def test_check_duplicate_schedule_type_limit_names(): """Test the check_duplicate_schedule_type_limit_names method.""" room = Room.from_box('Tiny House Zone', 5, 10, 3) room.properties.energy.program_type = office_program room.properties.energy.hvac = IdealAirSystem() south_face = room[3] south_face.apertures_by_ratio(0.4, 0.01) south_face.apertures[0].overhang(0.5, indoor=False) south_face.apertures[0].overhang(0.5, indoor=True) south_face.apertures[0].move_shades(Vector3D(0, 0, -0.5)) fritted_glass_trans = ScheduleRuleset.from_constant_value( 'Fritted Glass', 0.6, schedule_types.fractional) on_off = ScheduleTypeLimit('On-off', 0, 1, 'Discrete') full_occ = ScheduleRuleset.from_constant_value('Occupied', 1, on_off) south_face.apertures[0].outdoor_shades[0].properties.energy.transmittance_schedule = \ fritted_glass_trans room.properties.energy.people = People('Office Occ', 0.05, full_occ) model = Model('Tiny House', [room]) assert model.properties.energy.check_duplicate_schedule_type_limit_names( False) full_occ.unlock() new_sch_type = ScheduleTypeLimit('Fractional', 0, 1, 'Discrete') full_occ.schedule_type_limit = new_sch_type full_occ.lock() assert not model.properties.energy.check_duplicate_schedule_type_limit_names( False) with pytest.raises(ValueError): model.properties.energy.check_duplicate_schedule_type_limit_names(True)
def test_schedule_typelimit_equality(): """Test the equality of ScheduleTypeLimit objects.""" fractional = ScheduleTypeLimit('Fractional', 0, 1, 'Continuous', 'Dimensionless') fract_dup = fractional.duplicate() temperature = ScheduleTypeLimit('Temperature', -273.15, None, 'Continuous', 'Temperature') assert fractional == fract_dup assert fractional != temperature
def scheduletypelimit_temperature(directory): temperature = ScheduleTypeLimit('Temperature', -273.15, None, 'Continuous', 'Temperature') dest_file = os.path.join(directory, 'scheduletypelimit_temperature.json') with open(dest_file, 'w') as fp: json.dump(temperature.to_dict(), fp, indent=4)
def test_schedule_ruleset_dict_methods(): """Test the ScheduleRuleset to/from dict methods.""" temperature = ScheduleTypeLimit('Temperature', -273.15, None, 'Continuous', 'Temperature') temp_dict = temperature.to_dict() new_temperature = ScheduleTypeLimit.from_dict(temp_dict) assert new_temperature == temperature assert temp_dict == new_temperature.to_dict() """
def test_schedule_typelimit_to_from_idf(): """Test the ScheduleTypeLimit to_idf and from_idf methods.""" temperature = ScheduleTypeLimit('Temperature', -273.15, None, 'Continuous', 'Temperature') temp_string = temperature.to_idf() rebuilt_temperature = ScheduleTypeLimit.from_idf(temp_string) rebuilt_temp_string = rebuilt_temperature.to_idf() assert rebuilt_temperature == temperature assert rebuilt_temp_string == temp_string
def test_schedule_typelimit_init(): """Test the initialization of ScheduleTypeLimit and basic properties.""" fractional = ScheduleTypeLimit('Fractional', 0, 1, 'Continuous', 'Dimensionless') str(fractional) # test the string representation assert fractional.name == 'Fractional' assert fractional.lower_limit == 0 assert fractional.upper_limit == 1 assert fractional.numeric_type == 'Continuous' assert fractional.unit_type == 'Dimensionless' assert isinstance(fractional.data_type, fraction.Fraction) assert fractional.unit == 'fraction'
Returns: report: Reports, errors, warnings, etc. type_limit: A ScheduleTypeLimit object that can be assigned to any schedule object. """ ghenv.Component.Name = "HB Type Limit" ghenv.Component.NickName = 'TypeLimit' ghenv.Component.Message = '0.1.1' ghenv.Component.Category = 'HB-Energy' ghenv.Component.SubCategory = '2 :: Schedules' ghenv.Component.AdditionalHelpFromDocStrings = "0" try: # import the honeybee-energy dependencies from honeybee_energy.schedule.typelimit import ScheduleTypeLimit except ImportError as e: raise ImportError('\nFailed to import honeybee_energy:\n\t{}'.format(e)) try: # import ladybug_rhino dependencies from ladybug_rhino.grasshopper import all_required_inputs except ImportError as e: raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e)) if all_required_inputs(ghenv.Component): # set default values numeric_type = 'Discrete' if discrete_ else 'Continuous' _unit_type_ = 'Dimensionless' if _unit_type_ is None else _unit_type_ # create the ScheduleTypeLimit type_limit = ScheduleTypeLimit(_name, low_limit_, up_limit_, numeric_type, _unit_type_)
'activity_level': ('Activity Level', 0, None, 'Continuous', 'ActivityLevel'), 'power': ('Power', None, None, 'Continuous', 'Power'), 'humidity': ('Humidity', 0, 100, 'Continuous', 'Percent'), 'angle': ('Angle', 0, 180, 'Continuous', 'Angle'), 'delta_temperature': ('Delta Temperature', None, None, 'Continuous', 'DeltaTemperature'), 'percent': ('Percent', 0, 100, 'Continuous', 'Percent') } # establish variables for the default schedule types used across the library # and auto-generate materials if they were not loaded from default.idf try: fractional = _idf_schedule_type_limits['Fractional'] except KeyError: fractional = ScheduleTypeLimit(*_default_prop['fractional']) _idf_schedule_type_limits['Fractional'] = fractional try: on_off = _idf_schedule_type_limits['On-Off'] except KeyError: on_off = ScheduleTypeLimit(*_default_prop['on_off']) _idf_schedule_type_limits['On-Off'] = on_off try: temperature = _idf_schedule_type_limits['Temperature'] except KeyError: temperature = ScheduleTypeLimit(*_default_prop['temperature']) _idf_schedule_type_limits['Temperature'] = temperature try: