urbanopt-reopt 0.2.0 → 0.2.1
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 +5 -0
- data/lib/urbanopt/reopt/feature_report_adapter.rb +6 -6
- data/lib/urbanopt/reopt/reopt_lite_api.rb +18 -2
- data/lib/urbanopt/reopt/reopt_post_processor.rb +1 -1
- data/lib/urbanopt/reopt/scenario_report_adapter.rb +10 -6
- data/lib/urbanopt/reopt/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8000b40da80c144605734ce4d7284a86a2231e87
|
4
|
+
data.tar.gz: ae21be460c29a1d9027083d6d72c51abc8dd1a9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a64e8393504d9262f56ff09787ed7ba12d8830b891615e1d0bbce38aa984cddd4eb698544f259b028a33f14357b35955b2cd4dbc71e0aa4219f84059109016d
|
7
|
+
data.tar.gz: 69000034ce08db6386777d2dd351a0b607154e2e43c411d35f4bc2486dd126c73ef9e00b279df63270f968f9978acb59fc3430c9cebbdd4b22d0579eb84e7373
|
data/CHANGELOG.md
CHANGED
@@ -104,17 +104,17 @@ module URBANopt # :nodoc:
|
|
104
104
|
begin
|
105
105
|
col_num = feature_report.timeseries_csv.column_names.index('Electricity:Facility(kWh)')
|
106
106
|
t = CSV.read(feature_report.timeseries_csv.path, headers: true, converters: :numeric)
|
107
|
-
|
108
|
-
if
|
107
|
+
energy_timeseries_kw = t.by_col[col_num].map { |e| ((e * feature_report.timesteps_per_hour || 0) ) }
|
108
|
+
if energy_timeseries_kw.length < (feature_report.timesteps_per_hour * 8760)
|
109
109
|
start_date = Time.parse(t.by_col["Datetime"][0])
|
110
110
|
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) /
|
111
111
|
(( 60 / feature_report.timesteps_per_hour ) * 60)).to_int
|
112
112
|
end_date = Time.parse(t.by_col["Datetime"][-1])
|
113
113
|
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
114
|
(( 60 / feature_report.timesteps_per_hour ) * 60)).to_int
|
115
|
-
|
115
|
+
energy_timeseries_kw = [0.0]*(start_ts-1) + energy_timeseries_kw + [0.0]*((feature_report.timesteps_per_hour * 8760) - end_ts)
|
116
116
|
end
|
117
|
-
reopt_inputs[:Scenario][:Site][:LoadProfile][:loads_kw] =
|
117
|
+
reopt_inputs[:Scenario][:Site][:LoadProfile][:loads_kw] = energy_timeseries_kw.map { |e| e ? e : 0 }[0,(feature_report.timesteps_per_hour * 8760)]
|
118
118
|
rescue StandardError
|
119
119
|
@@logger.error("Could not parse the annual electric load from the timeseries csv - #{feature_report.timeseries_csv.path}")
|
120
120
|
raise "Could not parse the annual electric load from the timeseries csv - #{feature_report.timeseries_csv.path}"
|
@@ -200,7 +200,7 @@ module URBANopt # :nodoc:
|
|
200
200
|
feature_report.distributed_generation.add_tech 'storage', URBANopt::Scenario::DefaultReports::Storage.new( {size_kwh: (storage['size_kwh'] || 0), size_kw: (storage['size_kw'] || 0) })
|
201
201
|
end
|
202
202
|
|
203
|
-
generation_timeseries_kwh = Matrix[[0] * 8760]
|
203
|
+
generation_timeseries_kwh = Matrix[[0] * (8760 * feature_report.timesteps_per_hour)]
|
204
204
|
|
205
205
|
unless reopt_output['outputs']['Scenario']['Site']['PV'].nil?
|
206
206
|
reopt_output['outputs']['Scenario']['Site']['PV'].each do |pv|
|
@@ -236,7 +236,7 @@ module URBANopt # :nodoc:
|
|
236
236
|
end
|
237
237
|
end
|
238
238
|
|
239
|
-
$generation_timeseries_kwh = generation_timeseries_kwh.to_a[0] || [0] * 8760
|
239
|
+
$generation_timeseries_kwh = generation_timeseries_kwh.to_a[0] || [0] * (8760 * feature_report.timesteps_per_hour)
|
240
240
|
$generation_timeseries_kwh_col = feature_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Total(kw)')
|
241
241
|
if $generation_timeseries_kwh_col.nil?
|
242
242
|
$generation_timeseries_kwh_col = feature_report.timeseries_csv.column_names.length
|
@@ -196,7 +196,15 @@ module URBANopt # :nodoc:
|
|
196
196
|
while status == 'Optimizing...'
|
197
197
|
response = make_request(http, request)
|
198
198
|
data = JSON.parse(response.body)
|
199
|
-
|
199
|
+
if data['outputs']['Scenario']['Site']['PV'].kind_of?(Array)
|
200
|
+
pv_sizes = 0
|
201
|
+
data['outputs']['Scenario']['Site']['PV'].each do |x|
|
202
|
+
pv_sizes = pv_sizes + x['size_kw'].to_f
|
203
|
+
end
|
204
|
+
else
|
205
|
+
pv_sizes = data['outputs']['Scenario']['Site']['PV']['size_kw'] || 0
|
206
|
+
end
|
207
|
+
sizes = pv_sizes + (data['outputs']['Scenario']['Site']['Storage']['size_kw'] || 0) + (data['outputs']['Scenario']['Site']['Wind']['size_kw'] || 0) + (data['outputs']['Scenario']['Site']['Generator']['size_kw'] || 0)
|
200
208
|
status = data['outputs']['Scenario']['status']
|
201
209
|
|
202
210
|
sleep 5
|
@@ -209,7 +217,15 @@ module URBANopt # :nodoc:
|
|
209
217
|
sleep 1
|
210
218
|
response = make_request(http, request)
|
211
219
|
data = JSON.parse(response.body)
|
212
|
-
|
220
|
+
if data['outputs']['Scenario']['Site']['PV'].kind_of?(Array)
|
221
|
+
pv_sizes = 0
|
222
|
+
data['outputs']['Scenario']['Site']['PV'].each do |x|
|
223
|
+
pv_sizes = pv_sizes + x['size_kw'].to_f
|
224
|
+
end
|
225
|
+
else
|
226
|
+
pv_sizes = data['outputs']['Scenario']['Site']['PV']['size_kw'] || 0
|
227
|
+
end
|
228
|
+
sizes = pv_sizes + (data['outputs']['Scenario']['Site']['Storage']['size_kw'] || 0) + (data['outputs']['Scenario']['Site']['Wind']['size_kw'] || 0) + (data['outputs']['Scenario']['Site']['Generator']['size_kw'] || 0)
|
213
229
|
(check_complete = sizes == 0) && ((data['outputs']['Scenario']['Site']['Financial']['npv_us_dollars'] || 0) > 0)
|
214
230
|
_tries += 1
|
215
231
|
end
|
@@ -223,7 +223,7 @@ module URBANopt # :nodoc:
|
|
223
223
|
else
|
224
224
|
warn "Could not save feature reports - the number of save names provided did not match the number of feature reports"
|
225
225
|
end
|
226
|
-
|
226
|
+
end
|
227
227
|
rescue StandardError
|
228
228
|
@@logger.info("Could not optimize Feature Report #{feature_report.name} #{feature_report.id}")
|
229
229
|
end
|
@@ -115,21 +115,25 @@ module URBANopt # :nodoc:
|
|
115
115
|
reopt_inputs[:Scenario][:Site][:land_acres] = scenario_report.program.site_area * 1.0 / 43560 # acres/sqft
|
116
116
|
end
|
117
117
|
|
118
|
+
unless scenario_report.timesteps_per_hour.nil?
|
119
|
+
reopt_inputs[:Scenario][:time_steps_per_hour] = scenario_report.timesteps_per_hour
|
120
|
+
end
|
121
|
+
|
118
122
|
# Update load profile info
|
119
123
|
begin
|
120
124
|
col_num = scenario_report.timeseries_csv.column_names.index('Electricity:Facility(kWh)')
|
121
125
|
t = CSV.read(scenario_report.timeseries_csv.path, headers: true, converters: :numeric)
|
122
|
-
|
123
|
-
if
|
126
|
+
energy_timeseries_kw = t.by_col[col_num].map { |e| ((e * scenario_report.timesteps_per_hour || 0) ) }
|
127
|
+
if energy_timeseries_kw.length < (scenario_report.timesteps_per_hour * 8760)
|
124
128
|
start_date = Time.parse(t.by_col["Datetime"][0])
|
125
129
|
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) /
|
126
130
|
(( 60 / scenario_report.timesteps_per_hour ) * 60)).to_int
|
127
131
|
end_date = Time.parse(t.by_col["Datetime"][-1])
|
128
132
|
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) /
|
129
133
|
(( 60 / scenario_report.timesteps_per_hour ) * 60)).to_int
|
130
|
-
|
134
|
+
energy_timeseries_kw = [0.0]*(start_ts-1) + energy_timeseries_kw + [0.0]*((scenario_report.timesteps_per_hour * 8760) - end_ts)
|
131
135
|
end
|
132
|
-
reopt_inputs[:Scenario][:Site][:LoadProfile][:loads_kw] =
|
136
|
+
reopt_inputs[:Scenario][:Site][:LoadProfile][:loads_kw] = energy_timeseries_kw.map { |e| e ? e : 0 }[0,(scenario_report.timesteps_per_hour * 8760)]
|
133
137
|
rescue StandardError
|
134
138
|
@@logger.error("Could not parse the annual electric load from the timeseries csv - #{scenario_report.timeseries_csv.path}")
|
135
139
|
raise "Could not parse the annual electric load from the timeseries csv - #{scenario_report.timeseries_csv.path}"
|
@@ -237,7 +241,7 @@ module URBANopt # :nodoc:
|
|
237
241
|
scenario_report.distributed_generation.add_tech 'storage', URBANopt::Scenario::DefaultReports::Storage.new( {size_kwh: (storage['size_kwh'] || 0), size_kw: (storage['size_kw'] || 0) })
|
238
242
|
end
|
239
243
|
|
240
|
-
generation_timeseries_kwh = Matrix[[0] * 8760]
|
244
|
+
generation_timeseries_kwh = Matrix[[0] * (8760 * scenario_report.timesteps_per_hour)]
|
241
245
|
|
242
246
|
|
243
247
|
reopt_output['outputs']['Scenario']['Site']['PV'].each do |pv|
|
@@ -272,7 +276,7 @@ module URBANopt # :nodoc:
|
|
272
276
|
end
|
273
277
|
end
|
274
278
|
|
275
|
-
$generation_timeseries_kwh = generation_timeseries_kwh.to_a[0]
|
279
|
+
$generation_timeseries_kwh = generation_timeseries_kwh.to_a[0] || [0] * (8760 * scenario_report.timesteps_per_hour)
|
276
280
|
$generation_timeseries_kwh_col = scenario_report.timeseries_csv.column_names.index('REopt:ElectricityProduced:Total(kw)')
|
277
281
|
if $generation_timeseries_kwh_col.nil?
|
278
282
|
$generation_timeseries_kwh_col = scenario_report.timeseries_csv.column_names.length
|
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.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|