honeybee-openstudio 2.22.3 → 2.23.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/honeybee-openstudio.gemspec +1 -1
  3. data/lib/from_openstudio/construction/air.rb +2 -2
  4. data/lib/from_openstudio/construction/opaque.rb +2 -2
  5. data/lib/from_openstudio/construction/shade.rb +2 -2
  6. data/lib/from_openstudio/construction/window.rb +2 -2
  7. data/lib/from_openstudio/construction_set.rb +14 -14
  8. data/lib/from_openstudio/geometry/aperture.rb +1 -1
  9. data/lib/from_openstudio/geometry/door.rb +1 -1
  10. data/lib/from_openstudio/geometry/face.rb +1 -1
  11. data/lib/from_openstudio/geometry/room.rb +1 -1
  12. data/lib/from_openstudio/geometry/shade.rb +1 -1
  13. data/lib/from_openstudio/material/opaque.rb +1 -1
  14. data/lib/from_openstudio/material/opaque_no_mass.rb +1 -1
  15. data/lib/from_openstudio/material/window_blind.rb +1 -1
  16. data/lib/from_openstudio/material/window_gas.rb +1 -1
  17. data/lib/from_openstudio/material/window_gas_custom.rb +1 -1
  18. data/lib/from_openstudio/material/window_gas_mixture.rb +1 -1
  19. data/lib/from_openstudio/material/window_glazing.rb +1 -1
  20. data/lib/from_openstudio/material/window_simpleglazsys.rb +1 -1
  21. data/lib/from_openstudio/model.rb +23 -2
  22. data/lib/from_openstudio/schedule/ruleset.rb +140 -0
  23. data/lib/from_openstudio/schedule/type_limit.rb +75 -0
  24. data/lib/from_openstudio.rb +5 -1
  25. data/lib/honeybee/_defaults/energy_default.json +8 -2
  26. data/lib/honeybee/model.rb +1 -0
  27. data/lib/honeybee/model_object.rb +11 -3
  28. data/lib/measures/from_honeybee_model_to_gbxml/measure.rb +1 -0
  29. data/lib/to_openstudio/construction/window.rb +18 -9
  30. data/lib/to_openstudio/geometry/room.rb +8 -0
  31. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b23a8787eb73cfedcfb87593efb1089039ddf316fef2c45ef5911251a2a7b7fe
4
- data.tar.gz: '019c3ea7029d7372de457911e7fbb08f690f83fc27e5605249e273b9bb677701'
3
+ metadata.gz: f5b611d0b78befb14bd1968ad3bc09479295c7367265049523c28ef3b3e3feeb
4
+ data.tar.gz: 6630478417dcc8d8680339b3d673b857ac6e0593152310213a3dc9c6eb227914
5
5
  SHA512:
6
- metadata.gz: 3ebc33a0448cfc47bf86dc954d7186798d35482975b5a3fd66efcfe7003e7c1e06b43334621935e5eda599e433c68b3e64d7b9414bc80280af8b56ad503b55b4
7
- data.tar.gz: 9923b7fec07cc6729d8a7f882802022629073671e2e2d9c53e5afb244ddbb9e87a8fd3a93e32a748742ba1cc079b32dc1e5d4a36b598d68b36deefc6574bf7ac
6
+ metadata.gz: 549cb01585b8b2983b5d5014703325bf87a83db1cc600c4f4ed557a501d998cc5e2632970a7d58d0c75d7a34234a11befbe2eb27c49c085303d25708040c794a
7
+ data.tar.gz: 16c6ed67bb2a2a8a5e83fe63641dee6db8df13a855103149565a4d476e0746c02a7837d12307f45ad67fe77854d2c572fcd39323434be5338395e27bb98f36a5
@@ -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.3'
7
+ spec.version = '2.23.1'
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
 
@@ -40,11 +40,11 @@ module Honeybee
40
40
  hash = {}
41
41
  hash[:type] = 'AirBoundaryConstructionAbridged'
42
42
  # set hash values from OpenStudio Object
43
- hash[:identifier] = construction.nameString
43
+ hash[:identifier] = clean_name(construction.nameString)
44
44
  # check if boost optional object is empty
45
45
  unless construction.simpleMixingSchedule.empty?
46
46
  schedule = construction.simpleMixingSchedule.get
47
- hash[:air_mixing_schedule] = schedule.nameString
47
+ hash[:air_mixing_schedule] = clean_name(schedule.nameString)
48
48
  end
49
49
  #TODO: Add air_mixing_per_area
50
50
 
@@ -40,12 +40,12 @@ module Honeybee
40
40
  hash = {}
41
41
  hash[:type] = 'OpaqueConstructionAbridged'
42
42
  # set hash values from OpenStudio Object
43
- hash[:identifier] = construction.nameString
43
+ hash[:identifier] = clean_name(construction.nameString)
44
44
  hash[:materials] = []
45
45
  # get construction layers
46
46
  layers = construction.layers
47
47
  layers.each do |layer|
48
- name = layer.nameString
48
+ name = clean_name(layer.nameString)
49
49
  hash[:materials] << name
50
50
  end
51
51
 
@@ -40,7 +40,7 @@ module Honeybee
40
40
  hash = {}
41
41
  hash[:type] = 'ShadeConstruction'
42
42
  # set hash values from OpenStudio Object
43
- hash[:identifier] = construction.nameString
43
+ hash[:identifier] = clean_name(construction.nameString)
44
44
  # get outermost construction layers
45
45
  layer = construction.layers[0]
46
46
  if layer.to_StandardGlazing.is_initialized
@@ -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
@@ -40,12 +40,12 @@ module Honeybee
40
40
  hash = {}
41
41
  hash[:type] = 'WindowConstructionAbridged'
42
42
  # set hash values from OpenStudio Object
43
- hash[:identifier] = construction.nameString
43
+ hash[:identifier] = clean_name(construction.nameString)
44
44
  hash[:materials] = []
45
45
  # get construction layers
46
46
  layers = construction.layers
47
47
  layers.each do |layer|
48
- name = layer.nameString
48
+ name = clean_name(layer.nameString)
49
49
  hash[:materials] << name
50
50
  end
51
51
 
@@ -40,7 +40,7 @@ module Honeybee
40
40
  hash = {}
41
41
  hash[:type] = 'ConstructionSetAbridged'
42
42
  # set hash values from OpenStudio Object
43
- hash[:identifier] = construction_set.nameString
43
+ hash[:identifier] = clean_name(construction_set.nameString)
44
44
  hash[:wall_set] = {}
45
45
  hash[:floor_set] = {}
46
46
  hash[:aperture_set] = {}
@@ -53,17 +53,17 @@ module Honeybee
53
53
  # get interior wall construction
54
54
  unless int_surf_construction.wallConstruction.empty?
55
55
  int_wall_const = int_surf_construction.wallConstruction.get
56
- hash[:wall_set][:interior_construction] = int_wall_const.nameString
56
+ hash[:wall_set][:interior_construction] = clean_name(int_wall_const.nameString)
57
57
  end
58
58
  # get interior floor construction
59
59
  unless int_surf_construction.floorConstruction.empty?
60
60
  int_floor_const = int_surf_construction.floorConstruction.get
61
- hash[:floor_set][:interior_construction] = int_floor_const.nameString
61
+ hash[:floor_set][:interior_construction] = clean_name(int_floor_const.nameString)
62
62
  end
63
63
  # get interior roofceiling construction
64
64
  unless int_surf_construction.roofCeilingConstruction.empty?
65
65
  int_roof_const = int_surf_construction.roofCeilingConstruction.get
66
- hash[:roof_ceiling_set][:interior_construction] = int_roof_const.nameString
66
+ hash[:roof_ceiling_set][:interior_construction] = clean_name(int_roof_const.nameString)
67
67
  end
68
68
  end
69
69
 
@@ -72,17 +72,17 @@ module Honeybee
72
72
  int_subsurf_const = construction_set.defaultInteriorSubSurfaceConstructions.get
73
73
  unless int_subsurf_const.fixedWindowConstruction.empty?
74
74
  int_wind_const = int_subsurf_const.fixedWindowConstruction.get
75
- hash[:aperture_set][:window_construction] = int_wind_const.nameString
75
+ hash[:aperture_set][:window_construction] = clean_name(int_wind_const.nameString)
76
76
  end
77
77
  # get interior door construction
78
78
  unless int_subsurf_const.doorConstruction.empty?
79
79
  int_door_const = int_subsurf_const.doorConstruction.get
80
- hash[:door_set][:interior_construction] = int_door_const.nameString
80
+ hash[:door_set][:interior_construction] = clean_name(int_door_const.nameString)
81
81
  end
82
82
  # get interior glass door construction
83
83
  unless int_subsurf_const.glassDoorConstruction.empty?
84
84
  int_glass_door_const = int_subsurf_const.glassDoorConstruction.get
85
- hash[:door_set][:interior_glass_construction] = int_glass_door_const.nameString
85
+ hash[:door_set][:interior_glass_construction] = clean_name(int_glass_door_const.nameString)
86
86
  end
87
87
  end
88
88
 
@@ -92,17 +92,17 @@ module Honeybee
92
92
  # get exterior wall construction
93
93
  unless ext_surf_const.wallConstruction.empty?
94
94
  ext_wall_const = ext_surf_const.wallConstruction.get
95
- hash[:wall_set][:exterior_construction] = ext_wall_const.nameString
95
+ hash[:wall_set][:exterior_construction] = clean_name(ext_wall_const.nameString)
96
96
  end
97
97
  # get exterior floor construction
98
98
  unless ext_surf_const.floorConstruction.empty?
99
99
  ext_floor_const = ext_surf_const.floorConstruction.get
100
- hash[:floor_set][:exterior_construction] = ext_floor_const.nameString
100
+ hash[:floor_set][:exterior_construction] = clean_name(ext_floor_const.nameString)
101
101
  end
102
102
  # get exterior roofceiling construction
103
103
  unless ext_surf_const.roofCeilingConstruction.empty?
104
104
  ext_roof_const = ext_surf_const.roofCeilingConstruction.get
105
- hash[:roof_ceiling_set][:exterior_construction] = ext_roof_const.nameString
105
+ hash[:roof_ceiling_set][:exterior_construction] = clean_name(ext_roof_const.nameString)
106
106
  end
107
107
  end
108
108
 
@@ -112,22 +112,22 @@ module Honeybee
112
112
  # get exterior operable window construction
113
113
  unless ext_subsurf_const.operableWindowConstruction.empty?
114
114
  ext_wind_const = ext_subsurf_const.operableWindowConstruction.get
115
- hash[:aperture_set][:operable_construction] = ext_wind_const.nameString
115
+ hash[:aperture_set][:operable_construction] = clean_name(ext_wind_const.nameString)
116
116
  end
117
117
  # get exterior skylight construction
118
118
  unless ext_subsurf_const.skylightConstruction.empty?
119
119
  ext_skylight_const = ext_subsurf_const.skylightConstruction.get
120
- hash[:aperture_set][:skylight_construction] = ext_skylight_const.nameString
120
+ hash[:aperture_set][:skylight_construction] = clean_name(ext_skylight_const.nameString)
121
121
  end
122
122
  # get exterior door construction
123
123
  unless ext_subsurf_const.doorConstruction.empty?
124
124
  ext_door_const = ext_subsurf_const.doorConstruction.get
125
- hash[:door_set][:exterior_construction] = ext_door_const.nameString
125
+ hash[:door_set][:exterior_construction] = clean_name(ext_door_const.nameString)
126
126
  end
127
127
  # get exterior overhead door construction
128
128
  unless ext_subsurf_const.overheadDoorConstruction.empty?
129
129
  ext_ovhd_door_const = ext_subsurf_const.overheadDoorConstruction.get
130
- hash[:door_set][:overhead_construction] = ext_ovhd_door_const.nameString
130
+ hash[:door_set][:overhead_construction] = clean_name(ext_ovhd_door_const.nameString)
131
131
  end
