def test_mj_j_from_v(self): """ Test MJCell.get_j_from_v() :return: """ sq1_cell = SQCell(eg=1.87, cell_T=300, plug_in_term=rev_diode) sq2_cell = SQCell(eg=1.42, cell_T=300, plug_in_term=rev_diode) sq3_cell = SQCell(eg=1.0, cell_T=300, plug_in_term=rev_diode) tj_cell = MJCell([sq1_cell, sq2_cell, sq3_cell]) tj_cell.set_input_spectrum(load_astm(("AM1.5d"))) solved_mj_v, solved_mj_i = tj_cell.get_iv() volt = np.linspace(2.5, 5, num=300) solved_current = tj_cell.get_j_from_v(volt, max_iter=3) interped_i = np.interp(volt, solved_mj_v, solved_mj_i) print(solved_current - interped_i) plt.plot(volt, interped_i, '.-') plt.plot(solved_mj_v, solved_mj_i, '.-') plt.plot(volt, solved_current, '.-', label='get_j_from_v', alpha=0.3) plt.ylim([-200, 0]) plt.legend() plt.show()
def test_mj_cell_iv(self): """ Test solving multi-junction cells, by breaking it down into series-connected subcells. :return: """ sq1_cell = SQCell(eg=1.87, cell_T=300, plug_in_term=rev_breakdown_diode) sq2_cell = SQCell(eg=1.42, cell_T=300, plug_in_term=rev_breakdown_diode) sq3_cell = SQCell(eg=1.0, cell_T=300, plug_in_term=rev_breakdown_diode) tj_cell = MJCell([sq1_cell, sq2_cell, sq3_cell]) tj_cell.set_input_spectrum(load_astm(("AM1.5d"))) solved_mj_v, solved_mj_i = tj_cell.get_iv() # plot the I-V of sq1,sq2 and sq3 volt = np.linspace(-3, 3, num=300) plt.plot(volt, sq1_cell.get_j_from_v(volt), label="top cell") plt.plot(volt, sq2_cell.get_j_from_v(volt), label="middle cell") plt.plot(volt, sq3_cell.get_j_from_v(volt), label="bottom cell") plt.plot(solved_mj_v, solved_mj_i, '.-', label="MJ cell") plt.ylim([-200, 0]) plt.xlim([-5, 6]) plt.xlabel("voltage (V)") plt.ylabel("currnet (A/m^2)") plt.legend() plt.show()