def __eval_string_expression(self, string_expression, **others): if " " in string_expression: # treat second part as unit! string_expression, units = string_expression.split(" ", 1) use_units = True else: use_units = False if 'T' in string_expression and 'T' not in others.keys(): raise KeyError( 'The temperature is needed to calculate this parameter. ' 'Include keyword argument "T" when calling "get_parameter"') non_converted_unit = eval(string_expression, {"__builtins__": self.builtins_replacement}, others) in_si_units = siUnits(non_converted_unit, units) if use_units else non_converted_unit return in_si_units
Al2O3 = material('Al2O3') TiO2 = material('TiO2') AlInP = material("AlInP") GaInP = material("GaInP") GaAs = material('GaAs') Ge = material("Ge") Al02Ga08As = material('AlGaAs') Al08Ga02As = material('AlGaAs') # TOP CELL - GaInP ARC1 = Al2O3() ARC2 = TiO2() top_window_material = AlInP(Al=0.5) top_cell_n_material = GaInP(In=0.51, Nd=siUnits(2e18, "cm-3"), hole_diffusion_length=si("300nm")) top_cell_p_material = GaInP(In=0.51, Na=siUnits(1.5e17, "cm-3"), electron_diffusion_length=si("2um")) top_cell_TJ_material = Al08Ga02As(Al=0.8) for mat in [top_cell_n_material, top_cell_p_material]: mat.band_gap = material('GaInP')(In=0.51).band_gap mat.eff_mass_hh_z = material('GaInP')(In=0.51).eff_mass_hh_z mat.eff_mass_electron = material('GaInP')(In=0.51).eff_mass_electron mat.relative_permittivity = 11.75 all_materials.append(ARC1) all_materials.append(ARC2) all_materials.append(top_window_material)
from solcore.interpolate import interp1d from solcore.solar_cell import SolarCell from solcore.structure import Junction, Layer from solcore.solar_cell_solver import solar_cell_solver all_materials = [] def this_dir_file(f): return os.path.join(os.path.split(__file__)[0], f) # We need to build the solar cell layer by layer. # We start from the AR coating. In this case, we load it from an an external file refl_nm = np.loadtxt(this_dir_file("MgF-ZnS_AR.csv"), unpack=True, delimiter=",") ref = interp1d(x=siUnits(refl_nm[0], "nm"), y=refl_nm[1], bounds_error=False, fill_value=0) # TOP CELL - GaInP # Now we build the top cell, which requires the n and p sides of GaInP and a window layer. # We also load the absorption coefficient from an external file. We also add some extra parameters needed for the # calculation such as the minority carriers diffusion lengths AlInP = material("AlInP") InGaP = material("GaInP") window_material = AlInP(Al=0.52) top_cell_n_material = InGaP(In=0.49, Nd=siUnits(2e18, "cm-3"), hole_diffusion_length=si("200nm")) top_cell_p_material = InGaP(In=0.49, Na=siUnits(1e17, "cm-3"), electron_diffusion_length=si("1um")) all_materials.append(window_material) all_materials.append(top_cell_n_material) all_materials.append(top_cell_p_material)
def spectral_response_all_junctions(solar_cell, incident_light=None, energy=None, V=0, verbose=False): """ Calculates the spectral response of any number of junctions using analytical diode equations as described in J. Nelson's book "The Physics of Solar Cells" (2003). All parameters must be in SI units. It only works for homojunctions. :param solar_cell: A structure object with one or more Junction objects and a few optional parameters. Each junction is made of a sequence of *Layers* (with a thickness, a material and a role) and the surface recombination velocities for electrons and holes. Optional attributes for the structure are: - shading: (optional) Shading loses. - reflectivity: (optional) Function that calculates the reflectivity as a function of energy (in J). :param incident_light: (optional) 2D array containing the energies and the spectral power density (in photons m-2 J-1). :param energy: (optional) energies at which to calculate the QE. If not provided, the range of the incident ligth is used and if that is not defined, a "sensible" range is used. :param V: The voltage at which to perform the calculations (in V) :param verbose: If the information about the calculation must be printed (default = FALSE). :return: A dictionary containing, as a function of energy: - junctions: A list containing the QE data for each junction - transmitted: The transmitted power density - transmitted_fraction: The fraction of transmitted power - passive_loss: The passive losses (light absorbed in the encapsulants, AR coatings, window layers, etc) - reflected: reflected power density - reflected_fraction: Fraction of reflected power - e: The energy values """ science_reference( "Nelson pin spectral response", "Jenny: (Nelson. The Physics of Solar Cells. Imperial College Press (2003))" ) # Get the energy range and incident spectrum. If they are not inputs, we create some sensible values. if energy is None: if incident_light is not None: energy = incident_light[0] bs = np.copy(incident_light[1]) else: energy = siUnits(np.linspace(0.5, 3.5, 450), 'eV') bs = np.ones_like(energy) else: if incident_light is not None: bs = np.interp(energy, incident_light[0], incident_light[1]) else: bs = np.ones_like(energy) bs_initial = np.copy(bs) # We include the shadowing losses if hasattr(solar_cell, 'shading'): bs *= (1 - solar_cell.shading) # And the reflexion losses if hasattr(solar_cell, 'reflectivity') and solar_cell.reflectivity is not None: ref = solar_cell.reflectivity(energy) bs *= (1 - ref) reflected = ref * bs_initial else: reflected = np.zeros_like(bs) # And now we perform the calculation, each junction at a time qe_result = [] passive_loss = np.ones_like(bs) for layer_index, layer_object in enumerate(solar_cell): # Attenuation due to absorption in the AR coatings or any layer in the front that is not part of the # junction if type(layer_object) is Layer: bs = bs * np.exp( -layer_object.material.alphaE(energy) * layer_object.width) passive_loss *= np.exp(-layer_object.material.alphaE(energy) * layer_object.width) # For each junction, we calculate the spectral response elif type(layer_object) is Junction: # If there are window layers, passively absorbing light above the emitter, we attenuate the intensity idx = 0 for junction_layer_object in layer_object: if junction_layer_object.role != 'emitter': bs = bs * np.exp( -junction_layer_object.material.alphaE(energy) * junction_layer_object.width) passive_loss *= np.exp( -junction_layer_object.material.alphaE(energy) * junction_layer_object.width) idx += 1 else: break output = calculate_junction_sr(layer_object, energy, bs, bs_initial, V, printParameters=verbose) qe_result.append(output) # And we reduce the amount of light reaching the next junction for junction_layer_object in layer_object[idx:]: bs *= np.exp(-junction_layer_object.material.alphaE(energy) * junction_layer_object.width) else: raise ValueError( "Strange layer-like object discovered in structure stack: {}". format(type(layer_object))) return { "junctions": qe_result, "transmitted": bs, "transmitted_fraction": bs / bs_initial, "passive_loss": 1 - passive_loss, "reflected": reflected, "reflected_fraction": reflected / bs_initial, "e": energy }
from solcore.structure import Junction, Layer from solcore.solar_cell_solver import solar_cell_solver all_materials = [] def this_dir_file(f): return os.path.join(os.path.split(__file__)[0], f) # We need to build the solar cell layer by layer. # We start from the AR coating. In this case, we load it from an an external file refl_nm = np.loadtxt(this_dir_file("MgF-ZnS_AR.csv"), unpack=True, delimiter=",") ref = interp1d(x=siUnits(refl_nm[0], "nm"), y=refl_nm[1], bounds_error=False, fill_value=0) # TOP CELL - GaInP # Now we build the top cell, which requires the n and p sides of GaInP and a window layer. # We also load the absorption coefficient from an external file. We also add some extra parameters needed for the # calculation such as the minority carriers diffusion lengths AlInP = material("AlInP") InGaP = material("GaInP") window_material = AlInP(Al=0.52) top_cell_n_material = InGaP(In=0.49, Nd=siUnits(2e18, "cm-3"), hole_diffusion_length=si("200nm")) top_cell_p_material = InGaP(In=0.49,
Al2O3 = material('Al2O3') TiO2 = material('TiO2') AlInP = material("AlInP") GaInP = material("GaInP") GaAs = material('GaAs') Ge = material("Ge") Al02Ga08As = material('AlGaAs') Al08Ga02As = material('AlGaAs') # TOP CELL - GaInP ARC1= Al2O3() ARC2 = TiO2() top_window_material = AlInP(Al=0.5) top_cell_n_material = GaInP(In=0.51,Nd=siUnits(2e18, "cm-3"), hole_diffusion_length=si("300nm")) top_cell_p_material = GaInP(In=0.51,Na=siUnits(1.5e17, "cm-3"), electron_diffusion_length=si("2um")) top_cell_TJ_material = Al08Ga02As(Al=0.8) #for mat in [top_cell_n_material, top_cell_p_material]: #mat.band_gap = material('GaInP')(In=0.51).band_gap #mat.eff_mass_hh_z = material('GaInP')(In=0.51).eff_mass_hh_z #mat.eff_mass_electron = material('GaInP')(In=0.51).eff_mass_electron #mat.permittivity = 11.75 all_materials.append(ARC1) all_materials.append(ARC2) all_materials.append(top_window_material) all_materials.append(top_cell_n_material) all_materials.append(top_cell_p_material) all_materials.append(top_cell_TJ_material)