Linear State-Space Control Contents of the course

D
u(t)
x0
B
+ +
x(t)
∫
x(t)
C
+
y(t)
+
A
Linear State-Space Control
Gabriel Oliver Codina
Systems, Robotics & Vision Group
Universitat de les Illes Balears
G.Oliver, UIB
Contents of the course
► Introduction
► State-Space
Fundamentals
► Controllability and Observability
► (Stability)
► Design of Linear State Feedback Control Laws
► Observers and Observer-based Compensators
► Introduction to Optimal Control
G.Oliver, UIB
1
Objectives of the course
► State-Space
modeling of linear systems
► Time-domain and frequency-domain analysis of linear
systems
► Analysis and design of controllers and observers in the
S-S modeling of linear systems
► Introduction to optimal control
G.Oliver, UIB
Bibliography
► Linear
■
State-Space Control Systems
R. L. Williams & D. A. Lawrence. John Wiley & Sons, 2007
► Control
■
S. Domínguez et al. Prentice Hall, 2002
► Control
■
en el espacio de estado
Systems Engineering
N. S. Nise. John Wiley & Sons, 2004
G.Oliver, UIB
2
Introduction
► Analysis
and design of feedback control systems
■ Classical (frequency-domain) approach: converting a
system’s differential equation to a transfer function,
thus generating a mathematical model of the system
that algebraically relates a presentation of the output
to a representation of the input.
►
It can only be applied to LTI systems (or LTI approximations)
G.Oliver, UIB
Introduction
► Analysis
and design of feedback control systems
■ Modern
(state-space or time-domain) approach: is a
unified method for modeling, analyzing and designing
a wider range of systems, such as:
► Non linear systems (backlash, saturation, dead
zone)
► Nonzero initial conditions systems
► Time-varying systems (mass variable systems, …)
► Multiple-input, multiple-output systems
► Systems with digital computers in the loop
► Model systems for digital simulation
► Can also be used for the same class of systems
modeled by the classical approach
G.Oliver, UIB
3
Introductory example
►
Example 1: Find a state-space representation of the system shown in
the figure if the output is the current through the resistor.
L
iL(t)
v(t) +
-
■
■
iC(t)
iR(t)
R
C
Step 1 Label all the branch currents in the network: iC, iR, iL
Step 2 Select the state variables: write the derivative equation for
all energy-storage elements (L and C)…
C
dvc
= iC
dt
L
diL
= vL
dt
and choose the differentiated quantities as the state variables (vC , iL)
G.Oliver, UIB
Introductory example
■
Step 3 Write the right-had sides of “step 2” and the output equations as
linear combinations of the state variables and the input. Network theory
(Kirchhoff, etc.) will be used for the electric systems.
dvc
= iC = f1(vC , iL , v(t))
dt
di
L L = vL = f 2(vC , iL , v(t))
dt
C
State eq
dvc
1
= − RC
vC + C1 iL
dt
diL
= − L1 vC + L1 v(t )
dt
Output eq
iR = f 3 (vC , iL , v(t ))
iC = −iR + iL = − R1 vC + iL
vL = −vC + v(t )
iR = R1 vC
G.Oliver, UIB
4
Introductory example
■
Step 4 Obtain the S-S representation in vector-matrix form
1
v&C  − RC
=
&   1
iL   − L
iR = [ R1
 vC   0 
v(t)
⋅
+
0   iL   L1 
1
C
v 
0 ]⋅  C 
 iL 
G.Oliver, UIB
State-Space Representation
►Definitions
■
System state: minimum information needed in order to completely determine
the output of a system from a given moment, provided the input is known from
that moment
■
System variable: any variable that responds to an input or initial conditions in
a system
■
State variables: the smallest set of linearly independent system variables
such that the values of the set members at time t0 along with known forcing
functions completely determine the value of all system variables for all t≥t0
■
State vector: vector whose elements are the estate variables
■
State space: n-dimensional space whose axes represent the state variables
■
State equations: set of n simultaneous, first order differential equations with n
variables, where the n variables to be solved are the state variables
■
Output equation: algebraic expression of the output variables of a system as
linear combinations of the state variables and the inputs
G.Oliver, UIB
5
State-Space Representation
►
A state-space representation for an LTI system has the general form:
x& (t) = Ax(t) + Bu(t)
y(t) = Cx(t) + Du(t)
where:
x(t): state vector (n-dimensional)
y(t): output vector (p-dim)
u(t): input or control vector (m-dim)
A: dynamic matrix (n x n)
B: input matrix (n x m)
u(t)
C: output matrix (p x n)
D: feedforward (direct) matrix (p x m)
x(t0 ) = x 0
Initial conditions
D
x0
B
+ +
x(t)
∫
x(t)
C
+
y(t)
+
A
G.Oliver, UIB
State-Space Representation
► Selecting
the state variables must follow these rules:
A minimum number of state variables must be selected
They must be linearly independent
The minimum number of state variables required equals the order of
the differential equation describing the system. From the transfer
function point of view, the order of the differential equation is the
order of the denominator of the TF after canceling common factors in
the numerator and denominator
A practical way to determine the number of state variables is to count
the number of independent energy-storage elements in the system
■
■
(capacitors and inductors in electrical syst.; masses and springs in mechanical syst.).
Recommended procedure:
■
■
■
■
Write the simple derivative eq for each energy-storage element
Solve for each derivative term as a linear combination of system
variables and the input
Each differentiated variable is selected as a state variable
All other system variables and the output are written in terms of the state
variables and the input
G.Oliver, UIB
6
Introductory example
►
Example 2: Obtain the SS equations for the next circuit, being the
output vector y=[vR2 iR2]T
C
iC
i(t)
R1
iR1
iL
v&C   1
States Eq   =  R1C1∆
i&L  − L∆
L
iR2
1− 4 R2
C∆
R2
L∆
Out Eq
vR 2  − (1 + ∆1 )
i  =  1−4 R1
 R 2   ∆R1
Where
∆ = − (1 − 4 R2 ) +
(
 vC  − 1−C4∆R2 
   +  R2 i(t)
  iL   − L∆ 
R2
∆
1
∆
R2
R1
4vL(t)
R2
)
 vC  − R∆2 
   +  1 i(t)
  iL   − ∆ 
G.Oliver, UIB
From transfer function to state space
►
Converting a transfer function with constant term in numerator
This case corresponds to a linear system that can be represented as an
nth-order linear differential equation with constant coefficients like:
d n y (t )
d n−1 y (t )
dy (t )
+ an −1
+ ...a1
+ a0 y (t ) = b0u (t )
n
dt
dt n −1
dt
The classical Transfer Function (TF) representation of that system is
obtained applying the Laplace Transform to the diff.eq.
G ( s) =
Y (s)
b0
=
U ( s ) s n + an−1s n−1 + ...a1s + a0
U(s)
G(s)
Y(s)
If the State Space (SS) representation has to be obtained, a convenient
way to select state variables is to choose the output, y(t), and its n-1
derivatives as the state variables. This is called the phase-variable
choice.
A SS representation using the phase-variable choice for the state
variables is said to be in the Controller Canonical Form (CCF).
G.Oliver, UIB
7
From transfer function to state space
x1 = y
dy
dt
dy
x&1 = x2
x2 =
d2y
dt
x& 2 = x3
x& 2 = 2
dt
d2y
M
x3 = 2
3
Differentiating x& = d y Substituting x& = x
dt
n −1
n
3
both sides
dt 3
M
x& n = −a0 x1 − a1 x2 ... − an −1 xn + b0u
M
d n −1 y
xn = n −1
dny
dt
x& n = n
dt
x&1 =
that can be written in vector-matrix form as follows:
 x&1   0
 x&   0
 2  
 M = M

 
 x& n −1   0
 x& n  − a0
G.Oliver, UIB
1
0
0
1
0
0
− a1
− a2
ACCF
0   x1   0 
0   x2   0 
  M  +  M u

  
...
1   xn −1   0 
... − an −1   xn  b0 
...
...
 x1 
x 
 2 
y = [1 0 0 ... 0]⋅  M 


 xn −1 
 xn 
