honeybee-openstudio 2.32.0 → 2.32.1

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: 1927df270811214605f2db5ed8f390dfff4213b4b8e749c6049ddf074a8be94d
4
- data.tar.gz: 0b01e83fac83f8e9950627ce130fbfbb194288230fd2c36c11f6d3b988fb2e34
3
+ metadata.gz: b1a0e49c9d5045c2b09cc0f0fbe3bd964fb4251e077eb2bd27db6bedcfcf39cd
4
+ data.tar.gz: 967f9557a5238c899c9af5214158b63f4bd9dff66074cc309bb4d3f9c59ee72a
5
5
  SHA512:
6
- metadata.gz: 672dc0bca8b45b6cf45f0af19225d86ee828ecc27c62c65d8231627ef6c0ddb677cc32a8d2c4b3364fbe51eacbbc4bdcfa84b7d3dc129b6941e8fec0416f1c0c
7
- data.tar.gz: 20c019e91bbf78bd27c009d48db0305b5bfc0cf97f7e80868c54172e0d8409a83b892ed41b806c6225fcd77a2a8376b5a01f0cd08958d27c3bcbf96fd9c3851e
6
+ metadata.gz: bf2aeec6148a31263db088720abf68dc914002d5fefb73c6ac24e599d79a148f763c4bda05d96eabaf9968ccb35519b707cb52febc84f3d7ffa8acb0924b27c6
7
+ data.tar.gz: 2ceb1977685d6b3b6fe4bc1edb69029906795d4a2f3541ecdb25226c3cc3068101c20b9dfa154a4795f5f490560717dad5e1230f41ff164fb235ba2415b4a353
@@ -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.32.0'
7
+ spec.version = '2.32.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
 
@@ -61,12 +61,16 @@ module Honeybee
61
61
  end
62
62
 
63
63
  # loop through day schedules and create openstudio schedule day object
64
+ day_schs = Hash.new
64
65
  def_day_id = @hash[:default_day_schedule]
65
66
  def_day_hash = nil
66
67
  @hash[:day_schedules].each do |day_schedule|
67
68
  if day_schedule[:identifier] != def_day_id
68
69
  day_schedule_new = OpenStudio::Model::ScheduleDay.new(openstudio_model)
69
- day_schedule_new.setName(day_schedule[:identifier])
70
+ exist_sch = openstudio_model.getScheduleDayByName(day_schedule[:identifier])
71
+ if exist_sch.empty? # make sure we don't overwrite an existing schedule day
72
+ day_schedule_new.setName(day_schedule[:identifier])
73
+ end
70
74
  unless @hash[:display_name].nil?
71
75
  day_schedule_new.setDisplayName(@hash[:display_name])
72
76
  end
@@ -81,53 +85,55 @@ module Honeybee
81
85
  time_until = OpenStudio::Time.new(0, times_day_new[i][0], times_day_new[i][1], 0)
82
86
  day_schedule_new.addValue(time_until, values_day_new[i])
83
87
  end
88
+ day_schs[day_schedule[:identifier]] = day_schedule_new
84
89
  else
85
90
  def_day_hash = day_schedule
86
91
  end
87
92
  end
88
93
 
94
+ # assign default day schedule
95
+ def_day_sch = os_sch_ruleset.defaultDaySchedule
96
+ exist_sch = openstudio_model.getScheduleDayByName(def_day_id)
97
+ if exist_sch.empty? # make sure we don't overwrite an existing schedule day
98
+ def_day_sch.setName(def_day_id)
99
+ end
100
+ unless sch_type_limit_obj.nil?
101
+ def_day_sch.setScheduleTypeLimits(sch_type_limit_obj)
102
+ end
103
+ values_day_new = def_day_hash[:values]
104
+ times_day_new = def_day_hash[:times]
105
+ times_day_new.delete_at(0) # Remove [0, 0] from array at index 0.
106
+ times_day_new.push([24, 0]) # Add [24, 0] at index 0
107
+ values_day_new.each_index do |i|
108
+ time_until = OpenStudio::Time.new(0, times_day_new[i][0], times_day_new[i][1], 0)
109
+ def_day_sch.addValue(time_until, values_day_new[i])
110
+ end
111
+ day_schs[def_day_id] = def_day_sch
112
+
89
113
  # assign holiday schedule
