honeybee-openstudio 2.8.3 → 2.9.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: 544e602c7a0c32ac70d1b6635a3bd3dfec44d1b2e80e58833025c94f37fa98cf
4
- data.tar.gz: 658f8b8062c2004bf3e5bc01505220482ca70ebf4a68aeb81ac74c71d6eb8d63
3
+ metadata.gz: 50bd29b0bca99508709cea52595072ae27dda7359bc162ef0de858175bad07ea
4
+ data.tar.gz: d3608a262db331c2e526c989300492561e45bc8c5ca72020aa12a38c349a462b
5
5
  SHA512:
6
- metadata.gz: 8d316bbfbeeba44c92915d1c76124ab510781e02ac053fd56f41b1a48aae60856a50b6c0f70aa0b3993ab46b18b0835624f50e809cb080219c98f18e24995ea4
7
- data.tar.gz: 7fb71a158188765c0a858a6948ba30f85d58323721425af3752cefcbecbc5764a65fd6e54a413cf14fa37e8d752b7623e74fb46d0aa8674b2bf9523044905378
6
+ metadata.gz: e2043a1a03fb0df9b9e7f1dee318fbef24f4be496506f93e395a3a4f6f5a646f17cd5cc71e4a162e0c4eb9f000e31619cf6c26c4c7aeb5a4a0ebab5a01d8cb4f
7
+ data.tar.gz: 144f09a0b5551652bf2b27fc8cdbb378ace72eea40f6c1ffd712e550aa91fa7d38963312957e22a2750bc5ad5e82bf0828133b456fe45322eafaa68fd9c8675d
@@ -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.8.3'
7
+ spec.version = '2.9.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
 
@@ -0,0 +1,169 @@
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 'openstudio/workflow/adapters/output_adapter'
33
+
34
+ # Local file based workflow
35
+ class HoneybeeAdapter < OpenStudio::Workflow::OutputAdapters
36
+ def initialize(options = {})
37
+ puts "viiiiiiiiiiiiizzzzzzzzz!"
38
+ STDOUT.flush
39
+ super
40
+ end
41
+
42
+ # Write to the filesystem that the process has started
43
+ #
44
+ def communicate_started
45
+ File.open("#{@options[:output_directory]}/started.job", 'w') do |f|
46
+ f << "Started Workflow #{::Time.now}"
47
+ # make sure data is written to the disk one way or the other
48
+ begin
49
+ f.fsync
50
+ rescue
51
+ f.flush
52
+ end
53
+ end
54
+ end
55
+
56
+ # Write to the filesystem that the process has completed
57
+ #
58
+ def communicate_complete
59
+ File.open("#{@options[:output_directory]}/finished.job", 'w') do |f|
60
+ f << "Finished Workflow #{::Time.now}"
61
+ # make sure data is written to the disk one way or the other
62
+ begin
63
+ f.fsync
64
+ rescue
65
+ f.flush
66
+ end
67
+ end
68
+ end
69
+
70
+ # Write to the filesystem that the process has failed
71
+ #
72
+ def communicate_failure
73
+ File.open("#{@options[:output_directory]}/failed.job", 'w') do |f|
74
+ f << "Failed Workflow #{::Time.now}"
75
+ # make sure data is written to the disk one way or the other
76
+ begin
77
+ f.fsync
78
+ rescue
79
+ f.flush
80
+ end
81
+ end
82
+ end
83
+
84
+ # Do nothing on a state transition
85
+ #
86
+ def communicate_transition(_ = nil, _ = nil, _ = nil)
87
+ end
88
+
89
+ # Do nothing on EnergyPlus stdout
90
+ #
91
+ def communicate_energyplus_stdout(line, options = {})
92
+ puts "EnergyPlus: #{line}"
93
+ end
94
+
95
+ # Do nothing on Measure result
96
+ #
97
+ def communicate_measure_result(result, options = {})
98
+ step_result = result.stepResult
99
+ initial_condition = result.stepInitialCondition
100
+ final_condition = result.stepFinalCondition
101
+ errors = result.stepErrors
102
+ warnings = result.stepWarnings
103
+ infos = result.stepInfo
104
+
105
+ # Mirrors WorkflowStepResult::string
106
+ tab = 'Honeybee '
107
+ puts "#{tab}Result: #{step_result.get.valueName}" if !step_result.empty?
108
+ puts "#{tab}Initial Condition: #{initial_condition.get}" if !initial_condition.empty?
109
+ puts "#{tab}Final Condition: #{final_condition.get}" if !final_condition.empty?
110
+ errors.each { |error| puts "#{tab}Error: #{error}" }
111
+ warnings.each { |warning| puts "#{tab}Warn: #{warning}" }
112
+ infos.each { |info| puts "#{tab}Info: #{info}" }
113
+ end
114
+
115
+ # Write the measure attributes to the filesystem
116
+ #
117
+ def communicate_measure_attributes(measure_attributes, _ = nil)
118
+ attributes_file = "#{@options[:output_directory]}/measure_attributes.json"
119
+ FileUtils.rm_f(attributes_file) if File.exist?(attributes_file)
120
+ File.open(attributes_file, 'w') do |f|
121
+ f << JSON.pretty_generate(measure_attributes)
122
+ # make sure data is written to the disk one way or the other
123
+ begin
124
+ f.fsync
125
+ rescue
126
+ f.flush
127
+ end
128
+ end
129
+ end
130
+
131
+ # Write the objective function results to the filesystem
132
+ #
133
+ def communicate_objective_function(objectives, _ = nil)
134
+ obj_fun_file = "#{@options[:output_directory]}/objectives.json"
135
+ FileUtils.rm_f(obj_fun_file) if File.exist?(obj_fun_file)
136
+ File.open(obj_fun_file, 'w') do |f|
137
+ f << JSON.pretty_generate(objectives)
138
+ # make sure data is written to the disk one way or the other
139
+ begin
140
+ f.fsync
141
+ rescue
142
+ f.flush
143
+ end
144
+ end
145
+ end
146
+
147
+ # Write the results of the workflow to the filesystem
148
+ #
149
+ def communicate_results(directory, results)
150
+ zip_results(directory)
151
+
152
+ if results.is_a? Hash
153
+ # DLM: don't we want this in the results zip?
154
+ # DLM: deprecate in favor of out.osw
155
+ File.open("#{@options[:output_directory]}/data_point_out.json", 'w') do |f|
156
+ f << JSON.pretty_generate(results)
157
+ # make sure data is written to the disk one way or the other
158
+ begin
159
+ f.fsync
160
+ rescue
161
+ f.flush
162
+ end
163
+ end
164
+ else
165
+ #puts "Unknown datapoint result type. Please handle #{results.class}"
166
+ end
167
+ end
168
+ end
169
+
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.8.3
4
+ version: 2.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tanushree Charan
@@ -163,6 +163,7 @@ files:
163
163
  - doc_templates/copyright_ruby.txt
164
164
  - honeybee-openstudio.gemspec
165
165
  - lib/files/Honeybee.rb
166
+ - lib/files/honeybee_adapter.rb
166
167
  - lib/files/honeybee_workflow.osw
167
168
  - lib/files/urbanopt_Gemfile
168
169
  - lib/from_openstudio.rb