# Control Systems

- A control system contains processes with the purpose of obtaining a desired output given a specific input
- For example, consider a lift which rises from the ground to fourth floor:
- Pressing the button is a step input
- The lift rising is a transient response

- Two major performance measures
- Steady-state error
- Transient response

- Open loop control system configurations have an input that feeds directly into an output
- Cannot compensate for any disturbance

- Closed loop system feed the output signal back into the controller by subtracting it from the input
- Error drives controller to make corrections

General closed loop feedback control:

To design control systems, a system model is often needed. There are two general approaches:

- From first principles
- Uses known physical properties and laws (newton's laws, kirchhoff's laws, etc)

- Data-driven
- Identifies the system based on data collected

- Models usually take the form of a differential equation which describes the systems dynamics
- Used for simulation, control design, reference tracking, disturbance rejection, etc

## Transfer Functions

Transfer functions give a ratio of output to input for a system.

Consider an $n$th order linear differential equation, where $c(t)$ is the output, $r(t)$ the input, and $a_{i}$ and $b_{i}$ are the model parameters:

$a_{n}dt_{n}d_{n}c(t) +a_{n−1}dt_{n−1}d_{n−1}c(t) +...+a_{0}c(t)=b_{m}dt_{m}d_{m}r(t) +a_{m−1}dt_{m−1}d_{m−1}r(t) +...+b_{0}r(t)$

Taking laplace transforms an putting into a ratio of input over output:

$G(s)=R(s)C(s) =a_{n}s_{n}+a_{n_{−}1}s_{n−1}+...+a_{0}b_{m}s_{m}+b_{m_{−}1}s_{m−1}+...+b_{0} $

- The transfer function of multiple systems $G(s)=G_{1}(s)G_{2}(s)G_{3}(s)$
- Working with transfer functions is easier than ODEs as it they don't involve any differentials.

### Example

Given the transfer function $G(s)=s+21 $, find the response to a unit step input $r(t)=u(t)$:

$C(S)=s+2R(s) $

Transfer function of the step input $R(s)=s1 $, so:

$C(S)=s+21 s1 =2s1 −2(s+2)1 $

Taking inverse laplace transforms:

$c(t)=(21 −21 e_{−2t})u(t)$

## Modelling

Two approaches to modelling a system:

- Physical modelling
- Data-driven modelling

Models are developed so we can obtain transfer functions for further system analysis. Focusing on mainly how to build physical models of systems from first principles, there are three main steps:

- Structuring the problem
- Intended use of the model
- Inputs/outputs
- Other parameters
- How do subsystems interact
- Draw a block diagram

- Formulate the basic equations
- Describe relationships between variables
- Write down conservation laws
- Write down relevant relationships

- Formulate the ODE
- Express time derivatives of relevant variables
- Express outputs as function of inputs

There are two main physical systems relevant to this module, electrical, and rotational mechanical. The properties of the main components of these systems are shown in the tables below:

### Rotational Systems

In a rotational system, we are interested in the relationship between applied torque and angular displacement. The sum of the applied torque is the sum of the moments of all the components. For example, obtain the equations of motion for the system shown:

The system has an input torque at $θ_{1}$, two inertias $J_{1}$ and $J_{2}$, the two bearings act as dampers $D_{1}$ and $D_{2}$, and the torsion acts as a spring $K$:

For inertia $J_{1}$:

$Kθ_{1}(t)+D_{1}θ˙_{1}(t)+J_{1}θ¨_{1}(t)−Kθ_{2}(t)=T(t)$

And for $J_{2}$:

$Kθ_{2}(t)+D_{2}θ˙_{2}(t)−J_{2}θ¨_{2}(t)−Kθ_{1}(t)=0$

Note that for both these equations the form is [sum of impedances connected to motion] - [sum of impedance between motions] = [sum of applied torque at motion]. This general form can be applied to any rotational (or electrical) modelling problem.

### Electrial Systems

Obtain the voltage-current relationship of the following electrical system:

Using KVL for loop 1:

$LdtdI_{1}(t) +R_{1}I_{1}(t)−LdtdI_{2}(t) =V(t)$

