Class CashFlowEngine
java.lang.Object
neqsim.process.fielddevelopment.economics.CashFlowEngine
- All Implemented Interfaces:
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
TaxModelinterface - 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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classRepresents cash flow for a single year.static final classComplete result of cash flow calculation. -
Field Summary
FieldsModifier and TypeFieldDescriptionCAPEX by year (year to amount in MUSD).private static final doubleDays per year for conversions.static final doubleDefault discount rate (8%).static final doubleDefault OPEX as percentage of CAPEX (4%).private intFirst year of project (for analysis purposes).private doubleFixed OPEX per year (MUSD).private doubleGas price in USD per Sm3.Annual gas production by year (year to Sm3).private doubleGas transport tariff in USD per Sm3.private intLast year of project.private doubleNGL price in USD per barrel.Annual NGL production by year (year to barrels).private doubleOil price in USD per barrel.Annual oil production by year (year to barrels).private doubleOil transport tariff in USD per barrel.private doubleOPEX as percentage of total CAPEX per year.private static final longprivate TaxModelTax model for calculating country-specific taxes.private doubleTotal CAPEX for depreciation calculation.private doubleVariable OPEX per barrel of oil equivalent (USD/boe). -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new cash flow engine with default Norwegian tax model.CashFlowEngine(String countryCode) Creates a new cash flow engine with specified country code.CashFlowEngine(NorwegianTaxModel taxModel) Deprecated.CashFlowEngine(TaxModel taxModel) Creates a new cash flow engine with specified tax model. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAnnualProduction(int year, double oilBbl, double gasSm3, double nglBbl) Adds annual production for a specific year.voidaddCapex(double capexMusd, int year) Adds CAPEX for a specific year.calculate(double discountRate) Calculates cash flow for the project.doublecalculateBreakevenGasPrice(double discountRate) Calculates breakeven gas price for zero NPV.doublecalculateBreakevenOilPrice(double discountRate) Calculates breakeven oil price for zero NPV.private doublecalculateDepreciation(int year) private doublecalculateIRR(List<CashFlowEngine.AnnualCashFlow> cashFlows) doublecalculateNPV(double discountRate) Calculates NPV at specified discount rate.private doublecalculateUplift(int year) Gets the country code of the current tax model.Gets the country name of the current tax model.private doublegetOrDefault(Map<Integer, Double> map, Integer key, double defaultValue) Gets the tax model.doubleGets total CAPEX.voidsetCapex(double capexMusd, int year) Sets total CAPEX for a single year.voidsetCapexSchedule(Map<Integer, Double> capexSchedule) Sets CAPEX schedule from a map.voidsetFixedOpexPerYear(double fixedOpexMusd) Sets fixed OPEX per year.voidsetGasPrice(double priceUsdPerSm3) Sets gas price.voidsetGasTariff(double tariffUsdPerSm3) Sets gas transport tariff.voidsetNglPrice(double priceUsdPerBbl) Sets NGL price.voidsetOilPrice(double priceUsdPerBbl) Sets oil price.voidsetOilTariff(double tariffUsdPerBbl) Sets oil transport tariff.voidsetOpexPercentOfCapex(double percentage) Sets OPEX as percentage of total CAPEX per year.voidsetProductionProfile(Map<Integer, Double> oilByYear, Map<Integer, Double> gasByYear, Map<Integer, Double> nglByYear) Sets complete production profile from maps.voidsetTaxModel(String countryCode) Sets the tax model using a country code from the registry.voidsetTaxModel(TaxModel taxModel) Sets the tax model.voidsetVariableOpexPerBoe(double opexPerBoe) Sets variable OPEX per barrel of oil equivalent.private void
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
DEFAULT_DISCOUNT_RATE
public static final double DEFAULT_DISCOUNT_RATEDefault discount rate (8%).- See Also:
-
DEFAULT_OPEX_PERCENT
public static final double DEFAULT_OPEX_PERCENTDefault OPEX as percentage of CAPEX (4%).- See Also:
-
DAYS_PER_YEAR
private static final double DAYS_PER_YEARDays per year for conversions.- See Also:
-
taxModel
Tax model for calculating country-specific taxes. -
oilPriceUsdPerBbl
private double oilPriceUsdPerBblOil price in USD per barrel. -
gasPriceUsdPerSm3
private double gasPriceUsdPerSm3Gas price in USD per Sm3. -
nglPriceUsdPerBbl
private double nglPriceUsdPerBblNGL price in USD per barrel. -
gasTariffUsdPerSm3
private double gasTariffUsdPerSm3Gas transport tariff in USD per Sm3. -
oilTariffUsdPerBbl
private double oilTariffUsdPerBblOil transport tariff in USD per barrel. -
capexByYear
-
totalCapex
private double totalCapexTotal CAPEX for depreciation calculation. -
opexPercentOfCapex
private double opexPercentOfCapexOPEX as percentage of total CAPEX per year. -
fixedOpexPerYear
private double fixedOpexPerYearFixed OPEX per year (MUSD). -
variableOpexPerBoe
private double variableOpexPerBoeVariable OPEX per barrel of oil equivalent (USD/boe). -
oilProductionByYear
-
gasProductionByYear
-
nglProductionByYear
-
firstYear
private int firstYearFirst year of project (for analysis purposes). -
lastYear
private int lastYearLast year of project.
-
-
Constructor Details
-
CashFlowEngine
public CashFlowEngine()Creates a new cash flow engine with default Norwegian tax model. -
CashFlowEngine
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
Creates a new cash flow engine with specified tax model.- Parameters:
taxModel- tax model to use for calculations
-
CashFlowEngine
Deprecated.UseCashFlowEngine(TaxModel)orCashFlowEngine(String)insteadCreates 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 USDyear- year of expenditure
-
addCapex
public void addCapex(double capexMusd, int year) Adds CAPEX for a specific year.- Parameters:
capexMusd- CAPEX in million USDyear- year of expenditure
-
setCapexSchedule
-
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 yearoilBbl- annual oil production in barrelsgasSm3- annual gas production in Sm3nglBbl- 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 barrelsgasByYear- map of year to gas production in Sm3nglByYear- map of year to NGL production in barrels (can be null)
-
calculate
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
-
calculateDepreciation
private double calculateDepreciation(int year) -
calculateUplift
private double calculateUplift(int year) -
calculateIRR
-
getTaxModel
-
setTaxModel
Sets the tax model.- Parameters:
taxModel- tax model to use
-
setTaxModel
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
Gets the country code of the current tax model.- Returns:
- country code
-
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
-
CashFlowEngine(TaxModel)orCashFlowEngine(String)instead