openstudio-standards 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (378) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.md +33 -0
  3. data/data/inventory/thermal_bridging.csv +90 -0
  4. data/data/standards/OpenStudio_Standards-deer-comstock.xlsx +0 -0
  5. data/data/standards/manage_OpenStudio_Standards.rb +1 -1
  6. data/data/standards/test_performance_expected_dd_results.csv +2014 -1891
  7. data/lib/openstudio-standards/btap/analysis.rb +8 -8
  8. data/lib/openstudio-standards/btap/bridging.rb +664 -645
  9. data/lib/openstudio-standards/btap/btap.model.rb +14 -14
  10. data/lib/openstudio-standards/btap/btap.rb +7 -7
  11. data/lib/openstudio-standards/btap/btap_result.rb +1 -1
  12. data/lib/openstudio-standards/btap/economics.rb +23 -23
  13. data/lib/openstudio-standards/btap/envelope.rb +8 -8
  14. data/lib/openstudio-standards/btap/equest.rb +1 -1
  15. data/lib/openstudio-standards/btap/geometry.rb +2 -2
  16. data/lib/openstudio-standards/btap/mpc.rb +7 -7
  17. data/lib/openstudio-standards/btap/schedules.rb +1 -1
  18. data/lib/openstudio-standards/btap/simmanager.rb +4 -4
  19. data/lib/openstudio-standards/btap/spaceloads.rb +26 -26
  20. data/lib/openstudio-standards/btap/utilities.rb +6 -6
  21. data/lib/openstudio-standards/btap/vintagizer.rb +1 -1
  22. data/lib/openstudio-standards/constructions/information.rb +83 -0
  23. data/lib/openstudio-standards/constructions/materials/modify.rb +72 -0
  24. data/lib/openstudio-standards/constructions/modify.rb +80 -0
  25. data/lib/openstudio-standards/create_typical/create_typical.rb +983 -0
  26. data/lib/openstudio-standards/create_typical/enumerations.rb +484 -0
  27. data/lib/openstudio-standards/create_typical/space_type_blend.rb +791 -0
  28. data/lib/openstudio-standards/create_typical/space_type_ratios.rb +494 -0
  29. data/lib/openstudio-standards/daylighting/space.rb +47 -0
  30. data/lib/openstudio-standards/geometry/create.rb +801 -0
  31. data/lib/openstudio-standards/geometry/create_bar.rb +2170 -0
  32. data/lib/openstudio-standards/geometry/information.rb +462 -0
  33. data/lib/openstudio-standards/geometry/modify.rb +48 -0
  34. data/lib/openstudio-standards/hvac/air_loop/information.rb +79 -0
  35. data/lib/openstudio-standards/hvac/cbecs_hvac.rb +616 -0
  36. data/lib/openstudio-standards/hvac/setpoint_managers/information.rb +91 -0
  37. data/lib/openstudio-standards/prototypes/ashrae_90_1/ashrae_90_1_2004/ashrae_90_1_2004.AirTerminalSingleDuctVAVReheat.rb +1 -1
  38. data/lib/openstudio-standards/prototypes/ashrae_90_1/ashrae_90_1_2007/ashrae_90_1_2007.AirTerminalSingleDuctVAVReheat.rb +1 -1
  39. data/lib/openstudio-standards/prototypes/ashrae_90_1/ashrae_90_1_2010/ashrae_90_1_2010.AirTerminalSingleDuctVAVReheat.rb +1 -1
  40. data/lib/openstudio-standards/prototypes/ashrae_90_1/ashrae_90_1_2010/ashrae_90_1_2010.Model.rb +1 -1
  41. data/lib/openstudio-standards/prototypes/ashrae_90_1/ashrae_90_1_2013/ashrae_90_1_2013.AirTerminalSingleDuctVAVReheat.rb +1 -1
  42. data/lib/openstudio-standards/prototypes/ashrae_90_1/ashrae_90_1_2013/ashrae_90_1_2013.Model.rb +2 -2
  43. data/lib/openstudio-standards/prototypes/ashrae_90_1/ashrae_90_1_2013/ashrae_90_1_2013.hvac_systems.rb +1 -1
  44. data/lib/openstudio-standards/prototypes/ashrae_90_1/ashrae_90_1_2016/ashrae_90_1_2016.AirTerminalSingleDuctVAVReheat.rb +1 -1
  45. data/lib/openstudio-standards/prototypes/ashrae_90_1/ashrae_90_1_2016/ashrae_90_1_2016.Model.rb +4 -36
  46. data/lib/openstudio-standards/prototypes/ashrae_90_1/ashrae_90_1_2016/ashrae_90_1_2016.hvac_systems.rb +1 -1
  47. data/lib/openstudio-standards/prototypes/ashrae_90_1/ashrae_90_1_2019/ashrae_90_1_2019.AirTerminalSingleDuctVAVReheat.rb +1 -1
  48. data/lib/openstudio-standards/prototypes/ashrae_90_1/ashrae_90_1_2019/ashrae_90_1_2019.Model.rb +4 -36
  49. data/lib/openstudio-standards/prototypes/ashrae_90_1/ashrae_90_1_2019/ashrae_90_1_2019.Space.rb +3 -3
  50. data/lib/openstudio-standards/prototypes/ashrae_90_1/ashrae_90_1_2019/ashrae_90_1_2019.hvac_systems.rb +1 -1
  51. data/lib/openstudio-standards/prototypes/ashrae_90_1/doe_ref_1980_2004/doe_ref_1980_2004.AirTerminalSingleDuctVAVReheat.rb +1 -1
  52. data/lib/openstudio-standards/prototypes/ashrae_90_1/doe_ref_1980_2004/doe_ref_1980_2004.Model.elevators.rb +1 -1
  53. data/lib/openstudio-standards/prototypes/ashrae_90_1/doe_ref_pre_1980/doe_ref_pre_1980.AirTerminalSingleDuctVAVReheat.rb +1 -1
  54. data/lib/openstudio-standards/prototypes/ashrae_90_1/doe_ref_pre_1980/doe_ref_pre_1980.CoilHeatingGas.rb +1 -1
  55. data/lib/openstudio-standards/prototypes/ashrae_90_1/doe_ref_pre_1980/doe_ref_pre_1980.Model.elevators.rb +1 -1
  56. data/lib/openstudio-standards/prototypes/ashrae_90_1/nrel_nze_ready_2017/nrel_zne_ready_2017.AirTerminalSingleDuctVAVReheat.rb +1 -1
  57. data/lib/openstudio-standards/prototypes/ashrae_90_1/ze_aedg_multifamily/ze_aedg_multifamily.AirTerminalSingleDuctVAVReheat.rb +1 -1
  58. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.College.rb +7 -7
  59. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.Courthouse.rb +8 -8
  60. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.FullServiceRestaurant.rb +14 -14
  61. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.HighRiseApartment.rb +9 -9
  62. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.Hospital.rb +16 -16
  63. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.Laboratory.rb +7 -7
  64. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.LargeDataCenterHighITE.rb +8 -8
  65. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.LargeDataCenterLowITE.rb +8 -8
  66. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.LargeHotel.rb +11 -11
  67. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.LargeOffice.rb +7 -7
  68. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.LargeOfficeDetailed.rb +9 -9
  69. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.MediumOffice.rb +8 -8
  70. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.MediumOfficeDetailed.rb +11 -11
  71. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.MidriseApartment.rb +9 -9
  72. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.Outpatient.rb +19 -19
  73. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.PrimarySchool.rb +10 -10
  74. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.QuickServiceRestaurant.rb +13 -13
  75. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.RetailStandalone.rb +6 -6
  76. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.RetailStripmall.rb +6 -6
  77. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.SecondarySchool.rb +9 -9
  78. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.SmallDataCenterHighITE.rb +8 -8
  79. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.SmallDataCenterLowITE.rb +8 -8
  80. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.SmallHotel.rb +8 -8
  81. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.SmallOffice.rb +8 -8
  82. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.SmallOfficeDetailed.rb +11 -11
  83. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.SuperMarket.rb +10 -10
  84. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.SuperTallBuilding.rb +19 -19
  85. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.TallBuilding.rb +18 -18
  86. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.Warehouse.rb +6 -6
  87. data/lib/openstudio-standards/prototypes/common/do_not_edit_metaclasses.rb +957 -957
  88. data/lib/openstudio-standards/prototypes/common/objects/Prototype.AirConditionerVariableRefrigerantFlow.rb +1 -1
  89. data/lib/openstudio-standards/prototypes/common/objects/Prototype.AirTerminalSingleDuctVAVReheat.rb +1 -1
  90. data/lib/openstudio-standards/prototypes/common/objects/Prototype.CoilCoolingWaterToAirHeatPumpEquationFit.rb +84 -16
  91. data/lib/openstudio-standards/prototypes/common/objects/Prototype.CoilHeatingDXSingleSpeed.rb +1 -1
  92. data/lib/openstudio-standards/prototypes/common/objects/Prototype.CoilHeatingGas.rb +1 -1
  93. data/lib/openstudio-standards/prototypes/common/objects/Prototype.CoilHeatingWaterToAirHeatPumpEquationFit.rb +61 -10
  94. data/lib/openstudio-standards/prototypes/common/objects/Prototype.ControllerWaterCoil.rb +1 -1
  95. data/lib/openstudio-standards/prototypes/common/objects/Prototype.CoolingTower.rb +1 -1
  96. data/lib/openstudio-standards/prototypes/common/objects/Prototype.Fan.rb +1 -1
  97. data/lib/openstudio-standards/prototypes/common/objects/Prototype.FanConstantVolume.rb +1 -1
  98. data/lib/openstudio-standards/prototypes/common/objects/Prototype.FanOnOff.rb +1 -1
  99. data/lib/openstudio-standards/prototypes/common/objects/Prototype.FanVariableVolume.rb +1 -1
  100. data/lib/openstudio-standards/prototypes/common/objects/Prototype.FanZoneExhaust.rb +1 -1
  101. data/lib/openstudio-standards/prototypes/common/objects/Prototype.HeatExchangerAirToAirSensibleAndLatent.rb +2 -2
  102. data/lib/openstudio-standards/prototypes/common/objects/Prototype.Model.exterior_lights.rb +4 -4
  103. data/lib/openstudio-standards/prototypes/common/objects/Prototype.Model.hvac.rb +4 -4
  104. data/lib/openstudio-standards/prototypes/common/objects/Prototype.Model.rb +43 -30
  105. data/lib/openstudio-standards/prototypes/common/objects/Prototype.Model.swh.rb +1 -1
  106. data/lib/openstudio-standards/prototypes/common/objects/Prototype.ServiceWaterHeating.rb +18 -11
  107. data/lib/openstudio-standards/prototypes/common/objects/Prototype.SizingSystem.rb +1 -1
  108. data/lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb +774 -117
  109. data/lib/openstudio-standards/prototypes/common/objects/Prototype.radiant_system_controls.rb +340 -481
  110. data/lib/openstudio-standards/prototypes/common/objects/Prototype.refrigeration.rb +3 -3
  111. data/lib/openstudio-standards/prototypes/common/objects/Prototype.utilities.rb +3 -3
  112. data/lib/openstudio-standards/prototypes/common/prototype_metaprogramming.rb +22 -22
  113. data/lib/openstudio-standards/prototypes/deer/deer.Model.rb +1 -1
  114. data/lib/openstudio-standards/qaqc/calibration.rb +131 -0
  115. data/lib/openstudio-standards/qaqc/create_results.rb +983 -0
  116. data/lib/openstudio-standards/qaqc/envelope.rb +399 -0
  117. data/lib/openstudio-standards/qaqc/eui.rb +213 -0
  118. data/lib/openstudio-standards/qaqc/hvac.rb +1943 -0
  119. data/lib/openstudio-standards/qaqc/internal_loads.rb +568 -0
  120. data/lib/openstudio-standards/qaqc/reporting.rb +141 -0
  121. data/lib/openstudio-standards/qaqc/schedules.rb +129 -0
  122. data/lib/openstudio-standards/qaqc/service_water_heating.rb +273 -0
  123. data/lib/openstudio-standards/qaqc/weather_files.rb +497 -0
  124. data/lib/openstudio-standards/qaqc/zone_conditions.rb +278 -0
  125. data/lib/openstudio-standards/schedules/create.rb +364 -0
  126. data/lib/openstudio-standards/schedules/information.rb +169 -0
  127. data/lib/openstudio-standards/schedules/modify.rb +445 -0
  128. data/lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb +110 -71
  129. data/lib/openstudio-standards/standards/Standards.AirTerminalSingleDuctParallelPIUReheat.rb +3 -3
  130. data/lib/openstudio-standards/standards/Standards.AirTerminalSingleDuctVAVReheat.rb +4 -4
  131. data/lib/openstudio-standards/standards/Standards.BoilerHotWater.rb +2 -1
  132. data/lib/openstudio-standards/standards/Standards.ChillerElectricEIR.rb +16 -10
  133. data/lib/openstudio-standards/standards/Standards.CoilCoolingDXSingleSpeed.rb +4 -4
  134. data/lib/openstudio-standards/standards/Standards.CoilCoolingDXTwoSpeed.rb +1 -1
  135. data/lib/openstudio-standards/standards/Standards.CoilCoolingWaterToAirHeatPumpEquationFit.rb +1 -1
  136. data/lib/openstudio-standards/standards/Standards.CoilDX.rb +4 -4
  137. data/lib/openstudio-standards/standards/Standards.CoilHeatingDXMultiSpeed.rb +1 -1
  138. data/lib/openstudio-standards/standards/Standards.CoilHeatingDXSingleSpeed.rb +5 -5
  139. data/lib/openstudio-standards/standards/Standards.CoilHeatingGas.rb +1 -1
  140. data/lib/openstudio-standards/standards/Standards.CoilHeatingGasMultiStage.rb +1 -1
  141. data/lib/openstudio-standards/standards/Standards.CoilHeatingWaterToAirHeatPumpEquationFit.rb +1 -1
  142. data/lib/openstudio-standards/standards/Standards.Construction.rb +17 -18
  143. data/lib/openstudio-standards/standards/Standards.CoolingTower.rb +6 -6
  144. data/lib/openstudio-standards/standards/Standards.CoolingTowerSingleSpeed.rb +1 -1
  145. data/lib/openstudio-standards/standards/Standards.CoolingTowerTwoSpeed.rb +1 -1
  146. data/lib/openstudio-standards/standards/Standards.CoolingTowerVariableSpeed.rb +1 -1
  147. data/lib/openstudio-standards/standards/Standards.Fan.rb +6 -12
  148. data/lib/openstudio-standards/standards/Standards.FanVariableVolume.rb +2 -2
  149. data/lib/openstudio-standards/standards/Standards.FluidCooler.rb +1 -1
  150. data/lib/openstudio-standards/standards/Standards.HeaderedPumpsVariableSpeed.rb +1 -1
  151. data/lib/openstudio-standards/standards/Standards.HeatExchangerSensLat.rb +3 -3
  152. data/lib/openstudio-standards/standards/Standards.Model.rb +411 -261
  153. data/lib/openstudio-standards/standards/Standards.PlanarSurface.rb +2 -2
  154. data/lib/openstudio-standards/standards/Standards.PlantLoop.rb +94 -29
  155. data/lib/openstudio-standards/standards/Standards.Pump.rb +2 -2
  156. data/lib/openstudio-standards/standards/Standards.ScheduleConstant.rb +2 -2
  157. data/lib/openstudio-standards/standards/Standards.ScheduleRuleset.rb +14 -14
  158. data/lib/openstudio-standards/standards/Standards.Space.rb +37 -30
  159. data/lib/openstudio-standards/standards/Standards.SpaceType.rb +38 -29
  160. data/lib/openstudio-standards/standards/Standards.SubSurface.rb +7 -7
  161. data/lib/openstudio-standards/standards/Standards.Surface.rb +13 -13
  162. data/lib/openstudio-standards/standards/Standards.ThermalZone.rb +109 -66
  163. data/lib/openstudio-standards/standards/Standards.WaterHeaterMixed.rb +11 -4
  164. data/lib/openstudio-standards/standards/Standards.ZoneHVACComponent.rb +6 -6
  165. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2004/ashrae_90_1_2004.AirLoopHVAC.rb +1 -1
  166. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2004/ashrae_90_1_2004.PlantLoop.rb +1 -1
  167. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2004/ashrae_90_1_2004.Space.rb +1 -1
  168. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2007/ashrae_90_1_2007.Space.rb +1 -1
  169. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2010/ashrae_90_1_2010.AirLoopHVAC.rb +4 -4
  170. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2010/ashrae_90_1_2010.AirTerminalSingleDuctVAVReheat.rb +1 -1
  171. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2010/ashrae_90_1_2010.Space.rb +4 -4
  172. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2013/ashrae_90_1_2013.AirLoopHVAC.rb +4 -4
  173. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2013/ashrae_90_1_2013.AirTerminalSingleDuctVAVReheat.rb +1 -1
  174. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2013/ashrae_90_1_2013.CoolingTowerVariableSpeed.rb +1 -1
  175. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2013/ashrae_90_1_2013.Model.rb +5 -21
  176. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2013/ashrae_90_1_2013.Space.rb +4 -4
  177. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2013/ashrae_90_1_2013.WaterHeaterMixed.rb +1 -1
  178. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2013/ashrae_90_1_2013.ZoneHVACComponent.rb +1 -1
  179. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2016/ashrae_90_1_2016.AirLoopHVAC.rb +36 -4
  180. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2016/ashrae_90_1_2016.AirTerminalSingleDuctVAVReheat.rb +1 -1
  181. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2016/ashrae_90_1_2016.CoolingTowerVariableSpeed.rb +1 -1
  182. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2016/ashrae_90_1_2016.Space.rb +4 -4
  183. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2016/ashrae_90_1_2016.ZoneHVACComponent.rb +1 -1
  184. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2016/comstock_ashrae_90_1_2016/comstock_ashrae_90_1_2016.AirLoopHVAC.rb +26 -0
  185. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2019/ashrae_90_1_2019.AirLoopHVAC.rb +53 -10
  186. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2019/ashrae_90_1_2019.AirTerminalSingleDuctVAVReheat.rb +1 -1
  187. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2019/ashrae_90_1_2019.CoolingTowerVariableSpeed.rb +1 -1
  188. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2019/ashrae_90_1_2019.Space.rb +6 -6
  189. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2019/ashrae_90_1_2019.ZoneHVACComponent.rb +2 -2
  190. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2019/comstock_ashrae_90_1_2019/comstock_ashrae_90_1_2019.AirLoopHVAC.rb +26 -0
  191. data/lib/openstudio-standards/standards/ashrae_90_1/data/ashrae_90_1.curves.json +211 -211
  192. data/lib/openstudio-standards/standards/ashrae_90_1/doe_ref_1980_2004/data/doe_ref_1980_2004.economizers.json +14 -14
  193. data/lib/openstudio-standards/standards/ashrae_90_1/doe_ref_1980_2004/doe_ref_1980_2004.AirLoopHVAC.rb +4 -4
  194. data/lib/openstudio-standards/standards/ashrae_90_1/doe_ref_1980_2004/doe_ref_1980_2004.Model.rb +1 -1
  195. data/lib/openstudio-standards/standards/ashrae_90_1/doe_ref_1980_2004/doe_ref_1980_2004.PlantLoop.rb +1 -1
  196. data/lib/openstudio-standards/standards/ashrae_90_1/doe_ref_pre_1980/data/doe_ref_pre_1980.economizers.json +14 -14
  197. data/lib/openstudio-standards/standards/ashrae_90_1/doe_ref_pre_1980/doe_ref_pre_1980.AirLoopHVAC.rb +4 -4
  198. data/lib/openstudio-standards/standards/ashrae_90_1/doe_ref_pre_1980/doe_ref_pre_1980.Model.rb +1 -1
  199. data/lib/openstudio-standards/standards/ashrae_90_1/doe_ref_pre_1980/doe_ref_pre_1980.PlantLoop.rb +1 -1
  200. data/lib/openstudio-standards/standards/ashrae_90_1/nrel_zne_ready_2017/nrel_zne_ready_2017.AirLoopHVAC.rb +6 -6
  201. data/lib/openstudio-standards/standards/ashrae_90_1/nrel_zne_ready_2017/nrel_zne_ready_2017.AirTerminalSingleDuctVAVReheat.rb +1 -1
  202. data/lib/openstudio-standards/standards/ashrae_90_1/nrel_zne_ready_2017/nrel_zne_ready_2017.CoolingTowerVariableSpeed.rb +1 -1
  203. data/lib/openstudio-standards/standards/ashrae_90_1/nrel_zne_ready_2017/nrel_zne_ready_2017.PlantLoop.rb +1 -1
  204. data/lib/openstudio-standards/standards/ashrae_90_1/nrel_zne_ready_2017/nrel_zne_ready_2017.Space.rb +4 -4
  205. data/lib/openstudio-standards/standards/ashrae_90_1/ze_aedg_multifamily/ze_aedg_multifamily.AirLoopHVAC.rb +6 -6
  206. data/lib/openstudio-standards/standards/ashrae_90_1/ze_aedg_multifamily/ze_aedg_multifamily.AirTerminalSingleDuctVAVReheat.rb +1 -1
  207. data/lib/openstudio-standards/standards/ashrae_90_1/ze_aedg_multifamily/ze_aedg_multifamily.CoolingTowerVariableSpeed.rb +1 -1
  208. data/lib/openstudio-standards/standards/ashrae_90_1/ze_aedg_multifamily/ze_aedg_multifamily.PlantLoop.rb +1 -1
  209. data/lib/openstudio-standards/standards/ashrae_90_1/ze_aedg_multifamily/ze_aedg_multifamily.Space.rb +4 -4
  210. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.AirLoopHVAC.rb +22 -28
  211. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.AirTerminalSingleDuctParallelPIUReheat.rb +1 -1
  212. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.AirTerminalSingleDuctVAVReheat.rb +2 -2
  213. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.BoilerHotWater.rb +1 -74
  214. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.ChillerElectricEIR.rb +7 -59
  215. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.CoilCoolingDXSingleSpeed.rb +1 -1
  216. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.CoilCoolingDXTwoSpeed.rb +1 -1
  217. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.CoilDX.rb +1 -1
  218. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.CoilHeatingDXSingleSpeed.rb +1 -1
  219. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.CoilHeatingGas.rb +1 -21
  220. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.DesignSpecificationOutdoorAir.rb +101 -0
  221. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.FanConstantVolume.rb +1 -1
  222. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.FanOnOff.rb +1 -1
  223. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.FanVariableVolume.rb +1 -1
  224. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.HeatExchangerSensLat.rb +1 -1
  225. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.Model.rb +643 -526
  226. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.PlanarSurface.rb +8 -2
  227. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.PlantLoop.rb +17 -77
  228. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.Space.rb +74 -16
  229. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.SpaceType.rb +96 -44
  230. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.Surface.rb +6 -6
  231. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.ThermalZone.rb +18 -6
  232. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.ZoneHVACComponent.rb +1 -1
  233. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.rb +328 -74
  234. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/ashrae_90_1_prm_2019.Model.rb +0 -118
  235. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/ashrae_90_1_prm_2019.rb +2 -1
  236. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm_2019/data/ashrae_90_1_prm_2019.heat_rejection.json +1 -1
  237. data/lib/openstudio-standards/standards/ashrae_90_1_prm/docs/baseline_outdoor_air.md +35 -0
  238. data/lib/openstudio-standards/standards/ashrae_90_1_prm/docs/set_plug_load_measures.md +1 -1
  239. data/lib/openstudio-standards/standards/ashrae_90_1_prm/userdata_csv/ashrae_90_1_prm.UserData.rb +228 -0
  240. data/lib/openstudio-standards/standards/ashrae_90_1_prm/userdata_csv/userdata_enums.rb +131 -0
  241. data/lib/openstudio-standards/standards/ashrae_90_1_prm/userdata_csv/userdata_space.csv +1 -1
  242. data/lib/openstudio-standards/standards/cbes/cbes.AirLoopHVAC.rb +5 -5
  243. data/lib/openstudio-standards/standards/cbes/cbes.Model.rb +1 -1
  244. data/lib/openstudio-standards/standards/cbes/cbes.PlantLoop.rb +1 -1
  245. data/lib/openstudio-standards/standards/cbes/cbes.Space.rb +1 -1
  246. data/lib/openstudio-standards/standards/cbes/cbes_t24_2005/cbes_t24_2005.Space.rb +1 -1
  247. data/lib/openstudio-standards/standards/cbes/cbes_t24_2008/cbes_t24_2008.Space.rb +1 -1
  248. data/lib/openstudio-standards/standards/deer/deer.AirLoopHVAC.rb +109 -27
  249. data/lib/openstudio-standards/standards/deer/deer.Space.rb +1 -1
  250. data/lib/openstudio-standards/standards/deer/deer_1985/data/deer_1985.economizers.json +246 -4
  251. data/lib/openstudio-standards/standards/deer/deer_1996/data/deer_1996.economizers.json +246 -4
  252. data/lib/openstudio-standards/standards/deer/deer_2003/data/deer_2003.economizers.json +246 -4
  253. data/lib/openstudio-standards/standards/deer/deer_2003/deer_2003.ThermalZone.rb +18 -18
  254. data/lib/openstudio-standards/standards/deer/deer_2007/data/deer_2007.economizers.json +246 -4
  255. data/lib/openstudio-standards/standards/deer/deer_2007/deer_2007.ThermalZone.rb +18 -18
  256. data/lib/openstudio-standards/standards/deer/deer_2011/data/deer_2011.economizers.json +246 -4
  257. data/lib/openstudio-standards/standards/deer/deer_2011/deer_2011.ThermalZone.rb +18 -18
  258. data/lib/openstudio-standards/standards/deer/deer_2014/data/deer_2014.economizers.json +248 -6
  259. data/lib/openstudio-standards/standards/deer/deer_2014/deer_2014.Space.rb +3 -3
  260. data/lib/openstudio-standards/standards/deer/deer_2014/deer_2014.ThermalZone.rb +18 -18
  261. data/lib/openstudio-standards/standards/deer/deer_2015/data/deer_2015.economizers.json +248 -6
  262. data/lib/openstudio-standards/standards/deer/deer_2015/deer_2015.Space.rb +3 -3
  263. data/lib/openstudio-standards/standards/deer/deer_2015/deer_2015.ThermalZone.rb +18 -18
  264. data/lib/openstudio-standards/standards/deer/deer_2017/data/deer_2017.economizers.json +248 -6
  265. data/lib/openstudio-standards/standards/deer/deer_2017/deer_2017.Space.rb +3 -3
  266. data/lib/openstudio-standards/standards/deer/deer_2017/deer_2017.ThermalZone.rb +18 -18
  267. data/lib/openstudio-standards/standards/deer/deer_2020/data/deer_2020.economizers.json +248 -6
  268. data/lib/openstudio-standards/standards/deer/deer_2020/deer_2020.AirLoopHVAC.rb +18 -5
  269. data/lib/openstudio-standards/standards/deer/deer_2020/deer_2020.FanVariableVolume.rb +1 -1
  270. data/lib/openstudio-standards/standards/deer/deer_2020/deer_2020.Space.rb +3 -3
  271. data/lib/openstudio-standards/standards/deer/deer_2020/deer_2020.ThermalZone.rb +18 -18
  272. data/lib/openstudio-standards/standards/deer/deer_2025/data/deer_2025.economizers.json +248 -6
  273. data/lib/openstudio-standards/standards/deer/deer_2025/deer_2025.AirLoopHVAC.rb +3 -3
  274. data/lib/openstudio-standards/standards/deer/deer_2025/deer_2025.FanVariableVolume.rb +1 -1
  275. data/lib/openstudio-standards/standards/deer/deer_2025/deer_2025.Space.rb +3 -3
  276. data/lib/openstudio-standards/standards/deer/deer_2030/data/deer_2030.economizers.json +248 -6
  277. data/lib/openstudio-standards/standards/deer/deer_2030/data/deer_2030.heat_pumps.json +2 -2
  278. data/lib/openstudio-standards/standards/deer/deer_2030/deer_2030.AirLoopHVAC.rb +3 -3
  279. data/lib/openstudio-standards/standards/deer/deer_2030/deer_2030.FanVariableVolume.rb +1 -1
  280. data/lib/openstudio-standards/standards/deer/deer_2030/deer_2030.Space.rb +3 -3
  281. data/lib/openstudio-standards/standards/deer/deer_2035/data/deer_2035.economizers.json +248 -6
  282. data/lib/openstudio-standards/standards/deer/deer_2035/deer_2035.AirLoopHVAC.rb +3 -3
  283. data/lib/openstudio-standards/standards/deer/deer_2035/deer_2035.FanVariableVolume.rb +1 -1
  284. data/lib/openstudio-standards/standards/deer/deer_2035/deer_2035.Space.rb +3 -3
  285. data/lib/openstudio-standards/standards/deer/deer_2040/data/deer_2040.economizers.json +248 -6
  286. data/lib/openstudio-standards/standards/deer/deer_2040/deer_2040.AirLoopHVAC.rb +3 -3
  287. data/lib/openstudio-standards/standards/deer/deer_2040/deer_2040.FanVariableVolume.rb +1 -1
  288. data/lib/openstudio-standards/standards/deer/deer_2040/deer_2040.Space.rb +3 -3
  289. data/lib/openstudio-standards/standards/deer/deer_2045/data/deer_2045.economizers.json +260 -0
  290. data/lib/openstudio-standards/standards/deer/deer_2045/deer_2045.AirLoopHVAC.rb +3 -3
  291. data/lib/openstudio-standards/standards/deer/deer_2045/deer_2045.FanVariableVolume.rb +1 -1
  292. data/lib/openstudio-standards/standards/deer/deer_2045/deer_2045.Space.rb +3 -3
  293. data/lib/openstudio-standards/standards/deer/deer_2050/data/deer_2050.economizers.json +248 -6
  294. data/lib/openstudio-standards/standards/deer/deer_2050/deer_2050.AirLoopHVAC.rb +3 -3
  295. data/lib/openstudio-standards/standards/deer/deer_2050/deer_2050.FanVariableVolume.rb +1 -1
  296. data/lib/openstudio-standards/standards/deer/deer_2050/deer_2050.Space.rb +3 -3
  297. data/lib/openstudio-standards/standards/deer/deer_2055/data/deer_2055.economizers.json +248 -6
  298. data/lib/openstudio-standards/standards/deer/deer_2055/deer_2055.AirLoopHVAC.rb +3 -3
  299. data/lib/openstudio-standards/standards/deer/deer_2055/deer_2055.FanVariableVolume.rb +1 -1
  300. data/lib/openstudio-standards/standards/deer/deer_2055/deer_2055.Space.rb +3 -3
  301. data/lib/openstudio-standards/standards/deer/deer_2060/data/deer_2060.economizers.json +248 -6
  302. data/lib/openstudio-standards/standards/deer/deer_2060/deer_2060.AirLoopHVAC.rb +3 -3
  303. data/lib/openstudio-standards/standards/deer/deer_2060/deer_2060.FanVariableVolume.rb +1 -1
  304. data/lib/openstudio-standards/standards/deer/deer_2060/deer_2060.Space.rb +3 -3
  305. data/lib/openstudio-standards/standards/deer/deer_2065/data/deer_2065.economizers.json +248 -6
  306. data/lib/openstudio-standards/standards/deer/deer_2065/deer_2065.AirLoopHVAC.rb +3 -3
  307. data/lib/openstudio-standards/standards/deer/deer_2065/deer_2065.FanVariableVolume.rb +1 -1
  308. data/lib/openstudio-standards/standards/deer/deer_2065/deer_2065.Space.rb +3 -3
  309. data/lib/openstudio-standards/standards/deer/deer_2070/data/deer_2070.economizers.json +248 -6
  310. data/lib/openstudio-standards/standards/deer/deer_2070/deer_2070.AirLoopHVAC.rb +3 -3
  311. data/lib/openstudio-standards/standards/deer/deer_2070/deer_2070.FanVariableVolume.rb +1 -1
  312. data/lib/openstudio-standards/standards/deer/deer_2070/deer_2070.Space.rb +3 -3
  313. data/lib/openstudio-standards/standards/deer/deer_2075/data/deer_2075.economizers.json +248 -6
  314. data/lib/openstudio-standards/standards/deer/deer_2075/deer_2075.AirLoopHVAC.rb +3 -3
  315. data/lib/openstudio-standards/standards/deer/deer_2075/deer_2075.FanVariableVolume.rb +1 -1
  316. data/lib/openstudio-standards/standards/deer/deer_2075/deer_2075.Space.rb +3 -3
  317. data/lib/openstudio-standards/standards/deer/deer_pre_1975/data/deer_pre_1975.economizers.json +246 -4
  318. data/lib/openstudio-standards/standards/necb/BTAP1980TO2010/data/space_types.json +447 -223
  319. data/lib/openstudio-standards/standards/necb/BTAPPRE1980/building_envelope.rb +1 -1
  320. data/lib/openstudio-standards/standards/necb/BTAPPRE1980/data/space_types.json +447 -223
  321. data/lib/openstudio-standards/standards/necb/BTAPPRE1980/hvac_systems.rb +5 -2
  322. data/lib/openstudio-standards/standards/necb/ECMS/data/chiller_types.json +25 -0
  323. data/lib/openstudio-standards/standards/necb/ECMS/data/chillers.json +44 -0
  324. data/lib/openstudio-standards/standards/necb/ECMS/data/curves.json +225 -0
  325. data/lib/openstudio-standards/standards/necb/ECMS/ecms.rb +2 -2
  326. data/lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb +193 -73
  327. data/lib/openstudio-standards/standards/necb/ECMS/pv_ground.rb +1 -1
  328. data/lib/openstudio-standards/standards/necb/NECB2011/autozone.rb +10 -4
  329. data/lib/openstudio-standards/standards/necb/NECB2011/beps_compliance_path.rb +7 -7
  330. data/lib/openstudio-standards/standards/necb/NECB2011/building_envelope.rb +4 -5
  331. data/lib/openstudio-standards/standards/necb/NECB2011/data/chiller_types.json +32 -0
  332. data/lib/openstudio-standards/standards/necb/NECB2011/data/chillers.json +1 -1
  333. data/lib/openstudio-standards/standards/necb/NECB2011/data/constants.json +36 -0
  334. data/lib/openstudio-standards/standards/necb/NECB2011/data/fuel_type_sets.json +7 -7
  335. data/lib/openstudio-standards/standards/necb/NECB2011/data/geometry/NorthernEducation.osm +47587 -0
  336. data/lib/openstudio-standards/standards/necb/NECB2011/data/geometry/NorthernHealthCare.osm +49764 -0
  337. data/lib/openstudio-standards/standards/necb/NECB2011/data/geometry/Warehouse.osm +283 -297
  338. data/lib/openstudio-standards/standards/necb/NECB2011/data/space_type_unit_definitions.txt +2 -1
  339. data/lib/openstudio-standards/standards/necb/NECB2011/data/space_types.json +447 -223
  340. data/lib/openstudio-standards/standards/necb/NECB2011/data/standards_data.rb +3 -3
  341. data/lib/openstudio-standards/standards/necb/NECB2011/hvac_system_1_multi_speed.rb +1 -1
  342. data/lib/openstudio-standards/standards/necb/NECB2011/hvac_systems.rb +49 -27
  343. data/lib/openstudio-standards/standards/necb/NECB2011/necb_2011.rb +400 -202
  344. data/lib/openstudio-standards/standards/necb/NECB2011/service_water_heating.rb +4 -4
  345. data/lib/openstudio-standards/standards/necb/NECB2015/data/space_types.json +637 -318
  346. data/lib/openstudio-standards/standards/necb/NECB2015/hvac_systems.rb +18 -1
  347. data/lib/openstudio-standards/standards/necb/NECB2015/necb_2015.rb +3 -3
  348. data/lib/openstudio-standards/standards/necb/NECB2017/data/space_types.json +637 -318
  349. data/lib/openstudio-standards/standards/necb/NECB2017/hvac_systems.rb +1 -1
  350. data/lib/openstudio-standards/standards/necb/NECB2017/necb_2017.rb +3 -3
  351. data/lib/openstudio-standards/standards/necb/NECB2020/building_envelope.rb +1 -1
  352. data/lib/openstudio-standards/standards/necb/NECB2020/data/space_types.json +615 -307
  353. data/lib/openstudio-standards/standards/necb/NECB2020/service_water_heating.rb +4 -4
  354. data/lib/openstudio-standards/standards/necb/common/btap_data.rb +10 -5
  355. data/lib/openstudio-standards/standards/necb/common/btap_datapoint.rb +1 -1
  356. data/lib/openstudio-standards/utilities/assertion.rb +128 -0
  357. data/lib/openstudio-standards/utilities/logging.rb +2 -3
  358. data/lib/openstudio-standards/utilities/object_info.rb +39 -18
  359. data/lib/openstudio-standards/utilities/schedule_translator.rb +8 -6
  360. data/lib/openstudio-standards/utilities/simulation.rb +24 -11
  361. data/lib/openstudio-standards/utilities/sqlfile.rb +10 -5
  362. data/lib/openstudio-standards/version.rb +1 -1
  363. data/lib/openstudio-standards/weather/Weather.Model.rb +8 -9
  364. data/lib/openstudio-standards/weather/Weather.stat_file.rb +3 -3
  365. data/lib/openstudio-standards/weather/information.rb +35 -0
  366. data/lib/openstudio-standards.rb +69 -5
  367. metadata +54 -18
  368. data/License.txt +0 -65
  369. data/data/standards/OpenStudio_Standards-deer-ALL-comstock(space_types).xlsx +0 -0
  370. data/lib/openstudio-standards/hvac_sizing/Siz.AirLoopHVAC.rb +0 -59
  371. data/lib/openstudio-standards/hvac_sizing/Siz.CoilCoolingWater.rb +0 -13
  372. data/lib/openstudio-standards/hvac_sizing/Siz.HVACComponent.rb +0 -36
  373. data/lib/openstudio-standards/hvac_sizing/Siz.HeatingCoolingFuels.rb +0 -898
  374. data/lib/openstudio-standards/hvac_sizing/Siz.Model.rb +0 -126
  375. data/lib/openstudio-standards/hvac_sizing/Siz.ThermalZone.rb +0 -356
  376. data/lib/openstudio-standards/prototypes/ashrae_90_1/nrel_nze_ready_2017/nrel_zne_ready_2017.Model.rb +0 -35
  377. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.CoolingTower.rb +0 -110
  378. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.CoolingTowerVariableSpeed.rb +0 -5
