## Saturday, November 26, 2011

### Understanding the DC Motor Part IV

The final part of understanding motor control is regarding control the position of the permanent magnet direct current motor. But this is applicable to the speed or torque. This control method is called the cascade control and it is inspired by the Faulhaber motion control module.

Again, the motor model is from Roger Asenstrup. All the parameters are from the model.

Motor Position Control with Single Loop PID

A simple position feedback using the angle feedback from the motor. Kp = 1, Ki = 0, Kd = 0.

 Figure 1. Position control with Kp = 1, Ki = 0, Kd = 0.

 Figure 2. Result from Figure 1

As seen from Figure 2, the Proportional only control is good enough to control the motor position.

But this is when the nonlinearity kicks in. In Figure 3, a dead zone was added to approximate the Coulomb friction. The value of dead zone is -0.1 to 0.1 volts.
 Figure 3. P control (Kp = 1) with dead zone

 Figure 4. Result from Figure 3

Figure 4 shows the result with the presence of dead zone. The motor position will not converge to desired value of position. One method to solve this is to use proportional and integral control (PI control).
 Figure 5. PI control (Kp = 1, Ki = 3) with dead zone

After applying the PI control, the value will converge to the desired value slowly, shown in Figure 5.

Saturation Problem

Using PI control is not good for saturation problem. It will cause the error to integrate really quickly and causing a large overshoot.
 Figure 6. PI control (Kp = 1, Ki = 3) with dead zone and saturation

 Figure 7. Result of Figure 6.

As seen from Figure 7, the motor will overshoot due to integration of the saturation.

To solve the problem, a cascade controller was proposed. The position error will be fed into a PID with velocity feedback.
 Figure 8. Position P Control (Kp = 5) cascade with Velocity P Control (Kp = 3)

 Figure 9. Result of Figure 8

From Figure 9, seems that the performance of the motor position control has improved although the reaching time is slower. Even with presence of dead zone, and saturation, the control still be able to perform well.

Motor Driver Current Problem

There is another problem to address, which is the motor current. The current is needed to drive the torque of the motor. If the simulation in Figure 8 was modified (Figure 10) to include motor current plot, it can be seen in Figure 11 that the motor current can spike at more than 5 Ampere.

 Figure 10. Modified to include motor current plot

 Figure 11. Same result as Figure 9, zoomed

Another loop of PID was used to control the motor current. In this strategy, only integral control (I control) was used. In other word, the overall system is Proportional (Position) - Proportional (Velocity) - Integral Control (Current).

 Figure 12. Position P Control (Kp = 5) cascade with Velocity P Control (Kp = 3) cascade with Current Integral Control (Ki = 1)

 Figure 13. Result from Figure 12

After adding the current controller, the performance is quite similar to the controller without it, in Figure 9.

But notice the peak current was reduced from more than 5 A to 0.57 A.

Concluding Remark

This concludes the "Understanding the DC Motor" section. Although this is only simulation, application in the real motor is still far away. It includes the feedback sensor (like position, velocity and current) and the motor driver. Making the position control as a whole is not as easy as it seems. But if one do not understand the nature of motor, it is quite hard to start with.

Check out the full series

Part I
Part II
Part III
Part II, III - Interlude
Part IV