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

EE 312/ lecture no.

3/ State Space modelling approach

University of Benghazi
Faculty of Engineering
Electrical and Electronic Engineering Department
----------------------------------------------------------------------------------------------------------------------------
Control systems EE312 Fall 2011/2012

Course Format and Assessment


The course will be delivered in 56 hours, with 4 home works. Final exam will be in Feb. 2012.
Course material will include handouts.
----------------------------------------------------------------------------------------------------------------------------
Instructor:
Dr. Awad Shamekh
----------------------------------------------------------------------------------------------------------------------------

Lecture no. (3) Date: 11/12/2011

Learning Outcomes of this lecture


The student will understand:
• The state space approach.
• Solution of the state equation.
• Converting between state space and transfer function techniques.

----------------------------------------------------------------------------------------------------------------------------
References:
- Modern control systems, R.C. Dorf
- Control systems Engineering, Norman Nise
- Linear control systems engineering, Morris Driels
---------------------------------------------------------------------------------------------------------------------------

Introduction
In the previous lectures block diagram and signal flow graph methods were presented
for system modeling. Although these two approaches are relatively straightforward,
they have certain disadvantages which can be summarized as:
• Applicable for linear systems.
• Initial conditions are neglected.
• Not easy to handle multivariable systems.
From these shortcomings, the state space technique looks an attractive dynamic
method for system modeling that can address effectively the mentioned
disadvantages. However this course will focus on linear systems.

State space model


A system can be represented in state space by the following equations:

1
EE 312/ lecture no. 3/ State Space modelling approach

&
X ( n×1) = A ( n×n ) X ( n×1) + B ( n× m ) u ( m×1) (1)
Y( l×1) = C ( l×n ) X ( n×1) + D ( l×m ) u ( m×1) (2)

Where
X state vector
&
X derivative of the state vector with respect to time
y output vector
u input or control vector
A system matrix
B input matrix
C output matrix
D feedforward matrix

Equation (1) is called the state equation and equation (2) is called the output equation.

Definition
State equations are a set of n simultaneous, first order differential equations with n
variables. Where the n variables to be solved are state variables.

Output equation is an algebraic equation that expresses the output variables 0f a


system as linear combinations of the state variables and inputs.

As an example, for a linear, time-invariant, second-order system with a single input


v(t), the state equations could take on the following form:

dx1
= a11 x1 + a12 x2 + b1v(t )
dt
dx2
= a 21 x1 + a 22 x2 + b2 v(t )
dt
Where x1 and x2 are the state variables. If there is a single output , the output equation
could take on the following form:

y = c1 x1 + c2 x 2 + d1v(t )
The choice of state variables for a given system is not unique. The requirement in
choosing the state variables is that they be linearly independent and that a minimum
number of them be chosen.

Example
Obtain the state space model for the circuit shown in the fig (1).

2
EE 312/ lecture no. 3/ State Space modelling approach

Solution
Current through the inductor and the voltage across the capacitor are taken as state
variables as follows:
1 dx 1 1
x1 = i = i L x 2 = vc =
C ∫ idt ⎯
⎯→ 2 = i = x1
dt C C
Apply KVL
di 1
dt C ∫
vi = iR + L + idt

or
dx1
vi = Rx1 + L + x2
dt
dx1 vi R x
= − x1 + 2 # (1)
dt L L L
dx 2 x1
= # (2)
dt dt
1
y = v c = ∫ idt = x 2 # (3)
C
From #(1)& #(2) the state equations can be constructed as:
⎡ dx1 ⎤ ⎡ R 1⎤
⎢ dt ⎥ ⎢− L - ⎥ ⎡1⎤
L ⎡ x1 ⎤ ⎢ ⎥
⎢ ⎥=⎢ ⎥ ⎢ ⎥ + L vi
⎢ dx 2 ⎥ ⎢ 1 ⎢ ⎥
0 ⎥ ⎣ 2 ⎦ ⎣0 ⎦
x
⎢⎣ dt ⎥⎦ ⎢⎣ C ⎥⎦

and from #(3) the output equation can be formed as:


⎡ x1 ⎤
y = [0 1] ⎢ ⎥
⎣ x2 ⎦

3
EE 312/ lecture no. 3/ State Space modelling approach

State Space model from differential equations


