- Posts: 2
NPV Discrepancy in PV + Single Owner 'Send to Excel with Equations' Workbook
- Caide Spriestersbach
- Topic Author
Less
More
18 Nov 2025 03:09 #14381
by Caide Spriestersbach
NPV Discrepancy in PV + Single Owner 'Send to Excel with Equations' Workbook was created by Caide Spriestersbach
Describe the Issue
I've noticed a significant difference in the NPV (Net Present Value) as reported in SAM's simulation results compared to the cash flow workbook created with 'Send to Excel with equations'. Interestingly, the Levelized PPA Price (nominal) matches correctly between SAM and Excel, but NPV does not match at all. This issue appears to affect the Single Owner financial model specifically. Other financial metrics like LPPA are calculated correctly in Excel, suggesting that the issue is with missing or incorrectly mapped cashflow outputs needed for NPV calculations.
To Reproduce
Steps to reproduce the behavior:
Expected Behavior
I expect the NPV reported in the Excel workbook to match (or be very close to) the NPV shown in SAM's simulation results, similar to how the Levelized PPA Price matches correctly.
System Information
This issue affects:
I'm also working with PySAM (which shows perfect parity with and need to export results to Excel for internal review. I have read other forum posts and issues on GitHub and have read that the issue tends to be within the template not within SAM, so we know we can trust the outputs - we just desire the financial model to align so we can share it with our internal team and external shareholders. Any guidance on PySAM → Excel mapping would also be appreciated.
Please note the values in the screenshot in attachments are unrealistic due to this being a test project setup quickly but I have seen similar discrepancies across our other actual projects higher than 5%.
I've noticed a significant difference in the NPV (Net Present Value) as reported in SAM's simulation results compared to the cash flow workbook created with 'Send to Excel with equations'. Interestingly, the Levelized PPA Price (nominal) matches correctly between SAM and Excel, but NPV does not match at all. This issue appears to affect the Single Owner financial model specifically. Other financial metrics like LPPA are calculated correctly in Excel, suggesting that the issue is with missing or incorrectly mapped cashflow outputs needed for NPV calculations.
To Reproduce
Steps to reproduce the behavior:
- Create a 'Photovoltaic, Single Owner' model
- Configure the system and run simulation
- Note the NPV value on the Results/Metrics page in SAM
- Click on the 'Cash Flow' tab
- Select 'Send to Excel with equations'
- Note the NPV value calculated in the Excel workbook
- Compare the two NPV values - they do not match
Expected Behavior
I expect the NPV reported in the Excel workbook to match (or be very close to) the NPV shown in SAM's simulation results, similar to how the Levelized PPA Price matches correctly.
System Information
- Operating System Name: Microsoft Windows 11 Pro
- Version: 10.0.26100 Build 26100
- SAM Version: 2025.4.16
- Configuration: Photovoltaic + Single Owner
This issue affects:
- Users trying to validate SAM results with Excel models
- Anyone using Excel workbooks for detailed financial analysis or auditing
- Are there known workarounds for this NPV calculation issue?
- Which specific cashflow output variables need to be added to the Excel export for accurate NPV calculations?
- Is this issue on the development roadmap for a fix?
I'm also working with PySAM (which shows perfect parity with and need to export results to Excel for internal review. I have read other forum posts and issues on GitHub and have read that the issue tends to be within the template not within SAM, so we know we can trust the outputs - we just desire the financial model to align so we can share it with our internal team and external shareholders. Any guidance on PySAM → Excel mapping would also be appreciated.
Please note the values in the screenshot in attachments are unrealistic due to this being a test project setup quickly but I have seen similar discrepancies across our other actual projects higher than 5%.
Attachments:
Please Log in or Create an account to join the conversation.
- Paul Gilman
Less
More
- Posts: 5677
19 Nov 2025 18:17 - 19 Nov 2025 18:19 #14389
by Paul Gilman
Replied by Paul Gilman on topic NPV Discrepancy in PV + Single Owner 'Send to Excel with Equations' Workbook
Hi Caide,
The formulas in the Excel version of the cash flow only approximate SAM's financial model calculations. In some cases, the Excel calculations do not match SAM's calculations. Please attach a .sam file that demonstrates the discrepancy you observed if you would like me to help identify the cause of the difference that you are seeing. (I was not able to reproduce the discrepancy in my testing.)
As for replicating this feature in PySAM, here's the way it works in SAM: When you click Send to Excel with Equations in SAM, it opens a copy of the 'single_owner.xlsx' workbook, and sends values of a selection of input and output variables to cells in the workbook. Excel then calculates values in other cells in the workbook using workbook formulas. The workbooks are in the '/runtime/spreadsheets' folder of your SAM installation. These are also available in GitHub here: github.com/NREL/SAM/tree/develop/deploy/runtime/spreadsheets .
The code that exports variables to Excel is on GitHub here: github.com/NREL/SAM/blob/develop/deploy/runtime/cashflow.lk . It is written in SAM's built-in LK scripting language, which is described here: sam.nrel.gov/lk-script.html . The function that exports variables for the Single Owner financial model is defined here: github.com/NREL/SAM/blob/dc1e25e4f229203d6cdb7656417f2c9c0a4c65d3/deploy/runtime/cashflow.lk#L2021 .
To implement this in Python, you would need to replicate the relevant pieces of code in that LK script to read the variable values, and then export them to the Excel workbook:
1. Create and run a PV / Single Owner model.
2. Get values of the input and output variables required by the 'single_owner.xlsx' workbook.
3. Open the workbook and copy those values to the appropriate cells in the workbook.
Best regards,
Paul.
The formulas in the Excel version of the cash flow only approximate SAM's financial model calculations. In some cases, the Excel calculations do not match SAM's calculations. Please attach a .sam file that demonstrates the discrepancy you observed if you would like me to help identify the cause of the difference that you are seeing. (I was not able to reproduce the discrepancy in my testing.)
As for replicating this feature in PySAM, here's the way it works in SAM: When you click Send to Excel with Equations in SAM, it opens a copy of the 'single_owner.xlsx' workbook, and sends values of a selection of input and output variables to cells in the workbook. Excel then calculates values in other cells in the workbook using workbook formulas. The workbooks are in the '/runtime/spreadsheets' folder of your SAM installation. These are also available in GitHub here: github.com/NREL/SAM/tree/develop/deploy/runtime/spreadsheets .
The code that exports variables to Excel is on GitHub here: github.com/NREL/SAM/blob/develop/deploy/runtime/cashflow.lk . It is written in SAM's built-in LK scripting language, which is described here: sam.nrel.gov/lk-script.html . The function that exports variables for the Single Owner financial model is defined here: github.com/NREL/SAM/blob/dc1e25e4f229203d6cdb7656417f2c9c0a4c65d3/deploy/runtime/cashflow.lk#L2021 .
To implement this in Python, you would need to replicate the relevant pieces of code in that LK script to read the variable values, and then export them to the Excel workbook:
1. Create and run a PV / Single Owner model.
2. Get values of the input and output variables required by the 'single_owner.xlsx' workbook.
3. Open the workbook and copy those values to the appropriate cells in the workbook.
Best regards,
Paul.
Last edit: 19 Nov 2025 18:19 by Paul Gilman.
Please Log in or Create an account to join the conversation.
Moderators: Paul Gilman




