How to set ZoneVentilation:DesignFlowRate in workspace object?
I'm trying to change the Schedule Name in the zoneVentilation:DesignFlowRate workspace objects.
To do this I retrieve all the zoneVentilation:DesignFlowRate objects using getObjectsByType. Then I iterate over the array and try to set the Schedule Name using the setString method. Unexpectedly, it returns False and no change is done.
I'm using the example in the Measure Writing Guide, following closely the "Editing EnergyPlus Workspace Objects" section, and I can't find any obvious problem.
What follows is the code I'm testing:
idfFlowRates = workspace.getObjectsByType("ZoneVentilation_DesignFlowRate".to_IddObjectType)
if not idfFlowRates.empty?
msg("\n __ result __\n")
msg(" idfFlowRates[0].class ----------------------> #{idfFlowRates[0].class}\n")
msg(" inital value: idfFlowRates[0].getString(1) -> #{idfFlowRates[0].getString(1)}\n")
result = idfFlowRates[0].setString(1,"Test text")
msg(" succesfully written? -----------------------> #{result}\n")
msg(" final value --------------------------------> #{idfFlowRates[0].getString(1)}\n")
else
msg("array is empty \n")
end
The output of this code is:
__ result __
idfFlowRates[0].class ----------------------> OpenStudio::WorkspaceObject
inital value: idfFlowRates[0].getString(2) -> Always_On
succesfully written? -----------------------> false
final value --------------------------------> Always_On
Do you have any clue about what I may be missing here?
Note: getObjectByType function seems to be working ok because idfFlowRates is an array of WorkspaceObjects. I get the same result using :
instead of _
.
For reference zone ventilation design flow rate is in the OpenStudio api now. This measure demonstrates how to use it. https://bcl.nrel.gov/node/83272
Due to this bug: https://github.com/NREL/OpenStudio/is... , this measure doesn't work properly when used with an ideal air loads system, and the idf object ends with an "Always On Discrete" schedule name. We are trying to work around this using an Energy+ measure instead of an OpenStudio one.
Solved,
I was using a test name instead a real schedule name. Using an existing schedule name works fine both with
:
or_
.Thank you very much for your help.