Professional Documents
Culture Documents
Optimal Cruise Control
Optimal Cruise Control
Abstract: An algorithm for solving the cruise control problem of transferring the speed of a vehicle
between two values in a fixed interval of time using a predefined sequence of gears is presented. This
is a hybrid dynamic optimization problem since the control variables include both a continuous variable
(fuel flow) and a discrete variable (the gear to apply at each instant). The solution is given in the form
of a hybrid optimal control algorithm that computes the optimal switching times between gears using
Dynamic Programming and the optimal fuel profile between successive gear boundaries using a gradient
algorithm to approximate the optimum conditions. In order to reduce the search of the optimal switching
times to a search in a finite dimension graph, a procedure based on a changing grid is used. The algorithm
is illustrated by a simulation using a diesel one-dimensional car model.
5500
350
5000
300
Engine torque [Nm]
4500
250 4000
100
2000
50 1500
1000
0
1000 2000 3000 4000 5000
500
Engine speed [rpm]
0 1 2 3 4 5 6 7
Fuel flow [L/s] x 10
−3
The engine model assumes an input diesel flow u(t) measured The transmission links the wheels and the engine together
in liters per second. The total power P is given by using a gear box. Its role is to increase torque and decrease
wheel speed to match the operational range of the engine. The
P (t) = Eu(t). (1)
transmission also introduces internal drag that depends on the
where E is the total energy density of diesel fuel. A consider- engine speed. In the model developed here, the internal drag
able percentage of this power is dissipated in thermal losses, does not only model the transmission itself, but also all the load
and only a part is available as mechanical power, Pm , given by at the engine shaft.
Pm (t) = η Te (t), we (t) × P (t). (2) The torque output available at the car wheels is given by
where Te and ωe are the engine torque and speed and η is the Tw (t) = ri rf Te (t) − α − βωe (t) (5)
efficiency. The engine torque output is given by where ri is the gear ratio for gear i, rf is the final drive ratio
and α, β are drag coefficients.
Pm (t) η Te (t), we (t) × P (t)
Te (t) = = (3) Engine rotational speed, measured in [rad/s], is obtained from
ωe (t) ωe (t)
wheel speed by gear ratio conversion and is given by
Equation (3) constitutes an algebraic loop, since efficiency η ωe (t) = ri rf ωw (t) (6)
and engine torque values are computed based on each other,
which makes computations more taxing. To overcome this, the 2.3 Traction force and wheels
torque value as a function of we (t) and u(t) can be numerically
computed, by solving the algebraic loop (3) offline. The wheels are modeled as a rotational to linear movement
converter neglecting inertia and drag. Wheel rotational speed,
For the purposes of this work, it was assumed that efficiency measured in [rad/s], is given by
level-curves on the (Te , we ) plane are elliptical (figure 1),
2π
ωw (t) = v(t) (7)
(Te − cT )2 (we − cw )2
Λ
η Te , we = χ − θ + (4)
lT lw where Λ is the wheel perimeter. The used tire dimensions
are 205/55R16, corresponding to a perimeter of Λ = 1.9852
for a reasonable choice of the parameters cT , lT , cw and lw . meters.
Constants χ and θ perform a linear transformation, making the
elliptic surface concavity face downwards instead of upwards. Similarly, the traction force is obtained from the torque applied
Constant χ is the value of the maximum efficiency, i.e. when by the engine at the wheels
(Te , we ) = (cT , cw ) then η = χ. 2π
F (t) = Tw (t) (8)
In this specific case a closed-form solution for computing Te (t) Λ
can be easily derived by replacing (4) in (3). 2.4 Car dynamic model
From the data available for this engine, it is known that it
achieves a maximum torque of 310 Nm at 1800-2400 rpm. The evolution of the car speed depends of the forces applied.
Below and above this operational range the torque is reduced. The forces considered are: traction force F (t), gravitational
It is also known that a maximum power of 93kW is attained force and aerodynamic drag Fa (t).
3
at 3600 rpm, implying a torque T = 93×10 60 1
3600 2π ≈ 246.7 v̇(t) = −9.8 sin(θ) + (F (t) − Fa (t)) (9)
Nm at that speed. From this scarce data, a maximum torque m
curve was designed as shown in figure 1. For any given engine where θ is the terrain inclination. Aerodynamic drag is assumed
speed, admissible engine torque values lie below this curve. The to be given by
numerical solution of equation (3) given the efficiency function 1 2
(4) is represented in figure 2. Fa (t) = ρACd v(t) − vwind (t) (10)
2
parameter value units 2.6
−3
x 10 Control signal u(t)
m 1500 Kg 2.4
A 2.29 m2 1.8
1.6
Cd 0.29 - 1.4
0 2 4 6 8 10 12 14 16 18 20
P 1.9852 m Time [s]
Car speed
α 35 Nm 90
E 40.8e6 J/L 80
70
0 2 4 6 8 10 12 14 16 18 20
Time [s]
r6 0.673
90
rf 3.240
80
Table 2. Non-linear car model gear ratio values
70
40
Table 1 contains the values used for the nonlinear car model 30
50 2
0
0 20 40 60 80 100 120 1
0 2 4 6 8 10 12 14 16 18 20
Time [s] Time [s]
Engine speed Car speed
6000
100
Speed [rpm]
Speed [Km/h]
4000
80
2000
60
0
0 20 40 60 80 100 120 40
Time [s] 0 2 4 6 8 10 12 14 16 18 20
Torque [Nm]
300
200
Maximum torque
250
100 200
0 150
0 20 40 60 80 100 120
100
Time [s] 0 2 4 6 8 10 12 14 16 18 20
Time [s]
6 X3
State value
4 f2
X
2 2
0
f1
X
1
−2 | | | | | | | |
1 1 1 2 2 3 3 1
−4 t1 t2 t3 t2 t3 t2 t3 t4
−6
Time
−25 −20 −15 −10 −5 0 5 10 15 20 25
Parameter "R" variation [%]
Corresponding graph
Fig. 7. Sensitivity curve for parameter Λ (car wheel perimeter)
for a speed transfer with initial speed x0 = 60 Km/h and t1 t1
2 3
terminal speed xf = 150 Km/h in 90 seconds, using gear
5
1 2 2 1
The following procedure consists of an algorithm to find a t1 t2 t3 t4
suboptimal solution for the optimal switched dynamics state
transfer problem, i.e. making the state change from an initial
value x0 at t0 to a desired target value xf at the final time tf , t3 t3
2 3
where t0 and tf are given and fixed. The algorithm is based on f1 f2 f3
dynamic optimization in that the desired state transfer, x0 to xf , X1 X2 X3 X4
is broken up into smaller state transfer problems, one for each State value
distinct dynamics. The sequence of dynamics equations and
the state values at which a switch between dynamics equations
occur are given. The performance index, to minimize has the
form Z tf Fig. 8. Candidate time values for a switched dynamics opti-
mization problem with 3 plants, f1 , f2 and f3
J= L(x(t), u(t))dt (15)
t0
where x(t) and u(t) are the state and control vectors at some In the sequel, when referring to tji , we will use the notion of
time t, respectively. In the case of the minimum fuel problem, time value and node interchangeably, since the lower index i
the lagrangian is given by L = u(t). Let already indicates that this is a time value belonging to state
Xi i = 1, ..., N + 1 (16) value Xi .
be the state values at which a switch between plant dynamics The total procedure can be separated into three phases:
occurs, which are given and fixed, such that the plant dynamics
fi apply when performing state value transfers from Xi to 1. Define graph nodes and arcs
Xi+1 . The initial and final state values are x0 and xf . The Nodes: The initial and final state values correspond to two
dynamic optimization procedure consists of finding the optimal nodes, t0 and tf , respectively. For the remaining state values,
switching instants X2 , ..., XN , define a set of candidate nodes (18), such that
t∗i , i = 1, ..., N + 1 (17) t1i < t1i+i and tM i Mi+1
< ti+1 , for i = 2, ..., N , i.e. the first
i
in respect to the chosen state values Xi , where t∗i corresponds to and last candidate nodes of switch i must be smaller than the
the time instant at which the state value Xi occurs. Naturally, first and last candidate nodes of switch i + 1 (see figure 8).
the first and last time instants are t∗1 ≡ t0 and t∗N +1 ≡ tf .
In order to determine the remaining N − 1 optimal switching Arcs: Acceptable arcs on the graph are all those that connect a
instants, a set of Mi candidate time values is defined node at switch Xi with another node at the following switch
Xi+1 , and such that the time of the former node is strictly
tji , j = 1, ..., Mi (18) smaller than the time of the latter.
at which each of the N − 1 intermediate state values Xi , i =
2, ..., N are attained. 2. Compute optimal control, and corresponding cost, for all
arcs in graph
This defines a grid of state/time values that can also be rep-
resented as an oriented graph, as shown in figure 8. The cost For each arc connecting nodes tji and tki+1 , compute the optimal
of each arc of the graph is computed by (15), where the inte- i+1,k
control signal ui,j using the algorithm described in Appendix
gration interval corresponds to the time interval where that arc Bryson and Ho (1975), and the corresponding performance
is defined. The optimal switching instants (in respect to all the index value Ji,ji+1,k
, for performing the optimal state value
candidates) are computed as those for which the total cost for transfer from Xi to Xi+1 . If a given arc is impossible, e.g. the
transferring the state value from x0 at t0 to xf at tf is minimum. corresponding state transfer cannot be accomplished in the time
Having computed all the N + 1 optimal switching instants, the
interval that spans between tji and tki+1 , the cost of that arc is
resulting set of instants can be adjusted and refined by creating set to +∞.
new sets of candidate time values (18) and repeating the same
procedure. 3. Determine optimal path and corresponding cost
The maximum-cost path that connects the first and last nodes, *
Iteration 1 (J = 0.029023)
t0 and tf , is the optimal path with respect to the candidate 70
Optimal state trajectory
nodes established in 1. The nodes that make up the optimal path 65
connects that node to the final node tf . Let u∗tj be the optimal 50
i
tji
control signal that connects to the next node on its optimal 45
path and Jt∗j the cost of the whole optimal path connecting tji 40
i
to tf . The dynamic programming approach consists of going 35
*
where the first term inside the brackets corresponds to the cost Iteration 2 (J = 0.028874)
70
of going from tji to tki+1 and the second term corresponds to the Optimal state trajectory
65
optimal cost of going from tki+1 to the final node tf . The optimal
cost of the node, Jt∗j , is then computed as the sum of both terms 60
for node tji , i.e. the node tki+1 for which (19) is achieved, is also 50
registered. 45
When all nodes on the graph have been labeled with the optimal 40
cost to go an the optimal decision, the total optimal cost for
35
the state transfer problem is J ∗ ≡ Jt∗0 . The optimal path can
be easily reconstructed by starting from the first node t0 and 0 5 10 15
recursively jumping to the optimal decision until the final node Time [s]
tf is reached. Finally, the total optimal control signal u∗ can be
recovered from the individual optimal control signals along the Fig. 10. Candidate time values and optimal path after iteration
optimal path. 2
It is remarked that the solution is suboptimal in the sense that *
Iteration 3 (J = 0.028828)
the switching state values Xi are fixed and that the global 70
Optimal state trajectory
optimum may not be found. 65
45
40
65
3
60
Car speed [Km/h]
55
45
Optimal state trajectory 2
40
35
1.5
0 5 10 15
Time [s]
1
0 5 10 15
Time[s]
Fig. 12. Candidate time values and optimal path after iteration
4 Fig. 15. Resulting optimal control for the speed transfer prob-
*
Iteration 13 (J = 0.028743) lem.
70
427.
65
Bryson, A. E., and Ho, Y. C. (1975). Applied Optimal Control.
60 Hemisphere, New York.
Bryson, A. E. (1999). Dynamic Optimization. Addison-Wesley.
Car speed [Km/h]
55
Ferreau, H. J., Lorini, G. and Diehl, M. (2006). Fast nonlinear
50 model predictive control of gasoline engines. Proc. 2006
45
IEEE Int. Conf. on Control Applications, Munich, Germany,
Optimal state trajectory 2754-2759.
40
Gausemeir, S., K.-P. Jaker and A. Trachtler (2010). Multi-
35 objective Optimization of a Vehicle Velocity Profile by
Means of Dynamic Programming. Prep. IFAC Symp. Ad-
0 5 10 15 vances in Automotive Control, AAC2010, Munich, Germany.
Time [s]
Hashimoto, S. , Okuda, H., Okada, Y., Adachi, S., Niwa, S.
and Kajitani, M. (2006). An engine control systems design
Fig. 13. Candidate time values and optimal path after iteration for low emission vehicles by generalised predictive control
13 based on identified model. Proc. 2006 IEEE Int. Conf. on
Performance index value along iterations Control Applications, Munich, Germany, 2411-2416.
0.029
Hedlund, S. and A. Rantzer (1999). Optimal Control of Hybrid
0.029 Systems. Proc. 38th CDC, Phoenix, Arizona, 3972-3977.
Performance index value (J)
Fig. 14. Evolution of the performance index value along 9 Appendix A. ITERATIVE SOLUTION FOR THE OPTIMAL
iterations of the hybrid dynamic optimization procedure CONTROL PROBLEM WITH TERMINAL CONSTRAINTS
expense of computational load. In turn, this may be reduced
Let
by replacing the gradient algorithm to solve state transfer with
constant dynamics by more efficient algorithms Ferreau et al. ẋ = f (x, u, t), t ∈ [t0 , tf ], x(t0 ) = x0 (A.1)
(2006). describe the nonlinear time-varying dynamics of a plant, with
given initial condition x0 , where x(t) ∈ Rn and u(t) ∈ Rm are
REFERENCES the state and input vectors at time t, respectively, and
Z tf
Bemporad, A. and N. Giorgetti (2006). Logic-Based Solu- J = φ(x(tf ), tf ) + L(x(t), u(t), t)dt (A.2)
tion Methods for Optimal Control of Hybrid Systems. IEEE t0
Trans. Autom. Control, 51(6):963-976. a performance index to maximize. A minimization problem
Bemporad, A. and M. Morari (1999). Control of systems inte- can also be formulated by maximizing the performance index
grating logic, dynamics and constraints. Automatica, 35:407- Jmin = −J.
The optimal control problem with terminal constraints consists Evaluate ψ at the terminal time and compute the gradient
in finding the input signal u∗ (t), t ∈ [t0 , tf ], for which the signals δuk (t) and δuη (t) for all t ∈ [t0 , tf ]
plant exhibits a state trajectory x∗ (t) such that the terminal state δuk (t) = [HuΦ (t) + ν T HuΨ (t)]T
value, x∗ (tf ), verifies a set of terminal constraint functions, in
the form of q restriction equations, δuη (t) = [HuΨ (t)]T Q−1 ψ(tf )
"
ψ1 (x(tf ), tf )
# " #
0 where δuk (t) allows improvement in the performance index
ψ(x(tf ), tf ) = ··· = ··· (A.3) value, and δuη (t) allows improvement of satisfying the ter-
ψq (x(tf ), tf ) 0 minal constraints i.e. allows feasibility of the optimal control
signal u(t) with respect to the terminal state constraint function
and such that the performance index value, J, is maximum. ψ.
An iterative numerical algorithm for obtaining the optimal con- 6. Compute and update the estimate of the optimal control
trol signal under these circumstances is now described Bryson signal
and Ho (1975). An initial estimate for the optimal control sig-
nal must be provided. Each iteration consists of the following Compute the control correction signal δu(t)
steps: δu(t) = −kδuk (t) − ηδuη (t)
1. Integrate state equation and update the estimate of the optimal control signal
Using the current estimate of the optimal control signal, u(t) ∈ u(t) ← u(t) + δu(t)
Rm , integrate the state equation A.1 to obtain the state evolution choosing k < 0 (k > 0) if maximizing (minimizing) the
x(t) ∈ Rn from t0 to tf . performance index, and 0 < η ≤ 1.
2. Integrate co-state equations 7. Evaluate stop criteria
Let λΦ (t), an (n×1) vector, and λΨ (t), an (n×q) matrix, be co- Compute the root-mean-square value of δu(t) using the stan-
state variables. Define the corresponding Hamiltonian functions dard definition s
as 1
Z tf
T
H Φ (λΦ , x, u, t) = L(x, u, t) + λΦ f (x, u, t), (δu)rms = [δu(t)]2 dt
t f − t 0 t0
T
H Ψ (λΨ , x, u, t) = λΨ f (x, u, t),
The algorithm stops if (δu)rms is smaller than a specified
and integrate backwards, from tf to t0 , the adjoint equations
threshold, or if the maximum number of iterations is reached.
∂L T ∂f
−[λ̇Φ ]T = HxΦ = + λΦ ,
∂x ∂x
T ∂f
−[λ̇Ψ ]T = HxΨ = λΨ ,
∂x
for which the terminal co-state conditions are
λΦ (tf ) = φTx (x(tf ), tf ),
λΨ (tf ) = ψxT (x(tf ), tf ).
3. Compute Hamiltonian partial derivatives
Compute the Hamiltonian functions partial derivatives with
respect to the control signal u for all t ∈ [t0 , tf ],
∂L T ∂f
HuΦ = + λΦ
∂u ∂u
Ψ Ψ T ∂f
Hu = λ
∂u
Hu (t) is a (1 × m) vector and HuΨ (t) is a (q × m) matrix.
Φ