-
Notifications
You must be signed in to change notification settings - Fork 46
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
Conversation
Matthew-Boyd
commented
Feb 9, 2023
- Improve value assignment in power_source
- Add detailed PV model (pvsamv1)
- Add custom PV model capability
|
@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 |
@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. |
hybrid/detailed_pv_plant.py
Outdated
) | ||
self._system_model.SystemDesign.subarray1_nstrings = n_strings | ||
self._system_model.SystemDesign.system_capacity = system_capacity | ||
self._system_model.SystemDesign.inverter_count = n_inverters |
There was a problem hiding this comment.
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:
Line 71 in c4e2a55
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:
Line 130 in c4e2a55
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.
There was a problem hiding this comment.
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.
hybrid/hybrid_simulation.py
Outdated
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']: |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
@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/detailed_pv_plant.py
Outdated
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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!
There was a problem hiding this 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!