8000 refactor ModelChain inverter methods to use PVSystem.get_ac by wholmgren · Pull Request #1150 · pvlib/pvlib-python · GitHub
[go: up one dir, main page]

Skip to content

refactor ModelChain inverter methods to use PVSystem.get_ac #1150

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 13 commits into from
Jan 28, 2021
Prev Previous commit
Next Next commit
fix get_ac with sandia tests
  • Loading branch information
wholmgren committed Jan 27, 2021
commit b603a2966098a9187be206766ad5bcca106569d5
20 changes: 12 additions & 8 deletions pvlib/tests/test_pvsystem.py
38EB
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import pandas as pd

import pytest
from conftest import assert_series_equal, assert_frame_equal
from conftest import (
assert_series_equal, assert_frame_equal, fail_on_pvlib_version)
from numpy.testing import assert_allclose
import unittest.mock as mock

Expand All @@ -15,6 +16,7 @@
from pvlib import irradiance
from pvlib.location import Location
from pvlib import temperature
from pvlib._deprecation import pvlibDeprecationWarning


@pytest.mark.parametrize('iam_model,model_params', [
Expand Down Expand Up @@ -1388,7 +1390,7 @@ def test_PVSystem_get_ac_sandia(cec_inverter_parameters, mocker):
assert_series_equal(pacs, pd.Series([-0.020000, 132.004308, 250.000000]))


# remove after deprecation period for PVSystem.snlinverter
@fail_on_pvlib_version('0.10')
def test_PVSystem_snlinverter(cec_inverter_parameters):
system = pvsystem.PVSystem(
inverter=cec_inverter_parameters['Name'],
Expand All @@ -1397,8 +1399,8 @@ def test_PVSystem_snlinverter(cec_inverter_parameters):
vdcs = pd.Series(np.linspace(0,50,3))
idcs = pd.Series(np.linspace(0,11,3))
pdcs = idcs * vdcs

pacs = system.snlinverter(vdcs, pdcs)
with pytest.warns(pvlibDeprecationWarning):
pacs = system.snlinverter(vdcs, pdcs)
assert_series_equal(pacs, pd.Series([-0.020000, 132.004308, 250.000000]))


Expand Down Expand Up @@ -1964,21 +1966,23 @@ def test_PVSystem_pvwatts_losses(pvwatts_system_defaults, mocker):
assert out < expected


# remove after deprecation period for PVSystem.pvwatts_ac
@fail_on_pvlib_version('0.10')
def test_PVSystem_pvwatts_ac(pvwatts_system_defaults, mocker):
mocker.spy(inverter, 'pvwatts')
pdc = 50
out = pvwatts_system_defaults.pvwatts_ac(pdc)
with pytest.warns(pvlibDeprecationWarning):
out = pvwatts_system_defaults.pvwatts_ac(pdc)
inverter.pvwatts.assert_called_once_with(
pdc, **pvwatts_system_defaults.inverter_parameters)
assert out < pdc


# remove after deprecation period for PVSystem.pvwatts_ac
@fail_on_pvlib_version('0.10')
def test_PVSystem_pvwatts_ac_kwargs(pvwatts_system_kwargs, mocker):
mocker.spy(inverter, 'pvwatts')
pdc = 50
out = pvwatts_system_kwargs.pvwatts_ac(pdc)
with pytest.warns(pvlibDeprecationWarning):
out = pvwatts_system_kwargs.pvwatts_ac(pdc)
inverter.pvwatts.assert_called_once_with(
pdc, **pvwatts_system_kwargs.inverter_parameters)
assert out < pdc
Expand Down
0