You are on page 1of 22

ELEC2146

Electrical Engineering Modelling and Simulation

State Space

Dr Julien Epps
S2, 2011

Dr Julien Epps ELEC2146 Electrical Engineering Modelling and Simulation 1


Overview
 Motivation
 State space
– General form
– State equations in matrix form
– Converting from differential equation
– Converting to differential equation
– State space simulation diagram

Dr Julien Epps ELEC2146 Electrical Engineering Modelling and Simulation 2


Motivation
 What’s wrong with this ?
dMx dx dNy dy
y (t ) = bM M + ... + b1 + b0 x(t ) − a N N − ... − a1
dt dt dt dt

– Only handles a single input and a single output


 Some systems have multiple inputs and/or outputs
– Does not provide access to “internal” variables, only
input and output
 Sometimes we may be interested in these also
– Not very efficient for simulation
 Prefer first-order derivatives

Dr Julien Epps ELEC2146 Electrical Engineering Modelling and Simulation 3


State space form

dx1
= a11 x1 + a12 x2 + ... + a1n xn + b11u1 + b12 u 2 + ... + b1m u m
dt
dx2
= a21 x1 + a 22 x2 + ... + a2 n xn + b21u1 + b22 u 2 + ... + b2 m u m state
dt equations
M
dxn
= an1 x1 + an 2 x2 + ... + ann xn + bn1u1 + bn 2 u 2 + ... + bnm u m
dt
y1 = c11 x1 + c12 x2 + ... + c1n xn + d11u1 + d12 u 2 + ... + d1m u m
M output
equations
y p = c p1 x1 + c p 2 x2 + ... + c pn xn + d p1u1 + d p 2 u 2 + ... + d pm u m

Dr Julien Epps ELEC2146 Electrical Engineering Modelling and Simulation 4


State space form
 Inputs:
ui , i = 1,2,..., m
 Internal state variables:
xi , i = 1,2,..., n
– Together, these are the “state” of the system
 Outputs:
yi , i = 1,2,..., p

Dr Julien Epps ELEC2146 Electrical Engineering Modelling and Simulation 5


Matrix-vector state space form
 u1   x1   y1 
u  x  y 
u =  2 x =  2  2
y=
M M M
     
um   xn   y p 
 a11 a12 L a1n   b11 b12 L b1m 
a a L a  b b L b 
A =  21 22 2n 
B =  21 22 2m 
 M M M   M M M 
   
a a
 n1 n 2 L a nn  b b
 n1 n 2 L bnm 

 c11 c12 L c1n   d11 d12 L d1m 


c c  d d 
L c L d
C=
2n 
D=
21 22 21 22 2m 
 M M M   M M M 
   
c p1 c p 2 L c pn   p1 p 2 L pm 
d d d
Dr Julien Epps ELEC2146 Electrical Engineering Modelling and Simulation 6
Matrix-vector state space form

internal feedback
effect of input(s) on
and connection
internal states
derivative of x behaviour
wrt to t

x& = Ax + Bu
y = Cx + Du
effect of internal states effect of input(s) on
on output signal(s) outputs

Dr Julien Epps ELEC2146 Electrical Engineering Modelling and Simulation 7


Matrix-vector state space form

+
x& x
u B
+ ∫ dt C
+
y
+

Dr Julien Epps ELEC2146 Electrical Engineering Modelling and Simulation 8


Conversion from differential eqns
 Generally, select state variables as

– Capacitor voltages or inductor currents


 If analysing circuits directly into state space form
 Note that state variables can represent different physical
quantities (V, A)

– First-order derivatives of each other


 When converting from a differential equation(s)

Dr Julien Epps ELEC2146 Electrical Engineering Modelling and Simulation 9


Conversion from differential eqns
 Example: Circuit analysis → state space

dv 1  1   1 1
=  − v − i + is 
dt C  R  v& − RC − C  v   1 
 i& =  1    +  C  is
di 1
= v
   0   i   0 
dt L  L 
v 
– Note: i = [0 1]  + [0]is
 Output can be a state variable
i 
 One state variable is a voltage, one is a current

Dr Julien Epps ELEC2146 Electrical Engineering Modelling and Simulation 10


Conversion from differential eqns
 Example: Differential eqn → state space
d2y dy
2
+ 5 − 16 y = x
dt dt
dy
– Set x1 = y , x2 = = x&1
dt

 x&1   0 1   x1  0
 x&  = 16 − 5  x  + 1u
 2   2   

 x1 
y = [1 0]  + [0]u
 x2 

Dr Julien Epps ELEC2146 Electrical Engineering Modelling and Simulation 11


Conversion to differential eqns
1. Convert state space matrix-vector form
to system of equations
2. Substitute state equations into each
other until there are n differential
equations in just one state variable (and
any inputs)
3. Substitute these into the output
equations, to produce a single
differential equation for each pair of
input(s) and output(s)

Dr Julien Epps ELEC2146 Electrical Engineering Modelling and Simulation 12


Conversion to differential eqns
 Example
 1 1
− RC − C  1
A=  B = C  C = [0 1] D = [0]
1 0
 0   
 L 
dv 1 1 1
=− v − i + is
dt RC C C
di 1
= v
dt L
d 2i L di 1 1 d 2i 1 di 1 1
L 2 =− − i + is 2
+ + i= is
dt RC dt C C dt RC dt LC LC
Dr Julien Epps ELEC2146 Electrical Engineering Modelling and Simulation 13
Conversion to differential eqns
 Example
 − 1 − 2 1 5 0  0
A=  B=   C=  D= 
 − 3 0   0  0 4  0
dx1
= − x1 − 2 x2 + u
dt
dx2
= −3x1
dt
y1 = 5x1
y2 = 4x2

Dr Julien Epps ELEC2146 Electrical Engineering Modelling and Simulation 14


Conversion to differential eqns
&x&1 = − x&1 − 2 x&2 + u& = − x&1 − 2(−3x1 ) + u&
&x&&2 = −3&x&1 = −3(− x&1 + 6 x1 + u& )
= − &x&2 + 6 x&2 − 3u& → &x&2 = − x& 2 + 6 x2 − 3u
&y&1 = 5&x&1 = 5(− x&1 + 6 x1 + u& )
= − y&1 + 6 y1 + 5u&
&y&2 = 4 &x&2 = 4(− x&2 + 6 x2 − 3u )
= − y& 2 + 6 y2 − 12u

&y&1 + y&1 − 6 y1 = 5u&

&y&2 + y& 2 − 6 y2 = −12u

Dr Julien Epps ELEC2146 Electrical Engineering Modelling and Simulation 15


State space simulation diagram
 State space form is also convenient for
designing realisations of a system
– A more detailed version of the diagram in slide 8
 Step 1: Start with self-feedback

x& i xi
+ ∫ dt
+

aii

Dr Julien Epps ELEC2146 Electrical Engineering Modelling and Simulation 16


State space simulation diagram
 Step 2: Add feedback from other state
variables
ai1 x1

.
.
.
+
x& i xi
+ ∫ dt
+ +
aii
.
.
.

ain xn

Dr Julien Epps ELEC2146 Electrical Engineering Modelling and Simulation 17


State space simulation diagram
 Step 3: Connect internal states to inputs

u1 bi1 ai1 x1

. .
. .
. .
+
x& i xi
ui bii
+ ∫ dt
.
.
+ +
.
um bim aii
.
.
.

ain xn

Dr Julien Epps ELEC2146 Electrical Engineering Modelling and Simulation 18


State space simulation diagram
 Step 4: Connect internal states to outputs
+
c1i y1
+
+
.
.
.
+
x& i xi
∫ dt cli
+
yl
+ +

aii
.
.
.
+
cpi yp
+
Dr Julien Epps ELEC2146 Electrical Engineering Modelling and Simulation 19
State space simulation diagram
 Step 5: Connect inputs
d11
u1
. ++
. ci1 y1
. +
+
.
dli .
ui .
. ++
x& i xi
∫ dt
.
. cil yl
+
+ +

aii .
.
.
+
cip yp
+
++
dpm
um
Dr Julien Epps ELEC2146 Electrical Engineering Modelling and Simulation 20
State space simulation diagram
 Example:

− 1 0 0 1
A =  1 − 1 0  B = 0
 0 0 − 6 1

C = [1 − 1 2] D = [0]

Dr Julien Epps ELEC2146 Electrical Engineering Modelling and Simulation 21


State space simulation diagram
+ x&1 x1
1
∫ dt 1
+

-1

+
x& 2 x2
u ∫ dt -1 y
+

-1

x& 3 x3
1
+ ∫ dt 2
+

-6

Dr Julien Epps ELEC2146 Electrical Engineering Modelling and Simulation 22

You might also like