On this page we are looking at how the Energy Cost Metric is calculated in the publically available EPC Wrapper python reference code here:
Please be aware that the code we are looking at here (November 2026) should not be treated as a definitive representation of the final HEM/HEMIE methodology. This publicly available version is incomplete, remains under development and is subject to change. It should not be relied upon in any way.
The repository's README file makes this clear, stating:
“The EPC wrapper is currently in development and should not be used for any official purpose.”
The comments on this site are of the code at the time of anaylsis.
The comments on this site may be wrong.
Please use your own due diligence and look at the code yourself to confirm anything important.
The description in the Python code is:
Total cost of all metered sources of energy consumed in the dwelling.
The metric is expressed in: £/year
The calculation uses the energy consumption predicted by the main HEM simulation, applying standardised energy tariffs and standing charges to the results.
Importantly, it isn't attempting to predict what the current occupants will actually pay. It uses modelled energy consumption and prescribed prices to provide a consistent comparison between properties.
The Government's proposed approach is also to present this metric as an estimated annual bill in pounds, rather than an A–G rating.
The calculation is essentially:
Energy Cost = Cost of imported energy - Value of exported energy
+ Standing Charges
The wrapper calculates the cost of imported energy by applying a tariff to the energy imported at each timestep.
The underlying function is: _calculate_tariff_cost_in_pounds()
Its calculation is:
The division by 100 converts the tariff from pence into pounds.
This is performed separately for the relevant energy supplies, with standing charges added afterwards.
The result is an annual cost.
The calculation uses the energy import and export data returned by HEM.
This is particularly important because it isn't simply adding up the energy consumed by the heating system.
It includes metered energy used for the various purposes within the dwelling, including:
There is an important distinction here between energy consumption and energy supplied.
For example, a heat pump consumes electricity, but also extracts heat from the external environment. The cost calculation accounts for the electricity imported to operate the heat pump, not the additional heat extracted from the environment.
Similarly, gas consumption is costed according to the amount of gas imported.
The metric therefore represents the estimated cost of the metered energy supplies rather than the total useful energy delivered to the property.
This is where things get particularly interesting.
The wrapper contains a file called:
metric_tariff_data.csv
This contains 17,520 rows, corresponding to the half-hourly timesteps in a year.
There are four tariff columns:
| Tariff | Description |
|---|---|
| Standard Tariff | Standard electricity tariff |
| 7-Hour Off Peak Tariff | Economy 7-style tariff |
| 10-Hour Off Peak Tariff | Longer off-peak tariff |
| Variable Time of Day Tariff | Time-varying electricity tariff |
The CSV contains a different rate for each half-hourly timestep for the variable tariff.
For example, the first few entries are:
| Timestep | Standard | 7-hour off peak | Variable |
|---|---|---|---|
| 0 | 25.16p | 14.60p | 10.87p |
| 1 | 25.16p | 14.60p | 9.73p |
| 2 | 25.16p | 14.60p | 14.52p |
| 3 | 25.16p | 14.60p | 9.34p |
These figures are illustrative of the data in the repository, not necessarily current consumer tariffs.
An important observation: although the CSV contains four tariff profiles, the Energy Cost calculation currently uses only two of them:
The 10-hour and Variable Time of Day tariffs are not selected by the energy_cost() function.
They are relevant to other functionality in the wrapper, particularly the Smart Readiness calculations.
In metrics.py, the relevant code is:
export_amount = _calculate_energy_supply_cost( supply_names=_get_supply_names_by_fuel( project, core_enums.FuelType.ELECTRICITY ), energy_flow=output_core.energy_export, tariff=tariffs["Standard Tariff"],)Notice that it explicitly selects:
tariffs["Standard Tariff"]
It doesn't select an export-specific tariff or a SEG rate.
Therefore, exported electricity is currently valued at 25.16p/kWh in the Energy Cost calculation.
For comparison, this is considerably more than the 5–15p/kWh export rates commonly associated with SEG arrangements, although actual SEG rates vary between suppliers and tariffs.
Remember that the wrapper applies the 7-hour off-peak tariff to electricity supplies serving storage heaters or heat batteries.
However, when calculating exported electricity, it uses the Standard Tariff for all electricity supplies.
Consequently, a property with storage heaters could have:
However, The code explicitly states that the tariffs and standing charges currently used are temporary placeholders that need replacing.
So we shouldn't assume that 25.16p/kWh will be the final export valuation.
This is one of the more interesting aspects.
The code contains a function called:
_get_electricity_supplies_with_hb_or_esh()
It identifies electricity supplies that have either:
If an electricity supply has one of these systems assigned to it, the wrapper applies the 7-Hour Off Peak Tariff.
Otherwise, it applies the Standard Tariff.
This is worth explaining because the treatment is slightly more sophisticated than simply assigning Economy 7 to every property with an electric heating system.
For example:
| Heating arrangement | Electricity tariff |
|---|---|
| Direct electric panel heaters | Standard |
| Electric storage heaters | 7-hour off peak |
| Heat pump | Standard |
| Heat battery | 7-hour off peak |
| Gas boiler with standard electricity supply | Standard |
There is an additional detail concerning multiple electricity supplies.
The tariff is assigned to each individual electricity supply, rather than simply applying one tariff to the entire property.
For example, a property could have a standard electricity supply and a separate supply serving storage heaters. The wrapper can apply different tariffs to each.
However, it applies the tariff to the entire energy flow associated with that supply, not just the electricity consumed by the storage heaters themselves.
The wrapper also includes standing charges.
These are currently defined in metrics.py.
The values are:
| Tariff | Annual standing charge |
|---|---|
| Standard | £81 |
| 7-hour off peak | £88 |
| Fuel | Annual standing charge |
|---|---|
| Mains gas | £92 |
| Bulk LPG | £62 |
| Bottled LPG | £0 |
| LPG condition 11F | £92 |
| Custom fuel | £92 |
There is an important qualification here.
The code actually contains a comment stating:
The standing charges and tariffs used for this metric are currently stubs and need replacing.
It also refers to SAP 10.2 Table 12 and the 7-hour tariff.
So these should not be treated as confirmed final tariff values.
There is also a difference in how standing charges are applied:
This is another particularly interesting aspect.
The Energy Cost metric takes account of electricity exported to the grid.
The wrapper calculates the value of exported electricity using the Standard Tariff column.
The relevant code is:
export_amount = _calculate_energy_supply_cost( supply_names=_get_supply_names_by_fuel( project, core_enums.FuelType.ELECTRICITY ), energy_flow=output_core.energy_export, tariff=tariffs["Standard Tariff"],)The resulting export amount is added to the overall calculation.
There is a subtle but important point here: HEM represents electricity exports using negative energy flows. Consequently, adding the export cost calculation actually reduces the total bill.
In practical terms:
This means solar PV can have two effects on the Energy Cost metric.
First, it reduces the electricity that needs to be imported.
Second, any surplus electricity exported to the grid reduces the calculated annual cost further.
The wrapper doesn't appear to use a separate Smart Export Guarantee tariff for this calculation.
This is probably the most interesting discovery in the Energy Cost implementation.
The wrapper deliberately removes electric vehicle batteries before calculating the Energy Cost metric.
The relevant function is:
run_energy_cost_variant()
If the property has an EV battery, the wrapper creates a copy of the original assessment input, removes the EV battery and runs HEM again.
Why does it do this?
The code comments explain that the intention is to calculate the Energy Cost metric without EV charging energy, following Technical Note EPC-TN-009.
There is also an interesting explanation of why they do this by running HEM again rather than simply subtracting the electricity consumed by the vehicle from the original results.
The problem is that energy can move around the system in ways that make it difficult to attribute consumption directly to the EV.
For example:
Simply subtracting the EV charging consumption from the original results could therefore produce an inaccurate representation of the energy flows.
Instead, the wrapper removes the EV battery and runs the simulation again.
This allows HEM to recalculate the energy imports and exports without the EV.
The important consequence is that the Energy Cost metric does not include the cost of charging an electric vehicle.
This is quite a significant distinction for properties with EV charging facilities.
It also means that the EV can influence the Smart Readiness Metric without its charging consumption increasing the Energy Cost metric.
There is an important distinction between EV batteries and stationary domestic batteries.
The Energy Cost calculation does not remove ordinary domestic battery storage.
Consequently, domestic batteries remain part of the simulation.
This means their effects on electricity imports and exports are reflected in the calculated energy cost.
For example, a property with solar PV and battery storage might:
The Energy Cost metric should reflect those reduced imports.
This is different from the FEES calculation, where domestic battery storage is removed as part of the standardisation process.
It's also different from the EV treatment, where the wrapper specifically runs another simulation without the vehicle battery.
This is worth distinguishing because both metrics involve energy costs.
The Energy Cost metric calculates the estimated annual cost of the dwelling's energy consumption.
The Smart Readiness Metric, on the other hand, compares different simulation scenarios to establish how effectively the property can make use of energy flexibility.
The wrapper calculates three separate energy costs for the Smart Readiness Metric:
These are used to calculate the Smart Readiness score.
The Smart Metric has its own tariff configuration, and the calculations use different tariff assumptions from the main Energy Cost calculation.
This is why you see the additional tariff columns in metric_tariff_data.csv.
It is important not to confuse the two calculations.
The Energy Cost calculation uses the tariff data in metric_tariff_data.csv, but the code comments refer to Technical Note EPC-TN-009.
It would be interesting to establish precisely how the Government intends the standardised tariffs to be determined, particularly:
The published Government methodology describes the intended Energy Cost metric as an estimated annual energy bill based on prices at the time the EPC is generated.
However, the public development code is not sufficient to establish that all the current tariff assumptions will survive into the final implementation.
|
|
|