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()