openstudio-common-measures 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +6 -3
  4. data/Rakefile +17 -3
  5. data/lib/measures/AddDaylightSensors/LICENSE.md +27 -0
  6. data/lib/measures/AddDaylightSensors/README.md +136 -0
  7. data/lib/measures/AddDaylightSensors/README.md.erb +42 -0
  8. data/lib/measures/AddDaylightSensors/measure.rb +521 -0
  9. data/lib/measures/AddDaylightSensors/measure.xml +233 -0
  10. data/lib/measures/EnableDemandControlledVentilation/LICENSE.md +27 -0
  11. data/lib/measures/EnableDemandControlledVentilation/README.md +32 -0
  12. data/lib/measures/EnableDemandControlledVentilation/README.md.erb +42 -0
  13. data/lib/measures/EnableDemandControlledVentilation/measure.rb +154 -0
  14. data/lib/measures/EnableDemandControlledVentilation/measure.xml +99 -0
  15. data/lib/measures/EnableEconomizerControl/LICENSE.md +27 -0
  16. data/lib/measures/EnableEconomizerControl/README.md +48 -0
  17. data/lib/measures/EnableEconomizerControl/README.md.erb +42 -0
  18. data/lib/measures/EnableEconomizerControl/measure.rb +172 -0
  19. data/lib/measures/EnableEconomizerControl/measure.xml +124 -0
  20. data/lib/measures/IncreaseInsulationRValueForExteriorWalls/LICENSE.md +27 -0
  21. data/lib/measures/IncreaseInsulationRValueForExteriorWalls/README.md +64 -0
  22. data/lib/measures/IncreaseInsulationRValueForExteriorWalls/README.md.erb +42 -0
  23. data/lib/measures/IncreaseInsulationRValueForExteriorWalls/measure.rb +422 -0
  24. data/lib/measures/IncreaseInsulationRValueForExteriorWalls/measure.xml +150 -0
  25. data/lib/measures/IncreaseInsulationRValueForRoofs/LICENSE.md +27 -0
  26. data/lib/measures/IncreaseInsulationRValueForRoofs/README.md +64 -0
  27. data/lib/measures/IncreaseInsulationRValueForRoofs/README.md.erb +42 -0
  28. data/lib/measures/IncreaseInsulationRValueForRoofs/measure.rb +422 -0
  29. data/lib/measures/IncreaseInsulationRValueForRoofs/measure.xml +143 -0
  30. data/lib/measures/ReduceElectricEquipmentLoadsByPercentage/LICENSE.md +27 -0
  31. data/lib/measures/ReduceElectricEquipmentLoadsByPercentage/README.md +97 -0
  32. data/lib/measures/ReduceElectricEquipmentLoadsByPercentage/README.md.erb +42 -0
  33. data/lib/measures/ReduceElectricEquipmentLoadsByPercentage/measure.rb +450 -0
  34. data/lib/measures/ReduceElectricEquipmentLoadsByPercentage/measure.xml +186 -0
  35. data/lib/measures/ReduceLightingLoadsByPercentage/LICENSE.md +27 -0
  36. data/lib/measures/ReduceLightingLoadsByPercentage/README.md +96 -0
  37. data/lib/measures/ReduceLightingLoadsByPercentage/README.md.erb +42 -0
  38. data/lib/measures/ReduceLightingLoadsByPercentage/measure.rb +513 -0
  39. data/lib/measures/ReduceLightingLoadsByPercentage/measure.xml +191 -0
  40. data/lib/measures/ReduceSpaceInfiltrationByPercentage/LICENSE.md +27 -0
  41. data/lib/measures/ReduceSpaceInfiltrationByPercentage/README.md +104 -0
  42. data/lib/measures/ReduceSpaceInfiltrationByPercentage/README.md.erb +42 -0
  43. data/lib/measures/ReduceSpaceInfiltrationByPercentage/measure.rb +349 -0
  44. data/lib/measures/ReduceSpaceInfiltrationByPercentage/measure.xml +181 -0
  45. data/lib/measures/ReduceVentilationByPercentage/LICENSE.md +27 -0
  46. data/lib/measures/ReduceVentilationByPercentage/README.md +40 -0
  47. data/lib/measures/ReduceVentilationByPercentage/README.md.erb +42 -0
  48. data/lib/measures/ReduceVentilationByPercentage/measure.rb +291 -0
  49. data/lib/measures/ReduceVentilationByPercentage/measure.xml +96 -0
  50. data/lib/measures/add_ems_to_control_ev_charging/{ReadMe.MD → README.md} +0 -0
  51. data/lib/measures/add_ev_load/{ReadMe.MD → README.md} +0 -0
  52. data/lib/measures/create_variable_speed_rtu/LICENSE.md +27 -0
  53. data/lib/measures/create_variable_speed_rtu/README.md +120 -0
  54. data/lib/measures/create_variable_speed_rtu/README.md.erb +42 -0
  55. data/lib/measures/create_variable_speed_rtu/measure.rb +539 -0
  56. data/lib/measures/create_variable_speed_rtu/measure.xml +207 -0
  57. data/lib/measures/generic_qaqc/measure.xml +14 -14
  58. data/lib/measures/generic_qaqc/resources/check_envelope_conductance.rb +7 -1
  59. data/lib/measures/generic_qaqc/resources/check_eui_by_end_use.rb +10 -11
  60. data/lib/measures/openstudio_results/README.md +5 -1
  61. data/lib/measures/openstudio_results/measure.rb +12 -8
  62. data/lib/measures/openstudio_results/measure.xml +56 -36
  63. data/lib/measures/openstudio_results/resources/os_lib_reporting.rb +115 -37
  64. data/lib/measures/openstudio_results/resources/os_lib_schedules.rb +27 -25
  65. data/lib/measures/set_exterior_walls_and_floors_to_adiabatic/README.md +16 -0
  66. data/lib/measures/set_exterior_walls_and_floors_to_adiabatic/measure.rb +32 -1
  67. data/lib/measures/set_exterior_walls_and_floors_to_adiabatic/measure.xml +31 -12
  68. data/lib/measures/view_data/measure.xml +8 -8
  69. data/lib/measures/view_data/resources/va3c.rb +50 -46
  70. data/lib/measures/view_model/resources/va3c.rb +50 -46
  71. data/lib/openstudio/common_measures/version.rb +1 -1
  72. data/openstudio-common-measures.gemspec +2 -2
  73. metadata +59 -9
