Resolved conflicts in calculator.form.html.j2

This commit is contained in:
gaazzopa 2020-12-09 18:36:33 +01:00
parent a91c6a4c90
commit be33f4070f
6 changed files with 30 additions and 6 deletions

View file

@ -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.

View file

@ -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

View file

@ -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;
}

View file

@ -91,7 +91,7 @@
<input type="radio" id="interval" name="windows_open" value="interval" onclick="require_fields(this)">
<label for="interval">Interval:</label>&nbsp;&nbsp;
<input type="number" step="any" id="windows_duration" name="windows_duration" placeholder="mins" min="1" size="5" data-has-radio="#interval"> /
<input type="number" step="any" id="windows_frequency" name="windows_frequency" placeholder="hour" min="1" size="5" data-has-radio="#interval">
<input type="number" step="any" id="windows_frequency" name="windows_frequency" placeholder="mins" min="1" size="5" data-has-radio="#interval">
<br>
</div>
@ -218,7 +218,7 @@
<b>Ventilation data:</b> <br>
<ul>
<li>Mechanical ventilation = check the flow rates with the concerned technical department.</li>
<li>Natural ventilation = the type of window. The opening distance is between the fixed frame and movable part when open (commonly used values are window height = 1.6m and window opening = 0.15m).</li>
<li>Natural ventilation = the window opening distance is between the fixed frame and movable part when open (commonly used values are window height = 1.6m and window opening = 0.15m). Specify the windows open interval in duration and frequency.</li>
<li>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:</li>
<ul>
<li>Level 6 (max) = 430 m<sup>3</sup>/h (noisy)</li>

View file

@ -63,7 +63,27 @@
<li><p class="data_subtext">Opening distance: {{ form.opening_distance }} m</p></li>
<li><p class="data_subtext">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 %}

View file

@ -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'