代做MEC208 Instrumentation and Control System

- 首页 >> Database作业

Department of Mechatronics and Robotics
MEC208 Instrumentation and Control System
S2, 2022-2023
Computer Lab (Lab 2):
Control System CAD and CAS using MATLAB
Dr. Chee Shen LIM (MEC208, Part 2)
Name:
Student ID:
Group (1 or 2):
Date:
MEC208 Lab 2: Control System CAD and CAS using MATLAB
Page 4 of 14
© ver22-23-20230504, by C. S. Lim
Report Format
The format of the lab/assignment report should be of the following:
• The report should be of single column, font size 11, font style “Times New Roman”.
Please be reminded that handwritten reports will NOT be accepted.
• All figures must be clearly numbered and all plots must be clearly labelled.
• In your report, whenever necessary, you are expected to explain concisely your approach
(i.e., with full sentence and proper grammar, but please avoid unnecessarily long
explanation).
• In your answer for each question, do also include all MATLAB code/script that you used
to obtain the answers or plots (note: do not separately submit those raw .m files; answer
for each question should contain some MATLAB scripts). These codes/scripts should be
copied properly into the report, and should be standalone. For example, if you include
the code for Question 2a, you must make sure that the codes in this part alone (not linked
to other parts) can be copied by the marker into MATLAB for a quick, successful
verification.
• For analytical questions, whenever necessary, do also include your analysis and derivation.
Marks will be given on the following basis:
• The 10 questions in the “Computer Lab Work” section carry a total of 100 marks. Each
question carries 5 to 15 marks, depending on the complexity of the questions.
• Sub-marks will be awarded to technically correct analyses and comments, MATLAB
scripts, mathematical derivation (as necessitated by the questions), graphs/plots (and
annotations of the plots), and numerical answers. All analysis and comments should have
proper sentence structure and correct grammar.
MEC208 Lab 2: Control System CAD and CAS using MATLAB
Page 5 of 14
© ver22-23-20230504, by C. S. Lim
Examples
This part is to introduce about how to start using the Control System Toolbox in MATLAB for
control system CAD and CAS. You are suggested to go through the examples (in this section, or
even from other online resources) before you start working on the assignment tasks.
Example 1: Input a system described by a transfer function
To construct a system model in MATLAB, the command “tf” can be used. For example, to obtain
the following input transfer function:
𝑠𝑠2 + 𝑠𝑠 + 1
𝑠𝑠4 + 2𝑠𝑠
3 + 5𝑠𝑠 + 2
𝑠𝑠 + 1
𝑠𝑠4 + 2𝑠𝑠
3 + 3𝑠𝑠
2 + 3𝑠𝑠 + 10 ∙ 10
𝑠𝑠2 + 3
» sys1=tf([1 1 1], [1 2 0 5 2])
Transfer function:
s^2 + s + 1
---------------------
s^4 + 2 s^3 + 5 s + 2
>> sys1=tf([1 1], [1 2 3 3 10])
Transfer function:
s + 1
------------------------------
s^4 + 2 s^3 + 3 s^2 + 3 s + 10
>> sys2=tf([10], [ 1 0 3])
Transfer function:
10
-------
s^2 + 3
>> sys=sys1*sys2
Transfer function:
10 s + 10
-----------------------------------------------
s^6 + 2 s^5 + 6 s^4 + 9 s^3 + 19 s^2 + 9 s + 30
Example 2: Find the system’s zeros and poles
The commands used for this task are “pole” and “zero”. From the signs of system poles, you can
determine if the system is stable. For example, given the system G(s):
𝐺𝐺(𝑠𝑠) = 1
𝑠𝑠2 + 𝑠𝑠 + 1
Using MATLAB, the system’s poles can be obtained as follows:
>> pole(sys)
MEC208 Lab 2: Control System CAD and CAS using MATLAB
Page 6 of 14
© ver22-23-20230504, by C. S. Lim
ans =
-0.5000 + 0.8660i
-0.5000 - 0.8660i
>>
Given another example with system zeros:
𝐺𝐺(𝑠𝑠) = 2𝑠𝑠2 + 𝑠𝑠 + 3
𝑠𝑠4 + 2𝑠𝑠3 + 5𝑠𝑠2 + 6𝑠𝑠 + 7
>> sys=tf([2 1 3],[1 2 5 6 7])
Transfer function:
2 s^2 + s + 3
-----------------------------
s^4 + 2 s^3 + 5 s^2 + 6 s + 7
>> zero(sys)
ans =
-0.2500 + 1.1990i
-0.2500 - 1.1990i
>>
Example 3: Obtain the system model in pole-zero format
It is at times helpful to control designers to express a system into a form of first/second-order
components. For example, given G(s) below, one can express it to pole-zero format as follows:
𝐺𝐺(𝑠𝑠) = 1
𝑠𝑠4 + 𝑠𝑠3 + 3𝑠𝑠2 + 2𝑠𝑠 + 6
>> sys=tf([1], [1 1 3 2 6])
Transfer function:
1
---------------------------
s^4 + s^3 + 3 s^2 + 2 s + 6
>> zpk(sys)
Zero/pole/gain:
1
----------------------------------------------
(s^2 + 1.969s + 2.609) (s^2 - 0.9693s + 2.3)
>>
There are many other control-related numerical tools in MATALB. See some of the listed examples
in Part II.
Example 4: Obtain impulse, step, and ramp input responses
The commands used for obtaining the time responses against unit-step and unit-impulse inputs are,
respectively, “step()” and “impulse()”. Taking the following system as the example, its step and
impulse responses can be obtained as follows:
MEC208 Lab 2: Control System CAD and CAS using MATLAB
Page 7 of 14
© ver22-23-20230504, by C. S. Lim
1
𝑠𝑠3 + 2𝑠𝑠2 + 3𝑠𝑠 + 5
>> sys1=tf([1], [1 2 3 5])
Transfer function:
1
---------------------
s^3 + 2 s^2 + 3 s + 5
>> step(sys1)
>> impulse(sys1)
To obtain system ramp input response, the following can be done. Note that the title change is
necessary to avoid confusion.
>> sys2=tf([1], [1 0])
Transfer function:
1
𝑠𝑠
>> step(sys1*sys2)
>> title('Ramp Response')
MEC208 Lab 2: Control System CAD and CAS using MATLAB
Page 8 of 14
© ver22-23-20230504, by C. S. Lim
Example 5: Obtain the equivalent/effective transfer function of a closed-loop system
The relevant command is “feedback”. You can obtain the description of this command from
MATLAB help, i.e., using command “>>help feedback”. For example, given that a system has a
forward-path transfer function G(s)
𝐺𝐺(𝑠𝑠) = 1
𝑠𝑠2 + 𝑠𝑠 + 1
and feedback-path transfer function H(s)
𝐻𝐻(𝑠𝑠) = 1
𝑠𝑠 + 1
The closed-loop transfer function of the feedback system is obtainable through the following
commands:
>> sys1=tf([1],[1 1 1])
>> sys2=tf([1],[1 1])
>>sys_closed_loop=feedback(sys1,sys2,-1)
Transfer function:
s + 1
---------------------
s^3 + 2 s^2 + 2 s + 2
>>
At this stage of learning, you should be able to obtain the closed-loop transfer function through
analytical means. You are encouraged to check whether the numerical tools actually give you the
correct answer. At times, through cross-checking, you may find that there are some minor mistakes
in your own derivation or MATLAB scripts. You may also attempt the simulation questions at the
end of each chapter in the course textbook.
Optional
Before attempting the questions, apart from the numerical tools introduced above, it may be helpful
to you to spend some time understanding other numerical tools/functions (not in any particular
order) available to you in the Control System Toolbox of MATLAB.
tf
step
impulse
ramp
partfrac
ilaplace
plot
feedback
series
pzmap
pole
zero
ss
tf2ss
lsim
expm
hold on
hold off
Others (your own effort)
MEC208 Lab 2: Control System CAD and CAS using MATLAB
Page 9 of 14
© ver22-23-20230504, by C. S. Lim
Computer Lab Work (10 questions)
Problem 1 [9 marks]
Consider the differential equation
𝑑𝑑3𝑦𝑦(𝑡𝑡)
𝑑𝑑𝑡𝑡3 + 10
𝑑𝑑2𝑦𝑦(𝑡𝑡)
𝑑𝑑𝑡𝑡2 + 58
𝑑𝑑𝑑𝑑(𝑡𝑡)
𝑑𝑑𝑑𝑑
+ 136𝑦𝑦(𝑡𝑡) = 26𝑥𝑥(𝑡𝑡)
where y(0) = 𝑦𝑦̇(0) = 𝑦𝑦̈(0) = 0. With the help of the numerical tools of solving partial fraction
and/or inverse Laplace transform, determine the solutions/responses of 𝑦𝑦(𝑡𝑡) for, respectively, unit
impulse, unit step, and unit ramp of input x(t). In each case, show the s-domain partial fractions
before expressing the final time-domain expressions. Then, through the numerical tools in
MATLAB, obtain the output’s time response plots of each case for the first 5 seconds.
Problem 2 [5 marks]
Consider the block diagram in Figure P2.
Figure P2: Control block diagram with the following G and H transfer functions.
𝐺𝐺1 = 1
𝑠𝑠 + 2 𝐺𝐺2 = 1
𝑠𝑠2 + 2𝑠𝑠 + 2 𝐺𝐺3 = 𝑠𝑠 + 1
𝑠𝑠2 + 3 𝐺𝐺4 = 1
𝑠𝑠 + 5
𝐻𝐻1 = 2𝑠𝑠 + 3
𝑠𝑠2 + 𝑠𝑠 + 2
𝐻𝐻2 = 𝑠𝑠
𝑠𝑠 + 4 𝐻𝐻3 = 𝑠𝑠2 + 1
𝑠𝑠3 + 6
(a) Use an m-file to reduce the block diagram in Figure P2, obtain the equivalent closed-loop
transfer function of the above system.
(b) Use the numerical tools available, generate a pole-zero map in the graphical form and
calculate the poles and zeros of the closed-loop transfer function. Comment on the overall
system stability.
𝐺𝐺1 𝐺𝐺2
𝐻𝐻3
𝐺𝐺3 𝐺𝐺4
𝐻𝐻1 𝐻𝐻2
+ + +
+
− −
𝑅𝑅(𝑠𝑠) 𝑌𝑌(𝑠𝑠)
MEC208 Lab 2: Control System CAD and CAS using MATLAB
Page 10 of 14
© ver22-23-20230504, by C. S. Lim
Problem 3 [8 marks]
Consider the system

𝑥𝑥̇
1
𝑥𝑥̇
2
𝑥𝑥̇
3
 =  
−1 1 0
0 −1 1
0 0 −2
 
𝑥𝑥1
𝑥𝑥2
𝑥𝑥3
 +  
0
0
1
 𝑢𝑢
y = [1 0 0]
𝑥𝑥1
𝑥𝑥2
𝑥𝑥3

(a) Use the numerical tools in MATLAB, e.g., tf, determine the transfer function 𝐺𝐺(𝑠𝑠) =
𝑌𝑌(𝑠𝑠)/𝑈𝑈(𝑠𝑠).
(b) Assume 𝑢𝑢(𝑡𝑡) is a pulse input of magnitude 1 that lasts for a 2-seconds duration starting at
0 s (i.e., a pulse input means a step input that lasts for a short period), plot the response of
the system state x with initial condition 𝒙𝒙(0) = [1 1 0]𝑇𝑇, for 0 ≤ 𝑡𝑡 ≤ 10.
(c) State the 𝒙𝒙(3) values the same initial condition and input as part (b). Determine and
comment on how these x values at t = 3 s will be different if the input is never excited
(means zero for the entire 10 s period).
Problem 4 [5 marks]
Consider the closed loop transfer function
𝐿𝐿(𝑠𝑠) = 2s2 + 3s + 1
𝑠𝑠5 + 3𝑠𝑠4 + 2𝑠𝑠3 + 5𝑠𝑠2 + 5𝑠𝑠 + 5
(a) Explain Routh-Hurwitz stability criterion with your own words. Then, use the RouthHurwitz criterion to determine whether the system is stable. If it is not stable, how many
poles are in the right-half plane?
(b) Compute the poles of 𝐿𝐿(𝑠𝑠) and then verify the result in part (a).
MEC208 Lab 2: Control System CAD and CAS using MATLAB
Page 11 of 14
© ver22-23-20230504, by C. S. Lim
Problem 5 [15 marks]
Consider the following transfer function:
𝐺𝐺(𝑠𝑠) = 6s2 + 18s + 14
𝑠𝑠4 + 7𝑠𝑠3 + 12𝑠𝑠2 + 17𝑠𝑠 + 14
(a) Identify the dominant complex poles and complex zeros (if any) of the system. Then,
calculate the dominant complex poles’ natural frequency, damping factor, characteristic
rise time (0 to 100%), peak time, percent overshoot and 2% settling time.
(b) Plot and clearly label the unit-step response of G(s).
(c) Obtain from the figure in part (b) the exact rise time, peak time, percent overshoot, and 2%
settling time of the output response. Compare and comment on the difference between them
and the answers from part (a). [Hint: you may need to write the code manually to find these
values.]
Problem 6 [13 marks]
A control system is shown in Figure P6.
Figure P6
(a) Using MATLAB, plot the root locus assuming an ideal sensor H(s) = 1.
(b) It is found later than the sensor has a 1 second delay in the measurement, resulting in H(s)
being e-s instead of just “1”. Using MATLAB, plot the new root locus. Clearly state the
assumption used.
(c) Refer to the theoretical/characteristic behavior of second-order complex poles as the design
guides, analyze the root locus in part (b) and propose suitable 𝐾𝐾 value that produces an
overall step response with a percent overshoot less than 15 % and with (approximately) the
shortest possible 2% settling time. Explain and verify your gain selection.
1
𝑠𝑠(𝑠𝑠2 + 3𝑠𝑠 + 5)
𝐻𝐻(𝑠𝑠)
+

