Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ENH: Port PVsyst and Desoto parameter estimation from MATLAB #708

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

Merged
merged 148 commits into from
Aug 28, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
c00d419
ENH: porting pvsyst and single diode param est
Aug 1, 2016
e3d8235
change function name from est_single_diode_params
mikofski Oct 4, 2018
99d2f3f
use int indices, make docstring, test still fails
mikofski May 4, 2019
55d1c0b
isolate iv fitting and parameter generation
mikofski May 4, 2019
857d896
TST: schumaker test is passing! Yoohoo!
mikofski May 4, 2019
0433136
TST: fix imports and path to test data
mikofski May 4, 2019
1d418dd
fix Io test sortof, some stickler
mikofski May 4, 2019
1a055e7
Merge branch 'master' into pvsyst_parameter_estimation
mikofski Dec 4, 2019
a1bdf55
fix tests, merge ivtools
mikofski Dec 5, 2019
b886dc8
fixing test_PVsyst_parameter_estimation
mikofski Dec 5, 2019
db58d39
include statsmodels and mpl in ci/conda-envs
mikofski Dec 5, 2019
f19f1de
stickler fixes, long lines, code tweaks
mikofski Dec 5, 2019
2875438
rename update io and rsh tests so they run
mikofski Dec 5, 2019
5252c8a
concise indexing in Schumaker QSpline
mikofski Dec 5, 2019
38ee9b8
add test for numdiff
mikofski Dec 5, 2019
90bb48b
move pvsyst parameter estimation tests
mikofski Dec 5, 2019
4e27551
use maximum not max in estRsh
mikofski Dec 5, 2019
2faed73
fudge tolerance for pvsyst_parameter_estimation for fun
mikofski Dec 5, 2019
aa1210b
restrict pvsyst estimation test to first 3000 points
mikofski Dec 5, 2019
b59227e
rename pvsyst parameter estimation tests folder
mikofski Dec 5, 2019
de85d38
move test_numdiff inside test_pvsyst_parameter_estimation.py
mikofski Dec 5, 2019
82d452d
add requires_scipy to update_io_know_n tests
mikofski Dec 6, 2019
d6622f5
pycodestyle passing, rm xtra sp, fix indent
mikofski Dec 6, 2019
18e2cb6
shuffle functions into different modules. Rename to fit_sdX_ pattern
cwhanse Dec 9, 2019
9268fe8
fix import names
cwhanse Dec 9, 2019
836a9b5
fix import in ivtools
mikofski Dec 9, 2019
edf872c
refactor deux: rm old files
mikofski Dec 17, 2019
8b2d102
remove old pvsyst parma estimation tests
mikofski Dec 17, 2019
d9abba1
stickler fixes
mikofski Dec 17, 2019
1508b1d
Merge branch 'master' into pvsyst_parameter_estimation
mikofski Dec 17, 2019
152dd24
Merge branch 'master' into pvsyst_parameter_estimation
mikofski Dec 17, 2019
9b56560
using lambertw requires scipy in tests
mikofski Dec 17, 2019
a7dfe45
align with scipy.intepolate pattern
cwhanse Dec 18, 2019
8d67a97
refactor fit_sde_cocontent, change argument order
cwhanse Dec 18, 2019
780db42
stickler
cwhanse Dec 18, 2019
5207c60
fix argument order in fit_pvsyst_sandia
cwhanse Dec 19, 2019
b5270da
fix rectify function, add test
cwhanse Dec 20, 2019
47e4465
stickler
cwhanse Dec 20, 2019
1e1496c
corrections, add rcond=None
cwhanse Dec 20, 2019
98bcc25
more corrections
cwhanse Dec 20, 2019
a9c908d
undo change in rs, rsh order
cwhanse Dec 20, 2019
b2cbb11
fix test for rectify_iv_curve, use np.expm1
cwhanse Dec 20, 2019
2e973fe
exclude curve #2540
cwhanse Dec 20, 2019
383a1f8
fix expected outcome for test_rectify_
cwhanse Dec 20, 2019
e22942f
messed up csv
cwhanse Dec 20, 2019
1484e39
exclude curve #2540
cwhanse Dec 20, 2019
7f90f26
correct rounding for test_rectify_
cwhanse Dec 23, 2019
9c00ac8
move exclude to line 2540 was on 2536
cwhanse Dec 23, 2019
d52dade
create exclude mask for individual curves
cwhanse Dec 23, 2019
f934275
use umask
cwhanse Dec 23, 2019
ed378ac
helper functions, some streamlining
cwhanse Dec 23, 2019
41ca062
rename _update_io_known_n
cwhanse Dec 23, 2019
de1b493
docstring improvements
cwhanse Dec 24, 2019
e202506
split _calc_theta_phi_exact, overhaul tests
cwhanse Dec 24, 2019
d3baff3
remove unused lines
cwhanse Dec 25, 2019
08a5627
stickler
cwhanse Dec 25, 2019
a8059cb
remove test_ivtools.py
cwhanse Dec 25, 2019
9fc68b5
renaming, update api.rst
cwhanse Dec 25, 2019
e1544a3
update name
cwhanse Dec 25, 2019
0626805
improve _update_rsh_fixed_pt
cwhanse Dec 26, 2019
fdc0e66
fix typo
cwhanse Dec 26, 2019
8465bc0
fix error
cwhanse Dec 26, 2019
82669f4
correct convergence in _update_rsh_fixed_pt
cwhanse Dec 30, 2019
027f2ee
flake8
cwhanse Dec 30, 2019
5e7cc77
docstring for fit_sdm
cwhanse Jan 1, 2020
6ae5927
docstring for fit_sdm
cwhanse Jan 1, 2020
0a6fcab
docstring for fit_sdm
cwhanse Jan 1, 2020
317b92c
docstring for fit_sdm
cwhanse Jan 2, 2020
385a14b
docstring for fit_sde, utility
cwhanse Jan 2, 2020
0f7fab2
update api.rst
cwhanse Jan 2, 2020
11c98e5
add helper to deal with numpy<1.14
cwhanse Jan 2, 2020
291e086
fix workaround for numpy version
cwhanse Jan 2, 2020
4e80ea1
rename modules and functions, move tests to ivtools/test
cwhanse Jan 17, 2020
a9a4b7a
merge master, fix conflict
cwhanse Jan 17, 2020
0450815
fix merge conflicts, contains duplicated files
cwhanse Jan 17, 2020
d547521
move tests from ivtools/test to pvlib/tests/ivtools
cwhanse Jan 17, 2020
e98652e
remove old test folder
cwhanse Jan 17, 2020
f5351a9
remove old pvlib/test folder
cwhanse Jan 17, 2020
6a413d2
name correction, remove old test files
cwhanse Jan 17, 2020
6fe3c33
fix test, move test_fit_sde_cocontent into test_sde
cwhanse Jan 19, 2020
9f2e474
move test_schumaker_qspline to test_utility
cwhanse Jan 19, 2020
104052b
docstring work
cwhanse Jan 19, 2020
4392f70
resolve conflict
cwhanse Jan 19, 2020
ab31257
docstring work
cwhanse Jan 19, 2020
6c7c071
test corrections
cwhanse Jan 19, 2020
8d1b8b0
fix order in parametrize
cwhanse Jan 20, 2020
5e18986
one comma
cwhanse Jan 20, 2020
f08e1f6
corrections
cwhanse Jan 20, 2020
ea6a157
remove old files, update api.rst
cwhanse Jan 20, 2020
f7911fc
update names in ivtools\__init__.py
cwhanse Jan 20, 2020
488726d
docstring work, rename outputs from fit_pvsyst_sandia to be consisten…
cwhanse Jan 20, 2020
949aad7
docstring work, use cells_in_series throughout
cwhanse Jan 20, 2020
499ff7b
docstring work, use mu_gamma instead of mugamma
cwhanse Jan 20, 2020
a1ddcf9
missed one
cwhanse Jan 20, 2020
09127c6
sort of Rs vs R_s vs R_s_ref
cwhanse Jan 21, 2020
27e4200
refactor to prepare for adding desoto, cec estimation; remove logging
cwhanse Jan 22, 2020
0e4485b
merge
cwhanse Jan 22, 2020
f5b7ee4
add fit_desoto_sandia
cwhanse Jan 22, 2020
182f95b
correct argument order, lint
cwhanse Jan 22, 2020
987257d
change to pvlib-consistent key names
cwhanse Jan 22, 2020
37ee5d9
add test for fit_desoto_sandia
cwhanse Jan 22, 2020
d4c1950
corrections
cwhanse Jan 22, 2020
a2423e5
more corrections
cwhanse Jan 22, 2020
59f69be
use canonical order iph, io, rs, rsh, n
cwhanse Jan 23, 2020
15d4d6b
convert update_rsh test, move to test_sdm.py
cwhanse Jan 23, 2020
e168ead
fix update_rsh tests, improve function
cwhanse Jan 23, 2020
e605483
remove old update_rsh test file
cwhanse Jan 23, 2020
a33fed7
convert tests for _update_io
cwhanse Jan 23, 2020
9f8a0e1
remove old tests for _update_io
cwhanse Jan 23, 2020
64a51c1
convert tests for calc_theta_phi
cwhanse Jan 23, 2020
89d6442
remove old test for calc_theta
cwhanse Jan 23, 2020
6c45599
take care of float div by 0 test failures
cwhanse Jan 23, 2020
579b80d
move sde functions to canonical argument order
cwhanse Jan 23, 2020
d5ace89
fix bugs
cwhanse Jan 23, 2020
88c8995
more raid for bugs
cwhanse Jan 23, 2020
cad323b
die bugs die
cwhanse Jan 24, 2020
20b7e6d
maintain order of variables in the text file
cwhanse Jan 24, 2020
64a9fe5
test repair
cwhanse Jan 26, 2020
d44dbe7
minor editing
cwhanse Jan 26, 2020
83a2c30
pin pysam version to 1.2.1
cwhanse Jan 28, 2020
d0aed99
pysam to current version, patch over numpy 1.14 change
cwhanse Jan 28, 2020
22e8b7e
module docstring
cwhanse May 4, 2020
bb2af7e
Merge branch 'pvsyst_parameter_estimation' of https://github.com/miko…
cwhanse May 4, 2020
0f9896a
Merge remote-tracking branch 'upstream/master' into pvsyst_parameter_…
cwhanse May 4, 2020
d3a52e3
remove ivtools.py
cwhanse May 4, 2020
adb8290
separate sam_estimate_failure into its own function
cwhanse May 4, 2020
5bd14c7
Merge branch 'master' of https://github.com/pvlib/pvlib-python into p…
cwhanse Jun 10, 2020
157c2ab
Merge branch 'master' of https://github.com/pvlib/pvlib-python into p…
cwhanse Aug 24, 2020
a5d5ffa
fix stickler
cwhanse Aug 24, 2020
f46287e
'mispelling'
cwhanse Aug 24, 2020
c8b4b00
fix error in _calc_I0
cwhanse Aug 25, 2020
eea759b
more fixing of that error
cwhanse Aug 25, 2020
fa8d8a6
improvements from review
cwhanse Aug 25, 2020
944c16b
another fix for mistake in _calc_I0
cwhanse Aug 25, 2020
eb8d986
docstring edits
cwhanse Aug 25, 2020
8cc8249
improve coverage
cwhanse Aug 26, 2020
fce9b04
tpo
cwhanse Aug 26, 2020
b548f63
use the correct error Class
cwhanse Aug 26, 2020
df7520e
improvements from review
cwhanse Aug 27, 2020
cad96ef
changes from review: helper functions for test, _numdiff and _schum p…
cwhanse Aug 28, 2020
4831cfd
whatsnew
cwhanse Aug 28, 2020
83308a3
Merge branch 'master' of https://github.com/pvlib/pvlib-python into p…
cwhanse Aug 28, 2020
a1dc575
add renamed and moved data files
cwhanse Aug 28, 2020
ab4f99b
use pathlib.Path.open()
cwhanse Aug 28, 2020
cad3949
duh
cwhanse Aug 28, 2020
6866922
add return, doing three things at once = poor quality
cwhanse Aug 28, 2020
e9dba7d
add statsmodels for py38, fix dict declarations
cwhanse Aug 28, 2020
0c41ed2
()
cwhanse Aug 28, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
docstring improvements
  • Loading branch information
