From 5a9ff39eec3af282a77826b848e591a697a1994b Mon Sep 17 00:00:00 2001 From: omicron Date: Tue, 9 Jun 2026 14:23:59 +0200 Subject: [PATCH] Add room system for ventilation loss calculation --- ventilation.py | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 ventilation.py diff --git a/ventilation.py b/ventilation.py new file mode 100644 index 0000000..0f376e0 --- /dev/null +++ b/ventilation.py @@ -0,0 +1,46 @@ +from dataclasses import dataclass +from enum import Enum, auto + + +class RoomKind(Enum): + # Wet rooms + OPEN_KITCHEN = auto() + KITCHEN = auto() + TOILET = auto() + OTHER_WET = auto() + + # dry rooms + LIVING_ROOM = auto() + OTHER_DRY = auto() + + +# https://belglas.com/wp-content/uploads/2016/04/ventilatiedocumentresidentieel.pdf +_RANGES = { + RoomKind.OPEN_KITCHEN: (75, float("inf")), + RoomKind.KITCHEN: (50, 75), + RoomKind.TOILET: (25, 25), + RoomKind.OTHER_WET: (50, 75), + RoomKind.LIVING_ROOM: (75, 150), + RoomKind.OTHER_DRY: (25, 72), +} + + +def _clamp(x, low, high): + return min(max(x, low), high) + + +@dataclass +class Room: + kind: RoomKind + area: float + + @property + def is_wet(self) -> bool: + return self.kind not in {RoomKind.LIVING_ROOM, RoomKind.OTHER_DRY} + + @property + def flow_rate(self) -> float: + if self.kind == RoomKind.TOILET: + return 25 + rate = 3.6 * self.area + return _clamp(rate, *_RANGES[self.kind])