honeybee-openstudio 2.23.4 → 2.24.0

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: b883c23eb45c35c5ff82b420a7eba79e2cf2f4c228603531c8f049bf19ca4478
4
- data.tar.gz: f2776a7b81b4cb648ecc5171fd50f79face62d79574c0651801a5bad0fd388d9
3
+ metadata.gz: aaaa7ddfb52102f325f31d2090e14c7174c3a98ba156859b989b30391a4abbdb
4
+ data.tar.gz: 5f6fb58c9f9f926fab088fb0c300cbe4527039a984d2bc5d816d72c27f64d7f7
5
5
  SHA512:
6
- metadata.gz: 005e5223dd3db47c4a86760d54ed366ed6d2e2a23c31eddb00bab5398744e95de129cac8068708f976393763228953c9ab1e9f2d01949229ca1ed980b98edb67
7
- data.tar.gz: 050271b5e95a661bcc489303f9362040a283e891410a1cb4cd71eb3af5f793a69122cbb147cf5fada554240a0a64c88f37a0b53a06188d350406ee319d3488ae
6
+ metadata.gz: 47d6f83ad9135c92c77e5924c9d1872c2b2573a2d056f9940bec7f96b7aba8e74c6bcd0aca8cd83766a79c4c8398df88bbf54ae2a29edb8a080cc6d57a6f13ef
7
+ data.tar.gz: dc582df2f41e9ffe26b67a0c92b0d256dbab7215697573655d4eb50edd6a498ef9f084fd66016f8dfff3882555afacdcb6b558db7d7ed4fabc795145d3df89af
@@ -33,7 +33,7 @@ jobs:
33
33
  - name: set up node # we need node for for semantic release
34
34
  uses: actions/setup-node@v2.1.2
35
35
  with:
36
- node-version: 14.2.0
36
+ node-version: 14.17.0
37
37
  - name: install semantic-release
38
38
  run:
39
39
  npm install @semantic-release/exec
@@ -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.23.4'
7
+ spec.version = '2.24.0'
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
 
@@ -34,7 +34,7 @@ require 'openstudio/workflow/adapters/output_adapter'
34
34
  # Local file based workflow
35
35
  class HoneybeeAdapter < OpenStudio::Workflow::OutputAdapters
36
36
  def initialize(options = {})
37
- puts "viiiiiiiiiiiiizzzzzzzzz!"
37
+
38
38
  STDOUT.flush
39
39
  super
40
40
  end
@@ -72,7 +72,7 @@ module Honeybee
72
72
  unless sub_surface.isConstructionDefaulted
73
73
  construction = sub_surface.construction
74
74
  if !construction.empty?
75
- constr_id = construction.get.nameString
75
+ constr_id = clean_identifier(construction.get.nameString)
76
76
  unless $window_constructions[constr_id].nil?
77
77
  hash[:construction] = constr_id
78
78
  end
@@ -72,7 +72,7 @@ module Honeybee
72
72
  unless sub_surface.isConstructionDefaulted
73
73
  construction = sub_surface.construction
74
74
  if !construction.empty?
75
- constr_id = construction.get.nameString
75
+ constr_id = clean_identifier(construction.get.nameString)
76
76
  if hash[:is_glass] && !$window_constructions[constr_id].nil?
77
77
  hash[:construction] = constr_id
78
78
  elsif !hash[:is_glass] && !$opaque_constructions[constr_id].nil?
@@ -74,7 +74,7 @@ module Honeybee
74
74
  unless surface.isConstructionDefaulted
75
75
  construction = surface.construction
76
76
  if !construction.empty?
77
- constr_id = construction.get.nameString
77
+ constr_id = clean_identifier(construction.get.nameString)
78
78
  unless $opaque_constructions[constr_id].nil?
79
79
  hash[:construction] = constr_id
80
80
  end
@@ -112,7 +112,7 @@ module Honeybee
112
112
  def self.story_from_space(space)
113
113
  story = space.buildingStory
114
114
  if !story.empty?
115
- return story.get.nameString
115
+ return clean_identifier(story.get.nameString)
116
116
  end
117
117
  nil
118
118
  end
