urbanopt-rnm-us 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,45 @@
1
+ # *********************************************************************************
2
+ # URBANopt (tm), Copyright (c) 2019-2021, Alliance for Sustainable Energy, LLC, and other
3
+ # contributors. All rights reserved.
4
+
5
+ # Redistribution and use in source and binary forms, with or without modification,
6
+ # are permitted provided that the following conditions are met:
7
+
8
+ # Redistributions of source code must retain the above copyright notice, this list
9
+ # of conditions and the following disclaimer.
10
+
11
+ # Redistributions in binary form must reproduce the above copyright notice, this
12
+ # list of conditions and the following disclaimer in the documentation and/or other
13
+ # materials provided with the distribution.
14
+
15
+ # Neither the name of the copyright holder nor the names of its contributors may be
16
+ # used to endorse or promote products derived from this software without specific
17
+ # prior written permission.
18
+
19
+ # Redistribution of this software, without modification, must refer to the software
20
+ # by the same designation. Redistribution of a modified version of this software
21
+ # (i) may not refer to the modified version by the same designation, or by any
22
+ # confusingly similar designation, and (ii) must refer to the underlying software
23
+ # originally provided by Alliance as "URBANopt". Except to comply with the foregoing,
24
+ # the term "URBANopt", or any confusingly similar designation may not be used to
25
+ # refer to any modified version of this software or any modified version of the
26
+ # underlying software originally provided by Alliance without the prior written
27
+ # consent of Alliance.
28
+
29
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
30
+ # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
31
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
32
+ # IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
33
+ # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
+ # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
36
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
37
+ # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
38
+ # OF THE POSSIBILITY OF SUCH DAMAGE.
39
+ # *********************************************************************************
40
+
41
+ module URBANopt
42
+ module RNM
43
+ VERSION = '0.1.0'.freeze
44
+ end
45
+ end
@@ -0,0 +1,70 @@
1
+ # *********************************************************************************
2
+ # URBANopt (tm), Copyright (c) 2019-2021, Alliance for Sustainable Energy, LLC, and other
3
+ # contributors. All rights reserved.
4
+
5
+ # Redistribution and use in source and binary forms, with or without modification,
6
+ # are permitted provided that the following conditions are met:
7
+
8
+ # Redistributions of source code must retain the above copyright notice, this list
9
+ # of conditions and the following disclaimer.
10
+
11
+ # Redistributions in binary form must reproduce the above copyright notice, this
12
+ # list of conditions and the following disclaimer in the documentation and/or other
13
+ # materials provided with the distribution.
14
+
15
+ # Neither the name of the copyright holder nor the names of its contributors may be
16
+ # used to endorse or promote products derived from this software without specific
17
+ # prior written permission.
18
+
19
+ # Redistribution of this software, without modification, must refer to the software
20
+ # by the same designation. Redistribution of a modified version of this software
21
+ # (i) may not refer to the modified version by the same designation, or by any
22
+ # confusingly similar designation, and (ii) must refer to the underlying software
23
+ # originally provided by Alliance as "URBANopt". Except to comply with the foregoing,
24
+ # the term "URBANopt", or any confusingly similar designation may not be used to
25
+ # refer to any modified version of this software or any modified version of the
26
+ # underlying software originally provided by Alliance without the prior written
27
+ # consent of Alliance.
28
+
29
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
30
+ # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
31
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
32
+ # IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
33
+ # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
+ # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
36
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
37
+ # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
38
+ # OF THE POSSIBILITY OF SUCH DAMAGE.
39
+ # *********************************************************************************
40
+
41
+ require 'urbanopt/rnm/logger'
42
+ require 'json'
43
+ require 'csv'
44
+ require 'set'
45
+ require 'matrix'
46
+
47
+ module URBANopt
48
+ module RNM
49
+ class WiresExtendedCatalog
50
+ attr_accessor :x, :height, :gmr, :r, :ampacity, :diameter, :phase, :name, :type, :r_neutral, :gmr_neutral, :neutral_strands, :diameter_n_strand, :outside_diamater_neutral
51
+
52
+ def initialize
53
+ self.x = []
54
+ self.height = []
55
+ self.gmr = []
56
+ self.r = []
57
+ self.ampacity = []
58
+ self.diameter = []
59
+ self.phase = []
60
+ self.name = []
61
+ self.type = []
62
+ self.r_neutral = []
63
+ self.gmr_neutral = []
64
+ self.neutral_strands = []
65
+ self.diameter_n_strand = []
66
+ self.outside_diamater_neutral = []
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,93 @@
1
+ # *********************************************************************************
2
+ # URBANopt (tm), Copyright (c) 2019-2021, Alliance for Sustainable Energy, LLC, and other
3
+ # contributors. All rights reserved.
4
+
5
+ # Redistribution and use in source and binary forms, with or without modification,
6
+ # are permitted provided that the following conditions are met:
7
+
8
+ # Redistributions of source code must retain the above copyright notice, this list
9
+ # of conditions and the following disclaimer.
10
+
11
+ # Redistributions in binary form must reproduce the above copyright notice, this
12
+ # list of conditions and the following disclaimer in the documentation and/or other
13
+ # materials provided with the distribution.
14
+
15
+ # Neither the name of the copyright holder nor the names of its contributors may be
16
+ # used to endorse or promote products derived from this software without specific
17
+ # prior written permission.
18
+
19
+ # Redistribution of this software, without modification, must refer to the software
20
+ # by the same designation. Redistribution of a modified version of this software
21
+ # (i) may not refer to the modified version by the same designation, or by any
22
+ # confusingly similar designation, and (ii) must refer to the underlying software
23
+ # originally provided by Alliance as "URBANopt". Except to comply with the foregoing,
24
+ # the term "URBANopt", or any confusingly similar designation may not be used to
25
+ # refer to any modified version of this software or any modified version of the
26
+ # underlying software originally provided by Alliance without the prior written
27
+ # consent of Alliance.
28
+
29
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
30
+ # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
31
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
32
+ # IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
33
+ # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
+ # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
36
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
37
+ # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
38
+ # OF THE POSSIBILITY OF SUCH DAMAGE.
39
+ # *********************************************************************************
40
+ module URBANopt
41
+ module RNM
42
+ # creating the WiresOpendss class with required parameters by the OpenDSS catalog
43
+ class WiresOpendss
44
+ attr_accessor :fields, :value
45
+
46
+ def initialize
47
+ self.value = []
48
+ self.fields = []
49
+ end
50
+
51
+ def create(line_geometry, conductor)
52
+ # providing all info in ft
53
+ hash = {}
54
+ conductor.each do |k, v|
55
+ if k.include? '(mm)'
56
+ # new_key = "#{k.sub('(mm)', '')}(ft)"
57
+ new_key = "#{k.sub(' (mm)', '').gsub(' ','_')}"
58
+ hash[new_key] = v
59
+ elsif k.include? '(A)'
60
+ new_key = "#{k.sub(' (A)', '').gsub(' ','_')}"
61
+ hash[new_key] = v
62
+ elsif k.include? '#'
63
+ new_key = "#{k.sub('#', 'num').gsub(' ', '_')}"
64
+ hash[new_key] = v
65
+ elsif k.include? '(ohm/km)'
66
+ # new_key = "#{k.sub('(ohm/km)', '')}(ohm/mi)"
67
+ new_key = "#{k.sub(' (ohm/km)', '').gsub(' ','_')}"
68
+ hash[new_key] = v
69
+ elsif k != 'voltage level' && k != 'type'
70
+ new_key = "#{k.gsub(' ', '_')}"
71
+ hash[new_key] = v
72
+ else
73
+ new_key = "#{k.gsub(' ', '_')}"
74
+ hash[new_key] = v
75
+ end
76
+ end
77
+ line_geometry.each do |k, v|
78
+ hash[k] = v
79
+ if k.include? 'wire'
80
+ hash.delete(k)
81
+
82
+ elsif k.include? '(m)'
83
+ hash.delete(k)
84
+ k = k.split(' ')[0]
85
+ new_key = "#{k.sub(' ', '_')}"
86
+ hash[new_key] = v
87
+ end
88
+ end
89
+ return hash
90
+ end
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,37 @@
1
+ lib = File.expand_path('lib', __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'urbanopt/rnm/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'urbanopt-rnm-us'
7
+ spec.version = URBANopt::RNM::VERSION
8
+ spec.authors = ['Katherine Fleming', 'Luca de Rosa']
9
+ spec.email = ['katherine.fleming@nrel.gov', 'luca.derosa@iit.comillas.edu']
10
+
11
+ spec.summary = 'Library to create input files for RNM-US'
12
+ spec.description = 'Library to create input files for RNM-US'
13
+ spec.homepage = 'https://github.com/urbanopt/urbanopt-RNM-us-gem'
14
+
15
+ # Specify which files should be added to the gem when it is released.
16
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
17
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
18
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ end
20
+ spec.files += Dir.glob('catalogs/**')
21
+ spec.bindir = 'exe'
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ['lib', 'catalogs']
24
+ spec.required_ruby_version = '~> 2.7.0'
25
+
26
+ spec.add_dependency 'faraday', '1.0.1'
27
+ spec.add_dependency 'geoutm', '~>1.0.2'
28
+ spec.add_dependency 'rubyzip', '2.3.0'
29
+ spec.add_dependency 'urbanopt-geojson', '~> 0.6.5'
30
+
31
+ spec.add_development_dependency 'bundler', '~> 2.1'
32
+ spec.add_development_dependency 'rake', '~> 13.0'
33
+ spec.add_development_dependency 'rspec', '~> 3.7'
34
+ spec.add_development_dependency 'rubocop', '~> 1.15.0'
35
+ spec.add_development_dependency 'rubocop-checkstyle_formatter', '~> 0.4.0'
36
+ spec.add_development_dependency 'rubocop-performance', '~> 1.11.3'
37
+ end
metadata ADDED
@@ -0,0 +1,218 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: urbanopt-rnm-us
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Katherine Fleming
8
+ - Luca de Rosa
9
+ autorequire:
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 2021-07-22 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: faraday
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '='
19
+ - !ruby/object:Gem::Version
20
+ version: 1.0.1
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '='
26
+ - !ruby/object:Gem::Version
27
+ version: 1.0.1
28
+ - !ruby/object:Gem::Dependency
29
+ name: geoutm
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: 1.0.2
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: 1.0.2
42
+ - !ruby/object:Gem::Dependency
43
+ name: rubyzip
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '='
47
+ - !ruby/object:Gem::Version
48
+ version: 2.3.0
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '='
54
+ - !ruby/object:Gem::Version
55
+ version: 2.3.0
56
+ - !ruby/object:Gem::Dependency
57
+ name: urbanopt-geojson
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: 0.6.5
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: 0.6.5
70
+ - !ruby/object:Gem::Dependency
71
+ name: bundler
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '2.1'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '2.1'
84
+ - !ruby/object:Gem::Dependency
85
+ name: rake
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - "~>"
89
+ - !ruby/object:Gem::Version
90
+ version: '13.0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - "~>"
96
+ - !ruby/object:Gem::Version
97
+ version: '13.0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: rspec
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - "~>"
103
+ - !ruby/object:Gem::Version
104
+ version: '3.7'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - "~>"
110
+ - !ruby/object:Gem::Version
111
+ version: '3.7'
112
+ - !ruby/object:Gem::Dependency
113
+ name: rubocop
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - "~>"
117
+ - !ruby/object:Gem::Version
118
+ version: 1.15.0
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: 1.15.0
126
+ - !ruby/object:Gem::Dependency
127
+ name: rubocop-checkstyle_formatter
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: 0.4.0
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: 0.4.0
140
+ - !ruby/object:Gem::Dependency
141
+ name: rubocop-performance
142
+ requirement: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - "~>"
145
+ - !ruby/object:Gem::Version
146
+ version: 1.11.3
147
+ type: :development
148
+ prerelease: false
149
+ version_requirements: !ruby/object:Gem::Requirement
150
+ requirements:
151
+ - - "~>"
152
+ - !ruby/object:Gem::Version
153
+ version: 1.11.3
154
+ description: Library to create input files for RNM-US
155
+ email:
156
+ - katherine.fleming@nrel.gov
157
+ - luca.derosa@iit.comillas.edu
158
+ executables: []
159
+ extensions: []
160
+ extra_rdoc_files: []
161
+ files:
162
+ - ".gitignore"
163
+ - ".rubocop.yml"
164
+ - CHANGELOG.md
165
+ - CONTRIBUTING.md
166
+ - Gemfile
167
+ - LICENSE.md
168
+ - README.md
169
+ - Rakefile
170
+ - catalogs/average_peak_per_building_type.json
171
+ - catalogs/extended_catalog.json
172
+ - lib/urbanopt-rnm.rb
173
+ - lib/urbanopt/rnm.rb
174
+ - lib/urbanopt/rnm/api_client.rb
175
+ - lib/urbanopt/rnm/capacitor_opendss.rb
176
+ - lib/urbanopt/rnm/carson_eq.rb
177
+ - lib/urbanopt/rnm/consumers.rb
178
+ - lib/urbanopt/rnm/conversion_to_opendss.rb
179
+ - lib/urbanopt/rnm/geojson_input.rb
180
+ - lib/urbanopt/rnm/input_files.rb
181
+ - lib/urbanopt/rnm/logger.rb
182
+ - lib/urbanopt/rnm/oh_ug_rate.rb
183
+ - lib/urbanopt/rnm/post_processor.rb
184
+ - lib/urbanopt/rnm/processor_opendss_catalog.rb
185
+ - lib/urbanopt/rnm/prosumers.rb
186
+ - lib/urbanopt/rnm/rnm_us_catalog_conversion.rb
187
+ - lib/urbanopt/rnm/runner.rb
188
+ - lib/urbanopt/rnm/scenario_report.rb
189
+ - lib/urbanopt/rnm/substation_location.rb
190
+ - lib/urbanopt/rnm/transformer_opendss.rb
191
+ - lib/urbanopt/rnm/version.rb
192
+ - lib/urbanopt/rnm/wires_class.rb
193
+ - lib/urbanopt/rnm/wires_opendss.rb
194
+ - urbanopt-rnm-us-gem.gemspec
195
+ homepage: https://github.com/urbanopt/urbanopt-RNM-us-gem
196
+ licenses: []
197
+ metadata: {}
198
+ post_install_message:
199
+ rdoc_options: []
200
+ require_paths:
201
+ - lib
202
+ - catalogs
203
+ required_ruby_version: !ruby/object:Gem::Requirement
204
+ requirements:
205
+ - - "~>"
206
+ - !ruby/object:Gem::Version
207
+ version: 2.7.0
208
+ required_rubygems_version: !ruby/object:Gem::Requirement
209
+ requirements:
210
+ - - ">="
211
+ - !ruby/object:Gem::Version
212
+ version: '0'
213
+ requirements: []
214
+ rubygems_version: 3.1.4
215
+ signing_key:
216
+ specification_version: 4
217
+ summary: Library to create input files for RNM-US
218
+ test_files: []