urbanopt-reporting 0.9.1 → 0.10.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.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/nightly_ci_build.yml +1 -0
  3. data/CHANGELOG.md +14 -0
  4. data/Gemfile +2 -0
  5. data/lib/measures/default_feature_reports/measure.rb +18 -19
  6. data/lib/measures/default_feature_reports/measure.xml +3 -3
  7. data/lib/measures/export_time_series_modelica/measure.rb +1 -1
  8. data/lib/urbanopt/reporting/default_reports/construction_cost.rb +2 -2
  9. data/lib/urbanopt/reporting/default_reports/date.rb +1 -1
  10. data/lib/urbanopt/reporting/default_reports/distributed_generation.rb +65 -65
  11. data/lib/urbanopt/reporting/default_reports/end_use.rb +1 -1
  12. data/lib/urbanopt/reporting/default_reports/end_uses.rb +2 -2
  13. data/lib/urbanopt/reporting/default_reports/feature_report.rb +2 -3
  14. data/lib/urbanopt/reporting/default_reports/generator.rb +2 -2
  15. data/lib/urbanopt/reporting/default_reports/logger.rb +1 -1
  16. data/lib/urbanopt/reporting/default_reports/power_distribution.rb +2 -2
  17. data/lib/urbanopt/reporting/default_reports/qaqc_flags.rb +4 -11
  18. data/lib/urbanopt/reporting/default_reports/reporting_period.rb +7 -7
  19. data/lib/urbanopt/reporting/default_reports/scenario_power_distribution_cost.rb +162 -166
  20. data/lib/urbanopt/reporting/default_reports/scenario_report.rb +3 -3
  21. data/lib/urbanopt/reporting/default_reports/schema/scenario_schema.json +58 -17
  22. data/lib/urbanopt/reporting/default_reports/solar_pv.rb +1 -1
  23. data/lib/urbanopt/reporting/default_reports/storage.rb +1 -1
  24. data/lib/urbanopt/reporting/default_reports/timeseries_csv.rb +2 -2
  25. data/lib/urbanopt/reporting/default_reports/wind.rb +1 -1
  26. data/lib/urbanopt/reporting/version.rb +1 -1
  27. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5aab8d062f546b4a594cc0f86d7c27b8bfb065fe357aed461df3db761e43590d
4
- data.tar.gz: 8a828838d4b881ccd81ca7541b247aad02f6aa560b2d14fa1ba213f9ab14de56
3
+ metadata.gz: b1877280e45c42b9a43bfd39dbd5305079fdcd3e4fad3cfba9894d0b7a05940c
4
+ data.tar.gz: 4380403c78776ac9ffa650859cf14a607b25bd910a0b1347c5c0f94362e21a55
5
5
  SHA512:
6
- metadata.gz: 3318a28163610658c35f31a9192c69877e6ffe1aee565d1a5d3b5a5f6180a95c83f5f8ee4258eaff20cc09390764082d04d438560dca0310816207e26b2b6d0c
7
- data.tar.gz: c90f19fd040dff797d0f2186ce11c1f18b2a8bb2b49e1c1934629bb3cae468ebe49466d38dee524bf2217ef69f099e08cb31b6130dd7d47e9f62429e1c8cf0b3
6
+ metadata.gz: 45de5ba3805fa748b1b6630ba7ca655643c28bc611c9aa4771944d6ffb40f296c0500f46dc700c293d54522a20a6d6f3c8205482e704436bff369f6386d1d569
7
+ data.tar.gz: 69a9b1ee7e94e14faa98f4cfd64f9f5cd0efdc9939f5c0ea8490018b14596f2a26590622efee2e23a602a1f1f34548756dabe2123f9b251df39c22a088a9dbd1
@@ -2,6 +2,7 @@ name: Reporting-gem CI
2
2
 
3
3
  on:
4
4
  # push:
5
+ workflow_dispatch:
5
6
  schedule:
6
7
  # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
7
8
  # 5 am UTC (11pm MDT the day before) every weekday night in MDT
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # URBANopt Reporting Gem
2
2
 
3
+ ## Version 0.10.1
4
+ * Other Fuel emission factors update by @rawadelkontar in https://github.com/urbanopt/urbanopt-reporting-gem/pull/153
5
+
6
+
7
+ **Full Changelog**: https://github.com/urbanopt/urbanopt-reporting-gem/compare/v0.10.0...v0.10.1
8
+
9
+ ## Version 0.10.0
10
+ * Additional reporting tests by @vtnate in https://github.com/urbanopt/urbanopt-reporting-gem/pull/147
11
+ * Update formatting and version in export_modelica_loads by @nllong in https://github.com/urbanopt/urbanopt-reporting-gem/pull/149
12
+ * Update feature reports for Reopt v3 by @vtnate in https://github.com/urbanopt/urbanopt-reporting-gem/pull/148
13
+
14
+
15
+ **Full Changelog**: https://github.com/urbanopt/urbanopt-reporting-gem/compare/v0.9.1...0.10.0
16
+
3
17
  ## Version 0.9.1
4
18
  * downgrade json-schema to 2.7 by @vtnate in https://github.com/urbanopt/urbanopt-reporting-gem/pull/145
5
19
 
data/Gemfile CHANGED
@@ -15,6 +15,8 @@ allow_local = ENV['FAVOR_LOCAL_GEMS']
15
15
  gem 'addressable', '2.8.1'
16
16
  # pin this dependency to avoid using racc dependency (which has native extensions)
17
17
  gem 'parser', '3.2.2.2'
18
+ # pin this dependency because 2.9.2 breaks OS tests (openstudio:test_with_openstudio)
19
+ gem 'regexp_parser', '2.9.0'
18
20
 
19
21
  # if allow_local && File.exist?('../openstudio-extension-gem')
20
22
  # gem 'openstudio-extension', path: '../openstudio-extension-gem'
@@ -798,7 +798,7 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
798
798
  enduses.each do |eu|
799
799
  sql_r = sql_query(runner, sql_file, 'AnnualBuildingUtilityPerformanceSummary', "TableName='End Uses' AND RowName='#{eu}' AND ColumnName='#{ft}'")
800
800
 
801
- # report each query in its corresponding feature report obeject
801
+ # report each query in its corresponding feature report object
802
802
  x = ft.tr(' ', '_').downcase
803
803
  if x.include? 'water'
804
804
  x_u = "#{x}_qbft"
@@ -931,14 +931,14 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
931
931
  conv_kg_mt = 0.001 # kg to metric ton
932
932
  conv_kbtu_J = 1054852.32 # KBtu to J (1kBtu = 1054852.32 J)
933
933
 
934
- ##### Emisison factors for natural gas, propane, and fuel oil based on EPA eGRID data and calculated using 20-year GWP horizon based on ASHRAE 189.1
935
- ## natural gas : 277.358126 KG/MWH
936
- ## propane : 323.896704 KG/MWH
937
- ## Fuel oil : 294.962046 KG/MWH
938
- nat_gas_val = 277.358126
939
- lpg_val = 323.896704
940
- fo1_val = 294.962046
941
- fo2_val = 294.962046
934
+ ##### Emisison factors for natural gas, propane, and fuel oil based on https://portfoliomanager.energystar.gov/pdf/reference/Emissions.pdf
935
+ ## natural gas : 181.7 KG/MWH
936
+ ## propane : 219.2 KG/MWH
937
+ ## Fuel oil #1: 250.8 KG/MWH
938
+ nat_gas_val = 181.7
939
+ lpg_val = 219.2
940
+ fo1_val = 250.8
941
+ fo2_val = 253.2
942
942
 
943
943
  ##########################################################################################################################
944
944
  ######################################## Reporting TImeseries Results FOR CSV File #######################################
@@ -1046,7 +1046,7 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
1046
1046
  total_hours = 1 / timesteps_per_hour.to_f # make sure timesteps_per_hour is a float in the division
1047
1047
  # set power_conversion
1048
1048
  power_conversion = total_hours # we set the power conversio to total_hours since we want to convert lWh to kW
1049
- puts "Power Converion: to convert kWh to kW values will be divided by #{power_conversion}"
1049
+ puts "Power Conversion: to convert kWh to kW values will be divided by #{power_conversion}"
1050
1050
 
1051
1051
  # number of values in each timeseries
1052
1052
  n = nil
@@ -1184,14 +1184,13 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
1184
1184
  # conv_kg_mt = 0.001 # kg to metric ton
1185
1185
  # conv_kbtu_J = 1054852.32 # KBtu to J (1kBtu = 1054852.32 J)
1186
1186
 
1187
- # ##### Emisison factors for natural gas, propane, and fuel oil based on EPA eGRID data and calculated using 20-year GWP horizon based on ASHRAE 189.1
1188
- # ## natural gas : 277.358126 KG/MWH
1189
- # ## propane : 323.896704 KG/MWH
1190
- # ## Fuel oil : 294.962046 KG/MWH
1191
- # nat_gas_val = 277.358126
1192
- # lpg_val = 323.896704
1193
- # fo1_val = 294.962046
1194
- # fo2_val = 294.962046
1187
+ # ##### Emisison factors for natural gas, propane, and fuel oil based on https://portfoliomanager.energystar.gov/pdf/reference/Emissions.pdf
1188
+ # ## natural gas : 181.7 KG/MWH
1189
+ # ## propane : 219.2 KG/MWH
1190
+ # nat_gas_val = 181.7
1191
+ # lpg_val = 219.2
1192
+ # fo1_val = 250.8
1193
+ # fo2_val = 253.2
1195
1194
 
1196
1195
  if timeseries_name == 'Natural_Gas_Emissions'
1197
1196
  newVals = Array.new(n, 0)
@@ -1441,7 +1440,7 @@ class DefaultFeatureReports < OpenStudio::Measure::ReportingMeasure
1441
1440
  else
1442
1441
  raise 'ELECTRICITY and GAS results are not initiaized'
1443
1442
  end
1444
- # get formated datetimes
1443
+ # get formatted datetimes
1445
1444
  timeseries_d.dateTimes.each do |datetime|
1446
1445
  datetimes << format_datetime(datetime.to_s)
1447
1446
  end
@@ -3,8 +3,8 @@
3
3
  <schema_version>3.1</schema_version>
4
4
  <name>default_feature_reports</name>
5
5
  <uid>9ee3135a-8070-4408-bfa1-b75fecf9dd4f</uid>
6
- <version_id>0d079df4-5b14-465d-9b3c-d00e30b3def2</version_id>
7
- <version_modified>2024-01-08T22:54:10Z</version_modified>
6
+ <version_id>1f0dd70a-ddad-4bb8-a54b-0aeb696e80d0</version_id>
7
+ <version_modified>2024-06-20T19:28:12Z</version_modified>
8
8
  <xml_checksum>FB304155</xml_checksum>
9
9
  <class_name>DefaultFeatureReports</class_name>
10
10
  <display_name>DefaultFeatureReports</display_name>
@@ -128,7 +128,7 @@
128
128
  <filename>measure.rb</filename>
129
129
  <filetype>rb</filetype>
130
130
  <usage_type>script</usage_type>
131
- <checksum>A0464D25</checksum>
131
+ <checksum>005CDD6D</checksum>
132
132
  </file>
133
133
  <file>
134
134
  <filename>USA_CO_Golden-NREL.724666_TMY3.epw</filename>
@@ -77,7 +77,7 @@ class ExportTimeSeriesLoadsCSV < OpenStudio::Measure::ReportingMeasure
77
77
  # use the built-in error checking
78
78
  return false unless runner.validateUserArguments(arguments(model), user_arguments)
79
79
 
80
- # #Read in argumetns related to variables for output requests
80
+ # #Read in arguments related to variables for output requests
81
81
  hhw_loop_name = runner.getStringArgumentValue('hhw_loop_name', user_arguments)
82
82
  chw_loop_name = runner.getStringArgumentValue('chw_loop_name', user_arguments)
83
83
 
@@ -17,7 +17,7 @@ module URBANopt
17
17
  attr_accessor :category, :item_name, :unit_cost, :cost_units, :item_quantity, :total_cost # :nodoc:
18
18
 
19
19
  ##
20
- # ConstructionCost class intialize all construction_cost attributes:
20
+ # ConstructionCost class initialize all construction_cost attributes:
21
21
  # +:category+ , +:item_name+ , +:unit_cost+ , +:cost_units+ , +:item_quantity+ , +:total_cost+
22
22
  ##
23
23
  # [parameters:]
@@ -108,7 +108,7 @@ module URBANopt
108
108
  end
109
109
 
110
110
  ##
111
- # Merges muliple construction costs together.
111
+ # Merges multiple construction costs together.
112
112
  # - loops over the new_costs and find the index of the cost with identical +:item_name+.
113
113
  # - if +item_name+ is identical then modify the existing_cost array by summing the :total_cost and :item_quantity. Else add the new_cost to existing_costs array.
114
114
  ##
@@ -17,7 +17,7 @@ module URBANopt
17
17
  attr_accessor :month, :day_of_month, :year #:nodoc:
18
18
 
19
19
  ##
20
- # Date class intialize all date attributes:
20
+ # Date class initialize all date attributes:
21
21
  # +:month+ , +:day_of_month+ , +:year+
22
22
  ##
23
23
  # [parameters:]
@@ -20,67 +20,67 @@ module URBANopt
20
20
  ##
21
21
  # _Float_ - Lifecycle costs for the complete distributed generation system in US Dollars
22
22
  #
23
- attr_accessor :lcc_us_dollars
23
+ attr_accessor :lcc
24
24
 
25
25
  ##
26
26
  # _Float_ - Lifecycle costs for the complete distributed generation system in US Dollars
27
27
  #
28
- attr_accessor :lcc_bau_us_dollars
28
+ attr_accessor :lcc_bau
29
29
 
30
30
  ##
31
31
  # _Float_ - Net present value of the complete distributed generation system in US Dollars
32
32
  #
33
- attr_accessor :npv_us_dollars
33
+ attr_accessor :npv
34
34
 
35
35
  ##
36
36
  # _Float_ - Total amount paid for utility energy in US Dollars in the first year of operation
37
37
  #
38
- attr_accessor :year_one_energy_cost_us_dollars
38
+ attr_accessor :year_one_energy_cost_before_tax
39
39
 
40
40
  ##
41
41
  # _Float_ - Total amount paid in utility demand charges in US Dollars in the first year of operation
42
42
  #
43
- attr_accessor :year_one_demand_cost_us_dollars
43
+ attr_accessor :year_one_demand_cost_before_tax
44
44
 
45
45
  ##
46
46
  # _Float_ - Total amount paid to the utility in US Dollars in the first year of operation
47
47
  #
48
- attr_accessor :year_one_bill_us_dollars
48
+ attr_accessor :year_one_bill_before_tax
49
49
 
50
50
  ##
51
51
  # _Float_ - Total energy costs in US Dollars over the life of the system after tax
52
52
  #
53
- attr_accessor :total_energy_cost_us_dollars
53
+ attr_accessor :lifecycle_energy_cost_after_tax
54
54
 
55
55
  ##
56
56
  # _Float_ - Total demand costs in US Dollars over the life of the system after tax
57
57
  #
58
- attr_accessor :total_demand_cost_us_dollars
58
+ attr_accessor :lifecycle_demand_cost_after_tax
59
59
 
60
60
  ##
61
- # _Float_ - Year one energy cost in the business as usual scenario (i.e no new system) after tax, us dollars
61
+ # _Float_ - Year one energy cost in the business as usual scenario (i.e no new system) before tax, us dollars
62
62
  #
63
- attr_accessor :year_one_energy_cost_bau_us_dollars
63
+ attr_accessor :year_one_energy_cost_before_tax_bau
64
64
 
65
65
  ##
66
66
  # _Float_ - Year one demand cost in the business as usual scenario (i.e no new system), us dollars
67
67
  #
68
- attr_accessor :year_one_demand_cost_bau_us_dollars
68
+ attr_accessor :year_one_demand_cost_before_tax_bau
69
69
 
70
70
  ##
71
71
  # _Float_ - Year one demand energy bill in the business as usual scenario (i.e no new system), us dollars
72
72
  #
73
- attr_accessor :year_one_bill_bau_us_dollars
73
+ attr_accessor :year_one_bill_before_tax_bau
74
74
 
75
75
  ##
76
76
  # _Float_ - Total lifetime demand costs in the business as usual scenario (i.e no new system) after tax, us dollars
77
77
  #
78
- attr_accessor :total_demand_cost_bau_us_dollars
78
+ attr_accessor :lifecycle_demand_cost_after_tax_bau
79
79
 
80
80
  ##
81
81
  # _Float_ - Total lifetime energy costs in the business as usual scenario (i.e no new system) after tax, us dollars
82
82
  #
83
- attr_accessor :total_energy_cost_bau_us_dollars
83
+ attr_accessor :lifecycle_energy_cost_after_tax_bau
84
84
 
85
85
  ##
86
86
  # _Array_ - List of _SolarPV_ systems
@@ -162,16 +162,16 @@ module URBANopt
162
162
  attr_accessor :reopt_assumptions_file_path
163
163
 
164
164
  ##
165
- # _Float_ - Annual percentage of electricity supplied by renewable sources
165
+ # _Float_ - Annual fraction of electricity supplied by renewable sources
166
166
  #
167
- attr_accessor :annual_renewable_electricity_pct
167
+ attr_accessor :renewable_electricity_fraction
168
168
 
169
169
  ##
170
170
  # Initialize distributed generation system design and financial metrics.
171
171
  #
172
172
  # * Technologies include +:solar_pv+, +:wind+, +:generator+, and +:storage+.
173
- # * Financial metrics include +:lcc_us_dollars+, +:npv_us_dollars+, +:year_one_energy_cost_us_dollars+, +:year_one_demand_cost_us_dollars+,
174
- # +:year_one_bill_us_dollars+, and +:total_energy_cost_us_dollars+
173
+ # * Financial metrics include +:lcc+, +:npv+, +:year_one_energy_cost_before_tax+, +:year_one_demand_cost_before_tax+,
174
+ # +:year_one_bill_before_tax+, and +:lifecycle_energy_cost_after_tax+
175
175
  ##
176
176
  # [parameters:]
177
177
  #
@@ -180,20 +180,20 @@ module URBANopt
180
180
  def initialize(hash = {})
181
181
  hash.delete_if { |k, v| v.nil? }
182
182
 
183
- @annual_renewable_electricity_pct = hash[:annual_renewable_electricity_pct]
184
- @lcc_us_dollars = hash[:lcc_us_dollars]
185
- @lcc_bau_us_dollars = hash[:lcc_bau_us_dollars]
186
- @npv_us_dollars = hash[:npv_us_dollars]
187
- @year_one_energy_cost_us_dollars = hash[:year_one_energy_cost_us_dollars]
188
- @year_one_energy_cost_bau_us_dollars = hash[:year_one_energy_cost_bau_us_dollars]
189
- @year_one_demand_cost_us_dollars = hash[:year_one_demand_cost_us_dollars]
190
- @year_one_demand_cost_bau_us_dollars = hash[:year_one_demand_cost_bau_us_dollars]
191
- @year_one_bill_us_dollars = hash[:year_one_bill_us_dollars]
192
- @year_one_bill_bau_us_dollars = hash[:year_one_bill_bau_us_dollars]
193
- @total_energy_cost_us_dollars = hash[:total_energy_cost_us_dollars]
194
- @total_energy_cost_bau_us_dollars = hash[:total_energy_cost_bau_us_dollars]
195
- @total_demand_cost_us_dollars = hash[:total_demand_cost_us_dollars]
196
- @total_demand_cost_bau_us_dollars = hash[:total_demand_cost_bau_us_dollars]
183
+ @renewable_electricity_fraction = hash[:renewable_electricity_fraction]
184
+ @lcc = hash[:lcc]
185
+ @lcc_bau = hash[:lcc_bau]
186
+ @npv = hash[:npv]
187
+ @year_one_energy_cost_before_tax = hash[:year_one_energy_cost_before_tax]
188
+ @year_one_energy_cost_before_tax_bau = hash[:year_one_energy_cost_before_tax_bau]
189
+ @year_one_demand_cost_before_tax = hash[:year_one_demand_cost_before_tax]
190
+ @year_one_demand_cost_before_tax_bau = hash[:year_one_demand_cost_before_tax_bau]
191
+ @year_one_bill_before_tax = hash[:year_one_bill_before_tax]
192
+ @year_one_bill_before_tax_bau = hash[:year_one_bill_before_tax_bau]
193
+ @lifecycle_energy_cost_after_tax = hash[:lifecycle_energy_cost_after_tax]
194
+ @lifecycle_energy_cost_after_tax_bau = hash[:lifecycle_energy_cost_after_tax_bau]
195
+ @lifecycle_demand_cost_after_tax = hash[:lifecycle_demand_cost_after_tax]
196
+ @lifecycle_demand_cost_after_tax_bau = hash[:lifecycle_demand_cost_after_tax_bau]
197
197
 
198
198
  @resilience_hours_min = hash[:resilience_hours_min]
199
199
  @resilience_hours_max = hash[:resilience_hours_max]
@@ -345,22 +345,22 @@ module URBANopt
345
345
  def to_hash
346
346
  result = {}
347
347
  result[:reopt_assumptions_file_path] = @reopt_assumptions_file_path if @reopt_assumptions_file_path
348
- result[:annual_renewable_electricity_pct] = @annual_renewable_electricity_pct if @annual_renewable_electricity_pct
349
- result[:lcc_us_dollars] = @lcc_us_dollars if @lcc_us_dollars
350
- result[:lcc_bau_us_dollars] = @lcc_bau_us_dollars if @lcc_bau_us_dollars
351
- result[:npv_us_dollars] = @npv_us_dollars if @npv_us_dollars
352
-
353
- result[:year_one_energy_cost_us_dollars] = @year_one_energy_cost_us_dollars if @year_one_energy_cost_us_dollars
354
- result[:year_one_demand_cost_us_dollars] = @year_one_demand_cost_us_dollars if @year_one_demand_cost_us_dollars
355
- result[:year_one_bill_us_dollars] = @year_one_bill_us_dollars if @year_one_bill_us_dollars
356
- result[:total_demand_cost_us_dollars] = @total_demand_cost_us_dollars if @total_demand_cost_us_dollars
357
- result[:total_energy_cost_us_dollars] = @total_energy_cost_us_dollars if @total_energy_cost_us_dollars
358
-
359
- result[:year_one_energy_cost_bau_us_dollars] = @year_one_energy_cost_bau_us_dollars if @year_one_energy_cost_bau_us_dollars
360
- result[:year_one_demand_cost_bau_us_dollars] = @year_one_demand_cost_bau_us_dollars if @year_one_demand_cost_bau_us_dollars
361
- result[:year_one_bill_bau_us_dollars] = @year_one_bill_bau_us_dollars if @year_one_bill_bau_us_dollars
362
- result[:total_energy_cost_bau_us_dollars] = @total_energy_cost_bau_us_dollars if @total_energy_cost_bau_us_dollars
363
- result[:total_demand_cost_bau_us_dollars] = @total_demand_cost_bau_us_dollars if @total_demand_cost_bau_us_dollars
348
+ result[:renewable_electricity_fraction] = @renewable_electricity_fraction if @renewable_electricity_fraction
349
+ result[:lcc] = @lcc if @lcc
350
+ result[:lcc_bau] = @lcc_bau if @lcc_bau
351
+ result[:npv] = @npv if @npv
352
+
353
+ result[:year_one_energy_cost_before_tax] = @year_one_energy_cost_before_tax if @year_one_energy_cost_before_tax
354
+ result[:year_one_demand_cost_before_tax] = @year_one_demand_cost_before_tax if @year_one_demand_cost_before_tax
355
+ result[:year_one_bill_before_tax] = @year_one_bill_before_tax if @year_one_bill_before_tax
356
+ result[:lifecycle_demand_cost_after_tax] = @lifecycle_demand_cost_after_tax if @lifecycle_demand_cost_after_tax
357
+ result[:lifecycle_energy_cost_after_tax] = @lifecycle_energy_cost_after_tax if @lifecycle_energy_cost_after_tax
358
+
359
+ result[:year_one_energy_cost_before_tax_bau] = @year_one_energy_cost_before_tax_bau if @year_one_energy_cost_before_tax_bau
360
+ result[:year_one_demand_cost_before_tax_bau] = @year_one_demand_cost_before_tax_bau if @year_one_demand_cost_before_tax_bau
361
+ result[:year_one_bill_before_tax_bau] = @year_one_bill_before_tax_bau if @year_one_bill_before_tax_bau
362
+ result[:lifecycle_energy_cost_after_tax_bau] = @lifecycle_energy_cost_after_tax_bau if @lifecycle_energy_cost_after_tax_bau
363
+ result[:lifecycle_demand_cost_after_tax_bau] = @lifecycle_demand_cost_after_tax_bau if @lifecycle_demand_cost_after_tax_bau
364
364
 
