urbanopt-reporting 0.2.0 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +19 -0
  3. data/.github/ISSUE_TEMPLATE/feature_request.md +15 -0
  4. data/.github/pull_request_template.md +13 -0
  5. data/.rdoc_options +36 -0
  6. data/CHANGELOG.md +43 -1
  7. data/LICENSE.md +1 -1
  8. data/RDOC_MAIN.md +10 -0
  9. data/deploy_docs.sh +5 -0
  10. data/doc_templates/LICENSE.md +1 -1
  11. data/doc_templates/copyright_erb.txt +1 -1
  12. data/doc_templates/copyright_js.txt +1 -1
  13. data/doc_templates/copyright_ruby.txt +1 -1
  14. data/docs/.gitignore +3 -0
  15. data/docs/.vuepress/components/InnerJsonSchema.vue +76 -0
  16. data/docs/.vuepress/components/JsonSchema.vue +12 -0
  17. data/docs/.vuepress/components/ScenarioSchema.vue +12 -0
  18. data/docs/.vuepress/components/StaticLink.vue +8 -0
  19. data/docs/.vuepress/config.js +25 -0
  20. data/docs/.vuepress/highlight.js +8 -0
  21. data/docs/.vuepress/json-schema-deref-loader.js +22 -0
  22. data/docs/.vuepress/public/custom_rdoc_styles.css +78 -0
  23. data/docs/.vuepress/styles/palette.styl +1 -0
  24. data/docs/.vuepress/utils.js +17 -0
  25. data/docs/README.md +9 -0
  26. data/docs/package-lock.json +10018 -0
  27. data/docs/package.json +30 -0
  28. data/docs/schemas/scenario-schema.md +3 -0
  29. data/lib/measures/default_feature_reports/LICENSE.md +1 -1
  30. data/lib/measures/default_feature_reports/measure.rb +231 -87
  31. data/lib/measures/default_feature_reports/measure.xml +11 -11
  32. data/lib/measures/export_modelica_loads/LICENSE.md +27 -0
  33. data/lib/measures/export_modelica_loads/README.md +26 -0
  34. data/lib/measures/export_modelica_loads/README.md.erb +42 -0
  35. data/lib/measures/export_modelica_loads/docs/.gitkeep +0 -0
  36. data/lib/measures/export_modelica_loads/measure.rb +367 -0
  37. data/lib/measures/export_modelica_loads/measure.xml +92 -0
  38. data/lib/measures/export_modelica_loads/resources/report.html.in +13 -0
  39. data/lib/measures/export_time_series_modelica/LICENSE.md +1 -0
  40. data/lib/measures/export_time_series_modelica/README.md +59 -0
  41. data/lib/measures/export_time_series_modelica/README.md.erb +42 -0
  42. data/lib/measures/export_time_series_modelica/docs/.gitkeep +0 -0
  43. data/lib/measures/export_time_series_modelica/measure.rb +433 -0
  44. data/lib/measures/export_time_series_modelica/measure.xml +147 -0
  45. data/lib/measures/export_time_series_modelica/resources/os_lib_helper_methods.rb +399 -0
  46. data/lib/measures/export_time_series_modelica/resources/report.html.in +13 -0
  47. data/lib/urbanopt/reporting/default_reports/end_uses.rb +52 -38
  48. data/lib/urbanopt/reporting/default_reports/feature_report.rb +79 -8
  49. data/lib/urbanopt/reporting/default_reports/location.rb +11 -11
  50. data/lib/urbanopt/reporting/default_reports/program.rb +86 -86
  51. data/lib/urbanopt/reporting/default_reports/reporting_period.rb +98 -78
  52. data/lib/urbanopt/reporting/default_reports/scenario_report.rb +7 -4
  53. data/lib/urbanopt/reporting/default_reports/schema/scenario_csv_columns.txt +15 -0
  54. data/lib/urbanopt/reporting/default_reports/schema/scenario_schema.json +108 -80
  55. data/lib/urbanopt/reporting/default_reports/thermal_storage.rb +10 -10
  56. data/lib/urbanopt/reporting/version.rb +1 -1
  57. data/urbanopt-reporting-gem.gemspec +4 -4
  58. metadata +50 -13
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>ReportingMeasure</title>
6
+ <link href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.2/css/bootstrap.min.css" rel="stylesheet">
7
+ <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
8
+ <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.3.9/d3.min.js"></script>
9
+ </head>
10
+ <body>
11
+ <%= output %>
12
+ </body>
13
+ </html>
@@ -39,10 +39,10 @@ module URBANopt
39
39
  # Enduses class inlclude results for each fuel type.
