openstudio-workflow 1.3.5 → 2.1.1

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.
Files changed (35) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +21 -0
  3. data/README.md +10 -10
  4. data/Rakefile +13 -0
  5. data/lib/openstudio-workflow.rb +2 -0
  6. data/lib/openstudio/workflow/adapters/input/local.rb +3 -0
  7. data/lib/openstudio/workflow/adapters/output/local.rb +3 -0
  8. data/lib/openstudio/workflow/adapters/output/socket.rb +2 -0
  9. data/lib/openstudio/workflow/adapters/output/web.rb +2 -0
  10. data/lib/openstudio/workflow/adapters/output_adapter.rb +4 -0
  11. data/lib/openstudio/workflow/job.rb +2 -0
  12. data/lib/openstudio/workflow/jobs/resources/monthly_report.idf +15 -13
  13. data/lib/openstudio/workflow/jobs/run_energyplus.rb +6 -3
  14. data/lib/openstudio/workflow/jobs/run_ep_measures.rb +5 -2
  15. data/lib/openstudio/workflow/jobs/run_initialization.rb +6 -3
  16. data/lib/openstudio/workflow/jobs/run_os_measures.rb +5 -2
  17. data/lib/openstudio/workflow/jobs/run_postprocess.rb +2 -0
  18. data/lib/openstudio/workflow/jobs/run_preprocess.rb +7 -4
  19. data/lib/openstudio/workflow/jobs/run_reporting_measures.rb +19 -1
  20. data/lib/openstudio/workflow/jobs/run_translation.rb +7 -4
  21. data/lib/openstudio/workflow/multi_delegator.rb +2 -0
  22. data/lib/openstudio/workflow/registry.rb +5 -0
  23. data/lib/openstudio/workflow/run.rb +4 -2
  24. data/lib/openstudio/workflow/time_logger.rb +2 -0
  25. data/lib/openstudio/workflow/util.rb +2 -0
  26. data/lib/openstudio/workflow/util/energyplus.rb +232 -229
  27. data/lib/openstudio/workflow/util/io.rb +2 -0
  28. data/lib/openstudio/workflow/util/measure.rb +5 -0
  29. data/lib/openstudio/workflow/util/model.rb +4 -0
  30. data/lib/openstudio/workflow/util/post_process.rb +4 -1
  31. data/lib/openstudio/workflow/util/weather_file.rb +5 -0
  32. data/lib/openstudio/workflow/version.rb +3 -1
  33. data/lib/openstudio/workflow_json.rb +5 -0
  34. data/lib/openstudio/workflow_runner.rb +4 -0
  35. metadata +84 -56
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: fb02ff2b9ba68076ad3bd7bdd0b07a790db0a90e
4
- data.tar.gz: 84f8b7b245040cbef4aae3b45a5b2fe973f0ace8
2
+ SHA256:
3
+ metadata.gz: c632f0a2834a490fbd25b21ef3f17ff07d77e08bdf76db7d1737a2843665d2b6
4
+ data.tar.gz: 6ac3e3165ddac8de85d5a364878e4ae18089a9b7c2171b9bf2341cd1c4c9438e
5
5
  SHA512:
6
- metadata.gz: 466afdf8aaea899d0567f97c1df7674b5a80af09ebc3044410cc3f6a752952e3d65fc9c281aea0480bdfdc13b239819ed4eab4e5d251d194f915929131741e4b
7
- data.tar.gz: 7c8f671a81404622f1257077cd24bfd77ab405efe4ec1d6fc8fe45688ed9905509005d27f55658dedecbc46be020c695ac41bc18431be7a22e355775499a6bc3
6
+ metadata.gz: e274ab7d2787530a70ea4b5f17859640597044b72ec0c62a5b1c35dd459b7e013fe248e8454526998ed66ec22750a4fc02831a30314cf50639717f608b11fa8f
7
+ data.tar.gz: 830be90f370e3f1290c3dddeeaa63c6e1b7d7f9b4bb7e64747ac04fbf44bd3e89b2f07d11683249aa19600dd331095a87694c55f1bc9fa9102d93bd65bb05071
@@ -1,6 +1,27 @@
1
1
  OpenStudio::Workflow Change Log
