urbanopt-reporting 0.1.1 → 0.3.2
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/.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 +41 -1
- 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 +191 -84
- 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 +42 -19
- 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 +15 -0
- data/lib/urbanopt/reporting/default_reports/schema/scenario_schema.json +97 -81
- 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 +11 -11
- 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 +35 -13
@@ -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,
|
@@ -224,30 +224,35 @@ module URBANopt
|
|
224
224
|
end
|
225
225
|
|
226
226
|
##
|
227
|
-
#
|
227
|
+
# Calls the individual functions to save 'default_feature_report.json' and 'default_feature_report.csv'
|
228
|
+
# For backward compatibility and ease of use
|
228
229
|
##
|
229
230
|
# [parameters]:
|
230
|
-
# +file_name+ - _String_ - Assign a name to the saved feature report
|
231
|
+
# +file_name+ - _String_ - Assign a name to the saved feature report file without an extension
|
231
232
|
def save_feature_report(file_name = 'default_feature_report')
|
233
|
+
save_json_report(file_name)
|
234
|
+
save_csv_report(file_name)
|
235
|
+
end
|
236
|
+
|
237
|
+
##
|
238
|
+
# Saves the 'default_feature_report.json' file to the results directory
|
239
|
+
##
|
240
|
+
# [parameters]:
|
241
|
+
# +file_name+ - _String_ - Assign a name to the saved feature report file without an extension
|
242
|
+
def save_json_report(file_name = 'default_feature_report')
|
232
243
|
# reassign the initialize local variable @file_name to the file name input.
|
233
244
|
@file_name = file_name
|
234
245
|
|
246
|
+
# define the results_dir_path
|
247
|
+
results_dir_path = File.join(@directory_name, 'feature_reports')
|
235
248
|
# create feature reports directory
|
236
|
-
Dir.mkdir(
|
237
|
-
|
238
|
-
# save the csv data
|
239
|
-
old_timeseries_path = nil
|
240
|
-
if !@timeseries_csv.path.nil?
|
241
|
-
old_timeseries_path = @timeseries_csv.path
|
242
|
-
end
|
243
|
-
|
244
|
-
@timeseries_csv.path = File.join(@directory_name, 'feature_reports', file_name + '.csv')
|
245
|
-
@timeseries_csv.save_data
|
249
|
+
Dir.mkdir(results_dir_path) unless Dir.exist?(File.join(@directory_name, 'feature_reports'))
|
246
250
|
|
251
|
+
## save json rport
|
247
252
|
# feature_hash
|
248
253
|
feature_hash = to_hash
|
249
254
|
|
250
|
-
json_name_path = File.join(
|
255
|
+
json_name_path = File.join(results_dir_path, file_name + '.json')
|
251
256
|
|
252
257
|
File.open(json_name_path, 'w') do |f|
|
253
258
|
f.puts JSON.pretty_generate(feature_hash)
|
@@ -258,13 +263,31 @@ module URBANopt
|
|
258
263
|
f.flush
|
259
264
|
end
|
260
265
|
end
|
266
|
+
end
|
261
267
|
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
268
|
+
##
|
269
|
+
# Saves the 'default_feature_report.csv' file to the results directory
|
270
|
+
##
|
271
|
+
# [parameters]:
|
272
|
+
# +file_name+ - _String_ - Assign a name to the saved feature report file without an extension
|
273
|
+
def save_csv_report(file_name = 'default_feature_report')
|
274
|
+
# reassign the initialize local variable @file_name to the file name input.
|
275
|
+
@file_name = file_name
|
276
|
+
|
277
|
+
# define the results_dir_path
|
278
|
+
results_dir_path = File.join(@directory_name, 'feature_reports')
|
279
|
+
# create feature reports directory
|
280
|
+
Dir.mkdir(results_dir_path) unless Dir.exist?(File.join(@directory_name, 'feature_reports'))
|
281
|
+
|
282
|
+
## copy CSV report to the new feature_reports folder
|
283
|
+
# get all folder names in the feature diectory
|
284
|
+
directory_folders = Dir.glob "#{@directory_name}/*/"
|
285
|
+
# copy the CSV report to the new feature_reports folder
|
286
|
+
directory_folders.each do |f|
|
287
|
+
if f.include? '_default_feature_reports'
|
288
|
+
FileUtils.cp(File.join(f, 'default_feature_reports.csv'), File.join(results_dir_path, @file_name + '.csv'))
|
289
|
+
end
|
266
290
|
end
|
267
|
-
return true
|
268
291
|
end
|
269
292
|
end
|
270
293
|
end
|
@@ -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,
|
@@ -60,7 +60,7 @@ module URBANopt
|
|
60
60
|
@@schema ||= @@validator.schema
|
61
61
|
|
62
62
|
# initialize @@logger
|
63
|
-
@@logger ||= URBANopt::
|
63
|
+
@@logger ||= URBANopt::Reporting::DefaultReports.logger
|
64
64
|
end
|
65
65
|
|
66
66
|
##
|
@@ -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,9 +39,9 @@ module URBANopt
|
|
39
39
|
# Location include all location information.
|
40
40
|
##
|
41
41
|
class Location
|
42
|
-
attr_accessor :
|
42
|
+
attr_accessor :latitude_deg, :longitude_deg, :surface_elevation_ft, :weather_filename #:nodoc:
|
43
43
|
##
|
44
|
-
# Location class initialize location attributes: +:
|
44
|
+
# Location class initialize location attributes: +:latitude_deg+ , +:longitude_deg+ , +:surface_elevation_ft+ , +:weather_filename+
|
45
45
|
##
|
46
46
|
# [parameters:]
|
47
47
|
# +hash+ - _Hash_ - A hash which may contain a deserialized location.
|
@@ -50,9 +50,9 @@ module URBANopt
|
|
50
50
|
hash.delete_if { |k, v| v.nil? }
|
51
51
|
hash = defaults.merge(hash)
|
52
52
|
|
53
|
-
@
|
54
|
-
@
|
55
|
-
@
|
53
|
+
@latitude_deg = hash[:latitude_deg]
|
54
|
+
@longitude_deg = hash[:longitude_deg]
|
55
|
+
@surface_elevation_ft = hash[:surface_elevation_ft]
|
56
56
|
@weather_filename = hash[:weather_filename]
|
57
57
|
|
58
58
|
# initialize class variables @@validator and @@schema
|
@@ -68,9 +68,9 @@ module URBANopt
|
|
68
68
|
##
|
69
69
|
def to_hash
|
70
70
|
result = {}
|
71
|
-
result[:
|
72
|
-
result[:
|
73
|
-
result[:
|
71
|
+
result[:latitude_deg] = @latitude_deg if @latitude_deg
|
72
|
+
result[:longitude_deg] = @longitude_deg if @longitude_deg
|
73
|
+
result[:surface_elevation_ft] = @surface_elevation_ft if @surface_elevation_ft
|
74
74
|
result[:weather_filename] = @weather_filename if @weather_filename
|
75
75
|
|
76
76
|
# validate location properties against schema
|
@@ -86,9 +86,9 @@ module URBANopt
|
|
86
86
|
##
|
87
87
|
def defaults
|
88
88
|
hash = {}
|
89
|
-
hash[:
|
90
|
-
hash[:
|
91
|
-
hash[:
|
89
|
+
hash[:latitude_deg] = nil
|
90
|
+
hash[:longitude_deg] = nil
|
91
|
+
hash[:surface_elevation_ft] = nil
|
92
92
|
hash[:weather_filename] = nil
|
93
93
|
|
94
94
|
return hash
|
@@ -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,
|
@@ -40,18 +40,18 @@ module URBANopt
|
|
40
40
|
# Program includes all building program related information.
|
41
41
|
##
|
42
42
|
class Program
|
43
|
-
attr_accessor :
|
44
|
-
:maximum_number_of_stories, :maximum_number_of_stories_above_ground, :
|
45
|
-
:number_of_parking_spaces_charging, :
|
43
|
+
attr_accessor :site_area_sqft, :floor_area_sqft, :conditioned_area_sqft, :unconditioned_area_sqft, :footprint_area_sqft, :maximum_roof_height_ft,
|
44
|
+
:maximum_number_of_stories, :maximum_number_of_stories_above_ground, :parking_area_sqft, :number_of_parking_spaces,
|
45
|
+
:number_of_parking_spaces_charging, :parking_footprint_area_sqft, :maximum_parking_height_ft, :maximum_number_of_parking_stories,
|
46
46
|
:maximum_number_of_parking_stories_above_ground, :number_of_residential_units, :building_types, :building_type, :maximum_occupancy,
|
47
|
-
:
|
48
|
-
:
|
49
|
-
# Program class initialize building program attributes: +:
|
50
|
-
# +:
|
51
|
-
# +:number_of_parking_spaces+ , +:number_of_parking_spaces_charging+ , +:
|
47
|
+
:area_sqft, :window_area_sqft, :north_window_area_sqft, :south_window_area_sqft, :east_window_area_sqft, :west_window_area_sqft, :wall_area_sqft, :roof_area_sqft, :equipment_roof_area_sqft,
|
48
|
+
:photovoltaic_roof_area_sqft, :available_roof_area_sqft, :total_roof_area_sqft, :orientation_deg, :aspect_ratio, :total_construction_cost_dollar # :nodoc:
|
49
|
+
# Program class initialize building program attributes: +:site_area_sqft+ , +:floor_area_sqft+ , +:conditioned_area_sqft+ , +:unconditioned_area_sqft+ ,
|
50
|
+
# +:footprint_area_sqft+ , +:maximum_roof_height_ft, +:maximum_number_of_stories+ , +:maximum_number_of_stories_above_ground+ , +:parking_area_sqft+ ,
|
51
|
+
# +:number_of_parking_spaces+ , +:number_of_parking_spaces_charging+ , +:parking_footprint_area_sqft+ , +:maximum_parking_height_ft+ , +:maximum_number_of_parking_stories+ ,
|
52
52
|
# +:maximum_number_of_parking_stories_above_ground+ , +:number_of_residential_units+ , +:building_types+ , +:building_type+ , +:maximum_occupancy+ ,
|
53
|
-
# +:
|
54
|
-
# +:
|
53
|
+
# +:area_sqft+ , +:window_area_sqft+ , +:north_window_area_sqft+ , +:south_window_area_sqft+ , +:east_window_area_sqft+ , +:west_window_area_sqft+ , +:wall_area_sqft+ , +:roof_area_sqft+ ,
|
54
|
+
# +:equipment_roof_area_sqft+ , +:photovoltaic_roof_area_sqft+ , +:available_roof_area_sqft+ , +:total_roof_area_sqft+ , +:orientation_deg+ , +:aspect_ratio+
|
55
55
|
##
|
56
56
|
# [parameters:]
|
57
57
|
# +hash+ - _Hash_ - A hash which may contain a deserialized program.
|
@@ -60,29 +60,29 @@ module URBANopt
|
|
60
60
|
hash.delete_if { |k, v| v.nil? }
|
61
61
|
hash = defaults.merge(hash)
|
62
62
|
|
63
|
-
@
|
64
|
-
@
|
65
|
-
@
|
66
|
-
@
|
67
|
-
@
|
68
|
-
@
|
63
|
+
@site_area_sqft = hash[:site_area_sqft]
|
64
|
+
@floor_area_sqft = hash[:floor_area_sqft]
|
65
|
+
@conditioned_area_sqft = hash[:conditioned_area_sqft]
|
66
|
+
@unconditioned_area_sqft = hash[:unconditioned_area_sqft]
|
67
|
+
@footprint_area_sqft = hash[:footprint_area_sqft]
|
68
|
+
@maximum_roof_height_ft = hash[:maximum_roof_height_ft]
|
69
69
|
@maximum_number_of_stories = hash[:maximum_number_of_stories]
|
70
70
|
@maximum_number_of_stories_above_ground = hash[:maximum_number_of_stories_above_ground]
|
71
|
-
@
|
71
|
+
@parking_area_sqft = hash[:parking_area_sqft]
|
72
72
|
@number_of_parking_spaces = hash[:number_of_parking_spaces]
|
73
73
|
@number_of_parking_spaces_charging = hash[:number_of_parking_spaces_charging]
|
74
|
-
@
|
75
|
-
@
|
74
|
+
@parking_footprint_area_sqft = hash[:parking_footprint_area_sqft]
|
75
|
+
@maximum_parking_height_ft = hash[:maximum_parking_height_ft]
|
76
76
|
@maximum_number_of_parking_stories = hash[:maximum_number_of_parking_stories]
|
77
77
|
@maximum_number_of_parking_stories_above_ground = hash[:maximum_number_of_parking_stories_above_ground]
|
78
78
|
@number_of_residential_units = hash[:number_of_residential_units]
|
79
79
|
@building_types = hash[:building_types]
|
80
|
-
@
|
81
|
-
@
|
82
|
-
@
|
83
|
-
@
|
80
|
+
@window_area_sqft = hash[:window_area_sqft]
|
81
|
+
@wall_area_sqft = hash[:wall_area_sqft]
|
82
|
+
@roof_area_sqft = hash[:roof_area_sqft]
|
83
|
+
@orientation_deg = hash[:orientation_deg]
|
84
84
|
@aspect_ratio = hash[:aspect_ratio]
|
85
|
-
@
|
85
|
+
@total_construction_cost_dollar = hash[:total_construction_cost_dollar]
|
86
86
|
|
87
87
|
# initialize class variables @@validator and @@schema
|
88
88
|
@@validator ||= Validator.new
|
@@ -94,29 +94,29 @@ module URBANopt
|
|
94
94
|
##
|
95
95
|
def defaults
|
96
96
|
hash = {}
|
97
|
-
hash[:
|
98
|
-
hash[:
|
99
|
-
hash[:
|
100
|
-
hash[:
|
101
|
-
hash[:
|
102
|
-
hash[:
|
97
|
+
hash[:site_area_sqft] = nil
|
98
|
+
hash[:floor_area_sqft] = nil
|
99
|
+
hash[:conditioned_area_sqft] = nil
|
100
|
+
hash[:unconditioned_area_sqft] = nil
|
101
|
+
hash[:footprint_area_sqft] = nil
|
102
|
+
hash[:maximum_roof_height_ft] = nil
|
103
103
|
hash[:maximum_number_of_stories] = nil
|
104
104
|
hash[:maximum_number_of_stories_above_ground] = nil
|
105
|
-
hash[:
|
105
|
+
hash[:parking_area_sqft] = nil
|
106
106
|
hash[:number_of_parking_spaces] = nil
|
107
107
|
hash[:number_of_parking_spaces_charging] = nil
|
108
|
-
hash[:
|
109
|
-
hash[:
|
108
|
+
hash[:parking_footprint_area_sqft] = nil
|
109
|
+
hash[:maximum_parking_height_ft] = nil
|
110
110
|
hash[:maximum_number_of_parking_stories] = nil
|
111
111
|
hash[:maximum_number_of_parking_stories_above_ground] = nil
|
112
112
|
hash[:number_of_residential_units] = nil
|
113
|
-
hash[:building_types] = [{ building_type: nil, maximum_occupancy: nil,
|
114
|
-
hash[:
|
115
|
-
hash[:
|
116
|
-
hash[:
|
117
|
-
hash[:
|
113
|
+
hash[:building_types] = [{ building_type: nil, maximum_occupancy: nil, floor_area_sqft: nil }]
|
114
|
+
hash[:window_area_sqft] = { north_window_area_sqft: nil, south_window_area_sqft: nil, east_window_area_sqft: nil, west_window_area_sqft: nil, total_window_area_sqft: nil }
|
115
|
+
hash[:wall_area_sqft] = { north_wall_area_sqft: nil, south_wall_area_sqft: nil, east_wall_area_sqft: nil, west_wall_area_sqft: nil, total_wall_area_sqft: nil }
|
116
|
+
hash[:roof_area_sqft] = { equipment_roof_area_sqft: nil, photovoltaic_roof_area_sqft: nil, available_roof_area_sqft: nil, total_roof_area_sqft: nil }
|
117
|
+
hash[:orientation_deg] = nil
|
118
118
|
hash[:aspect_ratio] = nil
|
119
|
-
hash[:
|
119
|
+
hash[:total_construction_cost_dollar] = nil
|
120
120
|
return hash
|
121
121
|
end
|
122
122
|
|
@@ -128,19 +128,19 @@ module URBANopt
|
|
128
128
|
##
|
129
129
|
def to_hash
|
130
130
|
result = {}
|
131
|
-
result[:
|
132
|
-
result[:
|
133
|
-
result[:
|
134
|
-
result[:
|
135
|
-
result[:
|
136
|
-
result[:
|
131
|
+
result[:site_area_sqft] = @site_area_sqft if @site_area_sqft
|
132
|
+
result[:floor_area_sqft] = @floor_area_sqft if @floor_area_sqft
|
133
|
+
result[:conditioned_area_sqft] = @conditioned_area_sqft if @conditioned_area_sqft
|
134
|
+
result[:unconditioned_area_sqft] = @unconditioned_area_sqft if @unconditioned_area_sqft
|
135
|
+
result[:footprint_area_sqft] = @footprint_area_sqft if @footprint_area_sqft
|
136
|
+
result[:maximum_roof_height_ft] = @maximum_roof_height_ft if @maximum_roof_height_ft
|
137
137
|
result[:maximum_number_of_stories] = @maximum_number_of_stories if @maximum_number_of_stories
|
138
138
|
result[:maximum_number_of_stories_above_ground] = @maximum_number_of_stories_above_ground if @maximum_number_of_parking_stories_above_ground
|
139
|
-
result[:
|
139
|
+
result[:parking_area_sqft] = @parking_area_sqft if @parking_area_sqft
|
140
140
|
result[:number_of_parking_spaces] = @number_of_parking_spaces if @number_of_parking_spaces
|
141
141
|
result[:number_of_parking_spaces_charging] = @number_of_parking_spaces_charging if @number_of_parking_spaces_charging
|
142
|
-
result[:
|
143
|
-
result[:
|
142
|
+
result[:parking_footprint_area_sqft] = @parking_footprint_area_sqft if @parking_footprint_area_sqft
|
143
|
+
result[:maximum_parking_height_ft] = @maximum_parking_height_ft if @maximum_parking_height_ft
|
144
144
|
result[:maximum_number_of_parking_stories] = @maximum_number_of_parking_stories if @maximum_number_of_parking_stories
|
145
145
|
result[:maximum_number_of_parking_stories_above_ground] = @maximum_number_of_parking_stories_above_ground if @maximum_number_of_parking_stories_above_ground
|
146
146
|
result[:number_of_residential_units] = @number_of_residential_units if @number_of_residential_units
|
@@ -152,25 +152,25 @@ module URBANopt
|
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
155
|
-
# result[:
|
156
|
-
|
157
|
-
|
158
|
-
result[:
|
155
|
+
# result[:window_area_sqft] = @window_area_sqft if @window_area_sqft
|
156
|
+
window_area_sqft_hash = @window_area_sqft if @window_area_sqft
|
157
|
+
window_area_sqft_hash.delete_if { |k, v| v.nil? }
|
158
|
+
result[:window_area_sqft] = window_area_sqft_hash if @window_area_sqft
|
159
159
|
|
160
|
-
# result[:
|
161
|
-
|
162
|
-
|
163
|
-
result[:
|
160
|
+
# result[:wall_area_sqft] = @wall_area_sqft if @wall_area_sqft
|
161
|
+
wall_area_sqft_hash = @wall_area_sqft if @wall_area_sqft
|
162
|
+
wall_area_sqft_hash.delete_if { |k, v| v.nil? }
|
163
|
+
result[:wall_area_sqft] = wall_area_sqft_hash if @wall_area_sqft
|
164
164
|
|
165
|
-
# result[:
|
166
|
-
|
167
|
-
|
168
|
-
result[:
|
165
|
+
# result[:roof_area_sqft] = @roof_area_sqft if @roof_area_sqft
|
166
|
+
roof_area_sqft_hash = @roof_area_sqft if @roof_area_sqft
|
167
|
+
roof_area_sqft_hash.delete_if { |k, v| v.nil? }
|
168
|
+
result[:roof_area_sqft] = roof_area_sqft_hash if @roof_area_sqft
|
169
169
|
|
170
|
-
result[:
|
170
|
+
result[:orientation_deg] = @orientation_deg if @orientation_deg
|
171
171
|
result[:aspect_ratio] = @aspect_ratio if @aspect_ratio
|
172
172
|
|
173
|
-
result[:
|
173
|
+
result[:total_construction_cost_dollar] = @total_construction_cost_dollar if @total_construction_cost_dollar
|
174
174
|
|
175
175
|
# validate program properties against schema
|
176
176
|
if @@validator.validate(@@schema[:definitions][:Program][:properties], result).any?
|
@@ -221,43 +221,43 @@ module URBANopt
|
|
221
221
|
# +other+ - _Program_ - An object of Program class.
|
222
222
|
##
|
223
223
|
def add_program(other)
|
224
|
-
@
|
224
|
+
@site_area_sqft = add_values(@site_area_sqft, other.site_area_sqft)
|
225
225
|
|
226
|
-
@
|
227
|
-
@
|
228
|
-
@
|
229
|
-
@
|
230
|
-
@
|
226
|
+
@floor_area_sqft = add_values(@floor_area_sqft, other.floor_area_sqft)
|
227
|
+
@conditioned_area_sqft = add_values(@conditioned_area_sqft, other.conditioned_area_sqft)
|
228
|
+
@unconditioned_area_sqft = add_values(@unconditioned_area_sqft, other.unconditioned_area_sqft)
|
229
|
+
@footprint_area_sqft = add_values(@footprint_area_sqft, other.footprint_area_sqft)
|
230
|
+
@maximum_roof_height_ft = max_value(@maximum_roof_height_ft, other.maximum_roof_height_ft)
|
231
231
|
@maximum_number_of_stories = max_value(@maximum_number_of_stories, other.maximum_number_of_stories)
|
232
232
|
@maximum_number_of_stories_above_ground = max_value(@maximum_number_of_stories_above_ground, other.maximum_number_of_stories_above_ground)
|
233
|
-
@
|
233
|
+
@parking_area_sqft = add_values(@parking_area_sqft, other.parking_area_sqft)
|
234
234
|
@number_of_parking_spaces = add_values(@number_of_parking_spaces, other.number_of_parking_spaces)
|
235
235
|
@number_of_parking_spaces_charging = add_values(@number_of_parking_spaces_charging, other.number_of_parking_spaces_charging)
|
236
|
-
@
|
237
|
-
@
|
236
|
+
@parking_footprint_area_sqft = add_values(@parkig_footprint_area_sqft, other.parking_footprint_area_sqft)
|
237
|
+
@maximum_parking_height_ft = max_value(@maximum_parking_height_ft, other.maximum_parking_height_ft)
|
238
238
|
@maximum_number_of_parking_stories = max_value(@maximum_number_of_parking_stories, other.maximum_number_of_parking_stories)
|
239
239
|
@maximum_number_of_parking_stories_above_ground = max_value(maximum_number_of_parking_stories_above_ground, other.maximum_number_of_parking_stories_above_ground)
|
240
240
|
@number_of_residential_units = add_values(@number_of_residential_units, other.number_of_residential_units)
|
241
|
-
@
|
241
|
+
@total_construction_cost_dollar = add_values(@total_construction_cost_dollar, other.total_construction_cost_dollar)
|
242
242
|
|
243
243
|
@building_types = other.building_types
|
244
244
|
|
245
|
-
@
|
246
|
-
@
|
247
|
-
@
|
248
|
-
@
|
249
|
-
@
|
245
|
+
@window_area_sqft[:north_window_area_sqft] = add_values(@window_area_sqft[:north_window_area_sqft], other.window_area_sqft[:north_window_area_sqft])
|
246
|
+
@window_area_sqft[:south_window_area_sqft] = add_values(@window_area_sqft[:south_window_area_sqft], other.window_area_sqft[:south_window_area_sqft])
|
247
|
+
@window_area_sqft[:east_window_area_sqft] = add_values(@window_area_sqft[:east_window_area_sqft], other.window_area_sqft[:east_window_area_sqft])
|
248
|
+
@window_area_sqft[:west_window_area_sqft] = add_values(@window_area_sqft[:west_window_area_sqft], other.window_area_sqft[:west_window_area_sqft])
|
249
|
+
@window_area_sqft[:total_window_area_sqft] = add_values(@window_area_sqft[:total_window_area_sqft], other.window_area_sqft[:total_window_area_sqft])
|
250
250
|
|
251
|
-
@
|
252
|
-
@
|
253
|
-
@
|
254
|
-
@
|
255
|
-
@
|
251
|
+
@wall_area_sqft[:north_wall_area_sqft] = add_values(@wall_area_sqft[:north_wall_area_sqft], other.wall_area_sqft[:north_wall_area_sqft])
|
252
|
+
@wall_area_sqft[:south_wall_area_sqft] = add_values(@wall_area_sqft[:south_wall_area_sqft], other.wall_area_sqft[:south_wall_area_sqft])
|
253
|
+
@wall_area_sqft[:east_wall_area_sqft] = add_values(@wall_area_sqft[:east_wall_area_sqft], other.wall_area_sqft[:east_wall_area_sqft])
|
254
|
+
@wall_area_sqft[:west_wall_area_sqft] = add_values(@wall_area_sqft[:west_wall_area_sqft], other.wall_area_sqft[:west_wall_area_sqft])
|
255
|
+
@wall_area_sqft[:total_wall_area_sqft] = add_values(@wall_area_sqft[:total_wall_area_sqft], other.wall_area_sqft[:total_wall_area_sqft])
|
256
256
|
|
257
|
-
@
|
258
|
-
@
|
259
|
-
@
|
260
|
-
@
|
257
|
+
@roof_area_sqft[:equipment_roof_area_sqft] = add_values(@roof_area_sqft[:equipment_roof_area_sqft], other.roof_area_sqft[:equipment_roof_area_sqft])
|
258
|
+
@roof_area_sqft[:photovoltaic_roof_area_sqft] = add_values(@roof_area_sqft[:photovoltaic_roof_area_sqft], other.roof_area_sqft[:photovoltaic_roof_area_sqft])
|
259
|
+
@roof_area_sqft[:available_roof_area_sqft] = add_values(@roof_area_sqft[:available_roof_area_sqft], other.roof_area_sqft[:available_roof_area_sqft])
|
260
|
+
@roof_area_sqft[:total_roof_area_sqft] = add_values(@roof_area_sqft[:total_roof_area_sqft], other.roof_area_sqft[:total_roof_area_sqft])
|
261
261
|
end
|
262
262
|
end
|
263
263
|
end
|
@@ -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,
|
@@ -43,16 +43,16 @@ module URBANopt
|
|
43
43
|
# ReportingPeriod includes all the results of a specific reporting period.
|
44
44
|
##
|
45
45
|
class ReportingPeriod
|
46
|
-
attr_accessor :id, :name, :multiplier, :start_date, :end_date, :month, :day_of_month, :year, :
|
47
|
-
:
|
48
|
-
:
|
49
|
-
:fuel_type, :
|
46
|
+
attr_accessor :id, :name, :multiplier, :start_date, :end_date, :month, :day_of_month, :year, :total_site_energy_kwh, :total_source_energy_kwh,
|
47
|
+
:net_site_energy_kwh, :net_source_energy_kwh, :total_utility_cost_dollar, :net_utility_cost_dollar, :utility_costs_dollar, :electricity_kwh, :natural_gas_kwh, :propane_kwh, :fuel_oil_kwh, :other_fuels_kwh, :district_cooling_kwh,
|
48
|
+
:district_heating_kwh, :water_qbft, :electricity_produced_kwh, :end_uses, :energy_production_kwh, :photovoltaic,
|
49
|
+
:fuel_type, :total_cost_dollar, :usage_cost_dollar, :demand_cost_dollar, :comfort_result, :time_setpoint_not_met_during_occupied_cooling,
|
50
50
|
: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 #:nodoc:
|
51
51
|
# ReportingPeriod class initializes the reporting period attributes:
|
52
|
-
# +:id+ , +:name+ , +:multiplier+ , +:start_date+ , +:end_date+ , +:month+ , +:day_of_month+ , +:year+ , +:
|
53
|
-
# +:
|
54
|
-
# +:
|
55
|
-
# +:fuel_type+ , +:
|
52
|
+
# +:id+ , +:name+ , +:multiplier+ , +:start_date+ , +:end_date+ , +:month+ , +:day_of_month+ , +:year+ , +:total_site_energy_kwh+ , +:total_source_energy_kwh+ ,
|
53
|
+
# +:net_site_energy_kwh+ , +:net_source_energy_kwh+ , +:total_utility_cost_dollar , +:net_utility_cost_dollar+ , +:utility_costs_dollar+ , +:electricity_kwh+ , +:natural_gas_kwh+ , +:propane_kwh+ , +:fuel_oil_kwh+ , +:other_fuels_kwh+ , +:district_cooling_kwh+ ,
|
54
|
+
# +:district_heating_kwh+ , +:water_qbft+ , +:electricity_produced_kwh+ , +:end_uses+ , +:energy_production_kwh+ , +:photovoltaic_kwh+ ,
|
55
|
+
# +:fuel_type+ , +:total_cost_dollar+ , +:usage_cost_dollar+ , +:demand_cost_dollar+ , +:comfort_result+ , +:time_setpoint_not_met_during_occupied_cooling+ ,
|
56
56
|
# +:time_setpoint_not_met_during_occupied_heating+ , +:time_setpoint_not_met_during_occupied_hours+
|
57
57
|
##
|
58
58
|
# [parameters:]
|
@@ -68,24 +68,26 @@ module URBANopt
|
|
68
68
|
@start_date = Date.new(hash[:start_date])
|
69
69
|
@end_date = Date.new(hash[:end_date])
|
70
70
|
|
71
|
-
@
|
72
|
-
@
|
73
|
-
@
|
74
|
-
@
|
75
|
-
@
|
76
|
-
@
|
77
|
-
@
|
78
|
-
@
|
79
|
-
@
|
80
|
-
@
|
81
|
-
@
|
82
|
-
@
|
83
|
-
@
|
71
|
+
@total_site_energy_kwh = hash[:total_site_energy_kwh]
|
72
|
+
@total_source_energy_kwh = hash[:total_source_energy_kwh]
|
73
|
+
@net_site_energy_kwh = hash[:net_site_energy_kwh]
|
74
|
+
@net_source_energy_kwh = hash[:net_source_energy_kwh]
|
75
|
+
@net_utility_cost_dollar = hash[:net_utility_cost_dollar]
|
76
|
+
@total_utility_cost_dollar = hash[:total_utility_cost_dollar]
|
77
|
+
@electricity_kwh = hash[:electricity_kwh]
|
78
|
+
@natural_gas_kwh = hash[:natural_gas_kwh]
|
79
|
+
@propane_kwh = hash[:propane_kwh]
|
80
|
+
@fuel_oil_kwh = hash[:fuel_oil_kwh]
|
81
|
+
@other_fuels_kwh = hash[:other_fuels_kwh]
|
82
|
+
@district_cooling_kwh = hash[:district_cooling_kwh]
|
83
|
+
@district_heating_kwh = hash[:district_heating_kwh]
|
84
|
+
@water_qbft = hash[:water_qbft]
|
85
|
+
@electricity_produced_kwh = hash[:electricity_produced_kwh]
|
84
86
|
@end_uses = EndUses.new(hash[:end_uses])
|
85
87
|
|
86
|
-
@
|
88
|
+
@energy_production_kwh = hash[:energy_production_kwh]
|
87
89
|
|
88
|
-
@
|
90
|
+
@utility_costs_dollar = hash[:utility_costs_dollar]
|
89
91
|
|
90
92
|
@comfort_result = hash[:comfort_result]
|
91
93
|
|
@@ -106,22 +108,24 @@ module URBANopt
|
|
106
108
|
hash[:start_date] = Date.new.to_hash
|
107
109
|
hash[:end_date] = Date.new.to_hash
|
108
110
|
|
109
|
-
hash[:
|
110
|
-
hash[:
|
111
|
-
hash
|
112
|
-
hash
|
113
|
-
hash
|
114
|
-
hash
|
115
|
-
hash
|
116
|
-
hash
|
117
|
-
hash
|
118
|
-
hash
|
119
|
-
hash[:
|
120
|
-
|
121
|
-
hash[:
|
111
|
+
hash[:total_site_energy_kwh] = nil
|
112
|
+
hash[:total_source_energy_kwh] = nil
|
113
|
+
hash[:net_site_energy_kwh] = nil
|
114
|
+
hash[:net_source_energy_kwh] = nil
|
115
|
+
hash[:net_utility_cost_dollar] = nil
|
116
|
+
hash[:total_utility_cost_dollar] = nil
|
117
|
+
hash[:electricity_kwh] = nil
|
118
|
+
hash[:natural_gas_kwh] = nil
|
119
|
+
hash[:propane_kwh] = nil
|
120
|
+
hash[:fuel_oil_kwh] = nil
|
121
|
+
hash[:other_fuels_kwh] = nil
|
122
|
+
hash[:district_cooling_kwh] = nil
|
123
|
+
hash[:district_heating_kwh] = nil
|
124
|
+
|
125
|
+
hash[:electricity_produced_kwh] = nil
|
122
126
|
hash[:end_uses] = EndUses.new.to_hash
|
123
|
-
hash[:
|
124
|
-
hash[:
|
127
|
+
hash[:energy_production_kwh] = { electricity_produced: { photovoltaic: nil } }
|
128
|
+
hash[:utility_costs_dollar] = [{ fuel_type: nil, total_cost_dollar: nil, usage_cost_dollar: nil, demand_cost_dollar: nil }]
|
125
129
|
hash[:comfort_result] = { time_setpoint_not_met_during_occupied_cooling: nil, time_setpoint_not_met_during_occupied_heating: nil,
|
126
130
|
time_setpoint_not_met_during_occupied_hours: nil, hours_out_of_comfort_bounds_PMV: nil, hours_out_of_comfort_bounds_PPD: nil }
|
127
131
|
|
@@ -142,32 +146,34 @@ module URBANopt
|
|
142
146
|
result[:multiplier] = @multiplier if @multiplier
|
143
147
|
result[:start_date] = @start_date.to_hash if @start_date
|
144
148
|
result[:end_date] = @end_date.to_hash if @end_date
|
145
|
-
result[:
|
146
|
-
result[:
|
147
|
-
result[:
|
148
|
-
result[:
|
149
|
-
result[:
|
150
|
-
result[:
|
151
|
-
result[:
|
152
|
-
result[:
|
153
|
-
result[:
|
154
|
-
result[:
|
155
|
-
result[:
|
156
|
-
result[:
|
157
|
-
result[:
|
149
|
+
result[:total_site_energy_kwh] = @total_site_energy_kwh if @total_site_energy_kwh
|
150
|
+
result[:total_source_energy_kwh] = @total_source_energy_kwh if @total_source_energy_kwh
|
151
|
+
result[:net_site_energy_kwh] = @net_site_energy_kwh if @net_site_energy_kwh
|
152
|
+
result[:net_source_energy_kwh] = @net_source_energy_kwh if @net_source_energy_kwh
|
153
|
+
result[:net_utility_cost_dollar] = @net_utility_cost_dollar if @net_utility_cost_dollar
|
154
|
+
result[:total_utility_cost_dollar] = @total_utility_cost_dollar if @total_utility_cost_dollar
|
155
|
+
result[:electricity_kwh] = @electricity_kwh if @electricity_kwh
|
156
|
+
result[:natural_gas_kwh] = @natural_gas_kwh if @natural_gas_kwh
|
157
|
+
result[:propane_kwh] = @propane_kwh if @propane_kwh
|
158
|
+
result[:fuel_oil_kwh] = @fuel_oil_kwh if @fuel_oil_kwh
|
159
|
+
result[:other_fuels_kwh] = @other_fuels_kwh if @other_fuels_kwh
|
160
|
+
result[:district_cooling_kwh] = @district_cooling_kwh if @district_cooling_kwh
|
161
|
+
result[:district_heating_kwh] = @district_heating_kwh if @district_heating_kwh
|
162
|
+
result[:water_qbft] = @water_qbft if @water_qbft
|
163
|
+
result[:electricity_produced_kwh] = @electricity_produced_kwh if @electricity_produced_kwh
|
158
164
|
result[:end_uses] = @end_uses.to_hash if @end_uses
|
159
165
|
|
160
|
-
|
161
|
-
|
162
|
-
|
166
|
+
energy_production_kwh_hash = @energy_production_kwh if @energy_production_kwh
|
167
|
+
energy_production_kwh_hash.delete_if { |k, v| v.nil? }
|
168
|
+
energy_production_kwh_hash.each do |eph|
|
163
169
|
eph.delete_if { |k, v| v.nil? }
|
164
170
|
end
|
165
171
|
|
166
|
-
result[:
|
172
|
+
result[:energy_production_kwh] = energy_production_kwh_hash if @energy_production_kwh
|
167
173
|
|
168
|
-
if @
|
169
|
-
result[:
|
170
|
-
@
|
174
|
+
if @utility_costs_dollar.any?
|
175
|
+
result[:utility_costs_dollar] = @utility_costs_dollar
|
176
|
+
@utility_costs_dollar.each do |uc|
|
171
177
|
uc&.delete_if { |k, v| v.nil? }
|
172
178
|
end
|
173
179
|
end
|
@@ -211,34 +217,36 @@ module URBANopt
|
|
211
217
|
##
|
212
218
|
def self.merge_reporting_period(existing_period, new_period)
|
213
219
|
# modify the existing_period by summing up the results
|
214
|
-
existing_period.
|
215
|
-
existing_period.
|
216
|
-
existing_period.
|
217
|
-
existing_period.
|
218
|
-
existing_period.
|
219
|
-
existing_period.
|
220
|
-
existing_period.
|
221
|
-
existing_period.
|
222
|
-
existing_period.
|
223
|
-
existing_period.
|
224
|
-
existing_period.
|
225
|
-
existing_period.
|
220
|
+
existing_period.total_site_energy_kwh = add_values(existing_period.total_site_energy_kwh, new_period.total_site_energy_kwh)
|
221
|
+
existing_period.total_source_energy_kwh = add_values(existing_period.total_source_energy_kwh, new_period.total_source_energy_kwh)
|
222
|
+
existing_period.net_source_energy_kwh = add_values(existing_period.net_source_energy_kwh, new_period.net_source_energy_kwh)
|
223
|
+
existing_period.net_utility_cost_dollar = add_values(existing_period.net_utility_cost_dollar, new_period.net_utility_cost_dollar)
|
224
|
+
existing_period.total_utility_cost_dollar = add_values(existing_period.total_utility_cost_dollar, new_period.total_utility_cost_dollar)
|
225
|
+
existing_period.electricity_kwh = add_values(existing_period.electricity_kwh, new_period.electricity_kwh)
|
226
|
+
existing_period.natural_gas_kwh = add_values(existing_period.natural_gas_kwh, new_period.natural_gas_kwh)
|
227
|
+
existing_period.propane_kwh = add_values(existing_period.propane_kwh, new_period.propane_kwh)
|
228
|
+
existing_period.fuel_oil_kwh = add_values(existing_period.fuel_oil_kwh, new_period.fuel_oil_kwh)
|
229
|
+
existing_period.other_fuels_kwh = add_values(existing_period.other_fuels_kwh, new_period.other_fuels_kwh)
|
230
|
+
existing_period.district_cooling_kwh = add_values(existing_period.district_cooling_kwh, new_period.district_cooling_kwh)
|
231
|
+
existing_period.district_heating_kwh = add_values(existing_period.district_heating_kwh, new_period.district_heating_kwh)
|
232
|
+
existing_period.water_qbft = add_values(existing_period.water_qbft, new_period.water_qbft)
|
233
|
+
existing_period.electricity_produced_kwh = add_values(existing_period.electricity_produced_kwh, new_period.electricity_produced_kwh)
|
226
234
|
|
227
235
|
# merge end uses
|
228
236
|
new_end_uses = new_period.end_uses
|
229
237
|
existing_period.end_uses&.merge_end_uses!(new_end_uses)
|
230
238
|
|
231
|
-
if existing_period.
|
232
|
-
if existing_period.
|
233
|
-
existing_period.
|
239
|
+
if existing_period.energy_production_kwh
|
240
|
+
if existing_period.energy_production_kwh[:electricity_produced_kwh]
|
241
|
+
existing_period.energy_production_kwh[:electricity_produced_kwh][:photovoltaic_kwh] = add_values(existing_period.energy_production_kwh[:electricity_produced][:photovoltaic], new_period.energy_production_kwh[:electricity_produced_kwh][:photovoltaic_kwh])
|
234
242
|
end
|
235
243
|
end
|
236
244
|
|
237
|
-
existing_period.
|
238
|
-
existing_period.
|
239
|
-
existing_period.
|
240
|
-
existing_period.
|
241
|
-
existing_period.
|
245
|
+
existing_period.utility_costs_dollar&.each_with_index do |item, i|
|
246
|
+
existing_period.utility_costs_dollar[i][:fuel_type] = existing_period.utility_costs_dollar[i][:fuel_type]
|
247
|
+
existing_period.utility_costs_dollar[i][:total_cost] = add_values(existing_period.utility_costs_dollar[i][:total_cost], new_period.utility_costs_dollar[i][:total_cost])
|
248
|
+
existing_period.utility_costs_dollar[i][:usage_cost] = add_values(existing_period.utility_costs_dollar[i][:usage_cost], new_period.utility_costs_dollar[i][:usage_cost])
|
249
|
+
existing_period.utility_costs_dollar[i][:demand_cost] = add_values(existing_period.utility_costs_dollar[i][:demand_cost], new_period.utility_costs_dollar[i][:demand_cost])
|
242
250
|
end
|
243
251
|
|
244
252
|
if existing_period.comfort_result
|