40
40
  ##
41
41
  class EndUses
42
- attr_accessor :electricity, :natural_gas, :additional_fuel, :district_cooling, :district_heating, :water # :nodoc:
42
+ attr_accessor :electricity_kwh, :natural_gas_kwh, :propane_kwh, :fuel_oil_kwh, :other_fuels_kwh, :district_cooling_kwh, :district_heating_kwh, :water_qbft # :nodoc:
43
43
  ##
44
- # EndUses class intialize end_uses(fuel type) attributes: +:electricity+ , +:natural_gas+ , +:additional_fuel+ ,
45
- # +:district_cooling+ , +:district_heating+ , +:water+
44
+ # EndUses class intialize end_uses(fuel type) attributes: +:electricity_kwh+ , +:natural_gas_kwh+ , +:propane_kwh+ , +:fuel_oil_kwh+ , +:other_fuels_kwh+ ,
45
+ # +:district_cooling_kwh+ , +:district_heating_kwh+ , +:water_qbft+
46
46
  ##
47
47
  # [parameters:]
48
48
  # +hash+ - _Hash_ - A hash which may contain a deserialized end_uses.
@@ -51,12 +51,14 @@ module URBANopt
51
51
  hash.delete_if { |k, v| v.nil? }
52
52
  hash = defaults.merge(hash)
53
53
 
54
- @electricity = EndUse.new(hash[:electricity])
55
- @natural_gas = EndUse.new(hash[:natural_gas])
56
- @additional_fuel = EndUse.new(hash[:additional_fuel])
57
- @district_cooling = EndUse.new(hash[:district_cooling])
58
- @district_heating = EndUse.new(hash[:district_heating])
59
- @water = EndUse.new(hash[:water])
54
+ @electricity_kwh = EndUse.new(hash[:electricity_kwh])
55
+ @natural_gas_kwh = EndUse.new(hash[:natural_gas_kwh])
56
+ @propane_kwh = EndUse.new(hash[:propane_kwh])
57
+ @fuel_oil_kwh = EndUse.new(hash[:fuel_oil_kwh])
58
+ @other_fuels_kwh = EndUse.new(hash[:other_fuels_kwh])
59
+ @district_cooling_kwh = EndUse.new(hash[:district_cooling_kwh])
60
+ @district_heating_kwh = EndUse.new(hash[:district_heating_kwh])
61
+ @water_qbft = EndUse.new(hash[:water_qbft])
60
62
 
61
63
  # initialize class variables @@validator and @@schema
62
64
  @@validator ||= Validator.new
@@ -72,29 +74,37 @@ module URBANopt
72
74
  def to_hash
73
75
  result = {}
74
76
 
75
- electricity_hash = @electricity.to_hash if @electricity.to_hash
76
- electricity_hash.delete_if { |k, v| v.nil? }
77
- result[:electricity] = electricity_hash if @electricity
77
+ electricity_kwh_hash = @electricity_kwh.to_hash if @electricity_kwh
78
+ electricity_kwh_hash.delete_if { |k, v| v.nil? }
79
+ result[:electricity_kwh] = electricity_kwh_hash if @electricity_kwh
78
80
 
79
- natural_gas_hash = @natural_gas.to_hash if @natural_gas
80
- natural_gas_hash.delete_if { |k, v| v.nil? }
81
- result[:natural_gas] = natural_gas_hash if @natural_gas
81
+ natural_gas_kwh_hash = @natural_gas_kwh.to_hash if @natural_gas_kwh
82
+ natural_gas_kwh_hash.delete_if { |k, v| v.nil? }
83
+ result[:natural_gas_kwh] = natural_gas_kwh_hash if @natural_gas_kwh
82
84
 
83
- additional_fuel_hash = @additional_fuel.to_hash if @additional_fuel
84
- additional_fuel_hash.delete_if { |k, v| v.nil? }
85
- result[:additional_fuel] = additional_fuel_hash if @additional_fuel
85
+ propane_kwh_hash = @propane_kwh.to_hash if @propane_kwh
86
+ propane_kwh_hash.delete_if { |k, v| v.nil? }
87
+ result[:propane_kwh] = propane_kwh_hash if @propane_kwh
86
88
 
87
- district_cooling_hash = @district_cooling.to_hash if @district_cooling
88
- district_cooling_hash.delete_if { |k, v| v.nil? }
89
- result[:district_cooling] = district_cooling_hash if @district_cooling
89
+ fuel_oil_kwh_hash = @fuel_oil_kwh.to_hash if @fuel_oil_kwh
90
+ fuel_oil_kwh_hash.delete_if { |k, v| v.nil? }
91
+ result[:fuel_oil_kwh] = fuel_oil_kwh_hash if @fuel_oil_kwh
90
92
 
91
- district_heating_hash = @district_heating.to_hash if @district_heating
92
- district_heating_hash.delete_if { |k, v| v.nil? }
93
- result[:district_heating] = district_heating_hash if @district_heating
93
+ other_fuels_kwh_hash = @other_fuels_kwh.to_hash if @other_fuels_kwh
94
+ other_fuels_kwh_hash.delete_if { |k, v| v.nil? }
95
+ result[:other_fuels_kwh] = other_fuels_kwh_hash if @other_fuels_kwh
94
96
 
95
- water_hash = @water.to_hash if @water
96
- water_hash.delete_if { |k, v| v.nil? }
97
- result[:water] = water_hash if @water
97
+ district_cooling_kwh_hash = @district_cooling_kwh.to_hash if @district_cooling_kwh
98
+ district_cooling_kwh_hash.delete_if { |k, v| v.nil? }
99
+ result[:district_cooling_kwh] = district_cooling_kwh_hash if @district_cooling_kwh
100
+
101
+ district_heating_kwh_hash = @district_heating_kwh.to_hash if @district_heating_kwh
102
+ district_heating_kwh_hash.delete_if { |k, v| v.nil? }
103
+ result[:district_heating_kwh] = district_heating_kwh_hash if @district_heating_kwh
104
+
105
+ water_qbft_hash = @water_qbft.to_hash if @water_qbft
106
+ water_qbft_hash.delete_if { |k, v| v.nil? }
107
+ result[:water_qbft] = water_qbft_hash if @water_qbft
98
108
 
99
109
  # validate end_uses properties against schema
100
110
  if @@validator.validate(@@schema[:definitions][:EndUses][:properties], result).any?
@@ -109,12 +119,14 @@ module URBANopt
109
119
  ##
110
120
  def defaults
111
121
  hash = {}
112
- hash[:electricity] = EndUse.new.to_hash
113
- hash[:natural_gas] = EndUse.new.to_hash
114
- hash[:additional_fuel] = EndUse.new.to_hash
115
- hash[:district_cooling] = EndUse.new.to_hash
116
- hash[:district_heating] = EndUse.new.to_hash
117
- hash[:water] = EndUse.new.to_hash
122
+ hash[:electricity_kwh] = EndUse.new.to_hash
123
+ hash[:natural_gas_kwh] = EndUse.new.to_hash
124
+ hash[:propane_kwh] = EndUse.new.to_hash
125
+ hash[:fuel_oil_kwh] = EndUse.new.to_hash
126
+ hash[:other_fuels_kwh] = EndUse.new.to_hash
127
+ hash[:district_cooling_kwh] = EndUse.new.to_hash
128
+ hash[:district_heating_kwh] = EndUse.new.to_hash
129
+ hash[:water_qbft] = EndUse.new.to_hash
118
130
 
