Class: RunEnergyPlus

Inherits:
OpenStudio::Workflow::Job show all
Includes:
OpenStudio::Workflow::Util::EnergyPlus
Defined in:
lib/openstudio/workflow/jobs/run_energyplus.rb

Overview

This class runs the EnergyPlus simulation

Constant Summary

Constants included from OpenStudio::Workflow::Util::EnergyPlus

OpenStudio::Workflow::Util::EnergyPlus::ENERGYPLUS_REGEX, OpenStudio::Workflow::Util::EnergyPlus::EXPAND_OBJECTS_REGEX

Instance Method Summary collapse

Methods included from OpenStudio::Workflow::Util::EnergyPlus

add_energyplus_output_request, #call_energyplus, check_for_object, #clean_directory, #energyplus_preprocess, #find_energyplus, merge_output_table_summary_reports, monthly_report_idf_text, #prepare_energyplus_dir

Methods included from OpenStudio::Workflow::Util::IO

#is_windows?, #popen_command

Constructor Details

#initialize(input_adapter, output_adapter, registry, options = {}) ⇒ RunEnergyPlus

Returns a new instance of RunEnergyPlus.



25
26
27
# File 'lib/openstudio/workflow/jobs/run_energyplus.rb', line 25

def initialize(input_adapter, output_adapter, registry, options = {})
  super
end

Instance Method Details

#performObject



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
# File 'lib/openstudio/workflow/jobs/run_energyplus.rb', line 29

def perform
  @logger.debug "Calling #{__method__} in the #{self.class} class"
  
  # skip if halted
  halted = @registry[:runner].halted
  @logger.info 'Workflow halted, skipping the EnergyPlus simulation' if halted
  return nil if halted

  # Checks and configuration
  raise 'No run_dir specified in the registry' unless @registry[:run_dir]
  ep_path = @options[:energyplus_path] ? @options[:energyplus_path] : nil
  @logger.warn "Using EnergyPlus path specified in options #{ep_path}" if ep_path

  @logger.info 'Starting the EnergyPlus simulation'
  @registry[:time_logger].start('Running EnergyPlus') if @registry[:time_logger]
  call_energyplus(@registry[:run_dir], ep_path, @output_adapter, @logger, @registry[:workflow_json])
  @registry[:time_logger].stop('Running EnergyPlus') if @registry[:time_logger]
  @logger.info 'Completed the EnergyPlus simulation'

  sql_path = File.join(@registry[:run_dir], 'eplusout.sql')
  @registry.register(:sql) { sql_path } if File.exist? sql_path
  @logger.warn "Unable to find sql file at #{sql_path}" unless @registry[:sql]

  nil
end