Skip to main content
Associate II
May 5, 2025
Question

How to control the power consumption of a motor using MCSDK

  • May 5, 2025
  • 1 reply
  • 568 views

Hello everyone!

I use these tools:

MCSDK V6.3.2 

CUBEMX V6.14.1

KEIL Compiler

I am curious about controlling the power consumption of a motor (instead of having set point for the motor's speed, we want to define this set point for power).

Is there any CHANCE to somehow implement a power consumption control loop in the firmware? Is there any API?

Could we customize and change the firmware's default control loop for speed and modify it in header files and source files of a project to work based on the power consumption?

What are your suggestions?

I hope you get the idea. Thanks ALL

 

1 reply

GMA
Technical Moderator
May 13, 2025

Hello @MotorHobbyist,

MC_GetAveragePowerMotor1_F is available (refer to mc_api.c file).
You can customize the FW, refer to License Agreement.

If you agree with the answer, please accept it by clicking on 'Accept as solution'.Best regards.GMA
Associate II
May 14, 2025

Hello dear @GMA 

Thanks for reply,

We'll definitely use the FW in compliance with the License. 

could you please see the shot I attached? Is this the right place to modify and customize the FW?

I know that for the F0 series, the fixed-point arithmetic is used for computational purposes.

Using MC_GetAveragePowerMotor1_F returns power in Watts. I suppose I should change the unit here, please correct me if I am mistaken.

How can we force the FW not to increase the torque ref. too much? I guess if I do not apply limitation, when motor is unloaded and the power set point is greater than the current power consumption, the firmware increases Iq current aggressively making my motor unstable.

Could you please walk me through?

I really recommend st to add the power consumption control loop, it is taking root nowadays, at least in my country

Regards!  

 

GMA
Technical Moderator
May 14, 2025

Hello @MotorHobbyist,

Did you try by using Torque Mode on Control mode? You will set the maximum Iq reference and then it will limit power consumption.

GMA_0-1747210868393.png

 

If you agree with the answer, please accept it by clicking on 'Accept as solution'.Best regards.GMA