119
131
  return hash
120
132
  end
@@ -127,11 +139,13 @@ module URBANopt
127
139
  ##
128
140
  def merge_end_uses!(new_end_uses)
129
141
  # modify the existing_period by summing up the results ; # sum results only if they exist
130
- @electricity.merge_end_use!(new_end_uses.electricity)
131
- @natural_gas.merge_end_use!(new_end_uses.natural_gas)
132
- @additional_fuel.merge_end_use!(new_end_uses.additional_fuel)
133
- @district_cooling.merge_end_use!(new_end_uses.district_cooling)
134
- @district_heating.merge_end_use!(new_end_uses.district_heating)
142
+ @electricity_kwh.merge_end_use!(new_end_uses.electricity_kwh)
143
+ @natural_gas_kwh.merge_end_use!(new_end_uses.natural_gas_kwh)
144
+ @propane_kwh.merge_end_use!(new_end_uses.propane_kwh)
145
+ @fuel_oil_kwh.merge_end_use!(new_end_uses.fuel_oil_kwh)
146
+ @other_fuels_kwh.merge_end_use!(new_end_uses.other_fuels_kwh)
147
+ @district_cooling_kwh.merge_end_use!(new_end_uses.district_cooling_kwh)
148
+ @district_heating_kwh.merge_end_use!(new_end_uses.district_heating_kwh)
135
149
  return self
136
150
  end
137
151
  end
@@ -227,27 +227,30 @@ module URBANopt
227
227
  # Saves the 'default_feature_report.json' and 'default_feature_report.csv' files
228
228
  ##
229
229
  # [parameters]:
230
- # +file_name+ - _String_ - Assign a name to the saved feature report results file without an extension
231
- def save_feature_report(file_name = 'default_feature_report')
230
+ # +file_name+ - _String_ - Assign a name to the saved feature results file without an extension
231
+ def save(file_name = 'default_feature_report')
232
232
  # reassign the initialize local variable @file_name to the file name input.
233
233
  @file_name = file_name
234
234
 
235
- # create feature reports directory
236
- Dir.mkdir(File.join(@directory_name, 'feature_reports')) unless Dir.exist?(File.join(@directory_name, 'feature_reports'))
237
-
238
- # save the csv data
235
+ # save the feature reports csv and json data
239
236
  old_timeseries_path = nil
240
237
  if !@timeseries_csv.path.nil?
241
238
  old_timeseries_path = @timeseries_csv.path
242
239
  end
243
240
 
241
+ # define the results_dir_path
242
+ results_dir_path = File.join(@directory_name, 'feature_reports')
243
+ # create feature reports directory
244
+ Dir.mkdir(results_dir_path) unless Dir.exist?(File.join(@directory_name, 'feature_reports'))
245
+
244
246
  @timeseries_csv.path = File.join(@directory_name, 'feature_reports', file_name + '.csv')
245
247
  @timeseries_csv.save_data
246
248
 
249
+ ## save json rport
247
250
  # feature_hash
248
251
  feature_hash = to_hash
249
252
 
250
- json_name_path = File.join(@directory_name, 'feature_reports', file_name + '.json')
253
+ json_name_path = File.join(results_dir_path, file_name + '.json')
251
254
 
252
255
  File.open(json_name_path, 'w') do |f|
253
256
  f.puts JSON.pretty_generate(feature_hash)
@@ -262,10 +265,78 @@ module URBANopt
262
265
  if !old_timeseries_path.nil?
263
266
  @timeseries_csv.path = old_timeseries_path
264
267
  else
265
- @timeseries_csv.path = File.join(@directory_name, 'feature_reports', file_name + '.csv')
268
+ @timeseries_csv.path = File.join(@directory_name, file_name + '.csv')
266
269
  end
