-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathShockleyQueisserTJ.py
118 lines (104 loc) · 4.62 KB
/
ShockleyQueisserTJ.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ======================================================================================================
# Solar Cell Shockley-Queisser Limit Calculator
# Code written by:
# Pr. Sidi Hamady
# Université de Lorraine, France
# See Copyright Notice in COPYRIGHT
# HowTo in README.md and README.pdf
# https://github.com/sidihamady/Shockley-Queisser
# http://www.hamady.org/photovoltaics/ShockleyQueisser.zip
# ======================================================================================================
# ShockleyQueisserTJ.py
# an example on how to use the command-line mode to perform specific calculations
# such as multijunction solar cell efficiency:
# calculates the efficiency of a triple junction solar cell and plots current-voltage characteristics
# import the program core class
from ShockleyQueisserCore import *
# create an instance of the core class
# set useTkinterGUI to False to use the command-line mode
SCC = ShockleyQueisserCore(verbose = False, useTkinterGUI = False)
# set the triple junction solar cell parameters
aTargetBandgap = np.array([1.9, 1.4, 0.9]) # bandgaps
aTargetBandgapTop = np.array([0, 1.9, 1.4]) # top bandgap for each cell (0 for the top cell)
aTargetLabel = ["Top", "Middle", "Bottom"]
aTargetLen = len(aTargetBandgap)
#
# initialize the output parameters
aJSC = np.array([])
aVOC = np.array([])
aFF = np.array([])
aV = {}
aJ = {}
jj = 0
jjx = 0
aVOCx = 0.0
#
for TB,TBT in zip(aTargetBandgap, aTargetBandgapTop):
SCC.calculate(
TargetBandgap = TB,
TargetBandgapTop = TBT,
Temperature = 300.0,
SolarConcentration = 1.0,
OutputFilename = None
)
aJSC = np.append(aJSC, SCC.Target_JSC)
aVOC = np.append(aVOC, SCC.Target_VOC)
aFF = np.append(aFF, SCC.Target_FF)
aV[jj] = np.copy(SCC.Target_Voltage)
aJ[jj] = np.copy(SCC.Target_Current)
if (jj == 0) or ((jj > 0) and (SCC.Target_VOC < aVOCx)):
aVOCx = SCC.Target_VOC
jjx = jj
# end if
jj += 1
# end for
# get the multijunction solar cell current-voltage characteristic
aVx = np.array([])
aJx = np.array([])
for ii in range(0, len(aV[jjx])):
tV = 0.0
tJ = 0.0
for jj in range(0, aTargetLen):
# sum voltage
tV += aV[jj][ii]
# take the min current (J is negative, from -JSC to 0)
if (jj == 0) or ((jj > 0) and (aJ[jj][ii] > tJ)):
tJ = aJ[jj][ii]
# end if
# end for
aVx = np.append(aVx, tV)
aJx = np.append(aJx, tJ)
# end for
aPm = np.min(aJx * aVx) # nominal power in mW/cm2
aPsolar = 0.1 * SCC.SolarPower * SCC.SolarConcentration # solar power, to convert from W/m2 to mW/cm2
aEff = -100.0 * aPm / aPsolar # efficiency in percentage
treport = ("Triple junction solar cell efficiency = %.3f %%\n with a nominal power of %.3f mW/cm2" % (aEff, -aPm))
print("\n----------------------------------------------------------------------\n" + treport + "\n----------------------------------------------------------------------\n")
# plot the current-voltage characteristics
fig = pl.figure(figsize=(10, 6), dpi=100, facecolor='#FFFFFF', linewidth=1.0, frameon=True)
fig.canvas.set_window_title('Triple Junction Solar Cell')
ax = fig.add_subplot(111)
linestyle = ['-', '-', '-', '-']
linecolor = ['m', 'b', 'r', 'olive']
linesize = [1.5, 1.5, 1.5, 2.0]
for jj in range(0, aTargetLen):
tline, = ax.plot(aV[jj], aJ[jj], linestyle[jj], linewidth=linesize[jj], label=aTargetLabel[jj])
tline.set_color(linecolor[jj])
# end for
tline, = ax.plot(aVx, aJx, linestyle[aTargetLen], linewidth=linesize[aTargetLen], label="Triple Junction")
tline.set_color(linecolor[aTargetLen])
leg = pl.legend(loc='best', ncol=4, frameon=1, fontsize='medium')
legframe = leg.get_frame()
legframe.set_facecolor('white')
legframe.set_edgecolor('black')
leg.get_frame().set_alpha(0.5)
pl.axhline(y=0, xmin=0, xmax=1, linewidth=2, color='k')
pl.axvline(x=0, ymin=0, ymax=1, linewidth=2, color='k')
ax.set_xlabel('$Voltage\ (V)$', fontsize=14)
ax.set_ylabel('$Current\ (mA/cm^2)$', fontsize=14)
pl.title('Triple Junction Solar Cell Current-Voltage Characteristic')
pl.show()
#