PI Controller : Theory + Demo

### PI Controller : Theory + Demo

Simulation

Your browser does not support the HTML5 canvas tag.

The scope is clickable & draggable. More here.
Your browser does not support the HTML5 canvas tag.

Note: The simulator is not compatible with Internet Explorer 11 and below. Please use Chrome/Firefox/Safari instead.

Your browser does not support the HTML5 canvas tag.
Your browser does not support the HTML5 canvas tag.

How to run the simulation

Time Domain:

1. The PI controller consists of a proportional and integral components (Gain1 and Gain2/Integrator1). The load is the Transfer Function1.
2. Hit the "Run" button and observe the system response.
3. Modify the proportional and/or integral gains to observe the effect on steady-state error and dynamic response.

Frequency Domain:

1. The PI controller consists of a proportional and integral components (Gain1 and Gain2/Integrator1). The load is the Transfer Function1.
2. To see the closed-loop response, leave the feedback path closed (Gain3 = 1) and click on Perturb In/Perturb Out block. Hit "Bode Plot".
3. To see the open-loop response, open the feedback path (Gain3 = 0) and click on Perturb In/Perturb Out block. Hit "Bode Plot".
4. Observe the system dynamics in the frequency domain in the magnitude and angle Bode plots.

Proportional-Integral Control : Inductive Load Example The system above contains a proportional-integral controller driving an inductive load. For example, the load could be a motor winding or an MRI gradient coil.

The proportional-integral controller sets the output voltage of an amplifier.

The amplifier applies voltage across a coil L with parasitic resistance R.

Notice that for constant current refences, the steady-state current error is zero, even if the parasitic resistance R is non-zero (proportional controllers almost always have steady-state error, see this article : Proportional Controller: Theory and Demo).

The Proportional-Integral Controller

Quick Facts and Features:

1. Compensator increases the system order by one due to the additional pole; this helps control command following error.
2. Increased phase-lag at low frequencies (due to the pole at the origin).
3. Generally increased damping, rise time and settling time.
4. Reduced overshoot (overshoot can be controlled with the two controller gains).
5. Decreased system bandwidth (the addition of integration path allows for higher performance with lower corner frequency).
6. Not sensitive to high frequency noise (proportional gain can be reduced due to the existence of the integrator).
7. Acts as a low pass filter in certain conditions (below the cross-over frequency).
8. Improved system steady state response (zero steady-state error when the plant order is 1 and the command is constant).

Controller Structure

The controller consists of two paths:

1. Proportional path: Kp
2. Integral path: Ki/s

In very crude terms, one could say that the proportional path tends to react very quickly on error and the integral term tends to integrate the error such that the controller eventually produces control output that drives the current error to zero.

Now a bit more theory:

• The PI controller adds a pole and zero to the system. Since the load is at least of a first order, more complex (and possibly oscillating) dynamics will be seen by the system.
• The sum of the two controller paths is as follows: • Hence, the pole is located at origin (s = 0 rad/s) and the zero is located at -Ki/Kp rad/s. It is a left half-plane zero.
• Since the pole is located at the origin, one would expect -20 dB slope until the numerator zero kicks in at -Ki/Kp rad/s.
• The initial angle is -90 degrees due to the zero. When the numerator zero kicks in, the overall PI controller lag gradually shifts to 0 degrees.
• For the default values of Kp = 10 and Ki = 200, the zero is located at -20 rad/s.
• High frequency gain is determined by Kp only. Hence, for Kp = 10, the HF gain is 20 log10(10) = 20 dB.

The Web-based simulator allows one to check the controller transfer function independently - see the figures below.  The plant transfer function is very simple:

• Inductance L = 1 H
• Resistance R = 10 Ohm

Hence: • During steady-state (s = 0 rad/s), the gain is 1/10 or 20 log10(0.1) = - 20 dB.
• The corner frequency is located at 10 rad/s.

A simple perturbation of the load corroborates the findings above:  The Open-Loop Transfer Function

The design of control systems is typically done open-loop. Why is that? Dynamics are easier to see with open-loop. Let me elucidate.

With open-loop characteristics, there are two stability factors immediately available:

1. Phase margin (180 - the phase delay at 0 dB)
2. Gain margin (the gain at -180 degree phase delay)

When the feedback loop is closed, the loop-gain below the corner frequency is 0 dB. That is, the system follows the command without any error below the corner frequency.

The open-loop transfer function can be easily achieved by breaking the feedback path:  Based on the figure above, the phase margin (when the open-loop gain is 0 dB or 1) is a bit above 70 degrees (phase margin is calculated as 180 + phase at gain = 0 dB). This will result in a slight but likely tolerable overshoot. See the Time-domain section below or simply run the simulation.

The Closed-Loop Transfer Function

To obtain the closed-loop transfer function, simply place the perturbation output after the current command and the perturbation input at the output of the load transfer function (default locations).  The Time-domain Behavior

The system responds to a step command in approximately 100 ms, which suggests ~10 rad/s closed-loop bandwidth.

A small overshoot (~7%) can be observed as well. PI Compensator Design Tips & Tricks

• The DC gain of a PI compensator is infinite DC gain (see the open-loop characteristic and extrapolate on the left side). This means that there is no steady-state error (if the command is constant).
• In the digital domain, an accumulator approximates the integrator. Typically, backward-Euler approximation method is employed.
• The pole present in the plant is typically cancelled by the PI compensator zero. This results in a pole-zero cancellation and ideally a first-order system behavior: The plant pole is located at -10 rad/s.

The compensator is: The ratio of Ki/Kp must be 10. If that happens, the resulting open-loop system transfer function is that of a first-order system. Say we desire the cross-over frequency to be 100 rad/s. Hence: And: And indeed, this is the case:

See the open-loop transfer function - notice that the phase delay is 90 degrees (until very high frequencies where the simulation accuracy starts to decline).  The closed-loop corner frequency is 10 rad/s, as predicted: An Alternative Form of PI Controller

The following figure shows an alternative form of proportional-integral controller. Algebraically, both the original and the alternative forms are equal. However, the break frequency of the compensator in its alternative form is directly set by the integral gain as is shown in the Bode plots below (20 rad/s).  References

Version

Author(s)

TS/TH/NH #### Proportional Controller Implementation

In MatLab, DSPs, and FPGAs.

. #### Control System Block Diagram

The fundamentals of signal flow. #### System Modeling With Transfer Functions

Introduction to dynamic systems. #### Fourier Series Demo

It is all sine waves.