You are on page 1of 7

Lecture 1: Contents of the course

Computer-Controlled Systems • Sampling of systems and signals


• Analysis of discrete-time systems
Goals of the course
– State-space and I/O models
• To understand discrete-time systems – Deterministic vs stochastic
• To understand computer-controlled • Hybrid systems
systems
• Design methods
• To be able to design sampled-data
controllers – Translation of analog design
– State-space and I/O models
• To understand the problems with
implementation – Optimal control
u (t ) y (t ) • Implementation
t t
u (t ) y (t )
Process

Hold Sampler
uk yk
uk D-A Computer A-D yk

t t

Computer-Controlled Systems Literature


• Lectures 40 hours • Åström K.J and Wittenmark B.: Com-
– Per Hagander puter Controlled Systems 3ed. Prentice
Hall, 1997
• Problem solving sessions 28 hours
• Solutions Manual
– Anton Cervin
• Computer Controlled Systems. Labora-
– Stefan Solyom
tory Experiments
• Laboratory experiments 4 labs
– week 7 All the literature is sold by KF.
– week 9, 11 This year the Solutions and Laboratory PM
– week 12 will be handed out, and also available over
– week 18, 19 the Web

&
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

CCSDEMO CCS — Example


Matlab and Simulink tool for the course Sampling of
s+b
s2 + a1 s + a2
for different sampling intervals

&
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

• Discrete-time systems Lab


computer
Admin.
computer
Information
station
Operator
station

Control network

– Disregard intersample behavior Process Process Process


station station station
Field
bus

Process

Our description of Problems with sampled-data


computer-controlled systems systems 1

Computer
Time dependence
Clock
(a)
u ys
A-D Computer D-A

{y(t k )} {u(t k )} u(t) y(t )


A-D Algorithm D-A Process
Clock

(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)

Sampling period h = 0.2/ω 0


1

Output
0
0 5 10

Input 0.5

−0.5
0 5 10
Time (ω0t)

Increased sampling period Better performance?


a) h = 0.5/ω 0 b) h = 1.08/ω 0 Dead-beat control h = 1.4/ω 0
(a) (b)
u( tk ) = t0 u c ( tk ) + t1 u c ( tk−1) − s0 y( tk) − s1 y( tk−1)
Output

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

Sampling creates new frequencies!

Sampling of systems Sampling a continuous-time


system
Look at the system from the point of view of
the computer The idea:

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!

How to compute Φ and Γ? Example: Sampling of double


integrator
• Numerical calculation in Matlab
   
• Series expansion of the matrix expo- dx
=
0

1
 0
 
x+ u
nential. dt 0 0 1
 
• The Laplace transform—the Laplace y = 1 0x
transform of exp( At) is (sI − A)−1 . Hence
• Cayley-Hamilton’s theorem. Φ = e Ah = I + Ah + A2 h2 /2 + ⋅ ⋅ ⋅
     
• Symbolic computer algebra, using pro- =


1 0 0 h 1 h

+  
=  

grams such as Maple and Mathemat- 0 1 0 0 0 1
 2
Z h   h 
ica.  s 
 

Γ= 
   ds = 
 2 
0 1  
One way is h

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

Matlab cont’d Sampling with Maple


>> [Phi,Gam]=c2d(A,B,0.1)
with(linalg);
Phi =
A:=array([[0,1],[0,0]]);
1.0000 0.1000
B:=array([[0],[1]]);
0 1.0000    
Gam = A := 

0 1
 B := 
 
0

0 0 1
0.0050
big:=concat(A,B);
0.1000  
>> help c2d big := 

0 1 0

0 0 1
C2D Conversion of continuous-time
systems to discrete time. big:=extend(big,1,0,0);
SYSD = C2D(SYSC,TS,METHOD) 0 1 0

 

converts the continuous system big := 
 
0 0 1

SYSC to a discrete-time system 0 0 0
SYSD with sample time TS.
The string METHOD selects the exponential(big*h);
 1 2
discretization method among the 
 1 h h 


 2 

following: 
 0 1 h 

’zoh’ Zero-order hold  
0 0 1
’foh’ Linear interpolation
’tustin’ Bilinear (Tustin)
.
.

&
c K. J. Åström and B. Wittenmark 7

You might also like