urbanopt-rnm-us 0.1.2 → 0.1.3
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -1
- data/Jenkinsfile +10 -0
- data/lib/urbanopt/rnm/api_client.rb +54 -36
- data/lib/urbanopt/rnm/consumers.rb +3 -1
- data/lib/urbanopt/rnm/prosumers.rb +2 -1
- data/lib/urbanopt/rnm/scenario_report.rb +1 -1
- data/lib/urbanopt/rnm/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d6d3af9851a2d2d27287ebfcff92f6951fd8747beeb35ec32e6b6739b9f2582
|
4
|
+
data.tar.gz: 067ffb458bc07753783766c9457f009581b63a89971390133f6a243953435a36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3789bcdc78b733b7a64edde02612a8be60f7b546b1c889a550fbeb7497c7c13c3210ed1da35d076e7c848a10cec37f3a449366ae7b178a32667070ca52db014e
|
7
|
+
data.tar.gz: c7b15977b63cf466a5726bb3941b3366e766dc807f331d3830b6ae82d1ce94b737da9b7750675e4509d5dd4ca2f3d9aadf66257be32f6cf2c097f2aa27567c37
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,18 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## Version 0.1.3
|
4
|
+
|
5
|
+
Date Range 11/02/21 - 11/08/21
|
6
|
+
|
7
|
+
- Fix [#11](https://github.com/urbanopt/urbanopt-rnm-us-gem/issues/11), results files are not downloading in project directory for large projects
|
8
|
+
|
9
|
+
- Fix [#16](https://github.com/urbanopt/urbanopt-rnm-us-gem/issues/16), fix residential enums to be consistent across files and fix typo in multifamily
|
10
|
+
|
3
11
|
## Version 0.1.2
|
4
12
|
|
5
13
|
Date Range 10/29/21 - 11/01/21
|
6
14
|
|
7
|
-
- Fix [#13]
|
15
|
+
- Fix [#13](https://github.com/urbanopt/urbanopt-rnm-us-gem/issues/13), update rubyzip dependency to fix conflict
|
8
16
|
|
9
17
|
## Version 0.1.1
|
10
18
|
|
data/Jenkinsfile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
//Jenkins pipelines are stored in shared libaries. Please see: https://github.com/tijcolem/nrel_cbci_jenkins_libs
|
2
|
+
|
3
|
+
@Library('cbci_shared_libs') _
|
4
|
+
|
5
|
+
// Build for PR to develop branch only.
|
6
|
+
if ((env.CHANGE_ID) && (env.CHANGE_TARGET) ) { // check if set
|
7
|
+
|
8
|
+
urbanopt_rnm_us()
|
9
|
+
|
10
|
+
}
|
@@ -177,52 +177,70 @@ module URBANopt
|
|
177
177
|
# prepare results directory
|
178
178
|
prepare_results_dir
|
179
179
|
|
180
|
-
max_tries =
|
180
|
+
max_tries = 20
|
181
181
|
tries = 0
|
182
182
|
puts "attempting to retrieve results for simulation #{@sim_id}"
|
183
183
|
while !done && (max_tries != tries)
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
if data['
|
192
|
-
|
184
|
+
begin
|
185
|
+
resp = conn.get("simulations/#{@sim_id}")
|
186
|
+
if resp.status == 200
|
187
|
+
data = JSON.parse(resp.body)
|
188
|
+
if data['status'] && ['failed', 'completed'].include?(data['status'])
|
189
|
+
# done
|
190
|
+
done = true
|
191
|
+
if data['status'] == 'failed'
|
192
|
+
if data['results'] && data['results']['message']
|
193
|
+
puts "Simulation Error: #{data['results']['message']}"
|
194
|
+
else
|
195
|
+
puts 'Simulation Error!'
|
196
|
+
end
|
193
197
|
else
|
194
|
-
|
198
|
+
# edge case, check for results
|
199
|
+
if data['results'].nil?
|
200
|
+
puts "got a 200 but results are null...trying again"
|
201
|
+
tries += 1
|
202
|
+
sleep(3)
|
203
|
+
else
|
204
|
+
# get results
|
205
|
+
@results = data['results'] || []
|
206
|
+
|
207
|
+
puts "downloading results"
|
208
|
+
# download results
|
209
|
+
download_results
|
210
|
+
return @results
|
211
|
+
end
|
195
212
|
end
|
196
213
|
else
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
# download results
|
201
|
-
download_results
|
202
|
-
|
203
|
-
return @results
|
214
|
+
puts "no status yet...trying again"
|
215
|
+
tries += 1
|
216
|
+
sleep(3)
|
204
217
|
end
|
218
|
+
|
205
219
|
else
|
220
|
+
puts("ERROR retrieving: #{resp.body}")
|
206
221
|
tries += 1
|
207
|
-
sleep(1)
|
208
|
-
end
|
209
222
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
# try again
|
221
|
-
puts("TRYING AGAIN...#{tries}")
|
222
|
-
sleep(3)
|
223
|
+
if tries == max_tries
|
224
|
+
# now raise the error
|
225
|
+
msg = "Error retrieving simulation #{@sim_id}. error code: #{resp.status}"
|
226
|
+
@@logger.error(msg)
|
227
|
+
raise msg
|
228
|
+
else
|
229
|
+
# try again
|
230
|
+
puts("TRYING AGAIN...#{tries}")
|
231
|
+
sleep(3)
|
232
|
+
end
|
223
233
|
end
|
234
|
+
rescue => error
|
235
|
+
@@logger.error("Error retrieving simulation #{@sim_id}.")
|
236
|
+
@@logger.error(error.message)
|
237
|
+
raise error.message
|
224
238
|
end
|
225
239
|
end
|
240
|
+
if !done
|
241
|
+
@@logger.error("Error retrieving simulation #{@sim_id}.")
|
242
|
+
raise 'Simulation not retrieved...maximum tries reached'
|
243
|
+
end
|
226
244
|
end
|
227
245
|
|
228
246
|
##
|
@@ -243,14 +261,14 @@ module URBANopt
|
|
243
261
|
streamed << chunk
|
244
262
|
end
|
245
263
|
end
|
246
|
-
# puts("STATUS: #{resp.status}, #{resp.body}")
|
247
264
|
|
248
265
|
if resp.status == 200
|
249
266
|
|
250
267
|
file_path = File.join(@rnm_dir, 'results', 'results.zip')
|
251
268
|
|
252
269
|
File.open(file_path, 'wb') { |f| f.write streamed.join }
|
253
|
-
|
270
|
+
puts "RNM-US results.zip downloaded to #{@rnm_dir}"
|
271
|
+
|
254
272
|
# unzip
|
255
273
|
Zip::File.open(file_path) do |zip_file|
|
256
274
|
zip_file.each do |f|
|
@@ -259,7 +277,7 @@ module URBANopt
|
|
259
277
|
zip_file.extract(f, f_path) unless File.exist?(f_path)
|
260
278
|
end
|
261
279
|
end
|
262
|
-
|
280
|
+
puts "results.zip extracted"
|
263
281
|
# delete zip
|
264
282
|
File.delete(file_path)
|
265
283
|
|
@@ -79,6 +79,7 @@ module URBANopt
|
|
79
79
|
yearly_profile_node_reactive = []
|
80
80
|
nodes_per_bldg, area, medium_voltage = av_peak_cons_per_building_type(folder['building_types'])
|
81
81
|
# the default variables are defined (i.e. type and rurality type)
|
82
|
+
puts "consumers 82"
|
82
83
|
closest_node = building_map[3].split('_')[1].to_i # refers to the node, found in the class above
|
83
84
|
node = closest_node
|
84
85
|
cont = 1
|
@@ -219,7 +220,8 @@ module URBANopt
|
|
219
220
|
single_values = Hash.new(0)
|
220
221
|
hours = 24 * n_timestep_per_hour -1
|
221
222
|
feature_type = json_feature_report['program']['building_types'][0]['building_type']
|
222
|
-
residential_building_types = [
|
223
|
+
residential_building_types = ['Single-Family Detached', 'Single-Family Attached', 'Multifamily', 'Single-Family', 'Multifamily Detached (2 to 4 units)', 'Multifamily Detached (5 or more units)']
|
224
|
+
|
223
225
|
# finding the index where to start computing and saving the info, from the value of the "worst-case hour" for the max peak consumption of the district
|
224
226
|
if residential_building_types.include? feature_type
|
225
227
|
profile_start_max = hour.hour_index_max_res - ((hour.peak_hour_max_res.split(':')[0].to_i + (hour.peak_hour_max_res.split(':')[1].to_i / 60)) * n_timestep_per_hour)
|
@@ -320,7 +320,8 @@ module URBANopt
|
|
320
320
|
@medium_voltage = false
|
321
321
|
hours = 24 * n_timestep_per_hour -1 # change name, maybe to intervals
|
322
322
|
feature_type = json_feature_report['program']['building_types'][0]["building_type"]
|
323
|
-
residential_building_types = [
|
323
|
+
residential_building_types = ['Single-Family Detached', 'Single-Family Attached', 'Multifamily', 'Single-Family', 'Multifamily Detached (2 to 4 units)', 'Multifamily Detached (5 or more units)']
|
324
|
+
|
324
325
|
# finding the index where to start computing and saving the info, from the value of the "worst-case hour" for the max peak consumption of the district
|
325
326
|
# considering num timestep per hours and the fact that each day starts from 1 am
|
326
327
|
if residential_building_types.include? feature_type
|
@@ -112,7 +112,7 @@ module URBANopt
|
|
112
112
|
def aggregate_consumption(file_csv, file_json, n_feature)
|
113
113
|
feature_type = file_json['program']['building_types'][0]['building_type']
|
114
114
|
# residential_building_types = "Single-Family Detached" #add the other types
|
115
|
-
residential_building_types = ['Single-Family Detached', 'Single-Family Attached', '
|
115
|
+
residential_building_types = ['Single-Family Detached', 'Single-Family Attached', 'Multifamily', 'Single-Family', 'Multifamily Detached (2 to 4 units)', 'Multifamily Detached (5 or more units)'] # add the other types
|
116
116
|
puts feature_type
|
117
117
|
j = 0
|
118
118
|
CSV.foreach(file_csv, headers: true) do |power|
|
data/lib/urbanopt/rnm/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: urbanopt-rnm-us
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katherine Fleming
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-11-
|
12
|
+
date: 2021-11-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -164,6 +164,7 @@ files:
|
|
164
164
|
- CHANGELOG.md
|
165
165
|
- CONTRIBUTING.md
|
166
166
|
- Gemfile
|
167
|
+
- Jenkinsfile
|
167
168
|
- LICENSE.md
|
168
169
|
- README.md
|
169
170
|
- Rakefile
|