The restriction that must be taken into account when it is desired to select the model
states is that no state variable can be chosen if it can be expressed as a linear
combination of the other state variables.

However, in n th differential equation model which is similar to the following


equation
dx1
= a11 x1 + a12 x 2 + ........... + a1n x 2 + b1 f (t )
dt

It is possible to say that the previous equation is a linear combination of the state
variables ( x1 , x 2 ,............, x n ) and the input function f (t ) .
An nth-order differential equation can be converted to n simultaneous first order
differential equations, as illustrated in the coming example:
d3y d2y d y
3
+ 6 2
+5 + 8y = u (4)
dt dt dt
To convert this model to a state space model let:
y = x1
dy dx1
= = x2
dt dt
d 2 y dx 2
= = x3
dt 2 dt
d 3 y dx3
=
dt 3 dt
Equation (4) can be re-arranged as:
d3y d y d2y
= u − 8 y − 5 − 6
dt 3 dt dt 2
Or
dx3
= u − 8 x1 − 5 x 2 − 6 x3
dt
Then the state space model can be constructed as:
& =
X AX + BU

4
EE 312/ lecture no. 3/ State Space modelling approach

⎡ dx1 ⎤
⎢ dt ⎥
⎢ ⎥ ⎡0 1 0 ⎤ ⎡ x1 ⎤ ⎡0⎤
⎢ 2 ⎥ = ⎢0 0 1 ⎥ ⎢ x ⎥ + ⎢0 ⎥ u
dx
⎢ dt ⎥ ⎢ ⎥ ⎢ 2⎥ ⎢ ⎥
⎢ ⎥ ⎢⎣- 8 - 5 - 6⎥⎦ ⎢⎣ x3 ⎥⎦ ⎢⎣1 ⎥⎦
⎢ dx3 ⎥
⎢⎣ dt ⎥⎦

The general form of a state space model of an n th order differential equation might be
expressed as follows:
dny d n −1 y d n−2 y dy
n
+ a1 n −1 + a 2 n − 2 + − − − − + a n −1 + a n y = ku
dt dt dt dt
Let
y = x1
dy dx1
= = x2
dt dt
d 2 y dx 2
= = x3
dt 2 dt
M
d n y dx n
= n
dt n dt

& =
X AX + BU
⎡ dx1 ⎤
⎢ dt ⎥
⎢ ⎥ ⎡0 1 0LL 0 ⎤ ⎡ x1 ⎤ ⎡0 ⎤
⎢ dx 2 ⎥ ⎢0 0 1 0L 0 ⎥ ⎢x ⎥ ⎢ ⎥
⎢ dt ⎥ = ⎢ ⎥ ⎢ 2 ⎥ + ⎢0 ⎥ u
⎢ ⎥ ⎢LLLLLLLL ⎥ ⎢M ⎥ ⎢M ⎥
⎢M ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥
⎢ dx n ⎥ ⎣− a n − a n −1 LL − a1 ⎦ ⎣ x n ⎦ ⎣k ⎦
⎢ ⎥
⎣ dt ⎦

The output equation is expressed as:


y = CX + DU

5
EE 312/ lecture no. 3/ State Space modelling approach

⎡ x1 ⎤
⎢x ⎥
y = 1 0 0 0 L 0 ⎢ 2 ⎥ + [0] u
[ ]
⎢M ⎥
⎢ ⎥
⎣ xn ⎦

Converting a transfer function with a constant term in


numerator to a state space model

Example
Find the state space representation in phase form for the transfer function shown in
the following figure.

Solution
Step 1: find the associated differential equation, since

C(S) 24
= 3
R(S) S +9S2 + 26S + 24

Apply cross multiplying, which yields

( S 3 + 9 S 2 + 26S + 24) C ( S ) = 24 R( s )

The corresponding differential equation is found by taking the inverse Laplace


transform, assuming zero initial conditions.

6
EE 312/ lecture no. 3/ State Space modelling approach

&&& + 9 C&& + 26 C& + 24 C = 24 r


C
where :
x1 = C
x 2 = x& 1 = C& , x 3 = x& 2 = C&&
x& = C&&&
3

That leads to

