exposure of the inside_temp and humidity to the API

This commit is contained in:
Luis Aleixo 2022-05-10 11:41:19 +02:00
parent 1e689af19c
commit 0b9582ce31
3 changed files with 16 additions and 4 deletions

View file

@ -45,6 +45,7 @@ class FormData:
floor_area: float
hepa_amount: float
hepa_option: bool
humidity: str
infected_coffee_break_option: str #Used if infected_dont_have_breaks_with_exposed
infected_coffee_duration: int #Used if infected_dont_have_breaks_with_exposed
infected_dont_have_breaks_with_exposed: bool
@ -54,6 +55,7 @@ class FormData:
infected_lunch_start: minutes_since_midnight #Used if infected_dont_have_breaks_with_exposed
infected_people: int
infected_start: minutes_since_midnight
inside_temp: float
location_name: str
location_latitude: float
location_longitude: float
@ -100,6 +102,7 @@ class FormData:
'floor_area': 0.,
'hepa_amount': 0.,
'hepa_option': False,
'humidity': '',
'infected_coffee_break_option': 'coffee_break_0',
'infected_coffee_duration': 5,
'infected_dont_have_breaks_with_exposed': False,
@ -109,6 +112,7 @@ class FormData:
'infected_lunch_start': '12:30',
'infected_people': _NO_DEFAULT,
'infected_start': '08:30',
'inside_temp': 293.,
'location_latitude': _NO_DEFAULT,
'location_longitude': _NO_DEFAULT,
'location_name': _NO_DEFAULT,
@ -240,11 +244,14 @@ class FormData:
volume = self.room_volume
else:
volume = self.floor_area * self.ceiling_height
if self.room_heating_option:
humidity = 0.3
if self.humidity == '':
if self.room_heating_option:
humidity = 0.3
else:
humidity = 0.5
else:
humidity = 0.5
room = models.Room(volume=volume, inside_temp=models.PiecewiseConstant((0, 24), (293,)), humidity=humidity)
humidity = float(self.humidity)
room = models.Room(volume=volume, inside_temp=models.PiecewiseConstant((0, 24), (self.inside_temp,)), humidity=humidity)
infected_population = self.infected_population()

View file

@ -783,6 +783,9 @@ $(document).ready(function () {
templateSelection: formatLocationSelection
});
// Logic for the API requests. Always set humity input as the empty string so that we can profit from the "room_heating_option default" values for humidity.
$("[name='humidity']").val("");
function formatlocation(suggestedLocation) {
// Function is called for each location from the geocoding API.

View file

@ -137,6 +137,8 @@
<input type="text" name="location_name" value="Geneva, CHE">
<input type="text" name="location_latitude" value="46.20833">
<input type="text" name="location_longitude" value="6.14275">
<input type="text" name="inside_temp" value="293">
<input type="text" name="humidity" value="">
</div>
<hr width="80%">