openstudio-standards 0.2.17.rc2 → 0.3.1.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (233) hide show
  1. checksums.yaml +4 -4
  2. data/data/geometry/ASHRAESuperMarket.json +29 -38
  3. data/data/standards/OpenStudio_Standards-deer-ALL-comstock(space_types).xlsx +0 -0
  4. data/data/standards/metadata_units_OpenStudio_Standards-deer-ALL-comstockspace_types.csv +172 -0
  5. data/data/standards/test_performance_expected_dd_results.csv +12 -12
  6. data/lib/openstudio-standards/btap/analysis.rb +389 -389
  7. data/lib/openstudio-standards/btap/bridging.rb +2099 -0
  8. data/lib/openstudio-standards/btap/btap.model.rb +717 -717
  9. data/lib/openstudio-standards/btap/btap.rb +33 -30
  10. data/lib/openstudio-standards/btap/economics.rb +1163 -1163
  11. data/lib/openstudio-standards/btap/envelope.rb +4 -4
  12. data/lib/openstudio-standards/btap/equest.rb +2524 -2524
  13. data/lib/openstudio-standards/btap/fileio.rb +9 -0
  14. data/lib/openstudio-standards/btap/measures.rb +1515 -1515
  15. data/lib/openstudio-standards/btap/mpc.rb +554 -554
  16. data/lib/openstudio-standards/btap/reporting.rb +287 -287
  17. data/lib/openstudio-standards/btap/simmanager.rb +759 -759
  18. data/lib/openstudio-standards/btap/spaceloads.rb +439 -439
  19. data/lib/openstudio-standards/btap/spacetypes.rb +113 -113
  20. data/lib/openstudio-standards/btap/utilities.rb +134 -134
  21. data/lib/openstudio-standards/hvac_sizing/Siz.AirLoopHVAC.rb +8 -83
  22. data/lib/openstudio-standards/hvac_sizing/Siz.CoilCoolingWater.rb +3 -99
  23. data/lib/openstudio-standards/hvac_sizing/Siz.HeatingCoolingFuels.rb +81 -75
  24. data/lib/openstudio-standards/hvac_sizing/Siz.Model.rb +7 -306
  25. data/lib/openstudio-standards/hvac_sizing/Siz.ThermalZone.rb +70 -98
  26. data/lib/openstudio-standards/prototypes/ashrae_90_1/ashrae_90_1_2016/ashrae_90_1_2016.Model.rb +41 -14
  27. data/lib/openstudio-standards/prototypes/ashrae_90_1/ashrae_90_1_2019/ashrae_90_1_2019.Model.rb +40 -14
  28. data/lib/openstudio-standards/prototypes/common/buildings/Prototype.SuperMarket.rb +1 -23
  29. data/lib/openstudio-standards/prototypes/common/objects/Prototype.Model.exterior_lights.rb +7 -7
  30. data/lib/openstudio-standards/prototypes/common/objects/Prototype.Model.rb +5 -1
  31. data/lib/openstudio-standards/prototypes/common/objects/Prototype.ServiceWaterHeating.rb +101 -4
  32. data/lib/openstudio-standards/prototypes/common/objects/Prototype.hvac_systems.rb +16 -1
  33. data/lib/openstudio-standards/prototypes/common/objects/Prototype.refrigeration.rb +5 -4
  34. data/lib/openstudio-standards/prototypes/common/objects/Prototype.utilities.rb +24 -4
  35. data/lib/openstudio-standards/standards/Standards.AirLoopHVAC.rb +18 -2
  36. data/lib/openstudio-standards/standards/Standards.BoilerHotWater.rb +18 -0
  37. data/lib/openstudio-standards/standards/Standards.CoilCoolingDXSingleSpeed.rb +13 -10
  38. data/lib/openstudio-standards/standards/Standards.CoilDX.rb +5 -3
  39. data/lib/openstudio-standards/standards/Standards.CoilHeatingDXSingleSpeed.rb +11 -8
  40. data/lib/openstudio-standards/standards/Standards.Construction.rb +1 -1
  41. data/lib/openstudio-standards/standards/Standards.Model.rb +68 -52
  42. data/lib/openstudio-standards/standards/Standards.PlantLoop.rb +2 -2
  43. data/lib/openstudio-standards/standards/Standards.Space.rb +16 -18
  44. data/lib/openstudio-standards/standards/Standards.ThermalZone.rb +1 -1
  45. data/lib/openstudio-standards/standards/Standards.WaterHeaterMixed.rb +5 -5
  46. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2004/data/ashrae_90_1_2004.ref_cases.json +510 -0
  47. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2004/data/ashrae_90_1_2004.refrigeration_compressors.json +18 -0
  48. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2004/data/ashrae_90_1_2004.refrigeration_walkins.json +410 -0
  49. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2004/data/ashrae_90_1_2004.spc_typ.json +2 -2
  50. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2007/data/ashrae_90_1_2007.ref_cases.json +510 -0
  51. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2007/data/ashrae_90_1_2007.refrigeration_compressors.json +18 -0
  52. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2007/data/ashrae_90_1_2007.refrigeration_walkins.json +410 -0
  53. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2007/data/ashrae_90_1_2007.spc_typ.json +2 -2
  54. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2010/data/ashrae_90_1_2010.ref_cases.json +510 -0
  55. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2010/data/ashrae_90_1_2010.refrigeration_compressors.json +18 -0
  56. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2010/data/ashrae_90_1_2010.refrigeration_walkins.json +410 -0
  57. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2010/data/ashrae_90_1_2010.spc_typ.json +2 -2
  58. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2013/data/ashrae_90_1_2013.ref_cases.json +510 -0
  59. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2013/data/ashrae_90_1_2013.refrigeration_compressors.json +18 -0
  60. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2013/data/ashrae_90_1_2013.refrigeration_walkins.json +410 -0
  61. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2013/data/ashrae_90_1_2013.spc_typ.json +2 -2
  62. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2016/data/ashrae_90_1_2016.spc_typ.json +2 -2
  63. data/lib/openstudio-standards/standards/ashrae_90_1/ashrae_90_1_2019/data/ashrae_90_1_2019.spc_typ.json +2 -2
  64. data/lib/openstudio-standards/standards/ashrae_90_1/data/ashrae_90_1.entryways.json +13 -2
  65. data/lib/openstudio-standards/standards/ashrae_90_1/data/ashrae_90_1.parking.json +11 -2
  66. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.AirLoopHVAC.rb +9 -0
  67. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.Model.rb +2 -0
  68. data/lib/openstudio-standards/standards/ashrae_90_1_prm/ashrae_90_1_prm.rb +4 -3
  69. data/lib/openstudio-standards/standards/deer/deer_1985/comstock_deer_1985/data/comstock_deer_1985.spc_typ.json +405 -405
  70. data/lib/openstudio-standards/standards/deer/deer_1996/comstock_deer_1996/data/comstock_deer_1996.spc_typ.json +405 -405
  71. data/lib/openstudio-standards/standards/deer/deer_2003/comstock_deer_2003/data/comstock_deer_2003.spc_typ.json +405 -405
  72. data/lib/openstudio-standards/standards/deer/deer_2003/deer_2003.ThermalZone.rb +21 -0
  73. data/lib/openstudio-standards/standards/deer/deer_2007/comstock_deer_2007/data/comstock_deer_2007.spc_typ.json +405 -405
  74. data/lib/openstudio-standards/standards/deer/deer_2007/deer_2007.ThermalZone.rb +21 -0
  75. data/lib/openstudio-standards/standards/deer/deer_2011/comstock_deer_2011/data/comstock_deer_2011.spc_typ.json +405 -405
  76. data/lib/openstudio-standards/standards/deer/deer_2011/deer_2011.ThermalZone.rb +21 -0
  77. data/lib/openstudio-standards/standards/deer/deer_2014/comstock_deer_2014/data/comstock_deer_2014.spc_typ.json +405 -405
  78. data/lib/openstudio-standards/standards/deer/deer_2014/deer_2014.ThermalZone.rb +21 -0
  79. data/lib/openstudio-standards/standards/deer/deer_2015/comstock_deer_2015/data/comstock_deer_2015.spc_typ.json +405 -405
  80. data/lib/openstudio-standards/standards/deer/deer_2015/deer_2015.ThermalZone.rb +21 -0
  81. data/lib/openstudio-standards/standards/deer/deer_2017/comstock_deer_2017/data/comstock_deer_2017.spc_typ.json +405 -405
  82. data/lib/openstudio-standards/standards/deer/deer_2017/deer_2017.ThermalZone.rb +21 -0
  83. data/lib/openstudio-standards/standards/deer/deer_2020/comstock_deer_2020/data/comstock_deer_2020.spc_typ.json +405 -405
  84. data/lib/openstudio-standards/standards/deer/deer_2020/deer_2020.AirLoopHVAC.rb +8 -0
  85. data/lib/openstudio-standards/standards/deer/deer_2020/deer_2020.ThermalZone.rb +21 -0
  86. data/lib/openstudio-standards/standards/deer/deer_2025/comstock_deer_2025/data/comstock_deer_2025.spc_typ.json +405 -405
  87. data/lib/openstudio-standards/standards/deer/deer_2030/comstock_deer_2030/data/comstock_deer_2030.spc_typ.json +405 -405
  88. data/lib/openstudio-standards/standards/deer/deer_2035/comstock_deer_2035/data/comstock_deer_2035.spc_typ.json +405 -405
  89. data/lib/openstudio-standards/standards/deer/deer_2040/comstock_deer_2040/data/comstock_deer_2040.spc_typ.json +405 -405
  90. data/lib/openstudio-standards/standards/deer/deer_2045/comstock_deer_2045/data/comstock_deer_2045.spc_typ.json +405 -405
  91. data/lib/openstudio-standards/standards/deer/deer_2050/comstock_deer_2050/data/comstock_deer_2050.spc_typ.json +405 -405
  92. data/lib/openstudio-standards/standards/deer/deer_2055/comstock_deer_2055/data/comstock_deer_2055.spc_typ.json +405 -405
  93. data/lib/openstudio-standards/standards/deer/deer_2060/comstock_deer_2060/data/comstock_deer_2060.spc_typ.json +405 -405
  94. data/lib/openstudio-standards/standards/deer/deer_2065/comstock_deer_2065/data/comstock_deer_2065.spc_typ.json +405 -405
  95. data/lib/openstudio-standards/standards/deer/deer_2070/comstock_deer_2070/data/comstock_deer_2070.spc_typ.json +405 -405
  96. data/lib/openstudio-standards/standards/deer/deer_2075/comstock_deer_2075/data/comstock_deer_2075.spc_typ.json +405 -405
  97. data/lib/openstudio-standards/standards/deer/deer_pre_1975/comstock_deer_pre_1975/data/comstock_deer_pre_1975.spc_typ.json +405 -405
  98. data/lib/openstudio-standards/standards/necb/BTAPPRE1980/btap_pre1980.rb +1 -1
  99. data/lib/openstudio-standards/standards/necb/BTAPPRE1980/hvac_system_3_and_8_single_speed.rb +3 -1
  100. data/lib/openstudio-standards/standards/necb/BTAPPRE1980/hvac_system_4.rb +3 -1
  101. data/lib/openstudio-standards/standards/necb/BTAPPRE1980/hvac_system_6.rb +2 -2
  102. data/lib/openstudio-standards/standards/necb/ECMS/data/curves.json +233 -0
  103. data/lib/openstudio-standards/standards/necb/ECMS/data/unitary_acs.json +180 -0
  104. data/lib/openstudio-standards/standards/necb/ECMS/ecms.rb +6 -1
  105. data/lib/openstudio-standards/standards/necb/ECMS/hvac_systems.rb +807 -258
  106. data/lib/openstudio-standards/standards/necb/NECB2011/autozone.rb +102 -66
  107. data/lib/openstudio-standards/standards/necb/NECB2011/data/fuel_type_sets.json +85 -8
  108. data/lib/openstudio-standards/standards/necb/NECB2011/data/geometry/HighriseApartment.osm +2483 -992
  109. data/lib/openstudio-standards/standards/necb/NECB2011/data/geometry/LowriseApartment.osm +4 -336
  110. data/lib/openstudio-standards/standards/necb/NECB2011/data/geometry/MidriseApartment.osm +228 -231
  111. data/lib/openstudio-standards/standards/necb/NECB2011/data/heat_pumps_heating.json +12 -18
  112. data/lib/openstudio-standards/standards/necb/NECB2011/data/space_type_unit_definitions.txt +76 -0
  113. data/lib/openstudio-standards/standards/necb/NECB2011/hvac_system_1_multi_speed.rb +6 -1
  114. data/lib/openstudio-standards/standards/necb/NECB2011/hvac_system_1_single_speed.rb +111 -24
  115. data/lib/openstudio-standards/standards/necb/NECB2011/hvac_system_2_and_5.rb +1 -0
  116. data/lib/openstudio-standards/standards/necb/NECB2011/hvac_system_3_and_8_multi_speed.rb +3 -1
  117. data/lib/openstudio-standards/standards/necb/NECB2011/hvac_system_3_and_8_single_speed.rb +64 -16
  118. data/lib/openstudio-standards/standards/necb/NECB2011/hvac_system_4.rb +61 -17
  119. data/lib/openstudio-standards/standards/necb/NECB2011/hvac_system_6.rb +128 -0
  120. data/lib/openstudio-standards/standards/necb/NECB2011/hvac_systems.rb +252 -23
  121. data/lib/openstudio-standards/standards/necb/NECB2011/necb_2011.rb +316 -20
  122. data/lib/openstudio-standards/standards/necb/NECB2011/qaqc/necb_qaqc.rb +1 -1
  123. data/lib/openstudio-standards/standards/necb/NECB2011/service_water_heating.rb +4 -6
  124. data/lib/openstudio-standards/standards/necb/NECB2011/system_fuels.rb +38 -0
  125. data/lib/openstudio-standards/standards/necb/NECB2015/data/heat_pumps_heating.json +16 -24
  126. data/lib/openstudio-standards/standards/necb/NECB2015/hvac_systems.rb +48 -25
  127. data/lib/openstudio-standards/standards/necb/NECB2020/building_envelope.rb +3 -3
  128. data/lib/openstudio-standards/standards/necb/NECB2020/data/chillers.json +36 -19
  129. data/lib/openstudio-standards/standards/necb/NECB2020/data/furnaces.json +19 -4
  130. data/lib/openstudio-standards/standards/necb/NECB2020/data/heat_pumps.json +20 -40
  131. data/lib/openstudio-standards/standards/necb/NECB2020/data/heat_pumps_heating.json +74 -36
  132. data/lib/openstudio-standards/standards/necb/NECB2020/necb_2020.rb +0 -2
  133. data/lib/openstudio-standards/standards/necb/NECB2020/service_water_heating.rb +124 -57
  134. data/lib/openstudio-standards/standards/necb/common/btap_data.rb +124 -2
  135. data/lib/openstudio-standards/standards/necb/common/btap_datapoint.rb +15 -2
  136. data/lib/openstudio-standards/standards/necb/common/necb_reference_runs.csv +1 -1
  137. data/lib/openstudio-standards/utilities/simulation.rb +1 -1
  138. data/lib/openstudio-standards/version.rb +1 -1
  139. data/lib/openstudio-standards/weather/Weather.Model.rb +5 -0
  140. data/lib/openstudio-standards/weather/Weather.stat_file.rb +33 -1
  141. data/lib/openstudio-standards.rb +1 -0
  142. metadata +14 -121
  143. data/data/standards/OpenStudio_Standards-ashrae_90_1.xlsx +0 -0
  144. data/data/weather/CAN_ON_Kingston.AP.718200_TMYx.2004-2018.ddy +0 -2342
  145. data/data/weather/CAN_ON_Kingston.AP.718200_TMYx.2004-2018.epw +0 -8768
  146. data/data/weather/CAN_ON_Kingston.AP.718200_TMYx.2004-2018.stat +0 -700
  147. data/data/weather/CAN_ON_Region.of.Waterloo.Intl.AP.713680_TMYx.2004-2018.ddy +0 -2342
  148. data/data/weather/CAN_ON_Region.of.Waterloo.Intl.AP.713680_TMYx.2004-2018.epw +0 -8768
  149. data/data/weather/CAN_ON_Region.of.Waterloo.Intl.AP.713680_TMYx.2004-2018.stat +0 -700
  150. data/data/weather/CAN_ON_Sarnia-Hadfield.AP.717040_TMYx.2004-2018.ddy +0 -2342
  151. data/data/weather/CAN_ON_Sarnia-Hadfield.AP.717040_TMYx.2004-2018.epw +0 -8768
  152. data/data/weather/CAN_ON_Sarnia-Hadfield.AP.717040_TMYx.2004-2018.stat +0 -700
  153. data/data/weather/CAN_QC_Gatineau.AP.716279_TMYx.2004-2018.ddy +0 -276
  154. data/data/weather/CAN_QC_Gatineau.AP.716279_TMYx.2004-2018.epw +0 -8768
  155. data/data/weather/CAN_QC_Gatineau.AP.716279_TMYx.2004-2018.stat +0 -611
  156. data/data/weather/CAN_QC_Granby.710367_TMYx.2004-2018.ddy +0 -276
  157. data/data/weather/CAN_QC_Granby.710367_TMYx.2004-2018.epw +0 -8768
  158. data/data/weather/CAN_QC_Granby.710367_TMYx.2004-2018.stat +0 -610
  159. data/data/weather/CAN_QC_Sherbrooke.AP.716100_TMYx.2004-2018.ddy +0 -2342
  160. data/data/weather/CAN_QC_Sherbrooke.AP.716100_TMYx.2004-2018.epw +0 -8768
  161. data/data/weather/CAN_QC_Sherbrooke.AP.716100_TMYx.2004-2018.stat +0 -700
  162. data/data/weather/CAN_QC_Trois.Rivieres.717240_TMYx.2004-2018.ddy +0 -2342
  163. data/data/weather/CAN_QC_Trois.Rivieres.717240_TMYx.2004-2018.epw +0 -8768
  164. data/data/weather/CAN_QC_Trois.Rivieres.717240_TMYx.2004-2018.stat +0 -700
  165. data/lib/openstudio-standards/hvac_sizing/Siz.AirConditionerVariableRefrigerantFlow.rb +0 -81
  166. data/lib/openstudio-standards/hvac_sizing/Siz.AirLoopHVACUnitaryHeatCoolVAVChngByp.rb +0 -27
  167. data/lib/openstudio-standards/hvac_sizing/Siz.AirLoopHVACUnitaryHeatPumpAirToAir.rb +0 -69
  168. data/lib/openstudio-standards/hvac_sizing/Siz.AirLoopHVACUnitaryHeatPumpAirToAirMultiSpeed.rb +0 -178
  169. data/lib/openstudio-standards/hvac_sizing/Siz.AirLoopHVACUnitarySystem.rb +0 -27
  170. data/lib/openstudio-standards/hvac_sizing/Siz.AirTermSnglDuctConstVolCooledBeam.rb +0 -27
  171. data/lib/openstudio-standards/hvac_sizing/Siz.AirTermSnglDuctConstVolFourPipeInduction.rb +0 -27
  172. data/lib/openstudio-standards/hvac_sizing/Siz.AirTermSnglDuctConstVolReheat.rb +0 -27
  173. data/lib/openstudio-standards/hvac_sizing/Siz.AirTermSnglDuctParallelPIUReheat.rb +0 -67
  174. data/lib/openstudio-standards/hvac_sizing/Siz.AirTermSnglDuctSeriesPIUReheat.rb +0 -27
  175. data/lib/openstudio-standards/hvac_sizing/Siz.AirTermSnglDuctUncontrolled.rb +0 -30
  176. data/lib/openstudio-standards/hvac_sizing/Siz.AirTermSnglDuctVAVHeatAndCoolNoReheat.rb +0 -27
  177. data/lib/openstudio-standards/hvac_sizing/Siz.AirTermSnglDuctVAVHeatAndCoolReheat.rb +0 -27
  178. data/lib/openstudio-standards/hvac_sizing/Siz.AirTermSnglDuctVAVNoReheat.rb +0 -68
  179. data/lib/openstudio-standards/hvac_sizing/Siz.AirTermSnglDuctVAVReheat.rb +0 -68
  180. data/lib/openstudio-standards/hvac_sizing/Siz.BoilerHotWater.rb +0 -42
  181. data/lib/openstudio-standards/hvac_sizing/Siz.BoilerSteam.rb +0 -27
  182. data/lib/openstudio-standards/hvac_sizing/Siz.ChillerElectricEIR.rb +0 -58
  183. data/lib/openstudio-standards/hvac_sizing/Siz.CoilCoolingDXMultiSpeed.rb +0 -171
  184. data/lib/openstudio-standards/hvac_sizing/Siz.CoilCoolingDXSingleSpeed.rb +0 -56
  185. data/lib/openstudio-standards/hvac_sizing/Siz.CoilCoolingDXTwoSpeed.rb +0 -89
  186. data/lib/openstudio-standards/hvac_sizing/Siz.CoilCoolingDXVariableRefrigerantFlow.rb +0 -50
  187. data/lib/openstudio-standards/hvac_sizing/Siz.CoilCoolingWaterToAirHeatPumpEquationFit.rb +0 -69
  188. data/lib/openstudio-standards/hvac_sizing/Siz.CoilHeatingDXMultiSpeed.rb +0 -120
  189. data/lib/openstudio-standards/hvac_sizing/Siz.CoilHeatingDXSingleSpeed.rb +0 -56
  190. data/lib/openstudio-standards/hvac_sizing/Siz.CoilHeatingDXVariableRefrigerantFlow.rb +0 -41
  191. data/lib/openstudio-standards/hvac_sizing/Siz.CoilHeatingDesuperheater.rb +0 -27
  192. data/lib/openstudio-standards/hvac_sizing/Siz.CoilHeatingElectric.rb +0 -30
  193. data/lib/openstudio-standards/hvac_sizing/Siz.CoilHeatingGas.rb +0 -30
  194. data/lib/openstudio-standards/hvac_sizing/Siz.CoilHeatingGasMultiStage.rb +0 -68
  195. data/lib/openstudio-standards/hvac_sizing/Siz.CoilHeatingWater.rb +0 -61
  196. data/lib/openstudio-standards/hvac_sizing/Siz.CoilHeatingWaterToAirHeatPumpEquationFit.rb +0 -57
  197. data/lib/openstudio-standards/hvac_sizing/Siz.CoilWaterHeatingDesuperheater.rb +0 -27
  198. data/lib/openstudio-standards/hvac_sizing/Siz.ControllerOutdoorAir.rb +0 -59
  199. data/lib/openstudio-standards/hvac_sizing/Siz.ControllerWaterCoil.rb +0 -49
  200. data/lib/openstudio-standards/hvac_sizing/Siz.CoolingTowerSingleSpeed.rb +0 -90
  201. data/lib/openstudio-standards/hvac_sizing/Siz.CoolingTowerTwoSpeed.rb +0 -83
  202. data/lib/openstudio-standards/hvac_sizing/Siz.CoolingTowerVariableSpeed.rb +0 -57
  203. data/lib/openstudio-standards/hvac_sizing/Siz.DistrictCooling.rb +0 -27
  204. data/lib/openstudio-standards/hvac_sizing/Siz.DistrictHeating.rb +0 -27
  205. data/lib/openstudio-standards/hvac_sizing/Siz.EvaporativeCoolerDirectResearchSpecial.rb +0 -27
  206. data/lib/openstudio-standards/hvac_sizing/Siz.EvaporativeCoolerIndirectResearchSpecial.rb +0 -27
  207. data/lib/openstudio-standards/hvac_sizing/Siz.EvaporativeFluidCoolerSingleSpeed.rb +0 -27
  208. data/lib/openstudio-standards/hvac_sizing/Siz.FanConstantVolume.rb +0 -29
  209. data/lib/openstudio-standards/hvac_sizing/Siz.FanOnOff.rb +0 -27
  210. data/lib/openstudio-standards/hvac_sizing/Siz.FanVariableVolume.rb +0 -29
  211. data/lib/openstudio-standards/hvac_sizing/Siz.HeaderedPumpsConstantSpeed.rb +0 -55
  212. data/lib/openstudio-standards/hvac_sizing/Siz.HeaderedPumpsVariableSpeed.rb +0 -55
  213. data/lib/openstudio-standards/hvac_sizing/Siz.HeatExchangerAirToAirSensibleAndLatent.rb +0 -38
  214. data/lib/openstudio-standards/hvac_sizing/Siz.HeatExchangerFluidToFluid.rb +0 -27
  215. data/lib/openstudio-standards/hvac_sizing/Siz.HumidifierSteamElectric.rb +0 -27
  216. data/lib/openstudio-standards/hvac_sizing/Siz.PlantLoop.rb +0 -42
  217. data/lib/openstudio-standards/hvac_sizing/Siz.PumpConstantSpeed.rb +0 -59
  218. data/lib/openstudio-standards/hvac_sizing/Siz.PumpVariableSpeed.rb +0 -59
  219. data/lib/openstudio-standards/hvac_sizing/Siz.SizingSystem.rb +0 -48
  220. data/lib/openstudio-standards/hvac_sizing/Siz.WaterHeaterMixed.rb +0 -16
  221. data/lib/openstudio-standards/hvac_sizing/Siz.ZoneHVACBaseboardConvectiveElectric.rb +0 -27
  222. data/lib/openstudio-standards/hvac_sizing/Siz.ZoneHVACBaseboardConvectiveWater.rb +0 -27
  223. data/lib/openstudio-standards/hvac_sizing/Siz.ZoneHVACFourPipeFanCoil.rb +0 -27
  224. data/lib/openstudio-standards/hvac_sizing/Siz.ZoneHVACHighTemperatureRadiant.rb +0 -27
  225. data/lib/openstudio-standards/hvac_sizing/Siz.ZoneHVACIdealLoadsAirSystem.rb +0 -27
  226. data/lib/openstudio-standards/hvac_sizing/Siz.ZoneHVACLowTempRadiantConstFlow.rb +0 -27
  227. data/lib/openstudio-standards/hvac_sizing/Siz.ZoneHVACLowTempRadiantVarFlow.rb +0 -27
  228. data/lib/openstudio-standards/hvac_sizing/Siz.ZoneHVACLowTemperatureRadiantElectric.rb +0 -27
  229. data/lib/openstudio-standards/hvac_sizing/Siz.ZoneHVACPackagedTerminalAirConditioner.rb +0 -88
  230. data/lib/openstudio-standards/hvac_sizing/Siz.ZoneHVACPackagedTerminalHeatPump.rb +0 -88
  231. data/lib/openstudio-standards/hvac_sizing/Siz.ZoneHVACTerminalUnitVariableRefrigerantFlow.rb +0 -104
  232. data/lib/openstudio-standards/hvac_sizing/Siz.ZoneHVACUnitHeater.rb +0 -27
  233. data/lib/openstudio-standards/hvac_sizing/Siz.ZoneHVACWaterToAirHeatPump.rb +0 -27
@@ -1,1515 +1,1515 @@
1
- # *********************************************************************
2
- # * Copyright (c) 2008-2015, Natural Resources Canada
3
- # * All rights reserved.
4
- # *
5
- # * This library is free software; you can redistribute it and/or
6
- # * modify it under the terms of the GNU Lesser General Public
7
- # * License as published by the Free Software Foundation; either
8
- # * version 2.1 of the License, or (at your option) any later version.
9
- # *
10
- # * This library is distributed in the hope that it will be useful,
11
- # * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
- # * Lesser General Public License for more details.
14
- # *
15
- # * You should have received a copy of the GNU Lesser General Public
16
- # * License along with this library; if not, write to the Free Software
17
- # * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
- # **********************************************************************/
19
-
20
-
21
- # To change this template, choose Tools | Templates
22
- # and open the template in the editor.
23
- require "#{File.dirname(__FILE__)}/btap"
24
-
25
- class OSMArg
26
- ARGUMENT_TYPES = [
27
- "BOOL",
28
- "STRING",
29
- "INTEGER",
30
- "FLOAT",
31
- "STRINGCHOICE",
32
- "WSCHOICE"
33
- ]
34
-
35
-
36
-
37
- attr_accessor :runner,
38
- :variable_name,
39
- :type,
40
- :required,
41
- :model_dependant,
42
- :display_name,
43
- :default_value,
44
- :min_value,
45
- :max_value,
46
- :string_choice_array,
47
- :os_object_type
48
-
49
- def self.bool( variable_name,display_name,required,default_value )
50
- raise "#{default_value} defaut value is not a bool." unless default_value.is_a?(Bool)
51
- default_value.respond_to?(:to_s)
52
- arg = OSMArg.new( "BOOL", variable_name, display_name, required)
53
- arg.default_value = default_value
54
- return arg
55
- end
56
-
57
- def self.string( variable_name,display_name,required,default_value )
58
- raise "#{default_value} defaut value is not a string." unless default_value.respond_to?(:to_s)
59
- arg = OSMArg.new( "STRING", variable_name, display_name, required)
60
- arg.default_value = default_value
61
- return arg
62
- end
63
-
64
- def self.integer( variable_name,display_name,required,default_value,min_value,max_value )
65
- raise "#{default_value} defaut value is not a integer." unless default_value.respond_to?(:to_i)
66
- arg = OSMArg.new( "INTEGER", variable_name, display_name, required)
67
- arg.default_value = default_value
68
- arg.min_value = min_value
69
- arg.max_value = max_value
70
- return arg
71
- end
72
-
73
- def self.float( variable_name, display_name, required,default_value,min_value, max_value )
74
- raise "#{default_value} defaut value is not a float." unless default_value.respond_to?(:to_f)
75
- arg = OSMArg.new( "INTEGER", variable_name, display_name, required)
76
- arg.default_value = default_value
77
- arg.min_value = min_value
78
- arg.max_value = max_value
79
- return arg
80
- end
81
-
82
- def self.choice(variable_name,display_name,required,default_value,string_choice_array)
83
- raise "#{default_value} defaut value is not an array." unless default_value.is_a?(Array)
84
- arg = OSMArg.new( "STRINGCHOICE", variable_name, display_name, required)
85
- arg.default_value = default_value
86
- arg.string_choice_array = string_choice_array
87
- return arg
88
- end
89
-
90
- def self.wschoice( variable_name, display_name, required, default_value, os_object_type)
91
- arg = OSMArg.new( "WSCHOICE", variable_name, display_name, required )
92
- arg.default_value = default_value
93
- arg.os_object_type = os_object_type
94
- return arg
95
- end
96
-
97
- def initialize( type, variable_name, display_name, required )
98
- self.type = type
99
- self.variable_name = variable_name
100
- self.display_name = display_name
101
- self.required = required
102
- self.model_dependant = false
103
- if self.type == "WSCHOICE"
104
- self.model_dependant = true
105
- else
106
- self.model_dependant = false
107
- end
108
- return self
109
- end
110
- end
111
-
112
-
113
-
114
-
115
-
116
- module BTAP
117
- module Measures
118
- module OSMeasures
119
-
120
-
121
-
122
-
123
- class BTAPModelUserScript < OpenStudio::Ruleset::ModelUserScript
124
- #if and E+ measure replace OpenStudio::Ruleset::ModelUserScript with OpenStudio::Ruleset::WorkspaceUserScript
125
- #Array containing information of all inputs required by measure.
126
- attr_accessor :argument_array_of_arrays
127
- attr_accessor :argument_array
128
- attr_accessor :file
129
- #Name of measure
130
- #attr_accessor :name
131
-
132
- #if and E+ measure replace OpenStudio::Ruleset::ModelUserScript with OpenStudio::Ruleset::WorkspaceUserScript
133
- def name
134
- "BTAPModelUserScript"
135
- OSMArgument.new
136
- end
137
-
138
- #this method will output the ruby macro to perform the change.
139
- def generate_ruby_macro(model,runner)
140
- if @file == nil or @file == ""
141
- @file = "Enter_Path_To_#{self.class.name}_measure.rb_File!"
142
- end
143
- BTAP::runner_register("MACRO", "\##{self.class.name} Measure Start", runner)
144
- BTAP::runner_register("MACRO", "require \"#{@file}\"", runner)
145
- BTAP::runner_register("MACRO", "argument_values = #{@arg_table}", runner)
146
- BTAP::runner_register("MACRO", "#{self.class.name}.new.set_user_arguments_and_apply(model,argument_values,runner)",runner)
147
- BTAP::runner_register("MACRO", "\##{self.class.name} Measure End", runner)
148
- end
149
-
150
- def set_user_arguments_and_apply(model,argument_values,runner)
151
- message = "Settting Arguments"
152
- runner.nil? ? puts(message) : runner.registerInfo(message)
153
- #create argument map
154
- user_arguments = OpenStudio::Ruleset::OSArgumentMap.new
155
- #get argument list
156
- arguments = self.arguments(model)
157
- #go through each argument
158
- arguments.each do |argument|
159
- found = false
160
- #go through each passed argument_values
161
- argument_values.each do |pair|
162
- #when a match is found.
163
- if argument.name == pair[0]
164
-
165
- clone_argument = argument.clone
166
- unless clone_argument.setValue(pair[1])
167
- message = "Could not set #{argument.name} to #{pair[1]}"
168
- runner.nil? ? puts(message) : runner.registerError(message)
169
- else
170
- message = "Set #{argument.name} to #{pair[1]}"
171
- runner.nil? ? puts(message) : runner.registerInfo(message)
172
- end
173
- user_arguments[pair[0]] = clone_argument
174
- #log message
175
- message = " Argument set to #{user_arguments}"
176
- runner.nil? ? puts(message) : runner.registerInfo(message)
177
- end
178
- found = true
179
- end
180
- puts ("Warning: value for argument #{argument.name} not set!.") if found == false
181
- end
182
- self.run(model, runner, user_arguments)
183
- end
184
-
185
- def run(model, runner, user_arguments)
186
- #IF and E+ measure replace model with workspace as the argument
187
- #Boilerplate start
188
- super(model, runner, user_arguments)
189
- BTAP::runner_register("INFO", "Initial model being modified by #{self.class.name}",runner)
190
- if not runner.validateUserArguments(self.arguments(model),user_arguments)
191
- return false
192
- end
193
-
194
- #Set argument to instance variables.
195
- self.argument_getter(model, runner,user_arguments)
196
- #will run the childs method measure_code
197
- result = self.measure_code(model,runner)
198
- generate_ruby_macro(model,runner)
199
- return result
200
- end # end method run
201
-
202
- def argument_setter(model,args)
203
- #***boilerplate code starts. Do not edit...
204
-
205
-
206
- #iterate through array of hashes and make arguments based on type and set
207
- # max and min values where applicable.
208
- @argument_array.each do |row|
209
- #strip out first char that contains the @ symbol
210
- row.variable_name[0] = ''
211
- arg = nil
212
- case row.type
213
- when "BOOL"
214
- arg = OpenStudio::Ruleset::OSArgument::makeBoolArgument(row.variable_name,row.required,row.model_dependant)
215
- when "STRING"
216
- arg = OpenStudio::Ruleset::OSArgument::makeStringArgument(row.variable_name,row.required,row.model_dependant)
217
- when "INTEGER"
218
- arg = OpenStudio::Ruleset::OSArgument::makeIntegerArgument(row.variable_name,row.required,row.model_dependant)
219
- arg.setMaxValue( row.max_value.to_i ) unless row.min_value.nil?
220
- arg.setMaxValue( row.max_value.to_i ) unless row.max_value.nil?
221
- when "FLOAT"
222
- arg = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(row.variable_name,row.required,row.model_dependant)
223
- arg.setMaxValue( row.max_value.to_f ) unless row.min_value.nil?
224
- arg.setMaxValue( row.max_value.to_f ) unless row.max_value.nil?
225
- when "STRINGCHOICE"
226
- # #add string choices one by one.
227
- chs = OpenStudio::StringVector.new
228
- row.string_choice_array.each {|choice| chs << choice}
229
- arg = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(row.variable_name, chs,row.required,row.model_dependant)
230
- when "PATH"
231
- arg = OpenStudio::Ruleset::OSArgument::makePathArgument("alternativeModelPath",true,"osm")
232
- when "WSCHOICE"
233
- arg = OpenStudio::Ruleset::makeChoiceArgumentOfWorkspaceObjects( row.variable_name, row.os_object_type.to_IddObjectType , model, row.required)
234
- end
235
- # #common argument aspects.
236
- unless arg.nil?
237
- arg.setDisplayName(row.display_name)
238
- arg.setDefaultValue(row.default_value) unless row.default_value.nil?
239
- args << arg
240
- end
241
- end
242
- return args
243
- end
244
-
245
- def argument_getter(model, runner,user_arguments)
246
- @arg_table = []
247
- unless @argument_array == nil
248
- @argument_array.each do |row|
249
- name = row.variable_name
250
-
251
- case row.type
252
- when "BOOL"
253
- value = runner.getBoolArgumentValue(name, user_arguments)
254
- instance_variable_set("@#{name}",value)
255
- @arg_table << [name,value]
256
- when "STRING"
257
- value = runner.getStringArgumentValue(name, user_arguments)
258
- instance_variable_set("@#{name}",value)
259
- @arg_table << [name,value]
260
- when "INTEGER"
261
- value = runner.getIntegerArgumentValue(name, user_arguments)
262
- instance_variable_set("@#{name}",value)
263
- @arg_table << [name,value]
264
- if ( not row.min_value.nil? and instance_variable_get("@#{name}") < row.min_value ) or ( not row.max_value.nil? and instance_variable_get("@#{name}") > row.max_value )
265
- runner.registerError("#{row.display_name} must be greater than or equal to #{row.min_value} and less than or equal to #{row.max_value}. You entered #{instance_variable_get("@#{name}")}.")
266
- return false
267
- end
268
- when "FLOAT"
269
- value = runner.getDoubleArgumentValue(name, user_arguments)
270
- instance_variable_set("@#{name}",value)
271
- @arg_table << [name,value]
272
-
273
- if ( not row.min_value.nil? and instance_variable_get("@#{name}") < row.min_value ) or ( not row.max_value.nil? and instance_variable_get("@#{name}") > row.max_value )
274
- runner.registerError("#{row.display_name} must be greater than or equal to #{row.min_value} and less than or equal to #{row.max_value}. You entered #{instance_variable_get("@#{name}")}.")
275
- return false
276
- end
277
- when "STRINGCHOICE"
278
- @arg_table << [name,runner.getBoolArgumentValue(name, user_arguments)]
279
- instance_variable_set("@#{name}", runner.getStringArgumentValue(name, user_arguments) )
280
- when "WSCHOICE"
281
- @arg_table << [name,runner.getBoolArgumentValue(name, user_arguments)]
282
- instance_variable_set("@#{name}", runner.getOptionalWorkspaceObjectChoiceValue(name, user_arguments,model) )
283
-
284
- when "PATH"
285
- @arg_table << [name,runner.getBoolArgumentValue(name, user_arguments)]
286
- instance_variable_set("@#{name}", runner.getPathArgument(name, user_arguments) )
287
- end #end case
288
- end #end do
289
- end
290
- return @arg_table
291
- end
292
-
293
- end
294
- #Measure Template simplified.
295
- class TemplateModelMeasure < BTAPModelUserScript
296
-
297
- def name
298
- "BTAPTempModelMeasure"
299
- end
300
-
301
- def arguments(model)
302
-
303
- #bool
304
- @argument_array << OSMArgument.bool(variable_name,display_name,required,default_value)
305
- #string
306
- @argument_array << OSMArgument.string(variable_name,display_name,required,default_value)
307
- #integer
308
- @argument_array << OSMArgument.integer(variable_name,display_name,required,default_value,min_value,max_value)
309
- #float
310
- @argument_array << OSMArgument.float(variable_name,display_name,required,default_value,min_value,max_value)
311
- #Choice
312
- @argument_array << OSMArgument.choice(variable_name,display_name,required,default_value,string_choice_array)
313
- #Workspace choice (using zones as an example)
314
- @argument_array << OSMArgument.wschoice(variable_name,display_name,required,default_value,string_choice_array)
315
- args = super(model,@argument_array)
316
- return args
317
- end
318
-
319
- def run(model, runner, user_arguments)
320
- #IF and E+ measure replace model with workspace as the argument
321
- #Boilerplate start
322
- parent_method_is_true = super(model, runner, user_arguments)
323
-
324
-
325
- #Start measure changes based on model.
326
- puts @boolean_argument_name
327
- puts @string_argument_name
328
- puts @integer_argument_name
329
- puts @float_argument_name
330
- puts @choice_argument_name
331
- puts @ws_choice_argument_name
332
-
333
-
334
-
335
-
336
- #Do your stuff here!
337
- #Here are some logging methods for reference.
338
- # runner.registerInitialCondition("Model initial condition (for example number of floors.")
339
- # runner.registerInfo("Use this for information to user.")
340
- # runner.registerWarning("Use this for warnings to user.")
341
- # runner.registerError("Use this for fatal error message to user. Will not continue. Return a false.") ; return false
342
- # runner.registerAsNotApplicable("Measure not applicable because XYZ. Return a true and will continue with other chained measures."); return true
343
- # runner.registerFinalCondition("Model ended with # of floors for example")
344
- # runner.registerFinalCondition("Indicate what was changed.")
345
-
346
-
347
- #If everything went well..
348
- return true ? parent_method_is_true : false
349
- end # end method run
350
-
351
- #For manually running script via an IDE or a command line.
352
- #Using the template above as an example.....
353
- # argument_values = [
354
- #
355
- # ["boolean_argument_name", true ],
356
- # ["string_argument_name", "some string" ],
357
- # ["integer_argument_name", 1 ],
358
- # ["float_argument_name", 0.001 ],
359
- # ["choice_argument_name", "choice1" ],
360
- # ["ws_choice_argument_name", "zone1" ],
361
- # ["path_argument_name", OpenStudio::Path.new(File.dirname(__FILE__))]
362
- # ]
363
- #
364
- def set_user_arguments_and_apply(model,argument_values,runner)
365
- self.run(model, runner, super(model,argument_values,runner) )
366
- end
367
-
368
- end
369
-
370
- class ArchetypeScan < BTAPModelUserScript
371
-
372
- def name
373
- "BTAPTempModelMeasure"
374
- end
375
-
376
- def arguments(model)
377
- #get all osm files in resource folder.
378
- osmfiles = OpenStudio::StringVector.new
379
- BTAP::FileIO::get_find_files_from_folder_by_extension(File.dirname(__FILE__), ".osm").each {|filename| osmfiles << File.basename(file_name, ",osm")}
380
-
381
-
382
- #list of arguments as they will appear in the interface. They are available in the run command as @variable_name.
383
- @argument_array_of_arrays = [
384
- [ "variable_name", "type", "required", "model_dependant", "display_name", "default_value", "min_value", "max_value", "string_choice_array", "os_object_type" ],
385
- [ "archetype_name", "STRINGCHOICE", true, false, "archetype_name", osmfiles[0].to_s , nil, nil, osmfiles, nil ],
386
- ]
387
- args = super(model,@argument_array_of_arrays)
388
- return args
389
- end
390
-
391
- def run(model, runner, user_arguments)
392
- #run the super
393
- parent_method_is_true = super(model, runner, user_arguments)
394
-
395
-
396
- ###############
397
-
398
- #Set Archetype name in runner.
399
- runner.registerValue('archetype_name',@archetype_name)
400
-
401
- #Set path to OSM files.
402
- alternative_model_path = OpenStudio::Path.new("#{File.dirname(__FILE__)}/#{@archetype_name}.osm")
403
- #load model and test.
404
- translator = OpenStudio::OSVersion::VersionTranslator.new
405
- oModel = translator.loadModel(alternative_model_path)
406
- if oModel.empty?
407
- runner.registerError("Could not load alternative model from '" + alternative_model_path.to_s + "'.")
408
- return false
409
- end
410
- new_model = oModel.get
411
-
412
- # pull original weather file object over
413
- weather_file = new_model.getOptionalWeatherFile
414
- if not weather_file.empty?
415
- weather_file.get.remove
416
- runner.registerInfo("Removed alternate model's weather file object.")
417
- end
418
- original_weather_file = model.getOptionalWeatherFile
419
- if not original_weather_file.empty?
420
- original_weather_file.get.clone(new_model)
421
- end
422
-
423
- # pull original design days over
424
- new_model.getDesignDays.sort.each { |designDay| designDay.remove }
425
- model.getDesignDays.sort.each { |designDay| designDay.clone(new_model) }
426
-
427
- #swap underlying data in model with underlying data in newModel
428
- model.swap(new_model)
429
- runner.registerFinalCondition("Model replaced with alternative #{alternative_model_path}.")
430
- return true ? parent_method_is_true : false
431
- end # end method run
432
-
433
- #For manually running script via an IDE or a command line script.
434
- #Using the template above as an example.....
435
- # argument_values = [
436
- # ["archetype_name", "FullServiceRestaurant" ]
437
- # ]
438
- #
439
- def set_user_arguments_and_apply(model,argument_values,runner)
440
- self.run(model, runner, super(model,argument_values,runner) )
441
- end
442
- end
443
- end
444
-
445
- class CSV_Measures
446
- def initialize(
447
- csv_file,
448
- script_root_folder_path
449
- )
450
- @csv_file_path = csv_file
451
- @csv_data = nil
452
- @script_root_folder_path = script_root_folder_path
453
- end
454
-
455
-
456
- # A tiny bit of metacode to assign some instance variables named as above. This will set
457
- # the above variable first to nil, then, if present in the csv row data received, the actual construction data values.
458
- # So we should after this loop access @ext_wall_rsi for example. If the variable is not present in the row. It will default the value to zero.
459
- # It should automatically make floats and strings accordingly.
460
- def set_instance_variables(measure_values)
461
-
462
- measure_values.each do |variable|
463
- instance_variable_set("@#{variable}", nil )
464
- instance_variable_set("@#{variable}", @csv_data[ variable ] ) unless ( (@csv_data.nil? == true ) or (@csv_data.has_key?(variable) == false) or (@csv_data[variable].to_s.strip.downcase == "na"))
465
- end
466
- end
467
-
468
- def are_all_instance_variables_nil?(measure_values)
469
- value = true
470
- measure_values.each do |variable|
471
- value = false unless instance_variable_get("@#{variable}").nil?
472
- end
473
- return value
474
- end
475
-
476
- end
477
- class CSV_OS_Measures < CSV_Measures
478
- #loading methods
479
- def side_load_base_model_building( model )
480
- log_message = ""
481
- measure_values =["base_model_rel_path"]
482
- #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
483
- self.set_instance_variables(measure_values)
484
- puts osm_model_full_path = "#{@script_root_folder_path}/#{@base_model_rel_path}"
485
- newModel = BTAP::FileIO::load_osm(osm_model_full_path,"-")
486
- model.swap(newModel)
487
- log_message << "\nModel replaced with alternative model #{osm_model_full_path}.\n"
488
- end
489
- def load_base_model_building()
490
- log_message = ""
491
- measure_values =[
492
- "base_model_rel_path"
493
- ]
494
- #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
495
- self.set_instance_variables(measure_values)
496
- osm_model_full_path = "#{@script_root_folder_path}/#{@base_model_rel_path}"
497
- model = BTAP::FileIO::load_osm(osm_model_full_path,"-")
498
- log_message << "\nModel rloaded #{osm_model_full_path}.\n"
499
- return model
500
- end
501
- def set_weather_file(model)
502
- measure_values =["weather_file_rel_path"]
503
- #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
504
- self.set_instance_variables(measure_values)
505
- BTAP::Site::set_weather_file(model,"#{@script_root_folder_path}/#{@weather_file_rel_path}") unless @weather_file_rel_path.nil?
506
- return "Set weather file to #{@weather_file_rel_path}.\n"
507
- end
508
- def set_hourly_output(model)
509
- #create array of output variables strings from E+
510
- output_variable_array =
511
- [
512
- "Facility Total Electric Demand Power",
513
- "Water Heater Gas Rate",
514
- "Plant Supply Side Heating Demand Rate",
515
- "Heating Coil Gas Rate",
516
- "Cooling Coil Electric Power",
517
- "Boiler Gas Rate",
518
- "Heating Coil Air Heating Rate",
519
- "Heating Coil Electric Power",
520
- "Cooling Coil Total Cooling Rate",
521
- "Water Heater Heating Rate",
522
- # "Facility Total HVAC Electric Demand Power",
523
- # "Facility Total Electric Demand Power",
524
- "Zone Air Temperature",
525
- "Water Heater Electric Power"
526
- # "Baseboard Air Inlet Temperature",
527
- # "Baseboard Air Outlet Temperature",
528
- # "Baseboard Water Inlet Temperature",
529
- # "Baseboard Water Outlet Temperature",
530
- # "Boiler Inlet Temperature",
531
- # "Boiler Outlet Temperature",
532
- # "Plant Supply Side Inlet Temperature",
533
- # "Plant Supply Side Outlet Temperature",
534
- # "People Radiant Heating Rate",
535
- # "People Sensible Heating Rate",
536
- # "People Latent Gain Rate",
537
- # "People Total Heating Rate",
538
- # "Lights Total Heating Rate",
539
- # "Electric Equipment Total Heating Rate",
540
- # "Other Equipment Total Heating Rate",
541
- # "District Heating Hot Water Rate",
542
- # "District Heating Rate",
543
- # "Air System Outdoor Air Flow Fraction",
544
- # "Air System Outdoor Air Minimum Flow Fraction",
545
- # "Air System Fan Electric Energy"
546
- ]
547
- BTAP::Reports::set_output_variables(model,"Hourly", output_variable_array)
548
- return "added output variables ..." << output_variable_array.to_s << "\n"
549
- end
550
-
551
- #Helper methods
552
- def create_cold_lake_vintages(output_folder = nil)
553
- # check if only a single vintage was requested or a full set.
554
- baseline_models = Hash.new()
555
- prototype_models = Hash.new()
556
-
557
- puts "Creating Baseline models"
558
- CSV.foreach( @csv_file_path, :headers => true, :converters => :all ) do |row|
559
- @csv_data = row
560
- unless @csv_data["measure_id"] == "NA"
561
- model = self.load_base_model_building()
562
- self.set_weather_file(model)
563
- self.set_hourly_output(model)
564
-
565
- model,log = self.apply_ecms(model,@csv_data)
566
- BTAP::FileIO::save_osm( model, "#{output_folder}/#{BTAP::FileIO::get_name(model)}.osm") unless output_folder.nil?
567
- File.open("#{output_folder}/#{BTAP::FileIO::get_name(model)}.log", 'w') { |file| file.write(log) } unless output_folder.nil?
568
- baseline_models[BTAP::FileIO::get_name(model)] = model
569
- end
570
- end
571
-
572
- #create ECM models.
573
- puts "Creating ECM models"
574
- counter = 0
575
- baseline_models.each do |name,model|
576
- #Scan folder and get the ecm csv files.
577
- ecm_csv_files = Dir.glob( "#{@script_root_folder_path}/**/ecm_*.csv" )
578
- #iterate through each csv file.
579
- ecm_csv_files.each do |ecm_csv_file|
580
- puts "evaluating #{ecm_csv_file}"
581
-
582
- # iterate through each row
583
- CSV.foreach( ecm_csv_file, :headers => true, :converters => :all ) do |row|
584
-
585
- # If row baseline matches current baseline name then
586
- if name == "#{row["building_type"]}~#{row["vintage_name"]}~baseline"
587
- #Skip row if measure_id is NA
588
- counter = counter + 1
589
- if row["measure_id"].nil? or row["measure_id"].upcase.strip == "NA" or row["measure_id"].upcase.strip == ""
590
- else
591
- new_model = BTAP::FileIO::deep_copy(model)
592
- new_model,log = self.apply_ecms(new_model,row)
593
- BTAP::FileIO::save_osm( new_model, "#{output_folder}/#{BTAP::FileIO::get_name(new_model)}.osm") unless output_folder.nil?
594
- File.open("#{output_folder}/#{BTAP::FileIO::get_name(new_model)}.log", 'w') { |file| file.write(log) } unless output_folder.nil?
595
- end
596
- end
597
- end
598
- end
599
- end
600
- puts "ECM generation completed."
601
- end
602
- def apply_ecms(model,row_data)
603
- log = ""
604
- @csv_data = row_data
605
- self.methods.select{ |i| i[/^ecm_.*$/] }.each do |ecm_method_name|
606
- log << "**********#{ecm_method_name}\n"
607
- raise ("model is nil") if model.nil?
608
- raise ("name is nil") if ecm_method_name.nil?
609
- log << self.method(ecm_method_name).call(model)
610
- end
611
- return model,log
612
- end
613
-
614
- #ecms
615
- def ecm_capital_costs(model)
616
- log = ""
617
- measure_values =
618
- [
619
- "measure_id",
620
- "cost_per_floor_m2",
621
- "cost_per_building"
622
- ]
623
- self.set_instance_variables( measure_values )
624
-
625
- #cost per building and building area
626
- building = model.building.get
627
- raise ("you did not enter a cost for measure #{@measure_id}. All measures must have a cost of at least 0.0 . Please add a cost_per_building field.") if @cost_per_building.nil?
628
- unless @cost_per_building.nil?
629
- BTAP::Resources::Economics::object_cost(building,"#{@measure_id} Capital Cost per building",@cost_per_building.to_f,"CostPerEach")
630
- log << "added cost of #{@measure_id} per building for #{@measure_id}"
631
- puts log
632
- end
633
- return log
634
- end
635
- def ecm_id(model)
636
- log = ""
637
- measure_values =
638
- [
639
- "building_type",
640
- "vintage_name",
641
- "measure_id"
642
- ]
643
- self.set_instance_variables( measure_values )
644
- BTAP::FileIO::set_name(model,"#{@building_type}~#{@vintage_name}~#{@measure_id}")
645
- puts BTAP::FileIO::get_name(model)
646
- return "Changed name to #{BTAP::FileIO::get_name(model)}"
647
-
648
- end
649
- def ecm_envelope( model )
650
- log = ""
651
- #List of variables required by this measure that are to be extracted from CSV row.
652
- measure_values =
653
- [
654
- "library_file",
655
- "default_construction_set_name",
656
- "ext_wall_rsi",
657
- "ext_floor_rsi",
658
- "ext_roof_rsi",
659
- "ground_wall_rsi",
660
- "ground_floor_rsi",
661
- "ground_roof_rsi",
662
- "fixed_window_rsi",
663
- "fixed_wind_solar_trans",
664
- "fixed_wind_vis_trans",
665
- "operable_window_rsi",
666
- "operable_wind_solar_trans",
667
- "operable_wind_vis_trans",
668
- "door_construction_rsi",
669
- "glass_door_rsi",
670
- "glass_door_solar_trans",
671
- "glass_door_vis_trans",
672
- "overhead_door_rsi",
673
- "skylight_rsi",
674
- "skylight_solar_trans",
675
- "skylight_vis_trans",
676
- "tubular_daylight_dome_rsi",
677
- "tubular_daylight_dome_solar_trans",
678
- "tubular_daylight_dome_vis_trans",
679
- "tubular_daylight_diffuser_rsi",
680
- "tubular_daylight_diffuser_solar_trans",
681
- "tubular_daylight_diffuser_vis_trans",
682
- "ext_wall_cost_m3",
683
- "ext_floor_cost_m3",
684
- "ext_roof_cost_m3",
685
- "ground_wall_cost_m3",
686
- "ground_floor_cost_m3",
687
- "ground_roof_cost_m3",
688
- "fixed_window_cost_m3",
689
- "operable_window_cost_m3",
690
- "door_construction_cost_m3",
691
- "glass_door_cost_m3",
692
- "overhead_door_cost_m3",
693
- "skylight_cost_m3",
694
- "tubular_daylight_dome_cost_m3",
695
- "tubular_daylight_diffuser_cost_m3",
696
- "total_building_construction_set_cost"
697
- ]
698
-
699
- self.set_instance_variables(measure_values)
700
- unless @default_construction_set_name.nil? or @library_file.nil?
701
-
702
- # #Remove all existing constructions from model.
703
- BTAP::Resources::Envelope::remove_all_envelope_information( model )
704
-
705
- # #Load Contruction osm library.
706
- construction_lib = BTAP::FileIO::load_osm("#{@script_root_folder_path}/#{@library_file}")
707
-
708
- #Get construction set.. I/O expensive so doing it here.
709
- vintage_construction_set = construction_lib.getDefaultConstructionSetByName(@default_construction_set_name)
710
- if vintage_construction_set.empty?
711
- raise("#{@default_construction_set} does not exist in #{@script_root_folder_path}/#{@library_file} library ")
712
- else
713
- vintage_construction_set = construction_lib.getDefaultConstructionSetByName(@default_construction_set_name).get
714
- end
715
-
716
-
717
- new_construction_set =vintage_construction_set.clone(model).to_DefaultConstructionSet.get
718
- #Set conductances to needed values in construction set if possible.
719
- BTAP::Resources::Envelope::ConstructionSets::customize_default_surface_construction_set_rsi!(
720
- model: model, name: "#{@default_construction_set}-modified",default_surface_construction_set: new_construction_set,
721
- ext_wall_rsi: @ext_wall_rsi, ext_floor_rsi: @ext_floor_rsi, ext_roof_rsi: @ext_roof_rsi,
722
- ground_wall_rsi: @ground_wall_rsi, ground_floor_rsi: @ground_floor_rsi, ground_roof_rsi: @ground_roof_rsi,
723
- fixed_window_rsi: @fixed_window_rsi, fixed_wind_solar_trans: @fixed_wind_solar_trans, fixed_wind_vis_trans: @fixed_wind_vis_trans,
724
- operable_window_rsi: @operable_window_rsi, operable_wind_solar_trans: @operable_wind_solar_trans, operable_wind_vis_trans: @operable_wind_vis_trans,
725
- door_construction_rsi: @door_construction_rsi,
726
- glass_door_rsi: @glass_door_rsi, glass_door_solar_trans: @glass_door_solar_trans, glass_door_vis_trans: @glass_door_vis_trans,
727
- overhead_door_rsi: @overhead_door_rsi,
728
- skylight_rsi: @skylight_rsi, skylight_solar_trans: @skylight_solar_trans, skylight_vis_trans: @skylight_vis_trans,
729
- tubular_daylight_dome_rsi: @tubular_daylight_dome_rsi, tubular_daylight_dome_solar_trans: @tubular_daylight_dome_solar_trans, tubular_daylight_dome_vis_trans: @tubular_daylight_dome_vis_trans,
730
- tubular_daylight_diffuser_rsi: @tubular_daylight_diffuser_rsi, tubular_daylight_diffuser_solar_trans: @tubular_daylight_diffuser_solar_trans, tubular_daylight_diffuser_vis_trans: @tubular_daylight_diffuser_vis_trans
731
- )
732
-
733
-
734
- #Set as default to model.
735
- model.building.get.setDefaultConstructionSet( new_construction_set )
736
-
737
- #Set cost information.
738
- BTAP::Resources::Envelope::ConstructionSets::customize_default_surface_construction_set_costs(new_construction_set,
739
- @ext_wall_cost_m2,
740
- @ext_floor_cost_m2,
741
- @ext_roof_cost_m2,
742
- @ground_wall_cost_m2,
743
- @ground_floor_cost_m2,
744
- @ground_roof_cost_m2,
745
- @fixed_window_cost_m2,
746
- @operable_window_cost_m2,
747
- @door_construction_cost_m2,
748
- @glass_door_cost_m2,
749
- @overhead_door_cost_m2,
750
- @skylight_cost_m2,
751
- @tubular_daylight_dome_cost_m2,
752
- @tubular_daylight_diffuser_cost_m2,
753
- @total_building_construction_set_cost
754
- )
755
-
756
- #Give adiabatic surfaces a construction. Does not matter what. This is a bug in OpenStudio that leave these surfaces unassigned by the default construction set.
757
- all_adiabatic_surfaces = BTAP::Geometry::Surfaces::filter_by_boundary_condition(model.getSurfaces, "Adiabatic")
758
- unless all_adiabatic_surfaces.empty?
759
- BTAP::Geometry::Surfaces::set_surfaces_construction( all_adiabatic_surfaces, model.building.get.defaultConstructionSet.get.defaultInteriorSurfaceConstructions.get.wallConstruction.get)
760
- end
761
- #Create sample csv file.
762
- CSV.open("#{@script_root_folder_path}/sample_envelope_ecm.csv", 'w') { |csv| csv << measure_values.unshift("measure_id") }
763
- return BTAP::Resources::Envelope::ConstructionSets::get_construction_set_info( new_construction_set )
764
- end
765
- return "Constructions were unchanged.\n"
766
- end
767
- def ecm_infiltration( model )
768
- measure_values =
769
- [
770
- "infiltration_design_flow_rate",
771
- "infiltration_flow_per_space",
772
- "infiltration_flow_per_exterior_area",
773
- "infiltration_air_changes_per_hour"
774
- ]
775
-
776
- #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
777
- self.set_instance_variables(measure_values)
778
-
779
- log = BTAP::Resources::SpaceLoads::ScaleLoads::set_inflitration_magnitude(
780
- model,
781
- @infiltration_design_flow_rate,
782
- @infiltration_flow_per_space,
783
- @infiltration_flow_per_exterior_area,
784
- @infiltration_air_changes_per_hour
785
- )
786
- return log
787
- end
788
- def ecm_fans( model )
789
- measure_values =
790
- [
791
- "fan_total_eff",
792
- "fan_motor_eff",
793
- "fan_volume_type"
794
- ]
795
- #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
796
- self.set_instance_variables(measure_values)
797
- log = ""
798
- unless model.getFanVariableVolumes.empty?
799
- log = "fan_variable_volume_name,fan_total_eff,fan_motor_eff\n"
800
- model.getFanVariableVolumes.sort.each do |fan|
801
- fan.setFanEfficiency( @fan_total_eff ) unless @fan_total_eff.nil?
802
- fan.setMotorEfficiency( @fan_motor_eff ) unless @fan_motor_eff.nil?
803
- log << fan.name.get.to_s << ",#{fan.fanEfficiency},#{fan.motorEfficiency}\n"
804
- end
805
- end
806
-
807
- unless model.getFanConstantVolumes.empty?
808
- log = "fan_constant_volume_name,fan_total_eff,fan_motor_eff\n"
809
- model.getFanConstantVolumes.sort.each do |fan|
810
- fan.setFanEfficiency( @fan_total_eff ) unless @fan_total_eff.nil?
811
- fan.setMotorEfficiency( @fan_motor_eff ) unless @fan_motor_eff.nil?
812
- log << fan.name.get.to_s << ",#{fan.fanEfficiency},#{fan.motorEfficiency}\n"
813
- end
814
-
815
- end
816
-
817
- case @fan_volume_type
818
-
819
- when "VariableVolume"
820
- model.getFanConstantVolumes.sort.each do |fan_const|
821
- #check that this is indeed connected to an airloop.
822
- log << "Found Const Vol Fan #{fan_const.name.get.to_s}"
823
- unless fan_const.loop.empty?
824
- fan_variable = OpenStudio::Model::FanVariableVolume.new(model,fan_const.availabilitySchedule)
825
- #pass information from old fan as much as possible.
826
- fan_variable.setFanEfficiency(fan_const.fanEfficiency)
827
- fan_variable.setPressureRise( fan_const.pressureRise() )
828
- fan_variable.autosizeMaximumFlowRate
829
- fan_variable.setFanPowerMinimumFlowRateInputMethod("FixedFlowRate")
830
- fan_variable.setFanPowerMinimumFlowFraction(0.25)
831
- fan_variable.setMotorInAirstreamFraction( fan_const.motorInAirstreamFraction() )
832
- fan_variable.setFanPowerCoefficient1(0.35071223)
833
- fan_variable.setFanPowerCoefficient2(0.30850535)
834
- fan_variable.setFanPowerCoefficient3(-0.54137364)
835
- fan_variable.setFanPowerCoefficient4(0.87198823)
836
-
837
- #get the airloop.
838
- air_loop = fan_const.loop.get
839
- #add the FanVariableVolume
840
- fan_variable.addToNode(air_loop.supplyOutletNode())
841
- #Remove FanConstantVolume
842
- fan_const.remove()
843
- log << "Replaced by Variable Vol Fan #{fan_variable.name.get.to_s}"
844
- end
845
- end
846
- when "ConstantVolume"
847
- model.getFanVariableVolumes.sort.each do |fan|
848
- #check that this is indeed connected to an airloop.
849
- log << "Found Const Vol Fan #{fan.name.get.to_s}"
850
- unless fan.loop.empty?
851
- new_fan = OpenStudio::Model::FanConstantVolume.new(model,fan.availabilitySchedule)
852
- #pass information from constant speed fan as much as possible.
853
- new_fan.setFanEfficiency(fan.fanEfficiency)
854
- new_fan.setPressureRise( fan.pressureRise() )
855
- new_fan.setMotorEfficiency(fan.motorEfficiency)
856
- new_fan.setMotorInAirstreamFraction( fan.motorInAirstreamFraction() )
857
- new_fan.autosizeMaximumFlowRate
858
- #get the airloop.
859
- air_loop = fan.loop.get
860
- #add the FanVariableVolume
861
- new_fan.addToNode(air_loop.supplyOutletNode())
862
- #Remove FanConstantVolume
863
- fan.remove()
864
- log << "Replaced by Constant Vol Fan #{new_fan.name.get.to_s}"
865
- end
866
- end
867
- when nil
868
- log << "No changes to Fan."
869
- else
870
- raise("fan_volume_type should be ConstantVolume or VariableVolume")
871
- end
872
- return log
873
- end
874
- def ecm_pumps( model )
875
- measure_values =
876
- [
877
- "pump_motor_eff",
878
- "pump_control_type",
879
- "pump_speed_type"
880
- ]
881
- #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
882
- self.set_instance_variables(measure_values)
883
- log = ""
884
- unless model.getPumpVariableSpeeds.empty?
885
- log = "pump_variable_speed_name,@pump_motor_eff\n"
886
- model.getPumpVariableSpeeds.sort.each do |pump|
887
- pump.setMotorEfficiency( @pump_motor_eff.to_f ) unless @pump_motor_eff.nil?
888
- pump.setPumpControlType( @pump_control_type ) unless @pump_control_type.nil?
889
- log << pump.name.get.to_s << ",#{pump.motorEfficiency}\n"
890
- end
891
- end
892
- unless model.getPumpConstantSpeeds.empty?
893
- log << "pump_variable_speed_name,@pump_motor_eff\n"
894
- model.getPumpConstantSpeeds.sort.each do |pump|
895
- pump.setMotorEfficiency( @pump_motor_eff.to_f ) unless @pump_motor_eff.nil?
896
- pump.setPumpControlType( @pump_control_type ) unless @pump_control_type.nil?
897
- log << pump.name.get.to_s << ",#{pump.motorEfficiency}\n"
898
- end
899
- end
900
-
901
- #set pump speed type based on existing pump.
902
- case @pump_speed_type
903
- when "VariableSpeed"
904
- model.getPumpConstantSpeeds.sort.each do |pump_const|
905
- log << "Found Const Vol Fan #{pump_const.name.get.to_s}"
906
- #check that this is indeed connected to an plant loop.
907
- unless pump_const.plantLoop.empty?
908
- pump_variable = OpenStudio::Model::PumpVariableSpeed.new(model)
909
- #pass information from constant speed fan as much as possible.
910
- pump_variable.setRatedFlowRate(pump_const.ratedFlowRate)
911
- pump_variable.setRatedPumpHead(pump_const.ratedPumpHead)
912
- pump_variable.setRatedPowerConsumption(pump_const.ratedPowerConsumption.to_f)
913
- pump_variable.setMotorEfficiency(pump_const.motorEfficiency.to_f)
914
- pump_variable.setPumpControlType(pump_const.pumpControlType)
915
- pump_variable.setFractionofMotorInefficienciestoFluidStream(pump_const.fractionofMotorInefficienciestoFluidStream.to_f)
916
- pump_variable.autosizeRatedFlowRate if pump_const.isRatedFlowRateAutosized
917
- pump_variable.autosizeRatedPowerConsumption if pump_const.isRatedPowerConsumptionAutosized
918
-
919
- #get the hot water loop.
920
- hw_loop = pump_const.plantLoop.get
921
- #Remove PumpConstantSpeed
922
- pump_const.remove()
923
- #add
924
- pump_variable.addToNode(hw_loop.supplyInletNode)
925
- log << "Replaced by Variable Vol Pump #{pump_variable.name.get.to_s}"
926
- end
927
- end #end loop PumpConstantSpeeds
928
- when "ConstantSpeed"
929
- model.getPumpVariableSpeeds.sort.each do |pump|
930
- log << "Found Variable Speed Pump #{pump.name.get.to_s}"
931
- #check that this is indeed connected to an plant loop.
932
- unless pump.plantLoop.empty?
933
- new_pump = OpenStudio::Model::PumpVariableSpeed.new(model)
934
- #pass information from constant speed fan as much as possible.
935
-
936
- new_pump.setRatedFlowRate(pump.ratedFlowRate.get)
937
- new_pump.setRatedPumpHead(pump.ratedPumpHead())
938
- new_pump.setRatedPowerConsumption(pump.ratedPowerConsumption.to_f)
939
- new_pump.setMotorEfficiency(pump.motorEfficiency().to_f)
940
- new_pump.setFractionofMotorInefficienciestoFluidStream(pump.fractionofMotorInefficienciestoFluidStream().to_f)
941
- new_pump.setPumpControlType( pump.pumpControlType )
942
- new_pump.autosizeRatedFlowRate if pump.isRatedFlowRateAutosized
943
- new_pump.autosizeRatedPowerConsumption if pump.isRatedPowerConsumptionAutosized
944
- #get the hot water loop.
945
- hw_loop = pump.plantLoop.get
946
- #Remove PumpVariableSpeed
947
- pump.remove()
948
- #add the pump to loop.
949
- new_pump.addToNode(hw_loop.supplyInletNode)
950
-
951
- log << "Replaced by constant speed Pump #{new_pump.name.get.to_s}"
952
- end
953
- end #end loop Pump variable Speeds
954
- when nil
955
- log << "No changes"
956
- else
957
- raise( "pump_speed_type field is not ConstantSpeed or VariableSpeed" )
958
- end
959
-
960
- #Create sample csv file.
961
- CSV.open("#{@script_root_folder_path}/sample_pump_eff_ecm.csv", 'w') { |csv| csv << measure_values.unshift("measure_id") }
962
- return log
963
- end
964
- def ecm_cooling_cop( model )
965
- log = ""
966
- measure_values =[
967
- "cop"
968
- ]
969
-
970
- #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
971
- self.set_instance_variables(measure_values)
972
-
973
- unless model.getCoilCoolingDXSingleSpeeds.empty?
974
- log = "coil_cooling_dx_single_speed_name,cop\n"
975
- model.getCoilCoolingDXSingleSpeeds.sort.each do |cooling_coil|
976
- cooling_coil.setRatedCOP( OpenStudio::OptionalDouble.new( @cop ) ) unless @cop.nil?
977
- cop = "NA"
978
- # Prior to 3.5.0, it was an optional double, now it's a double
979
- cop_ = OpenStudio::OptionalDouble.new(cooling_coil.ratedCOP)
980
- cop = cop_.get unless cop_.empty?
981
- log << cooling_coil.name.get.to_s << ",#{cop}\n"
982
-
983
- end
984
- end
985
-
986
- unless model.getCoilCoolingDXTwoSpeeds.empty?
987
- log << "coil_cooling_dx_two_speed_name,cop\n"
988
- model.getCoilCoolingDXTwoSpeeds.sort.each do |cooling_coil|
989
- cooling_coil.setRatedHighSpeedCOP( @cop ) unless @cop.nil?
990
- cooling_coil.setRatedLowSpeedCOP( @cop ) unless @cop.nil?
991
- cop_high = "NA"
992
- cop_ = OpenStudio::OptionalDouble.new(cooling_coil.ratedHighSpeedCOP)
993
- cop_high = cop_.get unless cop_.empty?
994
- cop_low = "NA"
995
- cop_ = OpenStudio::OptionalDouble.new(cooling_coil.ratedLowSpeedCOP)
996
- cop_low = cop_.get unless cop_.empty?
997
- log << cooling_coil.name.get.to_s << ",#{cop_high},#{cop_low}\n"
998
- end
999
- end
1000
- return log
1001
- end
1002
- def ecm_economizers( model )
1003
-
1004
- measure_values =[
1005
- "economizer_control_type",
1006
- "economizer_control_action_type",
1007
- "economizer_maximum_limit_dry_bulb_temperature",
1008
- "economizer_maximum_limit_enthalpy",
1009
- "economizer_maximum_limit_dewpoint_temperature",
1010
- "economizer_minimum_limit_dry_bulb_temperature" ]
1011
-
1012
- #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
1013
- self.set_instance_variables(measure_values)
1014
- log = ""
1015
- unless @economizer_control_type.nil?
1016
- log << BTAP::Resources::HVAC::enable_economizer(
1017
- model,
1018
- @economizer_control_type,
1019
- @economizer_control_action_type,
1020
- @economizer_maximum_limit_dry_bulb_temperature,
1021
- @economizer_maximum_limit_enthalpy,
1022
- @economizer_maximum_limit_dewpoint_temperature,
1023
- @economizer_minimum_limit_dry_bulb_temperature
1024
- )
1025
-
1026
- end
1027
- return log
1028
- end
1029
- def ecm_sizing( model)
1030
- measure_values =[
1031
- "heating_sizing_factor",
1032
- "cooling_sizing_factor",
1033
- "zone_heating_sizing_factor",
1034
- "zone_cooling_sizing_factor"
1035
- ]
1036
-
1037
- table = "*Sizing Factor Measure*"
1038
- #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
1039
- self.set_instance_variables(measure_values)
1040
- table = "handle,heating_sizing_factor,cooling_sizing_factor\n"
1041
- #Sizing Parameters
1042
-
1043
- model.getSizingParameters.setHeatingSizingFactor(@heating_sizing_factor) unless @heating_sizing_factor.nil?
1044
- model.getSizingParameters.setCoolingSizingFactor(@cooling_sizing_factor) unless @cooling_sizing_factor.nil?
1045
-
1046
-
1047
- #SizingZone
1048
- table << "handle,zone_heating_sizing_factor,zone_cooling_sizing_factor\n"
1049
- model.getSizingZones.sort.each do |item|
1050
- item.setZoneHeatingSizingFactor(@zone_heating_sizing_factor) unless @zone_heating_sizing_factor.nil?
1051
- item.setZoneCoolingSizingFactor(@zone_cooling_sizing_factor) unless @zone_cooling_sizing_factor.nil?
1052
- table << "#{item.handle},#{item.zoneHeatingSizingFactor.get},#{item.zoneCoolingSizingFactor.get}\n"
1053
- end
1054
- #Create sample csv file.
1055
- CSV.open("#{@script_root_folder_path}/sample_sizing_param_ecm.csv", 'w') { |csv| csv << measure_values.unshift("measure_id") }
1056
- return table
1057
- end
1058
- def ecm_dhw( model )
1059
- log = "shw_setpoint_sched,shw_heater_fuel_type,shw_thermal_eff\n"
1060
- measure_values =[
1061
- "shw_setpoint_sched_name",
1062
- "shw_heater_fuel_type",
1063
- "shw_thermal_eff"
1064
- ]
1065
- log = "*SHW Measures*\n"
1066
- #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
1067
- self.set_instance_variables(measure_values)
1068
-
1069
- #Create Schedule
1070
- #schedule = BTAP::Resources::Schedules::create_annual_ruleset_schedule_detailed_json(model, @shw_setpoint_sched) unless @shw_setpoint_sched_name.nil? or @shw_setpoint_sched.nil?
1071
-
1072
- #iterate through water heaters.
1073
- model.getWaterHeaterMixeds.sort.each do |item|
1074
- unless @shw_setpoint_sched_name.nil? or @shw_setpoint_sched.nil?
1075
- item.setSetpointTemperatureSchedule(schedule)
1076
- end
1077
- item.setHeaterFuelType(@shw_heater_fuel_type) unless @shw_heater_fuel_type.nil?
1078
- item.setHeaterThermalEfficiency(@shw_thermal_eff) unless @shw_thermal_eff.nil?
1079
- log << item.name.get.to_s << ",#{item.setpointTemperatureSchedule},#{item.heaterFuelType},#{item.heaterThermalEfficiency}\n"
1080
- end
1081
- return log
1082
- end
1083
- def ecm_hotwater_boilers( model )
1084
- measure_values = [
1085
- "hw_boiler_design_water_outlet_temperature",
1086
- "hw_boiler_fuel_type",
1087
- "hw_boiler_thermal_eff",
1088
- "hw_boiler_curve",
1089
- "hw_boiler_flow_mode",#
1090
- "hw_boiler_eff_curve_temp_eval_var",#
1091
- "hw_boiler_reset_highsupplytemp" ,
1092
- "hw_boiler_reset_outsidehighsupplytemp" ,
1093
- "hw_boiler_reset_lowsupplytemp" ,
1094
- "hw_boiler_reset_outsidelowsupplytemp" ,
1095
- ]
1096
-
1097
- #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
1098
- self.set_instance_variables(measure_values)
1099
- table = "name,boiler_design_water_outlet_temperature,boiler_fuel_type,boiler_thermal_eff\n"
1100
-
1101
- model.getPlantLoops.sort.each do |iplantloop|
1102
- iplantloop.components.each do |icomponent|
1103
- if icomponent.to_BoilerHotWater.is_initialized
1104
- boiler = icomponent.to_BoilerHotWater.get
1105
-
1106
- #set design outlet temp
1107
- if model.version < OpenStudio::VersionString.new('3.0.0')
1108
- boiler.setDesignWaterOutletTemperature(@hw_boiler_design_water_outlet_temperature) unless @hw_boiler_design_water_outlet_temperature.nil?
1109
- end
1110
- #set fuel type
1111
- boiler.setFuelType(@hw_boiler_fuel_type) unless @hw_boiler_fuel_type.nil?
1112
- #set thermal eff
1113
- boiler.setNominalThermalEfficiency(@hw_boiler_thermal_eff) unless @hw_boiler_thermal_eff.nil?
1114
- #set boiler flow mode
1115
- unless @hw_boiler_flow_mode.nil?
1116
- ["ConstantFlow","LeavingSetpointModulated","NotModulated"].include?(@hw_boiler_flow_mode) ? boiler.setBoilerFlowMode(@hw_boiler_flow_mode) : raise("Boiler flow mode #{@hw_boiler_flow_mode} invalid.")
1117
- end
1118
- #set setDesignWaterOutletTemperature
1119
- if model.version < OpenStudio::VersionString.new('3.0.0')
1120
- boiler.setDesignWaterOutletTemperature(@hotwaterboiler_reset_highsupplytemp) unless @hotwaterboiler_reset_highsupplytemp.nil?
1121
- end
1122
- #set EfficiencyCurveTemperatureEvaluationVariable
1123
- unless @hw_boiler_eff_curve_temp_eval_var.nil?
1124
- ["LeavingBoiler","EnteringBoiler"].include?(@hw_boiler_eff_curve_temp_eval_var) ? boiler.setEfficiencyCurveTemperatureEvaluationVariable(@hw_boiler_eff_curve_temp_eval_var) : raise("EfficiencyCurveTemperatureEvaluationVariable #{@hw_boiler_eff_curve_temp_eval_var} invalid.")
1125
- end
1126
-
1127
-
1128
- #Set boiler curve
1129
- curve = boiler.normalizedBoilerEfficiencyCurve
1130
- if not @hw_boiler_curve.nil? and curve.is_initialized and curve.get.to_CurveBiquadratic.is_initialized
1131
- case @hw_boiler_curve.downcase
1132
- when "atmospheric"
1133
- biqcurve = curve.get.to_CurveBiquadratic.get
1134
- biqcurve.setCoefficient1Constant(1.057059)
1135
- biqcurve.setCoefficient1Constant(1.057059)
1136
- biqcurve.setCoefficient2x(-0.0774177)
1137
- biqcurve.setCoefficient3xPOW2(0.07875142)
1138
- biqcurve.setCoefficient4y(0.0003943856)
1139
- biqcurve.setCoefficient5yPOW2(-0.000004074629)
1140
- biqcurve.setCoefficient6xTIMESY(-0.002202606)
1141
- biqcurve.setMinimumValueofx(0.3)
1142
- biqcurve.setMaximumValueofx(1.0)
1143
- biqcurve.setMinimumValueofy(40.0)
1144
- biqcurve.setMaximumValueofy(90.0)
1145
- biqcurve.setMinimumCurveOutput(0.0)
1146
- biqcurve.setMaximumCurveOutput(1.1)
1147
- biqcurve.setInputUnitTypeforX("Dimensionless")
1148
- biqcurve.setInputUnitTypeforY("Temperature")
1149
- biqcurve.setOutputUnitType("Dimensionless")
1150
- when "condensing"
1151
- biqcurve = curve.get.to_CurveBiquadratic.get
1152
- biqcurve.setCoefficient1Constant(0.4873)
1153
- biqcurve.setCoefficient2x(1.1322)
1154
- biqcurve.setCoefficient3xPOW2(-0.6425)
1155
- biqcurve.setCoefficient4y(0.0)
1156
- biqcurve.setCoefficient5yPOW2(0.0)
1157
- biqcurve.setCoefficient6xTIMESY(0.0)
1158
- biqcurve.setMinimumValueofx(0.1)
1159
- biqcurve.setMaximumValueofx(1.0)
1160
- biqcurve.setMinimumValueofy(0.0)
1161
- biqcurve.setMaximumValueofy(0.0)
1162
- biqcurve.setMinimumCurveOutput(0.0)
1163
- biqcurve.setMaximumCurveOutput(1.0)
1164
- biqcurve.setInputUnitTypeforX("Dimensionless")
1165
- biqcurve.setInputUnitTypeforY("Temperature")
1166
- biqcurve.setOutputUnitType("Dimensionless")
1167
- else
1168
- raise("#{@hotwaterboiler_curve} is not a valid boiler curve name (condensing_boiler_curve,atmospheric_boiler_curve")
1169
- end
1170
- end
1171
-
1172
- #boiler reset setpoint manager
1173
- unless @hotwaterboiler_reset_lowsupplytemp.nil? and @hotwaterboiler_reset_outsidelowsupplytemp.nil? and @hotwaterboiler_reset_highsupplytemp.nil? and @hotwaterboiler_reset_outsidehighsupplytemp.nil?
1174
- #check if setpoint manager is present at supply outlet
1175
- #Find any setpoint manager if it exists and outlet node and remove it.
1176
- iplantloop.supplyOutletNode.setpointManagers.each {|sm| sm.disconnect}
1177
-
1178
- #Add new setpoint manager
1179
- oar_stpt_manager = OpenStudio::Model::SetpointManagerOutdoorAirReset.new(model)
1180
- oar_stpt_manager.addToNode(iplantloop.supplyOutletNode)
1181
- oar_stpt_manager.setSetpointatOutdoorHighTemperature(@hw_boiler_reset_lowsupplytemp) unless @hw_boiler_reset_lowsupplytemp.nil?
1182
- oar_stpt_manager.setOutdoorHighTemperature(@hotwaterboiler_reset_outsidelowsupplytemp) unless @hw_boiler_reset_outsidelowsupplytemp.nil?
1183
- oar_stpt_manager.setSetpointatOutdoorLowTemperature(@hw_boiler_reset_highsupplytemp) unless @hw_boiler_reset_highsupplytemp.nil?
1184
- oar_stpt_manager.setOutdoorLowTemperature(@hw_boiler_reset_outsidehighsupplytemp) unless @hw_boiler_reset_outsidehighsupplytemp.nil?
1185
- end
1186
- table << boiler.name.get.to_s << ","
1187
- boiler.designWaterOutletTemperature.empty? ? dowt = "NA" : dowt = boiler.designWaterOutletTemperature.get
1188
- table << "#{dowt},#{boiler.fuelType},#{boiler.nominalThermalEfficiency}\n"
1189
- end
1190
- end
1191
- end #end boilers loop
1192
- return table
1193
- end
1194
- def ecm_dcv( model )
1195
- log = ""
1196
- measure_values =[
1197
- "dcv_enabled"
1198
- ]
1199
- #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
1200
- self.set_instance_variables(measure_values)
1201
- unless @dcv_enabled.nil?
1202
- log = BTAP::Resources::HVAC::enable_demand_control_ventilation(model,@dcv_enabled.to_bool)
1203
- end
1204
- return log
1205
- end
1206
- def ecm_heating_cooling_setpoints(model)
1207
-
1208
- log = ""
1209
- measure_values =[
1210
- "library_file",
1211
- "heating_schedule_name",
1212
- "cooling_schedule_name"
1213
- ]
1214
- #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
1215
- self.set_instance_variables(measure_values)
1216
-
1217
- library_file = @library_file
1218
- heating_schedule_name = @heating_schedule_name
1219
- cooling_schedule_name = @cooling_schedule_name
1220
-
1221
- unless @heating_schedule_name.nil? and @cooling_schedule_name.nil?
1222
- #Load Contruction osm library.
1223
- lib = BTAP::FileIO::load_osm("#{@script_root_folder_path}/#{library_file}")
1224
-
1225
- unless heating_schedule_name.nil?
1226
- #Get heating schedule from library and clone it.
1227
- heating_schedule = lib.getScheduleRulesetByName(heating_schedule_name)
1228
- if heating_schedule.empty?
1229
- raise("#{heating_schedule_name} does not exist in #{library_file} library ")
1230
- else
1231
- heating_schedule = lib.getScheduleRulesetByName(heating_schedule_name).get.clone(model).to_ScheduleRuleset.get
1232
- end
1233
- end
1234
-
1235
- unless cooling_schedule_name.nil?
1236
- #Get cooling schedule from library and clone it.
1237
- cooling_schedule = lib.getScheduleRulesetByName(cooling_schedule_name)
1238
- if cooling_schedule.empty?
1239
- raise("#{cooling_schedule_name} does not exist in #{library_file} library ")
1240
- else
1241
- cooling_schedule = lib.getScheduleRulesetByName(cooling_schedule_name).get.clone(model).to_ScheduleRuleset.get
1242
- end
1243
- end
1244
- model.getThermostatSetpointDualSetpoints.sort.each do |dual_setpoint|
1245
- unless heating_schedule_name.nil?
1246
- raise ("Could not set heating Schedule") unless dual_setpoint.setHeatingSetpointTemperatureSchedule(heating_schedule)
1247
- end
1248
- unless cooling_schedule_name.nil?
1249
- raise ("Could not set cooling Schedule") unless dual_setpoint.setCoolingSetpointTemperatureSchedule(cooling_schedule)
1250
- end
1251
- end
1252
- end
1253
- return log
1254
- end
1255
- def ecm_erv( model )
1256
- log = ""
1257
- measure_values =[
1258
- "erv_enabled",
1259
- "erv_autosizeNominalSupplyAirFlowRate",
1260
- "erv_NominalSupplyAirFlowRate",
1261
- "erv_HeatExchangerType",
1262
- "erv_SensibleEffectivenessat100CoolingAirFlow",
1263
- "erv_SensibleEffectivenessat75CoolingAirFlow",
1264
- "erv_LatentEffectiveness100Cooling",
1265
- "erv_LatentEffectiveness75Cooling",
1266
- "erv_SensibleEffectiveness100Heating",
1267
- "erv_SensibleEffectiveness75Heating",
1268
- "erv_LatentEffectiveness100Heating",
1269
- "erv_LatentEffectiveness75Heating",
1270
- "erv_SupplyAirOutletTemperatureControl",
1271
- "erv_setFrostControlType",
1272
- "erv_ThresholdTemperature",
1273
- "erv_InitialDefrostTimeFraction",
1274
- "erv_nominal_electric_power",
1275
- "erv_economizer_lockout"
1276
- ]
1277
-
1278
- #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
1279
- self.set_instance_variables(measure_values)
1280
-
1281
-
1282
- unless @erv_enabled.nil? or @erv_enabled.to_bool == false
1283
- BTAP::Resources::HVAC::enable_erv(
1284
- model,
1285
- @erv_autosizeNominalSupplyAirFlowRate,
1286
- @erv_NominalSupplyAirFlowRate,
1287
- @erv_HeatExchangerType,
1288
- @erv_SensibleEffectivenessat100CoolingAirFlow,
1289
- @erv_SensibleEffectivenessat75CoolingAirFlow,
1290
- @erv_LatentEffectiveness100Cooling,
1291
- @erv_LatentEffectiveness75Cooling,
1292
- @erv_SensibleEffectiveness100Heating,
1293
- @erv_SensibleEffectiveness75Heating,
1294
- @erv_LatentEffectiveness100Heating,
1295
- @erv_LatentEffectiveness75Heating,
1296
- @erv_SupplyAirOutletTemperatureControl.to_bool,
1297
- @erv_setFrostControlType,
1298
- @erv_ThresholdTemperature,
1299
- @erv_InitialDefrostTimeFraction,
1300
- @erv_nominal_electric_power,
1301
- @erv_economizer_lockout.to_bool
1302
- ).each { |erv| log << erv.to_s }
1303
-
1304
-
1305
- #Add setpoint manager to all OA object in airloops.
1306
- model.getHeatExchangerAirToAirSensibleAndLatents.sort.each do |erv|
1307
-
1308
- #needed to get the supply outlet node from the erv to place the setpoint manager.
1309
- node = erv.primaryAirOutletModelObject.get.to_Node.get if erv.primaryAirOutletModelObject.is_initialized
1310
- new_set_point_manager = OpenStudio::Model::SetpointManagerWarmest.new(model)
1311
- raise ("Could not add setpoint manager") unless new_set_point_manager.addToNode(node)
1312
- log << "added warmest control to node #{node}"
1313
- new_set_point_manager.setMaximumSetpointTemperature(16.0)
1314
- new_set_point_manager.setMinimumSetpointTemperature(5.0)
1315
- new_set_point_manager.setStrategy("MaximumTemperature")
1316
- new_set_point_manager.setControlVariable("Temperature")
1317
- end
1318
- log << "ERV have been modified.\n"
1319
- else
1320
- log << "ERV not changed."
1321
- end
1322
- return log
1323
- end
1324
- def ecm_exhaust_fans( model )
1325
- log = ""
1326
- #Exhaust ECM
1327
- measure_values =[
1328
- "exhaust_fans_occ_control_enabled"
1329
- ]
1330
- #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
1331
- self.set_instance_variables(measure_values)
1332
- unless @exhaust_fans_occ_control_enabled.nil? or @exhaust_fans_occ_control_enabled.to_bool == false
1333
- fans = BTAP::Resources::Schedules::set_exhaust_fans_availability_to_building_default_occ_schedule(model)
1334
- fans.each { |fan| log << fan.to_s}
1335
- else
1336
- log << "No changes to exhaust fans."
1337
- end
1338
- return log
1339
- end
1340
- def ecm_lighting( model )
1341
- log = ""
1342
- #Lighting ECM
1343
- measure_values =[
1344
- "lighting_scaling_factor",
1345
- "lighting_fraction_radiant",
1346
- "lighting_fraction_visible",
1347
- "lighting_return_air_fraction"
1348
- ]
1349
- #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
1350
- self.set_instance_variables(measure_values)
1351
- BTAP::Resources::SpaceLoads::ScaleLoads::scale_lighting_loads(
1352
- model,
1353
- @lighting_scaling_factor ) unless @lighting_scaling_factor.nil?
1354
- #Set lighting variables
1355
- model.getLightsDefinitions.sort.each do |lightsdef|
1356
- lightsdef.setFractionRadiant(@lighting_fraction_radiant.to_f)
1357
- lightsdef.setFractionVisible(@lighting_fraction_visible.to_f)
1358
- lightsdef.setReturnAirFraction(@lighting_return_air_fraction.to_f)
1359
- end
1360
- return log
1361
- end
1362
- def ecm_plugs( model )
1363
- log = ""
1364
- #Plug loads ECM
1365
- measure_values = [
1366
- "elec_equipment_scaling_factor",
1367
- "elec_equipment_fraction_radiant",
1368
- "elec_equipment_fraction_latent",
1369
- "elec_equipment_fraction_lost"
1370
- ]
1371
- #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
1372
- self.set_instance_variables(measure_values)
1373
-
1374
- BTAP::Resources::SpaceLoads::ScaleLoads::scale_electrical_loads(
1375
- model,
1376
- @elec_equipment_scaling_factor) unless @elec_equipment_scaling_factor.nil?
1377
-
1378
- #Set plug loads variables
1379
- model.getElectricEquipmentDefinitions.sort.each do |elec_equip_def|
1380
- elec_equip_def.setFractionRadiant(@elec_equipment_fraction_radiant.to_f)
1381
- elec_equip_def.setFractionLatent(@elec_equipment_fraction_latent.to_f)
1382
- elec_equip_def.setFractionLost(@elec_equipment_fraction_lost.to_f)
1383
- end
1384
-
1385
- CSV.open("#{@script_root_folder_path}/sample_scale_plug_loads_ecm.csv", 'w') { |csv| csv << measure_values.unshift("measure_id") }
1386
- return log
1387
- end
1388
- def ecm_cold_deck_reset_control( model )
1389
- log = ""
1390
- measure_values = [
1391
- "cold_deck_reset_enabled",
1392
- "cold_deck_reset_max_supply_air_temp",
1393
- "cold_deck_reset_min_supply_air_temp",
1394
- ]
1395
- #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
1396
- self.set_instance_variables(measure_values)
1397
-
1398
- if @cold_deck_reset_enabled.to_bool == true
1399
-
1400
- model.getAirLoopHVACs.sort.each do |iairloop|
1401
- cooling_present = false
1402
- set_point_manager = nil
1403
- iairloop.components.each do |icomponent|
1404
- if icomponent.to_CoilCoolingDXSingleSpeed.is_initialized or
1405
- icomponent.to_CoilCoolingDXTwoSpeed.is_initialized or
1406
- icomponent.to_CoilCoolingWater.is_initialized or
1407
- icomponent.to_CoilCoolingCooledBeam.is_initialized or
1408
- icomponent.to_CoilCoolingDXMultiSpeed.is_initialized or
1409
- icomponent.to_CoilCoolingDXVariableRefrigerantFlow.is_initialized or
1410
- icomponent.to_CoilCoolingLowTempRadiantConstFlow.is_initialized or
1411
- icomponent.to_CoilCoolingLowTempRadiantVarFlow.is_initialized
1412
- cooling_present = true
1413
- log << "found cooling."
1414
- end
1415
- end
1416
- #check if setpoint manager is present at supply outlet.
1417
- model.getSetpointManagerSingleZoneReheats.sort.each do |manager|
1418
- if iairloop.supplyOutletNode == manager.setpointNode.get
1419
- set_point_manager = manager
1420
- end
1421
- end
1422
-
1423
- if set_point_manager.nil? and cooling_present == true
1424
- set_point_manager = OpenStudio::Model::SetpointManagerSingleZoneReheat.new(model)
1425
- set_point_manager.addToNode(iairloop.supplyOutletNode)
1426
- end
1427
-
1428
-
1429
-
1430
- if cooling_present == true and not set_point_manager.nil?
1431
- set_point_manager.setMaximumSupplyAirTemperature(@cold_deck_reset_max_supply_air_temp)
1432
- set_point_manager.setMinimumSupplyAirTemperature(@cold_deck_reset_min_supply_air_temp)
1433
- log << "to_SetpointManagerSingleZoneReheat set to 20.0 and 13.0"
1434
- end
1435
- end
1436
- end
1437
- return log
1438
- end
1439
- def ecm_sat_reset( model )
1440
- log = ""
1441
- measure_values = [
1442
- "sat_reset_enabled",
1443
- "sat_reset_outdoor_high_temperature",
1444
- "sat_reset_outdoor_low_temperature",
1445
- "sat_reset_setpoint_at_outdoor_high_temperature",
1446
- "sat_reset_setpoint_at_outdoor_low_temperature"
1447
- ]
1448
-
1449
-
1450
- #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
1451
- self.set_instance_variables(measure_values)
1452
- if @sat_reset_enabled.to_bool == true
1453
- model.getAirLoopHVACs.sort.each do |iairloop|
1454
-
1455
- #check if setpoint manager is present at supply outlet
1456
- model.getSetpointManagerSingleZoneReheats.sort.each do |manager|
1457
- if iairloop.supplyOutletNode == manager.setpointNode.get
1458
- manager.disconnect
1459
- end
1460
- end
1461
-
1462
- new_set_point_manager = OpenStudio::Model::SetpointManagerOutdoorAirReset.new(model)
1463
- new_set_point_manager.addToNode(iairloop.supplyOutletNode)
1464
- new_set_point_manager.setOutdoorHighTemperature(@sat_reset_outdoor_high_temperature)
1465
- new_set_point_manager.setOutdoorLowTemperature(@sat_reset_outdoor_low_temperature)
1466
- new_set_point_manager.setSetpointatOutdoorHighTemperature(@sat_reset_setpoint_at_outdoor_high_temperature)
1467
- new_set_point_manager.setSetpointatOutdoorLowTemperature(@sat_reset_setpoint_at_outdoor_low_temperature)
1468
- new_set_point_manager.setControlVariable("Temperature")
1469
- log << "Replaced SingleZoneReheat with OA reset control."
1470
- end
1471
- end
1472
- return log
1473
- end
1474
- def ecm_temp_setback( model )
1475
- log = ""
1476
- measure_values = [
1477
- "occ_stbck_enabled",
1478
- "occ_stbck_tolerance",
1479
- "occ_stbck_heat_setback",
1480
- "occ_stbck_heat_setpoint",
1481
- "occ_stbck_cool_setback",
1482
- "occ_stbck_cool_setpoint"
1483
- ]
1484
- #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
1485
- self.set_instance_variables(measure_values)
1486
- # get occupancy schedule if possible.
1487
- unless @occ_stbck_enabled.nil? or @occ_stbck_enabled == false
1488
- if model.building.get.defaultScheduleSet.is_initialized and
1489
- model.building.get.defaultScheduleSet.get.numberofPeopleSchedule.is_initialized and
1490
- model.building.get.defaultScheduleSet.get.numberofPeopleSchedule.get.to_ScheduleRuleset.is_initialized
1491
- occupancy_schedule = model.building.get.defaultScheduleSet.get.numberofPeopleSchedule.get
1492
- heating_schedule,cooling_schedule = BTAP::Resources::Schedules::create_setback_schedule_based_on_another_schedule(
1493
- model,
1494
- occupancy_schedule,
1495
- @occ_stbck_tolerance.to_f,
1496
- @occ_stbck_heat_setpoint.to_f,
1497
- @occ_stbck_heat_setback.to_f,
1498
- @occ_stbck_cool_setpoint.to_f,
1499
- @occ_stbck_cool_setback.to_f)
1500
- model.getThermostatSetpointDualSetpoints.sort.each do |dual_setpoint|
1501
- raise ("Could not set setback heating Schedule") unless dual_setpoint.setHeatingSetpointTemperatureSchedule(heating_schedule)
1502
- raise ("Could not set setback cooling Schedule") unless dual_setpoint.setCoolingSetpointTemperatureSchedule(cooling_schedule)
1503
- log << "modified....#{dual_setpoint}"
1504
- end
1505
- end
1506
- else
1507
- log << "no change to setbacks."
1508
- end
1509
- return log
1510
- end
1511
- end
1512
- end
1513
- end
1514
-
1515
-
1
+ # # *********************************************************************
2
+ # # * Copyright (c) 2008-2015, Natural Resources Canada
3
+ # # * All rights reserved.
4
+ # # *
5
+ # # * This library is free software; you can redistribute it and/or
6
+ # # * modify it under the terms of the GNU Lesser General Public
7
+ # # * License as published by the Free Software Foundation; either
8
+ # # * version 2.1 of the License, or (at your option) any later version.
9
+ # # *
10
+ # # * This library is distributed in the hope that it will be useful,
11
+ # # * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # # * Lesser General Public License for more details.
14
+ # # *
15
+ # # * You should have received a copy of the GNU Lesser General Public
16
+ # # * License along with this library; if not, write to the Free Software
17
+ # # * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+ # # **********************************************************************/
19
+ #
20
+ #
21
+ # # To change this template, choose Tools | Templates
22
+ # # and open the template in the editor.
23
+ # require "#{File.dirname(__FILE__)}/btap"
24
+ #
25
+ # class OSMArg
26
+ # ARGUMENT_TYPES = [
27
+ # "BOOL",
28
+ # "STRING",
29
+ # "INTEGER",
30
+ # "FLOAT",
31
+ # "STRINGCHOICE",
32
+ # "WSCHOICE"
33
+ # ]
34
+ #
35
+ #
36
+ #
37
+ # attr_accessor :runner,
38
+ # :variable_name,
39
+ # :type,
40
+ # :required,
41
+ # :model_dependant,
42
+ # :display_name,
43
+ # :default_value,
44
+ # :min_value,
45
+ # :max_value,
46
+ # :string_choice_array,
47
+ # :os_object_type
48
+ #
49
+ # def self.bool( variable_name,display_name,required,default_value )
50
+ # raise "#{default_value} defaut value is not a bool." unless default_value.is_a?(Bool)
51
+ # default_value.respond_to?(:to_s)
52
+ # arg = OSMArg.new( "BOOL", variable_name, display_name, required)
53
+ # arg.default_value = default_value
54
+ # return arg
55
+ # end
56
+ #
57
+ # def self.string( variable_name,display_name,required,default_value )
58
+ # raise "#{default_value} defaut value is not a string." unless default_value.respond_to?(:to_s)
59
+ # arg = OSMArg.new( "STRING", variable_name, display_name, required)
60
+ # arg.default_value = default_value
61
+ # return arg
62
+ # end
63
+ #
64
+ # def self.integer( variable_name,display_name,required,default_value,min_value,max_value )
65
+ # raise "#{default_value} defaut value is not a integer." unless default_value.respond_to?(:to_i)
66
+ # arg = OSMArg.new( "INTEGER", variable_name, display_name, required)
67
+ # arg.default_value = default_value
68
+ # arg.min_value = min_value
69
+ # arg.max_value = max_value
70
+ # return arg
71
+ # end
72
+ #
73
+ # def self.float( variable_name, display_name, required,default_value,min_value, max_value )
74
+ # raise "#{default_value} defaut value is not a float." unless default_value.respond_to?(:to_f)
75
+ # arg = OSMArg.new( "INTEGER", variable_name, display_name, required)
76
+ # arg.default_value = default_value
77
+ # arg.min_value = min_value
78
+ # arg.max_value = max_value
79
+ # return arg
80
+ # end
81
+ #
82
+ # def self.choice(variable_name,display_name,required,default_value,string_choice_array)
83
+ # raise "#{default_value} defaut value is not an array." unless default_value.is_a?(Array)
84
+ # arg = OSMArg.new( "STRINGCHOICE", variable_name, display_name, required)
85
+ # arg.default_value = default_value
86
+ # arg.string_choice_array = string_choice_array
87
+ # return arg
88
+ # end
89
+ #
90
+ # def self.wschoice( variable_name, display_name, required, default_value, os_object_type)
91
+ # arg = OSMArg.new( "WSCHOICE", variable_name, display_name, required )
92
+ # arg.default_value = default_value
93
+ # arg.os_object_type = os_object_type
94
+ # return arg
95
+ # end
96
+ #
97
+ # def initialize( type, variable_name, display_name, required )
98
+ # self.type = type
99
+ # self.variable_name = variable_name
100
+ # self.display_name = display_name
101
+ # self.required = required
102
+ # self.model_dependant = false
103
+ # if self.type == "WSCHOICE"
104
+ # self.model_dependant = true
105
+ # else
106
+ # self.model_dependant = false
107
+ # end
108
+ # return self
109
+ # end
110
+ # end
111
+ #
112
+ #
113
+ #
114
+ #
115
+ #
116
+ # module BTAP
117
+ # module Measures
118
+ # module OSMeasures
119
+ #
120
+ #
121
+ #
122
+ #
123
+ # class BTAPModelUserScript < OpenStudio::Ruleset::ModelUserScript
124
+ # #if and E+ measure replace OpenStudio::Ruleset::ModelUserScript with OpenStudio::Ruleset::WorkspaceUserScript
125
+ # #Array containing information of all inputs required by measure.
126
+ # attr_accessor :argument_array_of_arrays
127
+ # attr_accessor :argument_array
128
+ # attr_accessor :file
129
+ # #Name of measure
130
+ # #attr_accessor :name
131
+ #
132
+ # #if and E+ measure replace OpenStudio::Ruleset::ModelUserScript with OpenStudio::Ruleset::WorkspaceUserScript
133
+ # def name
134
+ # "BTAPModelUserScript"
135
+ # OSMArgument.new
136
+ # end
137
+ #
138
+ # #this method will output the ruby macro to perform the change.
139
+ # def generate_ruby_macro(model,runner)
140
+ # if @file == nil or @file == ""
141
+ # @file = "Enter_Path_To_#{self.class.name}_measure.rb_File!"
142
+ # end
143
+ # BTAP::runner_register("MACRO", "\##{self.class.name} Measure Start", runner)
144
+ # BTAP::runner_register("MACRO", "require \"#{@file}\"", runner)
145
+ # BTAP::runner_register("MACRO", "argument_values = #{@arg_table}", runner)
146
+ # BTAP::runner_register("MACRO", "#{self.class.name}.new.set_user_arguments_and_apply(model,argument_values,runner)",runner)
147
+ # BTAP::runner_register("MACRO", "\##{self.class.name} Measure End", runner)
148
+ # end
149
+ #
150
+ # def set_user_arguments_and_apply(model,argument_values,runner)
151
+ # message = "Settting Arguments"
152
+ # runner.nil? ? puts(message) : runner.registerInfo(message)
153
+ # #create argument map
154
+ # user_arguments = OpenStudio::Ruleset::OSArgumentMap.new
155
+ # #get argument list
156
+ # arguments = self.arguments(model)
157
+ # #go through each argument
158
+ # arguments.each do |argument|
159
+ # found = false
160
+ # #go through each passed argument_values
161
+ # argument_values.each do |pair|
162
+ # #when a match is found.
163
+ # if argument.name == pair[0]
164
+ #
165
+ # clone_argument = argument.clone
166
+ # unless clone_argument.setValue(pair[1])
167
+ # message = "Could not set #{argument.name} to #{pair[1]}"
168
+ # runner.nil? ? puts(message) : runner.registerError(message)
169
+ # else
170
+ # message = "Set #{argument.name} to #{pair[1]}"
171
+ # runner.nil? ? puts(message) : runner.registerInfo(message)
172
+ # end
173
+ # user_arguments[pair[0]] = clone_argument
174
+ # #log message
175
+ # message = " Argument set to #{user_arguments}"
176
+ # runner.nil? ? puts(message) : runner.registerInfo(message)
177
+ # end
178
+ # found = true
179
+ # end
180
+ # puts ("Warning: value for argument #{argument.name} not set!.") if found == false
181
+ # end
182
+ # self.run(model, runner, user_arguments)
183
+ # end
184
+ #
185
+ # def run(model, runner, user_arguments)
186
+ # #IF and E+ measure replace model with workspace as the argument
187
+ # #Boilerplate start
188
+ # super(model, runner, user_arguments)
189
+ # BTAP::runner_register("INFO", "Initial model being modified by #{self.class.name}",runner)
190
+ # if not runner.validateUserArguments(self.arguments(model),user_arguments)
191
+ # return false
192
+ # end
193
+ #
194
+ # #Set argument to instance variables.
195
+ # self.argument_getter(model, runner,user_arguments)
196
+ # #will run the childs method measure_code
197
+ # result = self.measure_code(model,runner)
198
+ # generate_ruby_macro(model,runner)
199
+ # return result
200
+ # end # end method run
201
+ #
202
+ # def argument_setter(model,args)
203
+ # #***boilerplate code starts. Do not edit...
204
+ #
205
+ #
206
+ # #iterate through array of hashes and make arguments based on type and set
207
+ # # max and min values where applicable.
208
+ # @argument_array.each do |row|
209
+ # #strip out first char that contains the @ symbol
210
+ # row.variable_name[0] = ''
211
+ # arg = nil
212
+ # case row.type
213
+ # when "BOOL"
214
+ # arg = OpenStudio::Ruleset::OSArgument::makeBoolArgument(row.variable_name,row.required,row.model_dependant)
215
+ # when "STRING"
216
+ # arg = OpenStudio::Ruleset::OSArgument::makeStringArgument(row.variable_name,row.required,row.model_dependant)
217
+ # when "INTEGER"
218
+ # arg = OpenStudio::Ruleset::OSArgument::makeIntegerArgument(row.variable_name,row.required,row.model_dependant)
219
+ # arg.setMaxValue( row.max_value.to_i ) unless row.min_value.nil?
220
+ # arg.setMaxValue( row.max_value.to_i ) unless row.max_value.nil?
221
+ # when "FLOAT"
222
+ # arg = OpenStudio::Ruleset::OSArgument::makeDoubleArgument(row.variable_name,row.required,row.model_dependant)
223
+ # arg.setMaxValue( row.max_value.to_f ) unless row.min_value.nil?
224
+ # arg.setMaxValue( row.max_value.to_f ) unless row.max_value.nil?
225
+ # when "STRINGCHOICE"
226
+ # # #add string choices one by one.
227
+ # chs = OpenStudio::StringVector.new
228
+ # row.string_choice_array.each {|choice| chs << choice}
229
+ # arg = OpenStudio::Ruleset::OSArgument::makeChoiceArgument(row.variable_name, chs,row.required,row.model_dependant)
230
+ # when "PATH"
231
+ # arg = OpenStudio::Ruleset::OSArgument::makePathArgument("alternativeModelPath",true,"osm")
232
+ # when "WSCHOICE"
233
+ # arg = OpenStudio::Ruleset::makeChoiceArgumentOfWorkspaceObjects( row.variable_name, row.os_object_type.to_IddObjectType , model, row.required)
234
+ # end
235
+ # # #common argument aspects.
236
+ # unless arg.nil?
237
+ # arg.setDisplayName(row.display_name)
238
+ # arg.setDefaultValue(row.default_value) unless row.default_value.nil?
239
+ # args << arg
240
+ # end
241
+ # end
242
+ # return args
243
+ # end
244
+ #
245
+ # def argument_getter(model, runner,user_arguments)
246
+ # @arg_table = []
247
+ # unless @argument_array == nil
248
+ # @argument_array.each do |row|
249
+ # name = row.variable_name
250
+ #
251
+ # case row.type
252
+ # when "BOOL"
253
+ # value = runner.getBoolArgumentValue(name, user_arguments)
254
+ # instance_variable_set("@#{name}",value)
255
+ # @arg_table << [name,value]
256
+ # when "STRING"
257
+ # value = runner.getStringArgumentValue(name, user_arguments)
258
+ # instance_variable_set("@#{name}",value)
259
+ # @arg_table << [name,value]
260
+ # when "INTEGER"
261
+ # value = runner.getIntegerArgumentValue(name, user_arguments)
262
+ # instance_variable_set("@#{name}",value)
263
+ # @arg_table << [name,value]
264
+ # if ( not row.min_value.nil? and instance_variable_get("@#{name}") < row.min_value ) or ( not row.max_value.nil? and instance_variable_get("@#{name}") > row.max_value )
265
+ # runner.registerError("#{row.display_name} must be greater than or equal to #{row.min_value} and less than or equal to #{row.max_value}. You entered #{instance_variable_get("@#{name}")}.")
266
+ # return false
267
+ # end
268
+ # when "FLOAT"
269
+ # value = runner.getDoubleArgumentValue(name, user_arguments)
270
+ # instance_variable_set("@#{name}",value)
271
+ # @arg_table << [name,value]
272
+ #
273
+ # if ( not row.min_value.nil? and instance_variable_get("@#{name}") < row.min_value ) or ( not row.max_value.nil? and instance_variable_get("@#{name}") > row.max_value )
274
+ # runner.registerError("#{row.display_name} must be greater than or equal to #{row.min_value} and less than or equal to #{row.max_value}. You entered #{instance_variable_get("@#{name}")}.")
275
+ # return false
276
+ # end
277
+ # when "STRINGCHOICE"
278
+ # @arg_table << [name,runner.getBoolArgumentValue(name, user_arguments)]
279
+ # instance_variable_set("@#{name}", runner.getStringArgumentValue(name, user_arguments) )
280
+ # when "WSCHOICE"
281
+ # @arg_table << [name,runner.getBoolArgumentValue(name, user_arguments)]
282
+ # instance_variable_set("@#{name}", runner.getOptionalWorkspaceObjectChoiceValue(name, user_arguments,model) )
283
+ #
284
+ # when "PATH"
285
+ # @arg_table << [name,runner.getBoolArgumentValue(name, user_arguments)]
286
+ # instance_variable_set("@#{name}", runner.getPathArgument(name, user_arguments) )
287
+ # end #end case
288
+ # end #end do
289
+ # end
290
+ # return @arg_table
291
+ # end
292
+ #
293
+ # end
294
+ # #Measure Template simplified.
295
+ # class TemplateModelMeasure < BTAPModelUserScript
296
+ #
297
+ # def name
298
+ # "BTAPTempModelMeasure"
299
+ # end
300
+ #
301
+ # def arguments(model)
302
+ #
303
+ # #bool
304
+ # @argument_array << OSMArgument.bool(variable_name,display_name,required,default_value)
305
+ # #string
306
+ # @argument_array << OSMArgument.string(variable_name,display_name,required,default_value)
307
+ # #integer
308
+ # @argument_array << OSMArgument.integer(variable_name,display_name,required,default_value,min_value,max_value)
309
+ # #float
310
+ # @argument_array << OSMArgument.float(variable_name,display_name,required,default_value,min_value,max_value)
311
+ # #Choice
312
+ # @argument_array << OSMArgument.choice(variable_name,display_name,required,default_value,string_choice_array)
313
+ # #Workspace choice (using zones as an example)
314
+ # @argument_array << OSMArgument.wschoice(variable_name,display_name,required,default_value,string_choice_array)
315
+ # args = super(model,@argument_array)
316
+ # return args
317
+ # end
318
+ #
319
+ # def run(model, runner, user_arguments)
320
+ # #IF and E+ measure replace model with workspace as the argument
321
+ # #Boilerplate start
322
+ # parent_method_is_true = super(model, runner, user_arguments)
323
+ #
324
+ #
325
+ # #Start measure changes based on model.
326
+ # puts @boolean_argument_name
327
+ # puts @string_argument_name
328
+ # puts @integer_argument_name
329
+ # puts @float_argument_name
330
+ # puts @choice_argument_name
331
+ # puts @ws_choice_argument_name
332
+ #
333
+ #
334
+ #
335
+ #
336
+ # #Do your stuff here!
337
+ # #Here are some logging methods for reference.
338
+ # # runner.registerInitialCondition("Model initial condition (for example number of floors.")
339
+ # # runner.registerInfo("Use this for information to user.")
340
+ # # runner.registerWarning("Use this for warnings to user.")
341
+ # # runner.registerError("Use this for fatal error message to user. Will not continue. Return a false.") ; return false
342
+ # # runner.registerAsNotApplicable("Measure not applicable because XYZ. Return a true and will continue with other chained measures."); return true
343
+ # # runner.registerFinalCondition("Model ended with # of floors for example")
344
+ # # runner.registerFinalCondition("Indicate what was changed.")
345
+ #
346
+ #
347
+ # #If everything went well..
348
+ # return true ? parent_method_is_true : false
349
+ # end # end method run
350
+ #
351
+ # #For manually running script via an IDE or a command line.
352
+ # #Using the template above as an example.....
353
+ # # argument_values = [
354
+ # #
355
+ # # ["boolean_argument_name", true ],
356
+ # # ["string_argument_name", "some string" ],
357
+ # # ["integer_argument_name", 1 ],
358
+ # # ["float_argument_name", 0.001 ],
359
+ # # ["choice_argument_name", "choice1" ],
360
+ # # ["ws_choice_argument_name", "zone1" ],
361
+ # # ["path_argument_name", OpenStudio::Path.new(File.dirname(__FILE__))]
362
+ # # ]
363
+ # #
364
+ # def set_user_arguments_and_apply(model,argument_values,runner)
365
+ # self.run(model, runner, super(model,argument_values,runner) )
366
+ # end
367
+ #
368
+ # end
369
+ #
370
+ # class ArchetypeScan < BTAPModelUserScript
371
+ #
372
+ # def name
373
+ # "BTAPTempModelMeasure"
374
+ # end
375
+ #
376
+ # def arguments(model)
377
+ # #get all osm files in resource folder.
378
+ # osmfiles = OpenStudio::StringVector.new
379
+ # BTAP::FileIO::get_find_files_from_folder_by_extension(File.dirname(__FILE__), ".osm").each {|filename| osmfiles << File.basename(file_name, ",osm")}
380
+ #
381
+ #
382
+ # #list of arguments as they will appear in the interface. They are available in the run command as @variable_name.
383
+ # @argument_array_of_arrays = [
384
+ # [ "variable_name", "type", "required", "model_dependant", "display_name", "default_value", "min_value", "max_value", "string_choice_array", "os_object_type" ],
385
+ # [ "archetype_name", "STRINGCHOICE", true, false, "archetype_name", osmfiles[0].to_s , nil, nil, osmfiles, nil ],
386
+ # ]
387
+ # args = super(model,@argument_array_of_arrays)
388
+ # return args
389
+ # end
390
+ #
391
+ # def run(model, runner, user_arguments)
392
+ # #run the super
393
+ # parent_method_is_true = super(model, runner, user_arguments)
394
+ #
395
+ #
396
+ # ###############
397
+ #
398
+ # #Set Archetype name in runner.
399
+ # runner.registerValue('archetype_name',@archetype_name)
400
+ #
401
+ # #Set path to OSM files.
402
+ # alternative_model_path = OpenStudio::Path.new("#{File.dirname(__FILE__)}/#{@archetype_name}.osm")
403
+ # #load model and test.
404
+ # translator = OpenStudio::OSVersion::VersionTranslator.new
405
+ # oModel = translator.loadModel(alternative_model_path)
406
+ # if oModel.empty?
407
+ # runner.registerError("Could not load alternative model from '" + alternative_model_path.to_s + "'.")
408
+ # return false
409
+ # end
410
+ # new_model = oModel.get
411
+ #
412
+ # # pull original weather file object over
413
+ # weather_file = new_model.getOptionalWeatherFile
414
+ # if not weather_file.empty?
415
+ # weather_file.get.remove
416
+ # runner.registerInfo("Removed alternate model's weather file object.")
417
+ # end
418
+ # original_weather_file = model.getOptionalWeatherFile
419
+ # if not original_weather_file.empty?
420
+ # original_weather_file.get.clone(new_model)
421
+ # end
422
+ #
423
+ # # pull original design days over
424
+ # new_model.getDesignDays.sort.each { |designDay| designDay.remove }
425
+ # model.getDesignDays.sort.each { |designDay| designDay.clone(new_model) }
426
+ #
427
+ # #swap underlying data in model with underlying data in newModel
428
+ # model.swap(new_model)
429
+ # runner.registerFinalCondition("Model replaced with alternative #{alternative_model_path}.")
430
+ # return true ? parent_method_is_true : false
431
+ # end # end method run
432
+ #
433
+ # #For manually running script via an IDE or a command line script.
434
+ # #Using the template above as an example.....
435
+ # # argument_values = [
436
+ # # ["archetype_name", "FullServiceRestaurant" ]
437
+ # # ]
438
+ # #
439
+ # def set_user_arguments_and_apply(model,argument_values,runner)
440
+ # self.run(model, runner, super(model,argument_values,runner) )
441
+ # end
442
+ # end
443
+ # end
444
+ #
445
+ # class CSV_Measures
446
+ # def initialize(
447
+ # csv_file,
448
+ # script_root_folder_path
449
+ # )
450
+ # @csv_file_path = csv_file
451
+ # @csv_data = nil
452
+ # @script_root_folder_path = script_root_folder_path
453
+ # end
454
+ #
455
+ #
456
+ # # A tiny bit of metacode to assign some instance variables named as above. This will set
457
+ # # the above variable first to nil, then, if present in the csv row data received, the actual construction data values.
458
+ # # So we should after this loop access @ext_wall_rsi for example. If the variable is not present in the row. It will default the value to zero.
459
+ # # It should automatically make floats and strings accordingly.
460
+ # def set_instance_variables(measure_values)
461
+ #
462
+ # measure_values.each do |variable|
463
+ # instance_variable_set("@#{variable}", nil )
464
+ # instance_variable_set("@#{variable}", @csv_data[ variable ] ) unless ( (@csv_data.nil? == true ) or (@csv_data.has_key?(variable) == false) or (@csv_data[variable].to_s.strip.downcase == "na"))
465
+ # end
466
+ # end
467
+ #
468
+ # def are_all_instance_variables_nil?(measure_values)
469
+ # value = true
470
+ # measure_values.each do |variable|
471
+ # value = false unless instance_variable_get("@#{variable}").nil?
472
+ # end
473
+ # return value
474
+ # end
475
+ #
476
+ # end
477
+ # class CSV_OS_Measures < CSV_Measures
478
+ # #loading methods
479
+ # def side_load_base_model_building( model )
480
+ # log_message = ""
481
+ # measure_values =["base_model_rel_path"]
482
+ # #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
483
+ # self.set_instance_variables(measure_values)
484
+ # puts osm_model_full_path = "#{@script_root_folder_path}/#{@base_model_rel_path}"
485
+ # newModel = BTAP::FileIO::load_osm(osm_model_full_path,"-")
486
+ # model.swap(newModel)
487
+ # log_message << "\nModel replaced with alternative model #{osm_model_full_path}.\n"
488
+ # end
489
+ # def load_base_model_building()
490
+ # log_message = ""
491
+ # measure_values =[
492
+ # "base_model_rel_path"
493
+ # ]
494
+ # #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
495
+ # self.set_instance_variables(measure_values)
496
+ # osm_model_full_path = "#{@script_root_folder_path}/#{@base_model_rel_path}"
497
+ # model = BTAP::FileIO::load_osm(osm_model_full_path,"-")
498
+ # log_message << "\nModel rloaded #{osm_model_full_path}.\n"
499
+ # return model
500
+ # end
501
+ # def set_weather_file(model)
502
+ # measure_values =["weather_file_rel_path"]
503
+ # #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
504
+ # self.set_instance_variables(measure_values)
505
+ # BTAP::Site::set_weather_file(model,"#{@script_root_folder_path}/#{@weather_file_rel_path}") unless @weather_file_rel_path.nil?
506
+ # return "Set weather file to #{@weather_file_rel_path}.\n"
507
+ # end
508
+ # def set_hourly_output(model)
509
+ # #create array of output variables strings from E+
510
+ # output_variable_array =
511
+ # [
512
+ # "Facility Total Electric Demand Power",
513
+ # "Water Heater Gas Rate",
514
+ # "Plant Supply Side Heating Demand Rate",
515
+ # "Heating Coil Gas Rate",
516
+ # "Cooling Coil Electric Power",
517
+ # "Boiler Gas Rate",
518
+ # "Heating Coil Air Heating Rate",
519
+ # "Heating Coil Electric Power",
520
+ # "Cooling Coil Total Cooling Rate",
521
+ # "Water Heater Heating Rate",
522
+ # # "Facility Total HVAC Electric Demand Power",
523
+ # # "Facility Total Electric Demand Power",
524
+ # "Zone Air Temperature",
525
+ # "Water Heater Electric Power"
526
+ # # "Baseboard Air Inlet Temperature",
527
+ # # "Baseboard Air Outlet Temperature",
528
+ # # "Baseboard Water Inlet Temperature",
529
+ # # "Baseboard Water Outlet Temperature",
530
+ # # "Boiler Inlet Temperature",
531
+ # # "Boiler Outlet Temperature",
532
+ # # "Plant Supply Side Inlet Temperature",
533
+ # # "Plant Supply Side Outlet Temperature",
534
+ # # "People Radiant Heating Rate",
535
+ # # "People Sensible Heating Rate",
536
+ # # "People Latent Gain Rate",
537
+ # # "People Total Heating Rate",
538
+ # # "Lights Total Heating Rate",
539
+ # # "Electric Equipment Total Heating Rate",
540
+ # # "Other Equipment Total Heating Rate",
541
+ # # "District Heating Hot Water Rate",
542
+ # # "District Heating Rate",
543
+ # # "Air System Outdoor Air Flow Fraction",
544
+ # # "Air System Outdoor Air Minimum Flow Fraction",
545
+ # # "Air System Fan Electric Energy"
546
+ # ]
547
+ # BTAP::Reports::set_output_variables(model,"Hourly", output_variable_array)
548
+ # return "added output variables ..." << output_variable_array.to_s << "\n"
549
+ # end
550
+ #
551
+ # #Helper methods
552
+ # def create_cold_lake_vintages(output_folder = nil)
553
+ # # check if only a single vintage was requested or a full set.
554
+ # baseline_models = Hash.new()
555
+ # prototype_models = Hash.new()
556
+ #
557
+ # puts "Creating Baseline models"
558
+ # CSV.foreach( @csv_file_path, :headers => true, :converters => :all ) do |row|
559
+ # @csv_data = row
560
+ # unless @csv_data["measure_id"] == "NA"
561
+ # model = self.load_base_model_building()
562
+ # self.set_weather_file(model)
563
+ # self.set_hourly_output(model)
564
+ #
565
+ # model,log = self.apply_ecms(model,@csv_data)
566
+ # BTAP::FileIO::save_osm( model, "#{output_folder}/#{BTAP::FileIO::get_name(model)}.osm") unless output_folder.nil?
567
+ # File.open("#{output_folder}/#{BTAP::FileIO::get_name(model)}.log", 'w') { |file| file.write(log) } unless output_folder.nil?
568
+ # baseline_models[BTAP::FileIO::get_name(model)] = model
569
+ # end
570
+ # end
571
+ #
572
+ # #create ECM models.
573
+ # puts "Creating ECM models"
574
+ # counter = 0
575
+ # baseline_models.each do |name,model|
576
+ # #Scan folder and get the ecm csv files.
577
+ # ecm_csv_files = Dir.glob( "#{@script_root_folder_path}/**/ecm_*.csv" )
578
+ # #iterate through each csv file.
579
+ # ecm_csv_files.each do |ecm_csv_file|
580
+ # puts "evaluating #{ecm_csv_file}"
581
+ #
582
+ # # iterate through each row
583
+ # CSV.foreach( ecm_csv_file, :headers => true, :converters => :all ) do |row|
584
+ #
585
+ # # If row baseline matches current baseline name then
586
+ # if name == "#{row["building_type"]}~#{row["vintage_name"]}~baseline"
587
+ # #Skip row if measure_id is NA
588
+ # counter = counter + 1
589
+ # if row["measure_id"].nil? or row["measure_id"].upcase.strip == "NA" or row["measure_id"].upcase.strip == ""
590
+ # else
591
+ # new_model = BTAP::FileIO::deep_copy(model)
592
+ # new_model,log = self.apply_ecms(new_model,row)
593
+ # BTAP::FileIO::save_osm( new_model, "#{output_folder}/#{BTAP::FileIO::get_name(new_model)}.osm") unless output_folder.nil?
594
+ # File.open("#{output_folder}/#{BTAP::FileIO::get_name(new_model)}.log", 'w') { |file| file.write(log) } unless output_folder.nil?
595
+ # end
596
+ # end
597
+ # end
598
+ # end
599
+ # end
600
+ # puts "ECM generation completed."
601
+ # end
602
+ # def apply_ecms(model,row_data)
603
+ # log = ""
604
+ # @csv_data = row_data
605
+ # self.methods.select{ |i| i[/^ecm_.*$/] }.each do |ecm_method_name|
606
+ # log << "**********#{ecm_method_name}\n"
607
+ # raise ("model is nil") if model.nil?
608
+ # raise ("name is nil") if ecm_method_name.nil?
609
+ # log << self.method(ecm_method_name).call(model)
610
+ # end
611
+ # return model,log
612
+ # end
613
+ #
614
+ # #ecms
615
+ # def ecm_capital_costs(model)
616
+ # log = ""
617
+ # measure_values =
618
+ # [
619
+ # "measure_id",
620
+ # "cost_per_floor_m2",
621
+ # "cost_per_building"
622
+ # ]
623
+ # self.set_instance_variables( measure_values )
624
+ #
625
+ # #cost per building and building area
626
+ # building = model.building.get
627
+ # raise ("you did not enter a cost for measure #{@measure_id}. All measures must have a cost of at least 0.0 . Please add a cost_per_building field.") if @cost_per_building.nil?
628
+ # unless @cost_per_building.nil?
629
+ # BTAP::Resources::Economics::object_cost(building,"#{@measure_id} Capital Cost per building",@cost_per_building.to_f,"CostPerEach")
630
+ # log << "added cost of #{@measure_id} per building for #{@measure_id}"
631
+ # puts log
632
+ # end
633
+ # return log
634
+ # end
635
+ # def ecm_id(model)
636
+ # log = ""
637
+ # measure_values =
638
+ # [
639
+ # "building_type",
640
+ # "vintage_name",
641
+ # "measure_id"
642
+ # ]
643
+ # self.set_instance_variables( measure_values )
644
+ # BTAP::FileIO::set_name(model,"#{@building_type}~#{@vintage_name}~#{@measure_id}")
645
+ # puts BTAP::FileIO::get_name(model)
646
+ # return "Changed name to #{BTAP::FileIO::get_name(model)}"
647
+ #
648
+ # end
649
+ # def ecm_envelope( model )
650
+ # log = ""
651
+ # #List of variables required by this measure that are to be extracted from CSV row.
652
+ # measure_values =
653
+ # [
654
+ # "library_file",
655
+ # "default_construction_set_name",
656
+ # "ext_wall_rsi",
657
+ # "ext_floor_rsi",
658
+ # "ext_roof_rsi",
659
+ # "ground_wall_rsi",
660
+ # "ground_floor_rsi",
661
+ # "ground_roof_rsi",
662
+ # "fixed_window_rsi",
663
+ # "fixed_wind_solar_trans",
664
+ # "fixed_wind_vis_trans",
665
+ # "operable_window_rsi",
666
+ # "operable_wind_solar_trans",
667
+ # "operable_wind_vis_trans",
668
+ # "door_construction_rsi",
669
+ # "glass_door_rsi",
670
+ # "glass_door_solar_trans",
671
+ # "glass_door_vis_trans",
672
+ # "overhead_door_rsi",
673
+ # "skylight_rsi",
674
+ # "skylight_solar_trans",
675
+ # "skylight_vis_trans",
676
+ # "tubular_daylight_dome_rsi",
677
+ # "tubular_daylight_dome_solar_trans",
678
+ # "tubular_daylight_dome_vis_trans",
679
+ # "tubular_daylight_diffuser_rsi",
680
+ # "tubular_daylight_diffuser_solar_trans",
681
+ # "tubular_daylight_diffuser_vis_trans",
682
+ # "ext_wall_cost_m3",
683
+ # "ext_floor_cost_m3",
684
+ # "ext_roof_cost_m3",
685
+ # "ground_wall_cost_m3",
686
+ # "ground_floor_cost_m3",
687
+ # "ground_roof_cost_m3",
688
+ # "fixed_window_cost_m3",
689
+ # "operable_window_cost_m3",
690
+ # "door_construction_cost_m3",
691
+ # "glass_door_cost_m3",
692
+ # "overhead_door_cost_m3",
693
+ # "skylight_cost_m3",
694
+ # "tubular_daylight_dome_cost_m3",
695
+ # "tubular_daylight_diffuser_cost_m3",
696
+ # "total_building_construction_set_cost"
697
+ # ]
698
+ #
699
+ # self.set_instance_variables(measure_values)
700
+ # unless @default_construction_set_name.nil? or @library_file.nil?
701
+ #
702
+ # # #Remove all existing constructions from model.
703
+ # BTAP::Resources::Envelope::remove_all_envelope_information( model )
704
+ #
705
+ # # #Load Contruction osm library.
706
+ # construction_lib = BTAP::FileIO::load_osm("#{@script_root_folder_path}/#{@library_file}")
707
+ #
708
+ # #Get construction set.. I/O expensive so doing it here.
709
+ # vintage_construction_set = construction_lib.getDefaultConstructionSetByName(@default_construction_set_name)
710
+ # if vintage_construction_set.empty?
711
+ # raise("#{@default_construction_set} does not exist in #{@script_root_folder_path}/#{@library_file} library ")
712
+ # else
713
+ # vintage_construction_set = construction_lib.getDefaultConstructionSetByName(@default_construction_set_name).get
714
+ # end
715
+ #
716
+ #
717
+ # new_construction_set =vintage_construction_set.clone(model).to_DefaultConstructionSet.get
718
+ # #Set conductances to needed values in construction set if possible.
719
+ # BTAP::Resources::Envelope::ConstructionSets::customize_default_surface_construction_set_rsi!(
720
+ # model: model, name: "#{@default_construction_set}-modified",default_surface_construction_set: new_construction_set,
721
+ # ext_wall_rsi: @ext_wall_rsi, ext_floor_rsi: @ext_floor_rsi, ext_roof_rsi: @ext_roof_rsi,
722
+ # ground_wall_rsi: @ground_wall_rsi, ground_floor_rsi: @ground_floor_rsi, ground_roof_rsi: @ground_roof_rsi,
723
+ # fixed_window_rsi: @fixed_window_rsi, fixed_wind_solar_trans: @fixed_wind_solar_trans, fixed_wind_vis_trans: @fixed_wind_vis_trans,
724
+ # operable_window_rsi: @operable_window_rsi, operable_wind_solar_trans: @operable_wind_solar_trans, operable_wind_vis_trans: @operable_wind_vis_trans,
725
+ # door_construction_rsi: @door_construction_rsi,
726
+ # glass_door_rsi: @glass_door_rsi, glass_door_solar_trans: @glass_door_solar_trans, glass_door_vis_trans: @glass_door_vis_trans,
727
+ # overhead_door_rsi: @overhead_door_rsi,
728
+ # skylight_rsi: @skylight_rsi, skylight_solar_trans: @skylight_solar_trans, skylight_vis_trans: @skylight_vis_trans,
729
+ # tubular_daylight_dome_rsi: @tubular_daylight_dome_rsi, tubular_daylight_dome_solar_trans: @tubular_daylight_dome_solar_trans, tubular_daylight_dome_vis_trans: @tubular_daylight_dome_vis_trans,
730
+ # tubular_daylight_diffuser_rsi: @tubular_daylight_diffuser_rsi, tubular_daylight_diffuser_solar_trans: @tubular_daylight_diffuser_solar_trans, tubular_daylight_diffuser_vis_trans: @tubular_daylight_diffuser_vis_trans
731
+ # )
732
+ #
733
+ #
734
+ # #Set as default to model.
735
+ # model.building.get.setDefaultConstructionSet( new_construction_set )
736
+ #
737
+ # #Set cost information.
738
+ # BTAP::Resources::Envelope::ConstructionSets::customize_default_surface_construction_set_costs(new_construction_set,
739
+ # @ext_wall_cost_m2,
740
+ # @ext_floor_cost_m2,
741
+ # @ext_roof_cost_m2,
742
+ # @ground_wall_cost_m2,
743
+ # @ground_floor_cost_m2,
744
+ # @ground_roof_cost_m2,
745
+ # @fixed_window_cost_m2,
746
+ # @operable_window_cost_m2,
747
+ # @door_construction_cost_m2,
748
+ # @glass_door_cost_m2,
749
+ # @overhead_door_cost_m2,
750
+ # @skylight_cost_m2,
751
+ # @tubular_daylight_dome_cost_m2,
752
+ # @tubular_daylight_diffuser_cost_m2,
753
+ # @total_building_construction_set_cost
754
+ # )
755
+ #
756
+ # #Give adiabatic surfaces a construction. Does not matter what. This is a bug in OpenStudio that leave these surfaces unassigned by the default construction set.
757
+ # all_adiabatic_surfaces = BTAP::Geometry::Surfaces::filter_by_boundary_condition(model.getSurfaces, "Adiabatic")
758
+ # unless all_adiabatic_surfaces.empty?
759
+ # BTAP::Geometry::Surfaces::set_surfaces_construction( all_adiabatic_surfaces, model.building.get.defaultConstructionSet.get.defaultInteriorSurfaceConstructions.get.wallConstruction.get)
760
+ # end
761
+ # #Create sample csv file.
762
+ # CSV.open("#{@script_root_folder_path}/sample_envelope_ecm.csv", 'w') { |csv| csv << measure_values.unshift("measure_id") }
763
+ # return BTAP::Resources::Envelope::ConstructionSets::get_construction_set_info( new_construction_set )
764
+ # end
765
+ # return "Constructions were unchanged.\n"
766
+ # end
767
+ # def ecm_infiltration( model )
768
+ # measure_values =
769
+ # [
770
+ # "infiltration_design_flow_rate",
771
+ # "infiltration_flow_per_space",
772
+ # "infiltration_flow_per_exterior_area",
773
+ # "infiltration_air_changes_per_hour"
774
+ # ]
775
+ #
776
+ # #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
777
+ # self.set_instance_variables(measure_values)
778
+ #
779
+ # log = BTAP::Resources::SpaceLoads::ScaleLoads::set_inflitration_magnitude(
780
+ # model,
781
+ # @infiltration_design_flow_rate,
782
+ # @infiltration_flow_per_space,
783
+ # @infiltration_flow_per_exterior_area,
784
+ # @infiltration_air_changes_per_hour
785
+ # )
786
+ # return log
787
+ # end
788
+ # def ecm_fans( model )
789
+ # measure_values =
790
+ # [
791
+ # "fan_total_eff",
792
+ # "fan_motor_eff",
793
+ # "fan_volume_type"
794
+ # ]
795
+ # #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
796
+ # self.set_instance_variables(measure_values)
797
+ # log = ""
798
+ # unless model.getFanVariableVolumes.empty?
799
+ # log = "fan_variable_volume_name,fan_total_eff,fan_motor_eff\n"
800
+ # model.getFanVariableVolumes.sort.each do |fan|
801
+ # fan.setFanEfficiency( @fan_total_eff ) unless @fan_total_eff.nil?
802
+ # fan.setMotorEfficiency( @fan_motor_eff ) unless @fan_motor_eff.nil?
803
+ # log << fan.name.get.to_s << ",#{fan.fanEfficiency},#{fan.motorEfficiency}\n"
804
+ # end
805
+ # end
806
+ #
807
+ # unless model.getFanConstantVolumes.empty?
808
+ # log = "fan_constant_volume_name,fan_total_eff,fan_motor_eff\n"
809
+ # model.getFanConstantVolumes.sort.each do |fan|
810
+ # fan.setFanEfficiency( @fan_total_eff ) unless @fan_total_eff.nil?
811
+ # fan.setMotorEfficiency( @fan_motor_eff ) unless @fan_motor_eff.nil?
812
+ # log << fan.name.get.to_s << ",#{fan.fanEfficiency},#{fan.motorEfficiency}\n"
813
+ # end
814
+ #
815
+ # end
816
+ #
817
+ # case @fan_volume_type
818
+ #
819
+ # when "VariableVolume"
820
+ # model.getFanConstantVolumes.sort.each do |fan_const|
821
+ # #check that this is indeed connected to an airloop.
822
+ # log << "Found Const Vol Fan #{fan_const.name.get.to_s}"
823
+ # unless fan_const.loop.empty?
824
+ # fan_variable = OpenStudio::Model::FanVariableVolume.new(model,fan_const.availabilitySchedule)
825
+ # #pass information from old fan as much as possible.
826
+ # fan_variable.setFanEfficiency(fan_const.fanEfficiency)
827
+ # fan_variable.setPressureRise( fan_const.pressureRise() )
828
+ # fan_variable.autosizeMaximumFlowRate
829
+ # fan_variable.setFanPowerMinimumFlowRateInputMethod("FixedFlowRate")
830
+ # fan_variable.setFanPowerMinimumFlowFraction(0.25)
831
+ # fan_variable.setMotorInAirstreamFraction( fan_const.motorInAirstreamFraction() )
832
+ # fan_variable.setFanPowerCoefficient1(0.35071223)
833
+ # fan_variable.setFanPowerCoefficient2(0.30850535)
834
+ # fan_variable.setFanPowerCoefficient3(-0.54137364)
835
+ # fan_variable.setFanPowerCoefficient4(0.87198823)
836
+ #
837
+ # #get the airloop.
838
+ # air_loop = fan_const.loop.get
839
+ # #add the FanVariableVolume
840
+ # fan_variable.addToNode(air_loop.supplyOutletNode())
841
+ # #Remove FanConstantVolume
842
+ # fan_const.remove()
843
+ # log << "Replaced by Variable Vol Fan #{fan_variable.name.get.to_s}"
844
+ # end
845
+ # end
846
+ # when "ConstantVolume"
847
+ # model.getFanVariableVolumes.sort.each do |fan|
848
+ # #check that this is indeed connected to an airloop.
849
+ # log << "Found Const Vol Fan #{fan.name.get.to_s}"
850
+ # unless fan.loop.empty?
851
+ # new_fan = OpenStudio::Model::FanConstantVolume.new(model,fan.availabilitySchedule)
852
+ # #pass information from constant speed fan as much as possible.
853
+ # new_fan.setFanEfficiency(fan.fanEfficiency)
854
+ # new_fan.setPressureRise( fan.pressureRise() )
855
+ # new_fan.setMotorEfficiency(fan.motorEfficiency)
856
+ # new_fan.setMotorInAirstreamFraction( fan.motorInAirstreamFraction() )
857
+ # new_fan.autosizeMaximumFlowRate
858
+ # #get the airloop.
859
+ # air_loop = fan.loop.get
860
+ # #add the FanVariableVolume
861
+ # new_fan.addToNode(air_loop.supplyOutletNode())
862
+ # #Remove FanConstantVolume
863
+ # fan.remove()
864
+ # log << "Replaced by Constant Vol Fan #{new_fan.name.get.to_s}"
865
+ # end
866
+ # end
867
+ # when nil
868
+ # log << "No changes to Fan."
869
+ # else
870
+ # raise("fan_volume_type should be ConstantVolume or VariableVolume")
871
+ # end
872
+ # return log
873
+ # end
874
+ # def ecm_pumps( model )
875
+ # measure_values =
876
+ # [
877
+ # "pump_motor_eff",
878
+ # "pump_control_type",
879
+ # "pump_speed_type"
880
+ # ]
881
+ # #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
882
+ # self.set_instance_variables(measure_values)
883
+ # log = ""
884
+ # unless model.getPumpVariableSpeeds.empty?
885
+ # log = "pump_variable_speed_name,@pump_motor_eff\n"
886
+ # model.getPumpVariableSpeeds.sort.each do |pump|
887
+ # pump.setMotorEfficiency( @pump_motor_eff.to_f ) unless @pump_motor_eff.nil?
888
+ # pump.setPumpControlType( @pump_control_type ) unless @pump_control_type.nil?
889
+ # log << pump.name.get.to_s << ",#{pump.motorEfficiency}\n"
890
+ # end
891
+ # end
892
+ # unless model.getPumpConstantSpeeds.empty?
893
+ # log << "pump_variable_speed_name,@pump_motor_eff\n"
894
+ # model.getPumpConstantSpeeds.sort.each do |pump|
895
+ # pump.setMotorEfficiency( @pump_motor_eff.to_f ) unless @pump_motor_eff.nil?
896
+ # pump.setPumpControlType( @pump_control_type ) unless @pump_control_type.nil?
897
+ # log << pump.name.get.to_s << ",#{pump.motorEfficiency}\n"
898
+ # end
899
+ # end
900
+ #
901
+ # #set pump speed type based on existing pump.
902
+ # case @pump_speed_type
903
+ # when "VariableSpeed"
904
+ # model.getPumpConstantSpeeds.sort.each do |pump_const|
905
+ # log << "Found Const Vol Fan #{pump_const.name.get.to_s}"
906
+ # #check that this is indeed connected to an plant loop.
907
+ # unless pump_const.plantLoop.empty?
908
+ # pump_variable = OpenStudio::Model::PumpVariableSpeed.new(model)
909
+ # #pass information from constant speed fan as much as possible.
910
+ # pump_variable.setRatedFlowRate(pump_const.ratedFlowRate)
911
+ # pump_variable.setRatedPumpHead(pump_const.ratedPumpHead)
912
+ # pump_variable.setRatedPowerConsumption(pump_const.ratedPowerConsumption.to_f)
913
+ # pump_variable.setMotorEfficiency(pump_const.motorEfficiency.to_f)
914
+ # pump_variable.setPumpControlType(pump_const.pumpControlType)
915
+ # pump_variable.setFractionofMotorInefficienciestoFluidStream(pump_const.fractionofMotorInefficienciestoFluidStream.to_f)
916
+ # pump_variable.autosizeRatedFlowRate if pump_const.isRatedFlowRateAutosized
917
+ # pump_variable.autosizeRatedPowerConsumption if pump_const.isRatedPowerConsumptionAutosized
918
+ #
919
+ # #get the hot water loop.
920
+ # hw_loop = pump_const.plantLoop.get
921
+ # #Remove PumpConstantSpeed
922
+ # pump_const.remove()
923
+ # #add
924
+ # pump_variable.addToNode(hw_loop.supplyInletNode)
925
+ # log << "Replaced by Variable Vol Pump #{pump_variable.name.get.to_s}"
926
+ # end
927
+ # end #end loop PumpConstantSpeeds
928
+ # when "ConstantSpeed"
929
+ # model.getPumpVariableSpeeds.sort.each do |pump|
930
+ # log << "Found Variable Speed Pump #{pump.name.get.to_s}"
931
+ # #check that this is indeed connected to an plant loop.
932
+ # unless pump.plantLoop.empty?
933
+ # new_pump = OpenStudio::Model::PumpVariableSpeed.new(model)
934
+ # #pass information from constant speed fan as much as possible.
935
+ #
936
+ # new_pump.setRatedFlowRate(pump.ratedFlowRate.get)
937
+ # new_pump.setRatedPumpHead(pump.ratedPumpHead())
938
+ # new_pump.setRatedPowerConsumption(pump.ratedPowerConsumption.to_f)
939
+ # new_pump.setMotorEfficiency(pump.motorEfficiency().to_f)
940
+ # new_pump.setFractionofMotorInefficienciestoFluidStream(pump.fractionofMotorInefficienciestoFluidStream().to_f)
941
+ # new_pump.setPumpControlType( pump.pumpControlType )
942
+ # new_pump.autosizeRatedFlowRate if pump.isRatedFlowRateAutosized
943
+ # new_pump.autosizeRatedPowerConsumption if pump.isRatedPowerConsumptionAutosized
944
+ # #get the hot water loop.
945
+ # hw_loop = pump.plantLoop.get
946
+ # #Remove PumpVariableSpeed
947
+ # pump.remove()
948
+ # #add the pump to loop.
949
+ # new_pump.addToNode(hw_loop.supplyInletNode)
950
+ #
951
+ # log << "Replaced by constant speed Pump #{new_pump.name.get.to_s}"
952
+ # end
953
+ # end #end loop Pump variable Speeds
954
+ # when nil
955
+ # log << "No changes"
956
+ # else
957
+ # raise( "pump_speed_type field is not ConstantSpeed or VariableSpeed" )
958
+ # end
959
+ #
960
+ # #Create sample csv file.
961
+ # CSV.open("#{@script_root_folder_path}/sample_pump_eff_ecm.csv", 'w') { |csv| csv << measure_values.unshift("measure_id") }
962
+ # return log
963
+ # end
964
+ # def ecm_cooling_cop( model )
965
+ # log = ""
966
+ # measure_values =[
967
+ # "cop"
968
+ # ]
969
+ #
970
+ # #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
971
+ # self.set_instance_variables(measure_values)
972
+ #
973
+ # unless model.getCoilCoolingDXSingleSpeeds.empty?
974
+ # log = "coil_cooling_dx_single_speed_name,cop\n"
975
+ # model.getCoilCoolingDXSingleSpeeds.sort.each do |cooling_coil|
976
+ # cooling_coil.setRatedCOP( OpenStudio::OptionalDouble.new( @cop ) ) unless @cop.nil?
977
+ # cop = "NA"
978
+ # # Prior to 3.5.0, it was an optional double, now it's a double
979
+ # cop_ = OpenStudio::OptionalDouble.new(cooling_coil.ratedCOP)
980
+ # cop = cop_.get unless cop_.empty?
981
+ # log << cooling_coil.name.get.to_s << ",#{cop}\n"
982
+ #
983
+ # end
984
+ # end
985
+ #
986
+ # unless model.getCoilCoolingDXTwoSpeeds.empty?
987
+ # log << "coil_cooling_dx_two_speed_name,cop\n"
988
+ # model.getCoilCoolingDXTwoSpeeds.sort.each do |cooling_coil|
989
+ # cooling_coil.setRatedHighSpeedCOP( @cop ) unless @cop.nil?
990
+ # cooling_coil.setRatedLowSpeedCOP( @cop ) unless @cop.nil?
991
+ # cop_high = "NA"
992
+ # cop_ = OpenStudio::OptionalDouble.new(cooling_coil.ratedHighSpeedCOP)
993
+ # cop_high = cop_.get unless cop_.empty?
994
+ # cop_low = "NA"
995
+ # cop_ = OpenStudio::OptionalDouble.new(cooling_coil.ratedLowSpeedCOP)
996
+ # cop_low = cop_.get unless cop_.empty?
997
+ # log << cooling_coil.name.get.to_s << ",#{cop_high},#{cop_low}\n"
998
+ # end
999
+ # end
1000
+ # return log
1001
+ # end
1002
+ # def ecm_economizers( model )
1003
+ #
1004
+ # measure_values =[
1005
+ # "economizer_control_type",
1006
+ # "economizer_control_action_type",
1007
+ # "economizer_maximum_limit_dry_bulb_temperature",
1008
+ # "economizer_maximum_limit_enthalpy",
1009
+ # "economizer_maximum_limit_dewpoint_temperature",
1010
+ # "economizer_minimum_limit_dry_bulb_temperature" ]
1011
+ #
1012
+ # #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
1013
+ # self.set_instance_variables(measure_values)
1014
+ # log = ""
1015
+ # unless @economizer_control_type.nil?
1016
+ # log << BTAP::Resources::HVAC::enable_economizer(
1017
+ # model,
1018
+ # @economizer_control_type,
1019
+ # @economizer_control_action_type,
1020
+ # @economizer_maximum_limit_dry_bulb_temperature,
1021
+ # @economizer_maximum_limit_enthalpy,
1022
+ # @economizer_maximum_limit_dewpoint_temperature,
1023
+ # @economizer_minimum_limit_dry_bulb_temperature
1024
+ # )
1025
+ #
1026
+ # end
1027
+ # return log
1028
+ # end
1029
+ # def ecm_sizing( model)
1030
+ # measure_values =[
1031
+ # "heating_sizing_factor",
1032
+ # "cooling_sizing_factor",
1033
+ # "zone_heating_sizing_factor",
1034
+ # "zone_cooling_sizing_factor"
1035
+ # ]
1036
+ #
1037
+ # table = "*Sizing Factor Measure*"
1038
+ # #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
1039
+ # self.set_instance_variables(measure_values)
1040
+ # table = "handle,heating_sizing_factor,cooling_sizing_factor\n"
1041
+ # #Sizing Parameters
1042
+ #
1043
+ # model.getSizingParameters.setHeatingSizingFactor(@heating_sizing_factor) unless @heating_sizing_factor.nil?
1044
+ # model.getSizingParameters.setCoolingSizingFactor(@cooling_sizing_factor) unless @cooling_sizing_factor.nil?
1045
+ #
1046
+ #
1047
+ # #SizingZone
1048
+ # table << "handle,zone_heating_sizing_factor,zone_cooling_sizing_factor\n"
1049
+ # model.getSizingZones.sort.each do |item|
1050
+ # item.setZoneHeatingSizingFactor(@zone_heating_sizing_factor) unless @zone_heating_sizing_factor.nil?
1051
+ # item.setZoneCoolingSizingFactor(@zone_cooling_sizing_factor) unless @zone_cooling_sizing_factor.nil?
1052
+ # table << "#{item.handle},#{item.zoneHeatingSizingFactor.get},#{item.zoneCoolingSizingFactor.get}\n"
1053
+ # end
1054
+ # #Create sample csv file.
1055
+ # CSV.open("#{@script_root_folder_path}/sample_sizing_param_ecm.csv", 'w') { |csv| csv << measure_values.unshift("measure_id") }
1056
+ # return table
1057
+ # end
1058
+ # def ecm_dhw( model )
1059
+ # log = "shw_setpoint_sched,shw_heater_fuel_type,shw_thermal_eff\n"
1060
+ # measure_values =[
1061
+ # "shw_setpoint_sched_name",
1062
+ # "shw_heater_fuel_type",
1063
+ # "shw_thermal_eff"
1064
+ # ]
1065
+ # log = "*SHW Measures*\n"
1066
+ # #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
1067
+ # self.set_instance_variables(measure_values)
1068
+ #
1069
+ # #Create Schedule
1070
+ # #schedule = BTAP::Resources::Schedules::create_annual_ruleset_schedule_detailed_json(model, @shw_setpoint_sched) unless @shw_setpoint_sched_name.nil? or @shw_setpoint_sched.nil?
1071
+ #
1072
+ # #iterate through water heaters.
1073
+ # model.getWaterHeaterMixeds.sort.each do |item|
1074
+ # unless @shw_setpoint_sched_name.nil? or @shw_setpoint_sched.nil?
1075
+ # item.setSetpointTemperatureSchedule(schedule)
1076
+ # end
1077
+ # item.setHeaterFuelType(@shw_heater_fuel_type) unless @shw_heater_fuel_type.nil?
1078
+ # item.setHeaterThermalEfficiency(@shw_thermal_eff) unless @shw_thermal_eff.nil?
1079
+ # log << item.name.get.to_s << ",#{item.setpointTemperatureSchedule},#{item.heaterFuelType},#{item.heaterThermalEfficiency}\n"
1080
+ # end
1081
+ # return log
1082
+ # end
1083
+ # def ecm_hotwater_boilers( model )
1084
+ # measure_values = [
1085
+ # "hw_boiler_design_water_outlet_temperature",
1086
+ # "hw_boiler_fuel_type",
1087
+ # "hw_boiler_thermal_eff",
1088
+ # "hw_boiler_curve",
1089
+ # "hw_boiler_flow_mode",#
1090
+ # "hw_boiler_eff_curve_temp_eval_var",#
1091
+ # "hw_boiler_reset_highsupplytemp" ,
1092
+ # "hw_boiler_reset_outsidehighsupplytemp" ,
1093
+ # "hw_boiler_reset_lowsupplytemp" ,
1094
+ # "hw_boiler_reset_outsidelowsupplytemp" ,
1095
+ # ]
1096
+ #
1097
+ # #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
1098
+ # self.set_instance_variables(measure_values)
1099
+ # table = "name,boiler_design_water_outlet_temperature,boiler_fuel_type,boiler_thermal_eff\n"
1100
+ #
1101
+ # model.getPlantLoops.sort.each do |iplantloop|
1102
+ # iplantloop.components.each do |icomponent|
1103
+ # if icomponent.to_BoilerHotWater.is_initialized
1104
+ # boiler = icomponent.to_BoilerHotWater.get
1105
+ #
1106
+ # #set design outlet temp
1107
+ # if model.version < OpenStudio::VersionString.new('3.0.0')
1108
+ # boiler.setDesignWaterOutletTemperature(@hw_boiler_design_water_outlet_temperature) unless @hw_boiler_design_water_outlet_temperature.nil?
1109
+ # end
1110
+ # #set fuel type
1111
+ # boiler.setFuelType(@hw_boiler_fuel_type) unless @hw_boiler_fuel_type.nil?
1112
+ # #set thermal eff
1113
+ # boiler.setNominalThermalEfficiency(@hw_boiler_thermal_eff) unless @hw_boiler_thermal_eff.nil?
1114
+ # #set boiler flow mode
1115
+ # unless @hw_boiler_flow_mode.nil?
1116
+ # ["ConstantFlow","LeavingSetpointModulated","NotModulated"].include?(@hw_boiler_flow_mode) ? boiler.setBoilerFlowMode(@hw_boiler_flow_mode) : raise("Boiler flow mode #{@hw_boiler_flow_mode} invalid.")
1117
+ # end
1118
+ # #set setDesignWaterOutletTemperature
1119
+ # if model.version < OpenStudio::VersionString.new('3.0.0')
1120
+ # boiler.setDesignWaterOutletTemperature(@hotwaterboiler_reset_highsupplytemp) unless @hotwaterboiler_reset_highsupplytemp.nil?
1121
+ # end
1122
+ # #set EfficiencyCurveTemperatureEvaluationVariable
1123
+ # unless @hw_boiler_eff_curve_temp_eval_var.nil?
1124
+ # ["LeavingBoiler","EnteringBoiler"].include?(@hw_boiler_eff_curve_temp_eval_var) ? boiler.setEfficiencyCurveTemperatureEvaluationVariable(@hw_boiler_eff_curve_temp_eval_var) : raise("EfficiencyCurveTemperatureEvaluationVariable #{@hw_boiler_eff_curve_temp_eval_var} invalid.")
1125
+ # end
1126
+ #
1127
+ #
1128
+ # #Set boiler curve
1129
+ # curve = boiler.normalizedBoilerEfficiencyCurve
1130
+ # if not @hw_boiler_curve.nil? and curve.is_initialized and curve.get.to_CurveBiquadratic.is_initialized
1131
+ # case @hw_boiler_curve.downcase
1132
+ # when "atmospheric"
1133
+ # biqcurve = curve.get.to_CurveBiquadratic.get
1134
+ # biqcurve.setCoefficient1Constant(1.057059)
1135
+ # biqcurve.setCoefficient1Constant(1.057059)
1136
+ # biqcurve.setCoefficient2x(-0.0774177)
1137
+ # biqcurve.setCoefficient3xPOW2(0.07875142)
1138
+ # biqcurve.setCoefficient4y(0.0003943856)
1139
+ # biqcurve.setCoefficient5yPOW2(-0.000004074629)
1140
+ # biqcurve.setCoefficient6xTIMESY(-0.002202606)
1141
+ # biqcurve.setMinimumValueofx(0.3)
1142
+ # biqcurve.setMaximumValueofx(1.0)
1143
+ # biqcurve.setMinimumValueofy(40.0)
1144
+ # biqcurve.setMaximumValueofy(90.0)
1145
+ # biqcurve.setMinimumCurveOutput(0.0)
1146
+ # biqcurve.setMaximumCurveOutput(1.1)
1147
+ # biqcurve.setInputUnitTypeforX("Dimensionless")
1148
+ # biqcurve.setInputUnitTypeforY("Temperature")
1149
+ # biqcurve.setOutputUnitType("Dimensionless")
1150
+ # when "condensing"
1151
+ # biqcurve = curve.get.to_CurveBiquadratic.get
1152
+ # biqcurve.setCoefficient1Constant(0.4873)
1153
+ # biqcurve.setCoefficient2x(1.1322)
1154
+ # biqcurve.setCoefficient3xPOW2(-0.6425)
1155
+ # biqcurve.setCoefficient4y(0.0)
1156
+ # biqcurve.setCoefficient5yPOW2(0.0)
1157
+ # biqcurve.setCoefficient6xTIMESY(0.0)
1158
+ # biqcurve.setMinimumValueofx(0.1)
1159
+ # biqcurve.setMaximumValueofx(1.0)
1160
+ # biqcurve.setMinimumValueofy(0.0)
1161
+ # biqcurve.setMaximumValueofy(0.0)
1162
+ # biqcurve.setMinimumCurveOutput(0.0)
1163
+ # biqcurve.setMaximumCurveOutput(1.0)
1164
+ # biqcurve.setInputUnitTypeforX("Dimensionless")
1165
+ # biqcurve.setInputUnitTypeforY("Temperature")
1166
+ # biqcurve.setOutputUnitType("Dimensionless")
1167
+ # else
1168
+ # raise("#{@hotwaterboiler_curve} is not a valid boiler curve name (condensing_boiler_curve,atmospheric_boiler_curve")
1169
+ # end
1170
+ # end
1171
+ #
1172
+ # #boiler reset setpoint manager
1173
+ # unless @hotwaterboiler_reset_lowsupplytemp.nil? and @hotwaterboiler_reset_outsidelowsupplytemp.nil? and @hotwaterboiler_reset_highsupplytemp.nil? and @hotwaterboiler_reset_outsidehighsupplytemp.nil?
1174
+ # #check if setpoint manager is present at supply outlet
1175
+ # #Find any setpoint manager if it exists and outlet node and remove it.
1176
+ # iplantloop.supplyOutletNode.setpointManagers.each {|sm| sm.disconnect}
1177
+ #
1178
+ # #Add new setpoint manager
1179
+ # oar_stpt_manager = OpenStudio::Model::SetpointManagerOutdoorAirReset.new(model)
1180
+ # oar_stpt_manager.addToNode(iplantloop.supplyOutletNode)
1181
+ # oar_stpt_manager.setSetpointatOutdoorHighTemperature(@hw_boiler_reset_lowsupplytemp) unless @hw_boiler_reset_lowsupplytemp.nil?
1182
+ # oar_stpt_manager.setOutdoorHighTemperature(@hotwaterboiler_reset_outsidelowsupplytemp) unless @hw_boiler_reset_outsidelowsupplytemp.nil?
1183
+ # oar_stpt_manager.setSetpointatOutdoorLowTemperature(@hw_boiler_reset_highsupplytemp) unless @hw_boiler_reset_highsupplytemp.nil?
1184
+ # oar_stpt_manager.setOutdoorLowTemperature(@hw_boiler_reset_outsidehighsupplytemp) unless @hw_boiler_reset_outsidehighsupplytemp.nil?
1185
+ # end
1186
+ # table << boiler.name.get.to_s << ","
1187
+ # boiler.designWaterOutletTemperature.empty? ? dowt = "NA" : dowt = boiler.designWaterOutletTemperature.get
1188
+ # table << "#{dowt},#{boiler.fuelType},#{boiler.nominalThermalEfficiency}\n"
1189
+ # end
1190
+ # end
1191
+ # end #end boilers loop
1192
+ # return table
1193
+ # end
1194
+ # def ecm_dcv( model )
1195
+ # log = ""
1196
+ # measure_values =[
1197
+ # "dcv_enabled"
1198
+ # ]
1199
+ # #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
1200
+ # self.set_instance_variables(measure_values)
1201
+ # unless @dcv_enabled.nil?
1202
+ # log = BTAP::Resources::HVAC::enable_demand_control_ventilation(model,@dcv_enabled.to_bool)
1203
+ # end
1204
+ # return log
1205
+ # end
1206
+ # def ecm_heating_cooling_setpoints(model)
1207
+ #
1208
+ # log = ""
1209
+ # measure_values =[
1210
+ # "library_file",
1211
+ # "heating_schedule_name",
1212
+ # "cooling_schedule_name"
1213
+ # ]
1214
+ # #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
1215
+ # self.set_instance_variables(measure_values)
1216
+ #
1217
+ # library_file = @library_file
1218
+ # heating_schedule_name = @heating_schedule_name
1219
+ # cooling_schedule_name = @cooling_schedule_name
1220
+ #
1221
+ # unless @heating_schedule_name.nil? and @cooling_schedule_name.nil?
1222
+ # #Load Contruction osm library.
1223
+ # lib = BTAP::FileIO::load_osm("#{@script_root_folder_path}/#{library_file}")
1224
+ #
1225
+ # unless heating_schedule_name.nil?
1226
+ # #Get heating schedule from library and clone it.
1227
+ # heating_schedule = lib.getScheduleRulesetByName(heating_schedule_name)
1228
+ # if heating_schedule.empty?
1229
+ # raise("#{heating_schedule_name} does not exist in #{library_file} library ")
1230
+ # else
1231
+ # heating_schedule = lib.getScheduleRulesetByName(heating_schedule_name).get.clone(model).to_ScheduleRuleset.get
1232
+ # end
1233
+ # end
1234
+ #
1235
+ # unless cooling_schedule_name.nil?
1236
+ # #Get cooling schedule from library and clone it.
1237
+ # cooling_schedule = lib.getScheduleRulesetByName(cooling_schedule_name)
1238
+ # if cooling_schedule.empty?
1239
+ # raise("#{cooling_schedule_name} does not exist in #{library_file} library ")
1240
+ # else
1241
+ # cooling_schedule = lib.getScheduleRulesetByName(cooling_schedule_name).get.clone(model).to_ScheduleRuleset.get
1242
+ # end
1243
+ # end
1244
+ # model.getThermostatSetpointDualSetpoints.sort.each do |dual_setpoint|
1245
+ # unless heating_schedule_name.nil?
1246
+ # raise ("Could not set heating Schedule") unless dual_setpoint.setHeatingSetpointTemperatureSchedule(heating_schedule)
1247
+ # end
1248
+ # unless cooling_schedule_name.nil?
1249
+ # raise ("Could not set cooling Schedule") unless dual_setpoint.setCoolingSetpointTemperatureSchedule(cooling_schedule)
1250
+ # end
1251
+ # end
1252
+ # end
1253
+ # return log
1254
+ # end
1255
+ # def ecm_erv( model )
1256
+ # log = ""
1257
+ # measure_values =[
1258
+ # "erv_enabled",
1259
+ # "erv_autosizeNominalSupplyAirFlowRate",
1260
+ # "erv_NominalSupplyAirFlowRate",
1261
+ # "erv_HeatExchangerType",
1262
+ # "erv_SensibleEffectivenessat100CoolingAirFlow",
1263
+ # "erv_SensibleEffectivenessat75CoolingAirFlow",
1264
+ # "erv_LatentEffectiveness100Cooling",
1265
+ # "erv_LatentEffectiveness75Cooling",
1266
+ # "erv_SensibleEffectiveness100Heating",
1267
+ # "erv_SensibleEffectiveness75Heating",
1268
+ # "erv_LatentEffectiveness100Heating",
1269
+ # "erv_LatentEffectiveness75Heating",
1270
+ # "erv_SupplyAirOutletTemperatureControl",
1271
+ # "erv_setFrostControlType",
1272
+ # "erv_ThresholdTemperature",
1273
+ # "erv_InitialDefrostTimeFraction",
1274
+ # "erv_nominal_electric_power",
1275
+ # "erv_economizer_lockout"
1276
+ # ]
1277
+ #
1278
+ # #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
1279
+ # self.set_instance_variables(measure_values)
1280
+ #
1281
+ #
1282
+ # unless @erv_enabled.nil? or @erv_enabled.to_bool == false
1283
+ # BTAP::Resources::HVAC::enable_erv(
1284
+ # model,
1285
+ # @erv_autosizeNominalSupplyAirFlowRate,
1286
+ # @erv_NominalSupplyAirFlowRate,
1287
+ # @erv_HeatExchangerType,
1288
+ # @erv_SensibleEffectivenessat100CoolingAirFlow,
1289
+ # @erv_SensibleEffectivenessat75CoolingAirFlow,
1290
+ # @erv_LatentEffectiveness100Cooling,
1291
+ # @erv_LatentEffectiveness75Cooling,
1292
+ # @erv_SensibleEffectiveness100Heating,
1293
+ # @erv_SensibleEffectiveness75Heating,
1294
+ # @erv_LatentEffectiveness100Heating,
1295
+ # @erv_LatentEffectiveness75Heating,
1296
+ # @erv_SupplyAirOutletTemperatureControl.to_bool,
1297
+ # @erv_setFrostControlType,
1298
+ # @erv_ThresholdTemperature,
1299
+ # @erv_InitialDefrostTimeFraction,
1300
+ # @erv_nominal_electric_power,
1301
+ # @erv_economizer_lockout.to_bool
1302
+ # ).each { |erv| log << erv.to_s }
1303
+ #
1304
+ #
1305
+ # #Add setpoint manager to all OA object in airloops.
1306
+ # model.getHeatExchangerAirToAirSensibleAndLatents.sort.each do |erv|
1307
+ #
1308
+ # #needed to get the supply outlet node from the erv to place the setpoint manager.
1309
+ # node = erv.primaryAirOutletModelObject.get.to_Node.get if erv.primaryAirOutletModelObject.is_initialized
1310
+ # new_set_point_manager = OpenStudio::Model::SetpointManagerWarmest.new(model)
1311
+ # raise ("Could not add setpoint manager") unless new_set_point_manager.addToNode(node)
1312
+ # log << "added warmest control to node #{node}"
1313
+ # new_set_point_manager.setMaximumSetpointTemperature(16.0)
1314
+ # new_set_point_manager.setMinimumSetpointTemperature(5.0)
1315
+ # new_set_point_manager.setStrategy("MaximumTemperature")
1316
+ # new_set_point_manager.setControlVariable("Temperature")
1317
+ # end
1318
+ # log << "ERV have been modified.\n"
1319
+ # else
1320
+ # log << "ERV not changed."
1321
+ # end
1322
+ # return log
1323
+ # end
1324
+ # def ecm_exhaust_fans( model )
1325
+ # log = ""
1326
+ # #Exhaust ECM
1327
+ # measure_values =[
1328
+ # "exhaust_fans_occ_control_enabled"
1329
+ # ]
1330
+ # #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
1331
+ # self.set_instance_variables(measure_values)
1332
+ # unless @exhaust_fans_occ_control_enabled.nil? or @exhaust_fans_occ_control_enabled.to_bool == false
1333
+ # fans = BTAP::Resources::Schedules::set_exhaust_fans_availability_to_building_default_occ_schedule(model)
1334
+ # fans.each { |fan| log << fan.to_s}
1335
+ # else
1336
+ # log << "No changes to exhaust fans."
1337
+ # end
1338
+ # return log
1339
+ # end
1340
+ # def ecm_lighting( model )
1341
+ # log = ""
1342
+ # #Lighting ECM
1343
+ # measure_values =[
1344
+ # "lighting_scaling_factor",
1345
+ # "lighting_fraction_radiant",
1346
+ # "lighting_fraction_visible",
1347
+ # "lighting_return_air_fraction"
1348
+ # ]
1349
+ # #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
1350
+ # self.set_instance_variables(measure_values)
1351
+ # BTAP::Resources::SpaceLoads::ScaleLoads::scale_lighting_loads(
1352
+ # model,
1353
+ # @lighting_scaling_factor ) unless @lighting_scaling_factor.nil?
1354
+ # #Set lighting variables
1355
+ # model.getLightsDefinitions.sort.each do |lightsdef|
1356
+ # lightsdef.setFractionRadiant(@lighting_fraction_radiant.to_f)
1357
+ # lightsdef.setFractionVisible(@lighting_fraction_visible.to_f)
1358
+ # lightsdef.setReturnAirFraction(@lighting_return_air_fraction.to_f)
1359
+ # end
1360
+ # return log
1361
+ # end
1362
+ # def ecm_plugs( model )
1363
+ # log = ""
1364
+ # #Plug loads ECM
1365
+ # measure_values = [
1366
+ # "elec_equipment_scaling_factor",
1367
+ # "elec_equipment_fraction_radiant",
1368
+ # "elec_equipment_fraction_latent",
1369
+ # "elec_equipment_fraction_lost"
1370
+ # ]
1371
+ # #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
1372
+ # self.set_instance_variables(measure_values)
1373
+ #
1374
+ # BTAP::Resources::SpaceLoads::ScaleLoads::scale_electrical_loads(
1375
+ # model,
1376
+ # @elec_equipment_scaling_factor) unless @elec_equipment_scaling_factor.nil?
1377
+ #
1378
+ # #Set plug loads variables
1379
+ # model.getElectricEquipmentDefinitions.sort.each do |elec_equip_def|
1380
+ # elec_equip_def.setFractionRadiant(@elec_equipment_fraction_radiant.to_f)
1381
+ # elec_equip_def.setFractionLatent(@elec_equipment_fraction_latent.to_f)
1382
+ # elec_equip_def.setFractionLost(@elec_equipment_fraction_lost.to_f)
1383
+ # end
1384
+ #
1385
+ # CSV.open("#{@script_root_folder_path}/sample_scale_plug_loads_ecm.csv", 'w') { |csv| csv << measure_values.unshift("measure_id") }
1386
+ # return log
1387
+ # end
1388
+ # def ecm_cold_deck_reset_control( model )
1389
+ # log = ""
1390
+ # measure_values = [
1391
+ # "cold_deck_reset_enabled",
1392
+ # "cold_deck_reset_max_supply_air_temp",
1393
+ # "cold_deck_reset_min_supply_air_temp",
1394
+ # ]
1395
+ # #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
1396
+ # self.set_instance_variables(measure_values)
1397
+ #
1398
+ # if @cold_deck_reset_enabled.to_bool == true
1399
+ #
1400
+ # model.getAirLoopHVACs.sort.each do |iairloop|
1401
+ # cooling_present = false
1402
+ # set_point_manager = nil
1403
+ # iairloop.components.each do |icomponent|
1404
+ # if icomponent.to_CoilCoolingDXSingleSpeed.is_initialized or
1405
+ # icomponent.to_CoilCoolingDXTwoSpeed.is_initialized or
1406
+ # icomponent.to_CoilCoolingWater.is_initialized or
1407
+ # icomponent.to_CoilCoolingCooledBeam.is_initialized or
1408
+ # icomponent.to_CoilCoolingDXMultiSpeed.is_initialized or
1409
+ # icomponent.to_CoilCoolingDXVariableRefrigerantFlow.is_initialized or
1410
+ # icomponent.to_CoilCoolingLowTempRadiantConstFlow.is_initialized or
1411
+ # icomponent.to_CoilCoolingLowTempRadiantVarFlow.is_initialized
1412
+ # cooling_present = true
1413
+ # log << "found cooling."
1414
+ # end
1415
+ # end
1416
+ # #check if setpoint manager is present at supply outlet.
1417
+ # model.getSetpointManagerSingleZoneReheats.sort.each do |manager|
1418
+ # if iairloop.supplyOutletNode == manager.setpointNode.get
1419
+ # set_point_manager = manager
1420
+ # end
1421
+ # end
1422
+ #
1423
+ # if set_point_manager.nil? and cooling_present == true
1424
+ # set_point_manager = OpenStudio::Model::SetpointManagerSingleZoneReheat.new(model)
1425
+ # set_point_manager.addToNode(iairloop.supplyOutletNode)
1426
+ # end
1427
+ #
1428
+ #
1429
+ #
1430
+ # if cooling_present == true and not set_point_manager.nil?
1431
+ # set_point_manager.setMaximumSupplyAirTemperature(@cold_deck_reset_max_supply_air_temp)
1432
+ # set_point_manager.setMinimumSupplyAirTemperature(@cold_deck_reset_min_supply_air_temp)
1433
+ # log << "to_SetpointManagerSingleZoneReheat set to 20.0 and 13.0"
1434
+ # end
1435
+ # end
1436
+ # end
1437
+ # return log
1438
+ # end
1439
+ # def ecm_sat_reset( model )
1440
+ # log = ""
1441
+ # measure_values = [
1442
+ # "sat_reset_enabled",
1443
+ # "sat_reset_outdoor_high_temperature",
1444
+ # "sat_reset_outdoor_low_temperature",
1445
+ # "sat_reset_setpoint_at_outdoor_high_temperature",
1446
+ # "sat_reset_setpoint_at_outdoor_low_temperature"
1447
+ # ]
1448
+ #
1449
+ #
1450
+ # #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
1451
+ # self.set_instance_variables(measure_values)
1452
+ # if @sat_reset_enabled.to_bool == true
1453
+ # model.getAirLoopHVACs.sort.each do |iairloop|
1454
+ #
1455
+ # #check if setpoint manager is present at supply outlet
1456
+ # model.getSetpointManagerSingleZoneReheats.sort.each do |manager|
1457
+ # if iairloop.supplyOutletNode == manager.setpointNode.get
1458
+ # manager.disconnect
1459
+ # end
1460
+ # end
1461
+ #
1462
+ # new_set_point_manager = OpenStudio::Model::SetpointManagerOutdoorAirReset.new(model)
1463
+ # new_set_point_manager.addToNode(iairloop.supplyOutletNode)
1464
+ # new_set_point_manager.setOutdoorHighTemperature(@sat_reset_outdoor_high_temperature)
1465
+ # new_set_point_manager.setOutdoorLowTemperature(@sat_reset_outdoor_low_temperature)
1466
+ # new_set_point_manager.setSetpointatOutdoorHighTemperature(@sat_reset_setpoint_at_outdoor_high_temperature)
1467
+ # new_set_point_manager.setSetpointatOutdoorLowTemperature(@sat_reset_setpoint_at_outdoor_low_temperature)
1468
+ # new_set_point_manager.setControlVariable("Temperature")
1469
+ # log << "Replaced SingleZoneReheat with OA reset control."
1470
+ # end
1471
+ # end
1472
+ # return log
1473
+ # end
1474
+ # def ecm_temp_setback( model )
1475
+ # log = ""
1476
+ # measure_values = [
1477
+ # "occ_stbck_enabled",
1478
+ # "occ_stbck_tolerance",
1479
+ # "occ_stbck_heat_setback",
1480
+ # "occ_stbck_heat_setpoint",
1481
+ # "occ_stbck_cool_setback",
1482
+ # "occ_stbck_cool_setpoint"
1483
+ # ]
1484
+ # #Set all the above instance variables to the @csv_data values or, if not set or == 'na', to nil.
1485
+ # self.set_instance_variables(measure_values)
1486
+ # # get occupancy schedule if possible.
1487
+ # unless @occ_stbck_enabled.nil? or @occ_stbck_enabled == false
1488
+ # if model.building.get.defaultScheduleSet.is_initialized and
1489
+ # model.building.get.defaultScheduleSet.get.numberofPeopleSchedule.is_initialized and
1490
+ # model.building.get.defaultScheduleSet.get.numberofPeopleSchedule.get.to_ScheduleRuleset.is_initialized
1491
+ # occupancy_schedule = model.building.get.defaultScheduleSet.get.numberofPeopleSchedule.get
1492
+ # heating_schedule,cooling_schedule = BTAP::Resources::Schedules::create_setback_schedule_based_on_another_schedule(
1493
+ # model,
1494
+ # occupancy_schedule,
1495
+ # @occ_stbck_tolerance.to_f,
1496
+ # @occ_stbck_heat_setpoint.to_f,
1497
+ # @occ_stbck_heat_setback.to_f,
1498
+ # @occ_stbck_cool_setpoint.to_f,
1499
+ # @occ_stbck_cool_setback.to_f)
1500
+ # model.getThermostatSetpointDualSetpoints.sort.each do |dual_setpoint|
1501
+ # raise ("Could not set setback heating Schedule") unless dual_setpoint.setHeatingSetpointTemperatureSchedule(heating_schedule)
1502
+ # raise ("Could not set setback cooling Schedule") unless dual_setpoint.setCoolingSetpointTemperatureSchedule(cooling_schedule)
1503
+ # log << "modified....#{dual_setpoint}"
1504
+ # end
1505
+ # end
1506
+ # else
1507
+ # log << "no change to setbacks."
1508
+ # end
1509
+ # return log
1510
+ # end
1511
+ # end
1512
+ # end
1513
+ # end
1514
+ #
1515
+ #