Skip to content

remove unnecessary module argument from singlediode function #202

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

Merged
merged 4 commits into from
Jun 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 4 additions & 1 deletion docs/sphinx/source/whatsnew/v0.4.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ the API changes.
API Changes
~~~~~~~~~~~

* In ``pvlib.irradiance.perez``, renamed argument ``modelt`` to ``model`` (:issue:`196`)
* Remove unneeded module argument from singlediode function. (:issue:`200`)
* In ``pvlib.irradiance.perez``, renamed argument ``modelt`` to ``model``.
(:issue:`196`)


Enhancements
~~~~~~~~~~~~
Expand Down
15 changes: 5 additions & 10 deletions pvlib/pvsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,7 @@ def singlediode(self, photocurrent, saturation_current,
-------
See pvsystem.singlediode for details
"""
return singlediode(self.module_parameters, photocurrent,
saturation_current,
return singlediode(photocurrent, saturation_current,
resistance_series, resistance_shunt, nNsVth)

def i_from_v(self, resistance_shunt, resistance_series, nNsVth, voltage,
Expand Down Expand Up @@ -1334,9 +1333,9 @@ def sapm_celltemp(poa_global, wind_speed, temp_air,
return pd.DataFrame({'temp_cell': temp_cell, 'temp_module': temp_module})


def singlediode(module, photocurrent, saturation_current,
resistance_series, resistance_shunt, nNsVth):
'''
def singlediode(photocurrent, saturation_current, resistance_series,
resistance_shunt, nNsVth):
r'''
Solve the single-diode model to obtain a photovoltaic IV curve.

Singlediode solves the single diode equation [1]
Expand All @@ -1357,9 +1356,6 @@ def singlediode(module, photocurrent, saturation_current,

Parameters
----------
module : dict or Series
A dict-like object defining the SAPM performance parameters.

photocurrent : float or Series
Light-generated current (photocurrent) in amperes under desired
IV curve conditions. Often abbreviated ``I_L``.
Expand Down Expand Up @@ -1439,8 +1435,7 @@ def singlediode(module, photocurrent, saturation_current,
'i_0': saturation_current,
'i_l': photocurrent}

p_mp, v_mp = _golden_sect_DataFrame(params, 0, module['V_oc_ref']*1.14,
_pwr_optfcn)
p_mp, v_mp = _golden_sect_DataFrame(params, 0, v_oc*1.14, _pwr_optfcn)

# Invert the Power-Current curve. Find the current where the inverted power
# is minimized. This is i_mp. Start the optimization at v_oc/2
Expand Down
14 changes: 10 additions & 4 deletions pvlib/test/test_pvsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import pandas as pd

from nose.tools import assert_equals, assert_almost_equals
from numpy.testing import assert_allclose
from pandas.util.testing import assert_series_equal, assert_frame_equal
from numpy.testing import assert_allclose

Expand Down Expand Up @@ -268,14 +269,19 @@ def test_singlediode_series():
module_parameters=module_parameters,
EgRef=1.121,
dEgdT=-0.0002677)
out = pvsystem.singlediode(module_parameters, IL, I0, Rs, Rsh, nNsVth)
out = pvsystem.singlediode(IL, I0, Rs, Rsh, nNsVth)
assert isinstance(out, pd.DataFrame)


# nose didn't like it when I tried to use partial (wholmgren)
def assert_allclose_atol_01(*args):
return assert_allclose(*args, atol=0.02)


def test_singlediode_floats():
module = 'Example_Module'
module_parameters = sam_data['cecmod'][module]
out = pvsystem.singlediode(module_parameters, 7, 6e-7, .1, 20, .5)
out = pvsystem.singlediode(7, 6e-7, .1, 20, .5)
expected = {'i_xx': 4.2685798754011426,
'i_mp': 6.1390251797935704,
'v_oc': 8.1063001465863085,
Expand All @@ -285,7 +291,7 @@ def test_singlediode_floats():
'v_mp': 6.221535886625464}
assert isinstance(out, dict)
for k, v in out.items():
yield assert_almost_equals, expected[k], v, 3
yield assert_allclose_atol_01, expected[k], v


def test_PVSystem_singlediode_floats():
Expand All @@ -303,7 +309,7 @@ def test_PVSystem_singlediode_floats():
'v_mp': 6.221535886625464}
assert isinstance(out, dict)
for k, v in out.items():
yield assert_almost_equals, expected[k], v, 3
yield assert_allclose_atol_01, expected[k], v


def test_scale_voltage_current_power():
Expand Down