Sie sind auf Seite 1von 43

PRECISION MODULAR SERVO

Control Experiments

Precision Modular Servo


Control Experiments
33-927S
(For use with MATLAB
R2006b version 7.3)

CONFIDENTIAL

Feedback Instruments Ltd., Park Road, Crowborough, East Sussex, TN6 2QR, UK
Telephone: +44 (0) 1892 653322, Fax: +44 (0) 1892 663719
E-mail: feedback@feedback-instruments.com, Website: www.feedback-instruments.com
Manual: 33-927S Ed01 122006
Feedback Part No. 1160-33927S

33-927S

PRECISION MODULAR SERVO


Control Experiments

33-927S

II

PRECISION MODULAR SERVO


Control Experiments

PREFACE

THE HEALTH AND SAFETY AT WORK ACT 1974


We are required under the Health and Safety at Work Act 1974, to make available to users of this
equipment certain information regarding its safe use.
The equipment, when used in normal or prescribed applications within the parameters set for its
mechanical and electrical performance, should not cause any danger or hazard to health or safety if
normal engineering practices are observed and they are used in accordance with the instructions
supplied.
If, in specific cases, circumstances exist in which a potential hazard may be brought about by careless
or improper use, these will be pointed out and the necessary precautions emphasised.
While we provide the fullest possible user information relating to the proper use of this equipment, if
there is any doubt whatsoever about any aspect, the user should contact the Product Safety Officer at
Feedback Instruments Limited, Crowborough.
This equipment should not be used by inexperienced users unless they are under supervision.
We are required by European Directives to indicate on our equipment panels certain areas and
warnings that require attention by the user. These have been indicated in the specified way by yellow
labels with black printing, the meaning of any labels that may be fixed to the instrument are shown
below:

CAUTION RISK OF
DANGER

CAUTION RISK OF
ELECTRIC SHOCK

CAUTION ELECTROSTATIC
SENSITIVE DEVICE

Refer to accompanying documents

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

4. Equipment serial number

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

PRECISION MODULAR SERVO


Control Experiments

PREFACE

OPERATING CONDITIONS
WARNING:
This equipment must not be used in conditions of condensing humidity.

This equipment is designed to operate under the following conditions:


Operating Temperature

10C to 40C (50F to 104F)

Humidity

10% to 90% (non-condensing)

DECLARATION CONCERNING ELECTROMAGNETIC


COMPATIBILITY
Should this equipment be used outside the classroom, laboratory study area or similar such place for
which it is designed and sold then Feedback Instruments Ltd hereby states that conformity with the
protection requirements of the European Community Electromagnetic Compatibility Directive
(89/336/EEC) may be invalidated and could lead to prosecution.
This equipment, when operated in accordance with the supplied documentation, does not cause
electromagnetic disturbance outside its immediate electromagnetic environment.

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

PRECISION MODULAR SERVO


Control Experiments

Table of Contents
Manual overview ..................................................................................................... 1
Introduction ............................................................................................................. 2
Precision Modular Servo set description .............................................................. 3
DC Motor model ...................................................................................................... 5
Exercise 1 Model testing....................................................................... 8

PMS model identification ...................................................................................... 11


Static friction compensation ................................................................................. 12
Exercise 2 Static friction compensation ................................................... 12

Model 1 identification ........................................................................................... 14


Exercise 3 Model 1 identification ........................................................... 14

Model 2 identification ........................................................................................... 15


Exercise 4 Model 2 identification ........................................................... 15

PMS setup control ................................................................................................. 17


Plant control ........................................................................................................ 17
PID controller ...................................................................................................... 18
PMS velocity control ............................................................................................ 19
Exercise 5 PID control of motor velocity .................................................. 19
Exercise 6 Real time PID control of motor velocity ..................................... 21

Control signal saturation ...................................................................................... 25


Exercise 7 Anti-windup design .............................................................. 26
Exercise 8 Anti-windup for PMS ............................................................. 28

PMS position control ........................................................................................... 29


Exercise 9 PID control of motor position .................................................. 29
Exercise 10 Real time PID control of motor position .................................... 31
Exercise 11 Position tracking ................................................................ 33

PMS control under variable load conditions ......................................................... 34


Simple gain scheduling algorithm ..................................................................... 35
Exercise 12 Gain scheduling ................................................................. 35

33-927S

PRECISION MODULAR SERVO


Control Experiments

33-927S

VI

PRECISION MODULAR SERVO


Control Experiments

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.

If any of the identification or controller design exercises appear to be too difficult or


the results are not satisfactory you may go straight to the examples that are supplied
and test them by changing the parameters of the controllers.

33-927S

INTRODUCTION

PRECISION MODULAR SERVO


Control Experiments

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:





minimized rotor inertia,


minimized armature inductance,
improved withstand voltage and magnet saturation,
designed to withstand sudden acceleration and high frequency operation.

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

PRECISION MODULAR SERVO SET DESCRIPTION

PRECISION MODULAR SERVO


Control Experiments

Precision Modular Servo set description


The description of the PMS setup in this section refers mostly to the mechanical part
and the control aspect. For details of the mechanical and electrical connection, the
interface and an explanation of how the signals are measured and transferred to the
PC, refer to the Installation & Commissioning manual.
As shown in Figure 1, the PMS mechanical unit consists of a DC Motor,
Tachometer/Gearbox, Digital Encoder, Input and Output Potentiometers and
Magnetic Brake.

Figure 1 Precision Modular Servo mechanical unit

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

PRECISION MODULAR SERVO SET DESCRIPTION

PRECISION MODULAR SERVO


Control Experiments

Figure 2 PMS control system

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

PRECISION MODULAR SERVO


Control Experiments

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.

Figure 3 DC motor phenomenological model

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

PRECISION MODULAR SERVO


Control Experiments

DC MOTOR MODEL

The torque generated by the DC motor is proportional to the motor current i:

= 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)

where Kb is a motor property dependant constant related to physical properties of the


motor. Using Newtons law the mechanical dynamics can be described by:

J&& = i = d& + K t i

(3)

where d is a linear approximation of the viscous friction.


The equations governing the behaviour of the electrical model are:

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

PRECISION MODULAR SERVO


Control Experiments

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 bound for the control signal is set to [2.5V .. +2.5V].


The DC motor is a SISO plant single input single output (Figure 4). However the
output choice of the model changes depending on the control scheme we use
(velocity or position control).

Figure 4 DC Motor models for velocity and position control

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

PRECISION MODULAR SERVO


Control Experiments

DC MOTOR MODEL

Exercise 1 Model testing


Introduction
For the initial exercise the user has been provided with the DC Motor model
described by equations (6). The model can be opened in Simulink DCmotor_ManModel.mdl. As you will see in the later exercises, the basic DC
Motor model responds differently from the actual motor when it is used within
the PMS. This is because of the dynamics of the additional mechanical and
electrical PMS components that are not included in the basic model. However
these differences can easily be detected during the course of identification.
One can also modify the phenomenological model by adding gain or by certain
parameter tuning. Such modifications are implemented in the model called
DCmotor_TunModel.mdl. An amplification is added thus the PMS model is
created and controlled with the signal of 2.5 [V] amplitude in Simulink just as
the real plant is and responds similarly to the real plant.
Load Matlab and the menu system using the Windows Start menu (Figure 5).

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

PRECISION MODULAR SERVO


Control Experiments

Figure 6 Simulink model menu

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).

Figure 7 Simulation models menu

33-927S

PRECISION MODULAR SERVO


Control Experiments

DC MOTOR MODEL

Double click the required model DCmotor_ManModel.mdl. The Simulink model


