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

Revision history [back]

click to hide/show revision 1
initial version

How 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?

How 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?

How 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?

How 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 _.

How 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 _.