def test_ideal_air_system_setability(): """Test the setting of properties of IdealAirSystem.""" ideal_air = IdealAirSystem('Test System') ideal_air.identifier = 'Test System2' assert ideal_air.identifier == 'Test System2' ideal_air.economizer_type = 'DifferentialEnthalpy' assert ideal_air.economizer_type == 'DifferentialEnthalpy' ideal_air.sensible_heat_recovery = 0.75 assert ideal_air.sensible_heat_recovery == 0.75 ideal_air.latent_heat_recovery = 0.65 assert ideal_air.latent_heat_recovery == 0.65 ideal_air.heating_air_temperature = 40 assert ideal_air.heating_air_temperature == 40 ideal_air.cooling_air_temperature = 15 assert ideal_air.cooling_air_temperature == 15 ideal_air.heating_limit = 1000 assert ideal_air.heating_limit == 1000 ideal_air.cooling_limit = 2000 assert ideal_air.cooling_limit == 2000 sch_day = ScheduleDay( 'Day Control', [0, 1, 0], [Time(0, 0), Time(8, 0), Time(22, 0)]) schedule = ScheduleRuleset('HVAC Control', sch_day, None, schedule_types.on_off) ideal_air.heating_availability = schedule assert ideal_air.heating_availability == schedule ideal_air.cooling_availability = schedule assert ideal_air.cooling_availability == schedule
def test_ideal_air_to_dict(): """Test the to_dict method.""" ideal_air = IdealAirSystem('Passive House HVAC System') ideal_air.economizer_type = 'DifferentialEnthalpy' ideal_air.demand_controlled_ventilation = True ideal_air.sensible_heat_recovery = 0.75 ideal_air.latent_heat_recovery = 0.6 ideal_air.heating_air_temperature = 40 ideal_air.cooling_air_temperature = 15 ideal_air.heating_limit = 2000 ideal_air.cooling_limit = 3500 sch_day = ScheduleDay( 'Day Control', [0, 1, 0], [Time(0, 0), Time(8, 0), Time(22, 0)]) schedule = ScheduleRuleset('HVAC Control', sch_day, None, schedule_types.on_off) ideal_air.heating_availability = schedule ideal_air.cooling_availability = schedule ideal_air_dict = ideal_air.to_dict(abridged=True) assert ideal_air_dict['economizer_type'] == 'DifferentialEnthalpy' assert ideal_air_dict['demand_controlled_ventilation'] == True assert ideal_air_dict['sensible_heat_recovery'] == 0.75 assert ideal_air_dict['latent_heat_recovery'] == 0.6 assert ideal_air_dict['heating_air_temperature'] == 40 assert ideal_air_dict['cooling_air_temperature'] == 15 assert ideal_air_dict['heating_limit'] == 2000 assert ideal_air_dict['cooling_limit'] == 3500 assert ideal_air_dict['heating_availability'] == 'HVAC Control' assert ideal_air_dict['cooling_availability'] == 'HVAC Control'
def ideal_air_detailed(directory): ideal_air = IdealAirSystem('Passive House HVAC System') ideal_air.economizer_type = 'DifferentialEnthalpy' ideal_air.demand_controlled_ventilation = True ideal_air.sensible_heat_recovery = 0.75 ideal_air.latent_heat_recovery = 0.6 ideal_air.heating_air_temperature = 40 ideal_air.cooling_air_temperature = 15 ideal_air.heating_limit = 2000 ideal_air.cooling_limit = 3500 sch_day = ScheduleDay( 'Day Control', [0, 1, 0], [Time(0, 0), Time(8, 0), Time(22, 0)]) schedule = ScheduleRuleset('HVAC Control', sch_day, None, schedule_types.on_off) ideal_air.heating_availability = schedule ideal_air.cooling_availability = schedule dest_file = os.path.join(directory, 'ideal_air_detailed.json') with open(dest_file, 'w') as fp: json.dump(ideal_air.to_dict(abridged=True), fp, indent=4)
def test_ideal_air_dict_methods(): """Test the to/from dict methods.""" ideal_air = IdealAirSystem('Passive House HVAC System') ideal_air.economizer_type = 'DifferentialEnthalpy' ideal_air.demand_controlled_ventilation = True ideal_air.sensible_heat_recovery = 0.75 ideal_air.latent_heat_recovery = 0.6 ideal_air.heating_air_temperature = 40 ideal_air.cooling_air_temperature = 15 ideal_air.heating_limit = 2000 ideal_air.cooling_limit = 3500 sch_day = ScheduleDay( 'Day Control', [0, 1, 0], [Time(0, 0), Time(8, 0), Time(22, 0)]) schedule = ScheduleRuleset('HVAC Control', sch_day, None, schedule_types.on_off) ideal_air.heating_availability = schedule ideal_air.cooling_availability = schedule hvac_dict = ideal_air.to_dict() new_ideal_air = IdealAirSystem.from_dict(hvac_dict) assert new_ideal_air == ideal_air assert hvac_dict == new_ideal_air.to_dict()