Lecture 2

System models
• Time domain models
– High order ordinary differential equation model
– Contains only input variables, output variables, their
derivatives, and constant parameters
– Proper: highest output derivative order is greatest
– Highest order derivative of output = system order
n
n 1
d
d
d
y  an1 n1 y    a1 y  a0 y
n
dt
dt
dt
dm
d
 bm m u    b1 u  b0u
dt
dt
System models
• Time domain models
– State space model: state equation + output equation
– State equation: a set of 1st order diff eq on state
variables
– Output equation: output as function of state and input
 x  f ( x, u )

 y  g ( x, u )
– Linear systems:
 x  Ax  Bu

 y  Cx  Du
ODE model to State space model
dn
d n1
d
y  an1 n1 y    a1 y  a0 y  u
n
dt
dt
dt
Let x1  y, x2  y, x3  y, ...
Then x1  x2 , x2  x3 , x3  x4 , ...
1
0
0   x1  0 
 x1   0
x   0
  x  0 
0
1
0
d  2 
2  



 u
   
dt   
  
   
an 1   xn  1 
 xn   a0 a1 a2
y  [ 1 0 0 ... 0]x  [ 0]u
ODE model to State space model
m<n
d
d n 1
dn
When : n y  an 1 n 1 y    a1 y  a0 y
dt
dt
dt
d
dm
 bm m u    b1 u  b0u
dt
dt
d
dm
Let y  bm m z    b1 z  b0 z
dt
dt
d
d n 1
dn
z  an 1 n 1 z    a1 z  a0 z  u
Then :
n
dt
dt
dt
ODE model to State space model
Let x1  z, x2  z, x3  z , ...
We still have the same state equation:
1
0
0   x1  0 
 x1   0
x   0
  x  0 
0
1
0
d  2 
  2   u

   
dt   
  
   
an 1   xn  1 
 xn   a0 a1 a2
But the output equation will be:
dm
d
y  bm m z   b1 z  b0 z
dt
dt
 bm xm1   b1 x2  b0 x1
 [ b0
b1
... bm 0 ... 0]x  [ 0]u
Transfer Function
Transfer function from x to y is the gain from
X(s) to Y(s), that is, it is the ratio of
Laplace transform of y to Laplace transform of x :
Y ( s ) L  y (t ) 

 G ( s ),
X ( s ) L x(t )
Then : Y ( s )  H ( s ) X ( s )
or H ( s ), 
State space model to TF
 x  Ax  Bu
State space model : 
 y  Cx  Du
sX ( s )  AX ( s )  BU ( s )
take L : 
Y ( s )  CX ( s )  DU ( s )
( SI  A) X ( s )  BU ( s )
1
X ( s )  ( SI  A) BU ( s )
Y ( s )  [C ( SI  A) 1 B  D]U ( s )



H (s)
A, B, C, D are matrices
Input Output System
Input
x(t)
H(s)
Output
y(t)
– Y(s) = H(s)X(s)
– If the input x(t) = δ(t), the output is called the impulse
response.
– If the input x(t) = u(t), the output is called the step
response.
– If the input x(t) = Asin(wt), and H(s) is stable, output
steady state is A|H(jw)|sin(wt+H(jw))
– Poles: values of s at which TF  infinity
– Zeros: values of s at which TF = 0
Example: controller
E(s)
•
•
•
•
•
•
controller
C(s)
U(s)
Proportional controller: C(s) = KP =const
Integral controller: C(s) = KI/s
Derivative controller: C(s) = KDs
PI controller: C(s) = KP + KI/s
PD controller: C(s) = KP + KDs
PID controller: C(s) = KP + KI/s + KDs
From lecture 1:
Negative Feedback Control System
+
CONTROLLER
-
FEEDBACK
ELEMENT
+
+
CONTROLLED
DEVICE
Block Diagrams
•
•
•
•
x
y
G
A line is a signal
y = Gx
A block is a gain
+
x
s
Σ
+
A circle is a sum
s=x+z-y
y
z
Due to h.f. noise,
use proper blocks: num deg ≤ den deg
• Try to use just horizontal or vertical lines
– Use additional “ Σ ” to help
+
x
e.g.
s
+
+
-
y
z
Block Diagram Algebra
• Series:
x
G1
G2
y
x

G1 G2
y
• Parallel:
x
G1
G2
+
+
y

x
G1 + G2
y
• Feedback:
x
+
e
b
G1
y