365
365
  result[:total_solar_pv_kw] = @total_solar_pv_kw if @total_solar_pv_kw
366
366
  result[:total_wind_kw] = @total_wind_kw if @total_wind_kw
@@ -415,22 +415,22 @@ module URBANopt
415
415
  # Merge a distributed generation system with a new system
416
416
  ##
417
417
  def self.merge_distributed_generation(existing_dgen, new_dgen)
418
- existing_dgen.annual_renewable_electricity_pct = add_values(existing_dgen.annual_renewable_electricity_pct, new_dgen.annual_renewable_electricity_pct)
419
- existing_dgen.lcc_us_dollars = add_values(existing_dgen.lcc_us_dollars, new_dgen.lcc_us_dollars)
420
- existing_dgen.lcc_bau_us_dollars = add_values(existing_dgen.lcc_bau_us_dollars, new_dgen.lcc_bau_us_dollars)
421
- existing_dgen.npv_us_dollars = add_values(existing_dgen.npv_us_dollars, new_dgen.npv_us_dollars)
422
-
423
- 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)
424
- 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)
425
- existing_dgen.year_one_bill_us_dollars = add_values(existing_dgen.year_one_bill_us_dollars, new_dgen.year_one_bill_us_dollars)
426
- existing_dgen.total_energy_cost_us_dollars = add_values(existing_dgen.total_energy_cost_us_dollars, new_dgen.total_energy_cost_us_dollars)
427
- existing_dgen.total_demand_cost_us_dollars = add_values(existing_dgen.total_demand_cost_us_dollars, new_dgen.total_demand_cost_us_dollars)
428
-
429
- 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)
430
- 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)
431
- 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)
432
- 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)
433
- 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)
418
+ existing_dgen.renewable_electricity_fraction = add_values(existing_dgen.renewable_electricity_fraction, new_dgen.renewable_electricity_fraction)
419
+ existing_dgen.lcc = add_values(existing_dgen.lcc, new_dgen.lcc)
420
+ existing_dgen.lcc_bau = add_values(existing_dgen.lcc_bau, new_dgen.lcc_bau)
421
+ existing_dgen.npv = add_values(existing_dgen.npv, new_dgen.npv)
422
+
423
+ existing_dgen.year_one_energy_cost_before_tax = add_values(existing_dgen.year_one_energy_cost_before_tax, new_dgen.year_one_energy_cost_before_tax)
424
+ existing_dgen.year_one_demand_cost_before_tax = add_values(existing_dgen.year_one_demand_cost_before_tax, new_dgen.year_one_demand_cost_before_tax)
425
+ existing_dgen.year_one_bill_before_tax = add_values(existing_dgen.year_one_bill_before_tax, new_dgen.year_one_bill_before_tax)
426
+ existing_dgen.lifecycle_energy_cost_after_tax = add_values(existing_dgen.lifecycle_energy_cost_after_tax, new_dgen.lifecycle_energy_cost_after_tax)
427
+ existing_dgen.lifecycle_demand_cost_after_tax = add_values(existing_dgen.lifecycle_demand_cost_after_tax, new_dgen.lifecycle_demand_cost_after_tax)
428
+
429
+ existing_dgen.year_one_energy_cost_before_tax_bau = add_values(existing_dgen.year_one_energy_cost_before_tax_bau, new_dgen.year_one_energy_cost_before_tax_bau)
430
+ existing_dgen.year_one_demand_cost_before_tax_bau = add_values(existing_dgen.year_one_demand_cost_before_tax_bau, new_dgen.year_one_demand_cost_before_tax_bau)
431
+ existing_dgen.year_one_bill_before_tax_bau = add_values(existing_dgen.year_one_bill_before_tax_bau, new_dgen.year_one_bill_before_tax_bau)
432
+ existing_dgen.lifecycle_energy_cost_after_tax_bau = add_values(existing_dgen.lifecycle_energy_cost_after_tax_bau, new_dgen.lifecycle_energy_cost_after_tax_bau)
433
+ existing_dgen.lifecycle_demand_cost_after_tax_bau = add_values(existing_dgen.lifecycle_demand_cost_after_tax_bau, new_dgen.lifecycle_demand_cost_after_tax_bau)
434
434
 
435
435
  existing_dgen.resilience_hours_min = add_values(existing_dgen.resilience_hours_min, new_dgen.resilience_hours_min)
436
436
  existing_dgen.resilience_hours_max = add_values(existing_dgen.resilience_hours_max, new_dgen.resilience_hours_max)
@@ -470,7 +470,7 @@ module URBANopt
470
470
 
471
471
  new_dgen.generator.each do |generator|
472
472
  existing_dgen.generator.push generator
473
- if existing_dgen.total_wind_kw.nil?
473
+ if existing_dgen.total_generator_kw.nil?
474
474
  existing_dgen.total_generator_kw = generator.size_kw
475
475
  else
476
476
  existing_dgen.total_generator_kw += generator.size_kw
@@ -17,7 +17,7 @@ module URBANopt
17
17
  :fans, :pumps, :heat_rejection, :humidification, :heat_recovery, :water_systems, :refrigeration, :generators # :nodoc:
18
18
 
19
19
  ##
20
- # EndUse class intialize all enduse atributes: +:heating+ , +:cooling+ , +:interior_lighting+ ,
20
+ # EndUse class initialize all enduse attributes: +:heating+ , +:cooling+ , +:interior_lighting+ ,
21
21
  # +:exterior_lighting+ , +:interior_equipment+ , +:exterior_equipment+ ,
22
22
  # +:fans+ , +:pumps+ , +:heat_rejection+ , +:humidification+ , +:heat_recovery+ , +:water_systems+ , +:refrigeration+ , +:generators+
23
23
  ##
@@ -11,13 +11,13 @@ module URBANopt
11
11
  module Reporting
12
12
  module DefaultReports
13
13
  ##
14
- # Enduses class inlclude results for each fuel type.
14
+ # Enduses class include results for each fuel type.
15
15
  ##
16
16
  class EndUses
17
17
  attr_accessor :electricity_kwh, :natural_gas_kwh, :propane_kwh, :fuel_oil_kwh, :other_fuels_kwh, :district_cooling_kwh, :district_heating_kwh, :water_qbft # :nodoc:
18
18
 
19
19
  ##
20
- # EndUses class intialize end_uses(fuel type) attributes: +:electricity_kwh+ , +:natural_gas_kwh+ , +:propane_kwh+ , +:fuel_oil_kwh+ , +:other_fuels_kwh+ ,
20
+ # EndUses class initialize end_uses(fuel type) attributes: +:electricity_kwh+ , +:natural_gas_kwh+ , +:propane_kwh+ , +:fuel_oil_kwh+ , +:other_fuels_kwh+ ,
21
21
  # +:district_cooling_kwh+ , +:district_heating_kwh+ , +:water_qbft+
22
22
  ##
23
23
  # [parameters:]
@@ -55,7 +55,7 @@ module URBANopt
55
55
  # design_parameters to add later
56
56
  @construction_costs = []
57
57
  hash[:construction_costs].each do |cc|
58
- @constructiion_costs << ConstructionCost.new(cc)
58
+ @construction_costs << ConstructionCost.new(cc)
59
59
  end
60
60
 
61
61
  @reporting_periods = []
@@ -212,7 +212,6 @@ module URBANopt
212
212
  def save(file_name = 'default_feature_report')
213
213
  # reassign the initialize local variable @file_name to the file name input.
214
214
  @file_name = file_name
215
-
216
215
  # save the feature reports csv and json data
217
216
  old_timeseries_path = nil
218
217
  if !@timeseries_csv.path.nil?
@@ -298,7 +297,7 @@ module URBANopt
298
297
  ##
299
298
  # Saves the 'default_feature_report.csv' file to the results directory
300
299
  # This method only copies the CSV feature reports from the folder generated by the reporting measure
301
- # (<meausure number>_default_feature_reports/) to the new feature_reports/ folder
300
+ # (<measure number>_default_feature_reports/) to the new feature_reports/ folder
302
301
  ##
