Class: OpenStudio::Model::ScheduleCompact

Inherits:
Object
  • Object
show all
Defined in:
lib/openstudio-standards/standards/Standards.ScheduleCompact.rb

Overview

Reopen the OpenStudio class to add methods to apply standards to this object

Instance Method Summary collapse

Instance Method Details

#annual_min_max_valueObject

Returns the min and max value for this schedule.

return [Hash] Hash has two keys, min and max.

Author:

  • Andrew Parker, NREL.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/openstudio-standards/standards/Standards.ScheduleCompact.rb', line 8

def annual_min_max_value
  vals = []
  prev_str = ''
  sch.extensibleGroups.each do |eg|
    if prev_str.include?('until')
      val = eg.getDouble(0)
      if val.is_initialized
        vals << eg.getDouble(0).get
      end
    end
    str = eg.getString(0)
    if str.is_initialized
      prev_str = str.get.downcase
    end
  end

  # Error if no values were found
  if vals.size.zero?
    OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.ScheduleCompact', "Could not find any value in #{name} when determining min and max.")
    result = { 'min' => 999.9, 'max' => 999.9 }
    return result
  end

  result = { 'min' => vals.min, 'max' => vals.max }

  return result
end