@@ -0,0 +1,169 @@
1
+ # Methods to get information from Schedule objects
2
+ # Many of these methods may be moved to core OpenStudio
3
+ module OpenstudioStandards
4
+ module Schedules
5
+ # @!group Information
6
+
7
+ # add general schedule_min_max(schedule) method and merge with other methods
8
+
9
+ # returns the ScheduleRuleset minimum and maximum values
10
+ #
11
+ # @param schedule_ruleset [OpenStudio::Model::ScheduleRuleset] OpenStudio ScheduleRuleset object
12
+ # @return [Hash] returns as hash with 'min' and 'max' values
13
+ def self.schedule_ruleset_get_min_max(schedule_ruleset)
14
+ # validate schedule
15
+ if schedule_ruleset.to_ScheduleRuleset.is_initialized
16
+ schedule = schedule_ruleset.to_ScheduleRuleset.get
17
+
18
+ # gather profiles
19
+ profiles = []
20
+ profiles << schedule.defaultDaySchedule
21
+ rules = schedule.scheduleRules
22
+ rules.each do |rule|
23
+ profiles << rule.daySchedule
24
+ end
25
+
26
+ # test profiles
27
+ min = nil
28
+ max = nil
29
+ profiles.each do |profile|
30
+ profile.values.each do |value|
31
+ if min.nil?
32
+ min = value
33
+ else
34
+ if min > value then min = value end
35
+ end
36
+ if max.nil?
37
+ max = value
38
+ else
39
+ if max < value then max = value end
40
+ end
41
+ end
42
+ end
43
+ result = { 'min' => min, 'max' => max } # this doesn't include summer and winter design day
44
+ else
45
+ result = nil
46
+ end
47
+
48
+ return result
49
+ end
50
+
51
+ # create OpenStudio TimeSeries object from ScheduleRuleset values
52
+ #
53
+ # @param schedule_ruleset [OpenStudio::Model::ScheduleRuleset] OpenStudio ScheduleRuleset object
54
+ # @return [OpenStudio::TimeSeries] OpenStudio TimeSeries object of schedule values
55
+ def self.schedule_ruleset_get_timeseries(schedule_ruleset)
56
+ yd = schedule_ruleset.model.getYearDescription
57
+ start_date = yd.makeDate(1, 1)
58
+ end_date = yd.makeDate(12, 31)
59
+
60
+ values = OpenStudio::DoubleVector.new
61
+ day = OpenStudio::Time.new(1.0)
62
+ interval = OpenStudio::Time.new(1.0 / 48.0)
63
+ day_schedules = schedule_ruleset.to_ScheduleRuleset.get.getDaySchedules(start_date, end_date)
64
+ day_schedules.each do |day_schedule|
65
+ time = interval
66
+ while time < day
67
+ values << day_schedule.getValue(time)
68
+ time += interval
69
+ end
70
+ end
71
+ timeseries = OpenStudio::TimeSeries.new(start_date, interval, OpenStudio.createVector(values), '')
72
+ return timeseries
73
+ end
74
+
75
+ # Determine the hour when the schedule first exceeds the starting value and when
76
+ # it goes back down to the ending value at the end of the day.
77
+ # This method only works for ScheduleRuleset schedules.
78
+ #
79
+ # @param schedule_ruleset [OpenStudio::Model::ScheduleRuleset] OpenStudio ScheduleRuleset object
80
+ # @return [Hash<OpenStudio:Time>] returns as hash with 'start_time', 'end time']
81
+ def self.schedule_ruleset_get_start_and_end_times(schedule_ruleset)
82
+ # Ensure that this is a ScheduleRuleset
83
+ schedule_ruleset = schedule_ruleset.to_ScheduleRuleset
84
+ return [nil, nil] if schedule_ruleset.empty?
85
+
86
+ schedule_ruleset = schedule_ruleset.get
87
+
88
+ # Define the start and end date
89
+ if schedule_ruleset.model.yearDescription.is_initialized
90
+ year_description = schedule_ruleset.model.yearDescription.get
91
+ year = year_description.assumedYear
92
+ year_start_date = OpenStudio::Date.new(OpenStudio::MonthOfYear.new('January'), 1, year)
93
+ year_end_date = OpenStudio::Date.new(OpenStudio::MonthOfYear.new('December'), 31, year)
94
+ else
95
+ year_start_date = OpenStudio::Date.new(OpenStudio::MonthOfYear.new('January'), 1, 2009)
96
+ year_end_date = OpenStudio::Date.new(OpenStudio::MonthOfYear.new('December'), 31, 2009)
97
+ end
98
+
99
+ # Get the ordered list of all the day schedules that are used by this schedule ruleset
100
+ day_schs = schedule_ruleset.getDaySchedules(year_start_date, year_end_date)
101
+
102
+ # Get a 365-value array of which schedule is used on each day of the year,
103
+ day_schs_used_each_day = schedule_ruleset.getActiveRuleIndices(year_start_date, year_end_date)
104
+
105
+ # Create a map that shows how many days each schedule is used
106
+ day_sch_freq = day_schs_used_each_day.group_by { |n| n }
107
+ day_sch_freq = day_sch_freq.sort_by { |freq| freq[1].size }
108
+ common_day_freq = day_sch_freq.last
109
+
110
+ # Build a hash that maps schedule day index to schedule day
111
+ schedule_index_to_day = {}
112
+ day_schs.each_with_index do |day_sch, i|
113
+ schedule_index_to_day[day_schs_used_each_day[i]] = day_sch
114
+ end
115
+
116
+ # Get the most common day schedule
117
+ sch_index = common_day_freq[0]
118
+ number_of_days_sch_used = common_day_freq[1].size
119
+
120
+ # Get the day schedule at this index
121
+ day_sch = if sch_index == -1 # If index = -1, this day uses the default day schedule (not a rule)
122
+ schedule_ruleset.defaultDaySchedule
123
+ else
124
+ schedule_index_to_day[sch_index]
125
+ end
126
+
127
+ # Determine the full load hours for just one day
128
+ values = []
129
+ times = []
130
+ day_sch.times.each_with_index do |time, i|
131
+ times << day_sch.times[i]
132
+ values << day_sch.values[i]
133
+ end
134
+
135
+ # Get the minimum value
136
+ start_val = values.first
137
+ end_val = values.last
138
+
139
+ # Get the start time (first time value goes above minimum)
140
+ start_time = nil
141
+ values.each_with_index do |val, i|
142
+ break if i == values.size - 1 # Stop if we reach end of array
143
+
144
+ if val == start_val && values[i + 1] > start_val
145
+ start_time = times[i]
146
+ break
147
+ end
148
+ end
149
+
150
+ # Get the end time (first time value goes back down to minimum)
151
+ end_time = nil
152
+ values.each_with_index do |val, i|
153
+ if i < values.size - 1
154
+ if val > end_val && values[i + 1] == end_val
155
+ end_time = times[i]
156
+ break
157
+ end
158
+ else
159
+ if val > end_val && values[0] == start_val # Check first hour of day for schedules that end at midnight
160
+ end_time = OpenStudio::Time.new(0, 24, 0, 0)
161
+ break
162
+ end
163
+ end
164
+ end
165
+
166
+ return { 'start_time' => start_time, 'end_time' => end_time }
167
+ end
168
+ end
169
+ end
@@ -0,0 +1,445 @@
1
+ # Methods to modify existing Schedule objects
2
+ module OpenstudioStandards
3
+ module Schedules
4
+ # @!group Modify
5
+
6
+ # Increase/decrease by percentage or static value
7
+ #
8
+ # @param schedule_ruleset [OpenStudio::Model::ScheduleRuleset] OpenStudio ScheduleRuleset object
9
+ # @param value [Double] Hash of name and time value pairs
10
+ # @param modification_type [String] Options are 'Multiplier', which multiples by the value,
11
+ # and 'Sum' which adds by the value
12
+ # @return [OpenStudio::Model::ScheduleRuleset] OpenStudio ScheduleRuleset object
13
+ # @todo add in design day adjustments, maybe as an optional argument
14
+ # @todo provide option to clone existing schedule
15
+ def self.schedule_ruleset_simple_value_adjust(schedule_ruleset, value, modification_type = 'Multiplier')
16
+ # gather profiles
17
+ profiles = []
18
+ default_profile = schedule_ruleset.to_ScheduleRuleset.get.defaultDaySchedule
19
+ profiles << default_profile
20
+ rules = schedule_ruleset.scheduleRules
21
+ rules.each do |rule|
22
+ profiles << rule.daySchedule
23
+ end
24
+
25
+ # alter profiles
26
+ profiles.each do |profile|
27
+ times = profile.times
28
+ i = 0
29
+ profile.values.each do |sch_value|
30
+ case modification_type
31
+ when 'Multiplier', 'Percentage'
32
+ # percentage was used early on but Multiplier is preferable
33
+ profile.addValue(times[i], sch_value * value)
34
+ when 'Sum', 'Value'
35
+ # value was used early on but Sum is preferable
36
+ profile.addValue(times[i], sch_value + value)
37
+ end
38
+ i += 1
39
+ end
40
+ end
41
+
42
+ return schedule_ruleset
43
+ end
44
+
45
+ # Increase/decrease by percentage or static value
46
+ # change value when value passes/fails test
47
+ #
48
+ # @param schedule_ruleset [OpenStudio::Model::ScheduleRuleset] OpenStudio ScheduleRuleset object
49
+ # @param test_value [Double] if less than the test_value, use the pass_value to modify, otherwise use the fail_value
50
+ # @param pass_value [Double] value to adjust by if less than test value
51
+ # @param fail_value [Double] value to adjust by if more than test value
52
+ # @param floor_value [Double] minimum value that the adjustment can take
53
+ # @param modification_type [String] Options are 'Multiplier', which multiples by the value,
54
+ # and 'Sum' which adds by the value
55
+ # @return [OpenStudio::Model::ScheduleRuleset] OpenStudio ScheduleRuleset object
56
+ # @todo add in design day adjustments, maybe as an optional argument
57
+ # @todo provide option to clone existing schedule
58
+ def self.schedule_ruleset_conditional_adjust_value(schedule_ruleset, test_value, pass_value, fail_value, floor_value, modification_type = 'Multiplier')
59
+ # gather profiles
60
+ profiles = []
61
+ default_profile = schedule_ruleset.to_ScheduleRuleset.get.defaultDaySchedule
62
+ profiles << default_profile
63
+ rules = schedule_ruleset.scheduleRules
64
+ rules.each do |rule|
65
+ profiles << rule.daySchedule
66
+ end
67
+
68
+ # alter profiles
69
+ profiles.each do |profile|
70
+ times = profile.times
71
+ i = 0
72
+
73
+ profile.values.each do |sch_value|
74
+ # run test on this sch_value
75
+ if sch_value < test_value
76
+ adjust_value = pass_value
77
+ else
78
+ adjust_value = fail_value
79
+ end
80
+
81
+ # skip if sch_value is floor or less
82
+ next if sch_value <= floor_value
83
+
84
+ case modification_type
85
+ when 'Multiplier'
86
+ # take the max of the floor or resulting value
87
+ profile.addValue(times[i], [sch_value * adjust_value, floor_value].max)
88
+ when 'Sum'
89
+ # take the max of the floor or resulting value
90
+ profile.addValue(times[i], [sch_value + adjust_value, floor_value].max)
91
+ end
92
+ i += 1
93
+ end
94
+ end
95
+
96
+ return schedule_ruleset
97
+ end
98
+
99
+ # Increase/decrease by percentage or static value
100
+ # change value when time passes test
101
+ #
102
+ # @param schedule_ruleset [OpenStudio::Model::ScheduleRuleset] OpenStudio ScheduleRuleset object
103
+ # @param hhmm_before [String] time before string in hhmm format, e.g. 1530
104
+ # @param hhmm_after [String] string in hhmm format, e.g. 1530
105
+ # @param inside_value [Double]
106
+ # @param outside_value [Double]
107
+ # @param modification_type [String] Options are 'Sum', which adds to the value,
108
+ # and 'Replace' which replaces the value
109
+ # @return [OpenStudio::Model::ScheduleRuleset] OpenStudio ScheduleRuleset object
110
+ def self.schedule_ruleset_time_conditional_adjust_value(schedule_ruleset, hhmm_before, hhmm_after, inside_value, outside_value, modification_type = 'Sum')
111
+ # setup variables
112
+ array = hhmm_before.to_s.split('')
113
+ before_hour = "#{array[0]}#{array[1]}".to_i
114
+ before_min = "#{array[2]}#{array[3]}".to_i
115
+ array = hhmm_after.to_s.split('')
116
+ after_hour = "#{array[0]}#{array[1]}".to_i
117
+ after_min = "#{array[2]}#{array[3]}".to_i
118
+
119
+ # gather profiles
120
+ profiles = []
121
+ schedule = schedule_ruleset.to_ScheduleRuleset.get
122
+ default_profile = schedule_ruleset.defaultDaySchedule
123
+ profiles << default_profile
124
+ rules = schedule_ruleset.scheduleRules
125
+ rules.each do |rule|
126
+ profiles << rule.daySchedule
127
+ end
128
+
129
+ # alter profiles
130
+ profiles.each do |day_sch|
131
+ times = day_sch.times
132
+ i = 0
133
+
134
+ # set times special times needed for methods below
135
+ before_time = OpenStudio::Time.new(0, before_hour, before_min, 0)
136
+ after_time = OpenStudio::Time.new(0, after_hour, after_min, 0)
137
+ # day_end_time = OpenStudio::Time.new(0, 24, 0, 0)
138
+
139
+ # add datapoint at before and after time
140
+ original_value_at_before_time = day_sch.getValue(before_time)
141
+ original_value_at_after_time = day_sch.getValue(after_time)
142
+ day_sch.addValue(before_time, original_value_at_before_time)
143
+ day_sch.addValue(after_time, original_value_at_after_time)
144
+
145
+ # make arrays for original times and values
146
+ times = day_sch.times
147
+ sch_values = day_sch.values
148
+ day_sch.clearValues
149
+
150
+ # make arrays for new values
151
+ new_times = []
152
+ new_values = []
153
+
154
+ # loop through original time/value pairs to populate new array
155
+ for i in 0..(sch_values.length - 1)
156
+ new_times << times[i]
157
+
158
+ if times[i] > before_time && times[i] <= after_time
159
+ # updated this so times[i] == before_time goes into the else
160
+ if inside_value.nil?
161
+ new_values << sch_values[i]
162
+ elsif modification_type == 'Sum'
163
+ new_values << inside_value + sch_values[i]
164
+ elsif modification_type == 'Replace'
165
+ new_values << inside_value
166
+ else # should be Multiplier
167
+ new_values << inside_value * sch_values[i]
168
+ end
169
+ else
170
+ if outside_value.nil?
171
+ new_values << sch_values[i]
172
+ elsif modification_type == 'Sum'
173
+ new_values << outside_value + sch_values[i]
174
+ elsif modification_type == 'Replace'
175
+ new_values << outside_value
176
+ else # should be Multiplier
177
+ new_values << outside_value * sch_values[i]
178
+ end
179
+ end
180
+
181
+ end
182
+
183
+ # generate new day_sch values
184
+ for i in 0..(new_values.length - 1)
185
+ day_sch.addValue(new_times[i], new_values[i])
186
+ end
187
+ end
188
+
189
+ return schedule_ruleset
190
+ end
191
+
192
+ # Adjust hours of operation
193
+ #
194
+ # @param schedule_ruleset [OpenStudio::Model::ScheduleRuleset] OpenStudio ScheduleRuleset object
195
+ # @param options [Hash] Hash of argument options
196
+ # @return [OpenStudio::Model::ScheduleRuleset] OpenStudio ScheduleRuleset object
197
+ def self.schedule_ruleset_adjust_hours_of_operation(schedule_ruleset, options = {})
198
+ defaults = {
199
+ 'base_start_hoo' => 8.0, # may not be good idea to have default
200
+ 'base_finish_hoo' => 18.0, # may not be good idea to have default
201
+ 'delta_length_hoo' => 0.0,
202
+ 'shift_hoo' => 0.0,
203
+ 'default' => true,
204
+ 'mon' => true,
205
+ 'tue' => true,
206
+ 'wed' => true,
207
+ 'thur' => true,
208
+ 'fri' => true,
209
+ 'sat' => true,
210
+ 'sun' => true,
211
+ 'summer' => false,
212
+ 'winter' => false
213
+ }
214
+
215
+ # merge user inputs with defaults
216
+ options = defaults.merge(options)
217
+
218
+ # grab schedule out of argument
219
+ if schedule_ruleset.to_ScheduleRuleset.is_initialized
220
+ schedule = schedule_ruleset.to_ScheduleRuleset.get
221
+ else
222
+ OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Schedules.Modify', "schedule_ruleset_adjust_hours_of_operation only applies to ScheduleRuleset objects. Skipping #{schedule.name}")
223
+ return nil
224
+ end
225
+
226
+ # array of all profiles to change
227
+ profiles = []
228
+
229
+ # push default profiles to array
230
+ if options['default']
231
+ default_rule = schedule.defaultDaySchedule
232
+ profiles << default_rule
233
+ end
234
+
235
+ # push profiles to array
236
+ rules = schedule.scheduleRules
237
+ rules.each do |rule|
238
+ day_sch = rule.daySchedule
239
+
240
+ # if any day requested also exists in the rule, then it will be altered
241
+ alter_rule = false
242
+ if rule.applyMonday && rule.applyMonday == options['mon'] then alter_rule = true end
243
+ if rule.applyTuesday && rule.applyTuesday == options['tue'] then alter_rule = true end
244
+ if rule.applyWednesday && rule.applyWednesday == options['wed'] then alter_rule = true end
245
+ if rule.applyThursday && rule.applyThursday == options['thur'] then alter_rule = true end
246
+ if rule.applyFriday && rule.applyFriday == options['fri'] then alter_rule = true end
247
+ if rule.applySaturday && rule.applySaturday == options['sat'] then alter_rule = true end
248
+ if rule.applySunday && rule.applySunday == options['sun'] then alter_rule = true end
249
+
250
+ # @todo add in logic to warn user about conflicts where a single rule has conflicting tests
251
+
252
+ if alter_rule
253
+ profiles << day_sch
254
+ end
255
+ end
256
+
257
+ # add design days to array
258
+ if options['summer']
259
+ summer_design = schedule.summerDesignDaySchedule
260
+ profiles << summer_design
261
+ end
262
+ if options['winter']
263
+ winter_design = schedule.winterDesignDaySchedule
264
+ profiles << winter_design
265
+ end
266
+
267
+ # give info messages as I change specific profiles
268
+ OpenStudio.logFree(OpenStudio::Info, 'openstudio.standards.Schedules.Modify', "Adjusting #{schedule.name}")
269
+
270
+ # rename schedule
271
+ schedule.setName("#{schedule.name} - extend #{options['delta_length_hoo']} shift #{options['shift_hoo']}")
272
+
273
+ # break time args into hours and minutes
274
+ start_hoo_hours = (options['base_start_hoo']).to_i
275
+ start_hoo_minutes = (((options['base_start_hoo']) - (options['base_start_hoo']).to_i) * 60).to_i
276
+ finish_hoo_hours = (options['base_finish_hoo']).to_i
277
+ finish_hoo_minutes = (((options['base_finish_hoo']) - (options['base_finish_hoo']).to_i) * 60).to_i
278
+ delta_hours = (options['delta_length_hoo']).to_i
279
+ delta_minutes = (((options['delta_length_hoo']) - (options['delta_length_hoo']).to_i) * 60).to_i
280
+ shift_hours = (options['shift_hoo']).to_i
281
+ shift_minutes = (((options['shift_hoo']) - (options['shift_hoo']).to_i) * 60).to_i
282
+
283
+ # time objects to use in measure
284
+ time_0 = OpenStudio::Time.new(0, 0, 0, 0)
285
+ time_1_min = OpenStudio::Time.new(0, 0, 1, 0) # add this to avoid times in day profile less than this
286
+ time_12 = OpenStudio::Time.new(0, 12, 0, 0)
287
+ time_24 = OpenStudio::Time.new(0, 24, 0, 0)
288
+ start_hoo_time = OpenStudio::Time.new(0, start_hoo_hours, start_hoo_minutes, 0)
289
+ finish_hoo_time = OpenStudio::Time.new(0, finish_hoo_hours, finish_hoo_minutes, 0)
290
+ delta_time = OpenStudio::Time.new(0, delta_hours, delta_minutes, 0) # not used
291
+ shift_time = OpenStudio::Time.new(0, shift_hours, shift_minutes, 0)
292
+
293
+ # calculations
294
+ if options['base_start_hoo'] <= options['base_finish_hoo']
295
+ base_opp_day_length = options['base_finish_hoo'] - options['base_start_hoo']
296
+ mid_hoo = start_hoo_time + (finish_hoo_time - start_hoo_time) / 2
297
+ mid_non_hoo = mid_hoo + time_12
298
+ if mid_non_hoo > time_24 then mid_non_hoo -= time_24 end
299
+ else
300
+ base_opp_day_length = options['base_finish_hoo'] - options['base_start_hoo'] + 24
301
+ mid_non_hoo = finish_hoo_time + (start_hoo_time - finish_hoo_time) / 2
302
+ mid_hoo = mid_non_hoo + time_12
303
+ if mid_non_hoo > time_24 then mid_non_hoo -= time_24 end
304
+ end
305
+ adjusted_opp_day_length = base_opp_day_length + options['delta_length_hoo']
306
+ hoo_time_multiplier = adjusted_opp_day_length / base_opp_day_length
307
+ non_hoo_time_multiplier = (24 - adjusted_opp_day_length) / (24 - base_opp_day_length)
308
+
309
+ # check for invalid input
310
+ if adjusted_opp_day_length < 0
311
+ OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.Schedules.Modify', 'Requested hours of operation adjustment results in an invalid negative hours of operation')
312
+ return false
313
+ end
314
+ # check for invalid input
315
+ if adjusted_opp_day_length > 24
316
+ OpenStudio.logFree(OpenStudio::Error, 'openstudio.standards.Schedules.Modify', 'Requested hours of operation adjustment results in more than 24 hours of operation')
317
+ return false
318
+ end
319
+
320
+ # making some temp objects to avoid having to deal with wrap around for change of hoo times
321
+ mid_hoo < start_hoo_time ? (adj_mid_hoo = mid_hoo + time_24) : (adj_mid_hoo = mid_hoo)
322
+ finish_hoo_time < adj_mid_hoo ? (adj_finish_hoo_time = finish_hoo_time + time_24) : (adj_finish_hoo_time = finish_hoo_time)
323
+ mid_non_hoo < adj_finish_hoo_time ? (adj_mid_non_hoo = mid_non_hoo + time_24) : (adj_mid_non_hoo = mid_non_hoo)
324
+ adj_start = start_hoo_time + time_24 # not used
325
+
326
+ # edit profiles
327
+ profiles.each do |day_sch|
328
+ times = day_sch.times
329
+ values = day_sch.values
330
+
331
+ # in this case delete all values outside of
332
+ # todo - may need similar logic if exactly 0 hours
333
+ if adjusted_opp_day_length == 24
334
+ start_val = day_sch.getValue(start_hoo_time)
335
+ finish_val = day_sch.getValue(finish_hoo_time)
336
+
337
+ # remove times out of range that should not be reference or compressed
338
+ if start_hoo_time < finish_hoo_time
339
+ times.each do |time|
340
+ if time <= start_hoo_time || time > finish_hoo_time
341
+ day_sch.removeValue(time)
342
+ end
343
+ end
344
+ # add in values
345
+ day_sch.addValue(start_hoo_time, start_val)
346
+ day_sch.addValue(finish_hoo_time, finish_val)
347
+ day_sch.addValue(time_24, [start_val, finish_val].max)
348
+ else
349
+ times.each do |time|
350
+ if time > start_hoo_time && time <= finish_hoo_time
351
+ day_sch.removeValue(time)
352
+ end
353
+ end
354
+ # add in values
355
+ day_sch.addValue(finish_hoo_time, finish_val)
356
+ day_sch.addValue(start_hoo_time, start_val)
357
+ day_sch.addValue(time_24, [values.first, values.last].max)
358
+ end
359
+
360
+ end
361
+
362
+ times = day_sch.times
363
+ values = day_sch.values
364
+
365
+ # arrays for values to avoid overlap conflict of times
366
+ new_times = []
367
+ new_values = []
368
+
369
+ # this is to store what datapoint will be first after midnight, and what the value at that time should be
370
+ min_time_new = time_24
371
+ min_time_value = nil
372
+
373
+ # flag if found time at 24
374
+ found_24_or_0 = false
375
+
376
+ # push times to array
377
+ times.each do |time|
378
+ # create logic for four possible quadrants. Assume any quadrant can pass over 24/0 threshold
379
+ time < start_hoo_time ? (temp_time = time + time_24) : (temp_time = time)
380
+
381
+ # calculate change in time do to hoo delta
382
+ if temp_time <= adj_finish_hoo_time
383
+ expand_time = (temp_time - adj_mid_hoo) * hoo_time_multiplier - (temp_time - adj_mid_hoo)
384
+ else
385
+ expand_time = (temp_time - adj_mid_non_hoo) * non_hoo_time_multiplier - (temp_time - adj_mid_non_hoo)
386
+ end
387
+
388
+ new_time = time + shift_time + expand_time
389
+
390
+ # adjust wrap around times
391
+ if new_time < time_0
392
+ new_time += time_24
393
+ elsif new_time > time_24
394
+ new_time -= time_24
395
+ end
396
+ new_times << new_time
397
+
398
+ # see which new_time has the lowest value. Then add a value at 24 equal to that
399
+ if !found_24_or_0 && new_time <= min_time_new
400
+ min_time_new = new_time
401
+ min_time_value = day_sch.getValue(time)
402
+ elsif new_time == time_24 # this was added to address time exactly at 24
403
+ min_time_new = new_time
404
+ min_time_value = day_sch.getValue(time)
405
+ found_24_or_0 = true
406
+ elsif new_time == time_0
407
+ min_time_new = new_time
408
+ min_time_value = day_sch.getValue(time_0)
409
+ found_24_or_0 = true
410
+ end
411
+ end
412
+
413
+ # push values to array
414
+ values.each do |value|
415
+ new_values << value
416
+ end
417
+
418
+ # add value for what will be 24
419
+ new_times << time_24
420
+ new_values << min_time_value
421
+
422
+ new_time_val_hash = {}
423
+ new_times.each_with_index do |time, i|
424
+ new_time_val_hash[time.totalHours] = { time: time, value: new_values[i] }
425
+ end
426
+
427
+ # clear values
428
+ day_sch.clearValues
429
+
430
+ new_time_val_hash = Hash[new_time_val_hash.sort]
431
+ prev_time = nil
432
+ new_time_val_hash.sort.each do |hours, time_val|
433
+ if prev_time.nil? || time_val[:time] - prev_time > time_1_min
434
+ day_sch.addValue(time_val[:time], time_val[:value])
435
+ prev_time = time_val[:time]
436
+ else
437
+ OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Schedules.Modify', "Time step in #{day_sch.name} between #{prev_time.toString} and #{time_val[:time].toString} is too small to support, not adding value.")
438
+ end
439
+ end
440
+ end
441
+
442
+ return schedule
443
+ end
444
+ end
445
+ end