270
+
267
271
  return true
268
272
  end
273
+
274
+ ##
275
+ # Calls the individual functions to save 'default_feature_report.json' and 'default_feature_report.csv'
276
+ # For backward compatibility and ease of use
277
+ ##
278
+ # [parameters]:
279
+ # +file_name+ - _String_ - Assign a name to the saved feature report file without an extension
280
+ def save_feature_report(file_name = 'default_feature_report')
281
+ save_json_report(file_name)
282
+ save_csv_report(file_name)
283
+ end
284
+
285
+ ##
286
+ # Saves the 'default_feature_report.json' file to the results directory
287
+ ##
288
+ # [parameters]:
289
+ # +file_name+ - _String_ - Assign a name to the saved feature report file without an extension
290
+ def save_json_report(file_name = 'default_feature_report')
291
+ # reassign the initialize local variable @file_name to the file name input.
292
+ @file_name = file_name
293
+
294
+ # define the results_dir_path
295
+ results_dir_path = File.join(@directory_name, 'feature_reports')
296
+ # create feature reports directory
297
+ Dir.mkdir(results_dir_path) unless Dir.exist?(File.join(@directory_name, 'feature_reports'))
298
+
299
+ ## save json rport
300
+ # feature_hash
301
+ feature_hash = to_hash
302
+
303
+ json_name_path = File.join(results_dir_path, file_name + '.json')
304
+
305
+ File.open(json_name_path, 'w') do |f|
306
+ f.puts JSON.pretty_generate(feature_hash)
307
+ # make sure data is written to the disk one way or the other
308
+ begin
309
+ f.fsync
310
+ rescue StandardError
311
+ f.flush
312
+ end
313
+ end
314
+ end
315
+
316
+ ##
317
+ # Saves the 'default_feature_report.csv' file to the results directory
318
+ ##
319
+ # [parameters]:
320
+ # +file_name+ - _String_ - Assign a name to the saved feature report file without an extension
321
+ def save_csv_report(file_name = 'default_feature_report')
322
+ # reassign the initialize local variable @file_name to the file name input.
323
+ @file_name = file_name
324
+
325
+ # define the results_dir_path
326
+ results_dir_path = File.join(@directory_name, 'feature_reports')
327
+ # create feature reports directory
328
+ Dir.mkdir(results_dir_path) unless Dir.exist?(File.join(@directory_name, 'feature_reports'))
329
+
330
+ ## copy CSV report to the new feature_reports folder
331
+ # get all folder names in the feature diectory
332
+ directory_folders = Dir.glob "#{@directory_name}/*/"
333
+ # copy the CSV report to the new feature_reports folder
334
+ directory_folders.each do |f|
335
+ if f.include? '_default_feature_reports'
336
+ FileUtils.cp(File.join(f, 'default_feature_reports.csv'), File.join(results_dir_path, @file_name + '.csv'))
337
+ end
338
+ end
339
+ end
269
340
  end
270
341
  end
271
342
  end
@@ -39,9 +39,9 @@ module URBANopt
39
39
  # Location include all location information.
40
40
  ##
41
41
  class Location
42
- attr_accessor :latitude, :longitude, :surface_elevation, :weather_filename #:nodoc:
42
+ attr_accessor :latitude_deg, :longitude_deg, :surface_elevation_ft, :weather_filename #:nodoc:
43
43
  ##
44
- # Location class initialize location attributes: +:latitude+ , +:longitude+ , +:surface_elevation+ , +:weather_filename+
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
- @latitude = hash[:latitude]
54
- @longitude = hash[:longitude]
55
- @surface_elevation = hash[:surface_elevation]
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[:latitude] = @latitude if @latitude
72
- result[:longitude] = @longitude if @longitude
73
- result[:surface_elevation] = @surface_elevation if @surface_elevation
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[:latitude] = nil
90
- hash[:longitude] = nil
91
- hash[:surface_elevation] = nil
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
@@ -40,18 +40,18 @@ module URBANopt
40
40
  # Program includes all building program related information.
