0% found this document useful (0 votes)
11 views

M1 1 After Class

Uploaded by

Cheug-Lee Lim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

M1 1 After Class

Uploaded by

Cheug-Lee Lim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 42

Module 1-1: Linear Dynamics Modeling

Modern Control:Theory and Design (2023)

Ding Zhao

Associate Professor
College of Engineering
School of Computer Science

Carnegie Mellon University

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 1 / 42


Table of Contents

1 Overview

2 Mathematical expression of linear systems

3 State space representation

4 Linearization

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 2 / 42


Table of Contents

1 Overview

2 Mathematical expression of linear systems

3 State space representation

4 Linearization

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 3 / 42


Course Administration

Slides/assignments: Canvas

Assignment submission: Gradescope (access on Canvas)

Textbook: there is no textbook. All materials needed will be provided.

Forum: Campuswire (joining link at Syllabus on Canvas)

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 4 / 42


Syllabus of This Course - Canvas

Dynamic Modeling and Analysis


Design Methods for Control
Module 1-1: Linear Dynamics Modeling
Module 2-1: Feedback Control (Pole Placement)
Module 1-2: Solving Linear Dynamics
Module 2-2: Introduction to Optimal Control
(LQR, MPC)
Module 1-3: Controllability and Observability
Module 2-3: Introduction to Stochastic Control
(Kalman Filter)
Module 1-4: Realization
Module 2-4: Introduction to Adaptive Control
(State Space vs Transfer Fun.)
(MRAC)
Module 1-5: Stability
Module 2-5: New trend of control (Guest speaker)
Sub-module 1-4 have 5 projects
Each topic has a homework

⇒ Midterm

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 5 / 42


Linear CONTROL Systems - A Brief History
Control:continuously operating dynamical systems
Frequency response methods
made it possible to
design linear closed-loop Norbert Wiener (Cybernetics)
State space methods
Minorsky worked on linear model-based (MIMO)
automatic controllers (PID) optimal/stochastic/ modern control theory in
for steering ships adaptive control Rudolf Kalman (Apollo) engr,bio,med,econ,social etc.

1920s 1930s 1940s 1950s 1960s 1980s Present

Root-locus method
due to Evans
was fully developed
Nyquist/Bode (Bell Lab) developed Machine learning controls
methods for analyzing nolinear model-free
the stability of genetic algorithm, neural network
controlled systems reinforcement learning control

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 6 / 42


Knowledge in this will be Useful in the Following Courses

24-740 Combustion and Air Pollution Control


24-662 Robotic Systems and Internet of Things 16-642 Manipulation, Estimation, and
Control
24-671 Electromechanical Systems Design
16-711 Kinematics, Dynamic Systems
24-673 Soft Robots
and Control
24-757 Vibrations
16-722 Sensing and Sensors
24-773 Multivariable Linear Control
16-741 Mechanics of Manipulation
24-774 Advanced Control Systems Integration
16-745 Dynamic Optimization
24-775 Robot Design & Experimentation
16-748 Underactuated Robots
24-776 Nonlinear Controls
16-861 Mobile Robot Design
24-778 Mechatronic Design
16-865 Advanced Mobile Robot Design
24-785 Engineering Optimization
16-868 Biomechanics and Motor Control
24-784 Trustworthy Aritificial Intelligence (Spring)

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 7 / 42


Assessment

Homework: 20%
Midterm : 25%
Projects: 50%
Participation: 5%

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 8 / 42


Projects

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 9 / 42


Specific Goals of This Course
I will help you to be
Confident in the interview for positions of control engineers
Familiar with the most important control nomenclature, theories, algorithms
Capable to implement real-world control algorithms independently
I have talked to my students and summarized the following jargons that have been often
mentioned in their interviews. By the end of the class, you will be able to explain them.
Core math: QR, LU, SVD, Cholesky, Jordan, diagonal decomposition, Riccati Equation,
Cayley Hamilton Theorem, and why they are useful in control?!!
Control: Lyapunov stability, controllability, observability, LQR, LQG, MPC, separation
principle, realization, Kalman Decomposition, Kalman Filter, EKF, UKF
Programming: Python related questions (need extra practice)
The most common question being asked is: explain LQR - is it always stable? why?
I will spend a lecture to derive it with you.
Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 10 / 42
WARNINGS

This is a math course. NOT a project-based course.


Modern controller design is based on a solid mathematical foundation.
Different from e.g. deep learning.
Pure empirical hand-tuning is difficult and risky. -”don’t tell me, prove it to me”.
Safety critical applications include space aircraft, automobile, economy, electric grids,etc.
I will try to balance between the math rigorousness and application broadness in teaching
and assignment. But I also need your devotion to spend enough time and efforts learning
the math.
Drop the course if you have already selected 2+ ”hardcore” courses, or 2 courses
plus heavy research duty (research masters). The workload of this course may
make you feel uncomfortable.
Focus on building your expertise. Companies hire you to work on specific tasks not to
cover a broad area!

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 11 / 42


Prerequisites
If the following contents sound unfamiliar to you, you may consider take this course next year.
These topics are ones that I assume you know, I may barely review them:
Calculus (e.g. derivative/integral)
21-120 Calculus I, 21-122 Calculus II
Linear algebra (e.g. matrix inversion, eigenvectors/eigenvalues)
24-282 Special Topics: Linear Algebra and Vector Calculus for Engineers
Gilbert Strang, “Introduction to Linear Algebra (5th Edition),” 2016
Classical control (e.g. Laplace transformation, transfer function, poles/zeros)
24-451 Feedback Control Systems
Katsuhiko Ogata, “Modern control engineering (5th Edition)”, Pearson, 2009
Basic statistics (e.g. mean, variance, Gaussian distribution)
Robert S. Witte, John S. Witte, “Statistics (10th Edition),” Wiley, 2009
These topics are ones that I assume you have learned. I will review but will not teach
them:
Stability (positive poles) for classical control theories
PID controllers
Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 12 / 42
Table of Contents

1 Overview

2 Mathematical expression of linear systems

3 State space representation

4 Linearization

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 13 / 42


Linear Control SYSTEMS -Types

Types of systems
[Brogan, Modern Control Theory,
1990]

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 14 / 42


Linear Control SYSTEMS

We will take an abstract view of a system as a mapping from


inputs u ∈ Rm to output y ∈ Rn
Both u and y are vectors u y
H
Both u and y are functions of time
Write H as a mapping H : Rm → Rn where Ri is a set of
i-dimensional signals
Continuous Time System:
H is CT if both u and y are continuous time signals.
→ Described by ODEs ẏ(t) = f (y, u(t))
Discrete Time System:
H is DT if both u and y are discrete time signals.
→ Described by difference equations y[(k + 1)T ] = f (u(kT )) ⇒ y(k + 1) = f (y(k), u(k))

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 15 / 42


LINEAR Control Systems

Linearity: H is linear if it is both additive and homogeneous

Additivity:
H (u1 + u2 ) = H (u1 ) + H (u2 ) , ∀u1 , u2 ∈ S m
Homogeneity:
H(αu) = αH(u), ∀u, ∀ scalar α
These can be combined into

H (αu1 + βu2 ) = αH (u1 ) + βH (u2 )

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 16 / 42


Time Invariant Systems

A time-invariant system has a time-dependent system function that is not a direct


function of time.
Mathematically speaking, a ”time-invariance” system has the following property:
Given a system with a time-dependent output function y(t) and a time-dependent input
function x(t) the system will be considered time-invariant if a time-delay on the input
x(t + τ ) directly equates to a time-delay of the output y(t + τ ) function.

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 17 / 42


Example
For the following, determine if the system is 1) linear 2) time-invariant

a) ÿ = u − ky2 , for k ∈ R
Let 2 I/O pairs be given by y1 = H(u1 ), y2 = H(u2 )

ÿ1 = u1 − ky12

ÿ2 = u2 − ky22
Add together
ÿ1 + ÿ2 = u1 + u2 − k y12 + y22


¨ y2 = u1 + u2 − k (y1 + y2 )2 ⇒ Not linear



If additive, y1 +
For time invariance, substitute t = t − τ

ÿ(t − τ ) = u(t − τ ) − ky(t − τ )2

