Calculating a route with charging along the way.

For longer journeys with electric vehicles, it is important to plan for charging stops along the way. After all, charging stations are much less common than petrol stations. The Routing API is capable of planning such a route. The Routing service tries to find the fastest route, i.e., one with the lowest overall time consumed to reach the destination, while ensuring that vehicle does not run out of energy along the way.

This is not realized by enhancing a normal car route with stations along the way. The result of the calculation is a route optimized for electric vehicles.

This behavior can be enabled by adding ev[makeReachable]=true to the request. Additional parameters related to the charging preferences and attributes of the vehicle are necessary.

Basic example with mandatory ev parameters

The following route is only reachable after adding one charging station on the way. The result contains 2 sections.

The first section includes a postAction, which describes the charging stop. It contains the information on the expected arrival charge, recommended target charge and speed of charging. The consumption in the summary of the first section is negative, as the the resulting charge is higher than at the start because of charging.

departure now contains the start charge for that section and arrival contains charge at the end of the section.

curl -X GET \
  https://router.hereapi.com/v8/routes?departureTime=any&origin=52.533959,13.404780&ev[connectorTypes]=iec62196Type2Combo&transportMode=car&destination=51.741505,14.352413&return=summary&ev[freeFlowSpeedTable]=0,0.239,27,0.239,45,0.259,60,0.196,75,0.207,90,0.238,100,0.26,110,0.296,120,0.337,130,0.351,250,0.351&ev[trafficSpeedTable]=0,0.349,27,0.319,45,0.329,60,0.266,75,0.287,90,0.318,100,0.33,110,0.335,120,0.35,130,0.36,250,0.36&ev[auxiliaryConsumption]=1.8&ev[ascent]=9&ev[descent]=4.3&ev[makeReachable]=true&ev[initialCharge]=48&ev[maxCharge]=80&ev[chargingCurve]=0,239,32,199,56,167,60,130,64,111,68,83,72,55,76,33,78,17,80,1&ev[maxChargeAfterChargingStation]=72
{
  "routes": [
    {
      "id": "724e3494-9b75-432c-aa58-55807ca4dad0",
      "sections": [
        {
          "id": "f62775e5-829f-4444-bc04-27b36674eea4",
          "type": "vehicle",
          "postActions": [
            {
              "action": "charging",
              "duration": 541,
              "consumablePower": 100,
              "arrivalCharge": 40.9789,
              "targetCharge": 56
            }
          ],
          "departure": {
            "place": {
              "type": "place",
              "location": {
                "lat": 52.5338756,
                "lng": 13.4050139,
                "elv": 91
              },
              "originalLocation": {
                "lat": 52.5339589,
                "lng": 13.4047799
              }
            },
            "charge": 48
          },
          "arrival": {
            "place": {
              "type": "chargingStation",
              "location": {
                "lat": 52.4278437,
                "lng": 13.5197486,
                "elv": 75
              },
              "id": "5103"
            },
            "charge": 40.9789
          },
          "summary": {
            "duration": 2315,
            "length": 17982,
            "consumption": -8,
            "baseDuration": 2315
          },
          "transport": {
            "mode": "car"
          }
        },
        {
          "id": "bd40cfd7-2ee5-447c-8e73-625764176f9b",
          "type": "vehicle",
          "departure": {
            "place": {
              "type": "chargingStation",
              "location": {
                "lat": 52.4278437,
                "lng": 13.5197486,
                "elv": 75
              },
              "id": "5103"
            },
            "charge": 56
          },
          "arrival": {
            "place": {
              "type": "place",
              "location": {
                "lat": 51.7412356,
                "lng": 14.3525337,
                "elv": 115
              },
              "originalLocation": {
                "lat": 51.741505,
                "lng": 14.3524129
              }
            },
            "charge": 12.1218
          },
          "summary": {
            "duration": 4379,
            "length": 114451,
            "consumption": 43.8782,
            "baseDuration": 4379
          },
          "transport": {
            "mode": "car"
          }
        }
      ]
    }
  ]
}

Arriving at the destination with reserve

