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?