cwhanse committed Dec 24, 2019
commit de1b493219d4c39ed6ea7d3515c933dbbe0fe039
19 changes: 10 additions & 9 deletions 19 pvlib/ivtools/fit_sde.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
def fit_sde_sandia(voltage, current, v_oc=None, i_sc=None, v_mp_i_mp=None,
vlim=0.2, ilim=0.1):
r"""
Fits the single diode equation (SDE) to an IV curve.
Fits the single diode equation (SDE) [1]_ to an IV curve. Uses the method
described in [2]_.

Parameters
----------
Expand Down Expand Up @@ -136,11 +137,11 @@ def fit_sde_sandia(voltage, current, v_oc=None, i_sc=None, v_mp_i_mp=None,

References
----------
[1] S.R. Wenham, M.A. Green, M.E. Watt, "Applied Photovoltaics" ISBN
0 86758 909 4
[2] C. B. Jones, C. W. Hansen, Single Diode Parameter Extraction from
In-Field Photovoltaic I-V Curves on a Single Board Computer, 46th IEEE
Photovoltaic Specialist Conference, Chicago, IL, 2019
.. [1] S.R. Wenham, M.A. Green, M.E. Watt, "Applied Photovoltaics" ISBN
0 86758 909 4
. [2] C. B. Jones, C. W. Hansen, Single Diode Parameter Extraction from
In-Field Photovoltaic I-V Curves on a Single Board Computer, 46th IEEE
Photovoltaic Specialist Conference, Chicago, IL, 2019
"""

