Optimizing regenerative braking -- a variational calculus approach

We examine some basic physics surrounding regenerative braking and air drag. First, we analyze under what conditions it becomes energetically favorable to use aggressive regenerative braking to reach a lower speed over ``coasting'' where one relies solely on air drag to slow down. We then proceed to reformulate the question as an optimization problem to find the velocity-profile that maximizes battery charge. Making a simplifying assumption on battery-charging efficiency, we formulate the recovered energy as an integral quantity and solve the associated Euler-Lagrange equation to find the optimal braking curve. Using Lagrange-multipliers, we also explore the effect of adding a fixed-displacement constraint.


I. INTRODUCTION
Regenerative braking is a process by which some of the initial kinetic energy of a vehicle, rather than wasted as heat, is instead recovered by converting it into electrical energy which in turn is stored as chemical energy in the battery [1]. In the engineering literature, this topic is usually approached from a technological perspective [2][3][4][5][6]. In contrast, here we take a more simplified but fundamental "classical-mechanics" and variational calculus approach to the subject.
There has recently been some debate over the benefits of "1-pedal driving" -this is a mode where as soon as the driver of an electric vehicle (EV) releases pressure on the accelerator pedal, the electric generator is engaged, the battery charges up, and the EV begins to slow down. Tesla, for instance, makes this mode standard in all its cars. Other manufacturers, such as VW, have opted to preserve the driving experience of conventional internal-combustion-engine (ICE) cars, whereby releasing the accelerator pedal allows the car to coast. Coasting means that neither the motor nor the generator are engaged, and the vehicle slows down solely due to aerodynamic drag and other friction. Some people have argued that coasting is, in fact, always best in terms of efficiency, assuming no constraints on the stopping distance [7].
In this paper, we start by comparing the two strategies over the same fixed displacement, and we find that aggressive regenerative braking is superior to coasting as long as the final speed is small enough. While it is true that both the electric motor and the generator do not operate at perfect efficiency and produce losses, lowering the speed faster lowers the drag force on the vehicle (relative to coasting). Thus, there exist a trade-off: regenerative braking recovers some of the initial kinetic energy (though not all of it), but the electric motor then has to use additional energy to keep the vehicle in motion. Is more energy initially stored in the battery as is later drawn from it? As we will see, the answer often is yes.
In the second part of the paper, we reformulate the question in terms of an optimization problem. Here we ask: what should the speed-profile be that leaves the battery in the largest state of charge (SOC)? This recovered energy is an integral quantity, and we thus formulate the associated Euler-Lagrange equation whose solution maximize this quantity and yields the optimal velocity as a function of time. Modeling the regenerative-braking efficiency in the simplest, most tractable way, we solve this nonlinear differential equation numerically, as well as analytically in integral form. Finally, we examine the effect of adding a fixed-displacement constraint via a Lagrange multiplier.

A. Coasting
In this scenario we would like to rely solely on air drag and rolling friction to slow our EV down from an initial speed of v i to a final speed of v f . Here we ignore the contributions of rolling friction -it only exhibits a weak dependence on vehicle speed [8] and should thus result in a similar energy loss when comparing coasting with regenerative braking. What is the final state of the battery relative to its initial state while coasting? It is clear that they are the same. No energy is transferred to or from the battery.
For the sake of comparing to the regenerative-braking scenario, let us calculate the accumulated displacement for this coasting process. Let's assume that the drag force is quadratic in velocity, such that, where A is the cross-sectional area, ρ the density of air, and C d the drag coefficient, and where we have combined these parameters into a single constant, D. This form of the drag force is valid for relatively high speeds, such as a car on a highway, but fails at low speeds. We thus arrive at the following differential equation governing coasting, where m is the car mass. Equation (2) has the well-known analytical solution, The displacement, ∆x = tc 0 v(t)dt can then be found, after a few steps, It is clear from Eq.(4) that we cannot use the quadratic-drag assumption down to a v f of zero.

B. Regenerative Braking
Instead of coasting, let us now try a different strategy: we will slow the EV down quickly from v i to v f using regenerative braking, and then we will continue to drive at v f until we have covered the same distance, ∆x, as during coasting before. For sake of simplicity, let us further assume that in the braking phase, the speed drops linearly in time, and that we accomplish this part in a time, t r , as shown in Fig.1. As we will see in Section III, this constant-acceleration strategy is not energy optimal and can still be improved upon, but it serves as a good starting point. The total displacement can now be expressed as, (5) Setting this expression equal to Eq.(4) for coasting yields, This t f must be longer than the coasting time, t c , of course. Next, let us look at the battery SOC during the two stages -the initial regenerative-braking stage, followed by the constant-speed stage. First, how much energy can be transferred to the battery during the first stage? Here kinetic energy is converted to electrical energy and then stored as chemical energy in the battery. Let us assume that the efficiency from kinetic to chemical-battery energy is given by η. We then have that with |∆T | = 1 2 m(v 2 i − v 2 f ). Equation (7) can also be regarded as a definition of η, the regenerative efficiency [9,10]. But what is W (1) f ric for this stage? We know that W (1) describing the constant deceleration part shown in Fig.1 (blue line). If we denote v i − v f by w, expand out the cubic term, and change variables of integration, we can show that, We can then substitute Eq.(9) into Eq. (7). Now let's turn to the second stage. Here the electric motor has to simply counteract the drag force. The work done by the drag force is given by, with t f given by Eq. (6).
Assuming that the efficiency of converting chemical energy stored in the battery to electrical and then mechanical energy is , we arrive at, where W is given by Eq.(10), and so ∆E batt = ∆E (1) batt + ∆E (2) batt . The problem is then reduced to determining the sign of ∆E batt .
This expression for ∆E batt is still fairly complicated and includes 7 parameters: v i , v f , t r , D, m, η, and . Let us simplify things by analyzing the limit of short t r , such that t r << t f . In this limit the equations simplify significantly. We get, In other words, we have to determine the sign of the following expression, Equation (13) is plotted in Fig.2 as a function of speed ratio for two different sets of efficiencies. We see that for speed ratios only slightly larger than 1, M is negative. For larger speed ratios, M always turns positive. The crossing depends sensitively on the efficiencies of the motor and generator, with lower efficiency pushing that break-even point out to larger speed ratios. The conclusion is that coasting is preferable when the final target speed is not substantially below the initial speed, i.e., for instances where the desired slowdown is only moderate. For instances, where a more dramatic slowdown is desired, aggressive regenerative braking wins out. A quick calculation reveals that if we want to slow down to half of our initial speed, say from 60 mph to 30 mph, and assuming that η = , any efficiency larger than η = = 68 % will favor regenerative braking.

C. A concrete example
So far, the treatment has been theoretical. To make the conclusions more concrete, let us calculate actual numbers from a speed-down experiment with a Tesla (Model 3) [11]. For concreteness, consider decreasing the speed from 50 mph (22.35 m/s) to 25 mph (11.18 m/s) and compare regenerative braking to coasting. The parameters of this vehicle are given as: the drag coefficient C d =0.23, the frontal area A=2.22 m 2 , the weight of the car (with a driver) is m=1280 kg [12]. The density of dry air is ρ=1.225 kg/m 3 .
Assuming an efficiency of = η = 0.75, t f is calculated from Eq. (6) as, Next, from Eq. (7) and (11) and ∆E batt = ∆E According to Eqs. (14) and (15), t f and ∆E batt have a linear relationship with t r , and ∆E batt is positive only when t r < 92s. Furthermore, we can also get the time of coasting t c = 183 s from Eq. (3), and thus we explicitly verify the timeordering, t r < t c < t f when ∆E batt > 0.
In an actual speed-down experiment with a Tesla Model 3 we were able to reach a minimum t r of around 5.0 s. This is much below the theoretical cutoff value of 92 s (where the ∆E batt = 0), as calculated above. We have to remember, however, that the calculated t c and t r are too long compared to realistic numbers, as the real dissipation is not just in the form of air-drag, but also includes rolling friction (tire, road) and internal friction. Nonetheless, 5 s is significantly below both the 92 s, and it is also well below realistic coasting times. It is thus very likely that this speed-down experiment left the battery with a larger charge than what coasting would have accomplished.

A. Charging efficiency considerations
From the previous discussion, and in particular from Eq. (15), it becomes clear that without any further consideration of the charging efficiency involved, the best strategy is to brake very severely to reach the desired target speed as quickly as possible and then to remain at that constant speed for the rest of the way. This was also embodied in our examined limit of very short t r . As we now show, a variational-calculus formulation of that problem confirms this observation. In an initial attempt to shift into this framework, we seek to maximize the following functional, where The expression for L is derived from the combination of |dT | = −mvvdt and dW f ric = Dv 3 dt (where T denotes the kinetic energy). The associated Euler-Lagrange equation, then quickly leads to the result that v(t) = 0.
If we think about it a bit, this result should not be unexpected. Since we have assumed that the regenerative efficiency, η, is entirely constant, it makes sense that the energetically best thing we could do is to immediately slow down to zero. If we have a constraint that we must travel a certain distance, i.e., that T 0 v(t)dt = d, the analysis can be modified by adding a Lagrange multiplier, but the end result is similar: it is best to immediately slow down to a small constant speed (consistent with the distance, d).
It is clear that the culprit for this trivial answer is our assumption of constant efficiency. In reality, what EVs do when they need to slow down quickly is to blend in the physical brakes to assist the regenerative braking. The more severe the required deceleration, the more heavily the EV relies on brake pads and rotors. This means that the efficiency of converting kinetic energy into battery energy goes down significantly as the braking action quickens. The battery can only accept so much power delivered to it, and this maximum power also depends sensitively on the battery SOC and temperature. Even before we reach that power limit, Ohmic losses tend to increase with charging power to reduce efficiency [10,13], and friction braking is often blended in [4,5,9]. How should we model these effects on efficiency? To start, it is clear that the efficiency is a monotonically decreasing function of the braking power that the battery ideally would be expected to "absorb". This power, in turn, could be approximated by the reduction in kinetic energy of the vehicle, P ≈ −dT /dt = −mvv. Thus, we can write η = η(p) = η(v,v). We will later choose a linearly decreasing function. Such choice of η(P ), while not accounting for the full complexity, does capture the overall effect on efficiency heuristically and keeps the mathematics tractable.

