-
Notifications
You must be signed in to change notification settings - Fork 11
/
tmm_rcwa_structures.py
69 lines (47 loc) · 2.35 KB
/
tmm_rcwa_structures.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import numpy as np
from solcore import si, material
from solcore.structure import Layer
from solcore.constants import q, h, c
from solcore.interpolate import interp1d
from solcore.solar_cell import SolarCell
from rayflare.rigorous_coupled_wave_analysis import rcwa_structure
from rayflare.transfer_matrix_method import tmm_structure
from rayflare.options import default_options
import matplotlib.pyplot as plt
InGaP = material('GaInP')(In=0.5)
GaAs = material('GaAs')()
Ge = material('Ge')()
Ag = material('Ag')()
Air = material('Air')()
Al2O3 = material('Al2O3')()
wavelengths = np.linspace(250, 1900, 500) * 1e-9
options = default_options()
options.wavelengths = wavelengths
size = ((100, 0), (0, 100))
# anti-reflection coating
ARC = [Layer(si('80nm'), Al2O3)]
solar_cell = SolarCell(ARC + [Layer(material=InGaP, width=si('400nm')),
Layer(material=GaAs, width=si('4000nm')),
Layer(material=Ge, width=si('3000nm'))], substrate=Ag)
rcwa_setup = rcwa_structure(solar_cell, size, 2, options, Air, Ag)
tmm_setup = tmm_structure(solar_cell, coherent=True)
spect = np.loadtxt('data/AM0.csv', delimiter=',')
AM0 = interp1d(spect[:, 0], spect[:, 1])(wavelengths * 1e9)
for pol in ['s', 'p', 'u']:
for angle in [0, 60]:
options['pol'] = pol
options['theta_in'] = angle
rcwa_result = rcwa_setup.calculate()
tmm_result = tmm_setup.calculate(wavelength=wavelengths*1e9, pol=pol, angle=angle*np.pi/180)
Jsc_TMM = 0.1 * (q / (h * c))* np.trapz(wavelengths[:, None]*1e9*tmm_result['A_per_layer'] * AM0[:, None],
wavelengths*1e9, axis=0)/1e9
Jsc_RCWA = 0.1 * (q / (h * c))* np.trapz(wavelengths[:, None]*1e9*rcwa_result['A_per_layer'] * AM0[:, None],
wavelengths*1e9, axis=0)/1e9
print('Pol: ' + options['pol'] + ', Angle: ' + str(options['theta_in']) + ' deg \n' +
'TMM currents: ' + str(np.round(Jsc_TMM[1:], 3)) + '\n' +
'RCWA currents: ' + str(np.round(Jsc_RCWA[1:], 3)) + '\n')
plt.figure()
plt.plot(wavelengths*1e9, tmm_result['A_per_layer'][:, 1:])
plt.plot(wavelengths*1e9, rcwa_result['A_per_layer'][:, 1:], '--')
plt.title('Pol: ' + options['pol'] + ', Angle: ' + str(options['theta_in']) + ' deg')
plt.show()