2020from pvlib .tools import _build_kwargs
2121from pvlib .location import Location
2222from pvlib import irradiance , atmosphere
23- from pvlib import singlediode_methods
23+ import pvlib # use pvlib.singlediode to avoid clash with local method
2424
2525
2626# not sure if this belongs in the pvsystem module.
@@ -1963,52 +1963,12 @@ def singlediode(photocurrent, saturation_current, resistance_series,
19631963 open-circuit.
19641964
19651965 If the method is either ``'newton'`` or ``'brentq'`` and ``ivcurve_pnts``
1966- are indicated, then :func:`pvlib.singlediode_methods .bishop88` is used to
1966+ are indicated, then :func:`pvlib.singlediode .bishop88` [4] is used to
19671967 calculate the points on the IV curve points at diode voltages from zero to
19681968 open-circuit voltage with a log spacing that gets closer as voltage
19691969 increases. If the method is ``'lambertw'`` then the calculated points on
19701970 the IV curve are linearly spaced.
19711971
1972- The ``bishop88`` method uses an explicit solution from [4] that finds
1973- points on the IV curve by first solving for pairs :math:`(V_d, I)` where
1974- :math:`V_d` is the diode voltage :math:`V_d = V + I*Rs`. Then the voltage
1975- is backed out from :math:`V_d`. Points with specific voltage, such as open
1976- circuit, are located using the bisection search method, ``brentq``, bounded
1977- by a zero diode voltage and an estimate of open circuit voltage given by
1978-
1979- .. math::
1980-
1981- V_{oc, est} = n Ns V_{th} \\ log \\ left( \\ frac{I_L}{I_0} + 1 \\ right)
1982-
1983- We know that :math:`V_d = 0` corresponds to a voltage less than zero, and
1984- we can also show that when :math:`V_d = V_{oc, est}`, the resulting
1985- current is also negative, meaning that the corresponding voltage must be
1986- in the 4th quadrant and therefore greater than the open circuit voltage
1987- (see proof below). Therefore the entire forward-bias 1st quadrant IV-curve
1988- is bounded, and a bisection search within these points will always find
1989- desired condition.
1990-
1991- .. math::
1992-
1993- I = I_L - I_0 \\ left(\\ exp \\ left(\\ frac{V_{oc, est}}{n Ns V_{th}} \\ right) - 1 \\ right)
1994- - \\ frac{V_{oc, est}}{R_{sh}} \\ newline
1995-
1996- I = I_L - I_0 \\ left(\\ exp \\ left(\\ frac{n Ns V_{th} \\ log \\ left(\\ frac{I_L}{I_0} + 1 \\ right)}{n Ns V_{th}} \\ right) - 1 \\ right)
1997- - \\ frac{n Ns V_{th} \\ log \\ left(\\ frac{I_L}{I_0} + 1 \\ right)}{R_{sh}} \\ newline
1998-
1999- I = I_L - I_0 \\ left(\\ exp \\ left(\\ log \\ left(\\ frac{I_L}{I_0} + 1 \\ right) \\ right) - 1 \\ right)
2000- - \\ frac{n Ns V_{th} \\ log \\ left(\\ frac{I_L}{I_0} + 1 \\ right)}{R_{sh}} \\ newline
2001-
2002- I = I_L - I_0 \\ left(\\ frac{I_L}{I_0} + 1 - 1 \\ right)
2003- - \\ frac{n Ns V_{th} \\ log \\ left(\\ frac{I_L}{I_0} + 1 \\ right)}{R_{sh}} \\ newline
2004-
2005- I = I_L - I_0 \\ left(\\ frac{I_L}{I_0} \\ right)
2006- - \\ frac{n Ns V_{th} \\ log \\ left(\\ frac{I_L}{I_0} + 1 \\ right)}{R_{sh}} \\ newline
2007-
2008- I = I_L - I_L - \\ frac{n Ns V_{th} \log \\ left( \\ frac{I_L}{I_0} + 1 \\ right)}{R_{sh}} \\ newline
2009-
2010- I = - \\ frac{n Ns V_{th} \\ log \\ left( \\ frac{I_L}{I_0} + 1 \\ right)}{R_{sh}}
2011-
20121972 References
20131973 -----------
20141974 [1] S.R. Wenham, M.A. Green, M.E. Watt, "Applied Photovoltaics" ISBN
@@ -2029,12 +1989,12 @@ def singlediode(photocurrent, saturation_current, resistance_series,
20291989 --------
20301990 sapm
20311991 calcparams_desoto
2032- pvlib.singlediode_methods .bishop88
1992+ pvlib.singlediode .bishop88
20331993 """
20341994 # Calculate points on the IV curve using the LambertW solution to the
20351995 # single diode equation
20361996 if method .lower () == 'lambertw' :
2037- out = singlediode_methods ._lambertw (
1997+ out = pvlib . singlediode ._lambertw (
20381998 photocurrent , saturation_current , resistance_series ,
20391999 resistance_shunt , nNsVth , ivcurve_pnts
20402000 )
@@ -2047,19 +2007,19 @@ def singlediode(photocurrent, saturation_current, resistance_series,
20472007 # equation for the diode voltage V_d then backing out voltage
20482008 args = (photocurrent , saturation_current , resistance_series ,
20492009 resistance_shunt , nNsVth ) # collect args
2050- v_oc = singlediode_methods .bishop88_v_from_i (
2010+ v_oc = pvlib . singlediode .bishop88_v_from_i (
20512011 0.0 , * args , method = method .lower ()
20522012 )
2053- i_mp , v_mp , p_mp = singlediode_methods .bishop88_mpp (
2013+ i_mp , v_mp , p_mp = pvlib . singlediode .bishop88_mpp (
20542014 * args , method = method .lower ()
20552015 )
2056- i_sc = singlediode_methods .bishop88_i_from_v (
2016+ i_sc = pvlib . singlediode .bishop88_i_from_v (
20572017 0.0 , * args , method = method .lower ()
20582018 )
2059- i_x = singlediode_methods .bishop88_i_from_v (
2019+ i_x = pvlib . singlediode .bishop88_i_from_v (
20602020 v_oc / 2.0 , * args , method = method .lower ()
20612021 )
2062- i_xx = singlediode_methods .bishop88_i_from_v (
2022+ i_xx = pvlib . singlediode .bishop88_i_from_v (
20632023 (v_oc + v_mp ) / 2.0 , * args , method = method .lower ()
20642024 )
20652025
@@ -2069,7 +2029,7 @@ def singlediode(photocurrent, saturation_current, resistance_series,
20692029 (11.0 - np .logspace (np .log10 (11.0 ), 0.0 ,
20702030 ivcurve_pnts )) / 10.0
20712031 )
2072- ivcurve_i , ivcurve_v , _ = singlediode_methods .bishop88 (vd , * args )
2032+ ivcurve_i , ivcurve_v , _ = pvlib . singlediode .bishop88 (vd , * args )
20732033
20742034 out = OrderedDict ()
20752035 out ['i_sc' ] = i_sc
@@ -2125,7 +2085,7 @@ def max_power_point(photocurrent, saturation_current, resistance_series,
21252085 curve. This function uses Brent's method by default because it is
21262086 guaranteed to converge.
21272087 """
2128- i_mp , v_mp , p_mp = singlediode_methods .bishop88_mpp (
2088+ i_mp , v_mp , p_mp = pvlib . singlediode .bishop88_mpp (
21292089 photocurrent , saturation_current , resistance_series ,
21302090 resistance_shunt , nNsVth , method = method .lower ()
21312091 )
@@ -2205,7 +2165,7 @@ def v_from_i(resistance_shunt, resistance_series, nNsVth, current,
22052165 Energy Materials and Solar Cells, 81 (2004) 269-277.
22062166 '''
22072167 if method .lower () == 'lambertw' :
2208- return singlediode_methods ._lambertw_v_from_i (
2168+ return pvlib . singlediode ._lambertw_v_from_i (
22092169 resistance_shunt , resistance_series , nNsVth , current ,
22102170 saturation_current , photocurrent
22112171 )
@@ -2215,9 +2175,9 @@ def v_from_i(resistance_shunt, resistance_series, nNsVth, current,
22152175 # equation for the diode voltage V_d then backing out voltage
22162176 args = (current , photocurrent , saturation_current ,
22172177 resistance_series , resistance_shunt , nNsVth )
2218- V = singlediode_methods .bishop88_v_from_i (* args , method = method .lower ())
2178+ V = pvlib . singlediode .bishop88_v_from_i (* args , method = method .lower ())
22192179 # find the right size and shape for returns
2220- size , shape = singlediode_methods ._get_size_and_shape (args )
2180+ size , shape = pvlib . singlediode ._get_size_and_shape (args )
22212181 if size <= 1 :
22222182 if shape is not None :
22232183 V = np .tile (V , shape )
@@ -2293,7 +2253,7 @@ def i_from_v(resistance_shunt, resistance_series, nNsVth, voltage,
22932253 Energy Materials and Solar Cells, 81 (2004) 269-277.
22942254 '''
22952255 if method .lower () == 'lambertw' :
2296- return singlediode_methods ._lambertw_i_from_v (
2256+ return pvlib . singlediode ._lambertw_i_from_v (
22972257 resistance_shunt , resistance_series , nNsVth , voltage ,
22982258 saturation_current , photocurrent
22992259 )
@@ -2303,9 +2263,9 @@ def i_from_v(resistance_shunt, resistance_series, nNsVth, voltage,
23032263 # equation for the diode voltage V_d then backing out voltage
23042264 args = (voltage , photocurrent , saturation_current , resistance_series ,
23052265 resistance_shunt , nNsVth )
2306- I = singlediode_methods .bishop88_i_from_v (* args , method = method .lower ())
2266+ I = pvlib . singlediode .bishop88_i_from_v (* args , method = method .lower ())
23072267 # find the right size and shape for returns
2308- size , shape = singlediode_methods ._get_size_and_shape (args )
2268+ size , shape = pvlib . singlediode ._get_size_and_shape (args )
23092269 if size <= 1 :
23102270 if shape is not None :
23112271 I = np .tile (I , shape )
0 commit comments