@@ -3028,18 +3028,34 @@ def combine_loss_factors(index, *losses, fill_method='ffill'):
3028
3028
3029
3029
def _negative_total_power (current , * args ):
3030
3030
"""
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.
3032
3033
"""
3033
3034
return - np .sum (current * v_from_i (current , * args ))
3034
3035
3035
3036
3036
3037
def 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 ,
3038
3043
):
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
+ ):
3043
3059
# There cannot be mismatch, so fall back to non-mismatch function.
3044
3060
return {
3045
3061
** max_power_point (
@@ -3058,7 +3074,13 @@ def max_power_point_mismatched(
3058
3074
np .mean (resistance_shunt ),
3059
3075
np .mean (nNsVth ),
3060
3076
)["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
+ )
3062
3084
sol = scipy .optimize .minimize (_negative_total_power , i_mp_0 , args )
3063
3085
3064
3086
if sol .success :
0 commit comments