window will open.
Task
To begin with the user is advised to check the responses of the DC motor
model alone (DCmotor_ManModel.mdl) with zero, constant and sinusoidal
voltages applied (u). Try applying 24V and observe the motor runs at full speed
(approximately 4000rpm). You may change the values of the parameters to see
how the response varies. Try changing the moment of inertia value J (double
click on the motor block to change its parameters).
The tuned model (DCmotor_TunModel.mdl) includes an extra gain term that
models the gain provided by the PA150 preamplifier and SA150 Servo
Amplifier. This model can be run with a 2.5 [V] control signal amplitude (as
used by Simulink to drive the DAC output), which corresponds to the 24 [V]
amplitude signal applied to the motor.
Example results and comments
Figure 8 presents voltage step responses for the tuned PMS model with
minimum load.

Figure 8 Tuned PMS model results

33-927S

10

PMS MODEL IDENTIFICATION

PRECISION MODULAR SERVO


Control Experiments

PMS model identification


As mentioned in the previous section where the phenomenological model was
derived, two control aspects are taken into account: position control or velocity
control. Thus two plant models can be identified, one for which the rotor velocity will
be the output and another for which the rotor position is the output. Both of them
should only differ by an extra integration action in the model relating the control
voltage u and the rotor position. These models will be used for controller design and
tests in the Precision Modular Servo Control section.
There are a few important things that the control system designer has to keep in
mind when carrying out an identification experiment:


Stability problem if the plant that is identified is unstable, the


identification has to be carried out with a working controller, which
introduces additional problems that will be discussed further on. If the
plant is stable and does not have to work with a controller the
identification is much simpler.
Structure choice a very important aspect of the identification. For
linear models it comes down to choice of the numerator and
denominator order of the transfer function. It applies both for continuous
and discrete systems.
As far as the discrete models are concerned the structures are also
divided in terms of the error term description: ARX, ARMAX, OE, BJ1.
Sampling time the sampling time choice is important both for
identification and control. It cannot be too short nor can it be too long.
Too short sampling time might influence the identification quality
because of the quantisation effect introduced by the AD. Furthermore
the shorter the sampling time the faster the software and hardware has
to be and more memory is needed. However short sampling time will
allow for elimination of aliasing effects and thus anti aliasing filters2 will
not have to be introduced. Long sampling times will not allow for
including all of the dynamics.
Excitation signal for the linear models the excitation choice is simple.
Very often designers use white noise however in industrial applications
it is often disallowed. It is attractive however because of the fact that it

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

PMS MODEL IDENTIFICATION

PRECISION MODULAR SERVO


Control Experiments

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.

Static friction compensation


Before any of the identification and control experiments are carried out we need to
compensate the static friction (stiction) as best as possible. The problem with static
friction compensation is that when it is applied at the instant of start-up it
compensates well, but then provides too large an offset value when the DC Motor is
turning and the friction forces are smaller. Furthermore it is strongly dependant on
the position of the Zero Set potentiometer on the PA150C preamplifier unit.
However to keep it simple, only a voltage offset will be added to the control signal to
provide compensation and further nonlinear effects as friction will be dealt with by the
controller. Friction is influenced by the mechanical setup of the PMS system, thus
every time you change its mechanical properties the friction compensation should be
repeated.
Exercise 2 Static friction compensation
Introduction
In order to define the voltage offset values that need to be applied a friction
application has been designed PMSFriction.mdl.
Task
To get the best results from this test, connect a DVM across the Pre-amp
PA150C output terminals 2 and 3 and finally adjust the zero set pot until the
output is zero. If a DVM is not available, adjust the zero set pot 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.

33-927S

12

PMS MODEL IDENTIFICATION

PRECISION MODULAR SERVO


Control Experiments

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 9 Friction compensation block

Figure 10 Friction compensation block menu (double click the block to open)

Example results and comments


Depending on the mechanical setup of the PMS you can obtain different values
of the voltage offsets for each direction of rotation in the automatic friction
detection procedure, for example offn = 0.015 [V] for negative direction and offp
= 0.010 [V] for positive direction.

33-927S

13

PMS MODEL IDENTIFICATION

PRECISION MODULAR SERVO


Control Experiments

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

PMS MODEL IDENTIFICATION

PRECISION MODULAR SERVO


Control Experiments

obtain the discrete form use the c2d command. Make sure you specify the
proper sampling time.

Figure 11 Step response of the model

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

PRECISION MODULAR SERVO


Control Experiments

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.

Figure 12 Identified model step response

33-927S

16

PRECISION MODULAR SERVO


Control Experiments

PMS SETUP CONTROL

PMS setup control


The PMS control aspect covers three main control areas:




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)

Figure 13 Simple control system closed loop

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

PRECISION MODULAR SERVO


Control Experiments

PMS SETUP CONTROL

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:

u (t ) = P e(t ) + I e(t )dt + D

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

PMS SETUP CONTROL

PRECISION MODULAR SERVO


Control Experiments

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.

PMS velocity control


As a first control task, velocity control of the PMS is chosen. The following exercises
will guide you through the controller design, testing on the model and on the real time
application.
Exercise 5 PID control of motor velocity
Introduction
To design a PID controller a model of the plant is needed. For this purpose we
can use a discrete model and design a discrete PID controller, or use a
continuous model (equations 6 and 7) and design a continuous PID controller,
however when a controller is implemented on some kind of a control unit it has
to be used in a discrete form.
For the beginning the linear continuous model of the DC motor will be used:

33-927S

19

PRECISION MODULAR SERVO


Control Experiments

PMS SETUP CONTROL

G1 ( s ) =

(s)
u ( s)

K add K t
,
JL s + ( JR + dL) s + dR + K b K t
2

(14)

where Kadd is the additional gain value introduced by the amplifiers.


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 PMS Model Identification
section can be transformed into a continuous model before the controller
design.
For instructions on PID controller design refer to the Matlab Guide
manual.
The first controller tests have to be done on the models. The file
Model_PID_velocity.mdl has been created for the test purpose.
Example results and comments
The root locus of the identified model with the PID control with P = 0.00124,
I =0.0241, D = 0 is presented in Figure 14.

Figure 14 Root locus with PID controller

33-927S

20

PRECISION MODULAR SERVO


Control Experiments

PMS SETUP CONTROL

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.

Figure 15 Real time PMS velocity control

33-927S

21

PMS SETUP CONTROL

PRECISION MODULAR SERVO


Control Experiments

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

PMS SETUP CONTROL

PRECISION MODULAR SERVO


Control Experiments

Figure 16 PID control with P = 0.0012, I =0.0241, D =0

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

PMS SETUP CONTROL

PRECISION MODULAR SERVO


Control Experiments

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.

Figure 18 Control signal saturation, motor velocity

Figure 19 Control signal saturation, controller output

33-927S

24

PMS SETUP CONTROL

PRECISION MODULAR SERVO


Control Experiments

Control signal saturation


Every plant and actuator has its limits. As far as the PMS is concerned anything
above +2.5 [V] or 2.5 [V] will be limited to the boundary value. This control signal
bound is transferred to the maximal angular velocity value that can be reached under
different load values. The greater the load, the lower the maximum achievable
angular velocity. One could identify a static characteristic of the motor for different
loads to get the full picture of the achievable output variable values for the PMS.
The saturation itself is not that troublesome but together with PID control and
especially the integration of the error signal, it can cause big trouble. Of course
nothing can be done as far as the control algorithms are concerned to overcome the
problem of angular velocity bounds. But one must make sure that whenever the
bound is crossed the integration action is turned off. If it is not, the controller will
integrate the error and will be continuously increasing the value of the control signal
(windup effect), even though the system cannot respond due to the saturation.
Whenever that happens and the desired velocity value is later changed back to the
permissible value, because of the previous error integration, it will take some time
until the integrated value is reduced by the opposite sign error value. This will result
in an observable control signal switch delay, the length of which depends on how
long the windup effect lasts.
To overcome this problem anti-windup circuits are designed so that fast controller
reaction is ensured. There are several methods to design them. The following steps
lead to the design of one of the simplest methods:





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

The anti-windup can be tested on a DC motor model in AntiW_model.mdl.

