Class: BTAP::Measures::CSV_Measures

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

Direct Known Subclasses

CSV_OS_Measures

Instance Method Summary collapse

Constructor Details

#initialize(csv_file, script_root_folder_path) ⇒ CSV_Measures



411
412
413
414
415
416
417
418
# File 'lib/openstudio-standards/btap/measures.rb', line 411

def initialize(
    csv_file,
    script_root_folder_path
  )
  @csv_file_path = csv_file
  @csv_data = nil
  @script_root_folder_path = script_root_folder_path
end

Instance Method Details

#are_all_instance_variables_nil?(measure_values) ⇒ Boolean



433
434
435
436
437
438
439
# File 'lib/openstudio-standards/btap/measures.rb', line 433

def are_all_instance_variables_nil?(measure_values)
  value = true
  measure_values.each do |variable|
    value = false unless instance_variable_get("@#{variable}").nil?
  end
  return value
end

#set_instance_variables(measure_values) ⇒ Object

A tiny bit of metacode to assign some instance variables named as above. This will set the above variable first to nil, then, if present in the csv row data received, the actual construction data values. So we should after this loop access @ext_wall_rsi for example. If the variable is not present in the row. It will default the value to zero. It should automatically make floats and strings accordingly.



425
426
427
428
429
430
431
# File 'lib/openstudio-standards/btap/measures.rb', line 425

def set_instance_variables(measure_values)

  measure_values.each do |variable|
    instance_variable_set("@#{variable}", nil )
    instance_variable_set("@#{variable}", @csv_data[ variable ] )  unless ( (@csv_data.nil? == true ) or (@csv_data.has_key?(variable) == false) or (@csv_data[variable].to_s.strip.downcase == "na"))
  end
end