NPV calculation differs from Excel/Google Sheets #344
Replies: 2 comments 4 replies
-
@softwareengineerprogrammer, I set out to understand the convention that SAM GETEM uses. The SAM docs refer to: A Manual for the Economic Evaluation of Energy Efficiency and Renewable Energy Technologies, Short W et al, 1995, National Renewable Energy Laboratory, NREL/TP-462-5173, http://www.nrel.gov/docs/legosti/old/5173.pdf Page 41 of the manual shows an NPV example table, as shown in the following screenshot: ![]() Note that initial investment (at time zero) is NOT discounted. First years of cashflows (years 1+) are discounted at the end of period (Page 2 notes that they consider the annual cashflows to be lumped at the end of the period, not the middle). My hunch is that SAM follows the conventions noted in the manual. The challenge: SAM does not readily show annual present value numbers that sum to create the NPV. Next up, I will keep digging into a simple SAM to confirm their numbers/math. My recommendations at this point...
|
Beta Was this translation helpful? Give feedback.
-
@softwareengineerprogrammer before digging into the code, let me touch on the two concepts (pardon me if I'm a bit overboard on this).
See the following screenshot from Page 2 of the NREL manual referenced above: ![]() The manual author notes that they adopt the convention of assuming the cash flows are lumped at the end of each period (and a period is typically a year). I believe GEOPHIRES should adhere to the NREL convention, which I believe SAM uses also - which should be: lump cashflow at the end of the period. I still need to study SAM GETEM to confirm this behavior. From the GEOPHIRES user perspective, this should be clearly stated, a reasonable default should be used, and it may be reasonable to let the user adjust the default. A long variable name may be: whenInTheCashflowPeriodDoWeLumpTheCashflow :) Since naming is hard, I'll leave the picking of the name to smarter developers. But, I think I'm communicating the concept: Cashflows are assumed to be lumped at the end or middle of the period. ARIES (a ubiquitous oil & gas economic eval tool) uses middle of the period. The NREL manual says uses end of period. I recommend sticking to the NREL manual.
This is the numpy npv function issue. (it's different than the when-to-lump-the-cashflow-in-each-period noted immediately above). The numpy npv function accepts an array of cashflow values, and assumes the first value is the first period of future cashflow (call it period 1). (Correction by KTE, 3/7/2025: the numpy npv function assumes the first value is at time zero and NOT discounted. However, the Excel-style function assumes the first value is at time period 1 and IS discounted). However, as shown in Table 4-2 in the screenshot above, the NREL manual and common financial projection convention assumes that the initial investment is at time zero, and the initial investment is not discounted. I need to hop off for now, but will circle back tomorrow... |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
A user noticed that GEOPHIRES' calculated NPV value differs from calculating NPV from the project net revenue profile in Excel/Google Sheets. For example,
Fervo_Project_Cape-3
NPV calculated by GEOPHIRES is $4561.96M while Excel gives $4,115.21M.NPV calculation is performed in:
GEOPHIRES-X/src/geophires_x/Economics.py
Line 339 in 164f49a
numpy-financial npv documentation: https://numpy.org/numpy-financial/latest/npv.html
This comment explains the discrepancy and why the numpy-financial NPV calculation is more technically correct even though the Excel version has become a de-facto standard: numpy/numpy#10877 (comment)
Points of discussion:
Edit 2025-04-01: Relevant changes were merged in #364. Follow-up issue: #375
Beta Was this translation helpful? Give feedback.
All reactions