honeybee-openstudio 2.22.3 → 2.22.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b23a8787eb73cfedcfb87593efb1089039ddf316fef2c45ef5911251a2a7b7fe
4
- data.tar.gz: '019c3ea7029d7372de457911e7fbb08f690f83fc27e5605249e273b9bb677701'
3
+ metadata.gz: f8767065c98f72114b89b1d16304efe93ca0003a357f647954b0beed6989b1ec
4
+ data.tar.gz: 1ed4757de90face39cbc8309e45d5e1a872288bab0f9240da9a9d4b8db18dada
5
5
  SHA512:
6
- metadata.gz: 3ebc33a0448cfc47bf86dc954d7186798d35482975b5a3fd66efcfe7003e7c1e06b43334621935e5eda599e433c68b3e64d7b9414bc80280af8b56ad503b55b4
7
- data.tar.gz: 9923b7fec07cc6729d8a7f882802022629073671e2e2d9c53e5afb244ddbb9e87a8fd3a93e32a748742ba1cc079b32dc1e5d4a36b598d68b36deefc6574bf7ac
6
+ metadata.gz: '0925da969e4768649654327dd2574ab5cd4caec284ae804c42ae7fb772e139aae63d852a52b1406fb81e1c6db0fa1658f170c29389614bf0e3cc4d4054a428d4'
7
+ data.tar.gz: '091488d2fa18fa7f06452c43fea7d6559fdaa8591f04c9b5fa8732d65b0119e39aa789ba2c82ce806b5346aceabc44423ecd9c5d103d9f2cbb3d31e615f1e4d6'
@@ -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.22.4'
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
@@ -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
@@ -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
 
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.22.4
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-10 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler