honeybee-openstudio 0 → 1.8.1
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 -0
- data/.gitignore +32 -33
- data/.releaserc.json +7 -7
- data/.travis.yml +41 -0
- data/Gemfile +18 -14
- data/LICENSE.md +23 -23
- data/README.md +95 -95
- data/Rakefile +21 -16
- 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 +35 -38
- data/lib/files/Honeybee.rb +112 -112
- data/lib/files/honeybee_workflow.osw +47 -47
- data/lib/files/urbanopt_Gemfile +32 -32
- data/lib/{honeybee/_defaults → from_honeybee/_openapi}/model.json +8126 -11310
- data/lib/{honeybee/_defaults → from_honeybee/_openapi}/simulation-parameter.json +842 -972
- data/lib/{to_openstudio → from_honeybee}/construction/air.rb +65 -56
- data/lib/{to_openstudio → from_honeybee}/construction/opaque.rb +77 -67
- data/lib/{to_openstudio → from_honeybee}/construction/shade.rb +108 -99
- data/lib/{to_openstudio → from_honeybee}/construction/window.rb +80 -70
- data/lib/{to_openstudio → from_honeybee}/construction_set.rb +278 -266
- data/lib/{honeybee → from_honeybee}/extension.rb +109 -129
- data/lib/{to_openstudio → from_honeybee}/geometry/aperture.rb +167 -157
- data/lib/{to_openstudio → from_honeybee}/geometry/door.rb +160 -150
- data/lib/{to_openstudio → from_honeybee}/geometry/face.rb +163 -178
- data/lib/{to_openstudio → from_honeybee}/geometry/room.rb +392 -442
- data/lib/{to_openstudio → from_honeybee}/geometry/shade.rb +89 -79
- data/lib/{to_openstudio → from_honeybee}/hvac/ideal_air.rb +150 -141
- data/lib/{to_openstudio → from_honeybee}/load/electric_equipment.rb +96 -87
- data/lib/{to_openstudio → from_honeybee}/load/gas_equipment.rb +97 -88
- data/lib/{to_openstudio → from_honeybee}/load/infiltration.rb +94 -85
- data/lib/{to_openstudio → from_honeybee}/load/lighting.rb +98 -89
- data/lib/{to_openstudio → from_honeybee}/load/people.rb +100 -91
- data/lib/{to_openstudio → from_honeybee}/load/setpoint_humidistat.rb +75 -66
- data/lib/{to_openstudio → from_honeybee}/load/setpoint_thermostat.rb +71 -62
- data/lib/{to_openstudio → from_honeybee}/load/ventilation.rb +96 -87
- data/lib/{to_openstudio → from_honeybee}/material/opaque.rb +94 -85
- data/lib/{to_openstudio → from_honeybee}/material/opaque_no_mass.rb +94 -85
- data/lib/{to_openstudio → from_honeybee}/material/window_blind.rb +238 -229
- data/lib/{to_openstudio → from_honeybee}/material/window_gas.rb +76 -67
- data/lib/{to_openstudio → from_honeybee}/material/window_gas_custom.rb +118 -108
- data/lib/{to_openstudio → from_honeybee}/material/window_gas_mixture.rb +79 -70
- data/lib/{to_openstudio → from_honeybee}/material/window_glazing.rb +166 -157
- data/lib/{to_openstudio → from_honeybee}/material/window_shade.rb +160 -151
- data/lib/{to_openstudio → from_honeybee}/material/window_simpleglazsys.rb +73 -64
- data/lib/from_honeybee/model.rb +434 -0
- data/lib/{honeybee → from_honeybee}/model_object.rb +110 -108
- data/lib/{to_openstudio → from_honeybee}/program_type.rb +124 -104
- data/lib/{to_openstudio → from_honeybee}/schedule/fixed_interval.rb +115 -105
- data/lib/{to_openstudio → from_honeybee}/schedule/ruleset.rb +164 -164
- data/lib/{to_openstudio → from_honeybee}/schedule/type_limit.rb +88 -76
- data/lib/{to_openstudio/simulation/design_day.rb → from_honeybee/simulation/designday.rb} +105 -96
- data/lib/{honeybee/load/lighting.rb → from_honeybee/simulation/extension.rb} +46 -43
- data/lib/{to_openstudio/simulation/parameter_model.rb → from_honeybee/simulation/parameter.rb} +277 -243
- data/lib/{honeybee/simulation/design_day.rb → from_honeybee/version.rb} +34 -42
- data/lib/{honeybee.rb → from_honeybee.rb} +86 -93
- data/lib/measures/from_honeybee_model/LICENSE.md +27 -23
- 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 -80
- data/lib/measures/from_honeybee_model/tests/from_honeybee_model_test.rb +126 -126
- data/lib/measures/from_honeybee_simulation_parameter/LICENSE.md +27 -23
- 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 -86
- data/lib/measures/from_honeybee_simulation_parameter/tests/from_honeybee_simulation_parameter_test.rb +109 -109
- metadata +89 -147
- data/.github/workflows/ci.yaml +0 -88
- data/doc_templates/README.md.erb +0 -42
- data/lib/from_openstudio/geometry/aperture.rb +0 -136
- data/lib/from_openstudio/geometry/door.rb +0 -136
- data/lib/from_openstudio/geometry/face.rb +0 -174
- data/lib/from_openstudio/geometry/room.rb +0 -121
- data/lib/from_openstudio/geometry/shade.rb +0 -87
- data/lib/from_openstudio/model.rb +0 -123
- data/lib/from_openstudio/model_object.rb +0 -43
- data/lib/from_openstudio/simulation/design_day.rb +0 -123
- data/lib/from_openstudio/simulation/parameter_model.rb +0 -93
- data/lib/from_openstudio/simulation/simulation_output.rb +0 -67
- data/lib/from_openstudio.rb +0 -49
- data/lib/honeybee/_defaults/energy_default.json +0 -1682
- data/lib/honeybee/construction/air.rb +0 -42
- data/lib/honeybee/construction/opaque.rb +0 -42
- data/lib/honeybee/construction/shade.rb +0 -42
- data/lib/honeybee/construction/window.rb +0 -51
- data/lib/honeybee/construction/windowshade.rb +0 -43
- data/lib/honeybee/construction_set.rb +0 -42
- data/lib/honeybee/geometry/aperture.rb +0 -42
- data/lib/honeybee/geometry/door.rb +0 -42
- data/lib/honeybee/geometry/face.rb +0 -48
- data/lib/honeybee/geometry/room.rb +0 -56
- data/lib/honeybee/geometry/shade.rb +0 -42
- data/lib/honeybee/hvac/ideal_air.rb +0 -42
- data/lib/honeybee/hvac/template.rb +0 -73
- data/lib/honeybee/load/electric_equipment.rb +0 -42
- data/lib/honeybee/load/gas_equipment.rb +0 -42
- data/lib/honeybee/load/infiltration.rb +0 -42
- data/lib/honeybee/load/people.rb +0 -42
- data/lib/honeybee/load/setpoint_humidistat.rb +0 -46
- data/lib/honeybee/load/setpoint_thermostat.rb +0 -46
- data/lib/honeybee/load/ventilation.rb +0 -42
- data/lib/honeybee/material/opaque.rb +0 -42
- data/lib/honeybee/material/opaque_no_mass.rb +0 -42
- data/lib/honeybee/material/window_blind.rb +0 -42
- data/lib/honeybee/material/window_gas.rb +0 -42
- data/lib/honeybee/material/window_gas_custom.rb +0 -42
- data/lib/honeybee/material/window_gas_mixture.rb +0 -42
- data/lib/honeybee/material/window_glazing.rb +0 -42
- data/lib/honeybee/material/window_shade.rb +0 -42
- data/lib/honeybee/material/window_simpleglazsys.rb +0 -42
- data/lib/honeybee/model.rb +0 -87
- data/lib/honeybee/program_type.rb +0 -56
- data/lib/honeybee/schedule/fixed_interval.rb +0 -42
- data/lib/honeybee/schedule/ruleset.rb +0 -42
- data/lib/honeybee/schedule/type_limit.rb +0 -42
- data/lib/honeybee/simulation/parameter_model.rb +0 -86
- data/lib/honeybee/simulation/simulation_output.rb +0 -42
- data/lib/honeybee/ventcool/control.rb +0 -42
- data/lib/honeybee/ventcool/opening.rb +0 -46
- data/lib/honeybee/ventcool/simulation.rb +0 -42
- data/lib/to_openstudio/construction/windowshade.rb +0 -196
- data/lib/to_openstudio/hvac/Model.hvac.rb +0 -641
- data/lib/to_openstudio/hvac/template.rb +0 -169
- data/lib/to_openstudio/model.rb +0 -497
- data/lib/to_openstudio/model_object.rb +0 -52
- data/lib/to_openstudio/ventcool/control.rb +0 -185
- data/lib/to_openstudio/ventcool/opening.rb +0 -189
- data/lib/to_openstudio/ventcool/simulation.rb +0 -101
- data/lib/to_openstudio.rb +0 -92
data/lib/{to_openstudio/simulation/parameter_model.rb → from_honeybee/simulation/parameter.rb}
RENAMED
@@ -1,243 +1,277 @@
|
|
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 '
|
33
|
-
|
34
|
-
require '
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
end
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
OpenStudio::
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
if @hash[:
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
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 'from_honeybee/model_object'
|
33
|
+
require 'from_honeybee/simulation/extension'
|
34
|
+
require 'from_honeybee/simulation/designday'
|
35
|
+
|
36
|
+
require 'openstudio'
|
37
|
+
|
38
|
+
module FromHoneybee
|
39
|
+
class SimulationParameter
|
40
|
+
attr_reader :errors, :warnings
|
41
|
+
|
42
|
+
# Read Simulation Parameter JSON from disk
|
43
|
+
def self.read_from_disk(file)
|
44
|
+
hash = nil
|
45
|
+
File.open(File.join(file), 'r') do |f|
|
46
|
+
hash = JSON.parse(f.read, symbolize_names: true)
|
47
|
+
end
|
48
|
+
|
49
|
+
SimulationParameter.new(hash)
|
50
|
+
end
|
51
|
+
|
52
|
+
# Load ModelObject from symbolized hash
|
53
|
+
def initialize(hash)
|
54
|
+
# initialize class variable @@extension only once
|
55
|
+
@@extension = ExtensionSimulationParameter.new
|
56
|
+
@@schema = nil
|
57
|
+
File.open(@@extension.schema_file) do |f|
|
58
|
+
@@schema = JSON.parse(f.read, symbolize_names: true)
|
59
|
+
end
|
60
|
+
|
61
|
+
@hash = hash
|
62
|
+
@type = @hash[:type]
|
63
|
+
raise 'Unknown model type' if @type.nil?
|
64
|
+
raise "Incorrect model type for SimulationParameter '#{@type}'" unless @type == 'SimulationParameter'
|
65
|
+
end
|
66
|
+
|
67
|
+
# check if the model is valid
|
68
|
+
def valid?
|
69
|
+
if Gem.loaded_specs.has_key?("json-schema")
|
70
|
+
return validation_errors.empty?
|
71
|
+
else
|
72
|
+
return true
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# return detailed model validation errors
|
77
|
+
def validation_errors
|
78
|
+
if Gem.loaded_specs.has_key?("json-schema")
|
79
|
+
require 'json-schema'
|
80
|
+
JSON::Validator.fully_validate(@@schema, @hash)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def defaults
|
85
|
+
@@schema[:components][:schemas]
|
86
|
+
end
|
87
|
+
|
88
|
+
# convert to openstudio model, clears errors and warnings
|
89
|
+
def to_openstudio_model(openstudio_model=nil, log_report=false)
|
90
|
+
@errors = []
|
91
|
+
@warnings = []
|
92
|
+
|
93
|
+
if log_report
|
94
|
+
puts 'Starting SimulationParameter translation from Honeybee to OpenStudio'
|
95
|
+
end
|
96
|
+
@openstudio_model = if openstudio_model
|
97
|
+
openstudio_model
|
98
|
+
else
|
99
|
+
OpenStudio::Model::Model.new
|
100
|
+
end
|
101
|
+
|
102
|
+
create_openstudio_objects
|
103
|
+
|
104
|
+
if log_report
|
105
|
+
puts 'Done with SimulationParameter translation!'
|
106
|
+
end
|
107
|
+
|
108
|
+
@openstudio_model
|
109
|
+
end
|
110
|
+
|
111
|
+
def create_openstudio_objects
|
112
|
+
# get the defaults for each sub-object
|
113
|
+
simct_defaults = defaults[:SimulationControl][:properties]
|
114
|
+
shdw_defaults = defaults[:ShadowCalculation][:properties]
|
115
|
+
siz_defaults = defaults[:SizingParameter][:properties]
|
116
|
+
out_defaults = defaults[:SimulationOutput][:properties]
|
117
|
+
runper_defaults = defaults[:RunPeriod][:properties]
|
118
|
+
simpar_defaults = defaults[:SimulationParameter][:properties]
|
119
|
+
|
120
|
+
# set defaults for the Model's SimulationControl object
|
121
|
+
os_sim_control = @openstudio_model.getSimulationControl
|
122
|
+
os_sim_control.setDoZoneSizingCalculation(simct_defaults[:do_zone_sizing][:default])
|
123
|
+
os_sim_control.setDoSystemSizingCalculation(simct_defaults[:do_system_sizing][:default])
|
124
|
+
os_sim_control.setDoPlantSizingCalculation(simct_defaults[:do_plant_sizing][:default])
|
125
|
+
os_sim_control.setRunSimulationforWeatherFileRunPeriods(simct_defaults[:run_for_run_periods][:default])
|
126
|
+
os_sim_control.setRunSimulationforSizingPeriods(simct_defaults[:run_for_sizing_periods][:default])
|
127
|
+
os_sim_control.setSolarDistribution(shdw_defaults[:solar_distribution][:default])
|
128
|
+
|
129
|
+
# override any SimulationControl defaults with lodaded JSON
|
130
|
+
if @hash[:simulation_control]
|
131
|
+
unless @hash[:simulation_control][:do_zone_sizing].nil?
|
132
|
+
os_sim_control.setDoZoneSizingCalculation(@hash[:simulation_control][:do_zone_sizing])
|
133
|
+
end
|
134
|
+
unless @hash[:simulation_control][:do_system_sizing].nil?
|
135
|
+
os_sim_control.setDoSystemSizingCalculation(@hash[:simulation_control][:do_system_sizing])
|
136
|
+
end
|
137
|
+
unless @hash[:simulation_control][:do_plant_sizing].nil?
|
138
|
+
os_sim_control.setDoPlantSizingCalculation(@hash[:simulation_control][:do_plant_sizing])
|
139
|
+
end
|
140
|
+
unless @hash[:simulation_control][:run_for_run_periods].nil?
|
141
|
+
os_sim_control.setRunSimulationforWeatherFileRunPeriods(@hash[:simulation_control][:run_for_run_periods])
|
142
|
+
end
|
143
|
+
unless @hash[:simulation_control][:run_for_sizing_periods].nil?
|
144
|
+
os_sim_control.setRunSimulationforSizingPeriods(@hash[:simulation_control][:run_for_sizing_periods])
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
# set defaults for the Model's ShadowCalculation object
|
149
|
+
os_shadow_calc = @openstudio_model.getShadowCalculation
|
150
|
+
os_shadow_calc.setCalculationFrequency(shdw_defaults[:calculation_frequency][:default])
|
151
|
+
os_shadow_calc.setMaximumFiguresInShadowOverlapCalculations(shdw_defaults[:maximum_figures][:default])
|
152
|
+
os_shadow_calc.setCalculationMethod(shdw_defaults[:calculation_method][:default])
|
153
|
+
|
154
|
+
# override any ShadowCalculation defaults with lodaded JSON
|
155
|
+
if @hash[:shadow_calculation]
|
156
|
+
if @hash[:shadow_calculation][:calculation_frequency]
|
157
|
+
os_shadow_calc.setCalculationFrequency(@hash[:shadow_calculation][:calculation_frequency])
|
158
|
+
end
|
159
|
+
if @hash[:shadow_calculation][:maximum_figures]
|
160
|
+
os_shadow_calc.setMaximumFiguresInShadowOverlapCalculations(@hash[:shadow_calculation][:maximum_figures])
|
161
|
+
end
|
162
|
+
if @hash[:shadow_calculation][:calculation_method]
|
163
|
+
os_shadow_calc.setCalculationMethod(@hash[:shadow_calculation][:calculation_method])
|
164
|
+
end
|
165
|
+
if @hash[:shadow_calculation][:solar_distribution]
|
166
|
+
os_sim_control.setSolarDistribution(@hash[:shadow_calculation][:solar_distribution])
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
# set defaults for the Model's SizingParameter object
|
171
|
+
os_sizing_par = @openstudio_model.getSizingParameters
|
172
|
+
os_sizing_par.setHeatingSizingFactor(siz_defaults[:heating_factor][:default])
|
173
|
+
os_sizing_par.setCoolingSizingFactor(siz_defaults[:cooling_factor][:default])
|
174
|
+
|
175
|
+
# override any SizingParameter defaults with lodaded JSON
|
176
|
+
if @hash[:sizing_parameter]
|
177
|
+
if @hash[:sizing_parameter][:heating_factor]
|
178
|
+
os_sizing_par.setHeatingSizingFactor(@hash[:sizing_parameter][:heating_factor])
|
179
|
+
end
|
180
|
+
if @hash[:sizing_parameter][:cooling_factor]
|
181
|
+
os_sizing_par.setCoolingSizingFactor(@hash[:sizing_parameter][:cooling_factor])
|
182
|
+
end
|
183
|
+
# set any design days
|
184
|
+
if @hash[:sizing_parameter][:design_days]
|
185
|
+
@hash[:sizing_parameter][:design_days].each do |des_day|
|
186
|
+
des_day_object = DesignDay.new(des_day)
|
187
|
+
os_des_day = des_day_object.to_openstudio(@openstudio_model)
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
# set Outputs for the simulation
|
193
|
+
if @hash[:output]
|
194
|
+
if @hash[:output][:outputs]
|
195
|
+
@hash[:output][:outputs].each do |output|
|
196
|
+
os_output = OpenStudio::Model::OutputVariable.new(output, @openstudio_model)
|
197
|
+
if @hash[:output][:reporting_frequency]
|
198
|
+
os_output.setReportingFrequency(@hash[:output][:reporting_frequency])
|
199
|
+
else
|
200
|
+
os_output.setReportingFrequency(out_defaults[:reporting_frequency][:default])
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
204
|
+
if @hash[:output][:summary_reports]
|
205
|
+
begin
|
206
|
+
os_report = OpenStudio::Model::OutputTableSummaryReports.new(@openstudio_model)
|
207
|
+
rescue NameError
|
208
|
+
end
|
209
|
+
@hash[:output][:summary_reports].each do |report|
|
210
|
+
begin
|
211
|
+
os_report.addSummaryReport(report)
|
212
|
+
rescue NoMethodError
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
# set defaults for the year description
|
219
|
+
year_description = @openstudio_model.getYearDescription
|
220
|
+
year_description.setDayofWeekforStartDay(runper_defaults[:start_day_of_week][:default])
|
221
|
+
|
222
|
+
# set up the simulation RunPeriod
|
223
|
+
if @hash[:run_period]
|
224
|
+
# set the leap year
|
225
|
+
if @hash[:run_period][:leap_year]
|
226
|
+
year_description.setIsLeapYear(@hash[:run_period][:leap_year])
|
227
|
+
end
|
228
|
+
|
229
|
+
# set the start day of the week
|
230
|
+
if @hash[:run_period][:start_day_of_week]
|
231
|
+
year_description.setDayofWeekforStartDay(@hash[:run_period][:start_day_of_week])
|
232
|
+
end
|
233
|
+
|
234
|
+
# set the run preiod start and end dates
|
235
|
+
openstudio_runperiod = @openstudio_model.getRunPeriod
|
236
|
+
openstudio_runperiod.setBeginMonth(@hash[:run_period][:start_date][0])
|
237
|
+
openstudio_runperiod.setBeginDayOfMonth(@hash[:run_period][:start_date][1])
|
238
|
+
openstudio_runperiod.setEndMonth(@hash[:run_period][:end_date][0])
|
239
|
+
openstudio_runperiod.setEndDayOfMonth(@hash[:run_period][:end_date][1])
|
240
|
+
|
241
|
+
# set the daylight savings time
|
242
|
+
if @hash[:run_period][:daylight_saving_time]
|
243
|
+
os_dl_saving = @openstudio_model.getRunPeriodControlDaylightSavingTime
|
244
|
+
os_dl_saving.setStartDate(
|
245
|
+
OpenStudio::MonthOfYear.new(@hash[:run_period][:daylight_saving_time][:start_date][0]),
|
246
|
+
@hash[:run_period][:daylight_saving_time][:start_date][1])
|
247
|
+
os_dl_saving.setEndDate(
|
248
|
+
OpenStudio::MonthOfYear.new(@hash[:run_period][:daylight_saving_time][:end_date][0]),
|
249
|
+
@hash[:run_period][:daylight_saving_time][:end_date][1])
|
250
|
+
end
|
251
|
+
|
252
|
+
# TODO: set the holidays once they are available in OpenStudio SDK
|
253
|
+
end
|
254
|
+
|
255
|
+
# set the simulation timestep
|
256
|
+
os_timestep = @openstudio_model.getTimestep
|
257
|
+
if @hash[:timestep]
|
258
|
+
os_timestep.setNumberOfTimestepsPerHour(@hash[:timestep])
|
259
|
+
else
|
260
|
+
os_timestep.setNumberOfTimestepsPerHour(simpar_defaults[:timestep][:default])
|
261
|
+
end
|
262
|
+
|
263
|
+
# assign the north
|
264
|
+
if @hash[:north_angle]
|
265
|
+
@openstudio_model.getBuilding.setNorthAxis(-@hash[:north_angle])
|
266
|
+
end
|
267
|
+
|
268
|
+
# assign the terrain
|
269
|
+
os_site = @openstudio_model.getSite
|
270
|
+
os_site.setTerrain(simpar_defaults[:terrain_type][:default])
|
271
|
+
if @hash[:terrain_type]
|
272
|
+
os_site.setTerrain(@hash[:terrain_type])
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
end #SimulationParameter
|
277
|
+
end #FromHoneybee
|
@@ -1,42 +1,34 @@
|
|
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
|
-
|
33
|
-
|
34
|
-
|
35
|
-
class DesignDay < ModelObject
|
36
|
-
|
37
|
-
def defaults
|
38
|
-
@@schema[:components][:schemas][:DesignDay][:properties]
|
39
|
-
end
|
40
|
-
|
41
|
-
end # DesignDay
|
42
|
-
end # Honeybee
|
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
|
+
module FromHoneybee
|
33
|
+
VERSION = '0.1.0'.freeze
|
34
|
+
end
|