archetypal.umi_template.UmiTemplateLibrary

class archetypal.umi_template.UmiTemplateLibrary(name='unnamed', BuildingTemplates=None, GasMaterials=None, GlazingMaterials=None, OpaqueConstructions=None, OpaqueMaterials=None, WindowConstructions=None, StructureInformations=None, DaySchedules=None, WeekSchedules=None, YearSchedules=None, DomesticHotWaterSettings=None, VentilationSettings=None, WindowSettings=None, ZoneConditionings=None, ZoneConstructionSets=None, ZoneLoads=None, ZoneDefinitions=None)[source]

Handles parsing and creating Template Library Files for UMI for Rhino.

  • See open() to parse existing Umi Template Library files (.json).

  • See from_idf_files() to create a library by converting existing IDF models.

Initialize a new UmiTemplateLibrary with empty attributes.

Parameters
  • name (str) – The name of the UMI Template.

  • BuildingTemplates (list of BuildingTemplate) – list of BuildingTemplate objects.

  • GasMaterials (list of GasMaterial) – list of GasMaterial objects.

  • GlazingMaterials (list of GlazingMaterial) – list of GlazingMaterial objects.

  • OpaqueConstructions (list of OpaqueConstruction) – list of OpaqueConstruction objects.

  • OpaqueMaterials (list of OpaqueMaterial) – list of OpaqueMaterial objects.

  • WindowConstructions (list of WindowConstruction) – list of WindowConstruction objects.

  • StructureInformations (list of StructureInformation) – list of StructureInformation objects.

  • DaySchedules (list of DaySchedule) – list of DaySchedule objects.

  • WeekSchedules (list of WeekSchedule) – list of WeekSchedule objects.

  • YearSchedules (list of YearSchedule) – list of YearSchedule objects.

  • DomesticHotWaterSettings (list of DomesticHotWaterSetting) – list of DomesticHotWaterSetting objects.

  • VentilationSettings (list of VentilationSetting) – list of VentilationSetting objects.

  • WindowSettings (list of WindowSetting) – list of WindowSetting objects.

  • ZoneConditionings (list of ZoneConditioning) – list of ZoneConditioning objects.

  • ZoneConstructionSets (list of ZoneConstructionSet) – list of ZoneConstructionSet objects.

  • ZoneLoads (list of ZoneLoad) – list of ZoneLoad objects.

  • ZoneDefinitions (list of ZoneDefinition) – list of Zone objects

classmethod from_idf_files(idf_files, weather, name='unnamed', processors=- 1, keep_all_zones=False, **kwargs)[source]

Initialize an UmiTemplateLibrary object from one or more idf_files.

The resulting object contains the reduced version of the IDF files. To save to file, call the save() method.

Important

When using from_idf_files() The idf files are striped of run period modifiers and special days to return simple annual schedules.

Parameters
  • idf_files (list of (str or Path)) – list of IDF file paths.

  • weather (str or Path) – Path to the weather file.

  • name (str) – The name of the Template File

  • processors (int) – Number of cores. Defaults to -1, all cores.

  • kwargs – keyword arguments passed to IDF().

Raises

Exception – All exceptions are raised if settings.debug=True. Will raise an exception if all BuildingTemplates failed to be created.

static template_complexity_reduction(idfname, epw, **kwargs)[source]

Wrap IDF, simulate and BuildingTemplate for parallel processing.

classmethod open(filename)[source]

Initialize an UmiTemplate object from an UMI Template Library File.

Parameters

filename (str or Path) – PathLike object giving the pathname of the UMI Template File.

Returns

The template object.

Return type

UmiTemplateLibrary

classmethod loads(s, name)[source]

load string.

validate(defaults=True)[source]

Validate the object.

save(path_or_buf=None, indent=2, sort_keys=False, compression='infer', storage_options=None)[source]

Save to json file.

Parameters
  • path_or_buf (path-like) – File path or object. If not specified, overwrites files. See UmiTemplateLibrary.name.

  • indent (bool or str or int) – If indent is a non-negative integer or string, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0, negative, or “” will only insert newlines. None (the default) selects the most compact representation. Using a positive integer indent indents that many spaces per level. If indent is a string (such as “t”), that string is used to indent each level.

  • sort_keys (callable) – If sort_keys is true (default: False), then the output of dictionaries will be sorted by this callable. e.g.: lambda x: x.get(“$id”) sorts by $id. If callable is not available or fails, then sorted by Name.

  • compression (str) – A string representing the compression to use in the output file, only used when the first argument is a filename. By default, the compression is inferred from the filename.

  • storage_options (dict) – Extra options that make sense for a particular storage connection, e.g. host, port, username, password, etc., if using a URL that will be parsed by fsspec, e.g., starting “s3://”, “gcs://”. An error will be raised if providing this argument with a non-fsspec URL. See the fsspec and backend storage implementation docs for the set of allowed keys and values.

to_json(path_or_buf=None, indent=2, sort_keys=False, default_handler=None, compression='infer', storage_options=None)[source]

Convert the object to a JSON string.

Parameters
  • path_or_buf (path-like) – File path or object. If not specified, the result is returned as a string.

  • indent (bool or str or int) – If indent is a non-negative integer or string, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0, negative, or “” will only insert newlines. None (the default) selects the most compact representation. Using a positive integer indent indents that many spaces per level. If indent is a string (such as “t”), that string is used to indent each level.

  • sort_keys (callable) –

  • default_handler (callable) – Handler to call if object cannot otherwise be converted to a suitable format for JSON. Should receive a single argument which is the object to convert and return a serializable object.

  • compression (str) – A string representing the compression to use in the output file, only used when the first argument is a filename. By default, the compression is inferred from the filename.

  • storage_options (dict) – Extra options that make sense for a particular storage connection, e.g. host, port, username, password, etc., if using a URL that will be parsed by fsspec, e.g., starting “s3://”, “gcs://”. An error will be raised if providing this argument with a non-fsspec URL. See the fsspec and backend storage implementation docs for the set of allowed keys and values.

to_dict()[source]

Return UmiTemplateLibrary dictionary representation.

unique_components(exceptions=None)[source]

Keep only unique components.

Calls get_unique() for each object in the graph.

replace_component(this, that) None[source]

Replace all instances of this with that.

Parameters
  • this (UmiBase) – The reference to replace with that.

  • that (UmiBase) – The object to replace each references with.

update_components_list(exceptions=None)[source]

Update the component groups with connected components.

build_graph()[source]

Create the networkx.DiGraph UmiBase objects as nodes.