diff --git a/matlab/simFxFyStage.m b/matlab/DeltaTauParam.m
similarity index 98%
rename from matlab/simFxFyStage.m
rename to matlab/DeltaTauParam.m
index b8134f6..205c307 100644
--- a/matlab/simFxFyStage.m
+++ b/matlab/DeltaTauParam.m
@@ -1,4 +1,4 @@
-function [pb]=simFxFyStage(mot)
+function [pb]=DeltaTauParam(mot)
% !!! first it need to run: [mot1,mot2]=identifyFxFyStage() tobuild a motor object !!!
%
%loads the current (11.10.2018) controller settings of the
diff --git a/matlab/StateSpaceControlDesign.m b/matlab/ObserverParam.m
similarity index 99%
rename from matlab/StateSpaceControlDesign.m
rename to matlab/ObserverParam.m
index 09c14d3..55d9170 100644
--- a/matlab/StateSpaceControlDesign.m
+++ b/matlab/ObserverParam.m
@@ -1,4 +1,4 @@
-function [ssc]=StateSpaceControlDesign(mot,mode)
+function [ssc]=ObserverParam(mot,mode)
% !!! first it need to run: [mot1,mot2]=identifyFxFyStage() to build a motor object !!!
%
% builds a state space controller designed for the plant.
diff --git a/matlab/observer.slx b/matlab/ObserverSim.slx
similarity index 100%
rename from matlab/observer.slx
rename to matlab/ObserverSim.slx
diff --git a/matlab/documentFunctions.m b/matlab/docFunctions.m
similarity index 100%
rename from matlab/documentFunctions.m
rename to matlab/docFunctions.m
diff --git a/matlab/docSim.slx b/matlab/docSimulation.slx
similarity index 100%
rename from matlab/docSim.slx
rename to matlab/docSimulation.slx
diff --git a/matlab/sample.slx b/matlab/sample.slx
index bca6194..9a75239 100644
Binary files a/matlab/sample.slx and b/matlab/sample.slx differ
diff --git a/matlab/stage_closed_loop.slx b/matlab/stage_closed_loop.slx
deleted file mode 100644
index 6089ee5..0000000
Binary files a/matlab/stage_closed_loop.slx and /dev/null differ
diff --git a/python/MXMotion.py b/python/MXMotion.py
index 89a3e68..1577f94 100644
--- a/python/MXMotion.py
+++ b/python/MXMotion.py
@@ -70,25 +70,27 @@ class MotionBase:
if sync_mode!=0:
print({0: 'real start trigger', 1: 'simulated start trigger'}[sync_flag&1])
print({0: 'real frame trigger', 2: 'simulated frame trigger'}[sync_flag&2])
+
+ self.sync_run = '&{crdId}b{prgId}r'''.format(prgId=prgId, crdId=crdId)
+
if sync_mode==0:
try:
del self.sync_prg
except AttributeError:
pass
- self.sync_run = '&{crdId}b{prgId}r'''.format(prgId=prgId, crdId=crdId)
elif sync_mode in(1,2):
#frequence jitter 50Hz Swissgrid:
#https://www.swissgrid.ch/de/home/operation/grid-data/current-data.html#
- flag0='Coord[1].Q[10]' if sync_flag&1 else 'Gate3[1].Chan[0].UserFlag'
- flag1='Coord[1].Q[11]' if sync_flag&2 else 'Gate3[1].Chan[1].UserFlag'
+ flag0='Coord[{crdId}].Q[10]'.format(crdId=crdId) if sync_flag&1 else 'Gate3[1].Chan[0].UserFlag'
+ flag1='Coord[{crdId}].Q[11]'.format(crdId=crdId) if sync_flag&2 else 'Gate3[1].Chan[1].UserFlag'
if sync_mode==1:
prg = '''
- Coord[1].Q[1]=-2
- Coord[1].TimeBaseSlew=1 //1E-4 is default
- Coord[1].DesTimeBase=0
+ Coord[{crdId}].Q[0]=-2
+ Coord[{crdId}].TimeBaseSlew=1 //1E-4 is default
+ Coord[{crdId}].DesTimeBase=0
while({flag0}==0){{}}
- Coord[1].Q[1]=-1
+ Coord[{crdId}].Q[0]=-1
Gather.Enable=2
while({flag1}==0){{}}
Coord[1].DesTimeBase=Sys.ServoPeriod
@@ -98,11 +100,10 @@ class MotionBase:
//Gather.Enable=2 is done in the sync program
Coord[1].TimeBaseSlew=1 //1E-4 is default
Coord[1].DesTimeBase=0
- Coord[1].Q[1]=-1
+ //Coord[1].Q[0]=-1 is done in the sync program
'''.format(crdId=crdId, flag0=flag0, flag1=flag1)
self.sync_prg = prg
- self.sync_run = '&{crdId}b{prgId}r'''.format(prgId=prgId, crdId=crdId)
#download and start triggerSync code
comm=self.comm
@@ -113,7 +114,7 @@ class MotionBase:
if sync_mode==2 or arg&4:
sftp = comm.sftp
dst = '/tmp/triggerSync'
- src = os.path.abspath(os.path.join(os.path.dirname(__file__), '../src/triggerSync/triggerSync'))
+ src = os.path.abspath(os.path.join(os.path.dirname(__file__), 'triggerSync'))
sftp.put(src, dst)
sftp.chmod(dst, 0o755)
cmd = 'LD_LIBRARY_PATH=/opt/ppmac/libppmac/ ' + dst
@@ -140,7 +141,7 @@ class MotionBase:
- def run(self):
+ def run(self, crdId=1):
'runs the code sync_run which has been generated with setup_sync()'
comm = self.comm
gpascii = comm.gpascii
@@ -150,6 +151,32 @@ class MotionBase:
raise 'Need to call setup sync before'
gpascii.send_block(cmd)
+ def wait_armed(self,crdId=1): #wait until motors are at first position
+ sm=self.meta['sync_mode']
+ if sm==0:
+ return
+ else:
+ comm = self.comm
+ gpascii = comm.gpascii
+ while (True):
+ val = gpascii.get_variable('Coord[{crdId}].Q[0]'.format(crdId=crdId), type_=int)
+ if val==-2:
+ break
+ time.sleep(.1)
+
+ def progress(self): #returns the progress of the motion
+ sm=self.meta['sync_mode']
+ comm = self.comm
+ gpascii = comm.gpascii
+ ge = gpascii.get_variable('Gather.Enable', type_=int)
+ if ge == 0: return -1
+ cnt = gpascii.get_variable('Gather.Samples', type_=int)
+ try:
+ cnt*=self.meta['srv_per']/(self.meta['acq_per']*self.meta['pt2pt_time'])
+ except KeyError:
+ pass
+ return cnt
+
def trigger(self,wait=.5):
if self.meta['sync_mode']==0:
return # no trigger at all
diff --git a/python/shapepath.py b/python/shapepath.py
index aabf3c6..f5f8e2b 100755
--- a/python/shapepath.py
+++ b/python/shapepath.py
@@ -41,7 +41,7 @@ Enc 7: Interferometer X
'''
from __future__ import print_function
-import os, sys
+import os, sys, time
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
@@ -735,7 +735,7 @@ class ShapePath(MotionBase):
prg.append('{')
prg.append(' linear abs')
prg.append('X%g Y%g' % tuple(pv[0, (0,1)]))
- prg.append('dwell 100')
+ prg.append('dwell %d' % dwell)
prg.append('goto 100')
prg.append('}')
else:
@@ -866,9 +866,14 @@ if __name__=='__main__':
sp.setup_motion(fnPrg=fn+'.prg', mode=3, scale=1,dwell=10)
#sp.setup_motion(fnPrg=fn + '.prg', mode=1, scale=1,dwell=10)
#sp.setup_motion(fnPrg=fn + '.prg', mode=1, scale=0,dwell=10)
- sp.homing()
- sp.run()
+ sp.homing() #homing if needed
+ sp.run() #start motion program
+ sp.wait_armed() # wait until motors are at first position
sp.trigger(0.5) #send a start trigger (if needed) ater given time
+ while True:
+ p=sp.progress()
+ if p<0: break
+ print('progress %d'%p);time.sleep(.1)
sp.gather_upload(fnRec=fn+'.npz')
dp=DebugPlot(sp);dp.plot_gather(mode=11)
diff --git a/qt/ESB_MX_exp.ui b/qt/ESB_MX_exp.ui
index e33c9e4..57fb708 100644
--- a/qt/ESB_MX_exp.ui
+++ b/qt/ESB_MX_exp.ui
@@ -478,13 +478,13 @@ P=$(P),M=MOT_GIR_W
- EVR
+ EVR;EVR-simple
- G_EVR_main.ui
+ G_EVR_main.ui;S_LAS-TMAIN.ui
- SYS=SAR-CVME-ESBMX1,DEVICE=EVR0,FF=VME-300
+ SYS=SAR-CVME,DEVICE=EVR0,FF=VME-300;SYS=SAR-CVME,IOC=SAR-CVME-EVR0,DEVICE=EVR0
caRowColMenu::Menu