33-927S

25

PRECISION MODULAR SERVO


Control Experiments

PMS SETUP CONTROL

Exercise 7 Anti-windup design


Introduction
A linear continuous model of the DC motor will be used for the anti-windup test.
You can use a model to design that algorithm on your own or use the
AntiW_model.mdl for tests and analysis. The desired value of angular velocity
is first switched to a value exceeding the limit and then it is reduced to a
permissible value.
Task
Check the anti-windup algorithm. Change the AWgain value and observe the
system reaction. Use large, small and zero values to see how fast the controller
switches the control signal when returning to the permissible angular velocity
desired value range.
Example results and comments
The following figures (Figure 20) present the results for three situations, where
the anti-windup is switched off, for AWgain = 50 (medium value) and for
AWgain = 1000 (high value). Observe the value of the output to see how the
anti-windup improves the system performance.

Figure 20 Anti-windup performance

33-927S

26

PMS SETUP CONTROL

PRECISION MODULAR SERVO


Control Experiments

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

PRECISION MODULAR SERVO


Control Experiments

PMS SETUP CONTROL

Exercise 8 Anti-windup for PMS


Introduction
This time the anti-windup algorithm will be tested on the real plant and under
full load conditions. Use the AntiW_PMS.mdl for tests and analysis on the PMS
setup. Before the experiment is started you can check the maximum angular
velocity for the boundary voltage value of 2.5 [V] with the
PMS_PID_velocity.mdl. Remember to lower the magnet before any
experiments are run.
Task
Check the anti-windup algorithm. Change the AWgain value and observe the
system reaction. Use large, small and zero values to see how fast the controller
switches the control signal when returning to the permissible angular velocity
desired value range.
Example results and comments
Figure 21 presents the results for two situations, where the anti-windup is
switched off and on. Observe the value of the output to see how the antiwindup improves the system performance.

Figure 21 Anti-windup for PMS

33-927S

28

PRECISION MODULAR SERVO


Control Experiments

PMS SETUP CONTROL

PMS position control


The position control task is similar to velocity control however there is one significant
difference: the position control model has an additional integration action.
To acquire a model suitable for position control we can use the model prepared for
velocity control and simply transform it:

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)

where Kadd is the additional gain value introduced by the amplifiers.


For position control you can use a discrete model acquired in the identification task of
Model 2 and transform it to continuous form through the d2c function. The position
controller is designed in a similar way to that shown in the velocity control exercise.
Exercise 9 PID control of motor position
Introduction
A linear continuous model of the DC motor will be used:

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

PMS SETUP CONTROL

PRECISION MODULAR SERVO


Control Experiments

section can be transformed into a continuous model before the controller


design.
Open the root locus tool. Just as in the previous exercise, design a PID
controller. Observe how the closed loop system step response changes when
you move the poles and zeros and change the gain of the controller.
Position controller tests can be carried out on the models. The file called
Model_PID_position.mdl has been created for the purpose of the test.
Example results and comments
The root locus of the identified model using PID control with P = 0.0357,
I =0.00714, D = 0 is presented in Figure 22.

Figure 22 Root locus with PID controller

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

PMS SETUP CONTROL

PRECISION MODULAR SERVO


Control Experiments

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 10 Real time PID control of motor position


Introduction
Just as in exercise 9 the motor position will be controlled. This time it will be
tested in real time. For this exercise use the PMS_PID_position.mdl.
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
motor reacts to it. Change the controller P, I and D values to see how the signal
desired(t) is tracked by the system output.
Make sure the changes of the P, I and D gains will not have a destructive effect
on the DC Motor.
Example results and comments
Figure 23 presents real time simulation results of the position PID control.

33-927S

31

PMS SETUP CONTROL

PRECISION MODULAR SERVO


Control Experiments

Figure 23 PID control with P = 0.0357, I =0.00714, D = 0

33-927S

32

PRECISION MODULAR SERVO


Control Experiments

PMS SETUP CONTROL

Exercise 11 Position tracking


Introduction
The PMS setup IP150H potentiometer can serve as an external set point
signal. Its output is an analogue signal ranging from around 15 [V] to +15 [V].
For the position control application we can read that analogue voltage and
transform this signal into radians where half a turn gives a rotation of and a
corresponding signal of 15 [V]. Furthermore to use the OP150K as a
visualisation of the control system performance we can multiply the IP150H
signal, being the corresponding desired position, by 30 (gearbox ratio). Thus if
the algorithm works well the OP150K will track the movement of the IP150H.
The model PMS_PositionTracking.mdl has been created to test this PMS
feature.
Task
Use the PMS_PositionTracking.mdl to perform the tests. Vary the rate at which
the IP150H is turned to check the dynamic properties of the control system.
Vary the gains to see how the system performs. Use the step/invert switch on
the IP150H to see how the controller reacts.
Example results and comments
Figure 24 presents real time experiment results. The IP150H has been rotated
with different frequencies. The step/invert switch has also been used.

Figure 24 Position tracking

33-927S

33

PMS SETUP CONTROL

PRECISION MODULAR SERVO


Control Experiments

PMS control under variable load conditions


Control algorithms are the solution for following a certain path under different types of
disturbances. A variable load could be considered as a disturbance if its change is
relatively small. Thus once designed, a linear controller should be able to handle
small load changes. For best performance, large load variations require some kind of
controller adaptation to the new plant dynamics. If the load varies often we say that
the plant is non-stationary. We could use an advanced adaptive controller to
suppress the effect of load changes, however the nature of a servo motor application
is such that the device is kept in steady state most of the time. With small changes of
the control and output signals the adaptation would have to be frozen not to cause
estimator instability3. With the complexity of adaptive algorithms this could prove to
be a difficult and ineffective solution.
A robust adaptive solution could be utilized with a gain scheduling scheme if the
position of the magnet could be measured. Gain scheduling is a very well known and
often used approach in adaptive control. The idea of gain scheduling is to bound
usually one parameter of the controller (which is designed for the initial condition)
with the parameter determining the character of the disturbance. That initial condition
in the case of DC Motor and load simulation through eddy current could be a
situation when no extra load is applied with the magnet. For this position a linear PID
controller can be designed as in the previous sections. Then the controller design is
repeated with the magnet lowered simulating full load. However only one controller
parameter is changed with respect to the initial condition controller, this usually is the
controller gain. So depending on the angle of the magnet the gain of the controller is
changed according to a certain function, which we have to determine. If angle
information is fed electronically to the control system the gain scheduling is then
automatic. However if such a measurement is not available we can provide it on our
own restricting the magnet position to certain areas. For the beginning two areas
could only be considered: magnet low, magnet high. The performance of such
system will certainly be better comparing with the situation where the gain of the
controller is not changed at all with different load conditions.
We could think of other load estimation methods, which depending on current,
voltage and angular velocity measurement would give an estimate of the load. This
however will not be considered. The following section explains how the design of a
simple gain scheduling algorithm is carried out.
3

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

PMS SETUP CONTROL

PRECISION MODULAR SERVO


Control Experiments

Simple gain scheduling algorithm


The gain scheduling algorithm design can be divided into the following steps:
Design a PID controller for zero load conditions the model identified in the
modelling section.
Carry out an identification experiment to find a model for the full load
condition.
Design a new PID controller for a full load situation (full load model) by
changing only the P gain of the controller that was designed for the zero load
conditions. Try to obtain the same closed loop system response as for the
zero load closed loop system.
Test the performance of the two controllers on the real time DC Motor
application.
Combine two of the controllers into one. Change the P gain of the PID
controller depending on the magnet position.








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

PRECISION MODULAR SERVO


Control Experiments

PMS SETUP CONTROL

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.

Figure 25 Controller with gain scheduling

33-927S

36

PMS SETUP CONTROL

PRECISION MODULAR SERVO


Control Experiments

Figure 26 Controller without gain scheduling

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