Uploaded by kshemageorge13

Lecture 04

advertisement
Embedded Systems
Martina Maggio – Lecture 04: continuous- to discrete-time
1 / 11
Continuous-Time Linear Time-Invariant System
Process
u (t)
y (t)
ẋ (t) = A x (t) + B u (t)
π’«βˆΆ{
y (t) = C x (t) + D u (t)
Continuous-Time Linear Time-Invariant System
Process
u (t)
y (t)
ẋ (t) = A x (t) + B u (t)
π’«βˆΆ{
y (t) = C x (t) + D u (t)
Continuous-Time Linear Time-Invariant System
Process
u (t)
y (t)
ẋ (t) = A x (t) + B u (t)
π’«βˆΆ{
y (t) = C x (t) + D u (t)
Continuous-Time Linear Time-Invariant System
Process
u (t)
y (t)
ẋ (t) = A x (t) + B u (t)
π’«βˆΆ{
y (t) = C x (t) + D u (t)
We measure
the output
every πœ‹ time
units (sample)
Continuous-Time Linear Time-Invariant System
Process
u (t)
y (t)
ẋ (t) = A x (t) + B u (t)
π’«βˆΆ{
y (t) = C x (t) + D u (t)
We apply a
new input every
πœ‹ time units
(hold)
We measure
the output
every πœ‹ time
units (sample)
2 / 11
Sampling
s (t)
t
Sampling
s (t)
Sampling Period πœ‹
t
Sampling
s (t)
k=0
Sampling Period πœ‹
k=1
k=2
k=3
t
Sampling
s (t)
k=0
Sampling Period πœ‹
k=1
k=2
k=3
s (0) = s [0]
t
Sampling
s (t)
k=0
Sampling Period πœ‹
k=1
k=2
k=3
s (πœ‹) = s [1]
s (0) = s [0]
t
Sampling
s (t)
k=0
Sampling Period πœ‹
k=1
k=2
k=3
s (πœ‹) = s [1]
s (0) = s [0]
s (2πœ‹) = s [2]
t
Sampling
s (t)
k=0
Sampling Period πœ‹
k=1
k=2
k=3
s (πœ‹) = s [1]
s (0) = s [0]
s (2πœ‹) = s [2]
s (3πœ‹) = s [3]
t
Sampling
s (t)
k=0
Sampling Period πœ‹
k=1
k=2
k=3
s (k πœ‹) = s [k]
s (πœ‹) = s [1]
s (0) = s [0]
s (2πœ‹) = s [2]
s (3πœ‹) = s [3]
t
3 / 11
Sampling and Modeling
From continuous- to discrete-time (linear time-invariant) models
We would like to take our continous-time model and transform it into a
discrete-time equivalent model, that describes the behavior of the system at the
sampling instants {k, k − 1, … , 0}
ẋ (t) = A x (t) + B u (t)
→
?
⏟⏟⏟
y (t) = C x (t) + D u (t)
Discrete-Time Model
⏟⎴⎴⎴⎴⎴⎴⎴⎴⏟⎴⎴⎴⎴⎴⎴⎴⎴⏟
Continuous-Time Model
4 / 11
Sampling and Modeling
From continuous- to discrete-time (linear time-invariant) models
ẋ (t) = A x (t) + B u (t)
y (t) = C x (t) + D u (t)
The solution1 for this system is
t
x (t) = e
A(t−0)
x (0) + ∫ e A(t−𝜏) B u (𝜏) d𝜏
0
and this gives
t
y (t) = C e
A(t−0)
x (0) + ∫ C e A(t−𝜏) B u (𝜏) d𝜏 + D u (t)
0
1 For
the full derivation, see http://control.ucsd.edu/mauricio/courses/mae280a/lecture5.pdf
5 / 11
Sampling and Modeling
Assumption: in between
sampling
[
) instants, we keep the value of u constant (we
hold u), i.e., ∀t ∈ k πœ‹, (k + 1) πœ‹ , u (t) = u [k]
6 / 11
Sampling and Modeling
Assumption: in between
sampling
[
) instants, we keep the value of u constant (we
hold u), i.e., ∀t ∈ k πœ‹, (k + 1) πœ‹ , u (t) = u [k]
1. Solve the equation from time k πœ‹ to time t (with constant u)
6 / 11
Sampling and Modeling
Assumption: in between
sampling
[
) instants, we keep the value of u constant (we
hold u), i.e., ∀t ∈ k πœ‹, (k + 1) πœ‹ , u (t) = u [k]
1. Solve the equation from time k πœ‹ to time t (with constant u)
t
x (t) = e A (t−k πœ‹) x (k πœ‹) + ∫
e A(t−𝜏) B u (𝜏) d𝜏
kπœ‹
6 / 11
Sampling and Modeling
Assumption: in between
sampling
[
) instants, we keep the value of u constant (we
hold u), i.e., ∀t ∈ k πœ‹, (k + 1) πœ‹ , u (t) = u [k]
1. Solve the equation from time k πœ‹ to time t (with constant u)
t
x (t) = e A (t−k πœ‹) x (k πœ‹) + ∫
e A(t−𝜏) B u (𝜏) d𝜏
kπœ‹
t
x (t) = e A (t−k πœ‹) x (k πœ‹) + ∫
e A(t−𝜏) d𝜏 B u (k πœ‹)
kπœ‹
6 / 11
Sampling and Modeling
Assumption: in between
sampling
[
) instants, we keep the value of u constant (we
hold u), i.e., ∀t ∈ k πœ‹, (k + 1) πœ‹ , u (t) = u [k]
1. Solve the equation from time k πœ‹ to time t (with constant u)
t
x (t) = e A (t−k πœ‹) x (k πœ‹) + ∫
e A(t−𝜏) B u (𝜏) d𝜏
kπœ‹
t
x (t) = e A (t−k πœ‹) x (k πœ‹) + ∫
e A(t−𝜏) d𝜏 B u (k πœ‹)
kπœ‹
0
x (t) = e A (t−k πœ‹) x (k πœ‹) + ∫
−e Av dv B u (k πœ‹)
t−k πœ‹
6 / 11
Sampling and Modeling
Assumption: in between
sampling
[
) instants, we keep the value of u constant (we
hold u), i.e., ∀t ∈ k πœ‹, (k + 1) πœ‹ , u (t) = u [k]
1. Solve the equation from time k πœ‹ to time t (with constant u)
t
x (t) = e A (t−k πœ‹) x (k πœ‹) + ∫
e A(t−𝜏) B u (𝜏) d𝜏
kπœ‹
t
x (t) = e A (t−k πœ‹) x (k πœ‹) + ∫
e A(t−𝜏) d𝜏 B u (k πœ‹)
kπœ‹
0
x (t) = e A (t−k πœ‹) x (k πœ‹) + ∫
−e Av dv B u (k πœ‹)
t−k πœ‹
t−k πœ‹
x (t) = e
A (t−k πœ‹)
e Av dv B u (k πœ‹)
x (k πœ‹) + ∫
0
6 / 11
Sampling and Modeling
Assumption: in between
sampling
[
) instants, we keep the value of u constant (we
hold u), i.e., ∀t ∈ k πœ‹, (k + 1) πœ‹ , u (t) = u [k]
1. Solve the equation from time k πœ‹ to time t (with constant u)
t−k πœ‹
A (t−k πœ‹)
x (t) = e
x (k πœ‹) + ∫
e Av dv B u (k πœ‹)
⏟⏟⏟
0
Φ(t,k πœ‹)
⏟⎴⎴⎴⏟⎴⎴⎴⏟
Γ(t,k πœ‹)
7 / 11
Sampling and Modeling
Assumption: in between
sampling
[
) instants, we keep the value of u constant (we
hold u), i.e., ∀t ∈ k πœ‹, (k + 1) πœ‹ , u (t) = u [k]
1. Solve the equation from time k πœ‹ to time t (with constant u)
t−k πœ‹
A (t−k πœ‹)
x (t) = e
x (k πœ‹) + ∫
e Av dv B u (k πœ‹)
⏟⏟⏟
0
Φ(t,k πœ‹)
⏟⎴⎴⎴⏟⎴⎴⎴⏟
Γ(t,k πœ‹)
2. Impose periodic sampling, t = (k + 1) πœ‹
7 / 11
Sampling and Modeling
Assumption: in between
sampling
[
) instants, we keep the value of u constant (we
hold u), i.e., ∀t ∈ k πœ‹, (k + 1) πœ‹ , u (t) = u [k]
1. Solve the equation from time k πœ‹ to time t (with constant u)
t−k πœ‹
A (t−k πœ‹)
x (t) = e
x (k πœ‹) + ∫
e Av dv B u (k πœ‹)
⏟⏟⏟
0
Φ(t,k πœ‹)
⏟⎴⎴⎴⏟⎴⎴⎴⏟
Γ(t,k πœ‹)
2. Impose periodic sampling, t = (k + 1) πœ‹
k πœ‹+πœ‹−k πœ‹
(
)
A (k πœ‹+πœ‹−k πœ‹)
x (k + 1) πœ‹ = e
x (k πœ‹) + ∫
e Av dv B u (k πœ‹)
⏟⎴⎴⏟⎴⎴⏟
(
)
0
Φ (k+1) πœ‹,k πœ‹
⏟ ⎴⎴⎴⎴
⏟ ⎴⎴⎴⎴
⏟
(
)
Γ (k+1) πœ‹,k πœ‹
7 / 11
Sampling and Modeling
From continuous- to discrete-time (linear time-invariant) models
k πœ‹+πœ‹−k πœ‹
(
)
A (k πœ‹+πœ‹−k πœ‹)
x (k + 1) πœ‹ = e
x (k πœ‹) + ∫
e Av dv B u (k πœ‹)
⏟⎴⎴⏟⎴⎴⏟
(
)
0
Φ (k+1) πœ‹,k πœ‹
⏟ ⎴⎴⎴⎴
⏟ ⎴⎴⎴⎴
⏟
(
)
Γ (k+1) πœ‹,k πœ‹
8 / 11
Sampling and Modeling
From continuous- to discrete-time (linear time-invariant) models
k πœ‹+πœ‹−k πœ‹
(
)
A (k πœ‹+πœ‹−k πœ‹)
x (k + 1) πœ‹ = e
x (k πœ‹) + ∫
e Av dv B u (k πœ‹)
⏟⎴⎴⏟⎴⎴⏟
(
)
0
Φ (k+1) πœ‹,k πœ‹
⏟ ⎴⎴⎴⎴
⏟ ⎴⎴⎴⎴
⏟
(
)
Γ (k+1) πœ‹,k πœ‹
We can rewrite this as
πœ‹
(
)
Aπœ‹
x (k + 1) πœ‹ = e
x (k πœ‹) + ∫ e Av dv B u (k πœ‹)
⏟⏟⏟
0
Φ(πœ‹)
⏟⎴⎴⏟⎴⎴⏟
Γ(πœ‹)
8 / 11
Sampling and Modeling
From continuous- to discrete-time (linear time-invariant) models
πœ‹
(
)
Aπœ‹
x (k + 1) πœ‹ = e
x (k πœ‹) + ∫ e Av dv B u (k πœ‹)
⏟⏟⏟
0
Φ(πœ‹)
⏟⎴⎴⏟⎴⎴⏟
Γ(πœ‹)
Using the discrete-time notation, we can write
x [k + 1] = Φ (πœ‹) x [k] + Γ (πœ‹) u [k]
πœ‹
where Φ (πœ‹) = e A πœ‹ and Γ (πœ‹) = ∫0 e Av dv B
And calculate the output as
y [k] = C x [k] + D u [k]
9 / 11
Sampling and Modeling
From continuous- to discrete-time (linear time-invariant) models
It is possible to compute Φ and Γ simultaneously, using the formula
[
Φ Γ
] = eSπœ‹
0 I
where S = [
A B
]
0 0
The matrix exponential can be computed using the exp Julia or expm Matlab
function
10 / 11
Sampling Period Choice
The sampling period should be related to the physics of your system:
⨳ If your system state vector changes very fast you will need very frequent
samples to properly reconstruct the changes
⨳ If the changes are very slow you can afford sampling less frequently
As a rule of thumb, you would like to have between 4 and 20 samples during the
rise time of your step response, or alternatively πœ‹ ∈ (0.1 βˆ•πœ”n , 0.6 βˆ•πœ”n ) where πœ”n
is the natural frequency of your system (max absolute value of the eigenvalues of
A)
11 / 11
Download