You are on page 1of 21

Try to write the state space model

differently!
Try to write the state space model
differently!
A is a special matrix in state space representation, as it captures the
relationship between and . And
If we assume T is the matrix of eigenvectors of A, becomes a
diagonal matrix containing the eigenvalues of A.
Reminder: A.v = λ.v where v and λ are the eigenvectors and eigenvalues of A.
So yields, . The solution for the equation :

is . We conclude that how the state changes


over time is function of the eigenvalues λi of the matrix A.

So if and only if, all the eigenvalues of the system matrix have Re
λi <0, than the system is asymptotically stable.
State feedback control
State feedback control
Example
Find the eigenvalues of A.
Solve det (A-λI) = 0. 
-λ(-1-λ)-2=0  λ + λ^2 -2=0 
λ=-2,1.  unstable.
Using pole placement: Acl = A-B.K=
Acl = Find the eigenvalues of Acl.
Solve det (Acl-λI) = 0. 
=0 . 
Example
λ^2 + (1+k1)λ+ (k1+2k2-2)=0.
Let’s place the poles at λ=-2 and λ=-1. 
(λ+2)(λ+1)=0  λ^2 + 3λ + 2 = 0 
 k1= 2 and k2 =1
Example Matlab
% 1. Define state space matrices % 6. close the loop
A= [0 1; 2 -1]; Acl = A-B*K;
B= [1; 0]; % 7. eigs of closed loop
Ecl= eig(Acl);
C=[1 0];
D=0; % 8. create the closed loop system
syscl = ss(Acl,B,C,D);
% 2. create state space model
% 9. check the step response of both
sys=ss(A,B,C,D); systems
% 3. check open loop eigen values step(sys)
E=eig(A); step(syscl)
% 4. desired closed loop eigen values % 10. solve for kr
Kdc=dcgain(syscl);
P=[-2 -1];
Kr=1/Kdc;
% 5. pole placement % 11. create the closed loop scaled
K=place(A,B,P); system
syscl_scaled = ss(Acl,B*Kr,C,D);
step(syscl_scaled)
Reference tracking
Modeling
Modeling
• Role of a model: Analysis – Simulation –
Prediction – design.
• A model is a simplified description of a reality
system.
• Why we do models? Simpler, safer, cost
effective…
• How we do modeling: physical relations,
empirical knowledge, data…
Three phase method
• Structuring
• Divide into sub-systems
• Input, output, variables
• Relationships/Basic equations
• Conservation laws
• Constitutive relations
• Form State space model
• Choose state variables
• Form ẋ = …
Three phase method
• Structuring
• Divide into sub-systems
• Input, output, variables
• Relationships/Basic equations
• Conservation laws
• Constitutive relations
• Form State space model
• Choose state variables
• Form ẋ = …
Exp: Control the flow of a water tank
Three phase method
• Structuring
• Divide into sub-systems
• Input, output, variables
• Relationships/Basic equations
• Conservation laws
• Constitutive relations
• Form State space model
• Choose state variables
• Form ẋ = …
Three phase method
• Conservation laws (balance equation):
• Mass balance [kg]
• Force balance [kgm/s^2= N] (Newton’s law)
• Torque balance [kgm^2/s2= Nm] (Newton)
• Voltage balance [V] (Kirchhoff’s voltage law)
• Current flows [A] (Kirchhoff’s current law)
• Volume flows [m^3/s]
• Energy flows [J/s = W]
Three phase method
• Constitutive relations (relate variables of
different kind):
• Ohm’s law: U=Rl (voltage and current)
• Ideal gas law: pV=nRT (pres, vol and temp)
• Hooke’s law: F=kx (force and distance)
• Air resistance: F=bv^2 (force and velocity)
Exp: Control the flow of a water tank

Conservation laws (balance equation):


What is it that changes? What is causing this change?

Change of volume = Volume of supplied - Volume of consumed


per time instant, water water

dV/dt = q0 + d - q1

Constitutive relations
V = A.h (relation volume/level) and q1= (Bernoulli’s eq)
Three phase method
• Structuring
• Divide into sub-systems
• Input, output, variables
• Relationships/Basic equations
• Conservation laws
• Constitutive relations
• Form State space model
• Choose state variables
• Form ẋ = …
dV/dt = f (V , q0 , d)
q1 = f (V , q0 , d)
Choose state variables:
What is changing? V or h? let’s choose V.
dV/dt = q0 + d - q1 
“All models are wrong but some are
useful.”
George Box, Robustness in the strategy of scientific
model building, in Launer, R. L.; Wilkinson, G. N.,
Robustness in Statistics, Academic Press, pp. 201—
236, 1979
“Models and simulations can never
replace observations and experiments
— but they constitute an important and
useful complement.”
Lennart Ljung and Torkel Glad, Modeling and
Identification
of Dynamic Systems, Studentliteratur, 2016

• Verification is the process of determining that a model implementation


accurately represents the developer’s conceptual description of the model and
the solution to the model.

• Validation is the process of determining the degree to which a model is an


accurate representation of the real world from the perspective of the intended
uses of the model.
Homework 2

Use the 3 phase method to derive a model describing


how the position of the mass is related to the input force

You might also like