DIGITAL CONTROL SYSTEMS (EE-372)
Lab #1 Report
Course Instructor: Lt Col Dr Atif Qayyum
Lab Engineer: Haris Ataullah
Group Members Registration Number
Zain Rehan 301822
Muhammad Umer Siddiq 296908
Syed Muhammad Abdullah Shah 286767
Degree 41 Syndicate B
LAB 1: Introduction to Digital Controls
Exercise 1: Consider the Transfer function.
1
𝐺(𝑠) =
𝑠−1
i. The above system has a pole at +1. Design a proportional controller such that the closed
loop system has a pole at -1.
ii. Implement the continuous time closed loop system in Simulink. Use the figure given
below as a reference.
Figure 1: Continuous Time System implementation in Simulink
iii. Run the simulation to see the response of the system.
iv. If the controller was implemented digitally, we would also require an ADC and a DAC
for digital/analog conversions. The ADC can be implemented with a quantizer and a
sampler. The Simulink block of quantizer has a sampler built in it. The DAC can be
implemented with a zero-order hold (ZOH). Simulate a digital implementation of the
controller with the help of the following diagram.
Figure 2: Discrete Time System implementation in Simulink
v. Set the sampling time = 0.001 for both ZOH and quantizer. Set quantization interval =
0.001
vi. Connect the output of both control systems to a single scope for easy comparison.
Figure 3: Continuous & Discrete Time System implementation in Simulink
vii. Compare the outputs of both the control systems. Are they similar?
viii. Now gradually increase sampling time up to 5 seconds while keeping the quantization
interval at 0.001. Compare the response of both the systems. Do the responses differ?
Does the closed loop system with the digital controller remains stable?
ix. Keeping the sampling time at 0.01 secs, try different values of the quantization interval
between 0.001 and 5. Compare the response of both the systems. Do the responses differ?
Does the closed loop system with the digital controller remains stable? Do you observer
any oscillations in the steady state value of the system. Can you observe any link of the
frequency/amplitude of these oscillations to the sampling time and quantization interval?
Exercise 1 Solution:
Transfer Function Implementation:
%Exercise 1
G = tf(1,[1 -1])
pole(G)
G =
1
-----
s - 1
Continuous-time transfer function.
ans =
Proportional Controller Design (C = 2):
Simulink Implementation:
Simulink Observations:
For part (vii), sampling time and quantization interval are both equal to 0.001 and the outputs of
both control systems are exactly the same.
For part (viii), quantization interval is fixed at 0.001 and the sampling time is increased up to 5
seconds. The responses differ and the closed loop system with the digital controller does not
remain stable.
For part (ix), sampling time is fixed at 0.01 seconds and the quantization interval is changed
between 0.001 and 5. The responses differ, but the closed loop system with the digital controller
remains stable. However, as we increase the value of quantization interval, the oscillations in the
steady state value of the system increase. If the values of sampling time and quantization interval
are similar then the oscillations are small, but if these values differ then the oscillations are large.
Exercise 2: Consider the following transfer function.
1
𝐺(𝑠) =
𝑠+1
i. Design a proportional controller such that G(s) has a pole at -3.
ii. Implement this system in continuous time domain in Simulink.
iii. Implement this system using digital controller with the help of Zero Order Hold and
Quantizer.
iv. Display the response of both systems in one scope.
v. Compare the response of both systems.
vi. Gradually increase sampling time up to 5 seconds and compare responses.
vii. With sampling time = 0.1, gradually increase quantization interval to 5 and compare
responses.
viii. Note down your observations.
Exercise 2 Solution:
Transfer Function Implementation:
%Exercise 2
G = tf(1,[1 1])
pole(G)
G =
1
-----
s + 1
Continuous-time transfer function.
ans =
-1
Proportional Controller Design (C = 2):
Simulink Implementation:
Simulink Observations:
For part (v), sampling time and quantization interval are both equal to 0.001 and the outputs of
both control systems are exactly the same.
For part (vi), quantization interval is fixed at 0.001 and the sampling time is increased up to 5
seconds. The responses differ and the closed loop system with the digital controller does not
remain stable.
For part (vii), sampling time is fixed at 0.1 seconds and the quantization interval is changed
between 0.001 and 5. The responses differ, but the closed loop system with the digital controller
remains stable.
For part (viii), as we increase the value of quantization interval, the oscillations in the steady
state value of the system increase. If the values of sampling time and quantization interval are
similar then the oscillations are small, but if these values differ then the oscillations are large.
Exercise 3: Consider the following transfer function.
1
𝐺(𝑠) =
(𝑠 + 1)(𝑠 + 3)
i. Design a proportional controller such that G(s) has an OS = 4.32%
ii. Implement this system in continuous time domain in Simulink.
iii. Implement this system using digital controller with the help of Zero Order Hold and
Quantizer.
iv. Display the response of both systems in one diagram.
v. Compare the response of both systems.
vi. Gradually increase sampling time up to 5 seconds and compare responses.
vii. With sampling time = 0.1, gradually increase quantization interval to 5 and compare
responses.
viii. Note down your observations.
Exercise 3 Solution:
Transfer Function Implementation:
%Exercise 3
G = tf(1,[1 4 3])
pole(G)
G =
-------------
s^2 + 4 s + 3
Continuous-time transfer function.
ans =
-3
-1
Proportional Controller Design (C = 4):
Simulink Implementation:
Simulink Observations:
Observations are the same as those seen in exercises 1 and 2.
Exercise 4: Consider the following transfer function.
1
𝐺(𝑠) =
(𝑠 − 1)(𝑠 + 4)
i. Design a proportional controller such that G(s) has an OS = 16.3%.
ii. Implement this system in continuous time domain in Simulink.
iii. Implement this system using digital controller with the help of Zero Order Hold and
Quantizer.
iv. Display the response of both systems in one diagram.
v. Compare the response of both systems.
vi. Gradually increase sampling time up to 5 seconds and compare responses.
vii. With sampling time = 0.1, gradually increase quantization interval to 5 and compare
responses.
viii. Note down your observations.
Exercise 4 Solution:
Transfer Function Implementation:
%Exercise 4
G = tf(1,[1 3 -4])
pole(G)
G =
-------------
s^2 + 3 s - 4
Continuous-time transfer function.
ans =
-4
Proportional Controller Design (C = 9):
Simulink Implementation:
Simulink Observations:
Observations are the same as those seen in exercises 1 and 2.
Exercise 5: After considering the observations in the above exercises, in your opinion what are
the factors that need to be considered when implementing a controller digitally?
Explanation:
Sampling time and quantization interval must be selected carefully to ensure that the signal is
represented accurately in the digital domain. The sampling time must be small enough to ensure
that the controller response is stable. Sampling time and quantization interval must also have
values that are similar to minimize the oscillations in the steady state value of the system.
Exercise 6: In this handout all of the observations are with a simple controller. In your
opinion, will the sampling time and the quantization interval also affect a PID controller?
Explanation:
Sampling time and quantization interval will also affect a PID controller. To achieve certain
performance parameters such as rise time, percentage overshoot, etc. we will have to adequately
select the sampling time and quantization interval values and then adjust our gains through trial-
and-error approach.