Updating tests according to the change cd_b -> discharge_coefficient; no more WindowOpening in tests

This commit is contained in:
Nicolas Mounet 2020-12-01 15:32:23 +01:00
parent 205990c7b4
commit faac4c2893
3 changed files with 16 additions and 14 deletions

View file

@ -7,11 +7,11 @@ import pytest
def baseline_model():
model = models.ConcentrationModel(
room=models.Room(volume=75),
ventilation=models.WindowOpening(
ventilation=models.SlidingWindow(
active=models.PeriodicInterval(period=120, duration=120),
inside_temp=models.PiecewiseConstant((0,24),(293,)),
outside_temp=models.PiecewiseConstant((0,24),(283,)),
discharge_coefficient=0.6, window_height=1.6, opening_length=0.6,
window_height=1.6, opening_length=0.6,
),
infected=models.InfectedPopulation(
number=1,

View file

@ -26,11 +26,11 @@ def test_no_mask_emission_rate(baseline_model):
@pytest.fixture
def baseline_periodic_window():
return models.WindowOpening(
return models.SlidingWindow(
active=models.PeriodicInterval(period=120, duration=15),
inside_temp=models.PiecewiseConstant((0,24),(293,)),
outside_temp=models.PiecewiseConstant((0,24),(283,)),
discharge_coefficient=0.6, window_height=1.6, opening_length=0.6,
window_height=1.6, opening_length=0.6,
)
@ -289,11 +289,11 @@ def build_hourly_dependent_model(month, intervals_open=((7.5, 8.5),),
model = models.ConcentrationModel(
room=models.Room(volume=75),
ventilation=models.WindowOpening(
ventilation=models.SlidingWindow(
active=models.SpecificInterval(intervals_open),
inside_temp=models.PiecewiseConstant((0,24),(293,)),
outside_temp=outside_temp,
discharge_coefficient=0.6, window_height=1.6, opening_length=0.6,
window_height=1.6, opening_length=0.6,
),
infected=models.InfectedPopulation(
number=1,
@ -310,11 +310,11 @@ def build_hourly_dependent_model(month, intervals_open=((7.5, 8.5),),
def build_constant_temp_model(outside_temp, intervals_open=((7.5, 8.5),)):
model = models.ConcentrationModel(
room=models.Room(volume=75),
ventilation=models.WindowOpening(
ventilation=models.SlidingWindow(
active=models.SpecificInterval(intervals_open),
inside_temp=models.PiecewiseConstant((0,24),(293,)),
outside_temp=models.PiecewiseConstant((0,24),(outside_temp,)),
discharge_coefficient=0.6, window_height=1.6, opening_length=0.6,
window_height=1.6, opening_length=0.6,
),
infected=models.InfectedPopulation(
number=1,
@ -330,11 +330,11 @@ def build_constant_temp_model(outside_temp, intervals_open=((7.5, 8.5),)):
def build_hourly_dependent_model_multipleventilation(month, intervals_open=((7.5, 8.5),)):
vent = models.MultipleVentilation((
models.WindowOpening(
models.SlidingWindow(
active=models.SpecificInterval(intervals_open),
inside_temp=models.PiecewiseConstant((0,24),(293,)),
outside_temp=data.GenevaTemperatures[month],
discharge_coefficient=0.6, window_height=1.6, opening_length=0.6,
window_height=1.6, opening_length=0.6,
),
models.HEPAFilter(
active=models.SpecificInterval(((0,24),)),

View file

@ -37,7 +37,7 @@ def test_number_of_windows(baseline_slidingwindow):
@pytest.mark.parametrize(
"window_width, expected_cd_b",
"window_width, expected_discharge_coefficient",
[
[0.5, 0.01369640075],
[1., 0.01056914747],
@ -45,15 +45,17 @@ def test_number_of_windows(baseline_slidingwindow):
[4., 0.00779945967],
],
)
def test_hinged_window(baseline_hingedwindow,window_width,expected_cd_b):
def test_hinged_window(baseline_hingedwindow,window_width,
expected_discharge_coefficient):
room = models.Room(75)
hinged_window = dataclasses.replace(baseline_hingedwindow,
window_width=window_width)
npt.assert_allclose(hinged_window.cd_b, expected_cd_b, rtol=1e-8)
npt.assert_allclose(hinged_window.discharge_coefficient,
expected_discharge_coefficient, rtol=1e-8)
def test_sliding_window(baseline_slidingwindow):
room = models.Room(75)
assert baseline_slidingwindow.cd_b == 0.6
assert baseline_slidingwindow.discharge_coefficient == 0.6