And loop 2:

$LdtdI_{2}(t) +R_{2}I_{2}(t)+C1 ∫_{0}I_{2}(τ)dτ−LdtdI_{1}(t) =V_{c}(t)$

Again, noting that the form of the equation is the same as rotational: [sum of impedances around loop] - [sum of impedance between loops] = [sum of applied voltage]

## Block Diagram Algebra

A subsystem can be represented as a block with an input,output, and transfer function. Multiple blocks are connected to form systems, which involve summing junctions and pickoff points:

There are a few familiar forms that always pop up in block diagrams, that can be reduced down into simpler blocks:

### Cascade Form

In a cascade form, each signal is the product of the input and the transfer function. The transfer functions of blocks in a cascade are multiplied to form a single function.

### Parallel Form

In a parallel form, there is a single input, and the output is the sum of the outputs of all the subsystems.

### Feedback Form

Feedback form is the most important form encountered in control systems:

This can be reduced to a single transfer function:

$R(s)C(s) =1±G(s)H(s)G(s) $

### Other Identities

Moving left past a summing junction:

Moving right past a summing junction:

Moving left past a pickoff point:

Moving right past a pickoff point:

### Example

The goal is to rearrange diagrams into familiar forms that can then be collapsed

Forming the equivalent parallel system:

Collapsing the cascade:

We now have a single transfer function that is the ratio of output/input for the entire system.

## Poles and Zeros

A system can be analysed to obtain time response characteristics

- Transient response is the initial response that takes place over a time before reaching steady state
- Steady state response is the final response of the system after the transient has diminished

Conside the general form of the transfer function:

$G(s)=(s+p_{1})(s+p_{2})…(s+p_{n})(s+z_{1})(s+z_{2})…(s+z_{n}) $

**Poles are the roots of the denominator**- The values of $s$ that make $G(s)$ infinite

**Zeros are the roots of the numerator**- The values of $s$ that make $G(s)$ zero

As $s=jω+σ$ is a complex number, poles and zeros can be plotted on an argand diagram. If $G(s)=s+5s+2 $, then the transfer function has a pole at $s=−5$ and a zero at $s=−2$:

To further analyse this transfer function, we can give it an input step to analyse it's step response. The overall transfer function is now given by:

$C(s)=s1 s+5s+2 =5s2 +5(s+5)3 $

$c(t)=52 +53 e_{−5t}$

This shows that:

- The pole of the input function generates the form of the forced response (constant term)
- Step input has a pole at the origin, which generates a step function at the output

- The pole of the transfer function generates the form of the natural response
- $s=−5$ gave the form $e_{−5t}$

- The pole of the real axis generates an exponential response of the form $e_{st}$
- The farther to the left a pole is, the faster the transient decays
- Poles to the right of the imaginary axis will generate unstable responses

- Zeros and poles generate amplitudes for both forced and natural responses

### Stability

- Stability is the most system specification in control design
- Unstable systems are useless
- The definition of stability used here is that of a linear time invariant system
- Any that can be represented as a transfer function

The response of any system can be expressed as the sum of it's forced and natural responses:

- A system is
**stable**if the natural response decays to zero as $t→∞$ - A system is
**unstable**if the natural response grows without bound ($→∞$) as $t→∞$ - A system is
**marginally stable**if the response is constant or oscillatory

The stability of a system is defined by the poles of it's closed loop transfer function:

- If the poles are all negative, the system is stable and decays exponentially
- An unstable system has at least one negative pole
- If a pole lies on the imaginary axis then the system is oscillatory

## Transient Response Characteristics

The output response of a system for any given input depends on it's order. First and second order systems respond differently to the same input.

### First Order

A first order system only has one pole. A general first order system with one pole and no zeros, subject to a unit step response:

$C(S)=R(S)G(S)=s1 s+aa =fracas(s+a)$

$c(t)=c_{f}(t)+c_{n}(t)=1−e_{−at}$

Note that there is only a single parameter, $a$ that describes the dynamics of this system.

- When $t=1/a$, then $c(t)≈0.63$
- This is the time constant, $τ$ of the system
- The time it takes for the step response to rise to 63% if it's final value
- The further the pole from the imaginary axis, the faster the transient response and the lower the time constant

- Rise time $t_{r}$ is the time for the response to go from 10% to 90%
- $t_{r}≈2.2/a$

- Settling time $t_{s}$ is the time for the response to reach, and stay within, 2% of it's final value
- $t_{s}≈4/a$

Often it is not possible to obtain the transfer function of a system analytically, so we can obtain a time constant and other system parameters from data/graphs. The graph below shows a first order step response:

$C(s)=s1 s+aKa $

The final value of the response is 0.72, so the time constant is where the response reaches roughly $0.63×0.72=0.45$, which is at about 0.13s. Hence $a=0.131 =7.7$. To find $K$, we can use the final value theorem:

$s→0lim sC(s)=s→0lim s1 s+aa =s(s+a)a =0.72⇒K=0.72$

### Second Order

A second order system exhibits a wider range of responses than first order. A change in parameter changes the shape of the response entirely. There are four kinds of 2nd order response:

**Overdamped** response has two poles $σ_{1}$ and $σ_{2}$, both on the real axis, which exhibit the combined exponential response of the two poles.

$c(t)=K_{1}e_{σ_{1}t}+K_{2}e_{σ_{2}t}$

**Underdamped** response has a conjugate pair of complex poles $−σ±jω$, with the real part exhibiting exponential response, and the imaginary part sinusoidal.

$c(t)=Ae_{−σt}cos(ωt−ϕ)$

**Undamped** response has two imaginary poles, $±jω$, exhibiting purely sinusoidal response.

$c(t)=Acos(ω−ϕ)$

**Critically damped** response has two repeated real poles, $−σ$, so exhibits an exponential response, and an exponential response multiplied by time:

$c(t)=K_{1}e_{−σt}+K_{2}te_{−σt}$

There are two other meaningful parameters of a 2nd order response:

**Natural frequency**$ω_{n}$ is the frequency of oscillation of the system with no damping**Damping ratio**$ζ$ is the ratio of exponential decay frequency to natural frequency

A general 2nd order transfer function is given by:

$G(s)=s_{2}+2ζω_{n}s+ω_{n}ω_{n} $

The damping ratio $ζ$ determines the characteristics of the system response:

There are additional metrics that describe the response:

**Settling time**$t_{s}=ζω_{n}4 $**Peak time**$t_{p}$ is the time required to reach the first or maximum peak of the response**Percentage overshoot**%$OS$ is the amount that the response overshoots the steady state value at it's peak, expressed as a percentage of the steady state value- Rise time cannot be trivially defined for a 2nd order system

$t_{p}=ω_{n}1−ζ_{2} π $

$OS=1c(t_{p})−1 ×100=exp(−1−ζ_{2} ζπ )×100$

The damping ratio can also be defined in terms of these parameters:

$ζ=−π_{2}+(ln(OS/100))_{2} ln(OS/100) $

#### Example

Find the damping ratio, natural frequency, damping characteristics, peak time, overshoot, settling time of:

$G(s)=s_{2}+15s+100100 $

$ω_{n}=100ζ=2×1015 =0.75$

As $0<ζ<1$, this is an underdamped system.

$t_{p}=101−0.75_{2} π =0.475t_{s}=10×0.754 =0.533$

$OS=exp(−1−0.75_{2} 0.75π )×100=2.84%$

## Steady State Response Characteristics

Steady state response is the final response of the system after the transient has diminished. The primary design focus with control systems is around reducing steady state error, the difference between the input and the output ($e_{ss}=r(t)−c(t)$). In the graph below, output 1 has zero error, while output 2 has finite steady state error. It is possible for a system to have infinite steady state error if it continues to diverge from the input.

For three different kinds of test input, the corresponding steady state errors are given as

Step input:

$e_{step}(∞)=1+lim_{s→0}G(s)1 =1+K_{p}1 $

Ramp input:

$e_{ramp}(∞)=1+lim_{s→0}sG(s)1 =K_{v}1 $

Parabolic input:

$e_{ramp}(∞)=1+lim_{s→0}s_{2}G(s)1 =K_{a}1 $

$K_{p}$,$K_{v}$, and $K_{a}$ are static error constants associated with different input types.

In order to acheive zero steady state error for a step input the denominator of $G(s)$ has to be 0 as $s→0$, which is only possible if $n≥1$ in the equation below:

$G(s)=s_{n}(s+p_{1})(s+p_{2})...(s+z_{1})(s+z_{2})... $

Meaning that there must be at least one pure integrator (multiple of $1/s$) present in $G(s)$. For ramp and parabolic input, the same applies for $n≥2$ and $n≥3$.

## PID Controllers

PID controllers are a control method that consits of a proportional, integral, and derivative of an error input $e(t)$:

$u(t)=K_{p}e(t)+K_{i}∫e(t)dt+K_{d}dtde(t) $

$E(s)U(s) =K_{p}+sK_{i} +sK_{d}$

PID controllers are widely used as they are robust, versatile, and easy to tune. The tuning parameters are the three constants, $K_{p}$, $K_{i}$, and $K_{d}$

- Increasing the proportional term increases the output for the same level of error
- Causes the controller to react harder to errors so will react more quickly but overshoot more
- Reduces steady-state error

- The inclusion of an integrator helps to eliminate steady-state error
- If there is a persistent error the integrator builds and increases the control signal to reduce the error
- Can make the system respond slower and be more oscillatory

- The derivative term allows the controller to anticipate error
- The control signal can become large if the error is sloping steeply upwards, irrelevant of magnitude
- Adds damping to the system to decrease overshoot
- Does not affect steady-state error

Rise time | Overshoot | Settling time | Steady-state error | |
---|---|---|---|---|

$K_{p}$ | Decrease | Increase | Small change | Decrease |

$K_{i}$ | Decrease | Increase | Increase | Decrease |

$K_{d}$ | Small change | Decrease | Decrease | No change |

### PID Tuning

Tuning a PID controller can be done easily if a model of the system can be derived, as then analytical techniques can be applied to determine the ideal parameters. If a model cannot be obtained, then an experimental approach is required. The **Ziegler-Nichols** method is one common approach. The three constants are determined based upon the transient response characteristics of a given system, and there are two different methods, both aiming to give less than 25% overshoot.

Note that for the Ziegler-Nichols method, integral and derivative gains are used, where $K_{i}=K_{p}/T_{i}$ and $K_{d}=K_{p}T_{d}$

- The first method involves experimentally obtaining a unit step input
- If the system involved neither an integrator, or dominant complex poles then the output will look like an s-shaped curve
- This is when this method applies
- If this method doesn't apply, the system likely has a built in integrator, and the 2nd method is needed

- The curve is characterised by two parameters, the delay time $L$ and time constant $T$:

The transfer function can then be approximated by:

$U(s)C(s) =Ts+1Ke_{−Ls} $

And the PID constants are set according to the following:

Controller type | $K_{p}$ | $T_{i}$ | $T_{d}$ |
---|---|---|---|

P | $T/L$ | $∞$ | 0 |

PI | $0.9T/L$ | $L/0.3$ | 0 |

PID | $1.2T/L$ | $2L$ | $0.5L$ |

For the second method:

- Set $T_{i}=∞$ and $T_{d}=0$. Using $K_{p}$ only
- Increase the constant to a critical value at which the output exhibits sustained oscillation
- If this does not happen for any $K_{p}$, this method is not applicable

- The critical gain, $K_{cr}$ and corresponding critical oscillation period $P_{cr}$ are experimentally determined
- These are then used to set the other constants as per the following:

Controller type | $K_{p}$ | $T_{i}$ | $T_{d}$ |
---|---|---|---|

P | $0.5K_{cr}$ | $∞$ | 0 |

PI | $0.45K_{cr}$ | $0.83P_{cr}$ | 0 |

PID | $0.6K_{cr}$ | $0.5P_{cr}$ | $0.125P_{cr}$ |

Sometimes further tuning is required beyond these two methods to fine-tune the parameters to gain a response suitable to the application.