Skip to content

Trouble figuring out how to run IV gold standard test cases in pvlib #1578

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

Closed
reepoi opened this issue Oct 31, 2022 · 5 comments
Closed

Trouble figuring out how to run IV gold standard test cases in pvlib #1578

reepoi opened this issue Oct 31, 2022 · 5 comments

Comments

@reepoi
Copy link
Contributor

reepoi commented Oct 31, 2022

Describe the bug
When pvsystem.singlediode is called with method = 'brentq' or method = 'newton' and ivcurve_pnts > 0, singlediode.bishop88 is called to calculate the voltage and current of the ivcurve points. singlediode.bishop88 expects diode voltage, but pvsystem.singlediode passes it voltage instead.

To Reproduce
Steps to reproduce the behavior:

  1. Call with method = 'brentq' or method = 'newton',
    pvlib.pvsystem.singlediode(8, 5e-10, 1, 300, 1.8683643583499283, ivcurve_pnts=100, method='brentq')
    
  2. The first few voltage values are negative.

Expected behavior
The ivcurve points should be on this curve: https://cwhanse.github.io/ivcurves/test_cases.html#case-21

Versions:

  • pvlib.__version__: 0.9.3
  • pandas.__version__: 1.4.3
  • python: 3.10
@mikofski
Copy link
Member

mikofski commented Oct 31, 2022

The title of this issue is incorrect in my opinion. I cannot find where in pvsystem.singlediode “cell voltages” are passed where diode voltages are expected. Here is the only line where singlediode.bishope88 is called:

# calculate the IV curve if requested using bishop88

and it passes diode voltages as expected and returns both cell voltage & current.

I think you are looking for either i_from_v or v_from_i

@kandersolar
Copy link
Member

The current behavior as @mikofski describes is consistent with the function's docstring:

pvlib-python/pvlib/pvsystem.py

Lines 2819 to 2824 in b7768b4

If the method is either ``'newton'`` or ``'brentq'`` and ``ivcurve_pnts``
are indicated, then :func:`pvlib.singlediode.bishop88` [4]_ is used to
calculate the points on the IV curve points at diode voltages from zero to
open-circuit voltage with a log spacing that gets closer as voltage
increases. If the method is ``'lambertw'`` then the calculated points on
the IV curve are linearly spaced.

The first few voltage values are negative.

Although the most useful part of the IV curve is in the first quadrant, the curve as a whole does extend into quadrant II (and IV), so negative voltages in and of themselves are not physically illegitimate. Is the objection that the function would be more useful if it only returned points in the first quadrant?

@cwhanse
Copy link
Member

cwhanse commented Oct 31, 2022

I think in this case I may have given wrong direction to @reepoi. We are attempting to use some precisely computed IV pairs as tests for pvlib single diode equation solutions. We want to supply known voltage and get back the corresponding current. When I first looked, I thought that was the intent of

vd = v_oc * (

On second look, that line is passing voltages that are akin to initial guesses at the cell voltages.

To me it suggests that #418 is still relevant: there are uses when e.g. voltage is known and the corresponding current is desired, and pvlib.pvsystem.singlediode doesn't support that. Maybe it's a documentation gap, or as @wholmgren pointed out, an incorrect expectation of singlediode raised because of the ivcurve_pnts parameter.

@mikofski
Copy link
Member

I think if given specific known voltages and the corresponding currents are desired, then pvlib.singlediode.bishop88_i_from_v() should be used. IMHO there's not an expectation that pvsystem.singlediode() should return currents given voltages. In fact, AFAICT, voltages isn't even an input to this function:

pvlib-python/pvlib/pvsystem.py

Lines 2708 to 2710 in dd6062a

def singlediode(photocurrent, saturation_current, resistance_series,
resistance_shunt, nNsVth, ivcurve_pnts=None,
method='lambertw'):

@adriesse
Copy link
Member

adriesse commented Nov 2, 2022

I'm not sure what the best place is for this thought, but perhaps it could be useful if IV curve validation data sets actually included the diode voltage as well.

@mikofski mikofski changed the title pvsystem.singlediode passes voltage, not diode voltage, to singlediode.bishop88. Trouble figuring out how to run IV gold standard test cases in pvlib Nov 2, 2022
@cwhanse cwhanse closed this as completed Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants