# Hybrid control for low-regular nonlinear systems: application to an embedded control for an electric vehicle

Thomas Chambrion, Gilles Millérioux

► To cite this version:

Thomas Chambrion, Gilles Millérioux. Hybrid control for low-regular nonlinear systems: application to an embedded control for an electric vehicle. 2017. hal-01567396

HAL Id: hal-01567396

https://hal.science/hal-01567396

Preprint submitted on 23 Jul 2017

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>
# Hybrid control for low-regular nonlinear systems: application to an embedded control for an electric vehicle

Thomas Chambrion*†‡

Gilles Millerioux§

July 23, 2017

## Abstract

This note presents an embedded automatic control strategy for a low consumption vehicle equipped with an “on/off” engine. The main difficulties are the hybrid nature of the dynamics, the non smoothness of the dynamics of each mode, the uncertain environment, the fast changing dynamics, and low cost/ low consumption constraints for the control device. Human drivers of such vehicles frequently use an oscillating strategy, letting the velocity evolve between fixed lower and upper bounds. We present a general justification of this very simple and efficient strategy, that happens to be optimal for autonomous dynamics, robust and easily adaptable for real-time control strategy. Effective implementation in a competition prototype involved in low-consumption races shows that automatic velocity control achieves performances comparable with the results of trained human drivers. Major advantages of automatic control are improved robustness and safety. The total average power consumption for the control device is less than 10 mW.

## Contents

<table><tr><td>1 Introduction</td><td>2</td></tr><tr><td>2 Autonomous dynamics in finite time</td><td>3</td></tr><tr><td>2.1 Statement of the optimal control problem</td><td>3</td></tr><tr><td>2.2 Preliminaries</td><td>4</td></tr><tr><td>2.3 Physical assumptions</td><td>5</td></tr><tr><td>2.4 Oscillating structure of the solutions of Problem 1</td><td>7</td></tr><tr><td>3 Autonomous dynamics with infinite time horizon</td><td>9</td></tr><tr><td>3.1 Statement of the optimal problem</td><td>9</td></tr><tr><td>3.2 Main Result</td><td>9</td></tr><tr><td>3.3 Proof</td><td>9</td></tr><tr><td>3.4 Practical determination of the upper and lower speed limits</td><td>12</td></tr><tr><td>4 Non autonomous problem in finite time</td><td>12</td></tr><tr><td>4.1 Modeling</td><td>12</td></tr><tr><td>4.2 Description of the strategy</td><td>13</td></tr><tr><td>4.3 Well-posedness</td><td>13</td></tr><tr><td>4.4 Constraints fulfillment and robustness</td><td>13</td></tr><tr><td>5 Effective implementation</td><td>14</td></tr><tr><td>5.1 Vir'Volt 2 prototype</td><td>14</td></tr><tr><td>5.2 Effective results</td><td>15</td></tr><tr><td>6 Conclusions</td><td>15</td></tr></table>

<footnote>* Université de Lorraine, IECL, UMR 7502, 54506 Vandoeuvre-lès-Nancy, France</footnote>

<footnote>† CNRS, UMR 7502, 54506 Vandoeuvre-lès-Nancy, France</footnote>

<footnote>‡ Inria, 54600 Villers, France, Thomas.Chambrion@univ-lorraine.fr</footnote>

<footnote>§ Université de Lorraine, CRAN, UMR 7039, 54506 Vandoeuvre-lès-Nancy, France, Gilles.Millerioux@univ-lorraine.fr</footnote>
<figure><img src="image_2.png" /><figcaption>Figure 1: Test run of Vir'Volt 2 in Rotterdam (May 2014).</figcaption></figure>

# 1 Introduction

The European Shell Eco-Marathon™ brings together over 200 teams from high schools and universities from all over Europe, in a race involving ecological and economical vehicles. The principle of the race is to go through a given distance in a limited time and with the lower energy consumption. The aim of this note is to expose the design and the implementation of an embedded automatic control of the speed on the prototype Vir'Volt 2 (see Figure 1), built by the students of École Supérieure des Sciences et Technologies de Nancy (ESSTIN) in France that participated to the edition 2014 of the European Shell Eco-Marathon.

A crucial feature of the prototype is the hybrid nature of the control. Indeed, the DC electric motor is either switched on or switched off. The energy consumption of the vehicle is reduced to a roughly constant residual consumption of the electronics (a few milliwatts) when the engine is off and goes up to 160 W when the engine is on. When the engine is off, the transmission parts (gears, chains,...) are decoupled from the wheels and rapidly stops (the kinetic energy is dissipated by friction and Joule effect in the engine). When the engine is switched on, the transmission parts (gears, chains, ...) that were at rest have to speed up in order to reach the wheels velocity, before the coupling allows energy to be transmitted from the engine to the wheels. The difference between the kinetic energy of the freely evolving transmission parts and the transmissions parts rotating at engine speed is far from being negligible (about 10 J), and has to be paid each time the motor is switched on.

Clearly, the issue enters the context of control in switched systems. Switching systems are widely involved in industrial processes [23] and have been a major field of interest in automatic control [7][19] for years. Optimal control of such switched systems is now pretty well understood for linear dynamics [25, 26, 14, 21]. For non linear dynamics, the case without switching cost has raised considerable attention, see for instance [13, 28, 5, 4, 18, 1]. The optimization problem is classically tackled with the Pontriaguin Maximum Principle (PMP), see for instance [2] for an intrinsic formulation. Non smooth extensions of the PMP have been developed to include the case of non smooth trajectories or nonzero switching costs [27, 24].

Two difficulties prevent the direct use of these results in our case.

The first difficulty arises when modeling the dynamics. In the standard frame of Lipschitz continuous dynamics, a vehicle with switched off engine on a flat road will never be at rest because of the principle of non-intersection of solutions. A more realistic modeling (where cars can actually stop) requires to consider less regular dynamics, which usually give rise to non-trivial technical subtleties. This explain that this approach is rare in practice (with few exceptions, such as [17] for instance).

The second difficulty is the heavy computational burden. Even in the standard Lipschitz continuous frame-
work, with especially adapted algorithm [15, 9, 10], some dozen of seconds of computations are needed with a powerful desktop computer to compute the optimal strategy of a 39 minutes run, and any perturbation (traffic, weather change,...) requires a new computation. Following the rules of the competition, this computation has to be done or stored in the vehicle (not off board). Even for races where the electric energy needed to do the computation is not incorporated in the total energy consumption, the battery weight has bad influence on the total consumption. Online integration of the PMP requires a strong multi-core processor (about 50 W on average, about 100 kJ for the race). Table of optimal trajectories may be pre-computed offline and stored inboard. The main drawback of this approach is the cost of construction (pre-computation) of such a table - this includes a good knowledge of the geometry of the track and a reliable meteorological date base. This pre-computation process has to be redone for every different race.

Since global optimization seems out of reach, one may consider finite horizon optimization (as in Model Predictive Control). Even in this case, the computational burden is not to be neglected: a small linux computer with an average power of 5 W requires about 10 kJ for the race, to be compared with the 100 kJ needed to move the vehicle. Moreover, the choice of the horizon is usually difficult because it impacts on both feasibility [3, 8, 20] and stability issues (see [11, 16, 6, 22] for computational aspects with invariant set-based approaches).

Any proposed strategy to adapt the prototype speed will be an imperfect trade-off between robustness, computational tractability and efficiency. In energy efficient prototypes competitions, human drivers usually have an oscillating strategy, letting the velocity evolve between a lower and an upper limit. Our main result is a rigorous proof that, with physically reasonable assumptions, the long term optimal strategy for a stationary problem (wind and track slope remain constant) has exactly this pattern. Taking advantage of the particular structure of these solutions, this paper gives an explicit control strategy for the general problem (variable wind and slope) to adapt the finite horizon of the optimization scheme, with the following features:

* Very low computational burden, implementable on low-cost embedded micro-controller for real-time automatic control;

* Very low power consumption (less than 10 mW in average, about 15 J for the race);

* Real time adaptability with respect to changes in dynamics, weather or traffic conditions;

* Optimality of the control law if the race conditions (wind and slope) are constant.

The result applies also in the case (important in practice) where the dynamics is not Lipschitz continuous.

The layout of the paper is the following. In Section 2, the time independent model of the dynamics is presented and a finite-time horizon is considered. For this special case (autonomous dynamics corresponding to constant slope of the track, wind strength and direction), we prove (Proposition 3) that the optimal driving strategies exhibit a very simple behavior, where the speed oscillates, most of the time, between a maximum and a minimum without intermediate local extrema. In Section 3, we consider a long term version of the problem studied in Section 2, that is infinite time horizon. Once again, the optimal strategy exhibits a very simple periodic pattern. In Section 4, a non autonomous model for the dynamics is considered by taking into account possible external disturbances like variable slope, wind, .... Some preliminary well-posedness mathematical results are introduced. Next, we use the strong geometric structure of the optimal strategies in the autonomous case (the finite horizon of the optimization scheme is the period of the optimal control computed in Section 2). Stability and robustness analyses completes this section. Finally, Section 5 is devoted to the results obtainef from a real-life implementation on the prototype during the competition.

# 2 Autonomous dynamics in finite time

## 2.1 Statement of the optimal control problem

Let us consider the unperturbed dynamics of the vehicle given by:

$$ \dot{x} = f(x, u) \qquad (1) $$

where $x$ is the real-valued speed of the prototype, $u$ is the control, a piecewise constant function taking value in $\{0, 1\}$ representing the state of the engine (0 is off, 1 is on), and $f: \mathbf{R} \times \{0, 1\} \to \mathbf{R}$ is the dynamics. The initial condition $x(0) = x_0 \ge 0$ corresponds to the speed at start.
Hereafter, the total duration of the race will be denoted with $T$ ($T > 0$), the length of the track will be denoted with $L$ ($L > 0$) and the average speed will be denoted with $V = L/T$ ($V > 0$).

Let $u : [0, T] \to \{0, 1\}$ be piecewise constant control. For a real constant $T_1 > 0$, a real-valued function $x : [0, T_1] \to \mathbf{R}$ is a solution of (1) if $x$ is continuous, piecewise differentiable and satisfies (1) for almost every time $t$ in $[0, T_1]$.

Let us recall that a real-valued function $g : [0, T_1] \to \mathbf{R}$ is absolutely continuous if $g$ is differentiable almost everywhere in $[0, T_1]$ with integrable derivative $g'$ that satisfies $g(t) = g(0) + \int_0^t g'(s)ds$ for every $t$ in $[0, T_1]$. With every admissible control $u$ and absolutely continuous solution $x$ of (1), we associate the energy cost

$$C(u) = \int_{0}^{T} h(x(t), u(t))dt + \alpha N(u) \qquad (2)$$

where $h : [0, +\infty) \times \{0, 1\} \to [0, +\infty)$ is a $C^1$ function accounting for the instantaneous power consummed by the vehicle, $\alpha$ is a positive real constant (representing the cost to switch the motor on) and $N$ denotes the number of times that $u$ jumps from 0 to 1.

The problem to be solved is the following

**Problem 1** Find a piecewise constant control $u : [0, T] \to \{0, 1\}$ such that the associated solution of (1) with given initial condition $x_0$ satisfies $\int_0^T x(t)dt = L$ and minimizes the cost (2).

To ensure that the problem is well-posed, we need some regularity assumptions on $f$.

**Assumption 1** 1. For any $u$ in $\{0, 1\}$, the one-variable function $x \mapsto f(x, u)$ is continuous.

2. For every $x_0$ in $\mathbf{R}$, for every $u$ in $\{0, 1\}$, the Cauchy problem (1) with initial condition $x(0) = x_0$ admits a unique solution in positive time.

The existence (but not the uniqueness) of continuously differentiable solutions to the Cauchy problem (1) with initial condition $x_0$ at time $t_0$ is a consequence of Assumption 1.1 and Peano theorem (see for instance [12], Theorem 2.1 page 10). The local uniqueness in positive times of the solutions (Assumption 1.2) is needed for physical reasons and ensures the continuity of the solutions with respect to the initial conditions ([12], Theorem 2.1 page 94). Notice that Assumption 1 is not enough in general to ensure neither the uniqueness in past times nor the differentiability of the solutions with respect to the initial conditions ([12], Theorem 6.1 page 104).

## 2.2 Preliminaries

Let $u : [t_1, t_2] \subseteq [0, T] \to \{0, 1\}$ be constant on the interval $[t_1, t_2]$. Then, the solution $x : [t_1, t_2] \to \mathbf{R}$ of (1) with initial value $x(t_1) \subseteq [0, L]$ is of class $C^1$. If moreover $t \mapsto f(x(t), u(t))$ does not vanish on $[t_1, t_2]$, then $x(t)$ is increasing (if $f(x(t), u(t)) > 0$) or decreasing (if $f(x(t), u(t)) < 0$). As long as $t \mapsto f(x(t), u(t))$ does not vanish on $(t_1, t_2)$, one can use the change of variable $s = x$ in the following integrals and obtain expressions of the elapsed time between instants $t_1$ and $t_2$

$$t_2 - t_1 = \int_{t_1}^{t_2} d\tau = \int_{x(t_1)}^{x(t_2)} \frac{ds}{f(s, u)}, \qquad (3)$$

of the covered length between instants $t_1$ and $t_2$

$$\int_{t_1}^{t_2} x(\tau)d\tau = \int_{x(t_1)}^{x(t_2)} \frac{sds}{f(s, u)}, \qquad (4)$$

and of the total energy consumption between instants $t_1$ and $t_2$:

$$\int_{t_1}^{t_2} h(x(\tau), u(\tau))d\tau = \int_{x(t_1)}^{x(t_2)} \frac{h(s, u)ds}{f(s, u)}. \qquad (5)$$

Indeed, the number of switches $N(u)$ involved in (2) is zero in formula (5) since $u$ is constant on $[t_1, t_2]$. From formulas (3), (4) and (5), one can notice that the speed average and the energy consumption are continuously
differentiable with respect to the piece-wise constant control $u$, as long as the acceleration does not vanish. In particular, for any given constant $u$, for any given $V_0, V_1$ and any $w$ such that $x \mapsto f(x, u)$ does not vanish on the convex hull of $\{V_0, V_1, V_1 + w\}$, the difference between the time needed to reach speed $V_1 + w$ from $V_0$ and the time needed to reach speed $V_1$ from $V_0$ expresses, at first order, as

$$ \int_{V_0}^{V_1+w} \frac{ds}{f(s, u)} - \int_{V_0}^{V_1} \frac{ds}{f(s, u)} = \frac{w}{f(V_1, u)} + o_{w \to 0}(w). \quad (6) $$

Similarly, one gets the first order variation of the covered length

$$ \int_{V_0}^{V_1+w} \frac{sds}{f(s, u)} - \int_{V_0}^{V_1} \frac{sds}{f(s, u)} = \frac{wV_1}{f(V_1, u)} + o_{w \to 0}(w), \quad (7) $$

and of the energy consumption

$$ \int_{V_0}^{V_1+w} \frac{h(s, u)ds}{f(s, u)} - \int_{V_0}^{V_1} \frac{h(s, u)ds}{f(s, u)} = \frac{h(V_1, u)w}{f(V_1, u)} + o_{w \to 0}(w). \quad (8) $$

The above estimates are crucial for the variational arguments we will use in the proof of Propositions 1 and 3.

