urbanopt-reopt 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/urbanopt/reopt/feature_report_adapter.rb +27 -41
- data/lib/urbanopt/reopt/scenario_report_adapter.rb +28 -43
- data/lib/urbanopt/reopt/utilities.rb +4 -0
- data/lib/urbanopt/reopt/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f0f86844f3e29a25c87ebff9c818f5dc4a4554b80c0b455ddaae85f98c47093
|
4
|
+
data.tar.gz: d439583ce26cb0c236186e20549310bb557b0c0a9c6348844198427c931f7774
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bc02806faa4366ed1dbb0eb53baa221b0d06b8a096f0a3bb8d9833c51d3c4846853f5b4fc477082baf546925365f25d4dc5b507bc4f6e6da820631f03f35bb8
|
7
|
+
data.tar.gz: 2fab1cd48a34c055adb4ea0e66aaf69b0e81c51e26b0bca8bdee30e4b5b454ae944f8e00175f0a5dc8f66b319377bcde1e0bdb4030525c9bb00a6e33e4dc7f3a
|
data/CHANGELOG.md
CHANGED
@@ -173,27 +173,7 @@ module URBANopt # :nodoc:
|
|
173
173
|
@@logger.info("Warning cannot Feature Report #{feature_report.name} #{feature_report.id} - REopt optimization was non-optimal")
|
174
174
|
return feature_report
|
175
175
|
end
|
176
|
-
|
177
|
-
$ts_per_hour = feature_report.timesteps_per_hour
|
178
|
-
def scale_timeseries(input, ts_per_hr=$ts_per_hour)
|
179
|
-
if input.nil?
|
180
|
-
return nil
|
181
|
-
end
|
182
|
-
if input.length ==0
|
183
|
-
return nil
|
184
|
-
end
|
185
|
-
if input.length == (8760 * ts_per_hr)
|
186
|
-
return input
|
187
|
-
end
|
188
|
-
result = []
|
189
|
-
input.each do |val|
|
190
|
-
(1..ts_per_hr).each do |x|
|
191
|
-
result.push(val/ts_per_hr.to_f)
|
192
|
-
end
|
193
|
-
end
|
194
|
-
return result
|
195
|
-
end
|
196
|
-
|
176
|
+
|
197
177
|
# Update location
|
198
178
|
feature_report.location.latitude_deg = reopt_output['inputs']['Scenario']['Site']['latitude']
|
199
179
|
feature_report.location.longitude_deg = reopt_output['inputs']['Scenario']['Site']['longitude']
|
@@ -281,70 +261,70 @@ module URBANopt # :nodoc:
|
|
281
261
|
feature_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Total(kw)')
|
282
262
|
end
|
283
263
|
|
284
|
-
$load =
|
264
|
+
$load = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['LoadProfile']['year_one_electric_load_series_kw'], reopt_resolution, feature_report.timesteps_per_hour) || [0] * (8760 * feature_report.timesteps_per_hour)
|
285
265
|
$load_col = feature_report.timeseries_csv.column_names.index('REopt:Electricity:Load:Total(kw)')
|
286
266
|
if $load_col.nil?
|
287
267
|
$load_col = feature_report.timeseries_csv.column_names.length
|
288
268
|
feature_report.timeseries_csv.column_names.push('REopt:Electricity:Load:Total(kw)')
|
289
269
|
end
|
290
270
|
|
291
|
-
$utility_to_load =
|
271
|
+
$utility_to_load = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['ElectricTariff']['year_one_to_load_series_kw'], reopt_resolution, feature_report.timesteps_per_hour) || [0] * (8760 * feature_report.timesteps_per_hour)
|
292
272
|
$utility_to_load_col = feature_report.timeseries_csv.column_names.index('REopt:Electricity:Grid:ToLoad(kw)')
|
293
273
|
if $utility_to_load_col.nil?
|
294
274
|
$utility_to_load_col = feature_report.timeseries_csv.column_names.length
|
295
275
|
feature_report.timeseries_csv.column_names.push('REopt:Electricity:Grid:ToLoad(kw)')
|
296
276
|
end
|
297
277
|
|
298
|
-
$utility_to_battery =
|
278
|
+
$utility_to_battery = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['ElectricTariff']['year_one_to_battery_series_kw'], reopt_resolution, feature_report.timesteps_per_hour) || [0] * (8760 * feature_report.timesteps_per_hour)
|
299
279
|
$utility_to_battery_col = feature_report.timeseries_csv.column_names.index('REopt:Electricity:Grid:ToBattery(kw)')
|
300
280
|
if $utility_to_battery_col.nil?
|
301
281
|
$utility_to_battery_col = feature_report.timeseries_csv.column_names.length
|
302
282
|
feature_report.timeseries_csv.column_names.push('REopt:Electricity:Grid:ToBattery(kw)')
|
303
283
|
end
|
304
284
|
|
305
|
-
$storage_to_load =
|
285
|
+
$storage_to_load = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['Storage']['year_one_to_load_series_kw'], reopt_resolution, feature_report.timesteps_per_hour) || [0] * (8760 * feature_report.timesteps_per_hour)
|
306
286
|
$storage_to_load_col = feature_report.timeseries_csv.column_names.index('REopt:Electricity:Storage:ToLoad(kw)')
|
307
287
|
if $storage_to_load_col.nil?
|
308
288
|
$storage_to_load_col = feature_report.timeseries_csv.column_names.length
|
309
289
|
feature_report.timeseries_csv.column_names.push('REopt:Electricity:Storage:ToLoad(kw)')
|
310
290
|
end
|
311
291
|
|
312
|
-
$storage_to_grid =
|
292
|
+
$storage_to_grid = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['Storage']['year_one_to_grid_series_kw'], reopt_resolution, feature_report.timesteps_per_hour) || [0] * (8760 * feature_report.timesteps_per_hour)
|
313
293
|
$storage_to_grid_col = feature_report.timeseries_csv.column_names.index('REopt:Electricity:Storage:ToGrid(kw)')
|
314
294
|
if $storage_to_grid_col.nil?
|
315
295
|
$storage_to_grid_col = feature_report.timeseries_csv.column_names.length
|
316
296
|
feature_report.timeseries_csv.column_names.push('REopt:Electricity:Storage:ToGrid(kw)')
|
317
297
|
end
|
318
298
|
|
319
|
-
$storage_soc =
|
299
|
+
$storage_soc = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['Storage']['year_one_soc_series_pct'], reopt_resolution, feature_report.timesteps_per_hour) || [0] * (8760 * feature_report.timesteps_per_hour)
|
320
300
|
$storage_soc_col = feature_report.timeseries_csv.column_names.index('REopt:Electricity:Storage:StateOfCharge(pct)')
|
321
301
|
if $storage_soc_col.nil?
|
322
302
|
$storage_soc_col = feature_report.timeseries_csv.column_names.length
|
323
303
|
feature_report.timeseries_csv.column_names.push('REopt:Electricity:Storage:StateOfCharge(pct)')
|
324
304
|
end
|
325
305
|
|
326
|
-
$generator_total =
|
306
|
+
$generator_total = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['Generator']['year_one_power_production_series_kw'], reopt_resolution, feature_report.timesteps_per_hour) || [0] * (8760 * feature_report.timesteps_per_hour)
|
327
307
|
$generator_total_col = feature_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Generator:Total(kw)')
|
328
308
|
if $generator_total_col.nil?
|
329
309
|
$generator_total_col = feature_report.timeseries_csv.column_names.length
|
330
310
|
feature_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Generator:Total(kw)')
|
331
311
|
end
|
332
312
|
|
333
|
-
$generator_to_battery =
|
313
|
+
$generator_to_battery = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['Generator']['year_one_to_battery_series_kw'], reopt_resolution, feature_report.timesteps_per_hour) || [0] * (8760 * feature_report.timesteps_per_hour)
|
334
314
|
$generator_to_battery_col = feature_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Generator:ToBattery(kw)')
|
335
315
|
if $generator_to_battery_col.nil?
|
336
316
|
$generator_to_battery_col = feature_report.timeseries_csv.column_names.length
|
337
317
|
feature_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Generator:ToBattery(kw)')
|
338
318
|
end
|
339
319
|
|
340
|
-
$generator_to_load =
|
320
|
+
$generator_to_load = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['Generator']['year_one_to_load_series_kw'], reopt_resolution, feature_report.timesteps_per_hour) || [0] * (8760 * feature_report.timesteps_per_hour)
|
341
321
|
$generator_to_load_col = feature_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Generator:ToLoad(kw)')
|
342
322
|
if $generator_to_load_col.nil?
|
343
323
|
$generator_to_load_col = feature_report.timeseries_csv.column_names.length
|
344
324
|
feature_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Generator:ToLoad(kw)')
|
345
325
|
end
|
346
326
|
|
347
|
-
$generator_to_grid =
|
327
|
+
$generator_to_grid = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['Generator']['year_one_to_grid_series_kw'], reopt_resolution, feature_report.timesteps_per_hour) || [0] * (8760 * feature_report.timesteps_per_hour)
|
348
328
|
$generator_to_grid_col = feature_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Generator:ToGrid(kw)')
|
349
329
|
if $generator_to_grid_col.nil?
|
350
330
|
$generator_to_grid_col = feature_report.timeseries_csv.column_names.length
|
@@ -383,10 +363,10 @@ module URBANopt # :nodoc:
|
|
383
363
|
|
384
364
|
reopt_output['outputs']['Scenario']['Site']['PV'].each_with_index do |pv, i|
|
385
365
|
if (pv['size_kw'] || 0) > 0
|
386
|
-
$pv_total += Matrix[
|
387
|
-
$pv_to_battery += Matrix[
|
388
|
-
$pv_to_load += Matrix[
|
389
|
-
$pv_to_grid += Matrix[
|
366
|
+
$pv_total += Matrix[convert_powerflow_resolution(pv['year_one_power_production_series_kw'], reopt_resolution, feature_report.timesteps_per_hour) || [0] * (8760 * feature_report.timesteps_per_hour)]
|
367
|
+
$pv_to_battery += Matrix[convert_powerflow_resolution(pv['year_one_to_battery_series_kw'], reopt_resolution, feature_report.timesteps_per_hour) || [0] * (8760 * feature_report.timesteps_per_hour)]
|
368
|
+
$pv_to_load += Matrix[convert_powerflow_resolution(pv['year_one_to_load_series_kw'], reopt_resolution, feature_report.timesteps_per_hour) || [0] * (8760 * feature_report.timesteps_per_hour)]
|
369
|
+
$pv_to_grid += Matrix[convert_powerflow_resolution(pv['year_one_to_grid_series_kw'], reopt_resolution, feature_report.timesteps_per_hour) || [0] * (8760 * feature_report.timesteps_per_hour)]
|
390
370
|
end
|
391
371
|
end
|
392
372
|
|
@@ -395,28 +375,28 @@ module URBANopt # :nodoc:
|
|
395
375
|
$pv_to_load = $pv_to_load.to_a[0]
|
396
376
|
$pv_to_grid = $pv_to_grid.to_a[0]
|
397
377
|
|
398
|
-
$wind_total =
|
378
|
+
$wind_total = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['Wind']['year_one_power_production_series_kw'], reopt_resolution, feature_report.timesteps_per_hour) || [0] * (8760 * feature_report.timesteps_per_hour)
|
399
379
|
$wind_total_col = feature_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Wind:Total(kw)')
|
400
380
|
if $wind_total_col.nil?
|
401
381
|
$wind_total_col = feature_report.timeseries_csv.column_names.length
|
402
382
|
feature_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Wind:Total(kw)')
|
403
383
|
end
|
404
384
|
|
405
|
-
$wind_to_battery =
|
385
|
+
$wind_to_battery = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['Wind']['year_one_to_battery_series_kw'], reopt_resolution, feature_report.timesteps_per_hour) || [0] * (8760 * feature_report.timesteps_per_hour)
|
406
386
|
$wind_to_battery_col = feature_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Wind:ToBattery(kw)')
|
407
387
|
if $wind_to_battery_col.nil?
|
408
388
|
$wind_to_battery_col = feature_report.timeseries_csv.column_names.length
|
409
389
|
feature_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Wind:ToBattery(kw)')
|
410
390
|
end
|
411
391
|
|
412
|
-
$wind_to_load =
|
392
|
+
$wind_to_load = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['Wind']['year_one_to_load_series_kw'], reopt_resolution, feature_report.timesteps_per_hour) || [0] * (8760 * feature_report.timesteps_per_hour)
|
413
393
|
$wind_to_load_col = feature_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Wind:ToLoad(kw)')
|
414
394
|
if $wind_to_load_col.nil?
|
415
395
|
$wind_to_load_col = feature_report.timeseries_csv.column_names.length
|
416
396
|
feature_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Wind:ToLoad(kw)')
|
417
397
|
end
|
418
398
|
|
419
|
-
$wind_to_grid =
|
399
|
+
$wind_to_grid = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['Wind']['year_one_to_grid_series_kw'], reopt_resolution, feature_report.timesteps_per_hour) || [0] * (8760 * feature_report.timesteps_per_hour)
|
420
400
|
$wind_to_grid_col = feature_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Wind:ToGrid(kw)')
|
421
401
|
if $wind_to_grid_col.nil?
|
422
402
|
$wind_to_grid_col = feature_report.timeseries_csv.column_names.length
|
@@ -448,8 +428,14 @@ module URBANopt # :nodoc:
|
|
448
428
|
|
449
429
|
old_data = CSV.open(feature_report.timeseries_csv.path).read
|
450
430
|
start_date = Time.parse(old_data[1][0])
|
451
|
-
start_ts = (
|
452
|
-
|
431
|
+
start_ts = (
|
432
|
+
(
|
433
|
+
((start_date.yday - 1) * 60.0 * 60.0 * 24) +
|
434
|
+
(((start_date.hour) - 1) * 60.0 * 60.0) +
|
435
|
+
(start_date.min * 60.0) + start_date.sec ) /
|
436
|
+
(( 60 / feature_report.timesteps_per_hour ) * 60)
|
437
|
+
).to_int
|
438
|
+
|
453
439
|
mod_data = old_data.map.with_index do |x, i|
|
454
440
|
if i > 0
|
455
441
|
modrow(x, start_ts + i -2)
|
@@ -210,27 +210,7 @@ module URBANopt # :nodoc:
|
|
210
210
|
@@logger.info("Warning cannot Feature Report #{scenario_report.name} #{scenario_report.id} - REopt optimization was non-optimal")
|
211
211
|
return scenario_report
|
212
212
|
end
|
213
|
-
|
214
|
-
$ts_per_hour = scenario_report.timesteps_per_hour
|
215
|
-
def scale_timeseries(input, ts_per_hr=$ts_per_hour)
|
216
|
-
if input.nil?
|
217
|
-
return nil
|
218
|
-
end
|
219
|
-
if input.length ==0
|
220
|
-
return nil
|
221
|
-
end
|
222
|
-
if input.length == (8760 * ts_per_hr)
|
223
|
-
return input
|
224
|
-
end
|
225
|
-
result = []
|
226
|
-
input.each do |val|
|
227
|
-
(1..ts_per_hr).each do |x|
|
228
|
-
result.push(val/ts_per_hr.to_f)
|
229
|
-
end
|
230
|
-
end
|
231
|
-
return result
|
232
|
-
end
|
233
|
-
|
213
|
+
|
234
214
|
# Update location
|
235
215
|
scenario_report.location.latitude_deg = reopt_output['inputs']['Scenario']['Site']['latitude']
|
236
216
|
scenario_report.location.longitude_deg = reopt_output['inputs']['Scenario']['Site']['longitude']
|
@@ -317,70 +297,70 @@ module URBANopt # :nodoc:
|
|
317
297
|
scenario_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Total(kw)')
|
318
298
|
end
|
319
299
|
|
320
|
-
$load =
|
300
|
+
$load = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['LoadProfile']['year_one_electric_load_series_kw'], reopt_resolution, scenario_report.timesteps_per_hour) || [0] * (8760 * scenario_report.timesteps_per_hour)
|
321
301
|
$load_col = scenario_report.timeseries_csv.column_names.index('REopt:Electricity:Load:Total(kw)')
|
322
302
|
if $load_col.nil?
|
323
303
|
$load_col = scenario_report.timeseries_csv.column_names.length
|
324
304
|
scenario_report.timeseries_csv.column_names.push('REopt:Electricity:Load:Total(kw)')
|
325
305
|
end
|
326
306
|
|
327
|
-
$utility_to_load =
|
307
|
+
$utility_to_load = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['ElectricTariff']['year_one_to_load_series_kw'], reopt_resolution, scenario_report.timesteps_per_hour) || [0] * (8760 * scenario_report.timesteps_per_hour)
|
328
308
|
$utility_to_load_col = scenario_report.timeseries_csv.column_names.index('REopt:Electricity:Grid:ToLoad(kw)')
|
329
309
|
if $utility_to_load_col.nil?
|
330
310
|
$utility_to_load_col = scenario_report.timeseries_csv.column_names.length
|
331
311
|
scenario_report.timeseries_csv.column_names.push('REopt:Electricity:Grid:ToLoad(kw)')
|
332
312
|
end
|
333
313
|
|
334
|
-
$utility_to_battery =
|
314
|
+
$utility_to_battery = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['ElectricTariff']['year_one_to_battery_series_kw'], reopt_resolution, scenario_report.timesteps_per_hour) || [0] * (8760 * scenario_report.timesteps_per_hour)
|
335
315
|
$utility_to_battery_col = scenario_report.timeseries_csv.column_names.index('REopt:Electricity:Grid:ToBattery(kw)')
|
336
316
|
if $utility_to_battery_col.nil?
|
337
317
|
$utility_to_battery_col = scenario_report.timeseries_csv.column_names.length
|
338
318
|
scenario_report.timeseries_csv.column_names.push('REopt:Electricity:Grid:ToBattery(kw)')
|
339
319
|
end
|
340
320
|
|
341
|
-
$storage_to_load =
|
321
|
+
$storage_to_load = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['Storage']['year_one_to_load_series_kw'], reopt_resolution, scenario_report.timesteps_per_hour) || [0] * (8760 * scenario_report.timesteps_per_hour)
|
342
322
|
$storage_to_load_col = scenario_report.timeseries_csv.column_names.index('REopt:Electricity:Storage:ToLoad(kw)')
|
343
323
|
if $storage_to_load_col.nil?
|
344
324
|
$storage_to_load_col = scenario_report.timeseries_csv.column_names.length
|
345
325
|
scenario_report.timeseries_csv.column_names.push('REopt:Electricity:Storage:ToLoad(kw)')
|
346
326
|
end
|
347
327
|
|
348
|
-
$storage_to_grid =
|
328
|
+
$storage_to_grid = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['Storage']['year_one_to_grid_series_kw'], reopt_resolution, scenario_report.timesteps_per_hour) || [0] * (8760 * scenario_report.timesteps_per_hour)
|
349
329
|
$storage_to_grid_col = scenario_report.timeseries_csv.column_names.index('REopt:Electricity:Storage:ToGrid(kw)')
|
350
330
|
if $storage_to_grid_col.nil?
|
351
331
|
$storage_to_grid_col = scenario_report.timeseries_csv.column_names.length
|
352
332
|
scenario_report.timeseries_csv.column_names.push('REopt:Electricity:Storage:ToGrid(kw)')
|
353
333
|
end
|
354
334
|
|
355
|
-
$storage_soc =
|
335
|
+
$storage_soc = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['Storage']['year_one_soc_series_pct'], reopt_resolution, scenario_report.timesteps_per_hour) || [0] * (8760 * scenario_report.timesteps_per_hour)
|
356
336
|
$storage_soc_col = scenario_report.timeseries_csv.column_names.index('REopt:Electricity:Storage:StateOfCharge(pct)')
|
357
337
|
if $storage_soc_col.nil?
|
358
338
|
$storage_soc_col = scenario_report.timeseries_csv.column_names.length
|
359
339
|
scenario_report.timeseries_csv.column_names.push('REopt:Electricity:Storage:StateOfCharge(pct)')
|
360
340
|
end
|
361
341
|
|
362
|
-
$generator_total =
|
342
|
+
$generator_total = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['Generator']['year_one_power_production_series_kw'], reopt_resolution, scenario_report.timesteps_per_hour) || [0] * (8760 * scenario_report.timesteps_per_hour)
|
363
343
|
$generator_total_col = scenario_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Generator:Total(kw)')
|
364
344
|
if $generator_total_col.nil?
|
365
345
|
$generator_total_col = scenario_report.timeseries_csv.column_names.length
|
366
346
|
scenario_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Generator:Total(kw)')
|
367
347
|
end
|
368
348
|
|
369
|
-
$generator_to_battery =
|
349
|
+
$generator_to_battery = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['Generator']['year_one_to_battery_series_kw'], reopt_resolution, scenario_report.timesteps_per_hour) || [0] * (8760 * scenario_report.timesteps_per_hour)
|
370
350
|
$generator_to_battery_col = scenario_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Generator:ToBattery(kw)')
|
371
351
|
if $generator_to_battery_col.nil?
|
372
352
|
$generator_to_battery_col = scenario_report.timeseries_csv.column_names.length
|
373
353
|
scenario_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Generator:ToBattery(kw)')
|
374
354
|
end
|
375
355
|
|
376
|
-
$generator_to_load =
|
356
|
+
$generator_to_load = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['Generator']['year_one_to_load_series_kw'], reopt_resolution, scenario_report.timesteps_per_hour) || [0] * (8760 * scenario_report.timesteps_per_hour)
|
377
357
|
$generator_to_load_col = scenario_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Generator:ToLoad(kw)')
|
378
358
|
if $generator_to_load_col.nil?
|
379
359
|
$generator_to_load_col = scenario_report.timeseries_csv.column_names.length
|
380
360
|
scenario_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Generator:ToLoad(kw)')
|
381
361
|
end
|
382
362
|
|
383
|
-
$generator_to_grid =
|
363
|
+
$generator_to_grid = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['Generator']['year_one_to_grid_series_kw'], reopt_resolution, scenario_report.timesteps_per_hour) || [0] * (8760 * scenario_report.timesteps_per_hour)
|
384
364
|
$generator_to_grid_col = scenario_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Generator:ToGrid(kw)')
|
385
365
|
if $generator_to_grid_col.nil?
|
386
366
|
$generator_to_grid_col = scenario_report.timeseries_csv.column_names.length
|
@@ -418,10 +398,10 @@ module URBANopt # :nodoc:
|
|
418
398
|
|
419
399
|
reopt_output['outputs']['Scenario']['Site']['PV'].each_with_index do |pv, i|
|
420
400
|
if (pv['size_kw'] || 0) > 0
|
421
|
-
$pv_total += Matrix[
|
422
|
-
$pv_to_battery += Matrix[
|
423
|
-
$pv_to_load += Matrix[
|
424
|
-
$pv_to_grid += Matrix[
|
401
|
+
$pv_total += Matrix[convert_powerflow_resolution(pv['year_one_power_production_series_kw'], reopt_resolution, scenario_report.timesteps_per_hour) || [0] * (8760 * scenario_report.timesteps_per_hour)]
|
402
|
+
$pv_to_battery += Matrix[convert_powerflow_resolution(pv['year_one_to_battery_series_kw'], reopt_resolution, scenario_report.timesteps_per_hour) || [0] * (8760 * scenario_report.timesteps_per_hour)]
|
403
|
+
$pv_to_load += Matrix[convert_powerflow_resolution(pv['year_one_to_load_series_kw'], reopt_resolution, scenario_report.timesteps_per_hour) || [0] * (8760 * scenario_report.timesteps_per_hour)]
|
404
|
+
$pv_to_grid += Matrix[convert_powerflow_resolution(pv['year_one_to_grid_series_kw'], reopt_resolution, scenario_report.timesteps_per_hour) || [0] * (8760 * scenario_report.timesteps_per_hour)]
|
425
405
|
end
|
426
406
|
end
|
427
407
|
|
@@ -430,28 +410,28 @@ module URBANopt # :nodoc:
|
|
430
410
|
$pv_to_load = $pv_to_load.to_a[0]
|
431
411
|
$pv_to_grid = $pv_to_grid.to_a[0]
|
432
412
|
|
433
|
-
$wind_total =
|
413
|
+
$wind_total = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['Wind']['year_one_power_production_series_kw'], reopt_resolution, scenario_report.timesteps_per_hour) || [0] * (8760 * scenario_report.timesteps_per_hour)
|
434
414
|
$wind_total_col = scenario_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Wind:Total(kw)')
|
435
415
|
if $wind_total_col.nil?
|
436
416
|
$wind_total_col = scenario_report.timeseries_csv.column_names.length
|
437
417
|
scenario_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Wind:Total(kw)')
|
438
418
|
end
|
439
419
|
|
440
|
-
$wind_to_battery =
|
420
|
+
$wind_to_battery = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['Wind']['year_one_to_battery_series_kw'], reopt_resolution, scenario_report.timesteps_per_hour) || [0] * (8760 * scenario_report.timesteps_per_hour)
|
441
421
|
$wind_to_battery_col = scenario_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Wind:ToBattery(kw)')
|
442
422
|
if $wind_to_battery_col.nil?
|
443
423
|
$wind_to_battery_col = scenario_report.timeseries_csv.column_names.length
|
444
424
|
scenario_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Wind:ToBattery(kw)')
|
445
425
|
end
|
446
426
|
|
447
|
-
$wind_to_load =
|
427
|
+
$wind_to_load = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['Wind']['year_one_to_load_series_kw'], reopt_resolution, scenario_report.timesteps_per_hour) || [0] * (8760 * scenario_report.timesteps_per_hour)
|
448
428
|
$wind_to_load_col = scenario_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Wind:ToLoad(kw)')
|
449
429
|
if $wind_to_load_col.nil?
|
450
430
|
$wind_to_load_col = scenario_report.timeseries_csv.column_names.length
|
451
431
|
scenario_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Wind:ToLoad(kw)')
|
452
432
|
end
|
453
433
|
|
454
|
-
$wind_to_grid =
|
434
|
+
$wind_to_grid = convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['Wind']['year_one_to_grid_series_kw'], reopt_resolution, scenario_report.timesteps_per_hour) || [0] * (8760 * scenario_report.timesteps_per_hour)
|
455
435
|
$wind_to_grid_col = scenario_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Wind:ToGrid(kw)')
|
456
436
|
if $wind_to_grid_col.nil?
|
457
437
|
$wind_to_grid_col = scenario_report.timeseries_csv.column_names.length
|
@@ -482,17 +462,22 @@ module URBANopt # :nodoc:
|
|
482
462
|
end
|
483
463
|
|
484
464
|
old_data = CSV.open(scenario_report.timeseries_csv.path).read
|
485
|
-
start_date = Time.parse(old_data[1][0])
|
486
|
-
start_ts = (
|
465
|
+
start_date = Time.parse(old_data[1][0]) # Time is the end of the timestep
|
466
|
+
start_ts = (
|
467
|
+
(
|
468
|
+
((start_date.yday - 1) * 60.0 * 60.0 * 24) +
|
469
|
+
(((start_date.hour) - 1) * 60.0 * 60.0) +
|
470
|
+
(start_date.min * 60.0) + start_date.sec ) /
|
471
|
+
(( 60 / scenario_report.timesteps_per_hour ) * 60)
|
472
|
+
).to_int
|
487
473
|
mod_data = old_data.map.with_index do |x, i|
|
488
474
|
if i > 0
|
489
|
-
modrow(x, start_ts + i -
|
475
|
+
modrow(x, start_ts + i -1)
|
490
476
|
else
|
491
477
|
x
|
492
478
|
end
|
493
479
|
end
|
494
480
|
mod_data[0] = scenario_report.timeseries_csv.column_names
|
495
|
-
|
496
481
|
scenario_report.timeseries_csv.reload_data(mod_data)
|
497
482
|
return scenario_report
|
498
483
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: urbanopt-reopt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|