This is the total fuel cost saved by running an EV. This is calculated by taking the total amount of fuel that would have been consumed, assuming 50mpg, and mutlipying it by £1.30 per litre to calculate fuel cost. We then subtract the total cost of the electricity used to arrive at the difference between the two.
$fuelUsed = ($totalMiles / 50) * 4.54609; // Fuel used, in Litres, assuming 50mpg
$fuelCost = $fuelUsed * 1.30; // Total fuel cost is the Litres of fuel used multiplied by 1.30 per Litre.
$fuelSaving = $fuelCost - ($totalBattery * 0.12); // The saving is the total fuel cost minus the cost of the electricity used.