8000 Maximum power point tracking for mismatched devices (single-diode model) by markcampanelli · Pull Request #1923 · pvlib/pvlib-python · GitHub
[go: up one dir, main page]

Skip to content

Maximum power point tracking for mismatched devices (single-diode model) #1923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Appease flake8
  • Loading branch information
markcampanelli committed Dec 1, 2023
commit 1c2404a8a84a9cc3e6683ba454c4cf42ed083507
36 changes: 29 additions & 7 deletions pvlib/pvsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -3028,18 +3028,34 @@ def combine_loss_factors(index, *losses, fill_method='ffill'):

def _negative_total_power(current, *args):
"""
Compute negative of total power generated by devices in series at specified current.
Compute negative of total power generated by devices in series at
specified current.
"""
return -np.sum(current * v_from_i(current, *args))


def max_power_point_mismatched(
photocurrent, saturation_current, resistance_series, resistance_shunt, nNsVth,
photocurrent,
saturation_current,
resistance_series,
resistance_shunt,
nNsVth,
):
"""Compute maximum power info for (possibly) mismatched set of devices in series."""
if all([isinstance(input, numbers.Number) for input in (
photocurrent, saturation_current, resistance_series, resistance_shunt, nNsVth
)]):
"""
Compute maximum power info for (possibly) mismatched set of devices in
series.
"""
if all(
[
isinstance(input, numbers.Number) for input in (
photocurrent,
saturation_current,
resistance_series,
resistance_shunt,
nNsVth,
)
]
):
# There cannot be mismatch, so fall back to non-mismatch function.
return {
**max_power_point(
Expand All @@ -3058,7 +3074,13 @@ def max_power_point_mismatched(
np.mean(resistance_shunt),
np.mean(nNsVth),
)["i_mp"]
args = photocurrent, saturation_current, resistance_series, resistance_shunt, nNsVth
args = (
photocurrent,
saturation_current,
resistance_series,
resistance_shunt,
nNsVth,
)
sol = scipy.optimize.minimize(_negative_total_power, i_mp_0, args)

if sol.success:
Expand Down
0