You are on page 1of 344

Department of Electrical Engineering - National Taiwan University

Control Systems
2018 Fall at NTUEE

2018/9/12 NASA Lab - NTUEE 1


Course Information

2018/9/12 NASA Lab - NTUEE 2


Control Systems

• Lectures: Friday 9:10 – 12:00


• Textbook: Franklin, Feedback Control of Dynamic Systems 6th edition. ISBN: 9780136019695.
• Recommended video: Brian Douglas
https://www.youtube.com/watch?v=oBc_BHxw78s&list=PLUMWjy5jgHK1NC52DXXrriwihVrYZKqjk

• Keywords: LTI systems, control theory, feedback control, PID controller


• Prerequisite(s): ODEs, Laplace Transform, Transfer functions

• Instructor: Prof. Cheng-Wei Chen


 Office: MD-520
 Office hour: Friday 13:00 – 15:00
 Email: cwchenee@ntu.edu.tw
• TA: 曾湘妍
 Office: EE2-206
 Office hour: Thursday 13:00 – 15:00
 Email: r07921003@ntu.edu.tw

2018/9/12 NASA Lab - NTUEE 3


Grading Policy

• Grade distribution
 Simple quizzes (30%)
• Up to fifteen times per semester (basically after every lecture)
• Pick top 3~12 for averaging
 Midterm Exam (30%)
• Nov. 9th
• Covering everything up to week 8
• A little bit challenging (expected mean score = 65/100)
• Open book, close internet/laptop
 Competitions (40%)
• Two competitions per semester (15% ea) plus final presentation (10%)

• Rules
 #1: Let me know in advance if any help is needed.
 #2: A written statement is required when you are trying to argue your scores.
 #3: Arguing scores results in auditing the entire work.

2018/9/12 NASA Lab - NTUEE 4


Control Design Competition

• All in MATLAB. Hardware implementation is not required.


• Given a system and performance index (cost function), design your own controller (to minimize the cost)
• Possible topics
 Precise motion control without modeling error
 Precise motion control with modeling error
 Digital precise motion control with modeling error
• Grading

Grade

15%

10%

5%
0% Control Cost

The best group Given nodes

2018/9/12 NASA Lab - NTUEE 5


Lecture 1: Overview and Brief History
Welcome to control engineers’ world

2018/9/12 NASA Lab - NTUEE 6


Systems

• “Open-loop” system (or system plant) – P


• System input(s) – u
• System output(s) – y

u P y

2018/9/12 NASA Lab - NTUEE 7


Systems

u P y ?

2018/9/12 NASA Lab - NTUEE 8


Controls

• “Controller” – C
• Desired reference(s) – r
• System output(s) – y (optional)
• System input(s) – u

r + C u
-
y
(optional)

2018/9/12 NASA Lab - NTUEE 9


Controls

r +
-
C u
?
y

2018/9/12 NASA Lab - NTUEE 10


Control Engineering: Make the System Moves as Desired

min 𝑒 = min(𝑟 − 𝑦)
𝑢 𝑢
• Stability
 Will the error e converge?
• Performance
 How fast the transient response would disappear?
 How large the steady state error e would be?
• Robustness
 Will the disturbances affect the desired performance/stability?
• Optimality
 Can we save the energy of input u?
• Adaptability
 Can we learn to play?

2018/9/12 NASA Lab - NTUEE 11


Big Names

Pierre-Simon Laplace Edward Routh Aleksandr M. Lyapunov Harry Nyquist


1749-1827 1831-1907 1857-1918 1889-1976

Hendrik W. Bode Richard E. Bellman Gene F. Franklin Rudolf E. Kalman


1905-1982 1920-1984 1927-2012 1930-2016

2018/9/12 NASA Lab - NTUEE 12


Examples – Liquid Level Control

2018/9/12 NASA Lab - NTUEE 13


Examples – Fly-ball Governor

2018/9/12 NASA Lab - NTUEE 14


Examples – Cart Pole System

https://danielpiedrahita.wordpress.com/portfolio/cart-pole-control/

2018/9/12 NASA Lab - NTUEE 15


Examples – Quadcopter

https://www.youtube.com/watch?v=z9IV1GNkyyo&feature=youtu.be

2018/9/12 NASA Lab - NTUEE 16


Examples – Intraocular Robotic Interventional and Surgical System

2018/9/12 NASA Lab - NTUEE 17


Examples – Cruise Control

https://truewestmagazine.com/road-trip/

2018/9/12 NASA Lab - NTUEE 18


Examples – Self-Driving Car

https://www.youtube.com/watch?v=B8R148hFxPw&t=154s

2018/9/12 NASA Lab - NTUEE 19


Let’s Narrow Down

• In this course, we will focus on systems which are


 Single-Input-Single-Output (SISIO)

𝑢(𝑡), 𝑦(𝑡) ∈ ℝ

 Linear Time Invariant (LTI)

𝑢1 (𝑡) → 𝑦1 (𝑡), 𝑢2 (𝑡) → 𝑦2 (𝑡) ⇒ 𝑎𝑢1 (𝑡) + 𝑏𝑢2 (𝑡) → 𝑎𝑦1 (𝑡) + 𝑏𝑦2 (𝑡)
𝑢(𝑡) → 𝑦(𝑡) ⇒ 𝑢(𝑡 − 𝜏) → 𝑦(𝑡 − 𝜏)

2018/9/12 NASA Lab - NTUEE 20


Control Configurations

• Open-loop feedforward control • Closed-loop feedback control


 It’s like parenting  It’s like dating

u + u
r C P y r C P y
-

 Transfer function  Transfer function


𝑦 𝑦 𝐶𝑃
= 𝑃𝐶 =
𝑟 𝑟 1 + 𝐶𝑃

min(𝑟 − 𝑦) min(𝑟 − 𝑦)
𝑢 𝑢
1
𝐶= 𝐶→∞
𝑃

Can you tell which one is better?


2018/9/12 NASA Lab - NTUEE 21
Tools for Control Design on SISO LTI Systems

• Performance
 Transient response
 Steady state error
• Stability
 Pole/Zeros map
 Root locus
 Nyquist/Bode plot
• Robustness
 Gain/Phase margin
 Small gain theory
• Optimality (see Optimal Control, Convex Optimization…)
• Adaptability (see Adaptive Control/Filtering…)

2018/9/12 NASA Lab - NTUEE 22


The Real World

2018/9/12 NASA Lab - NTUEE 23


Control System Design Process

• What’s your goal?

• What can you do?

• Define the specification

• Hardware setup

• Modeling

• Control design

• Tuning

2018/9/12 NASA Lab - NTUEE 24


How to Implement a Controller (From e to u)?

2018/9/12 NASA Lab - NTUEE 25


控制領域課程
數學基礎 控制基礎
大 微方、線代、 控制系統、線性系統、

部 複變、機率 信號與系統、感測器與致動器…


究 系統理論
所 (高等)線性系統、非線性系統、離散事件系統、混合系統…

控制理論 最佳理論 學習理論 應用領域


最佳控制 線性規劃 智慧型控制 智慧機器人
適應控制 非線性規劃 類神經控制 影像,動畫,VR
強健控制 動態規劃 人工智慧… 智慧型運輸系統
隨機控制 離散最佳化 精密運動控制
訊號控制及對策 時間基礎
非線性控制… 衛星遙測&定位
… 數位控制
半導體製程
電腦控制
生產自動化…
即時控制…
Feng-Li Lian 10/2/14 - 26
Today’s Highlights

• Welcome to control engineers’ world

2018/9/12 NASA Lab - NTUEE 27


Lecture 2: Dynamic Models

2018/9/12 NASA Lab - NTUEE 28


Control Engineering: Make the System Moves as Desired

𝑢 = arcmin(𝑟 − 𝑦)
𝑢

2018/9/12 NASA Lab - NTUEE 29


System Model

• What is a system model?


• Why do we need a model for a system?
• How to derive/construct a system model?
• Can we trust our model?

2018/9/12 NASA Lab - NTUEE 30


Purpose of Modeling

• Without models – system design by implementation


 Trial and error
 Experiences
 Design rules
• With models – system design and analysis
 Design by analysis
 Design by simulation

2018/9/12 NASA Lab - NTUEE 31


System Identification

Model structure unknown Model structure known Model structure known


Parameters unknown Parameters unknown Parameters known

Modified by CW Chen 8/8/2018

2018/9/12 NASA Lab - NTUEE 32


White and Grey Box Modeling

• We will cover these methods in this lecture

Laplace
Principles
Physical Transform Transfer
ODE
System Function
Parameters

White box: Grey box:


from datasheet from experiments

2018/9/12 NASA Lab - NTUEE 33


Black Box Modeling

• These methods will be covered in System Identification

Physical Transfer
System Function
Experiments and I/O data post processing

sine sweep chirp step response ARX

2018/9/12 NASA Lab - NTUEE 34


Model Uncertainty and Modeling Error

• Modeling is difficult, expensive, and never perfect


• What can we do if the model/parameter is inaccurate?
 Do it again
 Robust design
 Adaptive design

2018/9/12 NASA Lab - NTUEE 35


The First Step: ODE

Laplace
Principles
Physical Transform Transfer
ODE
System Function
Parameters

White box: Grey box:


from datasheet from experiments

2018/9/12 NASA Lab - NTUEE 36


Models of Electric Circuits

• Elements of electric circuits

i+ = i- = 0
Op-amp
v+ = v - = 0

2018/9/12 NASA Lab - NTUEE 37


Electric Circuit Analysis

• Kirchhoff’s Current Law (KCL)

The algebraic sum of currents leaving a junction or node equals the algebraic
sum of currents entering that node.

• Kirchhoff’s Voltage Law (KVL)

The algebraic sum of all voltages taken around a closed path in a circuit is zero.

2018/9/12 NASA Lab - NTUEE 38


Motion Dynamics

• Newton’s Law
𝑭 = 𝒎𝒙ሷ
𝑚
[𝑁 = 𝑘𝑔 ∙ ]
𝑠2

• Newton’s Law for rotation motion

𝑴 = 𝑰𝜽ሷ
𝑟𝑎𝑑
[𝑁 ∙ 𝑚 = (𝑘𝑔 ∙ 𝑚2 ) ∙ ]
𝑠2

2018/9/12 NASA Lab - NTUEE 39


Example – DC Motor Model

• Electrical equation (from KVL)


𝒅𝒊
𝑳 = −𝑹𝒊 − 𝑲𝒎 𝒘 + 𝒗
𝒅𝒕
• Mechanical equation (from Newton’s Law for rotation)
𝒅𝒘
𝑱 = −𝒃𝒘 + 𝑲𝒎 𝒊 + 𝑻
𝒅𝒕

= 𝑏𝑤