@@ -150,6 +150,19 @@ module OsLib_Reporting
150
150
  return string
151
151
  end
152
152
 
153
+ # hard code fuel types (for E+ 9.4 shouldn't have it twice, should eventually come form OS)
154
+ def self.fuel_type_names(extended = false)
155
+ # get short or extended list (not using now)
156
+ fuel_types = []
157
+ OpenStudio::EndUseFuelType.getValues.each do |fuel_type|
158
+ # convert integer to string
159
+ fuel_name = OpenStudio::EndUseFuelType.new(fuel_type).valueDescription
160
+ next if fuel_name == 'Water'
161
+ fuel_types << fuel_name
162
+ end
163
+ return fuel_types
164
+ end
165
+
153
166
  # create template section
154
167
  def self.template_section(model, sqlFile, runner, name_only = false, is_ip_units = true)
155
168
  # array to hold tables
@@ -335,7 +348,7 @@ module OsLib_Reporting
335
348
  runner.registerValue(OsLib_Reporting.reg_val_string_prep(display), value, target_units)
336
349
  end
337
350
 
338
- # temp code to check OS vs. E+ area
351
+ # code to check OS vs. E+ area
339
352
  energy_plus_area = query_results.get
340
353
  open_studio_area = model.getBuilding.floorArea
341
354
  if (energy_plus_area - open_studio_area).abs >= 1.0
@@ -375,6 +388,52 @@ module OsLib_Reporting
375
388
  general_building_information[:data] << ['Net Site EUI', value_neat]
376
389
  end
377
390
 
391
+ # TODO: - add total EUI for conditioned floor area if not the same as total. Doesn't seem necessary to also calculate net conditioned EUI if it exists as a unique value.
392
+
393
+ # conditioned building area
394
+ query = 'SELECT Value FROM tabulardatawithstrings WHERE '
395
+ query << "ReportName='AnnualBuildingUtilityPerformanceSummary' and "
396
+ query << "ReportForString='Entire Facility' and "
397
+ query << "TableName='Building Area' and "
398
+ query << "RowName='Net Conditioned Building Area' and "
399
+ query << "ColumnName='Area' and "
400
+ query << "Units='m2';"
401
+ query_results = sqlFile.execAndReturnFirstDouble(query)
402
+ if query_results.empty?
403
+ runner.registerWarning('Did not find value for net conditioned building area.')
404
+ return false
405
+ elsif query_results.get == 0.0
406
+ display_a = 'Conditioned Building Area'
407
+ source_units_a = 'm^2'
408
+ if is_ip_units
409
+ target_units_a = 'ft^2'
410
+ else
411
+ target_units_a = source_units_a
412
+ end
413
+ value_a = OpenStudio.convert(query_results.get, source_units_a, target_units_a).get
414
+ value_neat_a = "#{OpenStudio.toNeatString(value_a, 0, true)} #{target_units_a}"
415
+ runner.registerValue(OsLib_Reporting.reg_val_string_prep(display_a), value_a, target_units_a)
416
+
417
+ # conditioned EUI
418
+ eui = sqlFile.totalSiteEnergy.get / energy_plus_area
419
+ display_e = 'Conditioned Site EUI'
420
+ source_units_e = 'GJ/m^2'
421
+ if is_ip_units
422
+ target_units_e = 'kBtu/ft^2'
423
+ else
424
+ target_units_e = 'kWh/m^2'
425
+ end
426
+ value_e = OpenStudio.convert(eui, source_units_e, target_units_e).get
427
+ value_neat_e = "#{OpenStudio.toNeatString(value_e, 2, true)} #{target_units_e}"
428
+ runner.registerValue(OsLib_Reporting.reg_val_string_prep(display_e), value_e, target_units_e)
429
+
430
+ # always register value, but only add to table if net is different than total
431
+ if energy_plus_area - query_results.get >= 1.0
432
+ general_building_information[:data] << [display_a, value_neat_a]
433
+ general_building_information[:data] << [display_e, value_neat_e]
434
+ end
435
+ end
436
+
378
437
  # get standards building type
379
438
  building_type = 'n/a'
380
439
  if model.getBuilding.standardsBuildingType.is_initialized
@@ -530,17 +589,16 @@ module OsLib_Reporting
530
589
  OpenStudio::EndUseCategoryType.getValues.each do |end_use|
531
590
  # get end uses
532
591
  end_use = OpenStudio::EndUseCategoryType.new(end_use).valueDescription
533
- query_elec = "SELECT Value FROM tabulardatawithstrings WHERE ReportName='AnnualBuildingUtilityPerformanceSummary' and TableName='End Uses' and RowName= '#{end_use}' and ColumnName= 'Electricity'"
534
- query_gas = "SELECT Value FROM tabulardatawithstrings WHERE ReportName='AnnualBuildingUtilityPerformanceSummary' and TableName='End Uses' and RowName= '#{end_use}' and ColumnName= 'Natural Gas'"
535
- query_add = "SELECT Value FROM tabulardatawithstrings WHERE ReportName='AnnualBuildingUtilityPerformanceSummary' and TableName='End Uses' and RowName= '#{end_use}' and ColumnName= 'Additional Fuel'"
536
- query_dc = "SELECT Value FROM tabulardatawithstrings WHERE ReportName='AnnualBuildingUtilityPerformanceSummary' and TableName='End Uses' and RowName= '#{end_use}' and ColumnName= 'District Cooling'"
537
- query_dh = "SELECT Value FROM tabulardatawithstrings WHERE ReportName='AnnualBuildingUtilityPerformanceSummary' and TableName='End Uses' and RowName= '#{end_use}' and ColumnName= 'District Heating'"
538
- results_elec = sqlFile.execAndReturnFirstDouble(query_elec).get
539
- results_gas = sqlFile.execAndReturnFirstDouble(query_gas).get
540
- results_add = sqlFile.execAndReturnFirstDouble(query_add).get
541
- results_dc = sqlFile.execAndReturnFirstDouble(query_dc).get
542
- results_dh = sqlFile.execAndReturnFirstDouble(query_dh).get
543
- total_end_use = results_elec + results_gas + results_add + results_dc + results_dh
592
+
593
+ # loop through fuels
594
+ total_end_use = 0.0
595
+ fuel_type_names.each do |fuel_type|
596
+ query_fuel = "SELECT Value FROM tabulardatawithstrings WHERE ReportName='AnnualBuildingUtilityPerformanceSummary' and TableName='End Uses' and RowName= '#{end_use}' and ColumnName= '#{fuel_type}'"
597
+ results_fuel = sqlFile.execAndReturnFirstDouble(query_fuel).get
598
+ total_end_use += results_fuel
599
+ end
600
+
601
+ # convert value and populate table
544
602
  value = OpenStudio.convert(total_end_use, 'GJ', target_units).get
545
603
  value_neat = OpenStudio.toNeatString(value, 0, true)
546
604
  output_data_end_use[:data] << [end_use, value_neat]
@@ -656,7 +714,19 @@ module OsLib_Reporting
656
714
  color = []
657
715
  color << '#DDCC77' # Electricity
