-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add recombination current params to all bishop88 functions #763
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
Changes from 8 commits
509ba3e
f4f4fe0
cbb78ac
22637f8
c20fa3e
149ebfe
f603461
309c87a
4086fc8
dddc4cd
5ad5241
1e3f8d6
581a427
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2473,7 +2473,8 @@ def singlediode(photocurrent, saturation_current, resistance_series, | |
|
|
||
|
|
||
| def max_power_point(photocurrent, saturation_current, resistance_series, | ||
| resistance_shunt, nNsVth, method='brentq'): | ||
| resistance_shunt, nNsVth, d2mutau=0, NsVbi=np.Inf, | ||
| method='brentq'): | ||
| """ | ||
| Given the single diode equation coefficients, calculates the maximum power | ||
| point (MPP). | ||
|
|
@@ -2491,6 +2492,14 @@ def max_power_point(photocurrent, saturation_current, resistance_series, | |
| nNsVth : numeric | ||
| product of thermal voltage ``Vth`` [V], diode ideality factor ``n``, | ||
| and number of serices cells ``Ns`` | ||
| d2mutau : numeric | ||
| PVSyst thin-film recombination parameter that is the ratio of thickness | ||
| of the intrinsic layer squared :math:`d^2` and the diffusion length of | ||
| charge carriers :math:`\\mu \\tau`, in volts [V], defaults to 0[V] | ||
| NsVbi : numeric | ||
| PVSyst thin-film recombination parameter that is the product of the PV | ||
| module number of series cells ``Ns`` and the builtin voltage ``Vbi`` of | ||
| the intrinsic layer, in volts [V], defaults to ``np.inf`` | ||
cwhanse marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| method : str | ||
| either ``'newton'`` or ``'brentq'`` | ||
|
|
||
|
|
@@ -2508,7 +2517,8 @@ def max_power_point(photocurrent, saturation_current, resistance_series, | |
| """ | ||
| i_mp, v_mp, p_mp = _singlediode.bishop88_mpp( | ||
| photocurrent, saturation_current, resistance_series, | ||
| resistance_shunt, nNsVth, method=method.lower() | ||
| resistance_shunt, nNsVth, d2mutau=0, NsVbi=np.Inf, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it an oversight that these parameters are hardcoded with default values here instead of passing through the arguments to this function?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it’s unintentional. Look at the git blame for these lines. When bishop was first added, we included the capability to model thin films but we didn’t fully implement passing the arguments and docstring in all the single diode &
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I probably copy/pasted from the function signature. :(
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kandersolar & @adriesse addressed in #1733 - btw: the recombination losses were only implemented in |
||
| method=method.lower() | ||
| ) | ||
| if isinstance(photocurrent, pd.Series): | ||
| ivp = {'i_mp': i_mp, 'v_mp': v_mp, 'p_mp': p_mp} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -173,7 +173,7 @@ def bishop88(diode_voltage, photocurrent, saturation_current, | |
|
|
||
| def bishop88_i_from_v(voltage, photocurrent, saturation_current, | ||
| resistance_series, resistance_shunt, nNsVth, | ||
| method='newton'): | ||
| d2mutau=0, NsVbi=np.Inf, method='newton'): | ||
| """ | ||
| Find current given any voltage. | ||
|
|
||
|
|
@@ -192,6 +192,14 @@ def bishop88_i_from_v(voltage, photocurrent, saturation_current, | |
| nNsVth : numeric | ||
| product of diode ideality factor (n), number of series cells (Ns), and | ||
| thermal voltage (Vth = k_b * T / q_e) in volts [V] | ||
| d2mutau : numeric | ||
|
||
| PVSyst thin-film recombination parameter that is the ratio of thickness | ||
| of the intrinsic layer squared :math:`d^2` and the diffusion length of | ||
| charge carriers :math:`\\mu \\tau`, in volts [V], defaults to 0[V] | ||
| NsVbi : numeric | ||
| PVSyst thin-film recombination parameter that is the product of the PV | ||
| module number of series cells ``Ns`` and the builtin voltage ``Vbi`` of | ||
| the intrinsic layer, in volts [V], defaults to ``np.inf`` | ||
| method : str | ||
| one of two optional search methods: either ``'brentq'``, a reliable and | ||
| bounded method or ``'newton'`` which is the default. | ||
|
|
@@ -203,7 +211,7 @@ def bishop88_i_from_v(voltage, photocurrent, saturation_current, | |
| """ | ||
| # collect args | ||
| args = (photocurrent, saturation_current, resistance_series, | ||
| resistance_shunt, nNsVth) | ||
| resistance_shunt, nNsVth, d2mutau, NsVbi) | ||
|
|
||
| def fv(x, v, *a): | ||
| # calculate voltage residual given diode voltage "x" | ||
|
|
@@ -216,8 +224,9 @@ def fv(x, v, *a): | |
| # brentq only works with scalar inputs, so we need a set up function | ||
| # and np.vectorize to repeatedly call the optimizer with the right | ||
| # arguments for possible array input | ||
| def vd_from_brent(voc, v, iph, isat, rs, rsh, gamma): | ||
| return brentq(fv, 0.0, voc, args=(v, iph, isat, rs, rsh, gamma)) | ||
| def vd_from_brent(voc, v, iph, isat, rs, rsh, gamma, d2mutau, NsVbi): | ||
| return brentq(fv, 0.0, voc, | ||
| args=(v, iph, isat, rs, rsh, gamma, d2mutau, NsVbi)) | ||
|
|
||
| vd_from_brent_vectorized = np.vectorize(vd_from_brent) | ||
| vd = vd_from_brent_vectorized(voc_est, voltage, *args) | ||
|
|
@@ -235,7 +244,7 @@ def vd_from_brent(voc, v, iph, isat, rs, rsh, gamma): | |
|
|
||
| def bishop88_v_from_i(current, photocurrent, saturation_current, | ||
| resistance_series, resistance_shunt, nNsVth, | ||
| method='newton'): | ||
| d2mutau=0, NsVbi=np.Inf, method='newton'): | ||
| """ | ||
| Find voltage given any current. | ||
|
|
||
|
|
@@ -254,6 +263,14 @@ def bishop88_v_from_i(current, photocurrent, saturation_current, | |
| nNsVth : numeric | ||
| product of diode ideality factor (n), number of series cells (Ns), and | ||
| thermal voltage (Vth = k_b * T / q_e) in volts [V] | ||
| d2mutau : numeric | ||
| PVSyst thin-film recombination parameter that is the ratio of thickness | ||
| of the intrinsic layer squared :math:`d^2` and the diffusion length of | ||
| charge carriers :math:`\\mu \\tau`, in volts [V], defaults to 0[V] | ||
| NsVbi : numeric | ||
| PVSyst thin-film recombination parameter that is the product of the PV | ||
| module number of series cells ``Ns`` and the builtin voltage ``Vbi`` of | ||
| the intrinsic layer, in volts [V], defaults to ``np.inf`` | ||
| method : str | ||
| one of two optional search methods: either ``'brentq'``, a reliable and | ||
| bounded method or ``'newton'`` which is the default. | ||
|
|
@@ -265,7 +282,7 @@ def bishop88_v_from_i(current, photocurrent, saturation_current, | |
| """ | ||
| # collect args | ||
| args = (photocurrent, saturation_current, resistance_series, | ||
| resistance_shunt, nNsVth) | ||
| resistance_shunt, nNsVth, d2mutau, NsVbi) | ||
| # first bound the search using voc | ||
| voc_est = estimate_voc(photocurrent, saturation_current, nNsVth) | ||
|
|
||
|
|
@@ -277,8 +294,9 @@ def fi(x, i, *a): | |
| # brentq only works with scalar inputs, so we need a set up function | ||
| # and np.vectorize to repeatedly call the optimizer with the right | ||
| # arguments for possible array input | ||
| def vd_from_brent(voc, i, iph, isat, rs, rsh, gamma): | ||
| return brentq(fi, 0.0, voc, args=(i, iph, isat, rs, rsh, gamma)) | ||
| def vd_from_brent(voc, i, iph, isat, rs, rsh, gamma, d2mutau, NsVbi): | ||
| return brentq(fi, 0.0, voc, | ||
| args=(i, iph, isat, rs, rsh, gamma, d2mutau, NsVbi)) | ||
|
|
||
| vd_from_brent_vectorized = np.vectorize(vd_from_brent) | ||
| vd = vd_from_brent_vectorized(voc_est, current, *args) | ||
|
|
@@ -295,7 +313,8 @@ def vd_from_brent(voc, i, iph, isat, rs, rsh, gamma): | |
|
|
||
|
|
||
| def bishop88_mpp(photocurrent, saturation_current, resistance_series, | ||
| resistance_shunt, nNsVth, method='newton'): | ||
| resistance_shunt, nNsVth, d2mutau=0, NsVbi=np.Inf, | ||
| method='newton'): | ||
| """ | ||
| Find max power point. | ||
|
|
||
|
|
@@ -312,6 +331,14 @@ def bishop88_mpp(photocurrent, saturation_current, resistance_series, | |
| nNsVth : numeric | ||
| product of diode ideality factor (n), number of series cells (Ns), and | ||
| thermal voltage (Vth = k_b * T / q_e) in volts [V] | ||
| d2mutau : numeric | ||
| PVSyst thin-film recombination parameter that is the ratio of thickness | ||
| of the intrinsic layer squared :math:`d^2` and the diffusion length of | ||
| charge carriers :math:`\\mu \\tau`, in volts [V], defaults to 0[V] | ||
| NsVbi : numeric | ||
| PVSyst thin-film recombination parameter that is the product of the PV | ||
| module number of series cells ``Ns`` and the builtin voltage ``Vbi`` of | ||
| the intrinsic layer, in volts [V], defaults to ``np.inf`` | ||
| method : str | ||
| one of two optional search methods: either ``'brentq'``, a reliable and | ||
| bounded method or ``'newton'`` which is the default. | ||
|
|
@@ -324,7 +351,7 @@ def bishop88_mpp(photocurrent, saturation_current, resistance_series, | |
| """ | ||
| # collect args | ||
| args = (photocurrent, saturation_current, resistance_series, | ||
| resistance_shunt, nNsVth) | ||
| resistance_shunt, nNsVth, d2mutau, NsVbi) | ||
| # first bound the search using voc | ||
| voc_est = estimate_voc(photocurrent, saturation_current, nNsVth) | ||
|
|
||
|
|
@@ -334,8 +361,9 @@ def fmpp(x, *a): | |
| if method.lower() == 'brentq': | ||
| # break out arguments for numpy.vectorize to handle broadcasting | ||
| vec_fun = np.vectorize( | ||
| lambda voc, iph, isat, rs, rsh, gamma: | ||
| brentq(fmpp, 0.0, voc, args=(iph, isat, rs, rsh, gamma)) | ||
| lambda voc, iph, isat, rs, rsh, gamma, d2mutau, NsVbi: | ||
| brentq(fmpp, 0.0, voc, | ||
| args=(iph, isat, rs, rsh, gamma, d2mutau, NsVbi)) | ||
| ) | ||
| vd = vec_fun(voc_est, *args) | ||
| elif method.lower() == 'newton': | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.