cancel
Showing results for 
Search instead for 
Did you mean: 

STSPIN32F0601 BASED MOTOR CONTROL ACCELERATIONA AND DEACCELERATION CODING

PPate.2
Associate III

Hello,

I have STSPIN32F0 Based Board for PMSM motor Drive. This Motor Works for Water Pump Application. we have Created 5 step in start up sequence using  MC workbench. Motor Rotate as per Profile upto start up sequence Complete. But as soon as Motor Switch to Close Loop it start to rotate on Full Speed Suddenly and that create problem in actual application for us(some time motor stall hear OR we receive Speed Feed Back error sometime). we need to set some acceleration time. after switching to close loop it will take some time to get high RPM. Also same thing we need when we send a STOP Command, Motor deaccelerate slowly and then Stop.

We can't find any solution we are trying from many days, Please let me know that how can i implement above function of acceleration and deacceleration in MC workbench Generated Code.

we are using sensor less FOC drive with single shunt measurement. 

I am using keil IDE for Coding..

 

Thanks

3 REPLIES 3
Gael A
ST Employee

Hello PPate.2,

Are you trying to achieve Speed Control, or Torque Control ?
If you are on Torque Control, then you are probably asking for a higher torque than the resistive torque applied to your drive. What happens is that your motor speeds up rapidly until that torque is reached. The only added resistive torque in that case will be friction, so most of the time the drive speeds up until max speed. In that case I can only recommend to lower the target torque until you reach the actual resistive torque, and behavior is satisfactory.

If you are on Speed Control, then that is probably an ramp issue, please make sure that your close loop target speed is relatively close to your switching speed threshold : OBS_MINIMUM_SPEED_RPM should be roughly similar from DEFAULT_TARGET_SPEED_RPM. Same goes for the end of your speed ramp target.

If none of this works, could you please send me your .stwb6 with your updated ramp so I can have a look. Also could you provide more information on your application, especially on the desired behavior of the drive.

If you agree with my answer, please consider accepting it by clicking on 'Accept as solution'.

Hope this will help,
Gaël A.

Hello @PPate.2,

On top of Gael's answer, let me add few additional comments.

I consider that you want to control your motor in speed mode.

As mentioned by Gael, to have a smooth transition between open and closed loop, Target speed must be close to the switching speed threshold if you do not apply any ramp (just start motor). In the workbench it means those values:

cedricH_0-1719416637673.png

and

cedricH_1-1719416735888.png

The advice is to limit the open loop at the good speed to guarantee a robust startup, but once the loop is closed, the speed regulator will try by default to reach the target speed in 0 second. So if the target speed value is far from the startup speed threshold, you will observe a huge acceleration as soon as the loop is closed.

This ramp can be overwritten by the Pilot if you select Execute speed ramp before pressing start motor button:

cedricH_2-1719417695754.png

Or in your application code, you can configure a ramp to accelerate from the switching speed threshold (set with the workbench) to the speed you want to achieve for your application.

The following code inserted in the main.c will configure the same ramp: reaching 3000 RPM into 3 seconds and start your motor just after the boot.

/* USER CODE BEGIN 2 */
MC_ProgramSpeedRampMotor1(RPM_2_SPEED_UNIT(3000), 3000);
MC_StartMotor1();
/* USER CODE END 2 */

Do not hesitate to have a look at our API documentation available from the Workbench (About->Documentation).

Regards

Cedric

Hello sir,

I am using motor in Torque Control mode.

Can you please guide me that how can I lower torque during open to close loop transition. How can i know that which is Optimal value of Torque that could give a best performance.

Here i have attached my code to review. please have a look and give a best possible solution.

thanks