I'm trying to run IdfObject.load code from the Reporting section of the Measure Writers Guide but not having any success. I am expecting it to produce a similar result to the Add Output Variable measure on BCL, ie append lines to the in.idf file in my model directory.
I am using OS 2.3.0 on Windows 10. I've got version numbers in the description field in the measure so I can tell from the GUI what version of the code I am running (not always obvious) and I have tried running as both an Energyplus measure (which seems logical as I am trying to modify the idf file) using the Workspace object and as an OpenStudio measure using the model object as the Add Output Variable measure does.
The codebelow is fromthe Energy Plus measure version:
```
#start the measure
class AddAllMonthly < OpenStudio::Ruleset::WorkspaceUserScript
#V1 initial dev, use workspace instead of model in class definition. Measure failed to run using Model in class definition
#V2 V1 ran but no output or messages. Add Workspace into def and super statements. No improvement
#V3 change variable 'steve' back to as per meaasure writing guide. Runs, no change to idf
#V4 check with Workspace in class definition and nothing in method or super definition as per downloaded code
# Runs, no info messages or changes to idf
#define the name that a user will see, this method may be deprecated as
#the display name in PAT comes from the name field in measure.xml
def name
return "addAllMonthly"
end
# human readable description
def description
return "V4 test using Energy plus measure and using Workspace object"
end
# human readable description of modeling approach
def modeler_description
return ""
end
#code copied from Measure writing guide
def energyPlusOutputRequests(runner, user_arguments)
super(runner, user_arguments)
runner.registerInfo("Started Output requests method") #line added for debugging
result = OpenStudio::IdfObjectVector.new
# use the built-in error checking
if !runner.validateUserArguments(arguments(), user_arguments)
#runner.registerInfo("Error check") #line added for debugging v8
return result
end
result << OpenStudio::IdfObject.load("Output:Variable,,Site Outdoor Air Drybulb Temperature,Timestep;").get
result << OpenStudio::IdfObject.load("Output:Variable,,Site Outdoor Air Humidity Ratio,Timestep;").get
result << OpenStudio::IdfObject.load("Output:Variable,,Site Outdoor Air Relative Humidity,Timestep;").get
result << OpenStudio::IdfObject.load("Output:Variable,,Zone Air Temperature,Timestep;").get
result << OpenStudio::IdfObject.load("Output:Variable,,Zone Air Humidity Ratio,Timestep;").get
result << OpenStudio::IdfObject.load("Output:Variable,,Zone Air Relative Humidity,Timestep;").get
return result
runner.registerInfo("Completed Output requests method") #line added for debugging
end #end the OutputRequests method
end #end the measure
#this allows the measure to be use by the application
AddAllMonthly.new.registerWithApplication
```
Any help/pointers would be greatly appreciated