urbanopt-reopt 0.5.0 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
data/docs/package.json CHANGED
@@ -10,13 +10,17 @@
10
10
  },
11
11
  "author": "NREL",
12
12
  "dependencies": {
13
+ "braces": "^3.0.2",
13
14
  "highlight.js": "^10.4.1",
14
15
  "json-schema-ref-parser": "^6.1.0",
15
16
  "json-schema-view-js": "git+https://git@github.com/bgschiller/json-schema-view-js.git",
16
- "vuepress": "^0.14.10",
17
- "webpack-dev-middleware": "^3.6.0"
17
+ "serialize-javascript": "^5.0.1",
18
+ "vuepress": "^1.6.0",
19
+ "webpack-dev-middleware": "^3.6.0",
20
+ "yargs-parser": "^18.1.1"
18
21
  },
19
22
  "devDependencies": {
20
- "gh-pages": "^2.0.1"
23
+ "gh-pages": "^2.0.1",
24
+ "ini": "^2.0.0"
21
25
  }
22
26
  }
@@ -32,6 +32,7 @@ require 'urbanopt/reporting/default_reports'
32
32
  require 'urbanopt/reopt/reopt_logger'
33
33
  require 'csv'
34
34
  require 'matrix'
35
+ require_relative 'utilities'
35
36
  require 'time'
36
37
 
37
38
  module URBANopt # :nodoc:
@@ -87,24 +88,30 @@ module URBANopt # :nodoc:
87
88
  reopt_inputs[:Scenario][:Site][:latitude] = feature_report.location.latitude_deg
88
89
  reopt_inputs[:Scenario][:Site][:longitude] = feature_report.location.longitude_deg
89
90
 
90
- # Parse Optional FeatureReport metrics
91
- unless feature_report.program.roof_area_sqft.nil?
92
- reopt_inputs[:Scenario][:Site][:roof_squarefeet] = feature_report.program.roof_area_sqft[:available_roof_area]
91
+ # Parse Optional FeatureReport metrics - do not overwrite from assumptions file
92
+ if reopt_inputs[:Scenario][:Site][:roof_squarefeet].nil?
93
+ unless feature_report.program.roof_area_sqft.nil?
94
+ reopt_inputs[:Scenario][:Site][:roof_squarefeet] = feature_report.program.roof_area_sqft[:available_roof_area_sqft]
95
+ end
93
96
  end
94
97
 
95
- unless feature_report.program.site_area_sqft.nil?
96
- reopt_inputs[:Scenario][:Site][:land_acres] = feature_report.program.site_area_sqft * 1.0 / 43560 # acres/sqft
98
+ if reopt_inputs[:Scenario][:Site][:land_acres].nil?
99
+ unless feature_report.program.site_area_sqft.nil?
100
+ reopt_inputs[:Scenario][:Site][:land_acres] = feature_report.program.site_area_sqft * 1.0 / 43560 # acres/sqft
101
+ end
97
102
  end
98
103
 
99
- unless feature_report.timesteps_per_hour.nil?
100
- reopt_inputs[:Scenario][:time_steps_per_hour] = feature_report.timesteps_per_hour
104
+ if reopt_inputs[:Scenario][:time_steps_per_hour].nil?
105
+ reopt_inputs[:Scenario][:time_steps_per_hour] = 1
101
106
  end
102
107
 
103
108
  # Parse Load Profile
104
109
  begin
110
+ #Convert kWh values in the timeseries CSV to kW
105
111
  col_num = feature_report.timeseries_csv.column_names.index('Electricity:Facility(kWh)')
106
112
  t = CSV.read(feature_report.timeseries_csv.path, headers: true, converters: :numeric)
107
113
  energy_timeseries_kw = t.by_col[col_num].map { |e| ((e * feature_report.timesteps_per_hour || 0) ) }
114
+ #Fill in missing timestep values with 0 if a full year is not provided
108
115
  if energy_timeseries_kw.length < (feature_report.timesteps_per_hour * 8760)
109
116
  start_date = Time.parse(t.by_col["Datetime"][0])
110
117
  start_ts = (((start_date.yday * 60.0 * 60.0 * 24) + (start_date.hour * 60.0 * 60.0) + (start_date.min * 60.0) + start_date.sec) /
@@ -113,15 +120,42 @@ module URBANopt # :nodoc:
113
120
  end_ts = (((end_date.yday * 60.0 * 60.0 * 24) + (end_date.hour * 60.0 * 60.0) + (end_date.min * 60.0) + end_date.sec) /
114
121
  (( 60 / feature_report.timesteps_per_hour ) * 60)).to_int
115
122
  energy_timeseries_kw = [0.0]*(start_ts-1) + energy_timeseries_kw + [0.0]*((feature_report.timesteps_per_hour * 8760) - end_ts)
116
- end
117
- reopt_inputs[:Scenario][:Site][:LoadProfile][:loads_kw] = energy_timeseries_kw.map { |e| e ? e : 0 }[0,(feature_report.timesteps_per_hour * 8760)]
123
+ end
124
+ #Clip to one non-leap year's worth of data
125
+ energy_timeseries_kw = energy_timeseries_kw.map { |e| e ? e : 0 }[0,(feature_report.timesteps_per_hour * 8760)]
126
+ #Convert from the OpenDSS resolution to the REopt Lite resolution, if necessary
118
127
  rescue StandardError
119
128
  @@logger.error("Could not parse the annual electric load from the timeseries csv - #{feature_report.timeseries_csv.path}")
120
129
  raise "Could not parse the annual electric load from the timeseries csv - #{feature_report.timeseries_csv.path}"
121
130
  end
131
+
132
+ # Convert load to REopt Resolution
133
+ begin
134
+ reopt_inputs[:Scenario][:Site][:LoadProfile][:loads_kw] = convert_powerflow_resolution(energy_timeseries_kw, feature_report.timesteps_per_hour, reopt_inputs[:Scenario][:time_steps_per_hour])
135
+
136
+ rescue
137
+ @@logger.error("Could not convert the annual electric load from a resolution of #{feature_report.timesteps_per_hour} to #{reopt_inputs[:Scenario][:time_steps_per_hour]}")
138
+ raise "Could not convert the annual electric load from a resolution of #{feature_report.timesteps_per_hour} to #{reopt_inputs[:Scenario][:time_steps_per_hour]}"
139
+ end
140
+
141
+ if reopt_inputs[:Scenario][:Site][:ElectricTariff][:coincident_peak_load_active_timesteps].nil?
142
+ n_top_values = 100
143
+ tmp1 = reopt_inputs[:Scenario][:Site][:LoadProfile][:loads_kw]
144
+ tmp2 = tmp1.each_index.max_by(n_top_values*reopt_inputs[:Scenario][:time_steps_per_hour]){|i| tmp1[i]}
145
+ for i in (0...tmp2.count)
146
+ tmp2[i] += 1
147
+ end
148
+ reopt_inputs[:Scenario][:Site][:ElectricTariff][:coincident_peak_load_active_timesteps] = tmp2
149
+ end
150
+
151
+ if reopt_inputs[:Scenario][:Site][:ElectricTariff][:coincident_peak_load_charge_us_dollars_per_kw].nil?
152
+ reopt_inputs[:Scenario][:Site][:ElectricTariff][:coincident_peak_load_charge_us_dollars_per_kw] = 0
153
+ end
154
+
122
155
  return reopt_inputs
123
156
  end
124
157
 
158
+
125
159
  ##
126
160
  # Update a FeatureReport from a \REopt Lite response
127
161
  #
@@ -164,9 +198,6 @@ module URBANopt # :nodoc:
164
198
  feature_report.location.latitude_deg = reopt_output['inputs']['Scenario']['Site']['latitude']
165
199
  feature_report.location.longitude_deg = reopt_output['inputs']['Scenario']['Site']['longitude']
166
200
 
167
- # Update timeseries csv from \REopt Lite dispatch data
168
- feature_report.timesteps_per_hour = reopt_output['inputs']['Scenario']['time_steps_per_hour']
169
-
170
201
  # Update distributed generation sizing and financials
171
202
  feature_report.distributed_generation.lcc_us_dollars = reopt_output['outputs']['Scenario']['Site']['Financial']['lcc_us_dollars'] || 0
172
203
  feature_report.distributed_generation.npv_us_dollars = reopt_output['outputs']['Scenario']['Site']['Financial']['npv_us_dollars'] || 0
@@ -215,29 +246,22 @@ module URBANopt # :nodoc:
215
246
  end
216
247
 
217
248
  generation_timeseries_kwh = Matrix[[0] * (8760 * feature_report.timesteps_per_hour)]
249
+ reopt_resolution = reopt_output['inputs']['Scenario']['time_steps_per_hour']
218
250
 
219
251
  unless reopt_output['outputs']['Scenario']['Site']['PV'].nil?
220
252
  reopt_output['outputs']['Scenario']['Site']['PV'].each do |pv|
221
253
  if (pv['size_kw'] || 0) > 0
222
254
  if !pv['year_one_power_production_series_kw'].nil?
223
- generation_timeseries_kwh += Matrix[pv['year_one_power_production_series_kw']]
255
+ generation_timeseries_kwh += Matrix[convert_powerflow_resolution(pv['year_one_power_production_series_kw'], reopt_resolution, feature_report.timesteps_per_hour)]
224
256
  end
225
257
  end
226
258
  end
227
259
  end
228
260
 
229
- unless reopt_output['outputs']['Scenario']['Site']['Storage'].nil?
230
- if (reopt_output['outputs']['Scenario']['Site']['Storage']['size_kw'] or 0) > 0
231
- if !reopt_output['outputs']['Scenario']['Site']['Storage']['year_one_to_grid_series_kw'].nil?
232
- generation_timeseries_kwh = generation_timeseries_kwh + Matrix[reopt_output['outputs']['Scenario']['Site']['Storage']['year_one_to_grid_series_kw']]
233
- end
234
- end
235
- end
236
-
237
261
  unless reopt_output['outputs']['Scenario']['Site']['Wind'].nil?
238
262
  if (reopt_output['outputs']['Scenario']['Site']['Wind']['size_kw'] || 0) > 0
239
263
  if !reopt_output['outputs']['Scenario']['Site']['Wind']['year_one_power_production_series_kw'].nil?
240
- generation_timeseries_kwh += Matrix[reopt_output['outputs']['Scenario']['Site']['Wind']['year_one_power_production_series_kw']]
264
+ generation_timeseries_kwh += Matrix[convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['Wind']['year_one_power_production_series_kw'], reopt_resolution, feature_report.timesteps_per_hour)]
241
265
  end
242
266
  end
243
267
  end
@@ -245,7 +269,7 @@ module URBANopt # :nodoc:
245
269
  unless reopt_output['outputs']['Scenario']['Site']['Generator'].nil?
246
270
  if (reopt_output['outputs']['Scenario']['Site']['Generator']['size_kw'] || 0) > 0
247
271
  if !reopt_output['outputs']['Scenario']['Site']['Generator']['year_one_power_production_series_kw'].nil?
248
- generation_timeseries_kwh += Matrix[reopt_output['outputs']['Scenario']['Site']['Generator']['year_one_power_production_series_kw']]
272
+ generation_timeseries_kwh += Matrix[convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['Generator']['year_one_power_production_series_kw'], reopt_resolution, feature_report.timesteps_per_hour)]
249
273
  end
250
274
  end
251
275
  end
@@ -257,70 +281,70 @@ module URBANopt # :nodoc:
257
281
  feature_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Total(kw)')
258
282
  end
259
283
 
260
- $load = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['LoadProfile']['year_one_electric_load_series_kw']) || [0] * (8760 * feature_report.timesteps_per_hour)
284
+ $load = scale_timeseries(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)
261
285
  $load_col = feature_report.timeseries_csv.column_names.index('REopt:Electricity:Load:Total(kw)')
262
286
  if $load_col.nil?
263
287
  $load_col = feature_report.timeseries_csv.column_names.length
264
288
  feature_report.timeseries_csv.column_names.push('REopt:Electricity:Load:Total(kw)')
265
289
  end
266
290
 
267
- $utility_to_load = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['ElectricTariff']['year_one_to_load_series_kw']) || [0] * (8760 * feature_report.timesteps_per_hour)
291
+ $utility_to_load = scale_timeseries(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)
268
292
  $utility_to_load_col = feature_report.timeseries_csv.column_names.index('REopt:Electricity:Grid:ToLoad(kw)')
269
293
  if $utility_to_load_col.nil?
270
294
  $utility_to_load_col = feature_report.timeseries_csv.column_names.length
271
295
  feature_report.timeseries_csv.column_names.push('REopt:Electricity:Grid:ToLoad(kw)')
272
296
  end
273
297
 
274
- $utility_to_battery = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['ElectricTariff']['year_one_to_battery_series_kw']) || [0] * (8760 * feature_report.timesteps_per_hour)
298
+ $utility_to_battery = scale_timeseries(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)
275
299
  $utility_to_battery_col = feature_report.timeseries_csv.column_names.index('REopt:Electricity:Grid:ToBattery(kw)')
276
300
  if $utility_to_battery_col.nil?
277
301
  $utility_to_battery_col = feature_report.timeseries_csv.column_names.length
278
302
  feature_report.timeseries_csv.column_names.push('REopt:Electricity:Grid:ToBattery(kw)')
279
303
  end
280
304
 
281
- $storage_to_load = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['Storage']['year_one_to_load_series_kw']) || [0] * (8760 * feature_report.timesteps_per_hour)
305
+ $storage_to_load = scale_timeseries(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)
282
306
  $storage_to_load_col = feature_report.timeseries_csv.column_names.index('REopt:Electricity:Storage:ToLoad(kw)')
283
307
  if $storage_to_load_col.nil?
284
308
  $storage_to_load_col = feature_report.timeseries_csv.column_names.length
285
309
  feature_report.timeseries_csv.column_names.push('REopt:Electricity:Storage:ToLoad(kw)')
286
310
  end
287
311
 
288
- $storage_to_grid = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['Storage']['year_one_to_grid_series_kw']) || [0] * (8760 * feature_report.timesteps_per_hour)
312
+ $storage_to_grid = scale_timeseries(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)
289
313
  $storage_to_grid_col = feature_report.timeseries_csv.column_names.index('REopt:Electricity:Storage:ToGrid(kw)')
290
314
  if $storage_to_grid_col.nil?
291
315
  $storage_to_grid_col = feature_report.timeseries_csv.column_names.length
292
316
  feature_report.timeseries_csv.column_names.push('REopt:Electricity:Storage:ToGrid(kw)')
293
317
  end
294
318
 
295
- $storage_soc = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['Storage']['year_one_soc_series_pct']) || [0] * (8760 * feature_report.timesteps_per_hour)
319
+ $storage_soc = scale_timeseries(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)
296
320
  $storage_soc_col = feature_report.timeseries_csv.column_names.index('REopt:Electricity:Storage:StateOfCharge(pct)')
297
321
  if $storage_soc_col.nil?
298
322
  $storage_soc_col = feature_report.timeseries_csv.column_names.length
299
323
  feature_report.timeseries_csv.column_names.push('REopt:Electricity:Storage:StateOfCharge(pct)')
300
324
  end
301
325
 
302
- $generator_total = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['Generator']['year_one_power_production_series_kw']) || [0] * (8760 * feature_report.timesteps_per_hour)
326
+ $generator_total = scale_timeseries(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)
303
327
  $generator_total_col = feature_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Generator:Total(kw)')
304
328
  if $generator_total_col.nil?
305
329
  $generator_total_col = feature_report.timeseries_csv.column_names.length
306
330
  feature_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Generator:Total(kw)')
307
331
  end
308
332
 
309
- $generator_to_battery = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['Generator']['year_one_to_battery_series_kw']) || [0] * (8760 * feature_report.timesteps_per_hour)
333
+ $generator_to_battery = scale_timeseries(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)
310
334
  $generator_to_battery_col = feature_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Generator:ToBattery(kw)')
311
335
  if $generator_to_battery_col.nil?
312
336
  $generator_to_battery_col = feature_report.timeseries_csv.column_names.length
313
337
  feature_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Generator:ToBattery(kw)')
314
338
  end
315
339
 
316
- $generator_to_load = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['Generator']['year_one_to_load_series_kw']) || [0] * (8760 * feature_report.timesteps_per_hour)
340
+ $generator_to_load = scale_timeseries(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)
317
341
  $generator_to_load_col = feature_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Generator:ToLoad(kw)')
318
342
  if $generator_to_load_col.nil?
319
343
  $generator_to_load_col = feature_report.timeseries_csv.column_names.length
320
344
  feature_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Generator:ToLoad(kw)')
321
345
  end
322
346
 
323
- $generator_to_grid = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['Generator']['year_one_to_grid_series_kw']) || [0] * (8760 * feature_report.timesteps_per_hour)
347
+ $generator_to_grid = scale_timeseries(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)
324
348
  $generator_to_grid_col = feature_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Generator:ToGrid(kw)')
325
349
  if $generator_to_grid_col.nil?
326
350
  $generator_to_grid_col = feature_report.timeseries_csv.column_names.length
@@ -359,10 +383,10 @@ module URBANopt # :nodoc:
359
383
 
360
384
  reopt_output['outputs']['Scenario']['Site']['PV'].each_with_index do |pv, i|
361
385
  if (pv['size_kw'] || 0) > 0
362
- $pv_total += Matrix[scale_timeseries(pv['year_one_power_production_series_kw']) || [0] * (8760 * feature_report.timesteps_per_hour)]
363
- $pv_to_battery += Matrix[scale_timeseries(pv['year_one_to_battery_series_kw']) || [0] * (8760 * feature_report.timesteps_per_hour)]
364
- $pv_to_load += Matrix[scale_timeseries(pv['year_one_to_load_series_kw']) || [0] * (8760 * feature_report.timesteps_per_hour)]
365
- $pv_to_grid += Matrix[scale_timeseries(pv['year_one_to_grid_series_kw']) || [0] * (8760 * feature_report.timesteps_per_hour)]
386
+ $pv_total += Matrix[scale_timeseries(convert_powerflow_resolution(pv['year_one_power_production_series_kw'], reopt_resolution, feature_report.timesteps_per_hour)) || [0] * (8760 * feature_report.timesteps_per_hour)]
387
+ $pv_to_battery += Matrix[scale_timeseries(convert_powerflow_resolution(pv['year_one_to_battery_series_kw'], reopt_resolution, feature_report.timesteps_per_hour)) || [0] * (8760 * feature_report.timesteps_per_hour)]
388
+ $pv_to_load += Matrix[scale_timeseries(convert_powerflow_resolution(pv['year_one_to_load_series_kw'], reopt_resolution, feature_report.timesteps_per_hour)) || [0] * (8760 * feature_report.timesteps_per_hour)]
389
+ $pv_to_grid += Matrix[scale_timeseries(convert_powerflow_resolution(pv['year_one_to_grid_series_kw'], reopt_resolution, feature_report.timesteps_per_hour)) || [0] * (8760 * feature_report.timesteps_per_hour)]
366
390
  end
367
391
  end
368
392
 
@@ -371,28 +395,28 @@ module URBANopt # :nodoc:
371
395
  $pv_to_load = $pv_to_load.to_a[0]
372
396
  $pv_to_grid = $pv_to_grid.to_a[0]
373
397
 
374
- $wind_total = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['Wind']['year_one_power_production_series_kw']) || [0] * (8760 * feature_report.timesteps_per_hour)
398
+ $wind_total = scale_timeseries(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)
375
399
  $wind_total_col = feature_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Wind:Total(kw)')
376
400
  if $wind_total_col.nil?
377
401
  $wind_total_col = feature_report.timeseries_csv.column_names.length
378
402
  feature_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Wind:Total(kw)')
379
403
  end
380
404
 
381
- $wind_to_battery = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['Wind']['year_one_to_battery_series_kw']) || [0] * (8760 * feature_report.timesteps_per_hour)
405
+ $wind_to_battery = scale_timeseries(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)
382
406
  $wind_to_battery_col = feature_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Wind:ToBattery(kw)')
383
407
  if $wind_to_battery_col.nil?
384
408
  $wind_to_battery_col = feature_report.timeseries_csv.column_names.length
385
409
  feature_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Wind:ToBattery(kw)')
386
410
  end
387
411
 
388
- $wind_to_load = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['Wind']['year_one_to_load_series_kw']) || [0] * (8760 * feature_report.timesteps_per_hour)
412
+ $wind_to_load = scale_timeseries(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)
389
413
  $wind_to_load_col = feature_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Wind:ToLoad(kw)')
390
414
  if $wind_to_load_col.nil?
391
415
  $wind_to_load_col = feature_report.timeseries_csv.column_names.length
392
416
  feature_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Wind:ToLoad(kw)')
393
417
  end
394
418
 
395
- $wind_to_grid = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['Wind']['year_one_to_grid_series_kw']) || [0] * (8760 * feature_report.timesteps_per_hour)
419
+ $wind_to_grid = scale_timeseries(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)
396
420
  $wind_to_grid_col = feature_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Wind:ToGrid(kw)')
