ELEC207辅导 、matlab设计编程讲解
ELEC207 Coursework (v6: 1 February 2022)
Page 1
ELEC207 Coursework: Design of a Stable Martian Segway (“Experiment 81”)
Prof Simon Maskell 1 February 2022
Module ELEC207
Coursework name Experiment 81
Component Weight 25% = 3.75 Credits
Semester 2
HE Level 5
Lab location Third floor EEE building
Work Individually
Timetabled time Check Canvas announcements for lab module
Suggested Private Study time 16h
Assessment method Individual report
Submission Format On line submission - Canvas
Late Submission Standard University Penalties
Resit Opportunity By arrangement
Marking Policy Numerical mark
Anonymous marking Yes
Feedback Canvas
Subject of relevance Control Engineering
AHEP Learning Outcomes LO1
This coursework component1 of ELEC207 relates to Part B, “Control”, and focuses on the
content up to and including lecture 10 of Part B of the module. The mark you will receive for
the coursework constitutes 25% of your mark for ELEC207 and is intended to enable you to
demonstrate your understanding of how to:
• use the position of poles to demonstrate whether systems are stable;
• use your knowledge of control to define a controller that ensures that a system is
stable;
• use root locus to ensure the closed-loop time-response has specific properties;
• use Simulink to validate that the closed-loop time-response is as expected;
• explain your work in a clear and concise fashion.
You are expected to make use of the lecture notes and explicit references to numbered
lectures are therefore included in this document. The demonstrators associated with the lab
are available to support you in undertaking this coursework. Queries can also be submitted
via the discussion board for ELEC207 on Canvas.
The mark you will receive (out of a total of 40 marks) will quantify the following aspects of
your write-up:
• Demonstration of your understanding of ELEC207 (75% and out of 30 marks);
• Clarity of exposition (25% and out of 10 marks).
The marking descriptors are provided in the appendix.
1 Assessment of ELEC207 has previously included Experiment 81, which may result in some legacy references
to experiment 81 in documentation that has not yet been updated to reflect the change. This coursework
takes the place of experiment 81.
ELEC207 Coursework (v6: 1 February 2022)
Page 2
Any emboldened text in a box herein implies that a specific response should be included in
your write-up with the number in brackets indicating the number of marks associated with
that component of the write-up. Failure to include such a response is liable to result in you
obtaining fewer marks than would have been the case otherwise.
The assessment of the assignment is intended to be sufficiently straightforward that a
diligent student should be able to achieve a pass mark of 40% but sufficiently challenging
that achieving a first (ie 70% or above) requires deep understanding of the subject matter.
To aid you in understanding how challenging each mark is to obtain, marks are annotated
with E for Easy, M for Moderate and H for Hard: 8 of the marks are deemed to be easy; 14
are deemed moderate; 8 are deemed hard.
You should submit your coursework on or before the deadline announced by the lab
coordinator (check Canvas announcements).
Plagiarism and collusion or fabrication of data is always treated seriously and action
appropriate to the circumstances is always taken. The procedure followed by the University
in all cases where plagiarism, collusion or fabrication is suspected is detailed in the
University’s Policy for Dealing with Plagiarism, Collusion and Fabrication of Data, Code of
Practice on Assessment, Category C, available on:
https://www.liverpool.ac.uk/media/livacuk/tqsd/code-of-practice-onassessment/appendix_L_cop_assess.pdf
ELEC207 Coursework (v6: 1 February 2022)
Page 3
1. Mathematical Modelling
A Segway (as shown in figure 1) is a physical system that can be modelled as an inverted
pendulum.
Figure 1: A Segway
More specifically, we will assume that the pendulum can be approximated as a point mass,
of mass m, at a distance, l, and at a (small) angle, θ(t), defined clockwise from vertical.
Gravity is assumed to act downwards and exert an acceleration of g. A motor provides a
torque, T(t). The actuator that converts the Torque control signal to the physical Torque can
be assumed to have a gain of unity. The angular acceleration of the pendulum can then be
approximated as being defined by:
𝑔
𝑙
θ(t) + T(t) = 𝑚
𝑑
2θ(t)
𝑑𝑡
2
Our task as an engineer designing the controller for the Martian Segway is to optimise the
time-response to changes to an input, X(t), which defines the desired values for θ(t). We will
consider this design criterion to be achieved if the settling time is equal to ts.
To ensure your Martian Segway is as unique as your coursework, please assume that:
• l is the day of the month when you were born (where l is in metres);
• m is the month of the year when you were born (where m is in kg);
• ts is the year when you were born divided by 250 (where ts is in seconds).
Please define the values for l, m and ts that you will use for your coursework. [1E]
Now derive the transfer function, 𝑯(𝒔) = 𝜽(𝒔)⁄𝑻(𝒔), of the Segway in terms of l, m and
g. [1E]
Using your values for l and m along with g=3.711 ms-2
, write the transfer function with
the denominator and numerator of your transfer function in polynomial form. [1E]
Calculate the position of the poles for your Segway and plot the poles on the complex
plane. [1E]
ELEC207 Coursework (v6: 1 February 2022)
Page 4
2. Validating that the Open-loop System is Unstable
With no controller, the system is believed to be unstable. We can use Simulink to validate
this. Open MATLAB R2020a or later (as available using Apps Anywhere or the Remote
Teaching Centre Service2
) and then click Simulink. Information is available online (at:
https://uk.mathworks.com/help/simulink) on how to use Simulink (please also check the
supporting materials available in your Canvas lab module page). Here we provide a brief
description of what is needed for our purposes:
1. Press “Blank Model”;
2. Click the “Library Browser” button, ;
3. Search for a step function by entering “Step” into the box where it says “enter search
term”;
4. Drag and drop the “Step” block onto the Simulink Editor;
5. Click the “Library Browser” button again;
6. Search for “Transfer Fcn” and drag and drop the “Transfer Fcn” block onto the
Simulink Editor. Be careful to select the continuous-time transfer function block
(parameterised by s) and not the discrete-time transfer function block (parameterised
by z);
7. Double click the “Transfer Fcn” block on the Simulink Editor and enter the
polynomials that you calculated above. Be careful that any coefficients of zero need
to be explicitly entered (ie coefficients of [1 0 2] describe s
2+2 but coefficients of [1 2]
describe s+2);
8. Click on the triangle on the right of the “Step” block such that an arrow appears;
9. Connect the output signal from the “Step” block to the input signal for the “Transfer
Fcn” block;
10. Add an “Outport” block;
11. Connect the output signal from the “Transfer Fcn” block to the input signal for the
“Outport” block;
12. Selecting the signal that connects the “Transfer Fcn” block to the input for the
“Outport” block such that it turns blue;
13. Click “Add viewer” (under “Simulation” and “Prepare”) and select “Scope”;
14. Press “Run” (under “Simulation” and “Simulate”). You should now see a graph
showing the time-response of your Segway to a unit-step.
15. Press “File” -> “Print” -> “Microsoft Print to PDF” -> “OK” and save the time-response
to a convenient location.
Insert a picture of the time-response of your Segway to the unit-step. [2E]
Comment on whether this time-response indicates that the open-loop system is
stable. [1M]
3. Ensuring that the Closed-loop System is Stable Using PID Control
We will now add a cascade controller, as explained in lecture 7. We will use a combination of
Proportional, Integral and Derivative control, ie a PID controller. The transfer function of a
PID controller is:
2 You can also download a copy of Matlab/Simulink from the University’s Computer Services Department
website at https://www.liverpool.ac.uk/csd/software/software-downloads/#matlab
ELEC207 Coursework (v6: 1 February 2022)
Page 5
𝐶(𝑠) = 𝐾𝑝 +
𝐾𝐼
𝑠
+ 𝐾𝐷𝑠 =
𝐾𝑝𝑠 + 𝐾𝐼 + 𝐾𝐷𝑠
2
𝑠
where Kp, KI and KD are respectively the proportional, integral and derivative control
constants. We know that the closed-loop transfer function for a negative feedback system
with open-loop transfer function of C(s)H(s) and that relates the input, X(s), to the output,
θ(s), is:
𝜃(𝑠)
𝑋(𝑠)
=
𝐶(𝑠)𝐻(𝑠)
1 + 𝐶(𝑠)𝐻(𝑠)
Write the closed-loop transfer function for your Segway in terms of Kp, KI and KD as a
ratio of polynomials in s. Ensure that the highest order term in s in the denominator
has a coefficient of unity. [3M]
To ensure that the system is stable, we start by placing the poles at s=-1, s=-2 and s=-3.
What is the characteristic polynomial that would result in these pole positions? [1M]
By equating the coefficients in the closed-loop transfer function’s denominator and
this characteristic function, deduce values for Kp, KI and KDwhich will ensure that the
closed-loop system is stable. [3M]
4. Validating That the Closed-loop System is Stable
Simulink includes a “Subtract” block and a “PID” block. Use these blocks (with the
parameters of the PID controller that you have defined) to simulate the time-response from a
stable closed-loop system.
Insert a picture of the time-response of your closed-loop system to the unit-step. [2M]
5. Optimising the Time-Response Using Root Locus
The open-loop system has poles and zeros that are the union of those associated with the
plant and those associated with the PID controller.
Calculate the positions of the open-loop zeros (ie the zeros of 𝑪(𝒔)𝑯(𝒔)) for the values
of l, m, Kp, KI and KD that you have used. [1M]
Recall that the PID controller has a pole at the origin and the Segway has poles that you
have calculated above.
State the positions of the open-loop poles (ie the poles of 𝑪(𝒔)𝑯(𝒔)) for the values of l
and m that you have used. [2E]
We are going to use the root locus to choose the open-loop gain to achieve the timeresponse we want. More specifically, we are going to move the closed-loop poles along the
root locus such that we can achieve the settling time that you have defined at the start of this
coursework assignment.
As explained in lecture 6, the settling time for a generalised second-order system with
natural frequency, β, and damping coefficient, ω, is 𝑡𝑠 ≈ 4⁄β𝜔. As explained in lecture 5, the
real part of the location of the poles of a generalised second-order system is 𝑅𝑒(𝑠) = −β𝜔.
We therefore want to ensure that the dominant poles (the poles that are closest to the
ELEC207 Coursework (v6: 1 February 2022)
Page 6
imaginary axis) are located such that 𝑅𝑒(𝑠) = − 4 𝑡 ⁄ 𝑠
. We can understand how to achieve
this by sketching the root locus for the open-loop system with the compensator.
Sketch the root locus for 𝑪(𝒔)𝑯(𝒔) and identify the points on the root locus that are
such that 𝑹𝒆(𝒔) = − 𝟒⁄𝒕𝒔
. [3M]
We now want to calculate the value of the open-loop gain that will ensure that the closedloop poles are such that we achieve the desired time-response.
Write the open-loop transfer function, 𝑪(𝒔)𝑯(𝒔), as a ratio of polynomials in 𝒔. [1H]
If the numerator of the open-loop transfer function is 𝑍(𝑠) and the denominator of the openloop transfer function is 𝑃(𝑠), ie 𝐶(𝑠)𝐻(𝑠) = 𝑍(𝑠)⁄𝑃(𝑠), then the closed-loop poles occur
when 𝑃(𝑠) + 𝐾𝑍(𝑠) = 0.
Write 𝑷(𝒔) + 𝑲𝒁(𝒔) = 𝟎 as a polynomial in 𝒔 involving 𝑲. [1H]
To identify the value of 𝐾, we need to re-express this polynomial as a polynomial in 𝑠̃= 𝑠 +
4 𝑡 ⁄ 𝑠
. We can achieve this by substituting 𝑠 = 𝑠̃− 4 𝑡 ⁄ 𝑠
(using your value for 𝑡𝑠
) and
simplifying.
Write 𝑷(𝒔̃) + 𝑲𝒁(𝒔̃) = 𝟎 as a polynomial in 𝒔̃ involving 𝑲. [1H]
As explained in lecture 9, we can then use Routh-Hurwitz to deduce the value of 𝐾 that is
such that 𝑠̃is on the imaginary axis (ie when 𝑅𝑒(𝑠) = − 4 𝑡 ⁄ 𝑠 and so we achieve our desired
time-response). We achieve this by choosing 𝐾 to be such that there is a row of zeros.
Complete a Routh table for 𝑷(𝒔̃) + 𝑲𝒁(𝒔̃). Deduce the value of 𝑲 that is such that
𝑹𝒆(𝒔) = − 𝟒⁄𝒕𝒔
[3H]
6. Validating the Response of Optimised System
You can now use Simulink to simulate the time-response from the closed-loop system with
the gain you have chosen, 𝐾. Note that there is a “Gain” block that you may find useful.
Insert a picture of the time-response of your improved closed-loop system to the unitstep. [2H]
7. Further Directions for Private Study (Not Assessed)
Should you find this coursework assignment interesting and wish to continue to work on
designing a Martian Segway, it might be interesting to consider:
1) Using a compensator (eg a PD controller) to ensure that the overshoot adheres to
some design criterion;
2) Using a further compensator (eg a PI controller) to ensure that the steady-state error
is reduced.
For the avoidance of doubt, your mark for the coursework will not be affected by whether you
design these compensators.
ELEC207 Coursework (v6: 1 February 2022)
Page 7
Marking descriptors
Demonstration of your
understanding of ELEC207 (75%)
Exposition and structure of the
report (25%)
90-100%
‘Outstanding’
Total coverage of the experiment aims,
objectives and task set. An exceptional
demonstration of knowledge and understanding,
appropriately grounded in theory and relevant
literature. Outstanding research and academic
content.
Extremely clear exposition. Excellently logical
structure. Excellent presentation, only the
most insignificant errors. Scientific
dissemination.
80-89%
‘Excellent’
As ‘Outstanding’ but with some minor
weaknesses in knowledge. Original and novel
aspects presented but not fully developed.
As ‘Outstanding’ but with some minor
weaknesses in structure, logic and/or
presentation.
70-79%
‘Very Good’
Full coverage of the task set. A very good
demonstration of knowledge and understanding
but with some modest gaps. A very good
grounding in theory.
Very clear exposition. Satisfactory structure.
Very good presentation, largely free of
grammatical and other errors. All compulsory
sections present.
60-69%
‘Comprehensive’
As ‘Very Good’ but with some gaps in knowledge
and understanding and/or gaps in theoretical
grounding.
As ‘Very Good’ but with some weaknesses in
exposition and/or structure, a few more
grammatical and other errors.
50-59%
‘Competent’
Covers most of the task set. Patchy knowledge
and understanding with a limited grounding in
literature.
Competent exposition and structure.
Competent presentation but some significant
grammatical and other errors. Minor errors
in labelling graphs and figures.
40-49%
‘Adequate’
As ‘Competent’ but patchy coverage of the task
set and more weaknesses and/or omissions in
knowledge and understanding. Just meets the
threshold level.
As ‘Competent’ but with more weaknesses in
exposition, structure, presentation and/or
errors. Just meets the threshold level.
35-39%
‘Compensatable
fail’
Some parts of the set task are likely to have been
omitted. Major gaps in knowledge and
understanding. Some significant confusion. Very
limited grounding. Falls just short of the
threshold level.
Somewhat confused and limited exposition.
Confused structure. Some weaknesses in
presentation and some serious grammatical
and other errors. Falls just short of the
threshold level.
20-34%
‘Deficient’
As ‘Compensatable Fail’ but with more serious
weaknesses in presentation and/or grammar.
Falls substantially below the threshold level.
As ‘Compensatable Fail’ but with more
serious weaknesses in presentation and/or
grammar. Falls substantially below the
threshold level.
0-20%
‘Extremely weak’
Largely confusing exposition and structure. Many
serious grammatical and other errors.
Largely confusing exposition and structure.
Many serious grammatical and other errors.