658
716
  color << '#999933' # Natural Gas
659
- color << '#AA4499' # Additional Fuel
717
+
718
+ # not used for 9.4
719
+ # color << '#AA4499' # Additional Fuel
720
+
721
+ # TODO: - new colors to add for 9.4 (for nwo using color of Additional Fuel)
722
+ color << '#AA4499'
723
+ color << '#AA4499'
724
+ color << '#AA4499'
725
+ color << '#AA4499'
726
+ color << '#AA4499'
727
+ color << '#AA4499'
728
+ color << '#AA4499'
729
+
660
730
  color << '#88CCEE' # District Cooling
661
731
  color << '#CC6677' # District Heating
662
732
  # color << "#332288" # Water (not used here but is in cash flow chart)
@@ -664,9 +734,9 @@ module OsLib_Reporting
664
734
 
665
735
  # loop through fuels for consumption tables
666
736
  counter = 0
667
- OpenStudio::EndUseFuelType.getValues.each do |fuel_type|
737
+ fuel_type_names.each do |fuel_type| # OpenStudio::EndUseFuelType.getValues
668
738
  # get fuel type and units
669
- fuel_type = OpenStudio::EndUseFuelType.new(fuel_type).valueDescription
739
+ # fuel_type = OpenStudio::EndUseFuelType.new(fuel_type).valueDescription
670
740
  next if fuel_type == 'Water'
671
741
  query = "SELECT Value FROM tabulardatawithstrings WHERE ReportName='AnnualBuildingUtilityPerformanceSummary' and TableName='End Uses' and RowName= 'Total End Uses' and ColumnName= '#{fuel_type}'"
672
742
  results = sqlFile.execAndReturnFirstDouble(query)
@@ -2458,16 +2528,8 @@ module OsLib_Reporting
2458
2528
  end_use_order = []
2459
2529
  month_order = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
2460
2530
 
2461
- extended_fuel_type_names = []
2462
- standard_fuel_types = []
2463
- OpenStudio::EndUseFuelType.getValues.each do |fuel_type|
2464
- standard_fuel_types << OpenStudio::EndUseFuelType.new(fuel_type).valueDescription
2465
- end
2466
- additional_fuel_types = ['FuelOil#1', 'FuelOil#2', 'PropaneGas', 'Coal', 'Diesel', 'Gasoline', 'OtherFuel1', 'OtherFuel2']
2467
- extended_fuel_type_names = standard_fuel_types + additional_fuel_types
2468
-
2469
2531
  # loop through fuels for consumption tables
2470
- extended_fuel_type_names.each do |fuel_type|
2532
+ fuel_type_names.each do |fuel_type|
2471
2533
  # get fuel type and units
2472
2534
  if fuel_type == 'Electricity'
2473
2535
  units = '"kWh"'
@@ -2509,7 +2571,7 @@ module OsLib_Reporting
2509
2571
  OpenStudio::MonthOfYear.getValues.each do |month|
2510
2572
  if month >= 1 && month <= 12
2511
2573
  valInJ = nil
2512
- if standard_fuel_types.include?(fuel_type)
2574
+ if fuel_type_names.include?(fuel_type)
2513
2575
  if !sqlFile.energyConsumptionByMonth(OpenStudio::EndUseFuelType.new(fuel_type),
2514
2576
  OpenStudio::EndUseCategoryType.new(category_type),
2515
2577
  OpenStudio::MonthOfYear.new(month)).empty?
@@ -2618,9 +2680,8 @@ module OsLib_Reporting
2618
2680
  end
2619
2681
 
2620
2682
  # loop through fuels for peak demand tables
2621
- OpenStudio::EndUseFuelType.getValues.each do |fuel_type|
2683
+ fuel_type_names.each do |fuel_type|
2622
2684
  # get fuel type and units
2623
- fuel_type = OpenStudio::EndUseFuelType.new(fuel_type).valueDescription
2624
2685
  if fuel_type == 'Electricity'
2625
2686
  unit_str = 'kW'
2626
2687
  else
@@ -2916,7 +2977,7 @@ module OsLib_Reporting
2916
2977
 
2917
2978
  end # end of for i in 0..(output_timeseries.size - 1)
2918
2979
  else
2919
- runner.registerWarning("Didn't find data for Zone Air Temperature")
2980
+ runner.registerWarning("Didn't find data for Zone Air Temperature") # not getting triggered when variable missing
2920
2981
  end # end of if output_timeseries.is_initialized
2921
2982
 
2922
2983
  # get unmet hours for each zone from tabular data
@@ -3050,7 +3111,7 @@ module OsLib_Reporting
3050
3111
 
3051
3112
  end # end of for i in 0..(output_timeseries.size - 1)
3052
3113
  else
3053
- runner.registerWarning("Didn't find data for Zone Air Relative Humidity")
3114
+ runner.registerWarning("Didn't find data for Zone Air Relative Humidity") # not getting triggered when variable missing
3054
3115
  end # end of if output_timeseries.is_initialized
3055
3116
 
3056
3117
  # get mean humidity
@@ -3392,24 +3453,24 @@ module OsLib_Reporting
3392
3453
  elec_equip_array.each do |elec_equip|
3393
3454
  if elec_equip.electricEquipmentDefinition.designLevelCalculationMethod == 'Watts/Area'
3394
3455
  if is_ip_units
3395
- ee_power = elec_equip.powerPerFloorArea.to_f * 0.092903 # IP
3456
+ ee_power = elec_equip.electricEquipmentDefinition.wattsperSpaceFloorArea.to_f * 0.092903 # IP
3396
3457
  ee_power = "#{ee_power.round(2)} (W/ft^2)"
3397
3458
  ee_total_power = ((elec_equip.powerPerFloorArea.to_f * space.floorArea))
3398
3459
  else
3399
- ee_power = elec_equip.powerPerFloorArea.to_f
3460
+ ee_power = elec_equip.electricEquipmentDefinition.wattsperSpaceFloorArea.to_f
3400
3461
  ee_power = "#{ee_power.round(2)} (W/m^2)"
3401
3462
  ee_total_power = ((elec_equip.powerPerFloorArea.to_f * space.floorArea))
3402
3463
  end
3403
3464
  end
3404
3465
 
3405
3466
  if elec_equip.electricEquipmentDefinition.designLevelCalculationMethod == 'Watts/Person'
3406
- ee_power = "#{elec_equip.powerPerPerson.to_f.round(2)} (W/person)"
3467
+ ee_power = "#{elec_equip.electricEquipmentDefinition.wattsperPerson .to_f.round(2)} (W/person)"
3407
3468
  ee_total_power = (elec_equip.powerPerPerson.to_f * space.numberOfPeople)
3408
3469
  end
3409
3470
 
3410
3471
  if elec_equip.electricEquipmentDefinition.designLevelCalculationMethod == 'EquipmentLevel'
3411
- ee_power = "#{elec_equip.designLevel.to_f.round(0)} (W)"
3412
- ee_total_power = elec_equip.designLevel.to_f.round(0) * elec_equip.multiplier
3472
+ ee_power = "#{elec_equip.electricEquipmentDefinition.designLevel.to_f.round(0)} (W)"
3473
+ ee_total_power = elec_equip.designLevel.to_f.round(0)
3413
3474
  end
3414
3475
 
3415
3476
  table[:data] << [elec_equip.name, elec_equip.electricEquipmentDefinition.name, ee_power, inheritance_level, elec_equip.multiplier.round(1), ee_total_power.round(0)]
@@ -3594,10 +3655,12 @@ module OsLib_Reporting
3594
3655
  end
3595
3656
 
3596
3657
  # loop through fuel types
3597
- OpenStudio::EndUseFuelType.getValues.each do |fuel_type|
3658
+ fuel_type_names.each do |fuel_type|
3598
3659
  OpenStudio::MonthOfYear.getValues.each do |month|
3599
3660
  if month >= 1 && month <= 12
3600
3661
 
3662
+ if fuel_type == 'Natural Gas' then fuel_type = 'Gas' end
3663
+
3601
3664
  # get cooling value for this fuel and month
