Editing Objects in EnergyPlus Measures

asked 2021-10-01 07:36:02 -0600

OH.AME2021's avatar

Hello, I'm trying to assign a DesignSpecification:ZoneAirDistribution object, through an EnergyPlus measure, to Controller:MechanicalVentilation and Sizing:Zone objects, and I ultimately want to assign a controller list to an AirLoopHVAC.

I was trying the following to edit my objects, but when I open the idf file after running the measure, the edits aren't shown in the objects despite successful runs ... I checked the WorkspaceObject, Workspace, and IdfObject documentations to figure what I may be doing wrong, but it's not clear.

sizingZone = workspace.getObjectsByType("Sizing:Zone").at(0).idfObject
sizingZone.setString(22,"DSZAD")
workspace.insertObject(sizingZone).get

controller = workspace.getObjectsByName("Controller Mechanical Ventilation 1",true).at(0)
controller = controller.idfObject
controller.setString(7,"DSZAD")
workspace.insertObject(controller).get

Are there any steps I'm missing? Is there a way to do what I'm trying in OpenStudio measures? Any advice is appreciated

edit retag flag offensive close merge delete

Comments

When you say successful runs, do you mean that it just ran or that the changes you intended to make were there? Where are you getting the IDF file you are opening manually? If you export Ann IDF from the file menu of the OpenStudio Application for example it won’t include impact of any EnergyPlus measures. Lastly what is the intent of the two workspace.insertObject lines? Those objects are already in the workspace and you should have been able to setString to change them in place.

David Goldwasser's avatar David Goldwasser  ( 2021-10-03 18:56:08 -0600 )edit

I don't think you need to call workspace.insertObject(sizingZone).get or workspace.insertObject(controller).get. When you get an object from a workspace (or model), that object is still a part of the model or workspace. Can you try your measure without those lines?

macumber's avatar macumber  ( 2021-10-05 20:55:17 -0600 )edit

Successful runs indeed meant just running, but the changes I wanted don't reflect in the objects.

The IDF file I check has path "model folder/run/in.idf". I'm running the measure in the CLI and I guess the "in.idf" file is the one being altered.

I had the workspace.insertObject lines in hope that they confirm the objects change in the workspace; when I use puts on my IDF objects in the measure, they show the desired changes, but on the workspace objects -which is what's ultimately in the IDF file it seems- it doesn't change.

OH.AME2021's avatar OH.AME2021  ( 2021-10-08 14:58:46 -0600 )edit

My guess is that you are modifying a different workspace than the one passed in to the run method. Are you able to post your entire measure for review?

macumber's avatar macumber  ( 2021-10-09 11:00:44 -0600 )edit

Thank you macumber Here is my measure I'm trying to add a DS:ZAD object defined in an external IDF file then assign it to components as needed. Copying and editing the "inject IDF objects" measure worked so far, but I'm stuck at the assignments part.

OH.AME2021's avatar OH.AME2021  ( 2021-10-11 12:32:28 -0600 )edit