Sha256: d7073fa9556c36cba8d839f651d22bd51e9dd19840abcdddd1e2eb073ffb988c
Contents?: true
Size: 1017 Bytes
Versions: 2
Compression:
Stored size: 1017 Bytes
Contents
# ********************************************************************************* # URBANopt (tm), Copyright (c) Alliance for Sustainable Energy, LLC. # See also https://github.com/urbanopt/urbanopt-cli/blob/develop/LICENSE.md # ********************************************************************************* # 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
urbanopt-cli-0.11.1 | example_files/resources/hpxml-measures/HPXMLtoOpenStudio/tests/util.rb |
urbanopt-cli-0.11.0 | example_files/resources/hpxml-measures/HPXMLtoOpenStudio/tests/util.rb |