6
6
import logging
7
7
from collections import OrderedDict
8
8
import numpy as np
9
- from scipy .optimize import fminbound , newton
9
+ from scipy .optimize import fminbound
10
10
11
11
logging .basicConfig ()
12
12
LOGGER = logging .getLogger (__name__ )
16
16
DAMP = 1.5
17
17
DELTA = EPS ** 0.33
18
18
19
+ # TODO: make fast_i_from_v, fast_v_from_i, fast_mppt using newton
20
+ # TODO: remove grad calcs from bishop88
21
+ # TODO: add new residual and f_prime calcs for fast_ methods to use newton
22
+ # TODO: refactor singlediode to be a wrapper with a method argument
23
+ # TODO: update pvsystem.singlediode to use slow_ methods by default
24
+ # TODO: ditto for i_from_v and v_from_i
25
+ # TODO: add new mppt function to pvsystem
26
+
19
27
20
28
def est_voc (photocurrent , saturation_current , nNsVth ):
21
29
"""
22
30
Rough estimate of open circuit voltage useful for bounding searches for
23
31
``i`` of ``v`` when using :func:`~pvlib.way_faster`.
24
32
25
- :param photocurrent: photo-generated current [A]
26
- :param saturation_current: diode one reverse saturation current [A]
27
- :param nNsVth: product of thermal voltage ``Vth`` [V], diode ideality
28
- factor ``n``, and number of series cells ``Ns``
33
+ :param numeric photocurrent: photo-generated current [A]
34
+ :param numeric saturation_current: diode one reverse saturation current [A]
35
+ :param numeric nNsVth: product of thermal voltage ``Vth`` [V], diode
36
+ ideality factor ``n``, and number of series cells ``Ns``
29
37
:returns: rough estimate of open circuit voltage [V]
30
38
"""
31
39
# http://www.pveducation.org/pvcdrom/open-circuit-voltage
@@ -42,13 +50,13 @@ def bishop88(vd, photocurrent, saturation_current, resistance_series,
42
50
photovoltaic cell interconnection circuits" JW Bishop, Solar Cell (1988)
43
51
https://doi.org/10.1016/0379-6787(88)90059-2
44
52
45
- :param vd: diode voltages [V} ]
46
- :param photocurrent: photo-generated current [A]
47
- :param saturation_current: diode one reverse saturation current [A]
48
- :param resistance_series: series resitance [ohms]
49
- :param resistance_shunt: shunt resitance [ohms]
50
- :param nNsVth" product of thermal voltage ``Vth`` [V], diode ideality
51
- factor ``n``, and number of series cells ``Ns``
53
+ :param numeric vd: diode voltages [V]
54
+ :param numeric photocurrent: photo-generated current [A]
55
+ :param numeric saturation_current: diode one reverse saturation current [A]
56
+ :param numeric resistance_series: series resitance [ohms]
57
+ :param numeric resistance_shunt: shunt resitance [ohms]
58
+ :param numeric nNsVth: product of thermal voltage ``Vth`` [V], diode
59
+ ideality factor ``n``, and number of series cells ``Ns``
52
60
:returns: tuple containing currents [A], voltages [V], gradient ``di/dvd``,
53
61
gradient ``dv/dvd``, power [W], gradient ``dp/dv``, and gradient
54
62
``d2p/dv/dvd``
@@ -169,9 +177,8 @@ def faster_way(photocurrent, saturation_current, resistance_series,
169
177
voc_est , newton_step , i_test , v_test , resnorm
170
178
)
171
179
if test :
172
- delta = EPS ** 0.3
173
- i_test2 , _ , _ , _ , _ , _ , _ = bishop88 (voc_est * (1.0 + delta ), * args )
174
- LOGGER .debug ('test_grad=%g' , (i_test2 - i_test ) / voc_est / delta )
180
+ i_test2 , _ , _ , _ , _ , _ , _ = bishop88 (voc_est * (1.0 + DELTA ), * args )
181
+ LOGGER .debug ('test_grad=%g' , (i_test2 - i_test ) / voc_est / DELTA )
175
182
LOGGER .debug ('grad=%g' , grad )
176
183
# find isc too
177
184
isc_est = 0.0
@@ -191,9 +198,8 @@ def faster_way(photocurrent, saturation_current, resistance_series,
191
198
vd_sc , newton_step , isc_est , v_test , resnorm
192
199
)
193
200
if test :
194
- delta = EPS ** 0.3
195
- _ , v_test2 , _ , _ , _ , _ , _ = bishop88 (vd_sc * (1.0 + delta ), * args )
196
- LOGGER .debug ('test_grad=%g' , (v_test2 - v_test ) / vd_sc / delta )
201
+ _ , v_test2 , _ , _ , _ , _ , _ = bishop88 (vd_sc * (1.0 + DELTA ), * args )
202
+ LOGGER .debug ('test_grad=%g' , (v_test2 - v_test ) / vd_sc / DELTA )
197
203
LOGGER .debug ('grad=%g' , grad )
198
204
# find the mpp
199
205
imp_est , vmp_est , pmp_est = 0.0 , 0.0 , 0.0
@@ -213,9 +219,8 @@ def faster_way(photocurrent, saturation_current, resistance_series,
213
219
vd_mp , newton_step , pmp_est , resnorm
214
220
)
215
221
if test :
216
- delta = EPS ** 0.3
217
- _ , _ , _ , _ , _ , grad_p2 , _ = bishop88 (vd_mp * (1.0 + delta ), * args )
218
- LOGGER .debug ('test_grad=%g' , (grad_p2 - grad_p ) / vd_mp / delta )
222
+ _ , _ , _ , _ , _ , grad_p2 , _ = bishop88 (vd_mp * (1.0 + DELTA ), * args )
223
+ LOGGER .debug ('test_grad=%g' , (grad_p2 - grad_p ) / vd_mp / DELTA )
219
224
LOGGER .debug ('grad=%g' , grad2p )
220
225
out = OrderedDict ()
221
226
out ['i_sc' ] = isc_est
0 commit comments