ECE311 LAB 2: Familiarization with Equipment and Basic Cruise Control Design

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (5 votes)

1 Purpose
The purpose of this experiment is to introduce you to the lab setup and the associated control
problem. Namely, the design of a cruise control system for a cart. You will test two different types
of controllers: proportional (P) and proportional-integral (PI). Furthermore, you will explore how
changing the controller parameters affects the closed loop performance.
Analogously to the previous lab you will submit your pre-lab first, receive feedback and then submit
all the material required for the experimental part: a lab report and all the required Simulink models.
Since you will not have access to an actual physical cart, we will provide you the Simulink model
cart.slx you will use for the experimental part.
2 Introduction
Consider a cart moving on a straight road with an unknown slope. It is assumed that the inertia
of the wheels is negligible, that the friction force is proportional to the speed of the car, and that
the engine imparts a force u. The schematic representation of the system is depicted below.
θ
u
Mg
xBɺ
x
Figure 1: Schematic representation of the system
1
Applying Newton’s law we obtain the following mathematical model of the system
Mx¨ = −Bx˙ + u + Mg sin θ. (1)
Since we are interested in controlling the speed ˙x of the car, we rewrite the model using v = ˙x,
Mv˙ = −Bv + u + Mg sin θ. (2)
The force u, imparted by a DC motor, is approximately proportional to the voltage vm applied to
the motor,
u = Kmvm. (3)
The voltage vm is the control input to the plant. The mathematical model of the cart system
becomes
v˙ = −
B
M
v +
Km
M

vm +
M
Km
g sin θ

