Esempio n. 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'


def solve_rcwa(solar_cell, options):
    """ Calculates the reflection, transmission and absorption of a solar cell object using the transfer matrix method

    :param solar_cell:
    :param options:
    :return:
    """
    wl = options.wavelength

    # We include the shadowing losses
    initial = (1 - solar_cell.shading) if hasattr(solar_cell, 'shading') else 1

    # Now we calculate the absorbed and transmitted light. We first get all the relevant parameters from the objects
    widths = []
    offset = 0
    all_layers = []
            ConserveMemory=False,
            WeismannFormulation=True)

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)