@@ -1932,8 +1932,8 @@ def sapm_effective_irradiance(poa_direct, poa_diffuse, airmass_absolute, aoi,
1932
1932
1933
1933
1934
1934
def singlediode (photocurrent , saturation_current , resistance_series ,
1935
- resistance_shunt , nNsVth , ivcurve_pnts = None ,
1936
- method = 'lambertw' ):
1935
+ resistance_shunt , nNsVth , voltage = np . array ([]) ,
1936
+ ivcurve_pnts = None , method = 'lambertw' ):
1937
1937
"""
1938
1938
Solve the single-diode model to obtain a photovoltaic IV curve.
1939
1939
@@ -1985,9 +1985,13 @@ def singlediode(photocurrent, saturation_current, resistance_series,
1985
1985
q is the charge of an electron (coulombs).
1986
1986
0 < nNsVth
1987
1987
1988
+ voltage : numeric, default empty
1989
+ Voltage values where points are calculated on the IV curve. Must be
1990
+ sorted in increasing order.
1991
+
1988
1992
ivcurve_pnts : None or int, default None
1989
- Number of points in the desired IV curve. If None or 0, no
1990
- IV curves will be produced .
1993
+ Number of points to calculate along the IV curve. If `voltages` is
1994
+ provides, `ivcurve_pnts` is ignored .
1991
1995
1992
1996
method : str, default 'lambertw'
1993
1997
Determines the method used to calculate points on the IV curve. The
@@ -2021,9 +2025,9 @@ def singlediode(photocurrent, saturation_current, resistance_series,
2021
2025
2022
2026
Notes
2023
2027
-----
2024
- If the method is ``'lambertw'`` then the solution employed to solve the
2025
- implicit diode equation utilizes the Lambert W function to obtain an
2026
- explicit function of :math:`V=f(I)` and :math:`I=f(V)` as shown in [2].
2028
+ If the method is ``'lambertw'`` then the solution to the implicit diode
2029
+ equation utilizes the Lambert W function to obtain an explicit function of
2030
+ :math:`V=f(I)` and :math:`I=f(V)` as shown in [2].
2027
2031
2028
2032
If the method is ``'newton'`` then the root-finding Newton-Raphson method
2029
2033
is used. It should be safe for well behaved IV-curves, but the ``'brentq'``
@@ -2094,13 +2098,21 @@ def singlediode(photocurrent, saturation_current, resistance_series,
2094
2098
(v_oc + v_mp ) / 2.0 , * args , method = method .lower ()
2095
2099
)
2096
2100
2097
- # calculate the IV curve if requested using bishop88
2098
- if ivcurve_pnts :
2101
+ if voltage .size :
2102
+ # calculate the IV curve if requested using bishop88
2103
+ ivcurve_i , ivcurve_v , _ = _singlediode .bishop88_i_from_v (
2104
+ voltage , * args , method = method .lower ())
2105
+ calc = True
2106
+ elif ivcurve_pnts :
2107
+ # calculate the IV curve if requested using bishop88
2099
2108
vd = v_oc * (
2100
2109
(11.0 - np .logspace (np .log10 (11.0 ), 0.0 ,
2101
2110
ivcurve_pnts )) / 10.0
2102
2111
)
2103
2112
ivcurve_i , ivcurve_v , _ = _singlediode .bishop88 (vd , * args )
2113
+ calc = True
2114
+ else :
2115
+ calc = False
2104
2116
2105
2117
out = OrderedDict ()
2106
2118
out ['i_sc' ] = i_sc
@@ -2111,7 +2123,7 @@ def singlediode(photocurrent, saturation_current, resistance_series,
2111
2123
out ['i_x' ] = i_x
2112
2124
out ['i_xx' ] = i_xx
2113
2125
2114
- if ivcurve_pnts :
2126
+ if calc :
2115
2127
2116
2128
out ['v' ] = ivcurve_v
2117
2129
out ['i' ] = ivcurve_i
0 commit comments