BCCF
CCCF
A mechanical example
►
Example 3: Find the state eqs for the translational mechanical system shown
in figure, being y1 and y2 the
y2
y1
f(t)
output of the system
c
k2
k1
m1
m2
frictionless
Newton’s 2nd law:
m1 &y&1 (t ) + k1 y1 (t ) − k2 [ y2 (t ) − y1 (t )] = f (t )
m2 &y&2 (t ) + cy& 2 (t ) + k2 [ y2 (t ) − y1 (t )] = 0
State variables defined in terms of mass displacements and velocities:
x1 (t ) = y1 (t ) x2 (t ) = y2 (t ) x3 (t ) = y&1 (t ) x4 (t ) = y& 2 (t )
Algebraic operations yield to the SS representation where:
0 1 0   x1   0 
 x&1   0
 x1 
   
 x&   0
x  0
0
0
1
x
y
0
1
0
0
0




2
2
1
   +   f (t )
  =  k +k
 2  +   f (t )
=
k2




 
1
2
1

0
0


 x&3  − m1


x
y
0
1
0
0
m1
  x3  0
3
 2 
m1

   k2






k2
− m2 0 − mc2   x4   0 
 x& 4   m2
 x4 
G.Oliver, UIB
8
From transfer function to state space
►
Converting a transfer function with polynomial in numerator
For example, consider a third order SISO system with second-order
numerator polynomial
G ( s) =
b2 s 2 + b1s + b0
s + a2 s 2 + a1s + a0
3
First, separate the transfer function into two cascaded modules
G(s)=G1(s)G2(s):
U(s)
1
s 3 + a2 s 2 + a1s + a0
W(s)
b2 s 2 + b1s + b0
Y(s)
Thanks to the intermediate variable W(s), we can write:
In the
1
U ( s ) time domain &w&&(t ) + a w
&&
&
2 (t ) + a1 w(t ) + a0 w(t ) = u (t )
s + a2 s + a1 s + a0
&&(t ) + b1w& (t ) + b0 w(t )
y (t ) = b2 w
Y ( s ) = b2 s 2 + b1s + b0 ⋅ W ( s )
W ( s) =
3
2
(
)
G.Oliver, UIB
From transfer function to state space
Now, using the phase-variable choice for the first subsystem G1
x1 = w
x2 = w& = x&1
&& = &x&1 = x& 2
x3 = w
x&3 = − a2 x3 − a1 x2 − a0 x1 + u
 x&1   0
 x&  =  0
 2 
 x&3  − a0
1
0
− a1
0   x1  0
1  ⋅  x2  + 0u (t ) State eq
− a2   x3  1
 x1 
w(t ) = [1 0 0]⋅  x2  + [0]⋅ u (t ) Intermediate eq
 x3 
Finally, to obtain the output eq, the differential eq for G2 is used
&&(t ) + b1w& (t ) + b0 w(t )
y (t ) = b2 w
= b2 x3 + b1 x2 + b0 x1
y (t ) = [b0
 x1 
b1 b2 ]⋅  x2  + [0]⋅ u (t )
 x3 
Output eq
G.Oliver, UIB
9
Block diagram representation
►
As it is one of the most used symbolic tool to represent systems in
control theory, an example about how to obtain a block diagram from
the SS representation follows.
Given the system with the next transfer function, obtain the block diagram
G ( s) =
b2 s 2 + b1s + b0
s + a2 s 2 + a1s + a0
U
3
W=x1
Y
1
b2 s 2 + b1s + b0
s 3 + a2 s 2 + a1s + a0
Remember the state variables choice and eqs stated in the previous slide
y (t ) = [b0
 x1 
b1 b2 ]⋅  x2 
 x3 
x1 = w
x2 = w& = x&1
&& = &x&1 = x&2
x3 = w
x& = − a x3 − a1 x2 − a0 x1 + u
b2
++
+
b1
u
x3
+
-- -
∫
a2
x3
∫
x2
∫
x1
y
b0
a1
a0
3
G.Oliver,
UIB 2
Linearization of nonlinear systems
►
►
►
►
►
As it has been stated before, SS can represent nonlinear systems
(eq coefficients not constants).
The ability to represent nonlinear systems does not imply the ability
to solve their state equations for the state variables and the output.
There exist techniques to solve some nonlinear state equations, but
they will not be exposed in this course.
If we are interested in small perturbations about an equilibrium point,
we can assume, with certain error, a linear behavior about this point.
Techniques of linearization are mainly based on cutting out higher
order terms of Taylor series expansion of the nonlinear functions
appearing in the system equations.
G.Oliver, UIB
10
Taylor series expansion (brief rev)
► Linear
■
approximation for two variables functions f(x,y)
L(x,y), the local linearization of f(x,y) about (a,b), is obtained
cutting out terms of the Taylor higher than first order
L ( x, y ) ≈ f ( a , b ) +
∂f
∂x
( x − a) +
( a ,b )
∂f
∂y
( y − b)
( a ,b )
Example: Find the linearization of f(x,y)=x2+y2 about point (1,2)
f (1,2) = 5
∂f
= 2 x (1, 2) = 2
∂x (1, 2 )
∂f
= 2 y (1, 2) = 4
∂y (1, 2 )
L ( x, y ) = 2 x + 4 y − 5
T1_2DLinearAprox.m
G.Oliver, UIB
Linearization of nonlinear systems
►
Nonlinear, time-varying systems can be represented by state
equations:
x& (t) = f [x(t), u(t), t ]
y(t) = h[x(t), u(t), t ]
x(t0 ) = x 0
where f( ) and h( ) are continuously differentiable functions of their
(n+m+1)-dimensional arguments. Linearization is obtained as follows:
■ Assume that under usual working circumstances the system
operates along the trajectory xn(t) while it is driven by the system
input un(t) called the nominal state trajectory and the nominal input
trajectory, respectively. Thus, next equations are satisfied:
x& n(t) = f [x n(t), u n(t), t ]
y n(t) = h[x n(t), u n(t), t ]
■
Expanding the nonlinear functions in a multivariate Taylor series up
to first order terms about [xn(t), un(t),t] we obtain:
∂f
[x n (t ), u n (t ), t ][x(t ) − x n (t )] + ∂f [x n (t ), u n (t ), t ][u(t ) − u n (t )]
∂x
∂u
∂h
∂h
y(t) ≈ h[x n(t), u n(t), t ] + [x n (t ), u n (t ), t ][x(t ) − x n (t )] + [x n (t ), u n (t ), t ][u(t ) − u n (t )]
∂x
∂u
G.Oliver, UIB
x& (t) ≈ f [x n(t), u n(t), t ] +
11
Linearization of nonlinear systems
■
Taking into account that f( ) and h( ) are matricial functions, the
following coefficient matrices can be defined:
∂f
[xn(t), un(t), t ] B(t) = ∂f [xn(t), un(t), t ]
∂x
∂u
∂h
∂h
C(t) = [xn(t), un(t), t ] D(t) = [xn(t), un(t), t ]
∂x
∂u
A(t) =
■
Moreover, if the deviations of the state, input and output from their
nominal trajectories are denoted by δ subscripts:
xδ (t) = x(t ) − x n (t ) uδ (t) = u(t ) − u n (t ) y δ (t) = y (t ) − y n (t )
■
Thus, on the assumption that the state, the input and the output
remain close to their respective nominal trajectories, high-order
terms can be neglected and a state equation for the linearly
approximated system is obtained:
x& δ (t) = x& (t) − x& n(t) ≈ A(t )xδ (t ) + B(t )uδ (t )
y δ (t) = y(t) − y n(t) ≈ C(t )xδ (t ) + D(t )uδ (t )
G.Oliver, UIB
Linearization of nonlinear systems
► Notice
that if the nonlinear state equation do not explicitly
depend on t, x& (t) = f [x(t), u(t)]
y(t) = h[x(t), u(t)]
and the nominal trajectory is in equilibrium condition
xn(t)=xn for a constant nominal input un(t)=un,
0 = f [x n , u n ]
the coefficient matrices in the linearized state equation
are constant, i. e. the system obtained is LTI. Matrices A,
B, C and D are constant.
G.Oliver, UIB
12
SS description in Matlab
►
There are mainly three ways to describe LTI systems with Matlab:
■
■
■
■
tf(num, den), where num and den stand for the polynomial coefficients for
the transfer function numerator and denominator, respectively.
zpk(z,p,k), where z is the array of numerator polynomial roots (the zeros),
p is the array of denominator polynomial roots (the poles), and k is the
system gain.
ss(A,B,C,D), where A, B, C and D are the constant coefficient matrices.
Other commands:
►
►
►
[A,B,C,D]=tf2ss(num,den)
[num,den]=ss2tf(A,B,C,D)
Example: Try the next sequence of Matlab commands
>> num=[1 3];
>> den=[1 3 4 2];
>> sys1=tf(num,den)
>> [A,B,C,D]=ssdata(sys1)
G.Oliver, UIB
SS description in Simulink
► State-Space
block: if coefficient matrices are known…
1
In1
x' = Ax+Bu
y = Cx+Du
1
Out 1
State -Space
► Double
clicking o the icon opens an emerging window
where al the parameters can be stated
► Simulink can also be used to obtain the SS matrices from
the TF description.
■
■
■
Define the Simulink model of the figure:
Save it as ‘model1’
Go to Matlab and type:
1
In1
>> [A,B,C,D]=linmod('model1')
1
s 2 +5s+6
1
Out 1
Transfer Fcn
1
s+2
Transfer Fcn 1
The SS coefficient matrices will be obtained
G.Oliver, UIB
13
Continuing Example: DC servomotor
►
The simplified DC servomotor model shown in the figure will be used
throughout the course. The input is the armature voltage v(t) and the
output is the motor shaft angular position θ(t). Back emf voltage, gear
ratio and load inertia are ignored.
L
R
+
v(t)
■
►
►
xT
L
τ(t), ω(t), θ(t)
bM
Armature circuit inductance L and resistance R
Motor shaft inertia: JM
Viscous damping coefficient: bM
Intermediate variables are:
►
►
►
■
x
Constant parameters are:
►
■
i(t)
JM
+
eb M
Armature current: i(t)
Motor torque: τ(t)
Motor shaft velocity: ω(t)
Input and Output:
►
►
Input: v(t)
Output: θ(t)
G.Oliver, UIB
A case study: DC servomotor model
► We
■
■
can obtain the dynamic model of the system from:
Armature circuit model (Kirchhoff’s voltage law)
di (t )
I (s)
1
L
+ Ri (t ) = v(t )
=
dt
V ( s ) Ls + R
Motor torque (Electromechanical coupling)
Θ( s )
kT
T (s)
=
= kT
τ (t ) = kT i (t )
2
V ( s ) ( J M s + bM s )·( Ls + R )
I (s)
Rotational mechanical model (Euler’s rot. law)
1
J M θ&&(t ) + bM θ&(t ) = τ (t ) Θ( s) =
2
T ( s ) J M s + bM s
■
LJ M θ&&&(t ) + ( LbM + RJ M )θ&& + RbM θ&(t ) = kT v(t )
G.Oliver, UIB
14
A case study: DC servomotor model
►
The state-space description of the system can be obtained from the
last third order diff equation using the phase-variable choice:
x1 = θ (t )
x = θ&(t ) = x&
x&1 = x2
x& 2 = x3
x3 = θ&&(t ) = x& 2
x&3 =
2
1
1
LJ M
[− ( LbM + RJ M ) x3 − RbM x2 + kT x2 ]
The state and output equations are:
1
 x&1  0
 x&  = 0
0
 2 
RbM
 x&3  0 − LJ
M
  x1   0 
    
 ⋅  x2  +  0  v(t )
( LbM + RJ M ) 
− LJ M   x3   LJkTM 
0
1
A
B
 x1 
y (t ) = [1 0 0]⋅  x2  + [0]⋅ v(t )
 x3 
C
D
Exercise: Build the Simulink model of the DC motor described by:
LJ M θ&&&(t ) + ( LbM + RJ M )θ&& + RbM θ&(t ) = kT v(t )
Observe the behavior of the output θ(t) for different inputs
T1_motor1.mdl
G.Oliver, UIB
15