Class CashFlowEngine

java.lang.Object
neqsim.process.fielddevelopment.economics.CashFlowEngine
All Implemented Interfaces:
Serializable

public class CashFlowEngine extends Object implements Serializable
Full-lifecycle cash flow engine for field development economics.

This class generates year-by-year cash flow projections for oil and gas field developments, incorporating:

  • Revenue: From oil, gas, and NGL sales
  • CAPEX: Capital expenditures with depreciation schedules
  • OPEX: Operating expenditures (fixed and variable)
  • Taxes: Country-specific tax models via TaxModel interface
  • Tariffs: Transport and processing tariffs

Key Metrics

The engine calculates standard project economics:

  • NPV: Net Present Value at specified discount rate
  • IRR: Internal Rate of Return
  • Payback: Time to recover initial investment
  • Breakeven: Oil/gas price for zero NPV

Tax Model Support

The engine supports any country's fiscal regime via the TaxModel interface:

// Use Norwegian tax model (default)
CashFlowEngine engine = new CashFlowEngine();

// Use any country from the registry
engine.setTaxModel(TaxModelRegistry.createModel("BR-PSA")); // Brazil Pre-Salt
engine.setTaxModel(TaxModelRegistry.createModel("UK")); // UK Continental Shelf
engine.setTaxModel(TaxModelRegistry.createModel("US-GOM")); // Gulf of Mexico

Example Usage

// Create engine with Brazilian tax model
CashFlowEngine engine = new CashFlowEngine("BR");

// Set project parameters
engine.setCapex(800, 2025); // 800 MUSD in 2025
engine.setOpexPercentOfCapex(0.04); // 4% of CAPEX per year

// Set price assumptions
engine.setOilPrice(75.0); // USD/bbl
engine.setGasPrice(0.25); // USD/Sm3

// Add production profile
engine.addAnnualProduction(2026, 0, 5.0e6, 0); // 5 MSm3 gas in 2026
engine.addAnnualProduction(2027, 0, 10.0e6, 0); // 10 MSm3 gas in 2027
// ... more years

// Calculate cash flow
CashFlowResult result = engine.calculate(0.08); // 8% discount rate

// Results
System.out.println("NPV: " + result.getNpv() + " MUSD");
System.out.println("IRR: " + result.getIrr() * 100 + "%");
System.out.println("Payback: " + result.getPaybackYears() + " years");
Version:
1.1
Author:
ESOL
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • DEFAULT_DISCOUNT_RATE

      public static final double DEFAULT_DISCOUNT_RATE
      Default discount rate (8%).
      See Also:
    • DEFAULT_OPEX_PERCENT

      public static final double DEFAULT_OPEX_PERCENT
      Default OPEX as percentage of CAPEX (4%).
      See Also:
    • DAYS_PER_YEAR

      private static final double DAYS_PER_YEAR
      Days per year for conversions.
      See Also:
    • taxModel

      private TaxModel taxModel
      Tax model for calculating country-specific taxes.
    • oilPriceUsdPerBbl

      private double oilPriceUsdPerBbl
      Oil price in USD per barrel.
    • gasPriceUsdPerSm3

      private double gasPriceUsdPerSm3
      Gas price in USD per Sm3.
    • nglPriceUsdPerBbl

      private double nglPriceUsdPerBbl
      NGL price in USD per barrel.
    • gasTariffUsdPerSm3

      private double gasTariffUsdPerSm3
      Gas transport tariff in USD per Sm3.
    • oilTariffUsdPerBbl

      private double oilTariffUsdPerBbl
      Oil transport tariff in USD per barrel.
    • capexByYear

      private Map<Integer,Double> capexByYear
      CAPEX by year (year to amount in MUSD).
    • totalCapex

      private double totalCapex
      Total CAPEX for depreciation calculation.
    • opexPercentOfCapex

      private double opexPercentOfCapex
      OPEX as percentage of total CAPEX per year.
    • fixedOpexPerYear

      private double fixedOpexPerYear
      Fixed OPEX per year (MUSD).
    • variableOpexPerBoe

      private double variableOpexPerBoe
      Variable OPEX per barrel of oil equivalent (USD/boe).
    • oilProductionByYear

      private Map<Integer,Double> oilProductionByYear
      Annual oil production by year (year to barrels).
    • gasProductionByYear

      private Map<Integer,Double> gasProductionByYear
      Annual gas production by year (year to Sm3).
    • nglProductionByYear

      private Map<Integer,Double> nglProductionByYear
      Annual NGL production by year (year to barrels).
    • firstYear

      private int firstYear
      First year of project (for analysis purposes).
    • lastYear

      private int lastYear
      Last year of project.
  • Constructor Details

    • CashFlowEngine

      public CashFlowEngine()
      Creates a new cash flow engine with default Norwegian tax model.
    • CashFlowEngine

      public CashFlowEngine(String countryCode)
      Creates a new cash flow engine with specified country code.
      Parameters:
      countryCode - country code (e.g., "NO", "UK", "BR", "US-GOM")
      Throws:
      IllegalArgumentException - if country code is not registered
    • CashFlowEngine

      public CashFlowEngine(TaxModel taxModel)
      Creates a new cash flow engine with specified tax model.
      Parameters:
      taxModel - tax model to use for calculations
    • CashFlowEngine

      @Deprecated public CashFlowEngine(NorwegianTaxModel taxModel)
      Creates a new cash flow engine with legacy Norwegian tax model.
      Parameters:
      taxModel - Norwegian tax model to use for calculations
  • Method Details

    • setCapex

      public void setCapex(double capexMusd, int year)
      Sets total CAPEX for a single year.
      Parameters:
      capexMusd - CAPEX in million USD
      year - year of expenditure
    • addCapex

      public void addCapex(double capexMusd, int year)
      Adds CAPEX for a specific year.
      Parameters:
      capexMusd - CAPEX in million USD
      year - year of expenditure
    • setCapexSchedule

      public void setCapexSchedule(Map<Integer,Double> capexSchedule)
      Sets CAPEX schedule from a map.
      Parameters:
      capexSchedule - map of year to CAPEX in MUSD
    • setOpexPercentOfCapex

      public void setOpexPercentOfCapex(double percentage)
      Sets OPEX as percentage of total CAPEX per year.
      Parameters:
      percentage - OPEX percentage (e.g., 0.04 for 4%)
    • setFixedOpexPerYear

      public void setFixedOpexPerYear(double fixedOpexMusd)
      Sets fixed OPEX per year.
      Parameters:
      fixedOpexMusd - fixed OPEX in million USD per year
    • setVariableOpexPerBoe

      public void setVariableOpexPerBoe(double opexPerBoe)
      Sets variable OPEX per barrel of oil equivalent.
      Parameters:
      opexPerBoe - variable OPEX in USD per BOE
    • setOilPrice

      public void setOilPrice(double priceUsdPerBbl)
      Sets oil price.
      Parameters:
      priceUsdPerBbl - oil price in USD per barrel
    • setGasPrice

      public void setGasPrice(double priceUsdPerSm3)
      Sets gas price.
      Parameters:
      priceUsdPerSm3 - gas price in USD per Sm3
    • setNglPrice

      public void setNglPrice(double priceUsdPerBbl)
      Sets NGL price.
      Parameters:
      priceUsdPerBbl - NGL price in USD per barrel
    • setGasTariff

      public void setGasTariff(double tariffUsdPerSm3)
      Sets gas transport tariff.
      Parameters:
      tariffUsdPerSm3 - tariff in USD per Sm3
    • setOilTariff

      public void setOilTariff(double tariffUsdPerBbl)
      Sets oil transport tariff.
      Parameters:
      tariffUsdPerBbl - tariff in USD per barrel
    • addAnnualProduction

      public void addAnnualProduction(int year, double oilBbl, double gasSm3, double nglBbl)
      Adds annual production for a specific year.
      Parameters:
      year - production year
      oilBbl - annual oil production in barrels
      gasSm3 - annual gas production in Sm3
      nglBbl - annual NGL production in barrels
    • setProductionProfile

      public void setProductionProfile(Map<Integer,Double> oilByYear, Map<Integer,Double> gasByYear, Map<Integer,Double> nglByYear)
      Sets complete production profile from maps.
      Parameters:
      oilByYear - map of year to oil production in barrels
      gasByYear - map of year to gas production in Sm3
      nglByYear - map of year to NGL production in barrels (can be null)
    • calculate

      public CashFlowEngine.CashFlowResult calculate(double discountRate)
      Calculates cash flow for the project.
      Parameters:
      discountRate - discount rate for NPV calculation (e.g., 0.08 for 8%)
      Returns:
      cash flow result with all metrics
    • calculateNPV

      public double calculateNPV(double discountRate)
      Calculates NPV at specified discount rate.
      Parameters:
      discountRate - discount rate (e.g., 0.08 for 8%)
      Returns:
      NPV in MUSD
    • calculateBreakevenOilPrice

      public double calculateBreakevenOilPrice(double discountRate)
      Calculates breakeven oil price for zero NPV.
      Parameters:
      discountRate - discount rate for NPV calculation
      Returns:
      breakeven oil price in USD/bbl
    • calculateBreakevenGasPrice

      public double calculateBreakevenGasPrice(double discountRate)
      Calculates breakeven gas price for zero NPV.
      Parameters:
      discountRate - discount rate for NPV calculation
      Returns:
      breakeven gas price in USD/Sm3
    • updateProjectYears

      private void updateProjectYears()
    • getOrDefault

      private double getOrDefault(Map<Integer,Double> map, Integer key, double defaultValue)
    • calculateDepreciation

      private double calculateDepreciation(int year)
    • calculateUplift

      private double calculateUplift(int year)
    • calculateIRR

      private double calculateIRR(List<CashFlowEngine.AnnualCashFlow> cashFlows)
    • getTaxModel

      public TaxModel getTaxModel()
      Gets the tax model.
      Returns:
      tax model
    • setTaxModel

      public void setTaxModel(TaxModel taxModel)
      Sets the tax model.
      Parameters:
      taxModel - tax model to use
    • setTaxModel

      public void setTaxModel(String countryCode)
      Sets the tax model using a country code from the registry.
      Parameters:
      countryCode - country code (e.g., "NO", "UK", "BR", "US-GOM")
      Throws:
      IllegalArgumentException - if country code is not registered
    • getCountryCode

      public String getCountryCode()
      Gets the country code of the current tax model.
      Returns:
      country code
    • getCountryName

      public String getCountryName()
      Gets the country name of the current tax model.
      Returns:
      country name
    • getTotalCapex

      public double getTotalCapex()
      Gets total CAPEX.
      Returns:
      total CAPEX in MUSD