100% found this document useful (3 votes)
3K views

Modeling A Cruise Control System

The document summarizes modeling a cruise control system using state space and transfer function methods. It begins by defining the system dynamics and parameters. In 3 sentences: The open loop response is analyzed. A proportional controller is designed using the last digits of the student ID as the gain, improving the response. A PI controller is then designed, meeting the criteria of rise time less than 5 seconds, overshoot less than 10%, and steady state error less than 2%.

Uploaded by

Al Mutiry Muard
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
3K views

Modeling A Cruise Control System

The document summarizes modeling a cruise control system using state space and transfer function methods. It begins by defining the system dynamics and parameters. In 3 sentences: The open loop response is analyzed. A proportional controller is designed using the last digits of the student ID as the gain, improving the response. A PI controller is then designed, meeting the criteria of rise time less than 5 seconds, overshoot less than 10%, and steady state error less than 2%.

Uploaded by

Al Mutiry Muard
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 23

Modeling a Cruise

Control System
[Type the
Murad document
subtitle]
2

Abstract
The aim of our project is to find an Open loop for the Cruise Control System and find the
performance.and Design a linear feedback proportional controller, and redesign it for the close
loop and find the performance.

Modeling a Cruise Control System


3

Subjects Page No.


Abstract 2
1. Introduction 4
1.2 State Space1 4
1.3 Transfer Function 5
1.3Design requirements 7
2. Open loop 8
3.digits of our student ID 10
4.Close Loop 12
4.1P controller 12
4.2 PI controller 15
5.Root Locus Method 18
20
5.1 Lag controller
6.References 23

Modeling a Cruise Control System


4

Modeling a Cruise Control System

1. Introduction:

The model of the cruise control system is relatively simple. If the inertia of the wheels is
neglected, and it is assumed that friction (which is proportional to the car's speed) is what is
opposing the motion of the car, then the problem is reduced to the simple mass and damper
system shown below.

Using Newton's law, the dynamic equation for this system is:

where u is the force from the engine. The state-space model of this equation now becomes:

For this example, let's assume that

m = 1000kg
b = 50Nsec/m
u = 500N
1.2 State Space

The state equations for this problem are:

Modeling a Cruise Control System


5

1.3 Transfer Function

>> m = 1000;

b = 50;

u = 500;

A = [0 1; 0 -b/m]

B = [0; 1/m]

C = [0 1]

D = 0

[num,den]=ss2tf(A,B,C,D)

A =

0 1.0000

0 -0.0500

B =

1.0e-003 *

Modeling a Cruise Control System


6

1.0000

C =

0 1

D =

num =

0 0.0010 0

den =

1.0000 0.0500 0

Modeling a Cruise Control System


7

>> TF(num,den)

Transfer function:

0.001 s

------------

s^2 + 0.05 s

1.3 Design requirements

The next step in modeling this system is to come up with some design criteria. When the engine
gives a 500 Newton force, the car will reach a maximum velocity of 10 m/s (22 mph). An
automobile should be able to accelerate up to that speed in less than 5 seconds. Since this is only
a cruise control system, a 10% overshoot on the velocity will not do much damage. A 2% steady-
state error is also acceptable for the same reason.

Keeping the above in mind, we have proposed the following design criteria for this problem:

Rise time < 5 sec


Overshoot < 10%
Steady state error < 2%

2. Open-loop
Modeling a Cruise Control System
8

Below we show how this problem would be solved using Matlab. If you copy the following text
into a m-file (or create a '.m' file located in the same directory as Matlab) and run it, Matlab will
give you the A, B, C, and D matrices of the state-space model and a plot of the response to a step
response of the input force.

m = 1000;
b = 50;
u = 500;
A = [0 1; 0 -b/m]
B = [0; 1/m]
C = [0 1]
D = 0
step(A,u*B,C,D)

After running the m-file, Matlab should output to the command window the following state-
space matrices:

A =

0 1.0000
0 -0.0500

B =

1.0e-003 *

0
1.0000

C =

0 1

D =

You should also get the following plot of the open-loop response of the velocity (initially at rest
at time t=0) for a step change in the applied force (going from 0-500N):

Modeling a Cruise Control System


9

As you can see, this step response does not meet the design criteria placed on the problem. The
system is overdamped, so the overshoot response is fine, but the rise time is too slow. Therefore
a controller will have to be designed to improve the dynamics of the system. Listed at the bottom
of the page are four methodologies for designing a controller (PID, root locus,frequency
response, and state space). Click on whichever one you would like to see.

Modeling a Cruise Control System


10

3. Design a feedback proportional controller with gain equals to the last


digits of our student ID.

3.1 Murad al-mutairi 426102080

The first thing to do in this problem is to transform the state-space equations into transfer
function form. Next, close the loop and add some proportional control to see if the response can
be improved. Create a new m-file with the following lines of code:

m = 1000;
b = 50;
u = 500;
A = [0 1; 0 -b/m]
B = [0; 1/m]
C = [0 1]
D = 0

[num,den]=ss2tf(A,B,C,D)
k = 2080;
[numc,denc] = cloop(k*num,den,-1);
t = 0:0.1:20;
step(10*numc,denc,t)
axis([0 20 0 10])

Modeling a Cruise Control System


11

3.2 Mohammed al-wenais 427103009

m = 1000;
b = 50;
u = 500;
A = [0 1; 0 -b/m]
B = [0; 1/m]
C = [0 1]
D = 0

[num,den]=ss2tf(A,B,C,D)
k = 3009;
[numc,denc] = cloop(k*num,den,-1);
t = 0:0.1:20;
step(10*numc,denc,t)
axis([0 20 0 10])

As you can see at the gain 2080 has steady state error 2% and settling time 2 sec, and at the gain
3009 has steady state error 1% and settling time 1.5 sec.

Modeling a Cruise Control System


12

4. Close Loop

The state equations for this problem are:

4.1 P controller
The first thing to do in this problem is to transform the state-space equations into transfer
function form. Next, close the loop and add some proportional control to see if the response can
be improved. Both of these steps can be done sequentially in Matlab. Create a new m-file with
the following lines of code (or create a '.m' file located in the same directory as Matlab):

m = 1000;
b = 50;
u = 500;
A = [0 1; 0 -b/m]
B = [0; 1/m]
C = [0 1]
D = 0

[num,den]=ss2tf(A,B,C,D)
k = 100;
[numc,denc] = cloop(k*num,den,-1);
t = 0:0.1:20;
step(10*numc,denc,t)
axis([0 20 0 10])

The number 10 that is multiplied by numc in the step command is used to make the reference
signal 10 the original step response had a steady state value of 10m/sec for an applied force of
500N. This m-file should now represent that same desired steady-state value. Running your m-
file should give you the following plot of the velocity response to the step change in the
reference.

Modeling a Cruise Control System


13

As you can see, the step response is not very good. The steady state error is more than 10%, and
the rise time is still too slow. You can adjust the proportional gain to make the response better,
but you will not be able to make the steady state value go to 10m/sec without getting rise times
that are too fast. You must always keep in mind that you are designing a real system, and for a
cruise control system to respond 0-10m/sec in less than half of a second is unrealistic. To
illustrate this idea, adjust the k value to equal 10,000, and you should get the following velocity
response:

Modeling a Cruise Control System


14

The steady state error has been dropped to near zero, but the rise time on this step response is
way too fast (about 0.2 seconds). The solution to this problem is to add some integral control to
eliminate the steady state error. Adjust k until you get a reasonable rise time. For example, with
k = 600, the response should now look like:

Modeling a Cruise Control System


15

4.2 PI controller

Now, try PI control. Change your m-file to look like the following:

k = 600;
ki = 1;
num1 = [k ki];
den1 = [1 0];
num2 = conv(num,num1);
den2 = conv(den,den1);
[numc,denc] = cloop(num2,den2,-1);
t = 0:0.1:20;
step(10*numc,denc,t)
axis([0 20 0 10])

You should get the following velocity response plot:

Modeling a Cruise Control System


16

We suggest starting with a ki value that is small, i. e. around 1, to get a feel for what the integral
control is doing to the response. Remember, integral control makes the transient response worse,
so adding too much initially can make the response unrecognizable. Now you can adjust the ki
value to reduce the steady state error. With ki = 40 and k adjusted up a little more to 800, the
response looks like the following:

Modeling a Cruise Control System


17

As you can see, this step response meets all of the design criteria, and therefore no more iteration
is needed. It is also noteworthy that no derivative control was needed in this example.

The system was originally critically damped, making the overshoot equal to zero. Had more
integral control been needed to eliminate the steady state error, the transient response may have
worsen to the point of needing derivative control.

It is easy to implement the derivative control in Matlab. Just change the num1 = [k ki];
line to num1 = [kd k ki];. However, this will make it necessary to adjust three variables
simultaneously. The best way to do this would be to adjust one variable at a time starting with k,
then kd, and then ki. You may have to go back and readjust, or tweak, the variables (gains)
after they have all been set.

Modeling a Cruise Control System


18

5. Root Locus Method

Proportional controller

Since this system is first order, the problem can be solved using proportional control, although a
lag controller can be added if the steady state error becomes too high.

The design criteria of a rise time of less than 5 seconds implies that the natural frequency must
be greater than 0.36 (remember: tr = 1.8/Wn). The design criteria also states that the overshoot
must be less than 10% which implies that the damping ratio zeta must be greater than 0.6. We
will use this fact to start the design of the controller (note: the sgrid command can show the
regions of the root locus where these two criteria are satisfied).

m = 1000;
b = 50;
u = 500;
A = [0 1; 0 -b/m]
B = [0; 1/m]
C = [0 1]
D = 0

[num,den]=ss2tf(A,B,C,D)

You should get the following output:

A =
0 1.0000
0 -0.0500

B =
1.0e-03 *

0
1.0000

C =
0 1

D =
0
Modeling a Cruise Control System
19

num =
0 0.0010 0

den =
1.0000 0.0500 0
If you look at the transfer function closely, you will notice that there is a pole-zero cancellation
at the origin (both num and den have a root at zero, as can be easily seen since they each have
a zero constant term). Matlab does not automatically cancel the pole and zero. As a result, it
can cause confusion in the root locus plot, so it is best to eliminate it now. This can be done by
manually eliminating both the pole and zero. At the end of your m-file, add the following code:

num = [num(1), num(2)]


den = [den(1), den(2)]

The transfer function is now:

num =
0.0010

den =
1.0000 0.0500
Now, we shall plot the root locus and step response to see the effects of proportional control
on the system. Copy the following code to the end of you m-file:

figure
hold;
axis([-0.6 0 -0.6 0.6]);
rlocus(num,den)
sgrid(0.6,.36)
[k,poles] = rlocfind(num,den);
figure
t = 0:0.1:20;
[numc,denc] = cloop(k*num,den, -1);
step(10*numc,denc,t)
axis([0 20 0 10])

When prompted to select a point on the root locus, click on the real axis just to the left of the
natural frequency requirement (about -0.4). The 10 in the step response is multiplied to the
numerator so that the desired reference signal will be 10 instead of the default of 1. If you look
Modeling a Cruise Control System
20

back to the original cruise control problem, you will see that the steady state value should be
10. The first plot given by Matlab should be the root locus. The second plot should be the
velocity response to the step change in the reference. The two plots should look similar to the
following:

5.1 Lag controller

A lag controller can be added to improve the steady state error. For this lag controller, we will
place the zero at -0.3 and the pole will at -0.03; this will result in an improvement of the steady-
state error by a factor of 10 = 0.3/0.03.

Change your m-file to look like the following to implement this new controller:

m = 1000;
b = 50;
u = 500;
A = [0 1; 0 -b/m];
B = [0; 1/m];
Modeling a Cruise Control System
21

C = [0 1];
D = 0;

[num,den] = ss2tf(A,B,C,D);
num=[num(1), num(2)];
den=[den(1), den(2)];

numlag = [1 .3];
denlag = [1 .03];
num1 = conv(num,numlag);
den1 = conv(den,denlag);

axis([-0.6 0 -.4 .4]);


hold;
rlocus(num1,den1)
sgrid(.6,.36)
[k,poles] = rlocfind(num1,den1);
figure
t = 0:0.1:20;
[numc,denc] = cloop(k*num1,den1, -1);
step(10*numc,denc,t)
axis([0 20 0 12])

The root locus should look like the following:

Modeling a Cruise Control System


22

When prompted to select a point on the root locus, again click on the real axis just to the left of
the natural frequency requirement to achieve the desired rise time. Now you should have the
following velocity response:

Modeling a Cruise Control System


23

6. References

WWW.engin.umich.edu

Modeling a Cruise Control System

You might also like