Esempio n. 1
0
    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()
Esempio n. 2
0
    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()
Esempio n. 3
0
    def test_parallel_connected_mj_cells(self):
        """
        Connected two triple-junction cells in parallel

        :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")))

        tj_cell_1 = copy.deepcopy(tj_cell)
        tj_cell_2 = copy.deepcopy(tj_cell)

        iv_funcs = [tj_cell_1.get_j_from_v, tj_cell_2.get_j_from_v]

        parallel_v, parallel_i = solve_parallel_connected_ivs(iv_funcs, vmin=-2, vmax=3.5, vnum=30)
        volt = np.linspace(-2, 3.5, num=30)
        curr = tj_cell_1.get_j_from_v(volt)

        plt.plot(volt, curr, '.-', label="single string")
        plt.plot(parallel_v, parallel_i, '.-', label="strings connected in parallel")
        plt.ylim([-600, 0])
        plt.show()
Esempio n. 4
0
    def test_series_connected_mj_cells(self):
        """
        Test three series-connected triple-junction cells.
        We break them down into nine series-connected subcells and perform ```solve_series_connected_ivs()```

        :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")))

        # Set up the MJCell() first. The purpose is only for calculating the transmitted spectrum
        # and the photocurrent of each subcell. We don't use the MJCell.get_j_from_v() to solve the I-V
        connected_cells = []
        number_of_mjcell = 3

        multi = np.array([0, 0.25, 0.5])
        for i in range(number_of_mjcell):
            # Need copy.deepcopy to also copy the subcells
            c_tj_cell = copy.deepcopy(tj_cell)
            # multi = np.random.random() * 0.5

            c_tj_cell.set_input_spectrum(load_astm("AM1.5d") * (1 + multi[i]))
            connected_cells.append(c_tj_cell)

        # Extract each subcell, make them into series-connected cells
        # Connect all the subcells in series
        iv_funcs = []
        for mj_cells in connected_cells:
            for subcell in mj_cells.subcell:
                iv_funcs.append(subcell.get_j_from_v)

        reverse_plot = True

        if reverse_plot:
            rev_fac = -1
        else:
            rev_fac =1

        from pypvcell.fom import isc
        for idx, cell in enumerate(connected_cells):
            v, i = cell.get_iv()
            print(isc(v, i * rev_fac))
            plt.plot(v, i * rev_fac, label="MJ cell {}".format(idx + 1))

        iv_pair = solve_series_connected_ivs(iv_funcs, vmin=-1, vmax=3.5, vnum=300)

        plt.plot(iv_pair[0], iv_pair[1] * rev_fac, '.-', label="Connected I-V")
        plt.ylim(sorted([-300 * rev_fac, 0]))
        plt.xlim([-10, 12])
        plt.xlabel("voltage (V)")
        plt.ylabel("current (A/m^2)")
        plt.legend()
        plt.savefig("./tests_output/Mjx3_demo.png", dpi=300)
        plt.show()
Esempio n. 5
0
    def test_two_connected_mj_cells(self):
        """
        Test three series-connected triple-junction cells.
        We use MJCells.get_j_from_v() as the iv_func of the bracket-based root-finding solver.
        Warning: this is slow.

        :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")))

        tj_cell_1 = copy.deepcopy(tj_cell)
        tj_cell_2 = copy.deepcopy(tj_cell)

        iv_funcs = [tj_cell_1.get_j_from_v, tj_cell_2.get_j_from_v]
        # solved_v,solved_i=solve_series_connected_ivs(iv_funcs, vmin=-2, vmax=3, vnum=10)
        volt_range = np.linspace(-1, 4, num=25)
        curr_range = tj_cell_1.get_j_from_v(volt_range)

        from scipy.optimize import brentq

        solved_v, solved_i = solve_v_from_j_by_bracket_root_finding(iv_funcs[0], curr_range, -5, 5, brentq)

        plt.plot(solved_v, solved_i, '.-')
        plt.ylim([-300, 0])
        plt.show()
Esempio n. 6
0
    def test_mjcell(self):

        sq_ingap = SQCell(eg=1.9, cell_T=293)
        sq_gaas = SQCell(eg=1.42, cell_T=293)

        dj_cell = MJCell([sq_ingap, sq_gaas])
        dj_cell.set_input_spectrum(self.input_ill)

        print("2J eta:%s" % dj_cell.get_eta())
Esempio n. 7
0
    def test_3jcell(self):

        sq_ingap = SQCell(eg=1.9, cell_T=293)
        sq_gaas = SQCell(eg=1.42, cell_T=293)
        sq_ge = SQCell(eg=0.67, cell_T=293)

        tj_cell = MJCell([sq_ingap, sq_gaas, sq_ge])
        tj_cell.set_input_spectrum(self.input_ill)

        print("3J eta: %s" % tj_cell.get_eta())