2018/9/12 NASA Lab - NTUEE 40


Nonlinear ODEs

2018/9/12 NASA Lab - NTUEE 41


Linearization

• Local behavior nearby the operational point


• Linearization methods
 Quick approximation
sin(𝜃) ≅ 𝜃 if 𝜃 → 0
𝑥 4 ≅ 0 if x → 0
 Taylor Series

𝜕𝑓
𝑓 𝑥 = 𝑓 𝑥𝑠 + ቤ 𝑥 − 𝑥𝑠 + ℎ𝑖𝑔ℎ 𝑜𝑟𝑑𝑒𝑟 𝑡𝑒𝑟𝑚𝑠
𝜕𝑥 𝑥
𝑠

𝜕𝑓
⇒ 𝑓 𝑥 ≅ 𝑓 𝑥𝑠 + ቤ 𝑥 − 𝑥𝑠
𝜕𝑥 𝑥
𝑠
𝑓 𝑥

𝑥
𝑥𝑠
2018/9/12 NASA Lab - NTUEE 42
Example – Pendulum with Torque Input

P(s)
P

𝑔 𝜕𝑓
𝑓 𝜃 = 𝑠𝑖𝑛𝜃 ≅ 𝑓 𝜃𝑠 + ቤ 𝜃 − 𝜃𝑠
𝑙 𝜕𝜃 𝜃
𝑠

(𝜃𝑠 = 0)

(𝜃𝑠 = 𝜋)

2018/9/12 NASA Lab - NTUEE 43


The Second Step: Transfer Function

Laplace
Principles
Physical Transform Transfer
ODE
System Function
Parameters

White box: Grey box:


from datasheet from experiments

2018/9/12 NASA Lab - NTUEE 44


Transfer Function of LTI Systems

• From dynamic equations, transfer function is defined to be

𝑌(s)
𝑃 𝑠 =
𝑈(s)

• Transfer function P(s) is the Laplace Transform of the system P’s impulse response p(t)
• Impulse response: the output y(t) when u(t) is a unit impulse
 For any input u(t), the output y(t) would equal the convolution of p(t) and u(t)

𝑦 𝑡 = 𝑢(𝑡) ⊗ 𝑝(𝑡)

2018/9/12 NASA Lab - NTUEE 45


Laplace Transform

• Two-sided Laplace transform

• One-sided (unilateral) Laplace transform

• Inverse Laplace transform

2018/9/12 NASA Lab - NTUEE 46


Example – Step and Ramp Functions

2018/9/12 NASA Lab - NTUEE 47


Example – Sinusoid Function

2018/9/12 NASA Lab - NTUEE 48


Properties of Laplace Transform – Superposition and Time Delay

2018/9/12 NASA Lab - NTUEE 49


Properties of Laplace Transform – Time Scaling and Frequency Shifting

2018/9/12 NASA Lab - NTUEE 50


Properties of Laplace Transform – Differentiation

2018/9/12 NASA Lab - NTUEE 51


Properties of Laplace Transform – Integration

2018/9/12 NASA Lab - NTUEE 52


Properties of Laplace Transform – Convolution

2018/9/12 NASA Lab - NTUEE 53


Properties of Laplace Transform – Time Product

2018/9/12 NASA Lab - NTUEE 54


The Final Value Theorem

• FVT

• Proof:

2018/9/12 NASA Lab - NTUEE 55


The Initial Value Theorem

• IVT

• Proof:

2018/9/12 NASA Lab - NTUEE 56


Example – Incorrect Use of FVT

2018/9/12 NASA Lab - NTUEE 57


Summary Table of Laplace Transform’s Properties

2018/9/12 NASA Lab - NTUEE 58


Table of Laplace transform

2018/9/12 NASA Lab - NTUEE 59


2018/9/12 NASA Lab - NTUEE 60
S-domain Equivalent Circuits

https://en.wikipedia.org/wiki/Laplace_transform

2018/9/12 NASA Lab - NTUEE 61


Example – Electric Filter
V1 5 V5 4

1 V4

3
V3
2 V2

KCL:

2018/9/12 NASA Lab - NTUEE 62


Transfer Function Models

• From modeling (white/grey box modeling)


 Model construction to have “dynamic equations”
 Linearization if necessary
 Identify “input” and “output” variables
 Take Laplace transformation
 Transfer function G(s) = Y(s)/U(s)

• From identification of I/O data (black box modeling)


 Check the “linearity” of the system
 Use “proper” input signal to generate corresponding output
 Derive Bode plot if sinusoidal inputs are used, or
 Directly derive the transfer functions

2018/9/12 NASA Lab - NTUEE 63


Today’s Highlights

• Modeling is difficult, expensive, and never perfect

2018/9/12 NASA Lab - NTUEE 64


Lecture 3: Dynamic Response
Effect of poles and zeros

2018/9/12 NASA Lab - NTUEE 65


Dynamical Responses of LTI Systems

• LTI systems
 Linearity
𝑢1 (𝑡) → 𝑦1 (𝑡), 𝑢2 (𝑡) → 𝑦2 (𝑡) ⇒ 𝑎𝑢1 (𝑡) + 𝑏𝑢2 (𝑡) → 𝑎𝑦1 (𝑡) + 𝑏𝑦2 (𝑡)

 Time Invariance

𝑢(𝑡) → 𝑦(𝑡) ⇒ 𝑢(𝑡 − 𝜏) → 𝑦(𝑡 − 𝜏)

• Given u(t), what would be y(t) of the LTI system P(s)?

u(t) P(s) y(t)


?
2018/9/12 NASA Lab - NTUEE 66
Impulse Response

ẟ(t) P(s) p(t)

• Impulse response p(t)


 The system P(s)’s output when presented with a unity impulse as the input.
 Inverse Laplace Transform of P(s)

𝑝 𝑡 = ℒ −1 {𝑃 𝑠 }
 For any input u(t), the output y(t) would equal the convolution of p(t) and u(t)
𝑦 𝑡 =𝑝 𝑡 ⊗𝑢 𝑡 =ℒ −1 {𝑃 𝑠 𝑈(𝑠)}

2018/9/12 NASA Lab - NTUEE 67


System Block Diagram

• Series • Parallel

P1 P2 Pn P1

P P2

𝑃(𝑠) = ෑ 𝑃𝑖 (𝑠)
Pn
𝑖=1

𝑃(𝑠) = ෍ 𝑃𝑖 (𝑠)
𝑖=1

2018/9/12 NASA Lab - NTUEE 68


Transfer Function of Feedback Control Systems

+ u
r C P y
-
H

𝑌(𝑠) 𝐶(𝑠)𝑃(𝑠)
𝐻 𝑠 = =
𝑅(𝑠) 1 + 𝐶(𝑠)𝑃(𝑠)

2018/9/12 NASA Lab - NTUEE 69


Block Diagram Simplification

• Mason’s gain formula


 TNC: Too tedious. Not covered. Check textbook if interested.

2018/9/12 NASA Lab - NTUEE 70


Transfer Function Representations

• TF form

• ZPK form

• Partial fraction expansion

2018/9/12 NASA Lab - NTUEE 71


Partial Fraction Expansion

• How to find Ci?

2018/9/12 NASA Lab - NTUEE 72


System Response Derivation by Inverse Laplace transform

Why?

2018/9/12 NASA Lab - NTUEE 73


Example (Only Step 5)

By Inverse Laplace Transform,

2018/9/12 NASA Lab - NTUEE 74


Example (Step 2 to 5)

1
𝐻 𝑠 =
𝑠+1

Forced response
Natural response

2018/9/12 NASA Lab - NTUEE 75


ODE vs. Control System

• ODE
 Complete solution = homogeneous solution + particular solution
• Control system
 Complete response = Natural response (zero input) + forced response (zero state)
 Natural response depends on the system’s pole location
 Forced response depends on the system’s input u(t)

2018/9/12 NASA Lab - NTUEE 76


Poles and Zeros

• n is the order of the system


 No physical system can have n < m; otherwise, it would have an infinite response at w∞

• pi , the root of the denominator, is the pole of the system


 It indicates the dynamic “mode”

• zi , the root of the numerator, is the transmission zero of the system


 Signal transmission-blocking property

2018/9/12 NASA Lab - NTUEE 77


First Order System (One Real Pole)

• If σ > 0, the pole locates at left-half plane (LHP) of s-domain


 The system is stable and its impulse response converges to zero as t∞
 Time constant

σ=1

= 0.37

• If σ < 0, the pole locates at right-half plane (RHP) of s-domain


 The system is unstable and its impulse response diverges as t∞

2018/9/12 NASA Lab - NTUEE 78


Second Order System (Two Real Poles)

Decays faster, Slower, primary


dominates the contributor
early stage later on

2018/9/12 NASA Lab - NTUEE 79


Second Order System (Complex Poles)

• Complex poles can be referred as


𝑠 2 + 𝑠𝜁𝑤𝑛 + 𝑤𝑛2
where

• Impulse response

2018/9/12 NASA Lab - NTUEE 80


Impulse Response of a Second Order System

2018/9/12 NASA Lab - NTUEE 81


Time Functions Associated with Pole Location in the S-plane

2018/9/12 NASA Lab - NTUEE 82


Oscillatory Time Response

• For

• We have

2018/9/12 NASA Lab - NTUEE 83


Example – Mass-Spring-Damper System

2018/9/12 NASA Lab - NTUEE 84


Effect of Zeros – Pole-Zero Cancellation

• Cancelling the effect of the nearby pole


(𝑠 + 1.0001) 1
𝑃 𝑠 = ≅
(𝑠 + 1)(𝑠 + 5) 𝑠 + 5

• Example

add a zero
at -1.1

• RHP poles are never be cancelled.  Why?

2018/9/12 NASA Lab - NTUEE 85


Effect of Zeros – Block Input Mode

• Block input mode


 Similar to pole zero cancellation

• Example

(𝑠 2 + 4) 1
𝑃 𝑠 = U 𝑠 =
(𝑠 + 1)(𝑠 + 5) (𝑠 2 + 4)

1
⇒ Y s = P(s)U 𝑠 =
(𝑠 + 1)(𝑠 + 5)
(input mode is filtered)

2018/9/12 NASA Lab - NTUEE 86


Effect of Zeros – Change Transient Response

• Consider a second order plant

 If α is large, the zero is far away


from the poles and has little
effect
 If α is close to 1, the zero is
close to the real part of the poles
and has a substantial influence

2018/9/12 NASA Lab - NTUEE 87


Effect of Zeros – Change Transient Response

H0(s) Hd(s)
Original response Differentiation of
w/o adding zero original response

LHP zeros RHP zero


Increase speed, create overshoot Decrease speed, create undershoot

Control engineers hate RHP zeros.


We will discuss this later.

2018/9/12 NASA Lab - NTUEE 88


Today’s Highlights

• Complete response = Natural response (zero input) + forced response (zero state)

2018/9/12 NASA Lab - NTUEE 89


Lecture 4: Dynamic Response
Stability

2018/9/12 NASA Lab - NTUEE 90


Control Engineering: Make the System Moves as Desired

𝑢 = 𝑎𝑟𝑐min(𝑟 − 𝑦)
𝑢

• Stability
 Will the error e=r-y converge?
• Performance
 How fast the transient response would disappear?
 How large the steady state error e would be?
• Robustness
 Will the disturbances affect the desired performance/stability?
• Optimality
 Can we save the energy of input u?
• Adaptability
 Can we learn to play?

2018/9/12 NASA Lab - NTUEE 91


Impulse Response

ẟ(t) P(s) p(t)

• Impulse response p(t)


 The system P(s)’s output when presented with a unity impulse as the input.
 Inverse Laplace Transform of P(s)

𝑝 𝑡 = ℒ −1 {𝑃 𝑠 }
 For any input u(t), the output y(t) would equal the convolution of p(t) and u(t)
𝑦 𝑡 =𝑝 𝑡 ⊗𝑢 𝑡 =ℒ −1 {𝑃 𝑠 𝑈(𝑠)}

2018/9/12 NASA Lab - NTUEE 92


Stability

• Stability is everything.
• One of the definitions of stability for LTI systems
 P(s) is stable if p(t)0 as t∞
 P(s) is neutrally stable (marginally stable) if |p(t)| < M, p(t)↛0 as t∞
 P(s) is unstable if |p(t)| ∞ as t∞
p(t)

p(t)

p(t)
• P.S. Stability of nonlinear and time-varying systems is complicated

2018/9/12 NASA Lab - NTUEE 93


Unstable Pendulum

• https://www.youtube.com/watch?v=R4V6ByEIWt4

2018/9/12 NASA Lab - NTUEE 94


Stability Condition

• Stable if all Re{pi}< 0 (in RHP)


• Neutrally stable (marginally stable) if no Re{pi} > 0 and at least one non-repeated pole on jω-axis
(Re{pi} = 0)
• Unstable if at least one Re{pi} > 0 (in LHP) or repeated pole on jω-axis

Note: Repeated real pole

2018/9/12 NASA Lab - NTUEE 95


Examples

2018/9/12 NASA Lab - NTUEE 96


Quick Check of Stability

Why?

2018/9/12 NASA Lab - NTUEE 97


Example

2018/9/12 NASA Lab - NTUEE 98


Routh’s Stability Criterion

• Independently proposed by Routh (1874) and Hurwitz (1895)


• Determining the root locations without solving the polynomial equation
• Useful before the availability of MATLAB (check “pzmap”)

2018/9/12 NASA Lab - NTUEE 99


Example

2018/9/12 NASA Lab - NTUEE 100


Example

2018/9/12 NASA Lab - NTUEE 101


Example

2018/9/12 NASA Lab - NTUEE 102


Example

2018/9/12 NASA Lab - NTUEE 103


Example

(Complex poles)

2018/9/12 NASA Lab - NTUEE 104


Stabilizing Controller

• We can stabilize an unstable system by feedback control


• Can we “directly” use feedforward control to stabilize an unstable system (aka to cancel unstable
pole)?
 Never try this.

2018/9/12 NASA Lab - NTUEE 105


P-Controller Design Using Routh Stability Criteria

• Control spec: Stabilize the 3-rd order system by applying a P-controller (constant gain K)

106
P-Controller Design Using Ruth Stability Criteria

107
PI-Controller Design Using Routh Stability Criteria

• Control spec:
 Remove the steady-state error of tracking a step function by applying a PI-controller.
 Make sure the closed-loop system is stable.

• P.S. PI-controller removes the steady-state error of tracking a step function, but creates stability
issue simultaneously. We will discuss the steady-state error and PID controller design later.

2018/9/12 NASA Lab - NTUEE 108


PI-Controller Design Using Routh Stability Criteria

2018/9/12 NASA Lab - NTUEE 109


Today’s Highlights

• Stability is everything.

2018/9/12 NASA Lab - NTUEE 110


Lecture 5: Dynamic Response
Time-domain specifications

2018/9/12 NASA Lab - NTUEE 111


Control Engineering: Make the System Moves as Desired

𝑢 = arcmin(𝑟 − 𝑦)
𝑢

• Stability
 Will the error e converge?  Check the system’s pole locations.
• Performance
 How fast the transient response would disappear?
 How large the steady state error e would be?
• Robustness
 Will the disturbances affect the desired performance/stability?
• Optimality
 Can we save the energy of input u?
• Adaptability
 Can we learn to play?

2018/9/12 NASA Lab - NTUEE 112


Impulse Response

ẟ(t) P(s) p(t)

𝑃(𝑠)

• Impulse response h(t)


 The system P(s)’s output when presented with a unity impulse as the input.
 Inverse Laplace Transform of P(s)

𝑝 𝑡 = ℒ −1 {𝑃 𝑠 }
 For any input u(t), the output y(t) would equal the convolution of p(t) and u(t)
𝑦 𝑡 =𝑝 𝑡 ⊗𝑢 𝑡 =ℒ −1 {𝑃 𝑠 𝑈(𝑠)}
 Problem: How to generate an impulse input in reality?

2018/9/12 NASA Lab - NTUEE 113


Step Response

1(t) P(s) y(t)

𝑃(𝑠)

• Step response
 The system P(s)’s output when presented with a unity step as the input.
 Integration of impulse response since t = 0
 Feasible and common

2018/9/12 NASA Lab - NTUEE 114


Time-Domain Specifications

Transient Steady State

2018/9/12 NASA Lab - NTUEE 115


Step Response of a Second Order System

𝑃(𝑠)

𝑃(𝑠)

2018/9/12 NASA Lab - NTUEE 116


Rise Time of a Second Order System

• Rise time – required time from y=0.1 to y=0.9

• Normally used; accurate only for a second-order system with no zeros


• Higher than second order?  Model reduction/approximation

2018/9/12 NASA Lab - NTUEE 117


Overshoot and Peak Time of a Second Order System

(ln 𝑀𝑝 )2
𝜁=
𝜋 2 + (ln 𝑀𝑝 )2

2018/9/12 NASA Lab - NTUEE 118


Settling Time of a Second Order System

2018/9/12 NASA Lab - NTUEE 119


Pole Placement Based on Time-Domain Specifications

• Control spec:
 Settling time less than ts (sec)

 Rise time less than tr (sec)

 Overshoot less than Mp (%)

(ln 𝑀𝑝 )2
𝜁≥
𝜋 2 + (ln 𝑀𝑝 )2

𝛽 = 𝑠𝑖𝑛−1 𝜁

2018/9/12 NASA Lab - NTUEE 120


Example

• Control spec:

𝛽 = 𝑠𝑖𝑛−1 𝜁 = 𝑠𝑖𝑛−1 0.6 ≅ 37°


37°

2018/9/12 NASA Lab - NTUEE 121


P-Controller Design Based on Time-Domain Specifications

2018/9/12 NASA Lab - NTUEE 122


P-Controller Design Based on Time-Domain Specifications

2018/9/12 NASA Lab - NTUEE 123


Example – Dominant Poles

• The dominant modes (poles) is usually 5~10 times less than the other modes (poles)
• Since the other modes decay faster than the dominant modes, we can ignore them
• Example:

20
𝑃 𝑠 = ⇒ 𝑝𝑜𝑙𝑒𝑠 𝑎𝑡 − 10, −1 ± 𝑗
(𝑠 + 10)(𝑠 2 + 2𝑠 + 2)

20
= 𝑠
10( + 1)(𝑠 2 + 2𝑠 + 𝑠)
10
20 2 1
≅ = ⇒𝜁≅ , 𝑤𝑛 ≅ 2
10(𝑠 2 + 2𝑠 + 2) 𝑠 2 + 2𝑠 + 2 2

⇒ 𝑡𝑟 ≅ 1.27𝑠, 𝑡𝑠 ≅ 4.6𝑠 , 𝑀𝑝 ≅ 5%

2018/9/12 NASA Lab - NTUEE 124


Example – Dominant Poles

• MATLAB is our good friend


