-
Notifications
You must be signed in to change notification settings - Fork 30
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 De Soto, PVsyst single diode models #117
base: master
Are you sure you want to change the base?
Conversation
Hi @cwhanse, I have a few comments, feel free to ignore:
|
The current use of "0", "_0", "0_T0" etc. doesn't follow the patterns I'm used to seeing, which I'm trying to follow. For example,
I got the message from @chetan201 that minimal changes to the API are desired, since other applications are relying on PVMismatch. The pvlib functions have a very different API than this package. I would prefer not to duplicate functions already in pvlib, but that's not avoidable without a complete redo of
I'm confused by this comment: bishop88 is a method to calculate an IV curve given values for the 5 parameters for a single diode equivalent circuit. It's not a single diode model, which in pvlib is implemented in the
I'm in complete agreement, but that's an overhaul of the |
@cwhanse thanks for your responses, all sounds good, let me know if/how I can support/help |
def Rsh(self): | ||
if self.diode_model == 'desoto': | ||
return self.Rsh_STC / self.Ee | ||
elif self.diode_model == 'desoto': |
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 line should say elif diode_model == "pvsyst"
right?
|
||
@property | ||
def N2(self): | ||
return self.N2_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.
I'm curious, does this line need if diode_model != '2-diode': return 0
?
Idiode1_sc = self.Isat1 * (np.exp(Vdiode_sc / self.Vt) - 1.) | ||
Idiode2_sc = self.Isat2 * (np.exp(Vdiode_sc / 2. / self.Vt) - 1.) | ||
Idiode1_sc = self.Isat1 * (np.expm1(Vdiode_sc / self.N1 / self.Vt)) | ||
Idiode2_sc = self.Isat2 * (np.expm1(Vdiode_sc / self.N2 / self.Vt)) |
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.
❤️ thanks for using expm1
Ishunt_sc = Vdiode_sc / self.Rsh # diode voltage at SC | ||
# photogenerated current coefficient | ||
return 1. + (Idiode1_sc + Idiode2_sc + Ishunt_sc) / self.Isc | ||
if self.diode_model=='2diode': | ||
return 1. + (Idiode1_sc + Idiode2_sc + Ishunt_sc) / self.Isc |
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.
Ah, re: my comment above I see now, it's fine to leave N2 as non-zero, because it won't be included in the desoto or pvsyst calcs anyway. Clever!
) | ||
else: | ||
_expTstar = np.exp( | ||
self.Eg / k_b /self.N1 * _inv_delta_T |
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 here you could just remove N1 for 2-diode, and it could just be self.Eg / k_b * _inv_delta_T
but I see, leaving it in gives it more flexibility, since N1 might not be one?
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.
Only one line L169 that looks like a typo to me, in the Rsh calculation, I think the second condition should say, if diode model is pvsyst, but it says desoto -- probably copy & paste typo. Otherwise this is amazing. Thank you x1e6 Cliff! I'm sorry you had to slog through my horrible code. I'm so embarrassed. 😕
@cwhanse Just curious, do you see this PR getting wrapped up in the next few weeks? I have something I'd like to use it for but can go another way if this is on the back burner. No pressure, I'm just trying to plan ahead. |
@kanderso-nrel I could do that. A few corrections are needed, and tests. I stopped work when the tests became a problem. I cannot exactly reproduce the PVMismatch IV curves using pvlib functions, because PVMismatch parameterizes the curves using Isc rather than photocurrent. The difference in Isc from pvlib and PVMismatch is not small. Let me see if I can find the code to show the problem, I would appreciate someone else's eyes on this. It may be that I'm not using PVMismatch correctly, it also may be that the properties aren't being updated when I expected they are. |
Summary of API breaks:
PVcell.Rsh
is replaced byPVcell.Rsh_STC
.PVcell.Rsh
now holds condition-dependent Rsh.PVcell.Eg
is replaced byPVcell.Eg_0
.PVcell.Eg
now holds condition-dependent Eg.PVcell.N1_0
andPVcell.N2_0
to contain diode (ideality) factors, which are used in place of the previously hard-coded 1.0 and 2.0 values.Not yet done:
PVcell.Voc
still uses diode factors 1.0 and 2.0 for the 2-diode model.Opening PR to get some feedback on the changes. No tests included.