x
G1
1  G1G2
y
G2
G1
y
x
1 G1G2
G1
x
• Proof: e  x  b, b  G2 y, y  G1e  y 
1  G1G2
e  x  G2G1e
1
(1  G1G2 )e  x  e 
x
1  G1G2
+
+
G1
G2
G1
1  G1G2
+
-
n1
d1
n2
d2
n1d 2
n1n2  d1d 2
>> s=tf('s')
Transfer function:
s
>> G1=(s+1)/(s+2)
Transfer function:
s+1
----s+2
>> G2=5/(s+5)
Transfer function:
5
----s+5
>> G=G1*G2
Transfer function:
5s+5
-------------s^2 + 7 s + 10
>> H=G1+G2
Transfer function:
s^2 + 11 s + 15
--------------s^2 + 7 s + 10
>> HF=feedback(G1, G2)
Transfer function:
s^2 + 6 s + 5
--------------s^2 + 12 s + 15
>> delay1=tf(1,1,'inputdelay',0.05)
Transfer function:
exp(-0.05*s) * 1
Step Response
0.9
0.8
0.7
0.6
Amplitude
>> H2=HF*delay1
Transfer function:
s^2 + 6 s + 5
exp(-0.05*s) * --------------s^2 + 12 s + 15
0.5
0.4
0.3
0.2
>> stepresp=H2*1/s
Transfer function:
s^2 + 6 s + 5
exp(-0.05*s) * ------------------s^3 + 12 s^2 + 15 s
0.1
0
>> step(H2)
0
0.5
1
1.5
Time (sec)
2
2.5
Quarter car suspension
Series
R(s)
+
bs  k
-
R(s)
+
-
R(s)
1
s
1
m
bs  k
ms 2
bs  k
ms 2  bs  k
1
s
y
y
Feedback
y
bs  k
TF  H ( s ) 
2
ms  bs  k
>> b=sym('b');
>> m=sym('m');
>> k=sym('k');
>> s=sym('s');
>> G1=b*s+k
G1 =
b*s+k
>> Gcl=G/(1+G)
Gcl =
(b*s+k)/m/s^2/(1+(b*s+k)/m/s^2)
>> G2=1/m*1/s*1/s
G2 =
1/m/s^2
>> simplify(Gcl)
>> G=G1*G2
G=
(b*s+k)/m/s^2
(b*s+k)/(m*s^2+b*s+k)
ans =
pick-up point
summation
• Move a block (G1) across a
into all touching lines:
– If arrow direction changes, invert block (1/G1)
– If arrow direction remains, no change in block
• For example:
along arrow
no change
along arrow
x
G1
z
G3
G2
x
y
G1
no change
G1
along arrow
along arrow
z
G3
G2
y
against, against
x
G1
z
G3
x
G1
z
G3
G2
against
along
G2
y
y
x
G1
G2
z
G3
1/G2
y

x

z
G1
G3
1/G3
G2
y
Find TF from U to Y:
I2
U
+
-
1
L1s  R1
I1
+
-
1
Cs
Vc
1
L2 s  R2
R2
• No pure series/parallel/feedback
• Needs to move a block, but which one?
Key: move one block to create pure series or
parallel or feedback!
So move
either left or right.
y
I2
U
1
L1s  R1
+
-
I1
+
-
+
1
L1s  R1
+
-
1
Cs
Vc
1
L2 s  R2
R2
1
L2 s  R2
R2
1
L2 s  R2
R2
y
L1s  R1
I2
U
-
1
Cs
Vc
y
L1s  R1
U
+
+
-
1
Cs( L1s  R1 )
y
L1s  R1
U
+
-
1
Cs( L1s  R1 )  1
1
L2 s  R2
R2
y
L1s  R1
U
U
+
-
1
Cs( L1s  R1 )( L2 s  R2 )  L2 s  R2
1
Cs( L1s  R1 )( L2 s  R2 )  L2 s  R2  L1s  R1
R2
R2
R2
T .F . 
Cs( L1s  R1 )( L2 s  R2 )  L2 s  R2  L1s  R1
y
y
Find TF from U to Y:
U
+
100
-
+
-
s 1
s2
2
s5
10
s ( s  20)
+
+
• No pure series/parallel/feedback
• Needs to move a block, but which one?
Key: move one block to create pure series or
parallel or feedback!
10
So move
either left or right.
s ( s  20)
Y
s ( s  20)
10
U+
100
+
-
U+
-
100
-
U+
-
100
-
+
s 1
s2
2
s5
+
10
s ( s  20)
10( s  1)
s( s  2)( s  20)
10(s  1)
s( s  2)(s  20)  10(s  1)
Y
+
s( s  20)
1
5( s  5)
s( s  20)
1
5( s  5)
+
Y
+
+
+
Y
Can use superposition:
First set D=0, find Y due to R
Then set R=0, find Y due to D
Finally, add the two component to get the overall Y
First set D=0, find Y due to R
G1G2
Y1 ( s ) 
R( s)
1  G1G2 H1
Then set R=0, find Y due to D
G2
G2
Y2 ( s) 
  D( s ) 
1  G1G2 H1
Finally, add the two components to get the overall Y
G1G2
G2
Y (s) 
R( s) 
D( s)
1  G1G2 H1
1  G1G2 H1