def test_light_iv(AlGaAs, light_source): import numpy as np from solcore.solar_cell import SolarCell, default_GaAs from solcore import material from solcore.solar_cell_solver import solar_cell_solver expected = np.array([ 142.68025180227374, 2.519346556870366, 0.9169672186977382, 329.61395441947565, 2.347826086956522, 140.3911287342211, 0.3294918264376029, ]) T = AlGaAs.T Vin = np.linspace(-2, 2.61, 201) V = np.linspace(0, 2.6, 300) substrate = material("GaAs")(T=T) my_solar_cell = SolarCell([AlGaAs, default_GaAs(T)], T=T, R_series=0, substrate=substrate) solar_cell_solver( my_solar_cell, "iv", user_options={ "T_ambient": T, "db_mode": "boltzmann", "voltages": V, "light_iv": True, "wavelength": light_source.x, "optics_method": "BL", "mpp": True, "internal_voltages": Vin, "light_source": light_source, }, ) output = [ my_solar_cell.iv.Isc, my_solar_cell.iv.Voc, my_solar_cell.iv.FF, my_solar_cell.iv.Pmpp, my_solar_cell.iv.Vmpp, my_solar_cell.iv.Impp, my_solar_cell.iv.Eta, ] assert np.array(output) == approx(expected, rel=1e-2)
def test_light_iv(): answer = [ 142.68025180227374, 2.519346556870366, 0.9169672186977382, 329.61395441947565, 2.347826086956522, 140.3911287342211, 0.3294918264376029, ] with tempfile.TemporaryDirectory(prefix="tmp", suffix="_sc3TESTS") as working_directory: filename = os.path.join(working_directory, "solcore_log.txt") PDD.log(filename) my_solar_cell = SolarCell([AlGaAs(T), default_GaAs(T)], T=T, R_series=0, substrate=substrate) solar_cell_solver( my_solar_cell, "iv", user_options={ "T_ambient": T, "db_mode": "boltzmann", "voltages": V, "light_iv": True, "wavelength": wl, "optics_method": "BL", "mpp": True, "internal_voltages": Vin, "light_source": light_source, }, ) output = [ my_solar_cell.iv.Isc, my_solar_cell.iv.Voc, my_solar_cell.iv.FF, my_solar_cell.iv.Pmpp, my_solar_cell.iv.Vmpp, my_solar_cell.iv.Impp, my_solar_cell.iv.Eta, ] for i in range(len(output)): assert output[i] == approx(answer[i])
def test_quantum_efficiency(AlGaAs, light_source): import numpy as np from solcore.solar_cell import SolarCell, default_GaAs from solcore import material from solcore.solar_cell_solver import solar_cell_solver expected = np.array([ 0.9866334968497021, 2.1512408472022467e-14, 0.9779769012349702, 0.03506561338387434, ]) T = AlGaAs.T Vin = np.linspace(-2, 2.61, 201) V = np.linspace(0, 2.6, 300) substrate = material("GaAs")(T=T) my_solar_cell = SolarCell([AlGaAs, default_GaAs(T)], T=T, R_series=0, substrate=substrate) solar_cell_solver( my_solar_cell, "qe", user_options={ "T_ambient": T, "db_mode": "boltzmann", "voltages": V, "light_iv": True, "wavelength": light_source.x, "optics_method": "BL", "mpp": True, "internal_voltages": Vin, "light_source": light_source, }, ) output = [ my_solar_cell[0].eqe(500e-9), my_solar_cell[0].eqe(800e-9), my_solar_cell[1].eqe(700e-9), my_solar_cell[1].eqe(900e-9), ] assert np.array(output) == approx(expected, abs=1e-3)
def test_quantum_efficiency(): answer = [ 0.9866334968497021, 2.1512408472022467e-14, 0.9779769012349702, 0.03506561338387434, ] with tempfile.TemporaryDirectory(prefix="tmp", suffix="_sc3TESTS") as working_directory: filename = os.path.join(working_directory, "solcore_log.txt") PDD.log(filename) my_solar_cell = SolarCell([AlGaAs(T), default_GaAs(T)], T=T, R_series=0, substrate=substrate) solar_cell_solver( my_solar_cell, "qe", user_options={ "T_ambient": T, "db_mode": "boltzmann", "voltages": V, "light_iv": True, "wavelength": wl, "optics_method": "BL", "mpp": True, "internal_voltages": Vin, "light_source": light_source, }, ) output = [ my_solar_cell[0].eqe(500e-9), my_solar_cell[0].eqe(800e-9), my_solar_cell[1].eqe(700e-9), my_solar_cell[1].eqe(900e-9), ] for i in range(len(output)): assert output[i] == approx(answer[i])
def test_92_light_iv(self): answer = [ 142.68025180227374, 2.519346556870366, 0.9169672186977382, 329.61395441947565, 2.347826086956522, 140.3911287342211, 0.3294918264376029 ] with tempfile.TemporaryDirectory( prefix="tmp", suffix="_sc3TESTS") as working_directory: filename = os.path.join(working_directory, 'solcore_log.txt') PDD.log(filename) my_solar_cell = SolarCell([AlGaAs(T), default_GaAs(T)], T=T, R_series=0, substrate=substrate) solar_cell_solver(my_solar_cell, 'iv', user_options={ 'T_ambient': T, 'db_mode': 'boltzmann', 'voltages': V, 'light_iv': True, 'wavelength': wl, 'optics_method': 'BL', 'mpp': True, 'internal_voltages': Vin, 'light_source': light_source }) output = [ my_solar_cell.iv.Isc, my_solar_cell.iv.Voc, my_solar_cell.iv.FF, my_solar_cell.iv.Pmpp, my_solar_cell.iv.Vmpp, my_solar_cell.iv.Impp, my_solar_cell.iv.Eta ] for i in range(len(output)): self.assertAlmostEqual(output[i], answer[i])
def test_92_light_iv(self): answer = [ 141.434980729, 2.46952886616, 0.91434377329, 319.359951949, 2.29565217391, 139.115130584, 0.319241623262 ] with tempfile.TemporaryDirectory( prefix="tmp", suffix="_sc3TESTS") as working_directory: filename = os.path.join(working_directory, 'solcore_log.txt') PDD.log(filename) my_solar_cell = SolarCell([AlGaAs(T), default_GaAs(T)], T=T, R_series=0, substrate=substrate) solar_cell_solver(my_solar_cell, 'iv', user_options={ 'T_ambient': T, 'db_mode': 'boltzmann', 'voltages': V, 'light_iv': True, 'wavelength': wl, 'optics_method': 'BL', 'mpp': True, 'internal_voltages': Vin, 'light_source': light_source }) output = [ my_solar_cell.iv.Isc, my_solar_cell.iv.Voc, my_solar_cell.iv.FF, my_solar_cell.iv.Pmpp, my_solar_cell.iv.Vmpp, my_solar_cell.iv.Impp, my_solar_cell.iv.Eta ] for i in range(len(output)): self.assertAlmostEqual(output[i], answer[i])
def test_93_qe(self): answer = [ 0.9831923128532823, 1.315965183418519e-13, 0.9672990699170962, 0.032767290395462376 ] with tempfile.TemporaryDirectory( prefix="tmp", suffix="_sc3TESTS") as working_directory: filename = os.path.join(working_directory, 'solcore_log.txt') PDD.log(filename) my_solar_cell = SolarCell([AlGaAs(T), default_GaAs(T)], T=T, R_series=0, substrate=substrate) solar_cell_solver(my_solar_cell, 'qe', user_options={ 'T_ambient': T, 'db_mode': 'boltzmann', 'voltages': V, 'light_iv': True, 'wavelength': wl, 'optics_method': 'BL', 'mpp': True, 'internal_voltages': Vin, 'light_source': light_source }) output = [ my_solar_cell[0].eqe(500e-9), my_solar_cell[0].eqe(800e-9), my_solar_cell[1].eqe(700e-9), my_solar_cell[1].eqe(900e-9) ] for i in range(len(output)): self.assertAlmostEqual(output[i], answer[i])
def test_93_qe(self): answer = [ 0.9866334968497021, 2.1512408472022467e-14, 0.9779769012349702, 0.03506561338387434 ] with tempfile.TemporaryDirectory( prefix="tmp", suffix="_sc3TESTS") as working_directory: filename = os.path.join(working_directory, 'solcore_log.txt') PDD.log(filename) my_solar_cell = SolarCell([AlGaAs(T), default_GaAs(T)], T=T, R_series=0, substrate=substrate) solar_cell_solver(my_solar_cell, 'qe', user_options={ 'T_ambient': T, 'db_mode': 'boltzmann', 'voltages': V, 'light_iv': True, 'wavelength': wl, 'optics_method': 'BL', 'mpp': True, 'internal_voltages': Vin, 'light_source': light_source }) output = [ my_solar_cell[0].eqe(500e-9), my_solar_cell[0].eqe(800e-9), my_solar_cell[1].eqe(700e-9), my_solar_cell[1].eqe(900e-9) ] for i in range(len(output)): self.assertAlmostEqual(output[i], answer[i])
output = Junction([ Layer(width=si('30nm'), material=window, role="Window"), Layer(width=si('150nm'), material=p_AlGaAs, role="Emitter"), Layer(width=si('1000nm'), material=n_AlGaAs, role="Base"), Layer(width=si('200nm'), material=bsf, role="BSF") ], sn=1e6, sp=1e6, T=T, kind='PDD') return output my_solar_cell = SolarCell([AlGaAs(T), default_GaAs(T)], T=T, R_series=0, substrate=substrate) Vin = np.linspace(-2, 2.61, 201) V = np.linspace(0, 2.6, 300) wl = np.linspace(350, 1000, 301) * 1e-9 light_source = LightSource(source_type='standard', version='AM1.5g', x=wl, output_units='photon_flux_per_m', concentration=1) # We calculate the IV curve under illumination solar_cell_solver(my_solar_cell,
output = Junction([ Layer(width=si('30nm'), material=window, role="Window"), Layer(width=si('150nm'), material=p_AlGaAs, role="Emitter"), Layer(width=si('1000nm'), material=n_AlGaAs, role="Base"), Layer(width=si('200nm'), material=bsf, role="BSF") ], sn=1e6, sp=1e6, T=T, kind='PDD') return output my_solar_cell = SolarCell([default_GaAs(T)], T=T, R_series=0, substrate=substrate) Vin = np.linspace(-2, 2.61, 201) V = np.linspace(0, 2.6, 300) wl = np.linspace(350, 1000, 301) * 1e-9 light_source = LightSource(source_type='standard', version='AM1.5g', x=wl, output_units='photon_flux_per_m', concentration=1) if __name__ == '__main__': # We calculate the IV curve under illumination