openstudio-workflow 1.3.3 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +77 -72
  3. data/README.md +93 -93
  4. data/Rakefile +36 -36
  5. data/lib/openstudio-workflow.rb +65 -49
  6. data/lib/openstudio/workflow/adapters/input/local.rb +324 -301
  7. data/lib/openstudio/workflow/adapters/output/local.rb +161 -97
  8. data/lib/openstudio/workflow/adapters/output/socket.rb +107 -91
  9. data/lib/openstudio/workflow/adapters/output/web.rb +82 -66
  10. data/lib/openstudio/workflow/adapters/output_adapter.rb +163 -147
  11. data/lib/openstudio/workflow/job.rb +57 -22
  12. data/lib/openstudio/workflow/jobs/resources/monthly_report.idf +222 -222
  13. data/lib/openstudio/workflow/jobs/run_energyplus.rb +70 -54
  14. data/lib/openstudio/workflow/jobs/run_ep_measures.rb +73 -57
  15. data/lib/openstudio/workflow/jobs/run_initialization.rb +203 -171
  16. data/lib/openstudio/workflow/jobs/run_os_measures.rb +89 -73
  17. data/lib/openstudio/workflow/jobs/run_postprocess.rb +73 -57
  18. data/lib/openstudio/workflow/jobs/run_preprocess.rb +104 -80
  19. data/lib/openstudio/workflow/jobs/run_reporting_measures.rb +118 -102
  20. data/lib/openstudio/workflow/jobs/run_translation.rb +84 -68
  21. data/lib/openstudio/workflow/multi_delegator.rb +62 -46
  22. data/lib/openstudio/workflow/registry.rb +172 -137
  23. data/lib/openstudio/workflow/run.rb +328 -312
  24. data/lib/openstudio/workflow/time_logger.rb +96 -53
  25. data/lib/openstudio/workflow/util.rb +49 -14
  26. data/lib/openstudio/workflow/util/energyplus.rb +605 -570
  27. data/lib/openstudio/workflow/util/io.rb +68 -33
  28. data/lib/openstudio/workflow/util/measure.rb +650 -615
  29. data/lib/openstudio/workflow/util/model.rb +151 -100
  30. data/lib/openstudio/workflow/util/post_process.rb +238 -187
  31. data/lib/openstudio/workflow/util/weather_file.rb +143 -108
  32. data/lib/openstudio/workflow/version.rb +40 -24
  33. data/lib/openstudio/workflow_json.rb +476 -443
  34. data/lib/openstudio/workflow_runner.rb +268 -252
  35. metadata +23 -23
@@ -1,108 +1,143 @@
1
- module OpenStudio
2
- module Workflow
3
- module Util
4
- # The current precedence rules for weather files are defined in this module. Best practice is to only use the
5
- # #get_weather_file method, as it will be forward compatible
6
- #
7
- module WeatherFile
8
- # Returns the weather file with precedence
9
- #
10
- # @param [String] directory The directory to append all relative directories to, see #get_weather_file_from_fs
11
- # @param [String] wf The weather file being searched for. If not the name of the file this parameter should be
12
- # the absolute path specifying it's location
13
- # @param [Array] wf_search_array The set of precedence ordered relative directories to search for the wf in. A
14
- # typical entry might look like `['files', '../../files', '../../weather']`
15
- # @param [Object] model The OpenStudio::Model object to parse, see #get_weather_file_from_osm
16
- # @return [String, nil] The weather file with precedence if defined, nil if not, and a failure if the wf is
17
- # defined but not in the filesystem
18
- #
19
- def get_weather_file(directory, wf, wf_search_array, model, logger = nil)
20
- # TODO: this logic needs some updating, weather file should come from current model, found using search paths
21
- logger ||= ::Logger.new(STDOUT) unless logger
22
- if wf
23
- weather_file = get_weather_file_from_fs(directory, wf, wf_search_array, logger)
24
- raise 'Could not locate the weather file in the filesystem. Please see the log' if weather_file == false
25
- end
26
- weather_file = get_weather_file_from_osm(model, logger) if weather_file.nil?
27
- raise 'Could not locate the weather file in the filesystem. Please see the log' if weather_file == false
28
- logger.warn 'The weather file could not be determined. Please see the log for details' unless weather_file
29
- weather_file
30
- end
31
-
32
- private
33
-
34
- # Returns the weather file from the model. If the weather file is defined in the model, then
35
- # it checks the file paths to check if the model exists. This allows for a user to upload a
36
- # weather file in a measure and then have the measure's path be used for the weather file.
37
- #
38
- # @todo (rhorsey) verify the description of this method, as it seems suspect
39
- # @param [Object] model The OpenStudio::Model object to retrieve the weather file from
40
- # @return [nil,false, String] If the result is nil the weather file was not defined in the model, if the result
41
- # is false the weather file was set but could not be found on the filesystem, if a string the weather file was
42
- # defined and it's existence verified
43
- #
44
- def get_weather_file_from_osm(model, logger)
45
- wf = nil
46
- # grab the weather file out of the OSM if it exists
47
- if model.weatherFile.empty?
48
- logger.warn 'No weather file defined in the model'
49
- else
50
- p = model.weatherFile.get.path.get.to_s.gsub('file://', '')
51
- wf = if File.exist? p
52
- File.absolute_path(p)
53
- else
54
- # this is the weather file from the OSM model
55
- File.absolute_path(@model.weatherFile.get.path.get.to_s)
56
- end
57
- logger.info "The weather file path found in the model object: #{wf}"
58
- unless File.exist? wf
59
- logger.warn 'The weather file could not be found on the filesystem.'
60
- wf = false
61
- end
62
- end
63
- wf
64
- end
65
-
66
- # Returns the weather file defined in the OSW
67
- #
68
- # @param [String] directory The base directory to append all relative directories to
69
- # @param [String] wf The weather file being searched for. If not the name of the file this parameter should be
70
- # the absolute path specifying it's location
71
- # @param [Array] wf_search_array The set of precedence ordered relative directories to search for the wf in. A
72
- # typical entry might look like `['files', '../../files', '../../weather']`
73
- # @return [nil, false, String] If the result is nil the weather file was not defined in the workflow, if the
74
- # result is false the weather file was set but could not be found on the filesystem, if a string the weather
75
- # file was defined and it's existence verified. The order of precedence for paths is as follows: 1 - an
76
- # absolute path defined in wf, 2 - the wf_search_array, should it be defined, joined with the weather file and
77
- # appended to the directory, with each entry in the array searched until the wf is found
78
- #
79
- def get_weather_file_from_fs(directory, wf, wf_search_array, logger)
80
- raise "wf was defined as #{wf}. Please correct" unless wf
81
- weather_file = nil
82
- if Pathname.new(wf).absolute?
83
- weather_file = wf
84
- else
85
- wf_search_array.each do |wf_dir|
86
- logger.warn "The path #{wf_dir} does not exist" unless File.exist? File.join(directory, wf_dir)
87
- next unless File.exist? File.join(directory, wf_dir)
88
- if Dir.entries(File.join(directory, wf_dir)).include? File.basename(wf)
89
- weather_file = File.absolute_path(File.join(directory, wf_dir, wf))
90
- break
91
- end
92
- end
93
- end
94
- unless weather_file
95
- logger.warn 'The weather file was not found on the filesystem'
96
- return nil
97
- end
98
- logger.info "Weather file with precedence in the file system is #{weather_file}"
99
- unless File.exist? weather_file
100
- logger.warn 'The weather file could not be found on the filesystem'
101
- weather_file = false
102
- end
103
- weather_file
104
- end
105
- end
106
- end
107
- end
108
- end
1
+ # *******************************************************************************
2
+ # OpenStudio(R), Copyright (c) 2008-2018, Alliance for Sustainable Energy, LLC.
3
+ # All rights reserved.
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are met:
6
+ #
7
+ # (1) Redistributions of source code must retain the above copyright notice,
8
+ # this list of conditions and the following disclaimer.
9
+ #
10
+ # (2) Redistributions in binary form must reproduce the above copyright notice,
11
+ # this list of conditions and the following disclaimer in the documentation
12
+ # and/or other materials provided with the distribution.
13
+ #
14
+ # (3) Neither the name of the copyright holder nor the names of any contributors
15
+ # may be used to endorse or promote products derived from this software without
16
+ # specific prior written permission from the respective party.
17
+ #
18
+ # (4) Other than as required in clauses (1) and (2), distributions in any form
19
+ # of modifications or other derivative works may not use the "OpenStudio"
20
+ # trademark, "OS", "os", or any other confusingly similar designation without
21
+ # specific prior written permission from Alliance for Sustainable Energy, LLC.
22
+ #
23
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
27
+ # GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28
+ # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
33
+ # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+ # *******************************************************************************
35
+
36
+ module OpenStudio
37
+ module Workflow
38
+ module Util
39
+ # The current precedence rules for weather files are defined in this module. Best practice is to only use the
40
+ # #get_weather_file method, as it will be forward compatible
41
+ #
42
+ module WeatherFile
43
+ # Returns the weather file with precedence
44
+ #
45
+ # @param [String] directory The directory to append all relative directories to, see #get_weather_file_from_fs
46
+ # @param [String] wf The weather file being searched for. If not the name of the file this parameter should be
47
+ # the absolute path specifying it's location
48
+ # @param [Array] wf_search_array The set of precedence ordered relative directories to search for the wf in. A
49
+ # typical entry might look like `['files', '../../files', '../../weather']`
50
+ # @param [Object] model The OpenStudio::Model object to parse, see #get_weather_file_from_osm
51
+ # @return [String, nil] The weather file with precedence if defined, nil if not, and a failure if the wf is
52
+ # defined but not in the filesystem
53
+ #
54
+ def get_weather_file(directory, wf, wf_search_array, model, logger = nil)
55
+ # TODO: this logic needs some updating, weather file should come from current model, found using search paths
56
+ logger ||= ::Logger.new(STDOUT) unless logger
57
+ if wf
58
+ weather_file = get_weather_file_from_fs(directory, wf, wf_search_array, logger)
59
+ raise 'Could not locate the weather file in the filesystem. Please see the log' if weather_file == false
60
+ end
61
+ weather_file = get_weather_file_from_osm(model, logger) if weather_file.nil?
62
+ raise 'Could not locate the weather file in the filesystem. Please see the log' if weather_file == false
63
+ logger.warn 'The weather file could not be determined. Please see the log for details' unless weather_file
64
+ weather_file
65
+ end
66
+
67
+ private
68
+
69
+ # Returns the weather file from the model. If the weather file is defined in the model, then
70
+ # it checks the file paths to check if the model exists. This allows for a user to upload a
71
+ # weather file in a measure and then have the measure's path be used for the weather file.
72
+ #
73
+ # @todo (rhorsey) verify the description of this method, as it seems suspect
74
+ # @param [Object] model The OpenStudio::Model object to retrieve the weather file from
75
+ # @return [nil,false, String] If the result is nil the weather file was not defined in the model, if the result
76
+ # is false the weather file was set but could not be found on the filesystem, if a string the weather file was
77
+ # defined and it's existence verified
78
+ #
79
+ def get_weather_file_from_osm(model, logger)
80
+ wf = nil
81
+ # grab the weather file out of the OSM if it exists
82
+ if model.weatherFile.empty?
83
+ logger.warn 'No weather file defined in the model'
84
+ else
85
+ p = model.weatherFile.get.path.get.to_s.gsub('file://', '')
86
+ wf = if File.exist? p
87
+ File.absolute_path(p)
88
+ else
89
+ # this is the weather file from the OSM model
90
+ File.absolute_path(@model.weatherFile.get.path.get.to_s)
91
+ end
92
+ logger.info "The weather file path found in the model object: #{wf}"
93
+ unless File.exist? wf
94
+ logger.warn 'The weather file could not be found on the filesystem.'
95
+ wf = false
96
+ end
97
+ end
98
+ wf
99
+ end
100
+
101
+ # Returns the weather file defined in the OSW
102
+ #
103
+ # @param [String] directory The base directory to append all relative directories to
104
+ # @param [String] wf The weather file being searched for. If not the name of the file this parameter should be
105
+ # the absolute path specifying it's location
106
+ # @param [Array] wf_search_array The set of precedence ordered relative directories to search for the wf in. A
107
+ # typical entry might look like `['files', '../../files', '../../weather']`
108
+ # @return [nil, false, String] If the result is nil the weather file was not defined in the workflow, if the
109
+ # result is false the weather file was set but could not be found on the filesystem, if a string the weather
110
+ # file was defined and it's existence verified. The order of precedence for paths is as follows: 1 - an
111
+ # absolute path defined in wf, 2 - the wf_search_array, should it be defined, joined with the weather file and
112
+ # appended to the directory, with each entry in the array searched until the wf is found
113
+ #
114
+ def get_weather_file_from_fs(directory, wf, wf_search_array, logger)
115
+ raise "wf was defined as #{wf}. Please correct" unless wf
116
+ weather_file = nil
117
+ if Pathname.new(wf).absolute?
118
+ weather_file = wf
119
+ else
120
+ wf_search_array.each do |wf_dir|
121
+ logger.warn "The path #{wf_dir} does not exist" unless File.exist? File.join(directory, wf_dir)
122
+ next unless File.exist? File.join(directory, wf_dir)
123
+ if Dir.entries(File.join(directory, wf_dir)).include? File.basename(wf)
124
+ weather_file = File.absolute_path(File.join(directory, wf_dir, wf))
125
+ break
126
+ end
127
+ end
128
+ end
129
+ unless weather_file
130
+ logger.warn 'The weather file was not found on the filesystem'
131
+ return nil
132
+ end
133
+ logger.info "Weather file with precedence in the file system is #{weather_file}"
134
+ unless File.exist? weather_file
135
+ logger.warn 'The weather file could not be found on the filesystem'
136
+ weather_file = false
137
+ end
138
+ weather_file
139
+ end
140
+ end
141
+ end
142
+ end
143
+ end
@@ -1,24 +1,40 @@
1
- ######################################################################
2
- # Copyright (c) 2008-2014, Alliance for Sustainable Energy.
3
- # All rights reserved.
4
- #
5
- # This library is free software; you can redistribute it and/or
6
- # modify it under the terms of the GNU Lesser General Public
7
- # License as published by the Free Software Foundation; either
8
- # version 2.1 of the License, or (at your option) any later version.
9
- #
10
- # This library is distributed in the hope that it will be useful,
11
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
- # Lesser General Public License for more details.
14
- #
15
- # You should have received a copy of the GNU Lesser General Public
16
- # License along with this library; if not, write to the Free Software
17
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
- ######################################################################
19
-
20
- module OpenStudio
21
- module Workflow
22
- VERSION = '1.3.3'.freeze # Suffixes must have periods (not dashes)
23
- end
24
- end
1
+ # *******************************************************************************
2
+ # OpenStudio(R), Copyright (c) 2008-2018, Alliance for Sustainable Energy, LLC.
3
+ # All rights reserved.
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are met:
6
+ #
7
+ # (1) Redistributions of source code must retain the above copyright notice,
8
+ # this list of conditions and the following disclaimer.
9
+ #
10
+ # (2) Redistributions in binary form must reproduce the above copyright notice,
11
+ # this list of conditions and the following disclaimer in the documentation
12
+ # and/or other materials provided with the distribution.
13
+ #
14
+ # (3) Neither the name of the copyright holder nor the names of any contributors
15
+ # may be used to endorse or promote products derived from this software without
16
+ # specific prior written permission from the respective party.
17
+ #
18
+ # (4) Other than as required in clauses (1) and (2), distributions in any form
19
+ # of modifications or other derivative works may not use the "OpenStudio"
20
+ # trademark, "OS", "os", or any other confusingly similar designation without
21
+ # specific prior written permission from Alliance for Sustainable Energy, LLC.
22
+ #
23
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
27
+ # GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28
+ # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
33
+ # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+ # *******************************************************************************
35
+
36
+ module OpenStudio
37
+ module Workflow
38
+ VERSION = '1.3.4'.freeze # Suffixes must have periods (not dashes)
39
+ end
40
+ end
@@ -1,443 +1,476 @@
1
- ######################################################################
2
- # Copyright (c) 2008-2014, Alliance for Sustainable Energy.
3
- # All rights reserved.
4
- #
5
- # This library is free software; you can redistribute it and/or
6
- # modify it under the terms of the GNU Lesser General Public
7
- # License as published by the Free Software Foundation; either
8
- # version 2.1 of the License, or (at your option) any later version.
9
- #
10
- # This library is distributed in the hope that it will be useful,
11
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
- # Lesser General Public License for more details.
14
- #
15
- # You should have received a copy of the GNU Lesser General Public
16
- # License along with this library; if not, write to the Free Software
17
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
- ######################################################################
19
-
20
- require 'pathname'
21
-
22
- # Optional_Shim provides a wrapper that looks like an OpenStudio Optional
23
- class Optional_Shim
24
- def initialize(obj)
25
- @obj = obj
26
- end
27
-
28
- def empty?
29
- @obj.nil?
30
- end
31
-
32
- def is_initialized
33
- !@obj.nil?
34
- end
35
-
36
- def get
37
- raise 'Uninitialized Optional_Shim' if @obj.nil?
38
- @obj
39
- end
40
- end
41
-
42
- s = ''
43
- unless s.respond_to?(:to_StepResult)
44
- class String
45
- def to_StepResult
46
- self
47
- end
48
- end
49
- end
50
- unless s.respond_to?(:to_VariantType)
51
- class String
52
- def to_VariantType
53
- self
54
- end
55
- end
56
- end
57
- unless s.respond_to?(:valueName)
58
- class String
59
- def valueName
60
- self
61
- end
62
- end
63
- end
64
-
65
- # WorkflowStepResultValue_Shim provides a shim interface to the WorkflowStepResultValue class in OpenStudio 2.X when running in OpenStudio 1.X
66
- class WorkflowStepResultValue_Shim
67
- def initialize(name, value, type)
68
- @name = name
69
- @value = value
70
- @type = type
71
- end
72
-
73
- attr_reader :name
74
-
75
- attr_reader :value
76
-
77
- def variantType
78
- @type
79
- end
80
-
81
- def valueAsString
82
- @value.to_s
83
- end
84
-
85
- def valueAsDouble
86
- @value.to_f
87
- end
88
-
89
- def valueAsInteger
90
- @value.to_i
91
- end
92
-
93
- def valueAsBoolean
94
- @value
95
- end
96
- end
97
-
98
- # WorkflowStepResult_Shim provides a shim interface to the WorkflowStepResult class in OpenStudio 2.X when running in OpenStudio 1.X
99
- class WorkflowStepResult_Shim
100
- def initialize(result)
101
- @result = result
102
- end
103
-
104
- def stepInitialCondition
105
- if @result[:initial_condition]
106
- return Optional_Shim.new(@result[:initial_condition])
107
- end
108
- return Optional_Shim.new(nil)
109
- end
110
-
111
- def stepFinalCondition
112
- if @result[:final_condition]
113
- return Optional_Shim.new(@result[:final_condition])
114
- end
115
- return Optional_Shim.new(nil)
116
- end
117
-
118
- def stepErrors
119
- return @result[:step_errors]
120
- end
121
-
122
- def stepWarnings
123
- return @result[:step_warnings]
124
- end
125
-
126
- def stepInfo
127
- return @result[:step_info]
128
- end
129
-
130
- def stepValues
131
- result = []
132
- @result[:step_values].each do |step_value|
133
- result << WorkflowStepResultValue_Shim.new(step_value[:name], step_value[:value], step_value[:type])
134
- end
135
- return result
136
- end
137
-
138
- def stepResult
139
- Optional_Shim.new(@result[:step_result])
140
- end
141
-
142
- def setStepResult(step_result)
143
- @result[:step_result] = step_result
144
- end
145
-
146
- end
147
-
148
- # WorkflowStep_Shim provides a shim interface to the WorkflowStep class in OpenStudio 2.X when running in OpenStudio 1.X
149
- class WorkflowStep_Shim
150
- def initialize(step)
151
- @step = step
152
- end
153
-
154
- attr_reader :step
155
-
156
- def name
157
- if @step[:name]
158
- Optional_Shim.new(@step[:name])
159
- else
160
- Optional_Shim.new(nil)
161
- end
162
- end
163
-
164
- def result
165
- if @step[:result]
166
- Optional_Shim.new(WorkflowStepResult_Shim.new(@step[:result]))
167
- else
168
- Optional_Shim.new(nil)
169
- end
170
- end
171
-
172
- # std::string measureDirName() const;
173
- def measureDirName
174
- @step[:measure_dir_name]
175
- end
176
-
177
- # std::map<std::string, Variant> arguments() const;
178
- def arguments
179
- # TODO: match C++
180
- @step[:arguments]
181
- end
182
- end
183
-
184
- # WorkflowJSON_Shim provides a shim interface to the WorkflowJSON class in OpenStudio 2.X when running in OpenStudio 1.X
185
- class WorkflowJSON_Shim
186
- def initialize(workflow, osw_dir)
187
- @workflow = workflow
188
- @osw_dir = osw_dir
189
- @current_step_index = 0
190
- end
191
-
192
- # std::string string(bool includeHash=true) const;
193
- def string
194
- JSON.fast_generate(@workflow)
195
- end
196
-
197
- def timeString
198
- ::Time.now.utc.strftime("%Y%m%dT%H%M%SZ")
199
- end
200
-
201
- # Returns the absolute path to the directory this workflow was loaded from or saved to. Returns current working dir for new WorkflowJSON.
202
- # openstudio::path oswDir() const;
203
- def oswDir
204
- OpenStudio.toPath(@osw_dir)
205
- end
206
-
207
- def saveAs(path)
208
- File.open(path.to_s, 'w') do |file|
209
- file << JSON.pretty_generate(@workflow)
210
- end
211
- end
212
-
213
- # Sets the started at time.
214
- def start
215
- @workflow[:started_at] = timeString
216
- end
217
-
218
- # Get the current step index.
219
- def currentStepIndex
220
- @current_step_index
221
- end
222
-
223
- # Get the current step.
224
- # boost::optional<WorkflowStep> currentStep() const;
225
- def currentStep
226
- steps = @workflow[:steps]
227
-
228
- step = nil
229
- if @current_step_index < steps.size
230
- step = WorkflowStep_Shim.new(steps[@current_step_index])
231
- end
232
- return Optional_Shim.new(step)
233
- end
234
-
235
- # Increments current step, returns true if there is another step.
236
- # bool incrementStep();
237
- def incrementStep
238
- @current_step_index += 1
239
- @workflow[:current_step] = @current_step_index
240
-
241
- if @current_step_index < @workflow[:steps].size
242
- return true
243
- end
244
-
245
- return false
246
- end
247
-
248
- # Returns the root directory, default value is '.'. Evaluated relative to oswDir if not absolute.
249
- # openstudio::path rootDir() const;
250
- # openstudio::path absoluteRootDir() const;
251
- def rootDir
252
- if @workflow[:root_dir]
253
- OpenStudio.toPath(@workflow[:root_dir])
254
- else
255
- OpenStudio.toPath(@osw_dir)
256
- end
257
- end
258
-
259
- def absoluteRootDir
260
- OpenStudio.toPath(File.absolute_path(rootDir.to_s, @osw_dir.to_s))
261
- end
262
-
263
- # Returns the run directory, default value is './run'. Evaluated relative to rootDir if not absolute.
264
- # openstudio::path runDir() const;
265
- # openstudio::path absoluteRunDir() const;
266
- def runDir
267
- if @workflow[:run_directory]
268
- OpenStudio.toPath(@workflow[:run_directory])
269
- else
270
- OpenStudio.toPath('./run')
271
- end
272
- end
273
-
274
- def absoluteRunDir
275
- OpenStudio.toPath(File.absolute_path(runDir.to_s, rootDir.to_s))
276
- end
277
-
278
- def outPath
279
- if @workflow[:out_name]
280
- OpenStudio.toPath(@workflow[:out_name])
281
- else
282
- OpenStudio.toPath('./out.osw')
283
- end
284
- end
285
-
286
- def absoluteOutPath
287
- OpenStudio.toPath(File.absolute_path(outPath.to_s, oswDir.to_s))
288
- end
289
-
290
- # Returns the paths that will be searched in order for files, default value is './files/'. Evaluated relative to rootDir if not absolute.
291
- # std::vector<openstudio::path> filePaths() const;
292
- # std::vector<openstudio::path> absoluteFilePaths() const;
293
- def filePaths
294
- result = OpenStudio::PathVector.new
295
- if @workflow[:file_paths]
296
- @workflow[:file_paths].each do |file_path|
297
- result << OpenStudio.toPath(file_path)
298
- end
299
- else
300
- result << OpenStudio.toPath('./files')
301
- result << OpenStudio.toPath('./weather')
302
- result << OpenStudio.toPath('../../files')
303
- result << OpenStudio.toPath('../../weather')
304
- result << OpenStudio.toPath('./')
305
- end
306
- result
307
- end
308
-
309
- def absoluteFilePaths
310
- result = OpenStudio::PathVector.new
311
- filePaths.each do |file_path|
312
- result << OpenStudio.toPath(File.absolute_path(file_path.to_s, rootDir.to_s))
313
- end
314
- result
315
- end
316
-
317
- # Attempts to find a file by name, searches through filePaths in order and returns first match.
318
- # boost::optional<openstudio::path> findFile(const openstudio::path& file);
319
- # boost::optional<openstudio::path> findFile(const std::string& fileName);
320
- def findFile(file)
321
- file = file.to_s
322
-
323
- # check if absolute and exists
324
- if Pathname.new(file).absolute?
325
- if File.exist?(file)
326
- return OpenStudio::OptionalPath.new(OpenStudio.toPath(file))
327
- end
328
-
329
- # absolute path does not exist
330
- return OpenStudio::OptionalPath.new
331
- end
332
-
333
- absoluteFilePaths.each do |file_path|
334
- result = File.join(file_path.to_s, file)
335
- if File.exist?(result)
336
- return OpenStudio::OptionalPath.new(OpenStudio.toPath(result))
337
- end
338
- end
339
- OpenStudio::OptionalPath.new
340
- end
341
-
342
- # Returns the paths that will be searched in order for measures, default value is './measures/'. Evaluated relative to rootDir if not absolute.
343
- # std::vector<openstudio::path> measurePaths() const;
344
- # std::vector<openstudio::path> absoluteMeasurePaths() const;
345
- def measurePaths
346
- result = OpenStudio::PathVector.new
347
- if @workflow[:measure_paths]
348
- @workflow[:measure_paths].each do |measure_path|
349
- result << OpenStudio.toPath(measure_path)
350
- end
351
- else
352
- result << OpenStudio.toPath('./measures')
353
- result << OpenStudio.toPath('../../measures')
354
- result << OpenStudio.toPath('./')
355
- end
356
- result
357
- end
358
-
359
- def absoluteMeasurePaths
360
- result = OpenStudio::PathVector.new
361
- measurePaths.each do |measure_path|
362
- result << OpenStudio.toPath(File.absolute_path(measure_path.to_s, rootDir.to_s))
363
- end
364
- result
365
- end
366
-
367
- # Attempts to find a measure by name, searches through measurePaths in order and returns first match. */
368
- # boost::optional<openstudio::path> findMeasure(const openstudio::path& measureDir);
369
- # boost::optional<openstudio::path> findMeasure(const std::string& measureDirName);
370
- def findMeasure(measureDir)
371
- measureDir = measureDir.to_s
372
-
373
- # check if absolute and exists
374
- if Pathname.new(measureDir).absolute?
375
- if File.exist?(measureDir)
376
- return OpenStudio::OptionalPath.new(OpenStudio.toPath(measureDir))
377
- end
378
-
379
- # absolute path does not exist
380
- return OpenStudio::OptionalPath.new
381
- end
382
-
383
- absoluteMeasurePaths.each do |measure_path|
384
- result = File.join(measure_path.to_s, measureDir)
385
- if File.exist?(result)
386
- return OpenStudio::OptionalPath.new(OpenStudio.toPath(result))
387
- end
388
- end
389
- OpenStudio::OptionalPath.new
390
- end
391
-
392
- # Returns the seed file path. Evaluated relative to filePaths if not absolute.
393
- # boost::optional<openstudio::path> seedFile() const;
394
- def seedFile
395
- result = OpenStudio::OptionalPath.new
396
- if @workflow[:seed_file]
397
- result = OpenStudio::OptionalPath.new(OpenStudio.toPath(@workflow[:seed_file]))
398
- end
399
- result
400
- end
401
-
402
- # Returns the weather file path. Evaluated relative to filePaths if not absolute.
403
- # boost::optional<openstudio::path> weatherFile() const;
404
- def weatherFile
405
- result = OpenStudio::OptionalPath.new
406
- if @workflow[:weather_file]
407
- result = OpenStudio::OptionalPath.new(OpenStudio.toPath(@workflow[:weather_file]))
408
- end
409
- result
410
- end
411
-
412
- # Returns the workflow steps. */
413
- # std::vector<WorkflowStep> workflowSteps() const;
414
- def workflowSteps
415
- result = []
416
- @workflow[:steps].each do |step|
417
- result << WorkflowStep_Shim.new(step)
418
- end
419
- result
420
- end
421
-
422
- def completedStatus
423
- if @workflow[:completed_status]
424
- Optional_Shim.new(@workflow[:completed_status])
425
- else
426
- Optional_Shim.new(nil)
427
- end
428
- end
429
-
430
- def setCompletedStatus(status)
431
- @workflow[:completed_status] = status
432
- @workflow[:completed_at] = timeString
433
- end
434
-
435
- def setEplusoutErr(eplusout_err)
436
- @workflow[:eplusout_err] = eplusout_err
437
- end
438
-
439
- # return empty optional
440
- def runOptions
441
- return Optional_Shim.new(nil)
442
- end
443
- end
1
+ # *******************************************************************************
2
+ # OpenStudio(R), Copyright (c) 2008-2018, Alliance for Sustainable Energy, LLC.
3
+ # All rights reserved.
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are met:
6
+ #
7
+ # (1) Redistributions of source code must retain the above copyright notice,
8
+ # this list of conditions and the following disclaimer.
9
+ #
10
+ # (2) Redistributions in binary form must reproduce the above copyright notice,
11
+ # this list of conditions and the following disclaimer in the documentation
12
+ # and/or other materials provided with the distribution.
13
+ #
14
+ # (3) Neither the name of the copyright holder nor the names of any contributors
15
+ # may be used to endorse or promote products derived from this software without
16
+ # specific prior written permission from the respective party.
17
+ #
18
+ # (4) Other than as required in clauses (1) and (2), distributions in any form
19
+ # of modifications or other derivative works may not use the "OpenStudio"
20
+ # trademark, "OS", "os", or any other confusingly similar designation without
21
+ # specific prior written permission from Alliance for Sustainable Energy, LLC.
22
+ #
23
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER, THE UNITED STATES
27
+ # GOVERNMENT, OR ANY CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28
+ # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29
+ # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
33
+ # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+ # *******************************************************************************
35
+
36
+ require 'pathname'
37
+
38
+ # Optional_Shim provides a wrapper that looks like an OpenStudio Optional
39
+ class Optional_Shim
40
+ def initialize(obj)
41
+ @obj = obj
42
+ end
43
+
44
+ def empty?
45
+ @obj.nil?
46
+ end
47
+
48
+ def is_initialized
49
+ !@obj.nil?
50
+ end
51
+
52
+ def get
53
+ raise 'Uninitialized Optional_Shim' if @obj.nil?
54
+ @obj
55
+ end
56
+ end
57
+
58
+ s = ''
59
+ unless s.respond_to?(:to_StepResult)
60
+ class String
61
+ def to_StepResult
62
+ self
63
+ end
64
+ end
65
+ end
66
+ unless s.respond_to?(:to_VariantType)
67
+ class String
68
+ def to_VariantType
69
+ self
70
+ end
71
+ end
72
+ end
73
+ unless s.respond_to?(:valueName)
74
+ class String
75
+ def valueName
76
+ self
77
+ end
78
+ end
79
+ end
80
+
81
+ # WorkflowStepResultValue_Shim provides a shim interface to the WorkflowStepResultValue class in OpenStudio 2.X when running in OpenStudio 1.X
82
+ class WorkflowStepResultValue_Shim
83
+ def initialize(name, value, type)
84
+ @name = name
85
+ @value = value
86
+ @type = type
87
+ end
88
+
89
+ attr_reader :name
90
+
91
+ attr_reader :value
92
+
93
+ def variantType
94
+ @type
95
+ end
96
+
97
+ def valueAsString
98
+ @value.to_s
99
+ end
100
+
101
+ def valueAsDouble
102
+ @value.to_f
103
+ end
104
+
105
+ def valueAsInteger
106
+ @value.to_i
107
+ end
108
+
109
+ def valueAsBoolean
110
+ @value
111
+ end
112
+ end
113
+
114
+ # WorkflowStepResult_Shim provides a shim interface to the WorkflowStepResult class in OpenStudio 2.X when running in OpenStudio 1.X
115
+ class WorkflowStepResult_Shim
116
+ def initialize(result)
117
+ @result = result
118
+ end
119
+
120
+ def stepInitialCondition
121
+ if @result[:initial_condition]
122
+ return Optional_Shim.new(@result[:initial_condition])
123
+ end
124
+ return Optional_Shim.new(nil)
125
+ end
126
+
127
+ def stepFinalCondition
128
+ if @result[:final_condition]
129
+ return Optional_Shim.new(@result[:final_condition])
130
+ end
131
+ return Optional_Shim.new(nil)
132
+ end
133
+
134
+ def stepErrors
135
+ return @result[:step_errors]
136
+ end
137
+
138
+ def stepWarnings
139
+ return @result[:step_warnings]
140
+ end
141
+
142
+ def stepInfo
143
+ return @result[:step_info]
144
+ end
145
+
146
+ def stepValues
147
+ result = []
148
+ @result[:step_values].each do |step_value|
149
+ result << WorkflowStepResultValue_Shim.new(step_value[:name], step_value[:value], step_value[:type])
150
+ end
151
+ return result
152
+ end
153
+
154
+ def stepResult
155
+ Optional_Shim.new(@result[:step_result])
156
+ end
157
+
158
+ def setStepResult(step_result)
159
+ @result[:step_result] = step_result
160
+ end
161
+
162
+ end
163
+
164
+ # WorkflowStep_Shim provides a shim interface to the WorkflowStep class in OpenStudio 2.X when running in OpenStudio 1.X
165
+ class WorkflowStep_Shim
166
+ def initialize(step)
167
+ @step = step
168
+ end
169
+
170
+ attr_reader :step
171
+
172
+ def name
173
+ if @step[:name]
174
+ Optional_Shim.new(@step[:name])
175
+ else
176
+ Optional_Shim.new(nil)
177
+ end
178
+ end
179
+
180
+ def result
181
+ if @step[:result]
182
+ Optional_Shim.new(WorkflowStepResult_Shim.new(@step[:result]))
183
+ else
184
+ Optional_Shim.new(nil)
185
+ end
186
+ end
187
+
188
+ # std::string measureDirName() const;
189
+ def measureDirName
190
+ @step[:measure_dir_name]
191
+ end
192
+
193
+ # std::map<std::string, Variant> arguments() const;
194
+ def arguments
195
+ # TODO: match C++
196
+ @step[:arguments]
197
+ end
198
+ end
199
+
200
+ # WorkflowJSON_Shim provides a shim interface to the WorkflowJSON class in OpenStudio 2.X when running in OpenStudio 1.X
201
+ class WorkflowJSON_Shim
202
+ def initialize(workflow, osw_dir)
203
+ @workflow = workflow
204
+ @osw_dir = osw_dir
205
+ @current_step_index = 0
206
+ end
207
+
208
+ # std::string string(bool includeHash=true) const;
209
+ def string
210
+ JSON.fast_generate(@workflow)
211
+ end
212
+
213
+ def timeString
214
+ ::Time.now.utc.strftime("%Y%m%dT%H%M%SZ")
215
+ end
216
+
217
+ # Returns the absolute path to the directory this workflow was loaded from or saved to. Returns current working dir for new WorkflowJSON.
218
+ # openstudio::path oswDir() const;
219
+ def oswDir
220
+ OpenStudio.toPath(@osw_dir)
221
+ end
222
+
223
+ def saveAs(path)
224
+ File.open(path.to_s, 'w') do |f|
225
+ f << JSON.pretty_generate(@workflow)
226
+ # make sure data is written to the disk one way or the other
227
+ begin
228
+ f.fsync
229
+ rescue
230
+ f.flush
231
+ end
232
+ end
233
+ end
234
+
235
+ # Sets the started at time.
236
+ def start
237
+ @workflow[:started_at] = timeString
238
+ end
239
+
240
+ # Get the current step index.
241
+ def currentStepIndex
242
+ @current_step_index
243
+ end
244
+
245
+ # Get the current step.
246
+ # boost::optional<WorkflowStep> currentStep() const;
247
+ def currentStep
248
+ steps = @workflow[:steps]
249
+
250
+ step = nil
251
+ if @current_step_index < steps.size
252
+ step = WorkflowStep_Shim.new(steps[@current_step_index])
253
+ end
254
+ return Optional_Shim.new(step)
255
+ end
256
+
257
+ # Increments current step, returns true if there is another step.
258
+ # bool incrementStep();
259
+ def incrementStep
260
+ @current_step_index += 1
261
+ @workflow[:current_step] = @current_step_index
262
+
263
+ if @current_step_index < @workflow[:steps].size
264
+ return true
265
+ end
266
+
267
+ return false
268
+ end
269
+
270
+ # Returns the root directory, default value is '.'. Evaluated relative to oswDir if not absolute.
271
+ # openstudio::path rootDir() const;
272
+ # openstudio::path absoluteRootDir() const;
273
+ def rootDir
274
+ if @workflow[:root_dir]
275
+ OpenStudio.toPath(@workflow[:root_dir])
276
+ else
277
+ OpenStudio.toPath(@osw_dir)
278
+ end
279
+ end
280
+
281
+ def absoluteRootDir
282
+ OpenStudio.toPath(File.absolute_path(rootDir.to_s, @osw_dir.to_s))
283
+ end
284
+
285
+ # Returns the run directory, default value is './run'. Evaluated relative to rootDir if not absolute.
286
+ # openstudio::path runDir() const;
287
+ # openstudio::path absoluteRunDir() const;
288
+ def runDir
289
+ if @workflow[:run_directory]
290
+ OpenStudio.toPath(@workflow[:run_directory])
291
+ else
292
+ OpenStudio.toPath('./run')
293
+ end
294
+ end
295
+
296
+ def absoluteRunDir
297
+ OpenStudio.toPath(File.absolute_path(runDir.to_s, rootDir.to_s))
298
+ end
299
+
300
+ def outPath
301
+ if @workflow[:out_name]
302
+ OpenStudio.toPath(@workflow[:out_name])
303
+ else
304
+ OpenStudio.toPath('./out.osw')
305
+ end
306
+ end
307
+
308
+ def absoluteOutPath
309
+ OpenStudio.toPath(File.absolute_path(outPath.to_s, oswDir.to_s))
310
+ end
311
+
312
+ # Returns the paths that will be searched in order for files, default value is './files/'. Evaluated relative to rootDir if not absolute.
313
+ # std::vector<openstudio::path> filePaths() const;
314
+ # std::vector<openstudio::path> absoluteFilePaths() const;
315
+ def filePaths
316
+ result = OpenStudio::PathVector.new
317
+ if @workflow[:file_paths]
318
+ @workflow[:file_paths].each do |file_path|
319
+ result << OpenStudio.toPath(file_path)
320
+ end
321
+ else
322
+ result << OpenStudio.toPath('./files')
323
+ result << OpenStudio.toPath('./weather')
324
+ result << OpenStudio.toPath('../../files')
325
+ result << OpenStudio.toPath('../../weather')
326
+ result << OpenStudio.toPath('./')
327
+ end
328
+ result
329
+ end
330
+
331
+ def absoluteFilePaths
332
+ result = OpenStudio::PathVector.new
333
+ filePaths.each do |file_path|
334
+ result << OpenStudio.toPath(File.absolute_path(file_path.to_s, rootDir.to_s))
335
+ end
336
+ result
337
+ end
338
+
339
+ def addFilePath(path)
340
+ if !@workflow[:file_paths]
341
+ @workflow[:file_paths] = []
342
+ end
343
+ @workflow[:file_paths] << path
344
+ end
345
+
346
+ def resetFilePaths()
347
+ @workflow[:file_paths] = []
348
+ end
349
+
350
+ # Attempts to find a file by name, searches through filePaths in order and returns first match.
351
+ # boost::optional<openstudio::path> findFile(const openstudio::path& file);
352
+ # boost::optional<openstudio::path> findFile(const std::string& fileName);
353
+ def findFile(file)
354
+ file = file.to_s
355
+
356
+ # check if absolute and exists
357
+ if Pathname.new(file).absolute?
358
+ if File.exist?(file)
359
+ return OpenStudio::OptionalPath.new(OpenStudio.toPath(file))
360
+ end
361
+
362
+ # absolute path does not exist
363
+ return OpenStudio::OptionalPath.new
364
+ end
365
+
366
+ absoluteFilePaths.each do |file_path|
367
+ result = File.join(file_path.to_s, file)
368
+ if File.exist?(result)
369
+ return OpenStudio::OptionalPath.new(OpenStudio.toPath(result))
370
+ end
371
+ end
372
+ OpenStudio::OptionalPath.new
373
+ end
374
+
375
+ # Returns the paths that will be searched in order for measures, default value is './measures/'. Evaluated relative to rootDir if not absolute.
376
+ # std::vector<openstudio::path> measurePaths() const;
377
+ # std::vector<openstudio::path> absoluteMeasurePaths() const;
378
+ def measurePaths
379
+ result = OpenStudio::PathVector.new
380
+ if @workflow[:measure_paths]
381
+ @workflow[:measure_paths].each do |measure_path|
382
+ result << OpenStudio.toPath(measure_path)
383
+ end
384
+ else
385
+ result << OpenStudio.toPath('./measures')
386
+ result << OpenStudio.toPath('../../measures')
387
+ result << OpenStudio.toPath('./')
388
+ end
389
+ result
390
+ end
391
+
392
+ def absoluteMeasurePaths
393
+ result = OpenStudio::PathVector.new
394
+ measurePaths.each do |measure_path|
395
+ result << OpenStudio.toPath(File.absolute_path(measure_path.to_s, rootDir.to_s))
396
+ end
397
+ result
398
+ end
399
+
400
+ # Attempts to find a measure by name, searches through measurePaths in order and returns first match. */
401
+ # boost::optional<openstudio::path> findMeasure(const openstudio::path& measureDir);
402
+ # boost::optional<openstudio::path> findMeasure(const std::string& measureDirName);
403
+ def findMeasure(measureDir)
404
+ measureDir = measureDir.to_s
405
+
406
+ # check if absolute and exists
407
+ if Pathname.new(measureDir).absolute?
408
+ if File.exist?(measureDir)
409
+ return OpenStudio::OptionalPath.new(OpenStudio.toPath(measureDir))
410
+ end
411
+
412
+ # absolute path does not exist
413
+ return OpenStudio::OptionalPath.new
414
+ end
415
+
416
+ absoluteMeasurePaths.each do |measure_path|
417
+ result = File.join(measure_path.to_s, measureDir)
418
+ if File.exist?(result)
419
+ return OpenStudio::OptionalPath.new(OpenStudio.toPath(result))
420
+ end
421
+ end
422
+ OpenStudio::OptionalPath.new
423
+ end
424
+
425
+ # Returns the seed file path. Evaluated relative to filePaths if not absolute.
426
+ # boost::optional<openstudio::path> seedFile() const;
427
+ def seedFile
428
+ result = OpenStudio::OptionalPath.new
429
+ if @workflow[:seed_file]
430
+ result = OpenStudio::OptionalPath.new(OpenStudio.toPath(@workflow[:seed_file]))
431
+ end
432
+ result
433
+ end
434
+
435
+ # Returns the weather file path. Evaluated relative to filePaths if not absolute.
436
+ # boost::optional<openstudio::path> weatherFile() const;
437
+ def weatherFile
438
+ result = OpenStudio::OptionalPath.new
439
+ if @workflow[:weather_file]
440
+ result = OpenStudio::OptionalPath.new(OpenStudio.toPath(@workflow[:weather_file]))
441
+ end
442
+ result
443
+ end
444
+
445
+ # Returns the workflow steps. */
446
+ # std::vector<WorkflowStep> workflowSteps() const;
447
+ def workflowSteps
448
+ result = []
449
+ @workflow[:steps].each do |step|
450
+ result << WorkflowStep_Shim.new(step)
451
+ end
452
+ result
453
+ end
454
+
455
+ def completedStatus
456
+ if @workflow[:completed_status]
457
+ Optional_Shim.new(@workflow[:completed_status])
458
+ else
459
+ Optional_Shim.new(nil)
460
+ end
461
+ end
462
+
463
+ def setCompletedStatus(status)
464
+ @workflow[:completed_status] = status
465
+ @workflow[:completed_at] = timeString
466
+ end
467
+
468
+ def setEplusoutErr(eplusout_err)
469
+ @workflow[:eplusout_err] = eplusout_err
470
+ end
471
+
472
+ # return empty optional
473
+ def runOptions
474
+ return Optional_Shim.new(nil)
475
+ end
476
+ end