Dynamics are unchanged by delay ⇒ time-invariant


Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 18 / 42
Example (OTB)
b) ÿ = 5t2 ẏ + 3y + u
Let y1 = H(u1 ), y2 = H(u2 )
ÿ1 = 5t2 ẏ1 + 3y1 + u1
ÿ2 = 5t2 ẏ2 + 3y2 + u2
ÿ3 = 5t2 ẏ3 + 3y3 + u3
u3 = αu1 + βu2
2
ÿ3 − 5t ẏ3 − 3y3 = αu1 + βu2
Replacing u1 and u2 ,
ÿ3 − 5t2 ẏ3 − 3y3 = α(ÿ1 − 5t2 ẏ1 + 3y1 ) + β(ÿ2 − 5t2 ẏ2 + 3y2 )
Rearranging,
ÿ3 − 5t2 ẏ3 − 3y3 = (αÿ1 + β ÿ2 ) − 5t2 (αẏ1 + β ẏ2 ) + 3(αy1 + βy2 )
If we compare the left side and right side, it becomes clear that system is Linear.
Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 19 / 42
Example (OTB) - Continued

ÿ1 = 5t2 ẏ1 + 3y1 + u1


ÿ2 = 5t2 ẏ2 + 3y2 + u2
Assume u2 (t) = u1 (t − τ ) and, Check y2 (t) = y1 (t − τ )
ÿ2 = 5t2 ẏ2 + 3y2 + u1 (t − τ )
Replace t with t − τ in the first Eq.
ÿ1 (t − τ ) = 5(t − τ )2 ẏ1 (t − τ ) + 3y1 (t − τ ) + u1 (t − τ )
whereas ÿ2 (t)
ÿ2 = 5t2 ẏ2 + 3y2 + u1 (t − τ )
Comparing the two above equation we can conclude that y2 (t) ̸= y1 (t − τ )
⇒ Time varying

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 20 / 42


Example (OTB) - Continued

Tricks to check time-invariant systems: in Dτ (y(t)) = y(t − τ ), we will replace all the t with
t − τ , while in Dτ (u(t)) = u(t − τ ), we only add −τ in the parentheses of u(t), i.e. we will
not change t outside of u(t). Then check whether Dτ (y(t)) = the output of Dτ (u(t))

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 21 / 42


Table of Contents

1 Overview

2 Mathematical expression of linear systems

3 State space representation

4 Linearization

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 22 / 42


State Space Equation

Can we establish theories that can work on all linear control systems in
automotive/aerospace engineering, chemistry reaction, petroleum industry, economy?
First we need to have a universal way to describe these systems. Fortunately, we do.

ẋ = Ax + Bu
y = Cx + Du

Rudolf Kálmán, 1930-2016

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 23 / 42


States

The concept of state occupies a central position in modern control theory. But what is state?

State is a complete summary of the status of the system at a particular point in time
The state at any time t0 is a set of the minimum number of parameters xi (t0 ) which
allows a unique output segment Y[t0 ,t] to be associated with each input segment u[t0 ,t] for
every t0 ∈ T and for all t > t0 , t ∈ T .

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 24 / 42


What is the State

State is a minimum complete summary of the status of the system


at a particular point in time.

Example: the State of Driving


F = ma = mp̈ = t2
x1 = p , x2 = ṗ, x = [x1 , x2 ]T
ṗ = v 
0 1
 
0

m ẋ = x+ F
p(0) = v(0) = 0 0 0 1/m
p(t) y=

1 0

x
Which is the state?:
{p, ṗ, p̈}, {ṗ, p̈}, {p, ṗ}, {p}, solve p(t)

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 25 / 42


Our First Python Program

COLAB LINK
import numpy as np
from scipy.signal import StateSpace, lsim
import matplotlib.pyplot as plt

m = 1 # kg
A = np.asarray([[0., 1.],
[0., 0.]])
B = np.asarray([[0.],
[1. / m]])
C = np.asarray([[1., 0.]])
D = np.asarray([[0.]])
# define the continouse time linear system
cart_sys = StateSpace(A, B, C, D)

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 26 / 42


Our First Python Program

# define simulation steps in time


t = np.arange(0, 10, 1e-3)
# define control input
F = t**2
# simulate the system
_, y, x = lsim(cart_sys, F, t, X0=[0., 0.])
# plot
plt.figure(dpi=100)
plt.plot(t, y)
plt.ylabel('p [m]')
plt.xlabel('t [s]')
plt.show()

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 27 / 42


Example: Automotive Suspension

s1 Write the equations of motion in steady state


m1 m1
m1 s̈1 = −k1 (s1 − s2 )
m2 s̈2 = k1 (s1 − s2 ) − k2 (s2 − u1 ) + u2
Let x1 = s1 , x2 = s˙1 x3 = s2 , x4 = ṡ2 ⇒
k1 (s1 − s2 )
k1 ẋ = Ax + Bu, y = Cx + Du  
u2 u2 k1 (s1 − s2 ) 0 0
 
s2 1 0 0 0  0 0 
m2 m2
C= D=0 B=  0

0 0 1 0 0 
k2 1
m2 m2
k2 (s2 − u1 ) 0 1 0 0
 
k2 k1 k1
u1  −m 0 m1 0 
A=
 0
1 
0 0 1 
k1 k1 k2
m2 0 − m2 − m2 0

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 28 / 42


The Choice of State is NOT Unique!
Let’s take a look at the last example and use the difference between positions as a state
x′1 = s1 , x′2 = s˙1 , x′3 = s1 − s2 , x′4 = s˙1 − s˙2 , x′ =  [x′1 , x′2 , x′3 , x′4 ]T
1 0 0 0
0 1 0 0 
Let x = Mx′ , ẋ = Mẋ′ ⇒ M =  −1

 1 0 −1 0  = M

0 1 0 −1
Given ẋ = Ax + Bu ⇒ Mẋ′ = AMx′ + Bu
⇒ ẋ′ = M−1 AMx′ + M−1 Bu, y = CMx′ + Du
Let  =M−1 AM (similarity transformation),  B̂ = M−1 B, and Ĉ = CM 
0 1 0 0 0 0
 0 0 −k1 /m1 0   0 0 
⇒ Â =   B̂ =  
 0 0 0 1   0 0 
k2 /m2 0 (−2k1 − k2 )/m2 0 −k2 /m2 −1/m2
 
1 0 0 0
Ĉ = Again, we can see the choice of state variables is not unique
0 0 1 0
Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 29 / 42
Summary of State Space Representation

State space form writes high order and coupled DEQs as 1st order equations
Many (infinite) different state equations represent the same DEQ
State equations can be transformed

Motivation of using Linear Space Representations


Can naturally deal with MIMO systems (Compare with “transfer function matrices”. We
will see later.)
Provide a convenient, compact notation, and uniform representations.
Allow the application of the powerful vector-matrix theory (you will see later in this class)
An ideal format for computer programming. (Vectorization)

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 30 / 42


Practice: State Space Example

Find a state space model for ÿ = 7t2 ẏ + 2y + u


Which is the state?: {y, ẏ, ÿ}, {ẏ, ÿ}, {y, ẏ}, {y}

Choose x1 = y, x2 = ẏ.
2nd order ODE to 1st order ODE
ẋ1 = ẏ = x2
ẋ2 = ÿ = 7t2 ẏ + 2y + u = 7t2 x2 + 2x1 + u
Now
 stack
 into a vector equation
     
ẋ1 x2 0 1 x1 0
= = + u
ẋ2 2x1 + 7t2 x2 + u 2 7t2 x2 1
For the output, want  y, i.e

  x1
y = x1 = 1 0 +0·u
x2

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 31 / 42


The Choice of State is NOT Unique!

Choose x1 = 2y + 3ẏ, x2 = ẏ, ⇒ y = (x1 − 3x2 )/2


Then,
ẋ1 = 2x2 + 3 7t2 x2 + x1 − 3x2 + u


ẋ2 = ÿ = 7t2 x2 + x1 − 3x2 + u


And,
y = 21 x1 − 23 x2
3 21t2 − 7
   
3
Hence, ẋ = 2 x+ u
1 7t − 3 1
y = [ 12 − 32 ]x
- These both model the same system!
- Different choices of state variables will have difference advantages.

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 32 / 42


Differential Equations to State Space - SISO System

dn y a n−1
dtn + an−1 ddtn−1y + . . . + a1 dy
dt + a0 y = b0 u
n−1
Define state variables: x1 = y, x2 = dy dy
dt , xn = dtn−1
Then, ẋ1 = x2 , ẋ2 = x3 , · · · , ẋn−1 = xn
ẋn = b0 u − an−1 xn−1 − an−2 xn−2 − · · · − a0 x1
Writein matrix form 
0 1 0... 0  
 0 0 1... 0  0
 
A =  ...
 . 
 B =  .. 
 
 
 0 0 0... 1  b0
−a0 −a1 −a2 . . . −an−1
 
C = 1 0 0... 0 D=0

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 33 / 42


