def test_BL_correction(): wl = np.linspace(800, 950, 4) * 1e-9 GaAs = material("GaAs")() thick_cell = SolarCell([Layer(material=GaAs, width=si("20um"))]) opts = State() opts.position = None prepare_solar_cell(thick_cell, opts) position = np.arange(0, thick_cell.width, 1e-9) opts.position = position opts.recalculate_absorption = True opts.no_back_reflexion = False opts.BL_correction = False opts.wavelength = wl solve_tmm(thick_cell, opts) no_corr = thick_cell.absorbed opts.BL_correction = True solve_tmm(thick_cell, opts) with_corr = thick_cell.absorbed assert with_corr == approx( np.array([6.71457872e-01, 6.75496354e-01, 2.09738887e-01, 0])) assert no_corr == approx( np.array([6.71457872e-01, 6.75496071e-01, 2.82306407e-01, 0]))
def test_inc_coh_tmm(): GaInP = material("GaInP")(In=0.5) GaAs = material("GaAs")() Ge = material("Ge")() optical_struct = SolarCell([ Layer(material=GaInP, width=si("5000nm")), Layer(material=GaAs, width=si("200nm")), Layer(material=GaAs, width=si("5um")), Layer(material=Ge, width=si("50um")), ]) wl = np.linspace(400, 1200, 5) * 1e-9 options = State() options.wavelength = wl options.optics_method = "TMM" options.no_back_reflection = False options.BL_correction = True options.recalculate_absorption = True c_list = [ ["c", "c", "c", "c"], ["c", "c", "c", "i"], ["c", "i", "i", "c"], ["i", "i", "i", "i"], ] results = [] for i1, cl in enumerate(c_list): options.coherency_list = cl solar_cell_solver(optical_struct, "optics", options) results.append(optical_struct.absorbed) A_calc = np.stack(results) A_data = np.array( [[0.5742503, 0.67956899, 0.73481184, 0.725372, 0.76792856], [0.5742503, 0.67956899, 0.73481184, 0.725372, 0.76792856], [0.5742503, 0.67956899, 0.73474943, 0.70493469, 0.70361194], [0.5742503, 0.67956899, 0.70927724, 0.71509221, 0.71592772]]) assert A_calc == approx(A_data)
kind='DA') ] # And, finally, we put everything together, adding also the surface recombination velocities sn and sp. # setting kind = 'DA' in the Junction definition tells the electrical solver later to use the depletion approximation optical_struct = SolarCell(ARC + top_junction + middle_junction + DBRa + DBRb + DBRc + bottom_junction, shading=0.05) wl = np.linspace(250, 1700, 400) * 1e-9 options = State() options.wavelength = wl options.optics_method = 'TMM' options.no_back_reflection = False options.pol = 'p' options.BL_correction = True options.coherency_list = 111 * ['c'] options.theta = 30 solar_cell_solver(optical_struct, 'qe', options) plt.figure() plt.plot( wl * 1e9, optical_struct[0].layer_absorption + optical_struct[1].layer_absorption) plt.plot(wl * 1e9, optical_struct[2].layer_absorption) plt.plot(wl * 1e9, optical_struct[3].layer_absorption) plt.plot(wl * 1e9, optical_struct[100].layer_absorption) plt.plot(wl * 1e9, optical_struct.absorbed, '--') plt.plot(wl * 1e9, optical_struct.transmitted, '--') plt.plot(wl * 1e9, optical_struct.reflected, '--') plt.legend(['ARC', 'top', 'middle', 'bottom', 'A', 'T', 'R'])