cancel
Showing results for 
Search instead for 
Did you mean: 

configuring speed and current regulation using ST tools

Christophe65
Associate III

Hello everyone,

I'm working on an application using a motor with a nominal speed of 1850 rpm and a nominal current of 4.1 A. The motor operates within a speed range of 300 to 800 rpm, and I'm looking to implement stable and efficient speed regulation.

I have already imported my project into MC Workbench and configured the following parameters:

 

Current configuration:

Speed sensing mode:

  • Speed Sensor Mode: Hall Sensor

Speed regulator:

  • Execution Rate: 1 ms
  • Target Speed: 648 rpm
  • Auto Calculate Kp & Ki: enabled
    • Kp ≈ 14.96
    • Ki ≈ 0.0105
  • Maximum speed error before fault: 3

Current regulators (Torque/Flux):

  • Execution Time: 50 µs
  • Control Mode: Speed control
  • Cut-off frequency: 6000 rad/s
  • Auto Calculate Torque/Flux Kp & Ki: enabled

Iq (Torque) Regulator:

  • Target: from speed regulator
  • Kp ≈ 7.62
  • Ki ≈ 0.326

Id (Flux) Regulator:

  • Target: 0 A
  • Kp ≈ 7.62
  • Ki ≈ 0.326

Modulation:

  • Selected modulation: None

PWM and current sensing:

  • PWM frequency: 20 kHz
  • Current sensing gain: 21
  • Measurement range: -15.71 A to +15.71 A

My questions:

  • Does this configuration seem suitable for stable regulation within my operating speed range (300–800 rpm)?
  • Is the automatic tuning of the Iq and Id current regulators sufficient, or should I manually adjust the gains to optimize performance?
  • Are there any recommendations to improve stability or accuracy at low speeds?

Thanks in advance for your feedback and suggestions!

5 REPLIES 5
STuser2
Senior II

My advice would be as a first step you should start running the motor in no load condition and reach the expected maximum speed.

For tuning of parameters, you can use the motor profiler. So, flashing the software and running the motor without any issues and check for proper sinusoidal currents will be first step. 

Christophe65
Associate III

Hello and thank you all for your help and feedback.

I’ve already profiled my motor using the Motor Profiler tool, and I’m able to run it in my application, currently without load. The motor operates within a speed range of 300 to 800 rpm.

I still need to make some adjustments to improve its responsiveness, especially during startup where I’m seeing position errors.
I plan to test the motor under load soon, but before that, I’d like to fully understand the configuration to ensure the motor reacts properly.

I’m considering increasing the maximum number of speed errors allowed before triggering a fault (currently set to 3) — could this be related to the startup issues I’m experiencing?

I’d also like to better understand the purpose of the following parameters in the Speed Regulator section of MC Workbench:

  • Execution Rate: 1 ms
  • Target Speed: 648 rpm

My questions:

  • What exactly does the Execution Rate represent? Is it the frequency at which the speed control loop is recalculated?
  • Is the Target Speed just a test value, or does it play a role in system behavior during startup or in gain calculation?

Thanks in advance for your insights!


@Christophe65 wrote:

I’m considering increasing the maximum number of speed errors allowed before triggering a fault (currently set to 3) — could this be related to the startup issues I’m experiencing?

Do not increase this, even if you increase there will not be much impact. If you are using your own custom board check for the Hall signals.

  • What exactly does the Execution Rate represent? Is it the frequency at which the speed control loop is recalculated?

 Yes this is the frequency at which speed loop is executed.

 

  • Is the Target Speed just a test value, or does it play a role in system behavior during startup or in gain calculation?

It is a default value the program considers before the actual speed value given by the speedrampmotor1

.MecSpeedRefUnitDefault     = (int16_t)(DEFAULT_TARGET_SPEED_UNIT),

__weak void MC_ProgramSpeedRampMotor1(int16_t hFinalSpeed, uint16_t hDurationms)
{
  MCI_ExecSpeedRamp(pMCI[M1], hFinalSpeed, hDurationms);
}

How to provide the Kp,Ki values is given in MCSDK documentation. The above is based on my knowledge. 

Hello,

Thank you for your support so far. My system is starting to be stable when running without load, which is encouraging.

:small_blue_diamond: Speed error issue during mechanical release

During my tests, I noticed that when I mechanically force the motor (for example, by braking or slightly blocking it), and then release it suddenly, a speed error is systematically triggered.

To investigate, I temporarily increased the number of allowed speed errors before triggering a fault to 100, but this had no effect on the behavior. I will lower this value back to 15, but I think the problem comes from somewhere else.

I would like to understand:

  • What could cause this speed error in such situations?
  • Could it be related to incorrect Hall sensor signal interpretation, low inertia, or a speed regulator configuration that is not robust enough?
  • Which parameters could be adjusted to make the system more tolerant and responsive in these conditions?

:small_blue_diamond: Asymmetric behavior due to the magnetic brake

My motor is equipped with a magnetic brake that is active in only one direction. In the future, if the system works correctly to regulate and maintain a stable speed of the door when descending, we plan to remove this brake.

For now, I am continuing my tests, but I have the impression that the system behaves differently depending on the direction of rotation, even though the PID values are identical for opening and closing.

I would like to know:

  • Is it normal for the system to react differently depending on the direction, even with identical parameters?
  • Could the magnetic brake disturb the regulation or introduce an asymmetric load that changes the regulator’s response?
  • Are there any recommendations to compensate for or neutralize this effect in the current configuration?

Thank you in advance for your insights!

Try to plot the below variable in cube monitor and verify if it is going in opposite direction of the expected direction

hAvrMecSpeedUnit

For example, if it is in general +Ve but suddenly it goes -Ve during the fault condition, this i have observed in my setup, so check that is condition, i am not sure what you are getting is the same scenario.