You are on page 1of 54

Control of Digital Systems

AUTOMATIC CONTROL AND SYSTEM THEORY

CONTROL OF DIGITAL SYSTEMS


Gianluca Palli

Dipartimento di Ingegneria dell Energia Elettrica e dell Informazione (DEI)


Università di Bologna
Email: gianluca.palli@unibo.it

G. Palli (DEI) Automatic Control & System Theory 1


Control of Digital Systems

Analog Control Systems

Analog Control Systems


ü  The computation of the control action is carried out in the
continuous-time domain, by means of electric, hydraulic or
mechanical systems

+ power
Controller actuator plant
amplifier
-

transducer

G. Palli (DEI) Automatic Control & System Theory 2


Control of Digital Systems

Digital Control Systems


Digital Control Systems
ü  A computer is present in the control loop:
ü  The control action is computed in the discrete-time domain with period T

ü  Suitable interfaces are needed between:


ü  The plant (continuous time domain)
ü  The controller (discrete time domain)
1010

1100
+ DIGITAL
A/D D/A actuator plant
COMPUTER
-

Clock (T)
Discrete-time domain

transducer
G. Palli (DEI) Automatic Control & System Theory 3
Control of Digital Systems

Digital Control Systems vs. Analog Control Systems

•  Better precision and •  A more difficult design


computational capabilities process
•  More complex control algorithms •  The designer must possess competences in
the field of electronics and digital interfaces
•  Improved flexibility •  Weaker stability
•  Different operating conditions can be managed
by just changing the software •  Transmission discontinuities, delays
•  The choice of the sampling time is important
•  Better reliability and
repeatability •  Undesired and unmanaged
•  No fatigue, thermal drift etc.
system failures
•  It is difficult to consider and evaluate all the
•  Digital signals can be easily possible failures during the software design

transmitted •  Electric power is always


•  Digital signals are more robust than analog ones
with respect to noise and disturbances
needed

G. Palli (DEI) Automatic Control & System Theory 4


Control of Digital Systems

Signals Typologies
Analog continuous-time
Sampled
data

Digital signal (quantized) Quantized continuous-time

G. Palli (DEI) Automatic Control & System Theory 5


Control of Digital Systems

Digital Control Systems

D/A
Controller actuator plant
interface

A/D
sensor
interface
00110

11101
01100

T T T
Digital discrete-time Analog continuous-time
signals signals

G. Palli (DEI) Automatic Control & System Theory 6


Control of Digital Systems

A/D Interface
A/D interface: the input signal x(t) is sampled with period T
•  The sequence of converted and quantized data x(kT) is given as
output

A/D

•  Dirac impulse sampling:


•  The switch closing time is null
•  A Dirac impulse of “area” x(kT) is given as output

A/D
δT

G. Palli (DEI) Automatic Control & System Theory 7


Control of Digital Systems

D/A Interface

•  Provides an analog signal from the input sequence of sampled data


•  The solution of the signal reconstruction problem is not unique if the
SHANNON THEOREM is not satisfied (ωs > 2 ωc, ωs = 2 π/T)

•  Zero-Order Hold gives the output:

•  Assuming an ideal sampling:

G. Palli (DEI) Automatic Control & System Theory 8


Control of Digital Systems

Design of Discrete-Time Controllers

Two approaches are possible to the design of digital control laws:

1.  “Direct” method


•  Discretization of the plant model
•  Design of the controller in the discrete-time domain

2.  “Indirect” Method


•  Simplest approach, it does not requires specific knowledge of
design techniques in the discrete-time domain
•  Some limitations are given by the choice of the sampling time

G. Palli (DEI) Automatic Control & System Theory 9


Control of Digital Systems

Design of Discrete-Time Controllers Digit

•  Indirect method (discretization)


x(t) e(t) ua(t) ya(t)
R(s) G(s)

x(t) e(t) ua(t) ya(t)


R(z) H(s) G(s)

•  T = … ? (as small as possible…)

G. Palli (DEI) Automatic Control & System Theory 10


Control of Digital Systems

Design of Discrete-Time Controllers

With the “indirect” method, four steps are usually involved:

1.  Choice of the sample time T

2.  Design of the continuous–time control law R(s)

3.  Discretization of the control function R(s) (e.g. bilinear transformation)

4.  Verification of the result by simulation (and experiments)

G. Palli (DEI) Automatic Control & System Theory 11


Control of Digital Systems

Design of digital controllers Digit

1) Choice of T and verification of the stability margins of the system

•  In designing the control law R(s), the process to be considered is

G. Palli (DEI) Automatic Control & System Theory 12


Control of Digital Systems