B. Optimal braking curves without distance constraints
Informed by these considerations, we now seek to maximize the following functional: The function, η(v,v), should be close to η 0 for low vv and then decrease for larger vv.
It is interesting to note that the first part of Eq.(20) is in the form of an Euler-Lagrange equation involving η as the functional. We must now specify a functional form for η to proceed. To keep things mathematically tractable, let us choose the following functional form for η: Here we have assumed that the efficiency drops linearly with power; the two parameters are the y-intercept η 0 , and the slope, b. Note that b here is positive, sincev is negative. A side benefit of this choice for η is that it forces the left side of Eq.(20) to zero, yielding: From Eq.(21), ∂η ∂v = bmv and ∂η ∂v = bmv, and we get, Substituting Eqs.(23) and (21) into Eq.(22) yields (after a few steps) the following differential equation: Although not imperative, it can be helpful to nondimensionalize Eq.(24). For this purpose we introduce the non-dimensional quantities u and τ , defined as τ = t/α, with α = m Dvi , and u = α(D/m)v = v/v i . Inserting these definitions into Eq.(24), we arrive at the governing equation: Here the prime indicates differentiation with respect to τ , and (26) Equation (25) represents a 2nd-order nonlinear differential equation that we can reduce to a first-order one. Dividing by u 2 and introducing w = u , we can rewrite Eq.(25) in the following form, We recognize this as a Bernoulli-type equation, which can be solved to obtain, Here k 1 is an constant of integration that can be computed from the initial conditions as follows: since w(1) = u (τ = 0) = u 0 , Eq. (28) leads to k 1 = 3(u 0 ) 2 − 2γ.
To obtain u(τ ), we remember that u = w. Thus, and finally, The integral on the right side of Eq. (30) can be evaluated in closed form (which would involve hypergeometric functions) or numerically integrated. Alternatively, we could of course solve the original differential equation, Eq.(25), numerically by specifying the initial conditions (u(0), u (0)). In either case, it is important to estimate realistic values of γ given by Eq.(26). Every constant therein is straightforward with the exception of b. To get a reasonable estimate of this constant, we can start with maximum charging rates for the Tesla Model 3 (SR+) of about 100 kW. It is likely that for this vehicle, the maximum regenerative power is software-limited to the somewhat lower threshold of around 75 kW. In our mathematical model, of course, the efficiency goes down linearly with power. Let's assume that we reduce η to η 0 /2 for 75 kW. This then implies a value of The same data plotted as an acceleration graph. All accelerations become extremely negative near τ = 0.14, so we plot only to 0.13 to highlight to essential differences between the traces. b = 5 * 10 −6 s/J, which yields γ = 67.5 for η 0 = 0.75 and v i = 50 mph. Figure 3(a) shows some typical numeric solutions obtained with Mathematica using the "NDSolve" command [14]. For the blue trace we set γ to 40, and for the red trace γ = 70. The initial conditions were u(0) = 1 for both, and u (0) was adjusted to obtain the same stopping time, τ f = 0.14 (defined by v(τ f ) = 0). For the red trace, this implies u (0) = −7.01, and for the blue, u (0) = −5.65. It should be noted that we get indistinguishable curves by using Eq. (30) and inverting the resulting τ (u).
Also shown for comparison in Fig.3(a) is the speed profile for a run where the extracted power is constant in time (black trace), with that constant adjusted to again yield the same stopping time. A straightforward calculation reveals that for constant power, v(t) = v 2 0 − κt. When comparing the red and black traces, it is evident that the optimal solution is one where initially, at high speeds, more power is extracted than for lower speeds. This makes sense, since the goal is to minimize losses from air-drag, and drawing out more energy from the available kinetic energy during the initial phase is advantageous.
Notice also that, according to Eq.(26), when the parameter γ is raised, b decreases, assuming the same EV is driven (identical m, D, η 0 ) and the same starting speed, v i , is used. For smaller slope, b, governing η(P ), the regenerative braking can be made more severe without incurring additional efficiency penalties. This explains the more negative overall ac- celeration seen in the red trace at the start, when compared with the blue trace.
Finally, Fig.3(b) plots the same data as an acceleration graph, u versus τ . As before, the γ = 70 solution appears in red, γ = 40 in blue, and the constant-power curve in black. For all curves, u diverges to negative infinity as u → 0. However, it is also apparent that the optimal solutions for both values of γ feature more negative accelerations at the beginning, and a less negative acceleration towards the end, compared to the constant-power curve. We again see that air-drag considerations nudge the optimal solutions in the direction of reducing speed at the beginning as much as possible.
This feature of the optimal solution is also present when the vehicle does not come to a stop but reaches a non-zero final speed. Mathematically, we need only modify the endpoint condition to v(T ) = v f . Figure 4(a) depicts the three solutions of the previous figure but now for a final (reduced) speed of u(τ f ) = 0.5, with τ f = 0.1. In Fig. 4(b), the same data is plotted as an acceleration graph that accentuates the differences and again showcases the strategy of making the acceleration as negative as possible at small times (red trace).
These optimized acceleration curves in Fig.4(b) can be compared to accelerometer data from a real test-drive in a Tesla Model 3 where the speed was reduced from 50 mph to 25 mph. This measurement is shown in Fig.5. We see that both the magnitude of acceleration, |u |, and the recovered power are not constant but largest at short times. In that respect, the result resembles the red curve of Fig.4(b).
We conclude this section by circling back to the original FIG. 5: Accelerometer data from a test drive in a Tesla Model 3 (SR+) where the speed was reduced from 50 mph to 25 mph using full regenerative braking. We see that the acceleration is indeed largest initially when the speed is close to 50 mph.
question: how much energy is added or drawn from the battery after performing braking actions according to these optimized solutions? ∆E batt is, in fact, given by the functional of Eq.(19). Should this integral, when evaluated for the numerical solutions found earlier, be positive, the battery would "gain charge" during the examined time interval. Casting this definite integral in terms of the non-dimensional variables, u and τ , we get that η(u, u ) = η 0 1 + 3 2γ uu , and: (31) We use the "NIntegrate" command in Mathematica to evaluate this integral for the traces in Fig.3 (where τ f = 0.14).
We thus obtain 0.315 mv 2 i for the red trace, 0.293 mv 2 i for the blue trace. Both integrals are therefore positive and less than η 0 (T i − T f ). Both solutions are also improvements over the constant-power curve; when compared to the red trace, it recovers roughly 2% less energy.
Similarly, we can compare the optimal braking curves in Fig. 4 to a the constant acceleration case considered earlier in Sec.II, where the speed drops linearly with time. When we do this for the γ = 70 curve (red trace), for instance, we find that the optimal solution recovers 0.226 mv 2 i , which is only about 0.1 % more energy than constant-acceleration braking. In a sense, this observation retroactively validates the initial, more simplified approach.

