Class DCFCalculator
java.lang.Object
neqsim.process.util.fielddevelopment.DCFCalculator
- All Implemented Interfaces:
Serializable
Discounted Cash Flow (DCF) calculator for field development economics.
Calculates NPV, IRR, payback period, and generates cash flow profiles for oil and gas field development projects. Supports CAPEX scheduling, production-linked revenue, OPEX, royalties, and tax with loss carry-forward.
Usage example:
DCFCalculator dcf = new DCFCalculator();
dcf.setDiscountRate(0.08);
dcf.setProjectLifeYears(20);
dcf.setTaxRate(0.22);
dcf.setRoyaltyRate(0.0);
dcf.addCapex(0, 500e6); // Year 0 investment
dcf.addCapex(1, 300e6); // Year 1 investment
dcf.setAnnualProduction(new double[]{0, 0, 10e6, 15e6, 15e6, 12e6, ...}); // Sm3/yr
dcf.setProductPrice(1.5); // NOK/Sm3
dcf.setAnnualOpex(50e6); // NOK/yr
dcf.calculate();
double npv = dcf.getNPV();
double irr = dcf.getIRR();
int payback = dcf.getPaybackYear();
- Version:
- 1.0
- Author:
- ESOL
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate double[]private doubleprivate double[]private booleanprivate double[]private double[]private doubleprivate double[]private doubleprivate doubleprivate doubleprivate doubleprivate double[]private intprivate doubleprivate doubleprivate intprivate doubleprivate static final longprivate double -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCapex(int year, double amount) Adds CAPEX investment for a specific year.voidRuns the DCF calculation.private doubleCalculates Internal Rate of Return using bisection method.private doublecalculateNPVAtRate(double rate) Calculates NPV at a specific discount rate.double[]Gets the annual cash flow array.double[]Gets the cumulative cash flow array.double[]Gets the discounted cash flow array.doubleGets the discount rate.doublegetIRR()Gets the Internal Rate of Return.doublegetNPV()Gets the Net Present Value.intGets the payback year (first year cumulative cash flow becomes positive).doubleGets the profitability index (benefit-cost ratio).voidsetAnnualOpex(double opex) Sets a constant annual OPEX (used if opexByYear is not specified).voidsetAnnualProduction(double[] production) Sets the annual production profile.voidsetCapexByYear(double[] capex) Sets the complete CAPEX schedule by year.voidsetDepreciationYears(double years) Sets the depreciation period in years (straight-line).voidsetDiscountRate(double rate) Sets the discount rate for NPV calculation.voidsetInflationRate(double rate) Sets the annual inflation rate for OPEX escalation.voidsetOpexByYear(double[] opex) Sets variable OPEX by year.voidsetProductPrice(double price) Sets the product price per unit volume.voidsetProjectLifeYears(int years) Sets the project life in years.voidsetRoyaltyRate(double rate) Sets the royalty rate.voidsetTaxRate(double rate) Sets the corporate tax rate.toJson()Returns the results as a JSON string.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
discountRate
private double discountRate -
projectLifeYears
private int projectLifeYears -
taxRate
private double taxRate -
royaltyRate
private double royaltyRate -
deprecationYears
private double deprecationYears -
inflationRate
private double inflationRate -
capexByYear
private double[] capexByYear -
annualProduction
private double[] annualProduction -
productPrice
private double productPrice -
annualOpex
private double annualOpex -
opexByYear
private double[] opexByYear -
npv
private double npv -
irr
private double irr -
paybackYear
private int paybackYear -
profitabilityIndex
private double profitabilityIndex -
annualCashFlow
private double[] annualCashFlow -
cumulativeCashFlow
private double[] cumulativeCashFlow -
discountedCashFlow
private double[] discountedCashFlow -
calculated
private boolean calculated
-
-
Constructor Details
-
DCFCalculator
public DCFCalculator()Creates a new DCF calculator with default parameters.
-
-
Method Details
-
setDiscountRate
public void setDiscountRate(double rate) Sets the discount rate for NPV calculation.- Parameters:
rate- discount rate as fraction (e.g. 0.10 for 10%)
-
getDiscountRate
public double getDiscountRate()Gets the discount rate.- Returns:
- discount rate as fraction
-
setProjectLifeYears
public void setProjectLifeYears(int years) Sets the project life in years.- Parameters:
years- number of years
-
setTaxRate
public void setTaxRate(double rate) Sets the corporate tax rate.- Parameters:
rate- tax rate as fraction (e.g. 0.22 for 22%)
-
setRoyaltyRate
public void setRoyaltyRate(double rate) Sets the royalty rate.- Parameters:
rate- royalty rate as fraction (e.g. 0.12 for 12%)
-
setDepreciationYears
public void setDepreciationYears(double years) Sets the depreciation period in years (straight-line).- Parameters:
years- depreciation period
-
setInflationRate
public void setInflationRate(double rate) Sets the annual inflation rate for OPEX escalation.- Parameters:
rate- inflation rate as fraction (e.g. 0.02 for 2%)
-
addCapex
public void addCapex(int year, double amount) Adds CAPEX investment for a specific year.- Parameters:
year- the year (0-based)amount- CAPEX amount in currency units
-
setCapexByYear
public void setCapexByYear(double[] capex) Sets the complete CAPEX schedule by year.- Parameters:
capex- array of CAPEX by year
-
setAnnualProduction
public void setAnnualProduction(double[] production) Sets the annual production profile.- Parameters:
production- array of annual production volumes (same unit as price)
-
setProductPrice
public void setProductPrice(double price) Sets the product price per unit volume.- Parameters:
price- price per unit of production
-
setAnnualOpex
public void setAnnualOpex(double opex) Sets a constant annual OPEX (used if opexByYear is not specified).- Parameters:
opex- annual operating expenditure
-
setOpexByYear
public void setOpexByYear(double[] opex) Sets variable OPEX by year.- Parameters:
opex- array of OPEX by year
-
calculate
public void calculate()Runs the DCF calculation. -
calculateIRR
private double calculateIRR()Calculates Internal Rate of Return using bisection method.- Returns:
- IRR as fraction, or NaN if no solution found
-
calculateNPVAtRate
private double calculateNPVAtRate(double rate) Calculates NPV at a specific discount rate.- Parameters:
rate- discount rate- Returns:
- NPV at the given rate
-
getNPV
public double getNPV()Gets the Net Present Value.- Returns:
- NPV in currency units
-
getIRR
public double getIRR()Gets the Internal Rate of Return.- Returns:
- IRR as fraction
-
getPaybackYear
public int getPaybackYear()Gets the payback year (first year cumulative cash flow becomes positive).- Returns:
- payback year (0-based), or -1 if project never pays back
-
getProfitabilityIndex
public double getProfitabilityIndex()Gets the profitability index (benefit-cost ratio).- Returns:
- profitability index
-
getAnnualCashFlow
public double[] getAnnualCashFlow()Gets the annual cash flow array.- Returns:
- array of after-tax cash flows by year
-
getCumulativeCashFlow
public double[] getCumulativeCashFlow()Gets the cumulative cash flow array.- Returns:
- array of cumulative cash flows by year
-
getDiscountedCashFlow
public double[] getDiscountedCashFlow()Gets the discounted cash flow array.- Returns:
- array of discounted cash flows by year
-
toJson
Returns the results as a JSON string.- Returns:
- JSON representation of DCF analysis results
-