# If not provided, extract v_oc, i_sc, v_mp and i_mp from the IV curve data
Expand Down Expand Up @@ -191,7 +192,7 @@ def _find_mp(voltage, current):


def _sandia_beta0_beta1(v, i, vlim, v_oc):
# Used by fit_sde_sandia.
# Helper for fit_sde_sandia.
# Get intercept and slope of linear portion of IV curve.
# Start with V =< vlim * v_oc, extend by adding points until slope is
# negative (downward).
Expand All @@ -214,7 +215,7 @@ def _sandia_beta0_beta1(v, i, vlim, v_oc):


def _sandia_beta3_beta4(voltage, current, beta0, beta1, ilim, i_sc):
# Used by fit_sde_sandia.
# Helper for fit_sde_sandia.
# Subtract the IV curve from the linear fit.
y = beta0 - beta1 * voltage - current
x = np.array([np.ones_like(voltage), voltage, current]).T
Expand All @@ -232,7 +233,7 @@ def _sandia_beta3_beta4(voltage, current, beta0, beta1, ilim, i_sc):


def _sandia_calc_sde_params(beta0, beta1, beta3, beta4, v_mp, i_mp, v_oc):
# Used by fit_sde_sandia.
# Helper for fit_sde_sandia.
nNsVth = 1.0 / beta3
Rs = beta4 / beta3
Gp = beta1 / (1.0 - Rs * beta1)
Expand Down
126 changes: 66 additions & 60 deletions 126 pvlib/ivtools/fit_sdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def fit_sdm_cec_sam(celltype, v_mp, i_mp, v_oc, i_sc, alpha_sc, beta_voc,
gamma_pmp, cells_in_series, temp_ref=25):
"""
Estimates parameters for the CEC single diode model (SDM) using the SAM
SDK.
SDK. Uses the method described in [1]_.

Parameters
----------
Expand Down Expand Up @@ -91,9 +91,9 @@ def fit_sdm_cec_sam(celltype, v_mp, i_mp, v_oc, i_sc, alpha_sc, beta_voc,

References
----------
[1] A. Dobos, "An Improved Coefficient Calculator for the California
Energy Commission 6 Parameter Photovoltaic Module Model", Journal of
Solar Energy Engineering, vol 134, 2012.
.. [1] A. Dobos, "An Improved Coefficient Calculator for the California
Energy Commission 6 Parameter Photovoltaic Module Model", Journal of
Solar Energy Engineering, vol 134, 2012.
"""

