diff --git a/cara/apps/calculator/README.md b/cara/apps/calculator/README.md
index 8d9685af..b4e9b5cb 100644
--- a/cara/apps/calculator/README.md
+++ b/cara/apps/calculator/README.md
@@ -72,7 +72,7 @@ If you open the window at different distances throughout the day, choose an aver
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 when the windows are open - all the time (always), or for 10 minutes every 2 hours.
+Finally, you must specify when the windows are open - all the time (always), or (interval) in duration and frequency (both in minutes).
#### No ventilation
This option assumes there is neither Mechanical nor Natural ventilation in the simulation.
diff --git a/cara/apps/calculator/model_generator.py b/cara/apps/calculator/model_generator.py
index b58a2cb8..23ff3b7e 100644
--- a/cara/apps/calculator/model_generator.py
+++ b/cara/apps/calculator/model_generator.py
@@ -142,7 +142,7 @@ class FormData:
# Initializes a ventilation instance as a window if 'natural' is selected, or as a HEPA-filter otherwise
if self.ventilation_type == 'natural':
if self.windows_open == 'interval':
- window_interval = models.PeriodicInterval(self.windows_frequency*60, self.windows_duration)
+ window_interval = models.PeriodicInterval(self.windows_frequency*60, self.windows_duration*60)
else:
window_interval = always_on
diff --git a/cara/apps/calculator/static/js/form.js b/cara/apps/calculator/static/js/form.js
index 1b6a48c8..0f5ac5f3 100644
--- a/cara/apps/calculator/static/js/form.js
+++ b/cara/apps/calculator/static/js/form.js
@@ -350,7 +350,7 @@ function validate_form(form) {
var windowsFrequencyObj = document.getElementById("windows_frequency");
removeErrorFor(windowsFrequencyObj);
- if (parseInt(windowsDurationObj.value) >= parseInt(windowsFrequencyObj.value) * 60) {
+ if (parseInt(windowsDurationObj.value) >= parseInt(windowsFrequencyObj.value)) {
insertErrorFor(windowsFrequencyObj, "Duration >= Frequency");
submit = false;
}
diff --git a/cara/apps/calculator/templates/calculator.form.html.j2 b/cara/apps/calculator/templates/calculator.form.html.j2
index 5731d9d0..7a319511 100644
--- a/cara/apps/calculator/templates/calculator.form.html.j2
+++ b/cara/apps/calculator/templates/calculator.form.html.j2
@@ -91,7 +91,7 @@
/
-
+
@@ -218,7 +218,7 @@
Ventilation data:
Opening distance: {{ form.opening_distance }} m
Windows open: {% if form.windows_open == "interval" %} - {{ form.windows_open }}s of {{ form.windows_duration }} mins every {{ form.windows_frequency }} hours + {{ form.windows_open }}s of + {% set windows_duration = form.windows_duration %} + {% set unit = "minutes" %} + {% if windows_duration % 60 == 0 %} + {% set windows_duration = form.windows_duration / 60 %} + {% set unit = "hours" %} + {% endif %} + {% if windows_duration.is_integer() %} + {% set windows_duration = windows_duration | int_format %} + {% endif %} + {{ windows_duration }} {{ unit }} every + {% set windows_frequency = form.windows_frequency %} + {% set unit = "minutes" %} + {% if windows_frequency % 60 == 0 %} + {% set windows_frequency = form.windows_frequency / 60 %} + {% set unit = "hours" %} + {% endif %} + {% if windows_frequency.is_integer() %} + {% set windows_frequency = windows_frequency | int_format %} + {% endif %} + {{ windows_frequency }} {{ unit }} {% else %} {{ form.windows_open }} {% endif %} diff --git a/cara/tests/apps/calculator/test_model_generator.py b/cara/tests/apps/calculator/test_model_generator.py index 0b660798..de929b3e 100644 --- a/cara/tests/apps/calculator/test_model_generator.py +++ b/cara/tests/apps/calculator/test_model_generator.py @@ -39,6 +39,8 @@ def test_ventilation_slidingwindow(baseline_form): window_height=1.6, opening_length=0.6, ) baseline_form.ventilation_type = 'natural' + baseline_form.windows_duration = 10 + baseline_form.windows_frequency = 120 baseline_form.windows_open = 'interval' baseline_form.window_type = 'sliding' baseline_form.event_type = 'recurrent_event' @@ -118,6 +120,8 @@ def test_ventilation_window_hepa(baseline_form): ventilation = models.MultipleVentilation((window,hepa)) baseline_form.ventilation_type = 'natural' + baseline_form.windows_duration = 10 + baseline_form.windows_frequency = 120 baseline_form.windows_open = 'interval' baseline_form.event_type = 'recurrent_event' baseline_form.recurrent_event_month = 'December'