First time here? Check our help page!
3

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

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")?

pflaumingo's avatar
1.9k
pflaumingo
asked 2017-07-31 20:36:38 -0500
__AmirRoth__'s avatar
4.4k
__AmirRoth__
updated 2017-08-05 07:25:56 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

5

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"]
Julien Marrec's avatar
29.7k
Julien Marrec
answered 2017-08-01 02:30:12 -0500, updated 2017-08-01 14:20:03 -0500
edit flag offensive 0 remove flag delete link

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 -0500) 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 -0500) edit

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

Julien Marrec's avatar Julien Marrec (2017-08-01 14:20:32 -0500) edit
add a comment see more comments