Class: BTAP::EQuest::DOEBDLlib

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/openstudio-standards/btap/equest.rb

Overview

an attempt to organize the BDLlibs…don’t think it works well at all.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDOEBDLlib

Returns a new instance of DOEBDLlib.



1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
# File 'lib/openstudio-standards/btap/equest.rb', line 1043

def initialize
  @commandList = Array.new()
  @db = Sequel.sqlite
  @db.create_table :materials do # Create a new table
    primary_key :id, :integer, :auto_increment => true
    column :command_name, :text
    column :name, :text
    column :type, :text
    column :thickness, :float
    column :conductivity, :float
    column :resistance, :float
    column :density, :float
    column :spec_heat, :float
  end
  @materials = @db[:materials] # Create a dataset

  @db.create_table :layers do # Create a new table
    primary_key :id, :integer, :auto_increment => true
    column :command_name, :text
    column :name, :text
    column :material, :text
    column :inside_film_res, :float
  end
  @layers = @db[:layers] # Create a dataset


  store_material()
end

Instance Attribute Details

#commandListObject

stores the name of the individual materials



1039
1040
1041
# File 'lib/openstudio-standards/btap/equest.rb', line 1039

def commandList
  @commandList
end

#dbObject

Returns the value of attribute db.



1030
1031
1032
# File 'lib/openstudio-standards/btap/equest.rb', line 1030

def db
  @db
end

#materialsObject

Returns the value of attribute materials.



1030
1031
1032
# File 'lib/openstudio-standards/btap/equest.rb', line 1030

def materials
  @materials
end

Instance Method Details

#find_layer(utype) ⇒ Object



1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
# File 'lib/openstudio-standards/btap/equest.rb', line 1092

def find_layer(utype)
  posts =  @layers.filter(:name => utype)
  record = posts.first()
  #Create the new command object.
  command = DOE2::DOECommand.new()
  #Insert the collected information into the object.
  command.commandName = "LAYERS"
  command.utype = record[:name]
  command.set_keyword_value("MATERIAL", record[:material])
  command.set_keyword_value("THICKNESS", record[:thickness])
  command.set_keyword_value("CONDUCTIVITY", record[:conductivity])
  command.set_keyword_value("DENSITY", record[:density])
  command.set_keyword_value("SPECIFIC HEAT", record[:spec_heat])

  return command
end

#find_material(utype) ⇒ Object



1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
# File 'lib/openstudio-standards/btap/equest.rb', line 1074

def find_material(utype)
  posts =  @materials.filter(:name => utype)
  record = posts.first()
  #Create the new command object.
  command = DOE2::DOECommand.new()
  #Insert the collected information into the object.
  command.commandName = "MATERIAL"
  command.utype = record[:name]
  command.set_keyword_value("TYPE", record[:type])
  command.set_keyword_value("THICKNESS", record[:thickness])
  command.set_keyword_value("CONDUCTIVITY", record[:conductivity])
  command.set_keyword_value("DENSITY", record[:density])
  command.set_keyword_value("SPECIFIC HEAT", record[:spec_heat])

  return command
end