Пример #1
0
from solcore.structure import Layer, Junction, TunnelJunction
from solcore.absorption_calculator import calculate_rat_rcwa, calculate_absorption_profile_rcwa

import numpy as np
import types
from solcore.state import State


rcwa_options = State()
rcwa_options.size = [500, 500]
rcwa_options.orders = 4
rcwa_options.theta = 0
rcwa_options.phi = 0
rcwa_options.pol = 'u'
rcwa_options.parallel = False
rcwa_options.n_jobs = -1

def solve_rcwa(solar_cell, options):
    """Calculates the reflection, transmission and absorption of a solar cell object using the rigorous coupled-wave analysis solver.

    :param solar_cell: A solar_cell object
    :param options: Options for the solver
    :return: None
    """
    wl = options.wavelength
    solar_cell.wavelength = options.wavelength
    parallel = options.parallel
    rcwa_options = options.get("rcwa_options", None)

    # We include the shadowing losses
    initial = (1 - solar_cell.shading) if hasattr(solar_cell, 'shading') else 1
light_source = LightSource(source_type='standard', version='AM0')

options = State()
options['rcwa_options'] = ropt
options.optics_method = 'RCWA'
options.wavelength = wavelengths
options.light_source = light_source
options.pol = 's'
options.mpp = True
options.light_iv = True
options.position = 1e-10
options.voltages = np.linspace(-1.5, 1.5, 100)
options.size = size
options.orders = 20
options.parallel = True

window_material = InGaP(In=0.485, Na=si(5e18, 'cm-3'))
# window_material.n_data = np.stack([wavelengths, InGaP_nk.n(wavelengths)])
# window_material.k_data = np.stack([wavelengths, InGaP_nk.k(wavelengths)])
# window_material.n_path = '/home/phoebe/Documents/rayflare/examples/data/InGaP_n.txt'
# window_material.k_path = '/home/phoebe/Documents/rayflare/examples/data/InGaP_k.txt'

to_save_for_WVASE = np.stack([
    wavelengths * 1e9,
    window_material.n(wavelengths),
    window_material.k(wavelengths)
]).T
np.savetxt('InGaP_interp_Solcore.mat', to_save_for_WVASE)

top_cell_n_material = GaAs(Nd=si("1e18cm-3"))