Exemplo n.º 1
0
    def execute(self):

        ## Set up power supply
        pow_supply = ke2410(self.pow_supply_address)
        pow_supply.reset()
        pow_supply.set_source('voltage')
        pow_supply.set_sense('current')
        pow_supply.set_current_limit(self.lim_cur)
        pow_supply.set_voltage(0)
        pow_supply.set_terminal('rear')
        pow_supply.set_interlock_on()
        pow_supply.set_output_on()

        ## Set up lcr meter
        lcr_meter = hp4980(self.lcr_meter_address)
        lcr_meter.reset()
        lcr_meter.set_voltage(self.lcr_vol)
        lcr_meter.set_frequency(self.lcr_freq)
        lcr_meter.set_mode('RX')

        # Set up switch
        switch = switchcard(self.switch_address)
        switch.reboot()
        switch.set_measurement_type('CV')
		switch.set_cv_resistance(self.cv_res)
    def execute(self):

        ## Set up power supply
        pow_supply = ke2410(self.pow_supply_address)
        pow_supply.reset()
        pow_supply.set_source('voltage')
        pow_supply.set_sense('current')
        pow_supply.set_current_limit(self.lim_cur)
        pow_supply.set_voltage(0)
        pow_supply.set_nplc(10)
        pow_supply.set_terminal('rear')
        pow_supply.set_output_on()

        ## Set up lcr meter
        lcr_meter = hp4980(self.lcr_meter_address)
        lcr_meter.reset()
        lcr_meter.set_voltage(self.lcr_vol)
        lcr_meter.set_frequency(self.lcr_freq)
        lcr_meter.set_mode('RX')

        # Set up switch
        switch = switchcard(self.switch_address)
        switch.reboot()
        switch.set_measurement_type('CV')
        switch.set_display_mode('OFF')

        ## Check settings
        lim_vol = pow_supply.check_voltage_limit()
        lim_cur = pow_supply.check_current_limit()
        lcr_vol = float(lcr_meter.check_voltage())
        lcr_freq = float(lcr_meter.check_frequency())
        temp_pc = switch.get_probecard_temperature()
        temp_sc = switch.get_matrix_temperature()
        # humd_pc = switch.get_probecard_humidity()
        # humd_sc = switch.get_matrix_humidity()
        type_msr = switch.get_measurement_type()
        type_disp = switch.get_display_mode()

        ## Print info
        self.logging.info("Settings:")
        self.logging.info("Power supply voltage limit:      %8.2E V" % lim_vol)
        self.logging.info("Power supply current limit:      %8.2E A" % lim_cur)
        self.logging.info("LCR measurement voltage:         %8.2E V" % lcr_vol)
        self.logging.info("LCR measurement frequency:       %8.2E Hz" %
                          lcr_freq)
        self.logging.info("Voltage delay:                   %8.2f s" %
                          self.delay_vol)
        self.logging.info("Channel delay:                   %8.2f s" %
                          self.delay_ch)
        self.logging.info("Probecard temperature:           %8.1f C" % temp_pc)
        self.logging.info("Switchcard temperature:          %8.1f C" % temp_sc)
        # self.logging.info("Probecard humidity:              %8.1f %" % humd_pc)
        # self.logging.info("Switchcard humidity:             %8.1f %" % humd_sc)
        self.logging.info("Switchcard measurement setting:  %s" % type_msr)
        self.logging.info("Switchcard display setting:      %s" % type_disp)
        self.logging.info("\t")

        self.logging.info(
            "\tVoltage [V]\tTime [s]\tChannel [-]\tR [kOhm]\tX [kOhm]\tC [pF]\tTotal Current[A]"
        )
        self.logging.info(
            "\t--------------------------------------------------------------------------"
        )

        ## Prepare
        out = []
        hd = ' Scan CV\n' \
           + ' Measurement Settings:\n' \
           + ' Power supply voltage limit:      %8.2E V\n' % lim_vol \
           + ' Power supply current limit:      %8.2E A\n' % lim_cur \
           + ' LCR measurement voltage:         %8.2E V\n' % lcr_vol \
           + ' LCR measurement frequency:       %8.0E Hz\n' % lcr_freq \
           + ' Voltage Delay:                   %8.2f s\n' % self.delay_vol \
           + ' Channel Delay:                   %8.2f s\n' % self.delay_ch \
           + ' Probecard temperature:           %8.1f C\n' % temp_pc \
           + ' Switchcard temperature:          %8.1f C\n' % temp_sc \
           + ' Switchcard measurement setting:  %s\n' % type_msr \
           + ' Switchcard display setting:      %s\n\n\n' % type_disp \
           + ' Nominal Voltage [V]\tMeasured Voltage [V]\tTime [s]\tChannel [-]\tR [kOhm]\tX [kOhm]\tC [pF]\tTotal Current[A]\n'

        ## Loop over voltages
        t = 0
        try:
            t0 = time.time()
            while (time.time() - t0 < 12 * 3600):
                for v in self.volt_list:
                    pow_supply.ramp_voltage(v)
                    time.sleep(self.delay_vol)
                    time.sleep(0.001)

                    for c in self.cell_list:
                        switch.open_channel(c)

                        t = 0
                        t1 = time.time()
                        while t < 60:
                            t = time.time() - t1
                            vol = pow_supply.read_voltage()
                            cur_tot = pow_supply.read_current()
                            r, x = lcr_meter.execute_measurement()

                            cap = (-10**(12)) / (2 * np.pi * self.lcr_freq * x)
                            time.sleep(1)

                            out.append([v, vol, t, c, r, x, cap, cur_tot])
                            self.logging.info(
                                "\t%.2f \t%.1f \t%4d \t%.3f \t%.3f \t%.3E \t%.2E"
                                % (vol, t, c, r / 1000., x / 1000., cap,
                                   cur_tot))

        except KeyboardInterrupt:
            pow_supply.ramp_voltage(0)
            self.logging.error(
                "Keyboard interrupt. Ramping down voltage and shutting down.")

        ## Close connections
        pow_supply.ramp_voltage(0)
        pow_supply.set_output_off()
        pow_supply.reset()

        ## Save and print
        self.logging.info("\n")
        self.save_list(out, "cv.dat", fmt="%.5E", header=hd)
        self.print_graph(np.array(out)[:, 2], np.array(out)[:, 6], np.array(out)[:, 6]*0.001, \
            'Channel Nr. [-]', 'Total Current [A]', 'All Channels ' + self.id, fn="cv_all_channels_%s.png" % self.id)
        self.print_graph(np.array(out)[:, 2], np.array(out)[:, 5], np.array(out)[:, 5]*0.001, \
            'Channel Nr. [-]', 'Capacitance [F]',  'CV All Channels ' + self.id, fn="cv_all_channels_%s.png" % self.id)
        if (len(self.cell_list) > 2):
            ch = int(len(self.cell_list) * 0.1) + 1
            self.print_graph(np.array([val for val in out if (val[2] == ch)])[:, 1], \
                np.array([val for val in out if (val[2] == ch)])[:, 6], \
                np.array([val for val in out if (val[2] == ch)])[:, 7], \
                'Bias Voltage [V]', 'Parallel Capacitance [F]', 'CV ' + self.id, fn="cv_channel_%d_%s.png" % (ch, self.id))
            self.print_graph(np.array([val for val in out if (val[2] == ch)])[2:, 1], \
                np.array([val for val in out if (val[2] == ch)])[2:, 6]**(-2), \
                np.array([val for val in out if (val[2] == ch)])[2:, 7] * 2 * np.array([val for val in out if (val[2] == ch)])[2:, 6]**(-3), \
                'Bias Voltage [V]', '1/C^2 [1/F^2]', '1/C2 ' + self.id, fn="1c2v_channel%d_%s.png" % (ch, self.id))
        # if (10 in out[:, 0]):
        #     self.print_graph(np.array([val for val in out if (val[0] == 10)])[:, 2], \
        #         np.array([val for val in out if (val[0] == 10)])[:, 5], \
        #         np.array([val for val in out if (val[0] == 10)])[:, 6], \
        #         'Channel Nr. [-]', 'Parallel Capacitance [F]', 'CV ' + self.id, fn="cv_all_channels_10V_%s.png" % self.id)
        #     self.print_graph(np.array([val for val in out if (val[0] == 10)])[:, 2], \
        #         np.array([val for val in out if (val[0] == 10)])[:, 7], \
        #         np.array([val for val in out if (val[0] == 10)])[:, 7]*0.01, \
        #         'Channel Nr. [-]', 'Total Current [A]', 'CV ' + self.id, fn="cv_total_current_all_channels_10V_%s.png" % self.id)
        # if (100 in out[:, 0]):
        #     self.print_graph(np.array([val for val in out if (val[0] == 100)])[:, 2], \
        #         np.array([val for val in out if (val[0] == 100)])[:, 5], \
        #         np.array([val for val in out if (val[0] == 100)])[:, 6], \
        #         'Channel Nr. [-]', 'Parallel Capacitance [F]', 'CV ' + self.id, fn="cv_all_channels_100V_%s.png" % self.id)
        #     self.print_graph(np.array([val for val in out if (val[0] == 100)])[:, 2], \
        #         np.array([val for val in out if (val[0] == 100)])[:, 7], \
        #         np.array([val for val in out if (val[0] == 100)])[:, 7]*0.01, \
        #         'Channel Nr. [-]', 'Total Current [A]', 'CV ' + self.id, fn="cv_total_current_all_channels_100V_%s.png" % self.id)
        self.logging.info("\n")

        if 0:
            self.save_list(range(0, 512, 1),
                           "channel_list.txt",
                           fmt='%d',
                           header='')
Exemplo n.º 3
0
    def execute(self):

        ## Set up power supply
        pow_supply = ke2410(self.pow_supply_address)
        pow_supply.reset()
        pow_supply.set_source('voltage')
        pow_supply.set_sense('current')
        pow_supply.set_current_limit(self.lim_cur)
        pow_supply.set_voltage(0)
        pow_supply.set_nplc(2)
        pow_supply.set_terminal('rear')
        pow_supply.set_interlock_on()
        pow_supply.set_output_on()

        ## Set up lcr meter
        lcr_meter = hp4980(self.lcr_meter_address)
        lcr_meter.reset()
        lcr_meter.set_voltage(self.lcr_vol)
        lcr_meter.set_frequency(self.lcr_freq)
        lcr_meter.set_mode('RX')

        # Set up switch
        switch = switchcard(self.switch_address)
        switch.reboot()
        switch.set_measurement_type('CV')
        switch.set_cv_resistance(self.cv_res)
        switch.set_display_mode('OFF')

        ## Check settings
        lim_vol = pow_supply.check_voltage_limit()
        lim_cur = pow_supply.check_current_limit()
        lcr_vol = float(lcr_meter.check_voltage())
        lcr_freq = float(lcr_meter.check_frequency())
        temp_pc = switch.get_probecard_temperature()
        temp_sc = switch.get_matrix_temperature()
        # humd_pc = switch.get_probecard_humidity()
        # humd_sc = switch.get_matrix_humidity()
        type_msr = switch.get_measurement_type()
        type_disp = switch.get_display_mode()

        ## Header
        hd = [
            'Scan CV\n', 'Measurement Settings:',
            'Power supply voltage limit:      %8.2E V' % lim_vol,
            'Power supply current limit:      %8.2E A' % lim_cur,
            'LCR measurement voltage:         %8.2E V' % lcr_vol,
            'LCR measurement frequency:       %8.2E Hz' % lcr_freq,
            'CV resistance:                   %8.2E Ohm' % self.cv_res,
            'Voltage delay:                   %8.2f s' % self.delay_vol,
            'Channel delay:                   %8.2f s' % self.delay_ch,
            'Probecard temperature:           %8.1f C' % temp_pc,
            'Switchcard temperature:          %8.1f C' % temp_sc,
            'Switchcard measurement setting:  %s' % type_msr,
            'Switchcard display setting:      %s' % type_disp, '\n\n',
            'Nominal Voltage [V]\t Measured Voltage [V]\tFrequency[Hz]\tChannel [-]\tR [Ohm]\tR_Err [Ohm]\tX [Ohm]\tX_Err [Ohm]\tC [F]\tTotal Current [A]\n'
        ]

        ## Print Info
        for line in hd[1:-2]:
            self.logging.info(line)
        self.logging.info("\t")
        self.logging.info("\t")
        self.logging.info(hd[-1])
        self.logging.info("-" * int(1.2 * len(hd[-1])))

        # Prepare
        out = []

        ## Loop over voltages
        try:
            for v in self.volt_list:
                switch.short_all()
                time.sleep(self.delay_ch)
                pow_supply.ramp_voltage(v)
                time.sleep(self.delay_vol)

                j = 0
                for c in self.cell_list:

                    ## Only measure unflagged cells
                    if self.flag_list[j] == 0:
                        switch.open_channel(c)
                        time.sleep(self.delay_ch)

                        ## Loop over freqs
                        for freq_nom in [
                                5E2, 1E3, 2E3, 3E3, 5E3, 1E4, 2E4, 5E4, 1E5,
                                1E6
                        ]:
                            lcr_meter.set_frequency(freq_nom)
                            time.sleep(1)
                            freq = float(lcr_meter.check_frequency())

                            cur_tot = pow_supply.read_current()
                            vol = pow_supply.read_voltage()

                            measurements = np.array([
                                lcr_meter.execute_measurement()
                                for _ in range(5)
                            ])
                            means = np.mean(measurements, axis=0)
                            errs = np.std(measurements, axis=0)

                            R, X = means
                            dR, dX = errs

                            time.sleep(0.001)

                            z = np.sqrt(R**2 + X**2)
                            phi = np.arctan(X / R)
                            r_s, c_s, l_s, D = lcr_series_equ(freq, z, phi)
                            r_p, c_p, l_p, D = lcr_parallel_equ(freq, z, phi)

                            j += 1
                            line = [
                                v, vol, freq, j, R, dR, X, dX, c_s, c_p,
                                cur_tot
                            ]
                            out.append(line)
                            self.logging.info(
                                "{:<5.2E}\t{: <5.2E}\t{: <5.2E}\t{: <5d}\t{: <5.2E}\t{: <5.2E}\t{: <5.2E}\t{: <5.2E}\t{: <8.3E}\t{: <8.3E}\t{:    <5.2E}"
                                .format(*line))

        except KeyboardInterrupt:
            switch.short_all()
            pow_supply.ramp_voltage(0)
            self.logging.error(
                "Keyboard interrupt. Ramping down voltage and shutting down.")

        ## Close connections
        switch.reset()
        pow_supply.ramp_voltage(0)
        time.sleep(15)
        pow_supply.set_interlock_off()
        pow_supply.set_output_off()
        pow_supply.reset()

        ## Save and print
        self.logging.info("\n")
        self.save_list(out, "cv.dat", fmt="%.5E", header="\n".join(hd))
        self.print_graph(np.array(out)[:, 2], np.array(out)[:, 8], np.array(out)[:, 8]*0.01, \
            'Channel Nr. [-]', 'Total Current [A]', 'All Channels ' + self.id, fn="cv_total_current_all_channels_%s.png" % self.id)
        self.print_graph(np.array(out)[:, 2], np.array(out)[:, 6], np.array(out)[:, 6]*0.01, \
            'Channel Nr. [-]', 'Capacitance [F]',  'CV All Channels ' + self.id, fn="cv_all_channels_%s.png" % self.id)
        if 0:
            ch = 1
            self.print_graph(np.array([val for val in out if (val[2] == ch)])[:, 1], \
                np.array([val for val in out if (val[2] == ch)])[:, 5], \
                np.array([val for val in out if (val[2] == ch)])[:, 6], \
                'Bias Voltage [V]', 'Parallel Capacitance [F]', 'CV ' + self.id, fn="cv_channel_%d_%s.png" % (ch, self.id))
            self.print_graph(np.array([val for val in out if (val[2] == ch)])[2:, 1], \
                np.array([val for val in out if (val[2] == ch)])[2:, 7]**(-2), \
                np.array([val for val in out if (val[2] == ch)])[2:, 7] * 0.01 * 2 * (np.array([val for val in out if (val[2] == ch)])[2:, 7]*0.01)**(-3), \
                'Bias Voltage [V]', '1/C^2 [1/F^2]', '1/C2 ' + self.id, fn="1c2v_channel%d_%s.png" % (ch, self.id))
        if (10 in np.array(out)[:, 0]):
            self.print_graph(np.array([val for val in out if (val[0] == 10)])[:, 2], \
                np.array([val for val in out if (val[0] == 10)])[:, 5], \
                np.array([val for val in out if (val[0] == 10)])[:, 6], \
                'Channel Nr. [-]', 'Parallel Capacitance [F]', 'CV ' + self.id, fn="cv_all_channels_10V_%s.png" % self.id)
            self.print_graph(np.array([val for val in out if (val[0] == 10)])[:, 2], \
                np.array([val for val in out if (val[0] == 10)])[:, 8], \
                np.array([val for val in out if (val[0] == 10)])[:, 8]*0.01, \
                'Channel Nr. [-]', 'Total Current [A]', 'CV ' + self.id, fn="cv_total_current_all_channels_10V_%s.png" % self.id)
        if (100 in np.array(out)[:, 0]):
            self.print_graph(np.array([val for val in out if (val[0] == 100)])[:, 2], \
                np.array([val for val in out if (val[0] == 100)])[:, 5], \
                np.array([val for val in out if (val[0] == 100)])[:, 6], \
                'Channel Nr. [-]', 'Parallel Capacitance [F]', 'CV ' + self.id, fn="cv_all_channels_100V_%s.png" % self.id)
            self.print_graph(np.array([val for val in out if (val[0] == 100)])[:, 2], \
                np.array([val for val in out if (val[0] == 100)])[:, 8], \
                np.array([val for val in out if (val[0] == 100)])[:, 8]*0.01, \
                'Channel Nr. [-]', 'Total Current [A]', 'CV ' + self.id, fn="cv_total_current_all_channels_100V_%s.png" % self.id)
        self.logging.info("\n")

        if 0:
            self.save_list(range(0, 512, 1),
                           "channel_list.txt",
                           fmt='%d',
                           header='')
