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

B7 - Introduction to Digital Control

• Why is Digital Control becoming more popular?


• Difference Equations
• Digital state Space Models
• Digital Step Responses
• Flow Charts
• Delay diagrams
Digital State Space Methods

u(k) y(t)
+
D/A System
-
+
A/D
-
Estimator
y(k)
K
x(k)
Advantages of Digital Control
• ADAPTABILITY
– can easily be reprogrammed if application changes without
changing the hardware
• REPEATABILITY
– components are unaffected by the environment
• SELF TUNING
– controllers can be time/environment dependent
Disadvantages of Digital Control
• SAMPLING
– Only seeing a snap shot of what the system is doing
• QUANTISATION
– Signals can only take specific values
• STABILITY PROBLEMS
– A stable system can become unstable by digitising
Sampling issues

y(k)

NB Looks like a digital first order response


Sampling issues

y(t)

But in practice is most definitely is not a first order system.


i.e. you can easily be fooled if your sampling time period is too long.
Difference Equations
• A difference equation is only valid at discrete points
in time
• In a digital controller these points in time are
governed by the sample interval that is set by the
clock
• A linear difference equation will be of the form

y(k) = -a1y(k-1) - ....- any(k-n) + b0 u(k) +b1u(k-1) + ....+ bnu(k-n)


Digital State Space Equations
x ( k + 1) = Fx ( k ) + Gu ( k )
y( k ) = Cx ( k ) + Du ( k )

 x1 ( k + 1)   f11 f12 f13   x1 ( k)  g11 g12 


 x ( k + 1)  =  f       u1 ( k) 
f f 23 x 2 ( k) + g 21 g 22 
 2   21 22     u 2 ( k) 
 x 3 ( k + 1)   f 31 f 32 f 33   x 3 ( k)  g 31 g 32 

 x1 ( k) 
 y1 ( k)   c11 c12 c13    d 11 d 12   u1 ( k) 
 y ( k)  =  c  
x 2 ( k) + 
   u ( k) 
 2   21 c22 c23   21 22   2 
d d
 x 3 ( k) 
Digital State Variable Time Responses
 x1 (k + 1)  0.6 0.1  x1 (k )  0.3 0 
 x (k + 1) = 0.2 0.7   x (k ) + 0.4u (k ) x (0) = 0 
 2    2     
 x (k ) 
y(k ) = 2 − 1 1  u (k ) = 1 for all k
 2 
x ( k )

k u(k) x1(k) x2(k) y(k) x1(k+1) x2(k+1)


0 1 0 0 0 0.3 0.4
1 1
2 1
3 1
4 1
5 1
Digital State Variable Time Responses
 x1 (k + 1)  0.6 0.1  x1 (k )  0.3 0 
 x (k + 1) = 0.2 0.7  x (k ) + 0.4u (k ) x (0) =  
 2    2    0 
 x (k ) 
y(k ) = 2 − 1 1  u (k ) = 1 for all k
 2 
x ( k )

k u(k) x1(k) x2(k) y(k) x1(k+1) x2(k+1)


0 1 0 0 0 0.3 0.4
1 1 0.3 0.4
2 1
3 1
4 1
5 1
Digital State Variable Time Responses
 x1 (k + 1)  0.6 0.1  x1 (k )  0.3 0 
 x (k + 1) = 0.2 0.7  x (k ) + 0.4u (k ) x (0) =  
 2    2    0 
 x (k ) 
y(k ) = 2 − 1 1  u (k ) = 1 for all k
 2 
x ( k )

k u(k) x1(k) x2(k) y(k) x1(k+1) x2(k+1)


0 1 0 0 0 0.3 0.4
1 1 0.3 0.4 0.2 0.52 0.74
2 1
3 1
4 1
5 1

Stop the video now and work out


y(2), x1(3) and x2(3)
Digital State Variable Time Responses
 x1 (k + 1)  0.6 0.1  x1 (k )  0.3 0 
 x (k + 1) = 0.2 0.7  x (k ) + 0.4u (k ) x (0) =  
 2    2    0 
 x (k ) 
y(k ) = 2 − 1 1  u (k ) = 1 for all k
 2 
x ( k )

k u(k) x1(k) x2(k) y(k) x1(k+1) x2(k+1)


0 1 0 0 0 0.3 0.4
1 1 0.3 0.4 0.2 0.52 0.74
2 1 0.52 0.74 0.3 0.686 1.022
3 1 0.686 1.022 0.35 0.8138 1.2526
4 1 0.8138 1.2526 0.375 0.91354 1.43958
5 1 0.91354 1.43958 0.3875 0.992082 1.590414
6 1 0.992082 1.590414 0.39375 1.054291 1.711706
7 1 1.054291 1.711706 0.396875 1.103745 1.809052
8 1 1.103745 1.809052 0.398438 1.143152 1.887086
9 1 1.143152 1.887086 0.399219 1.1746 1.94959
Digital State Variable Time Responses
 x1 (k + 1)  0.6 0.1  x1 (k )  0.3 0 
 x (k + 1) = 0.2 0.7  x (k ) + 0.4u (k ) x (0) =  
 2    2    0 
 x (k ) 
y(k ) = 2 − 1 1  u (k ) = 1 for all k
 2 
x ( k )

