A heating calculator can be numerically correct and still compare the wrong things. One useful test is to separate annual useful heat demand from electricity or fuel consumption before comparing the annual bills.
This is a small example for developers building energy tools, using a dependency-free Python model. It is deliberately not a building heat-loss calculation.
Define the contract
For a given useful heat demand Q (kWh/year), electricity unit price e (£/kWh), gas price g (£/kWh), seasonal heat pump COP c, boiler efficiency b, and an independently justified zone demand fraction z:
- Direct electric cost: Q × e
- Heat pump cost at equal demand: Q / c × e
- Gas cost at equal demand: Q / b × g
- Zoned direct electric cost at reduced demand: Q × z × e
The final line is a different demand scenario, not a claim that infrared converts electricity to heat more efficiently than other resistive heaters.
Test the boundary before the UI
With 10,000 kWh useful heat and illustrative unit rates of 26.32p electricity and 7.97p gas, the expected fuel costs are £2,632, £822.50 at COP 3.2, and approximately £885.56 at boiler efficiency 0.9. A 0.78 zone fraction yields £2,052.96 for direct electric — only if reducing the useful heat demand by 22% is a defensible assumption.
Here are three properties to check when adding sliders or a new UI:
from heating_cost import compare def test_no_zoning(): result = compare(10000, 26.32, 7.97, 3.2, .9, 1) assert result["direct electric (equal demand)"] == result["zoned direct electric (reduced demand)"] def test_zero_demand(): assert all(v == 0 for v in compare(0, 26.32, 7.97, 3.2, .9, .78).values()) def test_invalid_efficiency(): try: compare(10000, 26.32, 7.97, 3.2, 1.1, .78) except ValueError: return raise AssertionError("Efficiency above 1 should be rejected") The implementation and additional unittest cases are in the open-source heating cost sensitivity repository.
Design the inputs around the decision
A domestic unit price is not a commercial tariff. Ask for prices on the same VAT basis. Keep standing charges, capital cost, servicing and distribution losses separate unless you have data for those inputs. Show the date of any example rate and allow an override. Do not infer an annual heat requirement from room area alone without assumptions about fabric, local climate and use.
For a user-facing example, our team's room heating running-cost calculator uses a degree-day illustration and separates the zoned infrared scenario from other systems. If you're building a tool for industrial buildings, the warehouse heating guide gives context for occupancy, height, loading doors and zoning; an actual installation requires a competent site survey.
The numerical example is an illustration, not a tariff quote or a guarantee of comfort or savings. Disclosure: our team maintains the linked heating project and original repository. This article was prepared with AI assistance; the arithmetic and public destination pages were checked.