132
132
  end
133
133
 
@@ -40,7 +40,7 @@ module Honeybee
40
40
  hash = {}
41
41
  hash[:type] = 'Aperture'
42
42
  hash[:identifier] = clean_identifier(sub_surface.nameString)
43
- hash[:display_name] = clean_display_name(sub_surface.nameString)
43
+ hash[:display_name] = clean_name(sub_surface.nameString)
44
44
  hash[:user_data] = {handle: sub_surface.handle.to_s}
45
45
  hash[:properties] = properties_from_sub_surface(sub_surface)
46
46
  hash[:geometry] = geometry_from_sub_surface(sub_surface, site_transformation)
@@ -40,7 +40,7 @@ module Honeybee
40
40
  hash = {}
41
41
  hash[:type] = 'Door'
42
42
  hash[:identifier] = clean_identifier(sub_surface.nameString)
43
- hash[:display_name] = clean_display_name(sub_surface.nameString)
43
+ hash[:display_name] = clean_name(sub_surface.nameString)
44
44
  hash[:user_data] = {handle: sub_surface.handle.to_s}
45
45
  hash[:properties] = properties_from_sub_surface(sub_surface)
46
46
  hash[:geometry] = geometry_from_sub_surface(sub_surface, site_transformation)
@@ -38,7 +38,7 @@ module Honeybee
38
38
  hash = {}
39
39
  hash[:type] = 'Face'
40
40
  hash[:identifier] = clean_identifier(surface.nameString)
41
- hash[:display_name] = clean_display_name(surface.nameString)
41
+ hash[:display_name] = clean_name(surface.nameString)
42
42
  hash[:user_data] = {handle: surface.handle.to_s}
43
43
  hash[:properties] = properties_from_surface(surface)
44
44
  hash[:geometry] = geometry_from_surface(surface, site_transformation)
@@ -38,7 +38,7 @@ module Honeybee
38
38
  hash = {}
39
39
  hash[:type] = 'Room'
40
40
  hash[:identifier] = clean_identifier(space.nameString)
41
- hash[:display_name] = clean_display_name(space.nameString)
41
+ hash[:display_name] = clean_name(space.nameString)
42
42
  hash[:user_data] = {space: space.handle.to_s}
43
43
  hash[:properties] = properties_from_space(space)
44
44
 
@@ -40,7 +40,7 @@ module Honeybee
40
40
  hash = {}
41
41
  hash[:type] = 'Shade'
42
42
  hash[:identifier] = clean_identifier(shading_surface.nameString)
43
- hash[:display_name] = clean_display_name(shading_surface.nameString)
43
+ hash[:display_name] = clean_name(shading_surface.nameString)
44
44
  hash[:user_data] = {handle: shading_surface.handle.to_s}
45
45
  hash[:properties] = properties_from_shading_surface(shading_surface)
46
46
  hash[:geometry] = geometry_from_shading_surface(shading_surface, site_transformation)
@@ -40,7 +40,7 @@ module Honeybee
40
40
  hash = {}
41
41
  hash[:type] = 'EnergyMaterial'
42
42
  # set hash values from OpenStudio Object
43
- hash[:identifier] = material.nameString
43
+ hash[:identifier] = clean_name(material.nameString)
44
44
  hash[:thickness] = material.thickness
45
45
  hash[:conductivity] = material.conductivity
46
46
  hash[:density] = material.density
@@ -40,7 +40,7 @@ module Honeybee
40
40
  hash = {}
41
41
  hash[:type] = 'EnergyMaterialNoMass'
42
42
  # set hash values from OpenStudio Object
43
- hash[:identifier] = material.nameString
43
+ hash[:identifier] = clean_name(material.nameString)
44
44
  hash[:r_value] = material.thermalResistance
45
45
 
46
46
  if material.to_MasslessOpaqueMaterial.is_initialized
@@ -40,7 +40,7 @@ module Honeybee
40
40
  hash = {}
