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

Returns a new instance of CSV_Measures.



446
447
448
449
450
451
452
453
# File 'lib/openstudio-standards/btap/measures.rb', line 446

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

Returns:

  • (Boolean)


468
469
470
471
472
473
474
# File 'lib/openstudio-standards/btap/measures.rb', line 468

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.



460
461
462
463
464
465
466
# File 'lib/openstudio-standards/btap/measures.rb', line 460

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