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

Availability Schedule Measure

asked 2018-02-27 07:49:00 -0600

jmoody's avatar

updated 2018-02-27 07:55:03 -0600

I have project with 153 zones. In most zones I am using a Water to Air Heatpump. I need to change the availability schedule of each heat pump. I am fairly redundant task tolerant but in OS this gets a little long for even me. I am not a coder but I cannot dissect and modify code where necessary. Anyone know of an existing measure I could modify for this purpose?

edit retag flag offensive close merge delete

Comments

@jmoody is it the same schedule for all zones?

Avi's avatar Avi  ( 2018-02-27 12:19:26 -0600 )edit

The vast majority are the same zone with probably 30 exceptions.

jmoody's avatar jmoody  ( 2018-02-27 12:21:24 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
2

answered 2018-02-27 13:55:38 -0600

Avi's avatar

At the risk of stepping on someone's toes there is a quicker work around you might want to consider:

Backup your OSM file.

Create your the desired availability schedule and not down it's name.

open the OSM file in your choice of text editor.

Scan for the default availability schedule by name (should be - Always On Discrete hvac_library) and find the lines which define it. It should look like that:

! Always On Discrete
OS:Schedule:Constant,
  {2780322d-eacc-430e-af75-bc3f078346b0}, !- Handle
  Always On Discrete hvac_library,        !- Name
  {8aaf549f-13cf-47e3-9b02-370b4856d71c}, !- Schedule Type Limits Name
  1;                                      !- Value

copy the Handle line and delete it all.

Now search for your new schedule by name. You should find something like that:

OS:Schedule:Ruleset,
  {4180360c-3a82-42f1-bbe1-0b4e5b0c5f38}, !- Handle
  My new availability schedule,                !- Name
  {64b4dc07-40f6-4aa2-b51d-b32e9e4e9cb6}, !- Schedule Type Limits Name
  {33da82b4-4128-488d-ab2a-11e31dba5e63}, !- Default Day Schedule Name
  {3c0b3c2e-8e17-445d-b2ac-36b7a989688d}, !- Summer Design Day Schedule Name
  {cff6bd99-3338-4076-b70e-9d70f2644c90}; !- Winter Design Day Schedule Name

Now you need to replace all the instances of the Handle of that Ruleset Schedule with the Handle you copied from the Constant Schedule before.

Now you should be ready apart from the 30 exceptions schedules that you will have to change one by one.

edit flag offensive delete link more

Comments

You are not stepping on anybody's toes in my book. That is another solution and one that I would normally use because I am familiar with it from years of editing DOE files. I use Notepad++ and it works great but I would also love to be able to use the command line interface and measure writing to develop methods that are specific to our offices way of doing design. I think the answer really is all of the above.

jmoody's avatar jmoody  ( 2018-02-27 14:01:17 -0600 )edit

This will change all instances of Always On Discrete hvac_library with the new schedule, so it will only work if the objects you are changing are the only objects to use that schedule, or you don't mind all HVAC objects referencing the new schedule.

A smarter approach with direct text editing would be to make a new schedule in the model and save it. Then open your model in the text editor, do a find for the objects with the current schedule handle, and then click through and replace the handle on an object-by-object basis.

mdahlhausen's avatar mdahlhausen  ( 2018-02-27 18:32:06 -0600 )edit
2

answered 2018-02-27 12:31:13 -0600

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
edit flag offensive delete link more

Comments

I have been putting it off for 45 years but the realization that I need to learn some level of script writing. Python for my Revit work and Ruby for this. This looks like it will do the trick and open the door to more possibilities.

jmoody's avatar jmoody  ( 2018-02-27 12:56:55 -0600 )edit

For the complete newbie.....how do you begin with the command line interface. Where do you even begin running it from?

jmoody's avatar jmoody  ( 2018-02-27 23:00:04 -0600 )edit

I can't find a tutorial that walks through the command line interface. So I'll make one. Check back in a few days. If you need it sooner, I can do a quick web conference.

mdahlhausen's avatar mdahlhausen  ( 2018-02-27 23:54:35 -0600 )edit

That will work. I was looking for a tutorial on the CLI and measure writing yesterday and noticed that there is a lot of in-depth details about both but not a basic, "Here's how you get started tutorial." Thank you for doing this.

jmoody's avatar jmoody  ( 2018-02-28 08:36:57 -0600 )edit

@mdahlhausen, read up on the CLI and have a basic understanding of how to use it. I attempted the script above and it appeared to run but nothing changed on the model. Any ideas?

jmoody's avatar jmoody  ( 2018-03-10 08:11:03 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Training Workshops

Careers

Question Tools

1 follower

Stats

Asked: 2018-02-27 07:49:00 -0600

Seen: 399 times

Last updated: Feb 27 '18