def test_clean_and_id_string(): """Test the clean_and_id_string method.""" correct_str = '0.5 in. Gypsum Wall' incorrect_str = '0.5 in., Gypsum Wall' long_str = 'This is an exceptionally long text string that should never be used ' \ 'for the name of anything in EnergyPlus for whatever reason' assert clean_and_id_string(correct_str).startswith('0.5in.GypsumWall') assert clean_and_id_string(incorrect_str).startswith('0.5in.GypsumWall') assert len(clean_and_id_string(long_str)) < 70
raise ValueError( 'conditioned_ has been specified but dragonfly-energy ' 'has failed to import.\n{}'.format(e)) if all_required_inputs(ghenv.Component): room2d = [] # list of room2ds that will be returned face3ds = [face for geo in _geo for face in to_face3d(geo)] # convert to lb geo for i, geo in enumerate(face3ds): # get the name for the Room2D if len(_name_) == 0: # make a default Room2D name display_name = 'Room_{}'.format(document_counter('room_count')) else: display_name = '{}_{}'.format(longest_list(_name_, i), i + 1) \ if len(_name_) != len(face3ds) else longest_list(_name_, i) name = clean_and_id_string(display_name) # create the Room2D room = Room2D(name, geo, longest_list(_flr_to_ceiling, i), tolerance=tolerance) room.display_name = display_name # assign the program if len(_program_) != 0: program = longest_list(_program_, i) if isinstance(program, str): program = program_type_by_identifier(program) room.properties.energy.program_type = program else: # generic office program by default
raise ValueError( 'ep_trans_sch_ has been specified but honeybee-energy ' 'has failed to import.\n{}'.format(e)) try: # import the honeybee-radiance extension from honeybee_radiance.lib.modifiers import modifier_by_identifier except ImportError as e: if len(rad_mod_) != 0: raise ValueError('rad_mod_ has been specified but honeybee-radiance ' 'has failed to import.\n{}'.format(e)) if all_required_inputs(ghenv.Component): shades = [] # list of shades that will be returned for j, geo in enumerate(_geo): if len(_name_) == 0: # make a default Shade name name = display_name = clean_and_id_string('Shade') else: display_name = '{}_{}'.format(longest_list(_name_, j), j + 1) \ if len(_name_) != len(_geo) else longest_list(_name_, j) name = clean_and_id_string(display_name) is_detached = not longest_list(attached_, j) if len(attached_) != 0 else True lb_faces = to_face3d(geo) for i, lb_face in enumerate(lb_faces): shd_name = '{}_{}'.format(name, i) if len(lb_faces) > 1 else name hb_shd = Shade(shd_name, lb_face, is_detached) hb_shd.display_name = display_name # try to assign the energyplus construction if len(ep_constr_) != 0:
if len(ep_constr_) != 0: raise ValueError('ep_constr_ has been specified but honeybee-energy ' 'has failed to import.\n{}'.format(e)) try: # import the honeybee-radiance extension from honeybee_radiance.lib.modifiers import modifier_by_identifier except ImportError as e: if len(rad_mod_) != 0: raise ValueError('rad_mod_ has been specified but honeybee-radiance ' 'has failed to import.\n{}'.format(e)) if all_required_inputs(ghenv.Component): doors = [] # list of doors that will be returned for j, geo in enumerate(_geo): if len(_name_) == 0: # make a default Door name name = display_name = clean_and_id_string('Door') else: display_name = '{}_{}'.format(longest_list(_name_, j), j + 1) \ if len(_name_) != len(_geo) else longest_list(_name_, j) name = clean_and_id_string(display_name) glass = longest_list(glass_, j) if len(glass_) != 0 else False lb_faces = to_face3d(geo) for i, lb_face in enumerate(lb_faces): dr_name = '{}_{}'.format(name, i) if len(lb_faces) > 1 else name hb_dr = Door(dr_name, lb_face, is_glass=glass) hb_dr.display_name = display_name # try to assign the energyplus construction if len(ep_constr_) != 0: ep_constr = longest_list(ep_constr_, j)
if len(ep_constr_) != 0: raise ValueError('ep_constr_ has been specified but honeybee-energy ' 'has failed to import.\n{}'.format(e)) try: # import the honeybee-radiance extension from honeybee_radiance.lib.modifiers import modifier_by_identifier except ImportError as e: if len(rad_mod_) != 0: raise ValueError('rad_mod_ has been specified but honeybee-radiance ' 'has failed to import.\n{}'.format(e)) if all_required_inputs(ghenv.Component): faces = [] # list of faces that will be returned for j, geo in enumerate(_geo): if len(_name_) == 0: # make a default Face name name = display_name = clean_and_id_string('Face') else: display_name = '{}_{}'.format(longest_list(_name_, j), j + 1) \ if len(_name_) != len(_geo) else longest_list(_name_, j) name = clean_and_id_string(display_name) typ = longest_list(_type_, j) if len(_type_) != 0 else None bc = longest_list(_bc_, j) if len(_bc_) != 0 else None if typ is not None and typ not in face_types: typ = face_types.by_name(typ) if bc is not None and bc not in boundary_conditions: bc = boundary_conditions.by_name(bc) lb_faces = to_face3d(geo) for i, lb_face in enumerate(lb_faces): face_name = '{}_{}'.format(name, i) if len(lb_faces) > 1 else name hb_face = Face(face_name, lb_face, typ, bc)
raise ValueError('ep_constr_ has been specified but honeybee-energy ' 'has failed to import.\n{}'.format(e)) try: # import the honeybee-radiance extension from honeybee_radiance.lib.modifiers import modifier_by_identifier except ImportError as e: if len(rad_mod_) != 0: raise ValueError('rad_mod_ has been specified but honeybee-radiance ' 'has failed to import.\n{}'.format(e)) if all_required_inputs(ghenv.Component): apertures = [] # list of apertures that will be returned for j, geo in enumerate(_geo): if len(_name_) == 0: # make a default Aperture name name = display_name = clean_and_id_string('Aperture') else: display_name = '{}_{}'.format(longest_list(_name_, j), j + 1) \ if len(_name_) != len(_geo) else longest_list(_name_, j) name = clean_and_id_string(display_name) operable = longest_list(operable_, j) if len(operable_) != 0 else False lb_faces = to_face3d(geo) for i, lb_face in enumerate(lb_faces): ap_name = '{}_{}'.format(name, i) if len(lb_faces) > 1 else name hb_ap = Aperture(ap_name, lb_face, is_operable=operable) hb_ap.display_name = display_name # try to assign the energyplus construction if len(ep_constr_) != 0: ep_constr = longest_list(ep_constr_, j)