From dd3f51b21b03eb6d9345dbedc5aa7875ec69d1bd Mon Sep 17 00:00:00 2001 From: Nicolas Mounet Date: Thu, 5 Nov 2020 18:46:32 +0100 Subject: [PATCH] Adding HVAC (mechanical ventilation) and AirChange (manual input of air exchange) in as Ventilation classes, in models.py --- cara/models.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/cara/models.py b/cara/models.py index 35ce83f1..35460810 100644 --- a/cara/models.py +++ b/cara/models.py @@ -216,6 +216,7 @@ class HEPAFilter(Ventilation): active: Interval #: The rate at which the HEPA exchanges air (when switched on) + # in m^3/h q_air_mech: float def air_exchange(self, room: Room, time: float) -> float: @@ -226,6 +227,41 @@ class HEPAFilter(Ventilation): return self.q_air_mech / room.volume +@dataclass(frozen=True) +class HVACMechanical(Ventilation): + #: The interval in which the mechanical ventilation (HVAC) is operating. + active: Interval + + #: The rate at which the HVAC exchanges air (when switched on) + # in m^3/h + q_air_mech: float + + def air_exchange(self, room: Room, time: float) -> float: + # If the HVAC is off, no air is being exchanged. + if not self.active.triggered(time): + return 0. + # Reminder, no dependence on time in the resulting calculation. + return self.q_air_mech / room.volume + + +@dataclass(frozen=True) +class AirChange(Ventilation): + #: The interval in which the ventilation is operating. + active: Interval + + #: The rate (in h^-1) at which the ventilation exchanges all the air + # of the room (when switched on) + air_exch: float + + def air_exchange(self, room: Room, time: float) -> float: + # No dependence on the room volume. + # If off, no air is being exchanged. + if not self.active.triggered(time): + return 0. + # Reminder, no dependence on time in the resulting calculation. + return self.air_exch + + @dataclass(frozen=True) class Virus: #: Biological decay (inactivation of the virus in air)