def from_dict(cls, data): """Create a HVAC object from a dictionary. Args: data: A DOAS dictionary in following the format below. .. code-block:: python { "type": "", # text for the class name of the HVAC "identifier": "Classroom1_System", # identifier for the HVAC "display_name": "Standard System", # name for the HVAC "vintage": "ASHRAE_2013", # text for the vintage of the template "equipment_type": "", # text for the HVAC equipment type "sensible_heat_recovery": 0.75, # Sensible heat recovery effectiveness "latent_heat_recovery": 0.7, # Latent heat recovery effectiveness } """ assert data['type'] == cls.__name__, \ 'Expected {} dictionary. Got {}.'.format(cls.__name__, data['type']) # extract the key features and properties of the HVAC sensible = data['sensible_heat_recovery'] if \ 'sensible_heat_recovery' in data else None sensible = sensible if sensible != autosize.to_dict() else autosize latent = data['latent_heat_recovery'] if \ 'latent_heat_recovery' in data else None latent = latent if latent != autosize.to_dict() else autosize new_obj = cls(data['identifier'], data['vintage'], data['equipment_type'], sensible, latent) if 'display_name' in data and data['display_name'] is not None: new_obj.display_name = data['display_name'] return new_obj
def _properties_from_dict(data): """Extract basic properties from a dictionary and assign defaults.""" # extract the key features of the HVAC econ = data['economizer_type'] if 'economizer_type' in data and \ data['economizer_type'] is not None else 'DifferentialDryBulb' dcv = data['demand_controlled_ventilation'] if \ 'demand_controlled_ventilation' in data else False sensible = data['sensible_heat_recovery'] if \ 'sensible_heat_recovery' in data else 0 latent = data['latent_heat_recovery'] if \ 'latent_heat_recovery' in data else 0 # extract the heating and cooling temperature heat_temp = data['heating_air_temperature'] if \ 'heating_air_temperature' in data else 50 cool_temp = data['cooling_air_temperature'] if \ 'cooling_air_temperature' in data else 13 # extract the heating and cooling limits if 'heating_limit' not in data or data['heating_limit'] == autosize.to_dict(): heat_limit = autosize else: heat_limit = no_limit if data['heating_limit'] == no_limit.to_dict() \ else data['heating_limit'] if 'cooling_limit' not in data or data['cooling_limit'] == autosize.to_dict(): cool_limit = autosize else: cool_limit = no_limit if data['cooling_limit'] == no_limit.to_dict() \ else data['cooling_limit'] return econ, dcv, sensible, latent, heat_temp, cool_temp, heat_limit, cool_limit
def _properties_from_dict(data): """Extract basic properties from a dictionary and assign defaults.""" sensible = data['sensible_heat_recovery'] if \ 'sensible_heat_recovery' in data else 0 sensible = sensible if sensible != autosize.to_dict() else 0 latent = data['latent_heat_recovery'] if \ 'latent_heat_recovery' in data else 0 latent = latent if latent != autosize.to_dict() else 0 dcv = data['demand_controlled_ventilation'] \ if 'demand_controlled_ventilation' in data else False return sensible, latent, dcv