47 lines
1006 B
Python
47 lines
1006 B
Python
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])
|