openstudio-calibration 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +29 -0
- data/CHANGELOG.md +14 -0
- data/Gemfile +20 -0
- data/Jenkinsfile +6 -0
- data/LICENSE.md +27 -0
- data/README.md +33 -0
- data/Rakefile +50 -0
- data/doc_templates/LICENSE.md +27 -0
- data/doc_templates/README.md.erb +42 -0
- data/doc_templates/copyright_erb.txt +36 -0
- data/doc_templates/copyright_js.txt +4 -0
- data/doc_templates/copyright_ruby.txt +34 -0
- data/lib/files/.gitkeep +0 -0
- data/lib/measures/AddMonthlyJSONUtilityData/LICENSE.md +27 -0
- data/lib/measures/AddMonthlyJSONUtilityData/README.md +96 -0
- data/lib/measures/AddMonthlyJSONUtilityData/README.md.erb +42 -0
- data/lib/measures/AddMonthlyJSONUtilityData/measure.rb +280 -0
- data/lib/measures/AddMonthlyJSONUtilityData/measure.xml +163 -0
- data/lib/measures/AddMonthlyUtilityData/LICENSE.md +27 -0
- data/lib/measures/AddMonthlyUtilityData/README.md +64 -0
- data/lib/measures/AddMonthlyUtilityData/README.md.erb +42 -0
- data/lib/measures/AddMonthlyUtilityData/measure.rb +312 -0
- data/lib/measures/AddMonthlyUtilityData/measure.xml +115 -0
- data/lib/measures/AddMonthlyUtilityData/tests/AddMonthlyUtilityData_Test.rb +88 -0
- data/lib/measures/AddMonthlyUtilityData/tests/electric_billed_usages.json +198 -0
- data/lib/measures/AddMonthlyUtilityData/tests/gas_billed_usages.json +198 -0
- data/lib/measures/CalibrationReports/LICENSE.md +27 -0
- data/lib/measures/CalibrationReports/README.md +26 -0
- data/lib/measures/CalibrationReports/README.md.erb +42 -0
- data/lib/measures/CalibrationReports/measure.rb +511 -0
- data/lib/measures/CalibrationReports/measure.xml +98 -0
- data/lib/measures/CalibrationReports/resources/report.html.in +379 -0
- data/lib/measures/CalibrationReports/tests/CalibrationReports_Test.rb +523 -0
- data/lib/measures/CalibrationReports/tests/ExampleModel.osm +10497 -0
- data/lib/measures/CalibrationReports/tests/ExampleModelNoDemandInput.osm +10560 -0
- data/lib/measures/CalibrationReports/tests/ExampleModelNoGasInput.osm +10456 -0
- data/lib/measures/CalibrationReports/tests/USA_CO_Golden-NREL.724666_TMY3.epw +8768 -0
- data/lib/measures/CalibrationReportsEnhanced/LICENSE.md +27 -0
- data/lib/measures/CalibrationReportsEnhanced/README.md +143 -0
- data/lib/measures/CalibrationReportsEnhanced/README.md.erb +42 -0
- data/lib/measures/CalibrationReportsEnhanced/measure.rb +798 -0
- data/lib/measures/CalibrationReportsEnhanced/measure.xml +372 -0
- data/lib/measures/CalibrationReportsEnhanced/resources/report.html.in +380 -0
- data/lib/measures/CalibrationReportsEnhanced/tests/CalibrationReportsEnhanced_Test.rb +734 -0
- data/lib/measures/CalibrationReportsEnhanced/tests/ExampleModel.osm +10497 -0
- data/lib/measures/CalibrationReportsEnhanced/tests/ExampleModel_FuelOil.osm +12740 -0
- data/lib/measures/CalibrationReportsEnhanced/tests/USA_CO_Golden-NREL.724666_TMY3.epw +8768 -0
- data/lib/measures/CalibrationReportsEnhanced21/LICENSE.md +27 -0
- data/lib/measures/CalibrationReportsEnhanced21/README.md +109 -0
- data/lib/measures/CalibrationReportsEnhanced21/README.md.erb +42 -0
- data/lib/measures/CalibrationReportsEnhanced21/measure.rb +690 -0
- data/lib/measures/CalibrationReportsEnhanced21/measure.xml +269 -0
- data/lib/measures/CalibrationReportsEnhanced21/resources/report.html.in +380 -0
- data/lib/measures/CoilCoolingDXSingleSpeedMultiplier/LICENSE.md +27 -0
- data/lib/measures/CoilCoolingDXSingleSpeedMultiplier/README.md +48 -0
- data/lib/measures/CoilCoolingDXSingleSpeedMultiplier/README.md.erb +42 -0
- data/lib/measures/CoilCoolingDXSingleSpeedMultiplier/measure.rb +237 -0
- data/lib/measures/CoilCoolingDXSingleSpeedMultiplier/measure.xml +93 -0
- data/lib/measures/CoilCoolingDXSingleSpeedPercentChange/LICENSE.md +27 -0
- data/lib/measures/CoilCoolingDXSingleSpeedPercentChange/README.md +48 -0
- data/lib/measures/CoilCoolingDXSingleSpeedPercentChange/README.md.erb +42 -0
- data/lib/measures/CoilCoolingDXSingleSpeedPercentChange/measure.rb +228 -0
- data/lib/measures/CoilCoolingDXSingleSpeedPercentChange/measure.xml +93 -0
- data/lib/measures/CoilCoolingDXTwoSpeedMultiplier/LICENSE.md +27 -0
- data/lib/measures/CoilCoolingDXTwoSpeedMultiplier/README.md +64 -0
- data/lib/measures/CoilCoolingDXTwoSpeedMultiplier/README.md.erb +42 -0
- data/lib/measures/CoilCoolingDXTwoSpeedMultiplier/measure.rb +280 -0
- data/lib/measures/CoilCoolingDXTwoSpeedMultiplier/measure.xml +111 -0
- data/lib/measures/CoilCoolingDXTwoSpeedPercentChange/LICENSE.md +27 -0
- data/lib/measures/CoilCoolingDXTwoSpeedPercentChange/README.md +64 -0
- data/lib/measures/CoilCoolingDXTwoSpeedPercentChange/README.md.erb +42 -0
- data/lib/measures/CoilCoolingDXTwoSpeedPercentChange/measure.rb +270 -0
- data/lib/measures/CoilCoolingDXTwoSpeedPercentChange/measure.xml +111 -0
- data/lib/measures/CoilCoolingWaterMultiplier/LICENSE.md +27 -0
- data/lib/measures/CoilCoolingWaterMultiplier/README.md +80 -0
- data/lib/measures/CoilCoolingWaterMultiplier/README.md.erb +42 -0
- data/lib/measures/CoilCoolingWaterMultiplier/measure.rb +324 -0
- data/lib/measures/CoilCoolingWaterMultiplier/measure.xml +129 -0
- data/lib/measures/CoilCoolingWaterPercentChange/LICENSE.md +27 -0
- data/lib/measures/CoilCoolingWaterPercentChange/README.md +80 -0
- data/lib/measures/CoilCoolingWaterPercentChange/README.md.erb +42 -0
- data/lib/measures/CoilCoolingWaterPercentChange/measure.rb +311 -0
- data/lib/measures/CoilCoolingWaterPercentChange/measure.xml +129 -0
- data/lib/measures/CoilHeatingElectricMultiplier/LICENSE.md +27 -0
- data/lib/measures/CoilHeatingElectricMultiplier/README.md +48 -0
- data/lib/measures/CoilHeatingElectricMultiplier/README.md.erb +42 -0
- data/lib/measures/CoilHeatingElectricMultiplier/measure.rb +240 -0
- data/lib/measures/CoilHeatingElectricMultiplier/measure.xml +93 -0
- data/lib/measures/CoilHeatingElectricPercentChange/LICENSE.md +27 -0
- data/lib/measures/CoilHeatingElectricPercentChange/README.md +48 -0
- data/lib/measures/CoilHeatingElectricPercentChange/README.md.erb +42 -0
- data/lib/measures/CoilHeatingElectricPercentChange/measure.rb +231 -0
- data/lib/measures/CoilHeatingElectricPercentChange/measure.xml +93 -0
- data/lib/measures/CoilHeatingGasMultiplier/LICENSE.md +27 -0
- data/lib/measures/CoilHeatingGasMultiplier/README.md +64 -0
- data/lib/measures/CoilHeatingGasMultiplier/README.md.erb +42 -0
- data/lib/measures/CoilHeatingGasMultiplier/measure.rb +282 -0
- data/lib/measures/CoilHeatingGasMultiplier/measure.xml +111 -0
- data/lib/measures/CoilHeatingGasPercentChange/LICENSE.md +27 -0
- data/lib/measures/CoilHeatingGasPercentChange/README.md +64 -0
- data/lib/measures/CoilHeatingGasPercentChange/README.md.erb +42 -0
- data/lib/measures/CoilHeatingGasPercentChange/measure.rb +271 -0
- data/lib/measures/CoilHeatingGasPercentChange/measure.xml +111 -0
- data/lib/measures/CoilHeatingWaterMultiplier/LICENSE.md +27 -0
- data/lib/measures/CoilHeatingWaterMultiplier/README.md +48 -0
- data/lib/measures/CoilHeatingWaterMultiplier/README.md.erb +42 -0
- data/lib/measures/CoilHeatingWaterMultiplier/measure.rb +235 -0
- data/lib/measures/CoilHeatingWaterMultiplier/measure.xml +93 -0
- data/lib/measures/CoilHeatingWaterPercentChange/LICENSE.md +27 -0
- data/lib/measures/CoilHeatingWaterPercentChange/README.md +48 -0
- data/lib/measures/CoilHeatingWaterPercentChange/README.md.erb +42 -0
- data/lib/measures/CoilHeatingWaterPercentChange/measure.rb +226 -0
- data/lib/measures/CoilHeatingWaterPercentChange/measure.xml +93 -0
- data/lib/measures/ConstructionLayerZeroMaterialProperties/LICENSE.md +27 -0
- data/lib/measures/ConstructionLayerZeroMaterialProperties/README.md +88 -0
- data/lib/measures/ConstructionLayerZeroMaterialProperties/README.md.erb +42 -0
- data/lib/measures/ConstructionLayerZeroMaterialProperties/measure.rb +221 -0
- data/lib/measures/ConstructionLayerZeroMaterialProperties/measure.xml +194 -0
- data/lib/measures/ElectricBaseboardEfficiencyAndCapacity/LICENSE.md +27 -0
- data/lib/measures/ElectricBaseboardEfficiencyAndCapacity/README.md +40 -0
- data/lib/measures/ElectricBaseboardEfficiencyAndCapacity/README.md.erb +42 -0
- data/lib/measures/ElectricBaseboardEfficiencyAndCapacity/measure.rb +102 -0
- data/lib/measures/ElectricBaseboardEfficiencyAndCapacity/measure.xml +78 -0
- data/lib/measures/ExteriorWallThermalPropertiesMultiplier/LICENSE.md +27 -0
- data/lib/measures/ExteriorWallThermalPropertiesMultiplier/README.md +48 -0
- data/lib/measures/ExteriorWallThermalPropertiesMultiplier/README.md.erb +42 -0
- data/lib/measures/ExteriorWallThermalPropertiesMultiplier/measure.rb +263 -0
- data/lib/measures/ExteriorWallThermalPropertiesMultiplier/measure.xml +97 -0
- data/lib/measures/ExteriorWallThermalPropertiesPercentChange/LICENSE.md +27 -0
- data/lib/measures/ExteriorWallThermalPropertiesPercentChange/README.md +48 -0
- data/lib/measures/ExteriorWallThermalPropertiesPercentChange/README.md.erb +42 -0
- data/lib/measures/ExteriorWallThermalPropertiesPercentChange/measure.rb +253 -0
- data/lib/measures/ExteriorWallThermalPropertiesPercentChange/measure.xml +97 -0
- data/lib/measures/FansMultiplier/LICENSE.md +27 -0
- data/lib/measures/FansMultiplier/README.md +64 -0
- data/lib/measures/FansMultiplier/README.md.erb +42 -0
- data/lib/measures/FansMultiplier/measure.rb +297 -0
- data/lib/measures/FansMultiplier/measure.xml +166 -0
- data/lib/measures/FansPercentChange/LICENSE.md +27 -0
- data/lib/measures/FansPercentChange/README.md +64 -0
- data/lib/measures/FansPercentChange/README.md.erb +42 -0
- data/lib/measures/FansPercentChange/measure.rb +286 -0
- data/lib/measures/FansPercentChange/measure.xml +166 -0
- data/lib/measures/GeneralCalibrationMeasureMultiplier/LICENSE.md +27 -0
- data/lib/measures/GeneralCalibrationMeasureMultiplier/README.md +112 -0
- data/lib/measures/GeneralCalibrationMeasureMultiplier/README.md.erb +42 -0
- data/lib/measures/GeneralCalibrationMeasureMultiplier/measure.rb +639 -0
- data/lib/measures/GeneralCalibrationMeasureMultiplier/measure.xml +229 -0
- data/lib/measures/GeneralCalibrationMeasurePercentChange/LICENSE.md +27 -0
- data/lib/measures/GeneralCalibrationMeasurePercentChange/README.md +112 -0
- data/lib/measures/GeneralCalibrationMeasurePercentChange/README.md.erb +42 -0
- data/lib/measures/GeneralCalibrationMeasurePercentChange/measure.rb +756 -0
- data/lib/measures/GeneralCalibrationMeasurePercentChange/measure.xml +229 -0
- data/lib/measures/HardSizeHvac/LICENSE.md +27 -0
- data/lib/measures/HardSizeHvac/README.md +26 -0
- data/lib/measures/HardSizeHvac/README.md.erb +42 -0
- data/lib/measures/HardSizeHvac/measure.rb +88 -0
- data/lib/measures/HardSizeHvac/measure.xml +81 -0
- data/lib/measures/MaalkaMonthlyJSONUtilityData/LICENSE.md +27 -0
- data/lib/measures/MaalkaMonthlyJSONUtilityData/README.md +104 -0
- data/lib/measures/MaalkaMonthlyJSONUtilityData/README.md.erb +42 -0
- data/lib/measures/MaalkaMonthlyJSONUtilityData/measure.rb +304 -0
- data/lib/measures/MaalkaMonthlyJSONUtilityData/measure.xml +216 -0
- data/lib/measures/RValueOfInsulationForConstructionMultiplier/LICENSE.md +27 -0
- data/lib/measures/RValueOfInsulationForConstructionMultiplier/README.md +40 -0
- data/lib/measures/RValueOfInsulationForConstructionMultiplier/README.md.erb +42 -0
- data/lib/measures/RValueOfInsulationForConstructionMultiplier/measure.rb +196 -0
- data/lib/measures/RValueOfInsulationForConstructionMultiplier/measure.xml +132 -0
- data/lib/measures/RValueOfInsulationForConstructionPercentageChange/LICENSE.md +27 -0
- data/lib/measures/RValueOfInsulationForConstructionPercentageChange/README.md +40 -0
- data/lib/measures/RValueOfInsulationForConstructionPercentageChange/README.md.erb +42 -0
- data/lib/measures/RValueOfInsulationForConstructionPercentageChange/measure.rb +189 -0
- data/lib/measures/RValueOfInsulationForConstructionPercentageChange/measure.xml +132 -0
- data/lib/measures/RoofThermalPropertiesMultiplier/LICENSE.md +27 -0
- data/lib/measures/RoofThermalPropertiesMultiplier/README.md +48 -0
- data/lib/measures/RoofThermalPropertiesMultiplier/README.md.erb +42 -0
- data/lib/measures/RoofThermalPropertiesMultiplier/measure.rb +263 -0
- data/lib/measures/RoofThermalPropertiesMultiplier/measure.xml +97 -0
- data/lib/measures/RoofThermalPropertiesPercentChange/LICENSE.md +27 -0
- data/lib/measures/RoofThermalPropertiesPercentChange/README.md +48 -0
- data/lib/measures/RoofThermalPropertiesPercentChange/README.md.erb +42 -0
- data/lib/measures/RoofThermalPropertiesPercentChange/measure.rb +253 -0
- data/lib/measures/RoofThermalPropertiesPercentChange/measure.xml +97 -0
- data/lib/measures/TimeseriesObjectiveFunction/LICENSE.md +27 -0
- data/lib/measures/TimeseriesObjectiveFunction/README.md +207 -0
- data/lib/measures/TimeseriesObjectiveFunction/README.md.erb +42 -0
- data/lib/measures/TimeseriesObjectiveFunction/measure.rb +748 -0
- data/lib/measures/TimeseriesObjectiveFunction/measure.xml +435 -0
- data/lib/measures/TimeseriesObjectiveFunction/resources/report.html.erb +288 -0
- data/lib/measures/TimeseriesPlot/LICENSE.md +27 -0
- data/lib/measures/TimeseriesPlot/README.md +56 -0
- data/lib/measures/TimeseriesPlot/README.md.erb +42 -0
- data/lib/measures/TimeseriesPlot/measure.rb +302 -0
- data/lib/measures/TimeseriesPlot/measure.xml +137 -0
- data/lib/measures/TimeseriesPlot/resources/report.html.erb +270 -0
- data/lib/measures/WaterHeaterMixedMultiplier/LICENSE.md +27 -0
- data/lib/measures/WaterHeaterMixedMultiplier/README.md +64 -0
- data/lib/measures/WaterHeaterMixedMultiplier/README.md.erb +42 -0
- data/lib/measures/WaterHeaterMixedMultiplier/measure.rb +255 -0
- data/lib/measures/WaterHeaterMixedMultiplier/measure.xml +180 -0
- data/lib/measures/WaterHeaterMixedPercentChange/LICENSE.md +27 -0
- data/lib/measures/WaterHeaterMixedPercentChange/README.md +64 -0
- data/lib/measures/WaterHeaterMixedPercentChange/README.md.erb +42 -0
- data/lib/measures/WaterHeaterMixedPercentChange/measure.rb +245 -0
- data/lib/measures/WaterHeaterMixedPercentChange/measure.xml +180 -0
- data/lib/measures/zone_report/LICENSE.md +27 -0
- data/lib/measures/zone_report/README.md +26 -0
- data/lib/measures/zone_report/README.md.erb +42 -0
- data/lib/measures/zone_report/measure.rb +706 -0
- data/lib/measures/zone_report/measure.xml +67 -0
- data/lib/measures/zone_report/resources/report.html.in +342 -0
- data/lib/openstudio-calibration-measures.rb +36 -0
- data/lib/openstudio/calibration_measures.rb +37 -0
- data/lib/openstudio/calibration_measures/extension.rb +49 -0
- data/lib/openstudio/calibration_measures/version.rb +40 -0
- data/openstudio-calibration.gemspec +30 -0
- metadata +331 -0
@@ -0,0 +1,270 @@
|
|
1
|
+
<%
|
2
|
+
# *******************************************************************************
|
3
|
+
# OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
|
4
|
+
# All rights reserved.
|
5
|
+
# Redistribution and use in source and binary forms, with or without
|
6
|
+
# modification, are permitted provided that the following conditions are met:
|
7
|
+
#
|
8
|
+
# (1) Redistributions of source code must retain the above copyright notice,
|
9
|
+
# this list of conditions and the following disclaimer.
|
10
|
+
#
|
11
|
+
# (2) Redistributions in binary form must reproduce the above copyright notice,
|
12
|
+
# this list of conditions and the following disclaimer in the documentation
|
13
|
+
# and/or other materials provided with the distribution.
|
14
|
+
#
|
15
|
+
# (3) Neither the name of the copyright holder nor the names of any contributors
|
16
|
+
# may be used to endorse or promote products derived from this software without
|
17
|
+
# specific prior written permission from the respective party.
|
18
|
+
#
|
19
|
+
# (4) Other than as required in clauses (1) and (2), distributions in any form
|
20
|
+
# of modifications or other derivative works may not use the "OpenStudio"
|
21
|
+
# trademark, "OS", "os", or any other confusingly similar designation without
|
22
|
+
# specific prior written permission from Alliance for Sustainable Energy, LLC.
|
23
|
+
#
|
24
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS
|
25
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
26
|
+
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
27
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE
|
28
|
+
# UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF
|
29
|
+
# THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
30
|
+
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
31
|
+
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
32
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
33
|
+
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
34
|
+
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
35
|
+
# *******************************************************************************
|
36
|
+
%>
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
<!DOCTYPE html>
|
41
|
+
<meta charset="utf-8">
|
42
|
+
<style>
|
43
|
+
|
44
|
+
svg {
|
45
|
+
font: 10px sans-serif;
|
46
|
+
}
|
47
|
+
|
48
|
+
.axis path,
|
49
|
+
.axis line {
|
50
|
+
fill: none;
|
51
|
+
stroke: #000;
|
52
|
+
shape-rendering: crispEdges;
|
53
|
+
}
|
54
|
+
|
55
|
+
.brush .extent {
|
56
|
+
stroke: #fff;
|
57
|
+
fill-opacity: .125;
|
58
|
+
shape-rendering: crispEdges;
|
59
|
+
}
|
60
|
+
|
61
|
+
.xline {
|
62
|
+
stroke-width: 1;
|
63
|
+
fill: none;
|
64
|
+
clip-path: url(#clip);
|
65
|
+
}
|
66
|
+
|
67
|
+
</style>
|
68
|
+
<title>Timeseries</title>
|
69
|
+
<link href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.2.0/css/bootstrap.css" rel="stylesheet">
|
70
|
+
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
|
71
|
+
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.3.9/d3.min.js"></script>
|
72
|
+
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
|
73
|
+
</head>
|
74
|
+
<body>
|
75
|
+
<div id="timeseriesplot" class="container">
|
76
|
+
<h1 id="plottitle">Timeseries Plot</h1>
|
77
|
+
</div>
|
78
|
+
<script>
|
79
|
+
|
80
|
+
var allSeries = <%= all_series %>;
|
81
|
+
|
82
|
+
// Set the overall plot heading
|
83
|
+
$("#plottitle").text(allSeries[0].type);
|
84
|
+
|
85
|
+
// Define size and margins of chart
|
86
|
+
var margin = {top: 10, right: 350, bottom: 100, left: 40},
|
87
|
+
margin2 = {top: 430, right: 350, bottom: 20, left: 40},
|
88
|
+
width = 1500 - margin.left - margin.right,
|
89
|
+
height = 500 - margin.top - margin.bottom,
|
90
|
+
height2 = 500 - margin2.top - margin2.bottom;
|
91
|
+
|
92
|
+
var parseDate = d3.time.format("%b %Y").parse;
|
93
|
+
|
94
|
+
// Determine the bounds of the chart
|
95
|
+
var x_min = new Date('January 1, 3000 00:00:00');
|
96
|
+
var x_max = new Date('January 1, 1900 00:00:00');
|
97
|
+
var y_min = Number.POSITIVE_INFINITY;
|
98
|
+
var y_max = Number.NEGATIVE_INFINITY;
|
99
|
+
$.each(allSeries, function(index, all_series) {
|
100
|
+
var series = allSeries[index];
|
101
|
+
|
102
|
+
this_x_min = d3.min(series.data.map(function(d) { return new Date(d.time); }))
|
103
|
+
this_x_max = d3.max(series.data.map(function(d) { return new Date(d.time); }))
|
104
|
+
this_y_min = d3.min(series.data.map(function(d) { return d.y; }))
|
105
|
+
this_y_max = d3.max(series.data.map(function(d) { return d.y; }))
|
106
|
+
|
107
|
+
if (this_x_min < x_min) x_min = this_x_min;
|
108
|
+
if (this_x_max > x_max) x_max = this_x_max;
|
109
|
+
if (this_y_min < y_min) y_min = this_y_min;
|
110
|
+
if (this_y_max > y_max) y_max = this_y_max;
|
111
|
+
|
112
|
+
});
|
113
|
+
// Log the bounds for debugging
|
114
|
+
console.log("x_min = " + x_min)
|
115
|
+
console.log("x_max = " + x_max)
|
116
|
+
console.log("y_min = " + y_min)
|
117
|
+
console.log("y_max = " + y_max)
|
118
|
+
|
119
|
+
// Increase the y max by a little for readability
|
120
|
+
y_max = y_max + ((y_max - y_min) * 0.25);
|
121
|
+
|
122
|
+
// Horizontal axis scale
|
123
|
+
var x_extent = [this.x_min, this.x_max];
|
124
|
+
|
125
|
+
// Vertical axis scale
|
126
|
+
var y_extent = [this.y_min, this.y_max];
|
127
|
+
|
128
|
+
// Create the x and y scales (width on page) for both chart areas
|
129
|
+
var x = d3.time.scale().range([0, width]),
|
130
|
+
x2 = d3.time.scale().range([0, width]),
|
131
|
+
y = d3.scale.linear().range([height, 0]),
|
132
|
+
y2 = d3.scale.linear().range([height2, 0]);
|
133
|
+
|
134
|
+
// Create the x and y domains (extent of the data) for both chart areas
|
135
|
+
x.domain(x_extent);
|
136
|
+
y.domain(y_extent);
|
137
|
+
x2.domain(x.domain());
|
138
|
+
y2.domain(y.domain());
|
139
|
+
|
140
|
+
// Create and position axes
|
141
|
+
var xAxis = d3.svg.axis().scale(x).orient("bottom"),
|
142
|
+
xAxis2 = d3.svg.axis().scale(x2).orient("bottom"),
|
143
|
+
yAxis = d3.svg.axis().scale(y).orient("left"),
|
144
|
+
yAxis2 = d3.svg.axis().scale(y2).orient("left");
|
145
|
+
|
146
|
+
// Create the selector
|
147
|
+
var brush = d3.svg.brush()
|
148
|
+
.x(x2)
|
149
|
+
.on("brush", brushed);
|
150
|
+
|
151
|
+
// Function to create lines in the focus area
|
152
|
+
var line = d3.svg.line()
|
153
|
+
.x(function(d) { return x(new Date(d.time)); })
|
154
|
+
.y(function(d) { return y(d.y); });
|
155
|
+
|
156
|
+
// Function to create lines in the context area
|
157
|
+
var line2 = d3.svg.line()
|
158
|
+
.x(function(d) { return x2(new Date(d.time)); })
|
159
|
+
.y(function(d) { return y2(d.y); });
|
160
|
+
|
161
|
+
// Create the overall SVG
|
162
|
+
var svg = d3.select("#timeseriesplot").append("svg")
|
163
|
+
.attr("width", width + margin.left + margin.right)
|
164
|
+
.attr("height", height + margin.top + margin.bottom);
|
165
|
+
|
166
|
+
svg.append("defs").append("clipPath")
|
167
|
+
.attr("id", "clip")
|
168
|
+
.append("rect")
|
169
|
+
.attr("width", width)
|
170
|
+
.attr("height", height);
|
171
|
+
|
172
|
+
// Draw the focus section (main plot)
|
173
|
+
var focus = svg.append("g")
|
174
|
+
.attr("class", "focus")
|
175
|
+
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
|
176
|
+
|
177
|
+
// Draw the focus x and y axes
|
178
|
+
focusaxis = focus.append("g")
|
179
|
+
.attr("class", "x axis")
|
180
|
+
.attr("transform", "translate(0," + height + ")")
|
181
|
+
.call(xAxis);
|
182
|
+
|
183
|
+
focusaxis.append("text")
|
184
|
+
.text(allSeries[0].type + " [" + allSeries[0].units + "]")
|
185
|
+
.attr("transform", "rotate (-90, 0, 0) translate(" + (height / 5) + "," + (-1*(margin.left / 2 + 10)) + ")"); // TODO dynamically account for width of axis label to center
|
186
|
+
|
187
|
+
focus.append("g")
|
188
|
+
.attr("class", "y axis")
|
189
|
+
.call(yAxis);
|
190
|
+
|
191
|
+
// Draw the context section (selector)
|
192
|
+
var context = svg.append("g")
|
193
|
+
.attr("class", "context")
|
194
|
+
.attr("transform", "translate(" + margin2.left + "," + margin2.top + ")");
|
195
|
+
|
196
|
+
// Draw the context x axis
|
197
|
+
context.append("g")
|
198
|
+
.attr("class", "x axis")
|
199
|
+
.attr("transform", "translate(0," + height2 + ")")
|
200
|
+
.call(xAxis2);
|
201
|
+
|
202
|
+
// Draw the brush selector for the context
|
203
|
+
context.append("g")
|
204
|
+
.attr("class", "x brush")
|
205
|
+
.call(brush)
|
206
|
+
.selectAll("rect")
|
207
|
+
.attr("y", -6)
|
208
|
+
.attr("height", height2 + 7);
|
209
|
+
|
210
|
+
// Setup the spacing for the legends
|
211
|
+
var legendSpacing = 25;
|
212
|
+
|
213
|
+
// Create a legend for the data series
|
214
|
+
var primlegend = focus.append("g")
|
215
|
+
.attr("class", "w axis")
|
216
|
+
.attr("transform", "translate(" + (width + 10) + ",0)");
|
217
|
+
|
218
|
+
// TODO make series toggle-able
|
219
|
+
primlegend.append("text").text("Series Names")
|
220
|
+
//.style("cursor", " pointer")
|
221
|
+
.attr("y", legendSpacing * 1)
|
222
|
+
.attr("class", "noselect");
|
223
|
+
|
224
|
+
// Define the color scale
|
225
|
+
var c20 = d3.scale.category20();
|
226
|
+
c20.domain([1, allSeries.length]);
|
227
|
+
|
228
|
+
// Plot each series
|
229
|
+
var i = 1;
|
230
|
+
$.each(allSeries, function(index, all_series) {
|
231
|
+
var series = allSeries[index];
|
232
|
+
|
233
|
+
// Generate a color
|
234
|
+
var lineColor = c20(i)
|
235
|
+
|
236
|
+
// Plot on the focus
|
237
|
+
focus.append("path")
|
238
|
+
.datum(series.data)
|
239
|
+
.attr("class", "xline")
|
240
|
+
.attr("d", line)
|
241
|
+
.style("stroke", lineColor);
|
242
|
+
|
243
|
+
// Plot on the context
|
244
|
+
// Note that line2 uses the x2 and y2 scales
|
245
|
+
context.append("path")
|
246
|
+
.datum(series.data)
|
247
|
+
.attr("class", "xline")
|
248
|
+
.attr("d", line2)
|
249
|
+
.style("stroke", lineColor);
|
250
|
+
|
251
|
+
// Add the series name to the legend
|
252
|
+
primlegend.append("text").text(series.name + " [" + series.units + "]")
|
253
|
+
.style("cursor", " pointer")
|
254
|
+
.attr("y", legendSpacing * (i + 1))
|
255
|
+
.attr("class", "noselect")
|
256
|
+
.style("fill", lineColor);
|
257
|
+
|
258
|
+
i += 1;
|
259
|
+
|
260
|
+
});
|
261
|
+
|
262
|
+
// Define what to do when the selector is moved around
|
263
|
+
function brushed() {
|
264
|
+
console.log("Brushed")
|
265
|
+
x.domain(brush.empty() ? x2.domain() : brush.extent());
|
266
|
+
focus.selectAll(".xline").attr("d", line);
|
267
|
+
focus.selectAll(".x.axis").call(xAxis);
|
268
|
+
}
|
269
|
+
|
270
|
+
</script>
|
@@ -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,64 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
###### (Automatically generated documentation)
|
4
|
+
|
5
|
+
# Water Heater Mixed Multiplier
|
6
|
+
|
7
|
+
## Description
|
8
|
+
This is a general purpose measure to calibrate WaterHeaterMixed with a Multiplier.
|
9
|
+
|
10
|
+
## Modeler Description
|
11
|
+
It will be used for calibration of WaterHeaterMixed. User can choose between a SINGLE WaterHeaterMixed or ALL the WaterHeaterMixed objects.
|
12
|
+
|
13
|
+
## Measure Type
|
14
|
+
ModelMeasure
|
15
|
+
|
16
|
+
## Taxonomy
|
17
|
+
|
18
|
+
|
19
|
+
## Arguments
|
20
|
+
|
21
|
+
|
22
|
+
### Apply the Measure to a SINGLE WaterHeaterMixed, ALL the WaterHeaterMixeds or NONE.
|
23
|
+
|
24
|
+
**Name:** water_heater,
|
25
|
+
**Type:** Choice,
|
26
|
+
**Units:** ,
|
27
|
+
**Required:** true,
|
28
|
+
**Model Dependent:** false
|
29
|
+
|
30
|
+
### Multiplier for Heater Maximum Capacity.
|
31
|
+
Multiplier for Heater Maximum Capacity.
|
32
|
+
**Name:** maximum_capacity_multiplier,
|
33
|
+
**Type:** Double,
|
34
|
+
**Units:** ,
|
35
|
+
**Required:** true,
|
36
|
+
**Model Dependent:** false
|
37
|
+
|
38
|
+
### Multiplier for Heater Minimum Capacity.
|
39
|
+
Multiplier for Heater Minimum Capacity.
|
40
|
+
**Name:** minimum_capacity_multiplier,
|
41
|
+
**Type:** Double,
|
42
|
+
**Units:** ,
|
43
|
+
**Required:** true,
|
44
|
+
**Model Dependent:** false
|
45
|
+
|
46
|
+
### Multiplier for Thermal Efficiency.
|
47
|
+
Multiplier for Thermal Efficiency.
|
48
|
+
**Name:** thermal_efficiency_multiplier,
|
49
|
+
**Type:** Double,
|
50
|
+
**Units:** ,
|
51
|
+
**Required:** true,
|
52
|
+
**Model Dependent:** false
|
53
|
+
|
54
|
+
### Heater Fuel Type.
|
55
|
+
Heater Fuel Type.
|
56
|
+
**Name:** fuel_type,
|
57
|
+
**Type:** Choice,
|
58
|
+
**Units:** ,
|
59
|
+
**Required:** true,
|
60
|
+
**Model Dependent:** false
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
@@ -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,255 @@
|
|
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
|
+
# start the measure
|
37
|
+
class WaterHeaterMixedMultiplier < OpenStudio::Measure::ModelMeasure
|
38
|
+
# human readable name
|
39
|
+
def name
|
40
|
+
'Water Heater Mixed Multiplier'
|
41
|
+
end
|
42
|
+
|
43
|
+
# human readable description
|
44
|
+
def description
|
45
|
+
'This is a general purpose measure to calibrate WaterHeaterMixed with a Multiplier.'
|
46
|
+
end
|
47
|
+
|
48
|
+
# human readable description of modeling approach
|
49
|
+
def modeler_description
|
50
|
+
'It will be used for calibration of WaterHeaterMixed. User can choose between a SINGLE WaterHeaterMixed or ALL the WaterHeaterMixed objects.'
|
51
|
+
end
|
52
|
+
|
53
|
+
def change_name(object, maximum_capacity_multiplier, minimum_capacity_multiplier, thermal_efficiency_multiplier, fuel_type, orig_fuel_type)
|
54
|
+
nameString = object.name.get.to_s
|
55
|
+
if maximum_capacity_multiplier != 1.0
|
56
|
+
nameString += " #{maximum_capacity_multiplier.round(2)}x maxCap"
|
57
|
+
end
|
58
|
+
if minimum_capacity_multiplier != 1.0
|
59
|
+
nameString += " #{minimum_capacity_multiplier.round(2)}x minCap"
|
60
|
+
end
|
61
|
+
if thermal_efficiency_multiplier != 1.0
|
62
|
+
nameString += " #{thermal_efficiency_multiplier.round(2)}x thermEff"
|
63
|
+
end
|
64
|
+
nameString += " #{fuel_type} fuel Change" if orig_fuel_type != fuel_type
|
65
|
+
object.setName(nameString)
|
66
|
+
end
|
67
|
+
|
68
|
+
def check_multiplier(runner, multiplier)
|
69
|
+
if multiplier < 0
|
70
|
+
runner.registerError("Multiplier #{multiplier} cannot be negative.")
|
71
|
+
false
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# define the arguments that the user will input
|
76
|
+
def arguments(model)
|
77
|
+
args = OpenStudio::Measure::OSArgumentVector.new
|
78
|
+
|
79
|
+
# make a choice argument for model objects
|
80
|
+
water_heater_handles = OpenStudio::StringVector.new
|
81
|
+
water_heater_display_names = OpenStudio::StringVector.new
|
82
|
+
|
83
|
+
# putting model object and names into hash
|
84
|
+
water_heater_args = model.getWaterHeaterMixeds
|
85
|
+
water_heater_args.each do |water_heater_arg|
|
86
|
+
water_heater_handles << water_heater_arg.handle.to_s
|
87
|
+
water_heater_display_names << water_heater_arg.name.to_s
|
88
|
+
end
|
89
|
+
|
90
|
+
# add building to string vector with space type
|
91
|
+
building = model.getBuilding
|
92
|
+
water_heater_handles << building.handle.to_s
|
93
|
+
water_heater_display_names << '*All WaterHeaterMixeds*'
|
94
|
+
water_heater_handles << '0'
|
95
|
+
water_heater_display_names << '*None*'
|
96
|
+
|
97
|
+
# make a choice argument for space type
|
98
|
+
water_heater = OpenStudio::Measure::OSArgument.makeChoiceArgument('water_heater', water_heater_handles, water_heater_display_names)
|
99
|
+
water_heater.setDisplayName('Apply the Measure to a SINGLE WaterHeaterMixed, ALL the WaterHeaterMixeds or NONE.')
|
100
|
+
water_heater.setDefaultValue('*All WaterHeaterMixeds*') # if no space type is chosen this will run on the entire building
|
101
|
+
args << water_heater
|
102
|
+
|
103
|
+
# maximum_capacity_multiplier
|
104
|
+
maximum_capacity_multiplier = OpenStudio::Measure::OSArgument.makeDoubleArgument('maximum_capacity_multiplier', true)
|
105
|
+
maximum_capacity_multiplier.setDisplayName('Multiplier for Heater Maximum Capacity.')
|
106
|
+
maximum_capacity_multiplier.setDescription('Multiplier for Heater Maximum Capacity.')
|
107
|
+
maximum_capacity_multiplier.setDefaultValue(1.0)
|
108
|
+
maximum_capacity_multiplier.setMinValue(0.0)
|
109
|
+
args << maximum_capacity_multiplier
|
110
|
+
|
111
|
+
# minimum_capacity_multiplier
|
112
|
+
minimum_capacity_multiplier = OpenStudio::Measure::OSArgument.makeDoubleArgument('minimum_capacity_multiplier', true)
|
113
|
+
minimum_capacity_multiplier.setDisplayName('Multiplier for Heater Minimum Capacity.')
|
114
|
+
minimum_capacity_multiplier.setDescription('Multiplier for Heater Minimum Capacity.')
|
115
|
+
minimum_capacity_multiplier.setDefaultValue(1.0)
|
116
|
+
args << minimum_capacity_multiplier
|
117
|
+
|
118
|
+
# thermal_efficiency_multiplier
|
119
|
+
thermal_efficiency_multiplier = OpenStudio::Measure::OSArgument.makeDoubleArgument('thermal_efficiency_multiplier', true)
|
120
|
+
thermal_efficiency_multiplier.setDisplayName('Multiplier for Thermal Efficiency.')
|
121
|
+
thermal_efficiency_multiplier.setDescription('Multiplier for Thermal Efficiency.')
|
122
|
+
thermal_efficiency_multiplier.setDefaultValue(1.0)
|
123
|
+
args << thermal_efficiency_multiplier
|
124
|
+
|
125
|
+
# make a choice argument for fuel type
|
126
|
+
fuel_type = OpenStudio::StringVector.new
|
127
|
+
fuel_type << 'NaturalGas'
|
128
|
+
fuel_type << 'Electricity'
|
129
|
+
fuel_type << 'PropaneGas'
|
130
|
+
|
131
|
+
# heater_fuel_type
|
132
|
+
heater_fuel_type = OpenStudio::Measure::OSArgument.makeChoiceArgument('fuel_type', fuel_type, fuel_type)
|
133
|
+
heater_fuel_type.setDisplayName('Heater Fuel Type.')
|
134
|
+
heater_fuel_type.setDescription('Heater Fuel Type.')
|
135
|
+
heater_fuel_type.setDefaultValue('NaturalGas')
|
136
|
+
args << heater_fuel_type
|
137
|
+
|
138
|
+
args
|
139
|
+
end
|
140
|
+
|
141
|
+
# define what happens when the measure is run
|
142
|
+
def run(model, runner, user_arguments)
|
143
|
+
super(model, runner, user_arguments)
|
144
|
+
|
145
|
+
# use the built-in error checking
|
146
|
+
unless runner.validateUserArguments(arguments(model), user_arguments)
|
147
|
+
return false
|
148
|
+
end
|
149
|
+
|
150
|
+
# assign the user inputs to variables
|
151
|
+
water_heater_object = runner.getOptionalWorkspaceObjectChoiceValue('water_heater', user_arguments, model)
|
152
|
+
water_heater_handle = runner.getStringArgumentValue('water_heater', user_arguments)
|
153
|
+
fuel_type = runner.getStringArgumentValue('fuel_type', user_arguments)
|
154
|
+
thermal_efficiency_multiplier = runner.getDoubleArgumentValue('thermal_efficiency_multiplier', user_arguments)
|
155
|
+
check_multiplier(runner, thermal_efficiency_multiplier)
|
156
|
+
maximum_capacity_multiplier = runner.getDoubleArgumentValue('maximum_capacity_multiplier', user_arguments)
|
157
|
+
check_multiplier(runner, maximum_capacity_multiplier)
|
158
|
+
minimum_capacity_multiplier = runner.getDoubleArgumentValue('minimum_capacity_multiplier', user_arguments)
|
159
|
+
check_multiplier(runner, minimum_capacity_multiplier)
|
160
|
+
|
161
|
+
# find objects to change
|
162
|
+
water_heaters = []
|
163
|
+
building = model.getBuilding
|
164
|
+
building_handle = building.handle.to_s
|
165
|
+
runner.registerInfo("water_heater_handle: #{water_heater_handle}")
|
166
|
+
# setup water_heaters
|
167
|
+
if water_heater_handle == building_handle
|
168
|
+
# Use ALL SpaceTypes
|
169
|
+
runner.registerInfo('Applying change to ALL SpaceTypes')
|
170
|
+
water_heaters = model.getWaterHeaterMixeds
|
171
|
+
elsif water_heater_handle == 0.to_s
|
172
|
+
# SpaceTypes set to NONE so do nothing
|
173
|
+
runner.registerInfo('Applying change to NONE SpaceTypes')
|
174
|
+
elsif !water_heater_handle.empty?
|
175
|
+
# Single WaterHeaterMixed handle found, check if object is good
|
176
|
+
if !water_heater_object.get.to_WaterHeaterMixed.empty?
|
177
|
+
runner.registerInfo("Applying change to #{water_heater_object.get.name} WaterHeaterMixed")
|
178
|
+
water_heaters << water_heater_object.get.to_WaterHeaterMixed.get
|
179
|
+
else
|
180
|
+
runner.registerError("WaterHeaterMixed with handle #{water_heater_handle} could not be found.")
|
181
|
+
end
|
182
|
+
else
|
183
|
+
runner.registerError('WaterHeaterMixed handle is empty.')
|
184
|
+
return false
|
185
|
+
end
|
186
|
+
|
187
|
+
altered_heaters = []
|
188
|
+
altered_thermalefficiency = []
|
189
|
+
altered_max_cap = []
|
190
|
+
altered_min_cap = []
|
191
|
+
|
192
|
+
# report initial condition of model
|
193
|
+
runner.registerInitialCondition("Applying Multiplier to #{water_heaters.size} Water Heaters.")
|
194
|
+
|
195
|
+
# loop through space types
|
196
|
+
water_heaters.each do |water_heater|
|
197
|
+
altered_heater = false
|
198
|
+
# modify maximum_capacity_multiplier
|
199
|
+
if maximum_capacity_multiplier != 1.0
|
200
|
+
if water_heater.heaterMaximumCapacity.is_initialized
|
201
|
+
runner.registerInfo("Applying #{maximum_capacity_multiplier}x maximum capacity multiplier to #{water_heater.name.get}.")
|
202
|
+
water_heater.setHeaterMaximumCapacity(water_heater.heaterMaximumCapacity.get * maximum_capacity_multiplier)
|
203
|
+
altered_max_cap << water_heater.handle.to_s
|
204
|
+
altered_heater = true
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
# modify minimum_capacity_multiplier
|
209
|
+
if minimum_capacity_multiplier != 1.0
|
210
|
+
if water_heater.heaterMinimumCapacity.is_initialized
|
211
|
+
runner.registerInfo("Applying #{minimum_capacity_multiplier}x minimum capacity multiplier to #{water_heater.name.get}.")
|
212
|
+
water_heater.setHeaterMaximumCapacity(water_heater.heaterMinimumCapacity.get * minimum_capacity_multiplier)
|
213
|
+
altered_min_cap << water_heater.handle.to_s
|
214
|
+
altered_heater = true
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
# modify thermal_efficiency_multiplier
|
219
|
+
if thermal_efficiency_multiplier != 1.0
|
220
|
+
if water_heater.heaterThermalEfficiency.is_initialized
|
221
|
+
runner.registerInfo("Applying #{thermal_efficiency_multiplier}x thermal efficiency multiplier to #{water_heater.name.get}.")
|
222
|
+
water_heater.setHeaterThermalEfficiency(water_heater.heaterThermalEfficiency.get * thermal_efficiency_multiplier)
|
223
|
+
altered_thermalefficiency << water_heater.handle.to_s
|
224
|
+
altered_heater = true
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
orig_fuel_type = water_heater.heaterFuelType
|
229
|
+
if orig_fuel_type != fuel_type
|
230
|
+
runner.registerInfo("Changing Fuel Type to #{fuel_type} for #{water_heater.name.get}.")
|
231
|
+
water_heater.setHeaterFuelType(fuel_type)
|
232
|
+
altered_heater = true
|
233
|
+
end
|
234
|
+
|
235
|
+
next unless altered_heater
|
236
|
+
altered_heaters << water_heater.handle.to_s
|
237
|
+
change_name(water_heater, maximum_capacity_multiplier, minimum_capacity_multiplier, thermal_efficiency_multiplier, fuel_type, orig_fuel_type)
|
238
|
+
runner.registerInfo("WaterHeater name changed to: #{water_heater.name.get}")
|
239
|
+
end # end water_heater loop
|
240
|
+
|
241
|
+
# na if nothing in model to look at
|
242
|
+
if altered_heaters.empty?
|
243
|
+
runner.registerAsNotApplicable('No WaterHeaters were altered in the model')
|
244
|
+
return true
|
245
|
+
end
|
246
|
+
|
247
|
+
# report final condition of model
|
248
|
+
runner.registerFinalCondition("#{altered_heaters.size} WaterHeater objects were altered.")
|
249
|
+
|
250
|
+
true
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
# register the measure to be used by the application
|
255
|
+
WaterHeaterMixedMultiplier.new.registerWithApplication
|