honeybee_openstudio.writer module¶
Methods to write Honeybee Models to OpenStudio.
- honeybee_openstudio.writer.aperture_to_openstudio(aperture, os_model)[source]¶
Create an OpenStudio object from an Aperture.
- Parameters:
aperture – A honeybee Aperture for which an OpenStudio object will be returned.
os_model – The OpenStudio Model object to which the Aperture will be added.
- Returns:
An OpenStudio SubSurface object if the Aperture has a parent. An OpenStudio ShadingSurface object if the Aperture has no parent.
- honeybee_openstudio.writer.door_to_openstudio(door, os_model)[source]¶
Create an OpenStudio object from a Door.
- Parameters:
door – A honeybee Door for which an OpenStudio object will be returned.
os_model – The OpenStudio Model object to which the Door will be added.
- Returns:
An OpenStudio SubSurface object if the Door has a parent. An OpenStudio ShadingSurface object if the Door has no parent.
- honeybee_openstudio.writer.face_3d_to_openstudio(face_3d)[source]¶
Convert a Face3D into an OpenStudio Point3dVector.
- Parameters:
face_3d – A ladybug-geometry Face3D object for which an OpenStudio Point3dVector string will be generated.
- Returns:
An OpenStudio Point3dVector to be used to construct geometry objects.
- honeybee_openstudio.writer.face_to_openstudio(face, os_model, adj_map=None, ignore_complex_sub_faces=True)[source]¶
Create an OpenStudio object from a Face.
This method also adds all Apertures, Doors, and Shades assigned to the Face.
- Parameters:
face – A honeybee Face for which an OpenStudio object will be returned.
os_model – The OpenStudio Model object to which the Face will be added.
adj_map – An optional dictionary with keys for ‘faces’ and ‘sub_faces’ that will have the space Surfaces and SubSurfaces added to it such that adjacencies can be assigned after running this method.
ignore_complex_sub_faces – Boolean for whether sub-faces (including Apertures and Doors) should be ignored if they have more than 4 sides (True) or whether they should be left as they are (False). (Default: True).
- Returns:
An OpenStudio Surface object if the Face has a parent. An OpenStudio ShadingSurface object if the Face has no parent.
- honeybee_openstudio.writer.model_to_gbxml(model, triangulate_non_planar_orphaned=True, triangulate_subfaces=False, full_geometry=False, interior_face_type=None, ground_face_type=None, print_progress=False)[source]¶
Translate a Honeybee Model to gbXML string using OpenStudio SDK translators.
- Parameters:
model – The Honeybee Model to be converted into an OpenStudio Model.
triangulate_non_planar_orphaned – Boolean to note whether any non-planar orphaned geometry in the model should be triangulated. This can be helpful because OpenStudio simply raises an error when it encounters non-planar geometry, which would hinder the ability to save files that are to be corrected later. (Default: False).
triangulate_subfaces – Boolean to note whether sub-faces (including Apertures and Doors) should be triangulated if they have more than 4 sides (True) or whether they should be left as they are (False). This triangulation is necessary when exporting directly to EnergyPlus since it cannot accept sub-faces with more than 4 vertices. (Default: True).
full_geometry – Boolean to note whether space boundaries and shell geometry should be included in the exported gbXML vs. just the minimal required non-manifold geometry. (Default: False).
interior_face_type – Text string for the type to be used for all interior floor faces. If unspecified, the interior types will be left as they are. Choose from the following. InteriorFloor, Ceiling.
ground_face_type – Text string for the type to be used for all ground-contact floor faces. If unspecified, the ground types will be left as they are. Choose from the following. UndergroundSlab, SlabOnGrade, RaisedFloor.
print_progress – Set to True to have the progress of the translation printed as it is completed. (Default: False).
- honeybee_openstudio.writer.model_to_idf(model, seed_model=None, schedule_directory=None, use_geometry_names=False, use_resource_names=False, print_progress=False)[source]¶
Translate a Honeybee Model to an IDF string using OpenStudio SDK translators.
- Parameters:
model – The Honeybee Model to be converted into an OpenStudio Model.
seed_model – An optional OpenStudio Model object to which the Honeybee Model will be added. If None, a new OpenStudio Model will be initialized within this method. (Default: None).
schedule_directory – An optional file directory to which all file-based schedules should be written to. If None, all ScheduleFixedIntervals will be translated to Schedule:Compact and written fully into the IDF string instead of to Schedule:File. (Default: None).
use_geometry_names – Boolean to note whether a cleaned version of all geometry display names should be used instead of identifiers when translating the Model to OSM and IDF. Using this flag will affect all Rooms, Faces, Apertures, Doors, and Shades. It will generally result in more read-able names in the OSM and IDF but this means that it will not be easy to map the EnergyPlus results back to the input Honeybee Model. Cases of duplicate IDs resulting from non-unique names will be resolved by adding integers to the ends of the new IDs that are derived from the name. (Default: False).
use_resource_names – Boolean to note whether a cleaned version of all resource display names should be used instead of identifiers when translating the Model to OSM and IDF. Using this flag will affect all Materials, Constructions, ConstructionSets, Schedules, Loads, and ProgramTypes. It will generally result in more read-able names for the resources in the OSM and IDF. Cases of duplicate IDs resulting from non-unique names will be resolved by adding integers to the ends of the new IDs that are derived from the name. (Default: False).
print_progress – Set to True to have the progress of the translation printed as it is completed. (Default: False).
- honeybee_openstudio.writer.model_to_openstudio(model, seed_model=None, schedule_directory=None, use_geometry_names=False, use_resource_names=False, triangulate_non_planar_orphaned=False, triangulate_subfaces=True, use_simple_window_constructions=False, enforce_rooms=False, print_progress=False)[source]¶
Create an OpenStudio Model from a Honeybee Model.
The resulting Model will include all geometry (Rooms, Faces, Apertures, Doors, Shades), all fully-detailed constructions + materials, all fully-detailed schedules, and the room properties.
- Parameters:
model – The Honeybee Model to be converted into an OpenStudio Model.
seed_model – An optional OpenStudio Model object to which the Honeybee Model will be added. If None, a new OpenStudio Model will be initialized within this method. (Default: None).
schedule_directory – An optional file directory to which all file-based schedules should be written to. If None, all ScheduleFixedIntervals will be translated to Schedule:Compact and written fully into the IDF string instead of to Schedule:File. (Default: None).
use_geometry_names – Boolean to note whether a cleaned version of all geometry display names should be used instead of identifiers when translating the Model to OSM and IDF. Using this flag will affect all Rooms, Faces, Apertures, Doors, and Shades. It will generally result in more read-able names in the OSM and IDF but this means that it will not be easy to map the EnergyPlus results back to the input Honeybee Model. Cases of duplicate IDs resulting from non-unique names will be resolved by adding integers to the ends of the new IDs that are derived from the name. (Default: False).
use_resource_names – Boolean to note whether a cleaned version of all resource display names should be used instead of identifiers when translating the Model to OSM and IDF. Using this flag will affect all Materials, Constructions, ConstructionSets, Schedules, Loads, and ProgramTypes. It will generally result in more read-able names for the resources in the OSM and IDF. Cases of duplicate IDs resulting from non-unique names will be resolved by adding integers to the ends of the new IDs that are derived from the name. (Default: False).
triangulate_non_planar_orphaned – Boolean to note whether any non-planar orphaned geometry in the model should be triangulated upon export. This can be helpful because OpenStudio simply raises an error when it encounters non-planar geometry, which would hinder the ability to save files that are to be corrected later. (Default: False).
triangulate_subfaces – Boolean to note whether sub-faces (including Apertures and Doors) should be triangulated if they have more than 4 sides (True) or whether they should be left as they are (False). This triangulation is necessary when exporting directly to EnergyPlus since it cannot accept sub-faces with more than 4 vertices. (Default: True).
use_simple_window_constructions – Boolean to note whether the Model should be translated with simple window constructions, all of which will be represented with a single-layer glazing system construction. This is useful for translation to gbXML since the U-value will only show up if the construction is simple. (Default: False).
enforce_rooms – Boolean to note whether this method should enforce the presence of Rooms in the Model, which is as necessary prerequisite for simulation in EnergyPlus. (Default: False).
print_progress – Set to True to have the progress of the translation printed as it is completed. (Default: False).
Usage:
import os from honeybee.model import Model from honeybee.room import Room from honeybee.config import folders from honeybee_energy.lib.programtypes import office_program import openstudio from honeybee_openstudio.writer import model_to_openstudio # Crate an input Model room = Room.from_box('Tiny_House_Zone', 5, 10, 3) room.properties.energy.program_type = office_program room.properties.energy.add_default_ideal_air() hb_model = Model('Tiny_House', [room]) # translate the honeybee model to an openstudio model os_model = model_to_openstudio(hb_model) # save the OpenStudio model to an OSM osm = os.path.join(folders.default_simulation_folder, 'in.osm') os_model.save(osm, overwrite=True) # save the OpenStudio model to an IDF file idf_translator = openstudio.energyplus.ForwardTranslator() workspace = idf_translator.translateModel(os_model) idf = os.path.join(folders.default_simulation_folder, 'in.idf') workspace.save(idf, overwrite=True)
- honeybee_openstudio.writer.model_to_osm(model, seed_model=None, schedule_directory=None, use_geometry_names=False, use_resource_names=False, print_progress=False)[source]¶
Translate a Honeybee Model to an OSM string.
- Parameters:
model – The Honeybee Model to be converted into an OpenStudio Model.
seed_model – An optional OpenStudio Model object to which the Honeybee Model will be added. If None, a new OpenStudio Model will be initialized within this method. (Default: None).
schedule_directory – An optional file directory to which all file-based schedules should be written to. If None, all ScheduleFixedIntervals will be translated to Schedule:Compact and written fully into the IDF string instead of to Schedule:File. (Default: None).
use_geometry_names – Boolean to note whether a cleaned version of all geometry display names should be used instead of identifiers when translating the Model to OSM and IDF. Using this flag will affect all Rooms, Faces, Apertures, Doors, and Shades. It will generally result in more read-able names in the OSM and IDF but this means that it will not be easy to map the EnergyPlus results back to the input Honeybee Model. Cases of duplicate IDs resulting from non-unique names will be resolved by adding integers to the ends of the new IDs that are derived from the name. (Default: False).
use_resource_names – Boolean to note whether a cleaned version of all resource display names should be used instead of identifiers when translating the Model to OSM and IDF. Using this flag will affect all Materials, Constructions, ConstructionSets, Schedules, Loads, and ProgramTypes. It will generally result in more read-able names for the resources in the OSM and IDF. Cases of duplicate IDs resulting from non-unique names will be resolved by adding integers to the ends of the new IDs that are derived from the name. (Default: False).
print_progress – Set to True to have the progress of the translation printed as it is completed. (Default: False).
- honeybee_openstudio.writer.room_to_openstudio(room, os_model, adj_map=None, include_infiltration=True, ignore_complex_sub_faces=True)[source]¶
Create OpenStudio objects from a Room.
- Parameters:
room – A honeybee Room for which an OpenStudio object will be returned.
os_model – The OpenStudio Model object to which the Room will be added.
adj_map – An optional dictionary with keys for ‘faces’ and ‘sub_faces’ that will have the space Surfaces and SubSurfaces added to it such that adjacencies can be assigned after running this method.
include_infiltration – Boolean for whether or not infiltration will be included in the translation of the Room. It may be desirable to set this to False if the building airflow is being modeled with the EnergyPlus AirFlowNetwork. (Default: True).
ignore_complex_sub_faces – Boolean for whether sub-faces (including Apertures and Doors) should be ignored if they have more than 4 sides (True) or whether they should be left as they are (False). (Default: True).
- Returns:
An OpenStudio Space object for the Room.
- honeybee_openstudio.writer.shade_mesh_to_openstudio(shade_mesh, os_model)[source]¶
Create OpenStudio objects from a ShadeMesh.
- Parameters:
shade_mesh – A honeybee ShadeMesh for which OpenStudio objects will be returned.
os_model – The OpenStudio Model object to which the ShadeMesh will be added.
- Returns:
A list of OpenStudio ShadingSurface objects.
- honeybee_openstudio.writer.shade_to_openstudio(shade, os_model)[source]¶
Create an OpenStudio object from a Shade.
- Parameters:
shade – A honeybee Shade for which an OpenStudio object will be returned.
os_model – The OpenStudio Model object to which the Shade will be added.
- Returns:
An OpenStudio ShadingSurface object.