honeybee-openstudio 2.22.4 → 2.23.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f8767065c98f72114b89b1d16304efe93ca0003a357f647954b0beed6989b1ec
4
- data.tar.gz: 1ed4757de90face39cbc8309e45d5e1a872288bab0f9240da9a9d4b8db18dada
3
+ metadata.gz: 70d85a158c3143c24582c3f1c29fd12c166da8ce20add49553cf9c64d6a320f2
4
+ data.tar.gz: 63e8a77445232cd5f90fd3d3effdcd8816cd3982e50116ecca67e6656940589d
5
5
  SHA512:
6
- metadata.gz: '0925da969e4768649654327dd2574ab5cd4caec284ae804c42ae7fb772e139aae63d852a52b1406fb81e1c6db0fa1658f170c29389614bf0e3cc4d4054a428d4'
7
- data.tar.gz: '091488d2fa18fa7f06452c43fea7d6559fdaa8591f04c9b5fa8732d65b0119e39aa789ba2c82ce806b5346aceabc44423ecd9c5d103d9f2cbb3d31e615f1e4d6'
6
+ metadata.gz: bdcbacab7a8801c1a24044e9eef069bca9ffde80734fcb77c78b147492ba7ee30fdf6f3b67faf8990f8c5b11fdd5b60970e397423c933a904c8cf46f9da2ca00
7
+ data.tar.gz: 7488acf2edc55f7fc2bfb5b555b1095fc1e1493eba59044969c6c09003087aa103d628c2816f06ff9e89703f680f579190e615be0422249330beacd05851fbc0
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'honeybee-openstudio'
7
- spec.version = '2.22.4'
7
+ spec.version = '2.23.2'
8
8
  spec.authors = ['Tanushree Charan', 'Dan Macumber', 'Chris Mackey', 'Mostapha Sadeghipour Roudsari']
9
9
  spec.email = ['tanushree.charan@nrel.gov', 'chris@ladybug.tools']
10
10
 
@@ -61,7 +61,7 @@ module Honeybee
61
61
  hash[:solar_reflectance] = layer.solarReflectance.get
62
62
  end
63
63
  unless layer.visibleReflectance.empty?
64
- hash[:visible_reflectance] = layer.visibleReflectance
64
+ hash[:visible_reflectance] = layer.visibleReflectance.get
65
65
  end
66
66
  elsif layer.to_MasslessOpaqueMaterial.is_initialized
67
67
  layer = layer.to_MasslessOpaqueMaterial.get
@@ -46,6 +46,8 @@ require 'from_openstudio/construction/opaque'
46
46
  require 'from_openstudio/construction/window'
47
47
  require 'from_openstudio/construction/shade'
48
48
  require 'from_openstudio/construction_set'
49
+ require 'from_openstudio/schedule/type_limit'
50
+ require 'from_openstudio/schedule/ruleset'
49
51
 
50
52
  require 'openstudio'
51
53
 
@@ -126,11 +128,11 @@ module Honeybee
126
128
  def self.energy_properties_from_model(openstudio_model)
127
129
  hash = {}
128
130
  hash[:type] = 'ModelEnergyProperties'
129
- hash[:constructions] = []
130
131
  hash[:constructions] = constructions_from_model(openstudio_model)
131
132
  hash[:materials] = materials_from_model(openstudio_model)
132
- hash[:construction_sets] = []
133
133
  hash[:construction_sets] = constructionsets_from_model(openstudio_model)
134
+ hash[:schedule_type_limits] = schedtypelimits_from_model(openstudio_model)
135
+ hash[:schedules] = scheduleruleset_from_model(openstudio_model)
134
136
 
135
137
  hash
136
138
  end
@@ -266,5 +268,24 @@ module Honeybee
266
268
  result
267
269
  end
268
270
 
271
+ # Create HB Schedule Type Limits from OpenStudio Schedule Type Limits
272
+ def self.schedtypelimits_from_model(openstudio_model)
273
+ result = []
274
+ openstudio_model.getScheduleTypeLimitss.each do |sch_typ_lim|
275
+ result << ScheduleTypeLimit.from_schedule_type_limit(sch_typ_lim)
276
+ end
277
+
278
+ result
279
+ end
280
+
281
+ # Create HB Schedule Ruleset from OpenStudio Ruleset
282
+ def self.scheduleruleset_from_model(openstudio_model)
283
+ result = []
284
+ openstudio_model.getScheduleRulesets.each do |sch_ruleset|
285
+ result << ScheduleRulesetAbridged.from_schedule_ruleset(sch_ruleset)
286
+ end
287
+ result
288
+ end
289
+
269
290
  end # Model
