Professional Documents
Culture Documents
DC Servo
DC Servo
LABORATORY
INTRODUCTION
1.1
Objective
The aim of this laboratory is to design and implement a DC servo control system. The control
system is to meet a given set of specifications and achieve a rise time which is as fast as possible.
Each student will undertake laboratory preparation which will involve a dry run control system
design using a given nominal transfer function.
In the actual laboratory session, student groups will act as design teams competing with each
other to produce the fastest servo system. First experiments will be undertaken to determine the
actual transfer function of their servo system. Then the design will be carried out using ideas from
the group members preparation. Students can use any design technique which they are familiar
with to produce the controller design. Finally the design will be implemented and its performance
evaluated.
The laboratory including the preparation will be graded out of 100. There will be a prize of
20 bonus marks (up to a maximum of 100) for the group which meets all the specifications and
achieves the shortest rise time. To receive the bonus marks, the design and satisfaction of the
specifications together with the final results must be fully documented.
1.2
Hardware Description
1.3
A DC servo system such as can be found in the control laboratory can be modelled by a transfer
function of the form
a
Y (s)
=
(1.1)
Gam (s) =
X(s)
s(s + b)
where a and b are parameters of the system; see Figure 1.1.
U(s)
Y(s)
(s+b)
Figure 1.1: Transfer Function Model
Before, we can design a controller for the DC servo system, we must estimate the parameters
a and b in the transfer function given in equation (1.1).
A general linear second order system can be described by the transfer function model
Y (s)
n2
= 2
X(s)
s + 2n s + n2
(1.2)
where n is defined as the undamped natural frequency and is the system damping constant.
For a unit step input X(s) = 1/s, taking the inverse Laplace Transform of equation (1.2) yields
the unit step response y(t)
p
p
1 2
en t
1
y(t) = 1 p
sin(n 1 2 t + tan
).
(1.3)
1 2
From equation (1.3), the transient oscillation frequency is
p
t = n 1 2 .
(1.4)
Tt =
The expression for percentage overshoot (PO) is obtained by finding the first time when y(t)
=
0. Using this method, it can be shown that
!
P O = 100exp p
.
1 2
and hence
"
O
)
ln2 ( P100
=
PO
2
ln ( 100 ) + 2
n = p
1 2
# 21
(1.5)
(1.6)
The percentage overshoot and the transient oscillation frequency are both quantities which can be
easily determined from the system step response as shown in Figure 1.2. This figure also indicates
the rise time of the system.
1.5
% overshoot
transient oscillation period
100% 1
Amplitude
90%
0.5
rise time
10%
0
0
5
6
Time (secs)
10
placements
Vi
Kc
Motor/Load
Kpa
Ks
+
-
Power Amp
Potentiometer Gain
4
Vo
Ks
Kc
KP A
=
=
=
Potentiometer Scaling
Controller Gain
Power Amplifier Gain.
In the block diagram shown in Figure 1.3, we now replace the DC servo motor system and its
associated components by the corresponding transfer function. This leads to the block diagram
shown in Figure 1.4. The closed loop transfer function for the system of Figure 1.4 is
Y (s)
Kc a
= 2
.
X(s)
s + bs + Kc a
(1.7)
Equating like coefficients in equations (1.2) and (1.7) provides the following relationships:
Kc a
n2
2n .
(1.8)
The procedure to estimate the a parameter value of the plant transfer function (1.1) is to
determine the undamped natural frequency n and the system damping constant for the closed
loop system in Figure 1.4.
Vi
-
+
6
Kc
a
s(s+b)
X
-
X(s)/V
i (s) =
s+b
where is a scaling constant dependent on the Tachometer gain. The time constant m of this
transfer function is then calculated to be the time required for the output X to reach 62.3% of
its final value. This is illustrated in Figure 1.6. The b parameter is then obtained from the
relationship
1
.
(1.10)
b=
m
5
X
Vi
a
s+b
Step Response
F
Amplitude
0.63F
Time Constant
0
0
Time (sec.)
Figure 1.6: Step Response of Open Loop System
COLOUR CODE
DESCRIPTION
Orange
Yellow
Brown
Brown
Green
.
X
Do not ever connect anything to this red connector (if you have one)
It can be at a high voltage which can damage the dSPACE board.
SYMBOL
COLOUR CODE
DESCRIPTION
Voltage
White
Grey
Red
Yellow
Current
Norm
Zero
Max
ON
OFF
H
M
L
Knob
Knob
The dSPACE system is high performance digital control system based on the TI TMS320C31
DSP processor. It is directly interfaced with MATLAB/SIMULINK running on a PC. A simulink
block diagram is converted to real time C code, cross compiled and downloaded to the DSP board.
Software is also available for controlling the DSP from the PC and plotting variables in real time
in the DSP.
In this laboratory, you will familiarize yourself with some of the capabilities of the dSPACE
system including the implementation of transfer functions and the ability to provide step inputs
and to plot the resulting step responses of the systems under consideration. Each of the four IBM
PCs in the control lab contains a dSPACE ds1102 DSP board. This board can be connected to
the outside world via a connector box.
The first step in using the dSPACE system involves logging on to the PC. You should use the
username student and the password Eleceng1. All of the files that you generate during the
course of the laboratory should be stored in the directory
C:\MATLABR11\work\student
Do not create any other files or directories on the PC. Also, you should remove your files in the
above mentioned directory after the end of the laboratory period. The demonstrator will check
the PCs after the end of the laboratory and if you do not leave the PC in the condition you found
it, all members of your group may lose marks from their final lab grade.
3.1
We now present a case study of using the dSPACE system. The implementation of this case
study is not part of the laboratory but should give you an idea as to how to carry out the actual
laboratory.
In order to use the dSPACE system, you must construct block diagrams on MATLAB/SIMULINK
and run them on your dSPACE board.
After you log onto the PC, run MATLAB as follows:
Start Programs Matlab Matlab 5.3
Run simulink and create a block diagram which you wish to implement on dSPACE; e.g., see
below:
ADC #1
DAC #1
ADC #2
s
Integrator
s
Integrator1
DAC #2
ADC #3
DAC #3
ADC #4
DAC #4
DS1102ADC
DS1102DAC
Gain
1
Gain1
Figure 3.1: A simple simulink block diagram
Note that the ADC and DAC blocks included in this block diagram are specific to dSPACE
and should be obtained from the dSPACE RTI1102 folder of the simulink library browser. Also,
ensure that you use the correct board which is ds1102.
The signal applied to a dSPACE ADC channel must be in the range -10 to 10 volts. A signal
of +10 volts gives an internal value of 1.00 within simulink. The dSPACE DAC converters give
an output in the range of -10 to 10 volts. An internal value of 1.00 gives +10 volts on the DAC.
Give your model a suitable name and save it in the directory C:\MATLABR11\work\student.
Compiling and Downloading First make sure the matlab default directory is
C:\MATLABR11\work\student by giving the command:
>> pwd
If you are not in the right directory use the matlab command cd to get to the right directory.
In order to generate C code for your block diagram, go to the Tools menu and select RTW
options (RTW stands for Real Time Workshop). This is necessary in order to configure simulink
C code generation for use with dSPACE.
Select the Solver tab and set the step size to a suitable value in seconds. (Say 0.001) This
determines the sample period used in the real time implementation of the system.
Choose the Real Time Workshop Tab and click build. This will compile the block diagram
and download it to the dSPACE board.
From now on, if you change the block diagram and do not need to change the step size,
you can compile the block diagram simply by going to the tools menu and choosing RTW
build.
3.2
This is a powerful dSPACE software package used to interact with the program you have running
on the dSPACE DSP board. In particular, it is used to change parameters in the model and to
plot variables and signals in the DSP.
10
The following write up gives some basic instructions on the use of the ControlDesk package.
However, in order to use the package correctly you will need to use the online help. The online
help package is called dSPACE HelpDesk. To run this package choose the windows menu items
as follows:
Start Programs dSPACE Tools dSPACE HelpDesk
This online help system contains all the information about the ControlDesk package. In particular,
if you cant do something in ControlDesk, do not immediately ask the demonstrator how to do it
but rather try looking it up in HelpDesk first.
Overview ControlDesk allows you to collect the various files you need for a particular model in
an Experiment. An experiment can consist of
(i) Hardware specification: This specifies which board the program runs on (In our case there
is only one DSP board to worry about).
(ii) Instrumentation layout: In control desk, the instrumentation layout is used to display signals
from the DSP and to adjust parameters in the DSP model. For each experiment, you must
construct a layout to display the required variables and adjust the required parameters.
(iii) The ControlDesk package requires a .trc file corresponding to the simulink model which is
running on the DSP board. This file is automatically generated when the simulink block
diagram is compiled as above. This file is specified for the given experiment in the Variable
Manager section.
Main Window
11
an CRO type display. This example is not part of the lab but is intended to illustrate the use of
ControlDesk.
To start ControlDesk, double click on the dSPACE ControlDesk icon on the windows screen.
Create a new experiment using the following menu commands:
File New Experiment
You should give your experiment a name and make its working root directory:
C:\MATLABR11\work\student
Click on the green Hardware tab (Ha ...). This should indicate that a program is running on
your ds1102 board (by the green triangle). If not, you can drag and drop the corresponding
.obj file onto the ds1102 icon to download this program. Add this hardware description to
your experiment by right clicking on the window with the ds1102 icon and then choose Add
to Experiment
Click on the blue Experiment tag (E...). You should now see the hardware icon included in
your experiment. To add the required .trc file to your experiment use the following menu
commands:
File Open Variable File
and choose the .trc file corresponding to your simulink block diagram constructed above.
This should open a new window with your model name and also a window listing some
variables for your model. To add the .trc file to your experiment, right click on this window
and choose Add to Experiment. This should give you a new icon in your experiment which
includes your .trc file.
Also, you may wish to add your simulink block diagram to the experiment. This .mdl file is
not used by ControlDesk directly but it is useful to keep track of it.
To add this file to your experiment, give the following menu command:
File Import Files
Then locate the .mdl file for your block diagram. This should lead to a new External Files
section in the Navigator panel (under Experiment) with your .mdl file included.
To construct an instrumentation layout for your experiment, give the menu commands
File New
Then scroll down and select layout. This should create a blank layout window. Click on the
multi-coloured Instrumentation tab (In...). You should then see a virtual instrument panel.
In this example, we wish to create a CRO type display to plot the variable Integrator1
which is the output of our system. We will also include a gauge which displays the model
turnaround Time. This is useful if we want to know how short we can make the system
sample time (It must be at least greater than the turnaround time.).
Click on Data Acquisition in the Virtual Instruments panel and then click on the plotter
icon. (Note, in some cases, your Virtual Instruments panel may not have a Data Acquisition section. In this case simply click on the plotter icon directly.) Then move to the
Layout panel and draw a rectangle which will determine the size of your plot (It should take
up about half the available area but can be adjusted later if desired.) A set of axes should
appear on your layout panel.
13
We now need to set up this plotter to plot the desired variable. First move to the Tool
Window and click on Model Root. The variable panel should display a list of variables
associated with your simulink block diagram. For the simulink example described above,
there should be a variable denoted B:Integrator1. Click on this variable. (The notation
B:Integrator1 refers to the fact that we are interested in the output signal corresponding to
the simulink block labelled Integrator1.) Now drag and drop to the area just to the left of
the plotter y-axis in the Layout panel. The y-axis now should be labelled Integrator1 and a
red square appears indicating the color of the plot for this variable.
We can adjust the parameters of the plotter by right clicking on the plotter area and then
choosing the Properties menu item. Then click on the axes tab. At this stage, the only thing
we will adjust will be the Y-min value to -0.05 and the Y-Max value to 0.05.
The time and triggering of the plotter can be controlled by using a capture settings instrument. Click on the capture settings icon and then draw a suitable rectangle in the layout
panel (About half of the available area. Also, note that a capture setting block may also
automatically appear to the right of the layout when we use the plotter.)
Double click on the settings button in the capture instrument and click on the Capture tab.
In the Capture window, click on the right downarrow and choose the only option available
DSP - ... - Service #1. Also, set the length variable to 1sec. Then click OK.
In this case, our trigger variable will be the same variable that we are going to plot. Hence,
again click on B:Integrator1 in the Variable panel and drag and drop it in the trigger window
in the capture instrument panel (This is just below the words level and delay.)
You can then adjust the plot interval and trigger level to suitable values depending on the
signal you are plotting. If the signal applied to the filter is a 1Hz sine wave with amplitude
of 10V, then a suitable length is 1sec. Turn the trigger on with AutoRepeat and leave the
trigger level at 0.
To start plotting (assuming that the signal generator has been connected to the DSP board
connector panel), simply give the following menu command
Instrumentation Animation Mode
This should commence the interaction between your instrumentation layout and the DSP
board. To stop, choose the menu command
Instrumentation Edit Mode
This enables you to make further adjustments to your instrument panel. (Note, there are
also menu bar icons which perform these commands.)
The controldesk program does not have a direct way of printing plots. A simple way to print
plots is to use screen capture (hold down the alt key and press the print screen key).
Then run the paint program and paste the screen capture into the program. The required
plot can then be cut out and printed.
If you wish to save your traced data to a file so that it can be later loaded into matlab and
printed, make the following adjustment to the properties of the capture instrument: Under
Acquisition, choose simple capture and check Automatic storage. Then specify a filename in
which the data will be stored; e.g., output.mat. Then run the animation again. It is best to
turn off Autorepeat this time since every time a trace is plotted, it will also overwrite this
file.
After the capture is complete, you can open this file and plot it from your matlab command
window as follows:
14
15
3.3
The best way to use the dSPACE system to construct a step response is to add a constant block to
your simulink block diagram which will provide the step input. Then use the ControlDesk package
to control the step and view the resulting step response using a plotter instrument.
To provide the step input, we do NOT use the standard simulink step block. (The step
would be over before we had time to set things up). Rather we add a Constant block
whose value will be adjusted by ControlDesk to provide the step input at the required time.
Also, the ADC and DAC blocks can be removed. For the above example, this leads to the
following simulink block diagram.
16
Constant
s
Integrator
s
Integrator1
1
Gain
1
Gain1
Figure 3.4: Simulink block diagram for step response
Compile the system as normally.
Return to ControlDesk and close any old experiments. Open a new experiment and give it
a suitable name. As described in the previous example, add the hardware configuration and
.trc file to this experiment.
Create a new layout (or modify the existing layout) as follows:
17
18
The above procedure can be used to plot the step response of any physical system connected
to the dSPACE board. Connect the input of the system to a DAC channel (Vout(1) in the
connector box) and connect the output of the physical system to an ADC channel (Vin(1)
in the connector box).
Construct a simulink block diagram as shown below
DAC #1
ADC #1
Constant
DAC #2
ADC #2
DAC #3
ADC #3
DAC #4
ADC #4
DS1102DAC
1
Output
DS1102ADC
Specifications
In this laboratory, you must design a controller for the DC servo system of the form shown in
Figure 4.1.
Ref
Shaft
Input
Controller
Plant
H(s)
angle
G(s)
+
-
(ii) For a step change in the reference input of 20 , your control system should have an overshoot
of at most 4 (20%).
(iii) In addition to meeting all of the above specifications, your control system should achieve the
shortest possible rise time for a step change in the reference input of 20 .
Laboratory Preparation
All students should undertake the following laboratory preparation which should completed before
the beginning of the laboratory session. Have the demonstrator sign your laboratory preparation
report during the laboratory session and hand it in with your final laboratory report.
Assuming that the plant transfer function is
1000
Gam (s) =
s(s + 30)
design a controller so that all of the above specifications are met. For this inital design, you can
assume that the potentiometer sesnor scale factor is as follows: 1 volt corresponds to 14 degrees.
You may use any method you please to design the controller including Pole Placement, Root
Locus, and Frequency Domain Loop Shaping using Bode, Nyquist or Nichols plots.
The form of your controller may be a simple constant gain, PID or lead-lag controller or it
may be a complex controller including many lead and lag blocks together with complex poles and
high frequency roll-off poles.
Remember actuator saturation (the fact that the output signal of the dSPACE is constrained
to the range [10, 10] volts) is one of the main factors limiting the performance of a control system.
A design which looks very good without taking into account the effect of actuator saturation may
perform poorly when taking into account the effect of actuator saturation.
For this preliminary controller design, it is a good idea not to make the controller gain too
large. Otherwise, you may excite unmodelled dynamics in the plant and lead to an unstable system
when implemented on the real plant. In particular, it is a good idea to limit the gain crossover
frequency of your initial desing to something less than 100 rad/s.
The report on your laboratory preparation should include all steps in your design and should
verify that all of the specifications are met.
Laboratory Procedure
Before you can begin your controller design, you will need to carry out a number of experiments in
order to obtain an accurate model of your plant. Note that the dynamics of your plant will change
if you change the screw tightness on the motor gears. Your are free to set this at any tightness
you like (provided you do not damage the equipment). However, you should keep in mind that
the model will change if you change this screw.
Important. When using the DC servo system, there are voltages on the control panel which
can damage the DSPACE system. Have the demonstrator check any circuit involving the DSPACE
system before turning it on.
Identify the plant model.
(i) Carry out the experiment shown in Figure 1.4 in order to determine the parameter a in
the model (1.1). Note, it is important to choose suitable values of the controller gain Kc and
input step size in order to get an accurate answer. (Some trial and error may be required
here.)
(ii) Carry out the experiment shown in Figure 1.5 to determine the parameter b.
(iii) Devise and carry out an experiment to calibrate the potentiometer angle sensor; i.e., find its
gain factor in volts/degree.
20
The controller design Working as a team, use your identified plant model and matlab to
design a suitable controller to meet all of the above specifications and minimize the rise time. Use
matlab to simulate the predicted performance of your controller.
Controller Implementation
(i) Implement your controller in dSPACE.
(ii) Devise experiments to verify that your controller does meet all of the above specifications.
(iii) Carry out an experiment to measure the rise time of your controller in response to a 20
step. When you have obtained your final step response, notify the demonstrator who will
check it.
(iv) If your controller does not meet all of the specifications, you will need to return to the design
step and adjust your controller.
(v) Compare the measured performance of your controller with the simulated performance obtained at the design stage.
Laboratory Report
A formal laboratory report is required.
There should be one report for each student.
Each student should include his laboratory preparation (signed by the demonstrator) as part
of his final report.
Each student should list the other students in his group.
All experiments carried out in the lab should be fully described and the results should be
full documented.
Your design procedure needs to be fully documented including simulations showing how you
controller should meet the specifications.
Experiments showing that your controller meets the specifications should be fully documented.
In order to be eligible for the 20 marks bonus for the fastest rise time, your controller design
process together with the experiments verifying the specifications and controller performance
need to be fully documented. Thus, it is possible that some members of a group may receive
the bonus while other members do not.
21