homing plc and fixes

This commit is contained in:
2017-06-12 09:51:02 +02:00
parent 0bf383e155
commit 3b886088d9
15 changed files with 1133 additions and 87 deletions

68
cfg/init.cfg Normal file
View File

@@ -0,0 +1,68 @@
define(PLC_Homing='1')
open subprog 12
enable plc PLC_Homing
close
open plc PLC_Homing
define(status='P100',timer='P101')
L20=Motor[2].MaxDac
Motor[2].MaxDac=500
L21=Motor[2].FatalFeLimit
Motor[2].FatalFeLimit=2000
L22=Motor[2].JogSpeed
Motor[2].JogSpeed=1
L30=Motor[3].MaxDac
Motor[3].MaxDac=500
L31=Motor[3].FatalFeLimit
Motor[3].FatalFeLimit=2000
L32=Motor[3].JogSpeed
Motor[3].JogSpeed=1
Motor[2].PhaseFindingStep=1
Motor[3].PhaseFindingStep=1
timer = Sys.RunTime + 1;while (Sys.RunTime < timer){} //wait 1 sec
Motor[2].HomeVel=2
Motor[3].HomeVel=2
P200=Motor[2].HomeInProgress
home2
home3
timer = Sys.RunTime + 1;while (Sys.RunTime < timer){} //wait 1 sec
P201=Motor[2].HomeInProgress
status=1
while(1)
{
if(Motor[2].FeFatal && (status&2)==0)
{
status=status|2
Motor[2].HomeVel=-Motor[2].HomeVel
home2
}
if(Motor[3].HomeInProgress==0 && (status&4)==0)
{
status=status|4
Motor[3].HomeVel=-Motor[3].HomeVel
home3
}
if(Motor[2].HomeInProgress==0 && Motor[3].HomeInProgress==0)
{
status=status|8
break
}
}
Motor[2].MaxDac=L20
Motor[2].FatalFeLimit=L21
Motor[2].JogSpeed=L22
Motor[3].MaxDac=L30
Motor[3].FatalFeLimit=L31
Motor[3].JogSpeed=L32
disable plc PLC_Homing
close

71
cfg/init_limit.cfg Normal file
View File

@@ -0,0 +1,71 @@
//home by bove to physical limits and set these to -5000um
define(PLC_Homing='1')
open plc PLC_Homing
define(status='P100',timer='P101')
L20=Motor[2].MaxDac
Motor[2].MaxDac=500
L21=Motor[2].FatalFeLimit
Motor[2].FatalFeLimit=2000
L22=Motor[2].JogSpeed
Motor[2].JogSpeed=1
L30=Motor[3].MaxDac
Motor[3].MaxDac=500
L31=Motor[3].FatalFeLimit
Motor[3].FatalFeLimit=2000
L32=Motor[3].JogSpeed
Motor[3].JogSpeed=1
Motor[2].PhaseFindingStep=1
Motor[3].PhaseFindingStep=1
timer = Sys.RunTime + 1;while (Sys.RunTime < timer){} //wait 1 sec
jog-2; jog-3;
status=1
while(1)
{
if(Motor[2].FeWarn==1 && (status&2)==0)
{
status=status|2
jog/2
Motor[2].PhasePos=310
Motor[2].HomePos=Motor[2].ActPos+5000
jog2=0
}
if(Motor[3].FeWarn==1 && (status&4)==0)
{
status=status|4
jog/3
Motor[3].PhasePos=1210
Motor[3].HomePos=Motor[3].ActPos+5000
jog3=0
}
if(status==7)
{
status=status|8
break
}
}
timer = Sys.RunTime + 2
while (Sys.RunTime < timer){} //wait 2 sec
status=100
timer = Sys.RunTime + 2
status=200
while (Sys.RunTime < timer){} //wait 2 sec
status=201
Motor[2].MaxDac=L20
Motor[2].FatalFeLimit=L21
Motor[2].JogSpeed=L22
Motor[3].MaxDac=L30
Motor[3].FatalFeLimit=L31
Motor[3].JogSpeed=L32
disable plc PLC_Homing
close

View File

@@ -43,6 +43,7 @@ $$$***
//!common(PhaseFreq=40000)
!torqueCtrl()
!init()
&1
@@ -51,8 +52,8 @@ $$$***
//#3-> + .5X +1. Y + 0.01A
#1-> A
#2-> Y
#3-> X
#2-> X
#3-> Y
Coord[1].AltFeedRate=0
Coord[1].Tm=1 //1ms time

View File

@@ -53,8 +53,9 @@ Motor[1].pPhaseEnc=Acc84B[0].Chan[0].SerialEncDataA.a
//use um as motor unit
!encoder_sim(enc=2,tbl=10,mot=10,posSf=13000./2048)
!encoder_inc(enc=2,tbl=2,mot=2,posSf=13000./650000)
!motor_servo(mot=2,ctrl='ServoCtrl',Kp=20,Kvfb=1000,Ki=0.07,Kvff=1000,Kaff=4000,MaxInt=1000)
!motor(mot=2,dirCur=0,contCur=800,peakCur=2400,timeAtPeak=1,IiGain=1,IpfGain=0,IpbGain=2,JogSpeed=10.,numPhase=3,invDir=True,servo=None,PhasePosSf=1./81250,PhaseFindingDac=100,PhaseFindingTime=50,SlipGain=0,AdvGain=0,PwmSf=10000,FatalFeLimit=200,WarnFeLimit=100,InPosBand=2)
//!motor_servo(mot=2,ctrl='ServoCtrl',Kp=20,Kvfb=1000,Ki=0.07,Kvff=1000,Kaff=4000,MaxInt=1000)
!motor_servo(mot=2,ctrl='ServoCtrl',Kp=20,Kvfb=220,Ki=0.02,Kvff=240,Kaff=1500,MaxInt=1000)
!motor(mot=2,dirCur=0,contCur=800,peakCur=2400,timeAtPeak=1,IiGain=1,IpfGain=0,IpbGain=2,JogSpeed=10.,numPhase=3,invDir=True,servo=None,PhasePosSf=1./81250,PhaseFindingDac=100,PhaseFindingTime=50,SlipGain=0,AdvGain=0,PwmSf=10000,FatalFeLimit=200,WarnFeLimit=100,InPosBand=2,homing='enc-index')
//Stage X Parker MX80L (top stage, mounted on Y stage)
@@ -68,7 +69,7 @@ Motor[1].pPhaseEnc=Acc84B[0].Chan[0].SerialEncDataA.a
!encoder_inc(enc=3,tbl=3,mot=3,posSf=13000./650000)
!motor_servo(mot=3,ctrl='ServoCtrl',Kp=20,Kvfb=220,Ki=0.02,Kvff=240,Kaff=1500,MaxInt=1000)
//PhaseFreq=20000,PhasePerServo=1 -> Kvfb=220*4 Ki/=4,Kvff*=4,Kaff*=4*4
!motor(mot=3,dirCur=0,contCur=800,peakCur=2400,timeAtPeak=1,IiGain=1,IpfGain=0,IpbGain=2,JogSpeed=10.,numPhase=3,invDir=True,servo=None,PhasePosSf=1./81250,PhaseFindingDac=100,PhaseFindingTime=50,SlipGain=0,AdvGain=0,PwmSf=10000,FatalFeLimit=2000,WarnFeLimit=100,InPosBand=2)
!motor(mot=3,dirCur=0,contCur=800,peakCur=2400,timeAtPeak=1,IiGain=1,IpfGain=0,IpbGain=2,JogSpeed=10.,numPhase=3,invDir=True,servo=None,PhasePosSf=1./81250,PhaseFindingDac=100,PhaseFindingTime=50,SlipGain=0,AdvGain=0,PwmSf=10000,FatalFeLimit=200,WarnFeLimit=100,InPosBand=2,homing='enc-index')
//Interferometer 1 Stage Y Parker MX80L (bottom stage)
//----------------------------------------------------