try:
Expand All @@ -120,12 +120,12 @@ def fit_sdm_desoto(v_mp, i_mp, v_oc, i_sc, alpha_sc, beta_voc,
cells_in_series, EgRef=1.121, dEgdT=-0.0002677,
temp_ref=25, irrad_ref=1000, root_kwargs={}):
"""
Calculates the parameters for the De Soto single diode model using the
procedure described in [1]. This procedure has the advantage of
Calculates the parameters for the De Soto single diode model [1]_ using the
procedure described in [2]_. This procedure has the advantage of
using common specifications given by manufacturers in the
datasheets of PV modules.

The solution is found using the scipy.optimize.root() function,
The solution is found using ``scipy.optimize.root``,
with the corresponding default solver method 'hybr'.
No restriction is put on the fit variables, i.e. series
or shunt resistance could go negative. Nevertheless, if it happens,
Expand All @@ -134,7 +134,7 @@ def fit_sdm_desoto(v_mp, i_mp, v_oc, i_sc, alpha_sc, beta_voc,
in A/K and V/K here.

The parameters returned by this function can be used by
pvsystem.calcparams_desoto to calculate the values at different
``pvsystem.calcparams_desoto`` to calculate the values at different
irradiance and cell temperature.

Parameters
Expand Down Expand Up @@ -201,12 +201,12 @@ def fit_sdm_desoto(v_mp, i_mp, v_oc, i_sc, alpha_sc, beta_voc,

References
----------
[1] W. De Soto et al., "Improvement and validation of a model for
photovoltaic array performance", Solar Energy, vol 80, pp. 78-88,
2006.
.. [1] W. De Soto et al., "Improvement and validation of a model for
photovoltaic array performance", Solar Energy, vol 80, pp. 78-88,
2006.

[2] John A Duffie, William A Beckman, "Solar Engineering of Thermal
Processes", Wiley, 2013
.. [2] John A Duffie, William A Beckman, "Solar Engineering of Thermal
Processes", Wiley, 2013
"""

try:
Expand Down Expand Up @@ -278,12 +278,12 @@ def _system_of_equations_desoto(params, specs):

References
----------
[1] W. De Soto et al., "Improvement and validation of a model for
photovoltaic array performance", Solar Energy, vol 80, pp. 78-88,
2006.
.. [1] W. De Soto et al., "Improvement and validation of a model for
photovoltaic array performance", Solar Energy, vol 80, pp. 78-88,
2006.

[2] John A Duffie, William A Beckman, "Solar Engineering of Thermal
Processes", Wiley, 2013
.. [2] John A Duffie, William A Beckman, "Solar Engineering of Thermal
Processes", Wiley, 2013
"""

# six input known variables
Expand Down Expand Up @@ -326,7 +326,7 @@ def _system_of_equations_desoto(params, specs):
def fit_pvsyst_sandia(ivcurves, specs, const=constants, maxiter=5,
eps1=1.e-3):
"""
Estimate parameters for the PVsyst module performance model
Estimate parameters for the PVsyst module performance model.

Parameters
----------
Expand Down Expand Up @@ -392,27 +392,28 @@ def fit_pvsyst_sandia(ivcurves, specs, const=constants, maxiter=5,

Description
-----------
pvsyst_paramter_estimation estimates parameters for the PVsyst module
performance model [2,3,4]. Estimation methods are documented in [5,6,7].
``pvsyst_paramter_estimation`` estimates parameters for the PVsyst module
performance model [1]_, [2]_, [3]_. Estimation methods are documented in
[4]_, [5]_, [6]_. Ported from PVLib Matlab [7]_.

References
----------
[1] PVLib MATLAB
[2] K. Sauer, T. Roessler, C. W. Hansen, Modeling the Irradiance and
Temperature Dependence of Photovoltaic Modules in PVsyst, IEEE Journal
of Photovoltaics v5(1), January 2015.
[3] A. Mermoud, PV Modules modeling, Presentation at the 2nd PV Performance
Modeling Workshop, Santa Clara, CA, May 2013
[4] A. Mermoud, T. Lejeuene, Performance Assessment of a Simulation Model
for PV modules of any available technology, 25th European Photovoltaic
Solar Energy Conference, Valencia, Spain, Sept. 2010
[5] C. Hansen, Estimating Parameters for the PVsyst Version 6 Photovoltaic
Module Performance Model, Sandia National Laboratories Report
SAND2015-8598
[6] C. Hansen, Parameter Estimation for Single Diode Models of Photovoltaic
Modules, Sandia National Laboratories Report SAND2015-2065
[7] C. Hansen, Estimation of Parameters for Single Diode Models using
Measured IV Curves, Proc. of the 39th IEEE PVSC, June 2013.
.. [1] K. Sauer, T. Roessler, C. W. Hansen, Modeling the Irradiance and
Temperature Dependence of Photovoltaic Modules in PVsyst, IEEE Journal
of Photovoltaics v5(1), January 2015.
.. [2] A. Mermoud, PV Modules modeling, Presentation at the 2nd PV Performance
Modeling Workshop, Santa Clara, CA, May 2013
.. [3] A. Mermoud, T. Lejeuene, Performance Assessment of a Simulation Model
for PV modules of any available technology, 25th European Photovoltaic
Solar Energy Conference, Valencia, Spain, Sept. 2010
.. [4] C. Hansen, Estimating Parameters for the PVsyst Version 6 Photovoltaic
Module Performance Model, Sandia National Laboratories Report
SAND2015-8598
.. [5] C. Hansen, Parameter Estimation for Single Diode Models of Photovoltaic
Modules, Sandia National Laboratories Report SAND2015-2065
.. [6] C. Hansen, Estimation of Parameters for Single Diode Models using
Measured IV Curves, Proc. of the 39th IEEE PVSC, June 2013.
.. [7] PVLib MATLAB https://github.com/sandialabs/MATLAB_PV_LIB
"""

logging.basicConfig()
Expand Down Expand Up @@ -670,6 +671,8 @@ def _fit_pvsyst_sandia_gamma(isc, voc, rsh, vth, tck, const, specs):
# Estimate the diode factor gamma from Isc-Voc data. Method incorporates
# temperature dependence by means of the equation for Io

# Helper function for fit_pvsyst_sandia

y = np.log(isc - voc / rsh) - 3. * np.log(tck / (const['T0'] + 273.15))
x1 = const['q'] / const['k'] * (1. / (const['T0'] + 273.15) - 1. / tck)
x2 = voc / (vth * specs['ns'])
Expand Down Expand Up @@ -716,15 +719,15 @@ def _update_io(rsh, rs, nnsvth, io, il, voc):

Returns
-------
outio - a numpy array of lenght N of updated values for Io
next_io: a numpy array of lenght N of updated values for Io

References
----------
[1] PVLib MATLAB
[2] C. Hansen, Parameter Estimation for Single Diode Models of Photovoltaic
Modules, Sandia National Laboratories Report SAND2015-XXXX
[3] C. Hansen, Estimation of Parameteres for Single Diode Models using
Measured IV Curves, Proc. of the 39th IEEE PVSC, June 2013.
.. [1] C. Hansen, Parameter Estimation for Single Diode Models of
Photovoltaic Modules, Sandia National Laboratories Report SAND2015-2065
.. [2] C. Hansen, Estimation of Parameters for Single Diode Models using
Measured IV Curves, Proc. of the 39th IEEE PVSC, June 2013.
.. [3] PVLib MATLAB https://github.com/sandialabs/MATLAB_PV_LIB
"""

eps = 1e-6
Expand All @@ -747,10 +750,9 @@ def _update_io(rsh, rs, nnsvth, io, il, voc):
# Calculate Maximum Percent Difference
maxerr = np.max(np.abs(next_io - tio) / tio) * 100.
tio = next_io
k += 1.
k += 1

outio = tio
return outio
return next_io


def _rsh_pvsyst(x, rshexp, g, go):
Expand All @@ -773,6 +775,8 @@ def _filter_params(io, rsh, rs, ee, isc):
# where effective irradiance Ee differs by more than 5% from a linear fit
# to Isc vs. Ee

# Helper function for fit_pvsyst_sandia

badrsh = np.logical_or(rsh < 0., np.isnan(rsh))
negrs = rs < 0.
badrs = np.logical_or(rs > rsh, np.isnan(rs))
Expand Down Expand Up @@ -928,9 +932,11 @@ def _update_rsh_fixed_pt(rsh, rs, io, il, nnsvth, imp, vmp):

References
----------
[1] PVL MATLAB
[2] C. Hansen, Parameter Estimation for Single Diode Models of Photovoltaic
Modules, Sandia National Laboratories Report SAND2015-XXXX
.. [1] C. Hansen, Parameter Estimation for Single Diode Models of
Photovoltaic Modules, Sandia National Laboratories Report SAND2015-2065
.. [2] C. Hansen, Estimation of Parameters for Single Diode Models using
Measured IV Curves, Proc. of the 39th IEEE PVSC, June 2013.
.. [3] PVLib MATLAB https://github.com/sandialabs/MATLAB_PV_LIB
"""
niter = 500
x1 = rsh
Expand Down Expand Up @@ -976,19 +982,19 @@ def _calc_theta_phi_exact(imp, il, vmp, io, nnsvth, rs, rsh):

Returns
-------
theta: a numpy array of values for the Lamber W function for solving
theta: a numpy array of values for the Lambert W function for solving
I = I(V)
phi: a numpy array of values for the Lambert W function for solving
V = V(I)

References
----------
[1] PVLib MATLAB
[2] C. Hansen, Parameter Estimation for Single Diode Models of Photovoltaic
Modules, Sandia National Laboratories Report SAND2015-XXXX
[3] A. Jain, A. Kapoor, "Exact analytical solutions of the parameters of
real solar cells using Lambert W-function", Solar Energy Materials and
Solar Cells, 81 (2004) 269-277.
.. [1] C. Hansen, Parameter Estimation for Single Diode Models of
Photovoltaic Modules, Sandia National Laboratories Report SAND2015-2065
.. [2] PVLib MATLAB https://github.com/sandialabs/MATLAB_PV_LIB
.. [3] A. Jain, A. Kapoor, "Exact analytical solutions of the parameters of
real solar cells using Lambert W-function", Solar Energy Materials and
Solar Cells, 81 (2004) 269-277.
"""

try:
Expand Down Expand Up @@ -1042,12 +1048,12 @@ def _calc_theta_phi_exact(imp, il, vmp, io, nnsvth, rs, rsh):
rsh / (rsh + rs) * (rs * (il + io) + vmp) / nnsvth))
u = argw > 0
w = np.zeros(len(u))
w[~u] = float("Nan")
if any(argw[u] == float("Inf")):
w[~u] = np.nan
if any(argw[u] == np.Inf):
tmp = []
for i in argw[u]:
if i == float("Inf"):
tmp.append(float("Nan"))
if i == np.Inf:
tmp.append(np.nan)
else:
tmp.append(lambertw(i).real)
tmp = np.array(tmp, dtype=float)
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.