397
421
  if $wind_to_grid_col.nil?
398
422
  $wind_to_grid_col = feature_report.timeseries_csv.column_names.length
@@ -197,7 +197,7 @@ module URBANopt # :nodoc:
197
197
  end
198
198
 
199
199
  elapsed_time = 0
200
- max_elapsed_time = 60
200
+ max_elapsed_time = 60 * 5
201
201
 
202
202
  request = Net::HTTP::Get.new(uri.request_uri)
203
203
  response = make_request(http, request)
@@ -221,8 +221,10 @@ module URBANopt # :nodoc:
221
221
  if response.code == "200"
222
222
  return data
223
223
  end
224
-
225
- raise "Error from REopt API - #{data['Error']}"
224
+
225
+ @@logger.info("Error from REopt API - #{data['Error']}")
226
+ return {}
227
+
226
228
  end
227
229
 
228
230
  ##
@@ -251,7 +253,7 @@ module URBANopt # :nodoc:
251
253
  end
252
254
  request = Net::HTTP::Post.new(@uri_submit, header)
253
255
  request.body = ::JSON.generate(reopt_input, allow_nan: true)
254
-
256
+
255
257
  # Send the request
256
258
  response = make_request(http, request)
257
259
 
@@ -33,6 +33,7 @@ require 'urbanopt/reopt/reopt_logger'
33
33
  require 'matrix'
34
34
  require 'csv'
35
35
  require 'time'
36
+ require_relative 'utilities'
36
37
 
37
38
  module URBANopt # :nodoc:
38
39
  module REopt # :nodoc:
@@ -93,7 +94,6 @@ module URBANopt # :nodoc:
93
94
  requireds_names = ['latitude', 'longitude']
94
95
  requireds = [scenario_report.location.latitude_deg, scenario_report.location.longitude_deg]
95
96
 
96
-
97
97
  if requireds.include?(nil) || requireds.include?(0)
98
98
  requireds.each_with_index do |x, i|
99
99
  if [nil].include? x
@@ -110,16 +110,20 @@ module URBANopt # :nodoc:
110
110
 
111
111
  # Update optional info
112
112
  # REK: attribute names should be updated
113
- if !scenario_report.program.roof_area_sqft.nil?
114
- reopt_inputs[:Scenario][:Site][:roof_squarefeet] = scenario_report.program.roof_area_sqft[:available_roof_area]
113
+ if reopt_inputs[:Scenario][:Site][:roof_squarefeet].nil?
114
+ if !scenario_report.program.roof_area_sqft.nil?
115
+ reopt_inputs[:Scenario][:Site][:roof_squarefeet] = scenario_report.program.roof_area_sqft[:available_roof_area_sqft]
116
+ end
115
117
  end
116
118
 
117
- if !scenario_report.program.site_area_sqft.nil?
118
- reopt_inputs[:Scenario][:Site][:land_acres] = scenario_report.program.site_area_sqft * 1.0 / 43560 # acres/sqft
119
+ if reopt_inputs[:Scenario][:Site][:land_acres].nil?
120
+ if !scenario_report.program.site_area_sqft.nil?
121
+ reopt_inputs[:Scenario][:Site][:land_acres] = scenario_report.program.site_area_sqft * 1.0 / 43560 # acres/sqft
122
+ end
119
123
  end
120
124
 
121
- unless scenario_report.timesteps_per_hour.nil?
122
- reopt_inputs[:Scenario][:time_steps_per_hour] = scenario_report.timesteps_per_hour
125
+ if reopt_inputs[:Scenario][:time_steps_per_hour].nil?
126
+ reopt_inputs[:Scenario][:time_steps_per_hour] = 1
123
127
  end
124
128
 
125
129
  # Update load profile info
@@ -136,14 +140,38 @@ module URBANopt # :nodoc:
136
140
  (( 60 / scenario_report.timesteps_per_hour ) * 60)).to_int
137
141
  energy_timeseries_kw = [0.0]*(start_ts-1) + energy_timeseries_kw + [0.0]*((scenario_report.timesteps_per_hour * 8760) - end_ts)
138
142
  end
139
- reopt_inputs[:Scenario][:Site][:LoadProfile][:loads_kw] = energy_timeseries_kw.map { |e| e ? e : 0 }[0,(scenario_report.timesteps_per_hour * 8760)]
143
+ energy_timeseries_kw = energy_timeseries_kw.map { |e| e ? e : 0 }[0,(scenario_report.timesteps_per_hour * 8760)]
140
144
  rescue StandardError
141
145
  @@logger.error("Could not parse the annual electric load from the timeseries csv - #{scenario_report.timeseries_csv.path}")
142
146
  raise "Could not parse the annual electric load from the timeseries csv - #{scenario_report.timeseries_csv.path}"
143
147
  end