Exemplo n.º 4
0
    def execute(self):

        ## Set up power supply
        pow_supply = ke2410(self.pow_supply_address)
        pow_supply.reset()
        pow_supply.set_source('voltage')
        pow_supply.set_sense('current')
        pow_supply.set_current_limit(self.lim_cur)
        pow_supply.set_voltage(0)
        pow_supply.set_terminal('rear')
        pow_supply.set_interlock_on()
        pow_supply.set_output_on()

        ## Set up volt meter
        volt_meter = ke6487(self.volt_meter_address)
        volt_meter.reset()
        volt_meter.setup_ammeter()
        volt_meter.set_nplc(2)

        # Set up switch
        switch = switchcard(self.switch_address)
        switch.reboot()
        switch.set_measurement_type('IV')
        switch.set_display_mode('OFF')

        ## Check settings
        lim_vol = pow_supply.check_voltage_limit()
        lim_cur = pow_supply.check_current_limit()
        temp_pc = switch.get_probecard_temperature()
        temp_sc = switch.get_matrix_temperature()
        # humd_pc = switch.get_probecard_humidity()
        # humd_sc = switch.get_matrix_humidity()
        type_msr = switch.get_measurement_type()
        type_disp = switch.get_display_mode()

        ## Header
        hd = [
            'Scan IV\n',
            'Measurement Settings:',
            'Power supply voltage limit:      %8.2E V' % lim_vol,
            'Power supply current limit:      %8.2E A' % lim_cur,
            'Voltage delay:                   %8.2f s' % self.delay_vol,
            'Channel delay:                   %8.2f s' % self.delay_ch,
            'Probecard temperature:           %8.1f C' % temp_pc,
            'Switchcard temperature:          %8.1f C' % temp_sc,
            # 'Probecard humidity:              %s %' % humd_pc,
            # 'Switchcard humidity:             %s %' % humd_sc,
            'Switchcard measurement setting:  %s' % type_msr,
            'Switchcard display setting:      %s' % type_disp,
            '\n\n',
            'Nominal Voltage [V]\t Measured Voltage [V]\tChannel [-]\tCurrent [A]\tCurrent Error [A]\tTotal Current[A]\t'
        ]

        ## Print Info
        for line in hd[1:-2]:
            self.logging.info(line)
        self.logging.info("\t")
        self.logging.info("\t")
        self.logging.info(hd[-1])
        self.logging.info("-" * int(1.2 * len(hd[-1])))

        ## Prepare
        out = []

        ## Loop over voltages
        try:
            for v in self.volt_list:
                switch.short_all()
                time.sleep(self.delay_ch)
                pow_supply.ramp_voltage(v)
                time.sleep(self.delay_vol)

                j = 0
                for c in self.cell_list:

                    ## Only measure unflagged cells
                    if self.flag_list[j] == 0:

                        ## Through away first measurements after voltage change
                        if j == 0:
                            switch.open_channel(c)
                            for k in range(3):
                                volt_meter.read_current()
                                pow_supply.read_current()
                                time.sleep(0.001)

                        ## Go on with normal measurement
                        switch.open_channel(c)
                        time.sleep(self.delay_ch)

                        cur_tot = pow_supply.read_current()
                        vol = pow_supply.read_voltage()

                        measurements = np.array(
                            [volt_meter.read_current() for _ in range(5)])
                        means = np.mean(measurements, axis=0)
                        errs = np.std(measurements, axis=0)

                        i = means
                        di = errs

                        ## Flag cell if current too large
                        if i > 1E-6:
                            self.flag_list[j] = 1

                    ## Handle flagged cells
                    else:
                        cur_tot = pow_supply.read_current()
                        vol = pow_supply.read_voltage()

                        i = np.nan
                        di = np.nan

                    j += 1
                    line = [v, vol, j, i, di, cur_tot]
                    out.append(line)
                    time.sleep(0.001)
                    self.logging.info(
                        "{:<5.2E}\t{: <5.2E}\t{: <5d}\t{: <8.3E}\t{: <8.3E}\t{: <5.2E}"
                        .format(*line))

        except KeyboardInterrupt:
            switch.short_all()
            pow_supply.ramp_voltage(0)
            self.logging.error(
                "Keyboard interrupt. Ramping down voltage and shutting down.")

        ## Close connections
        switch.reset()
        pow_supply.ramp_voltage(0)
        time.sleep(15)
        pow_supply.set_interlock_off()
        pow_supply.set_output_off()
        pow_supply.reset()
        volt_meter.reset()

        ## Save and print
        self.logging.info("\n")
        self.save_list(out, "iv.dat", fmt="%.5E", header="\n".join(hd))
        self.print_graph(np.array(out)[:, 2], np.array(out)[:, 5], np.array(out)[:, 5]*0.001, \
            'Channel Nr. [-]', 'Total Current [A]', 'All Channels ' + self.id, fn="iv_all_channels_%s.png" % self.id)
        self.print_graph(np.array(out)[:, 2], np.array(out)[:, 3], np.array(out)[:, 4], \
            'Channel Nr. [-]', 'Leakage Current [A]',  'IV All Channels ' + self.id, fn="iv_all_channels_%s.png" % self.id)
        if 1:
            ch = 34
            self.print_graph(np.array([val for val in out if (val[2] == ch)])[:, 1], \
                np.array([val for val in out if (val[2] == ch)])[:, 3], \
                np.array([val for val in out if (val[2] == ch)])[:, 4], \
                'Bias Voltage [V]', 'Leakage Current [A]', 'IV ' + self.id, fn="iv_channel_%d_%s.png" % (ch, self.id))
        if (10 in np.array(out)[:, 0]):
            self.print_graph(np.array([val for val in out if (val[0] == 10)])[:, 2], \
                np.array([val for val in out if (val[0] == 10)])[:, 3], \
                np.array([val for val in out if (val[0] == 10)])[:, 4], \
                'Channel Nr. [-]', 'Leakage Current [A]', 'IV ' + self.id, fn="iv_all_channels_10V_%s.png" % self.id)
            self.print_graph(np.array([val for val in out if (val[0] == 10)])[:, 2], \
                np.array([val for val in out if (val[0] == 10)])[:, 5], \
                np.array([val for val in out if (val[0] == 10)])[:, 6], \
                'Channel Nr. [-]', 'Total Current [A]', 'IV ' + self.id, fn="iv_total_current_all_channels_10V_%s.png" % self.id)
        if (100 in np.array(out)[:, 0]):
            self.print_graph(np.array([val for val in out if (val[0] == 100)])[:, 2], \
                np.array([val for val in out if (val[0] == 100)])[:, 3], \
                np.array([val for val in out if (val[0] == 100)])[:, 4], \
                'Channel Nr. [-]', 'Leakage Current [A]', 'IV ' + self.id, fn="iv_all_channels_100V_%s.png" % self.id)
            self.print_graph(np.array([val for val in out if (val[0] == 100)])[:, 2], \
                np.array([val for val in out if (val[0] == 100)])[:, 5], \
                np.array([val for val in out if (val[0] == 100)])[:, 6], \
                'Channel Nr. [-]', 'Total Current [A]', 'IV ' + self.id, fn="iv_total_current_all_channels_100V_%s.png" % self.id)
        if (1000 in np.array(out)[:, 0]):
            self.print_graph(np.array([val for val in out if (val[0] == 1000)])[:, 2], \
                np.array([val for val in out if (val[0] == 1000)])[:, 3], \
                np.array([val for val in out if (val[0] == 1000)])[:, 4], \
                'Channel Nr. [-]', 'Leakage Current [A]', 'IV ' + self.id, fn="iv_all_channels_1000V_%s.png" % self.id)
            self.print_graph(np.array([val for val in out if (val[0] == 100)])[:, 2], \
                np.array([val for val in out if (val[0] == 1000)])[:, 5], \
                np.array([val for val in out if (val[0] == 1000)])[:, 6], \
                'Channel Nr. [-]', 'Leakage Current [A]', 'IV ' + self.id, fn="iv_total_current_all_channels_1000V_%s.png" % self.id)
        self.logging.info("\n")
