Sha256: 34d073ea6705ec450a049c07a3f4063e210fd61fead52101c8dbee8f28ba9225

Contents?: true

Size: 1.62 KB

Versions: 2

Compression:

Stored size: 1.62 KB

Contents

# frozen_string_literal: true

class EPlus
  # Constants
  FuelTypeElectricity = 'electricity'
  FuelTypeNaturalGas = 'NaturalGas'
  FuelTypeOil = 'FuelOilNo2'
  FuelTypePropane = 'Propane'
  FuelTypeWoodCord = 'OtherFuel1'
  FuelTypeWoodPellets = 'OtherFuel2'
  FuelTypeCoal = 'Coal'

  def self.input_fuel_map(hpxml_fuel)
    # Name of fuel used as inputs to E+ objects
    if [HPXML::FuelTypeElectricity].include? hpxml_fuel
      return FuelTypeElectricity
    elsif [HPXML::FuelTypeNaturalGas].include? hpxml_fuel
      return FuelTypeNaturalGas
    elsif [HPXML::FuelTypeOil,
           HPXML::FuelTypeOil1,
           HPXML::FuelTypeOil2,
           HPXML::FuelTypeOil4,
           HPXML::FuelTypeOil5or6,
           HPXML::FuelTypeDiesel,
           HPXML::FuelTypeKerosene].include? hpxml_fuel
      return FuelTypeOil
    elsif [HPXML::FuelTypePropane].include? hpxml_fuel
      return FuelTypePropane
    elsif [HPXML::FuelTypeWoodCord].include? hpxml_fuel
      return FuelTypeWoodCord
    elsif [HPXML::FuelTypeWoodPellets].include? hpxml_fuel
      return FuelTypeWoodPellets
    elsif [HPXML::FuelTypeCoal,
           HPXML::FuelTypeCoalAnthracite,
           HPXML::FuelTypeCoalBituminous,
           HPXML::FuelTypeCoke].include? hpxml_fuel
      return FuelTypeCoal
    else
      fail "Unexpected HPXML fuel '#{hpxml_fuel}'."
    end
  end

  def self.output_fuel_map(ep_fuel)
    # Name of fuel used in E+ outputs
    if ep_fuel == FuelTypeElectricity
      return 'Electric'
    elsif ep_fuel == FuelTypeNaturalGas
      return 'Gas'
    elsif ep_fuel == FuelTypeOil
      return 'FuelOil#2'
    else
      return ep_fuel
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
urbanopt-cli-0.4.1 example_files/resources/hpxml-measures/HPXMLtoOpenStudio/resources/energyplus.rb
urbanopt-cli-0.4.0 example_files/resources/hpxml-measures/HPXMLtoOpenStudio/resources/energyplus.rb