There are situations where adding a reserve charge at the destination is required. The reasons might include:

  • The consumption model does not compute energy consumption precisely and user wants to ensure the destination can be reached.
  • It is not possible to charge at the destination. The reserve is needed for the next journey.

There are 2 optional parameters that can be used for this purpose, both with value 0 by default:

  • ev[minChargeAtDestination] is used only for the destination waypoint.
  • ev[minChargeAtChargingStation] is used for all charging station waypoints.

Waypoints that are neither charging stops nor the destination do not support the corresponding parameter, as there is no use-case for them to have a reserve.

The following example describes a scenario specifying 10% of the maximum charge (8kWh) as minimum charge at a charging station. Additionally, it specifies 50kWh as minimum required charge at the destination. Because of this, there is now an additional charging station close to the destination. The response has 3 sections.

curl -X GET \
  https://router.hereapi.com/v8/routes?departureTime=any&origin=52.533959,13.404780&ev[connectorTypes]=iec62196Type2Combo&transportMode=car&destination=51.741505,14.352413&return=summary&ev[freeFlowSpeedTable]=0,0.239,27,0.239,45,0.259,60,0.196,75,0.207,90,0.238,100,0.26,110,0.296,120,0.337,130,0.351,250,0.351&ev[trafficSpeedTable]=0,0.349,27,0.319,45,0.329,60,0.266,75,0.287,90,0.318,100,0.33,110,0.335,120,0.35,130,0.36,250,0.36&ev[auxiliaryConsumption]=1.8&ev[ascent]=9&ev[descent]=4.3&ev[makeReachable]=true&ev[initialCharge]=48&ev[maxCharge]=80&ev[chargingCurve]=0,239,32,199,56,167,60,130,64,111,68,83,72,55,76,33,78,17,80,1&ev[maxChargeAfterChargingStation]=72&ev[minChargeAtChargingStation]=8&ev[minChargeAtDestination]=50
{
  "routes": [
    {
      "id": "c8dffbf5-d80d-47b1-a881-75a13365ee47",
      "sections": [
        {
          "id": "27ae0759-0b76-4445-ace6-3eac17dc26bd",
          "type": "vehicle",
          "postActions": [
            {
              "action": "charging",
              "duration": 829,
              "consumablePower": 100,
              "arrivalCharge": 40.9789,
              "targetCharge": 64
            }
          ],
          "departure": {
            "place": {
              "type": "place",
              "location": {
                "lat": 52.5338756,
                "lng": 13.4050139,
                "elv": 91
              },
              "originalLocation": {
                "lat": 52.5339589,
                "lng": 13.4047799
              }
            },
            "charge": 48
          },
          "arrival": {
            "place": {
              "type": "chargingStation",
              "location": {
                "lat": 52.4278437,
                "lng": 13.5197486,
                "elv": 75
              },
              "id": "5103"
            },
            "charge": 40.9789
          },
          "summary": {
            "duration": 2603,
            "length": 17982,
            "consumption": -16,
            "baseDuration": 2603
          },
          "transport": {
            "mode": "car"
          }
        },
        {
          "id": "a3983cff-9402-4522-a74f-f5848005faa0",
          "type": "vehicle",
          "postActions": [
            {
              "action": "charging",
              "duration": 2001,
              "consumablePower": 62,
              "arrivalCharge": 21.5392,
              "targetCharge": 56
            }
          ],
          "departure": {
            "place": {
              "type": "chargingStation",
              "location": {
                "lat": 52.4278437,
                "lng": 13.5197486,
                "elv": 75
              },
              "id": "5103"
            },
            "charge": 64
          },
          "arrival": {
            "place": {
              "type": "chargingStation",
              "location": {
                "lat": 51.7486348,
                "lng": 14.3282201,
                "elv": 116
              },
              "id": "5126"
            },
            "charge": 21.5392
          },
          "summary": {
            "duration": 6043,
            "length": 111088,
            "consumption": 8,
            "baseDuration": 6043
          },
          "transport": {
            "mode": "car"
          }
        },
        {
          "id": "f0c912dd-a0e5-40f4-b060-27ef09df2976",
          "type": "vehicle",
          "departure": {
            "place": {
              "type": "chargingStation",
              "location": {
                "lat": 51.7486348,
                "lng": 14.3282201,
                "elv": 116
              },
              "id": "5126"
            },
            "charge": 56
          },
          "arrival": {
            "place": {
              "type": "place",
              "location": {
                "lat": 51.7412356,
                "lng": 14.3525337,
                "elv": 115
              },
              "originalLocation": {
                "lat": 51.741505,
                "lng": 14.3524129
              }
            },
            "charge": 54.142
          },
          "summary": {
            "duration": 525,
            "length": 4135,
            "consumption": 1.858,
            "baseDuration": 525
          },
          "transport": {
            "mode": "car"
          }
        }
      ]
    }
  ]
}

Example with all parameters

The following is an example of a request with all available ev parameters (at the time of writing this guide).

curl -X GET \
  https://router.hereapi.com/v8/routes?departureTime=any&origin=52.533959,13.404780&ev[connectorTypes]=iec62196Type2Combo&transportMode=car&destination=51.741505,14.352413&return=summary&ev[freeFlowSpeedTable]=0,0.239,27,0.239,45,0.259,60,0.196,75,0.207,90,0.238,100,0.26,110,0.296,120,0.337,130,0.351,250,0.351&ev[trafficSpeedTable]=0,0.349,27,0.319,45,0.329,60,0.266,75,0.287,90,0.318,100,0.33,110,0.335,120,0.35,130,0.36,250,0.36&ev[auxiliaryConsumption]=1.8&ev[ascent]=9&ev[descent]=4.3&ev[makeReachable]=true&ev[initialCharge]=48&ev[maxCharge]=80&ev[chargingCurve]=0,239,32,199,56,167,60,130,64,111,68,83,72,55,76,33,78,17,80,1&ev[maxChargingVoltage]=400&ev[maxChargingCurrent]=250&ev[maxChargeAfterChargingStation]=72&ev[minChargeAtChargingStation]=8&ev[minChargeAtDestination]=8&ev[chargingSetupDuration]=300
{
  "routes": [
    {
      "id": "dbadad01-1177-4c72-bfe9-a6b89ffa8d30",
      "sections": [
        {
          "id": "9756dd53-ac2d-46bd-a511-a4dd76bc99b6",
          "type": "vehicle",
          "postActions": [
            {
              "action": "chargingSetup",
              "duration": 300
            },
            {
              "action": "charging",
              "duration": 541,
              "consumablePower": 100,
              "arrivalCharge": 40.9789,
              "targetCharge": 56
            }
          ],
          "departure": {
            "place": {
              "type": "place",
              "location": {
                "lat": 52.5338756,
                "lng": 13.4050139,
                "elv": 91
              },
              "originalLocation": {
                "lat": 52.5339589,
                "lng": 13.4047799
              }
            },
            "charge": 48
          },
          "arrival": {
            "place": {
              "type": "chargingStation",
              "location": {
                "lat": 52.4278437,
                "lng": 13.5197486,
                "elv": 75
              },
              "id": "5103"
            },
            "charge": 40.9789
          },
          "summary": {
            "duration": 2615,
            "length": 17982,
            "consumption": -8,
            "baseDuration": 2615
          },
          "transport": {
            "mode": "car"
          }
        },
        {
          "id": "a1783ce0-9e2a-4e03-9568-61a3e3498b42",
          "type": "vehicle",
          "departure": {
            "place": {
              "type": "chargingStation",
              "location": {
                "lat": 52.4278437,
                "lng": 13.5197486,
                "elv": 75
              },
              "id": "5103"
            },
            "charge": 56
          },
          "arrival": {
            "place": {
              "type": "place",
              "location": {
                "lat": 51.7412356,
                "lng": 14.3525337,
                "elv": 115
              },
              "originalLocation": {
                "lat": 51.741505,
                "lng": 14.3524129
              }
            },
            "charge": 12.1218
          },
          "summary": {
            "duration": 4379,
            "length": 114451,
            "consumption": 43.8782,
            "baseDuration": 4379
          },
          "transport": {
            "mode": "car"
          }
        }
      ]
    }
  ]
}

results matching ""

    No results matching ""