SFELPHOTON-1957:stop-go-and-return motion(2)
This commit is contained in:
+60
-13
@@ -19,12 +19,13 @@ verbose bits:
|
||||
|
||||
mode:
|
||||
0 unused
|
||||
1 pvt motion
|
||||
1 pvt motion (list of arbitrary points)
|
||||
2 unused
|
||||
3 pvt motion using inverse fft velocity
|
||||
4 pvt motion short code using grid parameters
|
||||
5 pvt motion short code using grid parameters. Instead of continous motion it moves and waits as give in the parameter time
|
||||
6 pvt motion 'hit and return using grid parameters. continous motion on 2n ells to pump then same 2n wells to probe, then go 2 rows down
|
||||
3 pvt motion using inverse fft velocity (list of arbitrary points)
|
||||
4 continuous : pvt motion using grid parameters (short code)
|
||||
5 stop-and-go : pvt motion using grid parameters: Instead of continous motion it moves and waits as give in the parameter time
|
||||
6 hit-and-return : pvt motion using grid parameters: continous motion on 2n ells to pump then same 2n wells to probe, then go 2 rows down
|
||||
7 stop-go-and-return : pvt motion using grid parameters: continous motion on 2n ells to pump then same 2n wells to probe, then go 2 rows down
|
||||
|
||||
sync:
|
||||
0 real start and frame trigger with sync
|
||||
@@ -797,7 +798,7 @@ class ShapePath(MotionBase):
|
||||
self.mot_pts=(np.hstack((pt, np.ones((pt.shape[0], 1))))*np.asmatrix(trf)).A # pt*trf
|
||||
#pv is an array of posx posy velx vely
|
||||
pv=np.ndarray(shape=(pt.shape[0]+2,4),dtype=pt.dtype)
|
||||
pv[:]=np.NaN
|
||||
pv[:]=np.nan
|
||||
pv[ 0,(0,1)]=pt[0,:]
|
||||
pv[ 1:-1,(0,1)]=pt
|
||||
pv[ -1,(0,1)]=pt[-1,:]
|
||||
@@ -1179,10 +1180,12 @@ enable plc 2
|
||||
|
||||
'''
|
||||
elif mode==7:
|
||||
if scan==0:
|
||||
if scan == 0:
|
||||
raise Exception('scan=0 not supported')
|
||||
pass
|
||||
else: # scan=1
|
||||
if meta['sync_mode'] == 2:
|
||||
_log.error('sync_mode=2 not allowed for stop-go-and-return motion !')
|
||||
vsx=px/(pt2pt_time)*scale*CoordFeedTime # scaling for Deltatau
|
||||
vsy=py/(pt2pt_time)*scale*CoordFeedTime # scaling for Deltatau
|
||||
|
||||
@@ -1202,15 +1205,56 @@ enable plc 2
|
||||
# else: -> }}else{{
|
||||
# elif ([^:]*): -> }}else if \(\1\){{
|
||||
|
||||
prg+=f'''\
|
||||
//mode 7: stop-go-and-return pvt motion
|
||||
|
||||
tmove = kwargs['tmove']
|
||||
twait = kwargs['twait']
|
||||
fel_per = meta['fel_per']
|
||||
pt2tp_felpulse = round((tmove + twait) / fel_per) # number of fel-pulses for a whole cycle (tmove+twait)
|
||||
meta['pt2pt_time'] = fel_per * pt2tp_felpulse
|
||||
twait_ = round((tmove + twait) / fel_per) * fel_per - tmove
|
||||
if twait != twait_:
|
||||
_log.warning(f'adjust twait({twait}) to {twait_} to match multiple of fel-cycles')
|
||||
# syncPlc:
|
||||
# Sys.Udata[0] 0->1 'fast counter: counter up ech pluse from 0 to pt2tp_felpulse
|
||||
# Sys.Udata[0] 0->1 'slow counter: increments by one after 'pt2tp_felpulse' pulses
|
||||
syncPlc = f'''\
|
||||
close all buffers
|
||||
disable plc 2
|
||||
open plc 2
|
||||
Sys.Udata[0]=0
|
||||
Sys.Udata[1]=0
|
||||
while(1) {{
|
||||
while (Gate3[1].Chan[1].UserFlag==0){{}}
|
||||
Sys.Udata[0]=Sys.Udata[0]+1
|
||||
if (Sys.Udata[0]>={pt2tp_felpulse}) {{
|
||||
Sys.Udata[1]=Sys.Udata[1]+1
|
||||
Sys.Udata[0]=0
|
||||
}}
|
||||
while (Gate3[1].Chan[1].UserFlag==1){{}}
|
||||
}}
|
||||
close
|
||||
enable plc 2
|
||||
'''
|
||||
if comm: comm.gpascii.send_block(syncPlc, verb & 0x08)
|
||||
prg += f'''\
|
||||
//mode 7: stop-go-and-return pvt motion
|
||||
{t}=1 // motion pvt tome scaling
|
||||
{k}=-1 // key position
|
||||
{cx}=0;{cy}=0 // section counter
|
||||
{x0}=0;{y0}=0;{n}=0 // counter well in region
|
||||
{dx}=0;{dy}=1 // motion pitch
|
||||
{vx}=0;{vy}={vsy} // scaled velocity
|
||||
|
||||
//Sys.Udata[0] fast counter
|
||||
//Sys.Udata[1] slow counter
|
||||
//Sys.Udata[2] last slow counter value
|
||||
while(Coord[1].DesTimeBase==0){{}}
|
||||
Sys.Udata[0]=0 // resets fast counter
|
||||
Sys.Udata[1]=0 // resets slow counter
|
||||
Sys.Udata[2]=0
|
||||
while(Sys.Udata[2]==Sys.Udata[1]){{}} //initial wait
|
||||
Sys.Udata[2]=Sys.Udata[1] //save last slow counter value
|
||||
|
||||
pvt{pt2pt_time} abs
|
||||
while(1){{
|
||||
if ({cy}%2==0){{ // even rows
|
||||
@@ -1220,8 +1264,9 @@ enable plc 2
|
||||
{vx}=-{vx}
|
||||
}}
|
||||
{x0}+={dx};{y0}+={dy}
|
||||
//send 1"A:move(%d) X%g:%g Y%g:%g",{k},{ox}+{x}*{px},{vx},{oy}+{y}*{py},{vy}
|
||||
X({ox}+{x}*{px}):({vx}) Y({oy}+{y}*{py}):({vy})
|
||||
//send 1"move(%d) X%g:0 Y%g:0",{k},{ox}+{x}*{px},{oy}+{y}*{py}
|
||||
X({ox}+{x}*{px}):0 Y({oy}+{y}*{py}):0
|
||||
while(Sys.Udata[2]==Sys.Udata[1]){{}};Sys.Udata[2]=Sys.Udata[1] // wait motion trigger
|
||||
if ({t}!=1){{
|
||||
pvt{pt2pt_time} abs;{t}=1
|
||||
}}
|
||||
@@ -1511,7 +1556,9 @@ if __name__=='__main__':
|
||||
ssz=(6, 10) # section size (in wells)
|
||||
smv=(ssz[0]-1+4,ssz[1]+1+8) # time(in num of shots) to move to next section (horiz/vert)
|
||||
sdelay=ssz[0]*ssz[1]+5 # wait after <swait> section for motion trigger. swait=0:never wait
|
||||
sp.setup_motion(fnPrg=fn+'.prg',scale=1.,cnt=1,dwell=100,mode=7,grid=grid,ssz=ssz,smv=smv,sdelay=sdelay)
|
||||
tmove=20 # time to move in ms
|
||||
twait=130# time to wait in ms
|
||||
sp.setup_motion(fnPrg=fn+'.prg',scale=1.,cnt=1,dwell=100,mode=7,grid=grid,ssz=ssz,smv=smv,sdelay=sdelay,tmove=tmove,twait=twait)
|
||||
else:
|
||||
raise(ValueError(f'unsupported mode:{mode}'))
|
||||
|
||||
@@ -1542,7 +1589,7 @@ if __name__=='__main__':
|
||||
'--host=SAR-CPPM-EXPMX1 -v0x5d',
|
||||
'--host=localhost:10001:10002 -v0x59',
|
||||
'--host=SAR-CPPM-EXPMX1 -v0x5d -m5',
|
||||
'--host=localhost:10001:10002 -v0x7d -m6',
|
||||
'--host=localhost:10001:10002 -v0x7d -m60',
|
||||
'--host=localhost:10001:10002 -v0x5d -m61',
|
||||
'--host=localhost:10001:10002 -v0x7d -m62'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user