𝑅𝑅(𝑠𝑠) 𝑌𝑌(𝑠𝑠)
Process
Sensor
𝐾𝐾(𝑠𝑠 + 1)
(𝑠𝑠 + 5)
Controller
MEC208 Lab 2: Control System CAD and CAS using MATLAB
Page 12 of 14
© ver22-23-20230504, by C. S. Lim
Problem 7 [10 marks]
Figure P7 is a block diagram model of a model for an altitude-rate control system.
Figure P7
(a) Assume that Gc is yet to be designed (means Gc = 1), plot the system’s unit-step response.
(b) Through a series of control design, it is decided that Gc should the form of 𝐺𝐺𝑐𝑐 =
𝐾𝐾(𝑠𝑠+2)2(𝑠𝑠+5)
(𝑠𝑠+10)2(2𝑠𝑠+0.1)
, where (𝑠𝑠+2)2
(𝑠𝑠+10)2 is a essentially a cascaded lead compensator, and K is the
control gain to be designed. If it is desired to place a pair of the closed loop poles as close
as possible to 𝑠𝑠 = −2 ± 𝑗𝑗2 for a quick/fast transient response, use the numerical tools in
MATLAB to estimate the most suitable value of K. Show all relevant plots in the process
of finding this gain. Then, state the damping factor and natural frequency of the dominant
complex poles.
(c) Use the selected K value in part (b), obtain the step and ramp responses for the first 10
seconds. Clearly label the plot.
Problem 8 [10 marks]
Figure P8 shows a closed-loop system with a tunable feedback parameter k, where k is a positive
number.
Figure P8
1
𝑠𝑠
2𝑠𝑠 + 0.1
𝑠𝑠2 + 0.2𝑠𝑠 + 2
1
+

𝑅𝑅(𝑠𝑠) 𝑋𝑋(𝑠𝑠)
Hydraulic servo Aircraft
Rate gyro
𝐺𝐺𝑐𝑐
Controller
1
𝑠𝑠
10
(2𝑠𝑠 + 1)(𝑠𝑠 + 5)
𝑘𝑘
+

𝑅𝑅(𝑠𝑠) 𝑌𝑌(𝑠𝑠)
+

MEC208 Lab 2: Control System CAD and CAS using MATLAB
Page 13 of 14
© ver22-23-20230504, by C. S. Lim
(a) Draw a root locus diagram to reflect the effect of changing k. Then, determine the range of
possible k values that can produce a pair of dominant oscillatory/complex poles with the
characteristic damping factor more than 0.4 and the characteristic 2% settling time less
than 1.6 s.
(b) Analyze the plot in part (a) and propose the final value of k that can produce a quicker
possible response. Then, plot the unit-step response of the output y(t), and comment on the
effect of third pole onto the overall behavior of the system.
Problem 9 [15 marks]
An aircraft’s pitch rate model is shown in Figure P9. The model characteristics have the following
values:
𝜔𝜔𝑛𝑛 = 3, 𝜁𝜁 = 0.2, 𝜏𝜏 = 0.15
The gain factor K1, however, will vary over the range 0.01 at lightweight cruise conditions to 0.2
at heavy-weight descent conditions. K2 is the controller gain.
Figure P9
The flight control system must provide good handling characteristics and comfortable flying
conditions. The desired closed-loop characteristics of the dominant roots of the control system
shown in Figure P10 should have a damping factor of 𝜁𝜁 = 0.7071.
(a) Sketch the root locus as a function of the scalar gain K1K2.
(b) Determine the gain K2 necessary to yield the dominant oscillatory roots with 𝜁𝜁 = 0.7071
when the aircraft is in the heavy-weight descent condition.
(c) With the K2 gain found in part (b), determine the 𝜁𝜁 of the dominant oscillatory roots under
lightweight descent condition. Comment on the difference between the two damping
factors values, and the effect to the aircraft under lightweight cruise condition.
𝐾𝐾1(𝜏𝜏𝜏𝜏 + 1)
𝑠𝑠2 + 2𝜁𝜁𝜔𝜔𝑛𝑛𝑠𝑠 + 𝜔𝜔𝑛𝑛
2
𝐾𝐾2(𝑠𝑠 + 1)2
(𝑠𝑠 + 9)(𝑠𝑠 + 90)
+