Design of digital controllers Digit

•  Example: Given the system

Design a digital lag net such that the phase margin results Mf = 55o
Impulse Response
1

0.9

The smallest time constant, 0.8

corresponding to the pole in p = -2, 0.7

is τ = 0.5 s. 0.6
Amplitude

0.5

Then, consider the sample time 0.4

T = 0.1 s. 0.3

0.2

0.1

0
0 1 2 3 4 5 6 7 8 9 10
Time (sec)
G. Palli (DEI) Automatic Control & System Theory 13
Control of Digital Systems

Design of digital controllers Digit

Bode diagrams of the original transfer function and of the sampled one
Bode Diagram
20

0
Magnitude (dB)

-20

-40
G(s)

-60

-80

-100
-90
G(z)
-135

-180
Phase (deg)

-225

-270

-315

-360
-1 0 1
10 10 10
Frequency (rad/sec)

G. Palli (DEI) Automatic Control & System Theory 14


Control of Digital Systems

Design of digital controllers Digit

•  Considering the zero-order hold, the following system is obtained

Nyquist Diagram
2

1.5
There is a small increase of the
1 phase lag.
0.5
In this case, is “small”
G1(s) since T is small.
Imaginary Axis

-0.5
A similar result is obtained
with the approximation
-1 G(s)
-1.5

-2
-2 -1.5 -1 -0.5 0 0.5 1
Real Axis

G. Palli (DEI) Automatic Control & System Theory 15


Control of Digital Systems

Design of digital controllers Digit

•  Let then consider G1(s) instead of G(s)

•  The result of the design of the lag net for G1(s) (phase margin MF = 55o) is:

•  By discretization of R(s) (ex. bilinear trans.) with T = 0.1 s:

•  N.B. Possible numerical problems for “similar” numbers (round)


G. Palli (DEI) Automatic Control & System Theory 16
Control of Digital Systems

Design of digital controllers Digit

•  The controller R(z) has been obtained

•  For its implementation on a computer, it is necessary to obtain the corresponding


difference equation. Therefore:

•  From which

•  Then

G. Palli (DEI) Automatic Control & System Theory 17


Control of Digital Systems

Design of digital controllers Digit

Results with T = 0.1 s

Uscita del sistema Uscita del sistema


1.5

1
1 0.8
0.6
0.5 0.4
0.2
0 0
0 10 20 30 40 50 0 1 2 3 4 5
tempo (s) tempo (s)
Azione di controllo Azione di controllo
0.6 0.4

0.4 0.3

0.2 0.2

0 0.1

-0.2 0
0 10 20 30 40 50 0 1 2 3 4 5
tempo (s) tempo (s)

G. Palli (DEI) Automatic Control & System Theory 18


Control of Digital Systems

Design of digital controllers Digit

Results with T = 0.5 s

Uscita del sistema Uscita del sistema


1.5
1
1 0.8
0.6
0.5 0.4
0.2
0 0
0 10 20 30 40 50 0 1 2 3 4 5
tempo (s) tempo (s)
Azione di controllo Azione di controllo
0.6 0.4

0.4 0.3

0.2 0.2

0 0.1

-0.2 0
0 10 20 30 40 50 0 1 2 3 4 5
tempo (s) tempo (s)

G. Palli (DEI) Automatic Control & System Theory 19


Control of Digital Systems

Design of digital controllers Digit

Results with T = 2 s

Uscita del sistema Uscita del sistema


1.5
1

1 0.8
0.6

0.5 0.4
0.2

0 0
0 10 20 30 40 50 0 1 2 3 4 5
tempo (s) tempo (s)
Azione di controllo Azione di controllo
0.6 0.5

0.4
0.4
0.3
0.2
0.2
0 0.1

-0.2 0
0 10 20 30 40 50 0 1 2 3 4 5
tempo (s) tempo (s)

G. Palli (DEI) Automatic Control & System Theory 20


Control of Digital Systems

Description of sampled data systems

CONTINUOUS-TIME DISCRETE-TIME
SYSTEMS SYSTEMS
Differential Finite-difference
equations A/D equations

D/A
Laplace
transform
Z transform

G. Palli (DEI) Automatic Control & System Theory 21


Control of Digital Systems

Discretization of Continuous-Time Controllers

Control Y
D/A Hold Actuator Plant
algorithm

A/D S&H Sensor

The control algorithm must be designed in such a way that the overall control
system with the same input behaves as much as possible to the continuous-time
regulator R(s)

Main problem: selection of the sample time T so that the sampled–


data represent a “good” approximation of the continuous-time signals

G. Palli (DEI) Automatic Control & System Theory 22


Control of Digital Systems

Data Sampling in MIMO Systems


n  Given the continuous-time linear system:

U(s) Y(s)
G(s)

and considering a discrete-time input u(kT), if a zero-order hold H0(s)


and a sample circuit with period T are introduced in the system, the
following discrete-time system is obtained:

u(kT) u(t) y(t) y(kT)


G(s)

n  The signal u(t) is piece-wise continuous:

G. Palli (DEI) Automatic Control & System Theory 23


Control of Digital Systems

Data Sampling
n  The signal u(t) is piecewise continuous:
for
u(kT) u(t)

n  The signal y(t) sampled with a period T generates the sampled signal
y(kT) Segnale y(t) Segnale y(kT)
3 3

y(t) y(kT)
2 2

1 1

0 0

-1 -1

-2 -2

-3 -3
0 2 4 6 8 10 0 2 4 6 8 10
Tempo (sec) Tempo kT (sec)

G. Palli (DEI) Automatic Control & System Theory 24


Control of Digital Systems

Data Sampling in MIMO Systems

u(kT) u(t) y(t) y(kT)


G(s)

n  The input-output behavior of the overall system is the same of the
discrete-time system:

U(z) Y(z)
G(z)

G. Palli (DEI) Automatic Control & System Theory 25


Control of Digital Systems

Data Sampling in MIMO Systems


n  A relation exists between matrices (A, B, C) and matrices (F, G, H). It can be
computed by solving the following linear differential equation in the interval
[kT, (k+1)T]:

n  The state x(t) that is reached starting from the initial state x(kT) at the time
instant t=kT is:

n  Hence, being u(t)=u(kT) constant, the state x((k+1)T) reached at the time
instant t=(k+1)T is:

G. Palli (DEI) Automatic Control & System Theory 26


Control of Digital Systems

Data Sampling in MIMO Systems


n  By means of the following change of variable:

the matrix G can be transformed as:

n  The output y(kT) is obtained from the signal y(t) sampled at t=kT:

G. Palli (DEI) Automatic Control & System Theory 27


Control of Digital Systems

Data Sampling in MIMO Systems

n  Then, the relation between the matrices (A, B, C) and (F, G, H) is:

n  The discrete-time system G(z) obtained from the continuous-time one
G(s) in this way is called sampled-data system.

n  Since matrices F and G depend on the sample time T, it is important


to analyze how the structural properties of reachability and
observability of the sampled-data system change in function of T.

G. Palli (DEI) Automatic Control & System Theory 28


Control of Digital Systems

Reachability and Observability

n  Being matrix F = e AT always invertible, in the sampled data system:


n  The controllability is always equivalent to reachability
n  The reconstructability is always equivalent to observability

For single-input systems, the following property holds:

n  THEOREM: Consider the completely reachable system (A, b) and the
sampling period T. The corresponding sampled-data system is
reachable iff each couple λi , λj of distinct eigenvalues of A with the
same real part satisfies the relation:

G. Palli (DEI) Automatic Control & System Theory 29


Control of Digital Systems

Reachability and Observability


For single-output systems, the following property holds (dual property
with respect to the previous one):

n  THEOREM: Consider the completely observable system (A, c) and the
sampling period T. The corresponding sampled data system is
observable iff each couple λi , λj of distinct eigenvalues of A with the
same real part satisfies the relation:

n  Note: If all the eigenvalues of matrix A are real, the sampled-data system
maintains always, for any T > 0, the same structural characteristics
(reachability, controllability, observability, reconstructability) of the original
continuous-time system (A, b, c).

G. Palli (DEI) Automatic Control & System Theory 30


Control of Digital Systems

Data Sampling in MIMO Systems


n  Example: compute the matrices of the sampled-data system obtained
from the following continuous-time system:

The matrices (F, G, H) result:

G. Palli (DEI) Automatic Control & System Theory 31


Control of Digital Systems

Data Sampling in MIMO Systems


n  Then, the corresponding sampled-data system is:

where the following simplified notation has been used:

n  The eigenvalues of matrix A are:

G. Palli (DEI) Automatic Control & System Theory 32


Control of Digital Systems

Data Sampling in MIMO Systems - Reachability


n  The reachability matrix of the sampled-data system is:

n  For T=π the system is not fully reachable, indeed:

n  From the theorem on the reachability of sampled data systems:

G. Palli (DEI) Automatic Control & System Theory 33


Control of Digital Systems

Data Sampling in MIMO Systems - Observability


n  The observability matrix of the sampled data system is:

n  The sampled data system is fully observable iff:

n  The characteristic polynomial of the matrix F is:

n  Then, the eigenvalues of F are:

G. Palli (DEI) Automatic Control & System Theory 34


Control of Digital Systems

Data Sampling in MIMO Systems – Impulse Response


4 8

3 6

2 4

1 2

0 0

-1 -2

-2 -4

-3
-6

-4
T = π/20 T = π/5
0 5 10 15 20 -8
0 5 10 15 20

15 20

15
10

10
5
5

0 0

-5
-5

-10
-10
-15

-15
T = π/2 T=π
0 5 10 15 20 -20
0 5 10 15 20
G. Palli (DEI) Automatic Control & System Theory 35
Control of Digital Systems

Data Sampling in MIMO Systems – Impulse Response


0.6 0.6

0.4 0.4

0.2 0.2

0 0

-0.2 -0.2

-0.4 -0.4

-0.6 -0.6
T = π/20 T = π/5
-0.8
0 5 10 15 20 -0.8
0 5 10 15 20
0.6

0.4

0.2

The properties of controllability and 0

observability degrades as the sampling


-0.2
period T grows
-0.4

-0.6
T=π
-0.8
0 5 10 15 20
G. Palli (DEI) Automatic Control & System Theory 36
Control of Digital Systems

Data Sampling in MIMO Systems – Transfer Function

n  The transfer function G(s) of the continuous-time system is:

n  The transfer function G(z) of the corresponding sampled data system
is:

G. Palli (DEI) Automatic Control & System Theory 37


Control of Digital Systems

Data Sampling in MIMO Systems – Transfer Function

n  The same result can be obtained by discretization of the transfer


function G(s) preceded by the zero-order hold:

G. Palli (DEI) Automatic Control & System Theory 38


Control of Digital Systems

Data Sampling in MIMO Systems

n  Example: consider the following purely inertial system with unitary
mass (m=1) subject to the external force u(t):

u(t)
m

n  The state vector is given by the position and the velocity

n  The system output is the position of the mass

G. Palli (DEI) Automatic Control & System Theory 39


Control of Digital Systems

Data Sampling in MIMO Systems

n  The dynamic model in the state-space representation is:

n  The matrices F and G of the corresponding sampled-data system are:

G. Palli (DEI) Automatic Control & System Theory 40


Control of Digital Systems

Data Sampling in MIMO Systems


n  Therefore, the sampled-data system can be written as:

n  It can be easily verified that this system is fully reachable and
observable

n  We are interested in designing a dead-beat controller: a state


feedback controller u(k)=K x(k) such that all the eigenvalues of the
closed-loop system eig(F+GK) are zero. This implies that the desired
characteristic polynomial of the closed loop system is:

G. Palli (DEI) Automatic Control & System Theory 41


Control of Digital Systems

Data Sampling in MIMO Systems


n  Assuming as state feedback matrix. Given u(k)=K x(k),
the following system dynamic matrix is obtained:

n  The characteristic polynomial of this matrix is:

n  By imposing the desired characteristic polynomial we


obtain:

G. Palli (DEI) Automatic Control & System Theory 42


Control of Digital Systems

Data Sampling in MIMO Systems


n  Since we are considering a dead-beat controller, the state feedback
u(k)=K x(t) is able to drive the state exactly to zero in just two steps
(since the order of the system is two) with an arbitrary small sample
time T

G. Palli (DEI) Automatic Control & System Theory 43


Control of Digital Systems

Data Sampling in MIMO Systems


n  The control action u(k) in the time instants k=0 and k=1 increases as
the sample time T decreases. Indeed:

n  The state can not be driven to zero in a time interval of 2T by means
of state feedback only in the case of continuous-time systems. In fact,
in the case of continuous-time systems the state goes to zero (or any
other final value) exponentially, that means the state is zero only for t
-> ∞.
G. Palli (DEI) Automatic Control & System Theory 44
Control of Digital Systems

Data Sampling in MIMO Systems


n  Simulink scheme

Clock
To Workspace1 uo

To Workspace6

yd

To Workspace14

1
K*u K*u K*u y
s

Pulse Kups Zero-Order B Integrator C To Workspace13

Generator Hold
A

Zero-Order
K*u
K Hold1

K*u xo

To Workspace2

K*u ys

C1 To Workspace3

G. Palli (DEI) Automatic Control & System Theory 45


Control of Digital Systems

Data Sampling in MIMO Systems


n  Ts = 1 sec, x0 = [5, -2]T, null setpoint

Response of yd, y and ys Control action u(k)


6 5

4
4

2
3
0

-2 2
0 2 4 6 8 10

Response of x1 and x2
1
5

0
-1

-5 -2
0 2 4 6 8 10 0 1 2 3 4 5 6 7 8 9 10

Input values u(k) = -2, 4

G. Palli (DEI) Automatic Control & System Theory 46


Control of Digital Systems

Data Sampling in MIMO Systems


n  Ts = 0.5 sec, x0 = [5, -2]T n  Ts = 2 sec, x0 = [5, -2]T
Response of yd, y and ys Response of yd, y and ys
6 6

4 4

2 2

0 0

-2 -2
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10

Response x1 and x2 Response x1 and x2


5 6

4
0
2
-5
0

-10 -2
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10

Control actionu(k) Control action u(k)


20 1

10
0.5
0
0
-10

-20 -0.5
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10

Input values u(k) = -14, 18 Input values u(k) = 0.25, 0.75

G. Palli (DEI) Automatic Control & System Theory 47


Control of Digital Systems

Data Sampling in MIMO Systems

n  Ts = 1 sec, x0 = [5, -2]T, square input setpoint with amplitude A = 10

Respose of yd, y and ys Control action u(k)


15 3

10
2
5

0
1

-5
0 10 20 30 40 50 60
0
Response of x1 and x2
15

10 -1

0 -2

-5

-10 -3
0 10 20 30 40 50 60 0 10 20 30 40 50 60

G. Palli (DEI) Automatic Control & System Theory 48


Control of Digital Systems

Data Sampling in MIMO Systems

G
n  If the state is not measureable, a dead-beat observer can be designed: in such
an observer the state estimation error evolves with a dynamics characterized by two
null eigenvalues (modes). This means that the eigenvalues of A+LC (or F+LH) are all
zeros.

n  Example: design of a reduced-order dead-beat observer.

n  Recalling the design of a generic reduced-order observer in the discrete-time case: the
system output directly coincides with the first q=1 components of the state.
n  Therefore, the observer dynamics is:

G. Palli (DEI) Automatic Control & System Theory 49


Control of Digital Systems

Data Sampling in MIMO Systems


n  The eigenvalues are imposed to be zero:

n  The dynamics of the dead-beat reduced-order observeris then:

it follows

and the state estimation is:

n  The transfer function G(s) of the continuous-time system is:

n  The transfer function G(z) of the


corrsponding discrete-time system is:

G. Palli (DEI) Automatic Control & System Theory 50


Control of Digital Systems

Data Sampling in MIMO Systems


n  Simulink scheme
uo
t
Clock To Workspace6
To Workspace1
yd

To Workspace14

1
K*u K*u K*u y
s
Pulse Kups Zero-Order B Integrator C To Workspace13
Generator Hold A
Zero-Order K*u
K Hold1

K*u xo

To Workspace2

xhat K*u ys

To Workspace4 C. To Workspace3

1 In1 y
x hat
K*u x hat

L In2 u

Subsystem
-1
1 K*u
Z
In1 y
Integer Delay -1/T

-1
2 K*u
Z
In2 u
Integer Delay1 T/2

G. Palli (DEI) Automatic Control & System Theory 51


Control of Digital Systems

Data Sampling in MIMO Systems


n  Ts = 2 sec, x0 = [5, -2]T n  Ts = 1 sec, x0 = [5, -2]T
Andamento yd, y e ys Andamento yd, y e ys
5 5

0 0

-5 -5

-10 -10
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10

Andamento x1 e x2 Andamento x1 e x2
10 20

5 10

0 0

-5 -10

-10 -20
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10
Azione di controllo u(k) Azione di controllo u(k)
10 40

5 20

0 0

-5 -20
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10

G. Palli (DEI) Automatic Control & System Theory 52


Control of Digital Systems

Data Sampling in MIMO Systems


n  Ts = 2 sec, x0 = [5, -2]T n  Ts = 1 sec, x0 = [5, -2]T

Andamento yd, y e ys Andamento yd, y e ys


15 15

10 10

5 5

0 0

-5 -5
0 10 20 30 40 50 60 0 10 20 30 40 50 60
Andamento x1 e x2 Andamento x1 e x2
20 20

10 10

0
0
-10
-10
0 10 20 30 40 50 60 -20
0 10 20 30 40 50 60
Azione di controllo u(k)
5
Azione di controllo u(k)
20

10
0
0

-10
-5
0 10 20 30 40 50 60 -20
0 10 20 30 40 50 60

G. Palli (DEI) Automatic Control & System Theory 53


Control of Digital Systems

AUTOMATIC CONTROL AND SYSTEM THEORY

CONTROL OF DIGITAL SYSTEMS

THE END

G. Palli (DEI) Automatic Control & System Theory 54

You might also like