8000 Add mismatch.py and function to combine curves by ajonesr · Pull Request #1781 · pvlib/pvlib-python · GitHub
[go: up one dir, main page]

Skip to content

Add mismatch.py and function to combine curves #1781

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 30 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
06abfaa
Added mismatch.py
ajonesr Jun 20, 2023
3159bc1
Make method in bishop functions explicit
ajonesr Jun 21, 2023
76efbac
Move clipping to prepare_curves
ajonesr Jun 21, 2023
586de8f
Change assert to ValueError
ajonesr Jun 21, 2023
3038f86
Added docstrings
ajonesr Jun 22, 2023
c0e57da
Fixed missing parenthesis
ajonesr Jun 22, 2023
0670a6f
Updated comments, fixed typo
ajonesr Jun 22, 2023
a3a135b
Updated imports
ajonesr Jun 22, 2023
c27f558
Updated .rst file
ajonesr Jun 22, 2023
5dfda15
Updated docstrings
ajonesr Jun 22, 2023
2f11a16
Update docstring of prepare_curves
ajonesr Jun 23, 2023
3effafe
Update docstring of combine_curves
ajonesr Jun 23, 2023
b969581
Fixed spacing and clipped_voltage typo
ajonesr Jun 23, 2023
7ab461c
Reverse order of currents array
ajonesr Jun 23, 2023
d87f9df
Add tests
ajonesr Jun 23, 2023
cf955a3
Fixed types, updated tests
ajonesr Jun 23, 2023
a014b2a
Updated whatsnew
ajonesr Jun 23, 2023
1f5914a
Added contributor
ajonesr Jun 23, 2023
94e923c
Update prepare_curves docstring
ajonesr Jun 26, 2023
31d1188
Update prepare_curves docstring
ajonesr Jun 26, 2023
0880f24
Update prepare_curves docstring
ajonesr Jun 26, 2023
e87b4aa
Update spacing
ajonesr Jun 26, 2023
057cada
Update spacing
ajonesr Jun 26, 2023
606de91
Add tests for ValueErrors
ajonesr Jun 26, 2023
baeac3f
Merge branch 'main' into mismatch
ajonesr Jun 26, 2023
ded4548
Update init
ajonesr Jun 26, 2023
52b7455
Added example
ajonesr Jul 10, 2023
2ca0cb0
Merge remote-tracking branch 'upstream/main' into mismatch
ajonesr Jul 13, 2023
8cca7b7
Update whatsnew, example
ajonesr Jul 14, 2023
17d738c
Merge branch 'main' of https://github.com/pvlib/pvlib-python into mis…
cwhanse Aug 11, 2023
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
Update whatsnew, example
  • Loading branch information
ajonesr committed Jul 14, 2023
commit 8cca7b7298bce3ee12bcc7d3b7b0fc8dc662a71c
39 changes: 33 additions & 6 deletions docs/examples/iv-modeling/plot_mismatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,30 @@
Calculating a combined IV curve
===============================

Example of combining IV curves in series, using the single diode model.
Here we show how to use pvlib to combine IV curves in series.

