ControlExperiments - Precision Modular Servo
ControlExperiments - Precision Modular Servo
Control Experiments
CONFIDENTIAL
Feedback Instruments Ltd., Park Road, Crowborough, East Sussex, TN6 2QR, UK
Telephone: +44 (0) 1892 653322, Fax: +44 (0) 1892 663719
E-mail: [email protected], Website: www.feedback-instruments.com
Manual: 33-927S Ed01 122006
Feedback Part No. 1160-33927S
33-927S
33-927S
II
PREFACE
CAUTION RISK OF
DANGER
CAUTION RISK OF
ELECTRIC SHOCK
CAUTION ELECTROSTATIC
SENSITIVE DEVICE
PRODUCT IMPROVEMENTS
We maintain a policy of continuous product improvement by incorporating the latest developments and
components into our equipment, even up to the time of dispatch.
All major changes are incorporated into up-dated editions of our manuals and this manual was believed
to be correct at the time of printing. However, some product changes which do not affect the
instructional capability of the equipment, may not be included until it is necessary to incorporate other
significant changes.
COMPONENT REPLACEMENT
Where components are of a Safety Critical nature, i.e. all components involved with the supply or
carrying of voltages at supply potential or higher, these must be replaced with components of equal
international safety approval in order to maintain full equipment safety.
In order to maintain compliance with international directives, all replacement components should be
identical to those originally supplied.
Any component may be ordered direct from Feedback or its agents by quoting the following
information:
1. Equipment type
3. Component value
2. Component reference
Components can often be replaced by alternatives available locally, however we cannot therefore
guarantee continued performance either to published specification or compliance with international
standards.
33-927S
III
PREFACE
OPERATING CONDITIONS
WARNING:
This equipment must not be used in conditions of condensing humidity.
Humidity
COPYRIGHT NOTICE
Feedback Instruments Limited
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or
transmitted, in any form or by any means, electronic, mechanical, photocopying, recording or
otherwise, without the prior permission of Feedback Instruments Limited.
ACKNOWLEDGEMENTS
Feedback Instruments Ltd acknowledge all trademarks.
MATLAB is a registered trademark of Mathworks Inc.
IBM, IBM - PC are registered trademarks of International Business Machines.
MICROSOFT, WINDOWS XP, WINDOWS 2000, WINDOWS ME, WINDOWS NT, WINDOWS 98, WINDOWS 95
and Internet Explorer are registered trademarks of Microsoft Corporation.
33-927S
IV
TABLE OF CONTENTS
Table of Contents
Manual overview ..................................................................................................... 1
Introduction ............................................................................................................. 2
Precision Modular Servo set description .............................................................. 3
DC Motor model ...................................................................................................... 5
Exercise 1 Model testing....................................................................... 8
33-927S
33-927S
VI
MANUAL OVERVIEW
Manual overview
The following manual refers to the Feedback Instruments Precision Modular Servo
Control application. It serves as a guide for the control tasks and provides useful
information about the physical behaviour of the system. A linear model is proposed
then identification algorithms are introduced. The models obtained are compared with
the phenomenological model and the Modular Servo setup. Control algorithms are
developed, tested on the Modular Servo models and then implemented in a real time
application.
Throughout the manual various exercises are proposed to bring the user closer to the
Modular Servo control problem. Depending on the knowledge level of the user some
of the sections and exercises can be skipped. The more advanced users can try to
model, identify and control the Modular Servo on their own from the beginning.
The relative difficulty of each exercise is indicated using the following icons:
easy level,
medium level,
expert level.
33-927S
INTRODUCTION
Introduction
The Precision Modular Servo (PMS) workshop serves as a model of a very popular
device, the DC Servo Motor. This is often used in robotic applications. The word
servo comes from the Latin word servus meaning servant or slave. Thus the servo
motor is intended to react to a given command, for example a desired position or
velocity. In order for the motor to be called a servo motor it has to be equipped with a
velocity and position measurement unit and motor driver. It may also include a simple
servo motor controller.
The main features distinguishing servo motors from normal motors are:
The PMS unit allows for the design of different servo motor controllers and to test
them in real time using the Matlab and Simulink environment.
33-927S
Apart from the mechanical units, the electrical units play an important role for motor
control. They allow measured signals to be transferred to the PC via an I/O card. The
amplifiers are used to transfer control signals from the PC to the DC Motor. The
mechanical and electrical units provide a complete control system setup presented in
Figure 2.
33-927S
In order to design any control algorithms one must first understand the physical
background behind the process and carry out identification experiments. The next
section explains the modelling process of the PMS.
33-927S
DC MOTOR MODEL
DC Motor model
Every control project starts with plant modelling, so as much information as possible
is given about the process itself. The mechanical-electrical model of the servo motor
is presented in Figure 3.
Usually, phenomenological models are nonlinear, that means at least one of the
states (i current, motor position) is an argument of a nonlinear function. In order
to present such a model as a transfer function (a form of linear plant dynamics
representation used in control engineering), it has to be linearised. However for the
DC motor model, nonlinearities are so small that they can be neglected.
According to the electrical-mechanical diagram presented in Figure 3 the linear
model equations can be derived.
33-927S
DC MOTOR MODEL
= Kt i
(1)
where Kt is the torque constant. The induced electromotive force, vemf, is a voltage
proportional to the angular shaft velocity & :
vemf = K b &
(2)
J&& = i = d& + K t i
(3)
u vemf = L
di
+ R i
dt
(4)
where u is the control signal. Including equation (2) transforms (4) into:
u = L
di
+ R i + K b &
dt
(5)
Equations (3) and (5) constitute the 2 main differential equations. Their
transformation leads to state space form:
d & Kt
&&
(6)
= J + J i,
di = R i K b & + 1 u
dt
L
L
L
d
d & J
=
dt i K b
L
&
y = [1 0] .
i
Kt
& 0
J + 1 u,
R
i L
L
(7)
For angular velocity & notation simplification we may use , where = & .
33-927S
DC MOTOR MODEL
To complete the model given by motion equations (6) and (7), we must introduce the
value of all parameters. The motor used for the experiments is a 24V DC brushed
motor with a no-load speed of 4050rpm. The following table gives the values of the
motor parameters supplied by the manufacturer:
Table 1. DC Motor parameters
The difference between these two models is trivial. Since the velocity = & is the
derivative of the position and we have the velocity as an output in the model
described by (6) and (7), we can integrate it to acquire the position .
33-927S
DC MOTOR MODEL
DC MOTOR MODEL
Figure 5 Start menu
Matlab will run and the Simulink model menu will open (Figure 6). This contains
links to the simulation-only models (Modular Servo Simulation Models), the
real-time models (Modular Servo Real-Time Models) and the manual
documents.
33-927S
Double click on the Modular Servo Simulation Models block in the main menu.
A sub-menu containing all of the simulation-only models will open (Figure 7).
33-927S
DC MOTOR MODEL
33-927S
10
More information about these structures can be obtained during the System Identification
courses.
2
These are the basics of the Digital Signal Processing course. For more insight the user is
asked to study more on signal processing and digital control.
33-927S
11
holds very broad frequency content thus the whole dynamics of the
plant can be identified. If the dynamics are not too complex several
sinusoids with different frequencies can be summed to produce a
satisfactory excitation signal.
Identification method usually two methods are used, the Least Mean
Square (LMS) method and the Instrumental Variable method. The LMS
method is the most popular and is implemented in Matlab. This method
minimizes the error between the model and the plant output. The
optimal model parameters, for which the square of the error is minimal
is the result of the identification.
33-927S
12
Open the PMSFriction.mdl and run the application (if it is the first time you are
running a real time application refer to the Installation & Commissioning
manual for guidance). This model slowly increases the drive signal to the motor
until static friction is overcome and the motor just starts to move, then records
the voltage offset value. It then repeats in the opposite direction. Record the
values of the voltage offsets for positive and negative movement. These are the
values that have to be inserted in the Friction compensation block (Figure 9,
Figure 10) placed in the Feedback DAC block in every application. However if
the result of the test is significantly greater than 0.2V it may appear to be
biased by other nonlinearities and should be investigated further. You should
try to adjust the mechanical setup to reduce the friction forces.
Figure 10 Friction compensation block menu (double click the block to open)
33-927S
13
Model 1 identification
The following exercise includes all of the above facts and provides an identification
experiment, which results in a discrete model of the DC Motor. The first model to be
identified describes the relation between the control voltage u and the angular
velocity of the DC motor, = & .
Exercise 3 Model 1 identification
Introduction
All of the control real time simulations are carried out with a sampling time of
Ts = 0.001 [s] therefore the same sampling time is used with the identification
experiments to provide full compatibility. For the identification the Matlab
System Identification Toolbox is used.
The identification experiment is carried out using the model called
VelocityModel_Ident.mdl. This model excites the motor system and records its
response. The excitation signal is composed of several sinusoids. The
experiment lasts 20 seconds and two signals are collected in the form of
vectors and are available in the Workspace.
Task
Before running the model adjust the zero set pot on the PA150C Pre-amplifier
very carefully so that the motor is not turning and the pot is in the middle of the
adjustment range over which the motor does not turn.
Carry out the identification experiment and collect the data. Identify a discrete
model using the Matlab identification interface (type ident at the command line
- the identification interface will open as in Figure 9).
For instructions on identification experiments refer to the Matlab Guide
manual.
Example results and comments
The step response of the identified system should be similar to the one
presented in Figure 11 but there will be significant differences because the
basic motor model does not take into account the properties of the real system
such as the loading effect of the gearbox, tachometer, output potentiometer etc.
If the model is transferred into the Matlab Workspace it can be compared
against the discrete equivalent of the continuous transfer function. In order to
33-927S
14
obtain the discrete form use the c2d command. Make sure you specify the
proper sampling time.
Compare the step responses or bode plots of the two systems (use the step
and bode commands). You can also transform the discrete models into their
continuous equivalent with the means of d2c command.
The model obtained is used in the first PID control exercise.
Model 2 identification
A similar identification experiment can be carried out when identifying the transfer
function between the control voltage u and the rotor position/angle .
Exercise 4 Model 2 identification
Introduction
This identification experiment is carried out with the PositionModel_Ident.mdl.
The excitation signal is composed of several sinusoids. The experiment lasts
20 seconds and two signals are collected in a form of vectors and are available
in the Matlab Workspace.
33-927S
15
Task
Carry out the identification experiment and collect the data. Use the Matlab
identification interface to identify a discrete model. For simplicity assign the
input and output data to the u and y vectors:
u = simout(:,1); y = simout(:,2);
Upload the signals for the identification from the Workspace. Make sure you
specify the proper sampling time (1ms). Select the proper structure of the
model (e.g. OE 2 2 1). Press estimate. You can check the quality of the
response of the identified model by the step response analysis, transient
response, pole and zeros map, frequency response and model residuals.
Example results and comments
The response of the model is presented in Figure 12. If the model is transferred
into the Workspace it can be compared against the discrete equivalent of the
continuous system (equations 6 and 7). In order to obtain the discrete form use
the c2d command. Make sure you specify the proper sampling time.
Note that the models you obtain may strongly depend on the magnetic brake
position, which simulates different load. Every time you change the magnet
position the model should be updated.
33-927S
16
position control,
velocity control,
control under different load conditions.
Each of these control problems has its own characteristic. For position control the
steady state control signal value should be 0 whereas for the velocity control in
steady state the control signal should be constant. Different loads will require some
kind of an adaptive control solution.
Matlab provides various analysis methods for linear systems as far as dynamics are
concerned (root locus, frequency analysis tools Bode diagrams, Nyquist plots, pole
and zero maps etc.). With the information that Matlab provides about the dynamics of
the system, controllers can be designed. The following sections explain how the PID
controller works, and how it can be tuned.
Plant control
There are numerous control algorithms however the PID control is the most popular
because of its simplicity. A general schematic of a simple control closed loop system
is presented in Figure 13.
C(s)
G(s)
Assuming that the plant is represented by its linear model its transfer function can be
described as:
G (s) =
33-927S
B( s )
A( s )
(8)
17
where s is the Laplace operator. The idea of control algorithms is to find such a
controller (transfer function, discrete transfer function, any nonlinear), which will fulfil
our requirements (certain dynamic response, certain frequency damping, good
response to the dynamic changes of the desired value etc.). Every controllers input
is the e(t) error signal. Sometimes disturbance signals are also measured.
Depending on the present and past values of the error signal, the controller performs
such an action (changes the u(t) control signal) that the y(t) is as close to the ydesired(t)
value as possible at all times.
There are a lot of controller design and tuning methods. All of them consider the
behaviour of the closed loop system (plant with a controller Figure 13) and provide
controller parameters according to the assumed system characteristics. With the
known plant transfer function G(s) it is possible to find satisfactory parameters of the
C(s) controller such that the closed loop system will have the desired characteristics
described by the transfer function Tc(s):
Tc ( s ) =
C (s ) G (s)
1 + C ( s) G(s )
(9)
PID controller
A PID controller consists of 3 blocks: Proportional, Integral and Derivative. The
equation governing the PID controller is as follows:
de(t )
dt
e(t ) = ydesired (t ) y (t )
(10)
(11)
With the means of the Laplace transform such a structure can be represented as a
transfer function:
I
+ D s) E (s )
s
U (s)
I
Ds 2 + Ps + I
C ( s) =
= ( P + + D s) =
E (s)
s
s
U (s) = ( P +
(12)
(13)
Each of the PID controller blocks (P, I and D) plays an important role. However for
some applications, the Integral or Derivative part has to be excluded to give
satisfactory results. The Proportional block is mostly responsible for the speed of the
system reaction. However for oscillatory plants it might increase the oscillations if the
value of P is set to be too large.
33-927S
18
The Integral part is very important and assures zero error value in the steady state,
which means that the output will be exactly what we want it to be. Nevertheless the
Integral action of the controller causes the system to respond slower to the desired
value changes and for systems were very fast reaction is very important it has to be
omitted. Certain nonlinearities will also cause problems for the integration action.
The Derivative part has been introduced to make the response faster. However it is
very sensitive to noise and may cause the system to react very nervously. Thus very
often it is omitted in the controller design. Derivative part output filtering may reduce
the nervous reaction but also slows the response of the controller down and
sometimes undermines the sense of using the Derivative part at all. Proper filtering
can help to reduce the high frequency noise without degrading the control system
performance in the lower frequency band.
There are several PID tuning techniques. Most often Ziegler-Nichols rules are used
or a relay experiment is undertaken. Very often the closed loop system roots are
analysed and set in the desired position by proper choice of P, I and D values.
Matlab delivers a root locus tool, which helps in such designs. To gain an
understanding of root locus controller design and its effects on the system, a motor
velocity control exercise is proposed.
33-927S
19
G1 ( s ) =
(s)
u ( s)
K add K t
,
JL s + ( JR + dL) s + dR + K b K t
2
(14)
33-927S
20
You can move the poles, zeros and the gain to obtain for example faster step
response of the closed loop system. Then you can export the controller into
Workspace and test it on the model (equation 14) of the DC Motor with
Model_PID_velocity.mdl or on the model that you have identified.
Use a sinusoidal signal for the set value of the motor velocity desired(t). Change
the frequency and see how the output follows the desired value. Decrease and
increase the values of the proportional, integral and derivative gains in the PID
controller. See how that influences the tracking of the desired value. You
should observe the influence that is described in the beginning of this section:
the I part assures zero steady state error but slows the system reaction, the D
part makes the system faster but causes the controller to behave nervously
observe the controller output.
The controller that has been obtained in the above exercise can be tested on the
PMS setup. The following exercise will guide you through it.
Exercise 6 Real time PID control of motor velocity
Introduction
Just as in exercise 5 the motor velocity will be controlled. This time it will be
tested in real time. For this exercise use the PMS_PID_velocity.mdl presented
in Figure 15.
33-927S
21
As you open the PMS_PID_velocity.mdl you will notice that this simulation is
directed to an external module, which is indicated in the upper part of the
simulation window. The PID controller has been already designed, however
you can change its parameters according to the results obtained in exercise 5.
Before you run the real time simulation make sure the PMS setup is properly
connected and that the Power Source is turned off. Refer to the Installation &
Commissioning manual for more instructions on real time simulations.
Task
The task is to change the sinusoidal desired(t) signal frequency and see how the
cart reacts to it. Change the controller P, I and D values to see how the signal
desired(t) is tracked by the system output. Experiment with the position of the
magnetic brake.
Make sure the changes of the P, I and D gains will not have a destructive effect
on the DC Motor. You should already gain some experience in exercise 5 on
how the values of these gains can be changed.
Example results and comments
Figure 16 and Figure 17 present real time simulation results of the velocity PID
control. Two I and D gain values have been selected. The simulation shows
that the I value increase may slow the system down and cause a larger
overshoot. You should also notice that the bigger the D value the faster the
response but the more nervous the control signal u. Very energetic control
signal changes can often lead to control unit brake down.
33-927S
22
The result presented in Figure 16 proves how efficient controllers can be when
an identification experiment is incorporated in their design. Even load variation
has little influence on the control system performance. Figure 17 shows how
wrong controller tuning may degrade the system performance.
Figure 17 Real time control simulation results, with greater I gain and smaller P gain
33-927S
23
Just like every other actuator, the DC motor has its limits as far as the control signal
and output variable value is concerned. Figure 18 and Figure 19 show what happens
whenever excessive angular velocity value is demanded under PID control. The
saturation effect can be easily achieved with the aid of the magnetic load. It is
explained in detail in the following section.
33-927S
24
measure the control signal saturation value (it is given as 2.5 V for PMS)
put a saturation block with the appropriate saturation values after the output
of the PID controller
subtract the saturation block output value from its input
multiply that signal by a gain (AWgain) and subtract it from the integration
block input error
33-927S
25
33-927S
26
Without the anti-windup the controller has to compensate for the error integration
before it switches to the next desired velocity value. Areas A and B are the same
so one can actually tell how long the controller will need to compensate for the error
integration during saturation.
33-927S
27
33-927S
28
G1 ( s ) =
(s)
u ( s)
K add K t
JL s + ( JR + dL) s + dR + K b K t
2
where
G1 ( s ) =
= &,
(s) s ( s)
=
,
u (s)
K add K t
( s) G1 ( s)
G2 ( s) =
=
=
.
3
u ( s)
s
JL s + ( JR + dL) s 2 + (dR + K b K t ) s
u( s)
(15)
G2 ( s) =
( s)
u (s)
Kt
JL s + ( JR + dL) s 2 + (dR + K b K t ) s
3
which means that our goal will be to follow a certain rotor position/angle
desired(t) profile.
Task
Design a PID controller for the above transfer function. Input the transfer
function in Matlab using the tf command. You may also use the model that you
have identified. The discrete model obtained in the PMS Model Identification
33-927S
29
You can move the poles, zeros and the gain to obtain, for example, faster step
response of the closed loop system. Then you can export the controller into
Workspace and test it on the model (equation 15) of the DC Motor with
Model_PID_position.mdl or on the model that you have identified.
33-927S
30
The controller that has been obtained in the above exercise can be tested on the
PMS setup. The following exercise will guide you through it.
33-927S
31
33-927S
32
33-927S
33
In order to get a full insight of Adaptive Control the user is advised to refer to publications on
that topic or attend a suitable course.
33-927S
34
Of course a fully automatic gain scheduling algorithm should perform the gain
changing on its own depending on the value of the disturbance variable. Due to the
fact that such a measurement is not available we can only test a manual version of
the gain scheduling algorithm.
Exercise 12 Gain scheduling
Introduction
As Figure 24 shows the system performance has degraded when the magnet
was lowered. The reason for that is the change of plant dynamics. With the
load applied the controller designed for the zero load conditions is
underperforming. By changing its gain according to the magnet position its
performance can be improved.
Task
According to the steps presented above, design a position tracking and gain
scheduling algorithm and test it on the DC motor. Carry out the position model
identification experiment under full load conditions. Use the model and the
previously designed controller and change its gain for optimal performance.
The gain scheduling has already been implemented for you in the
PMS_GainScheduling.mdl. A manual switch is provided which doubles the P
gain when set to position P2. Double click the switch to change its position.
33-927S
35
Run the model and investigate the controller performance when the load is
applied with and without the extra P gain.
Example results and comments
As a result of the identification experiment a new model is obtained under full
load conditions. Using the Matlab rltool an observation can be made that
doubling the P gain to a value of P=0.0714 ensures a similar step response
under full load conditions to that achieved by the original position controller
under no load conditions. Figure 25 shows example results using the
PMS_GainScheduling.mdl model with gain scheduling. After 25 seconds the
magnet is lowered and the controller gain is doubled by changing the position
of the Manual Switch. The performance of the gain scheduling controller is
compared with the fixed gain controller in Figure 26. Although the experiments
are not identical the difference in performance can clearly be seen.
33-927S
36
If gain scheduling is not applied at the moment the magnet is lowered the
performance of the control system deteriorates. Changing the P gain clearly
improves the performance.
33-927S
37