Ejemplo n.º 1
0
def test_sandia_multi(cec_inverter_parameters):
    vdcs = pd.Series(np.linspace(0, 50, 3))
    idcs = pd.Series(np.linspace(0, 11, 3)) / 2
    pdcs = idcs * vdcs
    pacs = inverter.sandia_multi((vdcs, vdcs), (pdcs, pdcs),
                                 cec_inverter_parameters)
    assert_series_equal(pacs, pd.Series([-0.020000, 132.004308, 250.000000]))
    # with lists instead of tuples
    pacs = inverter.sandia_multi([vdcs, vdcs], [pdcs, pdcs],
                                 cec_inverter_parameters)
    assert_series_equal(pacs, pd.Series([-0.020000, 132.004308, 250.000000]))
    # with arrays instead of tuples
    pacs = inverter.sandia_multi(np.array([vdcs, vdcs]),
                                 np.array([pdcs, pdcs]),
                                 cec_inverter_parameters)
    assert_series_equal(pacs, pd.Series([-0.020000, 132.004308, 250.000000]))
Ejemplo n.º 2
0
def test_sandia_multi_array(cec_inverter_parameters):
    vdcs = np.linspace(0, 50, 3)
    idcs = np.linspace(0, 11, 3)
    pdcs = idcs * vdcs
    pacs = inverter.sandia_multi((vdcs,), (pdcs,), cec_inverter_parameters)
    assert_allclose(pacs, np.array([-0.020000, 132.004278, 250.000000]))
Ejemplo n.º 3
0
def test_sandia_multi_length_error(cec_inverter_parameters):
    vdcs = pd.Series(np.linspace(0, 50, 3))
    idcs = pd.Series(np.linspace(0, 11, 3))
    pdcs = idcs * vdcs
    with pytest.raises(ValueError, match='p_dc and v_dc have different'):
        inverter.sandia_multi((vdcs,), (pdcs, pdcs), cec_inverter_parameters)