Introduction to Control Systems
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
METR4201: Introduction to Control Systems
Assignment Aligned to Practical 5
Learning objectives
The assignment is integrative and develops understanding of the following course learning
objectives:
1. Formulate Systems Models
• 1.4 Represent and simulate systems models by block diagrams and transfer
functions in Matlab and Simulink.
• 1.11 Model mechanical and electro-mechanical systems having transmissions
comprised of gears.
2. Analyze system models to understand behaviour
• 2.5 Construct root loci from the characteristic equation of a system using the
Evans Root Locus rules and the MATLAB control systems toolbox.
• 2.6 Employ root loci to analyse the dynamic behaviour under parameter
variation of SISO systems.
• 2.7 Calculate the system gain to realize a specific closed loop pole from a root
locus.
3. Design and Implement feedback control loops
• 3.1 Define and interpret performance specifications for feedback control systems.
• 3.2 Appreciate the general strategies for undertaking a control system design to
achieve specified steady state and transient behaviours.
• 3.4 Design and implement proportional, derivative, and integral compensators
(and combinations thereof) for SISO systems.
• 3.5 Design and implement single loop and cascaded control strategies for SISO
systems.
LO 1.4 LO 1.11 LO 2.5 LO 2.6 LO 2.7 LO 3.1 LO 3.2 LO 3.4 LO 3.5
Task 1 ●
Task 2 ●
Task 3 ● ●
Task 4 ● ● ● ● ● ● ●
Task 5 ● ●
Task 6 ● ● ●
Task 7 ● ● ●
Introduction
This assignment is aligned with the work you will complete in Practical 5. The scope is to
control the Furuta-type pendulum shown in Figure 1 so that the pendulum is automatically
balanced in an upright position, i.e. = 0.
In tutorial 3a you were invited to develop linearized transfer functions for this system. This
assignment works from those transfer functions and involves
• Forming closed loop transfer functions
• Designing PID compensators to a specification using Root Locus techniques
• Designing and analysing a cascade controller using the Root Locus
• Simulating system response in Simulink
In the associated practical (Practical 5) you will implement your controller, enhance your
understanding of its behaviour, and improve on its performance. You will also experience the
thrill of designing a control system for a relatively complicated machine.
Some tasks require the use of Matlab and the starting transfer functions are provided as part
of the materials available on Blackboard. Specifically
• AAP5_setup.m – this script creates the transfer functions that are required.
• Non-linear_simulation.slx – this file simulates the rotary inverted pendulum plant.
This allows for verification of controller values.
• initialiseVisualiser.m – this script is run from AAP5_setup.m, it will bring up a figure
with an animated pendulm. The Simulink model will not run when this figure is closed.
• armParts_vertices.mat, baseParts_vertices.mat, driveParts_vertices.mat, and
pendParts_vertices.mat – These files contain the geometry models used by the
visualiser.
Figure 1 Inverted pendulum rig and coordinate convention
Task 1: Find the effective inertia of the motor and gearbox elements as seen at the
rotational axis, .
The elements in the drivetrain between the motor and the rotational axis are modelled by
the inertias shown in Figure 2.
Derive an algebraic expression for the total effective inertia as seen at the rotational axis, ,
then substitute the parameter values provided in Table 1.
Figure 2: Motor, tachometer and gearbox components.
Table 1: Drivetrain parameters.
Variable Value Variable Value !"#!$%"& 3.462 × 10'( ⋅ ) &*+,-&" 1.463 × 10'./ ⋅ ) $!+0,#&$&" 6.355 × 10'1 ⋅ ) 2,$&*$3,#&$&" 1.616 × 10'.4 ⋅ ) . 5.444 × 10'5 ⋅ ) . 72 ) 4.183 × 10'6 ⋅ ) ) 120 / 1.008 × 10'( ⋅ ) / 24 7 4.669 × 10'( ⋅ ) 7 280 6 2.382 × 10'8 ⋅ ) 6 20 " 0.257 0.216
Note: After referring the cylindrical inertias to the rotational axis, , the inertia of the lever
arm, !"#, will need to be added to obtain the total rotational inertia on this axis. The lever
arm inertia is obtained by !"# = " ⋅ )3
Task 2: Find
!(#)%!(#) and &(#)%!(#).
In Tutorial Sheet 3a you were invited to develop linearized transfer functions relating angles and to the torque applied to the rotating arm. The resulting transfer functions were: ()9() = >22) + 2A) −22C> + 2)A>22) + 2A − >22A)D 7 − > + 2)A22)
and ()9() = 22C> + 2)A>22) + 2A − >22A)D ) − > + 2)A22
Here is the inertia calculated at Task 1.
The torque 9 is generated by applying a voltage ! to the actuating motor that drives the
rotating arm through a gearbox whose gear ratio is = 9!9 where # is the motor angular
displacement.
You first task is to find expressions for the transfer functions :(<)>"(<) and 9(<)>"(<) relating the moving
variables and to the applied voltage. Your results should express the transfer functions
in terms of both the model parameters (i.e. symbolically) and numerically by substituting
model parameter values into the transfer function expressions.
The block diagram given as Figure 3 may be helpful as might the observation that
!(#)&(#) = !(#)%!(#) %!(#)&(#) = '"(")##('"("#*+")##,'"("-.
Figure 3 Block Diagram model of motor and inverted pendulum plant
a q
Task 3. Use MATLAB to find transfer functions for and .
The Matlab script AAP5_setup.m evaluates the transfer functions :(<)?#(<) and 9(<)?#(<) using the
parameter values given in Table 2. The transfer functions are represented as Matlab system
models, see Appendix.
(i) Using Matlab functions feedback, series,and minreal determine the
transfer functions and .
(ii) Verify that the results obtained at Task 2 agree with those for Task 3.
Include a print out of the Matlab script used for these sub-tasks in your submission.
Table 1 Modelling parameters
Symbol Value Description 2 0.127 Mass of pendulum " 0.257 Mass of arm 2 0.337 Total length of Pendulum 2 22 = 0.168 Distance form pivot to centre of pendulm mass 2 2 ⋅ 2)12 = 0.0012 ⋅ ) Pendulum moment of inertia about centre of mass 0.216 Rotary arm length from pivot to tip 70 Gear ratio of 9!9 Obtained in Task 1 Total inertia at rotational axis, ! 0.18 Motor armature inductance ! 2.6 Motor armature resistance @ 7.68 × 10'/ /(/) Motor back-emf constant 7.68 × 10'/ ∙ / Motor current-torque constant
( )
( )a
s
V s
a ( )
( )a
s
V s
q
( )
( )a
s
V s
a ( )
( )a
s
V s
q
Task 4: Developing a PID controller to hold the pendulum upright
You will now design a controller for the pendulum angle . The control structure you will use
is shown in figure 4 below. It employs a PID controller to determine the motor voltage
command needed to maintain the pendulum angle at zero (upright) using a PID
compensator of the form:
:() = A,: + C,: + D$,&< = D',&<(ED),&Note that in general the zeros of a PID compensator can be real or complex. For this
assignment you are encouraged to seek a solution that has two real zeros.
Figure 4 Control structure for pendulum angle
The design specification for the pendulum angle controller is for the system to have a
transient respose for a step input satisfying:
• Peak Time, 2 ≤ 0.2s
• Percentage overshoot % ≤ 20%
(Specifying the performance in terms of attributes of a step input might at first seem a little
strange – why whould you want apply a step to ? Keep in mind that the system is a regulator
that seeks to maintain . Regulators aim to hold values at the specified level. Levels are
steps.)
A strategy for achieving this task is
• Identify the region of the complex plane that meets the design specification.
• Using the supplied Matlab scripts and Matlab’s SISOtool design a PID compensator
with two real-valued zeros that meets the specification.
In your report give values for , , , explain your rationale for the design in terms
of the root locus. Give the transfer function :(<):*+,(<) for your compensator (numerical values
for coefficients) and show the response of this transfer function to a unit step input.
a
a
a
0a =
,PK a ,DK a ,IK a
Task 5 Simulating the response of your compensator
The Simulink file Nonlinear_simulation.slx gives a non-linear model of the inverted
pendulum. The equations represented in the model are based on the equations of motion for
the system given in the Tutorial 3a question that asked you to model this system
Using Simulink’s PID block and the values for , , developed at Task 4, simulate
the response of the control system for regulating when subjected to a impulse-type
disturbance at the voltage command .
Things to note:
• In the Simulink PID block, set . This is the parameter of a low pass filter on
velocity.
• The reference position to your loop should be "&F = 0
In your your report, comment on the performance of your controller. In particular, why does drift?
,PK a ,DK a ,IK a
a
( )aV s
100N =
Task 6 Controlling and .
From Task 5 it should be clear that it is necessary to control both and simultaneously to
avoid drift in . This can be done by using cascaded control loops, a strategy commonly called
cascade control.
In cascade control the output of an outer compensator serves as the reference for an inner
control loop. The architecture of a cascade controller for controlling and is shown in
Figure 5. The variable is controlled in an inner PID loop and the variable is controlled in
an outer PD loop. A key requirement for cascade control to work is that the inner-loop be
“faster” than the outer-loop so that inner-loop dynamics do not “fight” the outer-loop control
actions.
The cascade structure you will be using is shown in the figure below.
Figure 5 Cascade control structure
You should have the closed loop transfer function for the inner loop from Task 4. Using this
result, and the Autotune facility within SISOtool (as pictured in the Appendix), stabilise the
pendulum arm . You can achieve this using a PD compensator with a first-order low-pass filter.
a q
a q
q
q a
a q
Task 7 Simulating your cascade controller
Using the Simulink file Nonlinear_simulation.slx, simulate your cascade controller
for
• a step reference change in "&F.
• a disturbance applied as a step to the motor voltage.
The PD with first-order low-pass filter can be modelled in Simulink using the LTI block or you
can use a PID block with the integral term set to zero. Save your PD with first-order low-pass
filter as a transfer function in Matlab and use the LTI block in Simulink to implement your
compensator.
Appendix
Some useful Matlab commands for working with transfer functions
The provided script creates transfer functions for you. However, you may find the following
useful.
Some functions
Mathworks provides excellent online documentation for their Matlab functions. However,
half of the battle is knowing which function to use in the first place. The following should help,
and the guidance offered should be supplemented with Mathworks documentation,
accessible online or by using the help function in Matlab.
Feedback
The feedback function closes control loops. The function assumes negative feedback.
Minreal
Because transfer functions ratios of polynomials in , it can sometimes happen that the
numerator and denominator have a common factor which can be canceled. When transfer
functions are evaluated numerically valid algebraic simplifications may not be effected
because computers representations of numbers always include rounding error.
The ‘minreal’ function in Matlab trys to overcome this by searching for cancellations between
the numerator and denominator of a given transfer function. This is useful when you are
working numerically, rather than symbolically. Rounding error causes cancelations to be
missed and the order of transfer functions may be inflated by multiplication if minreal is not
used.
While on the topic of pole/zero cancellations, it is often temping to design compensation by
using zeros to cancel unfavorably placed poles. This is almost always a very bad thing to do.
The intended cancellation will not occur if the introduced compensator zero is is slightly
different to the pole it is seeking to cancel and this can result in severe differences between
the expected behavior and the actual behavior. Suppose, for example, you seek to cancel the
behavior of an unstable plant pole by introducing a zero, via a compensator, to cancel it. If
the zero is even slightly off the pole, there will be a branch of the root locus connecting the
unstable pole to the compensator zero, with the consequence that the the closed loop system
will have an unstable pole and the system will be unstable.
Step
The step function will created a plot of the step response of a transfer function.
Plotting your simulation results
The non-linear simulation will save a timeseries of the pendulum angle and the arm angle to
the workspace as nonlinear. The following code will plot the data after you have run a
simulation in Simulink. You can add titles etc. as appropriate.
plot(nonlinear.time, nonlinear.signals.values)
LTI Block
The LTI block implements linear-time-invariant transfer functions. You have probably used
this block for linear simulations. You can use this block to model your compensator by saving
your compensator in the workspace as some variable, and then passing this variable into the
LTI block.