Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add detailed PV model (pvsamv1) #99

Merged
merged 16 commits into from
Feb 15, 2023
Merged

Add detailed PV model (pvsamv1) #99

merged 16 commits into from
Feb 15, 2023

Conversation

Matthew-Boyd
Copy link
Collaborator

  • Improve value assignment in power_source
  • Add detailed PV model (pvsamv1)
  • Add custom PV model capability

@Matthew-Boyd Matthew-Boyd added the enhancement New feature or request label Feb 9, 2023
@Matthew-Boyd Matthew-Boyd self-assigned this Feb 9, 2023
@Matthew-Boyd
Copy link
Collaborator Author

@dguittet

  • For parameter coherence, should nstrings be aligned to system_capacity or the other way around? See line 56 in detailed_pv_plant.py
  • Should detailed_pv_plant.py be named detailed_pv_source.py to relate better to pv_source.py?
  • Next steps:
    • generalize grid financial model (so a custom financial model doesn't need all the singleowner parameters)
    • add detailed PV layout capability
    • add custom financial model capability

@dguittet
Copy link
Collaborator

dguittet commented Feb 9, 2023

@Matthew-Boyd I think the workflow goes: target design capacity and ratios -> figure out the nstrings, nmodules etc which are integer and so might not result in exactly the desired target design capacity and ratios -> then set the system_capacity, which is really more like a reporting step since in Pvsamv1, the system_capacity is a calculated variable. Did I understand the question correctly?

@Matthew-Boyd
Copy link
Collaborator Author

@Matthew-Boyd I think the workflow goes: target design capacity and ratios -> figure out the nstrings, nmodules etc which are integer and so might not result in exactly the desired target design capacity and ratios -> then set the system_capacity, which is really more like a reporting step since in Pvsamv1, the system_capacity is a calculated variable. Did I understand the question correctly?

@dguittet Thanks, and yes, you understood correctly. I wasn't sure if this would apply to plant initialization, but I guess so. I've made the change.

)
self._system_model.SystemDesign.subarray1_nstrings = n_strings
self._system_model.SystemDesign.system_capacity = system_capacity
self._system_model.SystemDesign.inverter_count = n_inverters
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How I've tried to handle this issue of interdependent variables is shown in the wind source. For instance, in the __init__, the turbine rating is assigned from the config, and the rating then changes the system capacity:

self.turb_rating = farm_config['turbine_rating_kw']

The turb_rating is actually a Python class property with custom-defined getters and setters, as you can see here:

def turb_rating(self, rating_kw):

Whenever the setter self.turb_rating = x is called, we end up going to that custom function. That custom function's job is to make everything in PySAM consistent to the best of its ability.

When you have these new Pvsamv1 variables that users are supposed to use, you will need to add these class properties to control how they are accessed and modified. We want to enable the ability for the user to do:

pvplant.n_strings = 11
pvplant.module_power = 240
pvplant.subarray1_modules_per_string = 10
...

and have the end resulting Pvsamv1 model consistent.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been running into trouble with the way some properties are set up in HOPP, where you get caught in loops, and that's why I'm setting these directly. In this case, the actual system_capacity has been calculated (without designing a new layout) and should be set in the pysam model as-is, where the property is set up to assume it's been given the target system_capacity and it then calculates a new layout and sets a different system_capacity.

self.pv = PVPlant(self.site, power_sources['pv'])
if 'pv_plant' in power_sources['pv']:
self.pv = power_sources['pv']['pv_plant'] # User instantiated plant
elif 'tech_config' in power_sources['pv']:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if there's a more explicit way to let users choose between creating a DetailedPVPlant vs a PVPlant?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering this too... let's discuss.

@Matthew-Boyd
Copy link
Collaborator Author

@dguittet This covers everything we discussed last week. There's one test failing in one build, for what looks to be an nsrdb download issue.

hybrid/hybrid_simulation.py Show resolved Hide resolved
hybrid/detailed_pv_plant.py Outdated Show resolved Hide resolved
hybrid/detailed_pv_plant.py Outdated Show resolved Hide resolved
hybrid/layout/pv_design_utils.py Outdated Show resolved Hide resolved
hybrid/layout/pv_design_utils.py Outdated Show resolved Hide resolved
hybrid/layout/pv_design_utils.py Outdated Show resolved Hide resolved
self._system_model.SystemDesign.subarray1_modules_per_string = _modules_per_string
self._system_model.SystemDesign.subarray1_modules_per_string = 0
self._system_model.SystemDesign.subarray1_modules_per_string = 0
self._system_model.SystemDesign.subarray1_modules_per_string = 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be subarray2-4?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agh, darn it! Thanks for the catch!

Copy link
Collaborator

@dguittet dguittet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good to merge after that minor subarray2-4 change!

@Matthew-Boyd Matthew-Boyd merged commit 84f2934 into master Feb 15, 2023
@Matthew-Boyd Matthew-Boyd deleted the add_pvsamv1 branch February 15, 2023 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants