openstudio-calibration 0.1.3 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.rubocop.yml +7 -0
- data/CHANGELOG.md +40 -8
- data/Gemfile +6 -3
- data/Jenkinsfile +7 -2
- data/LICENSE.md +1 -1
- data/README.md +15 -4
- data/Rakefile +6 -6
- data/doc_templates/LICENSE.md +1 -1
- data/doc_templates/copyright_erb.txt +1 -1
- data/doc_templates/copyright_js.txt +1 -1
- data/doc_templates/copyright_ruby.txt +1 -1
- data/lib/measures/AddMonthlyJSONUtilityData/LICENSE.md +1 -1
- data/lib/measures/AddMonthlyJSONUtilityData/measure.rb +1 -1
- data/lib/measures/AddMonthlyJSONUtilityData/measure.xml +12 -11
- data/lib/measures/AddMonthlyUtilityData/LICENSE.md +1 -1
- data/lib/measures/AddMonthlyUtilityData/measure.rb +1 -1
- data/lib/measures/AddMonthlyUtilityData/measure.xml +13 -12
- data/lib/measures/CalibrationReports/LICENSE.md +1 -1
- data/lib/measures/CalibrationReports/README.md +2 -2
- data/lib/measures/CalibrationReports/measure.rb +1 -1
- data/lib/measures/CalibrationReports/measure.xml +11 -11
- data/lib/measures/CalibrationReportsEnhanced/LICENSE.md +1 -1
- data/lib/measures/CalibrationReportsEnhanced/measure.rb +2 -2
- data/lib/measures/CalibrationReportsEnhanced/measure.xml +18 -17
- data/lib/measures/CoilCoolingDXSingleSpeedMultiplier/LICENSE.md +1 -1
- data/lib/measures/CoilCoolingDXSingleSpeedMultiplier/measure.rb +1 -1
- data/lib/measures/CoilCoolingDXSingleSpeedMultiplier/measure.xml +14 -13
- data/lib/measures/CoilCoolingDXSingleSpeedPercentChange/LICENSE.md +1 -1
- data/lib/measures/CoilCoolingDXSingleSpeedPercentChange/measure.rb +1 -1
- data/lib/measures/CoilCoolingDXSingleSpeedPercentChange/measure.xml +14 -13
- data/lib/measures/CoilCoolingDXTwoSpeedMultiplier/LICENSE.md +1 -1
- data/lib/measures/CoilCoolingDXTwoSpeedMultiplier/measure.rb +1 -1
- data/lib/measures/CoilCoolingDXTwoSpeedMultiplier/measure.xml +14 -13
- data/lib/measures/CoilCoolingDXTwoSpeedPercentChange/LICENSE.md +1 -1
- data/lib/measures/CoilCoolingDXTwoSpeedPercentChange/measure.rb +1 -1
- data/lib/measures/CoilCoolingDXTwoSpeedPercentChange/measure.xml +14 -13
- data/lib/measures/CoilCoolingWaterMultiplier/LICENSE.md +1 -1
- data/lib/measures/CoilCoolingWaterMultiplier/measure.rb +1 -1
- data/lib/measures/CoilCoolingWaterMultiplier/measure.xml +14 -13
- data/lib/measures/CoilCoolingWaterPercentChange/LICENSE.md +1 -1
- data/lib/measures/CoilCoolingWaterPercentChange/measure.rb +1 -1
- data/lib/measures/CoilCoolingWaterPercentChange/measure.xml +14 -13
- data/lib/measures/CoilHeatingElectricMultiplier/LICENSE.md +1 -1
- data/lib/measures/CoilHeatingElectricMultiplier/measure.rb +1 -1
- data/lib/measures/CoilHeatingElectricMultiplier/measure.xml +14 -13
- data/lib/measures/CoilHeatingElectricPercentChange/LICENSE.md +1 -1
- data/lib/measures/CoilHeatingElectricPercentChange/measure.rb +1 -1
- data/lib/measures/CoilHeatingElectricPercentChange/measure.xml +14 -13
- data/lib/measures/CoilHeatingGasMultiplier/LICENSE.md +1 -1
- data/lib/measures/CoilHeatingGasMultiplier/measure.rb +1 -1
- data/lib/measures/CoilHeatingGasMultiplier/measure.xml +14 -13
- data/lib/measures/CoilHeatingGasPercentChange/LICENSE.md +1 -1
- data/lib/measures/CoilHeatingGasPercentChange/measure.rb +1 -1
- data/lib/measures/CoilHeatingGasPercentChange/measure.xml +14 -13
- data/lib/measures/CoilHeatingWaterMultiplier/LICENSE.md +1 -1
- data/lib/measures/CoilHeatingWaterMultiplier/measure.rb +1 -1
- data/lib/measures/CoilHeatingWaterMultiplier/measure.xml +14 -13
- data/lib/measures/CoilHeatingWaterPercentChange/LICENSE.md +1 -1
- data/lib/measures/CoilHeatingWaterPercentChange/measure.rb +1 -1
- data/lib/measures/CoilHeatingWaterPercentChange/measure.xml +14 -13
- data/lib/measures/ConstructionLayerZeroMaterialProperties/LICENSE.md +1 -1
- data/lib/measures/ConstructionLayerZeroMaterialProperties/measure.rb +1 -1
- data/lib/measures/ConstructionLayerZeroMaterialProperties/measure.xml +12 -11
- data/lib/measures/ElectricBaseboardEfficiencyAndCapacity/LICENSE.md +1 -1
- data/lib/measures/ElectricBaseboardEfficiencyAndCapacity/measure.rb +1 -1
- data/lib/measures/ElectricBaseboardEfficiencyAndCapacity/measure.xml +12 -11
- data/lib/measures/ExteriorWallThermalPropertiesMultiplier/LICENSE.md +1 -1
- data/lib/measures/ExteriorWallThermalPropertiesMultiplier/measure.rb +3 -3
- data/lib/measures/ExteriorWallThermalPropertiesMultiplier/measure.xml +24 -11
- data/lib/measures/ExteriorWallThermalPropertiesPercentChange/LICENSE.md +1 -1
- data/lib/measures/ExteriorWallThermalPropertiesPercentChange/measure.rb +3 -3
- data/lib/measures/ExteriorWallThermalPropertiesPercentChange/measure.xml +24 -11
- data/lib/measures/FansMultiplier/LICENSE.md +1 -1
- data/lib/measures/FansMultiplier/measure.rb +1 -1
- data/lib/measures/FansMultiplier/measure.xml +14 -13
- data/lib/measures/FansPercentChange/LICENSE.md +1 -1
- data/lib/measures/FansPercentChange/measure.rb +1 -1
- data/lib/measures/FansPercentChange/measure.xml +14 -13
- data/lib/measures/GeneralCalibrationMeasureMultiplier/LICENSE.md +1 -1
- data/lib/measures/GeneralCalibrationMeasureMultiplier/measure.rb +1 -1
- data/lib/measures/GeneralCalibrationMeasureMultiplier/measure.xml +16 -15
- data/lib/measures/GeneralCalibrationMeasurePercentChange/LICENSE.md +1 -1
- data/lib/measures/GeneralCalibrationMeasurePercentChange/measure.rb +1 -1
- data/lib/measures/GeneralCalibrationMeasurePercentChange/measure.xml +16 -15
- data/lib/measures/HardSizeHvac/LICENSE.md +1 -1
- data/lib/measures/HardSizeHvac/measure.rb +1 -1
- data/lib/measures/HardSizeHvac/measure.xml +13 -12
- data/lib/measures/RValueOfInsulationForConstructionMultiplier/LICENSE.md +1 -1
- data/lib/measures/RValueOfInsulationForConstructionMultiplier/measure.rb +1 -1
- data/lib/measures/RValueOfInsulationForConstructionMultiplier/measure.xml +12 -11
- data/lib/measures/RValueOfInsulationForConstructionPercentageChange/LICENSE.md +1 -1
- data/lib/measures/RValueOfInsulationForConstructionPercentageChange/measure.rb +1 -1
- data/lib/measures/RValueOfInsulationForConstructionPercentageChange/measure.xml +12 -11
- data/lib/measures/RoofThermalPropertiesMultiplier/LICENSE.md +1 -1
- data/lib/measures/RoofThermalPropertiesMultiplier/measure.rb +3 -3
- data/lib/measures/RoofThermalPropertiesMultiplier/measure.xml +24 -11
- data/lib/measures/RoofThermalPropertiesPercentChange/LICENSE.md +1 -1
- data/lib/measures/RoofThermalPropertiesPercentChange/measure.rb +3 -3
- data/lib/measures/RoofThermalPropertiesPercentChange/measure.xml +24 -11
- data/lib/measures/TimeseriesObjectiveFunction/LICENSE.md +1 -1
- data/lib/measures/TimeseriesObjectiveFunction/README.md +5 -171
- data/lib/measures/TimeseriesObjectiveFunction/measure.rb +3 -7
- data/lib/measures/TimeseriesObjectiveFunction/measure.xml +84 -9
- data/lib/measures/TimeseriesObjectiveFunction/resources/report.html.erb +6 -1
- data/lib/measures/TimeseriesPlot/LICENSE.md +1 -1
- data/lib/measures/TimeseriesPlot/README.md +5 -35
- data/lib/measures/TimeseriesPlot/measure.rb +1 -1
- data/lib/measures/TimeseriesPlot/measure.xml +28 -13
- data/lib/measures/TimeseriesPlot/resources/report.html.erb +6 -1
- data/lib/measures/WaterHeaterMixedMultiplier/LICENSE.md +1 -1
- data/lib/measures/WaterHeaterMixedMultiplier/measure.rb +1 -1
- data/lib/measures/WaterHeaterMixedMultiplier/measure.xml +14 -13
- data/lib/measures/WaterHeaterMixedPercentChange/LICENSE.md +1 -1
- data/lib/measures/WaterHeaterMixedPercentChange/measure.rb +1 -1
- data/lib/measures/WaterHeaterMixedPercentChange/measure.xml +14 -13
- data/lib/measures/{CalibrationReportsEnhanced21 → inspect_and_edit_parametric_schedules}/LICENSE.md +1 -1
- data/lib/measures/inspect_and_edit_parametric_schedules/README.md +41 -0
- data/lib/measures/{zone_report → inspect_and_edit_parametric_schedules}/README.md.erb +12 -1
- data/lib/measures/inspect_and_edit_parametric_schedules/docs/.gitkeep +0 -0
- data/lib/measures/inspect_and_edit_parametric_schedules/docs/apply_measures_now.png +0 -0
- data/lib/measures/inspect_and_edit_parametric_schedules/measure.rb +224 -0
- data/lib/measures/inspect_and_edit_parametric_schedules/measure.xml +125 -0
- data/lib/measures/{zone_report → shift_hours_of_operation}/LICENSE.md +1 -1
- data/lib/measures/shift_hours_of_operation/README.md +147 -0
- data/lib/measures/{MaalkaMonthlyJSONUtilityData → shift_hours_of_operation}/README.md.erb +5 -0
- data/lib/measures/shift_hours_of_operation/docs/.gitkeep +0 -0
- data/lib/measures/shift_hours_of_operation/measure.rb +525 -0
- data/lib/measures/shift_hours_of_operation/measure.xml +280 -0
- data/lib/openstudio/{calibration_measures → calibration}/extension.rb +2 -2
- data/lib/openstudio/{calibration_measures → calibration}/version.rb +3 -3
- data/lib/openstudio/{calibration_measures.rb → calibration.rb} +3 -3
- data/lib/{openstudio-calibration-measures.rb → openstudio-calibration.rb} +2 -2
- data/openstudio-calibration.gemspec +38 -0
- metadata +50 -61
- data/lib/measures/AddMonthlyUtilityData/tests/AddMonthlyUtilityData_Test.rb +0 -88
- data/lib/measures/AddMonthlyUtilityData/tests/electric_billed_usages.json +0 -198
- data/lib/measures/AddMonthlyUtilityData/tests/gas_billed_usages.json +0 -198
- data/lib/measures/CalibrationReports/tests/CalibrationReports_Test.rb +0 -523
- data/lib/measures/CalibrationReports/tests/ExampleModel.osm +0 -10497
- data/lib/measures/CalibrationReports/tests/ExampleModelNoDemandInput.osm +0 -10560
- data/lib/measures/CalibrationReports/tests/ExampleModelNoGasInput.osm +0 -10456
- data/lib/measures/CalibrationReports/tests/USA_CO_Golden-NREL.724666_TMY3.epw +0 -8768
- data/lib/measures/CalibrationReportsEnhanced/tests/CalibrationReportsEnhanced_Test.rb +0 -734
- data/lib/measures/CalibrationReportsEnhanced/tests/ExampleModel.osm +0 -10497
- data/lib/measures/CalibrationReportsEnhanced/tests/ExampleModel_FuelOil.osm +0 -12740
- data/lib/measures/CalibrationReportsEnhanced/tests/USA_CO_Golden-NREL.724666_TMY3.epw +0 -8768
- data/lib/measures/CalibrationReportsEnhanced21/README.md +0 -109
- data/lib/measures/CalibrationReportsEnhanced21/README.md.erb +0 -42
- data/lib/measures/CalibrationReportsEnhanced21/measure.rb +0 -690
- data/lib/measures/CalibrationReportsEnhanced21/measure.xml +0 -269
- data/lib/measures/CalibrationReportsEnhanced21/resources/report.html.in +0 -380
- data/lib/measures/MaalkaMonthlyJSONUtilityData/LICENSE.md +0 -27
- data/lib/measures/MaalkaMonthlyJSONUtilityData/README.md +0 -104
- data/lib/measures/MaalkaMonthlyJSONUtilityData/measure.rb +0 -304
- data/lib/measures/MaalkaMonthlyJSONUtilityData/measure.xml +0 -216
- data/lib/measures/zone_report/README.md +0 -26
- data/lib/measures/zone_report/measure.rb +0 -706
- data/lib/measures/zone_report/measure.xml +0 -67
- data/lib/measures/zone_report/resources/report.html.in +0 -342
- data/openstudio-calibration-measures.gemspec +0 -30
@@ -1,523 +0,0 @@
|
|
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 'openstudio'
|
37
|
-
require 'openstudio/measure/ShowRunnerOutput'
|
38
|
-
require 'fileutils'
|
39
|
-
|
40
|
-
require_relative '../measure.rb'
|
41
|
-
require 'minitest/autorun'
|
42
|
-
|
43
|
-
class CalibrationReports_Test < Minitest::Test
|
44
|
-
def is_openstudio_2?
|
45
|
-
begin
|
46
|
-
workflow = OpenStudio::WorkflowJSON.new
|
47
|
-
rescue StandardError
|
48
|
-
return false
|
49
|
-
end
|
50
|
-
true
|
51
|
-
end
|
52
|
-
|
53
|
-
def model_in_path_default
|
54
|
-
"#{File.dirname(__FILE__)}/ExampleModel.osm"
|
55
|
-
end
|
56
|
-
|
57
|
-
def epw_path_default
|
58
|
-
# make sure we have a weather data location
|
59
|
-
epw = nil
|
60
|
-
epw = OpenStudio::Path.new("#{File.dirname(__FILE__)}/USA_CO_Golden-NREL.724666_TMY3.epw")
|
61
|
-
assert(File.exist?(epw.to_s))
|
62
|
-
epw.to_s
|
63
|
-
end
|
64
|
-
|
65
|
-
def run_dir(test_name)
|
66
|
-
# always generate test output in specially named 'output' directory so result files are not made part of the measure
|
67
|
-
"#{File.dirname(__FILE__)}/output/#{test_name}"
|
68
|
-
end
|
69
|
-
|
70
|
-
def model_out_path(test_name)
|
71
|
-
"#{run_dir(test_name)}/TestOutput.osm"
|
72
|
-
end
|
73
|
-
|
74
|
-
def workspace_path(test_name)
|
75
|
-
if is_openstudio_2?
|
76
|
-
"#{run_dir(test_name)}/run/in.idf"
|
77
|
-
else
|
78
|
-
"#{run_dir(test_name)}/ModelToIdf/in.idf"
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
def sql_path(test_name)
|
83
|
-
if is_openstudio_2?
|
84
|
-
"#{run_dir(test_name)}/run/eplusout.sql"
|
85
|
-
else
|
86
|
-
"#{run_dir(test_name)}/ModelToIdf/EnergyPlusPreProcess-0/EnergyPlus-0/eplusout.sql"
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
def report_path(test_name)
|
91
|
-
"#{run_dir(test_name)}/report.html"
|
92
|
-
end
|
93
|
-
|
94
|
-
# method for running the test simulation using OpenStudio 1.x API
|
95
|
-
def setup_test_1(test_name, epw_path)
|
96
|
-
co = OpenStudio::Runmanager::ConfigOptions.new(true)
|
97
|
-
co.findTools(false, true, false, true)
|
98
|
-
|
99
|
-
unless File.exist?(sql_path(test_name))
|
100
|
-
puts 'Running EnergyPlus'
|
101
|
-
|
102
|
-
wf = OpenStudio::Runmanager::Workflow.new('modeltoidf->energypluspreprocess->energyplus')
|
103
|
-
wf.add(co.getTools)
|
104
|
-
job = wf.create(OpenStudio::Path.new(run_dir(test_name)), OpenStudio::Path.new(model_out_path(test_name)), OpenStudio::Path.new(epw_path))
|
105
|
-
|
106
|
-
rm = OpenStudio::Runmanager::RunManager.new
|
107
|
-
rm.enqueue(job, true)
|
108
|
-
rm.waitForFinished
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
# method for running the test simulation using OpenStudio 2.x API
|
113
|
-
def setup_test_2(test_name, epw_path)
|
114
|
-
osw_path = File.join(run_dir(test_name), 'in.osw')
|
115
|
-
osw_path = File.absolute_path(osw_path)
|
116
|
-
|
117
|
-
workflow = OpenStudio::WorkflowJSON.new
|
118
|
-
workflow.setSeedFile(File.absolute_path(model_out_path(test_name)))
|
119
|
-
workflow.setWeatherFile(File.absolute_path(epw_path))
|
120
|
-
workflow.saveAs(osw_path)
|
121
|
-
|
122
|
-
cli_path = OpenStudio.getOpenStudioCLI
|
123
|
-
cmd = "\"#{cli_path}\" run -w \"#{osw_path}\""
|
124
|
-
puts cmd
|
125
|
-
system(cmd)
|
126
|
-
end
|
127
|
-
|
128
|
-
# create test files if they do not exist when the test first runs
|
129
|
-
def setup_test(test_name, idf_output_requests, model_in_path = model_in_path_default, epw_path = epw_path_default)
|
130
|
-
FileUtils.mkdir_p(run_dir(test_name)) unless File.exist?(run_dir(test_name))
|
131
|
-
assert(File.exist?(run_dir(test_name)))
|
132
|
-
|
133
|
-
FileUtils.rm(report_path(test_name)) if File.exist?(report_path(test_name))
|
134
|
-
|
135
|
-
assert(File.exist?(model_in_path))
|
136
|
-
|
137
|
-
if File.exist?(model_out_path(test_name))
|
138
|
-
FileUtils.rm(model_out_path(test_name))
|
139
|
-
end
|
140
|
-
|
141
|
-
# convert output requests to OSM for testing, OS App and PAT will add these to the E+ Idf
|
142
|
-
workspace = OpenStudio::Workspace.new('Draft'.to_StrictnessLevel, 'EnergyPlus'.to_IddFileType)
|
143
|
-
workspace.addObjects(idf_output_requests)
|
144
|
-
rt = OpenStudio::EnergyPlus::ReverseTranslator.new
|
145
|
-
request_model = rt.translateWorkspace(workspace)
|
146
|
-
|
147
|
-
translator = OpenStudio::OSVersion::VersionTranslator.new
|
148
|
-
model = translator.loadModel(model_in_path)
|
149
|
-
assert(!model.empty?)
|
150
|
-
model = model.get
|
151
|
-
model.addObjects(request_model.objects)
|
152
|
-
model.save(model_out_path(test_name), true)
|
153
|
-
|
154
|
-
if ENV['OPENSTUDIO_TEST_NO_CACHE_SQLFILE']
|
155
|
-
FileUtils.rm_f(sql_path(test_name)) if File.exist?(sql_path(test_name))
|
156
|
-
end
|
157
|
-
|
158
|
-
if is_openstudio_2?
|
159
|
-
setup_test_2(test_name, epw_path)
|
160
|
-
else
|
161
|
-
setup_test_1(test_name, epw_path)
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
# calibration_reports
|
166
|
-
def test_CalibrationReports
|
167
|
-
test_name = 'calibration_reports'
|
168
|
-
model_in_path = "#{File.dirname(__FILE__)}/ExampleModel.osm"
|
169
|
-
|
170
|
-
# create an instance of the measure
|
171
|
-
measure = CalibrationReports.new
|
172
|
-
|
173
|
-
# create an instance of a runner
|
174
|
-
runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)
|
175
|
-
|
176
|
-
# get arguments
|
177
|
-
arguments = measure.arguments
|
178
|
-
argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments)
|
179
|
-
|
180
|
-
# create hash of argument values
|
181
|
-
args_hash = {}
|
182
|
-
|
183
|
-
# populate argument with specified hash value if specified
|
184
|
-
arguments.each do |arg|
|
185
|
-
temp_arg_var = arg.clone
|
186
|
-
assert(temp_arg_var.setValue(args_hash[arg.name])) if args_hash[arg.name]
|
187
|
-
argument_map[arg.name] = temp_arg_var
|
188
|
-
end
|
189
|
-
|
190
|
-
# get the energyplus output requests, this will be done automatically by OS App and PAT
|
191
|
-
idf_output_requests = measure.energyPlusOutputRequests(runner, argument_map)
|
192
|
-
assert_equal(0, idf_output_requests.size)
|
193
|
-
|
194
|
-
# mimic the process of running this measure in OS App or PAT. Optionally set custom model_in_path and custom epw_path.
|
195
|
-
epw_path = epw_path_default
|
196
|
-
setup_test(test_name, idf_output_requests)
|
197
|
-
|
198
|
-
assert(File.exist?(model_out_path(test_name)))
|
199
|
-
assert(File.exist?(sql_path(test_name)))
|
200
|
-
assert(File.exist?(epw_path))
|
201
|
-
|
202
|
-
# set up runner, this will happen automatically when measure is run in PAT or OpenStudio
|
203
|
-
runner.setLastOpenStudioModelPath(OpenStudio::Path.new(model_out_path(test_name)))
|
204
|
-
runner.setLastEnergyPlusWorkspacePath(OpenStudio::Path.new(workspace_path(test_name)))
|
205
|
-
runner.setLastEpwFilePath(epw_path)
|
206
|
-
runner.setLastEnergyPlusSqlFilePath(OpenStudio::Path.new(sql_path(test_name)))
|
207
|
-
|
208
|
-
# delete the output if it exists
|
209
|
-
FileUtils.rm(report_path(test_name)) if File.exist?(report_path(test_name))
|
210
|
-
assert(!File.exist?(report_path(test_name)))
|
211
|
-
|
212
|
-
# temporarily change directory to the run directory and run the measure
|
213
|
-
start_dir = Dir.pwd
|
214
|
-
begin
|
215
|
-
Dir.chdir(run_dir(test_name))
|
216
|
-
|
217
|
-
# run the measure
|
218
|
-
measure.run(runner, argument_map)
|
219
|
-
result = runner.result
|
220
|
-
show_output(result)
|
221
|
-
assert_equal('Success', result.value.valueName)
|
222
|
-
assert(result.warnings.empty?)
|
223
|
-
ensure
|
224
|
-
Dir.chdir(start_dir)
|
225
|
-
end
|
226
|
-
|
227
|
-
model = runner.lastOpenStudioModel
|
228
|
-
assert(!model.empty?)
|
229
|
-
model = model.get
|
230
|
-
|
231
|
-
sqlFile = runner.lastEnergyPlusSqlFile
|
232
|
-
assert(!sqlFile.empty?)
|
233
|
-
sqlFile = sqlFile.get
|
234
|
-
|
235
|
-
model.setSqlFile(sqlFile)
|
236
|
-
|
237
|
-
# must have a runPeriod
|
238
|
-
runPeriod = model.runPeriod
|
239
|
-
assert(!runPeriod.empty?)
|
240
|
-
|
241
|
-
# must have a calendarYear
|
242
|
-
yearDescription = model.yearDescription
|
243
|
-
assert(!yearDescription.empty?)
|
244
|
-
calendarYear = yearDescription.get.calendarYear
|
245
|
-
assert(!calendarYear.empty?)
|
246
|
-
|
247
|
-
# check for varying demand
|
248
|
-
model.getUtilityBills.each do |utilityBill|
|
249
|
-
next if utilityBill.peakDemandUnitConversionFactor.empty?
|
250
|
-
hasVaryingDemand = false
|
251
|
-
modelPeakDemand = 0.0
|
252
|
-
count = 0
|
253
|
-
utilityBill.billingPeriods.each do |billingPeriod|
|
254
|
-
peakDemand = billingPeriod.modelPeakDemand
|
255
|
-
next if peakDemand.empty?
|
256
|
-
temp = peakDemand.get
|
257
|
-
if count == 0
|
258
|
-
modelPeakDemand = temp
|
259
|
-
else
|
260
|
-
if modelPeakDemand != temp
|
261
|
-
hasVaryingDemand = true
|
262
|
-
break
|
263
|
-
end
|
264
|
-
end
|
265
|
-
count += 1
|
266
|
-
end
|
267
|
-
assert(hasVaryingDemand) if count > 1
|
268
|
-
end
|
269
|
-
|
270
|
-
# make sure the report file exists
|
271
|
-
assert(File.exist?(report_path(test_name)))
|
272
|
-
end
|
273
|
-
|
274
|
-
# calibration_reports_no_gas
|
275
|
-
def test_CalibrationReports_NoGas
|
276
|
-
test_name = 'calibration_reports_no_gas'
|
277
|
-
|
278
|
-
# # load model, remove gas bills, save to new file
|
279
|
-
# raw_model_path = "#{File.dirname(__FILE__)}/ExampleModel.osm"
|
280
|
-
# vt = OpenStudio::OSVersion::VersionTranslator.new
|
281
|
-
# model = vt.loadModel(raw_model_path)
|
282
|
-
# assert(!model.empty?)
|
283
|
-
# model = model.get
|
284
|
-
# utilityBills = model.getUtilityBills
|
285
|
-
# assert_equal(2, utilityBills.size)
|
286
|
-
# utilityBills.each do |utilityBill|
|
287
|
-
# if utilityBill.fuelType == 'Gas'.to_FuelType
|
288
|
-
# utilityBill.remove
|
289
|
-
# end
|
290
|
-
# end
|
291
|
-
# utilityBills = model.getUtilityBills
|
292
|
-
# assert_equal(1, utilityBills.size)
|
293
|
-
# altered_model_path = OpenStudio::Path.new("#{run_dir(test_name)}/ExampleModelNoGasInput.osm")
|
294
|
-
# model.save(altered_model_path, true)
|
295
|
-
#
|
296
|
-
# # set model_in_path to new altered copy of model
|
297
|
-
# model_in_path = altered_model_path
|
298
|
-
|
299
|
-
# dynamically generated test model creating issues on CI, so using pre-made test model for now.
|
300
|
-
model_in_path = "#{File.dirname(__FILE__)}/ExampleModelNoGasInput.osm"
|
301
|
-
|
302
|
-
# create an instance of the measure
|
303
|
-
measure = CalibrationReports.new
|
304
|
-
|
305
|
-
# create an instance of a runner
|
306
|
-
runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)
|
307
|
-
|
308
|
-
# get arguments
|
309
|
-
arguments = measure.arguments
|
310
|
-
argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments)
|
311
|
-
|
312
|
-
# create hash of argument values
|
313
|
-
args_hash = {}
|
314
|
-
|
315
|
-
# populate argument with specified hash value if specified
|
316
|
-
arguments.each do |arg|
|
317
|
-
temp_arg_var = arg.clone
|
318
|
-
assert(temp_arg_var.setValue(args_hash[arg.name])) if args_hash[arg.name]
|
319
|
-
argument_map[arg.name] = temp_arg_var
|
320
|
-
end
|
321
|
-
|
322
|
-
# get the energyplus output requests, this will be done automatically by OS App and PAT
|
323
|
-
idf_output_requests = measure.energyPlusOutputRequests(runner, argument_map)
|
324
|
-
assert_equal(0, idf_output_requests.size)
|
325
|
-
|
326
|
-
# mimic the process of running this measure in OS App or PAT. Optionally set custom model_in_path and custom epw_path.
|
327
|
-
epw_path = epw_path_default
|
328
|
-
sleep = 4 # try adding sleep for stability when test model is being created within test fails inconsistently
|
329
|
-
setup_test(test_name, idf_output_requests, model_in_path.to_s)
|
330
|
-
|
331
|
-
assert(File.exist?(model_out_path(test_name)))
|
332
|
-
assert(File.exist?(sql_path(test_name)))
|
333
|
-
assert(File.exist?(epw_path))
|
334
|
-
|
335
|
-
# set up runner, this will happen automatically when measure is run in PAT or OpenStudio
|
336
|
-
runner.setLastOpenStudioModelPath(OpenStudio::Path.new(model_out_path(test_name)))
|
337
|
-
runner.setLastEnergyPlusWorkspacePath(OpenStudio::Path.new(workspace_path(test_name)))
|
338
|
-
runner.setLastEpwFilePath(epw_path)
|
339
|
-
runner.setLastEnergyPlusSqlFilePath(OpenStudio::Path.new(sql_path(test_name)))
|
340
|
-
|
341
|
-
# delete the output if it exists
|
342
|
-
FileUtils.rm(report_path(test_name)) if File.exist?(report_path(test_name))
|
343
|
-
assert(!File.exist?(report_path(test_name)))
|
344
|
-
|
345
|
-
# temporarily change directory to the run directory and run the measure
|
346
|
-
start_dir = Dir.pwd
|
347
|
-
begin
|
348
|
-
Dir.chdir(run_dir(test_name))
|
349
|
-
|
350
|
-
# run the measure
|
351
|
-
measure.run(runner, argument_map)
|
352
|
-
result = runner.result
|
353
|
-
show_output(result)
|
354
|
-
assert_equal('Success', result.value.valueName)
|
355
|
-
assert(result.warnings.empty?)
|
356
|
-
ensure
|
357
|
-
Dir.chdir(start_dir)
|
358
|
-
end
|
359
|
-
|
360
|
-
model = runner.lastOpenStudioModel
|
361
|
-
assert(!model.empty?)
|
362
|
-
model = model.get
|
363
|
-
|
364
|
-
sqlFile = runner.lastEnergyPlusSqlFile
|
365
|
-
assert(!sqlFile.empty?)
|
366
|
-
sqlFile = sqlFile.get
|
367
|
-
|
368
|
-
model.setSqlFile(sqlFile)
|
369
|
-
|
370
|
-
# must have a runPeriod
|
371
|
-
runPeriod = model.runPeriod
|
372
|
-
assert(!runPeriod.empty?)
|
373
|
-
|
374
|
-
# must have a calendarYear
|
375
|
-
yearDescription = model.yearDescription
|
376
|
-
assert(!yearDescription.empty?)
|
377
|
-
calendarYear = yearDescription.get.calendarYear
|
378
|
-
assert(!calendarYear.empty?)
|
379
|
-
|
380
|
-
# check for varying demand
|
381
|
-
model.getUtilityBills.each do |utilityBill|
|
382
|
-
next if utilityBill.peakDemandUnitConversionFactor.empty?
|
383
|
-
hasVaryingDemand = false
|
384
|
-
modelPeakDemand = 0.0
|
385
|
-
count = 0
|
386
|
-
utilityBill.billingPeriods.each do |billingPeriod|
|
387
|
-
peakDemand = billingPeriod.modelPeakDemand
|
388
|
-
next if peakDemand.empty?
|
389
|
-
temp = peakDemand.get
|
390
|
-
if count == 0
|
391
|
-
modelPeakDemand = temp
|
392
|
-
else
|
393
|
-
if modelPeakDemand != temp
|
394
|
-
hasVaryingDemand = true
|
395
|
-
break
|
396
|
-
end
|
397
|
-
end
|
398
|
-
count += 1
|
399
|
-
end
|
400
|
-
assert(hasVaryingDemand) if count > 1
|
401
|
-
end
|
402
|
-
|
403
|
-
# make sure the report file exists
|
404
|
-
assert(File.exist?(report_path(test_name)))
|
405
|
-
end
|
406
|
-
|
407
|
-
# calibration_reports_no_gas
|
408
|
-
def test_CalibrationReports_NoDemand
|
409
|
-
test_name = 'calibration_reports_no_demand'
|
410
|
-
|
411
|
-
# # load model, remove gas bills, save to new file
|
412
|
-
# raw_model_path = "#{File.dirname(__FILE__)}/ExampleModel.osm"
|
413
|
-
# vt = OpenStudio::OSVersion::VersionTranslator.new
|
414
|
-
# model = vt.loadModel(raw_model_path)
|
415
|
-
# assert(!model.empty?)
|
416
|
-
# model = model.get
|
417
|
-
# utilityBills = model.getUtilityBills
|
418
|
-
# assert_equal(2, utilityBills.size)
|
419
|
-
# utilityBills.each do |utilityBill|
|
420
|
-
# if utilityBill.fuelType == 'Electricity'.to_FuelType
|
421
|
-
# utilityBill.billingPeriods.each(&:resetPeakDemand)
|
422
|
-
# end
|
423
|
-
# end
|
424
|
-
# utilityBills = model.getUtilityBills
|
425
|
-
# assert_equal(2, utilityBills.size)
|
426
|
-
# altered_model_path = OpenStudio::Path.new("#{run_dir(test_name)}/ExampleModelNoDemandInput.osm")
|
427
|
-
# model.save(altered_model_path, true)
|
428
|
-
#
|
429
|
-
# # set model_in_path to new altered copy of model
|
430
|
-
# model_in_path = altered_model_path
|
431
|
-
|
432
|
-
# dynamically generated test model creating issues on CI, so using pre-made test model for now.
|
433
|
-
model_in_path = "#{File.dirname(__FILE__)}/ExampleModelNoDemandInput.osm"
|
434
|
-
|
435
|
-
# create an instance of the measure
|
436
|
-
measure = CalibrationReports.new
|
437
|
-
|
438
|
-
# create an instance of a runner
|
439
|
-
runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)
|
440
|
-
|
441
|
-
# get arguments
|
442
|
-
arguments = measure.arguments
|
443
|
-
argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments)
|
444
|
-
|
445
|
-
# create hash of argument values
|
446
|
-
args_hash = {}
|
447
|
-
|
448
|
-
# populate argument with specified hash value if specified
|
449
|
-
arguments.each do |arg|
|
450
|
-
temp_arg_var = arg.clone
|
451
|
-
assert(temp_arg_var.setValue(args_hash[arg.name])) if args_hash[arg.name]
|
452
|
-
argument_map[arg.name] = temp_arg_var
|
453
|
-
end
|
454
|
-
|
455
|
-
# get the energyplus output requests, this will be done automatically by OS App and PAT
|
456
|
-
idf_output_requests = measure.energyPlusOutputRequests(runner, argument_map)
|
457
|
-
assert_equal(0, idf_output_requests.size)
|
458
|
-
|
459
|
-
# mimic the process of running this measure in OS App or PAT. Optionally set custom model_in_path and custom epw_path.
|
460
|
-
epw_path = epw_path_default
|
461
|
-
sleep = 4 # try adding sleep for stability when test model is being created within test fails inconsistently
|
462
|
-
setup_test(test_name, idf_output_requests, model_in_path.to_s)
|
463
|
-
|
464
|
-
assert(File.exist?(model_out_path(test_name)))
|
465
|
-
assert(File.exist?(sql_path(test_name)))
|
466
|
-
assert(File.exist?(epw_path))
|
467
|
-
|
468
|
-
# set up runner, this will happen automatically when measure is run in PAT or OpenStudio
|
469
|
-
runner.setLastOpenStudioModelPath(OpenStudio::Path.new(model_out_path(test_name)))
|
470
|
-
runner.setLastEnergyPlusWorkspacePath(OpenStudio::Path.new(workspace_path(test_name)))
|
471
|
-
runner.setLastEpwFilePath(epw_path)
|
472
|
-
runner.setLastEnergyPlusSqlFilePath(OpenStudio::Path.new(sql_path(test_name)))
|
473
|
-
|
474
|
-
# delete the output if it exists
|
475
|
-
FileUtils.rm(report_path(test_name)) if File.exist?(report_path(test_name))
|
476
|
-
assert(!File.exist?(report_path(test_name)))
|
477
|
-
|
478
|
-
# temporarily change directory to the run directory and run the measure
|
479
|
-
start_dir = Dir.pwd
|
480
|
-
begin
|
481
|
-
Dir.chdir(run_dir(test_name))
|
482
|
-
|
483
|
-
# run the measure
|
484
|
-
measure.run(runner, argument_map)
|
485
|
-
result = runner.result
|
486
|
-
show_output(result)
|
487
|
-
assert_equal('Success', result.value.valueName)
|
488
|
-
assert(result.warnings.empty?)
|
489
|
-
ensure
|
490
|
-
Dir.chdir(start_dir)
|
491
|
-
end
|
492
|
-
|
493
|
-
model = runner.lastOpenStudioModel
|
494
|
-
assert(!model.empty?)
|
495
|
-
model = model.get
|
496
|
-
|
497
|
-
sqlFile = runner.lastEnergyPlusSqlFile
|
498
|
-
assert(!sqlFile.empty?)
|
499
|
-
sqlFile = sqlFile.get
|
500
|
-
|
501
|
-
model.setSqlFile(sqlFile)
|
502
|
-
|
503
|
-
# must have a runPeriod
|
504
|
-
runPeriod = model.runPeriod
|
505
|
-
assert(!runPeriod.empty?)
|
506
|
-
|
507
|
-
# must have a calendarYear
|
508
|
-
yearDescription = model.yearDescription
|
509
|
-
assert(!yearDescription.empty?)
|
510
|
-
calendarYear = yearDescription.get.calendarYear
|
511
|
-
assert(!calendarYear.empty?)
|
512
|
-
|
513
|
-
# check for no demand
|
514
|
-
model.getUtilityBills.each do |utilityBill|
|
515
|
-
utilityBill.billingPeriods.each do |billingPeriod|
|
516
|
-
assert(billingPeriod.peakDemand.empty?)
|
517
|
-
end
|
518
|
-
end
|
519
|
-
|
520
|
-
# make sure the report file exists
|
521
|
-
assert(File.exist?(report_path(test_name)))
|
522
|
-
end
|
523
|
-
end
|