270
291
  end # Honeybee
@@ -0,0 +1,140 @@
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/schedule/ruleset'
33
+ require 'from_openstudio/model_object'
34
+
35
+ module Honeybee
36
+ class ScheduleRulesetAbridged < ModelObject
37
+
38
+ def self.from_schedule_ruleset(schedule_ruleset)
39
+ # create an empty hash
40
+ hash = {}
41
+ hash[:type] = 'ScheduleRulesetAbridged'
42
+ # set the primary (required) day schedules of the object
43
+ hash[:identifier] = clean_name(schedule_ruleset.nameString)
44
+ hash[:default_day_schedule] = clean_name(schedule_ruleset.defaultDaySchedule.nameString)
45
+ hash[:summer_designday_schedule] = clean_name(schedule_ruleset.summerDesignDaySchedule.nameString)
46
+ hash[:winter_designday_schedule] = clean_name(schedule_ruleset.winterDesignDaySchedule.nameString)
47
+ hash[:holiday_schedule] = clean_name(schedule_ruleset.holidaySchedule.nameString)
48
+
49
+ # create a list of all day schedules referenced in the Ruleset
50
+ schedule_days, day_ids = [], []
51
+ required_days = [
52
+ schedule_ruleset.defaultDaySchedule,
53
+ schedule_ruleset.summerDesignDaySchedule,
54
+ schedule_ruleset.winterDesignDaySchedule,
55
+ schedule_ruleset.holidaySchedule
56
+ ]
57
+ required_days.each do |day_sch|
58
+ unless day_ids.include? day_sch.nameString
59
+ schedule_days << day_sch
60
+ day_ids << day_sch.nameString
61
+ end
62
+ end
63
+
64
+ # loop through the rules and add them along with their day schedules
65
+ hash[:schedule_rules] = []
66
+ schedule_ruleset.scheduleRules.each do |schedule_rule|
67
+ hash[:schedule_rules] << ScheduleRulesetAbridged.from_schedule_rule(schedule_rule)
68
+ day_sch = schedule_rule.daySchedule
69
+ unless day_ids.include? day_sch.nameString
70
+ schedule_days << day_sch
71
+ day_ids << day_sch.nameString
72
+ end
73
+ end
74
+
75
+ # write all of the day schedule specifications into the hash
76
+ hash[:day_schedules] = []
77
+ schedule_days.each do |schedule_day|
78
+ hash[:day_schedules] << ScheduleRulesetAbridged.from_day_schedule(schedule_day)
79
+ end
80
+
81
+ # assing any schedule type limits if they exist
82
+ unless schedule_ruleset.scheduleTypeLimits.empty?
83
+ typ_lim = schedule_ruleset.scheduleTypeLimits.get
84
+ hash[:schedule_type_limit] = clean_name(typ_lim.nameString)
85
+ end
86
+
87
+ hash
88
+ end
89
+
90
+ def self.from_day_schedule(day_schedule)
91
+ hash = {}
92
+ hash[:type] = 'ScheduleDay'
93
+ hash[:identifier] = clean_name(day_schedule.nameString)
94
+ hash[:interpolate] = day_schedule.interpolatetoTimestep
95
+ hash[:values] = day_schedule.values
96
+ time_until = [[0,0]]
97
+ day_schedule.times.each do |time|
98
+ time_until << [time.hours, time.minutes]
99
+ end
100
+ time_until.delete_at(-1)
101
+ hash[:times] = time_until
102
+
103
+ hash
104
+ end
105
+
106
+ def self.from_schedule_rule(schedule_rule)
107
+ hash = {}
108
+ hash[:type] = 'ScheduleRuleAbridged'
109
+ hash[:schedule_day] = clean_name(schedule_rule.daySchedule.nameString)
110
+ hash[:apply_sunday] = schedule_rule.applySunday
111
+ hash[:apply_monday] = schedule_rule.applyMonday
112
+ hash[:apply_tuesday] = schedule_rule.applyTuesday
113
+ hash[:apply_wednesday] = schedule_rule.applyWednesday
114
+ hash[:apply_thursday] = schedule_rule.applyThursday
115
+ hash[:apply_friday] = schedule_rule.applyFriday
116
+ hash[:apply_saturday] = schedule_rule.applySaturday
117
+
118
+ #boost optional
119
+ unless schedule_rule.startDate.empty?
120
+ start_date = schedule_rule.startDate.get
121
+ hash[:start_date] = [(start_date.monthOfYear).value, start_date.dayOfMonth]
122
+ if start_date.isLeapYear
123
+ hash[:start_date] << 1
124
+ end
125
+ end
126
+
127
+ #boost optional
128
+ unless schedule_rule.endDate.empty?
129
+ end_date = schedule_rule.endDate.get
130
+ hash[:end_date] = [(end_date.monthOfYear).value, end_date.dayOfMonth]
131
+ if start_date.isLeapYear
132
+ hash[:end_date] << 1
133
+ end
134
+ end
135
+
136
+ hash
137
+ end
138
+
139
+ end # ScheduleRulesetAbridged
140
+ end # Honeybee
@@ -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/schedule/type_limit'
33
+ require 'to_openstudio/model_object'
34
+
35
+ module Honeybee
36
+ class ScheduleTypeLimit < ModelObject
37
+
38
+ def self.from_schedule_type_limit(schedule_type_limit)
39
+ # create an empty hash
40
+ hash = {}
41
+ hash[:type] = 'ScheduleTypeLimit'
42
+ # set hash values from OpenStudio Object
43
+ hash[:identifier] = clean_name(schedule_type_limit.nameString)
44
+ # check if boost optional object is empty
45
+ unless schedule_type_limit.lowerLimitValue.empty?
46
+ hash[:lower_limit] = schedule_type_limit.lowerLimitValue.get
47
+ end
48
+ # check if boost optional object is empty
49
+ unless schedule_type_limit.upperLimitValue.empty?
50
+ hash[:upper_limit] = schedule_type_limit.upperLimitValue.get
51
+ end
52
+ # check if boost optional object is empty
53
+ unless schedule_type_limit.numericType.empty?
54
+ numeric_type = schedule_type_limit.numericType.get
55
+ hash[:numeric_type] = numeric_type.titleize
56
+ end
57
+
58
+ # make sure unit type always follows the capitalization of the Honeybee Enumeration
59
+ unit_type = schedule_type_limit.unitType.titleize
60
+ if unit_type == 'Deltatemperature'
61
+ unit_type = 'DeltaTemperature'
62
+ elsif unit_type == 'Precipitationrate'
63
+ unit_type = 'PrecipitationRate'
64
+ elsif unit_type == 'Convectioncoefficient'
65
+ unit_type = 'ConvectionCoefficient'
66
+ elsif unit_type == 'Activitylevel'
67
+ unit_type = 'ActivityLevel'
68
+ elsif unit_type == 'Controlmode'
69
+ unit_type = 'Control'
70
+ end
71
+ hash[:unit_type] = unit_type
72
+
73
+ hash
74
+ end
75
+
76
+ end # ScheduleTypeLimit
77
+ end # Honeybee
@@ -63,4 +63,8 @@ require 'from_openstudio/material/window_simpleglazsys'
63
63
  # extend the simulation objects
64
64
  require 'from_openstudio/simulation/design_day'
65
65
  require 'from_openstudio/simulation/parameter_model'
66
- require 'from_openstudio/simulation/simulation_output'
66
+ require 'from_openstudio/simulation/simulation_output'
67
+
68
+ # extend the schedule objects
69
+ require 'from_openstudio/schedule/type_limit'
70
+ require 'from_openstudio/schedule/ruleset'
@@ -54,7 +54,10 @@
54
54
  "identifier": "Generic Single Pane",
55
55
  "materials": [
56
56
  "Generic Clear Glass"
57
- ]
57
+ ],
58
+ "u_factor": 5.731373,
59
+ "shgc": 0.824407,
60
+ "vt": 0.88
58
61
  },
59
62
  {
60
63
  "type": "ShadeConstruction",
@@ -170,7 +173,10 @@
170
173
  "Generic Low-e Glass",
171
174
  "Generic Window Air Gap",
172
175
  "Generic Clear Glass"
173
- ]
176
+ ],
177
+ "u_factor": 1.687787,
178
+ "shgc": 0.43651,
179
+ "vt": 0.635473
174
180
  },
175
181
  {
176
182
  "type": "OpaqueConstructionAbridged",
@@ -51,6 +51,7 @@ module Honeybee
51
51
  @@extension ||= Extension.new
52
52
  @@schema ||= @@extension.schema
53
53
  @@standards ||= @@extension.standards
54
+ $simple_window_cons = false
54
55
 
55
56
  @hash = hash
56
57
  @type = @hash[:type]
@@ -36,13 +36,6 @@ module Honeybee
36
36
 
37
37
  attr_reader :errors, :warnings
38
38
 
39
- @@encoding_options = {
40
- :invalid => :replace, # Replace invalid byte sequences
41
- :undef => :replace, # Replace anything not defined in ASCII
42
- :replace => '', # Use a blank for those replacements
43
- :universal_newline => true # Always break lines with \n
44
- }
45
-
46
39
  def method_missing(sym, *args)
47
40
  name = sym.to_s
48
41
  aname = name.sub('=', '')
@@ -107,12 +100,12 @@ module Honeybee
107
100
 
108
101
  # remove illegal characters in identifier
109
102
  def self.clean_name(str)
110
- ascii = str.encode(Encoding.find('ASCII'), @@encoding_options)
103
+ ascii = str.encode(Encoding.find('ASCII'))
111
104
  end
112
105
 
113
106
  # remove illegal characters in identifier
114
107
  def self.clean_identifier(str)
115
- encode_str = str.encode(Encoding.find('ASCII'), @@encoding_options)
108
+ encode_str = str.encode(Encoding.find('ASCII'))
116
109
  encode_str.gsub(/[^.A-Za-z0-9_-]/, '_').gsub(' ', '_')
117
110
  end
118
111
 
@@ -86,6 +86,7 @@ class FromHoneybeeModelToGbxml < OpenStudio::Measure::ModelMeasure
86
86
  return false
87
87
  end
88
88
  honeybee_model = Honeybee::Model.read_from_disk(model_json)
89
+ $simple_window_cons = true
89
90
  STDOUT.flush
90
91
  os_model = honeybee_model.to_openstudio_model(model)
91
92
  STDOUT.flush
@@ -50,16 +50,25 @@ module Honeybee
50
50
  # create material vector
51
51
  os_materials = OpenStudio::Model::MaterialVector.new
52
52
  # loop through each layer and add to material vector
53
- if @hash.key?(:layers)
54
- mat_key = :layers
53
+ if $simple_window_cons && @hash[:u_factor]
54
+ os_simple_glazing = OpenStudio::Model::SimpleGlazing.new(openstudio_model)
55
+ os_simple_glazing.setName(@hash[:identifier] + '_SimpleGlazSys')
56
+ os_simple_glazing.setUFactor(@hash[:u_factor])
57
+ os_simple_glazing.setSolarHeatGainCoefficient(@hash[:shgc])
58
+ os_simple_glazing.setVisibleTransmittance(@hash[:vt])
59
+ os_materials << os_simple_glazing
55
60
  else
56
- mat_key = :materials
57
- end
58
- @hash[mat_key].each do |material_identifier|
59
- material = openstudio_model.getMaterialByName(material_identifier)
60
- unless material.empty?
61
- os_material = material.get
62
- os_materials << os_material
61
+ if @hash.key?(:layers)
62
+ mat_key = :layers
63
+ else
64
+ mat_key = :materials
65
+ end
66
+ @hash[mat_key].each do |material_identifier|
67
+ material = openstudio_model.getMaterialByName(material_identifier)
68
+ unless material.empty?
69
+ os_material = material.get
70
+ os_materials << os_material
71
+ end
63
72
  end
64
73
  end
65
74
  os_construction.setLayers(os_materials)
@@ -105,6 +105,14 @@ module Honeybee
105
105
  os_thermal_zone.setMultiplier(@hash[:multiplier])
106
106
  end
107
107
 
108
+ # assign the geometry properties if they exist
109
+ if @hash[:ceiling_height]
110
+ os_thermal_zone.setCeilingHeight(@hash[:ceiling_height])
111
+ end
112
+ if @hash[:volume]
113
+ os_thermal_zone.setVolume(@hash[:volume])
114
+ end
115
+
108
116
  # assign the story
109
117
  if @hash[:story] # the users has specified the name of the story
110
118
  story = openstudio_model.getBuildingStoryByName(@hash[:story])
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: 2.22.4
4
+ version: 2.23.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: 2021-09-10 00:00:00.000000000 Z
14
+ date: 2021-09-15 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -187,6 +187,8 @@ files:
187
187
  - lib/from_openstudio/material/window_simpleglazsys.rb
188
188
  - lib/from_openstudio/model.rb
189
189
  - lib/from_openstudio/model_object.rb
190
+ - lib/from_openstudio/schedule/ruleset.rb
191
+ - lib/from_openstudio/schedule/type_limit.rb
190
192
  - lib/from_openstudio/simulation/design_day.rb
191
193
  - lib/from_openstudio/simulation/parameter_model.rb
192
194
  - lib/from_openstudio/simulation/simulation_output.rb