Planning a long-distance route with an electric vehicle
For electric vehicles (EVs), when specifying additional parameters describing consumption and charging, additional features are available:
- Calculating the reachable offset along the route.
- Calculating a long-distance EV route (LDEVR) that contains automatically added charging stops as waypoints to ensure that the destination is reachable while minimizing overall travel time.
Calculating the reachable offset along the route
Planning an EV route is similar to planning a regular route. To obtain reachability information, you must specify the RoutePlanningOptions
. These RoutePlanningOptions
must have a Vehicle
profile with:
Then the route planner gives you a route where the reachableOffset
field in the summary of the route is set. It estimates how far you can get with the current charge level. That could be the length of the whole route if it’s reachable or less than the length of the entire route if it’s not. The same method can be used with combustion engines, too.
Besides the previously mentioned electric engine parameters, it’s possible to specify the ElectricVehicleEfficiency
. This helps the TomTom route planner provide more accurate estimates or arrival charges, though it is not required.
1val consumption = mapOf(2 Speed.kilometersPerHour(0.0) to ElectricConsumption.kilowattHoursPer100Kilometers(13.44),3 Speed.kilometersPerHour(50.0) to ElectricConsumption.kilowattHoursPer100Kilometers(16.4),4 Speed.kilometersPerHour(80.0) to ElectricConsumption.kilowattHoursPer100Kilometers(18.8),5 Speed.kilometersPerHour(120.0) to ElectricConsumption.kilowattHoursPer100Kilometers(19.65),6 Speed.kilometersPerHour(170.0) to ElectricConsumption.kilowattHoursPer100Kilometers(21.1),7)89val electricVehicle = Vehicle.Car(10 electricEngine = ElectricEngine(11 chargeLevel = ChargeLevel(12 currentCharge = Energy.kilowattHours(10),13 maxCharge = Energy.kilowattHours(60),14 ),15 consumption = ElectricVehicleConsumption(null, consumption),16 ),17)1819val amsterdam = GeoPoint(52.377956, 4.897070)20val rotterdam = GeoPoint(51.926517, 4.462456)2122val routePlanningOptions = RoutePlanningOptions(23 itinerary = Itinerary(amsterdam, rotterdam),24 vehicle = electricVehicle,25)
Calculating a long distance EV route
To obtain a route with automatically generated waypoints that contain charging information, you must:
- Specify everything as in the previous example.
- Specify the
ChargingParameters
of theElectricEngine
in theVehicle
. - Pass in the
ChargingOptions
to theRoutePlanningOptions
. Then the route planner can automatically insert charging stops to ensure the destination is reachable.
Ensure that the battery curve map has no more than twenty (20) entries where all energy values must be greater or equal to zero while the power values must be greater than zero. Additionally, a battery curve without any entries is also considered valid. You should also make sure you are using plug types available in the region where you are trying to plan a route; otherwise, planning will fail.
1val consumption = mapOf(2 Speed.kilometersPerHour(0.0) to ElectricConsumption.kilowattHoursPer100Kilometers(13.44),3 Speed.kilometersPerHour(50.0) to ElectricConsumption.kilowattHoursPer100Kilometers(16.4),4 Speed.kilometersPerHour(80.0) to ElectricConsumption.kilowattHoursPer100Kilometers(18.8),5 Speed.kilometersPerHour(120.0) to ElectricConsumption.kilowattHoursPer100Kilometers(19.65),6 Speed.kilometersPerHour(170.0) to ElectricConsumption.kilowattHoursPer100Kilometers(21.1),7)89val batteryCurve = mapOf(10 Energy.kilowattHours(1) to Power.kilowatts(123),11 Energy.kilowattHours(18) to Power.kilowatts(121),12 Energy.kilowattHours(34) to Power.kilowatts(105),13 Energy.kilowattHours(50.8) to Power.kilowatts(66),14 Energy.kilowattHours(62.8) to Power.kilowatts(55.5),15)1617val chargingConnectors = listOf(18 ChargingConnector(19 currentType = CurrentType.AcThreePhase,20 plugTypes = listOf(ConnectorType.Iec62196Type2Outlet),21 ),22 ChargingConnector(23 currentType = CurrentType.Dc,24 plugTypes = listOf(ConnectorType.Iec62196Type2Ccs),25 ),26)2728val electricCarVehicleProfile = Vehicle.Car(29 electricEngine = ElectricEngine(30 consumption = ElectricVehicleConsumption(null, consumption),31 chargeLevel = ChargeLevel(Energy.kilowattHours(10), Energy.kilowattHours(70)),32 chargingParameters = ChargingParameters(33 batteryCurve = batteryCurve,34 chargingConnectors = chargingConnectors,35 ),36 ),37)
Make sure to use valid charging options:
- Minimum charge at a destination must be less than the maximum charge of the vehicle.
- Minimum charge at charging stops cannot be greater than half of the maximum charge of the vehicle (note that the first charging stop may have an arrival charge less than this value).
1val chargingOptions = ChargingOptions(2 minChargeAtChargingStops = Energy.kilowattHours(5),3 minChargeAtDestination = Energy.kilowattHours(10),4)
Requesting the route
Once the charging options are set, a route can be planned synchronously or asynchronously, as is done with usual route planning requests.
1val amsterdam = GeoPoint(52.377956, 4.897070)2val rotterdam = GeoPoint(51.926517, 4.462456)34val routePlanningOptions = RoutePlanningOptions(5 itinerary = Itinerary(amsterdam, rotterdam),6 vehicle = electricCarVehicleProfile,7 chargingOptions = chargingOptions,8)910val result = routePlanner.planRoute(routePlanningOptions)11val routePlanningResponse = when (result) {12 is Result.Success -> result.value()13 is Result.Failure -> return14}
Unsupported route planning options
The following options are not supported in Long Distance EV Routing:
WaypointOptimization.DistanceBased
is not supported.RouteType
values other thanRouteType.Fast
are not supported.Vehicle
types other thanCar
,Motorcycle
,Bus
, orVan
are not supported.
Charging stops information in successfully computed route
The route contains charging stops as waypoints that have been added automatically based on the vehicle’s consumption and charging model. Charging stops contain additional information:
- Automatically added charging stops have
RouteStopSourceType
with valueAutoGenerated
Arrival charge
Charging information
Next steps
Since you have learned how to plan EV routes, here are recommendations for the next steps: