- Posts: 3
Net Metering
- kbertcher
- Topic Author
Less
More
25 May 2022 12:18 #10996
by kbertcher
Net Metering was created by kbertcher
Hello,
I am currently using the Battery module from pySAM to model battery dispatch.
I have batt_dispatch_choice set to 4 for price signal dispatch and ur_metering_option set to 4 for buy all/sell all. In the SAM application, when I change the sell price the resulting dispatch changes, but in my pySAM setup when I change the sell price nothing happens. Any ideas on what could be going on would be greatly appreciated - thank you! Also, please let me know if there is more information on my end that I can provide to help identify the problem.
I am currently using the Battery module from pySAM to model battery dispatch.
I have batt_dispatch_choice set to 4 for price signal dispatch and ur_metering_option set to 4 for buy all/sell all. In the SAM application, when I change the sell price the resulting dispatch changes, but in my pySAM setup when I change the sell price nothing happens. Any ideas on what could be going on would be greatly appreciated - thank you! Also, please let me know if there is more information on my end that I can provide to help identify the problem.
Please Log in or Create an account to join the conversation.
- pgilman
Less
More
- Posts: 5447
25 May 2022 18:47 #10997
by pgilman
Replied by pgilman on topic Net Metering
Hi Katie,
Could you attach a copy of the .sam file and Python script you are using for this comparison?
Best regards,
Paul.
Could you attach a copy of the .sam file and Python script you are using for this comparison?
Best regards,
Paul.
Please Log in or Create an account to join the conversation.
- kbertcher
- Topic Author
Less
More
- Posts: 3
31 May 2022 12:15 #11024
by kbertcher
Replied by kbertcher on topic Net Metering
Hi Paul,
Thank you for your patience. I have uploaded SAM_tester which is the SAM file. When I change the Sell Rates in the Electricity Rates tab, the output changes as expected. The PYSAM_TOU file is the PYSAM file. When I change the Sell Rates via the net metering function on line 58, the output does not change. Please let me know if you have any trouble with the PYSAM_TOU file - it should run self-contained but used to be a notebook file so the formatting may be off. Thank you again and please let me know if there is any more information I can provide!
Best,
Katie
Thank you for your patience. I have uploaded SAM_tester which is the SAM file. When I change the Sell Rates in the Electricity Rates tab, the output changes as expected. The PYSAM_TOU file is the PYSAM file. When I change the Sell Rates via the net metering function on line 58, the output does not change. Please let me know if you have any trouble with the PYSAM_TOU file - it should run self-contained but used to be a notebook file so the formatting may be off. Thank you again and please let me know if there is any more information I can provide!
Best,
Katie
Attachments:
Please Log in or Create an account to join the conversation.
- pgilman
Less
More
- Posts: 5447
01 Jun 2022 16:46 - 01 Jun 2022 16:47 #11031
by pgilman
Replied by pgilman on topic Net Metering
Hi Katie,
Thank you for sending those files. The most common cause of differences between PySAM and SAM results is a difference in one or more inputs. The following are potential causes of differences in the files you shared:
1. Make sure you are using versions of SAM and PySAM that are based on the same version of SSC.
The .sam file was created and saved in SAM 2020.11.29, which is based on SSC version 256. The current Version of SAM is SAM 2021.20.02 Revision 1, which is based on SSC Version 268. You can find the version number of SSC for your version of SAM by clicking the Help button and then clicking About at the top of the Help window.
The current version of PySAM is 3.0.1, and it runs SSC Version 268. You can use the following script to check the PySAM and SSC versions:
2. Make sure you are using the same configuration in SAM and PySAM.
The SAM file you shared uses the Generic-Battery / Residential configuration. You can see that in the top left corner of the SAM window:
In Python, it looks like you are using the Standalone Battery / Residential configuration:
3. Make sure the inputs you are using in SAM are consistent with those in Python.
This can be tricky to ensure. The best way to be sure you are comparing consistent inputs is to set up your analysis in SAM, and then export the SAM inputs to JSON files and import those into your Python script. Export to JSON using a process similar to the one demonstrated in this video, except use PySAM JSON code generator option:
Then use the method described in the PySAM documentation to import the data from JSON: nrel-pysam.readthedocs.io/en/master/Import.html
When you are sure the inputs are consistent, you still may see small differences in output values due to differences in numerical precision in the underlying code, but the results should be pretty close to identical.
Let me know if you need more help identifying the cause of differences between specific outputs in SAM and PySAM.
Best regards,
Paul.
Thank you for sending those files. The most common cause of differences between PySAM and SAM results is a difference in one or more inputs. The following are potential causes of differences in the files you shared:
1. Make sure you are using versions of SAM and PySAM that are based on the same version of SSC.
The .sam file was created and saved in SAM 2020.11.29, which is based on SSC version 256. The current Version of SAM is SAM 2021.20.02 Revision 1, which is based on SSC Version 268. You can find the version number of SSC for your version of SAM by clicking the Help button and then clicking About at the top of the Help window.
The current version of PySAM is 3.0.1, and it runs SSC Version 268. You can use the following script to check the PySAM and SSC versions:
Code:
import PySAM as pysam
import PySAM.PySSC as pssc
print('PySAM Version', pysam.__version__)
ssc = pssc.PySSC()
print('SSC version', ssc.version())
2. Make sure you are using the same configuration in SAM and PySAM.
The SAM file you shared uses the Generic-Battery / Residential configuration. You can see that in the top left corner of the SAM window:
Attachment sam-config.png not found
In Python, it looks like you are using the Standalone Battery / Residential configuration:
Attachment python-config.png not found
3. Make sure the inputs you are using in SAM are consistent with those in Python.
This can be tricky to ensure. The best way to be sure you are comparing consistent inputs is to set up your analysis in SAM, and then export the SAM inputs to JSON files and import those into your Python script. Export to JSON using a process similar to the one demonstrated in this video, except use PySAM JSON code generator option:
Attachment code-generator.png not found
Then use the method described in the PySAM documentation to import the data from JSON: nrel-pysam.readthedocs.io/en/master/Import.html
When you are sure the inputs are consistent, you still may see small differences in output values due to differences in numerical precision in the underlying code, but the results should be pretty close to identical.
Let me know if you need more help identifying the cause of differences between specific outputs in SAM and PySAM.
Best regards,
Paul.
Attachments:
Last edit: 01 Jun 2022 16:47 by pgilman.
Please Log in or Create an account to join the conversation.
- kbertcher
- Topic Author
Less
More
- Posts: 3
07 Jul 2022 17:04 #11233
by kbertcher
Replied by kbertcher on topic Net Metering
Hi Paul,
Thank you so much for your help. I am coming back to this thread to both thank you and to close the loop that the generic battery vs standalone battery was the biggest issue between the pysam and SAM application versions.
I also wanted to ask a related question about net metering and the price-based battery dispatch in SAM. I know that the price based dispatch discharges at highest cost periods and charges at the lowest marginal cost periods. Is net metering factored into this cost calculation? When I export the "grid_power" output of the battery module at various levels of net metering it does not change, though the costs are now accurately accounting for net metering. Thank you again!
Best,
Katie
Thank you so much for your help. I am coming back to this thread to both thank you and to close the loop that the generic battery vs standalone battery was the biggest issue between the pysam and SAM application versions.
I also wanted to ask a related question about net metering and the price-based battery dispatch in SAM. I know that the price based dispatch discharges at highest cost periods and charges at the lowest marginal cost periods. Is net metering factored into this cost calculation? When I export the "grid_power" output of the battery module at various levels of net metering it does not change, though the costs are now accurately accounting for net metering. Thank you again!
Best,
Katie
Please Log in or Create an account to join the conversation.
Moderators: pgilman