20
20
from pvlib .tools import _build_kwargs
21
21
from pvlib .location import Location
22
22
from pvlib import irradiance , atmosphere
23
- from pvlib import singlediode_methods
23
+ import pvlib # use pvlib.singlediode to avoid clash with local method
24
24
25
25
26
26
# not sure if this belongs in the pvsystem module.
@@ -1963,52 +1963,12 @@ def singlediode(photocurrent, saturation_current, resistance_series,
1963
1963
open-circuit.
1964
1964
1965
1965
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
1967
1967
calculate the points on the IV curve points at diode voltages from zero to
1968
1968
open-circuit voltage with a log spacing that gets closer as voltage
1969
1969
increases. If the method is ``'lambertw'`` then the calculated points on
1970
1970
the IV curve are linearly spaced.
1971
1971
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
-
2012
1972
References
2013
1973
-----------
2014
1974
[1] S.R. Wenham, M.A. Green, M.E. Watt, "Applied Photovoltaics" ISBN
@@ -2029,12 +1989,12 @@ def singlediode(photocurrent, saturation_current, resistance_series,
2029
1989
--------
2030
1990
sapm
2031
1991
calcparams_desoto
2032
- pvlib.singlediode_methods .bishop88
1992
+ pvlib.singlediode .bishop88
2033
1993
"""
2034
1994
# Calculate points on the IV curve using the LambertW solution to the
2035
1995
# single diode equation
2036
1996
if method .lower () == 'lambertw' :
2037
- out = singlediode_methods ._lambertw (
1997
+ out = pvlib . singlediode ._lambertw (
2038
1998
photocurrent , saturation_current , resistance_series ,
2039
1999
resistance_shunt , nNsVth , ivcurve_pnts
2040
2000
)
@@ -2047,19 +2007,19 @@ def singlediode(photocurrent, saturation_current, resistance_series,
2047
2007
# equation for the diode voltage V_d then backing out voltage
2048
2008
args = (photocurrent , saturation_current , resistance_series ,
2049
2009
resistance_shunt , nNsVth ) # collect args
2050
- v_oc = singlediode_methods .bishop88_v_from_i (
2010
+ v_oc = pvlib . singlediode .bishop88_v_from_i (
2051
2011
0.0 , * args , method = method .lower ()
2052
2012
)
2053
- i_mp , v_mp , p_mp = singlediode_methods .bishop88_mpp (
2013
+ i_mp , v_mp , p_mp = pvlib . singlediode .bishop88_mpp (
2054
2014
* args , method = method .lower ()
2055
2015
)
2056
- i_sc = singlediode_methods .bishop88_i_from_v (
2016
+ i_sc = pvlib . singlediode .bishop88_i_from_v (
2057
2017
0.0 , * args , method = method .lower ()
2058
2018
)
2059
- i_x = singlediode_methods .bishop88_i_from_v (
2019
+ i_x = pvlib . singlediode .bishop88_i_from_v (
2060
2020
v_oc / 2.0 , * args , method = method .lower ()
2061
2021
)
2062
- i_xx = singlediode_methods .bishop88_i_from_v (
2022
+ i_xx = pvlib . singlediode .bishop88_i_from_v (
2063
2023
(v_oc + v_mp ) / 2.0 , * args , method = method .lower ()
2064
2024
)
2065
2025
@@ -2069,7 +2029,7 @@ def singlediode(photocurrent, saturation_current, resistance_series,
2069
2029
(11.0 - np .logspace (np .log10 (11.0 ), 0.0 ,
2070
2030
ivcurve_pnts )) / 10.0
2071
2031
)
2072
- ivcurve_i , ivcurve_v , _ = singlediode_methods .bishop88 (vd , * args )
2032
+ ivcurve_i , ivcurve_v , _ = pvlib . singlediode .bishop88 (vd , * args )
2073
2033
2074
2034
out = OrderedDict ()
2075
2035
out ['i_sc' ] = i_sc
@@ -2125,7 +2085,7 @@ def max_power_point(photocurrent, saturation_current, resistance_series,
2125
2085
curve. This function uses Brent's method by default because it is
2126
2086
guaranteed to converge.
2127
2087
"""
2128
- i_mp , v_mp , p_mp = singlediode_methods .bishop88_mpp (
2088
+ i_mp , v_mp , p_mp = pvlib . singlediode .bishop88_mpp (
2129
2089
photocurrent , saturation_current , resistance_series ,
2130
2090
resistance_shunt , nNsVth , method = method .lower ()
2131
2091
)
@@ -2205,7 +2165,7 @@ def v_from_i(resistance_shunt, resistance_series, nNsVth, current,
2205
2165
Energy Materials and Solar Cells, 81 (2004) 269-277.
2206
2166
'''
2207
2167
if method .lower () == 'lambertw' :
2208
- return singlediode_methods ._lambertw_v_from_i (
2168
+ return pvlib . singlediode ._lambertw_v_from_i (
2209
2169
resistance_shunt , resistance_series , nNsVth , current ,
2210
2170
saturation_current , photocurrent
2211
2171
)
@@ -2215,9 +2175,9 @@ def v_from_i(resistance_shunt, resistance_series, nNsVth, current,
2215
2175
# equation for the diode voltage V_d then backing out voltage
2216
2176
args = (current , photocurrent , saturation_current ,
2217
2177
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 ())
2219
2179
# 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 )
2221
2181
if size <= 1 :
2222
2182
if shape is not None :
2223
2183
V = np .tile (V , shape )
@@ -2293,7 +2253,7 @@ def i_from_v(resistance_shunt, resistance_series, nNsVth, voltage,
2293
2253
Energy Materials and Solar Cells, 81 (2004) 269-277.
2294
2254
'''
2295
2255
if method .lower () == 'lambertw' :
2296
- return singlediode_methods ._lambertw_i_from_v (
2256
+ return pvlib . singlediode ._lambertw_i_from_v (
2297
2257
resistance_shunt , resistance_series , nNsVth , voltage ,
2298
2258
saturation_current , photocurrent
2299
2259
)
@@ -2303,9 +2263,9 @@ def i_from_v(resistance_shunt, resistance_series, nNsVth, voltage,
2303
2263
# equation for the diode voltage V_d then backing out voltage
2304
2264
args = (voltage , photocurrent , saturation_current , resistance_series ,
2305
2265
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 ())
2307
2267
# 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 )
2309
2269
if size <= 1 :
2310
2270
if shape is not None :
2311
2271
I = np .tile (I , shape )
0 commit comments