19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# File 'lib/openstudio/workflow/jobs/run_preprocess.rb', line 19
def perform
@logger.debug "Calling #{__method__} in the #{self.class} class"
FileUtils.mkdir_p(@registry[:run_dir])
if !@options[:skip_energyplus_preprocess]
File.open("#{@registry[:run_dir]}/pre-preprocess.idf", 'w') do |f|
f << @registry[:model_idf].to_s
begin
f.fsync
rescue StandardError
f.flush
end
end
end
@logger.info 'Beginning to collect output requests from Reporting measures.'
energyplus_output_requests = true
apply_measures('ReportingMeasure'.to_MeasureType, @registry, @options, energyplus_output_requests)
@logger.info('Finished collect output requests from Reporting measures.')
halted = @registry[:runner].halted
@logger.info 'Workflow halted, skipping the EnergyPlus pre-processor' if halted
return nil if halted
if !@options[:skip_energyplus_preprocess]
@registry[:time_logger]&.start('Running EnergyPlus Preprocess')
energyplus_preprocess(@registry[:model_idf], @logger)
@registry[:time_logger]&.start('Running EnergyPlus Preprocess')
@logger.info 'Finished preprocess job for EnergyPlus simulation'
end
if File.exist?("#{@registry[:run_dir]}/in.idf")
@logger.warn 'IDF (in.idf) already exists in the run directory. Will simulate using this file'
else
save_idf(@registry[:model_idf], @registry[:run_dir])
end
return nil unless @options[:debug]
@registry[:time_logger]&.start('Saving IDF')
idf_name = save_idf(@registry[:model_idf], @registry[:root_dir])
@registry[:time_logger]&.stop('Saving IDF')
@logger.debug "Saved IDF as #{idf_name}"
nil
end
|