# Considering Charging of Electric Vehicles

## User Story

The user plans a trip with an electric vehicle and needs to visit various waypoints. To take into account the time needed for recharging the vehicle, the parameter evChargingTimePerDistance can be used.

### Background Information

Waypoints Sequence can account for time used for charging an electric vehicle ("ev") between the waypoints. This is done following a simple model: It is assumed, that in a fixed time the energy for a certain distance can be charged into the vehicle. It is the choice of the user to define a distance and how much time is needed to get the vehicle charged to the appropriate level. Charging times are controlled by the URL parameter evChargingTimePerDistance=timeInSecondsToRegainChargingLevel,distanceInMeterUntilRecharge.

The time required for charging is accounted as rest time, as it is assumed, the driver has nothing else to do.

• without legal rest times: All times in the response marked as "rest" are times required for charging the vehicle
• with legal rest times: It is assumed that normal rest times are used for charging. If the driver-rest time is equal to or exceeds therequired charging time, no additional time is added. If the driver-rest time is not long enough, the required additional charging time is added to the rest time.

All rest and charging times are provided as in a summary form between each two waypoints. Charging at destinations is not supported. It can be added to the service time.

There is no partial charging supported. In particular, if charging is required to reach the last waypoint, the vehicle is charged fully before reaching it.

In any case the refined charging times can be calculated using the HERE Routing API.

## Request

https://wse.ls.hereapi.com/2/findsequence.json
?apiKey=\{YOUR\_API\_KEY\}
&departure=2016-10-14T07:30:00Z
mode=fastest;truck;traffic:disabled;
&start=Warsaw;52.2356,21.01038
&end=Copenhagen;55.68524,12.57106;st:900
&destination1=Berlin;52.51605,13.37691;st:300
&evChargingTimePerDistance=7200,300000


Note: This example uses a HERE API Key to authenticate your request. For the available authentication options, see the Identity & Access Management Developer Guide.

## Response

{
"results": [
{
"waypoints": [
{
"id": "Warsaw",
"lat": 52.2356,
"lng": 21.01038,
"sequence": 0,
"estimatedArrival": null,
"estimatedDeparture": "2016-10-14T07:30:00Z",
"fulfilledConstraints": []
},
{
"id": "Berlin",
"lat": 52.51605,
"lng": 13.37691,
"sequence": 1,
"estimatedArrival": "2016-10-14T16:49:02Z",
"estimatedDeparture": "2016-10-14T16:54:02Z",
"fulfilledConstraints": [
"st:300"
]
},
{
"id": "Copenhagen",
"lat": 55.68524,
"lng": 12.57106,
"sequence": 2,
"estimatedArrival": "2016-10-15T04:09:02Z",
"estimatedDeparture": null,
"fulfilledConstraints": [
"st:900"
]
}
],
"distance": "1010126",
"time": "75242",
"interconnections": [
{
"fromWaypoint": "Warsaw",
"toWaypoint": "Berlin",
"distance": 573801,
"time": 26342,
"rest": 7200,     # 7200s of charging. That's one charge stop after 300km. 273.801km are driven without further charging
"waiting": 0
},
{
"fromWaypoint": "Berlin",
"toWaypoint": "Copenhagen",
"distance": 436325,
"time": 26100,
"rest": 14400,    # 14400s of charging. Since the last charging 710.126km still must be driven. That requires two more stops stops.
"waiting": 0
}
],
"description": "Targeted best time; without traffic",
"timeBreakdown": {
"driving": 52442,
"service": 1200,
"rest": 21600,  # Three charging stops in total.
"waiting": 0
}
}
],
"errors": [],
"processingTimeDesc": "959ms",
"responseCode": "200",
"warnings": null,
"requestId": null
}