Exemplo n.º 1
0
def test_calc_series():
    pvconst = PVconstants()
    pvcells = [
        PVcell(pvconst=pvconst, Tcell=323),
        PVcell(pvconst=pvconst, Ee=0.75, Tcell=313),
        PVcell(pvconst=pvconst, Ee=0.55, Tcell=303)
    ]
    i_at_vrbd = np.asarray([
        np.interp(pvc.VRBD, pvc.Vcell.flat, pvc.Icell.flat) for pvc in pvcells
    ])
    icells = np.asarray([pvc.Icell.flatten() for pvc in pvcells])
    vcells = np.asarray([pvc.Vcell.flatten() for pvc in pvcells])
    isc = np.asarray([pvc.Isc for pvc in pvcells])
    i, v = pvconst.calcSeries(icells, vcells, isc.mean(), i_at_vrbd.max())
    iv_old = np.loadtxt(os.path.join(BASE_DIR, 'calc_series_test_iv_old.dat'))
    iv_expected = np.loadtxt(os.path.join(BASE_DIR, 'calc_series_test_iv.dat'))
    # noinspection PyTypeChecker
    iv_calc = np.concatenate([[i], [v]], axis=0).T
    # noinspection PyTypeChecker
    ok_(np.allclose(iv_calc, iv_expected))
    assert np.allclose(iv_old[0, :], np.interp(iv_old[1, :], v, i), 0.01, 0.01)
    assert np.allclose(iv_old[1, :],
                       np.interp(iv_old[0, :], np.flipud(i), np.flipud(v)),
                       0.1, 0.1)
    return i, v
Exemplo n.º 2
0
def test_calc_series():
    pvconst = PVconstants()
    pvcells = [
        PVcell(pvconst=pvconst, Tcell=323),
        PVcell(pvconst=pvconst, Ee=0.75, Tcell=313),
        PVcell(pvconst=pvconst, Ee=0.55, Tcell=303)
    ]
    i_at_vrbd = np.asarray([
        np.interp(pvc.VRBD, pvc.Vcell.flat, pvc.Icell.flat) for pvc in pvcells
    ])
    icells = np.asarray([pvc.Icell.flatten() for pvc in pvcells])
    vcells = np.asarray([pvc.Vcell.flatten() for pvc in pvcells])
    isc = np.asarray([pvc.Isc for pvc in pvcells])
    i, v = pvconst.calcSeries(icells, vcells, isc.mean(), i_at_vrbd.max())
    iv = np.loadtxt(os.path.join(BASE_DIR, 'calc_series_test_iv.dat'))
    # noinspection PyTypeChecker
    ok_(np.allclose(i, iv[0]))
    # noinspection PyTypeChecker
    ok_(np.allclose(v, iv[1], rtol=1e-4))
    return i, v