urbanopt-reporting 0.1.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/bug_report.md +19 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +15 -0
- data/.github/pull_request_template.md +13 -0
- data/.rdoc_options +36 -0
- data/CHANGELOG.md +39 -0
- data/CONTRIBUTING.md +1 -1
- data/LICENSE.md +1 -1
- data/RDOC_MAIN.md +10 -0
- data/README.md +1 -1
- data/Rakefile +1 -1
- data/deploy_docs.sh +5 -0
- data/doc_templates/LICENSE.md +1 -1
- data/doc_templates/copyright_erb.txt +1 -1
- data/doc_templates/copyright_js.txt +1 -1
- data/doc_templates/copyright_ruby.txt +1 -1
- data/docs/.gitignore +3 -0
- data/docs/.vuepress/components/InnerJsonSchema.vue +76 -0
- data/docs/.vuepress/components/JsonSchema.vue +12 -0
- data/docs/.vuepress/components/ScenarioSchema.vue +12 -0
- data/docs/.vuepress/components/StaticLink.vue +8 -0
- data/docs/.vuepress/config.js +25 -0
- data/docs/.vuepress/highlight.js +8 -0
- data/docs/.vuepress/json-schema-deref-loader.js +22 -0
- data/docs/.vuepress/public/custom_rdoc_styles.css +78 -0
- data/docs/.vuepress/styles/palette.styl +1 -0
- data/docs/.vuepress/utils.js +17 -0
- data/docs/README.md +9 -0
- data/docs/package-lock.json +10018 -0
- data/docs/package.json +30 -0
- data/docs/schemas/scenario-schema.md +3 -0
- data/lib/measures/default_feature_reports/LICENSE.md +1 -1
- data/lib/measures/default_feature_reports/measure.rb +261 -88
- data/lib/measures/default_feature_reports/measure.xml +11 -11
- data/lib/urbanopt/reporting.rb +1 -1
- data/lib/urbanopt/reporting/default_reports.rb +1 -1
- data/lib/urbanopt/reporting/default_reports/construction_cost.rb +1 -1
- data/lib/urbanopt/reporting/default_reports/date.rb +1 -1
- data/lib/urbanopt/reporting/default_reports/distributed_generation.rb +119 -6
- data/lib/urbanopt/reporting/default_reports/end_use.rb +1 -1
- data/lib/urbanopt/reporting/default_reports/end_uses.rb +53 -39
- data/lib/urbanopt/reporting/default_reports/extension.rb +30 -0
- data/lib/urbanopt/reporting/default_reports/feature_report.rb +52 -21
- data/lib/urbanopt/reporting/default_reports/generator.rb +2 -2
- data/lib/urbanopt/reporting/default_reports/location.rb +12 -12
- data/lib/urbanopt/reporting/default_reports/logger.rb +1 -1
- data/lib/urbanopt/reporting/default_reports/power_distribution.rb +1 -1
- data/lib/urbanopt/reporting/default_reports/program.rb +87 -87
- data/lib/urbanopt/reporting/default_reports/reporting_period.rb +87 -79
- data/lib/urbanopt/reporting/default_reports/scenario_report.rb +1 -1
- data/lib/urbanopt/reporting/default_reports/schema/README.md +1 -1
- data/lib/urbanopt/reporting/default_reports/schema/scenario_csv_columns.txt +18 -1
- data/lib/urbanopt/reporting/default_reports/schema/scenario_schema.json +117 -82
- data/lib/urbanopt/reporting/default_reports/solar_pv.rb +2 -2
- data/lib/urbanopt/reporting/default_reports/storage.rb +2 -2
- data/lib/urbanopt/reporting/default_reports/thermal_storage.rb +111 -0
- data/lib/urbanopt/reporting/default_reports/timeseries_csv.rb +1 -1
- data/lib/urbanopt/reporting/default_reports/validator.rb +1 -1
- data/lib/urbanopt/reporting/default_reports/wind.rb +2 -2
- data/lib/urbanopt/reporting/derived_extension.rb +1 -1
- data/lib/urbanopt/reporting/version.rb +2 -2
- data/urbanopt-reporting-gem.gemspec +4 -4
- metadata +37 -15
@@ -3,8 +3,8 @@
|
|
3
3
|
<schema_version>3.0</schema_version>
|
4
4
|
<name>default_feature_reports</name>
|
5
5
|
<uid>9ee3135a-8070-4408-bfa1-b75fecf9dd4f</uid>
|
6
|
-
<version_id>
|
7
|
-
<version_modified>
|
6
|
+
<version_id>f9af7bd8-e9ce-41b4-b892-df29f235a9bd</version_id>
|
7
|
+
<version_modified>20201201T173130Z</version_modified>
|
8
8
|
<xml_checksum>FB304155</xml_checksum>
|
9
9
|
<class_name>DefaultFeatureReports</class_name>
|
10
10
|
<display_name>DefaultFeatureReports</display_name>
|
@@ -126,17 +126,23 @@
|
|
126
126
|
<usage_type>test</usage_type>
|
127
127
|
<checksum>CC4BFFAF</checksum>
|
128
128
|
</file>
|
129
|
+
<file>
|
130
|
+
<filename>README.md</filename>
|
131
|
+
<filetype>md</filetype>
|
132
|
+
<usage_type>readme</usage_type>
|
133
|
+
<checksum>0B68E96D</checksum>
|
134
|
+
</file>
|
129
135
|
<file>
|
130
136
|
<filename>LICENSE.md</filename>
|
131
137
|
<filetype>md</filetype>
|
132
138
|
<usage_type>license</usage_type>
|
133
|
-
<checksum>
|
139
|
+
<checksum>BBD19F47</checksum>
|
134
140
|
</file>
|
135
141
|
<file>
|
136
142
|
<filename>default_feature_reports_test.rb</filename>
|
137
143
|
<filetype>rb</filetype>
|
138
144
|
<usage_type>test</usage_type>
|
139
|
-
<checksum>
|
145
|
+
<checksum>19681175</checksum>
|
140
146
|
</file>
|
141
147
|
<file>
|
142
148
|
<version>
|
@@ -147,13 +153,7 @@
|
|
147
153
|
<filename>measure.rb</filename>
|
148
154
|
<filetype>rb</filetype>
|
149
155
|
<usage_type>script</usage_type>
|
150
|
-
<checksum>
|
151
|
-
</file>
|
152
|
-
<file>
|
153
|
-
<filename>README.md</filename>
|
154
|
-
<filetype>md</filetype>
|
155
|
-
<usage_type>readme</usage_type>
|
156
|
-
<checksum>0B68E96D</checksum>
|
156
|
+
<checksum>B1E43E26</checksum>
|
157
157
|
</file>
|
158
158
|
</files>
|
159
159
|
</measure>
|
data/lib/urbanopt/reporting.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
2
|
+
# URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
4
|
#
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
2
|
+
# URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
4
|
#
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
2
|
+
# URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
4
|
#
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
2
|
+
# URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
4
|
#
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
2
|
+
# URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
4
|
#
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -29,10 +29,10 @@
|
|
29
29
|
# *********************************************************************************
|
30
30
|
|
31
31
|
require 'json'
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
require 'urbanopt/reporting/default_reports/solar_pv'
|
33
|
+
require 'urbanopt/reporting/default_reports/wind'
|
34
|
+
require 'urbanopt/reporting/default_reports/generator'
|
35
|
+
require 'urbanopt/reporting/default_reports/storage'
|
36
36
|
require 'json-schema'
|
37
37
|
|
38
38
|
module URBANopt
|
@@ -47,6 +47,11 @@ module URBANopt
|
|
47
47
|
#
|
48
48
|
attr_accessor :lcc_us_dollars
|
49
49
|
|
50
|
+
##
|
51
|
+
# _Float_ - Lifecycle costs for the complete distributed generation system in US Dollars
|
52
|
+
#
|
53
|
+
attr_accessor :lcc_bau_us_dollars
|
54
|
+
|
50
55
|
##
|
51
56
|
# _Float_ - Net present value of the complete distributed generation system in US Dollars
|
52
57
|
#
|
@@ -68,10 +73,40 @@ module URBANopt
|
|
68
73
|
attr_accessor :year_one_bill_us_dollars
|
69
74
|
|
70
75
|
##
|
71
|
-
# _Float_ - Total
|
76
|
+
# _Float_ - Total energy costs in US Dollars over the life of the system after tax
|
72
77
|
#
|
73
78
|
attr_accessor :total_energy_cost_us_dollars
|
74
79
|
|
80
|
+
##
|
81
|
+
# _Float_ - Total demand costs in US Dollars over the life of the system after tax
|
82
|
+
#
|
83
|
+
attr_accessor :total_demand_cost_us_dollars
|
84
|
+
|
85
|
+
##
|
86
|
+
# _Float_ - Year one energy cost in the business as usual scenario (i.e no new system) after tax, us dollars
|
87
|
+
#
|
88
|
+
attr_accessor :year_one_energy_cost_bau_us_dollars
|
89
|
+
|
90
|
+
##
|
91
|
+
# _Float_ - Year one demand cost in the business as usual scenario (i.e no new system), us dollars
|
92
|
+
#
|
93
|
+
attr_accessor :year_one_demand_cost_bau_us_dollars
|
94
|
+
|
95
|
+
##
|
96
|
+
# _Float_ - Year one demand energy bill in the business as usual scenario (i.e no new system), us dollars
|
97
|
+
#
|
98
|
+
attr_accessor :year_one_bill_bau_us_dollars
|
99
|
+
|
100
|
+
##
|
101
|
+
# _Float_ - Total lifetime demand costs in the business as usual scenario (i.e no new system) after tax, us dollars
|
102
|
+
#
|
103
|
+
attr_accessor :total_demand_cost_bau_us_dollars
|
104
|
+
|
105
|
+
##
|
106
|
+
# _Float_ - Total lifetime energy costs in the business as usual scenario (i.e no new system) after tax, us dollars
|
107
|
+
#
|
108
|
+
attr_accessor :total_energy_cost_bau_us_dollars
|
109
|
+
|
75
110
|
##
|
76
111
|
# _Array_ - List of _SolarPV_ systems
|
77
112
|
#
|
@@ -117,6 +152,36 @@ module URBANopt
|
|
117
152
|
#
|
118
153
|
attr_accessor :total_generator_kw
|
119
154
|
|
155
|
+
##
|
156
|
+
# _Float_ - Minimum hour the system can support critical load during a grid outage
|
157
|
+
#
|
158
|
+
attr_accessor :resilience_hours_min
|
159
|
+
|
160
|
+
##
|
161
|
+
# _Float_ - Maximum hour the system can support critical load during a grid outage
|
162
|
+
#
|
163
|
+
attr_accessor :resilience_hours_max
|
164
|
+
|
165
|
+
##
|
166
|
+
# _Float_ - Average hour the system can support critical load during a grid outage
|
167
|
+
#
|
168
|
+
attr_accessor :resilience_hours_avg
|
169
|
+
|
170
|
+
##
|
171
|
+
# _Float_ - Average probability the system can sustain critical load during a grid outage
|
172
|
+
#
|
173
|
+
attr_accessor :probs_of_surviving
|
174
|
+
|
175
|
+
##
|
176
|
+
# _Float_ - Average monthly probabiliies that the system can sustain critical load during a grid outage
|
177
|
+
#
|
178
|
+
attr_accessor :probs_of_surviving_by_month
|
179
|
+
|
180
|
+
##
|
181
|
+
# _Float_ - Average hourly probabiliies that the system can sustain critical load during a grid outage
|
182
|
+
#
|
183
|
+
attr_accessor :probs_of_surviving_by_hour_of_the_day
|
184
|
+
|
120
185
|
##
|
121
186
|
# Initialize distributed generation system design and financial metrics.
|
122
187
|
#
|
@@ -132,11 +197,25 @@ module URBANopt
|
|
132
197
|
hash.delete_if { |k, v| v.nil? }
|
133
198
|
|
134
199
|
@lcc_us_dollars = hash[:lcc_us_dollars]
|
200
|
+
@lcc_bau_us_dollars = hash[:lcc_bau_us_dollars]
|
135
201
|
@npv_us_dollars = hash[:npv_us_dollars]
|
136
202
|
@year_one_energy_cost_us_dollars = hash[:year_one_energy_cost_us_dollars]
|
203
|
+
@year_one_energy_cost_bau_us_dollars = hash[:year_one_energy_cost_bau_us_dollars]
|
137
204
|
@year_one_demand_cost_us_dollars = hash[:year_one_demand_cost_us_dollars]
|
205
|
+
@year_one_demand_cost_bau_us_dollars = hash[:year_one_demand_cost_bau_us_dollars]
|
138
206
|
@year_one_bill_us_dollars = hash[:year_one_bill_us_dollars]
|
207
|
+
@year_one_bill_bau_us_dollars = hash[:year_one_bill_bau_us_dollars]
|
139
208
|
@total_energy_cost_us_dollars = hash[:total_energy_cost_us_dollars]
|
209
|
+
@total_energy_cost_bau_us_dollars = hash[:total_energy_cost_bau_us_dollars]
|
210
|
+
@total_demand_cost_us_dollars = hash[:total_demand_cost_us_dollars]
|
211
|
+
@total_demand_cost_bau_us_dollars = hash[:total_demand_cost_bau_us_dollars]
|
212
|
+
|
213
|
+
@resilience_hours_min = hash[:resilience_hours_min]
|
214
|
+
@resilience_hours_max = hash[:resilience_hours_max]
|
215
|
+
@resilience_hours_avg = hash[:resilience_hours_avg]
|
216
|
+
@probs_of_surviving = hash[:probs_of_surviving]
|
217
|
+
@probs_of_surviving_by_month = hash[:probs_of_surviving_by_month]
|
218
|
+
@probs_of_surviving_by_hour_of_the_day = hash[:probs_of_surviving_by_hour_of_the_day]
|
140
219
|
|
141
220
|
@total_solar_pv_kw = nil
|
142
221
|
@total_wind_kw = nil
|
@@ -276,16 +355,34 @@ module URBANopt
|
|
276
355
|
result = {}
|
277
356
|
|
278
357
|
result[:lcc_us_dollars] = @lcc_us_dollars if @lcc_us_dollars
|
358
|
+
result[:lcc_bau_us_dollars] = @lcc_bau_us_dollars if @lcc_bau_us_dollars
|
279
359
|
result[:npv_us_dollars] = @npv_us_dollars if @npv_us_dollars
|
360
|
+
|
280
361
|
result[:year_one_energy_cost_us_dollars] = @year_one_energy_cost_us_dollars if @year_one_energy_cost_us_dollars
|
281
362
|
result[:year_one_demand_cost_us_dollars] = @year_one_demand_cost_us_dollars if @year_one_demand_cost_us_dollars
|
282
363
|
result[:year_one_bill_us_dollars] = @year_one_bill_us_dollars if @year_one_bill_us_dollars
|
364
|
+
result[:total_demand_cost_us_dollars] = @total_demand_cost_us_dollars if @total_demand_cost_us_dollars
|
365
|
+
result[:total_energy_cost_us_dollars] = @total_energy_cost_us_dollars if @total_energy_cost_us_dollars
|
366
|
+
|
367
|
+
result[:year_one_energy_cost_bau_us_dollars] = @year_one_energy_cost_bau_us_dollars if @year_one_energy_cost_bau_us_dollars
|
368
|
+
result[:year_one_demand_cost_bau_us_dollars] = @year_one_demand_cost_bau_us_dollars if @year_one_demand_cost_bau_us_dollars
|
369
|
+
result[:year_one_bill_bau_us_dollars] = @year_one_bill_bau_us_dollars if @year_one_bill_bau_us_dollars
|
370
|
+
result[:total_energy_cost_bau_us_dollars] = @total_energy_cost_bau_us_dollars if @total_energy_cost_bau_us_dollars
|
371
|
+
result[:total_demand_cost_bau_us_dollars] = @total_demand_cost_bau_us_dollars if @total_demand_cost_bau_us_dollars
|
372
|
+
|
283
373
|
result[:total_solar_pv_kw] = @total_solar_pv_kw if @total_solar_pv_kw
|
284
374
|
result[:total_wind_kw] = @total_wind_kw if @total_wind_kw
|
285
375
|
result[:total_generator_kw] = @total_generator_kw if @total_generator_kw
|
286
376
|
result[:total_storage_kw] = @total_storage_kw if @total_storage_kw
|
287
377
|
result[:total_storage_kwh] = @total_storage_kwh if @total_storage_kwh
|
288
378
|
|
379
|
+
result[:resilience_hours_min] = @resilience_hours_min if @resilience_hours_min
|
380
|
+
result[:resilience_hours_max] = @resilience_hours_max if @resilience_hours_max
|
381
|
+
result[:resilience_hours_avg] = @resilience_hours_avg if @resilience_hours_avg
|
382
|
+
result[:probs_of_surviving] = @probs_of_surviving if @probs_of_surviving
|
383
|
+
result[:probs_of_surviving_by_month] = @probs_of_surviving_by_month if @probs_of_surviving_by_month
|
384
|
+
result[:probs_of_surviving_by_hour_of_the_day] = @probs_of_surviving_by_hour_of_the_day if @probs_of_surviving_by_hour_of_the_day
|
385
|
+
|
289
386
|
result[:solar_pv] = []
|
290
387
|
@solar_pv.each do |pv|
|
291
388
|
result[:solar_pv].push pv.to_hash
|
@@ -327,11 +424,27 @@ module URBANopt
|
|
327
424
|
##
|
328
425
|
def self.merge_distributed_generation(existing_dgen, new_dgen)
|
329
426
|
existing_dgen.lcc_us_dollars = add_values(existing_dgen.lcc_us_dollars, new_dgen.lcc_us_dollars)
|
427
|
+
existing_dgen.lcc_bau_us_dollars = add_values(existing_dgen.lcc_bau_us_dollars, new_dgen.lcc_bau_us_dollars)
|
330
428
|
existing_dgen.npv_us_dollars = add_values(existing_dgen.npv_us_dollars, new_dgen.npv_us_dollars)
|
429
|
+
|
331
430
|
existing_dgen.year_one_energy_cost_us_dollars = add_values(existing_dgen.year_one_energy_cost_us_dollars, new_dgen.year_one_energy_cost_us_dollars)
|
332
431
|
existing_dgen.year_one_demand_cost_us_dollars = add_values(existing_dgen.year_one_demand_cost_us_dollars, new_dgen.year_one_demand_cost_us_dollars)
|
333
432
|
existing_dgen.year_one_bill_us_dollars = add_values(existing_dgen.year_one_bill_us_dollars, new_dgen.year_one_bill_us_dollars)
|
334
433
|
existing_dgen.total_energy_cost_us_dollars = add_values(existing_dgen.total_energy_cost_us_dollars, new_dgen.total_energy_cost_us_dollars)
|
434
|
+
existing_dgen.total_demand_cost_us_dollars = add_values(existing_dgen.total_demand_cost_us_dollars, new_dgen.total_demand_cost_us_dollars)
|
435
|
+
|
436
|
+
existing_dgen.year_one_energy_cost_bau_us_dollars = add_values(existing_dgen.year_one_energy_cost_bau_us_dollars, new_dgen.year_one_energy_cost_bau_us_dollars)
|
437
|
+
existing_dgen.year_one_demand_cost_bau_us_dollars = add_values(existing_dgen.year_one_demand_cost_bau_us_dollars, new_dgen.year_one_demand_cost_bau_us_dollars)
|
438
|
+
existing_dgen.year_one_bill_bau_us_dollars = add_values(existing_dgen.year_one_bill_bau_us_dollars, new_dgen.year_one_bill_bau_us_dollars)
|
439
|
+
existing_dgen.total_energy_cost_bau_us_dollars = add_values(existing_dgen.total_energy_cost_bau_us_dollars, new_dgen.total_energy_cost_bau_us_dollars)
|
440
|
+
existing_dgen.total_demand_cost_bau_us_dollars = add_values(existing_dgen.total_demand_cost_bau_us_dollars, new_dgen.total_demand_cost_bau_us_dollars)
|
441
|
+
|
442
|
+
existing_dgen.resilience_hours_min = add_values(existing_dgen.resilience_hours_min, new_dgen.resilience_hours_min)
|
443
|
+
existing_dgen.resilience_hours_max = add_values(existing_dgen.resilience_hours_max, new_dgen.resilience_hours_max)
|
444
|
+
existing_dgen.resilience_hours_avg = add_values(existing_dgen.resilience_hours_avg, new_dgen.resilience_hours_avg)
|
445
|
+
existing_dgen.probs_of_surviving = add_values(existing_dgen.probs_of_surviving, new_dgen.probs_of_surviving)
|
446
|
+
existing_dgen.probs_of_surviving_by_month = add_values(existing_dgen.probs_of_surviving_by_month, new_dgen.probs_of_surviving_by_month)
|
447
|
+
existing_dgen.probs_of_surviving_by_hour_of_the_day = add_values(existing_dgen.probs_of_surviving_by_hour_of_the_day, new_dgen.probs_of_surviving_by_hour_of_the_day)
|
335
448
|
|
336
449
|
new_dgen.solar_pv.each do |pv|
|
337
450
|
existing_dgen.solar_pv.push pv
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
2
|
+
# URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
4
|
#
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# *********************************************************************************
|
2
|
-
# URBANopt, Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
2
|
+
# URBANopt (tm), Copyright (c) 2019-2020, Alliance for Sustainable Energy, LLC, and other
|
3
3
|
# contributors. All rights reserved.
|
4
4
|
#
|
5
5
|
# Redistribution and use in source and binary forms, with or without modification,
|
@@ -39,10 +39,10 @@ module URBANopt
|
|
39
39
|
# Enduses class inlclude results for each fuel type.
|
40
40
|
##
|
41
41
|
class EndUses
|
42
|
-
attr_accessor :
|
42
|
+
attr_accessor :electricity_kwh, :natural_gas_kwh, :propane_kwh, :fuel_oil_kwh, :other_fuels_kwh, :district_cooling_kwh, :district_heating_kwh, :water_qbft # :nodoc:
|
43
43
|
##
|
44
|
-
# EndUses class intialize end_uses(fuel type) attributes: +:
|
45
|
-
# +:
|
44
|
+
# EndUses class intialize end_uses(fuel type) attributes: +:electricity_kwh+ , +:natural_gas_kwh+ , +:propane_kwh+ , +:fuel_oil_kwh+ , +:other_fuels_kwh+ ,
|
45
|
+
# +:district_cooling_kwh+ , +:district_heating_kwh+ , +:water_qbft+
|
46
46
|
##
|
47
47
|
# [parameters:]
|
48
48
|
# +hash+ - _Hash_ - A hash which may contain a deserialized end_uses.
|
@@ -51,12 +51,14 @@ module URBANopt
|
|
51
51
|
hash.delete_if { |k, v| v.nil? }
|
52
52
|
hash = defaults.merge(hash)
|
53
53
|
|
54
|
-
@
|
55
|
-
@
|
56
|
-
@
|
57
|
-
@
|
58
|
-
@
|
59
|
-
@
|
54
|
+
@electricity_kwh = EndUse.new(hash[:electricity_kwh])
|
55
|
+
@natural_gas_kwh = EndUse.new(hash[:natural_gas_kwh])
|
56
|
+
@propane_kwh = EndUse.new(hash[:propane_kwh])
|
57
|
+
@fuel_oil_kwh = EndUse.new(hash[:fuel_oil_kwh])
|
58
|
+
@other_fuels_kwh = EndUse.new(hash[:other_fuels_kwh])
|
59
|
+
@district_cooling_kwh = EndUse.new(hash[:district_cooling_kwh])
|
60
|
+
@district_heating_kwh = EndUse.new(hash[:district_heating_kwh])
|
61
|
+
@water_qbft = EndUse.new(hash[:water_qbft])
|
60
62
|
|
61
63
|
# initialize class variables @@validator and @@schema
|
62
64
|
@@validator ||= Validator.new
|
@@ -72,29 +74,37 @@ module URBANopt
|
|
72
74
|
def to_hash
|
73
75
|
result = {}
|
74
76
|
|
75
|
-
|
76
|
-
|
77
|
-
result[:
|
77
|
+
electricity_kwh_hash = @electricity_kwh.to_hash if @electricity_kwh
|
78
|
+
electricity_kwh_hash.delete_if { |k, v| v.nil? }
|
79
|
+
result[:electricity_kwh] = electricity_kwh_hash if @electricity_kwh
|
78
80
|
|
79
|
-
|
80
|
-
|
81
|
-
result[:
|
81
|
+
natural_gas_kwh_hash = @natural_gas_kwh.to_hash if @natural_gas_kwh
|
82
|
+
natural_gas_kwh_hash.delete_if { |k, v| v.nil? }
|
83
|
+
result[:natural_gas_kwh] = natural_gas_kwh_hash if @natural_gas_kwh
|
82
84
|
|
83
|
-
|
84
|
-
|
85
|
-
result[:
|
85
|
+
propane_kwh_hash = @propane_kwh.to_hash if @propane_kwh
|
86
|
+
propane_kwh_hash.delete_if { |k, v| v.nil? }
|
87
|
+
result[:propane_kwh] = propane_kwh_hash if @propane_kwh
|
86
88
|
|
87
|
-
|
88
|
-
|
89
|
-
result[:
|
89
|
+
fuel_oil_kwh_hash = @fuel_oil_kwh.to_hash if @fuel_oil_kwh
|
90
|
+
fuel_oil_kwh_hash.delete_if { |k, v| v.nil? }
|
91
|
+
result[:fuel_oil_kwh] = fuel_oil_kwh_hash if @fuel_oil_kwh
|
90
92
|
|
91
|
-
|
92
|
-
|
93
|
-
result[:
|
93
|
+
other_fuels_kwh_hash = @other_fuels_kwh.to_hash if @other_fuels_kwh
|
94
|
+
other_fuels_kwh_hash.delete_if { |k, v| v.nil? }
|
95
|
+
result[:other_fuels_kwh] = other_fuels_kwh_hash if @other_fuels_kwh
|
94
96
|
|
95
|
-
|
96
|
-
|
97
|
-
result[:
|
97
|
+
district_cooling_kwh_hash = @district_cooling_kwh.to_hash if @district_cooling_kwh
|
98
|
+
district_cooling_kwh_hash.delete_if { |k, v| v.nil? }
|
99
|
+
result[:district_cooling_kwh] = district_cooling_kwh_hash if @district_cooling_kwh
|
100
|
+
|
101
|
+
district_heating_kwh_hash = @district_heating_kwh.to_hash if @district_heating_kwh
|
102
|
+
district_heating_kwh_hash.delete_if { |k, v| v.nil? }
|
103
|
+
result[:district_heating_kwh] = district_heating_kwh_hash if @district_heating_kwh
|
104
|
+
|
105
|
+
water_qbft_hash = @water_qbft.to_hash if @water_qbft
|
106
|
+
water_qbft_hash.delete_if { |k, v| v.nil? }
|
107
|
+
result[:water_qbft] = water_qbft_hash if @water_qbft
|
98
108
|
|
99
109
|
# validate end_uses properties against schema
|
100
110
|
if @@validator.validate(@@schema[:definitions][:EndUses][:properties], result).any?
|
@@ -109,12 +119,14 @@ module URBANopt
|
|
109
119
|
##
|
110
120
|
def defaults
|
111
121
|
hash = {}
|
112
|
-
hash[:
|
113
|
-
hash[:
|
114
|
-
hash[:
|
115
|
-
hash[:
|
116
|
-
hash[:
|
117
|
-
hash[:
|
122
|
+
hash[:electricity_kwh] = EndUse.new.to_hash
|
123
|
+
hash[:natural_gas_kwh] = EndUse.new.to_hash
|
124
|
+
hash[:propane_kwh] = EndUse.new.to_hash
|
125
|
+
hash[:fuel_oil_kwh] = EndUse.new.to_hash
|
126
|
+
hash[:other_fuels_kwh] = EndUse.new.to_hash
|
127
|
+
hash[:district_cooling_kwh] = EndUse.new.to_hash
|
128
|
+
hash[:district_heating_kwh] = EndUse.new.to_hash
|
129
|
+
hash[:water_qbft] = EndUse.new.to_hash
|
118
130
|
|
119
131
|
return hash
|
120
132
|
end
|
@@ -127,11 +139,13 @@ module URBANopt
|
|
127
139
|
##
|
128
140
|
def merge_end_uses!(new_end_uses)
|
129
141
|
# modify the existing_period by summing up the results ; # sum results only if they exist
|
130
|
-
@
|
131
|
-
@
|
132
|
-
@
|
133
|
-
@
|
134
|
-
@
|
142
|
+
@electricity_kwh.merge_end_use!(new_end_uses.electricity_kwh)
|
143
|
+
@natural_gas_kwh.merge_end_use!(new_end_uses.natural_gas_kwh)
|
144
|
+
@propane_kwh.merge_end_use!(new_end_uses.propane_kwh)
|
145
|
+
@fuel_oil_kwh.merge_end_use!(new_end_uses.fuel_oil_kwh)
|
146
|
+
@other_fuels_kwh.merge_end_use!(new_end_uses.other_fuels_kwh)
|
147
|
+
@district_cooling_kwh.merge_end_use!(new_end_uses.district_cooling_kwh)
|
148
|
+
@district_heating_kwh.merge_end_use!(new_end_uses.district_heating_kwh)
|
135
149
|
return self
|
136
150
|
end
|
137
151
|
end
|
@@ -1,3 +1,33 @@
|
|
1
|
+
# *********************************************************************************
|
2
|
+
# URBANopt (tm), Copyright (c) 2019-2020, 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
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
20
|
+
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
21
|
+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
22
|
+
# IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
23
|
+
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
24
|
+
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
25
|
+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
26
|
+
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
27
|
+
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
28
|
+
# OF THE POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
# *********************************************************************************
|
30
|
+
|
1
31
|
require 'version'
|
2
32
|
require 'openstudio/extension'
|
3
33
|
|