Example #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_terminal('rear')
        pow_supply.set_output_on()

        ## Set up volt meter
        volt_meter = ke2450(self.volt_meter_address)
        volt_meter.reset()
        volt_meter.set_voltage(0)
        volt_meter.set_terminal('front')
        volt_meter.setup_current_source()
        volt_meter.set_output_on()

        ## Check settings
        lim_vol = pow_supply.check_voltage_limit()
        lim_cur = pow_supply.check_current_limit()

        ## Header
        hd = [
            'Single IV\n', 'Measurement Settings:',
            'Power supply voltage limit:      %8.2E V' % lim_vol,
            'Power supply current limit:      %8.2E A' % lim_cur, '\n\n',
            'Nominal Bias Voltage [V]\tMeasured Bias Voltage [V]\tTime [s]\tFloating voltage [V]\tFloating Voltage Erro [V]\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 = []
        t = 0

        ## Ramp to voltage and monitor
        pow_supply.ramp_voltage(self.bias_voltage)
        time.sleep(0.1)

        t0 = time.time()
        while t < self.bias_duration:
            t = time.time() - t0

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

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

            v = means
            dv = errs

            line = [self.bias_voltage, vol, t, v, dv, cur_tot]
            out.append(line)
            self.logging.info(
                "{:<5.2E}\t{: <5.2E}\t{: <5.2E}\t{: <8.3E}\t{: <8.3E}\t{: <5.2E}"
                .format(*line))

        ## Ramp down to zero and monitor
        pow_supply.ramp_voltage(0)
        time.sleep(0.1)

        while t < self.monitor_duration:
            t = time.time() - t0

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

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

            v = means
            dv = errs

            line = [v, vol, t, v, dv, cur_tot]
            out.append(line)
            self.logging.info(
                "{:<5.2E}\t{: <5.2E}\t{: <5.2E}\t{: <8.3E}\t{: <8.3E}\t{: <5.2E}"
                .format(*line))

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

        ## Save and print
        self.logging.info("\n")
        self.save_list(out,
                       "iv.dat",
                       fmt="%.5E",
                       header=' volt [V]\tcurrent[A]\ttotal current[A]\t')
        self.print_graph(np.array(out)[:, 2],
                         np.array(out)[:, 3],
                         'Time [s]',
                         'Floating Cell Voltage [V]',
                         fn="iv.png")
        self.logging.info("\n")
Example #3
0
    def execute(self):

        ## Set up the forward bias power supply
        forward_pow_supply = ke2410(self.forward_pow_supply_address)
        forward_pow_supply.reset()
        forward_pow_supply.set_source('voltage')
        forward_pow_supply.set_sense('current')
        forward_pow_supply.set_current_limit(self.forward_bias_lim_cur)
        forward_pow_supply.set_voltage(0)
        forward_pow_supply.set_terminal('rear')
        forward_pow_supply.set_output_on()

        ## Set up the interpad bias power supply
        interpad_pow_supply = ke2450(self.interpad_pow_supply_address)
        interpad_pow_supply.reset()
        interpad_pow_supply.set_voltage(0)
        interpad_pow_supply.set_terminal('front')
        interpad_pow_supply.setup_voltage_source()
        interpad_pow_supply.set_output_on()

        ## Check settings
        lim_vol = forward_pow_supply.check_voltage_limit()
        lim_cur = forward_pow_supply.check_current_limit()

        ## Header
        hd = [
            'Interpad R\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,
            '\n\n',
            'Bias Voltage[V]\tInterpad Voltage [V]\tInterpad Current Mean [A]\tInterpad Current Error [A]\tResistance [Ohm]\tChi2 of Fit [-]\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 vbias in self.bias_volt_list:
                forward_pow_supply.ramp_voltage(vbias)
                time.sleep(self.delay_vol)

                v = []
                i = []
                di = []
                for vinter in self.interpad_volt_list:
                    interpad_pow_supply.ramp_voltage(vinter)
                    time.sleep(0.5)

                    vol = interpad_pow_supply.read_voltage()
                    cur_tot = forward_pow_supply.read_current()

                    measurements = np.array(
                        [interpad_pow_supply.read_current() for _ in range(3)])
                    v.append(vol)
                    i.append(np.mean(measurements))
                    di.append(np.std(measurements))

                ## Calculate resistance
                x = np.array(v)
                y = np.array(i)
                dy = np.array(di)
                p = np.polyfit(x, y, 1, w=1 / dy)
                chi2 = np.sum(((np.polyval(p, x) - y) / dy)**2)

                r = 1. / p[0]
                r2 = (x[-1] - x[1]) / (y[-1] - y[1])

                ## Write output
                for k in range(len(self.interpad_volt_list)):
                    line = [vbias, v[k], i[k], di[k], r, r2, chi2, cur_tot]
                    out.append(line)

                    self.logging.info(
                        "{:<5.2E}\t{: <5.2E}\t{: <8.4E}\t{: <5.2E}\t{: <5.2E}\t{: <5.2E}\t{: <5.2E}\t{: <5.2E}"
                        .format(*line))

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

        ## Close connections
        interpad_pow_supply.ramp_voltage(0)
        forward_pow_supply.ramp_voltage(0)
        time.sleep(15)

        forward_pow_supply.set_output_off()
        forward_pow_supply.reset()

        interpad_pow_supply.set_output_off()
        interpad_pow_supply.reset()

        ## Save and print
        self.logging.info("\n")
        self.save_list(out, "iv_inter.dat", fmt="%.5E", header="\n".join(hd))
    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='')
    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_output_on()
        time.sleep(5)

        ## 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')

        ## 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())

        # switch = switchcard("COM4")
        # switch.reboot()
        # switch.set_measurement_type('CV')
        # switch.set_display_mode('OFF')
        # switch.open_channel(110)

        ## Header
        hd = [
            'Longterm CV\n', 'Measurement Settings:',
            'Power Supply voltage limit:      %8.2E V' % lim_vol,
            'Power Supply current limit:      %8.2E A' % float(lim_cur),
            'LCR measurement voltage:         %8.2E V' % lcr_vol,
            'LCR measurement frequency:       %8.2E Hz' % lcr_freq, '\n\n',
            'Nominal Voltage [V]\t Measured Voltage [V]\tTime [s]\tR [Ohm]\tR_Err [Ohm]\tX [Ohm]\tX_Err [Ohm]\tCs [F]\tCp [F]\tTotal Current [A]'
        ]

        ## 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:
                pow_supply.ramp_voltage(v)
                time.sleep(self.delay_msr)

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

                t = 0
                t0 = time.time()
                while t < self.duration_msr:
                    t = time.time() - t0
                    time.sleep(0.1)

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

                    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

                    z = np.sqrt(r**2 + x**2)
                    phi = np.arctan(x / r)
                    r_s, c_s, l_s, D = lcr_series_equ(self.lcr_freq, z, phi)
                    r_p, c_p, l_p, D = lcr_parallel_equ(self.lcr_freq, z, phi)

                    line = [v, vol, t, 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{: <5.2E}\t{: <5.2E}\t{: <5.2E}\t{: <5.2E}\t{: <8.3E}\t{: <8.3E}\t{: <5.2E}"
                        .format(*line))

        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)
        time.sleep(10)
        pow_supply.set_interlock_off()
        pow_supply.set_output_off()
        pow_supply.reset()

        ## Save and print
        self.logging.info("")
        self.save_list(out, "cv_long.dat", fmt="%.5E", header="\n".join(hd))
        self.print_graph(np.array(out)[:, 2],
                         np.array(out)[:, 8],
                         np.array(out)[:, 8] * 0.01,
                         'Time [s]',
                         'Capacitance [F]',
                         'Longerm CV ' + self.id,
                         fn="cv_long_%s.png" % self.id)
        self.print_graph(np.array(out)[:, 2],
                         np.array(out)[:, 9],
                         np.array(out)[:, 9] * 0.01,
                         'Time [s]',
                         'Total Current [A]',
                         'Longerm CV ' + self.id,
                         fn="cv_long_total_current_%s.png" % self.id)
        self.logging.info("")
Example #6
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")
    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(1)

        ## Check settings
        lim_vol = pow_supply.check_voltage_limit()
        lim_cur = pow_supply.check_current_limit()

        ## Header
        hd = [
            'Longterm IV\n',
            'Measurement Settings:',
            'Power supply voltage limit:      %8.2E V' % lim_vol,
            'Power supply current limit:      %8.2E A' % lim_cur,
            '\n\n',
            'Nominal Voltage [V]\tMeasured Voltage [V]\tTime [s]\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:
                pow_supply.ramp_voltage(v)

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

                t = 0
                t0 = time.time()
                while t < self.duration_msr:
                    time.sleep(self.delay_msr)
                    t = time.time() - t0

                    cur_tot = pow_supply.read_current()

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

                    i = means
                    di = errs

                    line = [v, vol, t, i, di, cur_tot]
                    out.append(line)
                    self.logging.info("{:<5.2E}\t{: <5.2E}\t{: <5.2E}\t{: <8.3E}\t{: <8.3E}\t{: <5.2E}".format(*line))

        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)
        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("\t")
        self.save_list(out, "iv_long.dat", fmt="%.5E", header="\n".join(hd))
        self.print_graph(np.array(out)[:, 2], np.array(out)[:, 3], np.array(out)[:, 4], 'Time [s]', 'Leakage Current [A]', 'Longterm IV ' + self.id, fn="iv_long_%s.png" % self.id)
        self.print_graph(np.array(out)[:, 2], np.array(out)[:, 5], np.array(out)[:, 5]*0.01, 'Time [s]', 'Total Current [A]', 'Longterm IV ' + self.id, fn="iv_long_total_current%s.png" % self.id)
        self.logging.info("\t")
    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_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')

        ## 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())

        ## 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" %
                          float(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("\t")

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

        ## Prepare
        out = []
        hd = ' Single 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\n' % self.delay_vol \
           + ' Nominal Voltage [V]\t Measured Voltage [V]\tChannel [-]\tR [kOhm]\tR_Err [kOhm]\tX [kOhm]\tX_Err [kOhm]\tCs [pF]\tCp [pF]\tTotal Current [A]\n'

        ## Loop over voltages
        try:
            j = 0
            for v in self.volt_list:
                pow_supply.ramp_voltage(v)
                time.sleep(self.delay_vol)
                time.sleep(0.001)

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

                tmp1 = []
                tmp2 = []
                for i in range(5):
                    r, x = lcr_meter.execute_measurement()
                    tmp1.append(r)
                    tmp2.append(x)
                r = np.mean(np.array(tmp1))
                x = np.mean(np.array(tmp2))
                r_err = np.std(np.array(tmp1))
                x_err = np.std(np.array(tmp2))

                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(self.lcr_freq, z, phi)
                r_p, c_p, l_p, D = lcr_parallel_equ(self.lcr_freq, z, phi)

                out.append([v, vol, j, r, r_err, x, x_err, c_s, c_p, cur_tot])
                self.logging.info(
                    "\t%.2f \t%4d\t%.3f \t%.3f \t%.3E \t%.3E \t%.2E" %
                    (vol, j, r / 1000., x / 1000., c_s * 10**(12),
                     c_p * 10**(12), 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)
        time.sleep(15)
        pow_supply.set_output_off()
        pow_supply.reset()

        ## Save and print
        self.logging.info("")
        self.save_list(out, "cv.dat", fmt="%.5E", header=hd)
        self.print_graph(np.array(out)[:, 1], np.array(out)[:, 7], np.array(out)[:, 7] * 0.01, \
                         'Bias Voltage [V]', 'Parallel Capacitance [F]',  'CV ' + self.id, fn="cv_%s.png" % self.id)
        self.print_graph(np.array(out)[2:, 1], np.array(out)[2:, 7]**(-2), 0, \
                         'Bias Voltage [V]', '1/C^2 [1/F^2]',  '1/C2 ' + self.id, fn="1c2v_%s.png" % self.id)
        self.print_graph(np.array(out)[:, 1], np.array(out)[:, 9], np.array(out)[:, 9]*0.01, \
                         'Bias Voltage [V]', 'Total Current [A]', 'IV ' + self.id, fn="iv_total_current_%s.png" % self.id)
        self.logging.info("")
    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
Example #10
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='')
    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()
        #pow_supply.set_current_range(1E-3, 1)

        ## 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')

        ## 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())

        ## Header
        hd = [
            'Single IV\n',
            'Power Supply voltage limit:      %8.2E V' % lim_vol,
            'Power Supply current limit:      %8.2E A' % float(lim_cur),
            'LCR measurement voltage:         %8.2E V' % lcr_vol,
            'LCR measurement frequency:       %8.2E Hz' % lcr_freq,
            'Voltage Delay:                   %8.2f s' % self.delay_vol,
            '\n\n',
            'Nominal Voltage [V]\t Measured Voltage [V]\tFreq [Hz]\tR [Ohm]\tR_Err [Ohm]\tX [Ohm]\tX_Err [Ohm]\tCs [F]\tCp [F]\tTotal Current [A]'
        ]

        ## 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:
                pow_supply.ramp_voltage(v)

                while "{: <5.2E}".format(
                        pow_supply.read_voltage()) != "{: <5.2E}".format(v):
                    pow_supply.check_current_limit()
                    pow_supply.read_current()
                    #print "{: <5.2E}".format(pow_supply.read_voltage())
                    #print "{: <5.2E}".format(v)
                    if "{: <5.2E}".format(
                            pow_supply.read_current()) == "{: <5.2E}".format(
                                self.lim_cur):
                        break
                    time.sleep(0.5)

                time.sleep(self.delay_vol)
                if "{: <5.2E}".format(
                        pow_supply.read_current()) == "{: <5.2E}".format(
                            self.lim_cur):
                    print "Compliance " + "{: <5.2E}".format(
                        self.lim_cur) + "A reached"
                    break

                #print pow_supply.check_current_limit()
                #print pow_supply.read_current()
                vol = pow_supply.read_voltage()
                cur_tot = pow_supply.read_current()

                # for freq_nom in [self.lcr_freq]:
                for freq_nom in [
                        1E4
                ]:  #[5E2, 1E3, 5E3, 7.5E3, 9E3, 1E4, 1.1E4, 1.5E4, 2E4, 5E4, 1E5, 2E5, 1E6]
                    lcr_meter.set_frequency(freq_nom)
                    time.sleep(1)
                    freq = float(lcr_meter.check_frequency())

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

                    r, x = means
                    dr, dx = errs

                    z = np.sqrt(abs(r)**2 + x**2)
                    phi = np.arctan(x / abs(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)

                    line = [v, vol, freq, 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{: <5.2E}\t{: <5.2E}\t{: <5.2E}\t{: <5.2E}\t{: <8.3E}\t{: <8.3E}\t{: <5.2E}"
                        .format(*line))

        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)
        time.sleep(10)
        pow_supply.set_interlock_off()
        pow_supply.set_output_off()
        pow_supply.reset()

        ## Save and print
        self.logging.info("")
        self.save_list(out, "cv.dat", fmt="%.5E", header="\n".join(hd))
        self.print_graph(np.array(out)[:, 1], np.array(out)[:, 7], np.array(out)[:, 7] * 0.01, \
                         'Bias Voltage [V]', 'Parallel Capacitance [F]',  'CV ' + self.id, fn="cv_%s.png" % self.id)
        self.print_graph(np.array(out)[2:, 1], np.array(out)[2:, 7]**(-2), 0, \
                         'Bias Voltage [V]', '1/C^2 [1/F^2]',  '1/C2 ' + self.id, fn="1c2v_%s.png" % self.id)
        self.print_graph(np.array(out)[:, 1], np.array(out)[:, 9], np.array(out)[:, 9]*0.01, \
                         'Bias Voltage [V]', 'Total Current [A]', 'IV ' + self.id, fn="iv_total_current_%s.png" % self.id)
        self.logging.info("")
Example #12
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)

        ## Check settings
        lim_vol = pow_supply.check_voltage_limit()
        lim_cur = pow_supply.check_current_limit()

        ## Header
        hd = [
            'Single 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,
            '\n\n',
            'Nominal Voltage [V]\t Measured Voltage [V]\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:
                pow_supply.ramp_voltage(v)
                time.sleep(self.delay_vol)

                if "{: <5.2E}".format(abs(
                        pow_supply.read_current())) == "{: <5.2E}".format(
                            abs(self.lim_cur)):
                    print "Compliance " + "{: <5.2E}".format(
                        self.lim_cur) + "A reached"
                    break

                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

                line = [v, vol, I, dI, cur_tot]
                out.append(line)
                self.logging.info(
                    "{:<5.2E}\t{: <5.2E}\t{: <8.3E}\t{: <8.3E}\t{: <5.2E}".
                    format(*line))

        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)
        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)[:, 1], np.array(out)[:, 2], np.array(out)[:, 3], \
                         'Bias Voltage [V]', 'Leakage Current [A]', 'IV ' + self.id, fn="iv_%s.png" % self.id)
        self.print_graph(np.array([val for val in out if (abs(val[0]) < 251 and abs(val[0])>-0.1)])[:, 1], \
                         np.array([val for val in out if (abs(val[0]) < 251 and abs(val[0])>-0.1)])[:, 2], \
                         np.array([val for val in out if (abs(val[0]) < 251 and abs(val[0])>-0.1)])[:, 3], \
                         'Bias Voltage [V]', 'Leakage Current [A]', 'IV ' + self.id, fn="iv_zoom_%s.png" % self.id)
        self.print_graph(np.array(out)[:, 1], np.array(out)[:, 4], np.array(out)[:, 4]*0.01, \
                         'Bias Voltage [V]', 'Total Current [A]', 'IV ' + self.id, fn="iv_total_current_%s.png" % self.id)
        self.logging.info("\n")
Example #13
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_output_on()

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

        ## Set up lcr meter

        ## Set up switch
        # Set up switch

        v = 10
        pow_supply.ramp_voltage(v)
        time.sleep(delay_vol)

        cur_tot = pow_supply.read_current()

        total_current_notice = 1.0 * 10**(-7)
        total_current_warning = 5.0 * 10**(-7)

        if cur_tot < total_current_notice:
            self.logging.info("Total current: %e" % cur_tot)
        elif cur > single_channel_notice and cur < single_channel_warning:
            self.logging.warning("Total current: %e" % cur_tot)
        else:
            self.logging.critical("Total current: %e" % cur_tot)

        for c in self.cell_list:
            # Check all channels close
            # Open channel c
            time.sleep(delay_ch)

            cur = volt_meter.read_current()

            single_channel_notice = 1.0 * 10**(-9)
            single_channel_warning = 5.0 * 10**(-9)
            if cur < single_channel_notice:
                self.logging.info("cell nr.:%d, vol %d, cur %e" % (c, v, cur))
            elif cur > single_channel_notice and cur < single_channel_warning:
                self.logging.warning("cell nr.:%d, vol %d, cur %e" %
                                     (c, v, cur))
            else:
                self.logging.critical("cell nr.:%d, vol %d, cur %e" %
                                      (c, v, cur))

            # Close all channels
            time.sleep(0.01)

        ## Close connections
        pow_supply.set_output_off()
        pow_supply.reset()
        volt_meter.set_output_off()
        volt_meter.reset()
Example #14
0
    def execute(self):
        
        ## Set up power supply
        pow_supply1 = ke2410(self.pow_supply1_address)
        pow_supply1.reset()
        pow_supply1.set_source('voltage')
        pow_supply1.set_sense('current')
        pow_supply1.set_current_limit(self.lim_cur)
        pow_supply1.set_voltage(0)
        pow_supply1.set_terminal('rear')
        pow_supply1.set_output_on()

        ## Set up volt meter
        pow_supply2 = ke2450(self.pow_supply2_address)
        pow_supply2.reset()
        pow_supply2.set_source('current')
        pow_supply2.set_sense('voltage')
        #pow_supply2.set_current_limit(2)
        pow_supply2.set_voltage(0)
        pow_supply2.set_output_on()

        ## Print Info
        self.logging.info("Settings:")
        self.logging.info("Power supply 1 voltage limit:      %8.2E V" % self.lim_vol)
        self.logging.info("Power supply 1 current limit:      %8.2E A" % self.lim_cur)
        self.logging.info("Power supply 2 voltage limit:      %8.2E V" % self.lim_vol)
        self.logging.info("Power supply 2 current limit:      %8.2E A" % self.lim_cur)
        self.logging.info("Voltage Delay:                     %8.2E s" % self.delay_vol)
        self.logging.info("\t")

        self.logging.info("\tVoltage 1 [V]\tVoltage 2 [V]\tTotal current [A]")
        self.logging.info("\t--------------------------------------------------")

        ## Prepare
        out = []

        ## Loop over voltages
        for v in self.bias_list:
            pow_supply1.ramp_voltage(v)
            for v2 in self.volt_list:
                pow_supply2.ramp_voltage(v)
                time.sleep(self.delay_vol)

            #    vol1 = pow_supply1.read_voltage()
            #    vol2 = pow_supply1.read_voltage()
            #    cur = pow_supply2.read_current()
            #    cur_tot = pow_supply1.read_current()
    
            #    out.append([vol, cur, cur_tot])
            #    self.logging.info("\t%.2E \t%.2E \t%.2E" % (vol, cur, cur_tot))

            time.sleep(self.delay_vol)
            time.sleep(0.001)

            vol1 = pow_supply1.read_voltage()
            cur_tot = pow_supply1.read_current()
            
            tmp = []
            for i in range(5):
                tmp.append(pow_supply2.read_voltage())
            vol2 = np.mean(np.array(tmp))
            
            time.sleep(0.001)

            out.append([vol, cur, cur_tot])
            self.logging.info("\t%.2E \t%.3E \t%.2E" % (vol, cur, cur_tot))


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

        ## Save and print
        self.logging.info("\n")
        self.save_list(out, "iv.dat", fmt="%.5E", header=' volt [V]\tcurrent[A]\ttotal current[A]\t')
        self.print_graph(np.array(out)[:, 0], np.array(out)[:, 1], 'Bias Voltage [V]', 'Leakage Current [A]', fn="iv.png")
        self.logging.info("\n")
Example #15
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('CPRP')

        ## 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())

        ## Header
        hd = [
            'Interpad C\n', 'Measurement Settings:',
            'Power Supply voltage limit:      %8.2E V' % lim_vol,
            'Power Supply current limit:      %8.2E A' % float(lim_cur),
            'LCR measurement voltage:         %8.2E V' % lcr_vol,
            'LCR measurement frequency:       %8.2E Hz' % lcr_freq,
            'Voltage Delay:                   %8.2f s' % self.delay_vol,
            '\n\n',
            ' Nominal Voltage [V]\t Measured Voltage [V]\tFrequency [Hz]\tCp [F]\tCp_Err [F]\tRp [Ohm]\tRp_Err [Ohm]\tTotal Current [A]'
        ]

        ## 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()
                pow_supply.ramp_voltage(v)
                time.sleep(self.delay_vol)

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

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

                    measurements = np.array(
                        [lcr_meter.execute_measurement() for _ in range(5)])
                    c, r = np.mean(measurements, axis=0)
                    dc, dr = np.std(measurements, axis=0)

                    line = [v, vol, freq, c, dc, r, dr, cur_tot]
                    out.append(line)
                    self.logging.info(
                        "{:<5.2E}\t{: <5.2E}\t{: <5.3E}\t{: <5.2E}\t{: <5.2E}\t{: <5.2E}\t{: <5.2E}\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("")
        self.save_list(out, "cv_inter.dat", fmt="%.5E", header="\n".join(hd))
        self.print_graph(np.array(out)[:, 1], np.array(out)[:, 3], np.array(out)[:, 3] * 0.01, \
                    'Bias Voltage [V]', 'Parallel Capacitance [F]',  'CV ' + self.id, fn="cv_inter_%s.png" % self.id)
        self.print_graph(np.array(out)[:, 1], np.array(out)[:, 7], np.array(out)[:, 7]*0.01, \
                    'Bias Voltage [V]', 'Total Current [A]', 'IV ' + self.id, fn="iv_total_current_%s.png" % self.id)
        self.logging.info("")