GuidesAPI Reference
Guides

Plan efficient routes for EV fleets

This article demonstrates how you can tailor your tour planning to cater to the requirements of fleets comprising electric vehicles (EVs).

Adapting tour planning for electric vehicles involves addressing such specific use cases as range limits, charging en route, and optimizing breaks with charging intervals. By incorporating these adjustments into your tour planning problems, you can ensure efficient and reliable operations for EV fleets while maximizing driving range and minimizing downtime.

📘

Tip: Estimate battery consumption

Each electric vehicle has its limit on how far it can travel on a single charge before needing a recharge. This limit is critical, especially in logistics and delivery scenarios. You might already have insights into your vehicles' range capabilities. If not, consider using the HERE Routing API v8 to calculate battery consumption based on such variables as vehicle speed, route length, and terrain elevation. For more information, see EV routing in HERE Routing API v8.

When querying the HERE Routing API v8 for retrieving data on EV battery consumption, the response includes a summary object. This object contains a variety of values that can be utilized to establish different types of range limits pertinent to EVs, tailored to specific requirements.

Consider the following sample summary object:

"summary" : {
    "consumption" : 43.343000000000004,
    "length" : 145350,
    "baseDuration" : 6337,
    "duration" : 6337
  }

The following list presents insights on how you can utilize some key values from the summary object in tour planning for your EV fleet:

  • length: This value provides an estimate of how far a vehicle can travel before requiring charging. For example, you can use this value to set the maxDistance limit for your EV fleet when you require to complete a tour on a single charge.

  • duration or baseDuration: This value provides an estimate on how long a vehicle can operate on a single charge, with and without time-aware information (like waiting, breaks, and so on), respectively. These values might serve various purposes:

  • Setting the shiftTime limit for an EV fleet. Adjusting this limit alongside the maxDistance limit enables more control over tour planning for an EV fleet, accommodating both distance-based and time-based constraints.

  • Calculating the time window for charging jobs, enabling effective management of charging schedules.

  • Incorporating a driver break at the EV charging location, optimizing downtime by synchronizing breaks with charging intervals.

📘

Note

The HERE Routing API v8 can help you determine the battery consumption and thus the maximum length of your trip or its duration, providing insights into where charging should occur based on these parameters. However, determining the exact location of the EV charging spot within your system needs to be done independently.

Manage tour efficiency on a single charge

Consider a common use case in which an EV must complete a tour on a single battery charge before returning to the depot or completing the tour at an EV charging station for battery replenishment. To ensure that a vehicle can complete its assigned jobs without running out of battery power, you can use the fleet.types.limits option to set a tour distance and/or duration cap for each vehicle in the fleet. For more information about the limits option, see VehicleType.

The following problem JSON snippet provides a sample limits configuration, with the following settings:

  • shiftTime set to 10800 seconds (3 hours)
  • maxDistance set to 25000 meters (25 kilometers)
{
  // Simplified version focusing on the "limits" object
  "fleet": {
    "types": [
      {
        "id": "car_shift_a",
        "profile": "ev_car",
        "limits": {
          "shiftTime": 10800,
          "maxDistance": 25000
        },
        "amount": 2
      }
    ]
  }
}

In the preceding EV use case, the limits values impose a constraint on tour planning, in which a tour for a single vehicle cannot extend past 3 hours or 25 kilometers, setting boundaries on how long and how far the vehicles can operate before needing a recharge at the depot.

The following figure visualizes a solution to a 7-job problem for a fleet consisting of 2 vehicles, with the limits configuration as presented in the preceding use case:

A solution for a problem with limits that represent EV range on a single charge

As the Tours overview indicates, both vehicles completed their assigned tours without violating either the distance or duration limits. However, the vehicles achieved this at the cost of 2 unassigned jobs that would otherwise have extended the tour beyond an assigned limit (in this case, the distance limit).

Therefore, in single-charge EV use cases it's essential to adjust your fleet size or the number of jobs in a tour to ensure that all jobs are completed within the specified limits.

Plan for charging en route

Another common use case involves EVs scheduled to complete longer tours, for example from one city to another, with a distance exceeding their maximum range on a single charge. To complete the tour, the route must include one or more charging stops at strategically located charging stations along the route.

In the HERE Tour Planning API, you can create a regular delivery/pickup job to serve as a charging stop for your EV fleet, with some recommended settings.

📘

Note

