Final Cruise Control
Final Cruise Control
Final Cruise Control
(MATLAB IMPLEMENTATION)
SUBMITTED BY :-
ACKNOWLEDGEMENT
We pose our copious gratitude and like to thanks the entire staff of CETPA INFOTECH PVT. LTD., LUCKNOW for their help and kind
cooperation during our entire project preparation. We are extremely thankful to them for providing us with vital information about the topic. We take this opportunity to pay our sincere thanks to Er. ACHAL MITTAL, PROJECT GUIDE. At last but not the least, we would like to thank our parents and all our peers who have been a constant source of encouragement and inspiration in every walk of life.
CERTIFICATE
TO WHOMSOEVER MAY IT CONCERN
This is to certify that the work which is being successfully presented in the project report entitled CRUISE CONTROL SYSTEM by us during one month course on MATLAB from CETPA INFOTECH PVT. LTD. LUCKNOW .
DATED:
This is to certify that the above statement made by the candidate is correct to the best of my knowledge.
SUBMITTED BY :JYOTI & ANJALI KASHYAP B.TECH. III YEAR (EC) PROJECT INCHARGE: (Er.ACHAL MITTAL)
INDEX
y y y y y
Introduction History Theory of operation Electronic Cruise Control System Modeling a Cruise Control System
Physical setup and system equations Design requirements MATLAB representation
1. 2.
INTRODUCTION
CRUISE CONTROL
Cruise control is a system that automatically controls the speed of a motor vehicle . It is sometimes known as speed control or autocruise. The system takes over the throttle of the car to maintain a steady speed as set by the driver.
HISTORY
The technology was invented by James Watt and Matthew Boulton in 1788 to control steam engines. Modern cruise control (also known as a speedostat) was invented in 1945 by the blind inventor and mechanical engineer Ralph Teetor. His idea was born out of the frustration of riding in a car driven by his lawyer, who kept speeding up and slowing down as he talked. The first car with Teetor's system was the Chrysler Imperial in 1958. This system calculated ground speed based on driveshaft rotations and used a solenoid to vary throttle position as needed.
THEORY OF OPERATION
The cruise control may need to be turned on before use in some designs it is always "on" but not always enabled (not very common), others have a separate "on/off" switch, while still others just have an "on" switch that must be pressed after the vehicle has been started. Most designs have buttons for "set", "resume", "accelerate", and "coast" functions. Some also have a "cancel" button. Alternatively, depressing the brake or clutch pedal will disable the system so the driver can change the speed without resistance from the system. The system is operated with controls easily within the driver's reach, usually with two or more buttons on the steering wheel spokes or on the edge of the hub like those on Honda vehicles, on the turn signal stalk like in many older General Motors vehicles or on a dedicated stalk like those found in, particularly, Toyota and Lexus. The driver must bring the vehicle up to speed manually and use a button to set the cruise control to the current speed. The cruise control takes its speed signal from a rotating driveshaft, speedometercable, wheel speed sensor from the engine's RPM or from internal speed pulses produced electronically by the vehicle. Most systems do not allow the use of the cruise control below a certain speed (normally around 25 mph). The vehicle will maintain the desired speed by pulling the throttle cable with a solenoid, a vacuum driven servomechanism or by using the electronic systems built into the vehicle (fully electronic) if it uses a 'drive-by-wire' system. All cruise control systems must be capable of being turned off both explicitly and automatically, when the driver depresses the brake and
often also the clutch. Cruise control often includes a memory feature to resume the set speed after braking and a coast feature to disengage the system without braking. When the cruise control is engaged, the throttle can still be used to accelerate the car, but once the pedal is released the car will then slow down until it reaches the previously set speed.
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 modeling equations for this system become:
(1) where u is the force from the engine. For this example, let's assume that m = 1000kg b = 50Nsec/m u = 500N
y 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%
MATLAB representation
1. Transfer Function
To find the transfer function of the above system, we need to take the Laplace transform of the modeling equations (1). When finding the transfer function, zero initial conditions must be assumed. Laplace transforms of the two equations are shown below:
Since our output is the velocity, let's substitute V(s) in terms of Y(s): The transfer function of the system becomes:
To solve this problem using MATLAB, copy the following commands into an new m-file: m=1000; b=50; u=500; num=[1]; den=[m b]; cruise=tf(num,den); These commands will later be used to find the open-loop response of the system to a step input. But before getting into that, let's take a look at the state-space representation.
2. State-Space
We can rewrite the first-order modeling equation (1) as the state-space model.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)
y Open-loop response
Now let's see how the open-loop system responds to a step input. Add the following command to the end of your m-file and run it in the MATLAB command window:
step(u*cruise)
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.
motion of the car, then the problem is reduced to the simple mass and damper system shown below:
where u is the force from the engine. For this example, let's assume that m = 1000kg b = 50Nsec/m u = 500N
open a new model window. First, we will model the integral of acceleration.
y Insert an Integrator Block (from the Linear block library) and draw lines to and from its input and output terminals. y Label the input line "vdot" and the output line "v" as shown below. To add such a label, double click in the empty space just above the line.
Since the acceleration (dv/dt) is equal to the sum of the forces divided by mass, we will divide the incoming signal by the mass. y Insert a Gain block (from the Linear block library) connected to the integrators input line and draw a line leading to the input of the gain. y Edit the gain block by double-clicking on it and change its value to "1/m". y Change the label of the Gain block to "inertia" by clicking on the word "Gain" underneath the block.
y y y
y y y
Now, we will add in the forces which are represented in Equation (1). First, we will add in the damping force. Attach a Sum block (from the Linear block library) to the line leading to the inertia gain. Change the signs of this block to "+-". Insert a gain block below the inertia block, select it by single-clicking on it, and select Flip from the Format menu (or type Ctrl-F) to flip it left-toright. Set the gain value to "b" and rename this block to "damping". Tap a line (hold Ctrl while drawing) off the integrator's output and connect it to the input of the damping gain block. Draw a line from the damping gain output to the negative input of the Sum Block.
y The second force acting on the mass is the control input, u. We will apply a step input. Insert a Step block (from the Sources block library) and connect it with a line to the positive input of the Sum Block. y To view the output velocity, insert a Scope (from the Sinks block library) connected to the output of the integrator.
To provide a appropriate step input of 500 at t=0, double-click the Step block and set the Step Time to "0" and the Final Value to "u".
Open-loop response
y To simulate this system, first, an appropriate simulation time must be set. Select Parameters from the Simulation menu and enter "120" in the Stop Time field. 120 seconds is long enough to view the open-loop response.
The physical parameters must now be set. Run the following commands at the MATLAB prompt: m=1000; b=50; u=500; Run the simulation (Ctrl-t or Start on the Simulation menu). When the simulation is finished, double-click on the scope and hit its autoscale button. You should see the following output.
y Save your file as "ccmodel.mdl" (select Save As from the File menu). MATLAB will extract the linear model from the saved model file, not from the open model window. At the MATLAB prompt, enter the following commands: [A,B,C,D]=linmod('ccmodel') [num,den]=ss2tf(A,B,C,D) You should see the following output, providing both state-space and transfer function models of the system. A =-0.0500 B =1.0000e-003 C =1 D =0 num =0 0.0010 den =1.0000 0.0500 To verify the model extraction, we will generate an open-loop step response of the extracted transfer function
in MATLAB. We will multiply the numerator by 500 to simulate a step input of 500N. Enter the following command in MATLAB
step(500*num,den);
You should see the following plot which is equivalent to the Scope's output.
Implementing PI Control
In the cruise control example a PI controller was designed with Kp=800 and Ki=40 to give the desired response. We will implement this in Simulink by first containing the open-loop system from earlier in this page in a Subsystem block. y Create a new model window.
y Drag a Subsystem block from the Connections block library into your new model window.
y Double click on this block. You will see a blank window representing the contents of the subsystem (which is currently empty). y Open your previously saved model of the Cruise Control system, ccmodel.mdl. y Select Select All from the Edit menu (or Ctrl-A), and select Copy from the Edit menu (or Ctrl-C). y Select the blank subsystem window from your new model and select Paste from the Edit menu (or Ctrl-V). y You should see your original system in this new subsystem window. Close this window. y You should now see input and output terminals on the Subsystem block. Name this block "plant model".
Now, we will build a PI controller around the plant model. First, we will feed back the plant output. y Draw a line extending from the plant output. y Insert a Sum block and assign "+-" to it's inputs. y Tap a line of the output line and draw it to the negative input of the Sum block.
y y y y y
The output of the Sum block will provide the error signal. From this, we will generate proportional and integral components. Insert an integrator after the summer and connect them with a line. Insert and connect a gain block after the integrator to provide the integral gain. Label this integrator Ki and assign it a value of Ki. Insert a new Gain block and connect it with a line tapped off the output of the Sum block. Label this gain Kp and assign it a value of Kp.
Now we will add the proportional and integral components and apply the sum to the plant. y Insert a summer between the Ki block and the plant model and connect the outputs of the two gain blocks to the summer inputs. y Connect the summer output to the input of the plant.
Finally, we will apply a step input and view the output on a scope. y Attach a step block to the free input of the feedback Sum block. y Attach a Scope block to the plant output. y Double-click the Step block and set the Step Time to "0" and the Final Value to "u". This allows the input magnitude to be changed outside of simulink. In this example, we constructed a PI controller from fundamental blocks. As an alternative, we could have used a Transfer Function block (from the Linear block library) to implement this in one step, as shown below.
Closed-loop response To simulate this system, first, an appropriate simulation time must be set. Select Parameters from the Simulation menu and enter "10" in the Stop Time field. The design requirements included a rise time of less than 5 sec, so we simulate for 10 sec to view the output. The physical parameters must now be set. Run the following commands at the MATLAB prompt: m=1000; b=50; u=10; Kp=800; Ki=40; Run the simulation (Ctrl-t or Start on the Simulation menu). When the simulation is finished, double-click on the scope and hit its autoscale button.