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
remove tests for methods that no longer exist
  • Loading branch information
wholmgren committed Jan 27, 2021
commit ab4ab6e264bb6de58723ef1e2c8da31c259f13ab
71 changes: 0 additions & 71 deletions pvlib/tests/test_pvsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -1426,52 +1426,6 @@ def test_PVSystem_get_ac_sandia_multi(cec_inverter_parameters, mocker):
system.get_ac('sandia', (vdcs, vdcs), (pdcs, pdcs, pdcs))


# remove after deprecation period for PVSystem.sandia_multi
def test_PVSystem_sandia_multi(cec_inverter_parameters):
system = pvsystem.PVSystem(
arrays=[pvsystem.Array(), pvsystem.Array()],
inverter=cec_inverter_parameters['Name'],
inverter_parameters=cec_inverter_parameters,
)
vdcs = pd.Series(np.linspace(0, 50, 3))
idcs = pd.Series(np.linspace(0, 11, 3)) / 2
pdcs = idcs * vdcs
pacs = system.sandia_multi((vdcs, vdcs), (pdcs, pdcs))
assert_series_equal(pacs, pd.Series([-0.020000, 132.004308, 250.000000]))
with pytest.raises(ValueError,
match="Length mismatch for per-array parameter"):
system.sandia_multi(vdcs, (pdcs, pdcs))
with pytest.raises(ValueError,
match="Length mismatch for per-array parameter"):
system.sandia_multi(vdcs, (pdcs,))
with pytest.raises(ValueError,
match="Length mismatch for per-array parameter"):
system.sandia_multi((vdcs, vdcs), (pdcs, pdcs, pdcs))


# remove after deprecation period for PVSystem.sandia_multi
def test_PVSystem_sandia_multi_single_array(cec_inverter_parameters):
system = pvsystem.PVSystem(
arrays=[pvsystem.Array()],
inverter=cec_inverter_parameters['Name'],
inverter_parameters=cec_inverter_parameters,
)
8000 vdcs = pd.Series(np.linspace(0, 50, 3))
idcs = pd.Series(np.linspace(0, 11, 3))
pdcs = idcs * vdcs

pacs = system.sandia_multi(vdcs, pdcs)
assert_series_equal(pacs, pd.Series([-0.020000, 132.004308, 250.000000]))
pacs = system.sandia_multi((vdcs,), (pdcs,))
assert_series_equal(pacs, pd.Series([-0.020000, 132.004308, 250.000000]))
with pytest.raises(ValueError,
match="Length mismatch for per-array parameter"):
system.sandia_multi((vdcs, vdcs), pdcs)
with pytest.raises(ValueError,
match="Length mismatch for per-array parameter"):
system.sandia_multi((vdcs,), (pdcs, pdcs))


def test_PVSystem_get_ac_pvwatts(pvwatts_system_defaults, mocker):
mocker.spy(inverter, 'pvwatts')
pdc = 50
Expand Down Expand Up @@ -2030,31 +1984,6 @@ def test_PVSystem_pvwatts_ac_kwargs(pvwatts_system_kwargs, mocker):
assert out < pdc


# remove after deprecation period for PVSystem.pvwatts_ac
def test_PVSystem_pvwatts_multi(pvwatts_system_defaults,
pvwatts_system_kwargs):
expected = [pd.Series([0.0, 48.123524, 86.400000]),
pd.Series([0.0, 45.893550, 85.500000])]
systems = [pvwatts_system_defaults, pvwatts_system_kwargs]
for base_sys, exp in zip(systems, expected):
system = pvsystem.PVSystem(
arrays=[pvsystem.Array(), pvsystem.Array()],
inverter_parameters=base_sys.inverter_parameters,
)
pdcs = pd.Series([0., 25., 50.])
pacs = system.pvwatts_multi((pdcs, pdcs))
assert_series_equal(pacs, exp)
with pytest.raises(ValueError,
match="Length mismatch for per-array parameter"):
system.pvwatts_multi((pdcs,))
with pytest.raises(ValueError,
match="Length mismatch for per-array parameter"):
system.pvwatts_multi(pdcs)
with pytest.raises(ValueError,
match="Length mismatch for per-array parameter"):
system.pvwatts_multi((pdcs, pdcs, pdcs))


def test_PVSystem_num_arrays():
system_one = pvsystem.PVSystem()
system_two 4071 = pvsystem.PVSystem(arrays=[pvsystem.Array(), pvsystem.Array()])
Expand Down
0