19
19
from pvlib import tools
20
20
from pvlib .tools import _build_kwargs
21
21
from pvlib .location import Location
22
- from pvlib import irradiance , atmosphere
23
- import pvlib # use pvlib.singlediode to avoid clash with local method
22
+ from pvlib import irradiance , atmosphere , singlediode as _singlediode
24
23
25
24
26
25
# a dict of required parameter names for each DC power model
27
-
28
- DC_MODEL_PARAMS = {'sapm' :
29
- set (['A0' , 'A1' , 'A2' , 'A3' , 'A4' , 'B0' , 'B1' , 'B2' , 'B3' ,
30
- 'B4' , 'B5' , 'C0' , 'C1' , 'C2' , 'C3' , 'C4' , 'C5' , 'C6' ,
31
- 'C7' , 'Isco' , 'Impo' , 'Aisc' , 'Aimp' , 'Bvoco' ,
32
- 'Mbvoc' , 'Bvmpo' , 'Mbvmp' , 'N' , 'Cells_in_Series' ,
33
- 'IXO' , 'IXXO' , 'FD' ]),
34
- 'desoto' :
35
- set (['alpha_sc' , 'a_ref' , 'I_L_ref' , 'I_o_ref' ,
36
- 'R_sh_ref' , 'R_s' ]),
37
- 'pvsyst' :
38
- set (['gamma_ref' , 'mu_gamma' , 'I_L_ref' , 'I_o_ref' ,
39
- 'R_sh_ref' , 'R_sh_0' , 'R_s' , 'alpha_sc' , 'EgRef' ,
40
- 'cells_in_series' ]),
41
- 'singlediode' :
42
- set (['alpha_sc' , 'a_ref' , 'I_L_ref' , 'I_o_ref' ,
43
- 'R_sh_ref' , 'R_s' ]),
44
- 'pvwatts' :
45
- set (['pdc0' , 'gamma_pdc' ])
46
- }
26
+ DC_MODEL_PARAMS = {
27
+ 'sapm' : set ([
28
+ 'A0' , 'A1' , 'A2' , 'A3' , 'A4' , 'B0' , 'B1' , 'B2' , 'B3' ,
29
+ 'B4' , 'B5' , 'C0' , 'C1' , 'C2' , 'C3' , 'C4' , 'C5' , 'C6' ,
30
+ 'C7' , 'Isco' , 'Impo' , 'Aisc' , 'Aimp' , 'Bvoco' ,
31
+ 'Mbvoc' , 'Bvmpo' , 'Mbvmp' , 'N' , 'Cells_in_Series' ,
32
+ 'IXO' , 'IXXO' , 'FD' ]),
33
+ 'desoto' : set ([
34
+ 'alpha_sc' , 'a_ref' , 'I_L_ref' , 'I_o_ref' ,
35
+ 'R_sh_ref' , 'R_s' ]),
36
+ 'pvsyst' : set ([
37
+ 'gamma_ref' , 'mu_gamma' , 'I_L_ref' , 'I_o_ref' ,
38
+ 'R_sh_ref' , 'R_sh_0' , 'R_s' , 'alpha_sc' , 'EgRef' ,
39
+ 'cells_in_series' ]),
40
+ 'singlediode' : set ([
41
+ 'alpha_sc' , 'a_ref' , 'I_L_ref' , 'I_o_ref' ,
42
+ 'R_sh_ref' , 'R_s' ]),
43
+ 'pvwatts' : set (['pdc0' , 'gamma_pdc' ])
44
+ }
47
45
48
46
49
47
# not sure if this belongs in the pvsystem module.
@@ -2019,7 +2017,7 @@ def singlediode(photocurrent, saturation_current, resistance_series,
2019
2017
# Calculate points on the IV curve using the LambertW solution to the
2020
2018
# single diode equation
2021
2019
if method .lower () == 'lambertw' :
2022
- out = pvlib . singlediode ._lambertw (
2020
+ out = _singlediode ._lambertw (
2023
2021
photocurrent , saturation_current , resistance_series ,
2024
2022
resistance_shunt , nNsVth , ivcurve_pnts
2025
2023
)
@@ -2032,19 +2030,19 @@ def singlediode(photocurrent, saturation_current, resistance_series,
2032
2030
# equation for the diode voltage V_d then backing out voltage
2033
2031
args = (photocurrent , saturation_current , resistance_series ,
2034
2032
resistance_shunt , nNsVth ) # collect args
2035
- v_oc = pvlib . singlediode .bishop88_v_from_i (
2033
+ v_oc = _singlediode .bishop88_v_from_i (
2036
2034
0.0 , * args , method = method .lower ()
2037
2035
)
2038
- i_mp , v_mp , p_mp = pvlib . singlediode .bishop88_mpp (
2036
+ i_mp , v_mp , p_mp = _singlediode .bishop88_mpp (
2039
2037
* args , method = method .lower ()
2040
2038
)
2041
- i_sc = pvlib . singlediode .bishop88_i_from_v (
2039
+ i_sc = _singlediode .bishop88_i_from_v (
2042
2040
0.0 , * args , method = method .lower ()
2043
2041
)
2044
- i_x = pvlib . singlediode .bishop88_i_from_v (
2042
+ i_x = _singlediode .bishop88_i_from_v (
2045
2043
v_oc / 2.0 , * args , method = method .lower ()
2046
2044
)
2047
- i_xx = pvlib . singlediode .bishop88_i_from_v (
2045
+ i_xx = _singlediode .bishop88_i_from_v (
2048
2046
(v_oc + v_mp ) / 2.0 , * args , method = method .lower ()
2049
2047
)
2050
2048
@@ -2054,7 +2052,7 @@ def singlediode(photocurrent, saturation_current, resistance_series,
2054
2052
(11.0 - np .logspace (np .log10 (11.0 ), 0.0 ,
2055
2053
ivcurve_pnts )) / 10.0
2056
2054
)
2057
- ivcurve_i , ivcurve_v , _ = pvlib . singlediode .bishop88 (vd , * args )
2055
+ ivcurve_i , ivcurve_v , _ = _singlediode .bishop88 (vd , * args )
2058
2056
2059
2057
out = OrderedDict ()
2060
2058
out ['i_sc' ] = i_sc
@@ -2110,7 +2108,7 @@ def max_power_point(photocurrent, saturation_current, resistance_series,
2110
2108
curve. This function uses Brent's method by default because it is
2111
2109
guaranteed to converge.
2112
2110
"""
2113
- i_mp , v_mp , p_mp = pvlib . singlediode .bishop88_mpp (
2111
+ i_mp , v_mp , p_mp = _singlediode .bishop88_mpp (
2114
2112
photocurrent , saturation_current , resistance_series ,
2115
2113
resistance_shunt , nNsVth , method = method .lower ()
2116
2114
)
@@ -2190,7 +2188,7 @@ def v_from_i(resistance_shunt, resistance_series, nNsVth, current,
2190
2188
Energy Materials and Solar Cells, 81 (2004) 269-277.
2191
2189
'''
2192
2190
if method .lower () == 'lambertw' :
2193
- return pvlib . singlediode ._lambertw_v_from_i (
2191
+ return _singlediode ._lambertw_v_from_i (
2194
2192
resistance_shunt , resistance_series , nNsVth , current ,
2195
2193
saturation_current , photocurrent
2196
2194
)
@@ -2200,9 +2198,9 @@ def v_from_i(resistance_shunt, resistance_series, nNsVth, current,
2200
2198
# equation for the diode voltage V_d then backing out voltage
2201
2199
args = (current , photocurrent , saturation_current ,
2202
2200
resistance_series , resistance_shunt , nNsVth )
2203
- V = pvlib . singlediode .bishop88_v_from_i (* args , method = method .lower ())
2201
+ V = _singlediode .bishop88_v_from_i (* args , method = method .lower ())
2204
2202
# find the right size and shape for returns
2205
- size , shape = pvlib . singlediode ._get_size_and_shape (args )
2203
+ size , shape = _singlediode ._get_size_and_shape (args )
2206
2204
if size <= 1 :
2207
2205
if shape is not None :
2208
2206
V = np .tile (V , shape )
@@ -2278,7 +2276,7 @@ def i_from_v(resistance_shunt, resistance_series, nNsVth, voltage,
2278
2276
Energy Materials and Solar Cells, 81 (2004) 269-277.
2279
2277
'''
2280
2278
if method .lower () == 'lambertw' :
2281
- return pvlib . singlediode ._lambertw_i_from_v (
2279
+ return _singlediode ._lambertw_i_from_v (
2282
2280
resistance_shunt , resistance_series , nNsVth , voltage ,
2283
2281
saturation_current , photocurrent
2284
2282
)
@@ -2288,9 +2286,9 @@ def i_from_v(resistance_shunt, resistance_series, nNsVth, voltage,
2288
2286
# equation for the diode voltage V_d then backing out voltage
2289
2287
args = (voltage , photocurrent , saturation_current , resistance_series ,
2290
2288
resistance_shunt , nNsVth )
2291
- I = pvlib . singlediode .bishop88_i_from_v (* args , method = method .lower ())
2289
+ I = _singlediode .bishop88_i_from_v (* args , method = method .lower ())
2292
2290
# find the right size and shape for returns
2293
- size , shape = pvlib . singlediode ._get_size_and_shape (args )
2291
+ size , shape = _singlediode ._get_size_and_shape (args )
2294
2292
if size <= 1 :
2295
2293
if shape is not None :
2296
2294
I = np .tile (I , shape )
0 commit comments