Professional Documents
Culture Documents
Hold Sampler
uk yk
uk D-A Computer A-D yk
t t
&
c K. J. Åström and B. Wittenmark 1
IT tools Matlab macros for CCS
Course information, available tools
• WWW at
http://www.control.lth.se/~kursdr/
Figures generated with macros available
over the Web
• Matlab and Simulink
• Maple
• ccsdemo
• Email per@control.lth.se
&
c K. J. Åström and B. Wittenmark 2
Sampling of signals and systems Industrial computer-controlled
systems
• Introduction to computer-controlled Plant
manager
systems
• Sampling of signals
• Sampling of systems Order
handler
Production
manager
Financial
manager
Purchaser
– State-space models
– Input-output models Lab
assistant Plant network
Process
operator
Control network
Process
Computer
Time dependence
Clock
(a)
u ys
A-D Computer D-A
(b)
1 1
Output
Output
0 0
0 10 0 10
1 1
Output
Output
0 0
0 10 0 10
Time Time
&
c K. J. Åström and B. Wittenmark 3
A naive approach Control of the double integrator
Control of the arm of a disk drive
k Clock
G ( s) =
Js2
Algorithm
Continuous time controller
bK s+b
U ( s) = U c ( s) − K Y ( s)
a s+a
Discrete time controller y: = adin(in2) {read process value}
u:=K*(a/b*uc-y+x)
b
u( tk) = K ( u c ( tk ) − y( tk) + x( tk )) dout(u) {output control signal}
a
x( tk + h) = x( tk ) + h (( a − b) y( tk) − ax( tk )) newx:=x+h*((b-a)*y-b*x)
Output
0
0 5 10
Input 0.5
−0.5
0 5 10
Time (ω0t)
Output
1 1
− r1 u ( t k − 1 )
0 0
0 5 10 0 5 10
1
Position
0.5 0.5
Input
Input
0 0
0
0 5 10
−0.5 −0.5
0 5 10 15 0 5 10 15
Velocity
0.5
Time (ω0t) Time (ω0t)
0 5 10
0.5
Input
−0.5
0 5 10
Time (ω0t)
&
c K. J. Åström and B. Wittenmark 4
Sinusoidal measurement noise Sinusoidal measurement noise
cont’d
Double integrator with ω 0 = 1 and h = 0.5
Measurement noise 0.1 sin 12t Enlarge the scale
a) Continuous time, b) Discrete time
Measured output
0.2
(a) (b)
0.2 0.2 0
Output
Output
0 0 −0.2
−0.2 −0.2 0 5 10
0 10 20 0 10 20 0.2
Measured output
Measured output
Input
0.2 0.2 0
0 0 −0.2
−0.2 −0.2 0 5 10
Time
0 10 20 0 10 20
0.2 0.2
The sampling period is too long compared
Input
Input
0 0
−0.2 −0.2
with the noise
0 10 20 0 10 20 Important to filter before sampling!
ω sampled = hω ± nω sh Time Time
Sampling frequency ω s = 2π /h
Clock
• Let the input be piecewise constant
• Look at the sampling points only
{u(t k )} u(t) y(t) { y (tk )} • Use linearity and calculate step re-
D-A System A-D
sponses
System description
• Zero-order-hold sampling of a system
dx
• Computational issues = Ax( t) + Bu( t)
dt
• Solution of the system equation y( t) = Cx( t) + Du( t)
• Inverse of sampling Solve the system equation (Calculate the
• Sampling of a system with time delay step response, with initial value)
Z
• Intersample behavior A( t− t k)
t
P
x( t) = e x( tk ) + e A( t− s ) Bu( sP) dsP
• Transformation Z
tk
t
P
= e A( t− tk) x( tk ) + e A( t− s ) dsP Bu( tk)
tk
Z t− t k
= e A( t− tk) x( tk ) + e As ds Bu( tk)
0
= Φ( t, tk ) x( tk ) + Γ( t, tk )u( tk )
&
c K. J. Åström and B. Wittenmark 5
Periodic sampling Properties of Φ and Γ
The general case Φ = e Ah
Z h
x( tk+1 ) = Φ( tk+1, tk ) x( tk ) + Γ( tk+1 , tk )u( tk ) Γ= e As ds B
0
y( tk) = Cx( tk ) + Du( tk )
It thus follows that
where d Φ( t)
= AΦ( t) = Φ( t) A
A( t k+1− t k)
Φ( tk+1, tk ) = e dt
Z t k+1 − t k d Γ( t)
= Φ( t) B
Γ( tk+1, tk ) = e As ds B dt
0
Φ and Γ satisfy
Assume periodic sampling, i.e. tk = k ⋅ h,
then d Φ(t) Γ(t) Φ(t) Γ(t) A B
x( kh + h) = Φ x( kh) + Γ u( kh) =
dt 0 I 0 I 0 0
y( kh) = Cx( kh) + Du( kh)
Φ(h) and Γ(h) can be obtained from the
where
Φ=e Ah block matrix
Z
h
Φ( h) Γ( h) A B
Γ= e As ds B = exp h
0 0 I 0 0
NOTE: Time-invariant linear system!
Z h
Ah2 A2 h3
Ψ= eAs ds = I h + + + ⋅⋅⋅
0 2! 3!
The matrices Φ and Γ are given by
( Ah)2 ( Ah)3
Φ = I + AΨ = I + Ah + + + ⋅⋅⋅
2! 3!
Γ = ΨB
&
c K. J. Åström and B. Wittenmark 6
Sampling of double integrator Matlab cont’d
>> A=[0 1; 0 0] >> Big=[A,B;[0 0 0]]
A = Big =
0 1 0 1 0
0 0 0 0 1
>> B=[0 ; 1] 0 0 0
B = >> h=0.1
0 h =
1 0.1000
>> h=0.1 >> PhiGam=expm(Big*h)
h = PhiGam =
0.1000 1.0000 0.1000 0.0050
>> Phi=expm(A*h) 0 1.0000 0.1000
Phi = 0 0 1.0000
1.0000 0.1000 >> Phi=PhiGam(1:2,1:2)
0 1.0000 Phi =
>> h=0.01 1.0000 0.1000
h = 0 1.0000
0.0100 >> Gam=PhiGam(1:2,3)
>> Phi=expm(A*h) Gam =
Phi = 0.0050
1.0000 0.0100 0.1000
0 1.0000
&
c K. J. Åström and B. Wittenmark 7