Skip to content

Electric vehicle ​

  • 2 state
  • 1 control
  • Lagrange cost
  • fixed final time
  • 4 boundary
  • OptimalControl valid
  • OptimalControl, scalarized valid
  • JuMP valid
  • ModelingToolkit valid

The Electric Vehicle (EV) trajectory problem is a benchmark in optimal control for energy-efficient driving. It was introduced by Petit & Sciarretta (2011) as a simplified longitudinal model of an electric vehicle moving along a road with varying slope. The state variables are the vehicle position and velocity , and the control represents the traction/braking command. The objective is to minimise a combination of mechanical energy consumption and control effort, subject to boundary conditions on the trip distance and vehicle velocity over a fixed horizon.

Here, we denote the final time as , with   s.

Mathematical formulation ​

where the road slope is modelled as a cubic polynomial

and the parameters , , , , , and define vehicle dynamics, drag, and slope effects.

Qualitative behaviour ​

  • The optimal solution balances traction and braking to respect the velocity boundary conditions while minimising energy consumption.

  • Road slope variations introduce nonlinearities, strongly influencing the structure of the optimal control.

  • For flat roads, the solution often exhibits a bang–singular–bang profile, while slopes lead to asymmetric trajectories.

Characteristics ​

  • Nonlinear second-order dynamics including drag, gravity, and slope effects.

  • Mixed linear–quadratic cost reflecting energy and smoothness trade-offs.

  • Fixed-distance trip with zero final velocity.

  • Benchmark for testing energy-optimal trajectory generation and direct transcription methods in electric vehicles.

References ​

  • Petit, N., & Sciarretta, A. (2011). Optimal drive of electric vehicles using an inversion-based trajectory generation approach. IFAC Proceedings Volumes, 44(1), 14519–14526. Introduces the EV optimal control formulation, including energy-efficient trajectory generation and numerical solution methods.

  • Sciarretta, A., & Guzzella, L. (2007). Control of Hybrid Electric Vehicles. IEEE Control Systems Magazine, 27(2), 60–70. Provides context for energy-optimal vehicle control and modelling of longitudinal dynamics.

  • Feng, X., & Petrovic, D. (2010). Energy-optimal control of electric vehicles: A review of recent advances. IEEE Transactions on Intelligent Transportation Systems, 11(3), 678–689. Surveys numerical methods for EV trajectory optimisation, including handling of road slopes and energy costs.

Parameters ​

ParameterDefault valueUnitMeaning
t00sinitial time
tf1sfinal time
b11.0–weight of the power u·v in the cost
b21.0–weight of u² in the cost
h00.1–constant resistance in the dynamics of v
h11–gain of the control u in the dynamics of v
h20.001–coefficient of the quadratic drag v²
α03–coefficient of degree 0 of the road profile, a cubic in x
α10.4–coefficient of degree 1 of the road profile
α2-1–coefficient of degree 2 of the road profile
α30.1–coefficient of degree 3 of the road profile
x_t00minitial position
v_t00m/sinitial velocity
x_tf10mfinal position, the length of the trip
v_tf0m/sfinal velocity

Every modeling takes other values with the keyword parameters, merged with these: electric_vehicle(backend; parameters=(t0=…,)).

Reference objective ​

The best objective among the solves that converged, in each modeling, on the default grid of the modeling: the modelings are independent, each has its own reference. See how the references are computed.

ModelingSchemeGridReference objectiveSolvesDistinct solutionsConfigurations agree
JuMP:trapeze5001228.59928481yes, within 0
OptimalControl:trapeze5001228.599284181yes, within 9.3e-16
OptimalControl, scalarized:trapeze5001228.59928431yes, within 0