P1 = tf([20],[1 12 22 20]);
P2 = tf([2],[1 2 2]);
step(P1); hold on; step(P2); legend('High-order','Reduced Order’);

2018/9/12 NASA Lab - NTUEE 125


Summary of Time-Domain Specifications

2018/9/12 NASA Lab - NTUEE 126


MATLAB Tutorial

2018/9/12 NASA Lab - NTUEE 127


Useful MATLAB Functions

tf Build system by transfer function


zpk Build system by zeroes, poles and gain
ss Build system using state space representation
pzmap See where are the poles and zeros
impulse Impulse response
step Step response
bode Bode plot
nyquist Nyquist plot
rlcous root locus

2018/9/12 NASA Lab - NTUEE 128


Today’s Highlights

• There are lots of approximation in control engineering. This necessitates design fine tuning when
implementation.
• MATLAB is our good friend

2018/9/12 NASA Lab - NTUEE 129


Lecture 6: Basic Properties of Feedback Control
Open-loop vs. Closed-loop control

2018/9/12 NASA Lab - NTUEE 130


Framework of Control Systems

C(s) P(s)

C(s) P(s)

2018/9/12 NASA Lab - NTUEE 131


Control Objectives – Stability

• BIBO stability
 [u(t), y(t)] converge to zero when [r(t), w(t), v(t)] are impulses

2018/9/12 NASA Lab - NTUEE 132


Control Objectives – Performance

• Tracking
 y(t) follows r(t)

2018/9/12 NASA Lab - NTUEE 133


Control Objectives – Performance

• Regulation
 Keep y(t) near a constant setpoint r (e.g. zero) in the presence of w(t) and v(t)

2018/9/12 NASA Lab - NTUEE 134


Control Objectives – Performance

• Control effort
 Keep u(t) small (Do not exceed the actuator’s capacity)

e(t) u(t)
r(t) y(t)

2018/9/12 NASA Lab - NTUEE 135


Problems of Open-Loop Control

• Cannot handle unstable plants


2
 Example: for P 𝑠 =
𝑠−5
Ideally, we can do pole-zero cancellation
500(𝑠 − 5) 1000
C 𝑠 = ⇒𝑌 𝑠 =P 𝑠 C 𝑠 𝑅 𝑠 = 𝑅 𝑠 ≅𝑅 𝑠
𝑠 + 1000 𝑠 + 1000
2
In reality, modeling error exists and P 𝑠 =
𝑠−5.0001

500(𝑠 − 5) 1000(𝑠 − 5)
C 𝑠 = ⇒𝑌 𝑠 =P 𝑠 C 𝑠 𝑅 𝑠 = 𝑅 𝑠
𝑠 + 1000 (𝑠 − 5.0001)(𝑠 + 1000)

Unstable pole is not cancelled, resulting in unstable output y(t).

• Cannot handle disturbances


𝑌 𝑠 = 𝐶 𝑠 𝑃 𝑠 𝑅 𝑠 + 𝑃 𝑠 𝑊(𝑠)
E 𝑠 = 𝑅 𝑠 − 𝑌 𝑠 = 1 − 𝑃 𝑠 𝐶 𝑠 𝑅 𝑠 − 𝑃 𝑠 𝑊(𝑠)

The controller C(s) has no influence on this term.

2018/9/12 NASA Lab - NTUEE 136


Feedback Control

e
C(s) P(s)

𝑃 𝑠 𝐶(𝑠) 𝑃(𝑠) −𝑃 𝑠 𝐶(𝑠)


𝑌 𝑠 = 𝑅 𝑠 + 𝑊 𝑠 + 𝑉(𝑠)
1+𝑃 𝑠 𝐶 𝑠 1+𝑃 𝑠 𝐶 𝑠 1+𝑃 𝑠 𝐶 𝑠

• Stability
Char. Equation: 1 + 𝑃 𝑠 𝐶 𝑠 =0
⇒ Design C(s) to ensure closed-loop poles at LHP

• Performance
𝟏 𝑷 𝑪 𝑷𝑪
𝟏 + 𝑷𝑪 𝟏 + 𝑷𝑪 𝟏 + 𝑷𝑪 𝟏 + 𝑷𝑪
Tracking Regulation Ctrl Effort Reg/Ctrl
(E/R) (E/W) (U/R) (E/V, U/W)

Small when C ∞ Small when C 0

Design trade-off

2018/9/12 NASA Lab - NTUEE 137


Example – P-controller on a First Order System

P(s) C(s)

PC
PC

2018/9/12 NASA Lab - NTUEE 138


Example – P-controller on a First Order System

C
PC

2018/9/12 NASA Lab - NTUEE 139


Summary – Open-Loop vs. Closed-Loop Control

• Open-loop feedforward control


 Cannot handle unstable systems
 Cannot handle disturbance
• Closed-loop feedback control
 Perfect!?

2018/9/12 NASA Lab - NTUEE 140


Summary – Open-Loop vs. Closed-Loop Control

• Open-loop feedforward control


 Cannot handle unstable systems
 Cannot handle disturbance
• Closed-loop feedback control
 Perfect!? Feedback control is not as good as you thought
 Delay – closed-loop control fixes the error until it “sees” it
• Less precise on tracking problem
• Example: Unmanned vehicle control

Feedback control Feedforward control Feedback + Feedforward

2018/9/12 NASA Lab - NTUEE 141


Unmanned Vehicle Control

Transient response

Steady state error

2018/9/12 NASA Lab - NTUEE 142


Today’s Highlights

• Feedback control is not as good as you thought (but it is still powerful)

2018/9/12 NASA Lab - NTUEE 143


Lecture 7: Basic Properties of Feedback Control
Steady state error

2018/9/12 NASA Lab - NTUEE 144


Feedback Control

Open-loop (loop gain) L(s)

+ e u
r C P y
-
Closed-loop system H(s)

2018/9/12 NASA Lab - NTUEE 145


Control Engineering: Make the System Moves as Desired

𝑢 = arcmin(𝑟 − 𝑦)
𝑢

• Stability
 Will the error e converge?  Check the system’s pole locations.
• Performance
 How fast the transient response would disappear?
 How large the steady state error e would be?
• Robustness
 Will the disturbances affect the desired performance/stability?
• Optimality
 Can we save the energy of input u?
• Adaptability
 Can we learn to play?

2018/9/12 NASA Lab - NTUEE 146


Steady State Error

• Error in steady state

• Closed-loop steady state error can be analyzed and predicted by the open-loop plant model P(s)
and controller C(s)

2018/9/12 NASA Lab - NTUEE 147


Let’s Repeat Three Times

• Closed-loop steady state error can be analyzed and predicted by the open-loop plant model P(s)
and controller C(s)
• Closed-loop steady state error can be analyzed and predicted by the open-loop plant model P(s)
and controller C(s)
• Closed-loop steady state error can be analyzed and predicted by the open-loop plant model P(s)
and controller C(s)

𝟏
𝑳 𝒔 =𝑷 𝒔 𝑪 𝒔 𝑬 𝒔 =
𝟏 + 𝑳(𝒔)
𝐿(𝑠)
(Steady state error of H s = )
1+𝐿(𝑠)

• How? By looking at the “system type” of L(s). (P.S. L(s) is also called “loop gain”)

2018/9/12 NASA Lab - NTUEE 148


System Type

• L(s) is type K iff


 It doesn’t have any unstable (RHP) pole
 It has K poles at origin

2018/9/12 NASA Lab - NTUEE 149


Error Constant

2018/9/12 NASA Lab - NTUEE 150


Table of Steady State Error

2018/9/12 NASA Lab - NTUEE 151


Example – P-Controller for a Type 0 System
1
Ex: 𝑷 𝒔 = 𝑪(𝐬) = 𝑘
𝑠+1

PC

PC
PC

For type 0 system,


constant gain controller
cannot eliminate the
steady state error in the
step response, and
cannot follow the ramp
command at all.

2018/9/12 NASA Lab - NTUEE 152


Example – I-Controller for a Type 0 System

1 𝑘
Ex: 𝑷 𝒔 = 𝑠+1 𝑪(𝐬) = 𝑠

PC

For type 0 system,


integral control
improves steady
state error!

2018/9/12 NASA Lab - NTUEE 153


The Final Value Theorem

• FVT

• The “Table of Steady State Error” is derived from FVT. Memorizing the table is not recommended.

2018/9/12 NASA Lab - NTUEE 154


Example – Determine Steady State Error Using FVT
1
• Example: ramp response U(s) = 2
𝑠
𝑎(𝑠)
Let L(s) = 𝑘
𝑠 𝑏(𝑠)
1
lim 𝑒 𝑡 = lim 𝑠 E s = lim 𝑠 U 𝑠
𝑡⟶∞ 𝑠⟶0 𝑠⟶0 1+L 𝑠
𝑠 𝑘+1 𝑏 𝑠 𝑠 𝑘−1 𝑏 𝑠
= lim 𝑘 𝑈 𝑠 = lim 𝑘
𝑠⟶0 𝑠 𝑏 + 𝑎 𝑠 𝑠⟶0 𝑠 𝑏 + 𝑎 𝑠

 If k=0 (L is type 0)
lim 𝑒 𝑡 → ∞
𝑡⟶∞

 If k=1 (L is type 1)
𝑏(0) 1
lim 𝑒 𝑡 = ≜
𝑡⟶∞ 𝑎(0) 𝐾𝑣
 If k>=2 (L at least type 2)

lim 𝑒 𝑡 = 0
𝑡⟶∞
2018/9/12 NASA Lab - NTUEE 155
Internal Model Principle

Asymptotic regulation w.r.t. an external signal is achieved by place the dynamics of the signal
in the feedback path between the input and output to be regulated.

• Translation: If we wanna track a ramp, make sure the “ramp” is included in our loop gain L(s)

• Example:
 By applying an I-controller, type 0 plant can track a step without steady state error.
 Type 1 plant (including one integrator / one pole at origin) itself can track a step without steady
state error. However, there is a non-zero steady state error when it tracks a ramp.
• To further eliminate the steady state error when it tracks a ramp, apply an I-controller.
 Type 2 plant (including double integrators / two poles at origin) itself can track a ramp without
steady state error.
 Notch filters

2018/9/12 NASA Lab - NTUEE 156


First Milestone: Control Analysis in Time Domain

𝑢 = arcmin(𝑟 − 𝑦)
𝑢

• Stability
 Will the error e converge?  Check the system’s pole locations.
• Performance
 How fast the transient response would disappear?
 How large the steady state error e would be?
• Robustness
 Will the disturbances affect the desired performance/stability?
• Optimality
 Can we save the energy of input u?
• Adaptability
 Can we learn to play?

2018/9/12 NASA Lab - NTUEE 157


Today’s Highlights

• Closed-loop steady state error can be analyzed and predicted by the open-loop plant model P(s)
and controller C(s)
• The “Table of Steady State Error” is derived from FVT. Memorizing the table is not recommended.

2018/9/12 NASA Lab - NTUEE 158


Lecture 8: Basic Properties of Feedback Control
PID control

2018/9/12 NASA Lab - NTUEE 159


Feedback Control

Open-loop plant P(s)


Motor, inverted pendulum, UAV…

+ e u
r C P y
-
Closed-loop System H(s)

Controller C(s)
PID, lead-lag, state observer feedback…
implemented on a digital computer or an analog circuit

2018/9/12 NASA Lab - NTUEE 160


PID Control

𝐾𝐼
𝐶 𝑠 = 𝐾𝑃 + + 𝐾𝐷 𝑠
𝑠

𝑢 𝑡 = 𝐾𝑃 𝑒 𝑡 + 𝐾𝐼 න 𝑒 𝑡 𝑑𝑡 + 𝐾𝐷 𝑒(𝑡)

0

• PID control
 KP – Proportional: Faster response
 KI – Integral: Better steady state response
 KD – Derivative: Faster convergence

2018/9/12 NASA Lab - NTUEE 161


Why PID Works?

• Let’s analyze different controllers applied on a second order spring-mass-damper system

2018/9/12 NASA Lab - NTUEE 162


P-Controller: Faster Response 𝐶 𝑠 = 𝐾𝑃
• Closed-loop poles

𝑃 1 −𝑐 ± 𝑐 2 − 4𝑚𝑘෨
𝐻= = ⇒ Poles at
1 + 𝑃𝐶 𝑚𝑠 2 + 𝑐𝑠 + (𝑘 + 𝐾𝑃 ) 2𝑚

𝑘෨
• Tuning KP

2018/9/12 NASA Lab - NTUEE 163


Example – P-Controller

2018/9/12 NASA Lab - NTUEE 164


D-Controller: Faster Convergence 𝐶 𝑠 = 𝐾𝐷 𝑠
• Closed-loop poles
𝑃 1 −𝑐ǁ ± 𝑐ǁ 2 − 4𝑚𝑘
𝐻= = ⇒ Poles at
1 + 𝑃𝐶 𝑚𝑠 2 + (𝑐 + 𝐾𝐷 )𝑠 + 𝑘 2𝑚

𝑐ǁ
• Tuning KD

2018/9/12 NASA Lab - NTUEE 165


Example – D-Controller

2018/9/12 NASA Lab - NTUEE 166


PD-Controller

C(s)

In general,
PD controller offers
Good transient.

2018/9/12 NASA Lab - NTUEE 167


𝐾𝐼
I-Controller: Better Steady State Response 𝐶 𝑠 =
𝑠
• Loop gain
𝐾𝐼
𝐿 = 𝑃𝐶 = ⇒ Type 1 system. Zero steady-state error in the step response.
𝑚𝑠 3 + 𝑐𝑠 2 + 𝑘𝑠
• Closed-loop poles
𝑃 1
𝐻= =
1 + 𝑃𝐶 𝑚𝑠 3 + 𝑐𝑠 2 + 𝑘𝑠 + 𝐾𝐼
• Tuning KI

2018/9/12 NASA Lab - NTUEE 168


I-Controller: Better Steady State Response

• Tuning KI

2018/9/12 NASA Lab - NTUEE 169


PID Control

C(s)

2018/9/12 NASA Lab - NTUEE 170


PID Tuning

https://en.wikipedia.org/wiki/PID_controller
2018/9/12 NASA Lab - NTUEE 171
PID Tuning

https://en.wikipedia.org/wiki/PID_controller
2018/9/12 NASA Lab - NTUEE 172
PID Tuning

https://www.youtube.com/watch?v=fusr9eTceEo

2018/9/12 NASA Lab - NTUEE 173


Second Milestone: PID Control

r u y
Plant

2018/9/12 NASA Lab - NTUEE 174


Digital PID Control

• Discretization and approximation when Δt is sufficiently small (details will be covered in Digital Control)

Integral action:

Derivative action:

• Pseudo code

2018/9/12 NASA Lab - NTUEE 175


Integral Action Maintains Steady State

t ∞ t ∞
r=y r=y
e=0 e=0
𝑡

𝑢 𝑡 = 𝐾𝑃 𝑒 𝑡 + 𝐾𝐼 න 𝑒 𝑡 𝑑𝑡 + 𝐾𝐷 𝑒(𝑡)

0

⇒ 𝑢 ∞ = 𝐾𝐼 න 𝑒 𝑡 𝑑𝑡 = 𝑐𝑜𝑛𝑠𝑡𝑎𝑛𝑡
0

2018/9/12 NASA Lab - NTUEE 176


Example – Regulating Pendulum at Non-vertical Position

reference

Gravity compensation
by integral action

Gravity

2018/9/12 NASA Lab - NTUEE 177


Integral Windup
Control saturation

Large e (e.g. the beginning of the step response)


 uC > umax
 Control saturated u = umax
 Output y moves slower than the controller expected
 It seems that the integral action is not sufficient; more e (e>0) is integrated
 When y finally reaches r, the integral action is larger than the system’s need
 Create an huge overshoot at y (e<0) until the integrator is discharged

2018/9/12 NASA Lab - NTUEE 178


Example – Integral Windup

2018/9/12 NASA Lab - NTUEE 179


Example – Integral Windup after External Disturbance

https://www.youtube.com/watch?v=w-J5NQDE7Co

2018/9/12 NASA Lab - NTUEE 180


Integrator Anti-Windup

2018/9/12 NASA Lab - NTUEE 181


Example – Anti-Windup Compensation for a PI Controller
𝟏 𝑲𝑰 𝟒
𝑷 𝒔 = 𝑪 𝒔 = 𝑲𝒑 + =𝟐+
𝒔 𝒔 𝒔

• The input is limited to ±1.0

• Comparison of step responses

2018/9/12 NASA Lab - NTUEE 182


Today’s Highlights

• PID is the most popular method in industry

• See how Brian Douglas teaches PID


• https://www.youtube.com/watch?v=UR0hOmjaHp0&list=PLUMWjy5jgHK20UW0yM22HYEUTMJfla7
Mb

2018/9/12 NASA Lab - NTUEE 183


Lecture 9: Root Locus Design Method

2018/9/12 NASA Lab - NTUEE 184


Where are the Closed-Loop Poles if K is changed?

• Lots of Calculation

2018/9/12 NASA Lab - NTUEE 185


Root Locus Design Method

• The “trajectories” of the closed-loop poles due to the changing of a constant control gain can be
directly derived by analyzing the open-loop system

2018/9/12 NASA Lab - NTUEE 186


Let’s Repeat Three Times

• The “trajectories” of the closed-loop poles due to the changing of a constant control gain can be
directly derived by analyzing the open-loop system
• The “trajectories” of the closed-loop poles due to the changing of a constant control gain can be
directly derived by analyzing the open-loop system
• The “trajectories” of the closed-loop poles due to the changing of a constant control gain can be
directly derived by analyzing the open-loop system

• Control engineers love shortcuts


 Both steady state error and closed-loop poles are determined by checking the open-loop
system

2018/9/12 NASA Lab - NTUEE 187


Examples and Problem Formulation
Evans form of characteristic equation
• Example – P-controller
𝐶 𝑠 =𝐾 ⇒ 1 + 𝑃 𝑠 𝐶 𝑠 = 1 + 𝐾𝑃 𝑠 = 0 ⇒ How do the roots move as KP changes?

𝐿(𝑠)

• Example – Low pass filter


1 𝑃(𝑠)
𝐶 𝑠 = ⇒1+𝑃 𝑠 𝐶 𝑠 =1+ =0
𝑠+𝐾 𝑠+𝐾

⇒𝑠+𝐾+𝑃 𝑠 =0

1
⇒1+𝐾 =0 ⇒ How do the roots move as K changes?
𝑠 + 𝑃(𝑠)

𝐿(𝑠)

• Problem formulation
 Given L(s), plot the roots of 1+KL(s) on the complex plane as K:0∞
• The resulting trajectories are called the “root locus”
 P.S. L(s) represents the open-loop plant excluding the control gain K. Here it is not the loop
gain we referred previously.

2018/9/12 NASA Lab - NTUEE 188


How to Draw the Root Locus?

• MATLAB
 rlocus(L)
• Hand sketching
 This is why students hate control theory
 Accurate hand drawing is not required, but knowing how to roughly sketch the root locus is
helpful in control design.
• For example, sometimes P-controllers cannot stabilize an open-loop unstable system.
Root locus will show us this property without any calculation.

2018/9/12 NASA Lab - NTUEE 189


Basic Characterization

2018/9/12 NASA Lab - NTUEE 190


Phase Constraint

2018/9/12 NASA Lab - NTUEE 191


Root Locus Drawing Rules: Symmetry to the Real Axis

2018/9/12 NASA Lab - NTUEE 192


Root Locus Drawing Rules: Start from O.L. Poles, End at O.L. Zeros / Infinity

2018/9/12 NASA Lab - NTUEE 193


Examples

2018/9/12 NASA Lab - NTUEE 194


Root Locus Drawing Rules: Root Locus on Real Axis

Due to the phase constraint

G F E D CB A

2018/9/12 NASA Lab - NTUEE 195


Example

2018/9/12 NASA Lab - NTUEE 196


Example

2018/9/12 NASA Lab - NTUEE 197


Example

2018/9/12 NASA Lab - NTUEE 198


Root Locus Drawing Rules: Asymptote

2018/9/12 NASA Lab - NTUEE 199


Derivation of Rule 3

∵𝑠→∞

∵ (1 − 𝑥)𝑛 ≅ 1 − 𝑛𝑥

-1

2018/9/12 NASA Lab - NTUEE 200


Examples

2018/9/12 NASA Lab - NTUEE 201


Root Locus Drawing Rules: Departure and Arrival Angle

2018/9/12 NASA Lab - NTUEE 202


Examples

2018/9/12 NASA Lab - NTUEE 203


Example

2018/9/12 NASA Lab - NTUEE 204


Root Locus Drawing Rules: Intersection with Image Axis

• Example

2018/9/12 NASA Lab - NTUEE 205


Root Locus Drawing Rules: Breakaway Point

RULE 6. The real axis break-in and breakaway points 𝜎 satisfy


𝑑𝐿(𝑠)
ቤ =0
𝑠 𝑠=𝜎
Note: This is only a necessary condition

Real axis break-in and breakaway points

⟹ 1+KL(s)=0 has repeated roots on the real axis at 𝜎

𝑑 𝑑𝐿(𝑠)
⟹ 1 + 𝐾𝐿 𝑠 ቤ = ቤ =0
𝑠 𝑠=𝜎
𝑠 𝑠=𝜎

2018/9/12 NASA Lab - NTUEE 206


Example

𝑠+2
𝐿 𝑠 =
𝑠 2 + 2𝑠 + 2

𝑑𝐿(𝑠) 2𝑠 + 2 𝑠 + 2 − (𝑠 2 + 2𝑠 + 2)
=
𝑠 (𝑠 2 + 2𝑠 + 2)2

𝑠 2 + 4𝑠 + 2
= 2
(𝑠 + 2𝑠 + 2)2

𝑑𝐿(𝑠)
Let =0 ⇒ 𝑠 = −0.586, −3.414
𝑠
K<0 K>0

2018/9/12 NASA Lab - NTUEE 207


Control Design Using Root Locus

• Time-domain specifications  Region of interest (ROI) in s-plane


 Select the intersection between root locus and ROI
 Plugin the selected closed-loop poles into 1+KL(s)=0 and solve for K

2018/9/12 NASA Lab - NTUEE 208


Example – P-Controller Design

overshoot Mp = 5%

1 + 𝐾𝐿 𝑠 ቚ
𝑠=−1+𝑗
𝐾
=1+ ቤ
𝑠(𝑠 + 2) 𝑠=−1+𝑗
=0

⟹𝐾=2

2018/9/12 NASA Lab - NTUEE 209


More Insights from Root Locus

• This case shows that P-controller won’t have stability issue on a second order system
• Larger K introduces bigger overshoot
• Open-loop pole at origin  steady state error for step response = 0

overshoot Mp = 5%

2018/9/12 NASA Lab - NTUEE 210


Design Problem

C(s) P(s)
P(s)

2018/9/12 NASA Lab - NTUEE 211


P- and PD- Control

C(s)

C(s)

2018/9/12 NASA Lab - NTUEE 212


Lead and Lag Compensator

C(s)

C(s)

C(s)

C(s)

2018/9/12 NASA Lab - NTUEE 213


Lead Compensator

C(s)

C(s) C(s)
Pick this
2018/9/12 NASA Lab - NTUEE 214
Lead Compensator

C(s)

2018/9/12 NASA Lab - NTUEE 215


Oops! We Forgot Steady State Error

C(s) C(s)

2018/9/12 NASA Lab - NTUEE 216


Lag Compensator

C(s)

2018/9/12 NASA Lab - NTUEE 217


Final Design

C(s)

2018/9/12 NASA Lab - NTUEE 218


Today’s Highlights

• Accurate hand drawing (of root locus) is not required, but knowing how to roughly sketch the root
locus is helpful in control design.

• See how Brian Douglas teaches root locus


• https://www.youtube.com/watch?v=CRvVDoQJjYI&list=PLUMWjy5jgHK3-
ca6GP6PL0AgcNGHqn33f

2018/9/12 NASA Lab - NTUEE 219


Lecture 10: Frequency-Response Design Method
Bode and Nyquist plots

2018/9/12 NASA Lab - NTUEE 220


Reasons for the Frequency-Response Design Method

• Good design with plant uncertainty


• Experimental information can be used
• No intermediate processing of the data (Picture Story)
• Easiest method for compensation design

2018/9/12 NASA Lab - NTUEE 221


Frequency Response

• Sine in, sine out

unity amplitude

𝑢 𝑡 = 𝑠𝑖𝑛 𝑤0 𝑡 1(𝑡)

𝑤0
𝑈 𝑠 =
𝑠 2 + 𝑤02

𝑤0
𝑌 𝑠 = 𝐺(𝑠)
𝑠 2 + 𝑤02

2018/9/12 NASA Lab - NTUEE 222


Frequency Response

−1
Im 𝛼0
Disappear if G(s) is stable Magnitude Phase 𝜙 = tan ( )
Re 𝛼0
Same frequency as u(t)

2018/9/12 NASA Lab - NTUEE 223


Frequency Response

• In steady state

𝑦 𝑡 = 2|𝛼0 |𝑠𝑖𝑛(𝑤0 𝑡 + 𝜙)

≜ |𝐺(𝑗𝑤0 )|𝑠𝑖𝑛(𝑤0 𝑡 + ∠𝐺(𝑗𝑤0 ))


Magnitude Phase

• Frequency response: “If a sine wave is injected into a system at a given frequency, a linear system
will respond at that same frequency with a certain magnitude and a certain phase angle relative to
the input.”

• For any sinusoidal input with the same frequency 𝑤0 : 𝑢 𝑡 = 𝐴𝑠𝑖𝑛 𝑤0 𝑡 + 𝜃

𝑦 𝑡 = 𝐴|𝐺(𝑗𝑤0 )|𝑠𝑖𝑛(𝑤0 𝑡 + 𝜃 + ∠𝐺(𝑗𝑤0 ))


Amplified by the magnitude Shifted by the phase

2018/9/12 NASA Lab - NTUEE 224


Let’s Repeat Three Times

• Frequency response: “If a sine wave is injected into a system at a given frequency, a linear system
will respond at that same frequency with a certain magnitude and a certain phase angle relative to
the input.”
• Frequency response: “If a sine wave is injected into a system at a given frequency, a linear system
will respond at that same frequency with a certain magnitude and a certain phase angle relative to
the input.”
• Frequency response: “If a sine wave is injected into a system at a given frequency, a linear system
will respond at that same frequency with a certain magnitude and a certain phase angle relative to
the input.”

𝑢 𝑡 = 𝐴𝑠𝑖𝑛 𝑤0 𝑡 + 𝜃

G(s)

𝑦 𝑡 = 𝐴|𝐺(𝑗𝑤0 )|𝑠𝑖𝑛(𝑤0 𝑡 + 𝜃 + ∠𝐺(𝑗𝑤0 ))

• Control engineers love shortcuts.

2018/9/12 NASA Lab - NTUEE 225


Bode and Nyquist Plot

• Presenting the frequency response with regard to varying frequency components (w:0∞)
 Bode plot
• Plotting magnitude and phase separately
 Nyquist plot
• Plotting magnitude and phase jointly on the complex plane
• Why not just pick one?

Bode plot Nyquist plot

2018/9/12 NASA Lab - NTUEE 226


Why Bode Plot?

2018/9/12 NASA Lab - NTUEE 227


Bode Plots for Real Pole and Zero

Slope = +20dB

log scale

Slope = -20dB

log scale

2018/9/12 NASA Lab - NTUEE 228


Bode Plots for Complex Pole and Zero

Slope = -40dB

2018/9/12 NASA Lab - NTUEE 229


How to Acquire the Bode Plot of a System?

• From dynamic modeling and transfer function


 MATLAB is our good friend: bode(P)
 Manual sketching
1. Factor the transfer function into the product of basic elements (real/complex poles/zeros)
2. Sketch the basic elements
3. Put them together
• Magnitude: Sum in log scale
• Phase: Sum in linear scale
• From experimental data (aka system identification)
 Point by point: sine sweep
 FFT: step response, chirp…

2018/9/12 NASA Lab - NTUEE 230


Example

2018/9/12 NASA Lab - NTUEE 231


Example

2018/9/12 NASA Lab - NTUEE 232


What Can be Seen from a Bode Plot?

• Relative degree
• Low freq. behavior (DC gain)
• Number of poles, zeroes (expert level)

2018/9/12 NASA Lab - NTUEE 233


Error Constant from the Bode Plot of Loop Gain

|L(jw)|

2018/9/12 NASA Lab - NTUEE 234


Minimum Phase System

• All poles and zeros at LHP


• One-to-one mapping between magnitude and phase plot

2018/9/12 NASA Lab - NTUEE 235


Non-minimum Phase System

Minimum phase

Non-minimum phase
(RHP zero)

2018/9/12 NASA Lab - NTUEE 236


Sensitivity Function

• Definition

𝐸 𝑠 1
𝑆≜ =
𝑅 𝑠 1 + 𝐿(𝑠)

• Example

2018/9/12 NASA Lab - NTUEE 237


Nyquist Plot

2018/9/12 NASA Lab - NTUEE 238


Nyquist Plot

• Some tips
1. L(-jw) = L(jw), therefore w:0∞ is symmetric to w:0-∞
2. The Nyquist plot must be continuous and smooth.
3. L(j∞) = 0 if n = # of pole > m = # of zero
4. Depart angle at w0 = -90*(System Type)
5. Arrival angle at w∞ = -90*(n-m)
6. Little skill
1 1 −𝑗𝜙
= 𝑒
𝑟𝑒 𝑗𝜙 𝑟

2018/9/12 NASA Lab - NTUEE 239


Example

2018/9/12 NASA Lab - NTUEE 240


Example

2018/9/12 NASA Lab - NTUEE 241


Example

2018/9/12 NASA Lab - NTUEE 242


Nyquist Path

Nyquist path Nyquist plot

Im{L(jw)}

𝟏
𝒓=
𝜿
𝜽 = −𝜷

2018/9/12 NASA Lab - NTUEE 243


Nyquist Path

• Multiple poles and zeros

ς 𝜿𝒛
𝒓=
ς 𝜿𝒑

𝜽 = ෍ 𝜷𝒛 − ෍ 𝜷𝒑

• P.S. The Nyquist path must not touch any pole and zero
 If there are poles or zeros on the imaginary axis, reroute the path around them with a small
radius

2018/9/12 NASA Lab - NTUEE 244


Example

2018/9/12 NASA Lab - NTUEE 245


Example
One more
pole at origin

2018/9/12 NASA Lab - NTUEE 246


Stability Condition Can be Derived from Nyquist Plot (TBC)

G(s)

2018/9/12 NASA Lab - NTUEE 247


Today’s Highlights

• Sine in, sine out.

2018/9/12 NASA Lab - NTUEE 248


Lecture 11: Frequency-Response Design Method
Nyquist stability criterion

2018/9/12 NASA Lab - NTUEE 249


Nyquist Plot

2018/9/12 NASA Lab - NTUEE 250


Why Nyquist Plot?

• Robustness analysis
 We hope our control design is robust to
1. Gain variation in the open-loop
2. Time delay in the open-loop
 The stability and robustness of the closed-loop system can be directly derived by analyzing
the Nyquist plot of the (minimum-phase) loop gain

2018/9/12 NASA Lab - NTUEE 251


Let’s Repeat Three Times

• The stability and robustness of the closed-loop system can be directly derived by analyzing the
Nyquist plot of the loop gain
• The stability and robustness of the closed-loop system can be directly derived by analyzing the
Nyquist plot of the loop gain
• The stability and robustness of the closed-loop system can be directly derived by analyzing the
Nyquist plot of the loop gain

𝐿(𝑠)
𝑳 𝒔 =𝑷 𝒔 𝑪 𝒔 Stability and robustness of
1+𝐿(𝑠)

• Control engineers love shortcuts


 Steady state error – Knowing closed-loop steady state error from open-loop loop gain
 Root locus – Knowing closed-loop pole locations from open-loop characteristic equation
 Nyquist stability criterion – Knowing closed-loop system stability from open-loop loop gain

2018/9/12 NASA Lab - NTUEE 252


Nyquist Stability Criterion

Loop gain

2018/9/12 NASA Lab - NTUEE 253


Magic Number: -1

2018/9/12 NASA Lab - NTUEE 254


Example

2018/9/12 NASA Lab - NTUEE 255


Example

Q: Can we determine the stability by using the root locus method?

2018/9/12 NASA Lab - NTUEE 256


Example – P-Controller Design using Nyquist Stability Criterion

2018/9/12 NASA Lab - NTUEE 257


Cauchy’s Argument Principle

2018/9/12 NASA Lab - NTUEE 258


Why?

2018/9/12 NASA Lab - NTUEE 259


Cauchy’s Argument Principle vs. Nyquist Stability Criterion

2018/9/12 NASA Lab - NTUEE 260


Poles on Imaginary Axis

2018/9/12 NASA Lab - NTUEE 261


Example

2018/9/12 NASA Lab - NTUEE 262


Example

2018/9/12 NASA Lab - NTUEE 263


Example (cont.)

2018/9/12 NASA Lab - NTUEE 264


Stability Margins

• Assume the nominal closed-loop system is stable.


• When the Nyquist plot of L(jw) touches -1, the closed-loop stability changes.
• “Distances” from the Nyquist to -1 are defined as “stability margins”.
• Do we have to sketch the Nyquist plot to determine the stability margins?
 Of course not. Control engineers love…you know.
 We will cover this in the next lecture.

2018/9/12 NASA Lab - NTUEE 265


Today’s Highlights

• Control engineers love…you know.

• See how Brian Douglas teaches Nyquist stability criterion


• https://www.youtube.com/watch?v=sof3meN96MA&list=PLUMWjy5jgHK0c6HObj5BAMwmsgV2OW
sjG

2018/9/12 NASA Lab - NTUEE 266


Lecture 12: Frequency-Response Design Method
Stability margins

2018/9/12 NASA Lab - NTUEE 267


Control Engineering: Make the System Moves as Desired

𝑢 = arcmin(𝑟 − 𝑦)
𝑢

• Stability
 Will the error e converge?  Check the system’s pole locations.
• Performance
 How fast the transient response would disappear?
 How large the steady state error e would be?
• Robustness
 Will the disturbances affect the desired performance/stability?
• Optimality
 Can we save the energy of input u?
• Adaptability
 Can we learn to play?

2018/9/12 NASA Lab - NTUEE 268


Challenges in Feedback Control Design

• Plant model P(s)


 Incorrect parameter values
 Ignored dynamics
• Controller C(s)
 Digital implementation
 Computational delay
 Quantization/Discretization error

Open-loop plant model P(s)


Motor, inverted pendulum, UAV…

+ e u
r C P y
-
Closed-loop System H(s)
Controller C(s)
PID, lead-lag, state observer feedback…
designed based on the model P(s)

2018/9/12 NASA Lab - NTUEE 269


Problem Formulation

• 𝜂𝑒 −𝑗𝜃 : complex parameter representing uncertainties


 𝜂: gain perturbation
 𝜃: phase perturbation (time delay)

• Problem formulation
 Nominal case: 𝜂 = 1, 𝜃 = 0. The closed-loop system is stable
 Perturbed case: : 𝜂 ≠ 1, 𝜃 ≠ 0. Is the closed-loop system still stable?

+ e u
r C 𝜼𝒆−𝒋𝜽 P y
-

Actual plant
2018/9/12 NASA Lab - NTUEE 270
Nyquist Stability Criterion

Loop gain L=PC

2018/9/12 NASA Lab - NTUEE 271


Stability Margins

• Assume the nominal closed-loop system (with loop gain 𝐿(𝑗𝑤)) is stable.
 When the Nyquist plot of 𝜂𝑒 −𝑗𝜃 𝐿(𝑗𝑤) touches -1, the closed-loop system becomes marginally
stable.

−𝑗𝜃 𝜂𝑒 −𝑗𝜃 𝐿 𝑗𝑤
=1
1 + 𝜂𝑒 𝐿 𝑗𝑤 = 0 ⟺ ൝
∠𝜂𝑒 −𝑗𝜃 𝐿 𝑗𝑤 = −180°

• “Shortest distances” from the Nyquist to -1 are defined as “stability margins”.


 Gain margin (GM): maximal tolerable uncertain gain 𝜂 (when 𝜃 = 0)
 Phase margin (PM): maximal tolerable uncertain phase 𝜃 (when 𝜂 = 1)

2018/9/12 NASA Lab - NTUEE 272


Gain Margin

• Gain perturbation scales the Nyquist plot

−𝜼𝜶

−𝜶
−𝜼𝜶

𝟏
⇒ 𝐆𝐌 ≜
𝜶

2018/9/12 NASA Lab - NTUEE 273


Phase Margin

• Phase perturbation (time delay) rotates the Nyquist plot

𝜽 < 𝝓 ⇒ 𝐏𝐌 ≜ 𝝓

2018/9/12 NASA Lab - NTUEE 274


Definition of Stability Margins

2018/9/12 NASA Lab - NTUEE 275


Stability Margins on Bode Plot

• Do we have to sketch the Nyquist plot to determine the stability margins?


 Of course not. Control engineers love…you know.

Nyquist plot Bode plot

Phase
Crossover
Frequency

Gain
Crossover
Frequency

2018/9/12 NASA Lab - NTUEE 276


Example

2018/9/12 NASA Lab - NTUEE 277


Example

2018/9/12 NASA Lab - NTUEE 278


Example

2018/9/12 NASA Lab - NTUEE 279


Multiple Crossover Frequencies

• Take the first one


• Example

2018/9/12 NASA Lab - NTUEE 280


Stability Conditions Using GM and PM

⇒ L(s) has
Closed-Loop System
STABLE GM < 1
⇍ PM > 0

⇐ Only valids when L(s) is stable,


minimum phase, monotonically decreasing in Bode plot

2018/9/12 NASA Lab - NTUEE 281


Small Gain Theorem

• PM = ∞ if L(jw) is inside the unity circle

2018/9/12 NASA Lab - NTUEE 282


Trade-Off between Robustness and Performance

• There's no such thing as a free lunch


 Better robustness  larger PM  lower bandwidth  worse tracking performance

2018/9/12 NASA Lab - NTUEE 283


Today’s Highlights

• There's no such thing as a free lunch.

2018/9/12 NASA Lab - NTUEE 284


Lecture 13: Frequency-Response Design Method
Lead and lag compensation

2018/9/12 NASA Lab - NTUEE 285


Loop Shaping Design

• Open-loop loop gain L(s)  Properties of the closed-loop system H(s)


• Desired closed-loop response H(s)  Design of open-loop loop gain L(s)
• For second-order systems

𝑤𝑛2 𝐻 𝑠 𝑤𝑛2
𝐻 𝑠 = 2 2 ⟹ 𝐿 𝑠 = 1 − 𝐻 𝑠 = 𝑠(𝑠 + 2𝜁𝑤 )
𝑠 + 2𝜁𝑤𝑛 𝑠 + 𝑤𝑛 𝑛

 How should the frequency response of L(jw) look like?

2018/9/12 NASA Lab - NTUEE 286


Gain Crossover Frequency

⟹ 𝟎. 𝟓 < 𝝃 < 𝟏

2018/9/12 NASA Lab - NTUEE 287


Stability Margins

2018/9/12 NASA Lab - NTUEE 288


Error Constant

2018/9/12 NASA Lab - NTUEE 289


Bandwidth

H(j𝜔)
H(j𝜔)

H(j𝜔)
H(jw)

H(j𝜔𝐵𝑊 )

2018/9/12 NASA Lab - NTUEE 290


2018/9/12 NASA Lab - NTUEE 291
H(s)

H(j𝜔)
H(jw)

2018/9/12 NASA Lab - NTUEE 292


Summary of Frequency Domain Specification

2018/9/12 NASA Lab - NTUEE 293


Summary of Frequency Domain Specification

|H(jw)|

2018/9/12 NASA Lab - NTUEE 294


Typical Open-Loop Shaping

2018/9/12 NASA Lab - NTUEE 295


Lead and Lag Compensation

|C| |C|

∠C ∠C

C(s)

2018/9/12 NASA Lab - NTUEE 296


Realization of Lead Compensator

2018/9/12 NASA Lab - NTUEE 297


Lead Compensator vs. PD Control

• Both of them improve PM


• Lead compensator is less sensitive to high frequency noises

PD

|C|
Lead

2018/9/12 NASA Lab - NTUEE 298


Lag Compensator vs. PI Control

• Both of them improve steady state error


• Integrator increases instability

2018/9/12 NASA Lab - NTUEE 299


Typical Design Process

C(s) P(s)

• Given transient response spec.(PM, BW) and steady-state response spec


 Design k, LEAD, LAG
1. If k can do the trick, done!
2. Fix k for steady-state error, design LEAD, done!
3. If not, find reasonable k, design LEAD, then LAG!

2018/9/12 NASA Lab - NTUEE 300


Lead Compensator Design

2018/9/12 NASA Lab - NTUEE 301


Lead Compensator Design

C P

2018/9/12 NASA Lab - NTUEE 302


Lag Compensator Design

2018/9/12 NASA Lab - NTUEE 303


Overall Lead-Lag Compensation

෠ C(s)
C s = C(s) ෨

PC෨
PC

P
PC෨

PC PC
PC෨
P

2018/9/12 NASA Lab - NTUEE 304


Example – Improving PM using Lead Compensator

1
P s =
s(s + 1)

• Design specification PC
kP
 Steady state error < 0.1 for a unit-ramp
input  kv > 10
 Overshoot < 25%  PM=45 °

• Choose
s
 k = 10 +1
⟹ C s = 10 2
s
 wz=2, wp=10 +1
10

2018/9/12 NASA Lab - NTUEE 305


Example – Improving PM using Lag Compensator

1
P s =
s(s + 1)
PC
• Design specification kP
 Steady state error < 0.1 for a unit-ramp
input  kv > 10
 Overshoot < 25%  PM=45 °

• Choose
 K=10 with wc=3, PM=20 °
 For z=0.1, p=0.01, we have PM=50 °
s
+1
⟹ C s = 10 s 0.1
+1
0.01
 Stabilization is achieved by keeping wc
to the region with favorable phase
characteristics

 It’s okay in this class as long as your


control design achieves the
specifications

2018/9/12 NASA Lab - NTUEE 306


Third Milestone: Control Analysis in Frequency Domain

𝑢 = arcmin(𝑟 − 𝑦)
𝑢

• Stability
 Will the error e converge?  Check the system’s pole locations.
• Performance
 How fast the transient response would disappear?
 How large the steady state error e would be?
• Robustness
 Will the disturbances affect the desired performance/stability?
• Optimality
 Can we save the energy of input u?
• Adaptability
 Can we learn to play?

2018/9/12 NASA Lab - NTUEE 307


Summary of Control System Design

• Plant modeling ( P(s), Bode plot, … )


• Specifications
 Steady-state error
 Transient response (rise time, overshoot, settling time)
 Frequency response (PM, BW)
• Control system structure (unity feedback, feed forward, …)
• Controller design
 Start with k (P-controller), see if spec can be met
 + PI
 + Lead, Lag

2018/9/12 NASA Lab - NTUEE 308


Today’s Highlights

• It’s okay in this class as long as your control design achieves the specifications

• See how Brian Douglas teaches lead and lag compensator


• https://www.youtube.com/watch?v=xLhvil5sDcU&list=PLUMWjy5jgHK0WzmjRViTYtlSVSE_zP6yR

2018/9/12 NASA Lab - NTUEE 309


Lecture 14: State-Space Design
State-space representation

2018/9/12 NASA Lab - NTUEE 310


There are Many Ways to Describe LTI Systems

• Transfer functions

𝑌(𝑠)
𝑃 𝑠 =
𝑈(𝑠)

• State-space models


𝒙(𝑡) = 𝐴𝒙(𝑡) + 𝐵𝑢(𝑡)
𝑦(𝑡) = 𝐶𝒙(𝑡) + 𝐷𝑢(𝑡)

x(t) is a vector called “system states”

2018/9/12 NASA Lab - NTUEE 311


From ODEs to State-Space Model

• Loudspeaker example

𝑀𝑦ሷ + 𝑏𝑦ሶ = 0.63𝑖


𝑦
𝑢 𝑑𝑖
𝐿 + 𝑅𝑖 = 𝑢 − 0.63𝑦ሶ
𝑑𝑡
𝑒𝑐𝑜𝑖𝑙 = 0.63𝑦ሶ

definition of x(t) is not unique

• State-space representation


𝒙(𝑡) = 𝐴𝒙(𝑡) + 𝐵𝑢(𝑡) 𝒙(𝑡) ≜ [𝑦 𝑦ሶ 𝑖]𝑇
𝑦(𝑡) = 𝐶𝒙(𝑡) + 𝐷𝑢(𝑡)

0 1 0 0
𝐴= 0 −𝑏/𝑀 0.63/𝑀 𝐵= 0 𝐶= 1 0 0 𝐷=0
0 −0.63/𝐿 −𝑅/𝐿 1/𝐿

2018/9/12 NASA Lab - NTUEE 312


Example


𝒙(𝑡) = 𝐴𝒙(𝑡) + 𝐵𝑢(𝑡)
𝑦(𝑡) = 𝐶𝒙(𝑡) + 𝐷𝑢(𝑡)

𝐴= 𝐵=

𝐶𝐶 = 𝐷=0

2018/9/12 NASA Lab - NTUEE 313


From Transfer Function to State-Space Model

• Transfer functions (must be strictly proper)

𝑌(𝑠)
𝑃 𝑠 =
𝑈(𝑠)

• State-space models (controllable canonical form)

2018/9/12 NASA Lab - NTUEE 314


Example

2018/9/12 NASA Lab - NTUEE 315


Coordinate Transformation

• State-space realization of a transfer function is not unique


 Controllable canonical form
 Observable canonical form
 Diagonal canonical form
 …

• It depends on how the states x(t) are defined


 x(t) does not have to represent any physical meaning (e.g. position, velocity, acceleration, jerk..)

• Coordinate transform between state space model


𝒙(𝑡) = 𝐴𝒙(𝑡) + 𝐵𝑢(𝑡)
𝑦(𝑡) = 𝐶𝒙(𝑡) + 𝐷𝑢(𝑡)

𝒛 𝑡 = 𝑇𝒙 𝑡 𝒛 𝑡 = 𝑇 −1 𝒙 𝑡


𝒛(𝑡) = 𝑇𝐴𝑇 −1 𝒛(𝑡) + 𝑇𝐵𝑢(𝑡)
𝑦(𝑡) = 𝐶𝑇 −1 𝒛(𝑡) + 𝐷𝑢(𝑡)

2018/9/12 NASA Lab - NTUEE 316


Advantages of State Space Model

• State space model/normal form


 The dynamic equation is organized as a set of first-order differential equations
 Advantages
1. To study more general models
• Do not need to be linear or stationary
2. To introduce the idea of geometry into differential eqns
• A phase plane, or a path in state space (we control the states, not just the output)
3. To connect internal and external descriptions
• Transfer functions only relate inputs to outputs, not the internal behaviors
4. For multi-input multi-output system(MIMO)
• SISO in this book only
5. Modern control design using state space approach
• State feedback
• State observer feedback
• LQR

2018/9/12 NASA Lab - NTUEE 317


From State-Space Model to Transfer Function

• State-space model


𝒙(𝑡) = 𝐴𝒙(𝑡) + 𝐵𝑢(𝑡)
𝑦(𝑡) = 𝐶𝒙(𝑡) + 𝐷𝑢(𝑡)

• Transfer function

𝑌(𝑠)
𝑃 𝑠 = = 𝐶(𝑠𝐈 − 𝐴)−1 𝐵 + 𝐷
𝑈(𝑠)

• Impulse response

𝑝 𝑡 = 𝐶𝑒 𝐴𝑡 𝐵 + 𝐷𝛿(𝑡)

matrix exponential

2018/9/12 NASA Lab - NTUEE 318


Poles and Eigenvalues

• State-space model


𝒙(𝑡) = 𝐴𝒙(𝑡) + 𝐵𝑢(𝑡)
𝑦(𝑡) = 𝐶𝒙(𝑡) + 𝐷𝑢(𝑡)

• The poles of the system are the eigenvalues of the A matrix


 why?

𝑌(𝑠)
𝑃 𝑠 = = 𝐶(𝑠𝐈 − 𝐴)−1 𝐵 + 𝐷
𝑈(𝑠)
1
= Ψ
det(𝑠𝐼 − 𝐴)

characteristic eqn.

2018/9/12 NASA Lab - NTUEE 319


Useful MATLAB Command

• Try the following script


P = tf(num,den);
pole(P1);
[A,B,C,D] = ssdata(P);
eig(A);
G = ss(A,B,C,D);
pole(G);

• The poles of P and G are identical to the eigenvalues of A

2018/9/12 NASA Lab - NTUEE 320


State Feedback Control

• Coming soon..

2018/9/12 NASA Lab - NTUEE 321


Today’s Highlights

• The poles of the system are the eigenvalues of the A matrix

2018/9/12 NASA Lab - NTUEE 322


Lecture 15: State-Space Design
State feedback and pole assignment

2018/9/12 NASA Lab - NTUEE 323


State Feedback Control

• Control law: 𝑢 𝑡 = 𝑟 𝑡 − 𝐾𝒙(𝑡)

2018/9/12 NASA Lab - NTUEE 324


Analysis of State Feedback

• Closed-loop system


𝒙(𝑡) = 𝐴𝒙(𝑡) + 𝐵𝑢(𝑡)
r(t) = 0 for regulation

𝑢 𝑡 = 𝑟 𝑡 − 𝐾𝒙(𝑡) = −𝐾𝒙(𝑡)

𝒙ሶ 𝑡 = 𝐴𝒙 𝑡 − 𝐵𝐾𝒙(𝑡)
= (𝐴 − 𝐵𝐾)𝒙 𝑡

• The closed-loop system is stable iff the eigenvalues of (A-BK) < 0

𝒙 𝑡 → 0 as 𝑡 → ∞

2018/9/12 NASA Lab - NTUEE 325


Closed-Loop Pole Assignment

• We can freely “assign” desired pole locations through state feedback if (A,B) is controllable
• Example

0 1 0 𝑦
𝑚𝑦ሷ + 𝑏𝑦ሶ + 𝑘𝑦 = 𝑢 ⇒ 𝐴 = −𝑘 −𝑏ൗ , 𝐵 = 1ൗ , 𝒙 = 𝑦ሶ
ൗ𝑚 𝑚 𝑚
Let K = 𝑘1 𝑘2 , 𝑢 = −𝐾𝒙
𝑠 −1
det 𝑠𝐈 − 𝐴 + 𝐵𝐾 = det( 𝑘 + 𝑘2 𝑏 + 𝑘1 )
𝑠+
𝑚 𝑚
𝑏 + 𝑘1 𝑘 + 𝑘2
= 𝑠2 + s+
𝑚 𝑚
To place the closed-loop poles at −𝛼1 and −𝛼2

𝑏 + 𝑘1
= 𝛼1 + 𝛼2
𝑚 𝑘1 = 𝑚 𝛼1 + 𝛼2 − 𝑏
𝑘 + 𝑘2 ⇒
= 𝛼1 𝛼2 𝑘2 = 𝑚𝛼1 𝛼2 − 𝑘
𝑚

2018/9/12 NASA Lab - NTUEE 326


Controllability

• Controllability matrix 𝒞

𝒞 = [𝐵 𝐴𝐵 𝐴2 𝐵 … 𝐴𝑛−1 𝐵]

• (A,B) is controllable if 𝒞 is full rank

• An uncontrollable example:
State-space model

Transfer function

2018/9/12 NASA Lab - NTUEE 327


Limitation of State Feedback

• It’s not a good idea to randomly assign the locations of closed-loop poles to be far away from the
origin
 Trade-off: convergence speed (performance) vs. control energy
 Aggressive (fast) poles bring a large K, which may saturate the control authority

2018/9/12 NASA Lab - NTUEE 328


Optimal Control – Linear Quadratic Regulator

• Linear Quadratic Regulator (LQR)


 Optimal control considering the trade-off between performance and control energy (defined by the
cost function J)

• P.S. In reality, we still have to tune Q, R, and N

2018/9/12 NASA Lab - NTUEE 329


State Feedback Control

• Next question: are you able to measure all the states x(t)?

2018/9/12 NASA Lab - NTUEE 330


Today’s Highlights

• We can freely “assign” desired pole locations through state feedback if (A,B) is controllable

2018/9/12 NASA Lab - NTUEE 331


Lecture 16: State-Space Design
State observer feedback

2018/9/12 NASA Lab - NTUEE 332


State Feedback Control

• In most cases, the full states x(t) are not available (we cannot install that many sensors)

2018/9/12 NASA Lab - NTUEE 333


State Observer Feedback

2018/9/12 NASA Lab - NTUEE 334


Observer Design

• State observer = prediction (by the plant model) + measurement (of the output)
prediction measurement

• The convergence of estimation error depends on the dynamics of (A-LC)


Define

• The observer gain L may be chosen so that the eigenvalues of A-LC are any desired values if (A,C)
is observable.

2018/9/12 NASA Lab - NTUEE 335


Observability

• Observability matrix 𝒪

𝒪 = [𝐶 𝐶𝐴 𝐶𝐴2 … 𝐶𝐴𝑛−1 ]𝑇

• (A,C) is observable if 𝒪 is full rank

• An unobservable example:

State-space model

Transfer function

2018/9/12 NASA Lab - NTUEE 336


Separation Principle

• Separation principle – we can separately place the poles for state feedback and state observer

• How to place the observer poles, aka eigenvalues of (A-LC)?


 Usually, we put (A-LC) 2~5 times faster than (A-BK)

2018/9/12 NASA Lab - NTUEE 337


Example

2018/9/12 NASA Lab - NTUEE 338


Optimal Estimator – Kalman filter

2018/9/12 NASA Lab - NTUEE 339


Useful MATLAB Commands

• K = place(A,B,poles)
• [K,~,~] = lqr(SYS,Q,R,N)
• L = place(A’,C’,poles)’
• [~,L,~,~] = kalman(SYS,Q,R)

2018/9/12 NASA Lab - NTUEE 340


Review of Course Materials

2018/9/12 NASA Lab - NTUEE 341


Control Specifications

• We always check what are the control specifications before designing the controller
 Time-domain specifications
• Rise time – Tr
• Settling time – Ts
• Overshoot – Mp
• Steady state error
 Frequency-domain specifications
• Phase margin – PM
• Gain margin – GM
• Bandwidth

• All these specifications are related. Some of them are trade-off.

2018/9/12 NASA Lab - NTUEE 342


Controller

• Based on the control specification and the open-loop system, we first select which type of controllers
will be used
 P
 PI
 PD
 PID
 Lead
 Lag
 …

2018/9/12 NASA Lab - NTUEE 343


Control Design and Parameter Tuning

• We then make sure the closed-loop poles are in LHP and reach the desired specifications
 Design methods
• Time-domain root locus
• Frequency-domain loop shaping

• And then, fine tuning in MATLAB

• In the end, implement the controller. Maybe more fine tuning.

• Computer software can help control design, but not parameter tuning.
 Tuning requires knowledge and experiences.

2018/9/12 NASA Lab - NTUEE 344

You might also like