Skip to content

Conversation

@wholmgren
Copy link
Member

This PR adds an IV curve calculation feature to pvsystem.singlediode.

As discussed in #83, the singlediode API remains unchanged for timeseries analysis: series in yields dataframe out. Scalar and array input still yield dict output (well, now an OrderedDict).

Setting the new ivcurve_pnts keyword argument to a non-zero number will always yield an OrderedDict. The dict will also include the keys i and v. The values will be arrays with dimension one greater than the input data (1d arrays for scalar input, 2d arrays for array/series input).

Hopefully that makes sense. The idea is that it "just works".

Example usage below.

Closes #83.

In [197]: times = pd.DatetimeIndex(start='2015-06-01', end='2015-06-02', freq='3H', tz='America/Phoenix')

In [198]: tus = pvlib.location.Location(32, -110)

In [199]: cs = tus.get_clearsky(times)

In [200]: cec_module_params = pvsystem.retrieve_sam('cecmod')['Example_Module']

In [201]:     IL, I0, Rs, Rsh, nNsVth = pvsystem.calcparams_desoto(
     ...:                                          cs['ghi'],
     ...:                                          temp_cell=25,
     ...:                                          alpha_isc=cec_module_params['alpha_sc'],
     ...:                                          module_parameters=cec_module_params,
     ...:                                          EgRef=1.121,
     ...:                                          dEgdT=-0.0002677)

In [202]: sd = pvsystem.singlediode(IL, I0, Rs, Rsh, nNsVth, ivcurve_pnts=100)

In [203]: for i, v, poa in zip(sd['i'], sd['v'], cs['ghi']):
     ...:     plt.plot(v, i, label='{:.0f}'.format(poa))
     ...:

In [204]: plt.ylabel('current (A)'); plt.xlabel('voltage (V)')
Out[204]: <matplotlib.text.Text at 0x1068fdd68>

In [205]: plt.ylim(0, None); plt.xlim(0, None)
Out[205]: (0, 12.0)

In [206]: plt.legend()
Out[206]: <matplotlib.legend.Legend at 0x1068fcc88>

ivcurveexample

I would add the 5 IV curve points to the plot, but this PR does not include the fix in #222.

@wholmgren wholmgren added the api label Jul 21, 2016
@wholmgren wholmgren added this to the 0.4.0 milestone Jul 21, 2016
@wholmgren wholmgren merged commit 85e53af into pvlib:master Jul 22, 2016
@wholmgren wholmgren deleted the ivcurve branch August 28, 2018 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pvsystem.py - no continuous IV curve data

1 participant