41
41
  hash[:type] = 'EnergyWindowMaterialBlind'
42
42
  # set hash values from OpenStudio Object
43
- hash[:identifier] = material.nameString
43
+ hash[:identifier] = clean_name(material.nameString)
44
44
  hash[:slat_orientation] = material.slatOrientation
45
45
  hash[:slat_width] = material.slatWidth
46
46
  hash[:slat_separation] = material.slatSeparation
@@ -40,7 +40,7 @@ module Honeybee
40
40
  hash = {}
41
41
  hash[:type] = 'EnergyWindowMaterialGas'
42
42
  # set hash values from OpenStudio Object
43
- hash[:identifier] = material.nameString
43
+ hash[:identifier] = clean_name(material.nameString)
44
44
  hash[:thickness] = material.thickness
45
45
  hash[:gas_type] = material.gasType
46
46
 
@@ -40,7 +40,7 @@ module Honeybee
40
40
  hash = {}
41
41
  hash[:type] = 'EnergyWindowMaterialGasCustom'
42
42
  # set hash values from OpenStudio Object
43
- hash[:identifier] = material.nameString
43
+ hash[:identifier] = clean_name(material.nameString)
44
44
  hash[:thickness] = material.thickness
45
45
  # check if boost optional object is empty
46
46
  unless material.customConductivityCoefficientA.empty?
@@ -40,7 +40,7 @@ module Honeybee
40
40
  hash = {}
41
41
  hash[:type] = 'EnergyWindowMaterialGasMixture'
42
42
  # set hash values from OpenStudio Object
43
- hash[:identifier] = material.nameString
43
+ hash[:identifier] = clean_name(material.nameString)
44
44
  hash[:thickness] = material.thickness
45
45
  hash[:gas_types] = []
46
46
  hash[:gas_fractions] = []
@@ -40,7 +40,7 @@ module Honeybee
40
40
  hash = {}
41
41
  hash[:type] = 'EnergyWindowMaterialGlazing'
42
42
  # set hash values from OpenStudio Object
43
- hash[:identifier] = material.nameString
43
+ hash[:identifier] = clean_name(material.nameString)
44
44
  hash[:thickness] = material.thickness
45
45
  hash[:solar_transmittance] = material.solarTransmittance
46
46
  # check if boost optional object is empty
@@ -40,7 +40,7 @@ module Honeybee
40
40
  hash = {}
41
41
  hash[:type] = 'EnergyWindowMaterialSimpleGlazSys'
42
42
  # set hash values from OpenStudio Object
43
- hash[:identifier] = material.nameString
43
+ hash[:identifier] = clean_name(material.nameString)
44
44
  hash[:u_factor] = material.uFactor
45
45
  hash[:shgc] = material.solarHeatGainCoefficient
46
46
  # check if boost optional object is empty
@@ -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,75 @@
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
+ end
69
+ hash[:unit_type] = unit_type
70
+
71
+ hash
72
+ end
73
+
74
+ end # ScheduleTypeLimit
75
+ 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,6 +36,13 @@ 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
+
39
46
  def method_missing(sym, *args)
40
47
  name = sym.to_s
41
48
  aname = name.sub('=', '')
@@ -99,13 +106,14 @@ module Honeybee
99
106
  end
100
107
 
101
108
  # remove illegal characters in identifier
102
- def self.clean_display_name(str)
103
- str.gsub(/[^[:ascii:]]/, '')
109
+ def self.clean_name(str)
110
+ ascii = str.encode(Encoding.find('ASCII'), @@encoding_options)
104
111
  end
105
112
 
106
113
  # remove illegal characters in identifier
107
114
  def self.clean_identifier(str)
108
- str.gsub(/[^.A-Za-z0-9_-]/, '_').gsub(' ', '_')
115
+ encode_str = str.encode(Encoding.find('ASCII'), @@encoding_options)
116
+ encode_str.gsub(/[^.A-Za-z0-9_-]/, '_').gsub(' ', '_')
109
117
  end
110
118
 
111
119
 
@@ -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.3
4
+ version: 2.23.1
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-07 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