Question-and-Answer Resource for the Building Energy Modeling Community
Get s tarted with the Help page
Ask Your Question
3

Workspace object class

asked 2016-01-30 12:48:12 -0500

ngkhanh gravatar image

updated 2017-02-01 03:37:48 -0500

I got some problems with implement workspace class :

1/ workspace.getObjectsbyType(IddObjectType) - what are available objects ? The IddObjectType links to "empty content" page.

2/ workspace.getObjectbyName(String, ExactMatch = true) - Which name will be checked as follow object?

!-   ===========  ALL OBJECTS IN CLASS: SETPOINTMANAGER:MULTIZONE:HUMIDITY:MAXIMUM ===========

SetpointManager:MultiZone:Humidity:Maximum,
    DOAS humidity max,       !- Name
    DOAS Ventilation air loop,  !- HVAC Air Loop Name
    0.008,                   !- Minimum Setpoint Humidity Ratio {kgWater/kgDryAir}
    0.0195,                  !- Maximum Setpoint Humidity Ratio {kgWater/kgDryAir}
    Node 13;                 !- Setpoint Node or NodeList Name

3/workspace.getObjectbyReference(RefName) - how to create and format reference name ? Have any example for this method ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2016-01-31 10:49:56 -0500

The Workspace class works off of information in the IDD; the ProposedEnergy+.idd for EnergyPlus objects and the OpenStudio.idd for OpenStudio objects. To answer your questions:

  1. All the IddObject types are available, the one catch is that you have to replace ':' with '_' in the named. For example, to get all the 'SetpointManager:MultiZone:Humidity:Maximum' objects: workspace.getObjectsbyType("SetpointManager_MultiZone_Humidity_Maximum".to_IddObjectType)

  2. The object's name, which is usually the first field for EnergyPlus objects and second field (after handle) for OpenStudio objects. In your example it is DOAS humidity max, !- Name

  3. This finds objects which belong to a certain reference group in the Idd. For example, both the 'Zone' and 'BuildingSurface:Detailed' objects are tagged with\reference OutFaceEnvNames. This means that workspace.getObjectbyReference("OutFaceEnvNames") will return all 'Zone' and 'BuildingSurface:Detailed' objects (and any others in that reference group). The \reference tag is applied to the 'Name' field, other fields use the \object-list tag to indicate that field can refer to any object in the listed reference group. For example, the 'BuildingSurface:Detailed' field 'Outside Boundary Condition Object' is tagged with \object-list OutFaceEnvNames, that means it could point to a 'Zone' or 'BuildingSurface:Detailed' or any other object which has \reference OutFaceEnvNames on the 'Name' field. Does that make sense?

edit flag offensive delete link more

Comments

1/ so i refer to OpenStudio.idd for using model.getObjectbyType("IddObjectType".to_IddObjectType) in OS measure ModelUserScript and to "ProposedEnergy+.idd" in Energyplus measue WorkspaceUserScript : 2. when i write this code : workspace.getObjectbyName("OS SPM",false) - will it return all E+ object with name include "OS SPM" ? if answer is yes - object name has to have both of words or either one of them - how difference between ExactMatch = true and false ? 3. How create or modify reference group or it was determined in the Idd ? How tag object or objectType?

ngkhanh gravatar image ngkhanh  ( 2016-01-31 11:26:01 -0500 )edit

workspace.getObjectsByName does not test for substrings or use regular expressions. If exactMatch is true then it will find objects whose names are equal to the test string (case insensitive). If exactMatch is false it will check the basename, which is basically the object's name with trailing numbers removed. For example, "Zone 1"'s basename is "Zone". See the implementation

You cannot create or modify reference groups without changing the Idd.

macumber gravatar image macumber  ( 2016-01-31 18:12:27 -0500 )edit

Note that in a lot of cases it would be easier to just loop over all objects and write your own selection logic in Ruby.

macumber gravatar image macumber  ( 2016-01-31 18:13:12 -0500 )edit

i tried objs = workspace.getObjects() but it got error - have any fault in my syntax ?

ngkhanh gravatar image ngkhanh  ( 2016-01-31 22:40:56 -0500 )edit

Look at the documentation for Workspace, there is no getObjects method that takes no arguments, there is an objects method that does. OpenStudio coding standards say getter methods which take no arguments are not prefixed by 'get', getter methods that take arguments are prefixed with 'get'.

macumber gravatar image macumber  ( 2016-02-01 09:44:56 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

 

Question Tools

2 followers

Stats

Asked: 2016-01-30 12:48:12 -0500

Seen: 786 times

Last updated: Feb 01 '17