Class: URBANopt::RNM::Validation

Inherits:
Object
  • Object
show all
Defined in:
lib/urbanopt/rnm/validation.rb

Overview

Class for OpenDSS validation (runs python script)

Instance Method Summary collapse

Constructor Details

#initialize(rnm_full_path, b_numeric_ids) ⇒ Validation

Initialize attributes: ++run directory+

parameters:
  • rnm_dirname - String - name of RNM-US directory that will contain the input files (within the scenario directory)



17
18
19
20
21
22
23
24
25
26
# File 'lib/urbanopt/rnm/validation.rb', line 17

def initialize(rnm_full_path,b_numeric_ids)
  # absolute path
  @rnm_full_path = rnm_full_path
  @opendss_full_path=File.join(@rnm_full_path,'results/OpenDSS')
  @b_numeric_ids=b_numeric_ids
  if !Dir.exist?(@opendss_full_path)
      puts 'Error: folder does not exist'+@opendss_full_path
      raise 'No OpenDSS directory found for this scenario...run simulation first.'
  end
end

Instance Method Details

#run_validationObject

Run validation



32
33
34
35
36
37
38
39
# File 'lib/urbanopt/rnm/validation.rb', line 32

def run_validation()
  puts "Initiating OpenDSS validation in folder"
  puts @opendss_full_path
  puts "This can take several minutes"
  # puts `python ./lib/urbanopt/rnm/validation/main_validation.py #{@rnm_full_path}`
  log=`python ./lib/urbanopt/rnm/validation/main_validation.py #{@opendss_full_path} #{@b_numeric_ids}`
  puts log
end