예제 #1
0
 def pid(self, xx=None):
     if xx != None:
         sleep(1)
         caput(self.pvstring + 'P_S', xx[0])
         sleep(1)
         caput(self.pvstring + 'I_S', xx[1])
         sleep(1)
         caput(self.pvstring + 'D_S', xx[2])
         sleep(1)
         caput(self.pvstring + 'P_S', xx[0])
         sleep(1)
         caput(self.pvstring + 'I_S', xx[1])
         sleep(1)
         caput(self.pvstring + 'D_S', xx[2])
         sleep(1)
     #	caput(self.pvstring+'ASYN.AOUT','PID '+str(x[0])+','+str(x[1])+','+str(x[2]))
     #	return caput(self.pvstring+'ASYN.AINP','PID?')
     P = caget(self.pvstring + 'P')
     I = caget(self.pvstring + 'I')
     D = caget(self.pvstring + 'D')
     return [P, I, D]
예제 #2
0
    def autotune(self, terange, channel):
        self.cmod(1)
        self.mout(0)
        if float(self.mout()) > 0.0:
            print "just started Warning Mout>0"
        caput(self.pvstring + 'ASYN.AOUT', 'CSET 1,' + channel)
        caget(self.pvstring + 'ASYN.AINP')
        oppid = []
        self.cmod(4)
        temper = frange(terange[0], terange[1], terange[2])
        if float(self.mout()) > 0.0:
            print "Switching to mode 4 set Mout>0"

        for temp in temper:
            self.asynchronousMoveTo(temp)
            print self.getPosition()
            print self.getPosition()
            sleep(2)
            status = 1
            while status == 1:
                if float(self.mout()) > 0.0:
                    print "Warning during the tuning Mout>0"
                caput(self.pvstring + 'TUNEST')
                sleep(5)
                status = int(caget(self.pvstring + 'ASYN.AINP')[0])
#			caput(self.pvstring+'ASYN.AOUT','KRDG?'+channel)
#			sleep(1)
#			Tchant1=caget(self.pvstring+'ASYN.AINP')
#			sleep(1)
#			caput(self.pvstring+'ASYN.AOUT','KRDG?'+channel)
##			sleep(1)
#			Tchant2=caget(self.pvstring+'ASYN.AINP')
            tpid = [self.getPosition()] + self.pid()
            oppid = oppid + tpid
            print tpid
            if float(self.mout()) > 0.0:
                print "Warning Mout>0"
        self.cmod(1)
        return oppid
예제 #3
0
 def ramp(self, rate=None):
     '''ramp(): returns the status of the ramp \n''' \
     '''ramp([5]): set ramp ON at 5 K/min \n''' \
     '''ramp([0]): set ramp OFF'''
     if rate == None:
         caput(self.pvstring + 'ASYN.AOUT', 'RAMP? 1')
         sleep(2)
         string = caget(self.pvstring + 'ASYN.AINP')
         print 'ramp on te (on/off,K/min): ' + string
     elif len(rate) > 0:
         if rate[0] > 0:
             cmdstr = 'RAMP 1, 1, ' + str(rate[0])
             caput(self.pvstring + 'ASYN.AOUT', cmdstr)
         else:
             caput(self.pvstring + 'ASYN.AOUT', 'RAMP 1, 0')
예제 #4
0
 def getPosition(self):
     return float(caget(self.pvstring + 'CRDG' + self.channel))
예제 #5
0
 def getPosition(self):
     return [
         float(caget(self.pvstring + 'KRDG' + self.channel)),
         float(caget(self.pvstring + 'SRDG' + self.channel))
     ]
예제 #6
0
 def cmod(self, xx=None):
     if xx != None:
         caput(self.pvstring + 'CMODE_S', xx)
         sleep(1)
         caget(self.pvstring + 'CMODE')
     return caget(self.pvstring + 'CMODE')
예제 #7
0
 def heater(self):
     return caget(self.pvstring + 'HTR')
예제 #8
0
 def mout(self, xx=None):
     if xx != None:
         caput(self.pvstring + 'MOUT_S', xx)
         sleep(1)
     return caget(self.pvstring + 'MOUT')
예제 #9
0
 def hrange(self, xx=None):
     if xx != None:
         caput(self.pvstring + 'RANGE_S', xx)
         sleep(1)
     return caget(self.pvstring + 'RANGE')
예제 #10
0
 def getPosition(self):
     #	sleep(1)
     Tset = float(caget(self.pvstring + 'SETP'))
     return Tset
예제 #11
0
 def control_chan(self, channel):
     caput(self.pvstring + 'ASYN.AOUT', 'CSET 1,' + channel)
     sleep(1)
     return caget(self.pvstring + 'ASYN.AOUT')