Professional Documents
Culture Documents
(Version 2.1)
PAGE
1. INTRODUCTION 1.1
4. CHECKLIST 4.1
5. LABWORKS 5.1
5.1 Labwork 1 - Static and Dynamic Characteristics of the Pendulum Control System 5.3
5.3 Labwork 3 - Direct Digital Controller Design and Implementation : Inverted Pendulum 5.12
5.4 Labwork 4 - Direct Digital Controller Design and Implementation : Swinging Crane 5.17
APPENDICES
Appendix 3 A3.1
DIAGRAMS
The Bytronic Pendulum Control System (PCS1) is the result of a project collaboration between
Bytronic and The Department of Mechanical Engineering, Manchester Metropolitan University,
England.
The Pendulum Control System (PCS1) may be used in two different modes, either as an inverted
pendulum or as an overhead crane. Each mode presents a different and challenging control
predicament that requires a different approach and solution.
In the first inverted pendulum mode users have the task of controlling an inherently unstable system.
In order to balance the pendulum in the inverted position the pivot must be continuously moved to
correct the falling pendulum. In simple language, such as trying to vertically balance a broom in your
hand.This interesting control problem is fundamentally the same as those involved in rocket or missile
propulsion. The rocket has to balance on its engine as it accelerates. As the rocket tends to fall over
the engine, thrust must be deflected sideways to restore the rocket's course.
In the second mode, the carriage module is turned upside down so that the pendulum acts as a crane.
The pendulum swings naturally into an equilibrium position with the centre of mass below the pivot.
The problem is now to control the linear position of the load which possesses very oscillatory
dynamics.
The Pendulum Control System may be used as a stand alone analogue control system or interfaced to
an external controller such as a microcomputer. Both of these options are discussed in Section 2.
Page 1.1
GETTING STARTED
The PCS1 consists of two separate modules linked by a connecting cable: a Carriage Module and a
Control Console.
The Carriage Module consists of a carriage that carries a pivoted rod and mass which is driven along
a 500mm track by a dc servo motor and toothed belt. The motor has an integral tachometer. In one
mode the module behaves as an inverted pendulum but when it is turned upside down, the rod and
mass represent the lifting block of an overhead crane. The carriage position and the attitude of the
rod/mass assembly are measured by potentiometers. The entire carriage assembly is surrounded by
a transparent safety screen and the unit contains its own power supply and servo power amplifier.
The Control Console includes a clear mimic diagram of the overall system and connection to the
control/measurement signals are via easily accessible 4mm colour coded sockets. The colour coding
is as follows -
The Pendulum Control System's two modes of operation, namely stand-alone in analogue mode or
linked to a computer in digital mode, as discussed in Sections 2.1 and 2.2 respectively. To begin, we
recommend that you start with the analogue mode so as to gain understanding of the control problem.
The following procedure will allow a quick set-up of the PCS1 as a linear position control system and a
balancing inverted pendulum.
1. Position the equipment on a desk with the carriage module in the inverted pendulum position
(the white plastic base to the bottom of the unit and the motor to your right).
3. With a 4mm lead supplied, connect the set point to the servo amplifier input terminal as shown in
Figure 2.1.
Page 2.1
4. Turn on the power.
5. The system is now configured as a linear position controller. The position of the set point
potentiometer will determine the position of the carriage assembly along the x axis.
6. To achieve optimum position control, the servo amplifier gain and velocity feedback must be
calibrated on the control panel. This procedure is covered in detail in Labwork 1. However, to
get the system working, approximate values are maximum for both the servo gain and half
setting for velocity feedback.
Note - At both ends of the track the carriage is electronically limited to prevent the carriage
hitting the end stops.
7. Now the servo system is set-up we may begin to balance the pendulum. Disconnect the servo
input from the set point and temporarily connect this to GND to prevent noise pick-up.
8. To balance the pendulum the variables "a", "gain" and the compensator all need to be designed
and calculated. The procedure to do so is discussed in Labwork 1. However, so that you may
quickly get the unit operational, follow these approximate control panel settings below -
9. Hold the pendulum upright in the centre of the track. Connect the controller output to the servo
input using the 4mm connecting lead. Now, gently let go of the pendulum, the pendulum should
balance in the centre of the track.
Page 2.2
10. a) Nudge the balancing weight and see the controller compensate and regain balance.
b) Try adjusting the gain value from zero to 3.0 and find out its effect on the balancing
operation.
If the pendulum will not balance with the approximated values, gently move the weight to the
upright position, the controller should take over! If not, check all connections and settings,
especially the compensator as shown in Figure 2.2.
This section has been a simple introduction into the operation of the PCS1 in its analogue control
mode. To fully investigate the set-up values and compensator design, please refer to the Labworks.
The PCS1 control module signals are available for use with any external controller via the 4mm
connectors. However, the most popular use is likely to be with a PC/Compatible microcomputer. In
order to facilitate PC digital control of the PCS1, a socket at the rear of the control module allows the
measurement signals to be transmitted directly to a Bytronic AD/DA Interface Board (MPIBM3) located
in a PC expansion slot. In addition, the control signal from the PC is also routed via this cable to drive
the input of the carriage servo amplifier which, in turn, controls the motor.
To achieve digital control of the PCS1 please follow the procedure outlined below -
1. Ensure the power to the microcomputer system and the PCS1 are both OFF.
2. Install the IBM3 card into a spare PC expansion slot and set both the ADC and DAC channels to
operate on +/-10V bipolar operation, as described in the IBM3 manual.
3. Remove all 4mm cables that may be connected to the control panel.
a) Directly connect the MPIBM3 26 way ribbon cable into the rear of the control console.
b) The MPIBM3 26 way cable may be connected to the MPIBM3A terminal PCB. This will
allow more flexible connection of the analogue channels to the pendulum console 4mm
terminals.
5. Power-up the PCS1 and then the microcomputer system. The PCS carriage assembly should
position itself in the centre of the track and the microcomputer power-up as normal. If not, power
down immediately and check all connections.
6. Run the VICTORII Software to achieve digital control of the pendulum system, following the
instructions given in Labwork 3.
When using the Bytronic IBM3 card the analogue connections made to the PCS1 are shown in
Figure 2.3.
Page 2.3
Figure 2.3 MPIBM3 Analogue Channels
MPIBM3
Analogue Input Channel Function
0 Position Y
1 Position X
2 Set Point
3 Angle θ
4 Tachometer Feedback
5 Not Connected
6 Not Connected
7 Not Connected
8 Not Connected
The IBM3 card analogue input channels and the DAC O/P channels may be viewed using the MPIBM3
interactive program. Please follow the on-screen instructions.
Page 2.4
TECHNICAL SPECIFICATION
Mains Supply - 110V ac or 220-240V ac, depending upon model purchased - see label
on the rear of the PCS1.
Servo Power Amplifier - Burr Brown OPA541AP with internal current limit set to 2.0 amps.
Belt - 10mm wide 5 mm pitch - 1300mm long Kevlar braided timing belt.
Page 3.1
Figure 3.1 Circuit Diagram
Page 3.2
Figure 3.2 The Header Pin-Out Details
Page 3.3
CHECKLIST
Fault Checklist
Check the "a" value make sure that the "gain" is not too
large (range 1.0 to 2.0 approx.).
5. The motor is humming. Have you left a 4mm lead with one end connected to the
servo input and the other end floating free? If so, connect
this to GND to prevent noise pick-up.
6. The carriage response is very Turn the power OFF and slide the carriage assembly by
slow, the motor seems as though hand. Check the assembly is easy running with no
it is stalling. mechanical obstructions or tight spots.
7. The carriage assembly is hitting Connect a DVM to the control panel signal "x". With the
the end stops. system powered-up, connect the set-point to the servo
input.
Page 4.1
8. Digital control can not be Check that the connection between the PCS1 and the
achieved. MPIBM3 card is correct.
Check all 4mm cables are removed from the control panel.
If a problem persists, please do not hesitate in contacting either Bytronics direct or one of our
distributors.
Page 4.2
LABWORKS
The following labworks begin by familiarisation of the Pendulum Control Unit and its dynamic
characteristics. As the labworks progress, the cover the control of the pendulum control unit by both
analogue and direct digital control methods.
As a part of the labworks' various monitoring, interconnections will need to be made on the control
console. To ease the understanding, we have referred to the 4mm terminals and the control knobs as
shown in Figure 5.1.
The labworks do assume some control theory knowledge. We feel the labworks are best supported
by the CODASII simulation software and the Control System Design and Simulation text book,
bibliography ref. 1.
When the Pendulum Control Unit is linked to an IBM.PC to achieve Direct Digital Control, the Virtual
Instrument Control Software (VICTORII) package offers unequalled flexibility in the control of the
PCS1.
Both CODASII and VICTORII are available in single and multi-user licences from Bytronics.
Page 5.1
Figure 5.1 The Pendulum Unit Control Console
Page 5.2
5.1 Labwork 1
Static and Dynamic Characteristics of the Pendulum Control System (PCS1)
5.1.1 Object
5.1.2 Apparatus
Place the rig in the inverted pendulum position and unscrew the pendulum rod. Disconnect all the links on
the console. Connect the output of the set-point potentiometer (socket A) to the input of the carriage
servo (socket H). Position the set-point potentiometer (P1) so that it is at its mid-range. Adjust the servo
gain potentiometer (P3) and the velocity feedback potentiometer (P4) so that they are about mid-range.
Switch on the power to the apparatus.
Move the set-point potentiometer to and fro and observe the carriage change its position. Using the two
voltmeters, measure the set-point voltage and the carriage position voltage, Vx, (socket J). Increase the
set-point voltage uniformly from 0 to +10V and then back down to -10V and finally back to 0V in steps of
2V and plot a graph of the servo position against set-point voltage. Make sure that you always move the
pot in the required sense. If you move it too far one way, move the set-point potentiometer back and then
approach the required value slowly.
The non-linear behaviour (clipping characteristic) has been introduced deliberately to prevent the carriage
hitting the end stops too hard and so damaging the rig.
Disconnect the servo input (socket H) from the set-point potentiometer and connect the servo input to
ground. Push the carriage to the right with your hand and gently release it. Make a note of the carriage
position voltage. Repeat, pushing the carriage in the opposite direction and letting it go again. Hence
calculate the hysteresis of the carriage servo in volts. Compare this figure with that obtained above in 3b.
Reduce the servo gain pot to about 25% of its range and repeat the test. Finally put the servo gain to
maximum and measure the carriage hysteresis once more.
What conclusion do you draw about the effect of servo gain on the amount of hysteresis present in the
carriage servo? Can you explain the reason for your observation?
Page 5.3
5.1.5 Transient Response of the Servo Subsystem
Reduce the velocity feedback to zero. Use a signal generator to apply a +1V square wave of frequency
1Hz to the input of the carriage servo. Observe the carriage position on an oscilloscope (socket J).
Adjust the servo gain until the response shows a small overshoot of about 15% (damping ratio of about
0.7). Now increase the servo gain to a maximum and adjust the velocity feedback pot (P4) so that the
response is similar to the one observed previously.
From now on leave the gain of the carriage servo at a maximum and the amount of velocity feedback at
the value that produced a step response with a slight overshoot.
In this experiment we will obtain a transfer function of the carriage servo. To do this properly, you really
needs a frequency response analyser, but the method described here is a simple method for obtaining an
approximate second order model.
First we are going to determine the bandwidth of the carriage servo. Apply a 1 Hz sinusoidal signal with a
peak to peak amplitude of 1 volt to the input of the servo (socket H). Observe the carriage position
voltage on an oscilloscope. You may see a slight distortion because of the hysteresis that is present, but
the amplitude will be nearly the same as the applied signal, ie the servo-subsystem has unity low
frequency gain which confirms the result obtained in 5.1.3c. Increase the frequency of the applied signal
until the observed voltage has reduced to 0.7V, ie 1 2 of the low frequency value. The frequency at
which this occurs is the bandwidth of the system ωb. For a system with a damping ratio of 0.7, the natural
frequency, ωn, is equal to the bandwidth. Based on this approximation, calculate the natural frequency, ω
n. (Don't forget to work in rad/s). Hence deduce the transfer function of the servo-subsystem assuming
that the damping ratio is 0.7
As an example, a system whose bandwidth is 9.6Hz and a damping ratio of 0.7 has the approximate
transfer function -
1
G( s ) =
1 + 0 . 023s + 0 . 00027s 2
In this part of the experiment we will model the dynamic behaviour of the "pendulum". We shall do this by
observing the transient response of the system from an initial value. This really requires a storage 'scope
or a pen-recorder, but if VICTOR-II* is available, it can be used like a storage oscilloscope with a digitising
cursor.
Before fitting the pendulum rod into the carriage, position the mass at the end of the rod. Estimate the
position of the centre of mass of the rod/mass assembly by trying to balance it on your finger. (The centre
of mass is located just below the bottom of the mass.) We shall call this length, the effective pendulum
length, L.
Screw the pendulum rod firmly into the carriage. Tip the rig upside down so that it is in the "crane"
position. Connect the pendulum angle signal, Vθ, to the oscilloscope. If VICTOR-II is being used to
monitor the angle θ as the measured value, (analogue channel 3). Select a sample time of 0.0137s for
maximum resolution (Controller menu <F3>).
Page 5.4
Displace the pendulum by about 30o, release it and record the transient response. After about 20 cycles
freeze the display. Estimate the period of oscillation, T, and the logarithmic decrement using equation 1
(see ref 1, pg 73 and pg 80).
The value of the period obtained can be calculated theoretically from the basic dynamics of a simple
pendulum. The well known formula for the period is 2 π L g , where L is the effective length of the
pendulum (ie from the pivot to the centre of mass). Do this calculation using the effective centre of mass
obtained earlier and compare the period obtained with that observed experimentally.
α = ln(mk/mk+2) (1)
where mk is the magnitude of the kth overshoot. From the logarithmic decrement, α, the damping ratio,
may be calculated using the formula -
α
damping r atio ζ = (2)
α + 4π2
2
This system is very lightly damped, so in order to arrive at a figure for the damping ratio, it is best to plot a
graph of ln(mk) versus k. Use the cursor to extract data from the frozen display in the VICTOR recorder
window. The logarithmic decrement, α, is twice the slope of the graph.
Suppose for example the logarithmic decrement is 0.02, then the damping ratio figure works out to be
0.0033. You may need to modify the damping ratio figure slightly to obtain a better overall fit to the
observed response.
From the period, T, the natural frequency can be deduced assuming that the damping ratio is very small,
ie ωn ~ 2π/T. Suppose, T is 1.02s, then ωn is approximately 6.16 rad/s. Thus, with a natural frequency
value of 6.16 rad/s and a damping ratio figure of 0.0033, the pendulum can be modelled approximately as
a second order system -
1 1
G( s ) = =
2ζ 1 2 1 + 0. 0011s + 0 . 0264s 2
1+ s+ s
ωn ω n2
Use CODAS to compare the response of the model with that of the actual system. To do this, enter the
transfer function of the system, switch to open-loop, define an initial condition of unity (<Z>) and choose a
user defined input of 0. Figure 1.1 shows the trace obtained.
5.1.8 References
Ref 1 - Golten JW, Verwer AA, "Control System Design and Simulation", McGraw Hill, 1991
Page 5.5
Figure L1.1
Page 5.6
5.2 Labwork 2
Analogue Control of an Inverted Pendulum
A simple pendulum swings naturally into an equilibrium position with the centre of mass below the pivot.
In order to balance the pendulum in an inverted position the pivot must be continuously moved to correct
the falling pendulum. This interesting control problem is fundamentally the same as that involved in rocket
or missile propulsion. The rocket has to balance on its engine as it is accelerated. As the rocket tends to
fall over the engine thrust must be deflected sideways to restore its course.
This exercise is concerned with the stabilisation of the PCS1 apparatus when operating as an inverted
pendulum.
The controlled variable in this system is the position of the pendulum mass, y. Unfortunately y cannot be
directly measured but it can be calculated simply from the measurements θ and x as
y = x + L sin θ
(see Figure L2.1). For small angles the above equation approximates to
y≈x+Lθ
The voltage from the pendulum potentiometer, Vθ is scaled by a factor 'a' (potentiometer P5), and added,
by means of an operational amplifier circuit, to the voltage from the carriage potentiometer, Vx, to give
Vy = Vx + aVθ
The factor 'a' can be adjusted (potentiometer P5) to take account of various pendulum lengths, L.
Disconnect all the leads from the PCS1 console including the 25 way cable. Make sure that the carriage
servo gain is at a maximum and the velocity feedback potentiometer is at the value determined in Labwork
1. Also ensure that the mass on the pendulum rod is in the same position as in Labwork 1. Connect the
set-point pot to the carriage servo input and check that the servo is working.
Position the carriage near the centre of the track and screw the pendulum rod into its pivot. Support the
pendulum in an upright position by putting the threaded knob through the front panel and locating the end
of the rod into the clearance hole machined in the pendulum weight. Tighten the wing nut onto the inside
face of the front panel to remove any slackness. With the rod/mass assembly held steady at its centre of
gravity gently move the carriage from side to side using the set-point potentiometer. Monitor the voltage
Vy (socket L). As this voltage represents the position of the mass, it should not vary as the carriage
moves. By trial and error find a value for 'a' which minimises the variation in the calculated value of y. Do
this test with great care, make a note of the setting and lock the potentiometer in this position.
Page 5.7
5.2.4 Simulation Using CODAS
Initially we will neglect the dynamics of the carriage servo, ie assume that its response time is very fast in
comparison with the pendulum. The inverted pendulum can be linearised and modelled by the transfer
function
Y 1
( s) =
X s2
1−
ω n2
See the case study no. 2 in ref 1 pgs 198 et seq. This equation is explained on pg 200. There we have
Y 1
( s) =
X 1 − d2 s 2
where d² =l/g. The natural frequency of the pendulum is ωn, which is equal to 2π/T, where T is the period
of the pendulum. On Page 5.5 of this manual we state that the period is 2 π l g , hence
2π 1
ωn = = gl=
2π l g d2
Enter the transfer function into CODAS as Gp(s). For example, if ωn is 6.16 rad/s, the transfer function is
entered into CODAS as -
1
Gp ( s ) =
1 − 0 . 0264s 2
Examine the s-plane pole/zero pattern and confirm that the open loop transfer function predicts instability.
Plot the root locus diagram for both positive and negative gains (set K to any negative value to obtain the
latter). Comment on the possibility of stabilisation using proportional control. Predict the form of closed-
loop step response with proportional gains of -0.5, -1.0 and -2.0. Check your predictions using the time
domain environment of CODAS. Note the frequency of any oscillatory behaviour.
We will now try out proportional control on the PCS1 unit with negative gain. Switch off the power
amplifier and connect the set-point potentiometer as a reference voltage to the overall inverted pendulum
control system (link sockets A and B). Set-up the compensator as a unity gain inverting amplifier, i.e. put
a 100K resistor across terminals D and a 100K resistor across terminals F. Connect the output of the
operational amplifier directly to the servo reference input (link sockets G and H). Make sure the gain
switch is set to negative.
Support the pendulum by hand and with the gain potentiometer, P2, set to zero, switch on the power
amplifier. You may need to adjust the set-point pot to bring the carriage into the centre of the rig. Slowly
increase the gain and observe the carriage action as you move the pendulum to one side. Do not release
the pendulum completely because proportional control cannot stabilise this system. Compare the
behaviour of the system with different gains with that predicted by CODAS. Note particularly the
behaviour with the gain set at unity.
Page 5.8
Figure L2.1 Determination of Mass Position
y = x + L sin θ
Centre
Line
θ
L
Page 5.9
5.2.5 Stabilisation Using Phase Lead Compensation
The choice and design of the compensator is disucussed in depth in ref 1 pg 201. It suggests a
compensator of the form
1 + ds
Gc (s) =
b g
1 + d 10 s
0.2
(see ref 1 figure 6.22). For the Bytronic Pendulum d = = 0.14
9.81
The actual compensator recommended simply uses round numbers. It is not suggested that this
compensator is in anyway "optimum". Better compensators may be designed using the methodology
described in the case study.
The operational amplifier on the console can be used to implement a phase lead compensator (Figure
L2.2). We will use the compensator
1 + 0 .1s
Gc ( s ) =
1 + 0. 01s
Add this compensator to the CODAS simulation and plot the new root locus. Can the system now be
stabilised? What value of gain will result in a stable closed-loop system? Choose a gain which gives the
closed-loop system dominant poles a reasonable damping ratio. Obtain a simulation of the system step
response with this value of gain.
"Link between Gc(s) and op amp circuit". In general for an op amp circuit
V0 Z
=− f
V1 Z1
Where Zf is the feedback impedance round op amp and Z1 is the impedance between the input voltage
V1 and the summing junction.
1 1 1 + RC1s
= + C1s =
Z1 R R
1 1 1 + RC f s
and = + Cf s =
Zf R R
Vo 1 + RC1s
Thus = −
V1 1 + RC f s
Vo 1 + 0.1s
Hence =−
V1 1 + 0.01s
Page 5.10
Add the compensator components as shown in Figure L2.2.
Note - Ready-built compensator parts are supplied with the pendulum unit for this purpose.
Once more support the pendulum by hand and with the gain 'K' set to zero switch on the power amplifier.
Slowly increase the gain until the pendulum balances itself. Make a note of this critical value of gain.
Increase the gain to the value determined from CODAS and observe the response. Try gently altering the
set-point value to make the pendulum move along the track. Try gently tapping the pendulum to knock it
over.
Note - Very small adjustments in the value of 'a' (pot P5) can have a significant effect. If you have
difficulty in balancing the pendulum, try adjusting the 'a' pot slightly.
The CODAS simulation predicts a stable response for the compensated system, however you will no
doubt have noticed the servo continuously hunting from side to side. This behaviour is due to hysteresis
in the carriage servo. The effects of hysteresis will be covered in some detail in a later labwork.
Page 5.11
5.3 Labwork 3
Direct Digital Controller Design and Implementation: Inverted Pendulum
5.3.1 Apparatus
5.3.2 Introduction
Balancing the inverted pendulum using a direct digital controller is by no means a trivial exercise, either
from the point of view of design or implementation. In order to do this labwork completely you will need
access to the CODAS-II package and VICTOR-II software with an analogue I/O capability. It is possible,
however, to do this experiment without CODAS-II and just accept the designs obtained. However some
CACSD (Computer aided control system design) package is required if modifications are to be made to
the controller design.
VICTOR-II allows controllers to be implemented very simply by selecting the DDC mode of operation,
defining the sample time and entering the z-domain transfer function of the compensator. VICTOR-II or
another on-line control package facilitates the experiments that follow in this labwork. The alternative is to
write a real-time program to implement difference equations. It is reasonably straightforward to write a
simple program, in say PASCAL, that implements a control strategy defined in terms of difference
equations.
It should be pointed out that the controllers used in this labwork were designed using pole placement
methods described in ref 1, chapter 9. However because of the complexity of the dynamics of the rig,
hand methods are not really possible. However, one example of a design based on a simplified model
ignoring servo dynamics and damping is included for interest.
The inverted pendulum controller design is particularly difficult because the model obtained experimentally
describes the large signal behaviour of the system. However, near the point of balance, it is the small
signal behaviour that is significant. In this system factors such as friction and stiction are more
pronounced when the pendulum is nearly balanced (ie stationary) than when it is swinging. Thus the
model used for design is not the one that describes the behaviour well near the normal operating point.
This is rather different from process control situations where the small signal behaviour is less affected by
the type of non-linearities generally present in such systems.
Thus in designing the controller a very conservative approach must be adopted and the rules derived for
well behaved linear systems must be interpreted with a healthy scepticism and invariably some trial and
error is necessary to arrive at a workable robust solution.
Page 5.12
5.3.3 Design of a DDC Controller Using a Simplified Model
In this exercise we shall design a z-domain compensator using a simplified model of the inverted
pendulum in order to show the approach. The servo dynamics and any damping in the pendulum
pivot are neglected, ie the plant dynamics can adequately be described as
1
Gp( s ) =
s2
1−
ω n2
For the purpose of this exercise a natural frequency of 6.16 rad/s will be assumed, ie a period of
just over 1 second.
The key decisions that must be made are the desired closed-loop behaviour and the sample time.
These two factors, however, are not wholly independent. Guidelines for sample selection are
outlined in ref 1, chapter 6, pgs 318-319.
As the open loop system is second order, it is not unreasonable to demand that the underlying
dynamics of the closed-loop system should also be second order. However, experience shows
that for this difficult problem, the requirement for the closed-loop dynamics should be relaxed
further. The controller that results by demanding second order closed-loop dynamics produces a
rather violent control action that is sensitive to modelling errors and may not achieve balance. In
order to achieve a more robust control system, the target closed-loop dynamics will be specified
as third order.
For simplicity we will choose a characteristic equation with repeated roots. Now a third order
system with three identical lags of 0.25s has a 5% settling time of 1.5s which is a reasonable
specification for the system considering the underlying dynamics of the pendulum.
As well as the dynamic design criterion, a target must be set for the steady-state performance of
the control system. In the analogue design, a Type 0 phase advance compensator was
employed. With this compensator a forward gain of -3 was just achievable, ie a steady-state
closed-loop gain of 1.5, ie
K −3
steady − state gain = = = 1. 5
1+ K 1 − 3
For the DDC controller, however, we will specify steady-state set-point following, ie unity closed-
loop gain (F(1)=1).
The guidelines for sample time selection for DDC controllers in ref 1 suggest that the sampling
frequency, fs, should exceed about 20fb (where fb is the closed loop bandwidth). Now a system
with three repeated lags of time constant, τ, has a -3dB bandwidth of about 0.08/τ Hz. Thus the
target closed-loop bandwidth is about 0.32Hz. Hence the sampling frequency should exceed
6.4Hz (150ms sample time). Too high a sampling rate causes real s-plane poles to be bunched
very close to z=1 in the z-plane.
Page 5.13
Ref 1 recommends that the sampling frequency should be less than 50/τo, where τo is the
dominant open-loop time constant of the system. Now the system we are dealing with has a pair
of real poles at ±6.16s-1. Thus fs should be less than 50 x 6.16Hz, ie the sampling frequency
should not exceed 310Hz.
A certain amount of trial and error is required, but a sampling time is 0.055s (18.2Hz) does
produce a working controller and this figure is in agreement with the theoretical limits described
above.
In the z-domain a time constant of 0.25s maps to the point z = e − T τ on the real axis of the z-
plane. Thus for a sample-time, T, of 0.055s and a time constant, τ, of 0.25s, the point on the z-
plane is z~+0.8. Thus the desired closed-loop characteristic equation is:
(z-0.8)3=0
1
Gp( s ) =
1 − 0. 0264s 2
The z-transform of this system including the zero order hold is (ref 1, chapter 8, section 8.8 for
theory) -
Gp (z) = Z
R|S1− e − sT
1 U|V
T| s 2
(1 − s ω n 2
W|
=
( z − 1)
Z
1|RS 1 U|V
z |T
s (1 − s ) ω n 2
2
|W
−0. 058 ( z + 1)
Gp( z ) =
( z − 1. 4 )( z − 0. 7 )
You can get this result using CODAS-II by setting the hold time to 0.055s and pressing <F5>.
Alternatively, the result may be obtained using partial fractions and the table of Z transforms on pg
379 of ref 1. See Appendix 3 for details.
This open-loop system has an unstable pole at z=+1.4 and a zero on the unit circle. The design
procedure described in ref 1, pgs 310-311 requires that (1-F(z)) has a zero of the same value as
the unstable pole and also that F(z) incorporates the zero of the open-loop system that lies on the
unit circle.
Thus the form of the closed-loop transfer function, F(z), will thus be -
b 0 ( z + 1)( z + b1 )
F ( z) =
z( z − 0. 8 ) 3
The coefficients b0 and b1 are included to meet all the degrees of freedom required. The value
b0 and b1 will be chosen to satisfy the steady-state closed-loop gain criterion (F(1)=1) and the
requirement that (1-F(z)) has a zero at z=+1.4.
Page 5.14
The numerator, N(z), of (1-F(z)) is
(1+ b1)
1= 2b o
(1− 0.8)3
Solving these two equations simultaneously, one finds that b0 = 0.215 and b1 = -0.9814.
1 F(z)
Since Gc ( z) =
Gp ( z) 1 − F( z)
( z − 0.713)(z − 0.981)
Gc (z) = −3.7
(z − 1)( z − 0.215)
This controller gives good results, though a slight change in the controller gain, K, may improve
matters because of modelling errors.
The above controller is not very robust because it used a simplified model of the pendulum and ignored
the servo dynamics, but it should balance it.
Connect the 26 way cable from the MPIBM3 card to the PCS1 control module. Unscrew the pendulum
rod. Switch on power to the PCS1.
Start up VICTOR-II. Switch to DDC mode (Controller menu <F3>). Set the sample time to 0.055s (also in
the Controller menu <F3>) and clear the buffer. Select external plant (Plant menu <F4>).
Press <U>, and set the manual output to 50%. The carriage should move to the middle.
5*sin(0.5*t)
Page 5.15
Press <G>. You should see carriage move to and fro sinusoidally. Select the analogue input channel θ*
using the I/O menu (<F5>). So that the 'y' value is displayed, and adjust 'a' to be the same value as in
Labwork 2. (This value is very critical and you may have to tweak it later). You should see the easured
value signal appear on display also as a sinewave.
Press <G> again to remove excitation. Screw in the pendulum rod firmly with weight at the top. Connect
the locating knob to the pendulum mass, this keeps the centre of mass of the rod/mass assembly at the
same position irrespective of any movement of the carriage and press <G>. If you have adjusted the 'a'
value correctly, the measured value trace should stay horizontal. If not adjust 'a' pot until measured value
trace stays horizontal. If necessary you can change recorder vertical scale to increase resolution. Press
<G> to remove the excitation signal.
Change the set-point to 50% (Press <S> and type in value). Type in the compensator transfer function.
You do this in two stages, first press <N> and enter the Numerator, Then press <D> and type in the
Denominator. At this stage save data set to file by pressing <F2>, followed by <S> and call it something
like "INVP1".
Remove the locating knob and hold the mass at the end of the pendulum rod lightly and centre the rod so
that the deviation displayed on the VICTOR screen is nearly zero. Lightly hold the pendulum in this
position, switch to Auto, ie press <A>, wait for a second or two and release the pendulum. Hopefully it
should balance. Experiment gently with the adjustment of the 'a' pot to smooth behaviour. Press <G> to
add in the excitation. You can remove it by pressing <G> again. However this is very traumatic because
you can introduce a big kick. Try pressing <G> when the set-point displayed in the panel meter is close to
50%.
If the thing goes berserk, switch to manual (<M>) and try again.
1. The above compensator did not take into account the slight damping in the pendulum and ignored
the dynamics of the servo. Try the following compensator which was designed taking both factors
into account.
2. Design a compensator neglecting damping and servo dynamics with a sample time of 0.11s. Try
it out.
5.3.6 References
Ref 1: Golten JW, Verwer AA, "Control System Design and Simulation", McGraw Hill, 1991
Page 5.16
5.4 Labwork 4
Direct Digital Controller Design and Implementation: Swinging Crane
5.4.1 Apparatus
5.4.2 Introduction
When the PCS1 carriage module is inverted, ie in the crane position, the apparatus mimics an overhead
crane or a grab. In practice the grab is moved out over the material/goods to be raised, the grab is then
lowered and then raise the material. The problem is that if the top of the grab is moved suddenly, the
other end starts to swing violently and it takes a long time before the oscillations have died away and the
material can be hoisted safely. The object of this labwork is to devise a control law that will allow the grab
to reach a steady-state as fast as possible after a demand change in its horizontal position.
The dynamics of the system are essentially those of a pendulum and because of the very low damping,
the system shows a pronounced resonance at the natural frequency of the rod/mass combination.
Conventional analogue control of such a system using lead or lag compensators is very difficult. The best
approach is to use a 'notch' filter, ie a filter that has a anti-resonance. By placing the notch near the
natural frequency of the 'crane', the overall frequency response characteristic is smoothed out and then a
simple compensator can be employed to satisfy the design criteria. However this approach will not be
pursued here and it is left for students to explore this method for themselves. Rather than attempt to
control the system using analogue methods, discrete controllers will be designed and implemented. The
nature of the system lends itself very well to such methods which result in simple, robust and effective
control, for example - deadbeat controller.
Many of the arguments regarding sample time selection discussed in Labwork 3 for the inverted pendulum
are not applicable for the apparatus in this position. Although the system is very oscillatory, it is stable,
and even with a sluggish servo the system can be brought to rest. In the inverted pendulum mode,
however, it would not be possible to "catch" the pendulum before it topples over completely if the servo
behaviour were too slow or if the sample time were too long. In the case of the crane problem we can
design an effective controller with a much slower sampling rate.
For this system we can choose a more demanding design objective, ie dead-beat control with steady-state
set-point following, ie a compensator with integral action. Dead-beat control brings the system to rest in a
finite number of samples. As the system is second order, we can theoretically achieve dead-beat
behaviour in two sample intervals. Now, as the system oscillates naturally with a period of 0.94s, it seems
natural to try to bring it to rest in a half period. These arguments lead to a sample time of 0.94/4 = 0.235s.
In VICTOR-II the nearest sample time one can choose is 0.22s.
Page 5.17
In this application we can neglect the dynamics of the servo as it is so much faster and better behaved
than the crane. Furthermore as a first approximation we can neglect the damping in the pendulum. The
transfer function relating the centre of mass of the rod/mass assembly to the carriage position is assumed
to be -
1 1
Gp ( s ) = =
1 + s 2 / ω n2 1 + 0. 0264s 2
Assuming that ωn is 6.16 rad/s. Enter this transfer function into CODAS-II and select a sample time of
0.22s. Transform the plant transfer function to the z-domain (<F5>). The resulting pulsed transfer
function is approximately -
ωn2
Gp (s) =
s2 + ωn2
This is transformed again using CODASII as explained. Alternatively, you can do this by analysis following
similar lines to the example done for pg 5.13, ref 1.
Gp (z) = Z
R|S1− e − sT
ω n2 U|V = z − 1 Z R|S 1 ω
n
2 U|V
|T s 2
s + ωn 2
|W z |T s s + ω
2
n
2
|W
Again a partial fraction is required of the term inside the curly brackets.
1 ω n2 1 s
2
= − 2
2
s s + ωn s s + ωn2
The Z l q = z z− 1 − 1−z(2cos(
z − cos( θ ))
θ )z + z 2
Hence
0.785 ( z +1)
Gp ( z ) =
1 − 0. 43 z + z 2
Select the root-locus domain and you will observe that there are a pair of poles present on the unit-circle.
These poles represent the oscillatory dynamics of the pendulum. A sample rate of four times the natural
frequency would make these poles on the unit circle pure imaginary.
Page 5.18
5.4.4 Dead-Beat Controller Design Using Simplified Plant Model
To design this compensator, we allow Gc(z) to cancel the two poles on the unit circle. This effectively
produces a notch filter that cancels the pendulum resonance (see later). Cancelling the plant zero on the
unit circle, would result in a marginally stable controller (pg 311, ref 1). For steady-state set point
following, the closed-loop transfer function will be -
0 . 5 ( z + 1)
F ( z) =
z2
1 F ( z)
G c ( z) =
Gp 1 − F ( z )
Hence
0. 637 (1 − 0. 43 z + z2 )
G c ( z) =
( z − 1)( z + 0 . 5 )
Enter the plant and compensator transfer functions into CODAS-II and examine the closed-loop time
response. Also examine the control effort (<U>). Save the CODAS model to file as "crane1".
5.4.5 Procedure
Place the PCS1 carriage module into the 'crane' position, ie where the pendulum is hanging down
vertically. Connect the 26 way cable to the PCS1 control console. Switch on the power to the PCS1 unit
and start up VICTOR-II
Select the DDC mode with a sample time of 0.22s. Change the manual output to 40%, the set-point to
40% and the excitation to 20%. Enter the compensator transfer function. Save the settings to a file as
"crane1". Before switching to Auto press <G> to remind yourself of how oscillatory this system is. Press
<G> again and wait for the system to settle, or stop it swinging with your hand. Now switch VICTOR-II to
Auto and repeat. Freeze the display and measure the settling time. Is it the same as the simulation?
How does the observed response compare with the simulation?
Using CODAS-II load the file "crane1". Select the frequency domain <F8> and the Bode Gain View (<V>).
Press <F3> to select compensator and the plant. Draw the frequency response of the overall open-loop
system. Notice that the curve is smooth with no sharp resonances or anti resonances below the Nyquist
frequency.
Now press <F4> to look at the plant alone and draw its open-loop frequency response. Now change the
plant denominator to unity, bring in the compensator (<F3>). This time when you press <G> you will see
the frequency response of the compensator on its own. You will observe that the compensator has an
anti-resonance that cancels the plant resonance.
Page 5.19
5.4.7 Dead-Beat Controller Design Using Plant Model with Damping
1
Gp ( s ) =
1 + 0 . 0011s + 0. 0264s 2
In the next sections we shall design a controller that takes into account the damping in the actual system.
When damping is introduced in the plant transfer function, the poles and zeros all move inside the
unit circle, ie
0.76(z+0.97)
Gp ( z ) = 2
z − 0. 41z + 0 . 91
If a dead-beat controller is designed using the above model where the zero at z=-0.9 is cancelled,
the compensator will have a pole at z=-0.9. The resulting compensator is
Enter the above compensator into VICTOR, make sure the deviation is zero and switch to Auto.
Do not at this stage press <G> to excite the system. You will already observe an oscillatory mode
occurring even in this quiescent state. We will introduce a step change in the set-point, but be
ready to switch back to manual if the oscillations in the rig become too violent. Press <G> now
and observe the response. You probably are back in manual by now!. Clearly, cancelling a zero
on the real negative axis is not advisable. In fact there is very little advantage to be gained by
cancelling any plant zeros at all.
This time the compensator is designed without cancelling the zero at z=-0.97. The resulting
compensator is
0 . 67 ( z 2 − 0 . 41z + 0 . 91)
G c ( z) =
( z −1)( z + 0. 5 )
Try the response with this compensator and compare the results with those obtained with the
simpler plant model. Is the behaviour closer to the modelled response?. Try refining the plant
model so that the correlation between the actual crane and the simulation is close.
5.4.8 References
Ref 1: Golten JW, Verwer AA, "Control System Design and Simulation", McGraw Hill, 1991
Page 5.20
APPENDICES
Connect a DVM to the angle θ 4mm terminal on the PCS1 control panel. Check that when the
pendulum is upright, the voltage is 0V. If the voltage is not 0V then the servo potentiometer in the
carriage assembly requires adjustment.
2. Gently move the plastic cover off the assembly, exposing the servo potentiometer.
4. Adjust the servo potentiometer by rotating it so that when the pendulum is vertical, the voltage
feedback is 0V.
6. Reassemble the carriage module and test the operation of the unit.
If the problem re-occurs check the tightness of the M3 retaining grub screw which clamps the servo
potentiometer shaft.
Page A1.1
APPENDIX 2 RESETTING THE "X" POSITION POTENTIOMETER
Connect a DVM to the control panel signal "x". With the system powered up, connect the set point to
the servo input. Slide the set point to position the carriage assembly in the middle of the track (the
track is 500mm long). If the voltage at "x" is not 0V then the x position potentiometer needs
adjustment.
The "x" position potentiometer is located at the non-driven end of the carriage module. The detailed
assembly is shown in Figure A2.1.
1. Position the carriage assembly accurately in the centre of the track by sliding the set point
potentiometer.
2. Unlock the two retaining grub screws in the flexible coupling Part A, refer to Figure A2.1.
3. Rotate the flexible coupling by hand so as to turn the potentiometer shaft but not the timing gear
and carriage assembly. Turn the coupling until 0V is achieved on the DVM.
4. Add a little nut locker (loctite) to the grub screws 'A' and lock up tight.
Page A2.1
6. Use the set point potentiometer to move the carriage from one end to the other. The carriage
should be electronically limited to stop approximately 15mm short of the end stops.
7. The carriage should now be correctly calibrated and meet the following criteria -
a) With the carriage assembly at the centre of the track, the "x" voltage is 0V.
b) The carriage assembly should stop short of the end stops by approximately 15mm.
c) The x voltage to your right should be +ve and the voltage to your left should be -ve, and
both end limits should be approximately equal.
Page A2.2
APPENDIX 3
1 1 a2 1 s
Consider = = −
s (1− s 2 a2 ) s ( a2 − s 2 ) s ( s 2 − a2 )
s 2 − a2 − s 2 − a2 1
Check 2 2
= 2 2
=
s(s − a ) s(s − a ) s(1 − s 2 a 2 )
+s 1 1FG 1 IJ
Now
s −a2 2
=
H
+
2 s+a s−a K
1 (s − a) + (s + a) s
Check = 2
2 (s + a)(s − a) s − a2
Consider Z
RS 1 + 1 UV = z +
z
=z 2
( z − β 2 + z − β1 )
Ts + a s − aW z−β 1 z − β2 z − z( β1 + b 2 ) + β1β 2
Where β1 = e − aT , β 2 = e + aT
b
= 2z z − ( β1 + β 2 / 2) g
2
z − z( β1 + β 2 ) + 1
Thus Z
RS s UV = z( z − γ 2)
Ts 2
−a 2
W z − γ z+1 2
Where γ = β1 + β 2
Z
|RS 1 1 |UV = z −
z( z − γ 2)
|T s (1− s a ) |W ( z − 1)
2 2
( z 2 − γ z + 1)
z 2 − z + 1 − (z 2 − z(1 + γ 2) + γ 2 )
( z − 1)
z
Z l q = 1 − (zz− 1)(z − γ 2)
− γ z+1 2
=
z2 − γ z + 1
− z + (1 + γ 2)z + 1 − γ 2
=
z2 − γ z + 1
(1 − γ 2)(z + 1) (z + 1)(1 − γ 2)
= =
2
z − γ z+1 (z − β1 )( z − β 2 )
−0.0574(z + 1)
Gp (z) =
(z − 0.712)(z − 1.403)
Page A3.1