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

Are the ScheduleTypeLimits in the OpenStudio app available via the SDK?

asked 2017-07-31 20:36:38 -0600

pflaumingo's avatar

updated 2017-08-05 07:25:56 -0600

Is there a way to access the ScheduleTypeLimits that are used in the OpenStudio app through the OpenStudio SDK? Some sort of method like ScheduleTypeLimits.getScheduleTypeLimit("Fractional")?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
5

answered 2017-08-01 02:30:12 -0600

updated 2017-08-01 14:20:03 -0600

ScheduleTypeLimits is the object, it's already plural. If you need to get all of them, you need to append another s:

# Return an Array
model.getScheduleTypeLimitss

You could try getting them directly by name:

# Returns an optional, try `.empty?`then `.get`
model.getScheduleTypeLimitsByName("Fractional")

Of course you can use the array of ScheduleTypeLimits to filter on those that are Continuous only:

arr_continuous = []
model.getScheduleTypeLimitss.each do |s|
  next if s.numericType.empty?
  next if s.numericType.get != "Continuous"
  arr_continuous << s
end

Or the one-liner equivalent for fun:

model.getScheduleTypeLimitss.select{|s| (s.numericType.is_initialized) & (s.numericType.get == "Continuous")}

Just FYI, these two methods shall prove useful to return the possible values for numericType and unitType:

OpenStudio::Model::ScheduleTypeLimits::numericTypeValues
OpenStudio::Model::ScheduleTypeLimits::unitTypeValues

To answer your comment: they aren't "defined in OS App". Some objects in the hvac_library.osm have some schedule that have scheduleTypeLimits attached to them, and when you add them to your model (this uses clone, which carries the child objects with it), they come with.

The hvac_library.osm itself is quite poorly optimized in this fashion:

# lib = osload('/Applications/OpenStudio-2.1.2/OpenStudioApp.app/Contents/Resources/hvaclibrary/hvac_library.osm')

In [1]: lib.getScheduleTypeLimitss.map{|s| s.name.to_s}

Out[1]: ["OnOff 1",
 "Dimensionless",
 "Temperature",
 "Schedule Type Limits 1",
 "OnOff",
 "Min Max Temp w Deadband Min Limits",
 "ControlMode",
 "OnOff 2",
 "Fractional",
 "Temperature 2",
 "Min Max Temp w Deadband Max Limits",
 "Temperature 3",
 "Dimensionless 2",
 "Temperature 1",
 "Fractional 1",
 "Schedule Type Limits 2",
 "Temperature 5",
 "Fractional 2",
 "Dimensionless 1",
 "Temperature 4"]
edit flag offensive delete link more

Comments

These work for the ScheduleTypeLimitss already defined in a model, but I was more looking for a helper to grab the ScheduleTypeLimitss that are defined in the OpenStudio app rather than having to recreate them in the SDK.

pflaumingo's avatar pflaumingo  ( 2017-08-01 11:11:43 -0600 )edit

There aren't defined really. see my edit. Does that close this question?

Julien Marrec's avatar Julien Marrec  ( 2017-08-01 14:19:13 -0600 )edit

@Kyle Benne: my comment about "poorly optimized" might be of interest.

Julien Marrec's avatar Julien Marrec  ( 2017-08-01 14:20:32 -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

2 followers

Stats

Asked: 2017-07-31 20:36:38 -0600

Seen: 202 times

Last updated: Aug 01 '17