Functional Weave
Code in Python

energy.degree-days@1.0.0

README.md

1,773 bytes · view raw

# energy.degree-days

Heating degree days (HDD) and cooling degree days (CDD) for a run of days,
from each day's mean temperature and a base temperature:

```
HDD = sum over days of max(0, base - mean)
CDD = sum over days of max(0, mean - base)
```

They are the standard way to normalise heating (or cooling) energy for the
weather: kWh per degree day is comparable between a mild and a cold winter
where raw kWh is not.

## Units

Temperatures and results are integers in **tenths of a degree**: 12.3 °C is
`123`, and 45 degree days is `450`. Temperatures are recorded to a tenth of a
degree, and with integer tenths every sum is exact, so the answer is exact to
0.1 of a degree day in all three languages rather than approximately so.

## Decisions

- **The base is an argument.** 15.5 °C (`155`) is the long-standing UK
  convention for heating degree days (CIBSE TM41, and the base of the
  published UK regional series); buildings with better insulation or higher
  internal gains are often analysed at a lower base, and cooling is often
  counted above 15.5 °C or 18 °C. The same base is used for both sums.
- **Mean-temperature method only.** Each day contributes `base - mean` when
  positive. The Met Office / UKMO method that estimates degree days from a
  day's maximum and minimum (for days where the base falls between them) is
  a different formula and is not what this does; pass the true daily mean.
- **A day at exactly the base counts for neither.**
- An empty list gives zeros. A mean outside -100.0 to 100.0 °C is refused as
  a unit mistake (Fahrenheit, or whole degrees times 100).

## Source

CIBSE TM41, "Degree-days: theory and application" (Chartered Institution of
Building Services Engineers), for the definition and the 15.5 °C UK base.