matlab rename, adapt for new software
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
function [pb]=simFxFyStage(mot)
|
function [pb]=DeltaTauParam(mot)
|
||||||
% !!! first it need to run: [mot1,mot2]=identifyFxFyStage() tobuild a motor object !!!
|
% !!! first it need to run: [mot1,mot2]=identifyFxFyStage() tobuild a motor object !!!
|
||||||
%
|
%
|
||||||
%loads the current (11.10.2018) controller settings of the
|
%loads the current (11.10.2018) controller settings of the
|
||||||
@@ -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 !!!
|
% !!! first it need to run: [mot1,mot2]=identifyFxFyStage() to build a motor object !!!
|
||||||
%
|
%
|
||||||
% builds a state space controller designed for the plant.
|
% builds a state space controller designed for the plant.
|
||||||
Binary file not shown.
Binary file not shown.
@@ -70,25 +70,27 @@ class MotionBase:
|
|||||||
if sync_mode!=0:
|
if sync_mode!=0:
|
||||||
print({0: 'real start trigger', 1: 'simulated start trigger'}[sync_flag&1])
|
print({0: 'real start trigger', 1: 'simulated start trigger'}[sync_flag&1])
|
||||||
print({0: 'real frame trigger', 2: 'simulated frame trigger'}[sync_flag&2])
|
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:
|
if sync_mode==0:
|
||||||
try:
|
try:
|
||||||
del self.sync_prg
|
del self.sync_prg
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
self.sync_run = '&{crdId}b{prgId}r'''.format(prgId=prgId, crdId=crdId)
|
|
||||||
|
|
||||||
elif sync_mode in(1,2):
|
elif sync_mode in(1,2):
|
||||||
#frequence jitter 50Hz Swissgrid:
|
#frequence jitter 50Hz Swissgrid:
|
||||||
#https://www.swissgrid.ch/de/home/operation/grid-data/current-data.html#
|
#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'
|
flag0='Coord[{crdId}].Q[10]'.format(crdId=crdId) 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'
|
flag1='Coord[{crdId}].Q[11]'.format(crdId=crdId) if sync_flag&2 else 'Gate3[1].Chan[1].UserFlag'
|
||||||
if sync_mode==1:
|
if sync_mode==1:
|
||||||
prg = '''
|
prg = '''
|
||||||
Coord[1].Q[1]=-2
|
Coord[{crdId}].Q[0]=-2
|
||||||
Coord[1].TimeBaseSlew=1 //1E-4 is default
|
Coord[{crdId}].TimeBaseSlew=1 //1E-4 is default
|
||||||
Coord[1].DesTimeBase=0
|
Coord[{crdId}].DesTimeBase=0
|
||||||
while({flag0}==0){{}}
|
while({flag0}==0){{}}
|
||||||
Coord[1].Q[1]=-1
|
Coord[{crdId}].Q[0]=-1
|
||||||
Gather.Enable=2
|
Gather.Enable=2
|
||||||
while({flag1}==0){{}}
|
while({flag1}==0){{}}
|
||||||
Coord[1].DesTimeBase=Sys.ServoPeriod
|
Coord[1].DesTimeBase=Sys.ServoPeriod
|
||||||
@@ -98,11 +100,10 @@ class MotionBase:
|
|||||||
//Gather.Enable=2 is done in the sync program
|
//Gather.Enable=2 is done in the sync program
|
||||||
Coord[1].TimeBaseSlew=1 //1E-4 is default
|
Coord[1].TimeBaseSlew=1 //1E-4 is default
|
||||||
Coord[1].DesTimeBase=0
|
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)
|
'''.format(crdId=crdId, flag0=flag0, flag1=flag1)
|
||||||
|
|
||||||
self.sync_prg = prg
|
self.sync_prg = prg
|
||||||
self.sync_run = '&{crdId}b{prgId}r'''.format(prgId=prgId, crdId=crdId)
|
|
||||||
#download and start triggerSync code
|
#download and start triggerSync code
|
||||||
comm=self.comm
|
comm=self.comm
|
||||||
|
|
||||||
@@ -113,7 +114,7 @@ class MotionBase:
|
|||||||
if sync_mode==2 or arg&4:
|
if sync_mode==2 or arg&4:
|
||||||
sftp = comm.sftp
|
sftp = comm.sftp
|
||||||
dst = '/tmp/triggerSync'
|
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.put(src, dst)
|
||||||
sftp.chmod(dst, 0o755)
|
sftp.chmod(dst, 0o755)
|
||||||
cmd = 'LD_LIBRARY_PATH=/opt/ppmac/libppmac/ ' + dst
|
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()'
|
'runs the code sync_run which has been generated with setup_sync()'
|
||||||
comm = self.comm
|
comm = self.comm
|
||||||
gpascii = comm.gpascii
|
gpascii = comm.gpascii
|
||||||
@@ -150,6 +151,32 @@ class MotionBase:
|
|||||||
raise 'Need to call setup sync before'
|
raise 'Need to call setup sync before'
|
||||||
gpascii.send_block(cmd)
|
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):
|
def trigger(self,wait=.5):
|
||||||
if self.meta['sync_mode']==0:
|
if self.meta['sync_mode']==0:
|
||||||
return # no trigger at all
|
return # no trigger at all
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ Enc 7: Interferometer X
|
|||||||
|
|
||||||
'''
|
'''
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import os, sys
|
import os, sys, time
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import matplotlib as mpl
|
import matplotlib as mpl
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
@@ -735,7 +735,7 @@ class ShapePath(MotionBase):
|
|||||||
prg.append('{')
|
prg.append('{')
|
||||||
prg.append(' linear abs')
|
prg.append(' linear abs')
|
||||||
prg.append('X%g Y%g' % tuple(pv[0, (0,1)]))
|
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('goto 100')
|
||||||
prg.append('}')
|
prg.append('}')
|
||||||
else:
|
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=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=1,dwell=10)
|
||||||
#sp.setup_motion(fnPrg=fn + '.prg', mode=1, scale=0,dwell=10)
|
#sp.setup_motion(fnPrg=fn + '.prg', mode=1, scale=0,dwell=10)
|
||||||
sp.homing()
|
sp.homing() #homing if needed
|
||||||
sp.run()
|
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
|
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')
|
sp.gather_upload(fnRec=fn+'.npz')
|
||||||
dp=DebugPlot(sp);dp.plot_gather(mode=11)
|
dp=DebugPlot(sp);dp.plot_gather(mode=11)
|
||||||
|
|
||||||
|
|||||||
@@ -478,13 +478,13 @@ P=$(P),M=MOT_GIR_W</string>
|
|||||||
</color>
|
</color>
|
||||||
</property>
|
</property>
|
||||||
<property name="labels">
|
<property name="labels">
|
||||||
<string>EVR</string>
|
<string>EVR;EVR-simple</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="files">
|
<property name="files">
|
||||||
<string>G_EVR_main.ui</string>
|
<string>G_EVR_main.ui;S_LAS-TMAIN.ui</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="args">
|
<property name="args">
|
||||||
<string>SYS=SAR-CVME-ESBMX1,DEVICE=EVR0,FF=VME-300</string>
|
<string>SYS=SAR-CVME,DEVICE=EVR0,FF=VME-300;SYS=SAR-CVME,IOC=SAR-CVME-EVR0,DEVICE=EVR0</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="stackingMode" stdset="0">
|
<property name="stackingMode" stdset="0">
|
||||||
<enum>caRowColMenu::Menu</enum>
|
<enum>caRowColMenu::Menu</enum>
|
||||||
|
|||||||
Reference in New Issue
Block a user