honeybee-openstudio 2.12.1 → 2.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/honeybee-openstudio.gemspec +1 -1
- data/lib/files/urbanopt_Gemfile +1 -1
- data/lib/from_openstudio/material/opaque.rb +57 -0
- data/lib/from_openstudio/material/opaque_no_mass.rb +63 -0
- data/lib/from_openstudio/material/window_blind.rb +78 -0
- data/lib/from_openstudio/material/window_gas.rb +51 -0
- data/lib/from_openstudio/material/window_gas_custom.rb +94 -0
- data/lib/from_openstudio/material/window_gas_mixture.rb +70 -0
- data/lib/from_openstudio/material/window_glazing.rb +77 -0
- data/lib/from_openstudio/material/window_simpleglazsys.rb +55 -0
- data/lib/from_openstudio/model.rb +51 -0
- data/lib/measures/from_gbxml_model/LICENSE.md +23 -0
- data/lib/measures/from_gbxml_model/README.md +32 -0
- data/lib/measures/from_gbxml_model/measure.rb +114 -0
- data/lib/measures/from_gbxml_model/measure.xml +131 -0
- data/lib/measures/from_gbxml_model/tests/from_gbxml_model_test.rb +107 -0
- data/lib/measures/from_idf_model/LICENSE.md +23 -0
- data/lib/measures/from_idf_model/README.md +32 -0
- data/lib/measures/from_idf_model/measure.rb +114 -0
- data/lib/measures/from_idf_model/measure.xml +110 -0
- data/lib/measures/from_idf_model/tests/from_idf_model_test.rb +107 -0
- data/lib/measures/from_openstudio_model/LICENSE.md +23 -0
- data/lib/measures/from_openstudio_model/README.md +32 -0
- data/lib/measures/from_openstudio_model/measure.rb +114 -0
- data/lib/measures/from_openstudio_model/measure.xml +95 -0
- data/lib/measures/from_openstudio_model/tests/from_openstudio_model_test.rb +107 -0
- metadata +25 -2
@@ -0,0 +1,77 @@
|
|
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 'honeybee/material/window_glazing'
|
33
|
+
require 'to_openstudio/model_object'
|
34
|
+
|
35
|
+
module Honeybee
|
36
|
+
class EnergyWindowMaterialGlazing
|
37
|
+
|
38
|
+
def self.from_material(material)
|
39
|
+
# create an empty hash
|
40
|
+
hash = {}
|
41
|
+
hash[:type] = 'EnergyWindowMaterialGlazing'
|
42
|
+
# set hash values from OpenStudio Object
|
43
|
+
hash[:identifier] = material.nameString
|
44
|
+
hash[:thickness] = material.thickness
|
45
|
+
hash[:solar_transmittance] = material.solarTransmittance
|
46
|
+
# check if boost optional object is empty
|
47
|
+
unless material.frontSideSolarReflectanceatNormalIncidence.empty?
|
48
|
+
hash[:solar_reflectance] = material.frontSideSolarReflectanceatNormalIncidence.get
|
49
|
+
end
|
50
|
+
# check if boost optional object is empty
|
51
|
+
unless material.backSideSolarReflectanceatNormalIncidence.empty?
|
52
|
+
hash[:solar_reflectance_back] = material.backSideSolarReflectanceatNormalIncidence.get
|
53
|
+
end
|
54
|
+
# check if boost optional object is empty
|
55
|
+
unless material.visibleTransmittanceatNormalIncidence.empty?
|
56
|
+
hash[:visible_transmittance] = material.visibleTransmittanceatNormalIncidence.get
|
57
|
+
end
|
58
|
+
# check if boost optional object is empty
|
59
|
+
unless material.frontSideVisibleReflectanceatNormalIncidence.empty?
|
60
|
+
hash[:visible_reflectance] = material.frontSideVisibleReflectanceatNormalIncidence.get
|
61
|
+
end
|
62
|
+
# check if boost optional object is empty
|
63
|
+
unless material.backSideVisibleReflectanceatNormalIncidence.empty?
|
64
|
+
hash[:visible_reflectance_back] = material.backSideVisibleReflectanceatNormalIncidence
|
65
|
+
end
|
66
|
+
hash[:infrared_transmittance] = material.infraredTransmittance
|
67
|
+
hash[:emissivity] = material.frontSideInfraredHemisphericalEmissivity
|
68
|
+
hash[:emissivity_back] = material.backSideInfraredHemisphericalEmissivity
|
69
|
+
hash[:conductivity] = material.thermalConductivity
|
70
|
+
hash[:dirt_correction] = material.dirtCorrectionFactorforSolarandVisibleTransmittance
|
71
|
+
hash[:solar_diffusing] = material.solarDiffusing
|
72
|
+
|
73
|
+
hash
|
74
|
+
end
|
75
|
+
|
76
|
+
end # EnergyWindowMaterialGlazing
|
77
|
+
end # Honeybee
|
@@ -0,0 +1,55 @@
|
|
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 'honeybee/material/window_simpleglazsys'
|
33
|
+
require 'to_openstudio/model_object'
|
34
|
+
|
35
|
+
module Honeybee
|
36
|
+
class EnergyWindowMaterialSimpleGlazSys < ModelObject
|
37
|
+
|
38
|
+
def self.from_material(material)
|
39
|
+
# create an empty hash
|
40
|
+
hash = {}
|
41
|
+
hash[:type] = 'EnergyWindowMaterialSimpleGlazSys'
|
42
|
+
# set hash values from OpenStudio Object
|
43
|
+
hash[:identifier] = material.nameString
|
44
|
+
hash[:u_factor] = material.uFactor
|
45
|
+
hash[:shgc] = material.solarHeatGainCoefficient
|
46
|
+
# check if boost optional object is empty
|
47
|
+
unless material.visibleTransmittance.empty?
|
48
|
+
hash[:vt] = material.visibleTransmittance.get
|
49
|
+
end
|
50
|
+
|
51
|
+
hash
|
52
|
+
end
|
53
|
+
|
54
|
+
end # EnergyWindowMaterialSimpleGlazSys
|
55
|
+
end # Honeybee
|
@@ -33,6 +33,14 @@ require 'honeybee/model'
|
|
33
33
|
|
34
34
|
require 'from_openstudio/geometry/room'
|
35
35
|
require 'from_openstudio/geometry/shade'
|
36
|
+
require 'from_openstudio/material/opaque'
|
37
|
+
require 'from_openstudio/material/opaque_no_mass'
|
38
|
+
require 'from_openstudio/material/window_simpleglazsys'
|
39
|
+
require 'from_openstudio/material/window_glazing'
|
40
|
+
require 'from_openstudio/material/window_blind'
|
41
|
+
require 'from_openstudio/material/window_gas'
|
42
|
+
require 'from_openstudio/material/window_gas_custom'
|
43
|
+
require 'from_openstudio/material/window_gas_mixture'
|
36
44
|
|
37
45
|
require 'openstudio'
|
38
46
|
|
@@ -119,5 +127,48 @@ module Honeybee
|
|
119
127
|
result
|
120
128
|
end
|
121
129
|
|
130
|
+
# Create HB Material from OpenStudio Materials
|
131
|
+
def self.materials_from_model(openstudio_model)
|
132
|
+
result = []
|
133
|
+
|
134
|
+
# TODO: Loop through all materials and add puts statement for unsupported materials.
|
135
|
+
|
136
|
+
# Create HB EnergyMaterial from OpenStudio Material
|
137
|
+
openstudio_model.getStandardOpaqueMaterials.each do |material|
|
138
|
+
result << EnergyMaterial.from_material(material)
|
139
|
+
end
|
140
|
+
# Create HB EnergyMaterialNoMass from OpenStudio Material
|
141
|
+
openstudio_model.getMasslessOpaqueMaterials.each do |material|
|
142
|
+
result << EnergyMaterialNoMass.from_material(material)
|
143
|
+
end
|
144
|
+
# Create HB WindowMaterialSimpleGlazSys from OpenStudio Material
|
145
|
+
openstudio_model.getSimpleGlazings.each do |material|
|
146
|
+
result << EnergyWindowMaterialSimpleGlazSys.from_material(material)
|
147
|
+
end
|
148
|
+
# Create HB EnergyWindowMaterialGlazing from OpenStudio Material
|
149
|
+
openstudio_model.getStandardGlazings.each do |material|
|
150
|
+
result << EnergyWindowMaterialGlazing.from_material(material)
|
151
|
+
end
|
152
|
+
# Create HB EnergyWindowMaterialBlind from OpenStudio Material
|
153
|
+
openstudio_model.getBlinds.each do |material|
|
154
|
+
result << EnergyWindowMaterialBlind.from_material(material)
|
155
|
+
end
|
156
|
+
openstudio_model.getGass.each do |material|
|
157
|
+
# Create HB WindowGasCustom from OpenStudio Material
|
158
|
+
if material.gasType == 'Custom'
|
159
|
+
result << EnergyWindowMaterialGasCustom.from_material(material)
|
160
|
+
else
|
161
|
+
# Create HB WindowGas from OpenStudio Material
|
162
|
+
result << EnergyWindowMaterialGas.from_material(material)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
# Create HB EnergyWindowMaterialGasMixture from OpenStudio Material
|
166
|
+
openstudio_model.getGasMixtures.each do |material|
|
167
|
+
result << EnergyWindowMaterialGasMixture.from_material(material)
|
168
|
+
end
|
169
|
+
|
170
|
+
result
|
171
|
+
end
|
172
|
+
|
122
173
|
end # Model
|
123
174
|
end # Honeybee
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Honeybee OpenStudio Gem, Copyright (c) 2020, Alliance for Sustainable Energy, LLC,
|
2
|
+
Ladybug Tools LLC and other contributors. All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
5
|
+
following conditions are met:
|
6
|
+
|
7
|
+
(1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following
|
8
|
+
disclaimer.
|
9
|
+
|
10
|
+
(2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
|
11
|
+
disclaimer in the documentation and/or other materials provided with the distribution.
|
12
|
+
|
13
|
+
(3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products
|
14
|
+
derived from this software without specific prior written permission from the respective party.
|
15
|
+
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
17
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
18
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED
|
19
|
+
STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
20
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
21
|
+
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
22
|
+
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
23
|
+
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
###### (Automatically generated documentation)
|
4
|
+
|
5
|
+
# From gbXML Model
|
6
|
+
|
7
|
+
## Description
|
8
|
+
Translate a gbXML model into a JSON file of a Honeybee Model.
|
9
|
+
|
10
|
+
## Modeler Description
|
11
|
+
Translate a gbXML model into a JSON file of a Honeybee Model.
|
12
|
+
|
13
|
+
## Measure Type
|
14
|
+
ModelMeasure
|
15
|
+
|
16
|
+
## Taxonomy
|
17
|
+
|
18
|
+
|
19
|
+
## Arguments
|
20
|
+
|
21
|
+
|
22
|
+
### Path to the gbXML Model file
|
23
|
+
|
24
|
+
**Name:** gbxml_model,
|
25
|
+
**Type:** String,
|
26
|
+
**Units:** ,
|
27
|
+
**Required:** true,
|
28
|
+
**Model Dependent:** false
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
@@ -0,0 +1,114 @@
|
|
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
|
+
# see the URL below for information on how to write OpenStudio measures
|
33
|
+
# http://nrel.github.io/OpenStudio-user-documentation/reference/measure_writing_guide/
|
34
|
+
|
35
|
+
require 'from_openstudio'
|
36
|
+
|
37
|
+
# start the measure
|
38
|
+
class FromGbxmlModel < OpenStudio::Measure::ModelMeasure
|
39
|
+
# human readable name
|
40
|
+
def name
|
41
|
+
return "From Gbxml Model"
|
42
|
+
end
|
43
|
+
|
44
|
+
# human readable description
|
45
|
+
def description
|
46
|
+
return "Translate a gbXML into a JSON file of a Honeybee Model."
|
47
|
+
end
|
48
|
+
|
49
|
+
# human readable description of modeling approach
|
50
|
+
def modeler_description
|
51
|
+
return "Translate a gbXML into a JSON file of a Honeybee Model."
|
52
|
+
end
|
53
|
+
|
54
|
+
# define the arguments that the user will input
|
55
|
+
def arguments(model)
|
56
|
+
args = OpenStudio::Measure::OSArgumentVector.new
|
57
|
+
|
58
|
+
# Make an argument for the OpenStudio model
|
59
|
+
gbxml_model = OpenStudio::Measure::OSArgument.makeStringArgument('gbxml_model', true)
|
60
|
+
gbxml_model.setDisplayName('Path to the gbXML Model')
|
61
|
+
args << gbxml_model
|
62
|
+
|
63
|
+
# Make an argument for the output file path
|
64
|
+
output_file_path = OpenStudio::Measure::OSArgument.makeStringArgument('output_file_path', false)
|
65
|
+
output_file_path.setDisplayName('Output file path')
|
66
|
+
output_file_path.setDescription('If set, the output Honeybee JSON file will be exported to this path. Othervise The file will be exported to the same path as the gbXML model.')
|
67
|
+
output_file_path.setDefaultValue('')
|
68
|
+
args << output_file_path
|
69
|
+
|
70
|
+
return args
|
71
|
+
end
|
72
|
+
|
73
|
+
# define what happens when the measure is run
|
74
|
+
def run(model, runner, user_arguments)
|
75
|
+
super(model, runner, user_arguments)
|
76
|
+
STDOUT.flush
|
77
|
+
if !runner.validateUserArguments(arguments(model), user_arguments)
|
78
|
+
return false
|
79
|
+
end
|
80
|
+
|
81
|
+
gbxml_model = runner.getStringArgumentValue('gbxml_model', user_arguments)
|
82
|
+
|
83
|
+
gbxml_model_path, gbxml_model_name = File.split(gbxml_model)
|
84
|
+
honeybee_model_name = gbxml_model_name.split('.')[0] + '.hbjson'
|
85
|
+
|
86
|
+
if !File.exist?(gbxml_model)
|
87
|
+
runner.registerError("Cannot find file '#{gbxml_model}'")
|
88
|
+
return false
|
89
|
+
end
|
90
|
+
|
91
|
+
honeybee_model = Honeybee::Model.translate_from_gbxml_file(gbxml_model)
|
92
|
+
honeybee_hash = honeybee_model.hash
|
93
|
+
|
94
|
+
output_file_path = runner.getStringArgumentValue('output_file_path', user_arguments)
|
95
|
+
|
96
|
+
if output_file_path && !output_file_path.empty?
|
97
|
+
unless File.exist?(output_file_path)
|
98
|
+
output_folder = File.split(output_file_path)[0]
|
99
|
+
FileUtils.mkdir_p(output_folder)
|
100
|
+
end
|
101
|
+
else
|
102
|
+
output_file_path = File.join(gbxml_model_path, honeybee_model_name)
|
103
|
+
end
|
104
|
+
|
105
|
+
File.open(output_file_path, 'w') do |f|
|
106
|
+
f.puts JSON::pretty_generate(honeybee_hash)
|
107
|
+
end
|
108
|
+
|
109
|
+
return true
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
# register the measure to be used by the application
|
114
|
+
FromGbxmlModel.new.registerWithApplication
|
@@ -0,0 +1,131 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<measure>
|
3
|
+
<schema_version>3.0</schema_version>
|
4
|
+
<name>from_gbxml_model</name>
|
5
|
+
<uid>e4b3a388-3468-4962-a12e-e2e02bacb0a2</uid>
|
6
|
+
<version_id>0261fa70-1322-43ce-ae24-e6e65eb98f03</version_id>
|
7
|
+
<version_modified>20210428T160059Z</version_modified>
|
8
|
+
<xml_checksum>6BA95EF6</xml_checksum>
|
9
|
+
<class_name>FromGbxmlModel</class_name>
|
10
|
+
<display_name>From Gbxml Model</display_name>
|
11
|
+
<description>Translate a gbXML into a JSON file of a Honeybee Model.</description>
|
12
|
+
<modeler_description>Translate a gbXML into a JSON file of a Honeybee Model.</modeler_description>
|
13
|
+
<arguments>
|
14
|
+
<argument>
|
15
|
+
<name>model_json</name>
|
16
|
+
<display_name>Path to the Honeybee Model JSON file</display_name>
|
17
|
+
<description></description>
|
18
|
+
<type>String</type>
|
19
|
+
<units></units>
|
20
|
+
<required>true</required>
|
21
|
+
<model_dependent>false</model_dependent>
|
22
|
+
<default_value></default_value>
|
23
|
+
<min_value></min_value>
|
24
|
+
<max_value></max_value>
|
25
|
+
</argument>
|
26
|
+
</arguments>
|
27
|
+
<outputs />
|
28
|
+
<provenances />
|
29
|
+
<tags>
|
30
|
+
<tag>Whole Building.Space Types</tag>
|
31
|
+
</tags>
|
32
|
+
<attributes>
|
33
|
+
<attribute>
|
34
|
+
<name>Intended Software Tool</name>
|
35
|
+
<value>Apply Measure Now</value>
|
36
|
+
<datatype>string</datatype>
|
37
|
+
</attribute>
|
38
|
+
<attribute>
|
39
|
+
<name>Intended Software Tool</name>
|
40
|
+
<value>OpenStudio Application</value>
|
41
|
+
<datatype>string</datatype>
|
42
|
+
</attribute>
|
43
|
+
<attribute>
|
44
|
+
<name>Intended Software Tool</name>
|
45
|
+
<value>Parametric Analysis Tool</value>
|
46
|
+
<datatype>string</datatype>
|
47
|
+
</attribute>
|
48
|
+
<attribute>
|
49
|
+
<name>Intended Software Tool</name>
|
50
|
+
<value>Apply Measure Now</value>
|
51
|
+
<datatype>string</datatype>
|
52
|
+
</attribute>
|
53
|
+
<attribute>
|
54
|
+
<name>Intended Software Tool</name>
|
55
|
+
<value>OpenStudio Application</value>
|
56
|
+
<datatype>string</datatype>
|
57
|
+
</attribute>
|
58
|
+
<attribute>
|
59
|
+
<name>Intended Software Tool</name>
|
60
|
+
<value>Parametric Analysis Tool</value>
|
61
|
+
<datatype>string</datatype>
|
62
|
+
</attribute>
|
63
|
+
<attribute>
|
64
|
+
<name>Intended Software Tool</name>
|
65
|
+
<value>Apply Measure Now</value>
|
66
|
+
<datatype>string</datatype>
|
67
|
+
</attribute>
|
68
|
+
<attribute>
|
69
|
+
<name>Intended Software Tool</name>
|
70
|
+
<value>OpenStudio Application</value>
|
71
|
+
<datatype>string</datatype>
|
72
|
+
</attribute>
|
73
|
+
<attribute>
|
74
|
+
<name>Intended Software Tool</name>
|
75
|
+
<value>Parametric Analysis Tool</value>
|
76
|
+
<datatype>string</datatype>
|
77
|
+
</attribute>
|
78
|
+
<attribute>
|
79
|
+
<name>Measure Type</name>
|
80
|
+
<value>ModelMeasure</value>
|
81
|
+
<datatype>string</datatype>
|
82
|
+
</attribute>
|
83
|
+
<attribute>
|
84
|
+
<name>Intended Software Tool</name>
|
85
|
+
<value>Apply Measure Now</value>
|
86
|
+
<datatype>string</datatype>
|
87
|
+
</attribute>
|
88
|
+
<attribute>
|
89
|
+
<name>Intended Software Tool</name>
|
90
|
+
<value>OpenStudio Application</value>
|
91
|
+
<datatype>string</datatype>
|
92
|
+
</attribute>
|
93
|
+
<attribute>
|
94
|
+
<name>Intended Software Tool</name>
|
95
|
+
<value>Parametric Analysis Tool</value>
|
96
|
+
<datatype>string</datatype>
|
97
|
+
</attribute>
|
98
|
+
</attributes>
|
99
|
+
<files>
|
100
|
+
<file>
|
101
|
+
<filename>LICENSE.md</filename>
|
102
|
+
<filetype>md</filetype>
|
103
|
+
<usage_type>license</usage_type>
|
104
|
+
<checksum>1E0EDDB0</checksum>
|
105
|
+
</file>
|
106
|
+
<file>
|
107
|
+
<filename>README.md</filename>
|
108
|
+
<filetype>md</filetype>
|
109
|
+
<usage_type>readme</usage_type>
|
110
|
+
<checksum>782C496D</checksum>
|
111
|
+
</file>
|
112
|
+
<file>
|
113
|
+
<version>
|
114
|
+
<software_program>OpenStudio</software_program>
|
115
|
+
<identifier>2.0.0</identifier>
|
116
|
+
<min_compatible>2.0.0</min_compatible>
|
117
|
+
</version>
|
118
|
+
<filename>measure.rb</filename>
|
119
|
+
<filetype>rb</filetype>
|
120
|
+
<usage_type>script</usage_type>
|
121
|
+
<checksum>D5D8CB66</checksum>
|
122
|
+
</file>
|
123
|
+
<file>
|
124
|
+
<filename>from_gbxml_model_test.rb</filename>
|
125
|
+
<filetype>rb</filetype>
|
126
|
+
<usage_type>test</usage_type>
|
127
|
+
<checksum>AE86B654</checksum>
|
128
|
+
</file>
|
129
|
+
</files>
|
130
|
+
</measure>
|
131
|
+
<error>cannot load such file -- from_openstudio</error>
|