CONTROL ENGINEERING DIGITAL DESIGN
➢ In digital control systems – the analogy electronics used for compensation in a
continuous system is replaced with a digital computer or microcontroller.
➢ Design of a digital control system – accomplished by transforming a continuous design,
called emulation or designing the digital system directly.
➢ The design of digital controller - determining the effect of the sample rate and selecting
a rate that is sufficiently fast to meet all specifications
➢ Advantages and disadvantages
✓ Advantages
Controllers are easily implemented and can be tuned on-line
Controllers are small, cheap, and highly reproducible
Complex algorithms (adaptive, nonlinear, optimal) can be implemented in
software
Controllers can simultaneously perform monitoring, scheduling, and safety tasks
✓ Disadvantages
The closed-loop system contains mixed continuous-time, discrete-time, and
interfacing components, complicating analysis
Analysis is often based on approximations (especially at low sample rates)
Digital controllers are sensitive to numerical errors, finite word-length, and
computational delay
Frequency-domain intuition must be re-built for the discrete domain
➢ Digitization methods – allow the designer to converter a continuous compensation D(s)
into a set of difference equations that can be programmed directly into a control
computer.
✓ Euler’s method – one of the methods can be used for the digitization
𝑥(𝑘 + 1) − 𝑥(𝑘)
𝑥̇ (𝑘) ≅
𝑇
✓ T is the sampling rate or sample rate – a higher sample rate (30 x bandwidth),
the digitally controlled system will behave close to its continuous counterpart.
Example:
Assume the compensator D(s)
𝑈(𝑠) 𝑠+𝑎
𝐷(𝑠) = = 𝐾𝑜 ( ) → (𝑠 + 𝑏)𝑈(𝑠) = 𝐾𝑜 (𝑠 + 𝑎)𝐸(𝑠)
𝐸(𝑠) 𝑠+𝑏
and the corresponding differential equation
Example:
using sample rates of 20Hz and 40Hz, implement the control equations and compute
the theoretical step response of the continuous system and compare that with the step
response of digital controlled system
Assignment: sketch
➢ A continuous PID control law whose transfer function is
𝑢(𝑠) 1
𝐷(𝑠) = = 𝐾(1 + + 𝑇𝐷 𝑠)
𝑒(𝑠) 𝑇𝐼 𝑠
can be implemented digitally using:
𝑇 𝑇𝐷 𝑇𝐷 𝑇𝐷
𝑢(𝑘) = 𝑢(𝑘 − 1) + 𝐾[(1 + + ) 𝑒(𝑘) − (1 + 2 ) 𝑒(𝑘 − 1) + 𝑒(𝑘 − 2)]
𝑇𝐼 𝑇 𝑇 𝑇
The digital control system will behave reasonably close to the continuous system
providing the sample rate is faster than 30 times the bandwidth
Example:
A micro-servo motor has TF from input applied voltage to the output speed (rad per sec)
360000
𝐺(𝑠) =
(𝑠 + 60)(𝑠 + 600)
If the determined values of K =5, TD = 0.0008 sec and TI = 0.003 sec give satisfactory
performance for the continuous case. Pick an appropriate sample rate, determine the
corresponding digital control law and implement on a digital control system.
Compare the digital step response with the calculated response of a continuous system.
Soln.
- First select the sample rate – by determining the bandwidth first
- From continuous system – ωn ≌ 1800 rad/sec, and the bandwidth would be 2000
rad/sec or 320 Hz. So, the sample rate would be about 3.2 kHz if 10 times the
bandwidth (then T = 0.3 msec)
Assignment: Sketch the graph of continuous system and digital system in one graph
Increase the sample rate to 10kHz (30 times the bandwidth) – sketch
✓ However, increasing the sample rate – increases the cost of the computer (speed
and heating etc)
✓ Maintain the sample rate (T = 0.3 msec) and re-tune PID values to have better
performance and sketch (K =3.2, TD = 0.0011 sec and TI = 0.003 sec)
DIGITAL CONTROLLER DESIGN
➢ Discrete controllers can be designed by emulation, root locus or frequency response
methods
✓ Emulation – continuous system changed to equivalent digital system (results
evaluated in terms of zeros and poles in z-plane, magnitude and phase in
frequency response or transient response to step, impulse or other input)
✓ Root locus - same as continuous time systems but relations btn pole location
and time response must refer to the z-plane rather than s-plane
✓ Nyquist stability criterion for discrete system, Bode’s design for phase
and gain margin
➢ Successful design – by emulation typically requires a sampling frequency at least 30
times the expected closed-loop bandwidth.
➢ Steady state error constants for discrete systems in open loop transfer function and
closed-loop poles and zeros – determine the system performance
➢ Root locus rules for discrete system characteristic equations
➢ Step response characteristics – rise time, overshoot
Performance characteristics
1. Steady state tracking accuracy
✓ Steady state error – the requirement that after all transients are negligible
✓ For common that have zero steady state error to a step input and finite error
to a ramp input of slope ro of size ess = ro/Kv where Kv is velocity constant
2. Transient accuracy (dynamic response) – the ability of the system to keep the
error small as r(t) changes
i. Stability -
ii. Rise time – the time necessary for the response to rise from 0.1 to 0.9
iii. Overshoot
iv. Settling time – typical value of the error tolerance is 1% for which we compute
the envelope value
➢ Checked using relation z=esT to map the poles in s-plane to z-plane
➢ Influenced by damping ratio (ζ)
➢ We consider both ζ and zero locations to help meet required specifications
𝜁
%𝑜𝑣𝑒𝑟𝑠ℎ𝑜𝑜𝑡 ≅ (1 − ) 100
0.6
→ 𝑣𝑒𝑟𝑦 𝑟𝑜𝑢𝑔ℎ𝑙𝑦 𝑓𝑜𝑟 𝑠𝑒𝑐𝑜𝑛𝑑 − 𝑜𝑟𝑑𝑒𝑟 𝑠𝑦𝑠𝑡𝑒𝑚
then,
%𝑜𝑣𝑒𝑟𝑠ℎ𝑜𝑜𝑡
𝜁 = (0.6) (1 − )
100
➢ Another aspect is the rise-time (tr) – should satisfy 𝜔𝑛 ≥ 1.8⁄𝑡 → 𝑡𝑟 ≅
𝑟
1.8⁄
𝜔𝑛
➢ Settling time – typical value of the error tolerance is 1% for which we
compute the envelope value to be;
𝑒 𝜁𝜔𝑛𝑡𝑠 = 0.01 → 𝜁𝜔𝑛 𝑡𝑠 = 4.6 → 𝑡𝑠 = 4.6⁄𝜁𝜔
𝑛
➢ The above have to be converted into guidelines on the placement of poles in
the z-plane in order to guide the design of the digital controller (z=esT)
Example: (designing using emulation method)
In s-domain, the system has natural freq. of 1rad/sec or 0.16Hz, for safer, sample rate
would be 3 Hz or higher (20 times or more the closed-loop bandwidth)
Initially choose sample rate of 5 Hz hence sample time T = 0.2 sec
Converted in difference equation,
Let as evaluate the stability
➢ From G(s), given T = 0.2 sec
The closed-loop x-tics equation 1+D(z)G(z) = 0
Which has the roots z = 0.900±j0.162 that can evaluated to their corresponding ζ and 𝜔𝑛 or could be
converted back to s-plane such that s = -0.446±j0.891 (check if they are same as that of closed-loop
coninuous system)
Then ζ=0.447 (from ζ=0.5), ts = 10.3 sec (from 10 sec), overshoot = 20.8% (from 16%)
3. Disturbance rejection
i. Steady state
ii. Transient
4. Control effort required
i. Maximum magnitude of input control (u(t))
ii. Energy
5. Sensitivity to parameter changes
Compensator Design
✓ Assume a TF of the plant for an antenna angle-tracer
1
𝐺(𝑠) =
𝑠(10𝑠 + 1)
Required specifications for this system are: overshoot to a step input less than 16%, settling
time to 1% to be less than 10 sec, tracking error to a ramp input of slope 0.01 rad per sec to
be less than 0.01 rad and the sampling time to give at least 10 samples in a rise-time. Use
pole mapping technique
Root Locus of Digital Control Systems
➢ The root locus is the locus of points where roots of a characteristic equation can be
found as some real parameter varies from zero to large values
➢ Sometimes we are interested in negative parameter values and look at root loci for
parameter in the entire range (-∞≤K<∞). The loci of positive gain are most common
➢ The root locus can enable the design of the controller that meets a number of time
domain as well as frequency-domain specifications such as damping ratio, speed
response, settling time and natural frequency, in discrete-time systems require a minor
modification.
➢ NOTE: The mechanics of drawing the root loci are exactly the same in the z-plane as the
s-plane, that’s the rules for the real axis, asymptote construction and arrival or
departure angles are all unchanged
➢ The difference lies in the interpretation of the results – the pole locations mean
different things when to interpret system stability and dynamic response.
➢ To determine the gain required for stability and the gain required to meet a transient
response required – stability within the unit circle, find the intersection of the root
locus with the unit circle
𝑌(𝑍) 𝐾𝐺(𝑍)𝐷(𝑍)
Let = 1+𝐾𝐺(𝑍)𝐷(𝑍), then, the characteristic equation 1 + 𝐾𝐺(𝑍)𝐷(𝑍) = 0, as K varies,
𝑅(𝑍)
the roots of x-tics equation will also vary
If K = 0, the roots of the x-tics equation will be the roots of the denominator of 𝐺(𝑍)𝐷(𝑍)
and if K = ∞, the roots of the x-tics equation will be the zeros of the of 𝐺(𝑍)𝐷(𝑍)
To sketch the root locus
1. The root locus starts at the poles and progresses to the zeros
2. The root locus lies on a section of the real axis to the left of an odd numbers of poles
and zeros
3. The root locus is symmetrical w.r.t the horizontal real axis
4. The root locus may break away from the real axis and may re-enter the real axis
➢ Breakaway and entry points are determined
−𝑁(𝑍) 𝑑𝐹(𝜎)
𝐾= = 𝐹(𝑍), with z=σ, then =0
𝐷(𝑍) 𝑑(𝜎)
5. Plot the locus of roots that satisfy;
1 + 𝐾𝐺(𝑍)𝐷(𝑍) = 0 or
|𝐾𝐺(𝑍)𝐷(𝑍)| = 1 and ∠𝐺(𝑍)𝐷(𝑍) = 180° ∓ 𝑘360°, 𝑘 = 0,1,2,3 ….
➢ The lines of constant damping ratio, ξ for continuous-time systems are determined by
the angle θ such that
𝜉 = cos 𝜃
In any value of radius r
s = 𝑟(−cos 𝜃 + 𝑗𝑠𝑖𝑛 𝜃)
In the z-plane, these lines are mapped to be,
z = 𝑒 𝑟(− cos 𝜃)+𝑗 sin 𝜃)𝑇
of which the curve starts at z = 1 (r = 0 to any value btn 0 and -1)
➢ The constant damped frequency ωd in continuous time systems are circular about the origin
of s-plane such that,
𝜔𝑑 = 𝜔𝑛 √1 − 𝜉 2
➢ Depending on the natural frequency of the system 𝜔𝑛 , in the discrete-time domain are
mapped according to;
2
z = 𝑒 𝜔𝑛𝜉∓𝑗𝜔𝑛√1−𝜉
Figure 1: Constant damping ratio, settling time and peak time plots on z-plane
Figure 2: Curves of constant damping ratio on the z-plane
Example
Let Gp(s)=1/s2, D(Z)=1
𝑇 2 𝐾(𝑧 + 1)
𝐾𝐺(𝑍)𝐷(𝑍) = ×
2 (𝑧 − 1)2
with T = sqrt(2),
𝐾(𝑧 + 1)
𝐾𝐺(𝑍)𝐷(𝑍) =
(𝑧 − 1)2
Poles = 1, 1 and zeros =-1
Then, from
−𝑁(𝜎) −(𝜎 − 1)2
𝐾= = 𝐹(𝜎) =
𝐷(𝜎) (𝜎 + 1)
𝑑𝐹(𝜎)
With, = 0, σ1=-3 and σ2=1, then the locus leaves the two poles at σ2=1 and re-enters at
𝑑(𝜎)
σ1=-3
The system has two poles outside the unit circles hence its unstable to all values of K>0
Alternatively:
If the characteristic equation is
𝑁(𝑧)
1 + 𝐾𝐹(𝑧) = 1 + 𝐾
𝐷(𝑧)
As K changes, so do the locations of the closed-loop poles. The root locus is the locus of the
poles as a function of K. To sketch the root locus, follow these rules:
➢ N(z) has roots zi,i =1,…,m, D(z) has roots pi, i = 1,…,n. The difference btn n and m is
the relative degree r = n-m.
➢ The root locus is symmetric about the real axis
➢ There are n branches of the locus, one for each closed-loop pole.
➢ The locus starts (K = 0) at poles of F(z) and ends (K →∞) at zeros of F(z). There are
r zeros at infinity as K →∞
➢ The locus exists on the real axis to the left of an odd number of poles and zeros
➢ If r > 0, there are asymptotes of the root locus that intersect the real axis at
∑𝑛 𝑚
𝑖=1 𝑝𝑖 −∑𝑖=1 𝑧𝑖 𝜋
𝜎= and radiate out with angles 𝜃 = ±𝑞 𝑟 , where q = 1,3,5,…..
𝐷(𝑧)
➢ Break-away or break-in points of the locus exist where 𝑁(𝑧)𝐷′ (𝑧) − 𝑁 ′(𝑧) 𝐷(𝑧) = 0
➢ Angle of departure from complex pole pj is 𝜋 + ∑𝑚 𝑛
𝑖=1 ∠(𝑝𝑗 − 𝑧𝑖 ) − ∑𝑖=1,𝑖≠𝑗 ∠(𝑝𝑗 −
𝑝𝑖 )
➢ Angle of arrival at complex zero zj is 𝜋 − ∑𝑚 𝑛
𝑖=1,𝑖≠𝑗 ∠(𝑧𝑗 − 𝑧𝑖 ) − ∑𝑖=1 ∠(𝑧𝑗 − 𝑝𝑖 )
Example:
Consider a unity feedback loop in which the digital control
𝑧
𝐶(𝑧) = 𝐾
𝑧−1
is interconnected by a zero-order hold to the plant
1
𝑃(𝑠) =
𝑠+1
Determine the root locus for T = 0.5, T = 1 and T = 2
Let’s Design the compensator or digital controller
1
Let the plant 𝐺(𝑠) = 𝑠 , D(z) = 1
𝑇 2 𝐾(𝑧 + 1) 𝐾(𝑧 + 1)
𝐾𝐺(𝑧)𝐷(𝑧) = = , 𝑤𝑖𝑡ℎ 𝑇 = √2
2 (𝑧 − 1)2 (𝑧 − 1)2
This has poles at z =1,1 (double) and zeros at z = -1
Break-away: dF(σ)/dσ=0 gives σ₁=−3 (entry), σ₂=1 (breakaway). The two locus branches leave the
double pole at z=1 and re-enter the real axis at z=−3.
Both poles start outside the unit circle — the system is UNSTABLE for all K>0.
When the frequency-response design specifications such as the gain margin and phase
margin are known, one can design the phase lead, phase lag, and the lead lag
compensators, the discrete-time compensator design can be done
NOTE:
(i) The compensator can either be a lead, a lag or combination of both lead and lag
compensator,
(ii) Lead compensator improves the transient response of the system (moves the locus to
left)
(iii) Lag compensator improves the steady state error
Assume,
(𝑧−𝑎)
𝐷(𝑧) = 𝐾 (𝑧−𝑏)
For Lead compensator, |𝑎| < |𝑏| < 1
For lag compensator, 1 > |𝑎| > |𝑏|
Select the value of 𝑧 − 𝑎 in order to cancel one pole at G(Z) that lies on the positive real axis
of z-plane, then select 𝑧 − 𝑏 so that the locus of the compensated system will be give the set
of the complex roots at a desired point with the unit circle of z-plane.
(𝑧−𝑎)
So, 𝐷(𝑍) = 𝐾 (𝑧−𝑏)
In order to cancel one pole, set a = 1, and assume b = 0.2.
Then,
𝐾(𝑧 + 1)(𝑧 − 𝑎) 𝐾(𝑧 + 1)(𝑧 − 1)
𝐾𝐺(𝑍)𝐷(𝑍) = =
(𝑧 − 1) (𝑧 − 𝑏) (𝑧 − 1)2 (𝑧 − 0.2)
2
OK, poles = 1 and 0.2 and zeros = -1
With
𝑑𝐹(𝑧) −(𝑧 2 +2𝑧−1.4)
=0= (𝑧+1)2
, z = 0.549, -2.549.
𝑑(𝑧)
➢ The break away point = 0.549, the entry point = -2.549
➢ The root locus crosses the unit circle at K = 0.8, then system is stable for all values of
0<K<0.8
➢ At K = 0.5: closed-loop poles at z =0.9±j0.162
Converting: |z|=0.9145, σ=ln(0.9145)/0.1=−0.893, ωd=arctan (0.162/0.900)/0.1=1.78
rad/s
ωₙ=√(0.797+3.168) =1.99 rad/s, ζ=0.893/1.99=0.449
➢ Let as check on percent overshoot and settling time, ASSIGNMENT (%OS =
20.5%, ts = 5.15s)
Example:
Let the x-tics equation is with T = 1sec, and the controller is simply a proportional gain K
PID CONTROLLER
➢ The PID controller in discrete-time is the same as in continuous-time
➢ All characteristics of the PID in continuous time systems apply well to discrete time
systems subject to some adjustments of the discrete-time version.
➢ Consider PID controller in continuous-time system,
𝑈(𝑠) 𝑘𝐼
= 𝐺𝑐 (𝑠) = 𝑘𝑃 + +𝑘𝐷 𝑠
𝐸(𝑠) 𝑠
The values of gains kP, kI and kD are chosen to give the desired system dynamic
response. For the case of this subject,
𝑈(𝑠) 𝑘𝐼 1
= 𝐺𝑐 (𝑠) = 𝑘𝑃 + +𝑘𝐷 𝑠 = 𝑘𝑃 (1 + + 𝑇𝐷 𝑠)
𝐸(𝑠) 𝑠 𝑇1 𝑠
kP, TI and TD give a complete description of the controller, such that kP, is the
proportional gain, TI is the integral (or reset) time and TD is the derivative time.
➢ The methods of tuning these gains have been discussed (particularly using the
Ziegler-Nichols method.
(i) Proportional controller (P)
➢ Used to amplify the control error signal
𝑈(𝑠)
= 𝐺𝑐 (𝑠) = 𝑘𝑃
𝐸(𝑠)
The control signal is given as
𝑈(𝑠) = 𝐺𝑐 (𝑠)𝑋(𝑠) = 𝑘𝑃 𝐸(𝑠)
In z-domain (discrete-time)
𝑈(𝑧) = 𝐺𝑐 (𝑧)𝐸(𝑧) = 𝑘𝑃 𝐸(𝑧)
Means, the discrete-time P-controller has the same gain as that of the
continuous-time system
(ii) Integral Controller (I)
➢ Integration of error signal or numerical differentiation of the control signal
𝑈(𝑠) 𝑘𝑃 𝑘𝑃
= 𝐺𝑐 (𝑠) = ⇒ 𝑈(𝑠) = 𝐺𝑐 (𝑠)𝐸(𝑠) = 𝐸(𝑠)
𝐸(𝑠) 𝑇1 𝑠 𝑇1 𝑠
➢ In time domain
𝑑𝑢(𝑡) 𝑘𝑃
= 𝑒(𝑡)
𝑑(𝑡) 𝑇1
In digital form, applying Euler’s backward difference approximation rule, such that,
𝑢(𝑘) − 𝑢(𝑘 − 1) 𝑘𝑃
= 𝑒(𝑡)
𝑇 𝑇1
Such that,
𝑘𝑃 𝑇
𝑢(𝑘) = 𝑢(𝑘 − 1) + 𝑒(𝑡)
𝑇1
In z-transform,
𝑘𝑃 𝑇 𝑘𝑃 𝑇
𝑈(𝑧) = 𝑧 −1 𝑈(𝑧) + 𝐸(𝑧) ⇒ 𝑈(𝑧)[1 − 𝑧 −1 ] = 𝐸(𝑧)
𝑇1 𝑇1
𝑘𝑃 𝑇
𝑈(𝑧) = 𝐸(𝑧)
𝑇1 (𝑧 − 1)
𝑈(𝑧) 𝑘𝑃 𝑇
= 𝐺(𝑧) =
𝐸(𝑧) 𝑇1 (𝑧 − 1)
(iii) Derivative Controller
➢ To derive the control signal as the function of all past error signal up to time k
𝑈(𝑠)
= 𝐺𝑐 (𝑠) = 𝑘𝑃 𝑇𝐷 𝑠 ⇒ 𝑈(𝑠) = 𝑘𝑃 𝑇𝐷 𝑠𝐸(𝑠)
𝐸(𝑠)
➢ In time domain
𝑑𝑒(𝑡)
𝑢(𝑡) = 𝑘𝑃 𝑇𝐷
𝑑(𝑡)
Also, using forward Euler’s forward approximation rectangular integration rule; at t=kT
𝑑𝑒(𝑡) 𝑒(𝑘) − 𝑒(𝑘 − 1)
| =
𝑑(𝑡) 𝑡=𝑘 𝑇
𝑘𝑃 𝑇𝐷
𝑢(𝑘) = [𝑒(𝑘) − 𝑒(𝑘 − 1)]
𝑇
In z-transform,
𝑘𝑃 𝑇𝐷 𝑘𝑃 𝑇𝐷
𝑈(𝑧) = [𝐸(𝑧) − 𝑧 −1 𝐸(𝑧)] = 𝐸(𝑧)[1 − 𝑧 −1 ]
𝑇 𝑇
𝑈(𝑧) 𝑘𝑃 𝑇𝐷 (𝑧 − 1)
=
𝐸(𝑧) 𝑇𝑧
(iv) Then, PID controller in z-transform
𝑈(𝑧) 𝑇 𝑇𝐷 (𝑧 − 1)
= 𝐺𝑐 (𝑧) = 𝑘𝑃 (1 + + )
𝐸(𝑧) 𝑇1 (𝑧 − 1) 𝑇𝑧
Then, this can be implemented using digital compensators
ASSIGNMENT: USE TUSTIN METHOD
Ziegler–Nichols Tuning Rules
Ultimate gain method: (1) use proportional control only; (2) increase kP until constant oscillation; (3)
record ultimate gain K_u and period T_u.
Controller kP T_I T_D
Controller kP T_I T_D
P 0.50 K_u — —
PI 0.45 K_u T_u/1.2 —
PID 0.60 K_u T_u/2 T_u/8
NOTE: Ziegler-Nichols gives approximately 25% overshoot. Common practice: reduce kP by 20–30%
after initial tuning. Fine-tune T_D to increase damping if overshoot is too high.
Example:
The State-Space analysis
Questions
1. Consider the following input-output relationship for an open-loop discrete-time
system,
𝑢(𝑘) − 4𝑢(𝑘 − 1) + 3𝑢(𝑘 − 2) = 𝑟(𝑘) − 3𝑟(𝑘 − 1)
Determine the poles of the closed-loop system with unity feedback.
2. ssd