openstudio-geb 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -0
  3. data/lib/measures/add_chilled_water_storage_tank/measure.rb +163 -35
  4. data/lib/measures/{add_rooftop_pv → add_rooftop_pv_simple}/LICENSE.md +0 -0
  5. data/lib/measures/{add_rooftop_pv → add_rooftop_pv_simple}/README.md +0 -0
  6. data/lib/measures/{Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/measures/Enable Demand Controlled Ventilation → add_rooftop_pv_simple}/README.md.erb +0 -0
  7. data/lib/measures/{add_rooftop_pv → add_rooftop_pv_simple}/measure.rb +0 -0
  8. data/lib/measures/{add_rooftop_pv → add_rooftop_pv_simple}/measure.xml +0 -0
  9. data/lib/measures/{add_rooftop_pv → add_rooftop_pv_simple}/tests/CZ06RV2.epw +0 -0
  10. data/lib/measures/{add_rooftop_pv → add_rooftop_pv_simple}/tests/add_rooftop_pv_test.rb +0 -0
  11. data/lib/measures/{add_rooftop_pv → add_rooftop_pv_simple}/tests/pv_test_input.osm +0 -0
  12. data/lib/measures/average_ventilation_for_peak_hours/measure.rb +22 -11
  13. data/lib/measures/average_ventilation_for_peak_hours/tests/LargeOffice-90.1-2013-ASHRAE 169-2013-5A.osm +21863 -0
  14. data/lib/measures/reduce_epd_by_percentage_for_peak_hours/measure.rb +5 -5
  15. data/lib/openstudio/geb/utilities.rb +34 -6
  16. data/lib/openstudio/geb/version.rb +1 -1
  17. data/openstudio-geb.gemspec +1 -1
  18. metadata +12 -127
  19. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/files/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw +0 -8768
  20. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/files/USA_NY_Buffalo.Niagara.Intl.AP.725280_TMY3.epw +0 -8768
  21. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/measures/Enable Demand Controlled Ventilation/LICENSE.md +0 -27
  22. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/measures/Enable Demand Controlled Ventilation/README.md +0 -32
  23. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/measures/Enable Demand Controlled Ventilation/measure.rb +0 -156
  24. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/measures/Enable Demand Controlled Ventilation/measure.xml +0 -117
  25. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/measures/Enable Demand Controlled Ventilation/tests/0320_ModelWithHVAC_01.osm +0 -22223
  26. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/measures/Enable Demand Controlled Ventilation/tests/EnableDemandControlledVentilation_Test.rb +0 -123
  27. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/measures/Set Electric Equipment loads by EPD/LICENSE.md +0 -27
  28. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/measures/Set Electric Equipment loads by EPD/README.md +0 -136
  29. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/measures/Set Electric Equipment loads by EPD/README.md.erb +0 -47
  30. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/measures/Set Electric Equipment loads by EPD/measure.rb +0 -586
  31. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/measures/Set Electric Equipment loads by EPD/measure.xml +0 -200
  32. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/measures/Set Electric Equipment loads by EPD/tests/EnvelopeAndLoadTestModel_01.osm +0 -14352
  33. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/measures/Set Electric Equipment loads by EPD/tests/EnvelopeAndLoadTestModel_01_Costed.osm +0 -14438
  34. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/measures/Set Electric Equipment loads by EPD/tests/HasSpaceWithNoLightsOrElec.osm +0 -16531
  35. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/measures/Set Electric Equipment loads by EPD/tests/ReplaceElectricEquipmentWithEPD_Test.rb +0 -592
  36. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/out.osw +0 -68
  37. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/reports/eplustbl.html +0 -27183
  38. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/data_point.zip +0 -0
  39. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/data_point_out.json +0 -6
  40. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/eplusout.audit +0 -49
  41. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/eplusout.bnd +0 -1103
  42. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/eplusout.eio +0 -630
  43. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/eplusout.end +0 -1
  44. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/eplusout.err +0 -331
  45. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/eplusout.eso +0 -158559
  46. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/eplusout.mdd +0 -336
  47. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/eplusout.mtd +0 -2519
  48. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/eplusout.rdd +0 -638
  49. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/eplusout.shd +0 -902
  50. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/eplusout.sql +0 -0
  51. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/eplusssz.csv +0 -147
  52. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/eplustbl.htm +0 -27183
  53. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/epluszsz.csv +0 -148
  54. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/finished.job +0 -1
  55. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/in.idf +0 -10384
  56. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/in.osm +0 -13809
  57. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/measure_attributes.json +0 -6
  58. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/objectives.json +0 -2
  59. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/pre-preprocess.idf +0 -10134
  60. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/results.json +0 -6
  61. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/run.log +0 -0
  62. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/sqlite.err +0 -1
  63. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/started.job +0 -1
  64. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/stdout-energyplus +0 -271
  65. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/run/stdout-expandobject +0 -3
  66. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/stderr +0 -0
  67. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/stdout +0 -0
  68. data/lib/measures/Enable Demand Controlled Ventilation/tests/MediumOffice-90.1-2010-ASHRAE 169-2013-5A_dcv/workflow.osw +0 -19
  69. data/lib/measures/add_rooftop_pv/README.md.erb +0 -42
  70. data/lib/measures/average_ventilation_for_peak_hours/tests/example_model.osm +0 -8077
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 45ce7a6b389311aa0a2910b98859e3e23d283c1b7cb16a4e932e2c52457b3b05
4
- data.tar.gz: edf5e2693b3924602b03bb73477c99c88003cc391cf4f8b25d22f109befc3a5a
3
+ metadata.gz: 347d9430484e0647ed589317e8c8324f250e08d4d6f95bcd17e3a66fa84237cd
4
+ data.tar.gz: bd0f0c3f362792e18e8bddba9dea2c4d2cf8310cf6759fa91b4f50af864d914a
5
5
  SHA512:
6
- metadata.gz: a1e6bce96aa3833cd9b5dd6e9920cef45211c2daf0a1be06d751a3795f53f235f104281848b534361333fc7a8d914e498369811d40b16e10ac608efd7a925bef
7
- data.tar.gz: ae19c84f57043ed7b82ad19c8c5102907ce2fbf5b47308dc0ebdff84a1320340324bec466768b77cc7c0557fbeeca40845737165d026390a4a915326cbfa6b1d
6
+ metadata.gz: 01a593ed9e93044ee79e09dd8b98d697b7a609def6ba532cd37603e06dfef767b519730e443f946f52cffa2b357a0784dbf9ead1a47f5a00c665b5b61b6f9925
7
+ data.tar.gz: c2e3606e8c44287fe02e60caac0e6c57b4d0bdd82aa266d1701d47125bfeae7f869e55f89b0a8c65b88d530e634cc102118b38f6a32afe2e914d89d431d73ddb
data/.gitignore CHANGED
@@ -31,3 +31,8 @@ lib/measures/*/tests/baseline
31
31
 
32
32
  # runner conf
33
33
  runner.conf
34
+
35
+ # built gem file
36
+ *.gem
37
+
38
+ .DS_Store
@@ -51,7 +51,7 @@ class AddChilledWaterStorageTank < OpenStudio::Measure::ModelMeasure
51
51
  end
52
52
 
53
53
  # Make choice argument for primary loop selection
54
- selected_primary_loop_name = OpenStudio::Measure::OSArgument.makeChoiceArgument('selected_primary_loop_name', loop_choices, true)
54
+ selected_primary_loop_name = OpenStudio::Measure::OSArgument.makeChoiceArgument('selected_primary_loop_name', loop_choices, false)
55
55
  selected_primary_loop_name.setDisplayName('Select Primary Loop:')
56
56
  selected_primary_loop_name.setDescription('This is the primary cooling loop on which the chilled water tank will be added.')
57
57
  pri_loop_name = nil
@@ -156,12 +156,13 @@ class AddChilledWaterStorageTank < OpenStudio::Measure::ModelMeasure
156
156
  args << wknds
157
157
 
158
158
  # Output path, for sizing run
159
- run_output_path = OpenStudio::Measure::OSArgument.makePathArgument('run_output_path', true, "")
159
+ run_output_path = OpenStudio::Measure::OSArgument.makePathArgument('run_output_path', true, "", false)
160
160
  run_output_path.setDisplayName('Output path for tank sizing run (if tank volume is not provided)')
161
+ run_output_path.setDefaultValue(".")
161
162
  args << run_output_path
162
163
 
163
164
  # epw file path, for sizing run
164
- epw_path = OpenStudio::Measure::OSArgument.makePathArgument('epw_path', true, "")
165
+ epw_path = OpenStudio::Measure::OSArgument.makePathArgument('epw_path', true, "", false)
165
166
  epw_path.setDisplayName('epw file path for tank sizing run (if tank volume is not provided)')
166
167
  args << epw_path
167
168
 
@@ -187,6 +188,34 @@ class AddChilledWaterStorageTank < OpenStudio::Measure::ModelMeasure
187
188
  # assign the user inputs to variables
188
189
  objective = runner.getStringArgumentValue('objective', user_arguments)
189
190
  selected_primary_loop_name = runner.getStringArgumentValue('selected_primary_loop_name', user_arguments)
191
+ if selected_primary_loop_name
192
+ # get the primary cooling loop
193
+ selected_primary_loop = model.getModelObjectByName(selected_primary_loop_name)
194
+ if selected_primary_loop.is_initialized
195
+ selected_primary_loop = selected_primary_loop.get.to_PlantLoop.get
196
+ else
197
+ # The provided value is not a plant loop in the model
198
+ runner.registerError("The provided primary loop name doesn't exist in the model.")
199
+ return false
200
+ end
201
+ else
202
+ loop_choices = []
203
+ model.getPlantLoops.each do |loop|
204
+ if loop.sizingPlant.loopType.to_s == 'Cooling'
205
+ loop_choices << loop.name.to_s
206
+ end
207
+ end
208
+ if loop_choices.empty?
209
+ # No cooling loop; the measure is not applicable
210
+ runner.registerAsNotApplicable("No cooling loop in the model. The measure is not applicable.")
211
+ return true
212
+ else
213
+ # There is cooling loop in the model but user didn't specify one,
214
+ # and the cooling loop name does not include 'chilled water loop'
215
+ runner.registerError("Please select a primary loop name to run the measure. The available cooling loop(s) in the model is #{loop_choices.join(', ')}")
216
+ return false
217
+ end
218
+ end
190
219
  primary_loop_sp = runner.getDoubleArgumentValue('primary_loop_sp', user_arguments)
191
220
  secondary_loop_sp = runner.getDoubleArgumentValue('secondary_loop_sp', user_arguments)
192
221
  tank_charge_sp = runner.getDoubleArgumentValue('tank_charge_sp', user_arguments)
@@ -199,6 +228,7 @@ class AddChilledWaterStorageTank < OpenStudio::Measure::ModelMeasure
199
228
  charge_end = runner.getStringArgumentValue('charge_end', user_arguments)
200
229
  wknds = runner.getBoolArgumentValue('wknds', user_arguments)
201
230
 
231
+
202
232
  # check time format
203
233
  begin
204
234
  discharge_start = Time.strptime(discharge_start, '%H:%M')
@@ -293,14 +323,7 @@ class AddChilledWaterStorageTank < OpenStudio::Measure::ModelMeasure
293
323
  return false
294
324
  end
295
325
 
296
- # get the primary cooling loop
297
- selected_primary_loop = model.getModelObjectByName(selected_primary_loop_name)
298
- if selected_primary_loop.is_initialized
299
- selected_primary_loop = selected_primary_loop.get.to_PlantLoop.get
300
- else
301
- runner.registerError("Error: No Primary Cooling Loop Found. ")
302
- return false
303
- end
326
+
304
327
  # report initial condition of model
305
328
  runner.registerInitialCondition("Original primary chilled water loop: #{selected_primary_loop.name}.")
306
329
 
@@ -312,17 +335,112 @@ class AddChilledWaterStorageTank < OpenStudio::Measure::ModelMeasure
312
335
  primary_delta_t = selected_primary_loop.sizingPlant.loopDesignTemperatureDifference
313
336
  end
314
337
 
338
+ # get the condenser water loop
339
+ cw_loop = nil
340
+ model.getPlantLoops.each do |loop|
341
+ if loop.sizingPlant.loopType.to_s.downcase == 'condenser'
342
+ cw_loop = loop if cw_loop.nil?
343
+ # confirm if this condenser loop contains demand component of chiller that is in the selected_primary_loop
344
+ common_comps = cw_loop.demandComponents & selected_primary_loop.supplyComponents
345
+ chiller_in_both_loops = false
346
+ common_comps.each do |comp|
347
+ chiller_in_both_loops = true if comp.to_ChillerElectricEIR.is_initialized || comp.to_ChillerAbsorption.is_initialized || comp.to_ChillerAbsorptionIndirect.is_initialized
348
+ end
349
+ cw_loop = nil unless chiller_in_both_loops
350
+ end
351
+ end
352
+ # not necessarily can find a cw_loop as the existing primary chiller might be air cooled.
353
+
354
+ def hardsize_cooling_tower_two_speed(tower)
355
+ # implement the applySizingValues function for CoolingTowerTwoSpeed here since it's not yet implemented in OS standards
356
+ rated_water_flow_rate = tower.autosizedDesignWaterFlowRate
357
+ if rated_water_flow_rate.is_initialized
358
+ tower.setDesignWaterFlowRate(rated_water_flow_rate.get)
359
+ end
360
+
361
+ high_fan_speed_fan_power = tower.autosizedHighFanSpeedFanPower
362
+ if high_fan_speed_fan_power.is_initialized
363
+ tower.setHighFanSpeedFanPower(high_fan_speed_fan_power.get)
364
+ end
365
+
366
+ high_fan_speed_air_flow_rate = tower.autosizedHighFanSpeedAirFlowRate
367
+ if high_fan_speed_air_flow_rate.is_initialized
368
+ tower.setHighFanSpeedAirFlowRate(high_fan_speed_air_flow_rate.get)
369
+ end
370
+
371
+ high_fan_speed_u_factor_times_area_value = tower.autosizedHighFanSpeedUFactorTimesAreaValue
372
+ if high_fan_speed_u_factor_times_area_value.is_initialized
373
+ tower.setHighFanSpeedUFactorTimesAreaValue(high_fan_speed_u_factor_times_area_value.get)
374
+ end
375
+
376
+ low_fan_speed_air_flow_rate = tower.autosizedLowFanSpeedAirFlowRate
377
+ if low_fan_speed_air_flow_rate.is_initialized
378
+ tower.setLowFanSpeedAirFlowRate(low_fan_speed_air_flow_rate.get)
379
+ end
380
+
381
+ low_fan_speed_fan_power = tower.autosizedLowFanSpeedFanPower
382
+ if low_fan_speed_fan_power.is_initialized
383
+ tower.setLowFanSpeedFanPower(low_fan_speed_fan_power.get)
384
+ end
385
+
386
+ low_fan_speed_u_factor_times_area_value = tower.autosizedLowFanSpeedUFactorTimesAreaValue
387
+ if low_fan_speed_u_factor_times_area_value.is_initialized
388
+ tower.setLowFanSpeedUFactorTimesAreaValue(low_fan_speed_u_factor_times_area_value.get)
389
+ end
390
+
391
+ free_convection_regime_air_flow_rate = tower.autosizedFreeConvectionRegimeAirFlowRate
392
+ if free_convection_regime_air_flow_rate.is_initialized
393
+ tower.setFreeConvectionRegimeAirFlowRate(free_convection_regime_air_flow_rate.get)
394
+ end
395
+
396
+ free_convection_regime_u_factor_times_area_value = tower.autosizedFreeConvectionRegimeUFactorTimesAreaValue
397
+ if free_convection_regime_u_factor_times_area_value.is_initialized
398
+ tower.setFreeConvectionRegimeUFactorTimesAreaValue(free_convection_regime_u_factor_times_area_value.get)
399
+ end
400
+ end
401
+
315
402
  # if user provides this input, if not, do autosizing
316
403
  if user_arguments['tank_vol'].hasValue
317
404
  tank_vol = runner.getDoubleArgumentValue('tank_vol', user_arguments)
318
- else
319
- unless user_arguments['run_output_path'].hasValue
320
- runner.registerError("Need to provide run output path for sizing run of tank volume. ")
321
- return false
405
+ if cw_loop
406
+ # autosize cooling tower in the condenser loop to avoid invalid hard-sized parameters
407
+ cw_loop.supplyComponents.each do |comp|
408
+ if comp.to_CoolingTowerSingleSpeed.is_initialized
409
+ cooling_tower = comp.to_CoolingTowerSingleSpeed.get
410
+ cooling_tower.autosizeDesignWaterFlowRate
411
+ cooling_tower.autosizeFanPoweratDesignAirFlowRate
412
+ cooling_tower.autosizeDesignAirFlowRate
413
+ cooling_tower.autosizeUFactorTimesAreaValueatDesignAirFlowRate
414
+ cooling_tower.autosizeAirFlowRateinFreeConvectionRegime
415
+ cooling_tower.autosizeUFactorTimesAreaValueatFreeConvectionAirFlowRate
416
+ runner.registerInfo("CoolingTowerSingleSpeed #{cooling_tower.name} has been set to autosize.")
417
+ elsif comp.to_CoolingTowerTwoSpeed.is_initialized
418
+ cooling_tower = comp.to_CoolingTowerTwoSpeed.get
419
+ cooling_tower.autosizeDesignWaterFlowRate
420
+ cooling_tower.autosizeHighFanSpeedFanPower
421
+ cooling_tower.autosizeHighFanSpeedAirFlowRate
422
+ cooling_tower.autosizeHighFanSpeedUFactorTimesAreaValue
423
+ cooling_tower.autosizeLowFanSpeedAirFlowRate
424
+ cooling_tower.autosizeLowFanSpeedFanPower
425
+ cooling_tower.autosizeLowFanSpeedUFactorTimesAreaValue
426
+ cooling_tower.autosizeFreeConvectionRegimeAirFlowRate
427
+ cooling_tower.autosizeFreeConvectionRegimeUFactorTimesAreaValue
428
+ runner.registerInfo("CoolingTowerTwoSpeed #{cooling_tower.name} has been set to autosize.")
429
+ elsif comp.to_CoolingTowerVariableSpeed.is_initialized
430
+ cooling_tower = comp.to_CoolingTowerVariableSpeed.get
431
+ cooling_tower.autosize
432
+ runner.registerInfo("CoolingTowerVariableSpeed #{cooling_tower.name} has been set to autosize.")
433
+ end
434
+ end
322
435
  end
436
+ else
437
+ # unless user_arguments['run_output_path'].hasValue
438
+ # runner.registerError("Need to provide run output path for sizing run of tank volume. ")
439
+ # return false
440
+ # end
323
441
  run_output_path = runner.getPathArgumentValue('run_output_path', user_arguments)
324
442
  Dir.mkdir(run_output_path.to_s) unless File.exists?(run_output_path.to_s)
325
- sizing_output_path = File.join(run_output_path.to_s, 'sizing_run')
443
+ sizing_output_path = File.expand_path(File.join(run_output_path.to_s, 'sizing_run'))
326
444
  Dir.mkdir(sizing_output_path.to_s) unless File.exists?(sizing_output_path.to_s)
327
445
 
328
446
  # Change the simulation to only run the sizing days
@@ -351,11 +469,18 @@ class AddChilledWaterStorageTank < OpenStudio::Measure::ModelMeasure
351
469
  File.open(osw_path, 'w') do |f|
352
470
  f << JSON.pretty_generate(osw)
353
471
  end
472
+ model.resetSqlFile
354
473
  run_osw(osw_path)
355
474
  sleep(1)
356
- sql = model.sqlFile
357
- unless sql.is_initialized
358
- model.setSqlFile(OpenStudio::SqlFile.new(OpenStudio::Path.new(File.join(sizing_output_path.to_s, "run", "eplusout.sql"))))
475
+ sql_path = OpenStudio::Path.new(File.join(sizing_output_path.to_s, "run", "eplusout.sql"))
476
+ if OpenStudio.exists(sql_path)
477
+ sql = OpenStudio::SqlFile.new(sql_path)
478
+ unless sql.connectionOpen
479
+ runner.registerError("The sizing run failed without valid a sql file. Look at the eplusout.err file in #{File.dirname(sql_path.to_s)} to see the cause.")
480
+ return false
481
+ end
482
+ # Attach the sql file from the run to the model
483
+ model.setSqlFile(sql)
359
484
  end
360
485
 
361
486
  total_cooling_cap = 0 # initial
@@ -368,6 +493,24 @@ class AddChilledWaterStorageTank < OpenStudio::Measure::ModelMeasure
368
493
  total_cooling_cap += comp.to_ChillerAbsorptionIndirect.get.autosizedNominalCapacity.get
369
494
  end
370
495
  end
496
+ if cw_loop
497
+ # hard size cooling tower in the condenser loop
498
+ cw_loop.supplyComponents.each do |comp|
499
+ if comp.to_CoolingTowerSingleSpeed.is_initialized
500
+ cooling_tower = comp.to_CoolingTowerSingleSpeed.get
501
+ cooling_tower.applySizingValues
502
+ runner.registerInfo("Autosized parameters from the sizing run have been set to CoolingTowerSingleSpeed #{cooling_tower.name}")
503
+ elsif comp.to_CoolingTowerTwoSpeed.is_initialized
504
+ cooling_tower = comp.to_CoolingTowerTwoSpeed.get
505
+ hardsize_cooling_tower_two_speed(cooling_tower)
506
+ runner.registerInfo("Autosized parameters from the sizing run have been set to CoolingTowerTwoSpeed #{cooling_tower.name}")
507
+ elsif comp.to_CoolingTowerVariableSpeed.is_initialized
508
+ cooling_tower = comp.to_CoolingTowerVariableSpeed.get
509
+ cooling_tower.applySizingValues
510
+ runner.registerInfo("Autosized parameters from the sizing run have been set to CoolingTowerVariableSpeed #{cooling_tower.name}")
511
+ end
512
+ end
513
+ end
371
514
 
372
515
  # assuming average load ratio of chiller is 1/3 throughout the day
373
516
  tank_vol = total_cooling_cap/3.0 * 3600 * lasting_hrs / (4182 * 1000 * secondary_delta_t) # heat capacity of water 4182J/kg.K, water density 1000g/m3, lasting 8 hours
@@ -380,7 +523,6 @@ class AddChilledWaterStorageTank < OpenStudio::Measure::ModelMeasure
380
523
 
381
524
  sec_loop = OpenStudio::Model::PlantLoop.new(model)
382
525
  sec_loop.setName("Chilled Water Secondary Loop")
383
- selected_primary_loop = model.getPlantLoopByName("Chilled Water Loop").get
384
526
  selected_primary_loop.setName("Chilled Water Primary Loop")
385
527
  sizing_sec_plant = sec_loop.sizingPlant
386
528
  sizing_sec_plant.setLoopType('Cooling')
@@ -391,21 +533,7 @@ class AddChilledWaterStorageTank < OpenStudio::Measure::ModelMeasure
391
533
  sizing_pri_plant.setDesignLoopExitTemperature(primary_loop_sp)
392
534
  sizing_pri_plant.setLoopDesignTemperatureDifference(primary_delta_t)
393
535
 
394
- # get the condenser water loop
395
- cw_loop = nil
396
- model.getPlantLoops.each do |loop|
397
- if loop.sizingPlant.loopType.to_s.downcase == 'condenser'
398
- cw_loop = loop if cw_loop.nil?
399
- # confirm if this condenser loop contains demand component of chiller that is in the selected_primary_loop
400
- common_comps = cw_loop.demandComponents & selected_primary_loop.supplyComponents
401
- chiller_in_both_loops = false
402
- common_comps.each do |comp|
403
- chiller_in_both_loops = true if comp.to_ChillerElectricEIR.is_initialized || comp.to_ChillerAbsorption.is_initialized || comp.to_ChillerAbsorptionIndirect.is_initialized
404
- end
405
- cw_loop = nil unless chiller_in_both_loops
406
- end
407
- end
408
- # not necessarily can find a cw_loop as the existing primary chiller might be air cooled.
536
+
409
537
 
410
538
  # add chilled water tank to the primary loop as demand and secondary loop as supply
411
539
  chw_storage_tank = OpenStudio::Model::ThermalStorageChilledWaterStratified.new(model)
@@ -19,7 +19,7 @@ class AverageVentilationForPeakHours < OpenStudio::Measure::ModelMeasure
19
19
  end
20
20
  # human readable description of modeling approach
21
21
  def modeler_description
22
- return "The outdoor air flow rate will be reduced by the percentage specified by the user during the peak hours specified by the user. Then the decreased air flow rate will be added to the hours after the peak time."
22
+ return "The outdoor air flow rate will be reduced by the percentage specified by the user during the peak hours specified by the user. Then the decreased air flow rate will be added to the same number of hours before the peak time."
23
23
  end
24
24
  # define the arguments that the user will input
25
25
  def arguments(model)
@@ -34,14 +34,14 @@ class AverageVentilationForPeakHours < OpenStudio::Measure::ModelMeasure
34
34
  start_time = OpenStudio::Measure::OSArgument.makeStringArgument('start_time', false)
35
35
  start_time.setDisplayName('Start Time for the Reduction')
36
36
  start_time.setDescription('In HH:MM:SS format')
37
- start_time.setDefaultValue('14:00:00')
37
+ start_time.setDefaultValue('12:00:00')
38
38
  args << start_time
39
39
 
40
40
  # make an argument for the end time of the reduction
41
41
  end_time = OpenStudio::Measure::OSArgument.makeStringArgument('end_time', false)
42
42
  end_time.setDisplayName('End Time for the Reduction')
43
43
  end_time.setDescription('In HH:MM:SS format')
44
- end_time.setDefaultValue('16:00:00')
44
+ end_time.setDefaultValue('14:00:00')
45
45
  args << end_time
46
46
 
47
47
  # make an argument for the start date of the reduction
@@ -55,7 +55,7 @@ class AverageVentilationForPeakHours < OpenStudio::Measure::ModelMeasure
55
55
  end_date1 = OpenStudio::Ruleset::OSArgument.makeStringArgument('end_date1', false)
56
56
  end_date1.setDisplayName('End Date for Average Ventilation')
57
57
  end_date1.setDescription('In MM-DD format')
58
- end_date1.setDefaultValue('08-01')
58
+ end_date1.setDefaultValue('08-31')
59
59
  args << end_date1
60
60
 
61
61
 
@@ -144,7 +144,8 @@ class AverageVentilationForPeakHours < OpenStudio::Measure::ModelMeasure
144
144
  if oa_sch.empty?
145
145
  new_oa_sch_name = "#{outdoor_air_object.name} fraction schedule"
146
146
  runner.registerInfo("#{outdoor_air_object.name} doesn't have a schedule. A new schedule '#{new_oa_sch_name}' will be added.")
147
- # The fraction schedule cannot have value > 1
147
+ # The fraction schedule cannot have value > 1,
148
+ # so in order to increase the ventilation rate before peak hours, the original base value need to be increased
148
149
  outdoor_air_object.setOutdoorAirFlowperPerson(outdoor_air_object.outdoorAirFlowperPerson * (1+vent_reduce_percent*0.01))
149
150
  outdoor_air_object.setOutdoorAirFlowperFloorArea(outdoor_air_object.outdoorAirFlowperFloorArea * (1+vent_reduce_percent*0.01))
150
151
  outdoor_air_object.setOutdoorAirFlowAirChangesperHour(outdoor_air_object.outdoorAirFlowAirChangesperHour * (1+vent_reduce_percent*0.01))
@@ -156,15 +157,25 @@ class AverageVentilationForPeakHours < OpenStudio::Measure::ModelMeasure
156
157
  h, m, s = end_time.split(':')
157
158
  end_hour = h.to_i + m.to_i/60
158
159
  time_span = end_hour - start_hour
159
- end_hour_2 = end_hour + time_span
160
- if end_hour_2 > 24.0
161
- end_hour_2 -= 24.0
160
+ increase_start_hour = start_hour - time_span
161
+ if increase_start_hour < 0
162
+ increase_start_hour += 24
162
163
  end
163
- if end_hour_2 < start_hour
164
- adjusted_day_data_pairs = [[end_hour_2, 1], [start_hour, percent_back], [end_hour, percent_reduce], [24, 1]]
164
+ if increase_start_hour < start_hour
165
+ adjusted_day_data_pairs = [[increase_start_hour, percent_back], [start_hour, 1], [end_hour, percent_reduce], [24, percent_back]]
165
166
  else
166
- adjusted_day_data_pairs = [[start_hour, percent_back], [end_hour, percent_reduce], [end_hour_2, 1], [24, percent_back]]
167
+ adjusted_day_data_pairs = [[start_hour, 1], [end_hour, percent_reduce], [increase_start_hour, percent_back], [24, 1]]
167
168
  end
169
+ # end_hour_2 = end_hour + time_span
170
+ # if end_hour_2 > 24.0
171
+ # end_hour_2 -= 24.0
172
+ # end
173
+ # if end_hour_2 < start_hour
174
+ # adjusted_day_data_pairs = [[end_hour_2, 1], [start_hour, percent_back], [end_hour, percent_reduce], [24, 1]]
175
+ # else
176
+ # adjusted_day_data_pairs = [[start_hour, percent_back], [end_hour, percent_reduce], [end_hour_2, 1], [24, percent_back]]
177
+ # end
178
+
168
179
  normal_day_data_pairs = [[24, percent_back]]
169
180
  options = { 'name' => new_oa_sch_name,
170
181
  'winter_design_day' => normal_day_data_pairs,