|
8 | 8 |
|
9 | 9 | import numpy as np |
10 | 10 |
|
11 | | -import scipy.constants |
| 11 | +from scipy import constants |
12 | 12 | from scipy import optimize |
13 | 13 | from scipy.special import lambertw |
14 | 14 | from scipy.misc import derivative |
|
20 | 20 | from pvlib.ivtools.sde import _fit_sandia_cocontent |
21 | 21 |
|
22 | 22 |
|
| 23 | +CONSTANTS = {'E0': 1000.0, 'T0': 25.0, 'k': constants.k, 'q': constants.e} |
| 24 | + |
| 25 | + |
23 | 26 | def fit_cec_sam(celltype, v_mp, i_mp, v_oc, i_sc, alpha_sc, beta_voc, |
24 | 27 | gamma_pmp, cells_in_series, temp_ref=25): |
25 | 28 | """ |
@@ -204,7 +207,7 @@ def fit_desoto(v_mp, i_mp, v_oc, i_sc, alpha_sc, beta_voc, cells_in_series, |
204 | 207 | """ |
205 | 208 |
|
206 | 209 | # Constants |
207 | | - k = scipy.constants.value('Boltzmann constant in eV/K') |
| 210 | + k = constants.value('Boltzmann constant in eV/K') # in eV/K |
208 | 211 | Tref = temp_ref + 273.15 # [K] |
209 | 212 |
|
210 | 213 | # initial guesses of variables for computing convergence: |
@@ -340,9 +343,9 @@ def fit_pvsyst_sandia(ivcurves, specs, const=None, maxiter=5, eps1=1.e-3): |
340 | 343 | T0 : float |
341 | 344 | cell temperature at STC, default 25 [C] |
342 | 345 | k : float |
343 | | - 1.38066E-23 J/K (Boltzmann's constant) |
| 346 | + Boltzmann's constant [J/K] |
344 | 347 | q : float |
345 | | - 1.60218E-19 Coulomb (elementary charge) |
| 348 | + elementary charge [Coulomb] |
346 | 349 |
|
347 | 350 | maxiter : int, default 5 |
348 | 351 | input that sets the maximum number of iterations for the parameter |
@@ -417,7 +420,7 @@ def fit_pvsyst_sandia(ivcurves, specs, const=None, maxiter=5, eps1=1.e-3): |
417 | 420 | """ |
418 | 421 |
|
419 | 422 | if const is None: |
420 | | - const = {'E0': 1000.0, 'T0': 25.0, 'k': 1.38066e-23, 'q': 1.60218e-19} |
| 423 | + const = CONSTANTS |
421 | 424 |
|
422 | 425 | ee = ivcurves['ee'] |
423 | 426 | tc = ivcurves['tc'] |
@@ -520,9 +523,9 @@ def fit_desoto_sandia(ivcurves, specs, const=None, maxiter=5, eps1=1.e-3): |
520 | 523 | T0 : float |
521 | 524 | cell temperature at STC, default 25 [C] |
522 | 525 | k : float |
523 | | - 1.38066E-23 J/K (Boltzmann's constant) |
| 526 | + Boltzmann's constant [J/K] |
524 | 527 | q : float |
525 | | - 1.60218E-19 Coulomb (elementary charge) |
| 528 | + elementary charge [Coulomb] |
526 | 529 |
|
527 | 530 | maxiter : int, default 5 |
528 | 531 | input that sets the maximum number of iterations for the parameter |
@@ -579,7 +582,7 @@ def fit_desoto_sandia(ivcurves, specs, const=None, maxiter=5, eps1=1.e-3): |
579 | 582 | """ |
580 | 583 |
|
581 | 584 | if const is None: |
582 | | - const = {'E0': 1000.0, 'T0': 25.0, 'k': 1.38066e-23, 'q': 1.60218e-19} |
| 585 | + const = CONSTANTS |
583 | 586 |
|
584 | 587 | ee = ivcurves['ee'] |
585 | 588 | tc = ivcurves['tc'] |
|
0 commit comments