Describe the bug
A clear and concise description of what the bug is.
when I want to use InGaAs when In=0.53 to cacluate IV and EQE, it doesn't work, which occurs an index error.
To Reproduce
Steps to reproduce the behavior:
import numpy as np
import matplotlib.pyplot as plt
import solcore.poisson_drift_diffusion as PDD
from solcore import siUnits, material, si
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
from solcore.light_source import LightSource
all_materials = []
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("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)
T = 300
InP = material("InP")(Nd=siUnits(5e18, "cm-3")) # n+ emitter
InGaAs = material("InGaAs")(In=0.53, Na=siUnits(3e17, "cm-3")) # p base
solar_cell = SolarCell([
Junction([
Layer(width=siUnits(0.2, "um"), material=InP, role="emitter"), # 光照侧
Layer(width=siUnits(2, "um"), material=InGaAs, role="base") # 背面
],
sn=1e3, sp=1e3, T=300, kind='PDD',
interface_defects=[{
"interface": "InGaAsP / InP",
"type": "neutral",
"sigma_n": 1e-15,
"sigma_p": 1e-15,
"energy_level": -0.15,
"density": 1e12
}])
], T=T, R_series=0, reflectivity=ref, shading=0.08, cell_area=0.7 * 0.7 / 1e4)
wl = np.linspace(280, 1850, 700) * 1e-9
Set up the light source
lightsource = LightSource(source_type='standard', version='AM1.5g', x=wl,
output_units='photon_flux_per_m')
Calculate the EQE for the solar cell:
solar_cell_solver(solar_cell, 'qe', user_options={'wavelength': wl,
'da_mode': 'green',
'optics_method': 'TMM'
})
plt.figure(1)
plt.plot(wl * 1e9, solar_cell(0).eqe(wl) * 100, 'b', label='InGaAs QE', linewidth=2)
try:
if hasattr(solar_cell(0), 'layer_absorption'):
absorption = solar_cell(0).layer_absorption * 100
plt.fill_between(wl * 1e9, absorption, 0, alpha=0.3,
label='InGaAs Abs.', color='b')
except:
print("Absorption data not available for plotting")
plt.plot(wl * 1e9, 100 * (1 - solar_cell.reflected), '--k',
label="100 - Reflectivity", linewidth=1)
plt.legend()
plt.ylim(0, 100)
plt.ylabel('EQE (%)')
plt.xlabel('Wavelength (nm)')
plt.title('External Quantum Efficiency')
plt.grid(True, alpha=0.3)
plt.show()
V = np.linspace(-3, 0, 300)
internal_voltages = np.linspace(-4, 2, 400)
solar_cell_solver(solar_cell, 'iv', user_options={'light_source': lightsource,
'voltages': V,
'internal_voltages': internal_voltages,
'light_iv': True,
'wavelength': wl,
'optics_method': 'TMM',
'mpp': True,
})
plt.figure(2)
plt.plot(abs(V), -solar_cell.iv['IV'][1] / 10, 'k', linewidth=3, label='Total IV')
plt.text(0.5, 30, f'Jsc= {abs(solar_cell.iv.Isc / 10):.2f} mA.cm' + r'$^{-2}$')
plt.text(0.5, 28, f'Voc= {abs(solar_cell.iv.Voc):.2f} V')
plt.text(0.5, 26, f'FF= {solar_cell.iv.FF * 100:.2f} %')
plt.text(0.5, 24, f'Eta= {solar_cell.iv.Eta * 100:.2f} %')
plt.legend()
plt.ylim(0, 35)
plt.xlim(0, 3)
plt.ylabel('Current (mA/cm$^2$)')
plt.xlabel('Voltage (V)')
plt.title('Current-Voltage Characteristics')
plt.grid(True, alpha=0.3)
plt.show()
print("\n=== Solar Cell Performance ===")
print(f"Short-circuit current density (Jsc): {abs(solar_cell.iv.Isc / 10):.2f} mA/cm²")
print(f"Open-circuit voltage (Voc): {abs(solar_cell.iv.Voc):.3f} V")
print(f"Fill Factor (FF): {solar_cell.iv.FF * 100:.2f} %")
print(f"Efficiency (η): {solar_cell.iv.Eta * 100:.2f} %")
print(f"Maximum power point voltage (Vmpp): {solar_cell.iv.Vmpp:.3f} V")
print(f"Maximum power point current (Impp): {abs(solar_cell.iv.Impp / 10):.2f} mA/cm²")
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: [e.g. iOS]
- Solcore Version [e.g. 22]
Additional context
Add any other context about the problem here.
Describe the bug
A clear and concise description of what the bug is.
when I want to use InGaAs when In=0.53 to cacluate IV and EQE, it doesn't work, which occurs an index error.
To Reproduce
Steps to reproduce the behavior:
import numpy as np
import matplotlib.pyplot as plt
import solcore.poisson_drift_diffusion as PDD
from solcore import siUnits, material, si
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
from solcore.light_source import LightSource
all_materials = []
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("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)
T = 300
InP = material("InP")(Nd=siUnits(5e18, "cm-3")) # n+ emitter
InGaAs = material("InGaAs")(In=0.53, Na=siUnits(3e17, "cm-3")) # p base
solar_cell = SolarCell([
Junction([
Layer(width=siUnits(0.2, "um"), material=InP, role="emitter"), # 光照侧
Layer(width=siUnits(2, "um"), material=InGaAs, role="base") # 背面
],
sn=1e3, sp=1e3, T=300, kind='PDD',
interface_defects=[{
"interface": "InGaAsP / InP",
"type": "neutral",
"sigma_n": 1e-15,
"sigma_p": 1e-15,
"energy_level": -0.15,
"density": 1e12
}])
], T=T, R_series=0, reflectivity=ref, shading=0.08, cell_area=0.7 * 0.7 / 1e4)
wl = np.linspace(280, 1850, 700) * 1e-9
Set up the light source
lightsource = LightSource(source_type='standard', version='AM1.5g', x=wl,
output_units='photon_flux_per_m')
Calculate the EQE for the solar cell:
solar_cell_solver(solar_cell, 'qe', user_options={'wavelength': wl,
'da_mode': 'green',
'optics_method': 'TMM'
})
plt.figure(1)
plt.plot(wl * 1e9, solar_cell(0).eqe(wl) * 100, 'b', label='InGaAs QE', linewidth=2)
try:
if hasattr(solar_cell(0), 'layer_absorption'):
absorption = solar_cell(0).layer_absorption * 100
plt.fill_between(wl * 1e9, absorption, 0, alpha=0.3,
label='InGaAs Abs.', color='b')
except:
print("Absorption data not available for plotting")
plt.plot(wl * 1e9, 100 * (1 - solar_cell.reflected), '--k',
label="100 - Reflectivity", linewidth=1)
plt.legend()
plt.ylim(0, 100)
plt.ylabel('EQE (%)')
plt.xlabel('Wavelength (nm)')
plt.title('External Quantum Efficiency')
plt.grid(True, alpha=0.3)
plt.show()
V = np.linspace(-3, 0, 300)
internal_voltages = np.linspace(-4, 2, 400)
solar_cell_solver(solar_cell, 'iv', user_options={'light_source': lightsource,
'voltages': V,
'internal_voltages': internal_voltages,
'light_iv': True,
'wavelength': wl,
'optics_method': 'TMM',
'mpp': True,
})
plt.figure(2)
plt.plot(abs(V), -solar_cell.iv['IV'][1] / 10, 'k', linewidth=3, label='Total IV')
plt.text(0.5, 30, f'Jsc= {abs(solar_cell.iv.Isc / 10):.2f} mA.cm' + r'$^{-2}$')
plt.text(0.5, 28, f'Voc= {abs(solar_cell.iv.Voc):.2f} V')
plt.text(0.5, 26, f'FF= {solar_cell.iv.FF * 100:.2f} %')
plt.text(0.5, 24, f'Eta= {solar_cell.iv.Eta * 100:.2f} %')
plt.legend()
plt.ylim(0, 35)
plt.xlim(0, 3)
plt.ylabel('Current (mA/cm$^2$)')
plt.xlabel('Voltage (V)')
plt.title('Current-Voltage Characteristics')
plt.grid(True, alpha=0.3)
plt.show()
print("\n=== Solar Cell Performance ===")
print(f"Short-circuit current density (Jsc): {abs(solar_cell.iv.Isc / 10):.2f} mA/cm²")
print(f"Open-circuit voltage (Voc): {abs(solar_cell.iv.Voc):.3f} V")
print(f"Fill Factor (FF): {solar_cell.iv.FF * 100:.2f} %")
print(f"Efficiency (η): {solar_cell.iv.Eta * 100:.2f} %")
print(f"Maximum power point voltage (Vmpp): {solar_cell.iv.Vmpp:.3f} V")
print(f"Maximum power point current (Impp): {abs(solar_cell.iv.Impp / 10):.2f} mA/cm²")
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.