148
+
149
+ # Convert load to REopt Resolution
150
+ begin
151
+ reopt_inputs[:Scenario][:Site][:LoadProfile][:loads_kw] = convert_powerflow_resolution(energy_timeseries_kw, scenario_report.timesteps_per_hour, reopt_inputs[:Scenario][:time_steps_per_hour])
152
+ rescue
153
+ @@logger.error("Could not convert the annual electric load from a resolution of #{scenario_report.timesteps_per_hour} to #{reopt_inputs[:Scenario][:time_steps_per_hour]}")
154
+ raise "Could not convert the annual electric load from a resolution of #{scenario_report.timesteps_per_hour} to #{reopt_inputs[:Scenario][:time_steps_per_hour]}"
155
+ end
156
+
157
+ if reopt_inputs[:Scenario][:Site][:ElectricTariff][:coincident_peak_load_active_timesteps].nil?
158
+ n_top_values = 100
159
+ tmp1 = reopt_inputs[:Scenario][:Site][:LoadProfile][:loads_kw]
160
+ tmp2 = tmp1.each_index.max_by(n_top_values*reopt_inputs[:Scenario][:time_steps_per_hour]){|i| tmp1[i]}
161
+ for i in (0...tmp2.count)
162
+ tmp2[i] += 1
163
+ end
164
+ reopt_inputs[:Scenario][:Site][:ElectricTariff][:coincident_peak_load_active_timesteps] = tmp2
165
+ end
166
+
167
+ if reopt_inputs[:Scenario][:Site][:ElectricTariff][:coincident_peak_load_charge_us_dollars_per_kw].nil?
168
+ reopt_inputs[:Scenario][:Site][:ElectricTariff][:coincident_peak_load_charge_us_dollars_per_kw] = 0
169
+ end
170
+
144
171
  return reopt_inputs
145
172
  end
146
173
 
174
+
147
175
  ##
148
176
  # Converts a FeatureReport list from a ScenarioReport into an array of \REopt Lite posts
149
177
  #
@@ -207,9 +235,6 @@ module URBANopt # :nodoc:
207
235
  scenario_report.location.latitude_deg = reopt_output['inputs']['Scenario']['Site']['latitude']
208
236
  scenario_report.location.longitude_deg = reopt_output['inputs']['Scenario']['Site']['longitude']
209
237
 
210
- # Update timeseries csv from \REopt Lite dispatch data
211
- scenario_report.timesteps_per_hour = reopt_output['inputs']['Scenario']['time_steps_per_hour']
212
-
213
238
  # Update distributed generation sizing and financials
214
239
 
215
240
  scenario_report.distributed_generation.lcc_us_dollars = reopt_output['outputs']['Scenario']['Site']['Financial']['lcc_us_dollars'] || 0
@@ -257,30 +282,22 @@ module URBANopt # :nodoc:
257
282
  if !storage['size_kw'].nil? and storage['size_kw'] != 0
258
283
  scenario_report.distributed_generation.add_tech 'storage', URBANopt::Reporting::DefaultReports::Storage.new( {size_kwh: (storage['size_kwh'] || 0), size_kw: (storage['size_kw'] || 0) })
259
284
  end
260
-
285
+
286
+ reopt_resolution = reopt_output['inputs']['Scenario']['time_steps_per_hour']
261
287
  generation_timeseries_kwh = Matrix[[0] * (8760 * scenario_report.timesteps_per_hour)]
262
-
263
-
288
+
264
289
  reopt_output['outputs']['Scenario']['Site']['PV'].each do |pv|
265
290
  if (pv['size_kw'] || 0) > 0
266
291
  if !pv['year_one_power_production_series_kw'].nil?
267
- generation_timeseries_kwh += Matrix[pv['year_one_power_production_series_kw']]
292
+ generation_timeseries_kwh += Matrix[convert_powerflow_resolution(pv['year_one_power_production_series_kw'], reopt_resolution, scenario_report.timesteps_per_hour)]
268
293
  end
269
294
  end
270
295
  end
271
296
 
272
- unless reopt_output['outputs']['Scenario']['Site']['Storage'].nil?
273
- if (reopt_output['outputs']['Scenario']['Site']['Storage']['size_kw'] or 0) > 0
274
- if !reopt_output['outputs']['Scenario']['Site']['Storage']['year_one_to_grid_series_kw'].nil?
275
- generation_timeseries_kwh = generation_timeseries_kwh + Matrix[reopt_output['outputs']['Scenario']['Site']['Storage']['year_one_to_grid_series_kw']]
276
- end
277
- end
278
- end
279
-
280
297
  unless reopt_output['outputs']['Scenario']['Site']['Wind'].nil?
281
298
  if (reopt_output['outputs']['Scenario']['Site']['Wind']['size_kw'] || 0) > 0
282
299
  if !reopt_output['outputs']['Scenario']['Site']['Wind']['year_one_power_production_series_kw'].nil?
283
- generation_timeseries_kwh += Matrix[reopt_output['outputs']['Scenario']['Site']['Wind']['year_one_power_production_series_kw']]
300
+ generation_timeseries_kwh += Matrix[convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['Wind']['year_one_power_production_series_kw'], reopt_resolution, scenario_report.timesteps_per_hour)]
284
301
  end
285
302
  end
286
303
  end
@@ -288,7 +305,7 @@ module URBANopt # :nodoc:
288
305
  unless reopt_output['outputs']['Scenario']['Site']['Generator'].nil?
289
306
  if (reopt_output['outputs']['Scenario']['Site']['Generator']['size_kw'] || 0) > 0
290
307
  if !reopt_output['outputs']['Scenario']['Site']['Generator']['year_one_power_production_series_kw'].nil?
