First time here? Check out the Help page!
1 | initial version |
If you are going to be using OpenStudio, it's worth learning some very basic interaction with OpenStudio as an API, rather than a user-interface (GUI), even if you don't write full measures.
If you've installed OpenStudio version 2.+, you should have the command line interface installed. Open command prompt or other command line and type "openstudio" to see the options available. Here is an online guide to the CLI.
You can make short ruby scripts and run them directly in command line with:
openstudio myscript.rb
Try this out by saving the script below as a ruby file (extension .rb), changing the path to your model (being aware to use forward slashes / instead of back slashes \ if on a windows machine), and running it in the command line interface.
path = "C:/Users/my_name/my_folder/my_model.osm"
translator = OpenStudio::OSVersion::VersionTranslator.new
ospath = OpenStudio::Path.new(path)
model = translator.loadModel(ospath).get
#your new availability schedule
my_schedule = model.getScheduleByName("My Schedule").get
#loop through each WaterToAirHeatPump object and assign the schedule
model.getZoneHVACWaterToAirHeatPumps.each do |heat_pump|
heat_pump.setAvailabilitySchedule(my_schedule)
end