示例#1
0
def solve_qe(solar_cell, options):
    """ Calculates the QE of all the junctions

    :param solar_cell: A solar_cell object
    :param options: Options for the solvers
    :return: None
    """

    solve_optics(solar_cell, options)

    print('Solving QE of the solar cell...')
    for j in solar_cell.junction_indices:
        if solar_cell[j].kind == 'PDD':
            PDD.qe_pdd(solar_cell[j], options)
        elif solar_cell[j].kind == 'DA':
            ASC.qe_depletion(solar_cell[j], options)
        elif solar_cell[j].kind == '2D':
            # We solve this case as if it were DB. Therefore, to work it needs the same inputs in the Junction object
            wl = options.wavelength
            ASC.qe_detailed_balance(solar_cell[j], wl)
        elif solar_cell[j].kind == 'DB':
            wl = options.wavelength
            ASC.qe_detailed_balance(solar_cell[j], wl)
        else:
            raise ValueError(
                'ERROR in "solar_cell_solver":\n\tJunction {} has an invalid "type". It must be "PDD", "DA", "2D" or "DB".'
                .format(j))
def test_qe_depletion_pn(pn_junction):
    from solcore.analytic_solar_cells import qe_depletion

    test_junc, options = pn_junction

    wl = options.wavelength

    qe_depletion(test_junc[0], options)

    assert np.all(test_junc[0].eqe(wl) < 1)
    assert np.all(test_junc[0].eqe_emitter(wl) < 1)
    assert np.all(test_junc[0].eqe_base(wl) < 1)
    assert np.all(test_junc[0].eqe_scr(wl) < 1)
    assert np.all(test_junc[0].eqe(wl)[test_junc[0].eqe(wl) > 1e-3] <=
                  test_junc.absorbed[test_junc[0].eqe(wl) > 1e-3])
    assert np.all(test_junc[0].eqe_emitter(wl) + test_junc[0].eqe_base(wl) +
                  test_junc[0].eqe_scr(wl) == approx(test_junc[0].eqe(wl)))
    assert np.all(test_junc[0].iqe(wl) >= test_junc[0].eqe(wl))

    options['da_mode'] = 'green'
    qe_depletion(test_junc[0], options)

    assert np.all(test_junc[0].eqe(wl) < 1)
    assert np.all(test_junc[0].eqe_emitter(wl) < 1)
    assert np.all(test_junc[0].eqe_base(wl) < 1)
    assert np.all(test_junc[0].eqe_scr(wl) < 1)
    assert np.all(test_junc[0].eqe(wl)[test_junc[0].eqe(wl) > 1e-3] <=
                  test_junc.absorbed[test_junc[0].eqe(wl) > 1e-3])
    assert np.all(test_junc[0].eqe_emitter(wl) + test_junc[0].eqe_base(wl) +
                  test_junc[0].eqe_scr(wl) == approx(test_junc[0].eqe(wl)))
    assert np.all(test_junc[0].iqe(wl) >= test_junc[0].eqe(wl))