From f5ef650cea8f5430c909cbea64e37613d6a8f101 Mon Sep 17 00:00:00 2001
From: Luis Aleixo
Date: Mon, 13 Jun 2022 10:50:54 +0200
Subject: [PATCH] Added default frequency of 1 hour for window opening
---
cara/apps/calculator/model_generator.py | 7 ++----
cara/apps/calculator/static/js/form.js | 12 ++++------
.../templates/base/calculator.form.html.j2 | 7 +++---
.../templates/base/calculator.report.html.j2 | 3 +--
cara/apps/templates/base/userguide.html.j2 | 2 +-
.../apps/calculator/test_model_generator.py | 23 ++++++++-----------
6 files changed, 21 insertions(+), 33 deletions(-)
diff --git a/cara/apps/calculator/model_generator.py b/cara/apps/calculator/model_generator.py
index 8e92f361..e9557012 100644
--- a/cara/apps/calculator/model_generator.py
+++ b/cara/apps/calculator/model_generator.py
@@ -71,7 +71,6 @@ class FormData:
virus_type: str
volume_type: str
windows_duration: float
- windows_frequency: float
window_height: float
window_type: str
window_width: float
@@ -129,7 +128,6 @@ class FormData:
'window_height': 0.,
'window_width': 0.,
'windows_duration': 0.,
- 'windows_frequency': 0.,
'windows_number': 0,
'window_opening_regime': 'windows_open_permanently',
'short_range_option': 'short_range_no',
@@ -324,11 +322,11 @@ class FormData:
return outside_temp
def ventilation(self) -> models._VentilationBase:
- always_on = models.PeriodicInterval(period=120, duration=120)
+ always_on = models.PeriodicInterval(period=60, duration=60)
# 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.window_opening_regime == 'windows_open_periodically':
- window_interval = models.PeriodicInterval(self.windows_frequency, self.windows_duration, min(self.infected_start, self.exposed_start)/60)
+ window_interval = models.PeriodicInterval(60, self.windows_duration, min(self.infected_start, self.exposed_start)/60)
else:
window_interval = always_on
@@ -717,7 +715,6 @@ def baseline_raw_form_data() -> typing.Dict[str, typing.Union[str, float]]:
'virus_type': 'SARS_CoV_2',
'volume_type': 'room_volume_explicit',
'windows_duration': '',
- 'windows_frequency': '',
'window_height': '2',
'window_type': 'window_sliding',
'window_width': '2',
diff --git a/cara/apps/calculator/static/js/form.js b/cara/apps/calculator/static/js/form.js
index dc20b3b4..cc48a193 100644
--- a/cara/apps/calculator/static/js/form.js
+++ b/cara/apps/calculator/static/js/form.js
@@ -125,7 +125,6 @@ function require_natural_ventilation(option) {
if (!option) {
require_input_field("#window_width", option);
require_input_field("#windows_duration", option);
- require_input_field("#windows_frequency", option);
}
}
@@ -146,9 +145,7 @@ function require_air_supply(option) {
function require_venting(option) {
require_input_field("#windows_duration", option);
- require_input_field("#windows_frequency", option);
set_disabled_status("#windows_duration", !option);
- set_disabled_status("#windows_frequency", !option);
}
function require_lunch(id, option) {
@@ -404,14 +401,13 @@ function validate_form(form) {
}
});
- //Validate window venting duration < venting frequency
+ //Validate window venting duration > 60 minutes.
if (!$("#windows_duration").hasClass("disabled")) {
var windowsDurationObj = document.getElementById("windows_duration");
- var windowsFrequencyObj = document.getElementById("windows_frequency");
- removeErrorFor(windowsFrequencyObj);
+ removeErrorFor(windowsDurationObj);
- if (parseInt(windowsDurationObj.value) >= parseInt(windowsFrequencyObj.value)) {
- insertErrorFor(windowsFrequencyObj, "Duration >= Frequency");
+ if (parseInt(windowsDurationObj.value) > 60.) {
+ insertErrorFor(windowsDurationObj, "Duration > 60 minutes.");
submit = false;
}
}
diff --git a/cara/apps/templates/base/calculator.form.html.j2 b/cara/apps/templates/base/calculator.form.html.j2
index 294cda4f..19d73af7 100644
--- a/cara/apps/templates/base/calculator.form.html.j2
+++ b/cara/apps/templates/base/calculator.form.html.j2
@@ -237,9 +237,8 @@
- Periodically:
-
-
+ Periodically (open minutes per hour):
+
@@ -575,7 +574,7 @@
Ventilation data:
Mechanical ventilation = the HVAC supply of fresh air. Check the flow rates with the concerned technical department.
- Natural ventilation = the type of window opening. The opening distance is between the fixed frame and movable part when open (commonly used values are window height of 1.6m and window opening between 0.15m and 0.6m). In case of periodic opening, specify the duration (e.g. for 10 min) and frequency (e.g. every 60 min).
+ Natural ventilation = the type of window opening. The opening distance is between the fixed frame and movable part when open (commonly used values are window height of 1.6m and window opening between 0.15m and 0.6m). In case of periodic opening, specify the duration (e.g. 10 min) per hour.
HEPA filtration = the air flow of the device. The following values are based on the different fan velocities of a specific commercial device proposed by the HSE Unit:
Level 6 (max) = 430 m3 /h (noisy),
diff --git a/cara/apps/templates/base/calculator.report.html.j2 b/cara/apps/templates/base/calculator.report.html.j2
index c6ca579a..900c87cb 100644
--- a/cara/apps/templates/base/calculator.report.html.j2
+++ b/cara/apps/templates/base/calculator.report.html.j2
@@ -325,8 +325,7 @@
Opening distance: {{ form.opening_distance }} m
Windows open:
{% if form.window_opening_regime == "windows_open_periodically" %}
- Periodically for {{ form.windows_duration | readable_minutes}}
- every {{ form.windows_frequency | readable_minutes}}
+ Periodically for {{ form.windows_duration | readable_minutes}} every 1 hour.
{% elif form.window_opening_regime == "windows_open_permanently" %}
Permanently
{% endif %}
diff --git a/cara/apps/templates/base/userguide.html.j2 b/cara/apps/templates/base/userguide.html.j2
index 893637c2..8c03120f 100644
--- a/cara/apps/templates/base/userguide.html.j2
+++ b/cara/apps/templates/base/userguide.html.j2
@@ -95,7 +95,7 @@ If there are multiple windows of different sizes, you should take an average.
When using natural ventilation, the circulation of air is simulated as a function of the difference between the temperature inside the room and the outside air temperature. The average outdoor temperature for each hour of the day has been computed for every month of the year based on historical data for Geneva, Switzerland.
It is therefore very important to enter the correct time and date in the event data section.
-Finally, you must specify if the windows are open permanently (at all the times), or periodically (in intervals for a certain duration and frequency - both in minutes) - e.g. open the window for 10 minutes (duration) every 60 minutes (frequency).
+Finally, you must specify if the windows are open permanently (at all the times), or periodically (in intervals for a certain duration per hour - in minutes) - e.g. open the window for 10 minutes (duration) every 1 hour.
No ventilation
diff --git a/cara/tests/apps/calculator/test_model_generator.py b/cara/tests/apps/calculator/test_model_generator.py
index cd7de105..a00bde34 100644
--- a/cara/tests/apps/calculator/test_model_generator.py
+++ b/cara/tests/apps/calculator/test_model_generator.py
@@ -45,8 +45,7 @@ def test_blend_expiration(mask_type):
def test_ventilation_slidingwindow(baseline_form: model_generator.FormData):
baseline_form.ventilation_type = 'natural_ventilation'
- baseline_form.windows_duration = 10
- baseline_form.windows_frequency = 120
+ baseline_form.windows_duration = 5
baseline_form.window_opening_regime = 'windows_open_periodically'
baseline_form.window_type = 'window_sliding'
baseline_form.event_month = 'December'
@@ -59,13 +58,13 @@ def test_ventilation_slidingwindow(baseline_form: model_generator.FormData):
assert isinstance(baseline_window, models.SlidingWindow)
window = models.SlidingWindow(
- active=models.PeriodicInterval(period=120, duration=10, start=9),
+ active=models.PeriodicInterval(period=60, duration=5, start=9),
outside_temp=baseline_window.outside_temp,
window_height=1.6, opening_length=0.6,
)
ach = models.AirChange(
- active=models.PeriodicInterval(period=120, duration=120),
+ active=models.PeriodicInterval(period=60, duration=60),
air_exch=0.25,
)
ventilation = models.MultipleVentilation((window, ach))
@@ -75,8 +74,7 @@ def test_ventilation_slidingwindow(baseline_form: model_generator.FormData):
def test_ventilation_hingedwindow(baseline_form: model_generator.FormData):
baseline_form.ventilation_type = 'natural_ventilation'
- baseline_form.windows_duration = 10
- baseline_form.windows_frequency = 120
+ baseline_form.windows_duration = 5
baseline_form.window_opening_regime = 'windows_open_periodically'
baseline_form.window_type = 'window_hinged'
baseline_form.event_month = 'December'
@@ -90,12 +88,12 @@ def test_ventilation_hingedwindow(baseline_form: model_generator.FormData):
assert isinstance(baseline_window, models.HingedWindow)
window = models.HingedWindow(
- active=models.PeriodicInterval(period=120, duration=10, start=9),
+ active=models.PeriodicInterval(period=60, duration=5, start=9),
outside_temp=baseline_window.outside_temp,
window_height=1.6, window_width=1., opening_length=0.6,
)
ach = models.AirChange(
- active=models.PeriodicInterval(period=120, duration=120),
+ active=models.PeriodicInterval(period=60, duration=60),
air_exch=0.25,
)
ventilation = models.MultipleVentilation((window, ach))
@@ -135,8 +133,7 @@ def test_ventilation_airchanges(baseline_form: model_generator.FormData):
def test_ventilation_window_hepa(baseline_form: model_generator.FormData):
baseline_form.ventilation_type = 'natural_ventilation'
- baseline_form.windows_duration = 10
- baseline_form.windows_frequency = 120
+ baseline_form.windows_duration = 5
baseline_form.window_opening_regime = 'windows_open_periodically'
baseline_form.event_month = 'December'
baseline_form.window_height = 1.6
@@ -150,16 +147,16 @@ def test_ventilation_window_hepa(baseline_form: model_generator.FormData):
# Now build the equivalent ventilation instance directly, and compare.
window = models.SlidingWindow(
- active=models.PeriodicInterval(period=120, duration=10, start=9),
+ active=models.PeriodicInterval(period=60, duration=5, start=9),
outside_temp=baseline_window.outside_temp,
window_height=1.6, opening_length=0.6,
)
hepa = models.HEPAFilter(
- active=models.PeriodicInterval(period=120, duration=120),
+ active=models.PeriodicInterval(period=60, duration=60),
q_air_mech=250.,
)
ach = models.AirChange(
- active=models.PeriodicInterval(period=120, duration=120),
+ active=models.PeriodicInterval(period=60, duration=60),
air_exch=0.25,
)
ventilation = models.MultipleVentilation((window, hepa, ach))