You are on page 1of 6

LAB 8

THE USE OF MATLAB AND SIMULINK AS A TOOL


FOR CONTROL SYSTEM DESIGN

1. LAB OBJECTIVES

The objectives of Lab 8 are


a) To learn the use of Matlab and Simulink as tools for simulation and control system
design.
b) To identify the parameters of a (hidden) vehicle model in Simulink.
c) To design a controller for a vehicle-following application and evaluate its
performance through simulation.

2. BACKGROUND

2.1. Simulink
Matlab and Simulink are available in the computers in CSE Labs.

Tutorial:
The following tutorials are available on the web and can be utilized to get familiar with
the use of Simulink:
1) Simulink documentation from Mathworks:
http://www.mathworks.com/access/helpdesk/help/toolbox/simulink/simulink.shtml

2) Lou Russo, Howard P. Isermann Dept. of Chemical Engineering, RPI


http://www.rpi.edu/dept/chem-eng/WWW/faculty/bequette/lou/simtut/simtut_html.html

3) Simulink tutorial from the University of Michigan


http://www.engin.umich.edu/group/ctm/working/mac/

4) Simulink tutorial by Tom Nguyen


http://edu.levitas.net/Tutorials/Matlab/Simulink/
As a part of your pre-lab, review use of the following blocks in Simulink:
Sum, Derivative, Integrator, Transfer Function, From Workspace, To Workspace,
Sources: From Workspace, Sinusoid, Constant
Sinks: Scope, To Workspace
Simulation Options: sampling time, integration method

2.2. Vehicle Following

Consider a vehicle following application, such as adaptive cruise control. An adaptive cruise
control (ACC) system is an extension of the standard cruise control system. An ACC
equipped vehicle has a radar or other sensor that measures the distance to other
preceding vehicles (downstream vehicles) on the highway. In the absence of preceding
vehicles, the ACC vehicle travels at a user-set speed, much like a vehicle with a standard
cruise control system (see Fig. 1). However, if a preceding vehicle is detected on the
highway by the vehicles radar, the ACC system determines whether or not the vehicle
can continue to travel safely at the desired speed. If the preceding vehicle is too close or
traveling too slowly, then the ACC system switches from speed control to spacing
control. In spacing control, the ACC vehicle controls both the throttle and brakes so as to
maintain a desired spacing from the preceding vehicle.

Figure 1: Adaptive cruise control

2
In this lab, you will design a control system for an ACC vehicle and evaluate its
performance when a string of 3 ACC vehicles operate using this control law.

Consider a string of three vehicles on the highway using a longitudinal control system for
vehicle following, as shown in Fig. 2. Let xi be the location of the i th vehicle measured

from an absolute reference, as shown in Fig. 2 ( i 1, 2 and 3 ). The spacing error for the

2nd vehicle is then defined as i xi xi 1 Ldes . Here Ldes is the desired spacing and

should be larger than the preceding vehicle length i 1 . The desired spacing Ldes could
be chosen as a constant or as a function of variables such as the vehicle speed.

Ldes

x3
x2
x1

Figure 2: String of adaptive cruise control vehicles

As far as the control design for this lab is concerned, the plant model to be used is
xi u (1)

where the subscript i denotes the i th car in the string. The acceleration of the car is thus
assumed to be the control input. However, due to the finite bandwidth associated with
any lower level controller that achieves acceleration control, each car cannot actually be
expected to track its desired acceleration instantaneously. The performance of your
controller design will therefore be evaluated in the presence of a first-order lag in the
lower level controller performance:
1 1
xi xi _ des u (2)
s 1 s 1 i
Equation (1) is thus assumed to be the nominal plant model while the performance of the

3
controller will be evaluated by an actual plant model given by equation (2). Note that in
real world applications, the actual plant will always be different from the nominal plant
model used for control system design.

One of the tasks in this lab is to identify the time constant of the hidden vehicle model
provided to you in Simulink.

The maximum acceleration and deceleration possible are assumed to be 0.25g and 0.5g
respectively.

The spacing error of the 2nd vehicle is defined as


2 x2 x1 Ldes (3)

where Ldes is the desired constant value of inter-vehicle spacing, while the spacing error
of the 3rd vehicle is defined as
3 x3 x2 Ldes (4)

If we assume that the acceleration of the vehicle can be instantaneously controlled, then a
PD control system of the type
xi k p i k v i (5)

yields
i xi xi 1 k pi k vi k pi 1 kvi 1
which leads to the following closed-loop error dynamics
i kv i k p i k p i 1 kv i 1 (7)

Hence in the Laplace domain the transfer function relation between i and i 1 is

i kv s k p
2 (8)
i 1 s kv s k p

Thus if the spacing error of the i 1 th vehicle is zero, then the spacing error of the i th
vehicle will also converge to zero.

4
In particular, if the lead vehicle operates at constant velocity, then the spacing errors of all
vehicles will converge to zero. This can be seen from the following analysis. The spacing
error of the 2nd car is
2 x2 x1 k p 2 kv 2 x1 (9)

Hence the transfer function between the spacing error of the second car and the acceleration
of the first car is
1
L 2 2 (10)
x1 s kv s k p
Thus, if the acceleration of the first car is zero, then the spacing error of the second car
converges to zero.

e i
xi 1 Ldes
u y xi
C P

i 1 1 s2

xi 1 Ldes 1 PC 1 1 (k s k ) s 2 kv s k p
v p
s2

Figure 3: Feedback loop analysis of vehicle spacing control

Figure 3 shows a standard feedback loop structure for the vehicle spacing control problem. It
can again be seen that the characteristic equation for the system is s 2 kv s k p 0 .

3. PRELAB

Written hand in required.

1) Review use of the blocks in Simulink specified on page 2 (no written hand-in for this
task)
2) Open the Simulink vehicle model given to you on the class web site and review it (no
written hand-in for this task)
3) Describe a procedure for how you will determine the time constant of the vehicle
model during the lab (Hint: Review the system identification procedure of Lab 5).

5
4) Show how spacing error will be defined in Simulink starting from the vehicle models
provided to you.
5) Determine values of the proportional and derivative gains that you will use in a PD
controller so as to achieve a bandwidth of 6 rad/s and a damping ratio of 0.707. Use
the nominal second order vehicle model for your design.

4. LAB PROCEDURE

1. Implement the procedure you developed for identifying the time constant of the vehicle
model. Save your data and calculate the time constant.
2. The absolute positions of the three cars are available as signals in the given Simulink
program. Define spacing error for cars 2 and 3 in the Simulink block diagram using the
difference between these positions and a desired value for the inter-vehicle spacing.
3. Implement a PD controller in Simulink using the gains you calculated in pre-lab.
Simulate the performance of this controller. Assume that the first (lead) vehicle moves at
a constant speed of 30 m/s. Assume that there is an initial error in spacing between the
lead and the second vehicle of 2 meters and that the desired spacing is 10 meters.
Assume that the third vehicle has zero initial spacing error. Simulate and show the
performance of the system to these initial conditions.
4. Next, assume that the initial spacing errors are zero. Assume that at 1 second, the lead
vehicle begins to accelerate with a constant acceleration of 1 m/s/s. What is the steady
state error in spacing for vehicles 2 and 3? Does the use of PID control help to reduce this
spacing error to zero?
5. Next, assume that the lead vehicle has an initial speed of 30 m/s, an initial acceleration of
zero, and after 1 second it has a desired acceleration of x1_ des sin(t ) with = 5.5

rad/s. Simulate the performance of your PD controller. Compare the spacing errors of
cars 2 and 3 and determine which spacing error is bigger. Comment on how the spacing
error will propagate if there were a string of ACC vehicle with the same control law.

5. POSTLAB AND LAB REPORT


Include all your simulation results from 1, 3, 4 and 5 and also print-outs of your Simulink
block diagrams and the required analysis.

You might also like