303
302
  # [parameters]:
304
303
  # +file_name+ - _String_ - Assign a name to the saved feature report file without an extension
@@ -19,11 +19,11 @@ module URBANopt
19
19
  attr_accessor :size_kw
20
20
 
21
21
  ##
22
- # Intialize Generator attributes from a hash. Generator attributes currently are limited to power capacity.
22
+ # Initialize Generator attributes from a hash. Generator attributes currently are limited to power capacity.
23
23
  ##
24
24
  # [parameters:]
25
25
  #
26
- # * +hash+ - _Hash_ - A hash containting a +:size_kw+ key/value pair which represents the nameplate capacity in kilowatts (kW)
26
+ # * +hash+ - _Hash_ - A hash containing a +:size_kw+ key/value pair which represents the nameplate capacity in kilowatts (kW)
27
27
  #
28
28
  def initialize(hash = {})
29
29
  hash.delete_if { |k, v| v.nil? }
@@ -12,7 +12,7 @@ module URBANopt
12
12
 
13
13
  @@logger.level = Logger::WARN
14
14
  ##
15
- # Definining class variable "@@logger" to log errors, info and warning messages.
15
+ # Defining class variable "@@logger" to log errors, info and warning messages.
16
16
  def self.logger
17
17
  @@logger
18
18
  end
@@ -12,7 +12,7 @@ module URBANopt
12
12
  module Reporting
13
13
  module DefaultReports
14
14
  ##
15
- # power_distributio include eletrical power distribution systems information.
15
+ # power_distribution include eletrical power distribution systems information.
16
16
  ##
17
17
  class PowerDistribution
18
18
  attr_accessor :under_voltage_hours, :over_voltage_hours, :nominal_capacity,
@@ -89,7 +89,7 @@ module URBANopt
89
89
  end
90
90
 
91
91
  ##
92
- # Merges muliple power distribution results together.
92
+ # Merges multiple power distribution results together.
93
93
  ##
94
94
  # +new_costs+ - _Array_ - An array of ConstructionCost objects.
95
95
  def merge_power_distribution
@@ -16,9 +16,9 @@ module URBANopt
16
16
  ##
17
17
  # _Hash_ - Hash of flags raised by QAQC measure for this feature during this reporting period
18
18
  #
19
- attr_accessor :eui_reasonableness,:end_use_by_category,:mechanical_system_part_load_efficiency,
20
- :simultaneous_heating_and_cooling , :internal_loads , :schedules, :envelope_r_value,
21
- :domestic_hot_water , :mechanical_system_efficiency , :supply_and_zone_air_temperature,
19
+ attr_accessor :eui_reasonableness, :end_use_by_category, :mechanical_system_part_load_efficiency,
20
+ :simultaneous_heating_and_cooling, :internal_loads, :schedules, :envelope_r_value,
21
+ :domestic_hot_water, :mechanical_system_efficiency, :supply_and_zone_air_temperature,
22
22
  :total_qaqc_flags
23
23
 
24
24
  ##
@@ -46,14 +46,11 @@ module URBANopt
46
46
  @mechanical_system_efficiency = hash[:mechanical_system_efficiency]
47
47
  @total_qaqc_flags = hash[:total_qaqc_flags]
48
48
 
49
-
50
49
  # initialize class variables @@validator and @@schema
51
50
  @@validator ||= Validator.new
52
51
  @@schema ||= @@validator.schema
53
-
54
52
  end
55
53
 
56
-
57
54
  ##
58
55
  # Assigns default values if values do not exist.
59
56
  ##
@@ -72,9 +69,9 @@ module URBANopt
72
69
  hash[:mechanical_system_efficiency] = nil
73
70
  hash[:total_qaqc_flags] = nil
74
71
 
75
-
76
72
  return hash
77
73
  end
74
+
78
75
  ##
79
76
  # Convert to a Hash equivalent for JSON serialization
80
77
  ##
@@ -99,7 +96,6 @@ module URBANopt
99
96
  end
100
97
 
101
98
  return result
102
-
103
99
  end
104
100
 
105
101
  ##
@@ -126,7 +122,6 @@ module URBANopt
126
122
  # +other+ - _QAQC_ - An object of Program class.
127
123
  ##
128
124
  def add_qaqc_flags(other)
129
-
130
125
  @eui_reasonableness = add_values(@eui_reasonableness, other.eui_reasonableness)
131
126
  @end_use_by_category = add_values(@end_use_by_category, other.end_use_by_category)
132
127
  @mechanical_system_part_load_efficiency = add_values(@mechanical_system_part_load_efficiency, other.mechanical_system_part_load_efficiency)
@@ -138,9 +133,7 @@ module URBANopt
138
133
  @domestic_hot_water = add_values(@domestic_hot_water, other.domestic_hot_water)
139
134
  @mechanical_system_efficiency = add_values(@mechanical_system_efficiency, other.mechanical_system_efficiency)
140
135
  @total_qaqc_flags = add_values(@total_qaqc_flags, other.total_qaqc_flags)
141
-
142
136
  end
143
-
144
137
  end
145
138
  end
146
139
  end
@@ -24,9 +24,9 @@ module URBANopt
24
24
  :fuel_type, :total_cost_dollar, :usage_cost_dollar, :demand_cost_dollar, :comfort_result, :time_setpoint_not_met_during_occupied_cooling,
25
25
  :time_setpoint_not_met_during_occupied_heating, :time_setpoint_not_met_during_occupied_hours, :hours_out_of_comfort_bounds_PMV, :hours_out_of_comfort_bounds_PPD,
26
26
  :emissions, :future_annual_electricity_emissions_mt, :future_hourly_electricity_emissions_mt, :historical_annual_electricity_emissions_mt, :historical_hourly_electricity_emissions_mt,
27
- :future_annual_electricity_emissions_intensity_kg_per_ft2, :future_hourly_electricity_emissions_intensity_kg_per_ft2, :historical_annual_electricity_emissions_intensity_kg_per_ft2, :historical_hourly_electricity_emissions_intensity_kg_per_ft2 ,
27
+ :future_annual_electricity_emissions_intensity_kg_per_ft2, :future_hourly_electricity_emissions_intensity_kg_per_ft2, :historical_annual_electricity_emissions_intensity_kg_per_ft2, :historical_hourly_electricity_emissions_intensity_kg_per_ft2,
28
28
  :natural_gas_emissions_mt, :natural_gas_emissions_intensity_kg_per_ft2, :propane_emissions_mt, :propane_emissions_intensity_kg_per_ft2,
29
- :fueloil_no2_emissions_mt, :fueloil_no2_emissions_intensity_kg_per_ft2 #:nodoc:
29
+ :fueloil_no2_emissions_mt, :fueloil_no2_emissions_intensity_kg_per_ft2 #:nodoc:
30
30
 
31
31
  # ReportingPeriod class initializes the reporting period attributes:
32
32
  # +:id+ , +:name+ , +:multiplier+ , +:start_date+ , +:end_date+ , +:month+ , +:day_of_month+ , +:year+ , +:total_site_energy_kwh+ , +:total_source_energy_kwh+ , +:site_EUI_kwh_per_m2+, +:site_EUI_kbtu_per_ft2+, +:source_EUI_kwh_per_m2+, +:source_EUI_kbtu_per_ft2+,
@@ -123,11 +123,11 @@ module URBANopt
123
123
  hash[:comfort_result] = { time_setpoint_not_met_during_occupied_cooling: nil, time_setpoint_not_met_during_occupied_heating: nil,
124
124
  time_setpoint_not_met_during_occupied_hours: nil, hours_out_of_comfort_bounds_PMV: nil, hours_out_of_comfort_bounds_PPD: nil }
125
125
  hash[:emissions] = { future_annual_electricity_emissions_mt: nil, future_hourly_electricity_emissions_mt: nil, historical_annual_electricity_emissions_mt: nil,
126
- historical_hourly_electricity_emissions_mt: nil, future_annual_electricity_emissions_intensity_kg_per_ft2: nil,
127
- future_hourly_electricity_emissions_intensity_kg_per_ft2: nil, historical_annual_electricity_emissions_intensity_kg_per_ft2: nil,
128
- historical_hourly_electricity_emissions_intensity_kg_per_ft2: nil, natural_gas_emissions_mt: nil,
129
- natural_gas_emissions_intensity_kg_per_ft2: nil, propane_emissions_mt: nil, propane_emissions_intensity_kg_per_ft2: nil,
130
- fueloil_no2_emissions_mt: nil, fueloil_no2_emissions_intensity_kg_per_ft2: nil }
126
+ historical_hourly_electricity_emissions_mt: nil, future_annual_electricity_emissions_intensity_kg_per_ft2: nil,
127
+ future_hourly_electricity_emissions_intensity_kg_per_ft2: nil, historical_annual_electricity_emissions_intensity_kg_per_ft2: nil,
128
+ historical_hourly_electricity_emissions_intensity_kg_per_ft2: nil, natural_gas_emissions_mt: nil,
129
+ natural_gas_emissions_intensity_kg_per_ft2: nil, propane_emissions_mt: nil, propane_emissions_intensity_kg_per_ft2: nil,
130
+ fueloil_no2_emissions_mt: nil, fueloil_no2_emissions_intensity_kg_per_ft2: nil }
131
131
 
132
132
  return hash
133
133
  end
@@ -9,169 +9,165 @@ require 'json'
9
9
  require 'json-schema'
10
10
 
11
11
  module URBANopt
12
- module Reporting
13
- module DefaultReports
14
- ##
15
- # scenario_power_distribution_cost include eletrical power distribution system violation and
16
- # upgrade cost information.
17
- ##
18
- class ScenarioPowerDistributionCost
19
- attr_accessor :results, :outputs, :violation_summary, :costs_per_equipment, :equipment
20
-
21
- ##
22
- # ScenarioPowerDistributionCost class initializes all
23
- # scenario_power_distribution_cost attributes:
24
- # +:results+, +:outputs+, +:violation_summary+, +:costs_per_equipment+, +:equipment+
25
- ##
26
- def initialize(hash = {})
27
- hash.delete_if { |k, v| v.nil? }
28
- hash = defaults.merge(hash)
29
-
30
- @results = hash[:results]
31
- @outputs = hash[:outputs]
32
- @violation_summary = hash[:violation_summary]
33
- @costs_per_equipment = hash[:costs_per_equipment]
34
- @equipment = hash[:equipment]
35
-
36
- # initialize class variables @@validator and @@schema
37
- @@validator ||= Validator.new
38
- @@schema ||= @@validator.schema
39
- end
40
-
41
- ##
42
- # Assigns default values if attribute values do not exist.##
43
- def defaults
44
- hash = {}
45
- hash[:results] = []
46
- hash[:outputs] = {}
47
- hash[:violation_summary] = []
48
- hash[:costs_per_equipment] = []
49
- hash[:equipment] = []
50
-
51
- return hash
52
- end
53
-
54
- ##
55
- # Converts to a Hash equivalent for JSON serialization.
56
- ##
57
- # - Exclude attributes with nil values.
58
- # - Validate power_distribution_cost hash properties against schema.
59
- ##
60
- def to_hash
61
- result = {}
62
- result[:results] = @results if @results
63
- result[:outputs] = @outputs if !@outputs.empty?
64
- result[:violation_summary] = @violation_summary if @violation_summary
65
- result[:costs_per_equipment] = @costs_per_equipment if @costs_per_equipment
66
- result[:equipment] = @equipment if @equipment
67
-
68
- # validate power_distribution_cost properties against schema
69
- if @@validator.validate(@@schema[:definitions][:ScenarioPowerDistributionCost][:properties], result).any?
70
- raise "scenario_power_distribution_cost properties does not match schema: #{@@validator.validate(@@schema[:definitions][:ScenarioPowerDistributionCost][:properties], result)}"
71
- end
72
-
73
- return result
74
- end
75
-
76
- ##
77
- # Add a result
78
- ##
79
- def add_result(hash = {})
80
- hash.delete_if { |k, v| v.nil? }
81
- hash = defaults.merge(hash)
82
- result = {}
83
- result['num_violations'] = hash[:num_violations]
84
- @results << result
85
- end
86
-
87
- ##
88
- ## Add outputs
89
- ##
90
- def add_outputs(hash = {})
91
- hash.delete_if { |k, v| v.nil? }
92
- hash = defaults.merge(hash)
93
- output = {}
94
- output['log_file'] = hash[:log_file]
95
- output['jobs'] = []
96
- hash[:jobs].each do |job|
97
- output['jobs'] << job
98
- end
99
- @outputs = output
100
- end
101
-
102
- ##
103
- ## Add a violation summary
104
- ##
105
- def add_violation_summary(hash = {})
106
- hash.delete_if { |k, v| v.nil? }
107
- hash = defaults.merge(hash)
108
- violation_summary = {}
109
- violation_summary['scenario'] = hash[:scenario]
110
- violation_summary['stage'] = hash[:stage]
111
- violation_summary['upgrade_type'] = hash[:upgrade_type]
112
- violation_summary['simulation_time_s'] = hash[:simulation_time_s]
113
- violation_summary['thermal_violations_present'] = hash[:thermal_violations_present]
114
- violation_summary['voltage_violations_present'] = hash[:voltage_violations_present]
115
- violation_summary['max_bus_voltage'] = hash[:max_bus_voltage]
116
- violation_summary['min_bus_voltage'] = hash[:min_bus_voltage]
117
- violation_summary['num_voltage_violation_buses'] = hash[:num_voltage_violation_buses]
118
- violation_summary['num_overvoltage_violation_buses'] = hash[:num_overvoltage_violation_buses]
119
- violation_summary['voltage_upper_limit'] = hash[:voltage_upper_limit]
120
- violation_summary['num_undervoltage_violation_buses'] = hash[:num_undervoltage_violation_buses]
121
- violation_summary['voltage_lower_limit'] = hash[:voltage_lower_limit]
122
- violation_summary['max_line_loading'] = hash[:max_line_loading]
123
- violation_summary['max_transformer_loading'] = hash[:max_transformer_loading]
124
- violation_summary['num_line_violations'] = hash[:num_line_violations]
125
- violation_summary['line_upper_limit'] = hash[:line_upper_limit]
126
- violation_summary['num_transformer_violations'] = hash[:num_transformer_violations]
127
- violation_summary['transformer_upper_limit'] = hash[:transformer_upper_limit]
128
-
129
- @violation_summary << violation_summary
130
- end
131
-
132
- ##
133
- # Add costs per equipment
134
- ##
135
- def add_costs_per_equipment
136
- hash.delete_if { |k, v| v.nil? }
137
- hash = defaults.merge(hash)
138
- costs_per_equipment = {}
139
- costs_per_equipment['name'] = hash[:name]
140
- costs_per_equipment['type'] = hash[:type]
141
- costs_per_equipment['count'] = hash[:count]
142
- costs_per_equipment['total_cost_usd'] = hash[:costs_per_equipment]
143
-
144
- @costs_per_equipment << costs_per_equipment
145
- end
146
-
147
- ##
148
- # Add equipment
149
- ##
150
- def add_equipment
151
- hash.delete_if { |k, v| v.nil? }
152
- hash = defaults.merge(hash)
153
- equipment = {}
154
- equipment['equipment_type'] = hash[:equipment_type]
155
- equipment['equipment_name'] = hash[:equipment_name]
156
- equipment['status'] = hash[:status]
157
- equipment['parameter1_name'] = hash[:parameter1_name]
158
- equipment['parameter1_original'] = hash[:parameter1_original]
159
- equipment['parameter1_upgraded'] = hash[:parameter1_upgraded]
160
- equipment['parameter2_name'] = hash[:parameter2_name]
161
- equipment['parameter2_original'] = hash[:parameter2_original]
162
- equipment['parameter2_upgraded'] = hash[:parameter2_upgraded]
163
- equipment['parameter3_name'] = hash[:parameter3_name]
164
- equipment['parameter3_original'] = hash[:parameter3_original]
165
- equipment['parameter3_upgraded'] = hash[:parameter3_upgraded]
166
- equipment['name'] = hash[:name]
167
-
168
- @equipment << equipment
169
- end
170
-
171
-
172
-
173
- end # ScenarioPowerDistributionCost
174
-
175
- end # DefaultReports
176
- end # Reporting
177
- end # URBANopt
12
+ module Reporting
13
+ module DefaultReports
14
+ ##
15
+ # scenario_power_distribution_cost include eletrical power distribution system violation and
16
+ # upgrade cost information.
17
+ ##
18
+ class ScenarioPowerDistributionCost
19
+ attr_accessor :results, :outputs, :violation_summary, :costs_per_equipment, :equipment
20
+
21
+ ##
22
+ # ScenarioPowerDistributionCost class initializes all
23
+ # scenario_power_distribution_cost attributes:
24
+ # +:results+, +:outputs+, +:violation_summary+, +:costs_per_equipment+, +:equipment+
25
+ ##
26
+ def initialize(hash = {})
27
+ hash.delete_if { |k, v| v.nil? }
28
+ hash = defaults.merge(hash)
29
+
30
+ @results = hash[:results]
31
+ @outputs = hash[:outputs]
32
+ @violation_summary = hash[:violation_summary]
33
+ @costs_per_equipment = hash[:costs_per_equipment]
34
+ @equipment = hash[:equipment]
35
+
36
+ # initialize class variables @@validator and @@schema
37
+ @@validator ||= Validator.new
38
+ @@schema ||= @@validator.schema
39
+ end
40
+
41
+ ##
42
+ # Assigns default values if attribute values do not exist.##
43
+ def defaults
44
+ hash = {}
45
+ hash[:results] = []
46
+ hash[:outputs] = {}
47
+ hash[:violation_summary] = []
48
+ hash[:costs_per_equipment] = []
49
+ hash[:equipment] = []
50
+
51
+ return hash
52
+ end
53
+
54
+ ##
55
+ # Converts to a Hash equivalent for JSON serialization.
56
+ ##
57
+ # - Exclude attributes with nil values.
58
+ # - Validate power_distribution_cost hash properties against schema.
59
+ ##
60
+ def to_hash
61
+ result = {}
62
+ result[:results] = @results if @results
63
+ result[:outputs] = @outputs if !@outputs.empty?
64
+ result[:violation_summary] = @violation_summary if @violation_summary
65
+ result[:costs_per_equipment] = @costs_per_equipment if @costs_per_equipment
66
+ result[:equipment] = @equipment if @equipment
67
+
68
+ # validate power_distribution_cost properties against schema
69
+ if @@validator.validate(@@schema[:definitions][:ScenarioPowerDistributionCost][:properties], result).any?
70
+ raise "scenario_power_distribution_cost properties does not match schema: #{@@validator.validate(@@schema[:definitions][:ScenarioPowerDistributionCost][:properties], result)}"
71
+ end
72
+
73
+ return result
74
+ end
75
+
76
+ ##
77
+ # Add a result
78
+ ##
79
+ def add_result(hash = {})
80
+ hash.delete_if { |k, v| v.nil? }
81
+ hash = defaults.merge(hash)
82
+ result = {}
83
+ result['num_violations'] = hash[:num_violations]
84
+ @results << result
85
+ end
86
+
87
+ ##
88
+ ## Add outputs
89
+ ##
90
+ def add_outputs(hash = {})
91
+ hash.delete_if { |k, v| v.nil? }
92
+ hash = defaults.merge(hash)
93
+ output = {}
94
+ output['log_file'] = hash[:log_file]
95
+ output['jobs'] = []
96
+ hash[:jobs].each do |job|
97
+ output['jobs'] << job
98
+ end
99
+ @outputs = output
100
+ end
101
+
102
+ ##
103
+ ## Add a violation summary
104
+ ##
105
+ def add_violation_summary(hash = {})
106
+ hash.delete_if { |k, v| v.nil? }
107
+ hash = defaults.merge(hash)
108
+ violation_summary = {}
109
+ violation_summary['scenario'] = hash[:scenario]
110
+ violation_summary['stage'] = hash[:stage]
111
+ violation_summary['upgrade_type'] = hash[:upgrade_type]
112
+ violation_summary['simulation_time_s'] = hash[:simulation_time_s]
113
+ violation_summary['thermal_violations_present'] = hash[:thermal_violations_present]
114
+ violation_summary['voltage_violations_present'] = hash[:voltage_violations_present]
115
+ violation_summary['max_bus_voltage'] = hash[:max_bus_voltage]
116
+ violation_summary['min_bus_voltage'] = hash[:min_bus_voltage]
117
+ violation_summary['num_voltage_violation_buses'] = hash[:num_voltage_violation_buses]
118
+ violation_summary['num_overvoltage_violation_buses'] = hash[:num_overvoltage_violation_buses]
119
+ violation_summary['voltage_upper_limit'] = hash[:voltage_upper_limit]
120
+ violation_summary['num_undervoltage_violation_buses'] = hash[:num_undervoltage_violation_buses]
121
+ violation_summary['voltage_lower_limit'] = hash[:voltage_lower_limit]
122
+ violation_summary['max_line_loading'] = hash[:max_line_loading]
123
+ violation_summary['max_transformer_loading'] = hash[:max_transformer_loading]
124
+ violation_summary['num_line_violations'] = hash[:num_line_violations]
125
+ violation_summary['line_upper_limit'] = hash[:line_upper_limit]
126
+ violation_summary['num_transformer_violations'] = hash[:num_transformer_violations]
127
+ violation_summary['transformer_upper_limit'] = hash[:transformer_upper_limit]
128
+
129
+ @violation_summary << violation_summary
130
+ end
131
+
132
+ ##
133
+ # Add costs per equipment
134
+ ##
135
+ def add_costs_per_equipment
136
+ hash.delete_if { |k, v| v.nil? }
137
+ hash = defaults.merge(hash)
138
+ costs_per_equipment = {}
139
+ costs_per_equipment['name'] = hash[:name]
140
+ costs_per_equipment['type'] = hash[:type]
141
+ costs_per_equipment['count'] = hash[:count]
142
+ costs_per_equipment['total_cost_usd'] = hash[:costs_per_equipment]
143
+
144
+ @costs_per_equipment << costs_per_equipment
145
+ end
146
+
147
+ ##
148
+ # Add equipment
149
+ ##
150
+ def add_equipment
151
+ hash.delete_if { |k, v| v.nil? }
152
+ hash = defaults.merge(hash)
153
+ equipment = {}
154
+ equipment['equipment_type'] = hash[:equipment_type]
155
+ equipment['equipment_name'] = hash[:equipment_name]
156
+ equipment['status'] = hash[:status]
157
+ equipment['parameter1_name'] = hash[:parameter1_name]
158
+ equipment['parameter1_original'] = hash[:parameter1_original]
159
+ equipment['parameter1_upgraded'] = hash[:parameter1_upgraded]
160
+ equipment['parameter2_name'] = hash[:parameter2_name]
161
+ equipment['parameter2_original'] = hash[:parameter2_original]
162
+ equipment['parameter2_upgraded'] = hash[:parameter2_upgraded]
163
+ equipment['parameter3_name'] = hash[:parameter3_name]
164
+ equipment['parameter3_original'] = hash[:parameter3_original]
165
+ equipment['parameter3_upgraded'] = hash[:parameter3_upgraded]
166
+ equipment['name'] = hash[:name]
167
+
168
+ @equipment << equipment
169
+ end
170
+ end
171
+ end
172
+ end
173
+ end
@@ -33,7 +33,7 @@ module URBANopt
33
33
  :timeseries_csv, :location, :program, :construction_costs, :reporting_periods, :feature_reports, :distributed_generation,
34
34
  :scenario_power_distribution, :scenario_power_distribution_cost, :qaqc_flags # :nodoc:
35
35
 
36
- # ScenarioReport class intializes the scenario report attributes:
36
+ # ScenarioReport class initializes the scenario report attributes:
37
37
  # +:id+ , +:name+ , +:directory_name+, +:timesteps_per_hour+ , +:number_of_not_started_simulations+ ,
38
38
  # +:number_of_started_simulations+ , +:number_of_complete_simulations+ , +:number_of_failed_simulations+ ,
39
39
  # +:timeseries_csv+ , +:location+ , +:program+ , +:construction_costs+ , +:reporting_periods+ , +:feature_reports+,
@@ -74,7 +74,7 @@ module URBANopt
74
74
  @reporting_periods << ReportingPeriod.new(rp)
75
75
  end
76
76
 
77
- # feature_report is intialized here to be used in the add_feature_report method
77
+ # feature_report is initialized here to be used in the add_feature_report method
78
78
  @feature_reports = []
79
79
  hash[:feature_reports].each do |fr|
80
80
  @feature_reports << FeatureReport.new(fr)
@@ -246,7 +246,7 @@ module URBANopt
246
246
  # - add the array of feature_reports
247
247
  # - scenario report location takes the location of the first feature in the list
248
248
  ##
249
- # [parmeters:]
249
+ # [parameters:]
250
250
  # +feature_report+ - _FeatureReport_ - An object of FeatureReport class.
251
251
  ##
252
252
  def add_feature_report(feature_report)
@@ -412,32 +412,73 @@
412
412
  "description": "File path of REopt assumptions file used to generate results, if known",
413
413
  "type": "string"
414
414
  },
415
- "annual_renewable_electricity_pct": {
416
- "description": "Percentage of annual renewable electricity generation",
415
+ "renewable_electricity_fraction": {
416
+ "description": "Fraction of annual renewable electricity generation",
417
417
  "type": "number"
418
418
  },
419
- "lcc_us_dollars": {
420
- "description": "Optimal lifecycle cost",
419
+ "lcc": {
420
+ "description": "Lifecycle costs for the complete distributed generation system",
421
+ "units": "dollars",
421
422
  "type": "number"
422
423
  },
423
- "npv_us_dollars": {
424
- "description": "Net present value of savings realized by the project",
424
+ "lcc_bau": {
425
+ "description": "Lifecycle cost in the business as usual scenario (i.e no new system)",
426
+ "units": "dollars",
425
427
  "type": "number"
426
428
  },
427
- "year_one_energy_cost_us_dollars": {
428
- "description": "Optimal year one utility energy cost",
429
+ "npv": {
430
+ "description": "Net present value of the complete distributed generation system",
431
+ "units": "dollars",
429
432
  "type": "number"
430
433
  },
431
- "year_one_demand_cost_us_dollars": {
432
- "description": "Optimal year one utility demand cost",
434
+ "lifecycle_demand_cost_after_tax": {
435
+ "description": "Total demand costs in US Dollars over the life of the system after tax",
436
+ "units": "dollars",
433
437
  "type": "number"
434
438
  },
435
- "year_one_bill_us_dollars": {
436
- "description": "Optimal year one utility bill",
439
+ "year_one_energy_cost_before_tax": {
440
+ "description": "Total amount paid for utility energy in US Dollars in the first year of operation",
441
+ "units": "dollars",
437
442
  "type": "number"
438
443
  },
439
- "total_energy_cost_us_dollars": {
440
- "description": "Total utility energy cost over the lifecycle, after-tax",
444
+ "year_one_energy_cost_before_tax_bau": {
445
+ "description": "Year one energy cost in the business as usual scenario (i.e no new system) before tax",
446
+ "units": "dollars",
447
+ "type": "number"
448
+ },
449
+ "year_one_demand_cost_before_tax": {
450
+ "description": "Total amount paid in utility demand charges in US Dollars in the first year of operation",
451
+ "units": "dollars",
452
+ "type": "number"
453
+ },
454
+ "year_one_demand_cost_before_tax_bau": {
455
+ "description": "Year one demand cost in the business as usual scenario (i.e no new system) before tax",
456
+ "units": "dollars",
457
+ "type": "number"
458
+ },
459
+ "year_one_bill_before_tax": {
460
+ "description": "Total amount paid to the utility in US Dollars in the first year of operation",
461
+ "units": "dollars",
462
+ "type": "number"
463
+ },
464
+ "year_one_bill_before_tax_bau": {
465
+ "description": "Year one bill in the business as usual scenario (i.e no new system) before tax",
466
+ "units": "dollars",
467
+ "type": "number"
468
+ },
469
+ "lifecycle_energy_cost_after_tax": {
470
+ "description": "Total energy costs in US Dollars over the life of the system after tax",
471
+ "units": "dollars",
472
+ "type": "number"
473
+ },
474
+ "lifecycle_demand_cost_after_tax_bau": {
475
+ "description": "Total demand costs in US Dollars over the life of the system in the business as usual scenario (i.e no new system) after tax",
476
+ "units": "dollars",
477
+ "type": "number"
478
+ },
479
+ "lifecycle_energy_cost_after_tax_bau": {
480
+ "description": "Total energy costs in US Dollars over the life of the system in the business as usual scenario (i.e no new system) after tax",
481
+ "units": "dollars",
441
482
  "type": "number"
442
483
  },
443
484
  "SolarPV": {
@@ -678,7 +719,7 @@
678
719
  ]
679
720
  },
680
721
  "simultaneous_heating_and_cooling": {
681
- "description": "Whether heating and cooling are occuring during the same hour when cooling load exists",
722
+ "description": "Whether heating and cooling are occurring during the same hour when cooling load exists",
682
723
  "type": [
683
724
  "integer",
684
725
  "null"
@@ -743,7 +784,7 @@
743
784
  "type": "string"
744
785
  },
745
786
  "name": {
746
- "description": "name refers to the name of the feature (eg. Building 1, tranformer 5)",
787
+ "description": "name refers to the name of the feature (eg. Building 1, transformer 5)",
747
788
  "type": "string"
748
789
  },
749
790
  "directory_name": {
@@ -829,7 +870,7 @@
829
870
  "type": "string"
830
871
  },
831
872
  "multiplier": {
832
- "description": "Multiplier used if this reporting period is representative of mulitple periods. For example one week simulation that represents entire month.",
873
+ "description": "Multiplier used if this reporting period is representative of multiple periods. For example one week simulation that represents entire month.",
833
874
  "type": "number",
834
875
  "default": 1
835
876
  },
@@ -24,7 +24,7 @@ module URBANopt
24
24
  ##
25
25
  # [parameters:]
26
26
  #
27
- # * +hash+ - _Hash_ - A hash containting a +:size_kw+ key/value pair which represents the nameplate capacity in kilowatts (kW)
27
+ # * +hash+ - _Hash_ - A hash containing a +:size_kw+ key/value pair which represents the nameplate capacity in kilowatts (kW)
28
28
  #
29
29
  def initialize(hash = {})
30
30
  hash.delete_if { |k, v| v.nil? }
@@ -28,7 +28,7 @@ module URBANopt
28
28
  ##
29
29
  # [parameters:]
30
30
  #
31
- # * +hash+ - _Hash_ - A hash containting +:size_kw+ and +:size_kwh+ key/value pair which represents the power and storage capacity in kilowatts (kW) and kilowatt-hours respectively.
31
+ # * +hash+ - _Hash_ - A hash containing +:size_kw+ and +:size_kwh+ key/value pair which represents the power and storage capacity in kilowatts (kW) and kilowatt-hours respectively.
32
32
  #
33
33
  def initialize(hash = {})
34
34
  hash.delete_if { |k, v| v.nil? }
@@ -14,7 +14,7 @@ module URBANopt
14
14
  module Reporting
15
15
  module DefaultReports
16
16
  ##
17
- # TimeseriesCSV include timesries reults reported in a CSV file.
17
+ # TimeseriesCSV include timesries results reported in a CSV file.
18
18
  ##
19
19
  class TimeseriesCSV
20
20
  attr_accessor :path, :first_report_datetime, :column_names #:nodoc:
@@ -33,7 +33,7 @@ module URBANopt
33
33
  @path = hash[:path]
34
34
  @first_report_datetime = hash[:first_report_datetime]
35
35
 
36
- # from scenario csv shema get required reults to be aggregated
36
+ # from scenario csv shema get required results to be aggregated
37
37
  @required_column_names = load_scenario_csv_schema_headers
38
38
 
39
39
  @column_names = hash[:column_names]
@@ -23,7 +23,7 @@ module URBANopt
23
23
  ##
24
24
  # [parameters:]
25
25
  #
26
- # * +hash+ - _Hash_ - A hash containting a +:size_kw+ key/value pair which represents the nameplate capacity in kilowatts (kW)
26
+ # * +hash+ - _Hash_ - A hash containing a +:size_kw+ key/value pair which represents the nameplate capacity in kilowatts (kW)
27
27
  #
28
28
  def initialize(hash = {})
29
29
  hash.delete_if { |k, v| v.nil? }
@@ -5,6 +5,6 @@
5
5
 
6
6
  module URBANopt
7
7
  module Reporting
8
- VERSION = '0.9.1'.freeze
8
+ VERSION = '0.10.1'.freeze
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: urbanopt-reporting
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rawad El Kontar
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2024-01-09 00:00:00.000000000 Z
12
+ date: 2024-06-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler