class BTAP1980TO2010

This class holds methods that apply BTAP19802010 rules. @ref [References::BTAP19802010]

Public Class Methods

new() click to toggle source
Calls superclass method BTAPPRE1980::new
# File lib/openstudio-standards/standards/necb/BTAP1980TO2010/btap_1980to2010.rb, line 7
def initialize
  super()
  @standards_data = load_standards_database_new
  corrupt_standards_database
end

Public Instance Methods

load_standards_database_new() click to toggle source
Calls superclass method BTAPPRE1980#load_standards_database_new
# File lib/openstudio-standards/standards/necb/BTAP1980TO2010/btap_1980to2010.rb, line 13
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
set_occ_sensor_spacetypes(model, space_type_map) click to toggle source

occupancy sensor control applied using lighting schedule, see apply_lighting_schedule method

# File lib/openstudio-standards/standards/necb/BTAP1980TO2010/btap_1980to2010.rb, line 47
def set_occ_sensor_spacetypes(model, space_type_map)
  return true
end