From 8e5b15e0ac6507a28609b70494c4d8c36e88f91b Mon Sep 17 00:00:00 2001 From: Thierry Zamofing Date: Fri, 20 May 2022 08:24:44 +0200 Subject: [PATCH] wip --- Readme.md | 59 +++++++++++++++++++++++++++++- logbook.md | 35 +++++++++++++++++- python/shapepath.py | 88 ++++++++++++++++++++++++++++++++------------- 3 files changed, 155 insertions(+), 27 deletions(-) diff --git a/Readme.md b/Readme.md index acfa3cd..e170ca3 100644 --- a/Readme.md +++ b/Readme.md @@ -1142,10 +1142,11 @@ cp -farL ~/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/python/*.py \ ~/Documents/prj/SwissFEL/PBTools/pbtools/ \ ~/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/src/triggerSync/triggerSync \ /sf/bernina/config/swissmx/zamofing_t/ + cp -farL ~/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/python/ShapePathAnalyser/*.py \ /sf/bernina/config/swissmx/zamofing_t/ShapePathAnalyser/ -scp -r pc9477:~/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/python/*.py /sf/bernina/config/swissmx/zamofing_t/ +#scp -r pc9477:~/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/python/*.py /sf/bernina/config/swissmx/zamofing_t/ @@ -1200,3 +1201,59 @@ send 1"inv_res %f %f %f %f\\n",{qCX},{qCZ},{qW},{qFY} ``` + + +Oct. 2019 Measure backlash wedge movers +--------------------------------------- +``` +Wedge Mover 1 Mover 2 Plate 1 Plate 2 + 0 0 0 0 0 +-.1 -0.1030 -0.0990 -0.0990 -0.0990 +-.2 -0.2045 -0.1990 -0.1985 -0.2000 +-.3 -0.3060 -0.3005 -0.2990 -0.3000 +-.2 -0.2040 -0.2000 -0.2015 -0.2030 +-.1 -0.1030 -0.0990 -0.1020 -0.1030 + 0 0.0020 0.0025 0.0030 0.0020 + .1 0.0985 0.1030 0.0965 0.0980 + .2 0.1980 0.2015 0.1955 0.1980 + .3 0.2975 0.3020 0.2950 0.2960 + .2 0.1995 0.2035 0.1980 0.2020 + .1 0.0980 0.1045 0.0990 0.1010 + 0 0.0020 0.0045 0.0000 0.0010 + + +Mover 1/2 on the black metal block with the name +Plate 1/2 above mover 1/2 on aluminum border ob bread board + +-> no backlash (ca. 10um) could be measured. + +``` + + +16.5.22 tunneling +----------------- +``` +--host=localhost:10001:10002 + +PPMAC=SAR-CPPM-EXPMX1 + +rsync -va ~/Documents/prj/SwissFEL/PBTools/pbtools/gather/gather_server root@$PPMAC:/tmp/ +ssh root@$PPMAC +LD_LIBRARY_PATH=/opt/ppmac/libppmac/ /tmp/gather_server + + +ssh -L 10001:localhost:22 root@$PPMAC 'uname -a' +ssh -L 10002:localhost:2332 root@$PPMAC 'uname -a' +-> this tunnels port 22 and 2332 of $PPMAC to 10001 and 10002 of localhost + +Tests: +nc localhost 10001 +nc localhost 10002 + +list close ssh tunnel +--------------------- +lsof -i -n | grep '127.0.0.1:1000' + +. + + diff --git a/logbook.md b/logbook.md index 19b2ab1..b193092 100644 --- a/logbook.md +++ b/logbook.md @@ -959,7 +959,7 @@ OpenLoop: Status Review 2.8.2017 ---------------------- - +``` cd ~/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX;PBInspect --cfg PBinspect.pbi --host SAR-CPPM-EXPMX1 cd ~/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/cfg/;gpasciiCommander --host SAR-CPPM-EXPMX1 -i $$$*** @@ -985,6 +985,39 @@ cd /scratch/ESB_MX/ESB_MX/qt caqtdm -macro 'P=SAR-ESB_MX' ESB_MX_exp.ui Press homing or following line: caput SAR-ESB_MX:ASYN.AOUT 'enable plc 1' +``` + +Recommissioning 13.4.2022 +------------------------- +``` +MCS: + +Purchased On: 2017/12/18 +Part Type Name: MCS-3CC-ETHA-MOD +MAC 1: 00:04:A3:A2:71:35 +Purchase Number: 5200119415 + +root@SAR-CSSU-EXPMX1:~# echo -ne "\xff" > /dev/ttyM0 +-> it worked but Zan can not make it run any more +caput SAR-EXPMX1:ASYN.AOUT '#1p' +caget SAR-EXPMX1:ASYN.TINP + +caput SAR-EXPMX1:ASYN.AOUT 'BrickLV.Reset=1' + +-> Motor 4 has a short cirquit, therefore the motion and shapepath is not possible. + + +caput SAR-EXPMX1:ASYN.AOUT '&0#4->0' +caput SAR-EXPMX1:ASYN.AOUT '&0#5->0' +caput SAR-EXPMX1:ASYN.AOUT '&0#6->0' +caput SAR-EXPMX1:ASYN.AOUT '&0#7->0' +caput SAR-EXPMX1:ASYN.AOUT '&0#8->0' + +caput SAR-EXPMX1:ASYN.AOUT '#1..3j/' +caput SAR-EXPMX1:ASYN.AOUT '#4j/' + + +``` diff --git a/python/shapepath.py b/python/shapepath.py index f507e30..8340538 100755 --- a/python/shapepath.py +++ b/python/shapepath.py @@ -39,6 +39,29 @@ Mot 5: Stage Z Stada Stepper 670mA 200 poles 1 rev = 100*2 Enc 6: Interferometer Y Enc 7: Interferometer X + +tunnel PowerBrick port locally +------------------------------ +Port 22 on PowerBrick is the ssh server port +Port 2332 on PowerBrick is the gather port of gather_server + +PPMAC=SAR-CPPM-EXPMX1 +ssh -L 10001:localhost:22 root@$PPMAC 'uname -a' +ssh -L 10002:localhost:2332 root@$PPMAC 'uname -a' +-> this tunnels port 22 and 2332 of $PPMAC to 10001 and 10002 of localhost +('uname -a' is just to execute a command and return, because the port remains open) + +Tests: +nc localhost 10001 +nc localhost 10002 + +list close ssh tunnel +--------------------- +lsof -i -n | egrep 'ssh' +lsof -i -n | grep '127.0.0.1:1000' + + + ''' from __future__ import print_function #from __future__ import absolute_import,division,generators,nested_scopes,print_function,unicode_literals,with_statement @@ -52,6 +75,7 @@ import matplotlib.pyplot as plt import subprocess as sprc sys.path.insert(0,os.path.expanduser('~/Documents/prj/SwissFEL/PBTools/')) +sys.path.insert(0,os.path.expanduser('/tmp/zamofing_t/PBTools/')) from pbtools.misc.pp_comm import PPComm from pbtools.misc.gather import Gather from MXMotion import MotionBase @@ -638,12 +662,13 @@ class ShapePath(MotionBase): #1-> Y #2-> X #3-> A -#4->0 -#5->0 -#6->0 -#7->0 -#8->0 -#1..8j/ +&0#4->0 +&0#5->0 +&0#6->0 +&0#7->0 +#1..3j/ +//#8->0 +//#1..8j/ ''' gpascii.send_block(prg) @@ -800,18 +825,29 @@ if __name__=='__main__': def run_test(args): #dp=DebugPlot();dp.plot_gather();return - import socket - s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # create an INET, STREAMing socket - s.settimeout(.1) - try: - port=22 #ssh port - s.connect((args.host, port)) # try to connect to port - s.close() - except (socket.error, socket.gaierror) as e: - comm=gather=None - else: - comm = PPComm(host=args.host) - gather = Gather(comm) + #import socket + #s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # create an INET, STREAMing socket + #s.settimeout(.1) + #try: + # port=22 #ssh port + # s.connect((args.host, port)) # try to connect to port + # s.close() + #except (socket.error, socket.gaierror) as e: + # comm=gather=None + #else: + # comm = PPComm(host=args.host) + # gather = Gather(comm) + + hpp=args.host.split(':') + param={'host':hpp[0]} + if len(hpp)>1: + param['port']=int(hpp[1]) + if len(hpp)>2: + param['fast_gather_port']=int(hpp[2]) + print(' -> ssh-tunneling PPComm({host}:{port} {host}:{fast_gather_port})'.format(**param)) + comm=PPComm(**param) + gather = Gather(comm) + #real start and frame trigger with sync #sp = ShapePath(comm, gather, args.verbose) @@ -819,7 +855,7 @@ if __name__=='__main__': #sp = ShapePath(comm, gather, args.verbose,sync_mode=0,pt2pt_time=10) #simulated start and frame trigger no sync - #sp = ShapePath(comm, gather, args.verbose,sync_mode=1,sync_flag=3) + sp = ShapePath(comm, gather, args.verbose,sync_mode=1,sync_flag=3) #simulated start and frame trigger with sync #sp = ShapePath(comm, gather, args.verbose,sync_mode=2,sync_flag=3) @@ -828,7 +864,7 @@ if __name__=='__main__': #sp = ShapePath(comm, gather, args.verbose,sync_mode=1,sync_flag=1) #simulated start real frame trigger with sync - sp = ShapePath(comm, gather, args.verbose,sync_mode=2,sync_flag=1) + #sp = ShapePath(comm, gather, args.verbose,sync_mode=2,sync_flag=1) fn='/tmp/shapepath' #fn =unique_filename('ShapePathAnalyser/records/19_01_24/spiral') @@ -855,11 +891,12 @@ if __name__=='__main__': #sp.gen_swissmx_points(width=1000,ofs=(-500,0)) #sp.gen_swissfel_points(width=1000,ofs=(-500,0)) #sp.gen_rand_points(n=20, scale=100,ofs=(-950,+2780));sp.sort_points(xy=False) - sp.gen_rand_points(n=200, scale=100,ofs=(0,+2000));sp.sort_points(xy=False) + #sp.gen_rand_points(n=200, scale=100,ofs=(0,+2000));sp.sort_points(xy=False) #sp.gen_swissmx_points(width=1000, ofs=(-500, 0)); #sp.gen_spiral_points(rStart=100,rInc=10,numSeg=4,numCir=60, ofs=(0, 0)) #sp.gen_spiral_points(rStart=100,rInc=130,numSeg=4,numCir=2, ofs=(0, 0)) - #sp.gen_grid_points(w=10,h=10,pitch=100,rnd=0,ofs=(0,0));sp.sort_points(False); + #sp.gen_grid_points(w=20,h=20,pitch=100,rnd=0,ofs=(0,+2000));sp.sort_points(False); + sp.gen_grid_points(w=5,h=10,pitch=100,rnd=0,ofs=(0,+2000));sp.sort_points(False,10); #sp.gen_grid_points(w=1,h=10,pitch=100,rnd=0,ofs=(0,0)) #sp.gen_spiral_points(rStart=100,rInc=20,numSeg=8,numCir=32, ofs=(0, 0)) #sp.gen_spiral_points(rStart=100,rInc=10,numSeg=2,numCir=32, phase=45, ofs=(0, 0)) @@ -869,7 +906,7 @@ if __name__=='__main__': gtMaxLn=116508;ovhdTime=100 acq_per=int(np.ceil((sp.meta['pt2pt_time']*sp.points.shape[0]+ovhdTime)/(gtMaxLn*sp.meta['srv_per']))) sp.setup_gather(acq_per=acq_per) - sp.setup_sync(verbose=args.verbose&32,timeOfs=0.55) + sp.setup_sync(verbose=args.verbose&32,timeOfs=0.05) sp.setup_coord_trf() # reset to shape path system #sp.meta['pt2pt_time']=10 #put between setup_sync and setup_motion to have more motion points than FEL syncs sp.setup_motion(fnPrg=fn+'.prg', mode=3, scale=1.,dwell=10) @@ -917,8 +954,8 @@ if __name__=='__main__': 'main command line interpreter function' #usage: gpasciiCommunicator.py --host=PPMACZT84 myPowerBRICK.cfg (h, t)=os.path.split(sys.argv[0]);cmd='\n '+(t if len(h)>3 else sys.argv[0])+' ' - exampleCmd=('-n', - '-v15' + exampleCmd=('-v15', + '--host=localhost:10001:10002' ) epilog=__doc__+''' Examples:'''+''.join(map(lambda s:cmd+s, exampleCmd))+'\n ' @@ -928,6 +965,7 @@ Examples:'''+''.join(map(lambda s:cmd+s, exampleCmd))+'\n ' parser.add_option('-v', '--verbose', type="int", dest='verbose', help='verbosity bits (see below)', default=0) parser.add_option('--host', help='hostname', default='SAR-CPPM-EXPMX1') + #parser.add_option('--host', help='hostname', default='localhost:10001:10002') #parser.add_option('--host', help='hostname') (args, other)=parser.parse_args()