Table of Contents

1 Overview

2 Mathematical expression of linear systems

3 State space representation

4 Linearization

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 34 / 42


Why Linearization Ulam 1909-1984
Neumann 1903-1957
Metropolis 1915-1999

Almost all real systems are nonlinear.


“Using a term like nonlinear science is like referring to the bulk of zoology as the study of
non-elephant animals.” – Stanislaw Ulam
In general, nonlinear dynamical systems are difficult to analyze. It is often advantageous
to look for approximations to the complicated nonlinear systems.
Under specific conditions, we can replace the nonlinear system with an approximate linear
system. For example, we want to study whether small perturbations away from an
equilibrium point of the nonlinear system grow or decay with time.

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 35 / 42


Equilibrium Point

Consider the nonlinear time invariant system:

ẋ = f (x, u), f : Rn × Rm → R

x̄ ∈ Rn is an equilibrium point if

∃ū ∈ Rm , s.t.f (x̄, ū) = 0


i.e. ẋ(t) = 0 at equilibrium points.

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 36 / 42


Linearization

Define the deviation variables:


δx = x − x̄, δu = u − ū ⇒ x = δx + x̄, u = δu + ū, ẋ = δ̇x Jacobi, 1804-1851
Taylor Series

∂f ∂f
ẋ = f (x̄ + δx , ū + δu ) ≈ f (x̄, ū) + |x=x̄,u=ū δx + |x=x̄,u=ū δu
∂x ∂u
∂f ∂f
δ̇x = |x=x̄,u=ū δx + |x=x̄,u=ū δu
∂x ∂u
∂f ∂f ∂f
A= |x=x̄,u=ū ∈ Rn×n , B = |x=x̄,u=ū ∈ Rn×m , is called “Jacobian”
∂x ∂u ∂x

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 37 / 42


Example

x1 − x31 + x1 x2
 
ẋ =
−x2 + 2x1 x2
1. Find equilibria
(
x1 − x31 + x1 x2 = 0
⇒ x2 (2x1 − 1) = 0 ⇒ x2 = 0 or x1 = 21
−x2 + 2x1 x2 = 0
x2 = 0 ⇒ x1 (1 − x21 ) = 0 ⇒ x1 = 0, x1 = 1, x1 = −1 ⇒ (0, 0), (1, 0), (−1, 0)
x1 = 21 ⇒ 12 − 213 + 12 x2 = 0 ⇒ x2 = (−1 + 212 ) ⇒ ( 12 , − 34 )

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 38 / 42


Phase Portrait Plot of the Nonlinear System
COLAB LINK

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 39 / 42


Example

2. Linearization        1 
x1 − x31 + x1 x2
 
0 1 −1
ẋ = ,x = , , , 23
−x2 + 2x1 x2 0 0 0 −4

1 − 3x21 + x2
 
∂f x1
=
∂x 2x2 2x1 − 1
   
1 0 −2 −1
(0, 0): δ̇x = δ (−1, 0): δ̇x = δ
0 −1 x 0 −3 x
   1 1
−2 1 −2 2
(1, 0): δ̇x = δ ( 21 , − 43 ): δ̇x = δ
0 1 x − 32 0 x

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 40 / 42


Recap: State Space Equations

general (nonlinear) linear

ẋ = f (x, u, t) ẋ = A(t)x + B(t)u


time-varying
y = g(x, u, t) y = C(t)x + D(t)u

ẋ = f (x, u) ẋ = Ax + Bu
time-invariant
y = g(x, u) y = Cx + Du

where u ∈ Rm is input, x ∈ Rn is the states, and y ∈ Rp is the output. In this course, we will
focus on the linear SS problems.

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 41 / 42


Recap: Linearization
Consider the nonlinear system:

ẋ = f (x, u), f : Rn × Rm → R

x̄ ∈ Rn is an equilibrium point:

∃ū ∈ Rm , s.t.f (x̄, ū) = 0


Define the deviation variables:

δx = x − x̄, δu = u − ū ⇒ x = δx + x̄, u = δu + ū
∂f ∂f ∂f
A= |x=x̄,u=ū ∈ Rn×n , B = |x=x̄,u=ū ∈ Rn×m , is called “Jacobian”
∂x ∂u ∂x

Ding Zhao (CMU) M1-1: Linear Dynamic Modeling 42 / 42

You might also like