90
114
  if @hash[:holiday_schedule]
91
- holiday_schedule = openstudio_model.getScheduleDayByName(@hash[:holiday_schedule])
92
- unless holiday_schedule.empty?
93
- holiday_schedule_object = holiday_schedule.get
94
- os_sch_ruleset.setHolidaySchedule(holiday_schedule_object)
115
+ holiday_schedule = day_schs[@hash[:holiday_schedule]]
116
+ unless holiday_schedule.nil?
117
+ os_sch_ruleset.setHolidaySchedule(holiday_schedule)
95
118
  end
96
119
  end
97
120
 
98
121
  # assign summer design day schedule
99
122
  if @hash[:summer_designday_schedule]
100
- summer_design_day = openstudio_model.getScheduleDayByName(@hash[:summer_designday_schedule])
101
- unless summer_design_day.empty?
102
- summer_design_day_object = summer_design_day.get
103
- os_sch_ruleset.setSummerDesignDaySchedule(summer_design_day_object)
123
+ summer_design_day = day_schs[@hash[:summer_designday_schedule]]
124
+ unless summer_design_day.nil?
125
+ os_sch_ruleset.setSummerDesignDaySchedule(summer_design_day)
104
126
  end
105
127
  end
106
128
 
107
129
  # assign winter design day schedule
108
130
  if @hash[:winter_designday_schedule]
109
- winter_design_day = openstudio_model.getScheduleDayByName(@hash[:winter_designday_schedule])
110
- unless winter_design_day.empty?
111
- winter_design_day_object = winter_design_day.get
112
- os_sch_ruleset.setWinterDesignDaySchedule(winter_design_day_object)
131
+ winter_design_day = day_schs[@hash[:winter_designday_schedule]]
132
+ unless winter_design_day.nil?
133
+ os_sch_ruleset.setWinterDesignDaySchedule(winter_design_day)
113
134
  end
114
135
  end
115
136
 
116
- # assign default day schedule
117
- def_day_sch = os_sch_ruleset.defaultDaySchedule
118
- def_day_sch.setName(def_day_id)
119
- unless sch_type_limit_obj.nil?
120
- def_day_sch.setScheduleTypeLimits(sch_type_limit_obj)
121
- end
122
- values_day_new = def_day_hash[:values]
123
- times_day_new = def_day_hash[:times]
124
- times_day_new.delete_at(0) # Remove [0, 0] from array at index 0.
125
- times_day_new.push([24, 0]) # Add [24, 0] at index 0
126
- values_day_new.each_index do |i|
127
- time_until = OpenStudio::Time.new(0, times_day_new[i][0], times_day_new[i][1], 0)
128
- def_day_sch.addValue(time_until, values_day_new[i])
129
- end
130
-
131
137
  # assign schedule rules
132
138
  if @hash[:schedule_rules]
133
139
  @hash[:schedule_rules].each do |rule|
@@ -145,12 +151,10 @@ module Honeybee
145
151
  openstudio_schedule_rule.setStartDate(start_date)
146
152
  openstudio_schedule_rule.setEndDate(end_date)
147
153
 
148
- schedule_rule_day = openstudio_model.getScheduleDayByName(rule[:schedule_day])
149
- unless schedule_rule_day.empty?
150
- schedule_rule_day_object = schedule_rule_day.get
151
-
152
- values_day = schedule_rule_day_object.values
153
- times_day = schedule_rule_day_object.times
154
+ schedule_rule_day = day_schs[rule[:schedule_day]]
155
+ unless schedule_rule_day.nil?
156
+ values_day = schedule_rule_day.values
157
+ times_day = schedule_rule_day.times
154
158
 
155
159
  values_day.each_index do |i|
156
160
  openstudio_schedule_rule.daySchedule.addValue(times_day[i], values_day[i])
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.32.0
4
+ version: 2.32.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: 2022-09-02 00:00:00.000000000 Z
14
+ date: 2022-09-09 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler