A very important category of real time systems are
automatic control
systems
. In fact all control systems are real

time systems because
they must react to external events within a specified amount of time.
The operation of computer control systems is usually synchronized by
a clock signal that determines the sampling period. This sampling
period specifies the maximum total amount of time that is available for
A/D and D/A conversions and control computations.
Computer control systems
Control loop variables
y
(
t
) or
y
(
k
)

controlled variable
(temperature, pressure, water
level, flow, speed etc.)
r
(
k
)

reference or setpoint
i.e. the desired value of the controlled
variable
e
(
k
)

control error
the difference between the desired value of the
controlled variable and its actual value
e
(
k
)=
r
(
k
)

y
(
k
)
u
(
t
) or
u
(
k
)
–
manipulated variable
represents the action that is
used by the controller to change the controlled variable (control
valve position, power input of a heating element, speed of a
cooling fan, fuel flow to an engine or to a boiler)
Besides, there is usually also one or more
disturbance variable(s)
d
(
t
) that are external influences affecting the controlled variable
(changing temperature of the environment, changing load of a
electric drive or of an engine etc.)
Examples:
Digital control
of an Air Heater:
Digital speed control
of a DC motor:
Two types of real

time control
systems:
1. Embedded Systems
• dedicated control systems
• the computer is an embedded part of
some piece equipment
• microprocessors, real

time kernels, RTOS
• aerospace, industrial robots, vehicular
systems
2. Industrial Control Systems
• distributed control systems (DCS),
programmable controllers (PLC),
Soft

PLCs
• hierarchically organized, distributed
control systems
• process industry, manufacturing industry,
Universal process controller
Modular control system:
Actuators: Control valves
Control valves with electrical drive typically two phase
induction motor
Operation of the analog

to

digital converter (ADC), the digital

to

