Set maximum driving time before charging

When calculating routes for EVs, you can limit how long the driver can drive before they must stop to charge. This lets you tailor the route and charging schedule to meet legal requirements or driver preferences.

To set maximum driving time before charging, add these parameters to the API request:

  • ev[maxDrivingTimeBeforeCharge] - Defines the maximum driving time before the first charging stop. Value expressed in seconds. Maximum allowed value - 18000 (5 hours).
  • ev[minTimeAtFirstChargingStation] - Defines the minimum duration at the first charging stop, including the charging time and subsequent waiting time. Value expressed in seconds. Maximum allowed value - 1800 (30 minutes).

With these parameters set, the API makes a stop at a charging station that is reachable within the maximum driving time while being as close to that limit as possible. The location of the stop depends on the vehicle's battery state and station availability. For example, if two stations fall within the maximum driving time limit, the vehicle may only be able to reach the closer one because its initial charge is low.

Example — ev[maxDrivingTimeBeforeCharge] influence on driving time

The following pair of requests shows route calculation for the same origin and destination.

The first request sets ev[maxDrivingTimeBeforeCharge] to 7200 and the second request doesn't have this parameter. Take note of how that influences the timing of the first stop.

  • With ev[maxDrivingTimeBeforeCharge] set to 7200, the first stop takes place after around 2 hours and 6 minutes and about 112 kilometers.
  • Without the parameter set, the first stop takes place after around 3 hours and 16 minutes and about 251 kilometers.
curl -gX GET 'https://router.hereapi.com/v8/routes?'\
'origin=66.90249486,17.80828695&'\
'destination=64.482125,21.284434&'\
'transportMode=car&'\
'return=summary&'\
'traffic[mode]=disabled&'\
'vehicle[currentWeight]=2100&'\
'consumptionModel=physical&'\
'ev[auxiliaryPowerConsumption]=100&'\
'vehicle[frontalArea]=3.1&'\
'vehicle[airDragCoefficient]=0.28&'\
'vehicle[rollingResistanceCoefficient]=0.02&'\
'ev[recuperationEfficiency]=0.7&'\
'ev[driveEfficiency]=0.9&'\
'ev[initialCharge]=70.0&'\
'ev[maxCharge]=80.0&'\
'ev[minChargeAtChargingStation]=8.0&'\
'ev[minChargeAtDestination]=8.0&'\
'ev[maxChargeAfterChargingStation]=80.0&'\
'ev[maxDrivingTimeBeforeCharge]=7200&'\
'ev[minTimeAtFirstChargingStation]=1800&'\
'ev[chargingCurve]=0,96,8,193,16,200,32,190,48,96,64,48,80,5&'\
'ev[makeReachable]=true&'\
'ev[connectorTypes]=iec62196Type1Combo,iec62196Type2Combo,Chademo,Tesla&'\
'apiKey=YOUR_API_KEY'
curl -gX GET 'https://router.hereapi.com/v8/routes?'\
'origin=66.90249486,17.80828695&'\
'destination=64.482125,21.284434&'\
'transportMode=car&'\
'return=summary&'\
'traffic[mode]=disabled&'\
'vehicle[currentWeight]=2100&'\
'consumptionModel=physical&'\
'ev[auxiliaryPowerConsumption]=100&'\
'vehicle[frontalArea]=3.1&'\
'vehicle[airDragCoefficient]=0.28&'\
'vehicle[rollingResistanceCoefficient]=0.02&'\
'ev[recuperationEfficiency]=0.7&'\
'ev[driveEfficiency]=0.9&'\
'ev[initialCharge]=70.0&'\
'ev[maxCharge]=80.0&'\
'ev[minChargeAtChargingStation]=8.0&'\
'ev[minChargeAtDestination]=8.0&'\
'ev[maxChargeAfterChargingStation]=80.0&'\
'ev[chargingCurve]=0,96,8,193,16,200,32,190,48,96,64,48,80,5&'\
'ev[makeReachable]=true&'\
'ev[connectorTypes]=iec62196Type1Combo,iec62196Type2Combo,Chademo,Tesla&'\
'apiKey=YOUR_API_KEY'

Example — requested maximum driving time can't be honored

This example shows a request where the requested ev[maxDrivingTimeBeforeCharge]=120 is too short to reach any charging station, so the API returns a route that exceeds the limit instead of failing.
The response contains a relevant notice in the notices array.

curl -gX GET 'https://router.hereapi.com/v8/routes?'\
'origin=66.90249486,17.80828695&'\
'destination=65.84031234,20.50605319&'\
'transportMode=car&'\
'return=summary&'\
'traffic[mode]=disabled&'\
'vehicle[currentWeight]=2100&'\
'consumptionModel=physical&'\
'ev[auxiliaryPowerConsumption]=100&'\
'vehicle[frontalArea]=3.1&'\
'vehicle[airDragCoefficient]=0.28&'\
'vehicle[rollingResistanceCoefficient]=0.02&'\
'ev[recuperationEfficiency]=0.7&'\
'ev[driveEfficiency]=0.9&'\
'ev[initialCharge]=48.0&'\
'ev[maxCharge]=80.0&'\
'ev[minChargeAtChargingStation]=8.0&'\
'ev[minChargeAtDestination]=8.0&'\
'ev[maxChargeAfterChargingStation]=80.0&'\
'ev[maxDrivingTimeBeforeCharge]=120&'\
'ev[minTimeAtFirstChargingStation]=1800&'\
'ev[chargingCurve]=0,96,8,193,16,200,32,190,48,96,64,48,80,5&'\
'ev[makeReachable]=true&'\
'ev[connectorTypes]=iec62196Type1Combo,iec62196Type2Combo,Chademo,Tesla&'\
'apiKey=YOUR_API_KEY'

Did this page help you?