Sha256: 3bfef23ce3650dc79c417e90d408ce804e4e66ab8b23d54c91694d737ad00f1b

Contents?: true

Size: 703 Bytes

Versions: 13

Compression:

Stored size: 703 Bytes

Contents

# frozen_string_literal: true

def get_ems_values(ems_objects, name)
  values = {}
  ems_objects.each do |ems_object|
    next unless ems_object.name.to_s.include? name.gsub(' ', '_')

    ems_object.lines.each do |line|
      next unless line.downcase.start_with? 'set'

      lhs, rhs = line.split('=')
      lhs = lhs.gsub('Set', '').gsub('set', '').strip
      rhs = rhs.gsub(',', '').gsub(';', '').strip
      values[lhs] = [] if values[lhs].nil?
      # eg. "Q = Q + 1.5"
      if rhs.include? '+'
        rhs_els = rhs.split('+')
        rhs = rhs_els.map { |s| s.tr('()', '').to_f }.sum(0.0)
      else
        rhs = rhs.to_f
      end
      values[lhs] << rhs
    end
  end
  return values
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
urbanopt-cli-0.14.0 example_files/resources/residential-measures/resources/hpxml-measures/HPXMLtoOpenStudio/tests/util.rb
urbanopt-cli-0.13.0 example_files/resources/residential-measures/resources/hpxml-measures/HPXMLtoOpenStudio/tests/util.rb
urbanopt-cli-0.10.0 example_files/resources/hpxml-measures/HPXMLtoOpenStudio/tests/util.rb
urbanopt-cli-0.9.3 example_files/resources/hpxml-measures/HPXMLtoOpenStudio/tests/util.rb
urbanopt-cli-0.9.2 example_files/resources/hpxml-measures/HPXMLtoOpenStudio/tests/util.rb
urbanopt-cli-0.9.1 example_files/resources/hpxml-measures/HPXMLtoOpenStudio/tests/util.rb
urbanopt-cli-0.9.0 example_files/resources/hpxml-measures/HPXMLtoOpenStudio/tests/util.rb
urbanopt-cli-0.8.3 example_files/resources/hpxml-measures/HPXMLtoOpenStudio/tests/util.rb
urbanopt-cli-0.8.2 example_files/resources/hpxml-measures/HPXMLtoOpenStudio/tests/util.rb
urbanopt-cli-0.8.1 example_files/resources/hpxml-measures/HPXMLtoOpenStudio/tests/util.rb
urbanopt-cli-0.8.0 example_files/resources/hpxml-measures/HPXMLtoOpenStudio/tests/util.rb
urbanopt-cli-0.7.1 example_files/resources/hpxml-measures/HPXMLtoOpenStudio/tests/util.rb
urbanopt-cli-0.7.0 example_files/resources/hpxml-measures/HPXMLtoOpenStudio/tests/util.rb