Introduction, The PID Controller, State Space Models: Automatic Control, Basic Course, Lecture 1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 39

Introduction, The PID Controller, State Space

Models
Automatic Control, Basic Course, Lecture 1

November 6, 2018
Lund University, Department of Automatic Control
Content

1. Introduction

2. The PID Controller

3. State Space Models

1
Introduction
The Simple Feedback Loop

Disturbances

r u y
Controller Process

• Reference value r
• Control signal u
• Measured signal/output y

The problem/purpose: Design a controller such that the output follows


the reference signal as good as possible

2
The Simple Feedback Loop

Disturbances

r u y
Controller Process

• Reference value r
• Control signal u
• Measured signal/output y

The problem/purpose: Design a controller such that the output follows


the reference signal as good as possible
Note on terminology: Process, Controlled system, Plant etc...
2
The Feedback Loop

Disturbances

r u y
Controller Process

• Reference value r
• Control signal u
• Measured signal/output y

The problem/purpose: Design a controller such that the output follows


the reference signal as good as possible despite disturbances and
uncertainties in process.
3
Find the Control Problem - 1

4
Find the Control Problem - 1

• Reference value - Desired temperature


• Control signal - e.g., power to the AC, amount of hot water to the
radiators
• Measured value - The temperature in the room

4
Find the Control Problem - 2

5
Find the Control Problem - 2

• Reference value - Desired speed


• Control signal - Amount of gasoline to the engine
• Measured value - The speed of the car

5
Find the Control Problem - 3

6
Find the Control Problem - 3

• Reference value - Number of bacterias


• Control signal - “Food” (sugar and O2 )
• Measured value - E.g., pH or oxygen level in the tank

6
Feedforward

Some systems can operate well without feedback, i.e., in open loop.

Disturbances

r u y
Controller Process

Examples of open loop systems?

7
Feedforward vs. Feedback

Benefits with feedback:

• Stabilize unstable systems


• The speed of the system can be increased
• Less accurate model of the process is needed
• Disturbances can be compensated
• WARNING: Stable systems might become unstable with feedback

8
Feedforward vs. Feedback

Benefits with feedback:

• Stabilize unstable systems


• The speed of the system can be increased
• Less accurate model of the process is needed
• Disturbances can be compensated
• WARNING: Stable systems might become unstable with feedback

Feedforward and feedback are complementary approaches, and a good


controller typically uses both.

8
The PID Controller
The Error

The input to the controller will be the error, i.e., the difference between
the reference value and the measured value.
e =r −y

r u y
Controller Process

New block scheme:

r e u y
+ Controller Process

−1
9
On/Off Controller

(
umax if e > 0
u=
umin if e < 0

umax

umin

Usually not a good controller. Why?

10
The P Part

Idea: Decrease the controller gain for small control errors.


P-controller: 
umax if e > e0


u= u0 + Ke if − e0 ≤ e ≤ e0


u
min if e < −e0

umax

u0

umin

e
−e0 e0

P-part comes from proportional (here affine) to the error e.


11
The P Part

Idea: Decrease the controller gain for small control errors.


P-controller: 
umax if e > e0


u= u0 + Ke if − e0 ≤ e ≤ e0


u
min if e < −e0

The control error


u − u0
e=
K
To have e = 0 at stationarity, either:

• u0 = u
• K =∞

11
The P Part

Idea: Decrease the controller gain for small control errors.


P-controller: 
umax if e > e0


u= u0 + Ke if − e0 ≤ e ≤ e0


u
min if e < −e0

The control error


u − u0
e=
K
To have e = 0 at stationarity, either:

• u0 = u (What if u varies?)
• K = ∞ (On/off control)

11
The I Part

Idea: Adjust u0 automatically to become u.


PI-controller:  Z t 
1
u(t) = K e(τ )dτ + e
Ti
Compared to the P-controller, now
Z t
K
u0 (t) = e(τ )dτ
Ti

At stationary e = 0 if and only if r = y .


PI controller achieves what we want, if performance requirements are not
extensive.

12
Example of integral action needed — mini-problem (5 min)

(a) Argue why there will be a stationary error if we just use P-control; i.e.,
u(t) = K · (href − h)?
(b) How will the stationary error change with the value of the gain K ?
K
(c) What happens if we add integral action with very small integral gain ?
Ti
Sketch the behaviour.
13
Answer mini-problem

Note: This is not a strict answer and you need to make reasonable
assumptions about the process yourself for this to hold.

(a) Argue why there will be a stationary value if we just use P-control; i.e.,
u(t) = K · (href − h)?
If h = href the control signal u(t) = K · (href − h) = 0 and the motor
shuts off/fan stops spinning and the ball will fall. The process will
finally settle to an equilibrium with a positive stationary error
e = href − h such that the corresponding control signal will keep the
ball at a fixed error (e) from the reference.
(b) How will the stationary value change with the value of the gain K ?
The control signal to the fan motor u = K · e is the product of the
gain and the error; for a higher gain K you can reach stationarity
with a smaller stationary error e.

14
Answer mini-problem, cont’d
K
(c) What happens if we add integral action with very small integral gain ?
Ti
Sketch the behaviour.

15
Answer mini-problem, cont’d
K
(c) What happens if we add integral action with very small integral gain ?
Ti
Sketch the behaviour.

Note how the height of the ball (slowly) approaches the desired reference
(as the integral part makes the control action increase as long as there is
an error).
See also separate simulink example/demo.

15
The D Part

Idea: Speed up the PI-controller by “looking ahead”/”predicting future”.


PID-controller:
 Z t 
1 de
u=K e+ e(τ )dτ + Td
Ti dt

e e Same P- and I-part


in both cases, but
very different be-
havior of error. The
I I derivative of e con-
P P
tains a lot of infor-
Time Time
t t mation to utilize.

• P acts on the current error,


• I acts on the past error,

16
The D Part

Idea: Speed up the PI-controller by “looking ahead”/”predicting future”.


PID-controller:
 Z t 
1 de
u=K e+ e(τ )dτ + Td
Ti dt

e e Same P- and I-part


in both cases, but
very different be-

D havior of error. The


I I derivative of e con-
P D P
tains a lot of infor-
Time Time
t t mation to utilize.

• P acts on the current error,


• I acts on the past error,
• D acts on the ”future”/predicted error.

16
State Space Models
State Space Models

Consider a linear differential equation of order n

d ny d n−1 y d nu d n−1 u
+ a1 + . . . + an y = b 0 + b 1 + . . . + bn u
dt n dt n−1 dt n dt n−1

For linear systems the superposition principle holds:

u = u1 =⇒ y = y1 and
u = u2 =⇒ y = y2 implies
u = c1 · u1 + c2 · u2 =⇒ y = c1 · y1 + c2 · y2

and vice versa; We can consider the output from a sum of signals by
considering the influence from each component.

17
State Space Models

Consider a linear differential equation of order n

d ny d n−1 y d nu d n−1 u
+ a1 + . . . + an y = b 0 + b 1 + . . . + bn u
dt n dt n−1 dt n dt n−1

For linear systems the superposition principle holds:

u = u1 =⇒ y = y1 and
u = u2 =⇒ y = y2 implies
u = c1 · u1 + c2 · u2 =⇒ y = c1 · y1 + c2 · y2

and vice versa; We can consider the output from a sum of signals by
considering the influence from each component.

Q: Why is this not true for nonlinear systems? Example?


17
State Space Models

Consider a linear differential equation of order n


d ny d n−1 y d nu d n−1 u
+ a1 + . . . + a n y = b0 + b1 + . . . + bn u
dt n dt n−1 dt n dt n−1

18
State Space Models

Consider a linear differential equation of order n


d ny d n−1 y d nu d n−1 u
+ a1 + . . . + a n y = b0 + b1 + . . . + bn u
dt n dt n−1 dt n dt n−1

An alternative to ONE differential quation of order nth is to write it as a


system of n coupled differential equations, each or order one.

18
State Space Models

Consider a linear differential equation of order n


d ny d n−1 y d nu d n−1 u
+ a1 + . . . + a n y = b0 + b1 + . . . + bn u
dt n dt n−1 dt n dt n−1

An alternative to ONE differential quation of order nth is to write it as a


system of n coupled differential equations, each or order one.

General State space representation:




 ẋ1 = f1 (x1 , x2 , ...xn , u)

 ẋ2 = f2 (x1 , x2 , ...xn , u)


...




 ẋn = fn (x1 , x2 , ...xn , u)

y = g (x1 , x2 , ...xn , u)
The last row is a static equation relating the introduced states (x) with
the input u, and the output y .
18
State Space Models

Consider a linear differential equation of order n


d ny d n−1 y d nu d n−1 u
n
+ a1 n−1 + . . . + an y = b0 n + b1 n−1 + . . . + bn u
dt dt dt dt

An alternative to ONE differential quation of order nth is to write it as a


system of n coupled differential equations, each or order one.
Linear state space representation:
ẋ1 a11 a12 a1n x1 b1
      


 ẋ1 = a11 x1 + ... + a1n xn + b1 u ẋ2 
 =
a21
 a22 a2n 
 x2  + b2  u
   

 ẋ2 = a21 x1 + ... + a2n xn + bn u
       

ẋn an1 an2 ann xn bn
...
x1
 



 ẋn = an1 x1 + ... + ann xn + bn u   x2 

 y = c1 c2 ... cn   + du

y = c1 x1 + c2 x2 + ... + cn x2 + du
xn

19
State Space Models

Consider a linear differential equation of order n


d ny d n−1 y d nu d n−1 u
n
+ a1 n−1 + . . . + an y = b0 n + b1 n−1 + . . . + bn u
dt dt dt dt

An alternative to ONE differential quation of order nth is to write it as a


system of n coupled differential equations, each or order one.
Linear state space representation:
ẋ1 a11 a12 a1n x1 b1
      


 ẋ1 = a11 x1 + ... + a1n xn + b1 u ẋ2 
 =
a21
 a22 a2n 
 x2  + b2  u
   

 ẋ2 = a21 x1 + ... + a2n xn + bn u
       

ẋn an1 an2 ann xn bn
...
x1
 



 ẋn = an1 x1 + ... + ann xn + bn u   x2 

 y = c1 c2 ... cn   + du

y = c1 x1 + c2 x2 + ... + cn x2 + du
xn

NOTE: Only states (x) and inputs (u) are allowed on the right hand side in
Eq.-system above (in f and g ) for it to be called a state-space representation!
19
State Space Models

u y
Process

Linear dynamics can be described in the following form

ẋ = Ax + Bu
y = Cx (+Du)

Here x ∈ Rn is a vector with states. States can have a physical


”interpretation”, but not necessary.
In this course u ∈ R and y ∈ R will be scalars.

(For MIMO systems, see Multivariable Control (FRTN10))

20
Example

Example
The position of a mass m controlled by a force u is described by

mẍ = u

where x is the position of the mass.

u
m

Introduce the states x1 = ẋ and x2 = x and write the system on state


space form. Let the position be the output.

21
Dynamical Systems

Continous Time Discrete Time


(sampled)
Linear This course Real-Time Systems / Signal proc.
(FRTN01) .
Nonlinear Nonlinear Control and
Servo Systems (FRTN05)

Next lecture: Nonlinear dynamics can be linearized.

22

You might also like