Sha256: 73b64c9d47083407b06eeb45a0b21c38ff85cd3032e050896b9f2793d5787409

Contents?: true

Size: 1.01 KB

Versions: 11

Compression:

Stored size: 1.01 KB

Contents

# Reopen the OpenStudio class to add methods to apply standards to this object
class OpenStudio::Model::ScheduleCompact
  # Returns the min and max value for this schedule.
  #
  # @author Andrew Parker, NREL.
  # return [Hash] Hash has two keys, min and max.
  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
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
openstudio-standards-0.1.15 lib/openstudio-standards/standards/Standards.ScheduleCompact.rb
openstudio-standards-0.1.14 lib/openstudio-standards/standards/Standards.ScheduleCompact.rb
openstudio-standards-0.1.13 lib/openstudio-standards/standards/Standards.ScheduleCompact.rb
openstudio-standards-0.1.12 lib/openstudio-standards/standards/Standards.ScheduleCompact.rb
openstudio-standards-0.1.11 lib/openstudio-standards/standards/Standards.ScheduleCompact.rb
openstudio-standards-0.1.10 lib/openstudio-standards/standards/Standards.ScheduleCompact.rb
openstudio-standards-0.1.9 lib/openstudio-standards/standards/Standards.ScheduleCompact.rb
openstudio-standards-0.1.8 lib/openstudio-standards/standards/Standards.ScheduleCompact.rb
openstudio-standards-0.1.7 lib/openstudio-standards/standards/Standards.ScheduleCompact.rb
openstudio-standards-0.1.6 lib/openstudio-standards/standards/Standards.ScheduleCompact.rb
openstudio-standards-0.1.5 lib/openstudio-standards/standards/Standards.ScheduleCompact.rb