3602
3665
  if !sqlFile.energyConsumptionByMonth(OpenStudio::EndUseFuelType.new(fuel_type),
3603
3666
  OpenStudio::EndUseCategoryType.new('Cooling'),
@@ -3686,6 +3749,7 @@ module OsLib_Reporting
3686
3749
  end
3687
3750
 
3688
3751
  else
3752
+ # TODO: - see why this is getting thrown on some models
3689
3753
  runner.registerWarning("Didn't find data for Site Outdoor Air Drybulb Temperature")
3690
3754
  end # end of if output_timeseries.is_initialized
3691
3755
  else
@@ -4704,7 +4768,7 @@ module OsLib_Reporting
4704
4768
  num_warnings += 1
4705
4769
  if num_warnings < start_counter + 25
4706
4770
  measure_table_01[:data] << [step.logMessage]
4707
- else
4771
+ elsif num_warnings == start_counter + 25
4708
4772
  measure_table_01[:data] << ["* See OSW file for full list of warnings. This measure has #{result.warnings.size} warnings."]
4709
4773
  end
4710
4774
  end
@@ -4719,6 +4783,20 @@ module OsLib_Reporting
4719
4783
  end
4720
4784
  end
4721
4785
 
4786
+ # check for warnings in openstudio_results and add table for it if there are warnings.
4787
+ if !runner.result.stepWarnings.empty?
4788
+ measure_table_os_results = {}
4789
+ measure_table_os_results[:title] = 'OpenStudio Results'
4790
+ measure_table_os_results[:header] = ['Warning']
4791
+ measure_table_os_results[:data] = []
4792
+ num_measures_with_warnings += 1
4793
+ runner.result.stepWarnings.each do |warning|
4794
+ measure_table_os_results[:data] << [warning]
4795
+ num_warnings += 1
4796
+ end
4797
+ measure_tables << measure_table_os_results
4798
+ end
4799
+
4722
4800
  # add summary table (even when there are no warnings)
4723
4801
  measure_table_summary = {}
4724
4802
  measure_table_summary[:title] = 'Measure Warning Summary'
@@ -4731,7 +4809,7 @@ module OsLib_Reporting
4731
4809
  measure_table_summary[:data] << ['Total number of warnings', num_warnings]
4732
4810
 
4733
4811
  # add table to section
4734
- measure_tables << measure_table_summary
4812
+ measure_tables.insert(0, measure_table_summary)
4735
4813
 
4736
4814
  runner.registerValue('number_of_measures_with_warnings', num_measures_with_warnings)
4737
4815
  runner.registerValue('number_warnings', num_warnings)
@@ -547,31 +547,33 @@ module OsLib_Schedules
547
547
  end
548
548
 
549
549
  # Rules
550
- options['rules']&.each do |data_array|
551
- rule = OpenStudio::Model::ScheduleRule.new(sch_ruleset)
552
- rule.setName("#{sch_ruleset.name} #{data_array[0]} Rule")
553
- date_range = data_array[1].split('-')
554
- start_date = date_range[0].split('/')
555
- end_date = date_range[1].split('/')
556
- rule.setStartDate(model.getYearDescription.makeDate(start_date[0].to_i, start_date[1].to_i))
557
- rule.setEndDate(model.getYearDescription.makeDate(end_date[0].to_i, end_date[1].to_i))
558
- days = data_array[2].split('/')
559
- rule.setApplySunday(true) if days.include? 'Sun'
560
- rule.setApplyMonday(true) if days.include? 'Mon'
561
- rule.setApplyTuesday(true) if days.include? 'Tue'
562
- rule.setApplyWednesday(true) if days.include? 'Wed'
563
- rule.setApplyThursday(true) if days.include? 'Thu'
564
- rule.setApplyFriday(true) if days.include? 'Fri'
565
- rule.setApplySaturday(true) if days.include? 'Sat'
566
- day_schedule = rule.daySchedule
567
- day_schedule.setName("#{sch_ruleset.name} #{data_array[0]}")
568
- data_array.delete_at(0)
569
- data_array.delete_at(0)
570
- data_array.delete_at(0)
571
- data_array.each do |data_pair|
572
- hour = data_pair[0].truncate
573
- min = ((data_pair[0] - hour) * 60).to_i
574
- day_schedule.addValue(OpenStudio::Time.new(0, hour, min, 0), data_pair[1])
550
+ unless options['rules'].nil?
551
+ options['rules'].each do |data_array|
552
+ rule = OpenStudio::Model::ScheduleRule.new(sch_ruleset)
553
+ rule.setName("#{sch_ruleset.name} #{data_array[0]} Rule")
554
+ date_range = data_array[1].split('-')
555
+ start_date = date_range[0].split('/')
556
+ end_date = date_range[1].split('/')
557
+ rule.setStartDate(model.getYearDescription.makeDate(start_date[0].to_i, start_date[1].to_i))
558
+ rule.setEndDate(model.getYearDescription.makeDate(end_date[0].to_i, end_date[1].to_i))
559
+ days = data_array[2].split('/')
560
+ rule.setApplySunday(true) if days.include? 'Sun'
561
+ rule.setApplyMonday(true) if days.include? 'Mon'
562
+ rule.setApplyTuesday(true) if days.include? 'Tue'
563
+ rule.setApplyWednesday(true) if days.include? 'Wed'
564
+ rule.setApplyThursday(true) if days.include? 'Thu'
565
+ rule.setApplyFriday(true) if days.include? 'Fri'
566
+ rule.setApplySaturday(true) if days.include? 'Sat'
567
+ day_schedule = rule.daySchedule
568
+ day_schedule.setName("#{sch_ruleset.name} #{data_array[0]}")
569
+ data_array.delete_at(0)
570
+ data_array.delete_at(0)
571
+ data_array.delete_at(0)
572
+ data_array.each do |data_pair|
573
+ hour = data_pair[0].truncate
574
+ min = ((data_pair[0] - hour) * 60).to_i
575
+ day_schedule.addValue(OpenStudio::Time.new(0, hour, min, 0), data_pair[1])
576
+ end
575
577
  end
576
578
  end
577
579
 
@@ -75,6 +75,22 @@ ModelMeasure
75
75
  **Required:** true,
76
76
  **Model Dependent:** false
77
77
 
78
+ ### Adiabatic Inclusion List
79
+ Surfaces listed here will be changed to adiabatic boundary condition. This can contain one or more surface names. It is case sensitive and multiple names should be separated with a vertical pipe character like this. |
80
+ **Name:** inclusion_list,
81
+ **Type:** String,
82
+ **Units:** ,
83
+ **Required:** true,
84
+ **Model Dependent:** false
85
+
86
+ ### Adiabatic Exclusion List
87
+ Surfaces listed here will not be changed to adiabatic boundary condition. This can contain one or more surface names. It is case sensitive and multiple names should be separated with a vertical pipe character like this. |
88
+ **Name:** exclusion_list,
89
+ **Type:** String,
90
+ **Units:** ,
91
+ **Required:** true,
92
+ **Model Dependent:** false
93
+
78
94
 
79
95
 
80
96
 
@@ -96,6 +96,20 @@ class SetExteriorWallsAndFloorsToAdiabatic < OpenStudio::Measure::ModelMeasure
96
96
  west_walls.setDefaultValue(false)
97
97
  args << west_walls
98
98
 
99
+ # make an argument for inclusion_list
100
+ inclusion_list = OpenStudio::Measure::OSArgument.makeStringArgument('inclusion_list', true)
101
+ inclusion_list.setDisplayName('Adiabatic Inclusion List')
102
+ inclusion_list.setDescription('Surfaces listed here will be changed to adiabatic boundary condition. This can contain one or more surface names. It is case sensitive and multiple names should be separated with a vertical pipe character like this. |')
103
+ inclusion_list.setDefaultValue('make_me_adiabatic_01|make_me_adiabatic_02')
104
+ args << inclusion_list
105
+
106
+ # make an argument for exclusion_list
107
+ exclusion_list = OpenStudio::Measure::OSArgument.makeStringArgument('exclusion_list', true)
108
+ exclusion_list.setDisplayName('Adiabatic Exclusion List')
109
+ exclusion_list.setDescription('Surfaces listed here will not be changed to adiabatic boundary condition. This can contain one or more surface names. It is case sensitive and multiple names should be separated with a vertical pipe character like this. |')
110
+ exclusion_list.setDefaultValue('do_not_change_me_01|do_not_change_me_02')
111
+ args << exclusion_list
112
+
99
113
  return args
100
114
  end
101
115
 
@@ -117,6 +131,16 @@ class SetExteriorWallsAndFloorsToAdiabatic < OpenStudio::Measure::ModelMeasure
117
131
  east_walls = runner.getBoolArgumentValue('east_walls', user_arguments)
118
132
  west_walls = runner.getBoolArgumentValue('west_walls', user_arguments)
119
133
 
134
+ # split list arguments inoto an array
135
+ inclusion_list = runner.getStringArgumentValue('inclusion_list', user_arguments).split('|')
136
+ exclusion_list = runner.getStringArgumentValue('exclusion_list', user_arguments).split('|')
137
+
138
+ # add warning if same item on inclusion_list and exclusion_list
139
+ common_items = inclusion_list & exclusion_list
140
+ if !common_items.empty?
141
+ runner.registerWarning("One or more items (#{common_items.join(',')}) were on both the inclusion and exclusion list. The exclusion list will take precedence.")
142
+ end
143
+
120
144
  # counter for number of constructions use for interior walls in initial construction
121
145
  orig_adiabatic = 0
122
146
 
@@ -128,7 +152,14 @@ class SetExteriorWallsAndFloorsToAdiabatic < OpenStudio::Measure::ModelMeasure
128
152
  if surface.outsideBoundaryCondition == 'Adiabatic'
129
153
  orig_adiabatic += 1
130
154
  end
131
- if ext_roofs && (surface.surfaceType == 'RoofCeiling') && (surface.outsideBoundaryCondition == 'Outdoors')
155
+
156
+ # stop here if in exclusion list
157
+ next if exclusion_list.include?(surface.name.to_s)
158
+
159
+ if inclusion_list.include?(surface.name.to_s)
160
+ # if on list gets added without having to check orientation
161
+ surfaces_to_change << surface
162
+ elsif ext_roofs && (surface.surfaceType == 'RoofCeiling') && (surface.outsideBoundaryCondition == 'Outdoors')
132
163
  surfaces_to_change << surface
133
164
  elsif ext_floors && (surface.surfaceType == 'Floor') && (surface.outsideBoundaryCondition == 'Outdoors')
134
165
  surfaces_to_change << surface
@@ -1,9 +1,10 @@
1
+ <?xml version="1.0"?>
1
2
  <measure>
2
3
  <schema_version>3.0</schema_version>
3
4
  <name>set_exterior_walls_and_floors_to_adiabatic</name>
4
5
  <uid>63c7f9ba-8c85-4545-bbc0-d25babefb2c3</uid>
5
- <version_id>d8387847-0688-4374-9015-e042536ed932</version_id>
6
- <version_modified>20200229T024320Z</version_modified>
6
+ <version_id>75a958b7-2bf7-496a-80e5-dcae03703541</version_id>
7
+ <version_modified>20200715T184924Z</version_modified>
7
8
  <xml_checksum>5091078B</xml_checksum>
8
9
  <class_name>SetExteriorWallsAndFloorsToAdiabatic</class_name>
9
10
  <display_name>Set Exterior Walls and Floors to Adiabatic</display_name>
@@ -136,9 +137,27 @@
136
137
  </choice>
137
138
  </choices>
138
139
  </argument>
140
+ <argument>
141
+ <name>inclusion_list</name>
142
+ <display_name>Adiabatic Inclusion List</display_name>
143
+ <description>Surfaces listed here will be changed to adiabatic boundary condition. This can contain one or more surface names. It is case sensitive and multiple names should be separated with a vertical pipe character like this. |</description>
144
+ <type>String</type>
145
+ <required>true</required>
146
+ <model_dependent>false</model_dependent>
147
+ <default_value>make_me_adiabatic_01|make_me_adiabatic_02</default_value>
148
+ </argument>
149
+ <argument>
150
+ <name>exclusion_list</name>
151
+ <display_name>Adiabatic Exclusion List</display_name>
152
+ <description>Surfaces listed here will not be changed to adiabatic boundary condition. This can contain one or more surface names. It is case sensitive and multiple names should be separated with a vertical pipe character like this. |</description>
153
+ <type>String</type>
154
+ <required>true</required>
155
+ <model_dependent>false</model_dependent>
156
+ <default_value>do_not_change_me_01|do_not_change_me_02</default_value>
157
+ </argument>
139
158
  </arguments>
140
- <outputs/>
141
- <provenances/>
159
+ <outputs />
160
+ <provenances />
142
161
  <tags>
143
162
  <tag>Envelope.Opaque</tag>
144
163
  </tags>
@@ -167,12 +186,6 @@
167
186
  <usage_type>readmeerb</usage_type>
168
187
  <checksum>703C9964</checksum>
169
188
  </file>
170
- <file>
171
- <filename>README.md</filename>
172
- <filetype>md</filetype>
173
- <usage_type>readme</usage_type>
174
- <checksum>26B5B453</checksum>
175
- </file>
176
189
  <file>
177
190
  <filename>LICENSE.md</filename>
178
191
  <filetype>md</filetype>
@@ -188,13 +201,19 @@
188
201
  <filename>measure.rb</filename>
189
202
  <filetype>rb</filetype>
190
203
  <usage_type>script</usage_type>
191
- <checksum>B401A276</checksum>
204
+ <checksum>D073FC2A</checksum>
192
205
  </file>
193
206
  <file>
194
207
  <filename>set_exterior_walls_and_floors_to_adiabatic_Test.rb</filename>
195
208
  <filetype>rb</filetype>
196
209
  <usage_type>test</usage_type>
197
- <checksum>52BB63BA</checksum>
210
+ <checksum>2078C06A</checksum>
211
+ </file>
212
+ <file>
213
+ <filename>README.md</filename>
214
+ <filetype>md</filetype>
215
+ <usage_type>readme</usage_type>
216
+ <checksum>610E0A71</checksum>
198
217
  </file>
199
218
  </files>
200
219
  </measure>