Пример #1
0
    def performBias(self):
        extrainfo = dict()
        datadict = dict()
        
        gateDevice = self.__devicecontroller.getDeviceMappedToNode('Vg')
        drainDevice = self.__devicecontroller.getDeviceMappedToNode('Vd')
        sourceDevice = self.__devicecontroller.getDeviceMappedToNode('Vs')

        if gateDevice == None or drainDevice == None or sourceDevice == None:
            self.__logger.log(Logger.ERROR,"Three devices should be connected to the three different nodes before a bias run can be executed.")
            return
        
        drainDevice.set_output_volts(1)
        drainDevice.set_output_on()
        sourceDevice.set_output_volts(0)
        sourceDevice.set_output_on()
        self.__plotcontroller.clearPlot()
        tijd_lijst = Toolbox.makeTime(0, self.totaltime, self.nrDecades)
        self.__logger.log(Logger.INFO,'Stress times: '+' - '.join([str(x) for x in tijd_lijst]))
        self.__logger.log(Logger.INFO,'Starting Bias run with gate bias stress : %g V and drain stress : %d V'%(self.gate_bias,self.drain_bias))
        self.totalpbar.setMinimum(0)
        self.totalpbar.setMaximum(self.totaltime)
        extrainfo['total time'] = str(self.totaltime)+" s"
        extrainfo['number of decades']=str(self.nrDecades)
        extrainfo['stress times'] = ' - '.join([str(x) for x in tijd_lijst])
        extrainfo['gate bias stress'] = str(self.gate_bias)+" V"
        extrainfo['drain bias stress'] = str(self.drain_bias)+" V"
        extrainfo['sweep gate start'] = str(self.start)+" V"
        extrainfo['sweep gate end'] = str(self.stop)+" V"
        extrainfo['sweep drain'] = str(self.tft_drain)+" V"
        direction = "negative"
        if self.__ui.positiveBiasDirection.isChecked() == True:
            direction = "positive"
        base_name = self.construct_filename()
        filewriter = BiasFileWriter(self.__wafercontroller.get_current_wafer_dir()+"/"+base_name+".bias",self.__logger)
        filewriter.writeHeader(extrainfo, direction, self.totaltime)
        self.runActive = True
        self.__ui.actionBiasRun.setEnabled(False)
        self.__ui.actionAbortBiasStress.setEnabled(True)
        self.__ui.tftwidget.setEnabled(False)
        init_time = time.time()
        for t in range(0, len(tijd_lijst)):
            QtGui.QApplication.processEvents()
            self.__ui.currentCycleStatus.setText('Cycle %d: 0 / %d sec' %(t,tijd_lijst[t]))
            start = time.time()
            if t != 0:
                eind = start + tijd_lijst[t] - tijd_lijst[t-1]
                ctime = start - tijd_lijst[t-1]
            elif t==0:
                eind = start + tijd_lijst[t]
                ctime = start
                
            self.crono = Crono()
            self.crono.tick.connect(self.totalpbar.setValue)
            self.crono.status.connect(self.__ui.currentCycleStatus.setText)
            self.crono.start(tijd_lijst, t, eind, ctime)
            if self.runActive == False:
                self.__logger.log(Logger.WARNING,"Bias run aborted on user's request.")
                self.resetBias()
                return
            self.__ui.currentCycleStatus.setText('Cycle %d: %d / %d sec' % (t,tijd_lijst[t], tijd_lijst[t]))
            self.__logger.log(Logger.INFO,'Sweeping...')
            
            gate_smu = gateDevice.getScriptSyntax()
            drain_smu = drainDevice.getScriptSyntax()
            vgs, igs, ids = self.__tftcontroller.performSweep(gateDevice,drainDevice,gate_smu,drain_smu,self.start, self.stop,1,self.step,self.delay,False)
            self.__logger.log(Logger.INFO,'Sweep on timestamp %d sec - done' % (tijd_lijst[t]))
            self.__plotcontroller.plotIV_bias(ids,vgs)
            gateDevice.set_output_on()
            drainDevice.set_output_on()
            
            #Apply Bias
            gateDevice.set_output_volts(self.gate_bias)
            drainDevice.set_output_volts(self.drain_bias)
            t = Thread(target=filewriter.appendSweepData,args=(str(tijd_lijst[t]),Data.BiasPacket(igs, ids, vgs)))
            t.start()
            
        end_time = time.time()  
        gateDevice.set_output_off()
        drainDevice.set_output_off()
        self.__logger.log(Logger.INFO, 'Bias run completed in %d sec' %(end_time - init_time))
        self.__plotcontroller.saveCurrentPlot(self.__wafercontroller.get_current_wafer_dir()+"/"+base_name+".png")
        self.resetBias()