# EV routing

The EV routing features of the API extend the routing service with electric vehicle specific options. Routing responses can contain details of energy consumption of the vehicle on the route. Route calculations can also add charging stations to the route, to ensure that destination can be reached without running out of energy, while still optimizing the result for overall travel time.

For code samples, see these tutorials:

## Consumption model

The Routing API allows you to specify vehicle specific parameters, which are then used to calculate energy consumption for the vehicle on a given route.

Unless specified otherwise, the energy is assumed to be in Wh.

### Consumption calculation formula

In this model, consumption ($$C$$) along the segment depends on the length, speed and elevation difference.

$C = P_{asc} \cdot \Delta h_+ + P_{desc} \cdot \Delta h_- + P_{speed} \cdot L + P_{aux} \cdot t$

#### Request and Model Parameters

The following request parameters define the consumption model for consumption calculation:

Request Parameter Model Parameter Description
ascent $$P_{asc}$$ Energy consumed per meter rise in elevation.
descent $$P_{desc}$$ Energy recovered per meter fall in elevation.
freeFlowSpeedTable $$P_{speed}$$ Function curve specifying consumption rate at a given free flow speed on a flat stretch of road. See Consumption speed table for details.
trafficSpeedTable $$P_{speed}$$ Function curve specifying consumption rate at a given speed under traffic conditions on a flat stretch of road. See Consumption speed table for details.
auxiliaryConsumption $$P_{aux}$$ Energy consumed by the vehicle's auxiliary systems (e.g., air conditioning, lights) per second of travel.

#### Map Parameters

The following parameters are taken from the map data to support the consumption calculation:

Parameter Description
$$L$$ Length of the segment in meters.
$$\Delta h_+$$ Elevation difference between the end and the start of the segment in meters if positive, otherwise zero.
$$\Delta h_-$$ Elevation difference between the end and the start of the segment in meters if negative, otherwise zero.
$$t$$ Travel time along the segment in seconds.

### Consumption speed table

Consumption speed tables define the energy consumption rate when the vehicle travels on a straight road without elevation change at a given speed in km/h.

A table represents a piecewise linear function.Consumption speed tables define the energy consumption rate when the vehicle travels on a straight road without elevation change at a given speed in km/h.

A table represents a piecewise linear function. The following is a function with the corresponding request option:

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

#### Consumption speed function

The API allows two different consumption speed tables to be provided: freeFlowSpeedTable and trafficSpeedTable.

• freeFlowSpeedTable describes energy consumption when travelling at constant speed.

• trafficSpeedTable describes energy consumption when travelling under heavy traffic conditions, i.e. when the vehicle is expected to often change the travel speed, at a given average speed.

If trafficSpeedTable is not provided then only freeFlowSpeedTable is used for calculating speed-related energy consumption. Otherwise, the following formula is applied:

$P_{speed} = S_T(v_t) + \frac{v_t}{v_f} \times (S_F(v_t) - S_T(v_t)),$

where

• $$v_f$$ is the free flow speed of a given road, defined as the estimated speed of travel without considering any traffic-related constraints,
• $$v_t$$ is the average traffic speed of a given road, that uses available traffic information to estimate the speed of travel,
• $$S_T$$ and $$S_F$$ are the traffic and free flow speed tables, respectively.

For example, if traffic speed is equal to the free flow speed then only the freeFlowSpeedTable will be used for determining the energy consumption, and the lower the traffic speed is compared to free flow speed, the bigger effect the trafficSpeedTable will have.

To obtain energy consumption of the electric vehicle, add details of a consumption model to the request. All request parameters related to EV vehicles start with prefix ev.

For sample requests, see these sections: