- Posts: 24
Annual Energy Output for all years in VBA Code
- msohebzaidi
- Topic Author
Less
More
17 Dec 2021 00:37 #10411
by msohebzaidi
Annual Energy Output for all years in VBA Code was created by msohebzaidi
Hello SAM Team,
I have generated code from SAM file into a VBA code. When I run the VBA code in Excel, the output of only year 1 is shown. How can I output the annual energy for other years i.e. from 1 to 25 (Lifetime of the simulation)?
Thanks in advance!
Regards.
Soheb
I have generated code from SAM file into a VBA code. When I run the VBA code in Excel, the output of only year 1 is shown. How can I output the annual energy for other years i.e. from 1 to 25 (Lifetime of the simulation)?
Thanks in advance!
Regards.
Soheb
Please Log in or Create an account to join the conversation.
- pgilman
Less
More
- Posts: 5447
17 Dec 2021 17:31 #10412
by pgilman
Replied by pgilman on topic Annual Energy Output for all years in VBA Code
Hi Soheb,
Only the Detailed PV and battery storage models run a performance simulation over the analysis period. The other models, including CSP run a simulation over one year and then apply a degradation rate to calculate output in Years 2 and later.
You can tell which models run a simulation over the analysis period ("lifetime simulation") by running a simulation in SAM and seeing if the Data Tables tab on the Results page has a section labeled "Lifetime Hourly Data" (or Lifetime xx-minute Data for subhourly simulations).
Best regards,
Paul.
Only the Detailed PV and battery storage models run a performance simulation over the analysis period. The other models, including CSP run a simulation over one year and then apply a degradation rate to calculate output in Years 2 and later.
You can tell which models run a simulation over the analysis period ("lifetime simulation") by running a simulation in SAM and seeing if the Data Tables tab on the Results page has a section labeled "Lifetime Hourly Data" (or Lifetime xx-minute Data for subhourly simulations).
Best regards,
Paul.
Please Log in or Create an account to join the conversation.
- msohebzaidi
- Topic Author
Less
More
- Posts: 24
19 Dec 2021 21:52 #10417
by msohebzaidi
Replied by msohebzaidi on topic Annual Energy Output for all years in VBA Code
Thanks Paul that makes sense, but since I am using a Detailed PV-Battery -merchant plant model I am able to see all results over the life time of the project in SAM. However, when I run the VBA code in excel it only extracts the results for year 1 only. Is there a way I can get results for all years in Excel-VBA (This is the summary results that show up same as on the results page of SAM)? I would like to extract the annual energy, performance ratio, Energy yield, capacity factor and roundtrip efficiency of battery.
Similarly is there a way to export the detailed cash flows from the VBA code, just as we see it in SAM (Cash flow result tab).
Thanks in Advance Paul!
Regards.
Similarly is there a way to export the detailed cash flows from the VBA code, just as we see it in SAM (Cash flow result tab).
Thanks in Advance Paul!
Regards.
Please Log in or Create an account to join the conversation.
- pgilman
Less
More
- Posts: 5447
20 Dec 2021 17:51 #10421
by pgilman
Replied by pgilman on topic Annual Energy Output for all years in VBA Code
Hi Soheb,
When you run the Merchant Plant financial model with a performance model that runs a simulation over a single year, you can calculate the output in Years 2 and later by applying the degradation rate to the Year 1 data.
The cash flow tab on the SAM results page displays rows of cash flow items. Each row is an SSC output variable. Most of them are preceded by "cf_" to make it easier to identify them. There is not a single function that displays the entire cash flow.
The code that displays the cashflow in SAM is written in SAM's LK scripting language. You can find it here on GitHub to use as a reference:
github.com/NREL/SAM/blob/develop/deploy/runtime/cashflow.lk
Best regards,
Paul.
When you run the Merchant Plant financial model with a performance model that runs a simulation over a single year, you can calculate the output in Years 2 and later by applying the degradation rate to the Year 1 data.
The cash flow tab on the SAM results page displays rows of cash flow items. Each row is an SSC output variable. Most of them are preceded by "cf_" to make it easier to identify them. There is not a single function that displays the entire cash flow.
The code that displays the cashflow in SAM is written in SAM's LK scripting language. You can find it here on GitHub to use as a reference:
github.com/NREL/SAM/blob/develop/deploy/runtime/cashflow.lk
Best regards,
Paul.
Please Log in or Create an account to join the conversation.
- msohebzaidi
- Topic Author
Less
More
- Posts: 24
20 Dec 2021 21:52 #10423
by msohebzaidi
Replied by msohebzaidi on topic Annual Energy Output for all years in VBA Code
Thanks Paul, that makes sense.
For the cash flows in particular, since I'm dealing in VBA, what will be the best way to incorporate LK script as .bas file ? probably another VBA module which calls in these variables?
Also, when I generate the code in VBA from SAM, the "cf_" variables from Merchant plant model are not exported into the code. Had it been the case It would have solved my problem.
Thanks for your help again! Waiting for your response.
Regards
For the cash flows in particular, since I'm dealing in VBA, what will be the best way to incorporate LK script as .bas file ? probably another VBA module which calls in these variables?
Also, when I generate the code in VBA from SAM, the "cf_" variables from Merchant plant model are not exported into the code. Had it been the case It would have solved my problem.
Thanks for your help again! Waiting for your response.
Regards
Please Log in or Create an account to join the conversation.
- msohebzaidi
- Topic Author
Less
More
- Posts: 24
20 Dec 2021 21:55 #10424
by msohebzaidi
Replied by msohebzaidi on topic Annual Energy Output for all years in VBA Code
In addition to my previous reply, we can export annual energy for (year 1), but how do I find out energy from system_to_grid or system_to_batt or batt_to_grid?
How do I extract these values from the VBA code, given that these are all computed within the SSC model for merchant plant somewhere.
Regards.
How do I extract these values from the VBA code, given that these are all computed within the SSC model for merchant plant somewhere.
Regards.
Please Log in or Create an account to join the conversation.
Moderators: pgilman