## 2.3 Physical assumptions

We list below some mathematical assumptions, that correspond to reasonable physical assumptions.

**Assumption 2** 1. The external actions like the slope of the track and the wind are not strong enough to prevent the car to go forward (maybe very slowly) when the engine is on: there exists $V^* > 0$ such $f(x, 1) > 0$ if $x < V^*$, $f(V^*, 1) = 0$ and $f(x, 1) < 0$ if $x > V^*$;

2. The (possibly negative) acceleration is larger when engine is switched on: for every $x$, $f(x, 0) < f(x, 1)$;

3. When engine is off, the velocity tends to a (possibly negative) limit speed: there exists $V_*$ such that $f(x, 0) < 0$ if $x > V_*$, $f(x, 0) > 0$ if $x < V_*$ and $f(V_*, 0) = 0$.

4. Energy consumption is zero when the engine is off, positive when engine is on: for every $x$, $h(x, 1) > h(x, 0) = 0$;

5. Energy consumption increases with speed: $x \mapsto h(x, 1)$ is non-decreasing;

6. The switching cost is not so large that the best strategy on long term is to keep full speed: all the integrals below converge and

$$ \int_{V_*}^{V^*} \frac{h(V^*, 1) - h(s, 1)}{f(s, 1)} ds + \alpha < \frac{h(V^*, 1)}{V^* - V_*} \left( \int_{V_*}^{V^*} \frac{s - V_*}{f(s, 0)} ds + \int_{V_*}^{V^*} \frac{s - V_*}{f(s, 1)} ds \right); $$

7. The energetic cost does not grow at the same rate than the engine efficiency when the velocity rises: the function $F: x \mapsto \frac{h(x, 1)f(x, 0)}{f(x, 1)-f(x, 0)}$ is either strictly concave or strictly convex.

Assumptions 2.1, 2.2, and 2.3 are summarized in Figure 2.

The various terms involved in Assumption 2.6 can be interpreted in terms of velocity and accelerations. In particular, the first term $\int_{V_*}^{V^*} \frac{h(V^*, 1)-h(s, 1)}{f(s, 1)}ds$ is equal to $h(V^*, 1) \int_{V_*}^{V^*} \frac{ds}{f(s, 1)} - \int_{V_*}^{V^*} \frac{h(s, 1)}{f(s, 1)}ds$, i.e., the opposite of the difference between the energy needed to accelerate from $V_*$ to $V^*$ and the energy used by the vehicle running at full speed $V^*$ during the same amount of time $\int_{V_*}^{V^*} \frac{ds}{f(s, 1)}$.
<figure><img src="image_3.png" /><figcaption>Figure 2: Time plot of the dynamics with constant control $u = 1$ (top) and $u = 0$ (bottom). All the trajectories tend to $V^*$ (top) or $V_*$ (bottom) as the time tends to infinity.</figcaption></figure>

<figure><img src="image_4.png" /><figcaption>Figure 3: Representation of the speed with respect to the time. In this example, the initial speed $x_0$ is assumed to be zero. Both pictures in the left column represent possible optimal solutions to Problem 1. Both pictures on the right cannot be possible optimal solutions of Problem 1 because of the red dashed parts.</figcaption></figure>
<figure><img src="image_5.png" /><figcaption>Figure 4: First order variation argument. The reference trajectory (solid line), with extremal speeds $V_j$, $1 \le j \le 4$, is compared with the close neighbor (dashed line) with extremal speeds $V_j + w_j$, $1 \le j \le 4$. In this example, $w_2 = w_3 = 0$.</figcaption></figure>

## 2.4 Oscillating structure of the solutions of Problem 1

**Proposition 1** Under Assumptions 1 and 2, either Problem 1 has no solution or all of the solutions of Problem 1 have the following structure: with the possible exceptions of one initial and one final acceleration/deceleration phase, the speed of the vehicle oscillates between two values without intermediate local extrema.

**Remark 1** Proposition 1 does not state that Problem 1 has a solution. It only states that any solution of Problem 1 has an oscillating structure (see Figure 3), which is no surprise. Indeed, if it is possible to write a Maximum Principle for this optimization problem, then the co-state and the associated switching function will be parametrized by the velocity $x$. As a general rule, there is a Maximum Principle for every optimization problem but a precise statement may require space and technicalities (see in particular the very stimulating discussion of [27, Section VI]). Notice also that the lack of backward uniqueness of trajectories prevents a direct use of the classical proofs of the Maximum Principle that can be found for instance in [2].

The rest of this section is dedicated to the proof of Proposition 1. The core of the proof is the following variational argument (Lemma 2) whose proof does not require the convexity guaranteed by Assumption 2.7.

**Lemma 2** Under Assumptions 1 and 2.1 to 2.5, the solutions (if any) of Problem 1 have the following structure: with the possible exceptions of one initial and one final acceleration/deceleration phase, the speed of the vehicle oscillates between local extrema $V_1, V_2, \dots, V_p$ in $[V_*, V^*]$ and the matrix

$$ \begin{pmatrix} 1 & 1 & \dots & 1 \\ V_1 & V_2 & \dots & V_p \\ \frac{h(V_1)f(V_1,0)}{f(V_1,0)-f(V_1,1)} & \frac{h(V_2)f(V_2,0)}{f(V_2,0)-f(V_2,1)} & \dots & \frac{h(V_p)f(V_p,0)}{f(V_p,0)-f(V_p,1)} \end{pmatrix} $$

has rank at most two.

**Proof of Lemma 2:** Let $u : [0, T] \to \{0, 1\}$ be a piecewise constant optimal solution of Problem 1. The restriction to $(0, T)$ of the associated trajectory $x : [0, T] \to \mathbb{R}$ admits successive local extrema $V_1, V_2, \dots, V_p$ in $[V_*, V^*]$ at points $T_{V_1}, T_{V_2}, \dots, T_{V_p}$ where $u$ has discontinuities, successive global maxima $V^*$ on some intervals of length $T_1, T_2, \dots, T_l$ and successive global minima $V_*$ on some intervals of length $T'_1, T'_2, \dots, T'_l$. We insist on the fact that $V_1, V_2, \dots, V_p$ belong to the closed interval $[V_*, V^*]$. That is, the same control $u$ may be associated with several different representations. For instance, a control $u$ that switches from 1 to 0 exactly when the speed reaches $V^*$ can be represented either with some $T_{V_i}$ with $V_i = V^*$, or with some $T_i = 0$ (meaning that the maximal speed is constant during a time equal to zero). Note also that we only consider extrema of $x$ on the open interval $(0, T)$ (i.e., we do not consider the initial and final acceleration/deceleration if any). We proceed with a classical argument of calculus of variation and introduce $u^{w,\tau}$, an other admissible control for average speed $V$, close to $u$ in norm $L^1$, which admits local minima $V_j + w_j$, local maxima $V_j + w_j$ and (if applicable
for the reference trajectory) global extrema $V_*$ and $V^*$ on some intervals of length $T_1 + \tau_1, T_2 + \tau_2, \dots, T_l + \tau_l$. If $T_i = 0$ or $V_i = V_*$, we impose $\tau_i \ge 0$. If $V_i = V^*$, we impose $w_i \le 0$.

From (6), the invariance of total time (race duration equals $T$) implies

$$ \sum_{j=1}^{p} w_j \left( \frac{1}{f(V_j, 1)} - \frac{1}{f(V_j, 0)} \right) + \sum_{j=1}^{l} \tau_j + \sum_{j=1}^{l'} \tau'_j = 0. \quad (9) $$

From (7), the invariance of the average speed (covered length is equal to $L$) implies

$$ \sum_{j=1}^{p} \left( \frac{w_j V_j}{f(V_j, 1)} - \frac{w_j V_j}{f(V_j, 0)} \right) + V^* \sum_{j=1}^{l} \tau_j + V_* \sum_{j=1}^{l'} \tau'_j = 0. \quad (10) $$

The optimality of $u$ implies the invariance at first order of the cost. Hence, from (8),

$$ \sum_{j=0}^{p} \frac{w_j h(V_j, 1)}{f(V_j, 1)} + h(V^*, 1) \sum_{j=1}^{l} \tau_j + h(V_*, 0) \sum_{j=1}^{l'} \tau'_j = 0. $$

From Assumption 2.4,

$$ \sum_{j=0}^{p} \frac{w_j h(V_j, 1)}{f(V_j, 1)} + h(V^*, 1) \sum_{j=1}^{l} \tau_j = 0, $$

or, defining $\tilde{w}_j = w_j \left( \frac{1}{f(V_j, 1)} - \frac{1}{f(V_j, 0)} \right)$, $\Theta = \sum_{j=1}^{l} \tau_j$ and $\Theta' = \sum_{j=1}^{l'} \tau'_j$

$$ \sum_{j=0}^{p} \tilde{w}_j \frac{h(V_j, 1)f(V_j, 0)}{f(V_j, 0) - f(V_j, 1)} + h(V^*, 1)\Theta = 0. \quad (11) $$

Considering the left hand sides of equations (9), (10) and (11) as linear forms in $(\tilde{w}_j, \Theta, \Theta')$, we infer that the matrix

$$ \begin{pmatrix} 1 & \dots & 1 & 1 & 1 \\ V_1 & \dots & V_p & V^* & V_* \\ \frac{h(V_1, 1)f(V_1, 0)}{f(V_1, 0) - f(V_1, 1)} & \dots & \frac{h(V_p, 1)f(V_p, 0)}{f(V_p, 0) - f(V_p, 1)} & h(V^*, 1) & 0 \end{pmatrix} $$

has rank at most two (the last two columns only appears when $l \ne 0$ or $l' \ne 0$). Finally, notice that

$$ h(V^*, 1) = \frac{h(V^*, 1)f(V^*, 0)}{f(V^*, 0) - f(V^*, 1)} $$

and

$$ h(V_*, 0) = \frac{h(V_*, 1)f(V_*, 0)}{f(V_*, 0) - f(V_*, 1)} = 0 $$

to complete the proof of Lemma 2.

**Proof of Proposition 1:** We proceed by contradiction and assume that the speed admits $p$ different local extrema. If $p = 2$, there is nothing to prove. Else, we consider the first three columns of the matrix obtained in Lemma 2. Up to permutation of the indices, we may assume without loss of generality that $V_1 < V_3 < V_2$. Find $\mu, \nu > 0$, $\mu + \nu = 1$ such that $V_3 = \mu V_1 + \nu V_2$. Since the matrix

$$ \begin{pmatrix} 1 & 1 & 1 = \mu.1 + \nu.1 \\ V_1 & V_2 & V_3 = \mu V_1 + \nu V_2 \\ \frac{h(V_1, 1)f(V_1, 0)}{f(V_1, 0) - f(V_1, 1)} & \frac{h(V_2, 1)f(V_2, 0)}{f(V_2, 0) - f(V_2, 1)} & \frac{h(V_3, 1)f(V_3, 0)}{f(V_3, 0) - f(V_3, 1)} \end{pmatrix} $$

has rank at most 2, its determinant is zero. Hence,

$$ \frac{h(V_3, 1)f(V_3, 0)}{f(V_3, 0) - f(V_3, 1)} = \mu \frac{h(V_1, 1)f(V_1, 0)}{f(V_1, 0) - f(V_1, 1)} + \nu \frac{h(V_2, 1)f(V_2, 0)}{f(V_2, 0) - f(V_2, 1)}. $$

Hence, the mapping $F: x \mapsto \frac{h(x, 1)f(x, 0)}{f(x, 1) - f(x, 0)}$ is not strictly convex or concave, which is in contradiction with Assumption 2.7.
# 3 Autonomous dynamics with infinite time horizon

## 3.1 Statement of the optimal problem

In this subsection, we consider Problem 1 with a control restricted to a periodic control. Precisely, for any given $V > 0$, we define the admissible trajectories with average speed $V$ as the curves $t \in [0, T_1] \mapsto (x(t), u(t)) \in \mathbf{R} \times \{0, 1\}$ for some suitable $T_1 > 0$, with $x$ absolutely continuous and $u$ piecewise constant, satisfying (1) and such that $x(0) = x(T_1) = V$, $u(0) = u(T_1)$ and $\frac{1}{T_1} \int_0^{T_1} x(t)dt = V$. In particular, the control $u$ has an even number of discontinuities in $[0, T_1]$.

A piecewise constant function $u : [0, T_1] \to \{0, 1\}$ is an admissible control for average speed $V$ if there exists a function $x : [0, T_1] \to \mathbf{R}$ such that $(x, u)$ is an admissible trajectory with average speed $V$.

For $T_1 \ge 0$ and $k$ in $\mathbf{N}$, we denote with $\mathcal{U}_V^k(T_1)$ the set of admissible controls for average speed $V$ defined on $[0, T_1]$ with at most $k$ discontinuities, and we define the sets $\mathcal{U}_V(T_1) = \cup_{k \in \mathbf{N}} \mathcal{U}_V^k(T_1)$, $\mathcal{U}_V^k = \cup_{T_1 > 0} \mathcal{U}_V^k(T_1)$ and $\mathcal{U}_V = \cup_{T_1 > 0} \mathcal{U}_V(T_1) = \cup_{k \in \mathbf{N}} \mathcal{U}_V^k$.

For any subset $I$ of $\mathbf{R}$, we denote respectively with $\mathcal{U}_V^{k,I}(T_1)$, $\mathcal{U}_V^I(T_1)$ and $\mathcal{U}_V^I$ the functions of $\mathcal{U}_V^k(T_1)$, $\mathcal{U}_V(T_1)$ and $\mathcal{U}_V$ where $x$ takes value in $I$.

Finally, we associate, with every admissible control for average speed $V$ in $\mathcal{U}_V(T_1)$, the cost

$$C^a(u) = \frac{1}{T_1} C(u)$$

which can be seen as the average energy consumption to run the distance $VT_1$ in time $T_1$. Let us consider the following problem.

**Problem 2** Let $V > 0$ be given. Find the minimum, if any, of $C^a$ on $\mathcal{U}_V^I$.

Problem 2 may be seen as an infinite time horizon version of Problem 1. Indeed, no final time is given. We only aim at finding the lowest possible energy consumption for a long distance run at average speed $V$.

## 3.2 Main Result

The main result, proved below, stipulates that the minimum of $C^a$ is reached by controls with two discontinuities. In other words, the most energy efficient driving strategy is to let the speed $x$ periodically oscillate between two values $V^a$ and $V^b$, with no intermediate local extremum. Precisely, one has the following result (recall that $V^*$ and $V_*$ are defined in Assumption 2.1):

**Proposition 3** Under Assumptions 1 and 2, for every closed interval $I$ contained in $[V_*, V^*]$ and every interior point $V$ of $I$, $C^a$ admits a minimum on $\mathcal{U}_V^I$, and $\inf_{\mathcal{U}_V^I} C^a = \min_{\mathcal{U}_V^I} C^a$.

The result of Proposition 3 is twofold: first, there exists a minimum of $C^a$ and second, this minimum is reached with periodic controls with two discontinuities for a period. The second part is a direct application of Proposition 1. The only point to check is the existence of solutions, which is done in Section 3.3.

## 3.3 Proof

The proof requires several intermediate results and is given in the following section.

### 3.3.1 Existence of solutions to Problem 2 for a given number of switches

**Lemma 4** For every even $k$ in $\mathbf{N}$ and $T_1 > 0$, $C^a$ (and hence $C$) admits a minimum $m_V^k(T_1)$ on $\mathcal{U}_V^k(T_1)$.

**Proof:** This is a consequence of the compactness of $\mathcal{U}_V^k(T_1)$ endowed with the $L^1$ norm and of the continuity of $C$ when the number of switches is constant equal to $k$. ■
<figure><img src="image_6.png" /><figcaption>Figure 5: Large period optimal controls. For a control in $U_V^2(T_2)$, we define $T_1$ as the acceleration duration in the case where trajectories are backward unique near $V_1$ (top) and as the time where $x = V^*$ when backward uniqueness does not hold (bottom). The ratio $T_1/T_2$ is the same at first order in both cases.</figcaption></figure>

### 3.3.2 Cost estimates for control with small periods

**Lemma 5** For every $k$ in $2N$, $\lim_{T_1 \to 0} m_V^k(T_1) = +\infty$

**Proof:** We first prove by contradiction that $U_V^k(T_1)$ does not contain any continuous function. Indeed, assume that $u$ in $U_V^k(T_1)$ is continuous. Then, the associated trajectory $x$ is decreasing (if $u = 0$) or increasing (if $u = 1$). Since $u$ belongs to $U_V^k(T_1)$, $x(0) = x(T_1)$. Hence $x$ is constant. By Assumptions 2.1 and 2.3, $x = V^*$ or $x = V_*$. Hence, the average of $x$ is not $V$ (which belongs to $(V_*, V^*)$). This is a contradiction with the fact that $u$ belongs to $U_V^k(T_1)$. Hence $u$ has at least two discontinuities and $N(u) \ge 1$. Thus, $C^a(u) > \alpha/T_1$. ■

**Remark 2** As $\alpha$ tends to zero, the interval between two consecutive switching times tends to zero. Hence, the velocity tends to a constant $V$, which is the optimal trajectory of the relaxed problem when $u$ can take value in $[0, 1]$ with $f(x_1, x_2, u) = uf(x_1, x_2, 1) + (1-u)f(x_1, x_2, 0)$.

### 3.3.3 Oscillating structures of optimal trajectories with a given period

**Lemma 6** For every $k$ in $2N$, for every positive $T_a$, there exists $p$ in $N$ such that $m_V^k(T_a) = m_V^2(T_a/p)$

**Proof:** This is nothing but a restatement of Proposition 1 in the periodic case. ■

### 3.3.4 Cost estimates for controls with large periods

**Lemma 7** For every $T_1$ large enough, $m_V^2(T_1) \le \liminf_{T_2 \to +\infty} m_V^2(T_2)$.

**Proof:** We do the proof by computing an expansion of $m_V^2(T_2)$ as $T_2$ tends to infinity. Let $T_2$ be given, and $u$ a minimizing control in $m_V^2(T_2)$. We distinguish among several cases, depending on the regularity of $f$.

In the case of local backward uniqueness of the trajectories of (1) in neighborhoods of $V^*$ and $V_*$ (see Fig. 5 top), we may assume, up to a time shift, that $u(t) = 0$ for $t \in (0, T_1)$ and $u(t) = 0$ for $t \in (T_1, T_2)$. The associated trajectory reaches its minimum $V_0$ at $t = 0$ and its maximum $V_1$ at $T_1$. From (3), we get that

$$ \int_{V_0}^{V_1} \frac{s}{f(s, 1)} ds = \int_{V_0}^{V_1} \frac{s - V^*}{f(s, 1)} ds + V^*T_1 \text{ and} $$
$$ \int_{V_1}^{V_0} \frac{s}{f(s, 0)} ds = \int_{V_1}^{V_0} \frac{s - V_*}{f(s, 0)} ds + V_*(T_2 - T_1). $$

From (4), we get that

$$ T_2 V = \int_{V_0}^{V_1} \frac{s}{f(s, 1)} ds + \int_{V_1}^{V_0} \frac{s}{f(s, 0)} ds $$

Hence,

$$ V^* \frac{T_1}{T_2} + V_* \left(1 - \frac{T_1}{T_2}\right) + \frac{1}{T_2} \int_{V_0}^{V_1} \frac{s - V_*}{f(s, 1)} ds + \frac{1}{T_2} \int_{V_1}^{V_0} \frac{s - V_*}{f(s, 0)} ds = V \quad (12) $$

that implies $\lim_{T_2 \to \infty} T_1 = +\infty$. Hence, $\lim_{T_2 \to \infty} V_0 = V_*$ and $\lim_{T_2 \to \infty} V_1 = V^*$. Thus, there exists a function $\epsilon$ such that $\lim_{+\infty} \epsilon = 0$ and

$$ \frac{T_1}{T_2} = - \frac{1}{T_2(V^* - V_*)} \left( \int_{V_*}^{V^*} \frac{s - V_*}{f(s, 1)} ds + \int_{V_*}^{V^*} \frac{s - V_*}{f(s, 0)} ds \right) + \frac{V - V_*}{V^* - V_*} + \frac{\epsilon(T_2)}{T_2}. \quad (13) $$

We infer from (3) and (13) that

$$ \begin{aligned} C^a &= \frac{\alpha}{T_2} + \frac{1}{T_2} \int_{V_0}^{V_1} \frac{h(s, 1)}{f(s, 1)} ds \\ &= \frac{\alpha}{T_2} + \frac{1}{T_2} \left( \int_{V_0}^{V_1} \frac{h(s, 1) - h(V^*, 1)}{f(s, 1)} ds + h(V^*, 1) T_1 \right) \\ &= h(V^*, 1) \frac{V - V_*}{V^* - V_*} + \frac{1}{T_2} \left[ \alpha + \int_{V_*}^{V^*} \frac{h(s, 1) - h(V^*, 1)}{f(s, 1)} ds \right. \\ & \qquad \left. - \left( \int_{V_*}^{V^*} \frac{s - V_*}{f(s, 1)} ds + \int_{V_*}^{V^*} \frac{s - V_*}{f(s, 0)} ds \right) \frac{h(V^*, 1)}{V^* - V_*} \right] \\ & \qquad + \frac{\epsilon(T_2)}{T_2} \end{aligned} \quad (14) $$

In the case where the trajectories of (1) reach $V^*$ and $V_*$ in finite time, we denote (see Fig. 5 bottom) $T_m = \int_{V_*}^{V^*} \frac{ds}{f(s, 1)}$ and $T_d = \int_{V_*}^{V^*} \frac{ds}{f(s, 0)}$. Hence,

$$ \frac{T_1}{T_2}(V^* - V_*) = V - V_* + (Tm + T_d) \frac{V}{T_2} \quad (15) $$

Plugging (15) in the definition of $C^a$, we find that the estimate (14) is still valid (with $\epsilon = 0$) when the trajectories of (1) are not backward uniquely defined near $V^*$ and $V_*$. The mixed case (the trajectories are locally backward unique near $V^*$ and reach $V_*$ in finite time, or vice versa) can be treated as the two cases above and is omitted.

In conclusion, the estimate (14) is valid in any case and Lemma 7 follows from Assumption 2.6.

From Lemmas 5 and 7, we deduce that the continuous mapping $T \mapsto m_V^k(T)$ admits a minimum on $(0, +\infty)$. We denote this quantity with $m_V^k := \min_{T_1 > 0} m_V^k(T_1)$.

### 3.3.5 Completion of the proof of Proposition 3

By definition, $\inf_{U_V} C^a = \inf_{T > 0} \inf_{k \in 2N} m_V^k(T)$. By Lemma 4, each optimization problem for a given period $T_1$ admits a solution, and by Lemma 6, the associated control can be chosen with two discontinuities $\inf_{U_V} C^a = \inf_{T > 0} m_V^2(T)$, this last quantity being equal to $m_V^2$ by Lemmas 5 and 7. In particular, the infimum $\inf_{U_V} C^a$ is reached and is indeed a minimum.
## 3.4 Practical determination of the upper and lower speed limits

Based on the knowledge of the average target speed $V$, the dynamics $f$ and the cost function $h$, the search for the upper and lower speeds of the optimal solution whose existence is asserted by Proposition 3 amounts to solve two 1D continuous optimization problems. A variety of methods are available in the literature, especially when some regularity assumptions are done on $f$ and $h$. We present below a naive yet efficient grid method.

**Step 1: candidate selection** Select $p$ candidates $V_1^a < V_2^a < \dots < V_p^a < V$ for the lower speed limit.

**Step 2: search for upper limit** For every $i = 1 \dots p$, find (by dichotomy), the upper limit $V_i^b$ ensuring that the average speed is $V$ (in the case where $V_i^b = V^*$, compute also the time where the velocity is constant).

**Step 3: cost for each candidate** For every $i = 1 \dots p$, compute the cost $C^a$ associated with a trajectory oscillating from $V_i^a$ to $V_i^b$ (or staying at $V^*$ for the time computed in Step 2).

**Step 4: conclusion** Pick the pair $(V_i^a, V_i^b)$ with the lowest cost.

In our implementation (see Section 5), we mainly used $p = 4$, $V_i^a = V - \frac{5-i}{2} \text{ m.s}^{-1}$, $i = 1..4$.

# 4 Non autonomous problem in finite time

## 4.1 Modeling

For a real vehicle, the autonomous dynamics described in Section 2 is too restrictive. Various types of forces act on the vehicle. Some of them, like the solid friction forces applied on the wheels or axes, are roughly constant. Some others, such as the gravitation, depends on the slope of track. Some of the forces also depend on many (partly unknown) external factors, including the actual weather. This is the case for the aerodynamic drag depending on the velocity, the orientation of the track with respect to the wind and the strength of the wind.

If we consider both the position and the velocity of the vehicle denoted respectively $x_1$ and $x_2$, the dynamics turns into:

$$ \begin{cases} \dot{x}_1 = x_2 \\ \dot{x}_2 = f(x_1, x_2, t, u) \end{cases} \qquad (16) $$

with $f: [0, L] \times [0, +\infty) \times [0, T] \times \{0, 1\} \to \mathbf{R}$ a continuous function. The control $u: [0, T] \to \{0, 1\}$ is a piecewise constant function accounting for the state of the engine (off when $u = 0$, on when $u = 1$).

The steering possibilities of the car being limited at high speed, we introduce a (smooth) function $x_1 \mapsto V^s(x_1)$ representing the maximal safety speed at point $x_1$ and we will only consider solutions of system (16) satisfying the state constraint $0 \le x_2(t) \le V^s(x_1(t))$ for every $t$.

As in Section 2.1, with every admissible control $u$ and absolutely continuous solution $(x_1, x_2)$ of (16), we associate the energy cost

$$ C(u) = \int_{0}^{T} h(x_{2}(t), u(t))dt + \alpha N(u) \qquad (17) $$

where $h: [0, +\infty) \times \{0, 1\} \to [0, +\infty)$ is a $C^1$ function, $\alpha$ is a positive real constant and $N$ denotes the number of discontinuities of $u$.

**Problem 3** We aim to find a piecewise constant control $u$ that steers $(x_1, x_2)$, subject to the velocity constraints $x_2(t) \in V^s(x_1(t))$ for every $t$ and the dynamic (16), from $(0, 0)$ at time $t = 0$ to $(L, x_2(T))$ in time less than $T$ and minimizes cost $C$ (17).

We do the following assumptions.

**Assumption 3** 1. The track and weather conditions are piecewise continuous: there exist two subdivisions $0 = x_1^0 < x_1^1 < \dots < x_1^{p_1} = L$ and $0 = t^0 < t^1 < \dots < t^{p_t} = T$ of $[0, L]$ and $[0, T]$ such that for every $u$ in $\{0, 1\}$, $(x_1, x_2, t) \mapsto f(x_1, x_2, t, u)$ is continuous on $[x_1^j, x_1^{j+1}) \times \mathbf{R} \times [t^l, t^{l+1})$ for every $j < p_1$ and $l < p_t$;

2. For $u$ constant in $\{0, 1\}$, for every $j < p_1$ and $l < p_t$, for every $(x_1(t_0), x_2(t_0), t_0)$ in $[x_1^j, x_1^{j+1}) \times \mathbf{R} \times [t^l, t^{l+1})$, the Cauchy problem (16) with initial condition $(x_1(t_0), x_2(t_0), t_0)$ at time $t_0$ admits a locally unique solution in positive time;

3. For every time $t^*$ in $[0, T]$, for every position on the track $x_1^*$ in $[0, L]$, the functions $(x, u) \mapsto f(x_1^*, x, t^*, u)$ and $(v, u) \mapsto h(v, u)$ satisfy Assumptions 1 and 2.
Assumption 3.3 means that, around $x_1^*$ in $[0, L]$, we can locally replace the actual vehicle evolving on the actual irregular track with varying weather conditions by a fictional vehicle evolving on an infinite fictional track with constant slope or wind velocity (at $x_1^*$).

Let $u: [0, T_1] \to \{0, 1\}$ be piecewise constant. A pair $(x_1, x_2) : [0, T_1] \to \mathbb{R}^2$ is a solution of (16) if $(x_1, x_2)$ is continuous, piecewise differentiable and satisfies (16) for almost every time $t$ in $[0, T_1]$.

As before, the existence (but not the uniqueness) of such solutions to Cauchy problem (16) with initial condition $(x_1(t_0), x_2(t_0))$ at time $t_0$ is a consequence of Assumption 3.1 and Peano theorem (see for instance [12], Theorem 2.1 page 10).

## 4.2 Description of the strategy

The strategy we propose can be split in two parts: first, we identify the current dynamics and compute the current target and then we use the results of Section 2 during a small time interval (typically three seconds in our case), after which we proceed to a new identification, and a new optimization.

Precisely, we split the time interval $[0, T]$ into small intervals $[0, T] = \bigcup_{n=0}^{N}[nt_a, (n+1)t_a]$.

Assume that current time is equal to $t = nt_a$ for some $n$, and the vehicle is at position $x_1(nt_a)$ with velocity $x_2(nt_a)$. Identify the current dynamics (16) with $x_1^* = x_1(nt_a)$ and $t^* = nt_a$ and compute the target average speed $V = \frac{L-x_2(nt_a)}{T-nt_a}$. If $V < V^s(x_1(t_a))$, find the minimum $m_V^2$ and the corresponding trajectory $(x_2, u^*)$ of (1), with the constraint $x_2 \le V^s(x_1(t_a))$. This can be done, for instance, with Step 1 to Step 4 detailed in Section 3.4. The optimal speed $x_2$ oscillates between two values $V^a(t_a)$ and $V^b(t_a)$.

If $V^b(t_a) > V^s(x_1(t_a))$, keep $V^b(t_a) = V^s(x_1(t_a))$ and $V^a(t_a) = V^s(x_1(t_a)) - \delta$ where $\delta$ is a small enough constant (for our application, $\delta = 0.5 \text{ m.s}^{-1}$).

The control strategy $S$ is to repeat the following until $t = (n+1)t_a$:

1. Keep $u = 1$ until $x_2(t)$ reaches $V^b(nt_a)$.

2. As soon as $x_2(t)$ reaches $V^b(nt_a)$, set $u = 0$.

3. Keep $u = 0$ until $x_2(t) = V^a(t)$, then switch to $u = 1$.

4. Come back to (1), unless $x_1(t) \ge L$.

## 4.3 Well-posedness

The only point to check to guarantee the well-posedness of the control scheme $S$ is that the interval between two consecutive engine switches cannot tend to zero. Indeed, let $u_t$ be an admissible optimal control for average speed $V$ computed at time $t$. We denote the period of $u_t$ with $T_t$ and the associated cost with $C_t^a$ (index $t$ is the time at which the control has been computed). By Lemma 5, $C_t^a(u_t) > \alpha/T_t$, hence $T_t > \alpha/C_t^a(u_t)$. The cost $t \mapsto C_t^a$ is continuous and the interval $[0, T]$ is compact, hence $\inf_{0 \le t \le T} C_t^a > 0$. And thus, $\inf_{t \in [0, T]} T_t > 0$, and the switching points cannot accumulate (no Zeno phenomena).

## 4.4 Constraints fulfillment and robustness

The proposed strategy happens to be extremely robust in practice. This robustness may be explained by two reasons of different natures.

The first reason for the robustness of the strategy is the continuous actualization of the target average speed.

The second reason for robustness is the fact that we use a control on the average of the velocity. We first state two abstract results (Lemma 8 and Proposition 9 below).

**Lemma 8** Let $V_a < V_b$ be given, denote with $C$ the set of not vanishing continuous function on $[V_a, V_b]$. For $g$ in $C$, denote $T(g) = \int_{V_a}^{V_b} \frac{ds}{g(s)}$, $L(g) = \int_{V_a}^{V_b} \frac{sd s}{g(s)}$ and the mapping $\mathcal{F}$ defined on $C$ by $\mathcal{F}: g \mapsto L(g)/T(g) \in \mathbb{R}$. Then, for every $g$ in $C$ and every continuous $\delta g$ such that $\|\frac{\delta g}{g}\|_{L^\infty} < 1$,

$$ \begin{aligned} \mathcal{F}(g + \delta g) - \mathcal{F}(g) &= \frac{1}{T(g + \delta g)} \sum_{n=1}^{\infty} (-1)^n \int_{V_a}^{V_b} \frac{sd s - \mathcal{F}(g)}{g(s)} \left( \frac{\delta g(s)}{g(s)} \right)^n ds. \end{aligned} \quad (18) $$
<table><caption>Figure 6: Numerical value of the constants appearing in the dynamics (19).</caption><thead><tr><th>Constant</th><th>Value</th><th>Comment</th></tr></thead><tbody><tr><td>a</td><td>6.10<sup>-4</sup></td><td>m<sup>-1</sup></td></tr><tr><td>c</td><td>3.10<sup>-2</sup></td><td>m.s<sup>-2</sup></td></tr><tr><td>g</td><td>9.81</td><td>m.s<sup>-2</sup></td></tr><tr><td>f<sub>1</sub></td><td>0.20</td><td>m.s<sup>-2</sup></td></tr><tr><td>m</td><td>93</td><td>kg</td></tr></tbody></table>

**Proof:** Standard expansions show that

$$L(g + \delta g) = \sum_{n \ge 0} (-1)^n \int_{V_a}^{V_b} \frac{s(\delta g)^n}{g^{n+1}(s)} ds,$$

and $T(g + \delta g) = \sum_{n \ge 0} (-1)^n \int_{V_a}^{V_b} \frac{(\delta g)^n}{g^{n+1}(s)} ds$, for $\delta g$ small enough. Conclusion follows with basic calculus. ■

**Proposition 9** If $\delta g/g$ is constant, then $\mathcal{F}(g + \delta g) = \mathcal{F}(g)$.

**Proof:** Apply (18) and notice that $\int_{V_a}^{V_b} \frac{s - \mathcal{F}(g)}{g(s)} ds = L(g) - \mathcal{F}(g)T(g) = 0$. ■

Let us comment the statements of Lemma 8 and Proposition 9. If $f$ satisfies Assumptions 1 and 2 and one chooses $g: s \mapsto f(s, 1)$, the number $\mathcal{F}(g)$ is the average speeds when one speed up from $V_a$ to $V_b$ with the dynamics $f$. If the dynamics $s \mapsto f(s, 1)$ has been incorrectly identified and so is $\tilde{g}: s \mapsto f(s, 1) + \delta f(s)$, Lemma 8 gives an estimate of the difference between the expected average speed $\mathcal{F}(\tilde{g})$ and the actual average speed $\mathcal{F}(g)$. The point of Proposition 9 is that, if $(\delta f(s))/f(s, 1)$ is constant, then the change of average speed is zero. Hence the difference $\mathcal{F}(g + \delta g) - \mathcal{F}(g)$ is due to the variance of $\frac{\delta g}{g}$ which is usually small with respect to $\frac{\delta g}{g}$. The same computation is obviously valid for decelerations if one considers $g: s \mapsto f(s, 0)$, and generically in the non-autonomous case if one considers $g: s \mapsto f(x_1(s), s, t(s), u)$ where $x_1(s)$ and $t(s)$ are respectively the position on the track and the time where the vehicle reaches speed $s$.

# 5 Effective implementation

The strategy proposed in Section 4.2 has been implemented in an official competition in 2014.

## 5.1 Vir'Volt 2 prototype

The prototype (including the pilot) has a total weight of about 90 kg, is driven by a 200 W electric DC motor powered by a 23 V battery. The control scheme presented in this note is implemented on a microcontroller (ref dsPIC33ep512mu810 from Microchip™), with a 140 MHz internal clock. Standard 32 kHz oscillators, bike velocity sensors and GPS receiver provide (respectively) the current time, the velocity and the position needed for the algorithm.

A simplified dynamics for Vir'Volt 2 is given by

$$f(x_1, x_2, t, u) = -a(x_2 - v(x_1, t))^2 - c \operatorname{sign}(x_2) - g \sin \theta_{x_1} \\ + \begin{cases} f_1 & \text{if } u = 1 \\ 0 & \text{if } u = 0 \end{cases} \tag{19}$$

where $v(x_1, t)$ is the speed of the wind at point $x_1$ at time $t$, $\theta_{x_1}$ is the angle of the track with the horizontal plane at point $x_1$, $f_1$ is the traction force by mass unit when the engine is on, $g$ is the gravitational acceleration, $a$ accounts for the aerodynamics drag, and $c$ accounts for the solid friction in the vehicle.

The traction force $f_1$ is tabulated from the engine data sheet.

There are several ways to consider the energetic cost. The power transmitted to the wheels is the product $h_1(x_2, 1) = x_2 \cdot m \cdot f_1$. The energy taken from the battery is always larger than $h_1$ and depends on the design
<table><thead><tr><th></th><th>2013</th><th colspan="2">2014</th></tr><tr><th></th><th>1st run</th><th>1st run</th><th>2nd run</th></tr></thead><tbody><tr><th>Run duration</th><td></td><td></td><td></td></tr><tr><th>expected</th><td>35m 00s</td><td>36m 00s</td><td>38m 30s</td></tr><tr><th>realized</th><td>36m 01s</td><td>36m 10s</td><td>38m 31s</td></tr><tr><th>Consumption</th><td>112 742 J</td><td>120 150 J</td><td>107 946 J</td></tr></tbody></table>

Figure 7: Comparisons of the official runs results for the EMT prototype at Shell Eco-Marathon 2013 (manual command) and 2014 (automatic command and strategy of Section 4.2).

of the power conversion block. In the following, we consider the case where the power consumption is roughly independent from speed, $h_2(x_2, 1) = 23.7 = 161$ W for $x_2 > 5$ m.s$^{-1}$. Notice that the dynamics $f$ completed with $h_1$ or $h_2$ satisfies in both cases Assumption 3 at any time.

For a flat horizontal track without wind, with $\alpha = 10$ J and a target average speed of 7 m/s, the optimal strategy consists in letting the speed oscillate between 6.1 m/s and 7.94 m/s. The corresponding energetic cost for a track of 16.5 km (similar to the editions 2013 and 2014 of the European Shell Eco-Marathon) is 104 189 J. This computation is given for reference only since it neglects the fact that the vehicle start from velocity zero (kinetic energy of the vehicle at 7 m/s: about 2.5 kJ), the influence of the wind, and the elevation of the actual track which is not perfectly horizontal.

## 5.2 Effective results

Computation of the control law (including identification of the current dynamics from the sensors data) is possible with an average power of 10 mW.

The official results of the EMT prototype measured in the 2014 edition of the Shell Eco-Marathon are presented in Figure 7 with the first result of the 2013 edition. The 2013 prototype is basically the same as the 2014 one without embedded control (the driver directly switches the engine on or off). These results are directly comparable since they all were obtained without solar cells (EMT record on the Rotterdam track is 90211 J and was obtained with manual velocity command during a particularly sunny test in May 2013).

## 6 Conclusions

A real-time adaptive driving command strategy for low consumption vehicle has been presented. Real life implementation on a competition prototype showed good agreement between the theoretical analysis and the effective results. The consumption performances are comparable with performances obtained by highly trained human drivers. All the computations are done on board, in real time, with a low cost micro controller and limited energy consumption.

Among the various advantages of the automatic command, the pilots underlined the dramatic safety improvement (no need to concentrate on the velocity anymore) and the robustness of the command that allows effective recovering of optimal timing after traffic perturbations.

From a more theoretical point of view, it has been provided an explicit hybrid control strategy in a form of a piecewise constant control (on/off) for low regular dynamics, in particular not Lipschitz continuous. Furthermore, a switching cost has been considered. Because of the heavy computational burden, the use of a classical PMP is redhibitory. This contribution acts an an efficient alternative from this perspective. Optimality of the control in the case of autonomous systems and the robustness in the case of non autonomous systems (with time-varying disturbances) are shown.

## Acknowledgements

This work has been financially supported by CPER MISN and the Fédération Charles Hermite. It is a pleasure for the authors to thank the “Eco Motion Team” in charge of the Vir’Volt prototype development, especially
References

[1] G. Acampora, C. Landi, M. Luiso, and N. Pasquino. Optimization of energy consumption in a railway traction system. In *Power Electronics, Electrical Drives, Automation and Motion, 2006. SPEEDAM 2006. International Symposium on*, pages 1121–1126, May 2006.

[2] Andrei A. Agrachev and Yuri L. Sachkov. *Control theory from the geometric viewpoint*, volume 87 of *Encyclopaedia of Mathematical Sciences*. Springer-Verlag, Berlin, 2004. Control Theory and Optimization, II.

[3] Alberto Bemporad and Manfred Morari. Robust model predictive control: A survey. In *Robustness in identification and control*, volume 245 of *Lecture Notes in Control and Information Sciences*, pages 207–226. Springer London, 1999.

[4] S.C. Bengea and R.A Decarlo. Optimal and suboptimal control of switching systems. In *Decision and Control, 2003. Proceedings. 42nd IEEE Conference on*, volume 5, pages 5295–5300 Vol.5, Dec 2003.

[5] Sorin C. Bengea and Raymond A. DeCarlo. Optimal control of switching systems. *Automatica J. IFAC*, 41(1):11–27, 2005.

[6] F. Blanchini and S. Miani. *Set-Theoretic Methods in Control*. Birkhäuser, 2008.

[7] M.S. Branicky, V.S. Borkar, and S.K. Mitter. A unified framework for hybrid control: model and optimal control theory. *Automatic Control, IEEE Transactions on*, 43(1):31–45, Jan 1998.

[8] E. F. Camacho and C. Bordóns. *Model Predictive Control*. Springer-Verlag, 2004.

[9] X. C. Ding, Y. Wardi, and M. Egerstedt. On-line optimization of switched-mode dynamical systems. *Automatic Control, IEEE Transactions on*, 54(9):2266–2271, Sept 2009.

[10] M. Egerstedt, Y. Wardi, and H. Axelsson. Transition-time optimization for switched-mode dynamical systems. *Automatic Control, IEEE Transactions on*, 51(1):110–115, Jan 2006.

[11] E. G. Gilbert and K. T. Tan. Linear systems with state and control constrains: The theory and application of maximal output admissible sets. *Transactions on automatic control*, 36:1008–1020, 1991.

[12] Philip Hartman. *Ordinary differential equations*. John Wiley & Sons, Inc., New York-London-Sydney, 1964.

[13] S. Hedlund and A. Rantzer. Optimal control of hybrid systems. In *Decision and Control, 1999. Proceedings of the 38th IEEE Conference on*, volume 4, pages 3972–3977 vol.4, 1999.

[14] Shengxiang Jiang and P.G. Voulgaris. Performance optimization of switched systems: A model matching approach. *Automatic Control, IEEE Transactions on*, 54(9):2058–2071, Sept 2009.

[15] E.R. Johnson and T.D. Murphey. Second-order switching time optimization for nonlinear time-varying dynamic systems. *Automatic Control, IEEE Transactions on*, 56(8):1953–1957, Aug 2011.

[16] I. Kolmanovsky and E. G. Gilbert. Theory and computation of disturbance invariant sets for discrete time linear systems. *Mathematical Problems in Engineering: Theory, Methods and Applications*, 4:317–367, 1998.

[17] A Leonessa, M.M. Haddad, and V. Chellaboina. Nonlinear system stabilization via hierarchical switching control. *Automatic Control, IEEE Transactions on*, 46(1):17–28, Jan 2001.

[18] Liang Li, Wei Dong, Yindong Ji, Zengke Zhang, and Lang Tong. Minimal-energy driving strategy for high-speed electric train with hybrid system model. *Intelligent Transportation Systems, IEEE Transactions on*, 14(4):1642–1653, Dec 2013.
[19] Daniel Liberzon. *Switching in systems and control*. Systems & Control: Foundations & Applications. Birkhäuser Boston, Inc., Boston, MA, 2003.

[20] D. Limón, I. Alvarado, T. Alamo, and E. F. Camacho. MPC for tracking piecewise constant references for constrained linear systems. *Automatica*, 44:2382–2387, 2008.

[21] B. Lincoln and B. Bernhardsson. Lqr optimization of linear system switching. *Automatic Control, IEEE Transactions on*, 47(10):1701–1705, Oct 2002.

[22] T. Manrique-Espindola, M. Fiacchini, T. Chambrion, and G. Millerioux. Mpc-based tracking for real-time systems subject to time-varying polytopic constraints. *Optimal Control Applications and Methods*, pages 1480–1485, 2016.

[23] D.L. Pepyne and C.G. Cassandras. Optimal control of hybrid systems in manufacturing. *Proceedings of the IEEE*, 88(7):1108–1123, July 2000.

[24] B. Piccoli. Necessary conditions for hybrid optimization. In *Decision and Control, 1999. Proceedings of the 38th IEEE Conference on*, volume 1, pages 410–415 vol.1, 1999.

[25] P Riedinger, FR Kratz, C Iung, and C Zanne. Linear quadratic optimization for hybrid systems. *IEEE Conference on Decision and Control*, 3:3059–3064, 1999.

[26] Zhendong Sun and S.S. Ge. Analysis and synthesis of switched linear control systems. *Automatica*, 41(2):181 – 195, 2005.

[27] H.J. Sussmann. A maximum principle for hybrid optimal control problems. In *Decision and Control, 1999. Proceedings of the 38th IEEE Conference on*, volume 1, pages 425–430 vol.1, 1999.

[28] Xuping Xu and P.J. Antsaklis. Optimal control of switched systems based on parameterization of the switching instants. *Automatic Control, IEEE Transactions on*, 49(1):2–16, Jan 2004.