analog converter (DAC) and the zero order hold
(
ZOH)
ADC performs two functions:
1. Analog signal sampling
Continuous signal is replaced
with a sequence of values
equally spaced in the time
domain
2. Quantization amplitude of
the signal is represented with a
discrete set of different values
Zero order hold is described by the formula
v
v
v
T
k
t
kT
kT
y
t
y
)
1
(
)
(
)
(
The behavior of the output of standard DAC is that of zero order hold.
Discontinuous step changes at ZOH output can excite poorly damped
mechanical modes of the physical process and also cause wear in the
actuators of the system. A theoretically possible solution is higher order
hold circuits.
First order hold
:
v
v
v
v
v
v
v
T
k
t
kT
kT
y
T
k
y
T
kT
t
kT
y
t
y
)
1
(
)
(
)
)
1
((
)
(
)
(
This form of FOH is not causal. Causal FOH can be obtained by
introducing a delay of one sampling period or using output prediction
based on extrapolation from previous sampling period.
v
v
v
v
v
v
v
T
k
t
kT
T
k
y
kT
y
T
kT
t
kT
y
t
y
)
1
(
)
)
1
((
)
(
)
(
)
(
First and higher order hold circuits are normally not used in control
systems because of the high phase shift they introduce.
The simplest approach to control: on

off and three
position control
Static
chara
c
teristi
cs of
on

off and three position controllers
1
.
The higher is the control error the higher the control action
(manipulated variable) must be
)
(
)
(
t
e
r
t
u
o
Proportional or
P
controller
r
0
proportional gain
Digital P/PI/
PID
controller
)
s
(
E
s
T
s
T
r
)
s
(
U
dt
)
t
(
de
T
d
)
(
e
T
)
t
(
e
r
)
t
(
u
d
i
o
d
t
i
o
]
1
1
[
]
1
[
0
If the control error equals zero, the manipulated variable is also zero.
As a result of it, if the controlled plant is non

integrating (i.e. non

zero plant input is necessary to have non

zero output), there will
always be some non

zero steady state error. The value of error will
be the smaller the higher the proportional gain will be.
This is a significant drawback as the majority of the controlled plants
are non

integrating (some non

zero value of the plant input is
necessary to compensate for thermal losses, mechanical friction, load
torque etc. depending on the particular plant being controlled).
2.
Proportional
Integral or
PI
controller
)
(
1
)
(
]
1
1
[
)
(
]
)
(
1
)
(
[
)
(
0
s
E
s
T
s
T
r
s
E
s
T
r
s
U
d
e
T
t
e
r
t
u
i
i
o
i
o
t
i
o
T
i
integra
l time constant
Due to the presence of the integral term, the manipulated variable
(=plant input) can be non

zero even if control error is zero.
Achieving zero steady state error is therefore possible)
3.
Proportional Integral Derivate PID controller
T
d
derivative time constant
)
(
]
1
1
[
)
(
]
)
(
)
(
1
)
(
[
)
(
0
s
E
s
T
s
T
r
s
U
dt
t
de
T
d
e
T
t
e
r
t
u
d
i
o
d
t
i
o
The derivative term does not affect the steady state behavior of the
control loop (derivative of constant is zero), however it can be used
to speed up and improve the dynamics response of the control loop
Digital
PID
controller
)
s
(
E
s
T
s
T
r
)
s
(
U
dt
)
t
(
de
T
d
)
(
e
T
)
t
(
e
r
)
t
(
u
d
i
o
d
t
i
o
]
1
1
[
]
1
[
0
Individual terms are often discretized using different methods. The
proportional term requires no approximation because it is a purely
static part.
Integral term
:
rectangular rule, trapezoid rule
)
k
(
I
)
i
(
e
T
T
r
)
(
e
T
r
O
k
i
i
v
o
t
i
o
1
0
)
k
(
I
))
i
(
e
)
i
(
e
(
T
T
r
)
(
e
T
r
L
k
i
i
v
o
t
i
o
1
0
1
2
Backward rectangular rule
:
(
it is better than forward rule as it
immediately reacts to setpoint changes
)
Trapezoid rule
:
))
1
(
)
(
(
2
)
1
(
)
(
finally
and
))
1
(
)
(
(
2
)
1
(
)
(
))
1
(
)
(
(
2
)
1
(
))
1
(
)
(
(
2
)
(
1
1
1
k
e
k
e
T
T
r
k
I
k
I
k
e
k
e
T
T
r
k
I
k
I
i
e
i
e
T
T
r
k
I
i
e
i
e
T
T
r
k
I
i
v
o
L
L
i
v
o
L
L
k
i
i
v
o
L
k
i
i
v
o
L
The formula for calculating the integral term includes summation
from the beginning (1 or 0 depending on the particular rule that is
used). For implementation it is converted to the form of difference
equation that is updated recursively at each sampling instant. For
the trapezoid method this can be written in the following way
T
his simple approximation is very sensitive to noise and combined
effects of quantization and sampling may result in erratic behavior, in
particular if sampling time is small (the response to a slowly and
linearly growing signal
e
(
t
) is then not a small constant but a
sequence of short peaks with high magnitude)
Derivative term
:
The simplest approach
:
backward difference
)
(
))
1
(
)
(
(
k
D
T
k
e
k
e
T
r
dt
de
T
r
v
d
o
d
o
Better Alternative:
Multipoint difference
:
Derivative at time
kT
v
is approximated with an average speed of control
error change at several sampling intervals
Average error
4
3
2
1
k
k
k
k
k
e
e
e
e
e
v
k
k
k
k
v
k
k
v
k
k
v
k
k
v
k
k
v
k
T
e
e
e
e
T
e
e
T
e
e
T
e
e
T
e
e
T
e
k
D
6
3
3
5
,
1
5
,
0
5
,
0
5
,
1
4
1
)
(
3
2
1
3
2
1
Integral
Wind

up
Internal computation of the integral term
is practically unlimited, while the physical
manipulated variable is always limited
and the limits are hard. As a result of it
the value of the integral term can
significantly exceed the value of the
physically realizable manipulated
variable. In such a situation, if the setpoint
is reached and the control error changes
sign, it takes the a long time before this
change can also be observed at
manipulated variable output. Long lasting
overshoots as can be seen from the figure
and other problems then result.
Wind

up can be prevented by using the dynamic limitation of the
integral term.
The procedure is as follows:
1. At each time step k compute the individual terms
P
(
k
),
I
(
k
) and
D
(
k
)
2. Sum these terms up to calculate the manipulated variable
u
(
k
)=
P
(
k
)+
I
(
k
)+
D
(
k
)
3. If the value of the manipulated variable is within limits, it is
sent to the D/A converter. If not, manipulated variable remains at
one of its limits, the current value of the integral term
I
(
k
) is
discarded and replaced with
I
(
k

1
)
In the next sampling instant this procedure is repeated. Thus the
integral term is frozen for the whole time during which the
manipulated variable is at its limits and if its value becomes
smaller after the change of control error sign the effect on
manipulate variable is immediate.
As the integral term is frozen at some static value that is not
specified a priori, this limitation is called dynamic.
Aliasing
)
ft
sin(
A
)
t
(
u
2
Harmonic sign
a
l
with
fre
quency
f
Sampling
with
period
T
v
)
fkT
sin(
A
)
k
(
u
v
2
By
sampling
h
armonic
sign
a
l
with
fre
quency
v
nf
f
)
fkT
sin(
A
)
n
sin(
)
fkT
cos(
A
)
n
cos(
)
fkT
sin(
A
kT
)
nf
f
(
sin
A
)
k
(
u
v
v
v
v
2
2
2
2
2
2
In other words, it is not possible to distinguish between
sampled
sign
a
l
with
fre
quency
f
and
v
s
nf
f
f
Sign
a
l
50
Hz
sampled
with
sampling
frequency
a)
49
Hz
b)
51
Hz
2
v
f
f
Shannon

Kotělnikov
theorem
This theorem cannot be satisfied for noise signals
anti

aliasing
filt
e
r
is necessary
Usually analogue low

pass filter is combined with digital filter that
works with smaller sampling time that is the sampling time of the
control algorithm.
f
nf
f
f
v
s
Then
a
nd aliasing does not occur
PID Controller Output with PWM modulation
T
c
cycle time
Tuning of PID Controllers
The behavior of the
PID
controllers depends on 3 parameters
:
r
0

proportional gain
T
i

integral time constant or reset time
T
d

derivative time constant or rate time
Their values must be chosen appropriately in order to make the
control loop
:
1) stab
le
2)
well tuned with respect to dynamic responses to setpoint and/or
external disturbance changes. Typically, these responses should be
fast and without big over

or undershoots
If the dynamics of
w
(
t
) and
d
(
t
) changes is significantly different
(
and
typically it will be different: setpoint is often changed in steps resulting in step
changes of control error while the disturbances usually cause gradual changes
of the controlled variable and control error)
,
the controller tuning must be
optimized either with respect to setpoint tracking or with respect to
disturbance rejection but it is not possible to achieve both objectives with the
same controller tuning.
)
(
)
(
)
(
)
(
)
(
1
1
)
(
)
(
)
(
)
(
)
(
)
(
1
)
(
)
(
)
(
)
(
1
)
(
)
(
)
(
s
D
s
G
s
W
s
G
s
G
s
Y
s
W
s
E
s
D
s
G
s
G
s
G
s
W
s
G
s
G
s
G
s
G
s
Y
d
R
S
R
S
d
R
S
R
S
Two different objectives of PID controllers tuning:
a) Set

point tracking
b) Disturbance rejection
Ziegler Nichols
–
method
. This method is suitable for
disturbance rejection. It exists in two variants.
1.
Variant Ultimate gain method
:
only
P
controller is used,
I a
nd
D
terms are switched off. Proportional gain is gradually increased until
the stability limit is reached
(
undamped oscillations with constant
magnitude)
.
This value of the gain is called the ultimate gain
r
k
and the
period of oscillations is denoted as the ultimate period
T
k
.
Using these
two pieces of information the recommended controller tuning can be
calculated using the table below.
Controller
r
o
T
i
T
d
P
0,5
r
k
PI
0,45
r
k
0,85
T
k
PID
0,6
r
k
0,5
T
k
0,125
T
k
Ziegler

Nichols
tuning
rules
ultimate
gain
method
2
.
Variant

Step response method
Tangent in the inflection point of
the response (the point where the
slope of the response is
maximum)
T
u
–
dead time
T
n
–
rise time
K
–
steady state gain
)
(
)
(
u
y
K
n
u
T
T
Normalized dead
time
Controller
r
o
T
i
T
d
P
1/(
K
PI
0,9/(
K
3
T
u
PID
1,2/(
K
2
T
u
0,5
T
u
Ziegler
Nichols
tuning
rules
–
step
response
method
Chien Hrones Reswick
method
Based on the first order plus time delay approximation of the controlled
plant dynamics. Two possible choices: aperiodic closed loop response and
closed loop response with ca
20%
overshoot. This method gives tuning
formulae both for the setpoint tracking and for the disturbance rejection.
)
1
(
)
(
s
Ke
s
G
D
sT
s
Controller
No overshoot
Max
20%
overshoot
Set

point tracking
Disturbance
rejection
Set

point tracking
Disturbance
rejection
P
r
o
=0,3
/(
KT
D
)
r
o
=0,3
/(
KT
D
)
r
o
=0,7
/(
KT
D
)
r
o
=0,7
/(
KT
D
)
PI
r
o
=0,35
/(
KT
D
)
T
i
=1,2
r
o
=0,6
/(
KT
D
)
T
i
=4
T
D
r
o
=0,6
/(
KT
D
)
T
i
=
r
o
=0,7
/(
KT
D
)
T
i
=2,3
T
D
PID
r
o
=0,6
/(
KT
D
)
T
i
=
T
d
=0,5
T
D
r
o
=0,95
/(
KT
D
)
T
i
=2,4
T
D
T
d
=0,42
T
D
r
o
=0,95
/(
KT
D
)
T
i
=1,35
T
d
=0,47
T
D
r
o
=1,2
/(
KT
D
)
T
i
=2
T
D
T
d
=0,42
T
D
Chien Hrones Reswick
tuning rules
Comments 0
Log in to post a comment