openstudio-workflow 2.1.0 → 2.3.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 +4 -4
- data/CHANGELOG.md +22 -3
- data/README.md +1 -1
- data/lib/openstudio/workflow/adapters/input/local.rb +114 -1
- data/lib/openstudio/workflow/adapters/output/local.rb +5 -3
- data/lib/openstudio/workflow/adapters/output/socket.rb +2 -6
- data/lib/openstudio/workflow/adapters/output/web.rb +1 -17
- data/lib/openstudio/workflow/adapters/output_adapter.rb +6 -7
- data/lib/openstudio/workflow/job.rb +1 -1
- data/lib/openstudio/workflow/jobs/run_energyplus.rb +1 -1
- data/lib/openstudio/workflow/jobs/run_ep_measures.rb +1 -1
- data/lib/openstudio/workflow/jobs/run_initialization.rb +2 -2
- data/lib/openstudio/workflow/jobs/run_os_measures.rb +1 -1
- data/lib/openstudio/workflow/jobs/run_postprocess.rb +1 -1
- data/lib/openstudio/workflow/jobs/run_preprocess.rb +1 -1
- data/lib/openstudio/workflow/jobs/run_reporting_measures.rb +14 -2
- data/lib/openstudio/workflow/jobs/run_translation.rb +1 -1
- data/lib/openstudio/workflow/multi_delegator.rb +1 -1
- data/lib/openstudio/workflow/registry.rb +1 -1
- data/lib/openstudio/workflow/run.rb +17 -18
- data/lib/openstudio/workflow/time_logger.rb +1 -1
- data/lib/openstudio/workflow/util/energyplus.rb +60 -28
- data/lib/openstudio/workflow/util/io.rb +1 -1
- data/lib/openstudio/workflow/util/measure.rb +3 -1
- data/lib/openstudio/workflow/util/model.rb +61 -4
- data/lib/openstudio/workflow/util/post_process.rb +3 -3
- data/lib/openstudio/workflow/util/weather_file.rb +2 -2
- data/lib/openstudio/workflow/util.rb +1 -1
- data/lib/openstudio/workflow/version.rb +2 -2
- data/lib/openstudio/workflow_json.rb +3 -5
- data/lib/openstudio/workflow_runner.rb +2 -4
- data/lib/openstudio-workflow.rb +1 -1
- metadata +29 -30
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fcb791c63593c4b0a7c7050c243c4e7214e8e62f04d3f4e3c29652c6690b5372
|
|
4
|
+
data.tar.gz: c831e36b5024f861eee6a46e5fc751ec0dc965a4e358fd0532ad293069acfc4f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5191c3ec1be4a4b801afb357f46ef35b127a73b92c0c0d5c2831f1bb3374ec365675c6baa70e2513884ab87d5f6ffb80f69e540f90310db6ea99cf1d1962fe56
|
|
7
|
+
data.tar.gz: 7aceb6c2b096e47522ed68b978f3e36d46c8dd2dd79ace0a7b5415a685078dfd9852f75e626c98ea2d875e4365ae5787ea6a5007178fbda5b84490868b92ff30
|
data/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
OpenStudio::Workflow Change Log
|
|
2
2
|
==================================
|
|
3
3
|
|
|
4
|
+
Version 2.3.0
|
|
5
|
+
-------------
|
|
6
|
+
* Feature [#135](https://github.com/NREL/OpenStudio-workflow-gem/issues/135) Add option to export/run epJSON
|
|
7
|
+
|
|
8
|
+
Version 2.2.1
|
|
9
|
+
-------------
|
|
10
|
+
* Fixes [#4150](https://github.com/NREL/OpenStudio/issues/4150) LoadError changes current working directory in CLI
|
|
11
|
+
* Add skip option to not zip up datapoint results
|
|
12
|
+
* Update measure tester gem which upgrades Rubocop to 1.15
|
|
13
|
+
* Update styles to v4 based on new version of Rubocop
|
|
14
|
+
|
|
15
|
+
Version 2.2.0
|
|
16
|
+
-------------
|
|
17
|
+
* Minimum Ruby version upgraded to 2.7.0
|
|
18
|
+
* Bundler bumped to ~> 2.2
|
|
19
|
+
* Updated copyright
|
|
20
|
+
|
|
21
|
+
Version 2.1.1
|
|
22
|
+
-------------
|
|
23
|
+
* Add support for URBANopt Workflow
|
|
24
|
+
* Update reporting measure in tests
|
|
25
|
+
|
|
4
26
|
Version 2.1.0
|
|
5
27
|
-------------
|
|
6
28
|
* Support for EnergyPlus 9.4. This version will not work with prior versions of EnergyPlus.
|
|
@@ -8,18 +30,15 @@ Version 2.1.0
|
|
|
8
30
|
|
|
9
31
|
Version 2.0.1
|
|
10
32
|
-------------
|
|
11
|
-
|
|
12
33
|
* Bug fix for idf.addObjects(object) to idf.addObject(object)
|
|
13
34
|
|
|
14
35
|
Version 2.0.0
|
|
15
36
|
-------------
|
|
16
|
-
|
|
17
37
|
* Support Ruby > 2.5
|
|
18
38
|
* Support OpenStudio 3.x
|
|
19
39
|
|
|
20
40
|
Version 1.3.5
|
|
21
41
|
-------------
|
|
22
|
-
|
|
23
42
|
* Allow reporting to fail gracefully so HTML reports are returned Fixed [this](https://github.com/NREL/OpenStudio/issues/864).
|
|
24
43
|
* Allow EMS:OutputVariable in reporting measure
|
|
25
44
|
* Fixes [#93](https://github.com/NREL/OpenStudio-workflow-gem/issues/93) - Pass Model to the arguments method of ReportingMeasure
|
data/README.md
CHANGED
|
@@ -9,7 +9,7 @@ This branch is the development branch for the OpenStudio workflow gem.
|
|
|
9
9
|
|
|
10
10
|
The OpenStudio Workflow Gem has the following dependencies:
|
|
11
11
|
|
|
12
|
-
* Ruby 2.
|
|
12
|
+
* Ruby 2.7.2
|
|
13
13
|
* OpenStudio 3.x
|
|
14
14
|
|
|
15
15
|
[OpenStudio](https://www.openstudio.net/) needs to be installed and in your path. On Mac/Linux it is easiest to add the following to your .bash_profile or /etc/profile.d/<file>.sh to ensure OpenStudio loads. Assuming OpenStudio 3.0.0 installed:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -192,6 +192,24 @@ module OpenStudio
|
|
|
192
192
|
return default
|
|
193
193
|
end
|
|
194
194
|
|
|
195
|
+
def skip_zip_results(user_options, default)
|
|
196
|
+
# user option trumps all others
|
|
197
|
+
return user_options[:skip_zip_results] if user_options[:skip_zip_results]
|
|
198
|
+
|
|
199
|
+
# try to read from OSW
|
|
200
|
+
if @run_options && !@run_options.empty?
|
|
201
|
+
if @run_options.get.respond_to?(:skipZipResults)
|
|
202
|
+
return @run_options.get.skipZipResults
|
|
203
|
+
else
|
|
204
|
+
if @workflow[:run_options]
|
|
205
|
+
return @workflow[:run_options][:skip_zip_results]
|
|
206
|
+
end
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
return default
|
|
211
|
+
end
|
|
212
|
+
|
|
195
213
|
def preserve_run_dir(user_options, default)
|
|
196
214
|
# user option trumps all others
|
|
197
215
|
return user_options[:preserve_run_dir] if user_options[:preserve_run_dir]
|
|
@@ -273,6 +291,101 @@ module OpenStudio
|
|
|
273
291
|
return default
|
|
274
292
|
end
|
|
275
293
|
|
|
294
|
+
def epjson(user_options, default, logger)
|
|
295
|
+
# check version for this feature
|
|
296
|
+
os_version = OpenStudio::VersionString.new(OpenStudio.openStudioVersion)
|
|
297
|
+
min_version_feature = OpenStudio::VersionString.new('3.3.0')
|
|
298
|
+
unless os_version >= min_version_feature
|
|
299
|
+
log_message = 'epJSON is only supported for versions >= 3.3.0. Falling back to using IDF'
|
|
300
|
+
logger.info log_message
|
|
301
|
+
return default
|
|
302
|
+
end
|
|
303
|
+
|
|
304
|
+
# user option trumps all others
|
|
305
|
+
return user_options[:epjson] if user_options[:epjson]
|
|
306
|
+
|
|
307
|
+
# try to read from OSW
|
|
308
|
+
|
|
309
|
+
if @run_options.is_initialized && @run_options.get.respond_to?(:epjson)
|
|
310
|
+
return @run_options.get.epjson
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
return default
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
# Process the `run` method `ft_options` subhash
|
|
317
|
+
#
|
|
318
|
+
# This will validate that each suboption is supported in the current
|
|
319
|
+
# version as well as enhance the hash with the corresponding
|
|
320
|
+
# ForwardTranslator method name to set the value on the FT later
|
|
321
|
+
# in `translate_to_energyplus`
|
|
322
|
+
# user option trumps all others
|
|
323
|
+
def ft_options(user_options, default, logger)
|
|
324
|
+
# check version for this feature
|
|
325
|
+
os_version = OpenStudio::VersionString.new(OpenStudio.openStudioVersion)
|
|
326
|
+
|
|
327
|
+
os300 = OpenStudio::VersionString.new('3.0.0')
|
|
328
|
+
os330 = OpenStudio::VersionString.new('3.3.0')
|
|
329
|
+
known_ft_opts = {
|
|
330
|
+
# All Versions
|
|
331
|
+
runcontrolspecialdays: { method_name: :setKeepRunControlSpecialDays, min_version: nil },
|
|
332
|
+
ip_tabular_output: { method_name: :setIPTabularOutput, min_version: nil },
|
|
333
|
+
no_lifecyclecosts: { method_name: :setExcludeLCCObjects, min_version: nil },
|
|
334
|
+
# 3.0.0
|
|
335
|
+
no_sqlite_output: { method_name: :setExcludeSQliteOutputReport, min_version: os300 },
|
|
336
|
+
no_html_output: { method_name: :setExcludeHTMLOutputReport, min_version: os300 },
|
|
337
|
+
no_variable_dictionary: { method_name: :setExcludeVariableDictionary, min_version: os300 },
|
|
338
|
+
# 3.3.0
|
|
339
|
+
no_space_translation: { method_name: :setExcludeSpaceTranslation, min_version: os330 }
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
# user option trumps all others
|
|
343
|
+
if user_options[:ft_options]
|
|
344
|
+
ft_opts = {}
|
|
345
|
+
user_options[:ft_options].each do |opt_flag_name, opt_flag|
|
|
346
|
+
puts "#{opt_flag_name} = #{opt_flag}"
|
|
347
|
+
unless known_ft_opts.key?(opt_flag_name)
|
|
348
|
+
log_message = "'ft_options' suboption '#{opt_flag_name}' is not recognized, ignoring it."
|
|
349
|
+
logger.warn log_message
|
|
350
|
+
next
|
|
351
|
+
end
|
|
352
|
+
min_version = known_ft_opts[opt_flag_name][:min_version]
|
|
353
|
+
if !min_version.nil? && os_version < min_version
|
|
354
|
+
log_message = "'ft_options' suboption '#{opt_flag_name}' is only supported for OpenStudio Version >= #{min_version.str}, ignoring it."
|
|
355
|
+
logger.warn log_message
|
|
356
|
+
next
|
|
357
|
+
end
|
|
358
|
+
ft_opts[opt_flag_name] = { method_name: known_ft_opts[opt_flag_name][:method_name], value: opt_flag }
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
return ft_opts
|
|
362
|
+
end
|
|
363
|
+
|
|
364
|
+
# try to read from OSW
|
|
365
|
+
|
|
366
|
+
if @run_options.is_initialized && @run_options.get.respond_to?(:forwardTranslateOptions)
|
|
367
|
+
ft_opts = {}
|
|
368
|
+
JSON.parse(@run_options.get.forwardTranslateOptions, symbolize_names: true).each do |opt_flag_name, opt_flag|
|
|
369
|
+
unless known_ft_opts.key?(opt_flag_name)
|
|
370
|
+
log_message = "'ft_options' suboption '#{opt_flag_name}' is not recognized, ignoring it."
|
|
371
|
+
logger.warn log_message
|
|
372
|
+
next
|
|
373
|
+
end
|
|
374
|
+
min_version = known_ft_opts[opt_flag_name.to_sym][:min_version]
|
|
375
|
+
if !min_version.nil? && os_version < min_version
|
|
376
|
+
log_message = "'ft_options' suboption '#{opt_flag_name}' is only supported for OpenStudio Version >= #{min_version.str}, ignoring it."
|
|
377
|
+
logger.warn log_message
|
|
378
|
+
next
|
|
379
|
+
end
|
|
380
|
+
ft_opts[opt_flag_name] = { method_name: known_ft_opts[opt_flag_name][:method_name], value: opt_flag }
|
|
381
|
+
end
|
|
382
|
+
|
|
383
|
+
return ft_opts
|
|
384
|
+
end
|
|
385
|
+
|
|
386
|
+
return default
|
|
387
|
+
end
|
|
388
|
+
|
|
276
389
|
def weather_file(user_options, default)
|
|
277
390
|
# user option trumps all others
|
|
278
391
|
return user_options[:weather_file] if user_options[:weather_file]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -136,8 +136,10 @@ module OpenStudio
|
|
|
136
136
|
|
|
137
137
|
# Write the results of the workflow to the filesystem
|
|
138
138
|
#
|
|
139
|
-
def communicate_results(directory, results)
|
|
140
|
-
|
|
139
|
+
def communicate_results(directory, results, skip_zip_results)
|
|
140
|
+
if !skip_zip_results
|
|
141
|
+
zip_results(directory)
|
|
142
|
+
end
|
|
141
143
|
|
|
142
144
|
if results.is_a? Hash
|
|
143
145
|
# DLM: don't we want this in the results zip?
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -55,10 +55,6 @@ module OpenStudio
|
|
|
55
55
|
@socket.write("Started\n")
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
-
def communicate_results(directory, results)
|
|
59
|
-
super
|
|
60
|
-
end
|
|
61
|
-
|
|
62
58
|
def communicate_complete
|
|
63
59
|
super
|
|
64
60
|
@socket.write("Complete\n")
|
|
@@ -75,7 +71,7 @@ module OpenStudio
|
|
|
75
71
|
|
|
76
72
|
def communicate_transition(message, type, options = {})
|
|
77
73
|
super
|
|
78
|
-
@socket.write(message
|
|
74
|
+
@socket.write("#{message}\n")
|
|
79
75
|
end
|
|
80
76
|
|
|
81
77
|
def communicate_energyplus_stdout(line, options = {})
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -47,22 +47,6 @@ module OpenStudio
|
|
|
47
47
|
raise 'The required :url option was not passed to the web output adapter' unless options[:url]
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
-
def communicate_started
|
|
51
|
-
super
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def communicate_results(directory, results)
|
|
55
|
-
super
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def communicate_complete
|
|
59
|
-
super
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
def communicate_failure
|
|
63
|
-
super
|
|
64
|
-
end
|
|
65
|
-
|
|
66
50
|
def communicate_objective_function(objectives, options = {})
|
|
67
51
|
super
|
|
68
52
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -113,19 +113,18 @@ module OpenStudio
|
|
|
113
113
|
end
|
|
114
114
|
|
|
115
115
|
# skip x-large directory
|
|
116
|
-
if File.size?(file)
|
|
117
|
-
next
|
|
116
|
+
if File.size?(file) && (File.size?(file) >= 15000000)
|
|
117
|
+
next
|
|
118
118
|
end
|
|
119
|
+
|
|
119
120
|
add_directory_to_zip(zf, file, directory)
|
|
120
121
|
else
|
|
121
122
|
next if File.extname(file) =~ /\.rb.*/
|
|
122
123
|
next if File.extname(file) =~ /\.zip.*/
|
|
123
124
|
|
|
124
125
|
# skip large non-osm/idf files
|
|
125
|
-
if File.size(file)
|
|
126
|
-
|
|
127
|
-
next unless File.extname(file) == '.osm' || File.extname(file) == '.idf'
|
|
128
|
-
end
|
|
126
|
+
if File.size(file) && (File.size(file) >= 100000000) && !(File.extname(file) == '.osm' || File.extname(file) == '.idf')
|
|
127
|
+
next
|
|
129
128
|
end
|
|
130
129
|
|
|
131
130
|
zip_file_to_add = file.gsub("#{directory}/", '')
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -181,7 +181,7 @@ class RunInitialization < OpenStudio::Workflow::Job
|
|
|
181
181
|
|
|
182
182
|
unless weather_path.empty?
|
|
183
183
|
weather_path = weather_path.get
|
|
184
|
-
@logger.debug
|
|
184
|
+
@logger.debug "Searching for weather file #{weather_path}"
|
|
185
185
|
|
|
186
186
|
weather_full_path = workflow_json.findFile(weather_path)
|
|
187
187
|
if weather_full_path.empty?
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -63,8 +63,20 @@ class RunReportingMeasures < OpenStudio::Workflow::Job
|
|
|
63
63
|
# Ensure output_attributes is initialized in the registry
|
|
64
64
|
@registry.register(:output_attributes) { {} } unless @registry[:output_attributes]
|
|
65
65
|
|
|
66
|
+
# get OSA[:urbanopt] #BLB should prob be sent in as cli arg and used in options but for now just do this
|
|
67
|
+
@registry.register(:urbanopt) { false }
|
|
68
|
+
if @registry[:osw_path]
|
|
69
|
+
workflow = nil
|
|
70
|
+
if File.exist? @registry[:osw_path]
|
|
71
|
+
workflow = ::JSON.parse(File.read(@registry[:osw_path]), symbolize_names: true)
|
|
72
|
+
if !workflow.nil? && !workflow[:urbanopt].nil?
|
|
73
|
+
@registry.register(:urbanopt) { workflow[:urbanopt] }
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
66
78
|
# Load simulation files as required
|
|
67
|
-
unless @registry[:runner].halted
|
|
79
|
+
unless @registry[:runner].halted || @registry[:urbanopt]
|
|
68
80
|
if @registry[:model].nil?
|
|
69
81
|
osm_path = File.absolute_path(File.join(@registry[:run_dir], 'in.osm'))
|
|
70
82
|
@logger.debug "Attempting to load #{osm_path}"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -48,12 +48,7 @@ module OpenStudio
|
|
|
48
48
|
class Run
|
|
49
49
|
attr_accessor :registry
|
|
50
50
|
|
|
51
|
-
attr_reader :options
|
|
52
|
-
attr_reader :input_adapter
|
|
53
|
-
attr_reader :output_adapter
|
|
54
|
-
attr_reader :final_message
|
|
55
|
-
attr_reader :job_results
|
|
56
|
-
attr_reader :current_state
|
|
51
|
+
attr_reader :options, :input_adapter, :output_adapter, :final_message, :job_results, :current_state
|
|
57
52
|
|
|
58
53
|
# Define the default set of jobs. Note that the states of :queued of :finished need to exist for all job arrays.
|
|
59
54
|
#
|
|
@@ -90,6 +85,7 @@ module OpenStudio
|
|
|
90
85
|
# @option user_options [Hash] :debug Print debugging messages, overrides OSW option if set, defaults to false
|
|
91
86
|
# @option user_options [Hash] :energyplus_path Specifies path to energyplus executable, defaults to empty
|
|
92
87
|
# @option user_options [Hash] :fast Speeds up workflow by skipping steps not needed for running simulations, defaults to false
|
|
88
|
+
# @option user_options [Hash] :skip_zip_results Skips creating the data_point.zip file. Setting to `true` can cause issues with workflows expecting .zip files to signal completion (e.g., OpenStudio Analysis Framework), defaults to false
|
|
93
89
|
# @option user_options [Hash] :jobs Simulation workflow, overrides jobs in OSW if set, defaults to default_jobs
|
|
94
90
|
# @option user_options [Hash] :output_adapter Output adapter to use, overrides output adapter in OSW if set, defaults to local adapter
|
|
95
91
|
# @option user_options [Hash] :preserve_run_dir Prevents run directory from being cleaned prior to run, overrides OSW option if set, defaults to false - DLM, Deprecate
|
|
@@ -99,6 +95,8 @@ module OpenStudio
|
|
|
99
95
|
# @option user_options [Hash] :targets Log targets to write to, defaults to standard out and run.log
|
|
100
96
|
# @option user_options [Hash] :verify_osw Check OSW for correctness, defaults to true
|
|
101
97
|
# @option user_options [Hash] :weather_file Initial weather file to load, overrides OSW option if set, defaults to empty
|
|
98
|
+
# @option user_options [Hash] :epjson - Create, export and run using epjson format. Default is IDF
|
|
99
|
+
# @option user_options [Hash] :ft_options - A subhash of options to set on the ForwardTranslator
|
|
102
100
|
def initialize(osw_path, user_options = {})
|
|
103
101
|
# DLM - what is final_message?
|
|
104
102
|
@final_message = ''
|
|
@@ -158,15 +156,13 @@ module OpenStudio
|
|
|
158
156
|
end
|
|
159
157
|
|
|
160
158
|
# By default blow away the entire run directory every time and recreate it
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
FileUtils.rm_rf(@registry[:run_dir])
|
|
169
|
-
end
|
|
159
|
+
if !@options[:preserve_run_dir] && File.exist?(@registry[:run_dir])
|
|
160
|
+
# logger is not initialized yet (it needs run dir to exist for log)
|
|
161
|
+
puts "Removing existing run directory #{@registry[:run_dir]}" if @options[:debug]
|
|
162
|
+
|
|
163
|
+
# DLM: this is dangerous, we are calling rm_rf on a user entered directory, need to check this first
|
|
164
|
+
# TODO: Echoing Dan's comment
|
|
165
|
+
FileUtils.rm_rf(@registry[:run_dir])
|
|
170
166
|
end
|
|
171
167
|
FileUtils.mkdir_p(@registry[:run_dir])
|
|
172
168
|
|
|
@@ -176,7 +172,7 @@ module OpenStudio
|
|
|
176
172
|
else
|
|
177
173
|
# don't create these files unless we want to use them
|
|
178
174
|
# DLM: TODO, make sure that run.log will be closed later
|
|
179
|
-
@options[:targets] = [
|
|
175
|
+
@options[:targets] = [$stdout, File.open(File.join(@registry[:run_dir], 'run.log'), 'a')]
|
|
180
176
|
end
|
|
181
177
|
|
|
182
178
|
@registry.register(:log_targets) { @options[:targets] }
|
|
@@ -204,6 +200,9 @@ module OpenStudio
|
|
|
204
200
|
@options[:verify_osw] = @input_adapter.verify_osw(user_options, true)
|
|
205
201
|
@options[:weather_file] = @input_adapter.weather_file(user_options, nil)
|
|
206
202
|
@options[:fast] = @input_adapter.fast(user_options, false)
|
|
203
|
+
@options[:skip_zip_results] = @input_adapter.skip_zip_results(user_options, false)
|
|
204
|
+
@options[:epjson] = @input_adapter.epjson(user_options, false, @logger)
|
|
205
|
+
@options[:ft_options] = @input_adapter.ft_options(user_options, {}, @logger)
|
|
207
206
|
|
|
208
207
|
openstudio_dir = 'unknown'
|
|
209
208
|
begin
|
|
@@ -236,7 +235,7 @@ module OpenStudio
|
|
|
236
235
|
|
|
237
236
|
if !@options[:fast]
|
|
238
237
|
@logger.info 'Finished workflow - communicating results and zipping files'
|
|
239
|
-
@output_adapter.communicate_results(@registry[:run_dir], @registry[:results])
|
|
238
|
+
@output_adapter.communicate_results(@registry[:run_dir], @registry[:results], @options[:skip_zip_results])
|
|
240
239
|
end
|
|
241
240
|
rescue StandardError => e
|
|
242
241
|
@logger.info "Error occurred during running with #{e.message}"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -43,6 +43,8 @@ module OpenStudio
|
|
|
43
43
|
module EnergyPlus
|
|
44
44
|
require 'openstudio/workflow/util/io'
|
|
45
45
|
include OpenStudio::Workflow::Util::IO
|
|
46
|
+
require 'openstudio/workflow/util/model'
|
|
47
|
+
include OpenStudio::Workflow::Util::Model
|
|
46
48
|
ENERGYPLUS_REGEX = /^energyplus\D{0,4}$/i.freeze
|
|
47
49
|
EXPAND_OBJECTS_REGEX = /^expandobjects\D{0,4}$/i.freeze
|
|
48
50
|
|
|
@@ -94,8 +96,8 @@ module OpenStudio
|
|
|
94
96
|
Dir["#{energyplus_path}/*"].each do |file|
|
|
95
97
|
next if File.directory? file
|
|
96
98
|
|
|
97
|
-
# copy idd and
|
|
98
|
-
if File.extname(file).downcase =~ /.idd|.ini/
|
|
99
|
+
# copy idd, ini and epJSON schema files
|
|
100
|
+
if File.extname(file).downcase =~ /.idd|.ini|.epjson/
|
|
99
101
|
dest_file = "#{run_directory}/#{File.basename(file)}"
|
|
100
102
|
energyplus_files << dest_file
|
|
101
103
|
FileUtils.copy file, dest_file
|
|
@@ -125,12 +127,14 @@ module OpenStudio
|
|
|
125
127
|
# @return [Void]
|
|
126
128
|
#
|
|
127
129
|
def call_energyplus(run_directory, energyplus_path = nil, output_adapter = nil, logger = nil, workflow_json = nil)
|
|
128
|
-
logger ||= ::Logger.new(
|
|
130
|
+
logger ||= ::Logger.new($stdout) unless logger
|
|
129
131
|
|
|
130
132
|
current_dir = Dir.pwd
|
|
131
133
|
energyplus_path ||= find_energyplus
|
|
132
134
|
logger.info "EnergyPlus path is #{energyplus_path}"
|
|
135
|
+
|
|
133
136
|
energyplus_files, energyplus_exe, expand_objects_exe = prepare_energyplus_dir(run_directory, logger, energyplus_path)
|
|
137
|
+
|
|
134
138
|
Dir.chdir(run_directory)
|
|
135
139
|
logger.info "Starting simulation in run directory: #{Dir.pwd}"
|
|
136
140
|
|
|
@@ -152,18 +156,50 @@ module OpenStudio
|
|
|
152
156
|
end
|
|
153
157
|
end
|
|
154
158
|
|
|
155
|
-
#
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
159
|
+
# Translate the IDF to an epJSON if @options[:epjson] is true
|
|
160
|
+
# Ideally, this would be done sooner in the workflow process but many processes
|
|
161
|
+
# manipulate the model_idf, some which are ep_measures that may not work with json
|
|
162
|
+
# and ExpandObjects does not currently support epjson anyway to that still needs to run
|
|
163
|
+
# before this can be changed.
|
|
164
|
+
if @options[:epjson]
|
|
165
|
+
@logger.info 'Beginning the translation to epJSON'
|
|
166
|
+
@registry[:time_logger]&.start('Translating to EnergyPlus epJSON')
|
|
167
|
+
idf_final = load_idf("#{run_directory}/in.idf", @logger)
|
|
168
|
+
model_epjson = translate_idf_to_epjson idf_final, @logger
|
|
169
|
+
@registry[:time_logger]&.stop('Translating to EnergyPlus')
|
|
170
|
+
@logger.info 'Successfully translated to epJSON'
|
|
171
|
+
@registry[:time_logger]&.start('Saving epJSON')
|
|
172
|
+
epjson_name = save_epjson(model_epjson, run_directory)
|
|
173
|
+
@registry[:time_logger]&.stop('Saving epJSON')
|
|
174
|
+
@logger.debug "Saved epJSON as #{epjson_name}"
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# Run using epJSON if @options[:epjson] true, otherwise use IDF
|
|
178
|
+
if @options[:epjson]
|
|
179
|
+
command = popen_command("\"#{energyplus_exe}\" in.epJSON 2>&1")
|
|
180
|
+
logger.info "Running command '#{command}'"
|
|
181
|
+
File.open('stdout-energyplus', 'w') do |file|
|
|
182
|
+
::IO.popen(command) do |io|
|
|
183
|
+
while (line = io.gets)
|
|
184
|
+
file << line
|
|
185
|
+
output_adapter&.communicate_energyplus_stdout(line)
|
|
186
|
+
end
|
|
163
187
|
end
|
|
164
188
|
end
|
|
189
|
+
r = $?
|
|
190
|
+
else
|
|
191
|
+
command = popen_command("\"#{energyplus_exe}\" 2>&1")
|
|
192
|
+
logger.info "Running command '#{command}'"
|
|
193
|
+
File.open('stdout-energyplus', 'w') do |file|
|
|
194
|
+
::IO.popen(command) do |io|
|
|
195
|
+
while (line = io.gets)
|
|
196
|
+
file << line
|
|
197
|
+
output_adapter&.communicate_energyplus_stdout(line)
|
|
198
|
+
end
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
r = $?
|
|
165
202
|
end
|
|
166
|
-
r = $?
|
|
167
203
|
|
|
168
204
|
logger.info "EnergyPlus returned '#{r}'"
|
|
169
205
|
unless r.to_i.zero?
|
|
@@ -231,7 +267,7 @@ module OpenStudio
|
|
|
231
267
|
end
|
|
232
268
|
|
|
233
269
|
# merge in monthly reports
|
|
234
|
-
EnergyPlus.monthly_report_idf_text.split(
|
|
270
|
+
EnergyPlus.monthly_report_idf_text.split(/^\s*$/).each do |object|
|
|
235
271
|
object = object.strip
|
|
236
272
|
next if object.empty?
|
|
237
273
|
|
|
@@ -278,11 +314,9 @@ module OpenStudio
|
|
|
278
314
|
allowed_objects << 'Meter:CustomDecrement'
|
|
279
315
|
allowed_objects << 'EnergyManagementSystem:OutputVariable'
|
|
280
316
|
|
|
281
|
-
if allowed_objects.include?(idd_object.name)
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
num_added += 1
|
|
285
|
-
end
|
|
317
|
+
if allowed_objects.include?(idd_object.name) && !check_for_object(workspace, idf_object, idd_object.type)
|
|
318
|
+
workspace.addObject(idf_object)
|
|
319
|
+
num_added += 1
|
|
286
320
|
end
|
|
287
321
|
|
|
288
322
|
allowed_unique_objects = []
|
|
@@ -293,15 +327,13 @@ module OpenStudio
|
|
|
293
327
|
# OutputControl:ReportingTolerances # not allowed
|
|
294
328
|
# Output:SQLite # not allowed
|
|
295
329
|
|
|
296
|
-
if allowed_unique_objects.include?(idf_object.iddObject.name)
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
merge_output_table_summary_reports(summary_reports[0], idf_object)
|
|
304
|
-
end
|
|
330
|
+
if allowed_unique_objects.include?(idf_object.iddObject.name) && (idf_object.iddObject.name == 'Output:Table:SummaryReports')
|
|
331
|
+
summary_reports = workspace.getObjectsByType(idf_object.iddObject.type)
|
|
332
|
+
if summary_reports.empty?
|
|
333
|
+
workspace.addObject(idf_object)
|
|
334
|
+
num_added += 1
|
|
335
|
+
else
|
|
336
|
+
merge_output_table_summary_reports(summary_reports[0], idf_object)
|
|
305
337
|
end
|
|
306
338
|
end
|
|
307
339
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# *******************************************************************************
|
|
2
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
2
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
3
3
|
# All rights reserved.
|
|
4
4
|
# Redistribution and use in source and binary forms, with or without
|
|
5
5
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -342,6 +342,8 @@ module OpenStudio
|
|
|
342
342
|
result = nil
|
|
343
343
|
begin
|
|
344
344
|
load measure_path.to_s
|
|
345
|
+
# load.c in ruby can result in changing dir to root / so preserve cwd here. happens in openstudio cli
|
|
346
|
+
Dir.chdir measure_run_dir
|
|
345
347
|
measure_object = Object.const_get(class_name).new
|
|
346
348
|
rescue => e
|
|
347
349
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -95,19 +95,55 @@ module OpenStudio
|
|
|
95
95
|
# @todo (rhorsey) rescue errors here
|
|
96
96
|
#
|
|
97
97
|
def translate_to_energyplus(model, logger = nil)
|
|
98
|
-
logger ||= ::Logger.new(
|
|
98
|
+
logger ||= ::Logger.new($stdout)
|
|
99
99
|
logger.info 'Translate object to EnergyPlus IDF in preparation for EnergyPlus'
|
|
100
100
|
a = ::Time.now
|
|
101
101
|
# ensure objects exist for reporting purposes
|
|
102
102
|
model.getFacility
|
|
103
103
|
model.getBuilding
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
ft = OpenStudio::EnergyPlus::ForwardTranslator.new
|
|
105
|
+
|
|
106
|
+
ft_options = @options[:ft_options]
|
|
107
|
+
if !ft_options.empty?
|
|
108
|
+
|
|
109
|
+
msg = "Custom ForwardTranslator options passed:\n"
|
|
110
|
+
|
|
111
|
+
ft_options.each do |opt_flag_name, h|
|
|
112
|
+
ft_method = h[:method_name]
|
|
113
|
+
opt_flag = h[:value]
|
|
114
|
+
|
|
115
|
+
# Call the FT setter with the value passed in
|
|
116
|
+
ft.method(ft_method).call(opt_flag)
|
|
117
|
+
|
|
118
|
+
msg += "* :#{opt_flag_name}=#{opt_flag} => ft.#{ft_method}(#{opt_flag})\n"
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
logger.info msg
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
model_idf = ft.translateModel(model)
|
|
106
125
|
b = ::Time.now
|
|
107
126
|
logger.info "Translate object to EnergyPlus IDF took #{b.to_f - a.to_f}"
|
|
108
127
|
model_idf
|
|
109
128
|
end
|
|
110
129
|
|
|
130
|
+
# Translates an IDF model into an EnergyPlus epJSON object
|
|
131
|
+
#
|
|
132
|
+
# @param [Object] OpenStudio::IdfFile instance to translate into an OpenStudio epJSON object -- see
|
|
133
|
+
# the OpenStudio SDK for details on the process
|
|
134
|
+
# @return [Object] Returns and OpenStudio::epJSONobject
|
|
135
|
+
#
|
|
136
|
+
def translate_idf_to_epjson(model_idf, logger = nil)
|
|
137
|
+
logger ||= ::Logger.new($stdout)
|
|
138
|
+
logger.info 'Translate IDF to epJSON in preparation for EnergyPlus'
|
|
139
|
+
a = ::Time.now
|
|
140
|
+
model_epjson = OpenStudio::EPJSON.toJSONString(model_idf)
|
|
141
|
+
b = ::Time.now
|
|
142
|
+
logger.info "Translate IDF to EnergyPlus epJSON took #{b.to_f - a.to_f}"
|
|
143
|
+
|
|
144
|
+
model_epjson
|
|
145
|
+
end
|
|
146
|
+
|
|
111
147
|
# Saves an OpenStudio model object to file
|
|
112
148
|
#
|
|
113
149
|
# @param [Object] model The OpenStudio::Model instance to save to file
|
|
@@ -149,6 +185,27 @@ module OpenStudio
|
|
|
149
185
|
end
|
|
150
186
|
idf_filename
|
|
151
187
|
end
|
|
188
|
+
|
|
189
|
+
# Saves an OpenStudio EpJSON model object to file
|
|
190
|
+
#
|
|
191
|
+
# @param [Object] model The OpenStudio::Workspace instance to save to file
|
|
192
|
+
# @param [String] save_directory Folder to save the model in
|
|
193
|
+
# @param [String] name ('in.epJSON') Option to define a non-standard name
|
|
194
|
+
# @return [String] epJSON file name
|
|
195
|
+
#
|
|
196
|
+
def save_epjson(model_epjson, save_directory, name = 'in.epJSON')
|
|
197
|
+
epjson_filename = File.join(save_directory.to_s, name.to_s)
|
|
198
|
+
File.open(epjson_filename, 'w') do |f|
|
|
199
|
+
f << model_epjson.to_s
|
|
200
|
+
# make sure data is written to the disk one way or the other
|
|
201
|
+
begin
|
|
202
|
+
f.fsync
|
|
203
|
+
rescue StandardError
|
|
204
|
+
f.flush
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
epjson_filename
|
|
208
|
+
end
|
|
152
209
|
end
|
|
153
210
|
end
|
|
154
211
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -138,10 +138,10 @@ module OpenStudio
|
|
|
138
138
|
#
|
|
139
139
|
def rename_hash_keys(hash, logger)
|
|
140
140
|
# @todo should we log the name changes?
|
|
141
|
-
regex = %r{[
|
|
141
|
+
regex = %r{[|!@#$%^&*()\{\}\\\[\];:'",<.>/?+=]+}
|
|
142
142
|
|
|
143
143
|
rename_keys = lambda do |h|
|
|
144
|
-
if Hash
|
|
144
|
+
if h.is_a?(Hash)
|
|
145
145
|
h.each_key do |key|
|
|
146
146
|
if key.to_s =~ regex
|
|
147
147
|
logger.warn "Renaming result key '#{key}' to remove invalid characters"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -55,7 +55,7 @@ module OpenStudio
|
|
|
55
55
|
#
|
|
56
56
|
def get_weather_file(directory, wf, wf_search_array, model, logger = nil)
|
|
57
57
|
# TODO: this logic needs some updating, weather file should come from current model, found using search paths
|
|
58
|
-
logger ||= ::Logger.new(
|
|
58
|
+
logger ||= ::Logger.new($stdout) unless logger
|
|
59
59
|
if wf
|
|
60
60
|
weather_file = get_weather_file_from_fs(directory, wf, wf_search_array, logger)
|
|
61
61
|
raise 'Could not locate the weather file in the filesystem. Please see the log' if weather_file == false
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -37,6 +37,6 @@
|
|
|
37
37
|
|
|
38
38
|
module OpenStudio
|
|
39
39
|
module Workflow
|
|
40
|
-
VERSION = '2.
|
|
40
|
+
VERSION = '2.3.0' # Suffixes must have periods (not dashes)
|
|
41
41
|
end
|
|
42
42
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -89,9 +89,7 @@ class WorkflowStepResultValue_Shim
|
|
|
89
89
|
@type = type
|
|
90
90
|
end
|
|
91
91
|
|
|
92
|
-
attr_reader :name
|
|
93
|
-
|
|
94
|
-
attr_reader :value
|
|
92
|
+
attr_reader :name, :value
|
|
95
93
|
|
|
96
94
|
def variantType
|
|
97
95
|
@type
|
|
@@ -162,7 +160,7 @@ class WorkflowStepResult_Shim
|
|
|
162
160
|
|
|
163
161
|
def setStepResult(step_result)
|
|
164
162
|
@result[:step_result] = step_result
|
|
165
|
-
|
|
163
|
+
end
|
|
166
164
|
end
|
|
167
165
|
|
|
168
166
|
# WorkflowStep_Shim provides a shim interface to the WorkflowStep class in OpenStudio 2.X when running in OpenStudio 1.X
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
|
@@ -65,14 +65,12 @@ class WorkflowRunner < OpenStudio::Ruleset::OSRunner
|
|
|
65
65
|
::Time.now.utc.strftime('%Y%m%dT%H%M%SZ')
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
-
attr_reader :datapoint
|
|
68
|
+
attr_reader :datapoint, :analysis
|
|
69
69
|
|
|
70
70
|
def setDatapoint(datapoint)
|
|
71
71
|
@datapoint = datapoint
|
|
72
72
|
end
|
|
73
73
|
|
|
74
|
-
attr_reader :analysis
|
|
75
|
-
|
|
76
74
|
def setAnalysis(analysis)
|
|
77
75
|
@analysis = analysis
|
|
78
76
|
end
|
data/lib/openstudio-workflow.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# *******************************************************************************
|
|
4
|
-
# OpenStudio(R), Copyright (c) 2008-
|
|
4
|
+
# OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC.
|
|
5
5
|
# All rights reserved.
|
|
6
6
|
# Redistribution and use in source and binary forms, with or without
|
|
7
7
|
# modification, are permitted provided that the following conditions are met:
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: openstudio-workflow
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nicholas Long
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2021-10-21 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: builder
|
|
@@ -29,16 +29,16 @@ dependencies:
|
|
|
29
29
|
name: bundler
|
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
|
31
31
|
requirements:
|
|
32
|
-
- - "
|
|
32
|
+
- - ">="
|
|
33
33
|
- !ruby/object:Gem::Version
|
|
34
|
-
version:
|
|
34
|
+
version: 2.1.0
|
|
35
35
|
type: :development
|
|
36
36
|
prerelease: false
|
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
|
38
38
|
requirements:
|
|
39
|
-
- - "
|
|
39
|
+
- - ">="
|
|
40
40
|
- !ruby/object:Gem::Version
|
|
41
|
-
version:
|
|
41
|
+
version: 2.1.0
|
|
42
42
|
- !ruby/object:Gem::Dependency
|
|
43
43
|
name: ci_reporter
|
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -96,103 +96,103 @@ dependencies:
|
|
|
96
96
|
- !ruby/object:Gem::Version
|
|
97
97
|
version: 2.8.0
|
|
98
98
|
- !ruby/object:Gem::Dependency
|
|
99
|
-
name:
|
|
99
|
+
name: openstudio_measure_tester
|
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
|
101
101
|
requirements:
|
|
102
102
|
- - "~>"
|
|
103
103
|
- !ruby/object:Gem::Version
|
|
104
|
-
version:
|
|
104
|
+
version: 0.3.1
|
|
105
105
|
type: :development
|
|
106
106
|
prerelease: false
|
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
|
108
108
|
requirements:
|
|
109
109
|
- - "~>"
|
|
110
110
|
- !ruby/object:Gem::Version
|
|
111
|
-
version:
|
|
111
|
+
version: 0.3.1
|
|
112
112
|
- !ruby/object:Gem::Dependency
|
|
113
|
-
name:
|
|
113
|
+
name: openstudio-standards
|
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
|
115
115
|
requirements:
|
|
116
116
|
- - "~>"
|
|
117
117
|
- !ruby/object:Gem::Version
|
|
118
|
-
version:
|
|
118
|
+
version: 0.2.14
|
|
119
119
|
type: :development
|
|
120
120
|
prerelease: false
|
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
|
122
122
|
requirements:
|
|
123
123
|
- - "~>"
|
|
124
124
|
- !ruby/object:Gem::Version
|
|
125
|
-
version:
|
|
125
|
+
version: 0.2.14
|
|
126
126
|
- !ruby/object:Gem::Dependency
|
|
127
|
-
name:
|
|
127
|
+
name: parallel
|
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
|
129
129
|
requirements:
|
|
130
130
|
- - "~>"
|
|
131
131
|
- !ruby/object:Gem::Version
|
|
132
|
-
version:
|
|
132
|
+
version: 1.19.1
|
|
133
133
|
type: :development
|
|
134
134
|
prerelease: false
|
|
135
135
|
version_requirements: !ruby/object:Gem::Requirement
|
|
136
136
|
requirements:
|
|
137
137
|
- - "~>"
|
|
138
138
|
- !ruby/object:Gem::Version
|
|
139
|
-
version:
|
|
139
|
+
version: 1.19.1
|
|
140
140
|
- !ruby/object:Gem::Dependency
|
|
141
|
-
name:
|
|
141
|
+
name: public_suffix
|
|
142
142
|
requirement: !ruby/object:Gem::Requirement
|
|
143
143
|
requirements:
|
|
144
144
|
- - "~>"
|
|
145
145
|
- !ruby/object:Gem::Version
|
|
146
|
-
version:
|
|
146
|
+
version: 4.0.3
|
|
147
147
|
type: :development
|
|
148
148
|
prerelease: false
|
|
149
149
|
version_requirements: !ruby/object:Gem::Requirement
|
|
150
150
|
requirements:
|
|
151
151
|
- - "~>"
|
|
152
152
|
- !ruby/object:Gem::Version
|
|
153
|
-
version:
|
|
153
|
+
version: 4.0.3
|
|
154
154
|
- !ruby/object:Gem::Dependency
|
|
155
|
-
name:
|
|
155
|
+
name: rainbow
|
|
156
156
|
requirement: !ruby/object:Gem::Requirement
|
|
157
157
|
requirements:
|
|
158
158
|
- - "~>"
|
|
159
159
|
- !ruby/object:Gem::Version
|
|
160
|
-
version:
|
|
160
|
+
version: 3.0.0
|
|
161
161
|
type: :development
|
|
162
162
|
prerelease: false
|
|
163
163
|
version_requirements: !ruby/object:Gem::Requirement
|
|
164
164
|
requirements:
|
|
165
165
|
- - "~>"
|
|
166
166
|
- !ruby/object:Gem::Version
|
|
167
|
-
version:
|
|
167
|
+
version: 3.0.0
|
|
168
168
|
- !ruby/object:Gem::Dependency
|
|
169
|
-
name:
|
|
169
|
+
name: rake
|
|
170
170
|
requirement: !ruby/object:Gem::Requirement
|
|
171
171
|
requirements:
|
|
172
172
|
- - "~>"
|
|
173
173
|
- !ruby/object:Gem::Version
|
|
174
|
-
version: 0
|
|
174
|
+
version: '13.0'
|
|
175
175
|
type: :development
|
|
176
176
|
prerelease: false
|
|
177
177
|
version_requirements: !ruby/object:Gem::Requirement
|
|
178
178
|
requirements:
|
|
179
179
|
- - "~>"
|
|
180
180
|
- !ruby/object:Gem::Version
|
|
181
|
-
version: 0
|
|
181
|
+
version: '13.0'
|
|
182
182
|
- !ruby/object:Gem::Dependency
|
|
183
|
-
name:
|
|
183
|
+
name: rspec
|
|
184
184
|
requirement: !ruby/object:Gem::Requirement
|
|
185
185
|
requirements:
|
|
186
186
|
- - "~>"
|
|
187
187
|
- !ruby/object:Gem::Version
|
|
188
|
-
version:
|
|
188
|
+
version: '3.9'
|
|
189
189
|
type: :development
|
|
190
190
|
prerelease: false
|
|
191
191
|
version_requirements: !ruby/object:Gem::Requirement
|
|
192
192
|
requirements:
|
|
193
193
|
- - "~>"
|
|
194
194
|
- !ruby/object:Gem::Version
|
|
195
|
-
version:
|
|
195
|
+
version: '3.9'
|
|
196
196
|
description: Run OpenStudio based measures and simulations using EnergyPlus
|
|
197
197
|
email:
|
|
198
198
|
- nicholas.long@nrel.gov
|
|
@@ -246,15 +246,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
246
246
|
requirements:
|
|
247
247
|
- - "~>"
|
|
248
248
|
- !ruby/object:Gem::Version
|
|
249
|
-
version: 2.
|
|
249
|
+
version: 2.7.0
|
|
250
250
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
251
251
|
requirements:
|
|
252
252
|
- - ">="
|
|
253
253
|
- !ruby/object:Gem::Version
|
|
254
254
|
version: '0'
|
|
255
255
|
requirements: []
|
|
256
|
-
|
|
257
|
-
rubygems_version: 2.7.6.2
|
|
256
|
+
rubygems_version: 3.1.4
|
|
258
257
|
signing_key:
|
|
259
258
|
specification_version: 4
|
|
260
259
|
summary: OpenStudio Workflow Manager
|