Exemplo n.º 5
0
    def execute(self):

        ## Test functionality
        if self.mode == 0:

            ## Header
            hd = [
                'Debugging\n',
                'Measurement Settings:',
                '\n\n',
                'X[-]\tY[-]'
            ]

            ## Print Info
            for line in hd[1:-2]:
                self.logging.info(line)
            self.logging.info("\t")
            self.logging.info("\t")
            self.logging.info(hd[-1])
            self.logging.info("-" * int(1.2 * len(hd[-1])))

            ## Prepare
            out = []

            ## Create fake data
            try:
                for i in range(1, 10):
                    line = [i, i**2, 0.1]
                    out.append(line)
                    time.sleep(0.1)
                    self.logging.info("{:<5.2E}\t{: <5.2E}".format(*line))

            except KeyboardInterrupt:
                self.logging.error("Keyboard interrupt. Ramping down voltage and shutting down.")

            ## Save and print
            self.logging.info("\t")
            self.logging.info("\t")
            self.save_list(out, "out.dat", fmt="%4d", header="\n".join(hd))
            self.print_graph(np.array(out)[:, 0], np.array(out)[:, 1], np.array(out)[:, 2], 'x', 'y', 'Test Data', fn="out.png")


        ## Test communication
        elif self.mode == 1:

            ## Set up power supply
            pow_supply = ke2410(self.pow_supply_address)
            pow_supply.reset()
            pow_supply.set_source('voltage')
            pow_supply.set_sense('current')
            pow_supply.set_current_limit(self.lim_cur)
            pow_supply.set_voltage(0)
            pow_supply.set_terminal('rear')
            pow_supply.set_output_on()

            ## Set up volt meter
            volt_meter = ke2450(self.volt_meter_address)
            volt_meter.reset()
            volt_meter.set_source('voltage')
            volt_meter.set_sense('current')
            volt_meter.set_current_range(1E-4)
            volt_meter.set_voltage(0)
            volt_meter.set_output_on()

            ## Set up lcr meter
            lcr_meter = hp4980(self.lcr_meter_address)
            lcr_meter.reset()
            lcr_meter.set_voltage(self.test_vol)
            lcr_meter.set_frequency(self.test_freq)
            lcr_meter.set_mode('CPRP')

            for v in self.volt_list:
                pow_supply.ramp_voltage(v)
                time.sleep(1)

                vol = pow_supply.read_voltage()
                cur = pow_supply.read_current()
                cap, res = lcr_meter.execute_measurement()
                cur_tot = pow_supply.read_current()

                self.logging.info("vol %E, cur %E, cap %E, cur_tot %E" % (vol, cur, cap, cur_tot))

            ## Close connections
            pow_supply.set_output_off()
            pow_supply.reset()
            volt_meter.set_output_off()
            volt_meter.reset()


        ## Test ramping of voltage
        elif self.mode == 2:

            ## Set up power supply
            pow_supply = ke2410(self.pow_supply_address)
            pow_supply.reset()
            pow_supply.set_source('voltage')
            pow_supply.set_sense('current')
            pow_supply.set_current_limit(self.lim_cur)
            pow_supply.set_voltage(0)
            pow_supply.set_terminal('rear')
            pow_supply.set_output_on()

            ## Set up volt meter
            volt_meter = ke2001(self.volt_meter_address)
            volt_meter.reset()
            volt_meter.setup_ammeter(nplc=10, dig=9)

            try:
                for v in [-5, -1, 0, 1, 5, 10, 25, 50]:
                    pow_supply.ramp_voltage(v, debug=1)
                    time.sleep(1)

                    vol = pow_supply.read_voltage()
                    cur = volt_meter.read_current()
                    cur_tot = pow_supply.read_current()

                    self.logging.info("vol %E, cur_tot %E" % (vol, cur_tot))

            except KeyboardInterrupt:
                pow_supply.ramp_voltage(0)
                self.logging.error("Keyboard interrupt. Ramping down voltage and shutting down.")

            ## Close connections
            pow_supply.ramp_voltage(0, debug=1)
            pow_supply.set_output_off()
            pow_supply.reset()


        ## Test switchcard
        if self.mode == 3:

            ## Set up switch
            switch = switchcard(self.switch_address)
            switch.reboot()
            switch.set_display_mode('ON')

            self.logging.info("\t")
            self.logging.info("Channel Set [-]\tChannel Read [-]")
            self.logging.info("-----------------")
            self.logging.info("\t")

            try:
                init = time.time()
                for i in self.cell_list:
                    switch.open_channel(i)
                    ch = switch.get_channel()
                    t = time.time() - init
                    if ch == i:
                        self.logging.info("\t%.3f \t%d \t%d" % (t, i, ch))
                    else:
                        self.logging.warning("\t%.3f \t%d \t%d" % (t, i, ch))

            except KeyboardInterrupt:
                self.logging.error("Keyboard interrupt. Ramping down voltage and shutting down.")

            ## Save and print
            self.logging.info("\t")
            self.logging.info("\t")


        else:
            pass