Description
Speed Control of a Simplified Car Model
MAIN CONCEPTS OF THIS LAB
-
How to apply the Internal Model Principle for speed control of a car model
-
How to convert transient performance specifications to desired pole locations
-
INTRODUCTION
Imagine a car moving along a straight road with an unknown slope. Neglect the moment of inertia of the wheels, and suppose the friction force is proportional to the speed of the car (i.e. the friction is viscous). Finally, suppose the engine imparts an acceleration u (measured in m/s2) to the car. This is our control input. The schematic representation of the system just described is depicted below.
x
Bx˙
Mu
θ
Mg
Its mathematical model is
Mx¨ = −Bx˙ + Mu + Mg sin(θ ).
Here, x represents the displacement of the car measured with respect to an inertial frame, and θ is the unknown inclination angle of the road. Since we are interested in controlling the speed x˙ of the car, we rewrite the model using v = y˙,
Mv˙ = −Bv + Mu + Mg sin(θ ),
and we let y = v denote the output of the plant. Here we are assuming that we have a speed sensor (a
|
¯ |
:= g sin(θ ), we rewrite the model as |
|||
|
tachometer). Denoting d |
||||
|
v˙ = − |
B |
v + |
u + d¯ |
|
|
M |
(1) |
|||
y = v.
|
¯ |
B |
|
|
Since θ is unknown, so is the constant d, and therefore we regard it as a disturbance. Letting a = |
M |
, we |
|
obtain the plant block diagram depicted below. |
||
|
¯ |
||
|
D(s) = d/s |
a nonlinear system far from the equilibrium, you need to give a convincing explanation grounded in the concepts that you’ve learned in class, starting from the fact that the linearization constitutes an approximation of a nonlinear function. This component of the mark will be assigned as follows:
SPEC 5 When the desired reference speed is vdes = 14 m/s (i.e., 50 Km/hour) and D(s) = 0, the control input signal u(t) should not exceed the bound |u(t)| ≤ 30 m/s2.
Before proceeding, you need to review your lecture notes on the Internal Model Principle. We will make use of these concepts now.
By the Internal Model Principle, to meet SPEC 1 the controller must have a pole at zero (you will be asked to justify this in Output 1), so we will design a PI controller
-
-
-
-
-
-
-
C(s) = K
TI s + 1
,
(2)
TI s
-
-
-
-
-
-
where K, TI > 0 are two design parameters that we need to select. In the next box, you will be guided through pen and paper calculations that you’ll need to perform in preparation for your Matlab code.
Output 1. • Appealing to the Internal Model Principle, show that in order to meet SPEC 1, C(s) must have a pole at zero.
-
The PI controller (2) has a pole at zero. Give a clear explanation of the Internal Model Principle, and clearly show that it implies that if the gang of four transfer functions (see lecture notes) are BIBO stable, then SPEC 1 and SPEC 2 are met.
-
A necessary and sufficient condition for the gang of four transfer functions to be BIBO stable is that
-
-
all poles of the transfer function 1/(1 + CG) have negative real part, and
-
-
-
the product C(s)G(s) has no pole-zero cancellations in the closed right-half plane.
-
Show that for any K, TI > 0 the PI controller above satisfies conditions (a) and (b). Present clear and concise arguments.
-
Now we need pick K, TI > 0 to meet SPECS 3,4 and 5. We begin with SPEC 3. Find the transfer
function T(s) = Y(s)/R(s) (assuming D(s) = 0). In order for this transfer function to have negative real poles at − p1, −p2, its denominator must have the form s2 + (p1 + p2 )s + p1 p2. By equating coefficients, find the unique values of K, TI > 0 such that the poles of T(s) are − p1, −p2. Present a clear derivation of the relationship between (K, TI ) and (p1, p2 ).
You’ve now met SPEC 3, and you can still choose p1, p2 > 0 to meet SPECS,4 and 5. You will next work on SPEC 5. SPEC 4 will be addressed via tuning in simulation.
-
Now we investigate SPEC 5. The car is initialized at zero speed (because we are modelling it as a transfer function), and is asked to accelerate and reach a speed vdes. It is natural to assume that the largest acceleration will occur at t = 0. Assuming that this is the case (you’ll verify this assumption
later via simulation), we need to guarantee that |u(0)| < 30 m/s2. For this we use the following result.
Initial Value Theorem (IVT): Suppose that F : C → C is a rational and strictly proper function, and denote f (t) = L −1 (F(s)). Then f (0) = lims→∞ sF(s).
Find the transfer function U(s)/R(s), and setting R(s) = vdes /s = 14/s, compute U(s). Then, using the IVT, compute u(0) as a function of K and TI . In turn, K and TI depend on p1 and p2. Find the constraint that p1 and p2 must satisfy in order that |u(0)| < 30. Write out this constraint neatly. It should be an upper bound on the sum p1 + p2. This upper bound should depend on the constant a.
We end this section with a remark about SPEC 4. You might be wondering why in the above theoretical analysis we did not attempt to meet this specification using the formula for settling time Ts ≈ 4/(ζ ωn ). The reason is that this formula is only valid for complex conjugate poles, whereas in SPEC 3 we require the poles to be real.
-
ASYMPTOTIC TRACKING WITH DISTURBANCE REJECTION: NUMERICAL SIMULA–
TION
In this section you will use your theoretical analysis of Section 3 to simulate a PI controller solving the constant reference tracking problem with disturbance rejection.
MATLAB COMMANDS
h=stepinfo(G) Determines the transient performance information from the step response of the LTI object G. The variable h is a structure containing various performance parame-ters
minreal(G) Performs any pole-zero cancellations in a transfer function LTI object
SIMULINK BLOCKS (INSIDE THE LIBRARY BROWSER)
|
Sources → Step |
Step function |
|
|
Math |
operations → Abs |
Absolute value |
|
Math |
operations → Gain |
Constant gain |
Create a script named lab3.m.
-
Define variables M,B,g,a with numerical values given in the table in Section 1. Define a variable vdes with numerical value 14, and a variable dbar = g*sin(theta), where theta is assigned a numerical value of − π/6 (i.e., the road will be inclined uphill).
Define an LTI object named G with the plant transfer function G(s) = 1/(s + a).
-
Define variables p1,p2 containing initial values for the poles of the closed-loop system meeting specification SPEC 5 as per your development in Section 3. You will tune p1,p2 later to meet SPEC 4. Define PI control parameters named K,TI in terms of p1 and p2. Define an LTI object named C with the controller transfer function C(s) in (2).
-
Using the LTI objects C and G, define an LTI object named T containing the transfer function Y(s)/R(s) (assuming D(s) = 0). Using the command minreal, perform any pole-zero cancel-
lations in T. Then, extract the poles of T (see Lab 1 for how to do this) and verify that they coincide with − p1, −p2.
dbar
e
u
C
G
output and reference signals vdes
u
tracking error
Draw the Simulink diagram displayed above, and name it lab3_1.slx.
-
In the block diagram, there are two LTI System blocks pointing to the objects G and C that your script lab3.m has defined in the workspace. There is a step function block to generate the distur-bance signal, and three scopes to measure the output and reference signals, the tracking error, and the control input signal.
-
Observe the area of the block diagram delimited by a red box. Here we are comparing two signals: the absolute value of the tracking error e(t) and a the constant signal 0.02 · vdes. The settling time is the first time when the former signal decreases and stays below the latter one.
-
Open the Model settings and under the Solver menu, set both relative and absolute tolerances to 10−10. Make sure that the solver is variable-step, and set the stop time to 30 seconds.
-
Open the Step function block, set step time to 15 seconds, initial value to 0, and final value to dbar (this variable was defined in your script). In words, the road will be flat for 15 seconds,
after which the inclination will change to − π/6 (i.e., the car will drive uphill; in practice the road inclination would change gradually). The car speed will clearly be affected by the sudden change in road inclination, but your controller should be able to recover from it.
-
Run the simulation and save three figures generated by the three scopes in the block diagram. Make sure that the tracking error scope is configured as in the block diagram. From this latter scope, deduce the settling time over the time interval 0 to 15 seconds, and check whether it is below 6 seconds. From the control signal scope, check whether our assumption in Section 3 that
u(t) would achieve its maximum value at t = 0 is correct. Verify that |u(t)| < 30. It should be, if your theoretical analysis of Section 3 is correct, and if p1 + p2 satisfies the bound you found in that section.
-
Tune the poles p1 and p2 (and correspondingly the PI control parameters K and TI ) in your lab3.m script, rerun the code, and then rerun the Simulink diagram. The objective of your tuning is to get the smallest settling time over the time interval 0 to 15 seconds that does not violate the control bound of SPEC 5 over that interval.
-
Now return to your Matlab script lab3.m, and recall that you’ve defined an LTI object T containing the transfer function Y(s)/R(s) assuming that D(s) = 0 (which is the case over the time interval 0
to 15 seconds). Using the command stepinfo, find the settling time of y(t), and compare it with the one you found above (over the interval 0 to 15 seconds) for the optimal values of p1 and p2. You should get the same settling time. If not, you have an error, find it and fix it.
Output 2. • Print your initial choices of p1, p2, and the corresponding values of K and TI . Produce three plots corresponding to the three scopes in the Simulink diagram, and estimate the settling time based on the system response over the first 15 seconds. Then, estimate the settling time after the disturbance kicks in at t = 15 s. Your plots should have titles describing their content.
-
Comment on your initial findings before tuning. Are all the five specs met? Which ones aren’t? Guide the reader of your report through the verification of which specs are met and which ones aren’t. Explain the tuning you plan to do to improve the performance, and show your reasoning behind it.
-
After tuning, print the values of p1, p2 minimizing the settling time while respecting the bound on u(t). Repeat again your analysis verifying whether all the specs are met. What is the best settling time you could get over the time interval 0 to 15 seconds? What is the settling time over the time interval 15 to 30 seconds? Print the settling time you found using stepinfo and verify that it’s the same as the one over the time interval 0 to 15 seconds that you deduced from the plots.
-
You will notice that, after the disturbance signal is enabled, the control signal u(t) will settle to a nonzero value. Find this value, and explain how it conforms with the physics of the problem (a mass on an inclined plane subject to gravity).
8
