openstudio-calibration 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (218) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +29 -0
  3. data/CHANGELOG.md +14 -0
  4. data/Gemfile +20 -0
  5. data/Jenkinsfile +6 -0
  6. data/LICENSE.md +27 -0
  7. data/README.md +33 -0
  8. data/Rakefile +50 -0
  9. data/doc_templates/LICENSE.md +27 -0
  10. data/doc_templates/README.md.erb +42 -0
  11. data/doc_templates/copyright_erb.txt +36 -0
  12. data/doc_templates/copyright_js.txt +4 -0
  13. data/doc_templates/copyright_ruby.txt +34 -0
  14. data/lib/files/.gitkeep +0 -0
  15. data/lib/measures/AddMonthlyJSONUtilityData/LICENSE.md +27 -0
  16. data/lib/measures/AddMonthlyJSONUtilityData/README.md +96 -0
  17. data/lib/measures/AddMonthlyJSONUtilityData/README.md.erb +42 -0
  18. data/lib/measures/AddMonthlyJSONUtilityData/measure.rb +280 -0
  19. data/lib/measures/AddMonthlyJSONUtilityData/measure.xml +163 -0
  20. data/lib/measures/AddMonthlyUtilityData/LICENSE.md +27 -0
  21. data/lib/measures/AddMonthlyUtilityData/README.md +64 -0
  22. data/lib/measures/AddMonthlyUtilityData/README.md.erb +42 -0
  23. data/lib/measures/AddMonthlyUtilityData/measure.rb +312 -0
  24. data/lib/measures/AddMonthlyUtilityData/measure.xml +115 -0
  25. data/lib/measures/AddMonthlyUtilityData/tests/AddMonthlyUtilityData_Test.rb +88 -0
  26. data/lib/measures/AddMonthlyUtilityData/tests/electric_billed_usages.json +198 -0
  27. data/lib/measures/AddMonthlyUtilityData/tests/gas_billed_usages.json +198 -0
  28. data/lib/measures/CalibrationReports/LICENSE.md +27 -0
  29. data/lib/measures/CalibrationReports/README.md +26 -0
  30. data/lib/measures/CalibrationReports/README.md.erb +42 -0
  31. data/lib/measures/CalibrationReports/measure.rb +511 -0
  32. data/lib/measures/CalibrationReports/measure.xml +98 -0
  33. data/lib/measures/CalibrationReports/resources/report.html.in +379 -0
  34. data/lib/measures/CalibrationReports/tests/CalibrationReports_Test.rb +523 -0
  35. data/lib/measures/CalibrationReports/tests/ExampleModel.osm +10497 -0
  36. data/lib/measures/CalibrationReports/tests/ExampleModelNoDemandInput.osm +10560 -0
  37. data/lib/measures/CalibrationReports/tests/ExampleModelNoGasInput.osm +10456 -0
  38. data/lib/measures/CalibrationReports/tests/USA_CO_Golden-NREL.724666_TMY3.epw +8768 -0
  39. data/lib/measures/CalibrationReportsEnhanced/LICENSE.md +27 -0
  40. data/lib/measures/CalibrationReportsEnhanced/README.md +143 -0
  41. data/lib/measures/CalibrationReportsEnhanced/README.md.erb +42 -0
  42. data/lib/measures/CalibrationReportsEnhanced/measure.rb +798 -0
  43. data/lib/measures/CalibrationReportsEnhanced/measure.xml +372 -0
  44. data/lib/measures/CalibrationReportsEnhanced/resources/report.html.in +380 -0
  45. data/lib/measures/CalibrationReportsEnhanced/tests/CalibrationReportsEnhanced_Test.rb +734 -0
  46. data/lib/measures/CalibrationReportsEnhanced/tests/ExampleModel.osm +10497 -0
  47. data/lib/measures/CalibrationReportsEnhanced/tests/ExampleModel_FuelOil.osm +12740 -0
  48. data/lib/measures/CalibrationReportsEnhanced/tests/USA_CO_Golden-NREL.724666_TMY3.epw +8768 -0
  49. data/lib/measures/CalibrationReportsEnhanced21/LICENSE.md +27 -0
  50. data/lib/measures/CalibrationReportsEnhanced21/README.md +109 -0
  51. data/lib/measures/CalibrationReportsEnhanced21/README.md.erb +42 -0
  52. data/lib/measures/CalibrationReportsEnhanced21/measure.rb +690 -0
  53. data/lib/measures/CalibrationReportsEnhanced21/measure.xml +269 -0
  54. data/lib/measures/CalibrationReportsEnhanced21/resources/report.html.in +380 -0
  55. data/lib/measures/CoilCoolingDXSingleSpeedMultiplier/LICENSE.md +27 -0
  56. data/lib/measures/CoilCoolingDXSingleSpeedMultiplier/README.md +48 -0
  57. data/lib/measures/CoilCoolingDXSingleSpeedMultiplier/README.md.erb +42 -0
  58. data/lib/measures/CoilCoolingDXSingleSpeedMultiplier/measure.rb +237 -0
  59. data/lib/measures/CoilCoolingDXSingleSpeedMultiplier/measure.xml +93 -0
  60. data/lib/measures/CoilCoolingDXSingleSpeedPercentChange/LICENSE.md +27 -0
  61. data/lib/measures/CoilCoolingDXSingleSpeedPercentChange/README.md +48 -0
  62. data/lib/measures/CoilCoolingDXSingleSpeedPercentChange/README.md.erb +42 -0
  63. data/lib/measures/CoilCoolingDXSingleSpeedPercentChange/measure.rb +228 -0
  64. data/lib/measures/CoilCoolingDXSingleSpeedPercentChange/measure.xml +93 -0
  65. data/lib/measures/CoilCoolingDXTwoSpeedMultiplier/LICENSE.md +27 -0
  66. data/lib/measures/CoilCoolingDXTwoSpeedMultiplier/README.md +64 -0
  67. data/lib/measures/CoilCoolingDXTwoSpeedMultiplier/README.md.erb +42 -0
  68. data/lib/measures/CoilCoolingDXTwoSpeedMultiplier/measure.rb +280 -0
  69. data/lib/measures/CoilCoolingDXTwoSpeedMultiplier/measure.xml +111 -0
  70. data/lib/measures/CoilCoolingDXTwoSpeedPercentChange/LICENSE.md +27 -0
  71. data/lib/measures/CoilCoolingDXTwoSpeedPercentChange/README.md +64 -0
  72. data/lib/measures/CoilCoolingDXTwoSpeedPercentChange/README.md.erb +42 -0
  73. data/lib/measures/CoilCoolingDXTwoSpeedPercentChange/measure.rb +270 -0
  74. data/lib/measures/CoilCoolingDXTwoSpeedPercentChange/measure.xml +111 -0
  75. data/lib/measures/CoilCoolingWaterMultiplier/LICENSE.md +27 -0
  76. data/lib/measures/CoilCoolingWaterMultiplier/README.md +80 -0
  77. data/lib/measures/CoilCoolingWaterMultiplier/README.md.erb +42 -0
  78. data/lib/measures/CoilCoolingWaterMultiplier/measure.rb +324 -0
  79. data/lib/measures/CoilCoolingWaterMultiplier/measure.xml +129 -0
  80. data/lib/measures/CoilCoolingWaterPercentChange/LICENSE.md +27 -0
  81. data/lib/measures/CoilCoolingWaterPercentChange/README.md +80 -0
  82. data/lib/measures/CoilCoolingWaterPercentChange/README.md.erb +42 -0
  83. data/lib/measures/CoilCoolingWaterPercentChange/measure.rb +311 -0
  84. data/lib/measures/CoilCoolingWaterPercentChange/measure.xml +129 -0
  85. data/lib/measures/CoilHeatingElectricMultiplier/LICENSE.md +27 -0
  86. data/lib/measures/CoilHeatingElectricMultiplier/README.md +48 -0
  87. data/lib/measures/CoilHeatingElectricMultiplier/README.md.erb +42 -0
  88. data/lib/measures/CoilHeatingElectricMultiplier/measure.rb +240 -0
  89. data/lib/measures/CoilHeatingElectricMultiplier/measure.xml +93 -0
  90. data/lib/measures/CoilHeatingElectricPercentChange/LICENSE.md +27 -0
  91. data/lib/measures/CoilHeatingElectricPercentChange/README.md +48 -0
  92. data/lib/measures/CoilHeatingElectricPercentChange/README.md.erb +42 -0
  93. data/lib/measures/CoilHeatingElectricPercentChange/measure.rb +231 -0
  94. data/lib/measures/CoilHeatingElectricPercentChange/measure.xml +93 -0
  95. data/lib/measures/CoilHeatingGasMultiplier/LICENSE.md +27 -0
  96. data/lib/measures/CoilHeatingGasMultiplier/README.md +64 -0
  97. data/lib/measures/CoilHeatingGasMultiplier/README.md.erb +42 -0
  98. data/lib/measures/CoilHeatingGasMultiplier/measure.rb +282 -0
  99. data/lib/measures/CoilHeatingGasMultiplier/measure.xml +111 -0
  100. data/lib/measures/CoilHeatingGasPercentChange/LICENSE.md +27 -0
  101. data/lib/measures/CoilHeatingGasPercentChange/README.md +64 -0
  102. data/lib/measures/CoilHeatingGasPercentChange/README.md.erb +42 -0
  103. data/lib/measures/CoilHeatingGasPercentChange/measure.rb +271 -0
  104. data/lib/measures/CoilHeatingGasPercentChange/measure.xml +111 -0
  105. data/lib/measures/CoilHeatingWaterMultiplier/LICENSE.md +27 -0
  106. data/lib/measures/CoilHeatingWaterMultiplier/README.md +48 -0
  107. data/lib/measures/CoilHeatingWaterMultiplier/README.md.erb +42 -0
  108. data/lib/measures/CoilHeatingWaterMultiplier/measure.rb +235 -0
  109. data/lib/measures/CoilHeatingWaterMultiplier/measure.xml +93 -0
  110. data/lib/measures/CoilHeatingWaterPercentChange/LICENSE.md +27 -0
  111. data/lib/measures/CoilHeatingWaterPercentChange/README.md +48 -0
  112. data/lib/measures/CoilHeatingWaterPercentChange/README.md.erb +42 -0
  113. data/lib/measures/CoilHeatingWaterPercentChange/measure.rb +226 -0
  114. data/lib/measures/CoilHeatingWaterPercentChange/measure.xml +93 -0
  115. data/lib/measures/ConstructionLayerZeroMaterialProperties/LICENSE.md +27 -0
  116. data/lib/measures/ConstructionLayerZeroMaterialProperties/README.md +88 -0
  117. data/lib/measures/ConstructionLayerZeroMaterialProperties/README.md.erb +42 -0
  118. data/lib/measures/ConstructionLayerZeroMaterialProperties/measure.rb +221 -0
  119. data/lib/measures/ConstructionLayerZeroMaterialProperties/measure.xml +194 -0
  120. data/lib/measures/ElectricBaseboardEfficiencyAndCapacity/LICENSE.md +27 -0
  121. data/lib/measures/ElectricBaseboardEfficiencyAndCapacity/README.md +40 -0
  122. data/lib/measures/ElectricBaseboardEfficiencyAndCapacity/README.md.erb +42 -0
  123. data/lib/measures/ElectricBaseboardEfficiencyAndCapacity/measure.rb +102 -0
  124. data/lib/measures/ElectricBaseboardEfficiencyAndCapacity/measure.xml +78 -0
  125. data/lib/measures/ExteriorWallThermalPropertiesMultiplier/LICENSE.md +27 -0
  126. data/lib/measures/ExteriorWallThermalPropertiesMultiplier/README.md +48 -0
  127. data/lib/measures/ExteriorWallThermalPropertiesMultiplier/README.md.erb +42 -0
  128. data/lib/measures/ExteriorWallThermalPropertiesMultiplier/measure.rb +263 -0
  129. data/lib/measures/ExteriorWallThermalPropertiesMultiplier/measure.xml +97 -0
  130. data/lib/measures/ExteriorWallThermalPropertiesPercentChange/LICENSE.md +27 -0
  131. data/lib/measures/ExteriorWallThermalPropertiesPercentChange/README.md +48 -0
  132. data/lib/measures/ExteriorWallThermalPropertiesPercentChange/README.md.erb +42 -0
  133. data/lib/measures/ExteriorWallThermalPropertiesPercentChange/measure.rb +253 -0
  134. data/lib/measures/ExteriorWallThermalPropertiesPercentChange/measure.xml +97 -0
  135. data/lib/measures/FansMultiplier/LICENSE.md +27 -0
  136. data/lib/measures/FansMultiplier/README.md +64 -0
  137. data/lib/measures/FansMultiplier/README.md.erb +42 -0
  138. data/lib/measures/FansMultiplier/measure.rb +297 -0
  139. data/lib/measures/FansMultiplier/measure.xml +166 -0
  140. data/lib/measures/FansPercentChange/LICENSE.md +27 -0
  141. data/lib/measures/FansPercentChange/README.md +64 -0
  142. data/lib/measures/FansPercentChange/README.md.erb +42 -0
  143. data/lib/measures/FansPercentChange/measure.rb +286 -0
  144. data/lib/measures/FansPercentChange/measure.xml +166 -0
  145. data/lib/measures/GeneralCalibrationMeasureMultiplier/LICENSE.md +27 -0
  146. data/lib/measures/GeneralCalibrationMeasureMultiplier/README.md +112 -0
  147. data/lib/measures/GeneralCalibrationMeasureMultiplier/README.md.erb +42 -0
  148. data/lib/measures/GeneralCalibrationMeasureMultiplier/measure.rb +639 -0
  149. data/lib/measures/GeneralCalibrationMeasureMultiplier/measure.xml +229 -0
  150. data/lib/measures/GeneralCalibrationMeasurePercentChange/LICENSE.md +27 -0
  151. data/lib/measures/GeneralCalibrationMeasurePercentChange/README.md +112 -0
  152. data/lib/measures/GeneralCalibrationMeasurePercentChange/README.md.erb +42 -0
  153. data/lib/measures/GeneralCalibrationMeasurePercentChange/measure.rb +756 -0
  154. data/lib/measures/GeneralCalibrationMeasurePercentChange/measure.xml +229 -0
  155. data/lib/measures/HardSizeHvac/LICENSE.md +27 -0
  156. data/lib/measures/HardSizeHvac/README.md +26 -0
  157. data/lib/measures/HardSizeHvac/README.md.erb +42 -0
  158. data/lib/measures/HardSizeHvac/measure.rb +88 -0
  159. data/lib/measures/HardSizeHvac/measure.xml +81 -0
  160. data/lib/measures/MaalkaMonthlyJSONUtilityData/LICENSE.md +27 -0
  161. data/lib/measures/MaalkaMonthlyJSONUtilityData/README.md +104 -0
  162. data/lib/measures/MaalkaMonthlyJSONUtilityData/README.md.erb +42 -0
  163. data/lib/measures/MaalkaMonthlyJSONUtilityData/measure.rb +304 -0
  164. data/lib/measures/MaalkaMonthlyJSONUtilityData/measure.xml +216 -0
  165. data/lib/measures/RValueOfInsulationForConstructionMultiplier/LICENSE.md +27 -0
  166. data/lib/measures/RValueOfInsulationForConstructionMultiplier/README.md +40 -0
  167. data/lib/measures/RValueOfInsulationForConstructionMultiplier/README.md.erb +42 -0
  168. data/lib/measures/RValueOfInsulationForConstructionMultiplier/measure.rb +196 -0
  169. data/lib/measures/RValueOfInsulationForConstructionMultiplier/measure.xml +132 -0
  170. data/lib/measures/RValueOfInsulationForConstructionPercentageChange/LICENSE.md +27 -0
  171. data/lib/measures/RValueOfInsulationForConstructionPercentageChange/README.md +40 -0
  172. data/lib/measures/RValueOfInsulationForConstructionPercentageChange/README.md.erb +42 -0
  173. data/lib/measures/RValueOfInsulationForConstructionPercentageChange/measure.rb +189 -0
  174. data/lib/measures/RValueOfInsulationForConstructionPercentageChange/measure.xml +132 -0
  175. data/lib/measures/RoofThermalPropertiesMultiplier/LICENSE.md +27 -0
  176. data/lib/measures/RoofThermalPropertiesMultiplier/README.md +48 -0
  177. data/lib/measures/RoofThermalPropertiesMultiplier/README.md.erb +42 -0
  178. data/lib/measures/RoofThermalPropertiesMultiplier/measure.rb +263 -0
  179. data/lib/measures/RoofThermalPropertiesMultiplier/measure.xml +97 -0
  180. data/lib/measures/RoofThermalPropertiesPercentChange/LICENSE.md +27 -0
  181. data/lib/measures/RoofThermalPropertiesPercentChange/README.md +48 -0
  182. data/lib/measures/RoofThermalPropertiesPercentChange/README.md.erb +42 -0
  183. data/lib/measures/RoofThermalPropertiesPercentChange/measure.rb +253 -0
  184. data/lib/measures/RoofThermalPropertiesPercentChange/measure.xml +97 -0
  185. data/lib/measures/TimeseriesObjectiveFunction/LICENSE.md +27 -0
  186. data/lib/measures/TimeseriesObjectiveFunction/README.md +207 -0
  187. data/lib/measures/TimeseriesObjectiveFunction/README.md.erb +42 -0
  188. data/lib/measures/TimeseriesObjectiveFunction/measure.rb +748 -0
  189. data/lib/measures/TimeseriesObjectiveFunction/measure.xml +435 -0
  190. data/lib/measures/TimeseriesObjectiveFunction/resources/report.html.erb +288 -0
  191. data/lib/measures/TimeseriesPlot/LICENSE.md +27 -0
  192. data/lib/measures/TimeseriesPlot/README.md +56 -0
  193. data/lib/measures/TimeseriesPlot/README.md.erb +42 -0
  194. data/lib/measures/TimeseriesPlot/measure.rb +302 -0
  195. data/lib/measures/TimeseriesPlot/measure.xml +137 -0
  196. data/lib/measures/TimeseriesPlot/resources/report.html.erb +270 -0
  197. data/lib/measures/WaterHeaterMixedMultiplier/LICENSE.md +27 -0
  198. data/lib/measures/WaterHeaterMixedMultiplier/README.md +64 -0
  199. data/lib/measures/WaterHeaterMixedMultiplier/README.md.erb +42 -0
  200. data/lib/measures/WaterHeaterMixedMultiplier/measure.rb +255 -0
  201. data/lib/measures/WaterHeaterMixedMultiplier/measure.xml +180 -0
  202. data/lib/measures/WaterHeaterMixedPercentChange/LICENSE.md +27 -0
  203. data/lib/measures/WaterHeaterMixedPercentChange/README.md +64 -0
  204. data/lib/measures/WaterHeaterMixedPercentChange/README.md.erb +42 -0
  205. data/lib/measures/WaterHeaterMixedPercentChange/measure.rb +245 -0
  206. data/lib/measures/WaterHeaterMixedPercentChange/measure.xml +180 -0
  207. data/lib/measures/zone_report/LICENSE.md +27 -0
  208. data/lib/measures/zone_report/README.md +26 -0
  209. data/lib/measures/zone_report/README.md.erb +42 -0
  210. data/lib/measures/zone_report/measure.rb +706 -0
  211. data/lib/measures/zone_report/measure.xml +67 -0
  212. data/lib/measures/zone_report/resources/report.html.in +342 -0
  213. data/lib/openstudio-calibration-measures.rb +36 -0
  214. data/lib/openstudio/calibration_measures.rb +37 -0
  215. data/lib/openstudio/calibration_measures/extension.rb +49 -0
  216. data/lib/openstudio/calibration_measures/version.rb +40 -0
  217. data/openstudio-calibration.gemspec +30 -0
  218. metadata +331 -0
@@ -0,0 +1,27 @@
1
+ OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC. All rights reserved.
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted
4
+ provided that the following conditions are met:
5
+
6
+ (1) Redistributions of source code must retain the above copyright notice, this list of conditions
7
+ and the following disclaimer.
8
+
9
+ (2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions
10
+ and the following disclaimer in the documentation and/or other materials provided with the distribution.
11
+
12
+ (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse
13
+ or promote products derived from this software without specific prior written permission from the
14
+ respective party.
15
+
16
+ (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other
17
+ derivative works may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar
18
+ designation without specific prior written permission from Alliance for Sustainable Energy, LLC.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
21
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES GOVERNMENT,
23
+ OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
25
+ OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,26 @@
1
+
2
+
3
+ ###### (Automatically generated documentation)
4
+
5
+ # Calibration Reports
6
+
7
+ ## Description
8
+
9
+
10
+ ## Modeler Description
11
+
12
+
13
+ ## Measure Type
14
+ ReportingMeasure
15
+
16
+ ## Taxonomy
17
+
18
+
19
+ ## Arguments
20
+
21
+
22
+
23
+
24
+ This measure does not have any user arguments
25
+
26
+
@@ -0,0 +1,42 @@
1
+ <%#= README.md.erb is used to auto-generate README.md. %>
2
+ <%#= To manually maintain README.md throw away README.md.erb and manually edit README.md %>
3
+ ###### (Automatically generated documentation)
4
+
5
+ # <%= name %>
6
+
7
+ ## Description
8
+ <%= description %>
9
+
10
+ ## Modeler Description
11
+ <%= modelerDescription %>
12
+
13
+ ## Measure Type
14
+ <%= measureType %>
15
+
16
+ ## Taxonomy
17
+ <%= taxonomy %>
18
+
19
+ ## Arguments
20
+
21
+ <% arguments.each do |argument| %>
22
+ ### <%= argument[:display_name] %>
23
+ <%= argument[:description] %>
24
+ **Name:** <%= argument[:name] %>,
25
+ **Type:** <%= argument[:type] %>,
26
+ **Units:** <%= argument[:units] %>,
27
+ **Required:** <%= argument[:required] %>,
28
+ **Model Dependent:** <%= argument[:model_dependent] %>
29
+ <% end %>
30
+
31
+ <% if arguments.size == 0 %>
32
+ <%= "This measure does not have any user arguments" %>
33
+ <% end %>
34
+
35
+ <% if outputs.size > 0 %>
36
+ ## Outputs
37
+ <% output_names = [] %>
38
+ <% outputs.each do |output| %>
39
+ <% output_names << output[:display_name] %>
40
+ <% end %>
41
+ <%= output_names.join(", ") %>
42
+ <% end %>
@@ -0,0 +1,511 @@
1
+ # *******************************************************************************
2
+ # OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
3
+ # All rights reserved.
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are met:
6
+ #
7
+ # (1) Redistributions of source code must retain the above copyright notice,
8
+ # this list of conditions and the following disclaimer.
9
+ #
10
+ # (2) Redistributions in binary form must reproduce the above copyright notice,
11
+ # this list of conditions and the following disclaimer in the documentation
12
+ # and/or other materials provided with the distribution.
13
+ #
14
+ # (3) Neither the name of the copyright holder nor the names of any contributors
15
+ # may be used to endorse or promote products derived from this software without
16
+ # specific prior written permission from the respective party.
17
+ #
18
+ # (4) Other than as required in clauses (1) and (2), distributions in any form
19
+ # of modifications or other derivative works may not use the "OpenStudio"
20
+ # trademark, "OS", "os", or any other confusingly similar designation without
21
+ # specific prior written permission from Alliance for Sustainable Energy, LLC.
22
+ #
23
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS
24
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
25
+ # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE
27
+ # UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF
28
+ # THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
30
+ # OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
32
+ # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33
+ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+ # *******************************************************************************
35
+
36
+ require 'erb'
37
+
38
+ # start the measure
39
+ class CalibrationReports < OpenStudio::Measure::ReportingMeasure
40
+ # define the name that a user will see, this method may be deprecated as
41
+ # the display name in PAT comes from the name field in measure.xml
42
+ def name
43
+ 'Calibration Reports'
44
+ end
45
+
46
+ # define the arguments that the user will input
47
+ def arguments
48
+ args = OpenStudio::Measure::OSArgumentVector.new
49
+
50
+ args
51
+ end
52
+
53
+ # define what happens when the measure is run
54
+ def run(runner, user_arguments)
55
+ super(runner, user_arguments)
56
+
57
+ # use the built-in error checking
58
+ return false unless runner.validateUserArguments(arguments, user_arguments)
59
+
60
+ os_version = OpenStudio::VersionString.new(OpenStudio.openStudioVersion)
61
+ min_version_feature1 = OpenStudio::VersionString.new('1.2.2')
62
+
63
+ # get the last model and sql file
64
+
65
+ model = runner.lastOpenStudioModel
66
+ if model.empty?
67
+ runner.registerError('Cannot find last model.')
68
+ return false
69
+ end
70
+ model = model.get
71
+
72
+ sqlFile = runner.lastEnergyPlusSqlFile
73
+ if sqlFile.empty?
74
+ runner.registerError('Cannot find last sql file.')
75
+ return false
76
+ end
77
+ sqlFile = sqlFile.get
78
+ model.setSqlFile(sqlFile)
79
+
80
+ # put data into variables, these are available in the local scope binding
81
+ # building_name = model.getBuilding.name.get
82
+
83
+ web_asset_path = OpenStudio.getSharedResourcesPath / OpenStudio::Path.new('web_assets')
84
+
85
+ energy = ''
86
+
87
+ calibrationGuidelines = OpenStudio::Model::UtilityBill.calibrationGuidelines
88
+ energy << 'var calibrationGuidelines = ['
89
+ calibrationGuidelines.each do |calibrationGuideline|
90
+ energy << '"' << calibrationGuideline << '",'
91
+ end
92
+ energy = energy[0..-2]
93
+ energy << "];\n"
94
+
95
+ maxNMBE = OpenStudio::Model::UtilityBill.maxNMBE(calibrationGuidelines[0])
96
+ energy << 'var ashraeMaxNMBE = '
97
+ energy << if !maxNMBE.empty?
98
+ maxNMBE.get.to_s
99
+ else
100
+ 'N/A'
101
+ end
102
+ energy << ";\n"
103
+ if os_version >= min_version_feature1
104
+ runner.registerValue('ashrae_max_nmbe', maxNMBE.get, '%')
105
+ end
106
+
107
+ maxCVRMSE = OpenStudio::Model::UtilityBill.maxCVRMSE(calibrationGuidelines[0])
108
+ energy << 'var ashraeMaxCVRMSE = '
109
+ energy << if !maxCVRMSE.empty?
110
+ maxCVRMSE.get.to_s
111
+ else
112
+ 'N/A'
113
+ end
114
+ energy << ";\n"
115
+ if os_version >= min_version_feature1
116
+ runner.registerValue('ashrae_max_cvrmse', maxCVRMSE.get, '%')
117
+ end
118
+
119
+ maxNMBE = OpenStudio::Model::UtilityBill.maxNMBE(calibrationGuidelines[1])
120
+ energy << 'var fempMaxNMBE = '
121
+ energy << if !maxNMBE.empty?
122
+ maxNMBE.get.to_s
123
+ else
124
+ 'N/A'
125
+ end
126
+ energy << ";\n"
127
+ if os_version >= min_version_feature1
128
+ runner.registerValue('femp_max_nmbe', maxNMBE.get, '%')
129
+ end
130
+
131
+ maxCVRMSE = OpenStudio::Model::UtilityBill.maxCVRMSE(calibrationGuidelines[1])
132
+ energy << 'var fempMaxCVRMSE = '
133
+ energy << if !maxCVRMSE.empty?
134
+ maxCVRMSE.get.to_s
135
+ else
136
+ 'N/A'
137
+ end
138
+ energy << ";\n"
139
+ if os_version >= min_version_feature1
140
+ runner.registerValue('femp_max_cvrmse', maxCVRMSE.get, '%')
141
+ end
142
+
143
+ energyElec = "\t\"Electricity Consumption\":{\n\t\t\"units\":\"kWh\",\n"
144
+ energyDemand = "\t\"Electricity Demand\":{\n\t\t\"units\":\"kW\",\n"
145
+ energyGas = "\t\"Natural Gas Consumption\":{\n\t\t\"units\":\"therms\",\n"
146
+ tempStartDate = ''
147
+ tempEndDate = ''
148
+ elecStartDate = "\t\t\t\t\"Start\":["
149
+ elecEndDate = "\t\t\t\t\"End\":["
150
+ gasStartDate = "\t\t\t\t\"Start\":["
151
+ gasEndDate = "\t\t\t\t\"End\":["
152
+ elecActualConsumption = "\t\t\t\t\"Actual\":["
153
+ elecModelConsumption = "\t\t\t\t\"Model\":["
154
+ actualPeakDemand = "\t\t\t\t\"Actual\":["
155
+ modelPeakDemand = "\t\t\t\t\"Model\":["
156
+ gasActualConsumption = "\t\t\t\t\"Actual\":["
157
+ gasModelConsumption = "\t\t\t\t\"Model\":["
158
+ elecNMBE = "\t\t\t\t\"NMBE\":["
159
+ demandNMBE = "\t\t\t\t\"NMBE\":["
160
+ gasNMBE = "\t\t\t\t\"NMBE\":["
161
+ peakDemandUnitConversionFactor = 1.0
162
+ consumptionUnitConversionFactor = 1.0
163
+ hasElec = false
164
+ hasDemand = false
165
+ hasGas = false
166
+
167
+ missingData = false
168
+ # must have a runPeriod
169
+ runPeriod = model.runPeriod
170
+ if runPeriod.empty?
171
+ missingData = true
172
+ runner.registerWarning('Model has no run period and cannot generate all data.')
173
+ end
174
+
175
+ # must have a calendarYear to generate model data
176
+ yearDescription = model.yearDescription
177
+ if yearDescription.empty?
178
+ missingData = true
179
+ runner.registerWarning('Model has no year description and cannot generate all data.')
180
+ else
181
+ calendarYear = yearDescription.get.calendarYear
182
+ if calendarYear.empty?
183
+ missingData = true
184
+ runner.registerWarning('Model has no calendar year and cannot generate all data.')
185
+ end
186
+ end
187
+
188
+ bill_index = 1
189
+ model.getUtilityBills.each do |utilityBill|
190
+ if os_version >= min_version_feature1
191
+ runner.registerValue("utility_bill_#{bill_index}_name", utilityBill.name.get)
192
+ runner.registerValue("utility_bill_#{bill_index}_fuel_type", utilityBill.fuelType.valueDescription)
193
+ end
194
+
195
+ cvrsme = 0.0
196
+ unless utilityBill.CVRMSE.empty?
197
+ cvrsme = utilityBill.CVRMSE.get
198
+ if os_version >= min_version_feature1
199
+ runner.registerValue("utility_bill_#{bill_index}_consumption_cvrmse", cvrsme, '%')
200
+ end
201
+ cvrsme = format '%.2f', cvrsme
202
+ end
203
+
204
+ nmbe = 0.0
205
+ unless utilityBill.NMBE.empty?
206
+ nmbe = utilityBill.NMBE.get
207
+ if os_version >= min_version_feature1
208
+ runner.registerValue("utility_bill_#{bill_index}_consumption_nmbe", nmbe, '%')
209
+ end
210
+ nmbe = format '%.2f', nmbe
211
+ end
212
+
213
+ string = ''
214
+ string << "\t\t\"cvrsme\":\"" << cvrsme.to_s << "\",\n\t\t\"nmbe\":\"" << nmbe.to_s << "\",\n\t\t\t\"data\":{\n"
215
+
216
+ hasDemandValues = false
217
+ if !utilityBill.peakDemandUnitConversionFactor.empty?
218
+ hasDemandValues = true
219
+ energyElec << string
220
+ energyDemand << string
221
+ peakDemandUnitConversionFactor = utilityBill.peakDemandUnitConversionFactor.get
222
+ else
223
+ hasDemandValues = false
224
+ energyGas << string
225
+ end
226
+
227
+ consumptionUnitConversionFactor = utilityBill.consumptionUnitConversionFactor
228
+
229
+ period_index = 1
230
+ actual_consumption = 0.0
231
+ modeled_consumption = 0.0
232
+ actual_demand = 0.0
233
+ modeled_demand = 0.0
234
+
235
+ utilityBill.billingPeriods.each do |billingPeriod|
236
+ tempStartDate = '"' << billingPeriod.startDate.monthOfYear.value.to_s
237
+ tempStartDate << '/'
238
+ tempStartDate << billingPeriod.startDate.dayOfMonth.to_s << '"'
239
+ tempEndDate = '"' << billingPeriod.endDate.monthOfYear.value.to_s
240
+ tempEndDate << '/'
241
+ tempEndDate << billingPeriod.endDate.dayOfMonth.to_s << '"'
242
+ if os_version >= min_version_feature1
243
+ runner.registerValue("utility_bill_#{bill_index}_period_#{period_index}_start_date", billingPeriod.startDate.to_s)
244
+ runner.registerValue("utility_bill_#{bill_index}_period_#{period_index}_end_date", billingPeriod.endDate.to_s)
245
+ end
246
+
247
+ if hasDemandValues
248
+ elecStartDate << tempStartDate << ','
249
+ elecEndDate << tempEndDate << ','
250
+
251
+ consumption = billingPeriod.consumption
252
+ if !consumption.empty?
253
+ hasElec = true
254
+ elecActualConsumption << consumption.get.to_s
255
+ actual_consumption += consumption.get
256
+ if os_version >= min_version_feature1
257
+ runner.registerValue("utility_bill_#{bill_index}_period_#{period_index}_consumption_actual",
258
+ consumption.get,
259
+ utilityBill.consumptionUnit)
260
+ end
261
+ else
262
+ elecActualConsumption << '0'
263
+ end
264
+ elecActualConsumption << ','
265
+
266
+ consumption = billingPeriod.modelConsumption
267
+ if !consumption.empty?
268
+ hasElec = true
269
+ temp = consumption.get / consumptionUnitConversionFactor
270
+ elecModelConsumption << temp.round.to_s
271
+ modeled_consumption += temp
272
+ if os_version >= min_version_feature1
273
+ runner.registerValue("utility_bill_#{bill_index}_period_#{period_index}_consumption_modeled",
274
+ temp,
275
+ utilityBill.consumptionUnit)
276
+ end
277
+ else
278
+ elecModelConsumption << '0'
279
+ end
280
+ elecModelConsumption << ','
281
+
282
+ peakDemand = billingPeriod.peakDemand
283
+ if !peakDemand.empty?
284
+ hasDemand = true
285
+ actualPeakDemand << peakDemand.get.to_s
286
+ actual_demand = peakDemand.get if peakDemand.get > actual_demand
287
+ if os_version >= min_version_feature1
288
+ runner.registerValue("utility_bill_#{bill_index}_period_#{period_index}_peak_demand_actual",
289
+ peakDemand.get,
290
+ utilityBill.peakDemandUnit.get)
291
+ end
292
+ else
293
+ actualPeakDemand << '0'
294
+ end
295
+ actualPeakDemand << ','
296
+
297
+ peakDemand = billingPeriod.modelPeakDemand
298
+ if !peakDemand.empty?
299
+ hasDemand = true
300
+ temp = peakDemand.get / 1000
301
+ temp_str = format '%.1f', temp
302
+ modelPeakDemand << temp_str.to_s
303
+ modeled_demand = temp if temp > modeled_demand
304
+ if os_version >= min_version_feature1
305
+ runner.registerValue("utility_bill_#{bill_index}_period_#{period_index}_peak_demand_modeled",
306
+ temp,
307
+ utilityBill.peakDemandUnit.get)
308
+ end
309
+ else
310
+ modelPeakDemand << '0'
311
+ end
312
+ modelPeakDemand << ','
313
+
314
+ if !billingPeriod.peakDemand.empty? && !billingPeriod.modelPeakDemand.empty? && (billingPeriod.peakDemand.get != 0)
315
+ percent = 100 * ((billingPeriod.modelPeakDemand.get / 1000) - billingPeriod.peakDemand.get) / billingPeriod.peakDemand.get
316
+ percent_str = format '%.2f', percent
317
+ demandNMBE << percent_str.to_s
318
+ if os_version >= min_version_feature1
319
+ runner.registerValue("utility_bill_#{bill_index}_period_#{period_index}_peak_demand_nmbe",
320
+ percent,
321
+ '%')
322
+ end
323
+ else
324
+ demandNMBE << '0'
325
+ end
326
+ demandNMBE << ','
327
+
328
+ if !billingPeriod.consumption.empty? && !billingPeriod.modelConsumption.empty? && (billingPeriod.consumption.get != 0)
329
+ percent = 100 * ((billingPeriod.modelConsumption.get / consumptionUnitConversionFactor) - billingPeriod.consumption.get) / billingPeriod.consumption.get
330
+ percent_str = format '%.2f', percent
331
+ elecNMBE << percent_str.to_s
332
+ if os_version >= min_version_feature1
333
+ runner.registerValue("utility_bill_#{bill_index}_period_#{period_index}_consumption_nmbe",
334
+ percent,
335
+ '%')
336
+ end
337
+ else
338
+ elecNMBE << '0'
339
+ end
340
+ elecNMBE << ','
341
+
342
+ else
343
+ gasStartDate << tempStartDate << ','
344
+ gasEndDate << tempEndDate << ','
345
+
346
+ consumption = billingPeriod.consumption
347
+ if !consumption.empty?
348
+ hasGas = true
349
+ gasActualConsumption << consumption.get.to_s
350
+ actual_consumption += consumption.get
351
+ if os_version >= min_version_feature1
352
+ runner.registerValue("utility_bill_#{bill_index}_period_#{period_index}_consumption_actual",
353
+ consumption.get,
354
+ utilityBill.consumptionUnit)
355
+ end
356
+ else
357
+ gasActualConsumption << '0'
358
+ end
359
+ gasActualConsumption << ','
360
+
361
+ consumption = billingPeriod.modelConsumption
362
+ if !consumption.empty?
363
+ hasGas = true
364
+ temp = consumption.get / consumptionUnitConversionFactor
365
+ gasModelConsumption << temp.round.to_s
366
+ modeled_consumption += temp
367
+ if os_version >= min_version_feature1
368
+ runner.registerValue("utility_bill_#{bill_index}_period_#{period_index}_consumption_modeled",
369
+ temp,
370
+ utilityBill.consumptionUnit)
371
+ end
372
+ else
373
+ gasModelConsumption << '0'
374
+ end
375
+ gasModelConsumption << ','
376
+
377
+ if !billingPeriod.consumption.empty? && !billingPeriod.modelConsumption.empty? && (billingPeriod.consumption.get != 0)
378
+ percent = 100 * ((billingPeriod.modelConsumption.get / consumptionUnitConversionFactor) - billingPeriod.consumption.get) / billingPeriod.consumption.get
379
+ percent_str = format '%.2f', percent
380
+ gasNMBE << percent_str.to_s
381
+ if os_version >= min_version_feature1
382
+ runner.registerValue("utility_bill_#{bill_index}_period_#{period_index}_consumption_nmbe",
383
+ percent,
384
+ '%')
385
+ end
386
+ else
387
+ gasNMBE << '0'
388
+ end
389
+ gasNMBE << ','
390
+
391
+ end
392
+ period_index += 1
393
+ end
394
+
395
+ if os_version >= min_version_feature1
396
+ if actual_consumption > 0.0
397
+ runner.registerValue("utility_bill_#{bill_index}_consumption_actual",
398
+ actual_consumption,
399
+ utilityBill.consumptionUnit)
400
+ runner.registerValue("utility_bill_#{bill_index}_consumption_modeled",
401
+ modeled_consumption,
402
+ utilityBill.consumptionUnit)
403
+ end
404
+ if actual_demand > 0.0
405
+ runner.registerValue("utility_bill_#{bill_index}_peak_demand_actual",
406
+ actual_demand,
407
+ utilityBill.peakDemandUnit.get)
408
+ runner.registerValue("utility_bill_#{bill_index}_peak_demand_modeled",
409
+ modeled_demand,
410
+ utilityBill.peakDemandUnit.get)
411
+ runner.registerValue("utility_bill_#{bill_index}_peak_demand_nmbe",
412
+ 100.0 * (modeled_demand - actual_demand) / actual_demand,
413
+ '%')
414
+ end
415
+ end
416
+
417
+ bill_index += 1
418
+ end
419
+
420
+ elecStartDate = elecStartDate[0..-2]
421
+ elecStartDate << "],\n"
422
+ elecEndDate = elecEndDate[0..-2]
423
+ elecEndDate << "],\n"
424
+ elecActualConsumption = elecActualConsumption[0..-2]
425
+ elecActualConsumption << "],\n"
426
+ elecModelConsumption = elecModelConsumption[0..-2]
427
+ elecModelConsumption << "],\n"
428
+ actualPeakDemand = actualPeakDemand[0..-2]
429
+ actualPeakDemand << "],\n"
430
+ modelPeakDemand = modelPeakDemand[0..-2]
431
+ modelPeakDemand << "],\n"
432
+ elecNMBE = elecNMBE[0..-2]
433
+ elecNMBE << "]\n"
434
+ demandNMBE = demandNMBE[0..-2]
435
+ demandNMBE << "]\n"
436
+ energyElec << elecStartDate << elecEndDate << elecActualConsumption << elecModelConsumption << elecNMBE
437
+ energyElec << "\t\t}\n" << "\t},\n"
438
+
439
+ energyDemand << elecStartDate << elecEndDate << actualPeakDemand << modelPeakDemand << demandNMBE
440
+ energyDemand << "\t\t}\n" << "\t},\n"
441
+
442
+ gasStartDate = gasStartDate[0..-2]
443
+ gasStartDate << "],\n"
444
+ gasEndDate = gasEndDate[0..-2]
445
+ gasEndDate << "],\n"
446
+ gasActualConsumption = gasActualConsumption[0..-2]
447
+ gasActualConsumption << "],\n"
448
+ gasModelConsumption = gasModelConsumption[0..-2]
449
+ gasModelConsumption << "],\n"
450
+ gasNMBE = gasNMBE[0..-2]
451
+ gasNMBE << "]\n"
452
+ energyGas << gasStartDate << gasEndDate << gasActualConsumption << gasModelConsumption << gasNMBE
453
+ energyGas << "\t\t}\n" << "\t},\n"
454
+
455
+ energy << "var consumption = {\n"
456
+
457
+ energy << energyElec if hasElec
458
+
459
+ energy << energyDemand if hasDemand
460
+
461
+ energy << energyGas if hasGas
462
+
463
+ energy << '};'
464
+
465
+ # echo out our values
466
+ # runner.registerInfo("This building is named #{building_name}.")
467
+
468
+ # read in template
469
+ html_in_path = "#{File.dirname(__FILE__)}/resources/report.html.in"
470
+ html_in_path = if File.exist?(html_in_path)
471
+ html_in_path
472
+ else
473
+ "#{File.dirname(__FILE__)}/report.html.in"
474
+ end
475
+ html_in = ''
476
+ File.open(html_in_path, 'r') do |file|
477
+ html_in = file.read
478
+ end
479
+
480
+ # configure template with variable values
481
+ renderer = ERB.new(html_in)
482
+ html_out = renderer.result(binding)
483
+
484
+ # write html file
485
+ html_out_path = './report.html'
486
+ File.open(html_out_path, 'w') do |file|
487
+ file << html_out
488
+ # make sure data is written to the disk one way or the other
489
+ begin
490
+ file.fsync
491
+ rescue StandardError
492
+ file.flush
493
+ end
494
+ end
495
+
496
+ # closing the sql file
497
+ sqlFile.close
498
+
499
+ # reporting final condition
500
+ if missingData == true
501
+ runner.registerFinalCondition('Calibration Report was not generated successfully.')
502
+ else
503
+ runner.registerFinalCondition('Calibration Report generated successfully.')
504
+ end
505
+
506
+ true
507
+ end
508
+ end
509
+
510
+ # this allows the measure to be use by the application
511
+ CalibrationReports.new.registerWithApplication