openstudio-standards 0.2.16 → 0.2.17.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (181) hide show
  1. checksums.yaml +4 -4
  2. data/data/standards/manage_OpenStudio_Standards.rb +31 -4
  3. data/lib/openstudio-standards/btap/geometry.rb +1 -1
  4. data/lib/openstudio-standards/hvac_sizing/Siz.HeatingCoolingFuels.rb +354 -2
  5. data/lib/openstudio-standards/hvac_sizing/Siz.ThermalZone.rb +79 -0
  6. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.College.rb +1 -1
  7. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.Laboratory.rb +1 -1
  8. data/lib/openstudio-standards/prototypes/common/do_not_edit_metaclasses.rb +3313 -0
  9. data/lib/openstudio-standards/prototypes/common/objects/Prototype.Fan.rb +12 -0
  10. data/lib/openstudio-standards/prototypes/common/objects/Prototype.Model.rb +3 -4
  11. data/lib/openstudio-standards/prototypes/common/objects/Prototype.SizingSystem.rb +1 -1
  12. data/lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb +167 -93
  13. data/lib/openstudio-standards/prototypes/common/objects/Prototype.utilities.rb +2 -4
  14. data/lib/openstudio-standards/prototypes/common/prototype_metaprogramming.rb +1 -0
  15. data/lib/openstudio-standards/refs/references.rb +3 -0
  16. data/lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb +279 -6
  17. data/lib/openstudio-standards/standards/Standards.AirTerminalSingleDuctParallelPIUReheat.rb +50 -2
  18. data/lib/openstudio-standards/standards/Standards.ChillerElectricEIR.rb +4 -0
  19. data/lib/openstudio-standards/standards/Standards.CoilCoolingWaterToAirHeatPumpEquationFit.rb +0 -1
  20. data/lib/openstudio-standards/standards/Standards.Construction.rb +185 -3
  21. data/lib/openstudio-standards/standards/Standards.Fan.rb +14 -6
  22. data/lib/openstudio-standards/standards/Standards.HeatExchangerSensLat.rb +1 -0
  23. data/lib/openstudio-standards/standards/Standards.Model.rb +1751 -383
  24. data/lib/openstudio-standards/standards/Standards.PlanarSurface.rb +130 -9
  25. data/lib/openstudio-standards/standards/Standards.PlantLoop.rb +50 -3
  26. data/lib/openstudio-standards/standards/Standards.ScheduleCompact.rb +44 -0
  27. data/lib/openstudio-standards/standards/Standards.ScheduleConstant.rb +27 -0
  28. data/lib/openstudio-standards/standards/Standards.ScheduleRuleset.rb +543 -0
  29. data/lib/openstudio-standards/standards/Standards.Space.rb +665 -15
  30. data/lib/openstudio-standards/standards/Standards.SpaceType.rb +141 -4
  31. data/lib/openstudio-standards/standards/Standards.SubSurface.rb +2 -1
  32. data/lib/openstudio-standards/standards/Standards.Surface.rb +117 -0
  33. data/lib/openstudio-standards/standards/Standards.ThermalZone.rb +197 -49
  34. data/lib/openstudio-standards/standards/Standards.ZoneHVACComponent.rb +41 -0
  35. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2004/ashrae_90_1_2004.Model.rb +6 -8
  36. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2004/comstock_ashrae_90_1_2004/data/ashrae_90_1.schedules.json +45 -45
  37. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2004/comstock_ashrae_90_1_2004/data/comstock_ashrae_90_1_2004.spc_typ.json +7 -7
  38. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2007/comstock_ashrae_90_1_2007/data/ashrae_90_1.schedules.json +45 -45
  39. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2007/comstock_ashrae_90_1_2007/data/comstock_ashrae_90_1_2007.spc_typ.json +7 -7
  40. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2010/comstock_ashrae_90_1_2010/data/ashrae_90_1.schedules.json +45 -45
  41. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2010/comstock_ashrae_90_1_2010/data/comstock_ashrae_90_1_2010.spc_typ.json +9 -9
  42. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2013/comstock_ashrae_90_1_2013/data/ashrae_90_1.schedules.json +45 -45
  43. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2013/comstock_ashrae_90_1_2013/data/comstock_ashrae_90_1_2013.spc_typ.json +4 -4
  44. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2016/comstock_ashrae_90_1_2016/data/ashrae_90_1.schedules.json +45 -45
  45. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2016/comstock_ashrae_90_1_2016/data/comstock_ashrae_90_1_2016.spc_typ.json +5 -5
  46. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2019/ashrae_90_1_2019.AirLoopHVAC.rb +5 -5
  47. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2019/comstock_ashrae_90_1_2019/data/ashrae_90_1.schedules.json +45 -45
  48. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2019/comstock_ashrae_90_1_2019/data/comstock_ashrae_90_1_2019.spc_typ.json +5 -5
  49. data/lib/openstudio-standards/standards/ashrae_90_1/data/ashrae_90_1.constructions.json +2 -2
  50. data/lib/openstudio-standards/standards/ashrae_90_1/data/ashrae_90_1.fans.json +12 -0
  51. data/lib/openstudio-standards/standards/ashrae_90_1/doe_ref_1980_2004/comstock_doe_ref_1980_2004/data/ashrae_90_1.schedules.json +45 -45
  52. data/lib/openstudio-standards/standards/ashrae_90_1/doe_ref_1980_2004/comstock_doe_ref_1980_2004/data/comstock_doe_ref_1980_2004.spc_typ.json +10 -10
  53. data/lib/openstudio-standards/standards/ashrae_90_1/doe_ref_pre_1980/comstock_doe_ref_pre_1980/data/ashrae_90_1.schedules.json +45 -45
  54. data/lib/openstudio-standards/standards/ashrae_90_1/doe_ref_pre_1980/comstock_doe_ref_pre_1980/data/comstock_doe_ref_pre_1980.spc_typ.json +10 -10
  55. data/lib/openstudio-standards/standards/ashrae_90_1/nrel_zne_ready_2017/nrel_zne_ready_2017.AirLoopHVAC.rb +1 -0
  56. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.AirLoopHVAC.rb +792 -0
  57. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.AirTerminalSingleDuctParallelPIUReheat.rb +10 -0
  58. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.AirTerminalSingleDuctVAVReheat.rb +31 -0
  59. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.BoilerHotWater.rb +91 -0
  60. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.ChillerElectricEIR.rb +84 -0
  61. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.CoilCoolingDXSingleSpeed.rb +145 -0
  62. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.CoilCoolingDXTwoSpeed.rb +106 -0
  63. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.CoilDX.rb +71 -0
  64. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.CoilHeatingDXSingleSpeed.rb +194 -0
  65. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.CoilHeatingGas.rb +120 -0
  66. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.CoolingTower.rb +110 -0
  67. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.CoolingTowerVariableSpeed.rb +5 -0
  68. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.Fan.rb +73 -0
  69. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.FanConstantVolume.rb +5 -0
  70. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.FanOnOff.rb +5 -0
  71. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.FanVariableVolume.rb +24 -0
  72. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.FanZoneExhaust.rb +5 -0
  73. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.HeatExchangerSensLat.rb +55 -0
  74. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.Model.rb +3045 -0
  75. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.PlanarSurface.rb +187 -0
  76. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.PlantLoop.rb +450 -0
  77. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.Space.rb +106 -0
  78. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.SpaceType.rb +666 -0
  79. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.Surface.rb +54 -0
  80. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.ThermalZone.rb +168 -0
  81. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.ZoneHVACComponent.rb +132 -0
  82. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.rb +239 -0
  83. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/ashrae_90_1_prm_2019.Model.rb +176 -0
  84. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/ashrae_90_1_prm_2019.rb +25 -0
  85. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.boilers.json +52 -0
  86. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.chillers.json +112 -0
  87. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.climate_zone_sets.json +210 -0
  88. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.construction_properties.json +10384 -0
  89. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.construction_sets.json +133 -0
  90. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.furnaces.json +43 -0
  91. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.heat_pumps.json +119 -0
  92. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.heat_pumps_heating.json +130 -0
  93. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.heat_rejection.json +13 -0
  94. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.lpd_space_type.json +568 -0
  95. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.motors.json +264 -0
  96. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.prm_baseline_hvac.json +439 -0
  97. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.prm_constructions.json +685 -0
  98. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.prm_economizers.json +213 -0
  99. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.prm_ext_ltg.json +32 -0
  100. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.prm_heat_type.json +136 -0
  101. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.prm_hvac_bldg_type.json +32 -0
  102. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.prm_interior_lighting.json +1837 -0
  103. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.prm_swh_bldg_type.json +184 -0
  104. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.prm_wwr_bldg_type.json +84 -0
  105. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.unitary_acs.json +148 -0
  106. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.water_heaters.json +157 -0
  107. data/lib/openstudio-standards/standards/ashrae_90_1_prm/data/ashrae_90_1_prm.climate_zone_sets.json +210 -0
  108. data/lib/openstudio-standards/standards/ashrae_90_1_prm/data/ashrae_90_1_prm.curves.json +18329 -0
  109. data/lib/openstudio-standards/standards/ashrae_90_1_prm/data/ashrae_90_1_prm.fans.json +340 -0
  110. data/lib/openstudio-standards/standards/ashrae_90_1_prm/data/ashrae_90_1_prm.materials.json +49924 -0
  111. data/lib/openstudio-standards/standards/ashrae_90_1_prm/docs/baseline_building_rotation_exception.md +44 -0
  112. data/lib/openstudio-standards/standards/ashrae_90_1_prm/docs/check_pump_power_and_control.md +71 -0
  113. data/lib/openstudio-standards/standards/ashrae_90_1_prm/docs/dcv.md +68 -0
  114. data/lib/openstudio-standards/standards/ashrae_90_1_prm/docs/dcv_implementation.png +0 -0
  115. data/lib/openstudio-standards/standards/ashrae_90_1_prm/docs/elevators.md +14 -0
  116. data/lib/openstudio-standards/standards/ashrae_90_1_prm/docs/exhaust_air_energy_recovery.md +36 -0
  117. data/lib/openstudio-standards/standards/ashrae_90_1_prm/docs/f_c_factors.md +19 -0
  118. data/lib/openstudio-standards/standards/ashrae_90_1_prm/docs/fan_power_credits.md +15 -0
  119. data/lib/openstudio-standards/standards/ashrae_90_1_prm/docs/preheat_coil.md +59 -0
  120. data/lib/openstudio-standards/standards/ashrae_90_1_prm/docs/pump_power_control.md +46 -0
  121. data/lib/openstudio-standards/standards/ashrae_90_1_prm/docs/return_air_type.md +31 -0
  122. data/lib/openstudio-standards/standards/ashrae_90_1_prm/docs/set_baseline_wwr.md +191 -0
  123. data/lib/openstudio-standards/standards/ashrae_90_1_prm/docs/set_hw_and_chw_supply_water_temp_reset_control.md +24 -0
  124. data/lib/openstudio-standards/standards/ashrae_90_1_prm/docs/set_num_boilers_chillers_towers.md +49 -0
  125. data/lib/openstudio-standards/standards/ashrae_90_1_prm/docs/set_plug_load_measures.md +80 -0
  126. data/lib/openstudio-standards/standards/ashrae_90_1_prm/docs/set_space_lpd.md +73 -0
  127. data/lib/openstudio-standards/standards/ashrae_90_1_prm/docs/unenclosed_and_unconditioned_spaces.md +11 -0
  128. data/lib/openstudio-standards/standards/ashrae_90_1_prm/docs/unmet_load_hours.md +20 -0
  129. data/lib/openstudio-standards/standards/ashrae_90_1_prm/docs/vav_parallel_piu_terminals_fan_control.md +23 -0
  130. data/lib/openstudio-standards/standards/ashrae_90_1_prm/docs/vav_terminals_min_flow_setpoint.md +21 -0
  131. data/lib/openstudio-standards/standards/ashrae_90_1_prm/userdata_csv/userdata_airloop_hvac.csv +1 -0
  132. data/lib/openstudio-standards/standards/ashrae_90_1_prm/userdata_csv/userdata_airloop_hvac_doas.csv +1 -0
  133. data/lib/openstudio-standards/standards/ashrae_90_1_prm/userdata_csv/userdata_building.csv +1 -0
  134. data/lib/openstudio-standards/standards/ashrae_90_1_prm/userdata_csv/userdata_design_specification_outdoor_air.csv +1 -0
  135. data/lib/openstudio-standards/standards/ashrae_90_1_prm/userdata_csv/userdata_electric_equipment.csv +1 -0
  136. data/lib/openstudio-standards/standards/ashrae_90_1_prm/userdata_csv/userdata_exterior_lights.csv +1 -0
  137. data/lib/openstudio-standards/standards/ashrae_90_1_prm/userdata_csv/userdata_gas_equipment.csv +1 -0
  138. data/lib/openstudio-standards/standards/ashrae_90_1_prm/userdata_csv/userdata_lights.csv +1 -0
  139. data/lib/openstudio-standards/standards/ashrae_90_1_prm/userdata_csv/userdata_space.csv +1 -0
  140. data/lib/openstudio-standards/standards/ashrae_90_1_prm/userdata_csv/userdata_spacetype.csv +1 -0
  141. data/lib/openstudio-standards/standards/ashrae_90_1_prm/userdata_csv/userdata_thermal_zone.csv +1 -0
  142. data/lib/openstudio-standards/standards/ashrae_90_1_prm/userdata_csv/userdata_wateruse_connections.csv +1 -0
  143. data/lib/openstudio-standards/standards/ashrae_90_1_prm/userdata_csv/userdata_wateruse_equipment.csv +1 -0
  144. data/lib/openstudio-standards/standards/ashrae_90_1_prm/userdata_csv/userdata_wateruse_equipment_definition.csv +1 -0
  145. data/lib/openstudio-standards/standards/ashrae_90_1_prm/userdata_csv/userdata_zone_hvac.csv +1 -0
  146. data/lib/openstudio-standards/standards/ashrae_90_1_prm/userdata_csv/userdata_zone_infiltration.csv +1 -0
  147. data/lib/openstudio-standards/standards/cbes/data/cbes.fans.json +12 -0
  148. data/lib/openstudio-standards/standards/deer/data/deer.fans.json +12 -0
  149. data/lib/openstudio-standards/standards/necb/ECMS/data/heat_pumps.json +1 -1
  150. data/lib/openstudio-standards/standards/necb/ECMS/data/heat_pumps_heating.json +1 -1
  151. data/lib/openstudio-standards/standards/necb/ECMS/data/unitary_acs.json +24 -11
  152. data/lib/openstudio-standards/standards/necb/ECMS/erv.rb +13 -15
  153. data/lib/openstudio-standards/standards/necb/NECB2011/data/province_map.json +17 -0
  154. data/lib/openstudio-standards/standards/necb/NECB2011/hvac_system_3_and_8_multi_speed.rb +1 -1
  155. data/lib/openstudio-standards/standards/necb/NECB2011/hvac_system_3_and_8_single_speed.rb +1 -1
  156. data/lib/openstudio-standards/standards/necb/NECB2011/hvac_system_4.rb +2 -2
  157. data/lib/openstudio-standards/standards/necb/NECB2011/hvac_system_6.rb +6 -5
  158. data/lib/openstudio-standards/standards/necb/NECB2011/hvac_systems.rb +3 -2
  159. data/lib/openstudio-standards/standards/necb/NECB2011/necb_2011.rb +2 -3
  160. data/lib/openstudio-standards/standards/necb/NECB2020/data/chillers.json +2 -2
  161. data/lib/openstudio-standards/standards/necb/NECB2020/data/space_types.json +33 -924
  162. data/lib/openstudio-standards/standards/necb/NECB2020/data/unitary_acs.json +15 -15
  163. data/lib/openstudio-standards/standards/necb/common/btap_data.rb +135 -29
  164. data/lib/openstudio-standards/standards/necb/common/btap_datapoint.rb +16 -4
  165. data/lib/openstudio-standards/standards/necb/common/neb_end_use_prices.csv +40 -42
  166. data/lib/openstudio-standards/standards/necb/common/necb_reference_runs.csv +1 -1
  167. data/lib/openstudio-standards/standards/necb/common/space_type_upgrade_map.json +89 -89
  168. data/lib/openstudio-standards/utilities/array.rb +11 -0
  169. data/lib/openstudio-standards/utilities/logging.rb +48 -0
  170. data/lib/openstudio-standards/utilities/object_info.rb +20 -0
  171. data/lib/openstudio-standards/utilities/schedule_translator.rb +348 -0
  172. data/lib/openstudio-standards/utilities/sqlfile.rb +68 -0
  173. data/lib/openstudio-standards/version.rb +2 -2
  174. data/lib/openstudio-standards/weather/Weather.Model.rb +42 -55
  175. data/lib/openstudio-standards/weather/Weather.stat_file.rb +1 -1
  176. data/lib/openstudio-standards.rb +35 -1
  177. metadata +111 -6
  178. data/data/standards/OpenStudio_Standards-ashrae_90_1.xlsx +0 -0
  179. data/data/standards/OpenStudio_Standards-ashrae_90_1_28Jan2022.xlsx +0 -0
  180. data/data/standards/OpenStudio_Standards-ashrae_90_1_28_Jan2022_2.xlsx +0 -0
  181. data/data/standards/openstudio_standards_duplicates_log.csv +0 -143
