Adding MultipleVentilation class

This commit is contained in:
Nicolas Mounet 2020-11-05 20:50:58 +01:00
parent e7e54cd129
commit 869758ce0d

View file

@ -176,6 +176,33 @@ class Ventilation:
return 0.
@dataclass(frozen=True)
class MultipleVentilation:
"""
Represents a mechanism by which air can be exchanged (replaced/filtered)
in a time dependent manner.
Group together different sources of ventilations.
"""
ventilations: typing.Tuple[Ventilation, ...]
def transition_times(self):
transitions = set()
for ventilation in self.ventilations:
transitions.update(ventilation.transition_times())
return sorted(transitions)
@abstractmethod
def air_exchange(self, room: Room, time: float) -> float:
"""
Returns the rate at which air is being exchanged in the given room
at a given time (in hours).
"""
return sum([ventilation.air_exchange(room,time)
for ventilation in self.ventilations])
@dataclass(frozen=True)
class WindowOpening(Ventilation):
#: The interval in which the window is open.