# Heatloss Calculation

## An Eccentric Anomaly: Ed Davies's Blog

My house designer is, understandably, a bit concerned about how he'll put the rather unconventional heating arrangements for my house into the SAP software. The other day we were discussing the emitters (radiators) involved and talked briefly about the size that would be required if we were to ignore the heat leakage from the thermal store which should in practice supply a lot of the background heat needed.

To get a grip on this myself I decided to update my heat loss calculations to the slightly evolved design of the house and to allow for the regulatory requirement that the emitters should be sufficient to keep one apartment at 21 °C and the rest of the dwelling at 18 °C.

For this I think it's conservative to assume that the two end bedrooms and the hall to the north of the small guest bedroom, by the front door, are at 18 °C and the bathroom, kitchen, living room and study are at 21 °C - that's pretty much how I'd like the house to be, anyway.

A normal person would probably create a spreadsheet for this but I think they're horrible things with far too much hidden information making them difficult to read and audit. They're used for vastly too many and too complicated applications by people who only have one hammer.

A sophisticated person would probably use IPython or something like that. I'm not that sophisticated, yet - I have it installed but haven't got to use it much. Maybe I need to get the book or something.

Anyway, what I did (which is the point of this post) is something in between: to write a simple Python script to do the calculation. Mostly, I hope, it's pretty self-explanatory (certainly more so than an equivalent spreadsheet would be) with the only real complication being the last few lines which print out the results.

It has the same sort of mix of data and calculation that a spreadsheet would have but at least keeps the output separate. Whether that's a plus or minus is an open question.

Something which might startle a neophyte programmer who's learned Python by the book is the use of classes as simple containers for variables without any intention of ever instantiating them. Here they're just used as wrappers to allow variables to be named and accessed uniformly: `FrontDoor.area` and `MainWindow.area` rather than something like `frontDoorArea` and also accessed together with expressions like `sum(o.area for o in p.openings)` to add up the areas of all the openings (windows and doors) in a part of the house.

It's a shame that Python doesn't have a nice literal object syntax for this but using classes does have the advantage (over, say, JavaScript object literals) that you can do calculations using the previously defined values for the object.

```#!/usr/bin/python3

import math

class Temps:
""" Area temperatures """
bedrooms = 18
main = 21
outside = -1

class House:
""" General house dimensions """
U = 0.1
edge = 8.2
length = 17.6
guestBedroom = 2.4
mainBedroom = 3
mainPart = length - (guestBedroom + mainBedroom)
gableArea = 0.5 * edge * math.sin(math.radians(60)) * edge # Half base times height

class FrontDoor:
""" Front door """
h = 2.0
w = 0.8
U = 1.0

class MainWindow:
""" Main window (Velux GPL M08 -65) """
w = 0.780
h = 1.398
U = 1.1

# Allow for not being vertical - exact increment needs checking.
MainWindow.U += 0.1

class BedroomWindow:
""" Bedroom window (Velux GL M06 -65) """
w = 0.780
h = 1.178
U = 1.0

openings = (FrontDoor, MainWindow, BedroomWindow)

for o in openings:
o.area = o.w * o.h
o.conductance = o.area * o.U

class GuestBedroom:
""" Guest bedroom and hall to its north. """
basicArea = House.edge * 3 * House.guestBedroom + House.gableArea
openings = (FrontDoor, MainWindow)
temp = Temps.bedrooms

class MainPart:
""" Main part of house: bathroom, kitchen, living room, study. """
basicArea = House.edge * 3 * House.mainPart
openings = (MainWindow, ) * 4
temp = Temps.main

class MainBedroom:
""" Main bedroom. """
basicArea = House.edge * 3 * House.mainBedroom + House.gableArea
openings = (MainWindow, BedroomWindow)
temp = Temps.bedrooms

houseParts = (GuestBedroom, MainPart, MainBedroom)

for p in houseParts:
p.area = p.basicArea - sum(o.area for o in p.openings)
p.lossCoeff = p.area * House.U + sum(o.conductance for o in p.openings)
p.loss = p.lossCoeff * (p.temp - Temps.outside)

class Conduction:
""" Conductive heat losses. """
loss = sum(p.loss for p in houseParts)

class Ventilation:
""" Ventilation heat losses. """
rate = 120                                  # m³/h
efficiency = 0.8
massRate = rate * 1.3 / 3600                # kg/s
heatOut = massRate * 1e3 * (Temps.main - Temps.outside) # Heat out in watts
loss = heatOut * (1 - efficiency)           # Net heat actually lost

class Overall:
""" Overall results. """
totalLoss = Conduction.loss + Ventilation.loss

things = (Temps, House) + openings + houseParts + (Conduction, Ventilation, Overall)

for i, c in enumerate(things):
if i > 0: print()
print(c.__doc__.strip())
for k in sorted(k for k in dir(c) if not k.startswith('_')):
print('  ', k + ':', getattr(c, k))
```

And the results…

```Area temperatures
bedrooms: 18
main: 21
outside: -1

General house dimensions
U: 0.1
edge: 8.2
gableArea: 29.11577407523282
guestBedroom: 2.4
length: 17.6
mainBedroom: 3
mainPart: 12.200000000000001

Front door
U: 1.0
area: 1.6
conductance: 1.6
h: 2.0
w: 0.8

Main window (Velux GPL M08 -65)
U: 1.2000000000000002
area: 1.09044
conductance: 1.3085280000000004
h: 1.398
w: 0.78

Bedroom window (Velux GL M06 -65)
U: 1.0
area: 0.91884
conductance: 0.91884
h: 1.178
w: 0.78

Guest bedroom and hall to its north.
area: 85.46533407523282
basicArea: 88.15577407523281
loss: 217.64616674294237
lossCoeff: 11.455061407523283
openings: (<class '__main__.FrontDoor'>, <class '__main__.MainWindow'>)
temp: 18

Main part of house: bathroom, kitchen, living room, study.
area: 295.75824
basicArea: 300.12
loss: 765.818592
lossCoeff: 34.809936
openings: (<class '__main__.MainWindow'>, <class '__main__.MainWindow'>, <class '__main__.MainWindow'>, <class '__main__.MainWindow'>)
temp: 21

Main bedroom.
area: 100.90649407523281
basicArea: 102.91577407523282
loss: 234.04233074294237
lossCoeff: 12.318017407523282
openings: (<class '__main__.MainWindow'>, <class '__main__.BedroomWindow'>)
temp: 18

Conductive heat losses.
loss: 1217.5070894858848

Ventilation heat losses.
efficiency: 0.8
heatOut: 953.3333333333334
loss: 190.66666666666663
massRate: 0.043333333333333335
rate: 120

Overall results.
totalLoss: 1408.1737561525515
```

So, about 1400 W of heating required under those conditions.

That's ignoring:

• The sheltering effect of the porch/greenhouse at the west end, particularly on the front door.
• Any heat gain through the windows.
• Any heat gain from the gable warm air collectors (which I tend to regard as separate from the main south-roof collectors) and any heat gain via the porch/greenhouse.
• Any reduction of heat loss via blinds on the windows (I expect to make up some well insulated covers for winter night time - about 16 hours a day for the worst bit of the year).
• Heat gains from occupants (with only one occupant the ventilation rate and therefore loss would be a lot lower than shown most of the time).

In general, I think it'd have to be unusually cold for quite a while to even need this amount of heating.