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
|
# File 'lib/openstudio/workflow/jobs/run_translation.rb', line 29
def perform
@logger.debug "Calling #{__method__} in the #{self.class} class"
if @registry[:runner].halted
@logger.info 'Workflow halted, skipping OSM to IDF translation'
@registry.register(:model_idf) { OpenStudio::Workspace.new }
return nil
end
FileUtils.mkdir_p(@registry[:run_dir])
if @registry[:wf]
@logger.info "Weather file for EnergyPlus simulation is #{@registry[:wf]}"
FileUtils.copy(@registry[:wf], "#{@registry[:run_dir]}/in.epw")
@registry.register(:wf) { "#{@registry[:run_dir]}/in.epw" }
else
@logger.warn "EPW file not found or not sent to #{self.class}"
end
@logger.info 'Beginning the translation to IDF'
@registry[:time_logger].start('Translating to EnergyPlus') if @registry[:time_logger]
model_idf = translate_to_energyplus @registry[:model], @logger
@registry[:time_logger].stop('Translating to EnergyPlus') if @registry[:time_logger]
@registry.register(:model_idf) { model_idf }
@logger.info 'Successfully translated to IDF'
return nil unless @options[:debug]
@registry[:time_logger].start('Saving IDF') if @registry[:time_logger]
idf_name = save_idf(@registry[:model_idf], @registry[:root_dir])
@registry[:time_logger].stop('Saving IDF') if @registry[:time_logger]
@logger.debug "Saved IDF as #{idf_name}"
nil
end
|