honeybee-openstudio 1.8.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.coveralls.yml +1 -1
- data/.gitignore +32 -32
- data/.releaserc.json +7 -7
- data/.travis.yml +44 -41
- data/Gemfile +18 -18
- data/LICENSE.md +23 -23
- data/README.md +95 -95
- data/Rakefile +20 -20
- data/doc_templates/LICENSE.md +23 -23
- data/doc_templates/copyright_erb.txt +31 -31
- data/doc_templates/copyright_js.txt +4 -4
- data/doc_templates/copyright_ruby.txt +29 -29
- data/honeybee-openstudio.gemspec +34 -35
- data/lib/files/Honeybee.rb +112 -112
- data/lib/files/honeybee_workflow.osw +47 -47
- data/lib/files/urbanopt_Gemfile +32 -32
- data/lib/from_honeybee.rb +85 -86
- data/lib/from_honeybee/_openapi/model.json +8691 -8126
- data/lib/from_honeybee/_openapi/simulation-parameter.json +983 -842
- data/lib/from_honeybee/construction/air.rb +64 -64
- data/lib/from_honeybee/construction/opaque.rb +76 -76
- data/lib/from_honeybee/construction/shade.rb +107 -107
- data/lib/from_honeybee/construction/window.rb +80 -80
- data/lib/from_honeybee/construction_set.rb +278 -278
- data/lib/from_honeybee/extension.rb +109 -109
- data/lib/from_honeybee/geometry/aperture.rb +167 -167
- data/lib/from_honeybee/geometry/door.rb +160 -160
- data/lib/from_honeybee/geometry/face.rb +163 -163
- data/lib/from_honeybee/geometry/room.rb +392 -392
- data/lib/from_honeybee/geometry/shade.rb +89 -89
- data/lib/from_honeybee/hvac/ideal_air.rb +150 -150
- data/lib/from_honeybee/load/electric_equipment.rb +95 -95
- data/lib/from_honeybee/load/gas_equipment.rb +97 -97
- data/lib/from_honeybee/load/infiltration.rb +94 -94
- data/lib/from_honeybee/load/lighting.rb +98 -98
- data/lib/from_honeybee/load/people.rb +99 -99
- data/lib/from_honeybee/load/setpoint_humidistat.rb +74 -74
- data/lib/from_honeybee/load/setpoint_thermostat.rb +71 -71
- data/lib/from_honeybee/load/ventilation.rb +95 -95
- data/lib/from_honeybee/material/opaque.rb +94 -94
- data/lib/from_honeybee/material/opaque_no_mass.rb +94 -94
- data/lib/from_honeybee/material/window_blind.rb +238 -238
- data/lib/from_honeybee/material/window_gas.rb +76 -76
- data/lib/from_honeybee/material/window_gas_custom.rb +118 -118
- data/lib/from_honeybee/material/window_gas_mixture.rb +79 -79
- data/lib/from_honeybee/material/window_glazing.rb +166 -166
- data/lib/from_honeybee/material/window_shade.rb +160 -160
- data/lib/from_honeybee/material/window_simpleglazsys.rb +73 -73
- data/lib/from_honeybee/model.rb +434 -434
- data/lib/from_honeybee/model_object.rb +110 -110
- data/lib/from_honeybee/program_type.rb +124 -124
- data/lib/from_honeybee/schedule/fixed_interval.rb +115 -115
- data/lib/from_honeybee/schedule/ruleset.rb +164 -164
- data/lib/from_honeybee/schedule/type_limit.rb +88 -88
- data/lib/from_honeybee/simulation/designday.rb +105 -105
- data/lib/from_honeybee/simulation/extension.rb +46 -46
- data/lib/from_honeybee/simulation/parameter.rb +316 -277
- data/lib/measures/from_honeybee_model/LICENSE.md +26 -26
- data/lib/measures/from_honeybee_model/README.md +32 -32
- data/lib/measures/from_honeybee_model/measure.rb +91 -91
- data/lib/measures/from_honeybee_model/measure.xml +103 -103
- data/lib/measures/from_honeybee_model/tests/from_honeybee_model_test.rb +126 -126
- data/lib/measures/from_honeybee_simulation_parameter/LICENSE.md +26 -26
- data/lib/measures/from_honeybee_simulation_parameter/README.md +32 -32
- data/lib/measures/from_honeybee_simulation_parameter/measure.rb +95 -95
- data/lib/measures/from_honeybee_simulation_parameter/measure.xml +91 -91
- data/lib/measures/from_honeybee_simulation_parameter/tests/from_honeybee_simulation_parameter_test.rb +109 -109
- metadata +13 -15
- data/lib/from_honeybee/version.rb +0 -34
@@ -1,91 +1,91 @@
|
|
1
|
-
<measure>
|
2
|
-
<schema_version>3.0</schema_version>
|
3
|
-
<name>from_honeybee_simulation_parameter</name>
|
4
|
-
<uid>a5f500d5-97ff-4048-a6f4-6b0b0a92d0f0</uid>
|
5
|
-
<version_id>1e4bf088-594a-49b3-89c7-91acc7b10262</version_id>
|
6
|
-
<version_modified>20191221T003153Z</version_modified>
|
7
|
-
<xml_checksum>D8922A73</xml_checksum>
|
8
|
-
<class_name>FromHoneybeeSimulationParameter</class_name>
|
9
|
-
<display_name>From Honeybee Simulation Parameter</display_name>
|
10
|
-
<description>Add a JSON file of Honeybee Simulationtion Parameters to an OpenStudio Model.</description>
|
11
|
-
<modeler_description>Add a JSON file of Honeybee Simulationtion Parameters to an OpenStudio Model.</modeler_description>
|
12
|
-
<arguments>
|
13
|
-
<argument>
|
14
|
-
<name>simulation_parameter_json</name>
|
15
|
-
<display_name>Path to the Honeybee SimulationParameter JSON file</display_name>
|
16
|
-
<type>String</type>
|
17
|
-
<required>true</required>
|
18
|
-
<model_dependent>false</model_dependent>
|
19
|
-
</argument>
|
20
|
-
</arguments>
|
21
|
-
<outputs/>
|
22
|
-
<provenances/>
|
23
|
-
<tags>
|
24
|
-
<tag>Whole Building.Space Types</tag>
|
25
|
-
</tags>
|
26
|
-
<attributes>
|
27
|
-
<attribute>
|
28
|
-
<name>Measure Type</name>
|
29
|
-
<value>ModelMeasure</value>
|
30
|
-
<datatype>string</datatype>
|
31
|
-
</attribute>
|
32
|
-
<attribute>
|
33
|
-
<name>Intended Software Tool</name>
|
34
|
-
<value>Apply Measure Now</value>
|
35
|
-
<datatype>string</datatype>
|
36
|
-
</attribute>
|
37
|
-
<attribute>
|
38
|
-
<name>Intended Software Tool</name>
|
39
|
-
<value>OpenStudio Application</value>
|
40
|
-
<datatype>string</datatype>
|
41
|
-
</attribute>
|
42
|
-
<attribute>
|
43
|
-
<name>Intended Software Tool</name>
|
44
|
-
<value>Parametric Analysis Tool</value>
|
45
|
-
<datatype>string</datatype>
|
46
|
-
</attribute>
|
47
|
-
</attributes>
|
48
|
-
<files>
|
49
|
-
<file>
|
50
|
-
<filename>LICENSE.md</filename>
|
51
|
-
<filetype>md</filetype>
|
52
|
-
<usage_type>license</usage_type>
|
53
|
-
<checksum>CD7F5672</checksum>
|
54
|
-
</file>
|
55
|
-
<file>
|
56
|
-
<filename>README.md</filename>
|
57
|
-
<filetype>md</filetype>
|
58
|
-
<usage_type>readme</usage_type>
|
59
|
-
<checksum>3D2FC3F1</checksum>
|
60
|
-
</file>
|
61
|
-
<file>
|
62
|
-
<version>
|
63
|
-
<software_program>OpenStudio</software_program>
|
64
|
-
<identifier>2.0.0</identifier>
|
65
|
-
<min_compatible>2.0.0</min_compatible>
|
66
|
-
</version>
|
67
|
-
<filename>measure.rb</filename>
|
68
|
-
<filetype>rb</filetype>
|
69
|
-
<usage_type>script</usage_type>
|
70
|
-
<checksum>52EE8F57</checksum>
|
71
|
-
</file>
|
72
|
-
<file>
|
73
|
-
<filename>from_honeybee_simulation_parameter_test.rb</filename>
|
74
|
-
<filetype>rb</filetype>
|
75
|
-
<usage_type>test</usage_type>
|
76
|
-
<checksum>F2F0C340</checksum>
|
77
|
-
</file>
|
78
|
-
<file>
|
79
|
-
<filename>simulation_par_detailed.json</filename>
|
80
|
-
<filetype>json</filetype>
|
81
|
-
<usage_type>test</usage_type>
|
82
|
-
<checksum>E2C31DBD</checksum>
|
83
|
-
</file>
|
84
|
-
<file>
|
85
|
-
<filename>simulation_par_simple.json</filename>
|
86
|
-
<filetype>json</filetype>
|
87
|
-
<usage_type>test</usage_type>
|
88
|
-
<checksum>E2C31DBD</checksum>
|
89
|
-
</file>
|
90
|
-
</files>
|
91
|
-
</measure>
|
1
|
+
<measure>
|
2
|
+
<schema_version>3.0</schema_version>
|
3
|
+
<name>from_honeybee_simulation_parameter</name>
|
4
|
+
<uid>a5f500d5-97ff-4048-a6f4-6b0b0a92d0f0</uid>
|
5
|
+
<version_id>1e4bf088-594a-49b3-89c7-91acc7b10262</version_id>
|
6
|
+
<version_modified>20191221T003153Z</version_modified>
|
7
|
+
<xml_checksum>D8922A73</xml_checksum>
|
8
|
+
<class_name>FromHoneybeeSimulationParameter</class_name>
|
9
|
+
<display_name>From Honeybee Simulation Parameter</display_name>
|
10
|
+
<description>Add a JSON file of Honeybee Simulationtion Parameters to an OpenStudio Model.</description>
|
11
|
+
<modeler_description>Add a JSON file of Honeybee Simulationtion Parameters to an OpenStudio Model.</modeler_description>
|
12
|
+
<arguments>
|
13
|
+
<argument>
|
14
|
+
<name>simulation_parameter_json</name>
|
15
|
+
<display_name>Path to the Honeybee SimulationParameter JSON file</display_name>
|
16
|
+
<type>String</type>
|
17
|
+
<required>true</required>
|
18
|
+
<model_dependent>false</model_dependent>
|
19
|
+
</argument>
|
20
|
+
</arguments>
|
21
|
+
<outputs/>
|
22
|
+
<provenances/>
|
23
|
+
<tags>
|
24
|
+
<tag>Whole Building.Space Types</tag>
|
25
|
+
</tags>
|
26
|
+
<attributes>
|
27
|
+
<attribute>
|
28
|
+
<name>Measure Type</name>
|
29
|
+
<value>ModelMeasure</value>
|
30
|
+
<datatype>string</datatype>
|
31
|
+
</attribute>
|
32
|
+
<attribute>
|
33
|
+
<name>Intended Software Tool</name>
|
34
|
+
<value>Apply Measure Now</value>
|
35
|
+
<datatype>string</datatype>
|
36
|
+
</attribute>
|
37
|
+
<attribute>
|
38
|
+
<name>Intended Software Tool</name>
|
39
|
+
<value>OpenStudio Application</value>
|
40
|
+
<datatype>string</datatype>
|
41
|
+
</attribute>
|
42
|
+
<attribute>
|
43
|
+
<name>Intended Software Tool</name>
|
44
|
+
<value>Parametric Analysis Tool</value>
|
45
|
+
<datatype>string</datatype>
|
46
|
+
</attribute>
|
47
|
+
</attributes>
|
48
|
+
<files>
|
49
|
+
<file>
|
50
|
+
<filename>LICENSE.md</filename>
|
51
|
+
<filetype>md</filetype>
|
52
|
+
<usage_type>license</usage_type>
|
53
|
+
<checksum>CD7F5672</checksum>
|
54
|
+
</file>
|
55
|
+
<file>
|
56
|
+
<filename>README.md</filename>
|
57
|
+
<filetype>md</filetype>
|
58
|
+
<usage_type>readme</usage_type>
|
59
|
+
<checksum>3D2FC3F1</checksum>
|
60
|
+
</file>
|
61
|
+
<file>
|
62
|
+
<version>
|
63
|
+
<software_program>OpenStudio</software_program>
|
64
|
+
<identifier>2.0.0</identifier>
|
65
|
+
<min_compatible>2.0.0</min_compatible>
|
66
|
+
</version>
|
67
|
+
<filename>measure.rb</filename>
|
68
|
+
<filetype>rb</filetype>
|
69
|
+
<usage_type>script</usage_type>
|
70
|
+
<checksum>52EE8F57</checksum>
|
71
|
+
</file>
|
72
|
+
<file>
|
73
|
+
<filename>from_honeybee_simulation_parameter_test.rb</filename>
|
74
|
+
<filetype>rb</filetype>
|
75
|
+
<usage_type>test</usage_type>
|
76
|
+
<checksum>F2F0C340</checksum>
|
77
|
+
</file>
|
78
|
+
<file>
|
79
|
+
<filename>simulation_par_detailed.json</filename>
|
80
|
+
<filetype>json</filetype>
|
81
|
+
<usage_type>test</usage_type>
|
82
|
+
<checksum>E2C31DBD</checksum>
|
83
|
+
</file>
|
84
|
+
<file>
|
85
|
+
<filename>simulation_par_simple.json</filename>
|
86
|
+
<filetype>json</filetype>
|
87
|
+
<usage_type>test</usage_type>
|
88
|
+
<checksum>E2C31DBD</checksum>
|
89
|
+
</file>
|
90
|
+
</files>
|
91
|
+
</measure>
|
@@ -1,109 +1,109 @@
|
|
1
|
-
# *******************************************************************************
|
2
|
-
# Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable
|
3
|
-
# Energy, LLC, Ladybug Tools LLC and other contributors. All rights reserved.
|
4
|
-
#
|
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
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS
|
20
|
-
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
21
|
-
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
22
|
-
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE
|
23
|
-
# UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF
|
24
|
-
# THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
25
|
-
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
26
|
-
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
27
|
-
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
28
|
-
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
29
|
-
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
-
# *******************************************************************************
|
31
|
-
|
32
|
-
require 'openstudio'
|
33
|
-
require 'openstudio/ruleset/ShowRunnerOutput'
|
34
|
-
require 'minitest/autorun'
|
35
|
-
require_relative '../measure.rb'
|
36
|
-
require 'fileutils'
|
37
|
-
|
38
|
-
class FromHoneybeeSimulationParameter_Test < Minitest::Test
|
39
|
-
# method to apply arguments, run measure, and assert results (only populate args hash with non-default argument values)
|
40
|
-
def apply_measure_to_model(test_name, args, model_name = nil, result_value = 'Success', warnings_count = 0, info_count = nil)
|
41
|
-
# create an instance of the measure
|
42
|
-
measure = FromHoneybeeSimulationParameter.new
|
43
|
-
|
44
|
-
# create an instance of a runner
|
45
|
-
runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)
|
46
|
-
|
47
|
-
if model_name.nil?
|
48
|
-
# make an empty model
|
49
|
-
model = OpenStudio::Model::Model.new
|
50
|
-
else
|
51
|
-
# load the test model
|
52
|
-
translator = OpenStudio::OSVersion::VersionTranslator.new
|
53
|
-
path = OpenStudio::Path.new(File.dirname(__FILE__) + '/' + model_name)
|
54
|
-
model = translator.loadModel(path)
|
55
|
-
assert(!model.empty?)
|
56
|
-
model = model.get
|
57
|
-
end
|
58
|
-
|
59
|
-
# get arguments
|
60
|
-
arguments = measure.arguments(model)
|
61
|
-
argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments)
|
62
|
-
|
63
|
-
# populate argument with specified hash value if specified
|
64
|
-
arguments.each do |arg|
|
65
|
-
temp_arg_var = arg.clone
|
66
|
-
if args.key?(arg.name)
|
67
|
-
assert(temp_arg_var.setValue(args[arg.name]), "could not set #{arg.name} to #{args[arg.name]}.")
|
68
|
-
end
|
69
|
-
argument_map[arg.name] = temp_arg_var
|
70
|
-
end
|
71
|
-
|
72
|
-
# run the measure
|
73
|
-
measure.run(model, runner, argument_map)
|
74
|
-
result = runner.result
|
75
|
-
|
76
|
-
# show the output
|
77
|
-
puts "measure results for #{test_name}"
|
78
|
-
show_output(result)
|
79
|
-
|
80
|
-
# assert that it ran correctly
|
81
|
-
if result_value.nil? then result_value = 'Success' end
|
82
|
-
assert_equal(result_value, result.value.valueName)
|
83
|
-
|
84
|
-
# check count of warning and info messages
|
85
|
-
unless info_count.nil? then assert(result.info.size == info_count) end
|
86
|
-
unless warnings_count.nil? then assert(result.warnings.size == warnings_count, "warning count (#{result.warnings.size}) did not match expectation (#{warnings_count})") end
|
87
|
-
|
88
|
-
# if 'Fail' passed in make sure at least one error message (while not typical there may be more than one message)
|
89
|
-
if result_value == 'Fail' then assert(result.errors.size >= 1) end
|
90
|
-
|
91
|
-
# save the model to test output directory
|
92
|
-
output_file_path = OpenStudio::Path.new(File.dirname(__FILE__) + "/output/#{test_name}_test_output.osm")
|
93
|
-
model.save(output_file_path, true)
|
94
|
-
end
|
95
|
-
|
96
|
-
def test_simulation_par_simple
|
97
|
-
args = {}
|
98
|
-
args['simulation_parameter_json'] = File.join(File.dirname(__FILE__) +
|
99
|
-
"/../../../../spec/samples/simulation_parameter/simulation_par_simple.json")
|
100
|
-
apply_measure_to_model(__method__.to_s.gsub('test_',''),args, nil)
|
101
|
-
end
|
102
|
-
|
103
|
-
def test_simulation_par_detailed
|
104
|
-
args = {}
|
105
|
-
args['simulation_parameter_json'] = File.join(File.dirname(__FILE__) + "/../../../../spec/samples/simulation_parameter/simulation_par_detailed.json")
|
106
|
-
apply_measure_to_model(__method__.to_s.gsub('test_',''),args, nil)
|
107
|
-
end
|
108
|
-
|
109
|
-
end
|
1
|
+
# *******************************************************************************
|
2
|
+
# Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable
|
3
|
+
# Energy, LLC, Ladybug Tools LLC and other contributors. All rights reserved.
|
4
|
+
#
|
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
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS
|
20
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
21
|
+
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
22
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE
|
23
|
+
# UNITED STATES GOVERNMENT, OR THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF
|
24
|
+
# THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
25
|
+
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
26
|
+
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
27
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
28
|
+
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
29
|
+
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
30
|
+
# *******************************************************************************
|
31
|
+
|
32
|
+
require 'openstudio'
|
33
|
+
require 'openstudio/ruleset/ShowRunnerOutput'
|
34
|
+
require 'minitest/autorun'
|
35
|
+
require_relative '../measure.rb'
|
36
|
+
require 'fileutils'
|
37
|
+
|
38
|
+
class FromHoneybeeSimulationParameter_Test < Minitest::Test
|
39
|
+
# method to apply arguments, run measure, and assert results (only populate args hash with non-default argument values)
|
40
|
+
def apply_measure_to_model(test_name, args, model_name = nil, result_value = 'Success', warnings_count = 0, info_count = nil)
|
41
|
+
# create an instance of the measure
|
42
|
+
measure = FromHoneybeeSimulationParameter.new
|
43
|
+
|
44
|
+
# create an instance of a runner
|
45
|
+
runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)
|
46
|
+
|
47
|
+
if model_name.nil?
|
48
|
+
# make an empty model
|
49
|
+
model = OpenStudio::Model::Model.new
|
50
|
+
else
|
51
|
+
# load the test model
|
52
|
+
translator = OpenStudio::OSVersion::VersionTranslator.new
|
53
|
+
path = OpenStudio::Path.new(File.dirname(__FILE__) + '/' + model_name)
|
54
|
+
model = translator.loadModel(path)
|
55
|
+
assert(!model.empty?)
|
56
|
+
model = model.get
|
57
|
+
end
|
58
|
+
|
59
|
+
# get arguments
|
60
|
+
arguments = measure.arguments(model)
|
61
|
+
argument_map = OpenStudio::Measure.convertOSArgumentVectorToMap(arguments)
|
62
|
+
|
63
|
+
# populate argument with specified hash value if specified
|
64
|
+
arguments.each do |arg|
|
65
|
+
temp_arg_var = arg.clone
|
66
|
+
if args.key?(arg.name)
|
67
|
+
assert(temp_arg_var.setValue(args[arg.name]), "could not set #{arg.name} to #{args[arg.name]}.")
|
68
|
+
end
|
69
|
+
argument_map[arg.name] = temp_arg_var
|
70
|
+
end
|
71
|
+
|
72
|
+
# run the measure
|
73
|
+
measure.run(model, runner, argument_map)
|
74
|
+
result = runner.result
|
75
|
+
|
76
|
+
# show the output
|
77
|
+
puts "measure results for #{test_name}"
|
78
|
+
show_output(result)
|
79
|
+
|
80
|
+
# assert that it ran correctly
|
81
|
+
if result_value.nil? then result_value = 'Success' end
|
82
|
+
assert_equal(result_value, result.value.valueName)
|
83
|
+
|
84
|
+
# check count of warning and info messages
|
85
|
+
unless info_count.nil? then assert(result.info.size == info_count) end
|
86
|
+
unless warnings_count.nil? then assert(result.warnings.size == warnings_count, "warning count (#{result.warnings.size}) did not match expectation (#{warnings_count})") end
|
87
|
+
|
88
|
+
# if 'Fail' passed in make sure at least one error message (while not typical there may be more than one message)
|
89
|
+
if result_value == 'Fail' then assert(result.errors.size >= 1) end
|
90
|
+
|
91
|
+
# save the model to test output directory
|
92
|
+
output_file_path = OpenStudio::Path.new(File.dirname(__FILE__) + "/output/#{test_name}_test_output.osm")
|
93
|
+
model.save(output_file_path, true)
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_simulation_par_simple
|
97
|
+
args = {}
|
98
|
+
args['simulation_parameter_json'] = File.join(File.dirname(__FILE__) +
|
99
|
+
"/../../../../spec/samples/simulation_parameter/simulation_par_simple.json")
|
100
|
+
apply_measure_to_model(__method__.to_s.gsub('test_',''),args, nil)
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_simulation_par_detailed
|
104
|
+
args = {}
|
105
|
+
args['simulation_parameter_json'] = File.join(File.dirname(__FILE__) + "/../../../../spec/samples/simulation_parameter/simulation_par_detailed.json")
|
106
|
+
apply_measure_to_model(__method__.to_s.gsub('test_',''),args, nil)
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: honeybee-openstudio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tanushree Charan
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: exe
|
13
13
|
cert_chain: []
|
14
|
-
date: 2020-05-
|
14
|
+
date: 2020-05-28 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
@@ -19,42 +19,42 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - "~>"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '1
|
22
|
+
version: '2.1'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '1
|
29
|
+
version: '2.1'
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rake
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
requirements:
|
34
34
|
- - '='
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version:
|
36
|
+
version: '13.0'
|
37
37
|
type: :development
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - '='
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
43
|
+
version: '13.0'
|
44
44
|
- !ruby/object:Gem::Dependency
|
45
45
|
name: rspec
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
48
|
- - '='
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: 3.
|
50
|
+
version: '3.9'
|
51
51
|
type: :development
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
55
|
- - '='
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version: 3.
|
57
|
+
version: '3.9'
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rubocop
|
60
60
|
requirement: !ruby/object:Gem::Requirement
|
@@ -103,28 +103,28 @@ dependencies:
|
|
103
103
|
requirements:
|
104
104
|
- - '='
|
105
105
|
- !ruby/object:Gem::Version
|
106
|
-
version: 0.
|
106
|
+
version: 0.2.3
|
107
107
|
type: :runtime
|
108
108
|
prerelease: false
|
109
109
|
version_requirements: !ruby/object:Gem::Requirement
|
110
110
|
requirements:
|
111
111
|
- - '='
|
112
112
|
- !ruby/object:Gem::Version
|
113
|
-
version: 0.
|
113
|
+
version: 0.2.3
|
114
114
|
- !ruby/object:Gem::Dependency
|
115
115
|
name: openstudio-standards
|
116
116
|
requirement: !ruby/object:Gem::Requirement
|
117
117
|
requirements:
|
118
118
|
- - "~>"
|
119
119
|
- !ruby/object:Gem::Version
|
120
|
-
version: 0.2.
|
120
|
+
version: 0.2.11
|
121
121
|
type: :runtime
|
122
122
|
prerelease: false
|
123
123
|
version_requirements: !ruby/object:Gem::Requirement
|
124
124
|
requirements:
|
125
125
|
- - "~>"
|
126
126
|
- !ruby/object:Gem::Version
|
127
|
-
version: 0.2.
|
127
|
+
version: 0.2.11
|
128
128
|
- !ruby/object:Gem::Dependency
|
129
129
|
name: public_suffix
|
130
130
|
requirement: !ruby/object:Gem::Requirement
|
@@ -205,7 +205,6 @@ files:
|
|
205
205
|
- lib/from_honeybee/simulation/designday.rb
|
206
206
|
- lib/from_honeybee/simulation/extension.rb
|
207
207
|
- lib/from_honeybee/simulation/parameter.rb
|
208
|
-
- lib/from_honeybee/version.rb
|
209
208
|
- lib/measures/.gitkeep
|
210
209
|
- lib/measures/from_honeybee_model/LICENSE.md
|
211
210
|
- lib/measures/from_honeybee_model/README.md
|
@@ -235,8 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
235
234
|
- !ruby/object:Gem::Version
|
236
235
|
version: '0'
|
237
236
|
requirements: []
|
238
|
-
|
239
|
-
rubygems_version: 2.4.5.1
|
237
|
+
rubygems_version: 3.0.6
|
240
238
|
signing_key:
|
241
239
|
specification_version: 4
|
242
240
|
summary: Gem for translating between Honeybee JSON and OpenStudio Model.
|