Tagged: Motor control

Motor Control Tutorial (Part I)

 

After working on several motor control projects, I decided to write this article about PID controller. This article will tell how to implement control loops (PID loops) in software. The hardware part will come soon.

PID Controller

A PID (proportional-integral-derivative) controller is a generic controller widely used in control systems. It calculates the difference value between a given set-point and measured value and attempts to minimize the difference.

The terminology “PID” tells that it includes three terms. Each term has a different effect on the controlled system. Figure 1 shows a block diagram of a basic PID controller.

 

Figure 1 Basic PID Controller

The standard mathematic form is

The three terms are

Implementation of a PID controller in a MCU chip requires a discrete form however.

Where

 T is the sample period (sec).

 Ti is the integral period (sec).

 Td is the derivative period (sec).

Then the three terms finally become

Integrator Anti-windup

There are limitations in actuators. For a system that operates over a wide range of conditions, it may happen that the control variable reaches the actuator limits. When this happens, the feedback loop is broken. The integral term will build up since the error is nonzero. The controller output will become very large. When the control input changes, it may take a long time before the integrator and the controller output come back inside the saturation range. To avoid this situation, some anti-windup correction is need.

Below is one way to implement anti-windup in a conventional PID controller.

If the actuator is saturated, the error will decrease integrator and thus prevent windup.