def heating_limit(self, value): if value is None: self._heating_limit = None elif isinstance(value, str) and value.lower() == 'autosize': self._heating_limit = 'autosize' else: self._heating_limit = float_positive(value, 'ideal air heating limit')
def __init__(self, identifier, economizer_type='DifferentialDryBulb', demand_controlled_ventilation=False, sensible_heat_recovery=0, latent_heat_recovery=0, heating_air_temperature=50, cooling_air_temperature=13, heating_limit=autosize, cooling_limit=autosize, heating_availability=None, cooling_availability=None): """Initialize IdealAirSystem.""" # initialize base HVAC system properties _HVACSystem.__init__(self, identifier) # set the main features of the HVAC system self.economizer_type = economizer_type self.demand_controlled_ventilation = demand_controlled_ventilation self.sensible_heat_recovery = sensible_heat_recovery self.latent_heat_recovery = latent_heat_recovery # set the options affecting heating and cooling # set heating_air_temperature without the setter to ensure > cooling check works self._heating_air_temperature = \ float_positive(heating_air_temperature, 'ideal air heating air temperature') self.cooling_air_temperature = cooling_air_temperature self.heating_limit = heating_limit self.cooling_limit = cooling_limit self.heating_availability = heating_availability self.cooling_availability = cooling_availability
def heating_limit(self, value): if value == autosize or value is None: self._heating_limit = autosize elif value == no_limit: self._heating_limit = no_limit else: self._heating_limit = float_positive(value, 'ideal air heating limit')
def cooling_limit(self, value): if value == autosize or value is None: self._cooling_limit = autosize elif value == no_limit: assert self.economizer_type == 'NoEconomizer', 'Ideal air system ' \ 'economizer_type must be "NoEconomizer" to have no cooling limit.' self._cooling_limit = no_limit else: self._cooling_limit = float_positive(value, 'ideal air cooling limit')
def cooling_limit(self, value): if value is None: # assert self.economizer_type == 'NoEconomizer', 'Ideal air system ' \ # 'economizer_type must be "NoEconomizer" to have no cooling limit.' self._cooling_limit = None elif isinstance(value, str) and value.lower() == 'autosize': self._cooling_limit = 'autosize' else: self._cooling_limit = float_positive(value, 'ideal air cooling limit')
def __init__(self, distance, depth, offset=0, angle=0, contour_vector=Vector2D(0, 1), flip_start_side=False): """Initialize LouversByDistance.""" self._distance = float_positive(distance, 'louver separation distance') _LouversBase.__init__(self, depth, offset, angle, contour_vector, flip_start_side)
def test_float_positive(): """Test the float_positive method.""" assert isinstance(float_positive(2.0), float) assert isinstance(float_positive(2), float) assert isinstance(float_positive('2'), float) with pytest.raises(AssertionError): assert isinstance(float_positive(-2), float) with pytest.raises(TypeError): assert isinstance(float_positive('two'), float) with pytest.raises(TypeError): assert isinstance(float_positive([2]), float) try: float_positive(-2, 'test number') except AssertionError as e: assert 'test number' in str(e)
def area_per_person(self, value): if float(value) != 0: self._people_per_area = 1 / float_positive(value, 'area per person') else: self._people_per_area = 0
def floor_area(self, value): self._floor_area = float_positive(value)
def r_factor(self, r_fac): self._u_factor = 1 / float_positive(r_fac, 'glazing material r-factor')
def u_value(self, u_val): self.r_value = 1 / float_positive(u_val, 'glazing material u-value')
def conductivity(self, cond): self._conductivity = float_positive(cond, 'glazing material conductivity')
def low_voltage(self, value): self._low_voltage = float_positive(value, 'low voltage')
def high_voltage(self, value): self._high_voltage = float_positive(value, 'high voltage')
def reactance(self, value): self._reactance = float_positive(value, 'reactance')
def velocity_coefficient(self, value): self._velocity_coefficient = float_positive( value, 'infiltration velocity coefficient')
def flow_per_exterior_area(self, value): self._flow_per_exterior_area = float_positive( value, 'infiltration flow per area')
def air_mixing_per_area(self, value): self._air_mixing_per_area = float_positive(value, 'air mixing per area')
def thickness(self, thick): self._thickness = float_positive(thick, 'glazing material thickness')
def radius_end(self, value): self._radius_end = typing.float_positive(value)
def resistivity(self, resis): self._conductivity = 1 / float_positive( resis, 'glazing material resistivity')
def radius_start(self, value): self._radius_start = typing.float_positive(value)
def r_value(self, r_val): self._conductivity = self.thickness / \ float_positive(r_val, 'glazing material r-value')
def flow_per_area(self, value): self._flow_per_area = float_positive(value, 'hot water flow per area')
def b_emittance(self, value): self._b_emittance = typing.float_positive(value)
def floor_to_floor_height(self, value): if value is None: ciel_hgt = max([room.ceiling_height for room in self._room_2ds]) value = ciel_hgt - self.floor_height self._floor_to_floor_height = float_positive(value, 'floor-to-floor height')
def people_per_area(self, value): self._people_per_area = float_positive(value, 'people per area')
def constant_coefficient(self, value): self._constant_coefficient = float_positive( value, 'infiltration constant coefficient')
def radius_inner(self, value): self._radius_inner = typing.float_positive(value)
def temperature_coefficient(self, value): self._temperature_coefficient = float_positive( value, 'infiltration temperature coefficient')