Class: URBANopt::RNM::ProcessorOpendss

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

Overview

class created to verify that if a component is repeated more than once in the extended catalog than it is parsed only one time for the OpenDSS catalog

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeProcessorOpendss

Returns a new instance of ProcessorOpendss.



12
13
14
15
# File 'lib/urbanopt/rnm/processor_opendss_catalog.rb', line 12

def initialize
  @list = list
  @cont = cont
end

Instance Attribute Details

#contObject

Returns the value of attribute cont.



10
11
12
# File 'lib/urbanopt/rnm/processor_opendss_catalog.rb', line 10

def cont
  @cont
end

#listObject

Returns the value of attribute list.



10
11
12
# File 'lib/urbanopt/rnm/processor_opendss_catalog.rb', line 10

def list
  @list
end

Instance Method Details

#process_data(catalog_data) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/urbanopt/rnm/processor_opendss_catalog.rb', line 17

def process_data(catalog_data)
  for kk in 0..catalog_data.length - 1 # inside each component
    zz = 0
    if @list.nil?
      @cont = 0
      @list = []
    else
      if catalog_data[kk].include? 'Probability' # referring to transformers
        zz += 1 while zz < @cont && @list[zz]['Name'] != catalog_data[kk]['Name']
      else
        zz += 1 while zz < @cont && @list[zz] != catalog_data[kk]
      end
    end
    if zz == @cont
      @list[@cont] = catalog_data[kk] # associating conductores values in this list
      @cont += 1
    end
  end
end