2
2
  ==================================
3
3
 
4
+ Version 2.1.1
5
+ -------------
6
+ * Add support for URBANopt Workflow
7
+ * Update reporting measure in tests
8
+
9
+ Version 2.1.0
10
+ -------------
11
+ * Support for EnergyPlus 9.4. This version will not work with prior versions of EnergyPlus.
12
+ * Add warning when paths are not relative
13
+
14
+ Version 2.0.1
15
+ -------------
16
+
17
+ * Bug fix for idf.addObjects(object) to idf.addObject(object)
18
+
19
+ Version 2.0.0
20
+ -------------
21
+
22
+ * Support Ruby > 2.5
23
+ * Support OpenStudio 3.x
24
+
4
25
  Version 1.3.5
5
26
  -------------
6
27
 
data/README.md CHANGED
@@ -4,30 +4,30 @@
4
4
 
5
5
  ## OpenStudio Workflow Gem
6
6
 
7
- This branch is the development branch for the OpenStudio workflow gem.
7
+ This branch is the development branch for the OpenStudio workflow gem.
8
8
  ## Installation
9
9
 
10
10
  The OpenStudio Workflow Gem has the following dependencies:
11
11
 
12
- * Ruby 2.2.4
13
- * OpenStudio 2.x
12
+ * Ruby 2.5.5
13
+ * OpenStudio 3.x
14
14
 
15
- [OpenStudio](http://developer.nrel.gov/downloads/buildings/openstudio/builds/) 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 2.9.1 installed:
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:
16
16
 
17
- export RUBYLIB=/usr/local/openstudio-2.9.1/Ruby
17
+ export RUBYLIB=/usr/local/openstudio-3.0.0/Ruby
18
18
 
19
19
  Add this line to your application's Gemfile:
20
20
 
21
21
  gem 'OpenStudio-workflow'
22
22
 
23
23
  And then execute:
24
-
24
+
25
25
  bundle install
26
-
26
+
27
27
  Or install it yourself as:
28
-
28
+
29
29
  $ gem install openstudio-workflow
30
-
30
+
31
31
  ## Usage
32
32
 
33
33
  There are currently two adapters to run OpenStudio workflow. The first is a simple Local adapter allowing the user to pass in the directory to simulation. The directory must have an [analysis/problem JSON file](spec/files/local_ex1/analysis_1.json) and a [datapoint JSON file](spec/files/local_ex1/datapoint_1.json).
@@ -52,7 +52,7 @@ rspec spec/
52
52
  ### Docker
53
53
 
54
54
  ```
55
- export OPENSTUDIO_VERSION=2.9.1
55
+ export OPENSTUDIO_VERSION=3.0.0
56
56
  docker run -v $(pwd):/var/simdata/openstudio \
57
57
  nrel/openstudio:$OPENSTUDIO_VERSION \
58
58
  /var/simdata/openstudio/test/bin/docker-run.sh
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler'
2
4
  Bundler.setup
3
5
 
@@ -34,3 +36,14 @@ task :test_zip do
34
36
  puts "Trying to extract #{f}"
35
37
  OpenStudio::Workflow.extract_archive(f, 'junk_out', true)
36
38
  end
39
+
40
+ desc 'Transition IDF Files'
41
+ task :transition_idf do
42
+ lst_path = File.join(Dir.pwd, 'IdfFilesToTransition.lst')
43
+ File.open(lst_path, 'w') do |file|
44
+ Dir.glob('**/*.idf').each do |idf|
45
+ file.puts(File.join(Dir.pwd, idf))
46
+ end
47
+ end
48
+ puts "Use the IDFVersionUpdater and point it to #{lst_path}"
49
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # *******************************************************************************
2
4
  # OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
3
5
  # All rights reserved.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # *******************************************************************************
2
4
  # OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
3
5
  # All rights reserved.
@@ -77,6 +79,7 @@ module OpenStudio
77
79
  #
78
80
  def workflow
79
81
  raise "Could not read workflow from #{@osw_abs_path}" if @workflow.nil?
82
+
80
83
  @workflow
81
84
  end
82
85
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # *******************************************************************************
2
4
  # OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
3
5
  # All rights reserved.
@@ -42,6 +44,7 @@ module OpenStudio
42
44
  class Local < OutputAdapters
43
45
  def initialize(options = {})
44
46
  raise 'The required :output_directory option was not passed to the local output adapter' unless options[:output_directory]
47
+
45
48
  super
46
49
  end
47
50
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # *******************************************************************************
2
4
  # OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
3
5
  # All rights reserved.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # *******************************************************************************
2
4
  # OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
3
5
  # All rights reserved.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # *******************************************************************************
2
4
  # OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
3
5
  # All rights reserved.
@@ -109,6 +111,7 @@ module OpenStudio
109
111
  if File.basename(file) =~ /seed|measures|weather/
110
112
  next
111
113
  end
114
+
112
115
  # skip x-large directory
113
116
  if File.size?(file)
114
117
  next if File.size?(file) >= 15000000
@@ -117,6 +120,7 @@ module OpenStudio
117
120
  else
118
121
  next if File.extname(file) =~ /\.rb.*/
119
122
  next if File.extname(file) =~ /\.zip.*/
123
+
120
124
  # skip large non-osm/idf files
121
125
  if File.size(file)
122
126
  if File.size(file) >= 100000000
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # *******************************************************************************
2
4
  # OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
3
5
  # All rights reserved.
@@ -1,3 +1,5 @@
1
+ Version,9.4;
2
+
1
3
  Output:Table:Monthly,
2
4
  Building Energy Performance - Electricity, !- Name
3
5
  2, !- Digits After Decimal
@@ -33,17 +35,17 @@ Output:Table:Monthly,
33
35
  Output:Table:Monthly,
34
36
  Building Energy Performance - Natural Gas, !- Name
35
37
  2, !- Digits After Decimal
36
- InteriorEquipment:Gas, !- Variable or Meter 1 Name
38
+ InteriorEquipment:NaturalGas, !- Variable or Meter 1 Name
37
39
  SumOrAverage, !- Aggregation Type for Variable or Meter 1
38
- ExteriorEquipment:Gas, !- Variable or Meter 2 Name
40
+ ExteriorEquipment:NaturalGas, !- Variable or Meter 2 Name
39
41
  SumOrAverage, !- Aggregation Type for Variable or Meter 2
40
- Heating:Gas, !- Variable or Meter 3 Name
42
+ Heating:NaturalGas, !- Variable or Meter 3 Name
41
43
  SumOrAverage, !- Aggregation Type for Variable or Meter 3
42
- Cooling:Gas, !- Variable or Meter 4 Name
44
+ Cooling:NaturalGas, !- Variable or Meter 4 Name
43
45
  SumOrAverage, !- Aggregation Type for Variable or Meter 4
44
- WaterSystems:Gas, !- Variable or Meter 5 Name
46
+ WaterSystems:NaturalGas, !- Variable or Meter 5 Name
45
47
  SumOrAverage, !- Aggregation Type for Variable or Meter 5
46
- Cogeneration:Gas, !- Variable or Meter 6 Name
48
+ Cogeneration:NaturalGas, !- Variable or Meter 6 Name
47
49
  SumOrAverage; !- Aggregation Type for Variable or Meter 6
48
50
 
49
51
  Output:Table:Monthly,
@@ -141,19 +143,19 @@ Output:Table:Monthly,
141
143
  Output:Table:Monthly,
142
144
  Building Energy Performance - Natural Gas Peak Demand, !- Name
143
145
  2, !- Digits After Decimal
144
- Gas:Facility, !- Variable or Meter 1 Name
146
+ NaturalGas:Facility, !- Variable or Meter 1 Name
145
147
  Maximum, !- Aggregation Type for Variable or Meter 1
146
- InteriorEquipment:Gas, !- Variable or Meter 1 Name
148
+ InteriorEquipment:NaturalGas, !- Variable or Meter 1 Name
147
149
  ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 1
148
- ExteriorEquipment:Gas, !- Variable or Meter 2 Name
150
+ ExteriorEquipment:NaturalGas, !- Variable or Meter 2 Name
149
151
  ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 2
150
- Heating:Gas, !- Variable or Meter 3 Name
152
+ Heating:NaturalGas, !- Variable or Meter 3 Name
151
153
  ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 3
152
- Cooling:Gas, !- Variable or Meter 4 Name
154
+ Cooling:NaturalGas, !- Variable or Meter 4 Name
153
155
  ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 4
154
- WaterSystems:Gas, !- Variable or Meter 5 Name
156
+ WaterSystems:NaturalGas, !- Variable or Meter 5 Name
155
157
  ValueWhenMaximumOrMinimum, !- Aggregation Type for Variable or Meter 5
156
- Cogeneration:Gas, !- Variable or Meter 6 Name
158
+ Cogeneration:NaturalGas, !- Variable or Meter 6 Name
157
159
  ValueWhenMaximumOrMinimum; !- Aggregation Type for Variable or Meter 6
158
160
 
159
161
  Output:Table:Monthly,
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # *******************************************************************************
2
4
  # OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
3
5
  # All rights reserved.
@@ -52,13 +54,14 @@ class RunEnergyPlus < OpenStudio::Workflow::Job
52
54
 
53
55
  # Checks and configuration
54
56
  raise 'No run_dir specified in the registry' unless @registry[:run_dir]
55
- ep_path = @options[:energyplus_path] ? @options[:energyplus_path] : nil
57
+
58
+ ep_path = @options[:energyplus_path] || nil
56
59
  @logger.warn "Using EnergyPlus path specified in options #{ep_path}" if ep_path
57
60
 
58
61
  @logger.info 'Starting the EnergyPlus simulation'
59
- @registry[:time_logger].start('Running EnergyPlus') if @registry[:time_logger]
62
+ @registry[:time_logger]&.start('Running EnergyPlus')
60
63
  call_energyplus(@registry[:run_dir], ep_path, @output_adapter, @logger, @registry[:workflow_json])
61
- @registry[:time_logger].stop('Running EnergyPlus') if @registry[:time_logger]
64
+ @registry[:time_logger]&.stop('Running EnergyPlus')
62
65
  @logger.info 'Completed the EnergyPlus simulation'
63
66
 
64
67
  sql_path = File.join(@registry[:run_dir], 'eplusout.sql')
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # *******************************************************************************
2
4
  # OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
3
5
  # All rights reserved.
@@ -63,9 +65,10 @@ class RunEnergyPlusMeasures < OpenStudio::Workflow::Job
63
65
 
64
66
  # Save both the OSM and IDF if the :debug option is true
65
67
  return nil unless @options[:debug]
66
- @registry[:time_logger].start('Saving IDF') if @registry[:time_logger]
68
+
69
+ @registry[:time_logger]&.start('Saving IDF')
67
70
  idf_name = save_idf(@registry[:model_idf], @registry[:root_dir])
68
- @registry[:time_logger].stop('Saving IDF') if @registry[:time_logger]
71
+ @registry[:time_logger]&.stop('Saving IDF')
69
72
  @logger.debug "Saved IDF as #{idf_name}"
70
73
 
71
74
  nil
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # *******************************************************************************
2
4
  # OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
3
5
  # All rights reserved.
@@ -62,6 +64,7 @@ class RunInitialization < OpenStudio::Workflow::Job
62
64
  # DLM: this key is the raw JSON object, it is deprecated and should not be used, use :workflow_json instead
63
65
  @registry.register(:workflow) { @input_adapter.workflow }
64
66
  raise 'Specified workflow was nil' unless @registry[:workflow]
67
+
65
68
  @logger.debug 'Retrieved the workflow from the adapter'
66
69
 
67
70
  @registry.register(:osw_dir) { @input_adapter.osw_dir }
@@ -129,6 +132,7 @@ class RunInitialization < OpenStudio::Workflow::Job
129
132
  if model_full_path.empty?
130
133
  raise "Seed model #{model_path.get} specified in OSW cannot be found"
131
134
  end
135
+
132
136
  model_full_path = model_full_path.get
133
137
 
134
138
  if File.extname(model_full_path.to_s) == '.idf'
@@ -157,9 +161,7 @@ class RunInitialization < OpenStudio::Workflow::Job
157
161
  end
158
162
 
159
163
  if @registry[:openstudio_2]
160
- if @registry[:model]
161
- @registry[:model].setWorkflowJSON(workflow_json.clone)
162
- end
164
+ @registry[:model]&.setWorkflowJSON(workflow_json.clone)
163
165
  end
164
166
 
165
167
  # DLM: TODO, load weather_file from options so it can be overriden by user_options
@@ -189,6 +191,7 @@ class RunInitialization < OpenStudio::Workflow::Job
189
191
  if weather_full_path.empty?
190
192
  raise "Weather file '#{weather_path}' specified but cannot be found"
191
193
  end
194
+
192
195
  weather_full_path = weather_full_path.get
193
196
 
194
197
  @registry.register(:wf) { weather_full_path.to_s }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # *******************************************************************************
2
4
  # OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
3
5
  # All rights reserved.
@@ -79,9 +81,10 @@ class RunOpenStudioMeasures < OpenStudio::Workflow::Job
79
81
 
80
82
  # Save the OSM if the :debug option is true
81
83
  return nil unless @options[:debug]
82
- @registry[:time_logger].start('Saving OSM') if @registry[:time_logger]
84
+
85
+ @registry[:time_logger]&.start('Saving OSM')
83
86
  osm_name = save_osm(@registry[:model], @registry[:root_dir])
84
- @registry[:time_logger].stop('Saving OSM') if @registry[:time_logger]
87
+ @registry[:time_logger]&.stop('Saving OSM')
85
88
  @logger.debug "Saved model as #{osm_name}"
86
89
 
87
90
  nil
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # *******************************************************************************
2
4
  # OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
3
5
  # All rights reserved.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # *******************************************************************************
2
4
  # OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
3
5
  # All rights reserved.
@@ -78,9 +80,9 @@ class RunPreprocess < OpenStudio::Workflow::Job
78
80
 
79
81
  # Perform pre-processing on in.idf to capture logic in RunManager
80
82
  if !@options[:skip_energyplus_preprocess]
81
- @registry[:time_logger].start('Running EnergyPlus Preprocess') if @registry[:time_logger]
83
+ @registry[:time_logger]&.start('Running EnergyPlus Preprocess')
82
84
  energyplus_preprocess(@registry[:model_idf], @logger)
83
- @registry[:time_logger].start('Running EnergyPlus Preprocess') if @registry[:time_logger]
85
+ @registry[:time_logger]&.start('Running EnergyPlus Preprocess')
84
86
  @logger.info 'Finished preprocess job for EnergyPlus simulation'
85
87
  end
86
88
 
@@ -94,9 +96,10 @@ class RunPreprocess < OpenStudio::Workflow::Job
94
96
 
95
97
  # Save the generated IDF file if the :debug option is true
96
98
  return nil unless @options[:debug]
97
- @registry[:time_logger].start('Saving IDF') if @registry[:time_logger]
99
+
100
+ @registry[:time_logger]&.start('Saving IDF')
98
101
  idf_name = save_idf(@registry[:model_idf], @registry[:root_dir])
99
- @registry[:time_logger].stop('Saving IDF') if @registry[:time_logger]
102
+ @registry[:time_logger]&.stop('Saving IDF')
100
103
  @logger.debug "Saved IDF as #{idf_name}"
101
104
 
102
105
  nil
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # *******************************************************************************
2
4
  # OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
3
5
  # All rights reserved.
@@ -60,14 +62,29 @@ class RunReportingMeasures < OpenStudio::Workflow::Job
60
62
 
61
63
  # Ensure output_attributes is initialized in the registry
62
64
  @registry.register(:output_attributes) { {} } unless @registry[:output_attributes]
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?
73
+ if !workflow[:urbanopt].nil?
74
+ @registry.register(:urbanopt) { workflow[:urbanopt] }
75
+ end
76
+ end
77
+ end
78
+ end
63
79
 
64
80
  # Load simulation files as required
65
- unless @registry[:runner].halted
81
+ unless @registry[:runner].halted || @registry[:urbanopt]
66
82
  if @registry[:model].nil?
67
83
  osm_path = File.absolute_path(File.join(@registry[:run_dir], 'in.osm'))
68
84
  @logger.debug "Attempting to load #{osm_path}"
69
85
  @registry.register(:model) { load_osm('.', osm_path) }
70
86
  raise "Unable to load #{osm_path}" unless @registry[:model]
87
+
71
88
  @logger.debug "Successfully loaded #{osm_path}"
72
89
  end
73
90
  if @registry[:model_idf].nil?
@@ -75,6 +92,7 @@ class RunReportingMeasures < OpenStudio::Workflow::Job
75
92
  @logger.debug "Attempting to load #{idf_path}"
76
93
  @registry.register(:model_idf) { load_idf(idf_path, @logger) }
77
94
  raise "Unable to load #{idf_path}" unless @registry[:model_idf]
95
+
78
96
  @logger.debug "Successfully loaded #{idf_path}"
79
97
  end
80
98
  if @registry[:sql].nil?
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # *******************************************************************************
2
4
  # OpenStudio(R), Copyright (c) 2008-2020, Alliance for Sustainable Energy, LLC.
3
5
  # All rights reserved.
@@ -66,17 +68,18 @@ class RunTranslation < OpenStudio::Workflow::Job
66
68
 
67
69
  # Translate the OSM to an IDF
68
70
  @logger.info 'Beginning the translation to IDF'
69
- @registry[:time_logger].start('Translating to EnergyPlus') if @registry[:time_logger]
71
+ @registry[:time_logger]&.start('Translating to EnergyPlus')
70
72
  model_idf = translate_to_energyplus @registry[:model], @logger
71
- @registry[:time_logger].stop('Translating to EnergyPlus') if @registry[:time_logger]
73
+ @registry[:time_logger]&.stop('Translating to EnergyPlus')
72
74
  @registry.register(:model_idf) { model_idf }
73
75
  @logger.info 'Successfully translated to IDF'
74
76
 
75
77
  # Save the generated IDF file if the :debug option is true
76
78
  return nil unless @options[:debug]
77
- @registry[:time_logger].start('Saving IDF') if @registry[:time_logger]
79
+
80
+ @registry[:time_logger]&.start('Saving IDF')
78
81
  idf_name = save_idf(@registry[:model_idf], @registry[:root_dir])
79
- @registry[:time_logger].stop('Saving IDF') if @registry[:time_logger]
82
+ @registry[:time_logger]&.stop('Saving IDF')
80
83
  @logger.debug "Saved IDF as #{idf_name}"
81
84
 
82
85
  nil