Editing Objects in EnergyPlus Measures
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
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.
I don't think you need to call
workspace.insertObject(sizingZone).get
orworkspace.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?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 useputs
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.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?
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.