Consumption Model
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 Online Routing API parameters for two vehicle types: combustion or electric and the output will contain the additional field fuelConsumptionInLiters or batteryConsumptionInkWh. For more details, please refer to: Consumtion models documentation.
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:
_query = [[[[[[[[[[[[[[TTRouteQueryBuilder createWithDest:COORDINATE_UTRECHT andOrig:COORDINATE_AMSTERDAM]
withMaxAlternatives:2]
withVehicleWeight:1600] //vehicle weight in kilograms
withCurrentFuelInLiters:50.0]
withCurrentAuxiliaryPowerInLitersPerHour:0.2]
withFuelEnergyDensityInMJoulesPerLiter:34.2]
withAccelerationEfficiency:0.33] //e.g. KineticEnergyGained/ChemicalEnergyConsumed
withDecelerationEfficiency:0.33] //e.g. ChemicalEnergySaved/KineticEnergyLost
withUphillEfficiency:0.33] //e.g. PotentialEnergyGained/ChemicalEnergyConsumed
withDownhillEfficiency:0.33] //e.g. ChemicalEnergySaved/PotentialEnergyLost
withVehicleEngineType:TTOptionVehicleEngineTypeCombustion]
withSpeedConsumptionInLitersPairs:speedConsumptionInLiters count:7]withTraffic:NO] build];
To request a route and calculate the consumption model for an electric vehicle:
_query = [[[[[[[[[[[[[[TTRouteQueryBuilder createWithDest:COORDINATE_UTRECHT andOrig:COORDINATE_AMSTERDAM]
withMaxAlternatives:2]
withVehicleWeight:1600] //vehicle weight in kilograms
withCurrentChargeInkWh:43]
withMaxChargeInkWh:85]
withAuxiliaryPowerInkW:1.7]
withAccelerationEfficiency:0.33] //e.g. KineticEnergyGained/ChemicalEnergyConsumed
withDecelerationEfficiency:0.33] //e.g. ChemicalEnergySaved/KineticEnergyLost
withUphillEfficiency:0.33] //e.g. PotentialEnergyGained/ChemicalEnergyConsumed
withDownhillEfficiency:0.33] //e.g. ChemicalEnergySaved/PotentialEnergyLost
withVehicleEngineType:(TTOptionVehicleEngineTypeElectric)]
withSpeedConsumptionInkWhPairs:speedConsumptionInkWh count:6]withTraffic:NO] build];
![]() Combustion |
![]() Electric |