@@ -115,6 +115,42 @@ class Standard
115
115
  return annual_flh
116
116
  end
117
117
 
118
+ # Returns the min and max value in a design day (heating or cooling) from a ruleset schedule
119
+ #
120
+ # @author Weili Xu, PNNL.
121
+ # @param schedule_ruleset [OpenStudio::Model::ScheduleRuleset] schedule ruleset object
122
+ # @param type [String] 'winter' will enable the winter design day search, 'summer' enables summer design day search
123
+ # @return [Hash] Hash has two keys, min and max.
124
+ def schedule_ruleset_design_day_min_max_value(schedule_ruleset, type = 'winter')
125
+ if type == 'winter'
126
+ schedule = schedule_ruleset.winterDesignDaySchedule
127
+ elsif type == 'summer'
128
+ schedule = schedule_ruleset.summerDesignDaySchedule
129
+ end
130
+
131
+ if !schedule
132
+ OpenStudio.logFree(OpenStudio::Warn, 'OpenStudio::Model::ScheduleRuleset', "#{schedule_ruleset.name} is missing #{type} design day schedule, use default day schedule to process the min max search")
133
+ schedule = schedule_ruleset.defaultDaySchedule
134
+ end
135
+
136
+ min = nil
137
+ max = nil
138
+ schedule.values.each do |value|
139
+ if min.nil?
140
+ min = value
141
+ else
142
+ min = value if min > value
143
+ end
144
+ if max.nil?
145
+ max = value
146
+ else
147
+ max = value if max < value
148
+ end
149
+ end
150
+
151
+ return { 'min' => min, 'max' => max }
152
+ end
153
+
118
154
  # Returns the min and max value for this schedule.
119
155
  # It doesn't evaluate design days only run-period conditions
120
156
  #
@@ -606,6 +642,513 @@ class Standard
606
642
  return true
607
643
  end
608
644
 
645
+ #
646
+ # Return Array of weekday values from Array of all day values
647
+ # @author Xuechen (Jerry) Lei, PNNL
648
+ # @param model [OpenStudio::model::Model] OpenStudio model object
649
+ # @param values [Array] hourly time-series values of all days
650
+ # @param value_includes_holiday [Bool] whether the input values include a day of holiday at the end of the array
651
+ #
652
+ # @return [Array] hourly time-series values in weekdays
653
+ #
654
+ def get_weekday_values_from_8760(model, values, value_includes_holiday = true)
655
+ start_day = model.getYearDescription.dayofWeekforStartDay
656
+ start_day_map = {
657
+ 'Sunday' => 0,
658
+ 'Monday' => 1,
659
+ 'Tuesday' => 2,
660
+ 'Wednesday' => 3,
661
+ 'Thursday' => 4,
662
+ 'Friday' => 5,
663
+ 'Saturday' => 6
664
+ }
665
+ start_day_num = start_day_map[start_day]
666
+ weekday_values = []
667
+ day_of_week = start_day_num
668
+ num_of_days = values.size / 24
669
+ if value_includes_holiday
670
+ num_of_days -= 1
671
+ end
672
+
673
+ for day_i in 1..num_of_days do
674
+ if day_of_week >= 1 && day_of_week <= 5
675
+ weekday_values += values.slice!(0, 24)
676
+ end
677
+ day_of_week += 1
678
+ # reset day of week
679
+ if day_of_week == 7
680
+ day_of_week = 0
681
+ end
682
+ end
683
+
684
+ return weekday_values
685
+ end
686
+
687
+ # Create a sequential array of values from a ScheduleReset object
688
+ # Will actually include 24 extra values if model year is a leap year
689
+ # Will also include 24 values at end of array representing the holiday day schedule
690
+ # Intended use is for storing fan schedules to hash of ZoneName:SchedArray so schedules
691
+ # can be saved when HVAC objects are deleted
692
+ # @author Doug Maddox, PNNL
693
+ # @param [object] model
694
+ # @param [Object] schedule_ruleset
695
+ # @return [Array<Double>] Array of sequential hourly values for year + 24 hours at end for holiday
696
+ def get_8760_values_from_schedule_ruleset(model, schedule_ruleset)
697
+ yd = model.getYearDescription
698
+ start_date = yd.makeDate(1, 1)
699
+ end_date = yd.makeDate(12, 31)
700
+
701
+ day_of_week = start_date.dayOfWeek.valueName
702
+
703
+ values = OpenStudio::DoubleVector.new
704
+ day = OpenStudio::Time.new(1.0)
705
+ interval = OpenStudio::Time.new(1.0 / 24.0)
706
+ day_schedules = schedule_ruleset.to_ScheduleRuleset.get.getDaySchedules(start_date, end_date)
707
+
708
+ numdays = day_schedules.size
709
+
710
+ # Get holiday schedule and append to end of values array
711
+ day_schedule_holiday = nil
712
+ schedule_ruleset.to_ScheduleRuleset.get.scheduleRules.each do |week_rule|
713
+ # If a holiday day type is defined, then store the schedule object for the first occurrence
714
+ # For now this is not implemented into the 8760 array
715
+ # if week_rule.applyHoliday
716
+ # day_schedule_holiday = week_rule.daySchedule
717
+ # break
718
+ # end
719
+ end
720
+ if day_schedule_holiday.nil?
721
+ day_schedule_holiday = schedule_ruleset.to_ScheduleRuleset.get.defaultDaySchedule
722
+ end
723
+ # Currently holidaySchedule is not working in SDK in ScheduleRuleset object
724
+ # TODO: enable the following lines when holidaySchedule is available
725
+ # if !schedule_ruleset.isHolidayScheduleDefaulted
726
+ # day_schedule = schedule_ruleset.to_ScheduleRuleset.get.holidaySchedule
727
+ # else
728
+ # day_schedule = schedule_ruleset.to_ScheduleRuleset.get.defaultSchedule
729
+ # end
730
+
731
+ # Make new array of day schedules for year, and add holiday day schedule to end
732
+ day_sched_array = []
733
+ day_schedules.each do |day_schedule|
734
+ day_sched_array << day_schedule
735
+ end
736
+
737
+ day_sched_array << day_schedule_holiday
738
+ numdays = day_schedules.size
739
+
740
+ day_sched_array.each do |day_schedule|
741
+ current_hour = interval
742
+ time_values = day_schedule.times
743
+ num_times = time_values.size
744
+ value_sum = 0
745
+ value_count = 0
746
+ time_values.each do |until_hr|
747
+ if until_hr < current_hour
748
+ # Add to tally for next hour average
749
+ value_sum += day_schedule.getValue(until_hr).to_f
750
+ value_count += 1
751
+ elsif until_hr >= current_hour + interval
752
+ # Loop through hours to catch current hour up to until_hr
753
+ while current_hour <= until_hr
754
+ values << day_schedule.getValue(until_hr).to_f
755
+ current_hour += interval
756
+ end
757
+
758
+ if (current_hour - until_hr) < interval
759
+ # This means until_hr is not an even hour break
760
+ # i.e. there is a sub-hour time step
761
+ # Increment the sum for averaging
762
+ value_sum += day_schedule.getValue(until_hr).to_f
763
+ value_count += 1
764
+ end
765
+
766
+ else
767
+ # Add to tally for this hour average
768
+ value_sum += day_schedule.getValue(until_hr).to_f
769
+ value_count += 1
770
+ # Calc hour average
771
+ if value_count > 0
772
+ value_avg = value_sum / value_count
773
+ else
774
+ value_avg = 0
775
+ end
776
+ values << value_avg
777
+ # setup for next hour
778
+ value_sum = 0
779
+ value_count = 0
780
+ current_hour += interval
781
+ end
782
+ end
783
+ end
784
+
785
+ return values
786
+ end
787
+
788
+ # Create a ScheduleRuleset object from an 8760 sequential array of values for a
789
+ # Values array will actually include 24 extra values if model year is a leap year
790
+ # Values array will also include 24 values at end of array representing the holiday day schedule
791
+ # @author Doug Maddox, PNNL
792
+ # @param model [Object]
793
+ # @param values [Array<Double>] array of annual values (8760 +/ 24) + holiday values (24)
794
+ # @param sch_name [String] name of schedule to be created
795
+ # @param sch_type_limits [Object] ScheduleTypeLimits object
796
+ # @return [Object] ScheduleRuleset
797
+ def make_ruleset_sched_from_8760(model, values, sch_name, sch_type_limits)
798
+ # Build array of arrays: each top element is a week, each sub element is an hour of week
799
+ all_week_values = []
800
+ hr_of_yr = -1
801
+ (0..51).each do |iweek|
802
+ week_values = []
803
+ (0..167).each do |hr_of_wk|
804
+ hr_of_yr += 1
805
+ week_values[hr_of_wk] = values[hr_of_yr]
806
+ end
807
+ all_week_values << week_values
808
+ end
809
+
810
+ # Extra week for days 365 and 366 (if applicable) of year
811
+ # since 52 weeks is 364 days
812
+ hr_of_yr += 1
813
+ last_hr = values.size - 1
814
+ iweek = 52
815
+ week_values = []
816
+ hr_of_wk = -1
817
+ (hr_of_yr..last_hr).each do |ihr_of_yr|
818
+ hr_of_wk += 1
819
+ week_values[hr_of_wk] = values[ihr_of_yr]
820
+ end
821
+ all_week_values << week_values
822
+
823
+ # Build ruleset schedules for first week
824
+ yd = model.getYearDescription
825
+ start_date = yd.makeDate(1, 1)
826
+ one_day = OpenStudio::Time.new(1.0)
827
+ seven_days = OpenStudio::Time.new(7.0)
828
+ end_date = start_date + seven_days - one_day
829
+
830
+ # Create new ruleset schedule
831
+ sch_ruleset = OpenStudio::Model::ScheduleRuleset.new(model)
832
+ sch_ruleset.setName(sch_name)
833
+ sch_ruleset.setScheduleTypeLimits(sch_type_limits)
834
+
835
+ # Make week schedule for first week
836
+ num_week_scheds = 1
837
+ week_sch_name = sch_name + '_ws' + num_week_scheds.to_s
838
+ week_1_rules = make_week_ruleset_sched_from_168(model, sch_ruleset, all_week_values[1], start_date, end_date, week_sch_name)
839
+ week_n_rules = week_1_rules
840
+ all_week_rules = []
841
+ all_week_rules << week_1_rules
842
+ iweek_previous_week_rule = 0
843
+
844
+ # temporary loop for debugging
845
+ week_n_rules.each do |sch_rule|
846
+ day_rule = sch_rule.daySchedule
847
+ xtest = 1
848
+ end
849
+
850
+ # For each subsequent week, check if it is same as previous
851
+ # If same, then append to Schedule:Rule of previous week
852
+ # If different, then create new Schedule:Rule
853
+ (1..51).each do |iweek|
854
+ is_a_match = true
855
+ start_date = end_date + one_day
856
+ end_date += seven_days
857
+ (0..167).each do |ihr|
858
+ if all_week_values[iweek][ihr] != all_week_values[iweek_previous_week_rule][ihr]
859
+ is_a_match = false
860
+ break
861
+ end
862
+ end
863
+ if is_a_match
864
+ # Update the end date for the Rules of the previous week to include this week
865
+ all_week_rules[iweek_previous_week_rule].each do |sch_rule|
866
+ sch_rule.setEndDate(end_date)
867
+ end
868
+ else
869
+ # Create a new week schedule for this week
870
+ num_week_scheds += 1
871
+ week_sch_name = sch_name + '_ws' + num_week_scheds.to_s
872
+ week_n_rules = make_week_ruleset_sched_from_168(model, sch_ruleset, all_week_values[iweek], start_date, end_date, week_sch_name)
873
+ all_week_rules << week_n_rules
874
+ # Set this week as the reference for subsequent weeks
875
+ iweek_previous_week_rule = iweek
876
+ end
877
+ end
878
+
879
+ # temporary loop for debugging
880
+ week_n_rules.each do |sch_rule|
881
+ day_rule = sch_rule.daySchedule
882
+ xtest = 1
883
+ end
884
+
885
+ # Need to handle week 52 with days 365 and 366
886
+ # For each of these days, check if it matches a day from the previous week
887
+ iweek = 52
888
+ # First handle day 365
889
+ end_date += one_day
890
+ start_date = end_date
891
+ match_was_found = false
892
+ # week_n is the previous week
893
+ week_n_rules.each do |sch_rule|
894
+ day_rule = sch_rule.daySchedule
895
+ is_match = true
896
+ # Need a 24 hour array of values for the day rule
897
+ ihr_start = 0
898
+ day_values = []
899
+ day_rule.times.each do |time|
900
+ now_value = day_rule.getValue(time).to_f
901
+ until_ihr = time.totalHours.to_i - 1
902
+ (ihr_start..until_ihr).each do |ihr|
903
+ day_values << now_value
904
+ end
905
+ end
906
+ (0..23).each do |ihr|
907
+ if day_values[ihr] != all_week_values[iweek][ihr + ihr_start]
908
+ # not matching for this day_rule
909
+ is_match = false
910
+ break
911
+ end
912
+ end
913
+ if is_match
914
+ match_was_found = true
915
+ # Extend the schedule period to include this day
916
+ sch_rule.setEndDate(end_date)
917
+ break
918
+ end
919
+ end
920
+ if match_was_found == false
921
+ # Need to add a new rule
922
+ day_of_week = start_date.dayOfWeek.valueName
923
+ day_names = [day_of_week]
924
+ day_sch_name = sch_name + '_Day_365'
925
+ day_sch_values = []
926
+ (0..23).each do |ihr|
927
+ day_sch_values << all_week_values[iweek][ihr]
928
+ end
929
+ # sch_rule is a sub-component of the ScheduleRuleset
930
+ sch_rule = add_one_ruleset_sch_rule(model, sch_ruleset, start_date, end_date, day_sch_values, day_sch_name, day_names)
931
+ week_n_rules = sch_rule
932
+ end
933
+
934
+ # Handle day 366, if leap year
935
+ # Last day in this week is the holiday schedule
936
+ # If there are three days in this week, then the second is day 366
937
+ if all_week_values[iweek].size == 24 * 3
938
+ ihr_start = 23
939
+ end_date += one_day
940
+ start_date = end_date
941
+ match_was_found = false
942
+ # week_n is the previous week
943
+ # which would be the week based on day 356, if that was its own week
944
+ week_n_rules.each do |sch_rule|
945
+ day_rule = sch_rule.daySchedule
946
+ is_match = true
947
+ day_rule.times.each do |ihr|
948
+ if day_rule.getValue(ihr).to_f != all_week_values[iweek][ihr + ihr_start]
949
+ # not matching for this day_rule
950
+ is_match = false
951
+ break
952
+ end
953
+ end
954
+ if is_match
955
+ match_was_found = true
956
+ # Extend the schedule period to include this day
957
+ sch_rule.setEndDate(OpenStudio::Date.new(OpenStudio::MonthOfYear.new(end_date.month.to_i), end_date.day.to_i))
958
+ break
959
+ end
960
+ end
961
+ if match_was_found == false
962
+ # Need to add a new rule
963
+ # sch_rule is a sub-component of the ScheduleRuleset
964
+
965
+ day_of_week = start_date.dayOfWeek.valueName
966
+ day_names = [day_of_week]
967
+ day_sch_name = sch_name + '_Day_366'
968
+ day_sch_values = []
969
+ (0..23).each do |ihr|
970
+ day_sch_values << all_week_values[iweek][ihr]
971
+ end
972
+ sch_rule = add_one_ruleset_sch_rule(model, sch_ruleset, start_date, end_date, day_sch_values, day_sch_name, day_names)
973
+ week_n_rules = sch_rule
974
+ end
975
+
976
+ # Last day in values array is the holiday schedule
977
+ # TODO: add holiday schedule when implemented in OpenStudio SDK
978
+ end
979
+
980
+ # Need to handle design days
981
+ # Find schedule with the most operating hours in a day,
982
+ # and apply that to both cooling and heating design days
983
+ hr_of_yr = -1
984
+ max_eflh = 0
985
+ ihr_max = -1
986
+ (0..364).each do |iday|
987
+ eflh = 0
988
+ ihr_start = hr_of_yr + 1
989
+ (0..23).each do |ihr|
990
+ hr_of_yr += 1
991
+ eflh += 1 if values[hr_of_yr] > 0
992
+ end
993
+ if eflh > max_eflh
994
+ max_eflh = eflh
995
+ # store index to first hour of day with max on hours
996
+ ihr_max = ihr_start
997
+ end
998
+ end
999
+ # Create the schedules for the design days
1000
+ day_sch = OpenStudio::Model::ScheduleDay.new(model)
1001
+ day_sch.setName(sch_name + 'Winter Design Day')
1002
+ (0..23).each do |ihr|
1003
+ hr_of_yr = ihr_max + ihr
1004
+ next if values[hr_of_yr] == values[hr_of_yr + 1]
1005
+
1006
+ day_sch.addValue(OpenStudio::Time.new(0, ihr + 1, 0, 0), values[hr_of_yr])
1007
+ end
1008
+ sch_ruleset.setWinterDesignDaySchedule(day_sch)
1009
+
1010
+ day_sch = OpenStudio::Model::ScheduleDay.new(model)
1011
+ day_sch.setName(sch_name + 'Summer Design Day')
1012
+ (0..23).each do |ihr|
1013
+ hr_of_yr = ihr_max + ihr
1014
+ next if values[hr_of_yr] == values[hr_of_yr + 1]
1015
+
1016
+ day_sch.addValue(OpenStudio::Time.new(0, ihr + 1, 0, 0), values[hr_of_yr])
1017
+ end
1018
+ sch_ruleset.setSummerDesignDaySchedule(day_sch)
1019
+
1020
+ return sch_ruleset
1021
+ end
1022
+
1023
+ # Create a ScheduleRules object from an hourly array of values for a week
1024
+ # @author Doug Maddox, PNNL
1025
+ # @param model [Object]
1026
+ # @param sch_ruleset [Object] ScheduleRuleset object
1027
+ # @param values [Array<Double>] array of hourly values for week (168)
1028
+ # @param start_date [Date] start date of week period
1029
+ # @param end_date [Date] end date of week period
1030
+ # @param sch_name [String] name of parent ScheduleRuleset object
1031
+ # @return [Array<Object>] array of ScheduleRules objects
1032
+ def make_week_ruleset_sched_from_168(model, sch_ruleset, values, start_date, end_date, sch_name)
1033
+ one_day = OpenStudio::Time.new(1.0)
1034
+ now_date = start_date - one_day
1035
+ days_of_week = []
1036
+ values_by_day = []
1037
+ # Organize data into days
1038
+ # create a 2-D array values_by_day[iday][ihr]
1039
+ hr_of_wk = -1
1040
+ (0..6).each do |iday|
1041
+ hr_values = []
1042
+ (0..23).each do |hr_of_day|
1043
+ hr_of_wk += 1
1044
+ hr_values << values[hr_of_wk]
1045
+ end
1046
+ values_by_day << hr_values
1047
+ now_date += one_day
1048
+ days_of_week << now_date.dayOfWeek.valueName
1049
+ end
1050
+
1051
+ # Make list of unique day schedules
1052
+ # First one is automatically unique
1053
+ # Store indexes to days with the same sched in array of arrays
1054
+ # day_sched_idays[0] << 0
1055
+ day_sched = {}
1056
+ day_sched['day_idx_list'] = [0]
1057
+ day_sched['hr_values'] = values_by_day[0]
1058
+ day_scheds = []
1059
+ day_scheds << day_sched
1060
+
1061
+ # Check each day with the cumulative list of day_scheds and add new, if unique
1062
+ (1..6).each do |iday|
1063
+ match_was_found = false
1064
+ day_scheds.each do |day_sched|
1065
+ # Compare each jday to the current iday and check for a match
1066
+ is_a_match = true
1067
+ (0..23).each do |ihr|
1068
+ if day_sched['hr_values'][ihr] != values_by_day[iday][ihr]
1069
+ # this hour is not a match
1070
+ is_a_match = false
1071
+ break
1072
+ end
1073
+ end
1074
+ if is_a_match
1075
+ # Add the day index to the list for this day_sched
1076
+ day_sched['day_idx_list'] << iday
1077
+ match_was_found = true
1078
+ break
1079
+ end
1080
+ end
1081
+ if match_was_found == false
1082
+ # Add a new day type
1083
+ day_sched = {}
1084
+ day_sched['day_idx_list'] = [iday]
1085
+ day_sched['hr_values'] = values_by_day[iday]
1086
+ day_scheds << day_sched
1087
+ end
1088
+ end
1089
+
1090
+ # Add the Rule and Day objects
1091
+ sch_rules = []
1092
+ iday_sch = 0
1093
+ day_scheds.each do |day_sched|
1094
+ iday_sch += 1
1095
+
1096
+ day_names = []
1097
+ day_sched['day_idx_list'].each do |idx|
1098
+ day_names << days_of_week[idx]
1099
+ end
1100
+ day_sch_name = "#{sch_name} Day #{iday_sch}"
1101
+ day_sch_values = day_sched['hr_values']
1102
+ sch_rule = add_one_ruleset_sch_rule(model, sch_ruleset, start_date, end_date, day_sch_values, day_sch_name, day_names)
1103
+
1104
+ sch_rules << sch_rule
1105
+ end
1106
+
1107
+ return sch_rules
1108
+ end
1109
+
1110
+ # Create a ScheduleRules object from an hourly array of values for a week
1111
+ # @author Doug Maddox, PNNL
1112
+ # @param model [Object]
1113
+ # @param sch_ruleset [Object] ScheduleRuleset object
1114
+ # @param values [Array<Double>] array of hourly values for day (24)
1115
+ # @param start_date [Date] start date of week period
1116
+ # @param end_date [Date] end date of week period
1117
+ # @param sch_name [String] name of ScheduleDay object
1118
+ # @param day_names [Array<String>] list of days of week for which this day type is applicable
1119
+ # @return [Object] ScheduleDay object
1120
+ def add_one_ruleset_sch_rule(model, sch_ruleset, start_date, end_date, values, sch_name, day_names)
1121
+ # sch_rule is a sub-component of the ScheduleRuleset
1122
+ sch_rule = OpenStudio::Model::ScheduleRule.new(sch_ruleset)
1123
+ # Set the dates when the rule applies
1124
+ sch_rule.setStartDate(OpenStudio::Date.new(OpenStudio::MonthOfYear.new(start_date.monthOfYear.value.to_i), start_date.dayOfMonth.to_i))
1125
+ sch_rule.setStartDate(start_date)
1126
+ sch_rule.setEndDate(end_date)
1127
+
1128
+ # Set the days for which the rule applies
1129
+ day_names.each do |day_of_week|
1130
+ sch_rule.setApplySunday(true) if day_of_week == 'Sunday'
1131
+ sch_rule.setApplyMonday(true) if day_of_week == 'Monday'
1132
+ sch_rule.setApplyTuesday(true) if day_of_week == 'Tuesday'
1133
+ sch_rule.setApplyWednesday(true) if day_of_week == 'Wednesday'
1134
+ sch_rule.setApplyThursday(true) if day_of_week == 'Thursday'
1135
+ sch_rule.setApplyFriday(true) if day_of_week == 'Friday'
1136
+ sch_rule.setApplySaturday(true) if day_of_week == 'Saturday'
1137
+ end
1138
+
1139
+ # Create the day schedule and add hourly values
1140
+ day_sch = sch_rule.daySchedule
1141
+ # day_sch = OpenStudio::Model::ScheduleDay.new(model)
1142
+ day_sch.setName(sch_name)
1143
+ (0..23).each do |ihr|
1144
+ next if values[ihr] == values[ihr + 1]
1145
+
1146
+ day_sch.addValue(OpenStudio::Time.new(0, ihr + 1, 0, 0), values[ihr])
1147
+ end
1148
+
1149
+ return sch_rule
1150
+ end
1151
+
609
1152
  private
610
1153
 
611
1154
  # Set the hours of operation (0 or 1) for a ScheduleDay.