@@ -62,7 +62,7 @@ module Honeybee
62
62
  unless shading_surface.isConstructionDefaulted
63
63
  construction = shading_surface.construction
64
64
  if !construction.empty?
65
- const_name = construction.get.nameString
65
+ const_name = clean_identifier(construction.get.nameString)
66
66
  hash[:construction] = const_name
67
67
  unless $shade_constructions.has_key?(const_name)
68
68
  const_obj = construction.get
@@ -74,7 +74,12 @@ module Honeybee
74
74
 
75
75
  transmittance_schedule = shading_surface.transmittanceSchedule
76
76
  if !transmittance_schedule.empty?
77
- hash[:transmittance_schedule] = transmittance_schedule.get.nameString
77
+ trans_sch_name = clean_identifier(transmittance_schedule.get.nameString)
78
+ # Check whether schedules other than schedule ruleset or schedule fixed interval are
79
+ # being assigned
80
+ unless $schedules[trans_sch_name].nil?
81
+ hash[:transmittance_schedule] = trans_sch_name
82
+ end
78
83
  end
79
84
 
80
85
  hash
@@ -48,6 +48,7 @@ require 'from_openstudio/construction/shade'
48
48
  require 'from_openstudio/construction_set'
49
49
  require 'from_openstudio/schedule/type_limit'
50
50
  require 'from_openstudio/schedule/ruleset'
51
+ require 'from_openstudio/schedule/fixed_interval'
51
52
 
52
53
  require 'openstudio'
53
54
 
@@ -64,7 +65,8 @@ module Honeybee
64
65
  hash[:tolerance] = 0.01
65
66
  hash[:angle_tolerance] = 1.0
66
67
 
67
- # Hashes for all constructions in the model
68
+ # Hashes for all shcedules and constructions in the model
69
+ $schedules = {}
68
70
  $opaque_constructions = {}
69
71
  $window_constructions = {}
70
72
  $shade_constructions = {}
@@ -133,6 +135,7 @@ module Honeybee
133
135
  hash[:construction_sets] = constructionsets_from_model(openstudio_model)
134
136
  hash[:schedule_type_limits] = schedtypelimits_from_model(openstudio_model)
135
137
  hash[:schedules] = scheduleruleset_from_model(openstudio_model)
138
+ hash[:schedules] = schedulefixedinterval_from_model(openstudio_model)
136
139
 
137
140
  hash
138
141
  end
@@ -282,7 +285,22 @@ module Honeybee
282
285
  def self.scheduleruleset_from_model(openstudio_model)
283
286
  result = []
284
287
  openstudio_model.getScheduleRulesets.each do |sch_ruleset|
285
- result << ScheduleRulesetAbridged.from_schedule_ruleset(sch_ruleset)
288
+ sched_hash = ScheduleRulesetAbridged.from_schedule_ruleset(sch_ruleset)
289
+ $schedules[sched_hash[:identifier]] = sched_hash
290
+ result << sched_hash
291
+ end
292
+ result
293
+ end
294
+
295
+ # Create HB Schedule Fixed Interval from OpenStudio Schedule Fixed Interval
296
+ def self.schedulefixedinterval_from_model(openstudio_model)
297
+ result = []
298
+ # check if it is a leap year
299
+ is_leap_year = openstudio_model.getYearDescription.isLeapYear
300
+ openstudio_model.getScheduleFixedIntervals.each do |sch_fix_int|
301
+ sched_fixed_hash = ScheduleFixedIntervalAbridged.from_schedule_fixedinterval(sch_fix_int, is_leap_year)
302
+ $schedules[sched_fixed_hash[:identifier]] = sched_fixed_hash
303
+ result << sched_fixed_hash
286
304
  end
287
305
  result
288
306
  end
@@ -0,0 +1,71 @@
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/fixed_interval'
33
+ require 'from_openstudio/model_object'
34
+
35
+ module Honeybee
36
+ class ScheduleFixedIntervalAbridged < ModelObject
37
+
38
+ def self.from_schedule_fixedinterval(schedule_fixedinterval, is_leap_year)
39
+ # create an empty hash
40
+ hash = {}
41
+ hash[:type] = 'ScheduleFixedIntervalAbridged'
42
+ hash[:identifier] = clean_name(schedule_fixedinterval.nameString)
43
+ start_month = schedule_fixedinterval.startMonth
44
+ start_day = schedule_fixedinterval.startDay
45
+ if is_leap_year
46
+ # if it is a leap year then add 1 as third value
47
+ hash[:start_date] = [start_month, start_day, 1]
48
+ else
49
+ hash[:start_date] = [start_month, start_day]
50
+ end
51
+ hash[:interpolate] = schedule_fixedinterval.interpolatetoTimestep
52
+ # assigning schedule type limit if it exists
53
+ unless schedule_fixedinterval.scheduleTypeLimits.empty?
54
+ typ_lim = schedule_fixedinterval.scheduleTypeLimits.get
55
+ hash[:schedule_type_limit] = clean_name(typ_lim.nameString)
56
+ end
57
+ interval_length = schedule_fixedinterval.intervalLength
58
+ hash[:timestep] = 60 / interval_length.to_i
59
+ # get values from schedule fixed interval
60
+ values = schedule_fixedinterval.timeSeries.values
61
+ value_array = []
62
+ for i in 0..(values.size - 1)
63
+ value_array << values[i]
64
+ end
65
+ hash[:values] = value_array
66
+
67
+ hash
68
+ end
69
+
70
+ end
71
+ end
@@ -37,7 +37,7 @@ module Honeybee
37
37
  def self.from_design_day(design_day)
38
38
  hash = {}
39
39
  hash[:type] = 'DesignDay'
40
- hash[:name] = design_day.nameString
40
+ hash[:name] = clean_identifier(design_day.nameString)
41
41
  hash[:day_type] = day_type_from_design_day(design_day)
42
42
  hash[:dry_bulb_condition] = dry_bulb_condition_from_design_day(design_day)
43
43
  hash[:humidity_condition] = humidity_condition_from_design_day(design_day)
@@ -83,4 +83,3 @@
83
83
  </file>
84
84
  </files>
85
85
  </measure>
86
- <error>cannot load such file -- honeybee/simulation/parameter</error>
@@ -43,9 +43,16 @@ module Honeybee
43
43
  end
44
44
 
45
45
  def to_openstudio(openstudio_model)
46
+ # get the vertices from the face
47
+ if @hash[:geometry][:vertices].nil?
48
+ hb_verts = @hash[:geometry][:boundary]
49
+ else
50
+ hb_verts = @hash[:geometry][:vertices]
51
+ end
52
+
46
53
  # reorder the vertices to ensure they start from the upper-left corner
47
54
  os_vertices = OpenStudio::Point3dVector.new
48
- @hash[:geometry][:boundary].each do |vertex|
55
+ hb_verts.each do |vertex|
49
56
  os_vertices << OpenStudio::Point3d.new(vertex[0], vertex[1], vertex[2])
50
57
  end
51
58
  reordered_vertices = OpenStudio.reorderULC(os_vertices)
@@ -43,9 +43,16 @@ module Honeybee
43
43
  end
44
44
 
45
45
  def to_openstudio(openstudio_model)
46
+ # get the vertices from the face
47
+ if @hash[:geometry][:vertices].nil?
48
+ hb_verts = @hash[:geometry][:boundary]
49
+ else
50
+ hb_verts = @hash[:geometry][:vertices]
51
+ end
52
+
46
53
  # create the openstudio shading surface
47
54
  os_vertices = OpenStudio::Point3dVector.new
48
- @hash[:geometry][:boundary].each do |vertex|
55
+ hb_verts.each do |vertex|
49
56
  os_vertices << OpenStudio::Point3d.new(vertex[0], vertex[1], vertex[2])
50
57
  end
51
58
  reordered_vertices = OpenStudio.reorderULC(os_vertices)
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.23.4
4
+ version: 2.24.0
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-17 00:00:00.000000000 Z
14
+ date: 2021-10-02 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -187,6 +187,7 @@ 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/fixed_interval.rb
190
191
  - lib/from_openstudio/schedule/ruleset.rb
191
192
  - lib/from_openstudio/schedule/type_limit.rb
192
193
  - lib/from_openstudio/simulation/design_day.rb