41
41
  ##
42
42
  class Program
43
- attr_accessor :site_area, :floor_area, :conditioned_area, :unconditioned_area, :footprint_area, :maximum_roof_height,
44
- :maximum_number_of_stories, :maximum_number_of_stories_above_ground, :parking_area, :number_of_parking_spaces,
45
- :number_of_parking_spaces_charging, :parking_footprint_area, :maximum_parking_height, :maximum_number_of_parking_stories,
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
- :area, :window_area, :north_window_area, :south_window_area, :east_window_area, :west_window_area, :wall_area, :roof_area, :equipment_roof_area,
48
- :photovoltaic_roof_area, :available_roof_area, :total_roof_area, :orientation, :aspect_ratio, :total_construction_cost # :nodoc:
49
- # Program class initialize building program attributes: +:site_area+ , +:floor_area+ , +:conditioned_area+ , +:unconditioned_area+ ,
50
- # +:footprint_area+ , +:maximum_roof_height, +:maximum_number_of_stories+ , +:maximum_number_of_stories_above_ground+ , +:parking_area+ ,
51
- # +:number_of_parking_spaces+ , +:number_of_parking_spaces_charging+ , +:parking_footprint_area+ , +:maximum_parking_height+ , +:maximum_number_of_parking_stories+ ,
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
- # +:area+ , +:window_area+ , +:north_window_area+ , +:south_window_area+ , +:east_window_area+ , +:west_window_area+ , +:wall_area+ , +:roof_area+ ,
54
- # +:equipment_roof_area+ , +:photovoltaic_roof_area+ , +:available_roof_area+ , +:total_roof_area+ , +:orientation+ , +:aspect_ratio+
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
- @site_area = hash[:site_area]
64
- @floor_area = hash[:floor_area]
65
- @conditioned_area = hash[:conditioned_area]
66
- @unconditioned_area = hash[:unconditioned_area]
67
- @footprint_area = hash[:footprint_area]
68
- @maximum_roof_height = hash[:maximum_roof_height]
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
- @parking_area = hash[:parking_area]
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
- @parking_footprint_area = hash[:parking_footprint_area]
75
- @maximum_parking_height = hash[:maximum_parking_height]
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
- @window_area = hash[:window_area]
81
- @wall_area = hash[:wall_area]
82
- @roof_area = hash[:roof_area]
83
- @orientation = hash[:orientation]
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
- @total_construction_cost = hash[:total_construction_cost]
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[:site_area] = nil
98
- hash[:floor_area] = nil
99
- hash[:conditioned_area] = nil
100
- hash[:unconditioned_area] = nil
101
- hash[:footprint_area] = nil
102
- hash[:maximum_roof_height] = nil
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[:parking_area] = nil
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[:parking_footprint_area] = nil
109
- hash[:maximum_parking_height] = nil
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, floor_area: nil }]
114
- hash[:window_area] = { north_window_area: nil, south_window_area: nil, east_window_area: nil, west_window_area: nil, total_window_area: nil }
115
- hash[:wall_area] = { north_wall_area: nil, south_wall_area: nil, east_wall_area: nil, west_wall_area: nil, total_wall_area: nil }
116
- hash[:roof_area] = { equipment_roof_area: nil, photovoltaic_roof_area: nil, available_roof_area: nil, total_roof_area: nil }
117
- hash[:orientation] = nil
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[:total_construction_cost] = nil
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[:site_area] = @site_area if @site_area
132
- result[:floor_area] = @floor_area if @floor_area
133
- result[:conditioned_area] = @conditioned_area if @conditioned_area
134
- result[:unconditioned_area] = @unconditioned_area if @unconditioned_area
135
- result[:footprint_area] = @footprint_area if @footprint_area
136
- result[:maximum_roof_height] = @maximum_roof_height if @maximum_roof_height
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[:parking_area] = @parking_area if @parking_area
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[:parking_footprint_area] = @parking_footprint_area if @parking_footprint_area
143
- result[:maximum_parking_height] = @maximum_parking_height if @maximum_parking_height
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[:window_area] = @window_area if @window_area
156
- window_area_hash = @window_area if @window_area
157
- window_area_hash.delete_if { |k, v| v.nil? }
158
- result[:window_area] = window_area_hash if @window_area
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[:wall_area] = @wall_area if @wall_area
161
- wall_area_hash = @wall_area if @wall_area
162
- wall_area_hash.delete_if { |k, v| v.nil? }
163
- result[:wall_area] = wall_area_hash if @wall_area
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[:roof_area] = @roof_area if @roof_area
166
- roof_area_hash = @roof_area if @roof_area
167
- roof_area_hash.delete_if { |k, v| v.nil? }
168
- result[:roof_area] = roof_area_hash if @roof_area
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[:orientation] = @orientation if @orientation
170
+ result[:orientation_deg] = @orientation_deg if @orientation_deg
171
171
  result[:aspect_ratio] = @aspect_ratio if @aspect_ratio
172
172
 
173
- result[:total_construction_cost] = @total_construction_cost if @total_construction_cost
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
- @site_area = add_values(@site_area, other.site_area)
224
+ @site_area_sqft = add_values(@site_area_sqft, other.site_area_sqft)
225
225
 
226
- @floor_area = add_values(@floor_area, other.floor_area)
227
- @conditioned_area = add_values(@conditioned_area, other.conditioned_area)
228
- @unconditioned_area = add_values(@unconditioned_area, other.unconditioned_area)
229
- @footprint_area = add_values(@footprint_area, other.footprint_area)
230
- @maximum_roof_height = max_value(@maximum_roof_height, other.maximum_roof_height)
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
- @parking_area = add_values(@parking_area, other.parking_area)
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
- @parking_footprint_area = add_values(@parkig_footprint_area, other.parking_footprint_area)
237
- @maximum_parking_height = max_value(@maximum_parking_height, other.maximum_parking_height)
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
- @total_construction_cost = add_values(@total_construction_cost, other.total_construction_cost)
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
- @window_area[:north_window_area] = add_values(@window_area[:north_window_area], other.window_area[:north_window_area])
246
- @window_area[:south_window_area] = add_values(@window_area[:south_window_area], other.window_area[:south_window_area])
247
- @window_area[:east_window_area] = add_values(@window_area[:east_window_area], other.window_area[:east_window_area])
248
- @window_area[:west_window_area] = add_values(@window_area[:west_window_area], other.window_area[:west_window_area])
249
- @window_area[:total_window_area] = add_values(@window_area[:total_window_area], other.window_area[:total_window_area])
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
- @wall_area[:north_wall_area] = add_values(@wall_area[:north_wall_area], other.wall_area[:north_wall_area])
252
- @wall_area[:south_wall_area] = add_values(@wall_area[:south_wall_area], other.wall_area[:south_wall_area])
253
- @wall_area[:east_wall_area] = add_values(@wall_area[:east_wall_area], other.wall_area[:east_wall_area])
254
- @wall_area[:west_wall_area] = add_values(@wall_area[:west_wall_area], other.wall_area[:west_wall_area])
255
- @wall_area[:total_wall_area] = add_values(@wall_area[:total_wall_area], other.wall_area[:total_wall_area])
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
- @roof_area[:equipment_roof_area] = add_values(@roof_area[:equipment_roof_area], other.roof_area[:equipment_roof_area])
258
- @roof_area[:photovoltaic_roof_area] = add_values(@roof_area[:photovoltaic_roof_area], other.roof_area[:photovoltaic_roof_area])
259
- @roof_area[:available_roof_area] = add_values(@roof_area[:available_roof_area], other.roof_area[:available_roof_area])
260
- @roof_area[:total_roof_area] = add_values(@roof_area[:total_roof_area], other.roof_area[:total_roof_area])
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