Monitor fuel consumption and CO₂ emissions
Estimating fuel consumption and CO₂ emission allows you to efficiently monitor the costs of your logistics operations as well as ensure the alignment with sustainability goals, such as reducing your carbon footprint.
You can provide energy consumption parameters for vehicles in your fleet as input in the problem request to get the total estimated fuel consumption and co2emission values for the resulting tour, integrated as part of the tour statistics in the HERE Tour Planning API solution, using the HERE Routing API v8.
Note
- To enable the CO₂ emission and fuel consumption statistics, you must get access to the HERE Routing API v8. For more information, see:
- Fuel consumption and CO₂ emission statistics serve informational purposes only with no influence on the route optimization.
- The process of obtaining these statistics includes an additional HERE Routing API v8 request, which might impact the total response time from the HERE Tour Planning API.
- If the request for
consumptionandco2Emissiondata to the HERE Routing API v8 fails, the solution returns an error message in thenoticeobject, without failing the HERE Tour Planning API request.
Understand CO₂ emission and fuel consumption calculation
To calculate the total fuel consumption and CO₂ emission for all vehicles taking part in the tour, include the fuel object in the problem request, as part of a vehicle type definition, as shown in the following sample snippet:
"fuel": {
"type": "petrol",
"freeFlowSpeedTable": "0,0,8.33,0.000120,13.89,0.000105,19.44,0.000095,22.22,0.000090,25,0.000092,30.56,0.000100,36.11,0.000115,40.28,0.000130",
"trafficSpeedTable": "0,0,8.33,0.000125,13.89,0.000110,19.44,0.000098,22.22,0.000090,25,0.000092,30.56,0.000100,36.11,0.000115,40.28,0.000130",
"additionalConsumption": 0.00001,
"ascent": 0.00001
}As the preceding example demonstrates, the fuel object contains a number of vehicle-specific energy consumption parameters, which the HERE Routing API v8 requires to calculate the total fuel consumption and CO₂ emission for the tour:
-
type: Refers to the fuel type, for example,petrol,diesel,LPG(Liquefied Petroleum Gas), and so on. -
freeFlowSpeedTable: Represents a table or dataset that with the vehicle's energy consumption at different speeds under free-flowing traffic conditions, in the following format:<SPEED_0>,<CONSUMPTION_0>,<SPEED_1>,<CONSUMPTION_1>,...,<SPEED_N>,<CONSUMPTION_N>The units vary, depending on the fuel type, as shown in the following table:
Fuel Type Unit Diesel, Petrol & LPG l/m (liters per meter) CNG kg/m (kilograms per meter) -
trafficSpeedTable: Represents the vehicle's energy consumption at different speeds under various traffic conditions, in the same format and unit system as thefreeFlowSpeedTableproperty. -
additionalConsumption: Refers to the fuel consumption (in liters per second for diesel, petrol & LPG, and kilograms per second for CNG) by the vehicle's auxiliary systems, for example, air-conditioning, lights, and so on. -
ascent: Represents the rate of fuel consumption per meter of elevation gain (in liters per meter for diesel, petrol & LPG, and kilograms per meter for CNG).
Note
- The unit systems for the energy consumption input differ between the HERE Tour Planning and HERE Routing v8 API. For more information, see:
For more information about the fuel object and the associated parameters, see the HERE Routing API v8 API Reference.
The following sections provide a practical example of the fuel consumption and CO₂ emission feature, put within the full context of the HERE Tour Planning problem and the resulting solution.
Problem
The following problem contains the fuel object together with the associated energy consumption properties, embedded as part of the vehicle type definition:
Click to expand/collapse the sample JSON
{
"fleet": {
"types": [
{
"id": "small",
"profile": "car",
"costs": {
"fixed": 20,
"distance": 0,
"time": 0.005
},
"shifts": [
{
"start": {
"time": "2023-05-28T08:00:00Z",
"location": {
"lat": 52.50935,
"lng": 13.41997
}
},
"end": {
"time": "2023-05-28T16:00:00Z",
"location": {
"lat": 52.50935,
"lng": 13.41997
}
}
}
],
"fuel": {
"type": "diesel",
"freeFlowSpeedTable": "0,0,8.33,0.000120,13.89,0.000105,19.44,0.000095,22.22,0.000090,25,0.000092,30.56,0.000100,36.11,0.000115,40.28,0.000130",
"trafficSpeedTable": "0,0,8.33,0.000125,13.89,0.000110,19.44,0.000098,22.22,0.000090,25,0.000092,30.56,0.000100,36.11,0.000115,40.28,0.000130",
"additionalConsumption": 0.00001,
"ascent": 0.00001
},
"capacity": [
100
],
"amount": 10
}
],
"profiles": [
{
"type": "car",
"name": "car"
}
]
},
"plan": {
"jobs": [
{
"id": "Job_1",
"tasks": {
"pickups": [
{
"places": [
{
"location": {
"lat": 52.56182,
"lng": 13.497167
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_2",
"tasks": {
"pickups": [
{
"places": [
{
"location": {
"lat": 52.534553,
"lng": 13.519429
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_3",
"tasks": {
"pickups": [
{
"places": [
{
"location": {
"lat": 52.482275,
"lng": 13.502456
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_4",
"tasks": {
"pickups": [
{
"places": [
{
"location": {
"lat": 52.473537,
"lng": 13.505414
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_5",
"tasks": {
"pickups": [
{
"places": [
{
"location": {
"lat": 52.463341,
"lng": 13.49061
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_6",
"tasks": {
"pickups": [
{
"places": [
{
"location": {
"lat": 52.434003,
"lng": 13.466142
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_7",
"tasks": {
"pickups": [
{
"places": [
{
"location": {
"lat": 52.447476,
"lng": 13.433062
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_8",
"tasks": {
"pickups": [
{
"places": [
{
"location": {
"lat": 52.458414,
"lng": 13.392079
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_9",
"tasks": {
"pickups": [
{
"places": [
{
"location": {
"lat": 52.446407,
"lng": 13.36047
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_10",
"tasks": {
"pickups": [
{
"places": [
{
"location": {
"lat": 52.440807,
"lng": 13.351399
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_11",
"tasks": {
"pickups": [
{
"places": [
{
"location": {
"lat": 52.441913,
"lng": 13.339028
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_12",
"tasks": {
"pickups": [
{
"places": [
{
"location": {
"lat": 52.458232,
"lng": 13.338698
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
},
{
"id": "Job_13",
"tasks": {
"pickups": [
{
"places": [
{
"location": {
"lat": 52.457629,
"lng": 13.323742
},
"duration": 600
}
],
"demand": [
1
]
}
]
}
}
]
}
}Solution
In the solution to the previous problem, the statistic object now includes the consumption and co2Emission properties, as shown in the following snippet:
{
"statistic": {
"cost": 91.205,
"distance": 60325,
"duration": 14241,
"times": {
"driving": 6441,
"serving": 7800,
"waiting": 0,
"stopping": 0,
"break": 0
},
"consumption": 6.3893,
"co2Emission": 17.232999999999997
}
}where:
-
consumption: Refers to the estimated net fuel consumption. The unit type varies by fuel type: for diesel, petrol, and LPG (liquefied petroleum gas) vehicles, it is measured in liters, while for CNG (compressed natural gas) vehicles, it is measured in kilograms.In the sample problem, the fuel type was specified as
diesel, which means that the resulting consumption is6.3893liters. -
co2Emission: Represents the estimated CO₂ emission for the tour, in kilograms.Based on the energy consumption statistics from the sample problem, the calculated total CO₂ emission for the tour is about
17.233kilograms.
The following JSON file contains the full solution JSON:
Click to expand/collapse the sample JSON
{
"statistic": {
"cost": 91.205,
"distance": 60325,
"duration": 14241,
"times": {
"driving": 6441,
"serving": 7800,
"waiting": 0,
"stopping": 0,
"break": 0
},
"consumption": 6.3893,
"co2Emission": 17.232999999999997
},
"tours": [
{
"vehicleId": "small_10",
"typeId": "small",
"stops": [
{
"time": {
"arrival": "2023-05-28T08:00:00Z",
"departure": "2023-05-28T08:00:00Z"
},
"load": [
0
],
"activities": [
{
"jobId": "departure",
"type": "departure",
"location": {
"lat": 52.50935,
"lng": 13.41997
},
"time": {
"start": "2023-05-28T08:00:00Z",
"end": "2023-05-28T08:00:00Z"
}
}
],
"location": {
"lat": 52.50935,
"lng": 13.41997
},
"distance": 0
},
{
"time": {
"arrival": "2023-05-28T08:19:39Z",
"departure": "2023-05-28T08:29:39Z"
},
"load": [
1
],
"activities": [
{
"jobId": "Job_1",
"type": "pickup",
"location": {
"lat": 52.56182,
"lng": 13.497167
},
"time": {
"start": "2023-05-28T08:19:39Z",
"end": "2023-05-28T08:29:39Z"
}
}
],
"location": {
"lat": 52.56182,
"lng": 13.497167
},
"distance": 9971
},
{
"time": {
"arrival": "2023-05-28T08:36:16Z",
"departure": "2023-05-28T08:46:16Z"
},
"load": [
2
],
"activities": [
{
"jobId": "Job_2",
"type": "pickup",
"location": {
"lat": 52.534553,
"lng": 13.519429
},
"time": {
"start": "2023-05-28T08:36:16Z",
"end": "2023-05-28T08:46:16Z"
}
}
],
"location": {
"lat": 52.534553,
"lng": 13.519429
},
"distance": 13720
},
{
"time": {
"arrival": "2023-05-28T09:00:18Z",
"departure": "2023-05-28T09:10:18Z"
},
"load": [
3
],
"activities": [
{
"jobId": "Job_3",
"type": "pickup",
"location": {
"lat": 52.482275,
"lng": 13.502456
},
"time": {
"start": "2023-05-28T09:00:18Z",
"end": "2023-05-28T09:10:18Z"
}
}
],
"location": {
"lat": 52.482275,
"lng": 13.502456
},
"distance": 22499
},
{
"time": {
"arrival": "2023-05-28T09:12:08Z",
"departure": "2023-05-28T09:22:08Z"
},
"load": [
4
],
"activities": [
{
"jobId": "Job_4",
"type": "pickup",
"location": {
"lat": 52.473537,
"lng": 13.505414
},
"time": {
"start": "2023-05-28T09:12:08Z",
"end": "2023-05-28T09:22:08Z"
}
}
],
"location": {
"lat": 52.473537,
"lng": 13.505414
},
"distance": 23785
},
{
"time": {
"arrival": "2023-05-28T09:28:08Z",
"departure": "2023-05-28T09:38:08Z"
},
"load": [
5
],
"activities": [
{
"jobId": "Job_5",
"type": "pickup",
"location": {
"lat": 52.463341,
"lng": 13.49061
},
"time": {
"start": "2023-05-28T09:28:08Z",
"end": "2023-05-28T09:38:08Z"
}
}
],
"location": {
"lat": 52.463341,
"lng": 13.49061
},
"distance": 26726
},
{
"time": {
"arrival": "2023-05-28T09:47:07Z",
"departure": "2023-05-28T09:57:07Z"
},
"load": [
6
],
"activities": [
{
"jobId": "Job_6",
"type": "pickup",
"location": {
"lat": 52.434003,
"lng": 13.466142
},
"time": {
"start": "2023-05-28T09:47:07Z",
"end": "2023-05-28T09:57:07Z"
}
}
],
"location": {
"lat": 52.434003,
"lng": 13.466142
},
"distance": 32033
},
{
"time": {
"arrival": "2023-05-28T10:02:57Z",
"departure": "2023-05-28T10:12:57Z"
},
"load": [
7
],
"activities": [
{
"jobId": "Job_7",
"type": "pickup",
"location": {
"lat": 52.447476,
"lng": 13.433062
},
"time": {
"start": "2023-05-28T10:02:57Z",
"end": "2023-05-28T10:12:57Z"
}
}
],
"location": {
"lat": 52.447476,
"lng": 13.433062
},
"distance": 35562
},
{
"time": {
"arrival": "2023-05-28T10:19:30Z",
"departure": "2023-05-28T10:29:30Z"
},
"load": [
8
],
"activities": [
{
"jobId": "Job_8",
"type": "pickup",
"location": {
"lat": 52.458414,
"lng": 13.392079
},
"time": {
"start": "2023-05-28T10:19:30Z",
"end": "2023-05-28T10:29:30Z"
}
}
],
"location": {
"lat": 52.458414,
"lng": 13.392079
},
"distance": 39586
},
{
"time": {
"arrival": "2023-05-28T10:34:45Z",
"departure": "2023-05-28T10:44:45Z"
},
"load": [
9
],
"activities": [
{
"jobId": "Job_9",
"type": "pickup",
"location": {
"lat": 52.446407,
"lng": 13.36047
},
"time": {
"start": "2023-05-28T10:34:45Z",
"end": "2023-05-28T10:44:45Z"
}
}
],
"location": {
"lat": 52.446407,
"lng": 13.36047
},
"distance": 42400
},
{
"time": {
"arrival": "2023-05-28T10:48:15Z",
"departure": "2023-05-28T10:58:15Z"
},
"load": [
10
],
"activities": [
{
"jobId": "Job_10",
"type": "pickup",
"location": {
"lat": 52.440807,
"lng": 13.351399
},
"time": {
"start": "2023-05-28T10:48:15Z",
"end": "2023-05-28T10:58:15Z"
}
}
],
"location": {
"lat": 52.440807,
"lng": 13.351399
},
"distance": 43984
},
{
"time": {
"arrival": "2023-05-28T11:01:36Z",
"departure": "2023-05-28T11:11:36Z"
},
"load": [
11
],
"activities": [
{
"jobId": "Job_11",
"type": "pickup",
"location": {
"lat": 52.441913,
"lng": 13.339028
},
"time": {
"start": "2023-05-28T11:01:36Z",
"end": "2023-05-28T11:11:36Z"
}
}
],
"location": {
"lat": 52.441913,
"lng": 13.339028
},
"distance": 45583
},
{
"time": {
"arrival": "2023-05-28T11:17:26Z",
"departure": "2023-05-28T11:27:26Z"
},
"load": [
12
],
"activities": [
{
"jobId": "Job_13",
"type": "pickup",
"location": {
"lat": 52.457629,
"lng": 13.323742
},
"time": {
"start": "2023-05-28T11:17:26Z",
"end": "2023-05-28T11:27:26Z"
}
}
],
"location": {
"lat": 52.457629,
"lng": 13.323742
},
"distance": 48283
},
{
"time": {
"arrival": "2023-05-28T11:29:59Z",
"departure": "2023-05-28T11:39:59Z"
},
"load": [
13
],
"activities": [
{
"jobId": "Job_12",
"type": "pickup",
"location": {
"lat": 52.458232,
"lng": 13.338698
},
"time": {
"start": "2023-05-28T11:29:59Z",
"end": "2023-05-28T11:39:59Z"
}
}
],
"location": {
"lat": 52.458232,
"lng": 13.338698
},
"distance": 49435
},
{
"time": {
"arrival": "2023-05-28T11:57:21Z",
"departure": "2023-05-28T11:57:21Z"
},
"load": [
0
],
"activities": [
{
"jobId": "arrival",
"type": "arrival",
"location": {
"lat": 52.50935,
"lng": 13.41997
},
"time": {
"start": "2023-05-28T11:57:21Z",
"end": "2023-05-28T11:57:21Z"
}
}
],
"location": {
"lat": 52.50935,
"lng": 13.41997
},
"distance": 60325
}
],
"statistic": {
"cost": 91.205,
"distance": 60325,
"duration": 14241,
"times": {
"driving": 6441,
"serving": 7800,
"waiting": 0,
"stopping": 0,
"break": 0
},
"consumption": 6.3893,
"co2Emission": 17.232999999999997
},
"shiftIndex": 0
}
]
}Conclusions
This tutorial showed how to include your fleet's energy consumption data in API requests. By doing so, you'll gain valuable insights into total fuel consumption and CO₂ emission for more cost-effective and environmentally conscious logistics operations.
Next steps
- For an in-depth exploration of the HERE Tour Planning API methods, endpoints, and parameters, see the API Reference.
- For more information about the HERE Routing API v8, see:
Updated 29 days ago