...
...
Code Block |
---|
LB def _align(self): Y3 caput('%s:%s' % (self.sPpmPv, 'C2'), 1)Realignment checks CL Y4 val = caget('%s:%s' % (self.sPpmPv, 'C2'))Save current speeds CL Y5 C2 = int(val) 'Assign realignment speeds R3=N3-50 APR_000 = self.apr_000'Lower upper deadband R4=N4+50 APR_180 = self.apr_180'Upper lower deadband CL Y2, C2<R4 ALG_000 = self.alg_000 ALG_180 = self.alg_180 self._exe_align(C2, APR_000, APR_180, ALG_000, ALG_180) def _exe_align(self, C2, APR_000, APR_180, ALG_000, ALG_180): print '_exe_align self.homeDone', self.homeDone self._dis_pars() self._pr_log('Blades alignment -----------------') if not self.homeDone: self._pr_err('!! Need to home before alignment procedure') return False #cmd = '%s:%s' % (self.sPpmPv, 'C1'); val = '%d' % C2 #self._pr_log('caput(\'%s\', %s)' % (cmd, val)) # set C1=C2 caput('%s:%s' % (self.sPpmPv, 'SET_VM'), 25600) # set EE=0 (open loop) caput('%s:%s' % (self.sPpmPv, 'SET_VI'), 2844) # set C1=0 caput('%s:%s' % (self.sPpmPv, 'SET_A'), 45511) # set C1=0 caput('%s:%s' % (self.sPpmPv, 'SET_D'), 45511) # set C1=0 caput('%s:%s' % (self.sPpmPv, 'SET_C1'), C2) # set C1=C2 caput('%s:%s' % (self.sPpmPv, 'SET_EE'), 1) # set EE=1 (close loop) #cmd = '%s:%s' % (self.sPpmPv, 'EE'); val = 1 #self._pr_log('caput(\'%s\', %s)' % (cmd, val)) # set EE=1 (close loop) print 'C2 >= APR_000', C2, APR_000 print 'C2 < APR_180', C2, APR_180 print 'C2 < APR_000', C2, APR_000 print 'C2 >= APR_180', C2, APR_180 # if C2 >= APR_000 and C2 < APR_180: # 'If C2 is below this db, move to 0 CL Y1, C2>R3 'If C2 above the db, move to 180 CL Y1, N9=0 'If open, just move to 0 CL Y6 'Restore PP speeds AD=1 # move absolute'Set toalign ALG_180done positionflag # H 100 RT LB Y1 #cmd = '%s:%s' % (self.sPpmPv, 'MA'); val = '%d' % ALG_180 #Reset far end, C2>N3-SD EE=1 #self._pr_log('caput(\'%s\', %s)' % (cmd, val)) #'Enable encoder MA 8192 'Move to 180 degrees H caput('%s:%s' % (self.sPpmPv, 'MA'), ALG_180) # 'Wait till elifmove C2is <done APR_000 and C2 >C1= APR_180: #0 'Reset microsteps register #C2=0 move absolute to ALG_100 position # 'Reset encoder register EE=0 #cmd = '%s:%s' % (self.sPpmPv, 'MA'); val = '%d' % ALG_000 #Disable encoder for trigger mode N9=1 #self._pr_log('caput(\'%s\', %s)' % (cmd, val)) #'Flag successful close H 100 RT LB Y2 caput('%s:%s' % (self.sPpmPv, 'MA'), ALG_000) # Reset near zero, C2<N4+SD EE=1 caput('%s:%s' % (self.sPpmPv, 'MA'), ALG_000) #'Enable encoder MA 0 'Move to 0 else:degrees # H self.homeDone = False # 'Wait till move is done C1=0 print '!! Need to home before'Reset alignmentmicrosteps procedure'register # C2=0 'Reset returnencoder False #register EE=0 'Disable cmdencoder = '%s:%s' % (self.sPpmPv, 'EE'); val = 0 #for trigger mode N9=1 self._pr_log('caput(\'%s\', %s)' % (cmd, val)) # set EE=0 (open loop) # 'Flag successful close H 100 RT LB Y4 cmd = '%s:%s' % (self.sPpmPv, 'C1'); val = 0 #'Save current speeds V1=VM V2=VI self._pr_log('caput(\'%s\', %s)' % (cmd, val)) # set C1=0 V3=A V4=D RT LB Y5 time.sleep(5) 'Assign realignment speeds caput('%s:%s' % (self.sPpmPv, 'SET_EE'), 0) # set EE=0 (open loop) VM=8192 VI=2000 A=2000 D=2000 RT LB Y6 caput('%s:%s' % (self.sPpmPv, 'SET_C1'), 0) # set C1=0Restore speeds VM=V1 VI=V2 A=V3 caput('%s:%s' % (self.sPpmPv, 'SET_C2'), 0) # set C1=0 D=V4 RT |
...