def test_adaptive_comfort_en15251(): """Test the adaptive_comfort_en15251 function""" # test typical condition comf_result = adaptive_comfort_en15251(22, 25) assert comf_result['to'] == 25 assert comf_result['t_comf'] == pytest.approx(26.06, rel=1e-2) assert comf_result['deg_comf'] == pytest.approx(-1.06, rel=1e-2) assert comf_result['deg_comf'] == comf_result['to'] - comf_result['t_comf'] # test a slightly cool case comf_result = adaptive_comfort_en15251(16, 25) assert comf_result['to'] == 25 assert comf_result['t_comf'] == pytest.approx(24.08, rel=1e-2) assert comf_result['deg_comf'] == pytest.approx(0.9199, rel=1e-2) assert comf_result['deg_comf'] == comf_result['to'] - comf_result['t_comf'] # test a very cold outdoor case comf_result = adaptive_comfort_en15251(5, 23) assert comf_result['to'] == 23 assert comf_result['t_comf'] == pytest.approx(22.1, rel=1e-2) assert comf_result['deg_comf'] == pytest.approx(0.8999, rel=1e-2) # testa a very hot outdoor case comf_result = adaptive_comfort_en15251(35, 28) assert comf_result['to'] == 28 assert comf_result['t_comf'] == pytest.approx(28.7, rel=1e-2) assert comf_result['deg_comf'] == pytest.approx(-0.7, rel=1e-2) # test a fully conditioned case comf_result = adaptive_comfort_conditioned(24, 23, 1, 'EN-15251') assert comf_result['to'] == 23 assert comf_result['t_comf'] == pytest.approx(24.76, rel=1e-2) assert comf_result['deg_comf'] == pytest.approx(-1.76, rel=1e-2) # test a partially conditioned case comf_result = adaptive_comfort_conditioned(24, 23, 0.5, 'EN-15251') assert comf_result['to'] == 23 assert comf_result['t_comf'] == pytest.approx(25.74, rel=1e-2) assert comf_result['deg_comf'] == pytest.approx(-2.74, rel=1e-2) # test a air speed cooling effect function assert cooling_effect_en15251(1.5, 26) == pytest.approx(3.707498, rel=1e-2) assert cooling_effect_en15251(1.0, 26) == pytest.approx(2.9835, rel=1e-2) assert cooling_effect_en15251(0.7, 26) == pytest.approx(2.34662122, rel=1e-2)
def test_adaptive_comfort_ashrae55(): """Test the adaptive_comfort_ashrae55 function""" # test typical condition comf_result = adaptive_comfort_ashrae55(22, 25) assert comf_result['to'] == 25 assert comf_result['t_comf'] == pytest.approx(24.62, rel=1e-2) assert comf_result['deg_comf'] == pytest.approx(0.3799, rel=1e-2) assert comf_result['deg_comf'] == comf_result['to'] - comf_result['t_comf'] # test a cooler outdoor case comf_result = adaptive_comfort_ashrae55(16, 25) assert comf_result['to'] == 25 assert comf_result['t_comf'] == pytest.approx(22.76, rel=1e-2) assert comf_result['deg_comf'] == pytest.approx(2.23999, rel=1e-2) assert comf_result['deg_comf'] == comf_result['to'] - comf_result['t_comf'] # test a very cold outdoor case comf_result = adaptive_comfort_ashrae55(5, 23) assert comf_result['to'] == 23 assert comf_result['t_comf'] == pytest.approx(20.900, rel=1e-2) assert comf_result['deg_comf'] == pytest.approx(2.0999, rel=1e-2) # testa a very hot outdoor case comf_result = adaptive_comfort_ashrae55(35, 28) assert comf_result['to'] == 28 assert comf_result['t_comf'] == pytest.approx(28.185, rel=1e-2) assert comf_result['deg_comf'] == pytest.approx(-0.185, rel=1e-2) # test a fully conditioned case comf_result = adaptive_comfort_conditioned(24, 23, 1, 'ASHRAE-55') assert comf_result['to'] == 23 assert comf_result['t_comf'] == pytest.approx(24.76, rel=1e-2) assert comf_result['deg_comf'] == pytest.approx(-1.76, rel=1e-2) # test a partially conditioned case comf_result = adaptive_comfort_conditioned(24, 23, 0.5, 'ASHRAE-55') assert comf_result['to'] == 23 assert comf_result['t_comf'] == pytest.approx(25.0, rel=1e-2) assert comf_result['deg_comf'] == pytest.approx(-2.0, rel=1e-2) # test a air speed cooling effect function assert cooling_effect_ashrae55(1.5, 26) == 2.2 assert cooling_effect_ashrae55(1.0, 26) == 1.8 assert cooling_effect_ashrae55(0.7, 26) == 1.2
if all_required_inputs(ghenv.Component) and _run is True: # Process inputs and assign defaults. input_list = [_out_temp, _air_temp, _mrt_, _air_speed_] input, data_colls = extract_collections(input_list) adapt_par = adapt_par_ or AdaptiveParameter() if data_colls == []: # The inputs are all individual values. prevail_temp = input[0] to = t_operative(input[1], float(input[2])) # Determine the ralationship to the neutral temperature if adapt_par.conditioning != 0: comf_result = adaptive_comfort_conditioned(prevail_temp, to, adapt_par.conditioning, adapt_par.standard) elif adapt_par.ashrae55_or_en15251 is True: comf_result = adaptive_comfort_ashrae55(prevail_temp, to) else: comf_result = adaptive_comfort_en15251(prevail_temp, to) # Determine the cooling effect if adapt_par.discrete_or_continuous_air_speed is True: ce = cooling_effect_ashrae55(input[3], to) else: ce = cooling_effect_en15251(input[3], to) # Output results neutral_temp = comf_result['t_comf'] deg_neutral = comf_result['deg_comf']