291
- generation_timeseries_kwh += Matrix[reopt_output['outputs']['Scenario']['Site']['Generator']['year_one_power_production_series_kw']]
308
+ generation_timeseries_kwh += Matrix[convert_powerflow_resolution(reopt_output['outputs']['Scenario']['Site']['Generator']['year_one_power_production_series_kw'], reopt_resolution, scenario_report.timesteps_per_hour)]
292
309
  end
293
310
  end
294
311
  end
@@ -300,70 +317,70 @@ module URBANopt # :nodoc:
300
317
  scenario_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Total(kw)')
301
318
  end
302
319
 
303
- $load = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['LoadProfile']['year_one_electric_load_series_kw']) || [0] * (8760 * scenario_report.timesteps_per_hour)
320
+ $load = scale_timeseries(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)
304
321
  $load_col = scenario_report.timeseries_csv.column_names.index('REopt:Electricity:Load:Total(kw)')
305
322
  if $load_col.nil?
306
323
  $load_col = scenario_report.timeseries_csv.column_names.length
307
324
  scenario_report.timeseries_csv.column_names.push('REopt:Electricity:Load:Total(kw)')
308
325
  end
309
326
 
310
- $utility_to_load = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['ElectricTariff']['year_one_to_load_series_kw']) || [0] * (8760 * scenario_report.timesteps_per_hour)
327
+ $utility_to_load = scale_timeseries(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)
311
328
  $utility_to_load_col = scenario_report.timeseries_csv.column_names.index('REopt:Electricity:Grid:ToLoad(kw)')
312
329
  if $utility_to_load_col.nil?
313
330
  $utility_to_load_col = scenario_report.timeseries_csv.column_names.length
314
331
  scenario_report.timeseries_csv.column_names.push('REopt:Electricity:Grid:ToLoad(kw)')
315
332
  end
316
333
 
317
- $utility_to_battery = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['ElectricTariff']['year_one_to_battery_series_kw']) || [0] * (8760 * scenario_report.timesteps_per_hour)
334
+ $utility_to_battery = scale_timeseries(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)
318
335
  $utility_to_battery_col = scenario_report.timeseries_csv.column_names.index('REopt:Electricity:Grid:ToBattery(kw)')
319
336
  if $utility_to_battery_col.nil?
320
337
  $utility_to_battery_col = scenario_report.timeseries_csv.column_names.length
321
338
  scenario_report.timeseries_csv.column_names.push('REopt:Electricity:Grid:ToBattery(kw)')
322
339
  end
323
340
 
324
- $storage_to_load = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['Storage']['year_one_to_load_series_kw']) || [0] * (8760 * scenario_report.timesteps_per_hour)
341
+ $storage_to_load = scale_timeseries(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)
325
342
  $storage_to_load_col = scenario_report.timeseries_csv.column_names.index('REopt:Electricity:Storage:ToLoad(kw)')
326
343
  if $storage_to_load_col.nil?
327
344
  $storage_to_load_col = scenario_report.timeseries_csv.column_names.length
328
345
  scenario_report.timeseries_csv.column_names.push('REopt:Electricity:Storage:ToLoad(kw)')
329
346
  end
330
347
 
331
- $storage_to_grid = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['Storage']['year_one_to_grid_series_kw']) || [0] * (8760 * scenario_report.timesteps_per_hour)
348
+ $storage_to_grid = scale_timeseries(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)
332
349
  $storage_to_grid_col = scenario_report.timeseries_csv.column_names.index('REopt:Electricity:Storage:ToGrid(kw)')
333
350
  if $storage_to_grid_col.nil?
334
351
  $storage_to_grid_col = scenario_report.timeseries_csv.column_names.length
335
352
  scenario_report.timeseries_csv.column_names.push('REopt:Electricity:Storage:ToGrid(kw)')
336
353
  end
337
354
 
338
- $storage_soc = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['Storage']['year_one_soc_series_pct']) || [0] * (8760 * scenario_report.timesteps_per_hour)
355
+ $storage_soc = scale_timeseries(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)
339
356
  $storage_soc_col = scenario_report.timeseries_csv.column_names.index('REopt:Electricity:Storage:StateOfCharge(pct)')
340
357
  if $storage_soc_col.nil?
341
358
  $storage_soc_col = scenario_report.timeseries_csv.column_names.length
342
359
  scenario_report.timeseries_csv.column_names.push('REopt:Electricity:Storage:StateOfCharge(pct)')
343
360
  end
344
361
 
345
- $generator_total = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['Generator']['year_one_power_production_series_kw']) || [0] * (8760 * scenario_report.timesteps_per_hour)
362
+ $generator_total = scale_timeseries(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)
346
363
  $generator_total_col = scenario_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Generator:Total(kw)')
347
364
  if $generator_total_col.nil?
348
365
  $generator_total_col = scenario_report.timeseries_csv.column_names.length
349
366
  scenario_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Generator:Total(kw)')
350
367
  end
351
368
 
352
- $generator_to_battery = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['Generator']['year_one_to_battery_series_kw']) || [0] * (8760 * scenario_report.timesteps_per_hour)
369
+ $generator_to_battery = scale_timeseries(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)
353
370
  $generator_to_battery_col = scenario_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Generator:ToBattery(kw)')
354
371
  if $generator_to_battery_col.nil?
355
372
  $generator_to_battery_col = scenario_report.timeseries_csv.column_names.length
356
373
  scenario_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Generator:ToBattery(kw)')
357
374
  end
358
375
 
359
- $generator_to_load = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['Generator']['year_one_to_load_series_kw']) || [0] * (8760 * scenario_report.timesteps_per_hour)
376
+ $generator_to_load = scale_timeseries(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)
360
377
  $generator_to_load_col = scenario_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Generator:ToLoad(kw)')
361
378
  if $generator_to_load_col.nil?
362
379
  $generator_to_load_col = scenario_report.timeseries_csv.column_names.length
363
380
  scenario_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Generator:ToLoad(kw)')
364
381
  end
365
382
 
366
- $generator_to_grid = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['Generator']['year_one_to_grid_series_kw']) || [0] * (8760 * scenario_report.timesteps_per_hour)
383
+ $generator_to_grid = scale_timeseries(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)
367
384
  $generator_to_grid_col = scenario_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Generator:ToGrid(kw)')
368
385
  if $generator_to_grid_col.nil?
369
386
  $generator_to_grid_col = scenario_report.timeseries_csv.column_names.length
@@ -401,10 +418,10 @@ module URBANopt # :nodoc:
401
418
 
402
419
  reopt_output['outputs']['Scenario']['Site']['PV'].each_with_index do |pv, i|
403
420
  if (pv['size_kw'] || 0) > 0
404
- $pv_total += Matrix[scale_timeseries(pv['year_one_power_production_series_kw']) || [0] * (8760 * scenario_report.timesteps_per_hour)]
405
- $pv_to_battery += Matrix[scale_timeseries(pv['year_one_to_battery_series_kw']) || [0] * (8760 * scenario_report.timesteps_per_hour)]
406
- $pv_to_load += Matrix[scale_timeseries(pv['year_one_to_load_series_kw']) || [0] * (8760 * scenario_report.timesteps_per_hour)]
407
- $pv_to_grid += Matrix[scale_timeseries(pv['year_one_to_grid_series_kw']) || [0] * (8760 * scenario_report.timesteps_per_hour)]
421
+ $pv_total += Matrix[scale_timeseries(convert_powerflow_resolution(pv['year_one_power_production_series_kw'], reopt_resolution, scenario_report.timesteps_per_hour)) || [0] * (8760 * scenario_report.timesteps_per_hour)]
422
+ $pv_to_battery += Matrix[scale_timeseries(convert_powerflow_resolution(pv['year_one_to_battery_series_kw'], reopt_resolution, scenario_report.timesteps_per_hour)) || [0] * (8760 * scenario_report.timesteps_per_hour)]
423
+ $pv_to_load += Matrix[scale_timeseries(convert_powerflow_resolution(pv['year_one_to_load_series_kw'], reopt_resolution, scenario_report.timesteps_per_hour)) || [0] * (8760 * scenario_report.timesteps_per_hour)]
424
+ $pv_to_grid += Matrix[scale_timeseries(convert_powerflow_resolution(pv['year_one_to_grid_series_kw'], reopt_resolution, scenario_report.timesteps_per_hour)) || [0] * (8760 * scenario_report.timesteps_per_hour)]
408
425
  end
409
426
  end
410
427
 
@@ -413,28 +430,28 @@ module URBANopt # :nodoc:
413
430
  $pv_to_load = $pv_to_load.to_a[0]
414
431
  $pv_to_grid = $pv_to_grid.to_a[0]
415
432
 
416
- $wind_total = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['Wind']['year_one_power_production_series_kw']) || [0] * (8760 * scenario_report.timesteps_per_hour)
433
+ $wind_total = scale_timeseries(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)
417
434
  $wind_total_col = scenario_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Wind:Total(kw)')
418
435
  if $wind_total_col.nil?
419
436
  $wind_total_col = scenario_report.timeseries_csv.column_names.length
420
437
  scenario_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Wind:Total(kw)')
421
438
  end
422
439
 
423
- $wind_to_battery = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['Wind']['year_one_to_battery_series_kw']) || [0] * (8760 * scenario_report.timesteps_per_hour)
440
+ $wind_to_battery = scale_timeseries(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)
424
441
  $wind_to_battery_col = scenario_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Wind:ToBattery(kw)')
425
442
  if $wind_to_battery_col.nil?
426
443
  $wind_to_battery_col = scenario_report.timeseries_csv.column_names.length
427
444
  scenario_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Wind:ToBattery(kw)')
428
445
  end
429
446
 
430
- $wind_to_load = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['Wind']['year_one_to_load_series_kw']) || [0] * (8760 * scenario_report.timesteps_per_hour)
447
+ $wind_to_load = scale_timeseries(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)
431
448
  $wind_to_load_col = scenario_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Wind:ToLoad(kw)')
432
449
  if $wind_to_load_col.nil?
433
450
  $wind_to_load_col = scenario_report.timeseries_csv.column_names.length
434
451
  scenario_report.timeseries_csv.column_names.push('REopt:ElectricityProduced:Wind:ToLoad(kw)')
435
452
  end
436
453
 
437
- $wind_to_grid = scale_timeseries(reopt_output['outputs']['Scenario']['Site']['Wind']['year_one_to_grid_series_kw']) || [0] * (8760 * scenario_report.timesteps_per_hour)
454
+ $wind_to_grid = scale_timeseries(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)
438
455
  $wind_to_grid_col = scenario_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Wind:ToGrid(kw)')
439
456
  if $wind_to_grid_col.nil?
440
457
  $wind_to_grid_col = scenario_report.timeseries_csv.column_names.length