dx1
= x&1 = 0 x1 + x 2 +0 x 3
dt
dx 2
= x& 2 = 0 x1 + 0 x 2 + x 3
dt
dx 3
= x& 3 = −24 x1 − 26 x 2 −9 x 3 + 24 r
dt
The output equation:

y = C = x1

In vector – matrix form

⎡x&1 ⎤ ⎡0 1 0 ⎤⎡x1 ⎤ ⎡ 0 ⎤
⎢x& ⎥ = ⎢0 0 1 ⎥⎢x ⎥ + ⎢ 0 ⎥ r
⎢ 2⎥ ⎢ ⎥⎢ 2 ⎥ ⎢ ⎥
⎢⎣x&3 ⎥⎦ ⎢⎣- 24 - 26 -9 ⎥⎦⎢⎣x3 ⎥⎦ ⎢⎣−24⎥⎦

7
EE 312/ lecture no. 3/ State Space modelling approach

⎡ x1 ⎤
y = [1 0 0 ]⎢⎢ x 2 ⎥⎥ + [0 ]u
⎢⎣ x 3 ⎥⎦
Notice that the third row of the system matrix has the same coefficients as the
denominator of the transfer function but negative and inverse order. Graphically the
system can be represented as in the Fig below.

8
EE 312/ lecture no. 3/ State Space modelling approach

Converting a transfer function with a polynomial in


numerator to a state space model
Find a state representation of the transfer function shown the following Fig.

Solution
Step 1:
Separate the system into cascade blocks as illustrated in the fig below. The first block
contains the denominator and the second block contains the numerator.

Step 2:
Find the state equation from the block containing the denominator as:

R( s)
X 1 (s) =
a3 S + a 2 S 2 + a1 S + a 0
3

Then

X 1 ( s )(a3 S 3 + a 2 S 2 + a1 S + a 0 ) = R ( s )
a3 S 3 X 1 ( s ) + a 2 S 2 X 1 ( s ) + a1 SX 1 ( s ) + a 0 X 1 ( s ) = R ( s )

Take Laplace inverse (assume the initial conditions equal zero):

9
EE 312/ lecture no. 3/ State Space modelling approach

a3&x&&1 + a 2 &x&1 + a1 x&1 + a 0 x1 = r


x1 = x1
dx1
x 2 = x&1 =
dt
d 2 x1
x3 = x& 2 = &x&1 =
dt 2
d 3 x1
&x3 = &x&2 = &x&&1 =
dt 3

The state equation then can be organized as follows:

dx1
= 0 x1 + 1x 2 + 0 x3 + 0r (1)
dt
dx 2
= 0 x1 + 0 x 2 + 1x3 + 0r (2)
dt
dx3 a a a 1
= − 0 x1 − 1 x 2 − 2 x3 + r (3)
dt a3 a3 a3 a3

This leads to the state equation in the matrix- vector form:

⎡ dx1 ⎤
⎢ dt ⎥ ⎡ ⎤ ⎡ x1 ⎤ ⎡ ⎤
⎢ ⎥ ⎢ 0 1 0⎥ ⎢⎢ ⎥⎥ ⎢ 0 ⎥
⎢ ⎥
⎢ ⎥ ⎢ ⎥
⎢ ⎥ ⎢ ⎥
⎢ dx ⎥ ⎢ ⎥
⎢ ⎥ ⎢ ⎥
⎢ 2⎥ = ⎢ 0 0 ⎥
1 ⎢ x2 ⎥ + ⎢ 0 ⎥ r
⎢ dt ⎥ ⎢ ⎥
⎢ ⎥ ⎢ ⎥⎢ ⎥ ⎢ ⎥
⎢ ⎥ ⎢ ⎥
⎢ ⎥ ⎢ a0 a1 a2 ⎥ ⎢ ⎥ ⎢ 1 ⎥
⎢ 3 ⎥ ⎢−
dx − − ⎥
⎢⎣ dt ⎥⎦ ⎣ a a a ⎦ ⎢⎣ x3 ⎥⎦ ⎢⎣ a3 ⎥⎦

Step 3:
Introduce the effect of the block with numerator. This should yield the output
equation as:

Y ( s ) = C ( s ) = (b2 S 2 + b1 S + b0 ) X 1 ( s )

d 2 x1 d x1
y (t ) = b2 2
+ b1 + b0 x1
dt dt
d x1 d 2 x1
y (t ) = b0 x1 + b1 + b2
dt dt 2
y (t ) = b0 x1 + b1 x 2 + b2 x3

In the matrix-vector notation:

10
EE 312/ lecture no. 3/ State Space modelling approach

⎡ x1 ⎤
y = [b0 b1 b2 ] ⎢ x ⎥ + [0]r
⎢ 2⎥
⎢⎣ x3 ⎥⎦

Remark:
9 From another perspective, the denominator of the transfer function yields the
state equation while the numerator yields the output equation.

Example:
In the above block diagram if:
b2 = 1, b1 = 7, b0 = 2
a3 = 1, a 2 = 9, a1 = 26, a0 = 24

obtain the state space equations and plot the block diagram that represents the state
space model of the given transfer function.

Solution

The state equation:


⎡ dx1 ⎤ ⎡ 0 1 0⎤ ⎡ x1 ⎤ ⎡ 0⎤
⎢ dt ⎥ ⎢ ⎥⎢ ⎥ ⎢ ⎥
⎢ ⎥ ⎢ ⎥⎢ ⎥ ⎢ ⎥
⎢ dx 2 ⎥ = ⎢ 0 0 1⎥ ⎢ x 2 ⎥ + ⎢ 0⎥ r
⎢ dt ⎥ ⎢ ⎥⎢ ⎥ ⎢ ⎥
⎢ ⎥ ⎢ ⎥⎢ ⎥ ⎢ ⎥
⎢ dx3 ⎥ ⎢
⎢⎣ dt ⎥⎦ ⎣− 24 − 26 − 9 ⎥⎦ ⎢⎣ x3 ⎥⎦ ⎢⎣ 1 ⎥⎦

The output equation:

⎡ x1 ⎤
y = [2 7 1] ⎢⎢ x 2 ⎥⎥ + [0] r
⎢⎣ x3 ⎥⎦

11
EE 312/ lecture no. 3/ State Space modelling approach

Converting from state space models to transfer function


models
Assume a state space model is given by:

X& = AX + BU (1)
Y = CX + DU (2)

™ Remember that the state space model denotes the internal structure of
modelling techniques

It is required to change this model to a transfer function representation.

™ Remember that the transfer function model represents the external model
approach.

To achieve that:

Take Laplace transform for eq. (1) & (2) assuming zero initial conditions as:

SX ( s ) = AX ( s ) + BU ( s ) (3)
Y ( s ) = CX ( s ) + DU ( s ) (4)

Solving for X(s) in eq. (3)

12
EE 312/ lecture no. 3/ State Space modelling approach

SX ( s ) − AX ( s ) = BU ( s )
X ( s )( SI − A) = BU ( s )
X ( s ) = ( SI − A) −1 BU ( s ) (5)

In this way the internal signal, X(s), is now absorbed by the input signal U(s).
Substitute eq. (5) into eq.(4). This produces

Y ( s ) = C ( SI − A) −1 BU ( s ) + DU ( s ) (6)
Y ( s)
Tf ( s ) = = C ( SI − A) −1 B + D (7)
U ( s)

Equation (7) is called the transfer function matrix.

Example:
Given the system defined by

⎡ 0 1 0⎤ ⎡10⎤
& ⎢
X =⎢ 0 0 1⎥ X + ⎢⎢0 ⎥⎥

⎢⎣− 1 − 2 − 3⎥⎦ ⎢⎣0 ⎥⎦

y = [1 0 0] X

Y ( s)
Find the transfer function Tf ( s ) = where U (s ) is the input and Y (s ) is the
U ( s)
output.
Solution

Find ( SI − A) as following:

⎡ S 0 0⎤ ⎡ 0 1 0⎤ ⎡ S −1 0 ⎤
⎢ ⎥ ⎢
( SI − A) = ⎢0 S 0⎥ − ⎢ 0 0 1⎥⎥ = ⎢⎢ 0 S − 1 ⎥⎥
⎢⎣0 0 S ⎥⎦ ⎢⎣− 1 − 2 − 3⎥⎦ ⎢⎣ 1 2 S + 3⎥⎦
To find ( SI − A) −1 :
9 Find the determinant of ( SI − A) , Δ
9 Find the cofactor of ( SI − A)
9 Take transpose of the cofactor matrix
9 Divide each element in the cofactor matrix by Δ

⎡ S −1 0 ⎤
det ( Δ ) of ( SI − A) = det ⎢⎢ 0 S − 1 ⎥⎥
⎢⎣ 1 2 S + 3⎥⎦

13
EE 312/ lecture no. 3/ State Space modelling approach

⎡+ − + ⎤
⎢S −1 0 ⎥⎥
Δ=⎢ = S ( S ( S + 3) + 2) − (−1)(1) + 0
⎢0 S −1 ⎥
⎢ ⎥
⎣1 2 S + 3⎦
Δ = S ( S 2 + 3S + 2) + 1
Δ = S 3 + 3S 2 + 2S + 1

Cofactor of ( SI − A) =

⎡ S −1 0 −1 0 S ⎤
⎢ − ⎥
⎢ 2 S+3 1 S+3 1 2 ⎥
⎢ −1 0 S 0 S −1 ⎥
⎢− − ⎥
⎢ 2 S+3 1 S+3 1 2 ⎥
⎢ ⎥
⎢ −1 0 S 0 S −1 ⎥

⎢ S −1 0 −1 0 S ⎥
⎣ ⎦

⎡ S ( S + 3) + 2 − (1) −S ⎤
⎢ ⎥
= ⎢+ ( S + 3) S ( S + 3) − (2S + 1)⎥
⎢ − (− S ) S 2 ⎥⎦
⎣ 1

Take the transpose of the cofactor matrix

T
⎡ S 2 + 3S + 2 −1 −S ⎤
⎢ ⎥
= ⎢ S +3 S 2 + 3S − (2 S + 1)⎥
⎢ 1 S S 2 ⎥⎦

⎡ S 2 + 3S + 2 S +3 1 ⎤
⎢ ⎥
= ⎢ −1 S 2 + 3S S ⎥
⎢ −S − (2S + 1) S 2 ⎥⎦

Now evaluate ( SI − A) −1 as:

⎡ S 2 + 3S + 2 S +3 1 ⎤
⎢ ⎥
⎢ −1 S + 3S
2
S ⎥
⎢ −S − (2 S + 1) S 2 ⎥⎦

Δ
This gives:

14
EE 312/ lecture no. 3/ State Space modelling approach

⎡ S 2 + 3S + 2 S +3 1 ⎤
⎢ ⎥
⎢ Δ Δ Δ ⎥
⎢ ⎥
⎢ ⎥
−1 S 2 + 3S S ⎥
( SI − A) = ⎢
−1

⎢ Δ Δ Δ⎥
⎢ ⎥
⎢ ⎥
⎢ −S − (2 S + 1) S2 ⎥
⎢ Δ Δ Δ ⎥⎦

Y ( s)
It is easy now to find Tf ( s ) = , recall equation no. (7), which provides:
U ( s)

Y ( s)
Tf ( s ) = = C ( SI − A) −1 B + D
U ( s)
⎡ S 2 + 3S + 2 S +3 1 ⎤
⎢ ⎥
⎢ Δ Δ Δ ⎥
⎢ ⎥
⎢ ⎥ ⎡10⎤
−1 S 2 + 3S ⎢0 ⎥ + [0]
= [1 0] ⎢
Y ( s) S ⎥
Tf ( s ) = 0 ⎢ ⎥
U ( s) ⎢ Δ Δ Δ⎥
⎢ ⎥ ⎢⎣0 ⎥⎦
⎢ ⎥
⎢ −S − (2S + 1) S2 ⎥
⎢ Δ Δ Δ ⎥⎦

⎡10⎤
Y ( s ) ⎡ S 2 + 3S + 2 S +3 1⎤ ⎢ ⎥
Tf ( s ) = =⎢ ⎥ 0
U ( s) ⎣ Δ Δ Δ⎦ ⎢ ⎥
⎢⎣0 ⎥⎦
Y ( s ) 10 ( S 2 + 3S + 2)
Tf ( s ) = =
U ( s) Δ

Since Δ = S 3 + 3S 2 + 2S + 1 then

Y ( s ) 10 ( S 2 + 3S + 2)
Tf ( s ) = =
U ( s ) S 3 + 3S 2 + 2 S + 1

15

You might also like