The Tour Planning API does not currently provide functionality for automatically updating distance and battery levels after charging, requiring you to recalculate the maximum distance a vehicle can cover dynamically.

Consider the following sample job configuration that represents a charging stop in a tour:

{
  "id": "Charging_job1",
  "priority": 1,
  "tasks": {
    "deliveries": [
      {
        "places": [
          {
            "times": [
              [
                "2023-07-31T13:45:00Z",
                "2023-07-31T15:45:00Z"
              ]
            ],
            "location": {
              "lat": 52.5954254748477,
              "lng": 13.324703385065265
            },
            "duration": 7200,
            "tag": "charging_1"
          },
          {
            "times": [
              [
                "2023-07-31T14:45:00Z",
                "2023-07-31T16:45:00Z"
              ]
            ],
            "location": {
              "lat": 52.471443,
              "lng": 13.38549
            },
            "duration": 7200,
            "tag": "charging_2"
          },
          {
            "times": [
              [
                "2023-07-31T15:45:00Z",
                "2023-07-31T17:45:00Z"
              ]
            ],
            "location": {
              "lat": 52.52640450644544,
              "lng": 13.407224802521869
            },
            "duration": 7200,
            "tag": "charging_3"
          }
        ],
        "demand": [
          0
        ]
      }
    ]
  }
}

The preceding job configuration contains the following key settings:

  • "priority": 1: This setting designates the job as the highest priority. When combined with the specified time window, it guarantees that the job is prioritized above others within the designated timeframe for charging.
  • "places": [...]: Contains up to three alternative locations for EV charging, in this example, designated as charging_1, charging_2, and charging_3. These locations offer flexibility in selecting charging points within the specified time window ("times": [...]), allowing the optimization algorithm to adapt to varying traffic conditions or proximity to the route or availability of a station.
  • "demand": [0]: This parameter is set to 0 to prevent wasting vehicle capacity during charging periods. Since the vehicle is inactive during charging, it does not engage in delivering or picking up goods.

The following figure shows a sample visualization of a problem solution for three single-vehicle EV fleets, consisting of 52 jobs. Mixed in-between regular jobs, there are three charging jobs (including the job from the preceding example), each assigned to a different fleet:

Charging stops implemented as high-priority jobs

As depicted in the visualization, the utilization of the aforementioned settings, including job priority, time windows, and alternative job locations, facilitates the successful completion of the tour by ensuring that all vehicles replenish their batteries as needed.

Overlap charging times with vehicle breaks

To optimize long-distance EV tours, you can plan the breaks to coincide with the vehicle's charging stops, allowing the driver to recharge the battery while taking a rest. To achieve that, in the shift configuration, add a break with a location.

For more information about the breaks option, see VehicleType.

Consider the following problem snippet that shows a sample shift configuration that includes a break at a specific location:

"shifts": [
  {
    "start": {
      "time": "2023-07-31T08:45:00Z",
      "location": {
        "lat": 52.530971,
        "lng": 13.384915
      }
    },
    "end": {
      "time": "2023-07-31T18:45:00Z",
      "location": {
        "lat": 52.530971,
        "lng": 13.384915
      }
    },
    "breaks": [
      {
        "duration": 5400,
        "times": [
          [
            "2023-07-31T11:45:00Z",
            "2023-07-31T13:15:00Z"
          ]
        ],
        "location": {
          "lat": 52.471443,
          "lng": 13.38549
        }
      }
    ]
  }
]

The "breaks" array from the preceding example contains a single break instance, with the following properties:

  • "duration": The estimated time required for vehicle charging.
  • "times": The timeframe allocated for battery charging. For example, you can allocate this timeframe based on the duration or baseDuration values from the HERE Routing API v8 or other factors, such as the time booked or reserved at the charging station.
  • "location": The location of the EV charging station, determined based on the estimated battery duration.

The following figure illustrates a sample solution for a problem that incorporates a break at a specific location, as described in the previous example.

A vehicle break that can serve as a charging stop in an EV tour

As the previous example demonstrate, by optimizing the scheduling of breaks to coincide with charging times, you maximize downtime efficiency for you EV fleets.

Next steps

  • For more information about formulating problems in the HERE Tour Planning API, see Problem.
  • For an in-depth exploration of the HERE Tour Planning API methods, endpoints, and parameters, see the API Reference.
  • For more information about routing, see HERE Routing API v8.