Difference between revisions of "Cruise control"

From FBSwiki
Jump to: navigation, search
(added further reading section)
Line 7: Line 7:
  
 
A simple control algorithm for controlling the speed is to use a "proportional plus integral" feedback.  In this algorithm, we choose the amount of gas flowing to the engine based  on both the error between the current and desired speed, and the integral of that error.  [[Image:speedresp.png|right|300px]]  The plot on the right shows the results of this feedback for a step change in the desired speed and a variety of different masses for the car (which might result from having a different number of passengers or towing a trailer).  Notice that independent of the mass (which varies by a factor of 3), the steady state speed of the vehicle always approaches the desired speed and achieves that speed within approximately 5 seconds.  Thus the performance of the system is robust with respect to this uncertainty.  
 
A simple control algorithm for controlling the speed is to use a "proportional plus integral" feedback.  In this algorithm, we choose the amount of gas flowing to the engine based  on both the error between the current and desired speed, and the integral of that error.  [[Image:speedresp.png|right|300px]]  The plot on the right shows the results of this feedback for a step change in the desired speed and a variety of different masses for the car (which might result from having a different number of passengers or towing a trailer).  Notice that independent of the mass (which varies by a factor of 3), the steady state speed of the vehicle always approaches the desired speed and achieves that speed within approximately 5 seconds.  Thus the performance of the system is robust with respect to this uncertainty.  
<br clear=both>
 
'''[[Exercise: Exploring the performance of a cruise controller]]'''
 
  
'''More information:'''
+
== SIMULINK model ==
* How Stuff Works: [http://auto.howstuffworks.com/cruise-control.htm cruise control]
+
* Wikipedia: [[Wikipedia:Cruise control|cruise control]]
+
 
+
== System model ==
+
 
[[Category:Running examples]]
 
[[Category:Running examples]]
  
The file {{matlabfile|cruisectrl.mdl}} contains a simple model of a cruise controller for a car, depicted below.
+
The file {{matlabfile|cruise_ctrl.mdl}} contains a fairly complete model of a cruise controller for a car, depicted below.
  
<center>[[Image:cruisectrl.png|500px]]</center>
+
<center>[[Image:cruise_ctrl.png|500px]]</center>
  
The system consists of a simple model of a vehicle (''vehicle dynamics''), with a proportional plus integral (PI) control law to track a step change in the car velocity. The commanded and actual variables are stored to the MATLAB workspace, along with the time vector.  The vehicle model is defined in the file {{matlabfile|cruisedyn.m}} and corresponds to the model described in {{chlink|Examples}}.  Its dynamics are given by
+
== MATLAB model ==
<center><amsmath>m \dot v = F - F_d</amsmath></center>
+
An alternative model for the system is a MATLAB model suitable for use with the 'ode45' function.
where <math>v</math> is the vehicle velocity, <math>m</math> is the mass of the vehicle, <math>F</math> is the force applied by the engine and <math>F_d = F_a + F_r + F_g</math> are the disturbance forces (aerodynamic drag, rolling friction and gravity).  The engine force depends on the vehicle velocity and the throttle command, <math>u</math>.
+
  
The model is initialized at 25 m/s (approximately 90 kph or 55 mph).  The throttle command is saturated at the maximum torque of the engine. These dynamics are in the subsytem block labelled ''vehicle dynamics''.  The control law attempts to maintain the vehicle speed by applying a motor force that is the
+
== Exercises ==
sum of two terms:
+
The following exercises make use of the cruise control model described here:
* a proportional gain that depends on the difference in speed between the commanded input and current vehicle speed
+
* Chapter 1: '''[[Exercise: Exploring the performance of a cruise controller*|Exploring the performance of a cruise controller]]'''
* an integral gain that depends on the integrated error of the commanded and current speed.
+
 
+
The commanded speed is set by a step input, which changes from 25 m/s to 30 m/s at t = 2 seconds. The integrator is initialized so that the initial input from the control law keeps the car at 25 m/s, the initial speed of the car.  The gains for the control law are shown in the green (shaded) boxes. They can be set by double clicking on them and typing the new value in the dialog box. The default gains give a stable control law with some overshoot and a fairly long settling time. The simulation store three variables to the MATLAB workspace:
+
<blockquote>
+
{|
+
|-
+
| <tt>ref</tt> ||&nbsp; the commanded (reference) velocity for the car
+
|-
+
| <tt>vel</tt> ||&nbsp; the actual velocity of the car
+
|-
+
| <tt>time</tt> || &nbsp; the time vector for the simulaton
+
|}
+
</blockquote>
+
These variables are all stored as simple arrays, allowing them to be plotted using the plot command.
+
  
 
== Further Reading ==
 
== Further Reading ==
 +
* How Stuff Works: [http://auto.howstuffworks.com/cruise-control.htm cruise control]
 +
* Wikipedia: [[Wikipedia:Cruise control|cruise control]]

Revision as of 02:33, 6 April 2008

This page documents the cruise control system that is used as a running example throughout the text. A detailed description of the dynamics of this system are presented in Chapter 3 - Examples. This page contains a description of the system, including the models and commands used to generate some of the plots in the text.

Introduction

Speedsys.jpg

Cruise control is the term used to describe a control system that regulates the speed of an automobile. Cruise control was commercially introduced in 1958 as an option on the Chrysler Imperial. The basic operation of a cruise controller is to sense the speed of the vehicle, compare this speed to a desired reference, and then accelerate or decelerate the car as required. The figure to the right shows a block diagram of this feedback system.

A simple control algorithm for controlling the speed is to use a "proportional plus integral" feedback. In this algorithm, we choose the amount of gas flowing to the engine based on both the error between the current and desired speed, and the integral of that error.
Speedresp.png
The plot on the right shows the results of this feedback for a step change in the desired speed and a variety of different masses for the car (which might result from having a different number of passengers or towing a trailer). Notice that independent of the mass (which varies by a factor of 3), the steady state speed of the vehicle always approaches the desired speed and achieves that speed within approximately 5 seconds. Thus the performance of the system is robust with respect to this uncertainty.

SIMULINK model

The file {{{2}}} contains a fairly complete model of a cruise controller for a car, depicted below.

Cruise ctrl.png

MATLAB model

An alternative model for the system is a MATLAB model suitable for use with the 'ode45' function.

Exercises

The following exercises make use of the cruise control model described here:

Further Reading