2
1.8
1.6
1.4
1.2 x1(k)
1 x2(k)
0.8 y(k)
0.6
0.4
0.2
0
0 2 4 6 8 10
NB strictly speaking this should be a
series of dots!
Sampling Time Period
Flow chart for a Set initial conditions

digital state space


no
model new sample?
yes

read u(k)

x ( k + 1) = Fx ( k ) + Gu ( k ) determine y(k)

y( k ) = Cx ( k ) + Du ( k ) output y(k)

determine x(k+1)

x(k) = x(k+1)
Drawing a delay diagram from a digital state
space model
• Draw n pure time delay blocks, z-1, in the middle of the page.
(Note n is the order of the system.)
• Let the output of each time delay be a state variable, xi (k).
• The input to each time delay will be the state variable
advanced by one time period, xi (k+1).
• Draw a summation block in front of each time delay.
• Using scalar blocks feedback the state variables to the
summers according to the equation, x(k+1) = Fx(k) + Gu(k).
• Using scalars and summers feedforward the state variables
to implement the equation, y(k) = Cx(k) + Du(k).
Delay Diagram from Digital State Space
 x1 (k + 1)  0.6 0.1  x1 (k)   0.3
 x k + 1)  =     +    u(k) 
 2( ) 0.2 0.7   x 2 (k)  0.4
 x1 (k) 
 y(k) =  2 −1  x (k) 
 2 
x1(k+1) x1(k)
z-1

x2(k+1) x2(k)
z-1
Delay Diagram from Digital State Space
 x1 (k + 1)  0.6 0.1  x1 (k)   0.3
 x k + 1)  =     +    u(k) 
 2( ) 0.2 0.7   x 2 (k)  0.4
 x1 (k) 
 y(k) =  2 −1  x (k)  0.6
 2 
+ x (k+1) x1(k)
1 z-1

0.1

x2(k+1) x2(k)
z-1
Delay Diagram from Digital State Space
 x1 (k + 1)  0.6 0.1  x1 (k)   0.3
 x k + 1)  =     +    u(k) 
 2( ) 0.2 0.7   x 2 (k)  0.4
 x1 (k) 
 y(k) =  2 −1  x (k)  0.6
 2 
+ x (k+1) x1(k)
1 z-1

+
0.2

0.1
+
x2(k+1) x2(k)
z-1
+
0.7
Delay Diagram from Digital State Space
 x1 (k + 1)  0.6 0.1  x1 (k)   0.3
 x k + 1)  =     +    u(k) 
 2( ) 0.2 0.7   x 2 (k)  0.4
 x1 (k) 
 y(k) =  2 −1  x (k)  0.6
 2 
+ x (k+1) x1(k)
+ 1 z-1
0.3
+
0.2
u(k)

0.1
+
+ x2(k+1) x2(k)
0.4 z-1
+
0.7
Delay Diagram from Digital State Space
 x1 (k + 1)  0.6 0.1  x1 (k)   0.3
 x k + 1)  =     +    u(k) 
 2( ) 0.2 0.7   x 2 (k)  0.4
 x1 (k) 
 y(k) =  2 −1  x (k)  0.6
 2 
+ x (k+1) x1(k)
+ 1 z-1
0.3 2
+
0.2 + y(k)
u(k)

0.1 +
+
+ x2(k+1) x2(k)
0.4 z-1 -1
+
0.7
Delay Diagrams to Digital State Space Models

• Arrange the diagram so that it only contains pure time delays,


scalars, and summers.
• Let the output of each time delay block, z-1, be a state
variable, xi(k). (NB the number of state variables is equal to
the number of time delays.)
• The input to each time delay will be the state variable
advanced by one time period, xi(k+1).
• Write down the state space model with blanks for the F, G, C,
and D matrices
• By inspection of the diagram fill in the blank spaces in the
matrices.
0.6

+ x (k+1) x1(k)
+ 1 z-1
0.3 2
+
0.2 + y(k)
u(k)

0.1 +
+
+ x2(k+1) x2(k)
0.4 z-1 -1
+
0.7
0.6

+ x (k+1) x1(k)
+ 1 z-1
0.3 2
+
0.2 + y(k)
u(k)

0.1 +
+
+ x2(k+1) x2(k)
0.4 z-1 -1
+
0.7

 x1 (k + 1)  0.6 0.1  x1 (k)   0.3


 x k + 1)  =     +    u(k) 
 2( ) 0.2 0.7   x 2 (k)  0.4
 x1 (k) 
 y(k) =  2 −1  x (k) 
 2 
0.6

+ x (k+1) x1(k)
+ 1 z-1
0.3 2
+
0.2 + y(k)
u(k)

0.1 +
+
+ x2(k+1) x2(k)
0.4 z-1 -1
+
0.7

 x1 (k + 1)  0.6 0.1  x1 (k)   0.3


 x k + 1)  =     +    u(k) 
 2( ) 0.2 0.7   x 2 (k)  0.4
 x1 (k) 
 y(k) =  2 −1  x (k) 
 2 
Summary of Lecture
• Digital control is easily implemented on the flight management
computer in software.
• Main advantage is that State Feedback can be self tuning.
– (Not covered at undergraduate level)
• Digital State Space Model is:

x ( k + 1) = Fx ( k ) + Gu ( k )
y( k ) = Cx ( k ) + Du ( k )

• Use either Excel or Matlab to determine the response of a digital state


space model
• Describe implementation of a digital state space model using a flow
chart or a delay diagram.

You might also like