Adding hinged windows to the calculator model_generator (plus test)

This commit is contained in:
Nicolas Mounet 2020-12-01 15:28:14 +01:00
parent 0c46bac365
commit 4007a1aee8
2 changed files with 43 additions and 9 deletions

View file

@ -146,13 +146,24 @@ class FormData:
inside_temp = models.PiecewiseConstant((0, 24), (293,))
outside_temp = data.GenevaTemperatures[month]
ventilation = models.SlidingWindow(
active=window_interval,
inside_temp=inside_temp, outside_temp=outside_temp,
window_height=self.window_height,
opening_length=self.opening_distance,
number_of_windows=self.windows_number,
)
if self.window_type == 'sliding':
ventilation = models.SlidingWindow(
active=window_interval,
inside_temp=inside_temp, outside_temp=outside_temp,
window_height=self.window_height,
opening_length=self.opening_distance,
number_of_windows=self.windows_number,
)
elif self.window_type == 'hinged':
ventilation = models.HingedWindow(
active=window_interval,
inside_temp=inside_temp, outside_temp=outside_temp,
window_height=self.window_height,
window_width=self.window_width,
opening_length=self.opening_distance,
number_of_windows=self.windows_number,
)
elif self.ventilation_type == "no-ventilation":
ventilation = models.AirChange(active=always_on, air_exch=0.)
else:
@ -419,7 +430,7 @@ def baseline_raw_form_data():
'ventilation_type': 'natural',
'volume_type': 'room_volume',
'window_height': '2',
'window_type': 'hinged',
'window_type': 'sliding',
'window_width': '2',
'windows_number': '1',
'windows_open': 'interval'

View file

@ -30,7 +30,7 @@ def test_blend_expiration():
assert r == expected
def test_ventilation_window(baseline_form):
def test_ventilation_slidingwindow(baseline_form):
room = models.Room(75)
window = models.SlidingWindow(
active=models.PeriodicInterval(period=120, duration=10),
@ -40,6 +40,7 @@ def test_ventilation_window(baseline_form):
)
baseline_form.ventilation_type = 'natural'
baseline_form.windows_open = 'interval'
baseline_form.window_type = 'sliding'
baseline_form.event_type = 'recurrent_event'
baseline_form.recurrent_event_month = 'December'
baseline_form.window_height = 1.6
@ -50,6 +51,28 @@ def test_ventilation_window(baseline_form):
[baseline_form.ventilation().air_exchange(room, t) for t in ts])
def test_ventilation_hingedwindow(baseline_form):
room = models.Room(75)
window = models.HingedWindow(
active=models.PeriodicInterval(period=120, duration=10),
inside_temp=models.PiecewiseConstant((0, 24), (293,)),
outside_temp=data.GenevaTemperatures['Dec'],
window_height=1.6, window_width=1., opening_length=0.6,
)
baseline_form.ventilation_type = 'natural'
baseline_form.windows_open = 'interval'
baseline_form.window_type = 'hinged'
baseline_form.event_type = 'recurrent_event'
baseline_form.recurrent_event_month = 'December'
baseline_form.window_height = 1.6
baseline_form.window_width = 1.
baseline_form.opening_distance = 0.6
ts = np.linspace(8, 16, 100)
np.testing.assert_allclose([window.air_exchange(room, t) for t in ts],
[baseline_form.ventilation().air_exchange(room, t) for t in ts])
def test_ventilation_mechanical(baseline_form):
room = models.Room(75)
mech = models.HVACMechanical(