Sha256: 5ab8238f5b62c72861a5ce334e2d23c0614a1674aa6076d9cba9feaa133a2d35

Contents?: true

Size: 1.95 KB

Versions: 19

Compression:

Stored size: 1.95 KB

Contents

# This class holds methods that apply BTAP19802010 rules.
# @ref [References::BTAP19802010]
class BTAP1980TO2010 < BTAPPRE1980
  @template = new.class.name
  register_standard(@template)

  def initialize
    super()
    @standards_data = load_standards_database_new
    corrupt_standards_database
  end

  def load_standards_database_new
    # load BTAP19802010 data.
    super()

    if __dir__[0] == ':' # Running from OpenStudio CLI
      embedded_files_relative('data/', /.*\.json/).each do |file|
        data = JSON.parse(EmbeddedScripting.getFileAsString(file))
        if !data['tables'].nil?
          @standards_data['tables'] = [*@standards_data['tables'], *data['tables']].to_h
        elsif !data['constants'].nil?
          @standards_data['constants'] = [*@standards_data['constants'], *data['constants']].to_h
        elsif !data['constants'].nil?
          @standards_data['formulas'] = [*@standards_data['formulas'], *data['formulas']].to_h
        end
      end
    else
      files = Dir.glob("#{File.dirname(__FILE__)}/data/*.json").select { |e| File.file? e }
      files.each do |file|
        data = JSON.parse(File.read(file))
        if !data['tables'].nil?
          @standards_data['tables'] = [*@standards_data['tables'], *data['tables']].to_h
        elsif !data['constants'].nil?
          @standards_data['constants'] = [*@standards_data['constants'], *data['constants']].to_h
        elsif !data['formulas'].nil?
          @standards_data['formulas'] = [*@standards_data['formulas'], *data['formulas']].to_h
        end
      end
    end
    # Write database to file.
    # File.open(File.join(File.dirname(__FILE__), '..', 'NECB2017.json'), 'w') {|f| f.write(JSON.pretty_generate(@standards_data))}
    return @standards_data
  end

  # occupancy sensor control applied using lighting schedule, see apply_lighting_schedule method
  def set_occ_sensor_spacetypes(model, space_type_map)
    return true
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
openstudio-standards-0.7.0 lib/openstudio-standards/standards/necb/BTAP1980TO2010/btap_1980to2010.rb
openstudio-standards-0.7.0.rc1 lib/openstudio-standards/standards/necb/BTAP1980TO2010/btap_1980to2010.rb
openstudio-standards-0.6.3 lib/openstudio-standards/standards/necb/BTAP1980TO2010/btap_1980to2010.rb
openstudio-standards-0.6.0.rc2 lib/openstudio-standards/standards/necb/BTAP1980TO2010/btap_1980to2010.rb
openstudio-standards-0.6.0.rc1 lib/openstudio-standards/standards/necb/BTAP1980TO2010/btap_1980to2010.rb
openstudio-standards-0.5.0 lib/openstudio-standards/standards/necb/BTAP1980TO2010/btap_1980to2010.rb
openstudio-standards-0.5.0.rc1 lib/openstudio-standards/standards/necb/BTAP1980TO2010/btap_1980to2010.rb
openstudio-standards-0.4.0 lib/openstudio-standards/standards/necb/BTAP1980TO2010/btap_1980to2010.rb
openstudio-standards-0.3.1.rc2 lib/openstudio-standards/standards/necb/BTAP1980TO2010/btap_1980to2010.rb
openstudio-standards-0.3.1.rc1 lib/openstudio-standards/standards/necb/BTAP1980TO2010/btap_1980to2010.rb
openstudio-standards-0.3.0 lib/openstudio-standards/standards/necb/BTAP1980TO2010/btap_1980to2010.rb
openstudio-standards-0.2.17.rc2 lib/openstudio-standards/standards/necb/BTAP1980TO2010/btap_1980to2010.rb
openstudio-standards-0.2.17.rc1 lib/openstudio-standards/standards/necb/BTAP1980TO2010/btap_1980to2010.rb
openstudio-standards-0.2.16 lib/openstudio-standards/standards/necb/BTAP1980TO2010/btap_1980to2010.rb
openstudio-standards-0.2.16.rc2 lib/openstudio-standards/standards/necb/BTAP1980TO2010/btap_1980to2010.rb
openstudio-standards-0.2.16.rc1 lib/openstudio-standards/standards/necb/BTAP1980TO2010/btap_1980to2010.rb
openstudio-standards-0.2.15 lib/openstudio-standards/standards/necb/BTAP1980TO2010/btap_1980to2010.rb
openstudio-standards-0.2.15.pre.rc2 lib/openstudio-standards/standards/necb/BTAP1980TO2010/btap_1980to2010.rb
openstudio-standards-0.2.15.pre.rc1 lib/openstudio-standards/standards/necb/BTAP1980TO2010/btap_1980to2010.rb