urbanopt-reporting 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -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>
@@ -223,6 +223,54 @@ module URBANopt
223
223
  return result
224
224
  end
225
225
 
226
+ ##
227
+ # Saves the 'default_feature_report.json' and 'default_feature_report.csv' files
228
+ ##
229
+ # [parameters]:
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
+ # reassign the initialize local variable @file_name to the file name input.
233
+ @file_name = file_name
234
+
235
+ # save the feature reports csv and json data
236
+ old_timeseries_path = nil
237
+ if !@timeseries_csv.path.nil?
238
+ old_timeseries_path = @timeseries_csv.path
239
+ end
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
+
246
+ @timeseries_csv.path = File.join(@directory_name, 'feature_reports', file_name + '.csv')
247
+ @timeseries_csv.save_data
248
+
249
+ ## save json rport
250
+ # feature_hash
251
+ feature_hash = to_hash
252
+
253
+ json_name_path = File.join(results_dir_path, file_name + '.json')
254
+
255
+ File.open(json_name_path, 'w') do |f|
256
+ f.puts JSON.pretty_generate(feature_hash)
257
+ # make sure data is written to the disk one way or the other
258
+ begin
259
+ f.fsync
260
+ rescue StandardError
261
+ f.flush
262
+ end
263
+ end
264
+
265
+ if !old_timeseries_path.nil?
266
+ @timeseries_csv.path = old_timeseries_path
267
+ else
268
+ @timeseries_csv.path = File.join(@directory_name, file_name + '.csv')
269
+ end
270
+
271
+ return true
272
+ end
273
+
226
274
  ##
227
275
  # Calls the individual functions to save 'default_feature_report.json' and 'default_feature_report.csv'
228
276
  # For backward compatibility and ease of use
@@ -43,13 +43,13 @@ 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, :total_site_energy_kwh, :total_source_energy_kwh,
46
+ attr_accessor :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,
47
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
48
  :district_heating_kwh, :water_qbft, :electricity_produced_kwh, :end_uses, :energy_production_kwh, :photovoltaic,
49
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+ , +:total_site_energy_kwh+ , +:total_source_energy_kwh+ ,
52
+ # +: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+,
53
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
54
  # +:district_heating_kwh+ , +:water_qbft+ , +:electricity_produced_kwh+ , +:end_uses+ , +:energy_production_kwh+ , +:photovoltaic_kwh+ ,
55
55
  # +:fuel_type+ , +:total_cost_dollar+ , +:usage_cost_dollar+ , +:demand_cost_dollar+ , +:comfort_result+ , +:time_setpoint_not_met_during_occupied_cooling+ ,
@@ -70,6 +70,10 @@ module URBANopt
70
70
 
71
71
  @total_site_energy_kwh = hash[:total_site_energy_kwh]
72
72
  @total_source_energy_kwh = hash[:total_source_energy_kwh]
73
+ @site_EUI_kwh_per_m2 = hash[:site_EUI_kwh_per_m2]
74
+ @site_EUI_kbtu_per_ft2 = hash[:site_EUI_kbtu_per_ft2]
75
+ @source_EUI_kwh_per_m2 = hash[:source_EUI_kwh_per_m2]
76
+ @source_EUI_kbtu_per_ft2 = hash[:source_EUI_kbtu_per_ft2]
73
77
  @net_site_energy_kwh = hash[:net_site_energy_kwh]
74
78
  @net_source_energy_kwh = hash[:net_source_energy_kwh]
75
79
  @net_utility_cost_dollar = hash[:net_utility_cost_dollar]
@@ -110,6 +114,10 @@ module URBANopt
110
114
 
111
115
  hash[:total_site_energy_kwh] = nil
112
116
  hash[:total_source_energy_kwh] = nil
117
+ hash[:site_EUI_kwh_per_m2] = nil
118
+ hash[:site_EUI_kbtu_per_ft2] = nil
119
+ hash[:source_EUI_kwh_per_m2] = nil
120
+ hash[:source_EUI_kbtu_per_ft2] = nil
113
121
  hash[:net_site_energy_kwh] = nil
114
122
  hash[:net_source_energy_kwh] = nil
115
123
  hash[:net_utility_cost_dollar] = nil
@@ -148,6 +156,10 @@ module URBANopt
148
156
  result[:end_date] = @end_date.to_hash if @end_date
149
157
  result[:total_site_energy_kwh] = @total_site_energy_kwh if @total_site_energy_kwh
150
158
  result[:total_source_energy_kwh] = @total_source_energy_kwh if @total_source_energy_kwh
159
+ result[:site_EUI_kwh_per_m2] = @site_EUI_kwh_per_m2 if @site_EUI_kwh_per_m2
160
+ result[:site_EUI_kbtu_per_ft2] = @site_EUI_kbtu_per_ft2 if @site_EUI_kbtu_per_ft2
161
+ result[:source_EUI_kwh_per_m2] = @source_EUI_kwh_per_m2 if @source_EUI_kwh_per_m2
162
+ result[:source_EUI_kbtu_per_ft2] = @source_EUI_kbtu_per_ft2 if @source_EUI_kbtu_per_ft2
151
163
  result[:net_site_energy_kwh] = @net_site_energy_kwh if @net_site_energy_kwh
152
164
  result[:net_source_energy_kwh] = @net_source_energy_kwh if @net_source_energy_kwh
153
165
  result[:net_utility_cost_dollar] = @net_utility_cost_dollar if @net_utility_cost_dollar
@@ -185,10 +185,13 @@ module URBANopt
185
185
  @timeseries_csv.path = File.join(@directory_name, file_name + '.csv')
186
186
  end
187
187
 
188
- # save the feature reports csv and json data
189
- # @feature_reports.each do |feature_report|
190
- # feature_report.save_feature_report()
191
- # end
188
+ if file_name == 'default_scenario_report'
189
+ file_name = 'default_feature_report'
190
+ end
191
+ #save the feature reports csv and json data
192
+ @feature_reports.each do |feature_report|
193
+ feature_report.save file_name
194
+ end
192
195
 
193
196
  return true
194
197
  end
@@ -271,6 +271,18 @@
271
271
  "description": "Total source energy used, does not include generation (kWh)",
272
272
  "type": "number"
273
273
  },
274
+ "site_EUI_kwh_per_m2": {
275
+ "type": "number"
276
+ },
277
+ "site_EUI_kBtu_per_ft2": {
278
+ "type": "number"
279
+ },
280
+ "source_EUI_kwh_per_m2": {
281
+ "type": "number"
282
+ },
283
+ "source_EUI_kBtu_per_ft2": {
284
+ "type": "number"
285
+ },
274
286
  "net_site_energy_kwh": {
275
287
  "description": "Net site energy (kWh)",
276
288
  "type": "number"
@@ -301,14 +313,14 @@
301
313
  "description": "Sum of all natural gas end uses consumption (kWh)",
302
314
  "type": "number"
303
315
  },
304
- "propane_kwh": {
316
+ "propane_kwh": {
305
317
  "description": "Sum of all propane end uses consumption (kWh)",
306
318
  "type": "number"
307
- },
308
- "fuel_oil_kwh": {
319
+ },
320
+ "fuel_oil_kwh": {
309
321
  "description": "Sum of all fuel oil #2 end uses consumption (kWh)",
310
322
  "type": "number"
311
- },
323
+ },
312
324
  "other_fuels_kwh": {
313
325
  "description": "Sum of all other (fuel oil #1, diesel, gasoline, coal, steam) fuel end uses consumption (kWh)",
314
326
  "type": "number"
@@ -379,12 +391,12 @@
379
391
  "natural_gas_kwh": {
380
392
  "$ref": "#/definitions/EndUse"
381
393
  },
382
- "propane_kwh": {
383
- "$ref": "#/definitions/EndUse"
384
- },
385
- "fuel_oil_kwh": {
386
- "$ref": "#/definitions/EndUse"
387
- },
394
+ "propane_kwh": {
395
+ "$ref": "#/definitions/EndUse"
396
+ },
397
+ "fuel_oil_kwh": {
398
+ "$ref": "#/definitions/EndUse"
399
+ },
388
400
  "other_fuels_kwh": {
389
401
  "$ref": "#/definitions/EndUse"
390
402
  },
@@ -536,8 +548,8 @@
536
548
  "enum": [
537
549
  "Electricity",
538
550
  "Natural Gas",
539
- "Propane",
540
- "Fuel Oil",
551
+ "Propane",
552
+ "Fuel Oil",
541
553
  "District Cooling",
542
554
  "District Heating",
543
555
  "Other Fuels",
@@ -889,4 +901,4 @@
889
901
  }
890
902
  }
891
903
  }
892
- }
904
+ }
@@ -30,6 +30,6 @@
30
30
 
31
31
  module URBANopt
32
32
  module Reporting
33
- VERSION = '0.3.2'.freeze
33
+ VERSION = '0.3.3'.freeze
34
34
  end
35
35
  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.3.2
4
+ version: 0.3.3
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: 2020-12-09 00:00:00.000000000 Z
12
+ date: 2021-01-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -144,6 +144,21 @@ files:
144
144
  - lib/measures/default_feature_reports/README.md.erb
145
145
  - lib/measures/default_feature_reports/measure.rb
146
146
  - lib/measures/default_feature_reports/measure.xml
147
+ - lib/measures/export_modelica_loads/LICENSE.md
148
+ - lib/measures/export_modelica_loads/README.md
149
+ - lib/measures/export_modelica_loads/README.md.erb
150
+ - lib/measures/export_modelica_loads/docs/.gitkeep
151
+ - lib/measures/export_modelica_loads/measure.rb
152
+ - lib/measures/export_modelica_loads/measure.xml
153
+ - lib/measures/export_modelica_loads/resources/report.html.in
154
+ - lib/measures/export_time_series_modelica/LICENSE.md
155
+ - lib/measures/export_time_series_modelica/README.md
156
+ - lib/measures/export_time_series_modelica/README.md.erb
157
+ - lib/measures/export_time_series_modelica/docs/.gitkeep
158
+ - lib/measures/export_time_series_modelica/measure.rb
159
+ - lib/measures/export_time_series_modelica/measure.xml
160
+ - lib/measures/export_time_series_modelica/resources/os_lib_helper_methods.rb
161
+ - lib/measures/export_time_series_modelica/resources/report.html.in
147
162
  - lib/urbanopt/reporting.rb
148
163
  - lib/urbanopt/reporting/default_reports.rb
149
164
  - lib/urbanopt/reporting/default_reports/construction_cost.rb