Increase fleet effectiveness by scheduling EV recharges at designated stations
When incorporating Electric Vehicle (EV) recharge stations into a tour plan for a fleet that includes electric vehicles, it is essential to consider such factors as the recharge station locations, the vehicle range, or the time that is needed for recharging the batteries.
With the recharges option in the HERE Tour Planning API, you can incorporate this data into vehicle routing problems and receive tour plans that minimize downtime that would otherwise be caused by a lack of charging opportunities, and helps to ensure continued fleet operation and reduce the risk of delays or missed deliveries.
Note
This is an ALPHA feature, which means it is new or experimental and under active development. Alpha features are provided for testing and feedback purposes. They may change significantly or might not become generally available.
For more information, see Explore experimental features.
Define recharge stations
The recharges object has the following options available:
maxDistance(required): Indicates the maximum distance for a vehicle to travel before it must visit an EV recharge station, measured in meters. This value resets after each recharge stop.stations(required): Indicates up to 20 locations representing the available recharge stations. Each recharge station must have the following properties:location(required): Specifies latitude and longitude coordinates of the recharge station.duration(required): Indicates the time that a vehicle needs to spend at the station recharging its batteries.
times(optional): Enables you to specify a time window within which the vehicle must arrive at the station to initiate charging.
Note
To use this feature effectively, ensure that each vehicle is fully charged before it initiates the tour. Additionally, at each charging stop, ensure the vehicle is fully recharged before continuing the tour so that the service can accurately schedule subsequent recharges before reaching the
maxDistancethreshold again.
Nest the recharges object within the shifts array assigned to the vehicle type representing your EV fleet, as shown in the following example:
"recharges": {
"maxDistance": 45000,
"stations": [
{
"location": {
"lat": 52.4532810373924,
"lng": 13.332342180894248
},
"duration": 1800
},
{
"location": {
"lat": 52.631342329,
"lng": 13.31433238
},
"duration": 1800
}
]
}For more information, see the API Reference.
Considerations for calculating maximum driving distance
Accurately calculating the maximum distance (maxDistance) an electric vehicle can drive is essential for planning efficient tours and strategically placing recharge stops that are easily accessible for your fleet. For example, if charging is required every 100 kilometers, consider adding a buffer of at least 10-15% to account for unexpected conditions such as high traffic, road works, or adverse weather. In this example, it means setting the maxDistance value to 90-85 kilometers. This approach ensures that you account for extra battery consumption, guaranteeing sufficient range.
Example: Tour optimization that includes EV recharge stations
This use case demonstrates the recharges functionality through a sample vehicle routing problem. The problem involves a fleet consisting of one electric vehicle (EV) with a maximum driving distance of 45,000 meters. The EV has two recharge stations at its disposal to support its operation. The objective is to serve a total of 10 jobs spread across a wide urban area, as depicted in the following map:
Note
The locations of the recharge stations are not shown on the map.
Problem
The following section contains the full problem JSON file, as described by the use case:
Click to expand/collapse the sample JSON
{ "configuration": {
"experimentalFeatures": [
"recharges"
]
},
"fleet": {
"types": [
{
"profile": "car",
"amount": 1,
"capacity": [
50
],
"costs": {
"time": 0.002,
"distance": 0.001,
"fixed": 10
},
"id": "vehicle_1",
"shifts": [
{
"start": {
"location": {
"lat": 52.531,
"lng": 13.38461
},
"time": "2024-06-24T08:00:00+02:00"
},
"end": {
"location": {
"lat": 52.531,
"lng": 13.38461
},
"time": "2024-06-24T20:00:00+02:00"
},
"recharges": {
"maxDistance": 45000,
"stations": [
{
"location": {
"lat": 52.4532810373924,
"lng": 13.332342180894247
},
"duration": 1800
},
{
"location": {
"lat": 52.631342329,
"lng": 13.31433238
},
"duration": 1800
}
]
}
}
]
}
],
"profiles": [
{
"name": "car",
"type": "car"
}
]
},
"plan": {
"jobs": [
{
"id": "Job_1",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.62738533184079,
"lng": 13.3789
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_2",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.4329271708958,
"lng": 13.376558539227483
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_3",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.580380893737356,
"lng": 13.304479222218161
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_4",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.5102,
"lng": 13.3444
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_5",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.65831976801964,
"lng": 13.359646771531477
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_6",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.49949154428338,
"lng": 13.40857671284082
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_7",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.465255531970406,
"lng": 13.511537556934355
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_8",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.4312,
"lng": 13.45023
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_9",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.6378,
"lng": 13.48675
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_10",
"tasks": {
"deliveries": [
{
"places": [
{
"location": {
"lat": 52.48811100200862,
"lng": 13.376
},
"duration": 300
}
],
"demand": [
1
]
}
]
}
}
]
}
}Solution
The following map visualizes a sample tour generated by the service for the vehicle routing problem, which is the subject of this use case:
The total driving distance for this tour, as indicated by solution statistics, was 108,491 meters, exceeding the maximum driving distance specified for the assigned vehicle (45,000 meters).
To guarantee continuous operations and successful job completion, the service extended the effective range of the vehicle by scheduling two recharge stops along the route, at each designated recharge station location, at tour distances of 40,693 and 70,846 meters, respectively, to enable the vehicle to complete all assigned tasks.
The following section contains the full solution JSON file:
Click to expand/collapse the sample JSON
{
"statistic": {
"cost": 152.849,
"distance": 108491,
"duration": 17179,
"times": {
"driving": 10579,
"serving": 6600,
"waiting": 0,
"stopping": 0,
"break": 0
}
},
"tours": [
{
"vehicleId": "vehicle_1_1",
"typeId": "vehicle_1",
"stops": [
{
"time": {
"arrival": "2024-06-24T06:00:00Z",
"departure": "2024-06-24T06:00:00Z"
},
"load": [
10
],
"activities": [
{
"jobId": "departure",
"type": "departure",
"location": {
"lat": 52.531,
"lng": 13.38461
},
"time": {
"start": "2024-06-24T06:00:00Z",
"end": "2024-06-24T06:00:00Z"
}
}
],
"location": {
"lat": 52.531,
"lng": 13.38461
},
"distance": 0
},
{
"time": {
"arrival": "2024-06-24T06:22:36Z",
"departure": "2024-06-24T06:27:36Z"
},
"load": [
9
],
"activities": [
{
"jobId": "Job_9",
"type": "delivery",
"location": {
"lat": 52.6378,
"lng": 13.48675
},
"time": {
"start": "2024-06-24T06:22:36Z",
"end": "2024-06-24T06:27:36Z"
}
}
],
"location": {
"lat": 52.6378,
"lng": 13.48675
},
"distance": 17552
},
{
"time": {
"arrival": "2024-06-24T06:42:43Z",
"departure": "2024-06-24T06:47:43Z"
},
"load": [
8
],
"activities": [
{
"jobId": "Job_5",
"type": "delivery",
"location": {
"lat": 52.65831976801964,
"lng": 13.359646771531477
},
"time": {
"start": "2024-06-24T06:42:43Z",
"end": "2024-06-24T06:47:43Z"
}
}
],
"location": {
"lat": 52.65831976801964,
"lng": 13.359646771531477
},
"distance": 28716
},
{
"time": {
"arrival": "2024-06-24T06:55:46Z",
"departure": "2024-06-24T07:00:46Z"
},
"load": [
7
],
"activities": [
{
"jobId": "Job_1",
"type": "delivery",
"location": {
"lat": 52.62738533184079,
"lng": 13.3789
},
"time": {
"start": "2024-06-24T06:55:46Z",
"end": "2024-06-24T07:00:46Z"
}
}
],
"location": {
"lat": 52.62738533184079,
"lng": 13.3789
},
"distance": 34688
},
{
"time": {
"arrival": "2024-06-24T07:11:01Z",
"departure": "2024-06-24T07:41:01Z"
},
"load": [
7
],
"activities": [
{
"jobId": "recharge",
"type": "recharge",
"location": {
"lat": 52.631342329,
"lng": 13.31433238
},
"time": {
"start": "2024-06-24T07:11:01Z",
"end": "2024-06-24T07:41:01Z"
}
}
],
"location": {
"lat": 52.631342329,
"lng": 13.31433238
},
"distance": 40693
},
{
"time": {
"arrival": "2024-06-24T07:52:06Z",
"departure": "2024-06-24T07:57:06Z"
},
"load": [
6
],
"activities": [
{
"jobId": "Job_3",
"type": "delivery",
"location": {
"lat": 52.58038089373736,
"lng": 13.30447922221816
},
"time": {
"start": "2024-06-24T07:52:06Z",
"end": "2024-06-24T07:57:06Z"
}
}
],
"location": {
"lat": 52.58038089373736,
"lng": 13.30447922221816
},
"distance": 47549
},
{
"time": {
"arrival": "2024-06-24T08:16:06Z",
"departure": "2024-06-24T08:21:06Z"
},
"load": [
5
],
"activities": [
{
"jobId": "Job_4",
"type": "delivery",
"location": {
"lat": 52.5102,
"lng": 13.3444
},
"time": {
"start": "2024-06-24T08:16:06Z",
"end": "2024-06-24T08:21:06Z"
}
}
],
"location": {
"lat": 52.5102,
"lng": 13.3444
},
"distance": 59861
},
{
"time": {
"arrival": "2024-06-24T08:30:47Z",
"departure": "2024-06-24T08:35:47Z"
},
"load": [
4
],
"activities": [
{
"jobId": "Job_10",
"type": "delivery",
"location": {
"lat": 52.48811100200862,
"lng": 13.376
},
"time": {
"start": "2024-06-24T08:30:47Z",
"end": "2024-06-24T08:35:47Z"
}
}
],
"location": {
"lat": 52.48811100200862,
"lng": 13.376
},
"distance": 64281
},
{
"time": {
"arrival": "2024-06-24T08:46:59Z",
"departure": "2024-06-24T09:16:59Z"
},
"load": [
4
],
"activities": [
{
"jobId": "recharge",
"type": "recharge",
"location": {
"lat": 52.4532810373924,
"lng": 13.332342180894248
},
"time": {
"start": "2024-06-24T08:46:59Z",
"end": "2024-06-24T09:16:59Z"
}
}
],
"location": {
"lat": 52.4532810373924,
"lng": 13.332342180894248
},
"distance": 70846
},
{
"time": {
"arrival": "2024-06-24T09:27:02Z",
"departure": "2024-06-24T09:32:02Z"
},
"load": [
3
],
"activities": [
{
"jobId": "Job_2",
"type": "delivery",
"location": {
"lat": 52.4329271708958,
"lng": 13.376558539227483
},
"time": {
"start": "2024-06-24T09:27:02Z",
"end": "2024-06-24T09:32:02Z"
}
}
],
"location": {
"lat": 52.4329271708958,
"lng": 13.376558539227483
},
"distance": 76125
},
{
"time": {
"arrival": "2024-06-24T09:45:17Z",
"departure": "2024-06-24T09:50:17Z"
},
"load": [
2
],
"activities": [
{
"jobId": "Job_8",
"type": "delivery",
"location": {
"lat": 52.4312,
"lng": 13.45023
},
"time": {
"start": "2024-06-24T09:45:17Z",
"end": "2024-06-24T09:50:17Z"
}
}
],
"location": {
"lat": 52.4312,
"lng": 13.45023
},
"distance": 83953
},
{
"time": {
"arrival": "2024-06-24T10:06:19Z",
"departure": "2024-06-24T10:11:19Z"
},
"load": [
1
],
"activities": [
{
"jobId": "Job_7",
"type": "delivery",
"location": {
"lat": 52.465255531970406,
"lng": 13.511537556934355
},
"time": {
"start": "2024-06-24T10:06:19Z",
"end": "2024-06-24T10:11:19Z"
}
}
],
"location": {
"lat": 52.465255531970406,
"lng": 13.511537556934355
},
"distance": 92789
},
{
"time": {
"arrival": "2024-06-24T10:28:58Z",
"departure": "2024-06-24T10:33:58Z"
},
"load": [
0
],
"activities": [
{
"jobId": "Job_6",
"type": "delivery",
"location": {
"lat": 52.49949154428338,
"lng": 13.40857671284082
},
"time": {
"start": "2024-06-24T10:28:58Z",
"end": "2024-06-24T10:33:58Z"
}
}
],
"location": {
"lat": 52.49949154428338,
"lng": 13.40857671284082
},
"distance": 102878
},
{
"time": {
"arrival": "2024-06-24T10:46:19Z",
"departure": "2024-06-24T10:46:19Z"
},
"load": [
0
],
"activities": [
{
"jobId": "arrival",
"type": "arrival",
"location": {
"lat": 52.531,
"lng": 13.38461
},
"time": {
"start": "2024-06-24T10:46:19Z",
"end": "2024-06-24T10:46:19Z"
}
}
],
"location": {
"lat": 52.531,
"lng": 13.38461
},
"distance": 108491
}
],
"statistic": {
"cost": 152.849,
"distance": 108491,
"duration": 17179,
"times": {
"driving": 10579,
"serving": 6600,
"waiting": 0,
"stopping": 0,
"break": 0
}
},
"shiftIndex": 0
}
]
}The solution includes comprehensive data for each recharge stop, which provides the exact location, arrival and departure times, and its position within the overall tour distance, as shown in the following example:
{
"time": {
"arrival": "2024-06-24T08:46:59Z",
"departure": "2024-06-24T09:16:59Z"
},
"load": [
4
],
"activities": [
{
"jobId": "recharge",
"type": "recharge",
"location": {
"lat": 52.4532810373924,
"lng": 13.332342180894248
},
"time": {
"start": "2024-06-24T08:46:59Z",
"end": "2024-06-24T09:16:59Z"
}
}
],
"location": {
"lat": 52.4532810373924,
"lng": 13.332342180894248
},
"distance": 70846
}In summary, by incorporating recharge stations into your tour plan, you can maximize route optimization for your electric vehicle (EV) fleet, ensure adequate range availability, and simplify fleet operations.
Next steps
For more information, see HERE Tour Planning API Reference.
Updated 28 days ago