def get_iv(**kwargs): candidate = dpv.objects.update(material, **kwargs) des = dpv.make_design(n_points=500, Ls=[1e-4, 1e-4], mats=candidate, Ns=[1e17, -1e17], Snl=1e7, Snr=0, Spl=0, Spr=1e7) results = dpv.simulate(des, verbose=False) return results["iv"][1]
def test_iv(self): L = 3e-4 J = 5e-6 material = dpv.create_material(Chi=3.9, Eg=1.5, eps=9.4, Nc=8e17, Nv=1.8e19, mn=100, mp=100, Et=0, tn=1e-8, tp=1e-8, A=1e4) design = dpv.make_design(n_points=500, Ls=[J, L - J], mats=[material, material], Ns=[1e17, -1e15], Snl=1e7, Snr=0, Spl=0, Spr=1e7) results = dpv.simulate(design) v, j = results["iv"] v_correct = [ 0.0, 0.05, 0.1, 0.15000000000000002, 0.2, 0.25, 0.30000000000000004, 0.35000000000000003, 0.4, 0.45, 0.5, 0.55, 0.6000000000000001, 0.6500000000000001, 0.7000000000000001, 0.75, 0.8, 0.85, 0.9, 0.9500000000000001 ] j_correct = [ 0.01882799450659129, 0.018753370994746384, 0.018675073222852775, 0.018592788678882418, 0.01850616015841796, 0.018414776404918568, 0.018318159501526814, 0.01821574845029824, 0.018106874755825324, 0.0179907188741479, 0.017866203205496447, 0.017731661626627034, 0.017583825887487907, 0.01741498506998538, 0.017204823904941775, 0.01689387681804267, 0.01628556057166174, 0.014630769395991339, 0.008610345709349041, -0.018267911703588706 ] self.assertTrue(jnp.allclose(v, v_correct), "Voltages do not match!") self.assertTrue(jnp.allclose(j, j_correct), "Currents do not match!")
tn=5e-9, tp=5e-9, Chi=3.9, A=1e4) des = dpv.make_design(n_points=500, Ls=[t1, t2], mats=[CdS, CdTe], Ns=[1e17, -1e15], Snl=1.16e7, Snr=1.16e7, Spl=1.16e7, Spr=1.16e7) ls = dpv.incident_light() if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("--save") args = parser.parse_args() results = dpv.simulate(des, ls) v, j = results["iv"] dpv.plot_iv_curve(v, j) dpv.plot_bars(des) dpv.plot_band_diagram(des, results["eq"], eq=True) dpv.plot_band_diagram(des, results["Voc"]) dpv.plot_charge(des, results["eq"]) eff = results["eff"] * 100 print(f"efficiency: {eff}%")
def f(x): des = x2des(x) results = dpv.simulate(des, verbose=False) eff = results["eff"] * 100 return -eff