Lab 3: Motor Cart Control - Freestyle: 1 Goals
Lab 3: Motor Cart Control - Freestyle: 1 Goals
Lab 3: Motor Cart Control - Freestyle: 1 Goals
Goals
1. To explore the fundamental differences between open loop and closed loop control phenomenon
by designing a position controller for the motor/cart system such that the cart can be accurately
positioned to any point on the track, specifically
The cart should be fast (go from 0 position to 10 cm in under 0.5 seconds)
The cart should be accurate (position error less than 2 mm, and overshoot less than 4 mm)
Equipment List
Item
1
2
3
4
5
6
7
Quantity
1
1
1
1
1
1
1
Table 1: Equipment
Description
Quanser UPM-2405 Power Supply
Motor/Cart system
Metal ruler
Dell PC with MultiIO and connector panel
Encoder cable
Power cable (6 pin DIN to 4 pin DIN, 1)
D/A cable (phono to 5 pin DIN)
Introduction
During the rest of this course you will learn systematic methods for designing control systems. It is
necessary to understand the difference between the open loop and closed loop control strategies, before
systematically designing a controller. This lab, where you try to design a controller in an ad-hoc manner,
will provide motivation for the process of systematic control system design.
3.1
Step Input
In controls lab you will be dealing with various types of inputs. One of the most common inputs in the
control system design is a step input. A step input is specified by three parameters:
Step Time
Initial Value
Final Value
Following are two graphical examples of the step input, when specified with the parameters mentioned
above.
Step Time: 2 sec
Initial Value: 0
8
Final Value: 4
Amplitude
Final Value
4
STEP from Initial to Final Value
t(s)
Step Time
Initial Value
Initial Value: 3
Amplitude
Final Value: -1
t(s)
-1
3.2
Motor/Cart System
The purpose of any control system design is to control one or more outputs of a physical system. The
physical system if often known as the Plant . In this lab, the plant refers to the Motor/Cart System.
The motor/cart system gets its power from the MultiIO connector panel through the amplifier (UPM).
The encoder mounted on the motor/cart system measures the distance travelled by the cart in counts.
It is then passed on to the computer via the MultiIO connector panel.
In-Lab Tasks
1. Wire the cart system. You will need to pass a motor voltage signal from the MultiIO connector
panel to the amplifier (UPM) and then to the carts motor. You will also need to be able to read
the encoder.
2. Create a simulink model file to implement your open loop control strategy developed in the prelab.
Make sure to set the saturation block at +2 to -2. The simulation also needs to be set to ode4,
this is set by clicking Simulation Configuration Parameters Solver. The Fixed step size
should also be set to 0.002. With the UPM amplifier powered off, build your application as you
did in Lab #2. If there are errors, then go back to your simulink block diagram and correct them.
The model should have the following features:
A plot window displaying the carts voltage input.
A plot window displaying the carts position in centimeters.
A To Workspace block for obtaining input commands just before the Write Analog block
A To Workspace block for obtaining cart position
3. Have your lab instructor inspect your open loop control strategy implementation. With your lab
instructor watching, power on the UPM and run the model by commanding a step input. Adjust
the step input parameters in a way such that the cart moves 10 cm to the right and then stops. You
may need to iterate several times before obtaining satisfactory positioning performance. When
you are done iterating, have your lab instructor inspect your final implementation and proceed to
the questions below.
(a) Does the voltage saturate, and if so, at what voltage?
(b) How long does it take the position response to go from 0 cm to 10 cm?
(c) After the cart stops, what is the error between what you commanded (10 cm) and the actual
cart position (use both the encoder measurement, and a visual inspection of the ruler) ?
4. The position and voltage data will be saved in the workspace. Save the workspace using a name
such as openloop10cm.mat Create and save both the plots using an .m file and annotate them
properly. Print off the HTML file for the open loop system, including the answered questions inside
the .m file.
5. Create a new simulink model file to implement your closed loop control strategy developed in the
prelab. With the UPM amplifier powered off, build your application. If there are errors, then
go back to your Simulink block diagram and correct them. The model should have the following
features:
A plot window displaying the carts voltage input
A plot window displaying the carts position in centimeters
A To Workspace block for obtaining input commands just before the Write Analog block
A To Workspace block for obtaining cart position
Have your instructor inspect your work before continuing.
6. Clear the workspace. Command the cart to go from 0 to 10 cm. The position and voltage data
will be saved in the workspace. Save the workspace in a new .mat file with a name such as
closedloop10cm.mat and plot the same two graphs in MATLAB. Answer the following questions
in your .m file in commented format.
3
Pre Lab
1. In the table below two sets of step input parameters are given for the first two plots. Sketch the
step input plots in the space provided below. For plots 3 and 4, note the step input parameters
from the sketches shown.
Table 2: Step Input Parameters
Plot No. Step Time Initial Value Final value
1.
5
0
2
2.
15
-4
0
3.
4.
10
15
10
15
-2
-2
1
-4
2
-4
10
15
10
15
-2
-2
3
-4
-4
Figure 3:
2. Given below are two Simulink block diagrams representing a typical form of an open loop and
closed loop control system. These block diagrams are incomplete. Complete the block diagrams
by labeling the figures, naming the blocks and making the right connections, wherever necessary.
For labeling and naming, use the names from the list given below:
HIL Read Encoder Block
Cart Position Scope
Scale Factor Gain Block (counts-to-cm)
HIL Write Analog Block
Position Command input, Constant Block
Motor/Cart System
Model 1:
Motor/Cart System
Model 2: