def solve_optics(solar_cell, options): """ Solves the optical properties of the structure, calculating the reflectance, absorptance and transmitance. The "optics_method" option controls which method is used to calculate the optical properties of the solar cell: - None: The calculation is skipped. Only useful for solar cells involving just "2-diode" kind of junctions. - BL: Uses the Beer-Lambert law to calculate the absorption in each layer. Front surface reflexion has to provided externally. It is the default method and the most flexible one. - TMM: Uses a transfer matrix calculation to obtain the RAT. Not valid for DB or 2D junction - RCWA: Uses the rigorous wave coupled analysisto obtain the RAT. This allows to include 2D photonic crystals in the structure, for example. Not valid for DB or 2D junctions - external: The reflection and absorption profiles are provided externally by the user, and therefore no calculation is performed by Solcore. :param solar_cell: A solar_cell object :param options: Options for the optics solver :return: None """ print('Solving optics of the solar cell...') if options.optics_method is None: print('Warning: Not solving the optics of the solar cell.') elif options.optics_method == 'external': solve_external_optics(solar_cell, options) elif options.optics_method == 'BL': solve_beer_lambert(solar_cell, options) elif options.optics_method == 'TMM': solve_tmm(solar_cell, options) elif options.optics_method == 'RCWA': solve_rcwa(solar_cell, options) else: raise ValueError( 'ERROR in "solar_cell_solver":\n\tOptics solver method must be None, "external", "BL", "TMM" or "RCWA".')
def junction(nd_top, na_top, nd_bottom, na_bottom): from solcore.structure import Junction, Layer from solcore import si, material from solcore.solar_cell import SolarCell from solcore.constants import vacuum_permittivity from solcore.solar_cell_solver import prepare_solar_cell from solcore.optics import solve_beer_lambert Lp = np.power(10, np.random.uniform(-8, -6)) Ln = np.power(10, np.random.uniform(-8, -6)) AlInP = material("AlInP") InGaP = material("GaInP") window_material = AlInP(Al=0.52) top_cell_n_material = InGaP( In=0.48, Nd=nd_top, Na=na_top, hole_diffusion_length=Lp, electron_diffusion_length=Ln, ) top_cell_p_material = InGaP( In=0.48, Nd=nd_bottom, Na=na_bottom, hole_diffusion_length=Lp, electron_diffusion_length=Ln, ) rel_perm = np.random.uniform(1, 20) for mat in [top_cell_n_material, top_cell_p_material]: mat.permittivity = rel_perm * vacuum_permittivity n_width = np.random.uniform(500, 1000) * 1e-9 p_width = np.random.uniform(3000, 5000) * 1e-9 test_junc = SolarCell([ Junction( [ Layer(si("25nm"), material=window_material, role="window"), Layer(n_width, material=top_cell_n_material, role="emitter"), Layer(p_width, material=top_cell_p_material, role="base"), ], sn=1, sp=1, kind="DA", ) ]) options = da_options() options.light_source = da_light_source() prepare_solar_cell(test_junc, options) solve_beer_lambert(test_junc, options) return test_junc, options