ECE 486 Control Systems
Lecture 2
State-Space Representation of a System
State-Space Model – a Unified Framework
Recall from last time, we introduced the basic concept of control diagram, where the terminology we used include
- System input (R)
- System output (Y)
- Controller block (C)
- Plant block (P or ˜P for plant and actuator combined)
- Feedback loop (F)
We also discussed the situation where the controller gain C (at the moment proprotional gain only) is large, we can achieve good reference tracking since C→∞ implies Y→R. At the same time, the contribution of disturbance inputs D1 and D2 to the system output is minimal, we call it good disturbance rejection.
Now for a brief moment, we will look at another way of describing system dynamics – the state-space model. First off, a few quick examples.
Example 1: Consider the Mass-Spring system as in Figure 1. Derive the governing differential equation and rewrite it in matrix form by reducing a higher order ODE to a set of first order ones.
Correction: The displacement x in the figure should be interpreted as measured against the resting position (x=0) of the spring, not against the wall. Since a spring can be stretched also compressed.
Figure 1: Example 1 – Mass-Spring system
Solution: By Newton’s second law, total force equals mass times acceleration. Therefore in this case,
F⏟total force=ma=spring force+friction+external force,where
spring force =−kx(by Hooke's law)friction force =−ρ˙x(by Stokes' law, linear drag pegged to velocity),i.e., we have the governing equation
−kx−ρ˙x+u=m¨x.We can move x,˙x,¨x to one side, leaving u on the other, and normalize the leading coefficient,
¨x+ρm˙x+kmx=um.This gives us a second order linear ODE.
To rewrite it in canonical form, we convert it to a system of first order ODEs by introducing veloctiy variable v=˙x,
{˙x=v(by definition of velocity)˙v=−ρmv−kmx+1mu.Equation (1) can also be written as (in order to see the matrix form more easily)
{˙x=(0)x+(1)v+(0)u˙v=(−km)x+(−ρm)v+(1m)u.Finally, we can express it in matrix form,
(˙x˙v)=(01−km−ρm)(xv)+(01m)u.Example 2: Consider RL circuit as in Figure 2. Derive the governing differential equation and rewrite it in matrix form by reducing a higher order ODE to a set of first order ones.
Figure 2: Example 2 – RL circuit
Solution: We can largely repeat what we did in Example 1 but instead apply Kirchhoff’s voltage law, total voltage drop along the circuit loop is 0.
−VS+VR+VL=0,(by Kirchhoff's voltage law)VR=RI,(by Ohm's law)VL=L˙I.(by Faraday's law)Therefore, we have −VS+RI+L˙I=0.
˙I=−RLI+1LVS.Note this is a first order system.
General n-Dimensional State-Space Model
If we apply abstraction to both Example 1 and Example 2 above, for a system with n states and m inputs,
state x=(x1⋮xn)∈Rn,input u=(u1⋮um)∈Rm,a linear state space representation is a set of ODEs in matrix form
(˙x1⋮˙xn)=(An×nmatrix)(x1⋮xn)+(Bn×mmatrix)(u1⋮um).Or for short,
˙x=An×nx+Bn×mu.
This is called the dynamics equation of the state-space representation. Sometimes we can augment this dynamics equation with output equation. Denote the p outputs as a vector y,
output y=(y1⋮yp)∈Rp,y=Cx,where C is a p×n matrix. For example, if we only care about (or can only measure) x1, then
y=x1=(10…0)(x1x2⋮xn).The state-space representation of a system can be written as
˙x=Ax+Bu,y=Cx.State-space models are useful and convenient for writing down system models for different types of systems, in a unified manner.
We will use the classic example of a simple pendulum to illustrate how to work with state-space models.
Example 3: Consider the simple pendulum as in Figure 3. Derive the governing differential equation and write it in the state-space representation.
Figure 3: Example 3 – Simple pendulum
Solution: Similar to Example 1, we apply here Newton’s second law but in its rotational version. It says total torque equals moment of inertia times angular acceleration.
T=Jα(pendulum torque + external torque=inertia×angular acceleration),where
pendulum torque=−mgsinθ⏟force×ℓ⏟lever arm,moment of inertia J=mℓ2.By substitution,
¨θ=−gℓsinθ+1mℓ2Te.It is a nonlinear equation though. Recall for small θ, use the approximation sinθ≈θ in Equation (2),
Figure 4: Overlaid sinx and x
We get
¨θ=−gℓθ+1mℓ2Te.Repeat what we did at the end of Example 1 to rewrite Equation (3) in state-space form: we introduce θ1=θ,θ2=˙θ, then
˙θ2=−gℓθ+1mℓ2Te=−gℓθ1+1mℓ2Te.So the state-space representation of a simple pendulum is
(˙θ1˙θ2)=(01−gℓ0)(θ1θ2)+(01mℓ2)Te.Question: What if θ is not small? say, θ is around π.
Answer: sinθ≈π−θ if θ is around π. (Why?)
Linearization of State-Space Models
Though in Example 3 we used the trick sinx≈x around x to obtain the linear state-space model, we are wondering if there is a general strategy to linearize state-space model. The answer is using Taylor series. Recall Taylor series expansion in one variable,
f(x)=f(x0)+f′(x0)(x−x0)+12f″(x0)(x−x0)2+…≈f(x0)+f′(x0)(x−x0).(linear approximation around x=x0)For a general nonlinear control system
˙x=f(x,u)(nonlinear state-space model)x=(x1⋮xn),u=(u1⋮um),f=(f1⋮fn),we can apply Taylor expansion in multivariables. Assume x=0,u=0 is an equilibrium point: f(0,0)=0, i.e., when the system is at rest and no control is applied, the system does not move. Around (x,u)=(0,0), for each fi(x,u) of f(x,u), i=1,…,n,
fi(x,u)=fi(0,0)⏟=0+∂fi∂x1(0,0)x1+…+∂fi∂xn(0,0)xn+∂fi∂u1(0,0)u1+…+∂fi∂um(0,0)um.After we assemble those n equations, we get the linearized state-space model
˙x=Ax+Bu, where Aij=∂fi∂xj|x=0u=0,Bik=∂fi∂uk|x=0u=0. A is nothing but the Jacobian of f(x,u) w.r.t. x at equilibrium and similarly B is the Jacobian of f(x,u) w.r.t. u at equilibrium.
Important: Since we have ignored the higher-order terms, this linear system is only an approximation that holds only for small deviations from equilibrium.
Let’s use the general strategy instead of a trick to relinearize the nonlinear dynamics of a simple pendulum in Example 3.
Example 3 (revisted): Relinearize the state-space model of a simple pendulum in Example 3 above.
Solution: The original nonlinear state-space model:
˙θ1=f1(θ1,θ2,Te)=θ2,(already linear)˙θ2=f2(θ1,θ2,Te)=−gℓsinθ1+1mℓ2Te.Linearize f2 around equilibrium (θ1,θ2,Te)=(0,0,0):
∂f2∂θ1=−gℓcosθ1,∂f2∂θ2=0,∂f2∂Te=1mℓ2,∂f2∂θ1|0=−gℓ,∂f2∂θ2|0=0,∂f2∂Te|0=1mℓ2.Therefore the linearized state-space model of the pendulum is
˙θ1=θ2,˙θ2=−gℓθ1+1mℓ2Te,which is the same as Example 3.
General Linearization Procedure
Note that if systems have different equilibria other than (x,u)=(0,0), we may apply translation to shift nonzero equilibrium to the origin:
x_=x−x0,u_=u−u0,f_(x_,u_)=f(x_+x0,u_+u0)=f(x,u).Since ˙x_=f_(x_,u_) is a system with origin as its equilibrium, we can apply the aforementioned linearization method we discussed for such systems. After we compute Jacobians and formulate the linearization in terms of x_ and u_, we substitute x_=x−x0, u_=u−u0 to get a linearized model in terms of x and u.
Observation: For any linear system, it must have an equilibrium point at (x,u)=(0,0) since if f is already linear
f(x,u)=Ax+Bux=0, u=0→f(0,0)=A0+B0=0.