Merge branch 'feature/windows_opening_interval' into 'master'
Confusion about when the window opens See merge request cara/cara!291
This commit is contained in:
commit
a07dfaf168
3 changed files with 8 additions and 5 deletions
|
|
@ -303,7 +303,7 @@ class FormData:
|
||||||
# Initializes a ventilation instance as a window if 'natural_ventilation' is selected, or as a HEPA-filter otherwise
|
# Initializes a ventilation instance as a window if 'natural_ventilation' is selected, or as a HEPA-filter otherwise
|
||||||
if self.ventilation_type == 'natural_ventilation':
|
if self.ventilation_type == 'natural_ventilation':
|
||||||
if self.window_opening_regime == 'windows_open_periodically':
|
if self.window_opening_regime == 'windows_open_periodically':
|
||||||
window_interval = models.PeriodicInterval(self.windows_frequency, self.windows_duration)
|
window_interval = models.PeriodicInterval(self.windows_frequency, self.windows_duration, min(self.infected_start, self.exposed_start))
|
||||||
else:
|
else:
|
||||||
window_interval = always_on
|
window_interval = always_on
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -123,11 +123,14 @@ class PeriodicInterval(Interval):
|
||||||
#: occurring, a value of 0 signifies that the event never happens.
|
#: occurring, a value of 0 signifies that the event never happens.
|
||||||
duration: float
|
duration: float
|
||||||
|
|
||||||
|
#: Time at which the first person (infected or exposed) arrives at the enclosed space.
|
||||||
|
start: float = 0.0
|
||||||
|
|
||||||
def boundaries(self) -> BoundarySequence_t:
|
def boundaries(self) -> BoundarySequence_t:
|
||||||
if self.period == 0 or self.duration == 0:
|
if self.period == 0 or self.duration == 0:
|
||||||
return tuple()
|
return tuple()
|
||||||
result = []
|
result = []
|
||||||
for i in np.arange(0, 24, self.period / 60):
|
for i in np.arange(self.start, 24, self.period / 60):
|
||||||
# NOTE: It is important that the time type is float, not np.float, in
|
# NOTE: It is important that the time type is float, not np.float, in
|
||||||
# order to allow hashability (for caching).
|
# order to allow hashability (for caching).
|
||||||
result.append((float(i), float(i+self.duration/60)))
|
result.append((float(i), float(i+self.duration/60)))
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ def test_ventilation_slidingwindow(baseline_form: model_generator.FormData):
|
||||||
assert isinstance(baseline_window, models.SlidingWindow)
|
assert isinstance(baseline_window, models.SlidingWindow)
|
||||||
|
|
||||||
window = models.SlidingWindow(
|
window = models.SlidingWindow(
|
||||||
active=models.PeriodicInterval(period=120, duration=10),
|
active=models.PeriodicInterval(period=120, duration=10, start=minutes_since_midnight(9 * 60)),
|
||||||
inside_temp=models.PiecewiseConstant((0, 24), (293,)),
|
inside_temp=models.PiecewiseConstant((0, 24), (293,)),
|
||||||
outside_temp=baseline_window.outside_temp,
|
outside_temp=baseline_window.outside_temp,
|
||||||
window_height=1.6, opening_length=0.6,
|
window_height=1.6, opening_length=0.6,
|
||||||
|
|
@ -80,7 +80,7 @@ def test_ventilation_hingedwindow(baseline_form: model_generator.FormData):
|
||||||
assert isinstance(baseline_window, models.HingedWindow)
|
assert isinstance(baseline_window, models.HingedWindow)
|
||||||
|
|
||||||
window = models.HingedWindow(
|
window = models.HingedWindow(
|
||||||
active=models.PeriodicInterval(period=120, duration=10),
|
active=models.PeriodicInterval(period=120, duration=10, start=minutes_since_midnight(9 * 60)),
|
||||||
inside_temp=models.PiecewiseConstant((0, 24), (293,)),
|
inside_temp=models.PiecewiseConstant((0, 24), (293,)),
|
||||||
outside_temp=baseline_window.outside_temp,
|
outside_temp=baseline_window.outside_temp,
|
||||||
window_height=1.6, window_width=1., opening_length=0.6,
|
window_height=1.6, window_width=1., opening_length=0.6,
|
||||||
|
|
@ -141,7 +141,7 @@ def test_ventilation_window_hepa(baseline_form: model_generator.FormData):
|
||||||
|
|
||||||
# Now build the equivalent ventilation instance directly, and compare.
|
# Now build the equivalent ventilation instance directly, and compare.
|
||||||
window = models.SlidingWindow(
|
window = models.SlidingWindow(
|
||||||
active=models.PeriodicInterval(period=120, duration=10),
|
active=models.PeriodicInterval(period=120, duration=10, start=minutes_since_midnight(9 * 60)),
|
||||||
inside_temp=models.PiecewiseConstant((0, 24), (293,)),
|
inside_temp=models.PiecewiseConstant((0, 24), (293,)),
|
||||||
outside_temp=baseline_window.outside_temp,
|
outside_temp=baseline_window.outside_temp,
|
||||||
window_height=1.6, opening_length=0.6,
|
window_height=1.6, opening_length=0.6,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue