# Motor controller structure for constant torque starting and then switching to constant speed

I need to design a field-oriented-control (FOC) controller for a permanent magnet synchronous motor (PMSM) with position sensor. In the starting process where the motor goes from zero speed to rated speed, the controller should be able to control the motor to produce constant torque. After the motor reaches rated speed, the controller should controller the motor to maintain the speed even when the motor load varies in certain range. I know PMSM is normally controlled with a speed loop and Id/Iq loop, and Iq loop is the one that controls the torque. So, what would this controller look like or how different loops are used to realize such a motor control process? Is it like Iq controller only during starting process and then add the speed controller once it reaches rated speed? If yes, how to switch the Iq_ref smoothly from a constant value to the output of speed controller without causing a sudden change of motor torque?

The typical structure is, as you mention, a Id/Iq loop and a speed loop. However, you don't "switch between" them. Normally, the Iq-controller would take a requested torque as input (equivalent to a certain Iq), and control the motor to achieve this, using feedback from current sensors, while the speed-controller, would take a requested speed as input, and produce a torque-request as output.

You still need the torque-controller to control the motor, but now you can ask the outer conroller for a speed instead of a torque. The output of the speed-controller will typically be limited to be within the rated torque of the motor.

If I understand your goal correctly, you need to tune this system so that when the input to the speed-controller (the outer controller) steps from zero to the rated speed, the response of the motor (its step response) is smooth and controlled, without overshooting the speed, or overloading anything. After all, you will need to lower the torque request before you hit the required speed, otherwise you will overshoot. How early you need to lower it, is what the speed-controller will figure out.

How this tuning is done will depend on what kind of (mechanical) load the motor is driving, and how known the various parameters are.

Have a look on my answer to similar question.

What you describe is an ordinary FOC control loop made of cascaded loops: position, speed, torque.

In the starting process where the motor goes from zero speed to rated speed, the controller should be able to control the motor to produce constant torque.

Well, it is not perfectly constant in real world. $$\T=J\alpha\$$, so knowing the moment of inertia of the system and desired torque you have to accelerate the motor at calculated acceleration.

See, the speed $$\\Omega\$$ is differentiated to get the $$\\alpha\$$ and then multiplied by J to get the torque setpoint. The velocity controller just corrects the velocity error.

When the drive reaches the setpoint speed, then the speed controller output just sets the torque that is needed to overcome the load torque.

Is it like Iq controller only during starting process and then add the speed controller once it reaches rated speed?

Iq and Id are current controllers, they are always present and working.

If yes, how to switch the Iq_ref smoothly from a constant value to the output of speed controller without causing a sudden change of motor torque?

The speed controller and the feedforward path does it for you. Keep in mind that is up to you to ramp the velocity, possibly in S-shape and write the correct value for the J.

• thanks for the explanation. I understand the controller structure is a feedforward one, but my questions is: during motor starting from zero to rated speed while maintaining constant torque, the T=Jα should be enough to generate the ref value for the current loop. But the speed control loop also has output. If they are added together, won't it make the torque reference non-constant? Oct 13, 2021 at 3:02
• @roTor-roTor If you look closely on my block diagram, the velocity error is delayed with 1st order lag before entering the PI contoller. But even without it, the PI controller will settle at stable value, you could even omit the feedforward path if the exact timing is not required. As per torque reference, you shall not expect a completely flat value since there is also a friction involved. Oct 13, 2021 at 6:24
• does it mean even without the feedforward control branches, the speed control loop plus the Id/Iq control loop will be able to realize constant torque starting from zero to rated speed and then automatically change to constant speed control? Oct 14, 2021 at 16:28