@@ -3028,18 +3028,34 @@ def combine_loss_factors(index, *losses, fill_method='ffill'):
30283028
30293029def _negative_total_power (current , * args ):
30303030 """
3031- Compute negative of total power generated by devices in series at specified current.
3031+ Compute negative of total power generated by devices in series at
3032+ specified current.
30323033 """
30333034 return - np .sum (current * v_from_i (current , * args ))
30343035
30353036
30363037def max_power_point_mismatched (
3037- photocurrent , saturation_current , resistance_series , resistance_shunt , nNsVth ,
3038+ photocurrent ,
3039+ saturation_current ,
3040+ resistance_series ,
3041+ resistance_shunt ,
3042+ nNsVth ,
30383043):
3039- """Compute maximum power info for (possibly) mismatched set of devices in series."""
3040- if all ([isinstance (input , numbers .Number ) for input in (
3041- photocurrent , saturation_current , resistance_series , resistance_shunt , nNsVth
3042- )]):
3044+ """
3045+ Compute maximum power info for (possibly) mismatched set of devices in
3046+ series.
3047+ """
3048+ if all (
3049+ [
3050+ isinstance (input , numbers .Number ) for input in (
3051+ photocurrent ,
3052+ saturation_current ,
3053+ resistance_series ,
3054+ resistance_shunt ,
3055+ nNsVth ,
3056+ )
3057+ ]
3058+ ):
30433059 # There cannot be mismatch, so fall back to non-mismatch function.
30443060 return {
30453061 ** max_power_point (
@@ -3058,7 +3074,13 @@ def max_power_point_mismatched(
30583074 np .mean (resistance_shunt ),
30593075 np .mean (nNsVth ),
30603076 )["i_mp" ]
3061- args = photocurrent , saturation_current , resistance_series , resistance_shunt , nNsVth
3077+ args = (
3078+ photocurrent ,
3079+ saturation_current ,
3080+ resistance_series ,
3081+ resistance_shunt ,
3082+ nNsVth ,
3083+ )
30623084 sol = scipy .optimize .minimize (_negative_total_power , i_mp_0 , args )
30633085
30643086 if sol .success :
0 commit comments