Marcus Völp
Constructing and Verifying Cyber Physical SystemsStability and Root Locus Method
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 143
Overview
Math
FeedbackControl
RTOS
Verification
Physics
Introduction
Mathematical Foundations (Differential Equations and Laplace Transformation)
Control and Feedback
Transfer Functions and State Space Models
Poles, Zeros / PID Control
Stability, Root Locust Method, Digital Control
Mixed-Criticality Scheduling and Real-Time Operating Systems (RTOS)
Coordinating Networked Cyber-Physical Systems
Program Verification
Differential Dynamic Logic and KeYmaera X
Differential Invariants
CPS
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 144
Overview
Observability
Sensor Fusion
Sensitivity
Stability
K. Åström, R. Murray“Feedback Systems –An Introduction for Scientists and Engineers”Princeton University Press
G. Franklin, J.D. Powell, A. Emami-Naeini“Feedback Control of Dynamic Systems”7th ed. Pearson
Root Locus Design Method
Digital Control
Advanced Topics(non-linearity, state-space design, …)
Brian Douglas Control Systems Lectures on YouTube
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 145
Sensitivity
How sensitive is the system to unanticipated changes of the plant (𝐺 → 𝐺 + 𝜕𝐺)?
Sensitivity of system transfer function T:
𝑆𝐺𝑇 =
𝜕𝑇𝑇𝜕𝐺𝐺
=𝐺 𝜕𝑇
𝑇 𝜕𝐺
Open Loop: 𝑇𝑂𝑝𝑒𝑛 + 𝜕𝑇𝑂𝑝𝑒𝑛 = 𝐷𝑂𝑝𝑒𝑛 𝐺 + 𝜕𝐺
= 𝐷𝑂𝑝𝑒𝑛𝐺 + 𝐷𝑂𝑝𝑒𝑛𝜕𝐺
= 𝑇𝑂𝑝𝑒𝑛 + 𝐷𝑂𝑝𝑒𝑛𝜕𝐺
𝜕𝑇𝑂𝑝𝑒𝑛
𝑇𝑂𝑝𝑒𝑛=
𝐷𝑂𝑝𝑒𝑛𝜕𝐺
𝐷𝑂𝑝𝑒𝑛𝐺=
𝜕𝐺
𝐺=> 𝑆𝐺
𝑇 = 1
Open loop systems have no means to compensate plant changes: any error in G is immediately reflected in T
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 146
Sensitivity
How sensitive is the system to unanticipated changes of the plant (𝐺 → 𝐺 + 𝜕𝐺)?
Sensitivity of system transfer function T:
𝑆𝐺𝑇 =
𝜕𝑇𝑇𝜕𝐺𝐺
=𝐺 𝜕𝑇
𝑇 𝜕𝐺
Closed Loop: 𝑇𝐶𝑙𝑜𝑠𝑒𝑑 + 𝜕𝑇𝐶𝑙𝑜𝑠𝑒𝑑 =𝐷𝐶𝑙 𝐺 + 𝜕𝐺
1 + 𝐷𝐶𝑙 𝐺 + 𝜕𝐺
Closed loop systems compensate plant changes the better the higher the gain. e.g. for 1 + 𝐺𝐷𝐶𝑙 = 100, a 10% change results in only 0.1% steady state gain change.
𝑆𝐺𝑇 =
𝐺 𝜕𝑇𝐶𝑙𝑇 𝜕𝐺
=𝐺 𝑑𝑇𝐶𝑙𝑇 𝑑𝐺
=𝐺
𝐺𝐷𝐶𝑙1 + 𝐺𝐷𝐶𝑙
1 + 𝐺𝐷𝐶𝑙 𝐷𝐶𝑙 − 𝐷𝐶𝑙(𝐺𝐷𝐶𝑙)
1 + 𝐺𝐷𝐶𝑙2
=1
1 + 𝐺𝐷𝐶𝑙
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 147
Stability
Roots in the right half of the s-plane cause instability.
Open Loop: 𝑇𝑂𝑝𝑒𝑛 = 𝐺𝐷𝑂𝑝𝑒𝑛 =𝑏 𝑠 𝑐(𝑠)
𝑎 𝑠 𝑑(𝑠)
𝐺 𝐷𝑂𝑝𝑒𝑛
Tempting to cancel instable root in a(s) with zero in c(s), but root remains in presence of slightest variance of plant.=> don’t use open loop control on instable plants
Closed Loop: 𝑇𝐶𝑙 =𝐺𝐷𝐶𝑙
1+𝐺𝐷𝐶𝑙1 + 𝐺𝐷𝐶𝑙 = 0
1 +𝑏 𝑠 𝑐(𝑠)
𝑎 𝑠 𝑑(𝑠)= 0
𝑎 𝑠 𝑑(𝑠) + 𝑏 𝑠 𝑐(𝑠) = 0
Cancelling with zero in c(s) is still sensitive to plant change, but it is still possible to construct stable systems from unstable plants.
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 148
Stability
𝐼,𝑚𝑝
𝑚𝑡 𝐹
𝜃
𝑥
𝑚𝑡 +𝑚𝑝 𝑥 + 𝑏 𝑥 + 𝑚𝑝𝑙 𝜃 cos 𝜃 + 𝑚𝑝𝑙 𝜃2 sin 𝜃 = 𝐹
𝐼 + 𝑚𝑝𝑙2 𝜃 + 𝑚𝑝𝑔𝑙 sin 𝜃 = −𝑚𝑝𝑙 𝑥 cos 𝜃
sin 𝜃 ≈ 𝜃cos 𝜃 ≈ 1
𝜃2 ≈ 0
𝑚𝑡 +𝑚𝑝 𝑥 + 𝑏 𝑥 + 𝑚𝑝𝑙 𝜃 = 𝐹𝐼 + 𝑚𝑝𝑙2 𝜃 + 𝑚𝑝𝑔𝑙𝜃 = −𝑚𝑝𝑙 𝑥
eliminate x
𝐼 + 𝑚𝑝𝑙2 𝑚𝑡 +𝑚𝑝 −𝑚𝑝
2𝑙2 𝜃 − 𝑚𝑝𝑔𝑙 𝑚𝑡 +𝑚𝑝 𝜃 = −𝑚𝑝𝑙𝐹
ℒΘ(𝑠)
𝐹(𝑠)=
−𝑚𝑝𝑙
𝐼 + 𝑚𝑝𝑙2 𝑚𝑡 +𝑚𝑝 −𝑚𝑝
2𝑙2 𝑠2 −𝑚𝑝𝑔𝑙 𝑚𝑡 +𝑚𝑝
𝑙
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 149
Stability
𝐼,𝑚𝑝
𝑚𝑡 𝐹
𝜃
𝑥
𝐺 𝑠 =Θ(𝑠)
𝐹(𝑠)=
1
𝑠2 − 1=
1
(𝑠 + 1)(𝑠 − 1)
Θ(𝑠)
𝐹(𝑠)=
−𝑚𝑝𝑙
𝐼 + 𝑚𝑝𝑙2 𝑚𝑡 +𝑚𝑝 −𝑚𝑝
2𝑙2 𝑠2 −𝑚𝑝𝑔𝑙 𝑚𝑡 +𝑚𝑝
𝐷𝐶𝑙 𝑠 =𝐾(𝑠 + 𝛾)
(𝑠 + 𝛿)
𝑎 𝑠 𝑑(𝑠) + 𝑏 𝑠 𝑐(𝑠) = 0
(𝑠 + 1)(𝑠 − 1)(𝑠 + 𝛿) + 𝐾(𝑠 + 𝛾) = 0 𝛾 = 1
(𝑠 − 1)(𝑠 + 𝛿) + 𝐾 = 0
𝑠2 + 𝛿 − 1 𝑠 + (𝐾 − 𝛿) = 0 𝑠2 + 2𝜁𝜔𝑛𝑠 + 𝜔𝑛2 = 0
𝛿 = 2𝜁𝜔𝑛 + 1 𝐾 = 𝜔𝑛2+2𝜁𝜔𝑛 + 1
Im(s)
Re(s)
sin−1 𝜉
𝜔𝑛
x
𝑙
cancel stable pole using zero
Often systems are parametric in at least one parameter!
e.g., 𝐾𝑃 of P controller
(temperature) variations in plant
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 150
Root Locus Design Method
1 + 𝐾 𝐺 𝑠 = 1 + 𝐾𝑃(𝑠)
𝑄(𝑠)= 0
Plant
𝐺 𝑠 =𝑃(𝑠)
𝑄(𝑠)
𝑅(𝑠)Σ
+
-
(PD) Control𝐾(𝑠 + 1)
Open Loop Transfer Function
How do poles of the overall system move with K?
𝑠2 + 3𝑠 + 𝐾𝑠 + 4𝐾 + 3 = 0 (𝑠2 + 3𝑠 + 3) + 𝐾(𝑠 + 4) = 0 1 + 𝐾(𝑠 + 4)
(𝑠2 + 3𝑠 + 3)= 0
Rules to draw the paths of the roots of the characteristic equation:
(MatLab “rlocus” does it but remembering the rules gives insight in system behavior)
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 151
Root Locus Design Method
Rule 1) There are n-lines (loci) where n is the maximum degree of Q or P, whichever is greater
Rule 2) As K increases from 0 to ∞, the roots move from the poles of G(s) to the zeros of G(s) (They attract zeros from infinity)
Rule 3) When roots are complex they occur in conjugate pairs
Rule 4) At no time will the same root cross over its path
1 + 𝐾𝑃(𝑠)
𝑄(𝑠)= 0
𝜁 ≥ 0.5
x
x
x
x
ox
x
Rules to draw the paths of the roots of the characteristic equation:
(MatLab “rlocus” does it but remembering the rules gives insight in system behavior)
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 152
Root Locus Design Method
Rule 1) There are n-lines (loci) where n is the maximum degree of Q or P, whichever is greater
Rule 2) As K increases from 0 to ∞, the roots move from the poles of G(s) to the zeros of G(s) (They attract zeros from infinity)
Rule 3) When roots are complex they occur in conjugate pairs
Rule 4) At no time will the same root cross over its path
1 + 𝐾𝑃(𝑠)
𝑄(𝑠)= 0
x ox∞
∞ o xo
o x
x
x
Rules to draw the paths of the roots of the characteristic equation:
(MatLab “rlocus” does it but remembering the rules gives insight in system behavior)
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 153
Root Locus Design Method
Rule 1) There are n-lines (loci) where n is the maximum degree of Q or P, whichever is greater
Rule 2) As K increases from 0 to ∞, the roots move from the poles of G(s) to the zeros of G(s) (They attract zeros from infinity)
Rule 3) When roots are complex they occur in conjugate pairs
Rule 4) At no time will the same root cross over its path
1 + 𝐾𝑃(𝑠)
𝑄(𝑠)= 0
x
x
x
xx x
OKwon’t happen
Rules to draw the paths of the roots of the characteristic equation:
(MatLab “rlocus” does it but remembering the rules gives insight in system behavior)
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 154
Root Locus Design Method
1 + 𝐾𝑃(𝑠)
𝑄(𝑠)= 0
Rule 5) The portion of the real axis to the left of an odd number of open loop poles and zeros are part of the loci
Rule 6) Lines leave (break out) and enter (break in) the real axis at 90°
Rule 7) If there are not enough poles or zeros to make a pair, then the extra lines go to or come from infinity.
Rule 8) Lines go to infinity along asymptotes. The angles of the asymptotes are:
Φ𝐴 =2𝑞+1
𝑛−𝑚180° where q = 0, 1, …, (n-m-1)
The centroid of the asymptotes are: 𝑓𝑖𝑛𝑖𝑡𝑒 𝑝𝑜𝑙𝑒𝑠 − 𝑓𝑖𝑛𝑖𝑡𝑒 𝑧𝑒𝑟𝑜𝑠
𝑛−𝑚
xxx ox123
12345
Rules to draw the paths of the roots of the characteristic equation:
(MatLab “rlocus” does it but remembering the rules gives insight in system behavior)
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 155
Root Locus Design Method
1 + 𝐾𝑃(𝑠)
𝑄(𝑠)= 0
Rule 5) The portion of the real axis to the left of an odd number of open loop poles and zeros are part of the loci
Rule 6) Lines leave (break out) and enter (break in) the real axis at 90°
Rule 7) If there are not enough poles or zeros to make a pair, then the extra lines go to or come from infinity.
Rule 8) Lines go to infinity along asymptotes. The angles of the asymptotes are:
Φ𝐴 =2𝑞+1
𝑛−𝑚180° where q = 0, 1, …, (n-m-1)
The centroid of the asymptotes are: 𝑓𝑖𝑛𝑖𝑡𝑒 𝑝𝑜𝑙𝑒𝑠 − 𝑓𝑖𝑛𝑖𝑡𝑒 𝑧𝑒𝑟𝑜𝑠
𝑛−𝑚
xxx ox123
12345
∞
∞
∞
xxo∞
Rules to draw the paths of the roots of the characteristic equation:
(MatLab “rlocus” does it but remembering the rules gives insight in system behavior)
Constructing and Verifying Cyber Physical Systems - Marcus Völp 156
Root Locus Design Method
1 + 𝐾𝑃(𝑠)
𝑄(𝑠)= 0
Rule 5) The portion of the real axis to the left of an odd number of open loop poles and zeros are part of the loci
Rule 6) Lines leave (break out) and enter (break in) the real axis at 90°
Rule 7) If there are not enough poles or zeros to make a pair, then the extra lines go to or come from infinity.
Rule 8) Lines go to infinity along asymptotes. The angles of the asymptotes are:
Φ𝐴 =2𝑞+1
𝑛−𝑚180° where q = 0, 1, …, (n-m-1)
The centroid of the asymptotes are: 𝑓𝑖𝑛𝑖𝑡𝑒 𝑝𝑜𝑙𝑒𝑠 − 𝑓𝑖𝑛𝑖𝑡𝑒 𝑧𝑒𝑟𝑜𝑠
𝑛−𝑚
xx
-1-2∞
∞
Φ𝐴0 =2∙0+1
2180° = 90°
Φ𝐴1 =2∙1+1
2180° = 270° = −90°
2 lines (q={0,1})
Summer 2015
𝑐𝑒𝑛𝑡 =−2−1
2= -1.5
Rules to draw the paths of the roots of the characteristic equation:
(MatLab “rlocus” does it but remembering the rules gives insight in system behavior)
Constructing and Verifying Cyber Physical Systems - Marcus Völp 157
Root Locus Design Method
1 + 𝐾𝑃(𝑠)
𝑄(𝑠)= 0
Rule 5) The portion of the real axis to the left of an odd number of open loop poles and zeros are part of the loci
Rule 6) Lines leave (break out) and enter (break in) the real axis at 90°
Rule 7) If there are not enough poles or zeros to make a pair, then the extra lines go to or come from infinity.
Rule 8) Lines go to infinity along asymptotes. The angles of the asymptotes are:
Φ𝐴 =2𝑞+1
𝑛−𝑚180° where q = 0, 1, …, (n-m-1)
The centroid of the asymptotes are: 𝑓𝑖𝑛𝑖𝑡𝑒 𝑝𝑜𝑙𝑒𝑠 − 𝑓𝑖𝑛𝑖𝑡𝑒 𝑧𝑒𝑟𝑜𝑠
𝑛−𝑚
Summer 2015
xx
-1-2
Φ𝐴0 =2∙0+1
3180° = 60°
Φ𝐴1 =2∙1+1
3180° = 180°
3 lines (q={0,1,2})
x
-3
Φ𝐴2 =2∙2+1
3180° = -60°
𝑐𝑒𝑛𝑡 =−3−2−1
3= -2
Rules to draw the paths of the roots of the characteristic equation:
(MatLab “rlocus” does it but remembering the rules gives insight in system behavior)
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 158
Root Locus Design Method
1 + 𝐾𝑃(𝑠)
𝑄(𝑠)= 0
Rule 9) If there is at least two lines to infinity, then the sum of all roots is constant
Rule 10) K going from 0 to negative infinity can be drawn by reversing rule 5 and adding 180° to the asymptote angles.xx
-1-2
x
-3(-3) + (-2) + (-1) = -6 K=0(-3.52) + (– 1.24+0.86i) + (– 1.24-0.86i) = -6 K=2
xxx
stabilize 2 as fast
destabilize ½ as fastx
x
x
Rules to draw the paths of the roots of the characteristic equation:
(MatLab “rlocus” does it but remembering the rules gives insight in system behavior)
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 159
Root Locus Design Method
1 + 𝐾𝑃(𝑠)
𝑄(𝑠)= 0
Rule 9) If there is at least two lines to infinity, then the sum of all roots is constant
Rule 10) K going from 0 to negative infinity can be drawn by reversing rule 5 and adding 180° to the asymptote angles.
Plant1
(𝑠 + 1)(𝑠 − 2)
𝑅(𝑠)Σ
+
-
Controlo x x
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 160
Digital Control
Plant𝐺 𝑠
𝑟(𝑡) 𝑦(𝑡)Σ+
+
𝑊(𝑠)
disturbance
𝑢(𝑘𝑇)Σ
Σ
+
-
++
𝑒(𝑘𝑇) DifferenceEquation
D/A
A/D 𝑉(𝑠)
sensor noise
ZOH
analog-to-digital converter
digital-to-analog converterzero order hold
Sensor𝑦(𝑘𝑇)
A/D
sample rate 1
𝑇=> one sample every sample period T
=> one output every sample period T
Clock
computer
zero order hold: hold output constant until next clock tick
𝑒(𝑘𝑇)
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 161
Digital Control
Analog / Digital Conversion
Resolution Nyquist-Shannon Theorem
full scale voltage range ('span')
If a function x(t) contains no frequencies higher thanB Hz, it is completely determined by giving itsordinates at a series of points spaced 1/(2B) secondsapart.
Alias because signal frequency B’ is higher than sampling frequency 2B
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 162
Digital Control
Difference Equations
𝑢(𝑘𝑇)Σ
+
-
𝑒(𝑘𝑇) DifferenceEquation
D/A
A/D
ZOH
𝑦(𝑘𝑇)
A/D
Clock
computer
𝑥 𝑘 + 1 = 𝑓 𝑥 𝑘 , 𝑢 𝑘
𝑦 𝑘 = ℎ(𝑥 𝑘 , 𝑢 𝑘 )
𝜕𝑥
𝜕𝑡≈𝑥 𝑘 + 1 − 𝑥[𝑘]
𝑡 𝑘 + 1 − 𝑡[𝑘]
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 163
Digital Control
React asynchronously
𝑢(𝑘𝑇)Σ
+
-
𝑒(𝑘𝑇) DifferenceEquation
D/A
A/D
ZOH
𝑦(𝑘𝑇)
A/D
Clock
computer
Electrical signal every time wheel reaches a certain position
Core D/A
A/D
ZOHA/D
Clock
computer
Capture
Capture
Compare
r[k], tr[k]
y[k], ty[k]
capture:store y[k] and timestamp ty[k]trigger interrupt in core
interrupt handler:read y[k], ty[k];read r[k], tr[k];compute u[k] and signal time ts[k];end of interrupt
compare:signal u[k] if clock == ts[k]
varying interrupt delivery times• disabled interrupts• long instructions• voltage / frequency scaling
varying execution times• voltage / frequency scaling• caches• input dependent jitter
execution times
interrupt delivery
Topics we did not cover:
• Nonlinear systems
• Frequency-Response Design Method
• State-Space Design
• Digital Control: z-Transform
• Matlab / Simulink
• a lot of case studies and examples
Topics we will be covering next:
• How to construct the execution environment for digital controllers?
• How to construct controllers that work together for a greater goal?
• How to verify that the controllers we design and implement are safe and secure?
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 164
Advanced Topics
Nonlinear systems: Taylor series
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 165
Advanced Topics
sin 𝜃 ≈ 𝜃; cos 𝜃 ≈ 1 for 𝜃 ≈ 0 𝑓 𝑎 =
𝑛=0
∞𝑓 𝑛 𝑎
𝑛!(𝑥 − 𝑎)𝑛Taylor series:
𝑒𝑥 =
𝑛=0
∞𝑥𝑛
𝑛!
1
1 − 𝑥=
𝑛=0
∞
𝑥𝑛
cos(𝑥) =
𝑛=0
∞(−1)𝑛
2𝑛 !𝑥2𝑛
sin(𝑥) =
𝑛=0
∞(−1)𝑛
2𝑛 + 1 !𝑥2𝑛+1
Nonlinear systems: Linearization by nonlinear feedback
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 166
Advanced Topics
Plant
𝑇𝑐 = 𝑚𝑙2 𝜃 + 𝑚𝑔𝑙 sin 𝜃
𝑅(𝑠) 𝑌(𝑠)Σ+
+
𝑊(𝑠)
disturbance
𝑈(𝑠)Σ
Σ
+
-
++
𝐸(𝑠) Control
𝑚𝑙2 𝜃 = 𝑢
Compute𝑇𝑐 = 𝑚𝑔𝑙 sin 𝜃 + 𝑢
Compute𝑦 = 𝑇𝑐 −𝑚𝑔𝑙 sin 𝜃
𝑉(𝑠)
sensor noise
State-Space Design (modern control design):
• ODEs don’t need to be linear
• no transformation required
• make internal energy transfers explicit; extract required output
• works for multiple input / multiple output (here SISO only)
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 167
Advanced Topics
𝒙 = 𝑨𝒙 + 𝑩𝑢
𝑦 = 𝑪𝒙 + 𝐷𝑢
system matrix (nxn) input matrix (nx1)
output matrix (1xn) direct transmission term
State-Space Design (modern control design):
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 168
Advanced Topics
𝒙 = 𝑨𝒙 + 𝑩𝑢
𝑦 = 𝑪𝒙 + 𝐷𝑢
system matrix (nxn) input matrix (nx1)
output matrix (1xn) direct transmission term
𝑥 = −𝑏(1 +𝑚𝑝𝑙𝐶)
𝑚𝑡 +𝑚𝑝
𝑥 + 𝑚𝑝𝑙𝐶𝑔 𝜃 + [1 + 𝑚𝑝𝑙𝐶
𝑚𝑡 +𝑚𝑝
]𝐹
𝜃 = −𝑚𝑝𝑙𝑔 𝑚𝑡 +𝑚𝑝
𝑚𝑡 +𝑚𝑝 𝐼 + 𝑚𝑝𝑙2 −𝑚𝑝
2𝑙2𝜃 +
𝑚𝑝𝑙𝑏
𝑚𝑡 +𝑚𝑝 𝐼 + 𝑚𝑝𝑙2 −𝑚𝑝
2𝑙2 𝑥 −
𝑚𝑝𝑙
𝑚𝑡 +𝑚𝑝 𝐼 + 𝑚𝑝𝑙2 −𝑚𝑝
2𝑙2𝐹
C
𝑚𝑡 +𝑚𝑝 𝑥 + 𝑏 𝑥 + 𝑚𝑝𝑙 𝜃 cos 𝜃 + 𝑚𝑝𝑙𝜃2 sin 𝜃 = 𝐹
𝐼 + 𝑚𝑝𝑙2 𝜃 + 𝑚𝑝𝑔𝑙 sin 𝜃 = −𝑚𝑝𝑙 𝑥 cos 𝜃
𝜃 𝜃 𝑥
=
0 𝐶𝑔(𝑚𝑡 +𝑚𝑝) 𝐶𝑏
1 0 0
0 𝑚𝑝𝑙𝐶𝑔 −𝑏(1 + 𝑚𝑝𝑙𝐶)
𝑚𝑡 +𝑚𝑝
𝜃𝜃 𝑥
+
𝐶0
1 + 𝑚𝑝𝑙𝐶
𝑚𝑡 +𝑚𝑝
𝐹 𝜃 = 0 1 0
𝜃𝜃 𝑥
+ 0
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 169
Observability
𝒙 = 𝑨𝒙 + 𝑩𝑢
𝑦 = 𝑪𝒙 + 𝐷𝑢
some part of x may remain internal (i.e., not observable)
Definition: (Observability)A linear system is observable if for any T > 0 it is possible to determine the state of the system x(T) through measurements of y(t) and u(t) on the interval [0, T].
𝜕𝑦
𝜕𝑡= 𝑪
𝝏𝒙
𝝏𝒕= 𝑪𝑨𝑥
𝜕𝑥
𝜕𝑡= 𝑨𝒙, 𝑦 = 𝑪𝑥
neglect input
𝑦 𝑦 𝑦⋮
𝑦(𝑛−1)
=
𝐶𝐶𝐴𝐶𝐴2
⋮𝐶𝐴𝑛−1
𝒙
observability matrix: 𝑾𝟎
Theorem: (Observability rank condition)A linear system of the form 𝒙 = 𝑨𝒙 + 𝑩𝑢,𝑦 = 𝑪𝒙 + 𝐷𝑢 is observable if and only if the observability matrix 𝑾𝟎 is full rank.
K. Åström, R. Murray“Feedback Systems –An Introduction for Scientists and Engineers”Princeton University Press
Combination of sensory data or data derived from sensory data from disparate sources to reduce uncertainty of the result below that of each individual sensor.
Virtual Sensor = Sensor + Mathematical Model to derive value of interest
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 170
Sensor Fusion
more accurate, more complete, more dependable, view which emerges from the individual signals (e.g., stereoscopic vision)
Direct fusion: fusion from sensor data and history valuesIndirect fusion: use a-priori knowledge about environment
average of all sensorsdiscard sensor data if returned gravity < 9 or > 9.3
Digital Control: z-Transform
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 171
Advanced Topics
ℒ 𝑓 𝑡 = 𝐹 𝑠 = 0
∞
𝑓(𝑡)𝑒−𝑠𝑡 Z 𝑓 𝑘 = 𝐹 𝑧 = 𝑘=0∞ 𝑓 𝑘 𝑧−𝑘
Z 𝑓 𝑘 − 1 = 𝑧−1𝐹 𝑧
𝑓 𝑘𝑇 = 𝑒−𝑎𝑘𝑇
𝐹 𝑧 =𝑧
𝑧 − 𝑒−𝑎𝑇1
𝑠 + 𝑎
𝑧 = 𝑒𝑠𝑇
𝑧 = 𝑒𝑠𝑇 s = −𝜉𝜔𝑛 ± 𝑗𝜔𝑛 1 − 𝜉2
Matlab / Simulink
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 172
Advanced Topics
Programming Interface
Source: http://www.mathworks.com/help/
Tools (e.g., Control System Toolbox)
Plots
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 173
Overview
Observability
Sensor Fusion
Sensitivity
Stability
K. Åström, R. Murray“Feedback Systems –An Introduction for Scientists and Engineers”Princeton University Press
G. Franklin, J.D. Powell, A. Emami-Naeini“Feedback Control of Dynamic Systems”7th ed. Pearson
Root Locus Design Method
Digital Control
Advanced Topics(non-linearity, state-space design, …)
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 174
Overview
Math
FeedbackControl
RTOS
Verification
Physics
Introduction
Mathematical Foundations (Differential Equations and Laplace Transformation)
Control and Feedback
Transfer Functions and State Space Models
Poles, Zeros / PID Control
Stability, Root Locust Method, Digital Control
Mixed-Criticality Scheduling and Real-Time Operating Systems (RTOS)
Coordinating Networked Cyber-Physical Systems
Program Verification
Differential Dynamic Logic and KeYmaera X
Differential Invariants
CPS
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 175
Leftovers
Constraints for designing second order systems
settling time 𝜎 ≥4.6
𝑡𝑠(decay below 1%)
Im(s)
Re(s)
𝜎
settling time
x
𝑒−𝜁𝜔𝑛𝑡𝑠 = 0.01
𝜁𝜔𝑛𝑡𝑠 ≈ 4.6
𝑡𝑠 ≈4.6
𝜎
𝑡𝑠 ≤ 𝑡 ⇒4.6
𝜎≤ 𝑡 ⇒ 𝜎 ≥
4.6
𝑡
Instability of I-Controllers
assume 𝐺 𝑠 =1
(𝑠+1)(𝑠+1)
𝑇𝐹 =𝑘𝐼𝐺(𝑠)
𝑠 + 𝑘𝐼𝐺(𝑠)=
𝑘𝐼𝑠(𝑠 + 1)(𝑠 + 1) + 𝑘𝐼
=𝑘𝐼
𝑠3 + 2𝑠2 + 𝑠 + 𝑘𝐼
Summer 2015 Constructing and Verifying Cyber Physical Systems - Marcus Völp 176
Leftovers
𝐼,𝑚𝑝
𝑚𝑡 𝐹
𝜃
𝑥
𝐺 𝑠 =Θ(𝑠)
𝐹(𝑠)=
1
𝑠2 − 1=
1
(𝑠 + 1)(𝑠 − 1)
Θ(𝑠)
𝐹(𝑠)=
−𝑚𝑝𝑙
𝐼 + 𝑚𝑝𝑙2 𝑚𝑡 +𝑚𝑝 −𝑚𝑝
2𝑙2 𝑠2 −𝑚𝑝𝑔𝑙 𝑚𝑡 +𝑚𝑝
𝐷𝐶𝑙 𝑠 =𝐾(𝑠 + 𝛾)
(𝑠 + 𝛿)
𝑎 𝑠 𝑑(𝑠) + 𝑏 𝑠 𝑐(𝑠) = 0
(𝑠 + 1)(𝑠 − 1)(𝑠 + 𝛿) + 𝐾(𝑠 + 𝛾) = 0 𝛾 = 1
(𝑠 − 1)(𝑠 + 𝛿) + 𝐾 = 0
𝑠2 + 𝛿 − 1 𝑠 + (𝐾 − 𝛿) = 0 𝑠2 + 2𝜁𝜔𝑛𝑠 + 𝜔𝑛2 = 0
𝛿 = 2𝜁𝜔𝑛 + 1 𝐾 = 𝜔𝑛2+2𝜁𝜔𝑛 + 1
Im(s)
Re(s)
sin−1 𝜉
𝜔𝑛
x
𝑙
cancel stable pole using zero