THIS SDK ISDEPRECATED.

We rolled out a new and better SDK for you.

Consumption Model

Allow your user to utilise the vehicle-specific consumption model when requesting a new route. The consumption model can be calculated based on a number of Routing API parameters for two vehicle types: combustion or electric. The output will contain the additional field fuelConsumptionInLiters or batteryConsumptionInkWh.

Sample use case: You are planning a journey and you want to select the most optimal route in terms of fuel/energy consumption.

To request a route and calculate the consumption model for a combustion vehicle:

1style = ETAView.ETAViewStyle.consumptionLiters
2var speedConsumptionInLiters: [TTSpeedConsumption] = [TTSpeedConsumptionMake(10, 6.5),
3 TTSpeedConsumptionMake(30, 7.0),
4 TTSpeedConsumptionMake(50, 8.0),
5 TTSpeedConsumptionMake(70, 8.4),
6 TTSpeedConsumptionMake(90, 7.7),
7 TTSpeedConsumptionMake(120, 7.5),
8 TTSpeedConsumptionMake(150, 9.0)]
9let query = TTRouteQueryBuilder.create(withDest: TTCoordinate.UTRECHT(), andOrig: TTCoordinate.AMSTERDAM())
10 .withMaxAlternatives(2)
11 .withVehicleWeight(1600)
12 .withCurrentFuel(inLiters: 50.0)
13 .withCurrentAuxiliaryPower(inLitersPerHour: 0.2)
14 .withFuelEnergyDensity(inMJoulesPerLiter: 34.2)
15 .withAccelerationEfficiency(0.33)
16 .withDecelerationEfficiency(0.33)
17 .withUphillEfficiency(0.33)
18 .withDownhillEfficiency(0.33)
19 .withVehicleEngineType(.combustion)
20 .withSpeedConsumption(inLitersPairs: &speedConsumptionInLiters, count: UInt(speedConsumptionInLiters.count))
21 .build()
22routePlanner.plan(with: query)
1self.style = ETAViewStyleConsumptionLiters
2TTSpeedConsumption speedConsumptionInLiters[7];
3speedConsumptionInLiters[0] = TTSpeedConsumptionMake(10, 6.5);
4speedConsumptionInLiters[1] = TTSpeedConsumptionMake(30, 7.0);
5speedConsumptionInLiters[2] = TTSpeedConsumptionMake(50, 8.0);
6speedConsumptionInLiters[3] = TTSpeedConsumptionMake(70, 8.4);
7speedConsumptionInLiters[4] = TTSpeedConsumptionMake(90, 7.7);
8speedConsumptionInLiters[5] = TTSpeedConsumptionMake(120, 7.5);
9speedConsumptionInLiters[6] = TTSpeedConsumptionMake(150, 9.0);
10TTRouteQuery *query = [[[[[[[[[[[[[TTRouteQueryBuilder createWithDest:[TTCoordinate UTRECHT] andOrig:[TTCoordinate AMSTERDAM]] withMaxAlternatives:2] withVehicleWeight:1600] withCurrentFuelInLiters:50.0] withCurrentAuxiliaryPowerInLitersPerHour:0.2] withFuelEnergyDensityInMJoulesPerLiter:34.2]
11 withAccelerationEfficiency:0.33] withDecelerationEfficiency:0.33] withUphillEfficiency:0.33] withDownhillEfficiency:0.33] withVehicleEngineType:TTOptionVehicleEngineTypeCombustion] withSpeedConsumptionInLitersPairs:speedConsumptionInLiters count:7] build];
12[self.routePlanner planRouteWithQuery:query];

To request a route and calculate the consumption model for an electric vehicle:

1style = ETAView.ETAViewStyle.consumptionKWh
2var speedConsumptionInkWh: [TTSpeedConsumption] = [TTSpeedConsumptionMake(10, 5.0),
3 TTSpeedConsumptionMake(30, 10.0),
4 TTSpeedConsumptionMake(50, 15.0),
5 TTSpeedConsumptionMake(70, 20.0),
6 TTSpeedConsumptionMake(90, 25.0),
7 TTSpeedConsumptionMake(120, 30.0)]
8let query = TTRouteQueryBuilder.create(withDest: TTCoordinate.UTRECHT(), andOrig: TTCoordinate.AMSTERDAM())
9 .withMaxAlternatives(2)
10 .withVehicleWeight(1600)
11 .withCurrentChargeInkWh(43)
12 .withMaxChargeInkWh(85)
13 .withAuxiliaryPowerInkW(1.7)
14 .withAccelerationEfficiency(0.33)
15 .withDecelerationEfficiency(0.33)
16 .withUphillEfficiency(0.33)
17 .withDownhillEfficiency(0.33)
18 .withVehicleEngineType(.electric)
19 .withSpeedConsumptionInkWhPairs(&speedConsumptionInkWh, count: UInt(speedConsumptionInkWh.count))
20 .build()
21routePlanner.plan(with: query)
1self.style = ETAViewStyleConsumptionKWh;
2TTSpeedConsumption speedConsumptionInkWh[6];
3speedConsumptionInkWh[0] = TTSpeedConsumptionMake(10, 5.0);
4speedConsumptionInkWh[1] = TTSpeedConsumptionMake(30, 10.0);
5speedConsumptionInkWh[2] = TTSpeedConsumptionMake(50, 15.0);
6speedConsumptionInkWh[3] = TTSpeedConsumptionMake(70, 20.0);
7speedConsumptionInkWh[4] = TTSpeedConsumptionMake(90, 25.0);
8speedConsumptionInkWh[5] = TTSpeedConsumptionMake(120, 30.0);
9TTRouteQuery *query = [[[[[[[[[[[[[TTRouteQueryBuilder createWithDest:[TTCoordinate UTRECHT] andOrig:[TTCoordinate AMSTERDAM]] withMaxAlternatives:2] withVehicleWeight:1600] withCurrentChargeInkWh:43] withMaxChargeInkWh:85] withAuxiliaryPowerInkW:1.7] withAccelerationEfficiency:0.33]
10 withDecelerationEfficiency:0.33] withUphillEfficiency:0.33] withDownhillEfficiency:0.33] withVehicleEngineType:(TTOptionVehicleEngineTypeElectric)] withSpeedConsumptionInkWhPairs:speedConsumptionInkWh count:6] build];
11[self.routePlanner planRouteWithQuery:query];

image

Combustion

image

Electric