Differences in weather (irradiance or temperature) or module condition can
cause two modules (or cells) to produce different current-voltage (IV)
characteristics or curves. Series-connected modules produce a string-level IV
curve, which can be obtained by combining the curves for the individual
modules. Combining the curves involves modeling IV curves at negative voltage,
because some modules (cells) in the series circuit will produce more
photocurrent than others but the combined current cannot exceed that of the
lowest-current module (cell).
"""

# %%
#
# pvlib provides two functions to combine series-connected curves:
#
#* :py:func:`pvlib.ivtools.mismatch.prepare_curves` uses parameters for the
# single diode equation and a simple model for negative voltage behavior to
# compute IV curves at a common set of currents
#
#* :py:func:`pvlib.ivtools.mismatch.combine_curves` produces the combined IV
# curve from a set of IV curves with common current values.


import numpy as np
import matplotlib.pyplot as plt
from scipy.constants import Boltzmann, elementary_charge
Expand All @@ -13,11 +34,13 @@


# set up parameter array

# the parameters should be in the order: photocurrent, saturation
# current, series resistance, shunt resistance, and n*Vth*Ns
vth = 298.15 * Boltzmann / elementary_charge
# these are the parameters for the single diode function

# example array of parameters
vth = 298.15 * Boltzmann / elementary_charge
params = np.array([[1.0, 3e-08, 1.0, 300, 1.3*vth*72],
[3, 3e-08, 0.1, 300, 1.01*vth*72],
[2, 5e-10, 0.1, 300, 1.1*vth*72]])
Expand All @@ -31,15 +54,19 @@
combined_curve_dict = combine_curves(currents, voltages_array)

# plot all curves and combined curve
for v in voltages_array:
plt.plot(v, currents)
for idx in range(len(voltages_array)):
v = voltages_array[idx]
plt.plot(v, currents, label=f"Panel {idx+1}")

plt.plot(combined_curve_dict['v'], combined_curve_dict['i'],
label="Combined curve")

# plot vertical line at breakdown voltage (used in simplified
# reverse bias model)
plt.vlines(brk_voltage, ymin=0.0, ymax=combined_curve_dict['i_sc'], ls='--',
color='k', linewidth=1, label="Breakdown voltage")

plt.xlabel("Voltage [V]")
plt.ylabel("Current [A]")
plt.vlines(brk_voltage, ymin=0.0, ymax=combined_curve_dict['i_sc'], ls='--',
color='k', label="Breakdown voltage")
plt.legend()
plt.show()
5 changes: 0 additions & 5 deletions docs/sphinx/source/whatsnew/v0.10.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ Enhancements
tolerance and number of iterations can be set.
(:issue:`1249`, :pull:`1764`)
* Improved `ModelChainResult.__repr__` (:pull:`1236`)
* Added a new module :py:mod:`pvlib.ivtools.mismatch` to contain functions for
combining IV curves. Added functions
:py:func:`pvlib.ivtools.mismatch.prepare_curves` and
:py:func:`pvlib.ivtools.mismatch.combine_curves`. (:pull:`1781`)
* Improved ``ModelChainResult.__repr__`` (:pull:`1236`)
* Exposes several functions useful for bifacial and shading calculations (:pull:`1666`):

Expand Down Expand Up @@ -169,7 +165,6 @@ Contributors
* Adam R. Jensen (:ghuser:`AdamRJensen`)
* Echedey Luis (:ghuser:`echedey-ls`)
* Cliff Hansen (:ghuser:`cwhanse`)
* Abigail Jones (:ghuser:`ajonesr`)
* Cédric Leroy (:ghuser:`cedricleroy`)
* Jean-Baptiste Pasquier (:ghuser:`pasquierjb`)
* Mark Mikofski (:ghuser:`mikofski`)
Expand Down
5 changes: 5 additions & 0 deletions docs/sphinx/source/whatsnew/v0.10.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Enhancements
:py:func:`pvlib.iotools.get_pvgis_hourly`, :py:func:`pvlib.iotools.get_cams`,
:py:func:`pvlib.iotools.get_bsrn`, and :py:func:`pvlib.iotools.read_midc_raw_data_from_nrel`.
(:pull:`1800`)
* Added a new module :py:mod:`pvlib.ivtools.mismatch` to contain functions for
combining IV curves. Added functions
:py:func:`pvlib.ivtools.mismatch.prepare_curves` and
:py:func:`pvlib.ivtools.mismatch.combine_curves`. (:pull:`1781`)


Bug fixes
Expand All @@ -36,3 +40,4 @@ Requirements
Contributors
~~~~~~~~~~~~
* Adam R. Jensen (:ghuser:`AdamRJensen`)
* Abigail Jones (:ghuser:`ajonesr`)
0