def test_init_indoor_solarcal_collection_epw(): """Test the initialization of the IndoorSolarCal collection with EPW input.""" calc_length = 8760 relative_path = './tests/epw/chicago.epw' epw = EPW(relative_path) solarcal_obj = IndoorSolarCal(epw.location, epw.direct_normal_radiation, epw.diffuse_horizontal_radiation, 24) assert isinstance(solarcal_obj.direct_normal_solar, HourlyContinuousCollection) assert len(solarcal_obj.direct_normal_solar.values) == calc_length assert solarcal_obj.direct_normal_solar[12] == pytest.approx(151, rel=1e-3) assert isinstance(solarcal_obj.diffuse_horizontal_solar, HourlyContinuousCollection) assert len(solarcal_obj.diffuse_horizontal_solar.values) == calc_length assert solarcal_obj.diffuse_horizontal_solar[12] == pytest.approx(168, rel=1e-3) assert isinstance(solarcal_obj.effective_radiant_field, HourlyContinuousCollection) assert len(solarcal_obj.effective_radiant_field.values) == calc_length assert solarcal_obj.effective_radiant_field[12] == pytest.approx(33.31652, rel=1e-3) assert isinstance(solarcal_obj.mrt_delta, HourlyContinuousCollection) assert len(solarcal_obj.mrt_delta.values) == calc_length assert solarcal_obj.mrt_delta[12] == pytest.approx(7.6436828, rel=1e-3) assert isinstance(solarcal_obj.mean_radiant_temperature, HourlyContinuousCollection) assert len(solarcal_obj.mean_radiant_temperature.values) == calc_length assert solarcal_obj.mean_radiant_temperature[12] == pytest.approx( 31.6436828, rel=1e-3)
def test_indoor_solarcal_collection_defaults(): """Test the default inputs assigned to the IndoorSolarCal collection.""" calc_length = 24 irr_header = Header(Irradiance(), 'W/m2', AnalysisPeriod(end_month=1, end_day=1)) dir_norm = HourlyContinuousCollection(irr_header, [500] * calc_length) diff_horiz = HourlyContinuousCollection(irr_header, [200] * calc_length) solarcal_obj = IndoorSolarCal(Location(), dir_norm, diff_horiz, 24) assert isinstance(solarcal_obj.fraction_body_exposed, HourlyContinuousCollection) assert len(solarcal_obj.fraction_body_exposed.values) == calc_length assert solarcal_obj.fraction_body_exposed[12] == 1 assert isinstance(solarcal_obj.sky_exposure, HourlyContinuousCollection) assert len(solarcal_obj.sky_exposure.values) == calc_length assert solarcal_obj.sky_exposure[12] == 1 assert isinstance(solarcal_obj.floor_reflectance, HourlyContinuousCollection) assert len(solarcal_obj.floor_reflectance.values) == calc_length assert solarcal_obj.floor_reflectance[12] == 0.25 assert isinstance(solarcal_obj.window_transmittance, HourlyContinuousCollection) assert len(solarcal_obj.window_transmittance.values) == calc_length assert solarcal_obj.window_transmittance[12] == 0.4 assert isinstance(solarcal_obj.solarcal_body_parameter, SolarCalParameter) default_par = SolarCalParameter() assert solarcal_obj.solarcal_body_parameter.posture == default_par.posture assert solarcal_obj.solarcal_body_parameter.sharp == default_par.sharp assert solarcal_obj.solarcal_body_parameter.body_azimuth == default_par.body_azimuth assert solarcal_obj.solarcal_body_parameter.body_absorptivity == default_par.body_absorptivity assert solarcal_obj.solarcal_body_parameter.body_emissivity == default_par.body_emissivity
def test_init_indoor_solarcal_collection(): """Test the initialization of the IndoorSolarCal collection.""" calc_length = 24 irr_header = Header(Irradiance(), 'W/m2', AnalysisPeriod(end_month=1, end_day=1)) dir_norm = HourlyContinuousCollection(irr_header, [500] * calc_length) diff_horiz = HourlyContinuousCollection(irr_header, [200] * calc_length) solarcal_obj = IndoorSolarCal(Location(), dir_norm, diff_horiz, 24) assert solarcal_obj.comfort_model == 'Indoor SolarCal' assert solarcal_obj.calc_length == calc_length str(solarcal_obj) # test that the string representaiton is ok assert isinstance(solarcal_obj.direct_normal_solar, HourlyContinuousCollection) assert len(solarcal_obj.direct_normal_solar.values) == calc_length assert solarcal_obj.direct_normal_solar[12] == 500 assert isinstance(solarcal_obj.diffuse_horizontal_solar, HourlyContinuousCollection) assert len(solarcal_obj.diffuse_horizontal_solar.values) == calc_length assert solarcal_obj.diffuse_horizontal_solar[12] == 200 assert isinstance(solarcal_obj.effective_radiant_field, HourlyContinuousCollection) assert len(solarcal_obj.effective_radiant_field.values) == calc_length assert solarcal_obj.effective_radiant_field[12] == pytest.approx(54.9228, rel=1e-3) assert isinstance(solarcal_obj.mrt_delta, HourlyContinuousCollection) assert len(solarcal_obj.mrt_delta.values) == calc_length assert solarcal_obj.mrt_delta[12] == pytest.approx(12.600738, rel=1e-3) assert isinstance(solarcal_obj.mean_radiant_temperature, HourlyContinuousCollection) assert len(solarcal_obj.mean_radiant_temperature.values) == calc_length assert solarcal_obj.mean_radiant_temperature[12] == pytest.approx( 36.600738, rel=1e-3)
def test_indoor_solarcal_collection_full_input(): """Test the initialization of the IndoorSolarCal collection will all inputs.""" calc_length = 24 irr_header = Header(Irradiance(), 'W/m2', AnalysisPeriod(end_month=1, end_day=1)) dir_norm = HourlyContinuousCollection(irr_header, [500] * calc_length) diff_horiz = HourlyContinuousCollection(irr_header, [200] * calc_length) custom_par = SolarCalParameter('seated', None, 45, 0.65, 0.97) solarcal_obj = IndoorSolarCal(Location(), dir_norm, diff_horiz, 24, 0.6, 0.4, 0.35, 0.7, custom_par) assert solarcal_obj.fraction_body_exposed[12] == 0.6 assert solarcal_obj.sky_exposure[12] == 0.4 assert solarcal_obj.floor_reflectance[0] == 0.35 assert solarcal_obj.window_transmittance[0] == 0.7 assert solarcal_obj.solarcal_body_parameter.posture == 'seated' assert solarcal_obj.solarcal_body_parameter.sharp is None assert solarcal_obj.solarcal_body_parameter.body_azimuth == 45 assert solarcal_obj.solarcal_body_parameter.body_absorptivity == 0.65 assert solarcal_obj.solarcal_body_parameter.body_emissivity == 0.97
dmrt: Data collection of mean radiant temperature delta in C. mrt: Data collection of mean radiant temperature in C. """ ghenv.Component.Name = 'LB Indoor Solar MRT' ghenv.Component.NickName = 'IndoorSolarMRT' ghenv.Component.Message = '1.5.0' ghenv.Component.Category = 'Ladybug' ghenv.Component.SubCategory = '1 :: Analyze Data' ghenv.Component.AdditionalHelpFromDocStrings = '6' try: from ladybug_comfort.collection.solarcal import IndoorSolarCal except ImportError as e: raise ImportError('\nFailed to import ladybug:\n\t{}'.format(e)) try: from ladybug_rhino.grasshopper import all_required_inputs except ImportError as e: raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e)) if all_required_inputs(ghenv.Component) and _run is True: sky_exposure_ = 0.5 if sky_exposure_ is None else sky_exposure_ solar_mrt_obj = IndoorSolarCal(_location, _dir_norm_rad, _diff_horiz_rad, _longwave_mrt, fract_body_exp_, sky_exposure_, _ground_ref_, _window_trans_, _solar_body_par_) erf = solar_mrt_obj.effective_radiant_field dmrt = solar_mrt_obj.mrt_delta mrt = solar_mrt_obj.mean_radiant_temperature