C. Adding a distance constraint with a Lagrange multiplier
We can ask a slightly modified question: what is the optimal braking curve, v(t), that connects the two points, v(0) = v i and v(T ) = v f , given that the car must cover a specified distance? Notice that we now have added another condition at the end. We would like to consider curves of equal displacment, d = T 0 vdt. Variational calculus tells us that we now need to make the following integral stationary: where λ is called the Lagrange multiplier and is related to the displacement. The Euler-Lagrange equation now reads, Following similar steps as before, we thus arrive at the modified non-dimensional governing equation, Employing the same analytical technique of reducing Eq. (34) to a first-order equation yields, with k = 3(u 0 ) 2 − 2γ − 6κλ. Figure 6 shows the effect of the distance constraint. The three traces correspond to three different values of the Lagrange multiplier and thus braking distances, with γ set to 70. We know that d = vdt = m D udτ . Therefore, to find the actual distance traveled, we numerically integrate the traces in Fig. 6. Then, using the values in section II C, we obtain d = 307, 295, and 282 m, respectively for the red, black and blue traces. Furthermore, T = ατ f = α(0.1) = 18.3 s. The recovered energies for the red, black and blue trace, respectively, are 0.2243 mv 2 i , 0.2260 mv 2 i , and 0.2245 mv 2 i . Not surprisingly, the optimal solution without displacement constraint (black trace) outperforms the other two solutions with the Lagrange multipliers.

IV. CONCLUSION
We can now answer the original question posed in the title with confidence. Under many circumstances, it is advanta-geous to employ aggressive regenerative braking over coasting. We have explored this from a number of different angles, choosing initially a simplified assumption of constant braking acceleration. In the second part of the paper, we then found more realistic braking curves -ones that maximize battery charge, after making certain assumptions on the efficiency profile for regenerative battery charging. To keep the problem mathematically tractable, we used a linear efficiency model, which allowed us to formulate the associated Euler-Lagrange equation. We then found both numerical and analytical (integral-form) solutions to the Euler-Lagrange equation. Finally, we explored the effect of introducing the constraint of fixed displacement (distance traveled) via a Lagrange multiplier. Not unexpectedly, one lesson from the optimal braking curves obtained in this manner is that it pays to make the acceleration as negative as possible at the beginning, in an effort to reduce air-drag losses as much as possible.