𝑅𝑅(𝑠𝑠) 𝑌𝑌(𝑠𝑠)
10
𝑠𝑠 + 10
1
Controller Actuator Aircraft dynamics
Rate gyro
MEC208 Lab 2: Control System CAD and CAS using MATLAB
Page 14 of 14
© ver22-23-20230504, by C. S. Lim
Problem 10 [10 marks]
As a new control engineer in Suzhou electric vehicle company, you are assigned tasks to analyze
and propose a solution to the EV Interior permanent magnet motor’s speed control problem shown
in Figure P10, where R is the reference input, 𝑇𝑇𝑑𝑑 is the torque disturbance, and 𝜔𝜔 is the motor
speed. You are supposed to justify your design solution using the control system understanding
from Part 2 of the module (in the form of textual description), mathematical derivation, simulation
result, or any other means deemed appropriate.
Figure P10
(a) Parameters of the motor speed dynamic’s transfer function are measured by a junior
mechanical engineer as 𝐴𝐴 = 1 ± 0.01 and 𝐵𝐵 = 0.1 ± 0.01 , where the “±0.01 ” is the
measurement tolerance. Your first task is to propose a suitable form of controller 𝐺𝐺𝑐𝑐(𝑠𝑠) that
can eliminate the steady-state motor speed error due to step disturbance. Explain your
answer with sufficient evidences, and suggest the gain/parameter value(s) accordingly.
(b) If it is found later that a mistake was committed by the junior mechanical engineer, in which
the average 𝐵𝐵 value obtained through the experiments should be 0.01 instead of 0.1.
Discuss whether the proposed controller 𝐺𝐺𝑐𝑐(𝑠𝑠) by you in part (a) is still suitable. If yes,
explain and justify your answer with sufficient evidences; otherwise, explain and then
suggest modification to the proposed controller 𝐺𝐺𝑐𝑐(𝑠𝑠) for improvement.
~~ The End. Enjoy! ~~
1
𝐴𝐴𝐴𝐴 + 𝐵𝐵 𝐺𝐺𝑐𝑐(𝑠𝑠)
+

𝜔𝜔𝑟𝑟𝑟𝑟𝑟𝑟 𝜔𝜔(𝑠𝑠)
Motor
Controller speed dynamics
𝑇𝑇𝑑𝑑(𝑠𝑠)
𝐸𝐸(𝑠𝑠) +
+

站长地图