Calculate costs of ICE and electric pence per mile
Methods
(inner) applyRatio(cost_ppm, ratio_value) → {number}
for user supplied mpg or electric range we want to apply a ratio to the official figures
Parameters:
Name | Type | Description |
---|---|---|
cost_ppm |
number | |
ratio_value |
number |
Returns:
- Type
- number
(inner) checkRequiredKeys() → {struct}
Returns:
- Type
- struct
(inner) costForFullCharge(battery_total_capacity_kwh, elec_pp_kwh) → {number}
calculate how much for a full charge of electric based on battery capacity and cost per kwh. The amount of electricity supplied by the chargepoint is calculated from WLTP efficiency and is equivalent to usable capacity plus losses. On some cars this figure happens to be close to Total capacity so we use that as a proxy.
Parameters:
Name | Type | Description |
---|---|---|
battery_total_capacity_kwh |
number | |
elec_pp_kwh |
number |
Returns:
- Type
- number
(inner) costForFullChargePPM(cost_for_full_charge, battey_range_miles) → {number}
amount ppm for a full battery charge
Parameters:
Name | Type | Description |
---|---|---|
cost_for_full_charge |
number | |
battey_range_miles |
number |
Returns:
- Type
- number
(inner) costForICEPPM(fuel_pp_litre, litres_per_mile) → {number}
amount ppm for ICE based on per litre used
Parameters:
Name | Type | Description |
---|---|---|
fuel_pp_litre |
number | |
litres_per_mile |
number |
Returns:
- Type
- number
(inner) litresUsedPerMile(mpg, miles) → {number}
litres of ICE fuel used per mile
Parameters:
Name | Type | Description |
---|---|---|
mpg |
number | |
miles |
number |
Returns:
- Type
- number
(inner) ratio(user_value, official_value) → {number}
where providing mpg and electric user provided values we want to have a ratio vs the official figures to calculate the cost per mile
Parameters:
Name | Type | Description |
---|---|---|
user_value |
number | user provided mpg or electric range |
official_value |
number | official mpg or electric range |
Returns:
ratio
- Type
- number