Cruise Control System
Cruise Control System
Islamabad
Assignment # 01 Advance Linear Control Systems
the car, but once the pedal is released the car will then slow down until it reaches the previously set speed. On the latest vehicles fitted with electronic throttle control, cruise control can be easily integrated into the vehicle's engine management system. Modern "adaptive" systems (see below) include the ability to automatically reduce speed when the distance to a car in front, or the speed limit, decreases. This is an advantage for those driving in unfamiliar areas. The cruise control systems of some vehicles incorporate a "speed limiter" function, which will not allow the vehicle to accelerate beyond a pre-set maximum; this can usually be overridden by fully depressing the accelerator pedal. (Most systems will prevent the vehicle accelerating beyond the chosen speed, but will not apply the brakes in the event of over speeding downhill.)
Application:
Cruise control system use to enhance the car sped when its move steady above the certain speed.
Second law: The acceleration a of a body is parallel and directly proportional to the net force F and inversely proportional to the mass m, i.e., F = ma. So from this equation we get :
(1)
Where u is the force from the engine, for this example assume that, (Mass) m=1000 kg
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% steadystate 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%
Transfer Function:
To find the transfer function of the above system, we need to take the Laplace transform of the modeling equations. When finding the transfer function, zero initial conditions must be assumed
Since our output is the velocity, let's substitute V(s) in terms of Y(s)
State-Space
We can rewrite the first-order modeling equation (1) as the state-space model. m(dy/dx)=by=u(t) X1=y X1=y or V=y or V=y V=u/m-b/m(v)
To use MATLAB to solve this problem, create an new m-file and copy the following commands
m = 1000; b = 50; u = 500; A = [-b/m]; B = [1/m]; C = [1]; D = 0; cruise=ss(A,B,C,D);
Open-loop response
Now let's see how the open-loop system responds to a step input. I get the following plot:
From the plot, we see that the vehicle takes more than 100 seconds to reach the steady-state speed of 10 m/s. This does not satisfy our rise time criterion of less than 5 seconds.
The transfer function in the plant is the transfer function derived above {Y(s)/U(s)=1/ms+b}. The controller will to be designed to satisfy all design criteria. Four different methods to design the controller are listed at the bottom of this page. I may choose on PID, Root-locus, Frequency response, or State-space.
where
The design criteria are: Rise time < 5 sec Overshoot < 10% Steady state error < 2% To see the original problem setup, refer to Cruise Control Modeling page.
Proportional controller
the root-locus plot shows the locations of all possible closed-loop poles when a single gain is varied from zero to infinity. Thus, only a proportional controller (Kp) will be considered to solve this problem. The closed-loop transfer function becomes:
Also, from the Root-Locus Tutorial, we know that the MATLAB command called sgrid should be used to find an acceptable region of the root-locus plot. To use the sgrid, both the damping
ratio (zeta) and the natural frequency (Wn) need to be determined first. The following two equations will be used to find the damping ratio and the natural frequency:
where Wn=Natural frequency zeta=Damping ratio Tr=Rise time Mp=Maximum overshoot One of our design criteria is to have a rise time of less than 5 seconds. From the first equation, we see that the natural frequency must be greater than 0.36. Also using the second equation, we see that the damping ratio must be greater than 0.6, since the maximum overshoot must be less than 10%. Now, we are ready to generate a root-locus plot and use the sgrid to find an acceptable region on the root-locus. .
m=1000; b=50; u=10; num=[1]; den=[m b]; cruise=tf(num,den);
rlocus(cruise)
axis([-0.6 0 -0.6 0.6]); sgrid(0.6, 0.36) [Kp, poles]=rlocfind(cruise) sys_cl=feedback(Kp*cruise,1); t=0:0.1:20; step(u*sys_cl,t) axis ([0 20 0 10])
The two dotted lines in an angle indicate the locations of constant damping ratio (zeta=0.6); the damping ratio is greater than 0.6 in between these lines and less than 0.6 outside the lines. The semi-ellipse indicates the locations of constant natural frequency (Wn=0.36); the natural frequency is greater than 0.36 outside the semi-ellipse, and smaller than 0.36 inside. If I look at the MATLAB command window, I see a prompt asking I to pick a point on the rootlocus plot. Since I want to pick a point in between dotted lines (zeta>0.6) and outside the semiellipse (Wn>0.36), click on the real axis just outside the semi-ellipse (around -0.4). I see the gain value (Kp) and pole locations in the MATLAB command window. Also I see the closed-loop step response similar to the one shown below.
With the specified gain Kp (the one I just picked), the rise time and the overshoot criteria have been met; however, a steady-state error of more than 10% remains.
Lag controller
To reduce the steady-state error, a lag controller will be added to the system. The transfer function of the lag controller is:
If I read the "Lag or Phase-Lag Compensator using Root-Locus the pole and the zero of a lag controller need to be placed close together. Also, it states that the steady-state error will be reduce by a factor of Zo/Po. For these reasons, let Zo equal -0.3 and Po equal -0.03. Create an new m-file, and enter the following commands.
m = 1000; b = 50; u = 10; Zo=0.3; Po=0.03; num=[1]; den=[m b]; cruise=tf(num,den); contr=tf([1 Zo],[1 Po]);
rlocus(contr*cruise);
axis([-0.6 0 -0.4 0.4]) sgrid(0.6,0.36); [Kp, poles]=rlocfind(contr*cruise); sys_cl=feedback(Kp*contr*cruise,1); t=0:0.1:20; step(u*sys_cl,t)
Running this m-file should give I a root-locus plot similar to the following:
In the MATLAB command window, I see the prompt asking I to select a point on the root-locus plot. Once again, click on the real axis around -0.4. I have the following response.
As I can see, the steady-state error has been reduced to near zero. The slight overshoot is a result of the zero added in the lag controller. The transfer function for this cruise control problem is the following,
and the block diagram of an typical unity feedback system is shown below.
The design criteria for this problem are: Rise time < 5 sec Overshoot < 10% Steady state error < 2%
Proportional control
The first thing to do in this problem is to find a closed-loop transfer function with a proportional control (Kp) added. By reducing the block diagram, the closed-loop transfer function with a proportional controller becomes:
kp=100; m=1000; b=50; u=10; num=[kp]; den=[m b+kp]; t=0:0.1:20; step(u*num,den,t) axis([0 20 0 10])
Running this m-file in the Matlab command window should give you the following step response.
We can use the Matlab command cloop to find the closed-loop response directly from the open-loop transfer function. If you choose to do so, change the m-file to the following and run it in the command window. You should get the same plot as the one shown above.
kp=100; m=1000; b=50; u=10; num=[1]; den=[m b]; [numc,denc]=cloop(kp*num,den,-1); t = 0:0.1:20; step (u*numc,denc,t) axis([0 20 0 10])
As you can see from the plot, both the steady-state error and the rise time do not satisfy our design criteria. You can increase the proportional gain (Kp) to improve the system output. Change the existing m-file so that Kp equal 10000 and rerun it in the Matlab command window. You should see the following plot.
The steady-state error has dropped to near zero and the rise time has decreased to less than 0.5 second. However, this response is unrealistic because a real cruise control system generally can not change the speed of the vehicle from 0 to 10 m/s in less than 0.5 second. The solution to this problem is to choose a proportional gain (Kp) that will give a reasonable rise time, and add an integral controller to eliminate the steady-state error.
PI control
The closed-loop transfer function of this cruise control system with a PI controller is:
An addition of an integral controller to the system eliminates the steady-state error. For now, let Kp equals 600 and Ki equals 1 and see what happens to the response.
kp = 600; ki = 1; m=1000; b=50; u=10; num=[kp ki]; den=[m b+kp ki]; t=0:0.1:20; step(u*num,den,t) axis([0 20 0 10])
kp=600; ki=1; m=1000; b=50; u=10; num=[1]; den=[m b]; num1=[kp ki]; den1=[1 0]; num2=conv(num,num1); den2=conv(den,den1); [numc,denc]=cloop(num2,den2,-1); t=0:0.1:20; step(u*numc,denc,t) axis([0 20 0 10])
Whichever the m-file you run, you should get the following output:
Now adjust both the proportional gain (Kp) and the integral gain (Ki) to obtain the desired response. When you adjust the integral gain (Ki), we suggest you to start with a small value since large (Ki) most likely unstabilize the response. With Kp equals 800 and Ki equals 40, the step response will look like the following:
As you can see, this step response meets all design criteria
PID control
For this particular example, no implementation of a derivative controller was needed to obtain a required output. However, you might want to see how to work with a PID control for the future reference. The closed-loop transfer function for this cruise control system with a PID controller is.
Matlab code:
kp=600; ki=10; kd=1; m=1000; b=50; u=10; num=[kd kp ki]; den=[m+kd b+kp ki]; t=0:0.1:20; step(u*num,den,t) axis([0 20 0 10])