Control & Instrumentations 2 (306SE)
Course Work CW1A
Digital Control Lab Assignment
Objectives
1. Design a digital controller using indirect method (in s-plane).
2. Design a digital controller using direct design method (in z-plane).
Introduction
This assignment is individual assignment. Each student will be assigned a different set specification,
the settle time and overshoot Mp. Make sure you have your own set of tS and MP.
The assignment has two parts:
PART A: Design the digital controller GC (𝑧) using indirect design method. [25 marks]
PART B: Design a digital controller GC (𝑧) using direct design method. [25 marks]
Submission method:
online (pdf file) on Blackboard , save your file as “ s/nr _ your full name _ CW1A”
Due date: Friday 10 Jan 2025 23pm (online submission on BB)
Total CW1 marks: 50 marks
Zero mark will be awarded if missed the deadline and if it is
found that your answer/submission is copied from another
student/someone else. Likely you will also face disciplinary
actions from CU and PSB Academy.
Control & Instrumentations 2 CW1A (digital control lab assignment)
Course Work 1 (Control Lab Assignment)
Part A
Tasks and instructions for part B
❖ Answer questions 1 ~ 4 as stated in the following pages
❖ Only submit your answer, not the question!
❖ Write down clearly question number!
❖ Use this page as the cover page!
❖ Due date: 10 Jan 2025
Student
Name
ID:
Assigned overshoot = _____%; Settling time = _____ ms
Sampling period TS= 1 msec
Question Assigned mark Awarded mark
1-4 25
Total mark 25
Declaration of Originality
I understand that Plagiarism is the act of taking and using the whole or any part of another person’s
work and presenting it as my own without proper acknowledgement.
I understand that Plagiarism is an academic offence and if I am found to have committed or abetted
the offence of plagiarism in relation to this submitted work, disciplinary action will be enforced, which
means that I can fail this subject!
Student signature: __________________________________________
Page 1 / 10 pages
Control & Instrumentations 2 CW1A (digital control lab assignment)
PART A: Design a digital controller for the DC motor position control system
using indirect design method.
Objectives:
To understand the system design specifications
To understand the discrete-time control system and digital compensator
To design a digital compensator for the motor position control system using indirect method
Use MATLAB to simulate the system and verify your design of the controller
Specifications for the motor control system performance
For this assignment, the desired specifications are as following. For a unit step input, the desired
closed-loop response should satisfy:
• Settling time (2%) between 0.02 and 0.08 seconds. (20ms to 80ms)
• Overshoot no more than 30% (5%, 10%, 15%, 20%, 25%)
• Minimum towards zero steady state error.
Task of the project PART A
Design a controller (compensator) with the following given structure such that the closed-loop
position control system response satisfies the specifications that are assigned to you.
s + zero z+a
GC ( s) = k C Bilinear transform GC ( z ) = k z
s + pole z +b
Your task is to determine the compensator parameters:
• The compensator gain: kC (kz)
• The compensator zero: zero (a)
• The compensator pole: pole (b)
Page 2 / 10 pages
Control & Instrumentations 2 CW1A (digital control lab assignment)
Method of the compensator design
The indirect design method is to be used to determine the compensator parameters. Please read
through Chapter 5 of the CI2 lecture notes for the details of this method.
Steps of the compensator design
1. Determine the desired damping ratio and natural frequency of the system based on the desired
performance specifications. Ask your Lecturer to know your specified Overshoot MP and
settle time tS
2. Derive the closed-loop transfer function of the motor control system (with the compensator)
in the s-domain.
3. Let zero = 1/ Tm ; namely let the compensator zero cancel the motor pole.
4. Compare the closed-loop characteristic equation with the desired characteristic equation to
determine the compensator parameters k C and pole (in the s-domain).
5. Choose the sampling period 𝑇𝑠 = 1 ms which satisfies s 20 n , Ts 20Tn .
6. Apply Tustin’s Bilinear Transformation transferring your designed compensator from s-
domain to z-domain.
2 z −1 z −1
s= = 1000
Ts z + 1 z +1
In the z-domain, the compensator has the following form:
s + zero z+a
GC ( s) = k C Bilinear transform GC ( z ) = k z
s + pole z +b
7. Simulate your system and verify if all specifications are met. You can simulate in either ways
as shown in Figure 2-1.
Compensator DC Motor
R(z) C(z)
+ 70
ZOH 𝑠(𝑠 + 50)
_
Compensator Digitized DC Motor
R(z) C(z)
+
_
Figure 2-1 Motor with compensator
Page 3 / 10 pages
Control & Instrumentations 2 CW1A (digital control lab assignment)
Tasks: Answer questions 1 ~ 4 and write your answer in your Assignment answer:
Question 1: Determine the desired damping ratio and natural frequency based the
specifications assigned to you
−
1− 2
MP = e → Damping ratio: = ? ______
4
ts = → Natural frequency: n = ? ______
n
The expected characteristic equation: s 2 + 2 n s + n2 = 0 is
____________________________________
Question 2: Determine the compensator parameters in s-domain
The motor control system in the s-domain is shown in Figure 2-2. It is assumed that the motor transfer
𝟕𝟎
function 𝐆𝐦 (s) =
𝒔(𝒔+𝟓𝟎)
R(s) + 70 C(s)
_ 𝑠(𝑠 + 50)
Figure 2-2 Motor control system in s-domain
Open loop transfer function: _________________________________
Closed loop transfer function: __________________________
Closed loop characteristic equation: ____________________________
Compare Eq2 with Eq1 to determine the required compensator parameters:
pole = ____________
k C = _____________
The required compensator transfer function is:
s + zero
GC ( s) = k C = ___________________
s + pole
Page 4 / 10 pages
Control & Instrumentations 2 CW1A (digital control lab assignment)
Question 3: Determine the digital compensator using Tustin’s bilinear transformation
Set the sampling period 𝑇𝑠 = 1 ms, and apply Tustin’s Bilinear Transformation to transfer your
designed compensator from s-domain to z-domain.
2 𝑧−1 𝑧−1
𝑠= = 2000
𝑇𝑠 𝑧 + 1 𝑧+1
The digitalized controller transfer function Gc (z ) is:
Gc (z ) = ________________________
Question 4: Simulate your final system and print out the results
Comment on the simulation result on how the compensator has improved the
system’s response.
Followings are required for submission of this part A:
• Your answer for Question 1 to 3
• Final system block diagram (use the Simulink block diagram)
• Simulation result (overview) from Simulink, which shows the transition part of the signal till
its beginning of steady state and not longer than that.
Indicate (use cursor in simulink) the steady state value and steady state error.
• Enlarged simulation curve which clearly shown the overshoot and settling time (use the
Simulink cursor)
• Complete m-file listing of your program for the whole indirect method.
• All submission must be in pdf file format.
Page 5 / 10 pages
Control & Instrumentations 2 CW1A (digital control lab assignment)
Course Work 1
Part B
Tasks and instructions for part B
❖ Answer questions 1 ~ 4 as stated in the following pages
❖ Write your answer only! Do not include this Assignment pages in your report, it will
be penalized!
❖ Write question number clearly.
❖ Use this template as cover page, submission without cover page will not be marked!
❖ Due date: __ Jan 2025 (zero mark if you missed this deadline)
Student
Name
ID:
Assigned overshoot = __%; Settling time = ____ ms
Question Assigned mark Awarded mark
1-4 25
Total mark 25
Declaration of Originality
I understand that Plagiarism is the act of taking and using the whole or any part of another person’s
work and presenting it as my own without proper acknowledgement.
I understand that Plagiarism is an academic offence and if I am found to have committed or abetted the
offence of plagiarism in relation to this submitted work, disciplinary action will be enforced. This will
mean that I might fail this subject! Anyone caught to have copied work from classmate, both will be given
ZERO marks.
Student signature: __________________________________________
Page 6 / 10 pages
Control & Instrumentations 2 CW1A (digital control lab assignment)
PART B: Design a digital controller for the DC motor position control
system using direct design method.
Objectives:
To design a digital compensator using direct method (in z plane)
Write program in m-file code and use Simulink to verify your result.
Specifications for the motor control system performance
For this part, the specifications are that the output signal c(k) should satisfy:
• Settling time (2%) between 0.02 s and 0.08 s (20ms to 80ms)
• Overshoot less than 30% (5%, 10%, 15%, 20%, 25%)
• Minimum/ towards zero steady state error.
Task of the project PART B
A controller (compensator) with the following transfer function is to be designed
z −
GC ( z ) = k
z−
Your task is to determine the compensator parameters such that the assigned specifications (overshoot
and settling time) are satisfied as verified by SIMULINK simulation.
• The compensator gain: k
• The compensator zero:
• The compensator pole:
Method of the compensator design
The direct design method is to be used to determine the compensator parameters. This method is
based on the root locus of the system. Refer also to chapter 5 of lecture notes.
Digitalized compensator DC Motor
R(z) C(z)
+
_
Figure 3-1 dc motor with digital compensator
Page 7 / 10 pages
Control & Instrumentations 2 CW1A (digital control lab assignment)
Steps of the compensator design
1. Determine the desired closed-loop poles in the s-domain based on the damping ratio and
natural frequency of the system that you have calculated in PART 1.
s = −n j n 1 − 2 = …..
2. From the definition of z-transform, transfer the desired closed-loop poles from the s-
domain to the z-domain.
- j 1− 2 T
z=e =e
n n
sTs s
= …….
Convert z to algorithm form: z = z (cos z j sin z ) = a jb
3. Draw the root locus of the motor in the z-plane based the transfer function GHP (z ) that
you have obtained in PART A - Q4. If the root locus passes through the desired closed-
loop poles z = a jb , then you only need a proportional controller GC ( z) = k and the
value of k can be determined from the root locus.
4. If the root locus does not pass through the desired closed-loop poles z = a jb (most
z −
possibly this is the case), then you need a compensator GC ( z ) = k .
z−
5. Let = the pole of the GHP (z ) (the one that is other than 1).
6. Write the open-loop transfer function of the system with the compensator as following,
where k and are to be determined.
z −
GC ( z )GHP ( z ) = k GHP ( z )
z−
7. Determine based on the angle condition:
GC ( z )G HP ( z ) = 180 o n360 o or zeros − poles = 180 o
8. Determine the compensator gain k based on magnitude condition:
GC ( z )G HP ( z ) z =a + jb = 1
z −
9. Write down the final compensator transfer function GC ( z ) = k . Draw the root
z−
locus of the final system based on GC ( z )GHP ( z ) ; and confirm that the root locus passes
through the desired closed-loop poles z = a jb .
10. Write all the above as codes in m-file script and at the same time run Simulink to check
your result produced by m-file method.
Page 8 / 10 pages
Control & Instrumentations 2 CW1A (digital control lab assignment)
Tasks: Answer questions 1 ~ 4 and implement this as m file code in matlab.
Question 1: Determine the desired closed-loop poles in the s-domain based on the damping
ratio and natural frequency of the system that you have calculated in PART 1.
s = −n j n 1 − 2 = ______________________
Transfer the desired closed-loop poles from s-domain to z-domain.
- j 1− 2 T
z=e =e
n n
sTs s
; 𝑇𝑠 = 1 ms (sampling period)
z = z (cos z j sin z ) = a jb = ________________
Use MATLAB to plot the root locus based on the motor transfer function
GHP (z ) that you have obtained in PART A Q4 (without compensator)
Print the root locus with only P-controller and with the PID controller (with
compensator) and comment the difference between them. Write two different
script/m-file for this and compare the two different results, comment on its stability.
Question 2: Select the compensator zero to cancel one pole of GHP (z ) {other than z=1}.
= ________________
Determine based on the angle condition: zeros − poles = 180 o
You need to draw a figure as the Figure below to calculate = _____
Im
z-plane
z = a + jb
pole(1)
zero pole( )
x x Re
Zero of GHP(z) 0 pole 1 of GHP(z)
Figure: Determine
Page 9 / 10 pages
Control & Instrumentations 2 CW1A (digital control lab assignment)
The angle condition is: zero − (pole(1) + pole( )) = 180
o
zero = _________________________
pole(1) = _________________________
pole( ) = _________________________
Determine the compensator gain k based on magnitude condition:
z −
GC ( z )G HP ( z ) z =a + jb = 1 → k GHP ( z ) =1
z− z = a + jb
1
k= = ___________________
z −
GHP ( z )
z− z = a + jb
Write down the final compensator (PID Controller) transfer function
z −
GC ( z ) = k = _________________
z−
Question 3: Simulate your system and the results
Followings submission are required for this part:
• Final system block diagram (use the Simulink block diagram)
• Simulation result (overview) from Simulink
• Enlarged simulation curve clearly shown the overshoot and settling time (Simulink)
• Complete m-file listing in this direct design method.
Question 4: derive the state space representation of the system with new PID controller
Use Matlab to acquire the state space representation for the new transfer function G(z) (using PID
compensator)
Write a simple m-file code to apply unit step and get the output result for this new transfer function
and compare this results with your results in Part B (using only P controller).
Note: Do NOT include the questions of this assignment as part of your submission!
End of CW1A
Page 10 / 10 pages