def test_pvav_equality(): """Test the equality of PVAV objects.""" hvac_sys = PVAV('Test System') hvac_sys_dup = hvac_sys.duplicate() hvac_sys_alt = PVAV('Test System', sensible_heat_recovery=0.75, latent_heat_recovery=0.6) assert hvac_sys is hvac_sys assert hvac_sys is not hvac_sys_dup assert hvac_sys == hvac_sys_dup hvac_sys_dup.sensible_heat_recovery = 0.6 assert hvac_sys != hvac_sys_dup assert hvac_sys != hvac_sys_alt
def test_pvav_multi_room(): """Test that PVAV systems can be assigned to multiple Rooms.""" first_floor = Room.from_box('First_Floor', 10, 10, 3, origin=Point3D(0, 0, 0)) second_floor = Room.from_box('Second_Floor', 10, 10, 3, origin=Point3D(0, 0, 3)) hvac_sys = PVAV('Test System') first_floor.properties.energy.hvac = hvac_sys second_floor.properties.energy.hvac = hvac_sys model = Model('Test_Bldg', [first_floor, second_floor]) hvacs = model.properties.energy.hvacs assert len(hvacs) == 1 assert hvacs[0] == hvac_sys model_dict = model.to_dict() assert len(model_dict['properties']['energy']['hvacs']) == 1 assert model_dict['rooms'][0]['properties']['energy'][ 'hvac'] == hvac_sys.identifier
def test_pvav_dict_methods(): """Test the to/from dict methods.""" hvac_sys = PVAV('High Efficiency HVAC System') hvac_sys.vintage = 'ASHRAE_2010' hvac_sys.equipment_type = 'PVAV_DHW' hvac_sys.economizer_type = 'DifferentialDryBulb' hvac_sys.sensible_heat_recovery = 0.8 hvac_sys.latent_heat_recovery = 0.65 hvac_dict = hvac_sys.to_dict() new_hvac_sys = PVAV.from_dict(hvac_dict) assert new_hvac_sys == hvac_sys assert hvac_dict == new_hvac_sys.to_dict()
def test_pvav_init(): """Test the initialization of PVAV and basic properties.""" hvac_sys = PVAV('Test System') str(hvac_sys) # test the string representation assert hvac_sys.identifier == 'Test System' assert hvac_sys.vintage == 'ASHRAE_2019' assert hvac_sys.equipment_type == 'PVAV_Boiler' assert hvac_sys.economizer_type == 'NoEconomizer' assert hvac_sys.sensible_heat_recovery == 0 assert hvac_sys.latent_heat_recovery == 0 hvac_sys.vintage = 'ASHRAE_2010' hvac_sys.equipment_type = 'PVAV_DHW' hvac_sys.economizer_type = 'DifferentialDryBulb' hvac_sys.sensible_heat_recovery = 0.8 hvac_sys.latent_heat_recovery = 0.65 assert hvac_sys.vintage == 'ASHRAE_2010' assert hvac_sys.equipment_type == 'PVAV_DHW' assert hvac_sys.economizer_type == 'DifferentialDryBulb' assert hvac_sys.sensible_heat_recovery == 0.8 assert hvac_sys.latent_heat_recovery == 0.65
def hvac_2004(model_json, climate_zone, nonresidential, fuel, floor_area, story_count, output_file): """Convert a Model's HVAC to be conformant with ASHRAE 90.1-2004 appendix G. This includes the selection of the correct Appendix G template HVAC based on the inputs and the application of this HVAC to all conditioned spaces in the model. \b Args: model_json: Full path to a Model JSON file. climate_zone: Text indicating the ASHRAE climate zone. This can be a single integer (in which case it is interpreted as A) or it can include the A, B, or C qualifier (eg. 3C). """ try: # re-serialize the Model to Python and get the glazing ratios with open(model_json) as json_file: data = json.load(json_file) model = Model.from_dict(data) # determine the HVAC template from the input criteria std = 'ASHRAE_2004' if len(climate_zone) == 1: climate_zone = '{}A'.format(climate_zone) if nonresidential: # determine the floor area if it is not input if floor_area == 0 or floor_area is None: floor_area = model.floor_area floor_area = floor_area if model.units == 'Meters' else \ floor_area * model.conversion_factor_to_meters(model.units) # determine the number of stories if it is not input if story_count == 0 or story_count is None: story_count = len(model.stories) # determine the HVAC from the floor area and stories hvac_id = 'Baseline 2004 {} HVAC' if story_count > 5 or floor_area > 13935.5: # more than 150,000 ft2 hvac_id = hvac_id.format('VAV') hvac_sys = VAV(hvac_id, std, 'VAV_Chiller_Boiler') \ if fuel else VAV(hvac_id, std, 'VAV_Chiller_PFP') elif story_count > 3 or floor_area > 6967.7: # more than 75,000 ft2 hvac_id = hvac_id.format('PVAV') hvac_sys = PVAV(hvac_id, std, 'PVAV_Boiler') \ if fuel else PVAV(hvac_id, std, 'PVAV_PFP') else: hvac_id = hvac_id.format('PSZ') hvac_sys = PSZ(hvac_id, std, 'PSZAC_Boiler') \ if fuel else PSZ(hvac_id, std, 'PSZHP') if climate_zone not in ('1A', '1B', '2A', '3A', '4A'): hvac_sys.economizer_type = 'DifferentialDryBulb' else: hvac_id = 'Baseline 2004 PT Residential HVAC' hvac_sys = PTAC(hvac_id, std, 'PTAC_BoilerBaseboard') \ if fuel else PTAC(hvac_id, std, 'PTHP') # apply the HVAC template to all conditioned rooms in the model for room in model.rooms: if room.properties.energy.is_conditioned: room.properties.energy.hvac = hvac_sys # write the Model JSON string output_file.write(json.dumps(model.to_dict())) except Exception as e: _logger.exception( 'Model baseline geometry creation failed.\n{}'.format(e)) sys.exit(1) else: sys.exit(0)