# Control Systems/Controllers and Compensators

## §Controllers

There are a number of different standard types of control systems that have been studied extensively. These controllers, specifically the P, PD, PI, and PID controllers are very common in the production of physical systems, but as we will see they each carry several drawbacks.

## §Proportional Controllers

A Proportional controller block diagram

Proportional controllers are simply gain values. These are essentially multiplicative coefficients, usually denoted with a K. A P controller can only force the system poles to a spot on the system's root locus. A P controller cannot be used for arbitrary pole placement.

We refer to this kind of controller by a number of different names: proportional controller, gain, and zeroth-order controller.

## §Derivative Controllers

A Proportional-Derivative controller block diagram

In the Laplace domain, we can show the derivative of a signal using the following notation:

$D(s) = \mathcal{L} \left\{ f'(t) \right\} = sF(s) - f(0)$

Since most systems that we are considering have zero initial condition, this simplifies to:

$D(s) = \mathcal{L} \left\{ f'(t) \right\} = sF(s)$

The derivative controllers are implemented to account for future values, by taking the derivative, and controlling based on where the signal is going to be in the future. Derivative controllers should be used with care, because even small amount of high-frequency noise can cause very large derivatives, which appear like amplified noise. Also, derivative controllers are difficult to implement perfectly in hardware or software, so frequently solutions involving only integral controllers or proportional controllers are preferred over using derivative controllers.

Notice that derivative controllers are not proper systems, in that the order of the numerator of the system is greater than the order of the denominator of the system. This quality of being a non-proper system also makes certain mathematical analysis of these systems difficult.

### §Z-Domain Derivatives

We won't derive this equation here, but suffice it to say that the following equation in the Z-domain performs the same function as the Laplace-domain derivative:

$D(z) = \frac{z - 1}{Tz}$

Where T is the sampling time of the signal.

## §Integral Controllers

A Proportional-Integral Controller block diagram

To implemenent an Integral in a Laplace domain transfer function, we use the following:

$\mathcal{L}\left\{ \int_0^t f(t)\, dt \right\} = {1 \over s}F(s)$

Integral controllers of this type add up the area under the curve for past time. In this manner, a PI controller (and eventually a PID) can take account of the past performance of the controller, and correct based on past errors.

### §Z-Domain Integral

The integral controller can be implemented in the Z domain using the following equation:

$D(z) = \frac{z + 1}{z - 1}$

## §PID Controllers

A block diagram of a PID controller

PID controllers are combinations of the proportional, derivative, and integral controllers. Because of this, PID controllers have large amounts of flexibility. We will see below that there are definite limites on PID control.

### §PID Transfer Function

The transfer function for a standard PID controller is an addition of the Proportional, the Integral, and the Differential controller transfer functions (hence the name, PID). Also, we give each term a gain constant, to control the weight that each factor has on the final output:

[PID]

$D(s) = K_p + {K_i \over s} + K_d s$

Notice that we can write the transfer function of a PID controller in a slightly different way:

$D(s) = \frac{A_0 + A_1s}{B_0 + B_1s}$

This form of the equation will be especially useful to us when we look at polynomial design.

### §PID Tuning

The process of selecting the various coefficient values to make a PID controller perform correctly is called PID Tuning. There are a number of different methods for determining these values:[1]

1) Direct Synthesis (DS) method

2) Internal Model Control (IMC) method

3) Controller tuning relations

4) Frequency response techniques

5) Computer simulation

6) On-line tuning after the control system is installed

7)Trial and error

Notes:

1. Seborg, Dale E.; Edgar, Thomas F.; Mellichamp, Duncan A. (2003). Process Dynamics and Control, Second Edition. John Wiley & Sons,Inc. ISBN 0471000779

### §Digital PID

In the Z domain, the PID controller has the following transfer function:

[Digital PID]

$D(z) = K_p + K_i \frac{T}{2} \left[ \frac{z + 1}{z - 1} \right] + K_d \left[ \frac{z - 1}{Tz} \right]$

And we can convert this into a canonical equation by manipulating the above equation to obtain:

$D(z) = \frac{a_0 + a_1 z^{-1} + a_2 z^{-2}}{1 + b_1 z^{-1} + b_2 z^{-2}}$

Where:

$a_0 = K_p + \frac{K_i T}{2} + \frac{K_d}{T}$
$a_1 = -K_p + \frac{K_i T}{2} + \frac{-2 K_d}{T}$
$a_2 = \frac{K_d}{T}$
$b_1 = -1$
$b_2 = 0$

Once we have the Z-domain transfer function of the PID controller, we can convert it into the digital time domain:

$y[n] = x[n]a_0 + x[n-1]a_1 + x[n-2]a_2 - y[n-1]b_1 - y[n-2]b_2$

And finally, from this difference equation, we can create a digital filter structure to implement the PID.

## §Bang-Bang Controllers

Despite the low-brow sounding name of the Bang-Bang controller, it is a very useful tool that is only really available using digital methods. A better name perhaps for a bang-bang controller is an on/off controller, where a digital system makes decisions based on target and threshold values, and decides whether to turn the controller on and off. Bang-bang controllers are a non-linear style of control that this book might consider in more detail in future chapters.

Consider the example of a household furnace. The oil in a furnace burns at a specific temperature -- it can't burn hotter or cooler. To control the temperature in your house then, the thermostat control unit decides when to turn the furnace on, and when to turn the furnace off. This on/off control scheme is a bang-bang controller.

## §Compensation

There are a number of different compensation units that can be employed to help fix certain system metrics that are outside of a proper operating range. Most commonly, the phase characteristics are in need of compensation, especially if the magnitude response is to remain constant.

## §Phase Compensation

Occasionally, it is necessary to alter the phase characteristics of a given system, without altering the magnitude characteristics. To do this, we need to alter the frequency response in such a way that the phase response is altered, but the magnitude response is not altered. To do this, we implement a special variety of controllers known as phase compensators. They are called compensators because they help to improve the phase response of the system.

There are two general types of compensators: Lead Compensators, and Lag Compensators. If we combine the two types, we can get a special Lead-Lag Compensator system.

When designing and implementing a phase compensator, it is important to analyze the effects on the gain and phase margins of the system, to ensure that compensation doesn't cause the system to become unstable. phase lead compensation:- 1 it is same as addition of zero to open loop TF since from pole zero point of view zero is nearer to origin than pole hence effect of zero dominant.

The transfer function for a lead-compensator is as follows:

$T_{lead}(s) = \frac{s-z}{s-p}$

To make the compensator work correctly, the following property must be satisfied:

$| z | < | p |$

And both the pole and zero location should be close to the origin, in the LHP. Because there is only one pole and one zero, they both should be located on the real axis.

Phase lead compensators help to shift the poles of the transfer function to the left, which is beneficial for stability purposes.

## §Phase Lag

The transfer function for a lag compensator is the same as the lead-compensator, and is as follows:

[Lag Compensator]

$T_{lag}(s) = \frac{s-z}{s-p}$

However, in the lag compensator, the location of the pole and zero should be swapped:

$| p | < | z |$

Both the pole and the zero should be close to the origin, on the real axis.

The Phase lag compensator helps to improve the steady-state error of the system. The poles of the lag compensator should be very close together to help prevent the poles of the system from shifting right, and therefore reducing system stability.

The transfer function of a lead-lag compensator is simply a multiplication of the lead and lag compensator transfer functions, and is given as:

$T_{lead-lag}(s) = \frac{(s-z_1)(s-z_2)}{(s-p_1)(s-p_2)}.$
$| p_1 | > | z_1 | > | z_2 | > | p_2 |$