Skip to content

Commit ac500d5

Browse files
committed
remove switch between find_minimum and golden mean
1 parent c62e6d1 commit ac500d5

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

pvlib/singlediode.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,6 @@ def _lambertw(photocurrent, saturation_current, resistance_series,
914914

915915
# Find the voltage, v_mp, where the power is maximized.
916916
# use scipy.elementwise if available
917-
use_gs = False
918917
try:
919918
from scipy.optimize.elementwise import find_minimum
920919
init = (0., 0.8*v_oc, 1.01*v_oc)
@@ -924,16 +923,10 @@ def _lambertw(photocurrent, saturation_current, resistance_series,
924923
params['resistance_series'],
925924
params['resistance_shunt'],
926925
params['nNsVth'],))
927-
if res.success.all():
928-
v_mp = res.x
929-
p_mp = -1.*res.f_x
930-
else:
931-
use_gs = True
926+
v_mp = res.x
927+
p_mp = -1.*res.f_x
932928
except ModuleNotFoundError:
933-
use_gs = True
934-
935-
if use_gs:
936-
# gracefully switch to old golden section method
929+
# switch to old golden section method
937930
p_mp, v_mp = _golden_sect_DataFrame(params, 0., v_oc * 1.14, _pwr_optfcn)
938931

939932
# Find Imp using Lambert W
@@ -960,7 +953,7 @@ def _lambertw(photocurrent, saturation_current, resistance_series,
960953

961954
def _vmp_opt(v, iph, io, rs, rsh, nNsVth):
962955
'''
963-
Function to find power from ``i_from_v``.
956+
Function to find negative of power from ``i_from_v``.
964957
'''
965958
current = _lambertw_i_from_v(v, iph, io, rs, rsh, nNsVth)
966959

0 commit comments

Comments
 (0)