Вы находитесь на странице: 1из 47

Chapter 3

State Variable Models


Modeling


• Types of systems electric
mechanical
electromechanical


• Types of models I/O o.d.e. models
Transfer Function
State space models
I/O o.d.e. model: o.d.e. involving input/output only.
linear:
dn d n1 d
n
y  an1 n1 y    a1 y  a0 y
dt dt dt
dm d
 bm m u    b1 u  b0u
dt dt
where u: input
y: output
State space model:

General: State eq : x  f ( x, u )

Output eq : y  h( x, u )
for LTI sys:  x  Ax  Bu

 y  Cx  Du
where: u: input  x  Fx  Gu
y: output  y  Hx  Ju
x: state vector
A,B,C,D, or F,G,H,J are constant matrices
Other types of models:
Transfer function model (This is I/O model)
from I/O o.d.e. model, take Laplace
transform:
Ly(t )  Y (s),
d 
L  y (t )  sY ( s )
 dt 
 d2 
L  2 y(t )  s 2Y ( s), 
 dt 
d 
Lu(t )  U (s), L  u (t )  sU ( s )
 dt 
Then I/O model in L.T. domain becomes:
s nY ( s)  an1s n1Y ( s)    a1sY ( s)  a0Y ( s)
 bm s mU ( s)    b1sU ( s)  b0U ( s)

Y ( s) bm s m    b1s  b0
 n
U ( s) s  an 1s n 1    a1s  a0
denote
 H ( s ) or G ( s )
This is the T.F. model of the system.
∴T.F. H ( s) or G ( s)  Y ( s)
U ( s)
or
Y ( s)  H ( s)U ( s) or G ( s)U ( s)
i.e. output L.T. is eq. to input L.T. with gain H(s)
Why State-Variable Models

• Computer-aided analysis works better for state models than


the transfer function approach.

• State variable model provide more internal information about


the plant, allowing more complete control.

• Optimal (“best”) design procedures are mostly based on the


use of state-variable models.

• The state variable models are required for digital simulation.


System State Definition
The state of a system is defined as
The state of a system at any time t0 is the amount of information
at t0 that, together with all inputs for t  t0, uniquely defines the
behavior of the system for all t  t0.
State Equations Standard Form
System matrix State vector
x (t )  Ax (t )  Bu (t ) State equation
y (t )  Cx (t )  Du (t ) Output equation

u(t) = input vector = (r  1) vector of input functions


y(t) = output vector = (p  1) vector of defined outputs.

• x (t ) is the time derivative of x(t)


 x(t) is the state vector, an (n  1) vector of the states
 A is the system matrix, an (n  n) matrix of the coefficients
 B is an (n  r) input matrix where r is the number of inputs
 C = (p  n) output matrix
 D = (p  r) matrix representing direct coupling between the
input and output. (Usually Neglected)
Example – RLC Circuit

 The system has two state variables, the inductor current (i) and
the capacitor voltage (v).

 We can obtain the system equations by use of 1) mesh


analysis, 2) nodal analysis, or 3) mixed (both) analysis. We would
normally choose mesh analysis since there is only one mesh;
however, we have a new constraint – avoiding integrals.

 The results of each approach are given on the following page.


System Equations
Mesh Analysis Nodal Analysis Mixed
v1  v IN 1 t

di di t

 v IN  iR  L  v  0    1
R L 0
( v 1 v 2 )dt 0  v IN  iR  L  idt  0
dt dt C 0
1 t dv 2

dv   0 v 1 t
i  C 0

( v v )dt C
OUT  idt
2 1
dt L 0 dt
C 0

All three results are valid models but only the equations obtained
from the mesh analysis can be represented as state equations in
the standard form. The state equations are given below:
di R 1 1
  i  vc  vIN
dt L L L
dvc i

dt C
This form is frequently used in digital simulation.
di R 1 1
  i  vc  vIN
dt L L L
dvc i

dt C
State Equations
The state equations, in standard form, for the series RLC circuit
are:

 R 1
 i   L   i   1 
     L  vIN
L
  1
vc     vc 0
0  
 C 
i
y  0 1    0vIN  vc
vc 
Solution Using Transforms
vOUT(t) can be obtained by taking the inverse (with step input):
VIN ( s)
LC 1
VOUT ( s)  2 
s  R s 1 s( s  0.5  j 0.866)( s  0.5  j 0.866)
L LC

The solution for vOUT(t) will have the form


 ( 0.5  j 0.866) t  ( 0.5  j 0.866) t
vOUT (t )  V0  V1e  V2e
The constants V0, V1, and V2 are evaluated using partial fractions:
1
V0  1
(0.5  j 0.866)(0.5  j 0.866)
1
V1   0.5  j 0.2887
(0.5  j 0.866)(  j1.732)
1
V2   0.5  j 0.2887
(0.5 j 0.866)( j1.732)
vOUT (t )  1  e 0.5t cos(0.866t )  0.5774e 0.5t sin( 0.866t )
Formal Solution We may use the standard form directly:

The characteristic equation for a  i   


R 1
  i   1 
set of state equations is given by     1L L
     L  vIN
|I – A| where A is the system  vC   0  vC   0 
 C 
matrix, I is the identity matrix,
and the  values are the
eigenvalues. The matrix |I – A|
 R 1  R 1
is given by
1 0  L     s  
I  A     1
L
 1
L L

0 1   0   s
 C   C 
R 1
Taking the determinant of this matrix yields  I  A  2
   0
L LC

This agrees with the previous results (the denominator of the


transform).
State variable Modeling:

d2y dy
M 2 B  Ky  f (t )
dt dt
d2y dy
M 2
 B  Ky  f (t ) x1  x2
dt dt
1 Mx2  Bx2  Kx1  u
G (s)  K B u
Ms 2  Bs  K x2   x1  x2 
M M M
Let x1 (t )  y y  x1
dy (t ) dx(t )
x2 (t )    x1 (t )
dt dt  x1   0 1  x   0 
 x     K  B   x    1 u
1

dx2 (t ) d 2 y (t )  2   M M   2   M 
x2  
dt dt 2  x1 
y  1 0   0u
 x2 
Next slides consider general standard Transfer Function
Example: Consider the system described by the coupled differential equations

y1  k1 y1  k 2 y1  u1  k3u 2


y 2  k 4 y2  k5 y1  k6u1
u1 & u2 are inputs, y1 & y2 are outputs. ki ; i=1,….6 are system parameters.
Let x1  y1
x2  y1  x1
x3  y2
x 2   k 2 x1  k1 x2  u1  k3u 2
x3   k5 x2  k 4 x3  k6u1  x1   0 1 0   x1   0 0
 x    k  u1 
output equation  2  2  k1 0   x2    1 
k3   
 x3   0  k5  k 4   x3  k6 0  u2 
y1  x1
 x1 
y2  x3  y1  1 0 0   0 0  u1 
 y   0 0 1  x2   0 0 u 
 2  x    2 
Simulation Diagrams
Simulation Diagram of State Equation

Initial Conditions
x  Ax  Bu
y  Cx

U B
+ x X
C Y
+


x  Ax  Bu  solution
y  Cx response
b2 b1 b0
Y ( s) b2 s  b1s  b0
2  2 3
Y ( s) Y G
 3  s s s  
U ( s) s  a2 s 2  a1s  a0 U ( s ) 1  a2  a1  a0 U 1  GH
s s2 s3
Dividing each term by the highest order of s yields

is canonical form

 x1   0 1 0   x1   0
x    0 0 1   x2    0  u
 2     
 x3   a0 a1 a2   x3  1
 x1 
y   b0 b1 b2   x2    0 u
 
 x3 

Control canonical form block diagram.


Transfer Function to State-Space Conversion
Direct Decomposition

Y ( s) b2 s 2  b1s  b0
 3
U ( s) s  a2 s 2  a1s  a0
Decompose into two blocks as shown in Figure:
U (s) 1 W (s) Y ( s)
b2 s  b1s  b0
2
s 3  a2 s 2  a1s  a0

W ( s)  3
U ( s) Y (s)  b2 s 2W (s)  b1sW (s)  b0W (s)
s  a2 s 2  a1s  a0

s3W (s)  a2 s 2W (s)  a1sW (s)  a0W (s)  U (s)


Time-domain equations:

w  a2 w  a1w  a0 w  u (t ) y(t )  b2 w  b1w  b0 w


w has to go through three integrators to get w
Which gives Phase variable control canonical simulation diagram:

b2
b1
+ +
u (t ) w 1 w 1 w 1 w + y
x1 b0
- s x3 s x2 s
- -
a2
a1
a0
Signal flow graph similar to the Simulation diagram :

b2
b1
1 w s 1 w s 1 w s 1 w b0 1 y
u (t )
a2 x3 x2 x1
a1
a0

Control System Toolbox contains a set of functions for model


conversion:
G = tf(num, den)
[A, B, C, D] = tf2ss(num, den), [num, den] = ss2tf(A, B, C, D, 1)
Converts the system in transfer function form to state-space phase
variable control canonical form & vice versa
For list of all functions type help/control/control at MATLAB prompt
Example:
For the following transfer function:
Y (s) s 2  7s  2
G( s)   3
U ( s) s  9s 2  26s  24
(a) Draw the simulation diagram and find the state-space
representation of the above transfer function.
(b) Use MATLAB Control System Toolbox
[A, B, C, D] = tf2ss(num, den) to find the state model.
Sol: a) Draw the transfer function block diagram in cascade form
U ( s) 1 W (s) 2 Y ( s)
s  7s  2
s  9 s  26s  24
3 2

From this we have:


s3W ( s)  9s 2W ( s)  26sW ( s)  24W ( s)  U ( s) & Y ( s)  s 2W ( s)  7 sW ( s)  2W ( s)

or in time-domain w  9w  26w  24w  u & y  w  7 w  2w


Time-domain equations yield the following simulation diagram:

1
7
1 w s 1
w s 1
w s 1 w 2 1 y
u (t ) x3
9 x2 x1
26
24

For state equation, the state variables x1 (t ) , x2 (t ) and x3 (t )


are assigned to the output of each integrator from the right to the
left. Next an equation is written for the input of each integrator.
The results are:
x1  x2 x2  x3 x3  24 x1  26 x2  9 x1  u(t )
and the output equation is: y  2 x1  7 x2  x3
Hence, in matrix form
 x1   0 1 0   x1  0
x    0 0 1   x   0 u (t )
 2   2  
 x3   24 26 9  x3  1 

 x1 
y   2 7 1  x2 
 x3 
(b) Re-write the following statements:
num = [1 7 2]; den = [1 9 26 24];
[A, B, C, D] = tf2ss(num, den)
The result is:
A= B= C= D=
-9 -26 -24 1 1 7 2 0
1 0 0 0
0 1 0 0

Note that MATLAB assigns x1 to the output of the first integrator, and
x2 and x3 to the output of the second and third integrators.
Example:
b2 b1 b0 2 8 6
 2 3  2 3
C ( s) 2 s 2  8s  6 s s s  s s s
 3 
R( s ) s  8s 2  26s  6 1  a2  a1  a0 1  8  26  6
s s2 s3 s s2 s3
The form is:
is control canonical form
 x1   0 1 0   x1   0
x    0 0 1   x    0 r
 2    2  
 x3   6 26 8  x3  1
 x1 
y   6 8 2  x2   [0]r.
 
 x3 
System controllable but not observable. Why?
Ans: State model is based on control canonical form, this can be
confirmed by another method later.
b2 b1 b0
Y ( s) b2 s  b1s  b0
2  2 3
Y ( s) Y G
 3  s s s  
U ( s) s  a2 s 2  a1s  a0 U ( s ) 1  a2  a1  a0 U 1  GH
s s2 s3

called observer canonical

 X 1   a2 1 0  X 1  b2 
  
 X 2     a1 0 1  X 2    b1 u
 X 3   a0 0 0  X 3  b0 
 
 X1 
Y  1 0 0 X 2 
Observer canonical form block diagram.  X 3 
Control canonical form

 X 1   a2 1 0  X 1  b0 
 X 1   0 0   X 1  0   
 X    0
1
  X   0 u X   a 0 1   X    b u
 2 
0 1  2  1  2   1 
 2   
 X 3    a0  a1  a2   X 3  1  X 3    a0 0 0  X 3  b2 
 
 X1   X1 
Y  b0 b1 b2  X 2  Y  1 0 0 X 2 
   
 X3  X 3 
Controllable but not directly observable but not directly
observable controllable
s 1 s 1 1
G(s)   2 
(s  1)( s  3) s  4s  3 s  3

Control canonical Observer canonical

 0 1  0 0  3 1
x
  x   u x    x   u
 3  4 1 1  4 1
 x1   x1 
y  1 1  y  0 1 
x 2  x 2 
State space model to T.F. / block diagram
s.s.
 x  Ax  Bu

 y  Cx  Du
Take L.T. :
sX ( s)  AX ( s)  BU ( s) 1

Y ( s)  CX ( s)  DU ( s) 2
From sX(s)-AX(s)=BU(s)
1
sIX(s)-AX(s)=BU(s)
(sI-A)X(s)=BU(s)
X(s)=(sI-A)-1BU(s)
into 2 : Y(s)=C(sI-A)-1BU(s)+DU(s)
Y(s)=[C(sI-A)-1B+D] U(s)


G(s)= C(sI-A)-1B+D
is the T.F. from u to y
from 1 1
X ( s)  ( AX ( s)  BU ( s))
s
D

u(s) + x(s) + y(s)


1
B C
s +
+

A
Example
  0 1  0
 x    x   u
  2  3 1
 y  1 3x

D  0, C  1 3
0 1 0 
A  , B 
 2  3 1
G ( s )  D  C ( sI  A) 1 B
1
 1 0   0 1   0
 0  1 3 s    
 0 1   2  3  1
1
 s  1  0
 1 3  1
 2 s  3  
s  3 1 0
 1 3
1
s( s  3)  2   2 s  1
1
 1 3
1
s( s  3)  2  s 
1

1
1 3 
s( s  3)  2 s
3s  1 3s  1
  2
s( s  3)  2 s  3s  2
>> n=[1 2 3];d=[1 4 5 6];
>> [A,B,C,D]=tf2ss(n,d)

A=
• In Matlab: -4 -5 -6
1 0 0
0 1 0
>> A=[0 1;-2 -3];
>> B=[0;1]; B=
1
>> C=[1 3]; 0
>> D=[0]; 0

>> [n,d]=ss2tf(A,B,C,D) C=
1 2 3

n= D=
0 3.0000 1.0000 0

d= >> tf(n,d)
1 3 2 Transfer function:
s^2 + 2 s + 3
---------------------
s^3 + 4 s^2 + 5 s + 6
State Space Model

• For linear motion


– Define two state variables for each mass
– x1=position, x2 = velocity; x1 dot = x2
– x2 dot is acc and solve for it from Newton’s
• For angular motion
– Define two state variables for each rotating
inertia
– x1= angle, x2 = angular velocity; x1 dot = x2
– x2 dot is angular acc and solve for it from
Euler’s law
Example: car suspension
Suppose y(t) is measured
from equilibrium position
when gravity has set in.
So gravity is canceled by
spring force at eq. pos.
∴There are two forces on m:

f spring  k  elongation
 k  (y-r) opposing y
f damping  b  (y  r) opposing y
Quarter car suspension
Let x1  y, x2  y ; u  r.
Then : x1  x2
b k b k
x2  y   y  y  r  r
m m m m
b k b k
  x2  x1  r  u
m m m m
Problem :
One variable is neither state nor input : r
Solution :
b
Modify x2 to get rid of r. Let x2  y  r
m
b
Then : x1  y  x2  r
m
b b k k
x2  y  r   y  y  r
m m m m
2
b b k k
  x2  2 r  x1  u
m m m m

u
State space model in matrix form :
 b 
 1 

x  0 1   1
x  
   k 
b     m 2 u

   m
x      x   k b 
2 m 2
  2
m m 
 x1 
y  x1  1 0   0u
 x2 
State-Transition Matrix
• The state-transition matrix is defined as
a matrix that satisfies
• (t): state-transition matrix 
• x(0): initial state 

Properties of State-Transition Matrix
1)
2)
3)

(t2t1): the transition of the state from t = t1 to t = t2


when the inputs are zero.

4)
State-Transition Equation
• State equation:

• Output Equation:
Example
Example

Вам также может понравиться