def setup_configuration(self, conf): # self.port = conf.get("jumoClient","port") self.logDir = conf.Directories['logDir'] self.configFile = conf.Directories['configDir'] + '/elComandante.conf' self.initFile = conf.Directories['configDir'] + '/elComandante.ini' # get("Directories","dataDir")+"logfiles" self.temp_log_filename = "temperature.log" self.tempLog = printer() self.tempLog.set_name('Temperature') self.tempLog.set_logfile(self.logDir, self.temp_log_filename) self.tempLog.disable_print() self.humidity_log_filename = "humidity.log" self.humidity_log = printer() self.humidity_log.set_name('Humidity') self.humidity_log.set_logfile(self.logDir, self.humidity_log_filename) self.humidity_log.disable_print() self.cur_log_filename = "current.log" self.curLog = printer() self.curLog.set_name('Current') self.curLog.set_logfile(self.logDir, self.cur_log_filename) self.curLog.disable_print() # todo find a better way to define list... self.subscriptions = { 'temp': "/temperature/jumo", 'hum': "/humidity", 'cur': "/jumo/current", 'psi': "/psi", 'watchDog': "/watchDog" } serverZiel = conf.get('subsystem', 'Ziel') serverPort = conf.getint('subsystem', 'Port') # print self.sclient # print 'initialize WatchDog sclient',serverZiel,serverPort self.sclient = sclient.sClient(serverZiel, serverPort, "watchDog") self.sclient.setID('watchDogClient') # print self.sclient self.subscribe() return True
def set_curLog(self): for tb, module in self.init.items('Modules'): if self.init.getboolean('TestboardUse', tb): if tb in self.currentTestCurLogger: del self.currentTestCurLogger[tb] self.currentTestCurLogger[tb] = printer() self.currentTestCurLogger[tb].set_name('Test_Hum_Log_%s' % tb) self.currentTestCurLogger[tb].disable_print() if tb in self.currentTestDirs: # and self.status != 'Prepare': current_dir = self.currentTestDirs[tb] fileName = 'CurLog_' + self.status + '.log' self.currentTestCurLogger[tb].set_logfile(current_dir, fileName)
def __init__(self, timestamp, log, client): el_agente.el_agente.__init__(self, timestamp, log, client) self.agente_name = "watchDogAgente" self.client_name = "watchDog" self.log = printer() self.sclient = None self.active = True self.pending = False self.currentTestTempLogger = {} self.currentTestHumLogger = {} self.currentTestCurLogger = {} self.currentTestDirs = {} self.testOverview = {} self.FAILED = -1 self.SUCCESS = +1 self.UNKOWN = -2 self.BUSY = 0 self.status = 'unkown'
def set_tempLog(self): for tb, module in self.init.items('Modules'): if self.init.getboolean('TestboardUse', tb): if tb in self.currentTestTempLogger: del self.currentTestTempLogger[tb] self.currentTestTempLogger[tb] = printer() self.currentTestTempLogger[tb].set_name('Test_Temp_Log_%s' % tb) self.currentTestTempLogger[tb].disable_print() if tb in self.currentTestDirs and self.status != 'Prepare': # if self.currentTestTempLogger[tb].logger1 and k = 0: # loggerDict = self.currentTestTempLogger[tb].logger1.manager.loggerDict # print loggerDict # k=1 current_dir = self.currentTestDirs[tb] fileName = 'TempLog_' + self.status + '.log' # self.currentTestTempLogger[tb].close_logfiles() # print 'new Temp Log for %s: %s %s, len = %s'%(tb,dir, # fileName,len(self.currentTestTempLogger[tb].logger1.handlers)) self.currentTestTempLogger[tb].set_logfile(current_dir, fileName)
# the id3003.id3003_xray_generator and the zaber.zaber_motor_stage classes. import sys sys.path.insert(1, "../") import time import argparse import zaber import id3003 import myutils import signal from myutils import process process.create_pid_file() ## Instance of the logger from the myutils package log = myutils.printer() ## @addtogroup xrayClient # @details # Since the xrayClient can use multiple different x-ray setups there is # quite a number of command line arguments to chose how the client # operates. Normally, the client is started by elComandante who reads # the required arguments from its configuration files. # # Command line arguments: # - \c \--xray-device Xray generator device, e.g. /dev/ttyS0 (default: /dev/ttyF0) # - \c \--xray-type Xray generator device type, e.g. id3003 (default: id3003) # - \c \--stage-device Fluorescence device, e.g. /dev/ttyS0 (default: /dev/ttyF1) # - \c \--stage-type Fluorescence device type, e.g. zaber (default: zaber) # - \c \--directory Directory for log files (default: .) # - \c \--timestamp Timestamp for creation of file (default: 0)
default="../config/") parser.add_argument( "-dir", "--directory", dest="loggingDir", help= "specify directory containing all logging files e.g. ../DATA/logfiles/", default="../DATA/logfiles") parser.add_argument("-num", "--numTB", dest="numTB", help="specify the number of Testboards in use", default="1") #parse args and setup logdir args = parser.parse_args() Logger = printer() Logger.set_name("Psi46Log") Logger.set_prefix('') Logger.set_logfile('%s' % (args.loggingDir), 'psi46Handler.log') Logger << 'ConfigDir: "%s"' % args.configDir configDir = args.configDir numTB = int(args.numTB) #load config config = BetterConfigParser() config.read(configDir + '/elComandante.conf') #config clientName = "psi46" serverZiel = config.get('subsystem', 'Ziel') Port = int(config.get('subsystem', 'Port')) serverPort = int(config.get('subsystem', 'Port'))
print 'hallo' #------------some configuration-------------- parser = argparse.ArgumentParser() parser.add_argument("-c", "--config", dest="configDir", help="specify directory containing config files e.g. ../config/", default="../config/") parser.add_argument("-dir","--directory", dest="loggingDir", help="specify directory containing all logging files e.g. ../DATA/logfiles/", default="../DATA/logfiles") parser.add_argument("-num","--numTB", dest="numTB", help="specify the number of Testboards in use", default="1") #parse args and setup logdir args = parser.parse_args() Logger = printer() Logger.set_name("Psi46Log") Logger.set_prefix('') Logger.set_logfile('%s'%(args.loggingDir),'psi46Handler.log') Logger <<'ConfigDir: "%s"'%args.configDir configDir= args.configDir numTB = int(args.numTB) #load config config = BetterConfigParser() config.read(configDir+'/elComandante.conf') #config clientName = "psi46" serverZiel=config.get('subsystem','Ziel') Port = int(config.get('subsystem','Port')) serverPort = int(config.get('subsystem','Port'))
import sys sys.path.insert(1, "../") import time import argparse import myutils import signal from myutils import process # Devices import yoctorelay process.create_pid_file() ## Instance of the logger from the myutils package log = myutils.printer() log.printv() log.set_name("lowVoltageClient") # Print welcome log << "LowVoltage Client" log.printv() ## @addtogroup lowVoltageClient ## @details ## Since the lowVoltageClient can use multiple different setups there are ## a few of command line arguments to chose how the client operates. Normally, ## the client is started by elComandante who reads the required arguments ## from its configuration files. ## ## Command line arguments: ## - \c \--device Low voltage device, e.g. /dev/ttyS0 (default: any)
def sweep(): global doingSweep global testDir global maxSweepTries global client global keithley global aboName doingSweep = True outputStatus = keithley.getOutputStatus() client.send(aboName,':MSG! Start with Linear Sweep from %sV to %sV in %sV steps\n'%(startValue,stopValue,stepValue)) Logger << "TestDirectory is: %s"%testDir Logger << "Max Sweep Tries: %d"%maxSweepTries ntries = 0 while True: retVal = keithley.doLinearSweep(startValue, stopValue, stepValue, nSweeps, delay) # Logger << 'keithley RetVal: %s'%retVal ntries+=1 if retVal!=0 or ntries>=maxSweepTries: Logger << 'exit while loop' break voltage = keithley.getLastVoltage() msg='Keithley Tripped %s of %s times @ %s\n'%(ntries,maxSweepTries,voltage) Logger << msg client.send(aboName,msg) client.send(IVAbo,msg) Logger << "Done with recording IV Curve" client.send(aboName,'Results of Linear Sweep:\n') client.send(IVAbo,'Results Start:\n') client.sendData(voltageAbo,'Sweep Data\n') client.sendData(currentAbo,'Sweep Data\n') client.sendData(resistanceAbo,'Sweep Data\n') client.send(aboName,':PROG:IV! RESULTS\n') npoint = 0 nPoints = len(keithley.measurments) ivCurveLogger = printer() ivCurveLogger.set_name("ivCurveLogger") ivCurveLogger.set_prefix('') ivCurveLogger.set_logfile(testDir,'ivCurve.log') ivCurveLogger.disable_print() # ivCurveLogger.timestamp = float(args.timestamp) ivCurveLogger << '#voltage(V)\tcurrent(A)\ttimestamp' while len(keithley.measurments)>0: npoint +=1 measurement = keithley.measurments.popleft() measurement[0]=int(measurement[0]) #Logger << "sending: %s - %s" %(measurement,len(keithley.measurments)) timestamp = measurement[0] voltage = float(measurement[1]) current = float(measurement[2]) # resistance = float(measurement[3]) try: client.sendData(aboName,':IV! %s/%s '%(npoint,nPoints) +" ".join(map(str, measurement[:3]))+'\n') except: Logger.warning("Couldn't send to %s"%aboName) try: client.sendData(aboName,':IV! %s/%s '%(npoint,nPoints) +" ".join(map(str, measurement[:3]))+'\n') except: Logger.warning("Couldn't send to %s"%aboName) print "Couln't send to %s"%aboName try: client.sendData(IVAbo," ".join(map(str, measurement[:3]))+'\n') except: Logger.warning("Couldn't send to %s"%IVAbo) strA = '%d %+8.3f'%(timestamp,voltage) strA = strA.strip('\n') strA += '\n' try: client.sendData(voltageAbo,strA) except: Logger.warning("Couldn't send '%s'"%strA) strA = '%d %+11.4e'%(timestamp,current) strA = strA.strip('\n') strA += '\n' try: client.sendData(currentAbo,'%d %+11.4e\n'%(timestamp,current)) except: Logger.warning("Couldn't send '%s'"%strA) try: ivCurveLogger << '%+8.3f\t%+11.4e\t%d'%(voltage,current,timestamp) except: Logger.warning("Couldn't write to ivCuvrveLogger") try: IVLogger << '%s\t%s\t%s'%(voltage,current,timestamp) except: Logger.warning("Couldn't write to ivLogger") # client.sendData(resistanceAbo,'%s %s\n'%(timestamp,resistance)) Logger << 'Results End, %s'% aboName client.send(IVAbo,'Results End\n') client.clearPackets(aboName) #client.send(aboName,':PROG:IV! FINISHED\n') sleep(1) #client.sendData(aboName,':PROG:IV! FINISHED\n') client.send(voltageAbo,'Sweep Data Done\n') client.send(currentAbo,'Sweep Data Done\n') client.send(resistanceAbo,'Sweep Data Done\n') Logger << 'Sweep done' del ivCurveLogger sleep(1) Logger << 're-initialize Keithley' keithley.initKeithley() keithley.setOutput(outputStatus) doingSweep = False client.send(aboName,':PROG:IV! FINISHED\n')
import sys sys.path.insert(1, "../") from myutils import sClient, decode, printer, is_float #from threading import Thread #import subprocess import time import argparse import keithleyInterface import os #import serial import signal from time import sleep ON = 1 OFF = 0 End = False Logger = printer() IVLogger = printer() Logger.set_name("KeithleyLog") IVLogger.set_name("ivLog") LeakageCurrentLogger = printer() LeakageCurrentLogger.set_name("leakageCurrentLog") #sweep parameters TODO anpassen startValue = -100 stopValue = -200 stepValue = 15 nSweeps = 1 delay =.1 maxSweepTries=1 doingSweep = False do_leakage_current_measurement = False
def sweep(): global doingSweep global testDir global maxSweepTries global client global keithley global aboName doingSweep = True outputStatus = keithley.getOutputStatus() client.send( aboName, ':MSG! Start with Linear Sweep from %sV to %sV in %sV steps\n' % (startValue, stopValue, stepValue)) Logger << "TestDirectory is: %s" % testDir Logger << "Max Sweep Tries: %d" % maxSweepTries ntries = 0 while True: retVal = keithley.doLinearSweep(startValue, stopValue, stepValue, nSweeps, delay) # Logger << 'keithley RetVal: %s'%retVal ntries += 1 if retVal != 0 or ntries >= maxSweepTries: Logger << 'exit while loop' break voltage = keithley.getLastVoltage() msg = 'Keithley Tripped %s of %s times @ %s\n' % ( ntries, maxSweepTries, voltage) Logger << msg client.send(aboName, msg) client.send(IVAbo, msg) Logger << "Done with recording IV Curve" client.send(aboName, 'Results of Linear Sweep:\n') client.send(IVAbo, 'Results Start:\n') client.sendData(voltageAbo, 'Sweep Data\n') client.sendData(currentAbo, 'Sweep Data\n') client.sendData(resistanceAbo, 'Sweep Data\n') client.send(aboName, ':PROG:IV! RESULTS\n') npoint = 0 nPoints = len(keithley.measurments) ivCurveLogger = printer() ivCurveLogger.set_name("ivCurveLogger") ivCurveLogger.set_prefix('') ivCurveLogger.set_logfile(testDir, 'ivCurve.log') ivCurveLogger.disable_print() # ivCurveLogger.timestamp = float(args.timestamp) ivCurveLogger << '#voltage(V)\tcurrent(A)\ttimestamp' while len(keithley.measurments) > 0: npoint += 1 measurement = keithley.measurments.popleft() measurement[0] = int(measurement[0]) #Logger << "sending: %s - %s" %(measurement,len(keithley.measurments)) timestamp = measurement[0] voltage = float(measurement[1]) current = float(measurement[2]) # resistance = float(measurement[3]) try: client.sendData( aboName, ':IV! %s/%s ' % (npoint, nPoints) + " ".join(map(str, measurement[:3])) + '\n') except: Logger.warning("Couldn't send to %s" % aboName) try: client.sendData( aboName, ':IV! %s/%s ' % (npoint, nPoints) + " ".join(map(str, measurement[:3])) + '\n') except: Logger.warning("Couldn't send to %s" % aboName) print "Couln't send to %s" % aboName try: client.sendData(IVAbo, " ".join(map(str, measurement[:3])) + '\n') except: Logger.warning("Couldn't send to %s" % IVAbo) strA = '%d %+8.3f' % (timestamp, voltage) strA = strA.strip('\n') strA += '\n' try: client.sendData(voltageAbo, strA) except: Logger.warning("Couldn't send '%s'" % strA) strA = '%d %+11.4e' % (timestamp, current) strA = strA.strip('\n') strA += '\n' try: client.sendData(currentAbo, '%d %+11.4e\n' % (timestamp, current)) except: Logger.warning("Couldn't send '%s'" % strA) try: ivCurveLogger << '%+8.3f\t%+11.4e\t%d' % (voltage, current, timestamp) except: Logger.warning("Couldn't write to ivCuvrveLogger") try: IVLogger << '%s\t%s\t%s' % (voltage, current, timestamp) except: Logger.warning("Couldn't write to ivLogger") # client.sendData(resistanceAbo,'%s %s\n'%(timestamp,resistance)) Logger << 'Results End, %s' % aboName client.send(IVAbo, 'Results End\n') client.clearPackets(aboName) #client.send(aboName,':PROG:IV! FINISHED\n') sleep(1) #client.sendData(aboName,':PROG:IV! FINISHED\n') client.send(voltageAbo, 'Sweep Data Done\n') client.send(currentAbo, 'Sweep Data Done\n') client.send(resistanceAbo, 'Sweep Data Done\n') Logger << 'Sweep done' del ivCurveLogger sleep(1) Logger << 're-initialize Keithley' keithley.initKeithley() keithley.setOutput(outputStatus) doingSweep = False client.send(aboName, ':PROG:IV! FINISHED\n')
# from threading import Thread # import subprocess import time import argparse import keithleyInterface import os # import serial import signal from time import sleep from threading import Timer ON = 1 OFF = 0 End = False Logger = printer() IVLogger = printer() LeakageCurrentLogger = printer() Logger.set_name("KeithleyLog") IVLogger.set_name("ivLog") LeakageCurrentLogger.set_name("leakageCurrentLog") # sweep parameters TODO anpassen startValue = -100 stopValue = -200 stepValue = 15 nSweeps = 1 delay = .1 maxSweepTries = 1 doingSweep = False do_leakage_current_measurement = False