def test_ptac_equality(): """Test the equality of PTAC objects.""" hvac_sys = PTAC('Test System') hvac_sys_dup = hvac_sys.duplicate() hvac_sys_alt = PTAC('Test System', equipment_type='PTAC_DHW') assert hvac_sys is hvac_sys assert hvac_sys is not hvac_sys_dup assert hvac_sys == hvac_sys_dup hvac_sys_dup.equipment_type = 'PTAC_GasCoil' assert hvac_sys != hvac_sys_dup assert hvac_sys != hvac_sys_alt
def test_ptac_dict_methods(): """Test the to/from dict methods.""" hvac_sys = PTAC('High Efficiency HVAC System') hvac_sys.vintage = 'ASHRAE_2010' hvac_sys.equipment_type = 'PTAC_DHW' hvac_dict = hvac_sys.to_dict() new_hvac_sys = PTAC.from_dict(hvac_dict) assert new_hvac_sys == hvac_sys assert hvac_dict == new_hvac_sys.to_dict()
def test_ptac_init(): """Test the initialization of PTAC and basic properties.""" hvac_sys = PTAC('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 == 'PTAC_ElectricBaseboard' 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 = 'PTAC_DHW' with pytest.raises(AssertionError): hvac_sys.economizer_type = 'DifferentialDryBulb' with pytest.raises(AssertionError): hvac_sys.sensible_heat_recovery = 0.8 with pytest.raises(AssertionError): hvac_sys.latent_heat_recovery = 0.65 assert hvac_sys.vintage == 'ASHRAE_2010' assert hvac_sys.equipment_type == 'PTAC_DHW'
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)