. (4)
Since the slope θ is unknown, the constant M
Km
g sin θ is a disturbance acting on the plant. Letting
a =
Km
M
, b =
B
M
, d(t) = d · 1(t) := M
Km
g sin θ · 1(t), (5)
the plant block diagram is depicted in Figure 2.
+
+
Plant
Disturbance
Input Output
a
s b +
V s( ) ( ) V s m
( ) D s d
s
=
Figure 2: Block diagram of the plant
In this lab, you will familiarize yourself with the experimental setup, you will experimentally determine the constants a and b, and you’ll implement basic proportional and proportional-integral
controllers to regulate the car speed.
The experimental setup used in the lab is shown in Figure 3 .
The designed controller will be implemented in Simulink. For all your simulations you will use the
Simulink model cart.slx provided to you as the additional material relative to this lab.
3 Preparation
Consider the block diagram in Figure 2 and assume that the road is flat, i.e., θ = 0 and hence
D(s) = 0. Suppose that a step voltage vm(t) = V0 · 1(t) (V0 > 0) is applied to the DC motor
and that at time t = 0 the cart is still (i.e., v(0) = 0). Using the final value theorem determine
v(+∞) = limt→∞ v(t) in terms of V0, a, and b.
Submit this expression and its derivation in your pre-lab report.
2
y
Cart System
u
Controller
Simulink Environment
Figure 3: Block diagram of the experimental setup
4 Experiment
Be sure to include all the required Simulink models and plots in your lab report. To build the
models for every section, start by opening the cart.slx model provided to you and save it with
a different name. In this way you will always be sure that you will keep the original settings we
prepared for the cart.slx model provided to you.
4.1 Introduction to the cart system
In this first part you will familiarize with the cart system by plotting the response to a square wave
input voltage.
4.1.1 Open loop response: square wave voltage to the DC motor
In this section you will learn how to configure and setup your system. You will need to The objective
is to have the cart on the rails swing back and forth when inputting a square wave. Open the plant
model (the file cart.slx provided to you) on your simulink model. Using the Sources/Signal
Generator block in Simulink, create a block that generates a square wave for vm(t) with amplitude
1.5 V and frequency 0.5Hz. Be sure to input the value 0 to the offset input. A simple way to do
it is to use the constant block with value 0 (this corresponds to a cart system with no slope). If
everything is correctly set your block diagram should look very similar to Figure 4.
Once your model is correctly set, run the simulation by clicking on the run button in Simulink. You
should be able to see an animation showing the movement of the cart as in Figure 5. Save your
model as model intro.slx and include it in your submission. You will also save the position and
velocity responses and include them in your lab report (Section 2.1 in the lab report).
4.1.2 Collecting data from the cart
To collect data from the proposed experiment you can use the scope blocks as in Figure 4 or if you
prefer creating your own plot you can use the To Workspace block. 1
1
https://www.mathworks.com/help/simulink/slref/toworkspace.html
3
Figure 4: Schematic representation of the Matlab Simulink model
Figure 5: Cart animation
4.2 Identification of model parameters a and b
Recall that in the introduction we modelled the car as a transfer function V (s)/Vm(s) = a/(s + b),
where Vm(s) is the Laplace transform of the input voltage signal and V (s) is the Laplace transform
of the cart speed signal. Before controlling the system, we need to experimentally determine the
parameters a and b. This is the objective of this section. For this section start by opening the
cart.slx model provided to you and save it with the new name model id.slx. You will include
this file as part of your submission.
Figure 6: Schematic representation of the Matlab Simulink model
4
1. The detailed steps to build the new model are listed below.
• Open another copy of the cart.slx Simulink model and the Library browser. Keep the
input to the offset port at 0 as in Figure 4.
• Using the Continuous/Transfer Function block, create a system with transfer function
a
s + b
. This block represents the mathematical model of the plant assuming that the
disturbance is zero, that is, assuming that the cart track is horizontal. The objective
here is to experimentally determine the values a and b.
• Using the Sources/Signal Generator block in Simulink, create a block that generates
a square wave for vm(t) with amplitude 1.5 V and frequency 0.5Hz.
• Connect both the output of the transfer function block and the output of the cart to a
Scope (found in the Sinks library).
In this way you will be able to directly compare the velocity output of the cart and the transfer
function models on the same scope.
2. We choose the initial guesses for a and b in the system model as 0.5 and 5 respectively.
3. Run the Simulink model to obtain the corresponding results for the considered a and b. Save
the resulting plot and include it in your lab report.
4. Look at the experimental velocity and determine as accurately as you can its total variation
over the half period. We’ll denote such variation by 4v.
5. Notice that over the half period under consideration, the signal vm(t) performs a step of
amplitude V0 = 3V . We’ll make the approximation to consider the signal vt to be in steady
state at the end of the half period. So we deduce that, in response to an input step of
amplitude 3V , the plant output has a total variation of 4v. Using the formula you found in
your lab preparation and the value 4v you just found, find a relationship between a and b.
Specifically, find an expression of the type a = f(b).
6. It should be now clear that for any choice of b, setting a = f(b) guarantees that the steady
state value of the model output approximately coincides with that of the actual plant output.
Now you’ll tune b to make sure that the transients coincide as much as possible.
Keep the value of b you were using earlier, and set a = f(b) in Simulink. Run the simulation
and verify that the steady-state values of the model and actual plant outputs coincide. Include
this simulation result in your lab report.
7. Now try to increase b. Don’t forget, every time you modify b, you must also update a = f(b)
in Simulink. Run the simulation to see if the new value of b yields better results. Keep tuning
b until you minimize the discrepancy between the actual plant and model outputs.
Once you have found reasonable estimate save Simulink model model id.slx with the final
values of a and b you estimated. Report your findings in the report (Section 2.2 in the lab
report) together with the plot that shows that your final choices of the parameters actually
approximate the cart response. You’ll use the values of a and b you just found in Lab 3.
5
4.3 Proportional Control
Now you’ll implement a proportional controller to regulate the speed of the cart. A proportional
controller is a controller of the form
vm(t) = Ke(t), (6)
where e(t) := r(t) − v(t) is called the tracking error. This is the difference between the reference
signal r(t) and the actual plant output v(t). In the cart experiment, r(t) represents a desired
velocity profile for the car, while v(t) represents the actual cart speed. Do the following steps for
this section.
1. Open another copy of the cart.slx Simulink model and the Library browser. Keep the input
to the offset port at 0 as in Figure 4. You will save your model as model p.slx and once
complete, include it in your submission.
2. Set up your Simulink model as in Figure 7. This time, the input voltage to the cart is
vm(t) = K(r(t) − v(t)) = Ke(t).
3. The velocity reference is set to a square wave form with the amplitude of 0.2 m/s and frequency
of 0.5 Hz. Use the same signal generator block you used in the previous step.
4. Start with a prortional gain K = 5. Do you expect the error to asymptotically tend to 0?
Can you explain why, using the concepts learned in class?
5. Using the concepts learned in class (e.g. final value theorem) try to predict what would be
the effect of increasing the controller gain K.
6. Now, verify your hypothesis with the help of simulations. Increase the controller gain2
, and
run the system again. Repeat this operation a few times and save your simulation results to
include in your report. Do the simulations results match your expectations?
Report all your findings in the Lab Report (Section 2.3).
4.4 Proportional-Integral Control
You’ll now implement a proportional-integral controller. A PI controller is an enhancement of a PI
controller and has the form
vm(t) = Ke(t) + K
TI
Z t
0
e(τ )dτ, (7)
2Usually, for a physical implementation, the hardware limitations of your control system will limit the maximum
controller gain you can use. In this case we ask you not to usea controller gain higher than 100 since it will make the
simulation unstable.
6
Figure 7: Schematic representation of the Matlab Simulink model
where K and TI are two positive design constants. Taking the Laplace transform, we find that a
PI controller has a transfer function (from e to vm),
K +
K
TIs
= K(
TIs + 1
TIs
) (8)
Do the following steps for this section.
1. Open another copy of the cart.slx Simulink model and the Library browser. Keep the input
to the offset port at 0 as in Figure 4. You will save your model as model pi.slx and once
complete, include it in your submission.
2. As in the previous experiment, the velocity reference is set to a square wave form with the
amplitude of 0.2m/s and frequency of 0.5Hz.
3. Set Ti = 0.07 and K = 2. There are two ways to implement your PI controller:
• Properly use an integrator block and a proportional block;
• Use a transfer function block implementing directly (8).
For this exercise you will have to build your own schematics, instead of using the schematics
proposed in this lab instructions for the other exercises.
4. Following the same procedure described in the previous sections, run the Simulink simulation
to observe the obtained experimental results. Report the plot representing the displacement
and the velocity of the cart.
5. Include the plot for Ti = 0.07 and K = 2.
6. Next, keep Ti constant and start increasing K. Simulate your system for different values of
K and record your observations: what’s the effect of increasing K?
7. How does the performance of the P and PI controllers compare?
Report all your findings in the Lab Report (Section 2.4).
7
5 Submission
For this lab you are required to submit the following material:
1. Pre-lab report (first deadline);
2. Lab report;
3. Lab files:
• model intro.slx
• model id.slx
• model p.slx
• model pi.slx
8