Class: RunEnergyplus
- Inherits:
-
Object
- Object
- RunEnergyplus
- Defined in:
- lib/openstudio/workflow/jobs/run_energyplus/run_energyplus.rb
Overview
Copyright © 2008-2014, Alliance for Sustainable Energy.
All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Instance Method Summary collapse
-
#initialize(directory, logger, adapter, options = {}) ⇒ RunEnergyplus
constructor
Initialize param directory: base directory where the simulation files are prepared param logger: logger object in which to write log messages.
- #perform ⇒ Object
Constructor Details
#initialize(directory, logger, adapter, options = {}) ⇒ RunEnergyplus
Initialize param directory: base directory where the simulation files are prepared param logger: logger object in which to write log messages
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/openstudio/workflow/jobs/run_energyplus/run_energyplus.rb', line 24 def initialize(directory, logger, adapter, = {}) energyplus_path = nil if /cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM energyplus_path = 'C:/EnergyPlus-8-1-0' else energyplus_path = '/usr/local/EnergyPlus-8-1-0' end defaults = { energyplus_path: energyplus_path } @options = defaults.merge() # TODO: use openstudio tool finder for this @directory = directory @run_directory = "#{@directory}/run" @adapter = adapter @logger = logger @results = {} @logger.info "#{self.class} passed the following options #{@options}" end |
Instance Method Details
#perform ⇒ Object
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 77 78 79 80 81 82 |
# File 'lib/openstudio/workflow/jobs/run_energyplus/run_energyplus.rb', line 47 def perform @logger.info "Calling #{__method__} in the #{self.class} class" @logger.info "Current directory is #{@directory}" # Ensure that the directory is created (but it should already be at this point) FileUtils.mkdir_p(@run_directory) # verify that the OSM, IDF, and the Weather files are in the run directory as the 'in.*' format if @options[:run_openstudio][:weather_filename] && File.exist?(@options[:run_openstudio][:weather_filename]) # verify that it is named in.epw unless File.basename(@options[:run_openstudio][:weather_filename]).downcase == 'in.idf' FileUtils.copy(@options[:run_openstudio][:weather_filename], "#{@run_directory}/in.epw") end else fail "EPW file not found or not sent to #{self.class}" end # Need to check the in.idf and in.osm # FileUtils.copy(options[:osm], "#{@run_directory}/in.osm") # FileUtils.copy(options[:idf], "#{@run_directory}/in.idf") # can't create symlinks because the /vagrant mount is actually a windows mount @logger.info "Copying EnergyPlus files to run directory: #{@run_directory}" FileUtils.copy("#{@options[:energyplus_path]}/libbcvtb.so", "#{@run_directory}/libbcvtb.so") FileUtils.copy("#{@options[:energyplus_path]}/libepexpat.so", "#{@run_directory}/libepexpat.so") FileUtils.copy("#{@options[:energyplus_path]}/libepfmiimport.so", "#{@run_directory}/libepfmiimport.so") FileUtils.copy("#{@options[:energyplus_path]}/libDElight.so", "#{@run_directory}/libDElight.so") FileUtils.copy("#{@options[:energyplus_path]}/libDElight.so", "#{@run_directory}/libDElight.so") FileUtils.copy("#{@options[:energyplus_path]}/ExpandObjects", "#{@run_directory}/ExpandObjects") FileUtils.copy("#{@options[:energyplus_path]}/EnergyPlus", "#{@run_directory}/EnergyPlus") FileUtils.copy("#{@options[:energyplus_path]}/Energy+.idd", "#{@run_directory}/Energy+.idd") @results = call_energyplus @results end |