diff --git a/Readme.md b/Readme.md index dc280c6..8a8c471 100644 --- a/Readme.md +++ b/Readme.md @@ -363,3 +363,233 @@ $$$*** !SAR-EXPMX3() ``` +5 CAM mover commissioning EH60 27.3.18 +-------------------------------------- +``` +PPMAC=SAROP11-CPPM-MOT6765 +PPMAC=MOTTEST-CPPM-CRM0515 +PBInspect --host $PPMAC + +gpasciiCommander --host $PPMAC -i +$$$*** +!common() +PowerBrick[0].GpioData[0].17=1 +16 fail +17 ok +18 fail +19 ok +20 fail +21 fail on box +22 fail on box +23 fail on box +21 fail on box + +Testing on motor 2 + +$$$*** +!common() +!encoder_sim(enc=2,tbl=2,mot=2) +!motor(mot=2,dirCur=1000,JogSpeed=1024) +!encoder_ssi(enc=2,tbl=10,mot=10,numBits=18) + +PowerBrick[0].GpioData[0].17=1 +#2j:102400 +PowerBrick[0].GpioData[0].17=0 +#2k + +#2j:10240000 == 360 deg = 262037.6288 inc = 360000mdeg + + +//the motor has 512*200*100 usteps per revolution (512 uystep/step, 200 steps/rev 1:100 gear) +//the ssi-encoder has 2**18=262144 steps per revolution + + +//motor_u_steps/inc_enc_step=39.0625 +//the ssi-encoder has 2**18=262144 steps per revolution + +//10240000 ustep == 262144 encCnt == 360deg=360000mdeg +//posSf = userUnits/encoder_steps=360000/262144=5625./4096. +//servoSf=motor_u_steps/userUnits 10240000/360000=256./9. + + +$$$*** +!common() +!encoder_ssi(enc=2,numBits=18,posSf=5625./4096.) +!motor(mot=2,dirCur=1000,JogSpeed=40,servoSf=256./9.,HomeOffset=0) +PowerBrick[0].GpioData[0].17=1 +#2j:360000 +PowerBrick[0].GpioData[0].17=0 +#2k +!cm_brake(mot=2,curOn=1000,cs=1,delay=200,gpio=17) + + + +cpx r0=180000;call 20 //motor 2 180deg +cpx r0=0 ;call 20 //motor 2 0 deg + + + +cd /home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/cfg/ +gpasciiCommander --host $PPMAC -i +$$$*** +!common() +!SAR-EXPMX3() +cpx call 15 //current on, open breaks +#1..5j=180000 +#1..5j=0 +cpx call 16 //close breaks, current off +&1 +cpx r0=180000;call 20 //motor 2 180deg + +open prog 10 +call15 +abslinear +X(10) Y(0) U(0) V(0) W(0) +call16 +close +b10r + +open prog 11 +call15 +abslinear +jog1=0 +jog2=0 +jog3=0 +jog4=0 +jog5=0 +call16 +close +b11r + +open prog 12 +call15 +abslinear +jog1=180000 +jog2=180000 +jog3=180000 +jog4=180000 +jog5=180000 +call16 +close +b12r +&1p +``` + +5 CAM coord trf EH60 27.3.18 +---------------------------- +``` +PPMAC=MOTTEST-CPPM-CRM0515 +ssh root@$PPMAC +sendgetsends -1 + + +open prog 12 +call15 +abslinear +jog1=180000 +jog2=180000 +jog3=180000 +jog4=180000 +jog5=180000 +call16 +close +b12r +&1p +``` + +5 CAM coord trf EH60 27.3.18 +---------------------------- +``` +PPMAC=MOTTEST-CPPM-CRM0515 +ssh root@$PPMAC +sendgetsends -1 + +$$$*** +!common() +!SAR-EXPMX3() + + +&1p -> execute forward kinematics + +cpx call 15 +#1..5j=0 +cpx abslinear X(0)Y(0)U(0)V(0)W(0) ->executes inverse kinematic +cpx call 16 + + + + + L6=2000/3000 + L7=1000/1.41421356237 + L11=L7*sin(L1*1.74532925199e-05) + L12=L7*sin(L2*1.74532925199e-05) + L13=L7*sin(L3*1.74532925199e-05) + L14=L7*sin(L4*1.74532925199e-05) + L15=L7*sin(L5*1.74532925199e-05) + + +$$$*** +!common() +!SAR-EXPMX3() +&1 +#1..5j/ +#1..5hmz + +open prog 1 + //homez1..5 + call 15 + jog1..5=0 + call 16 + L0 = Sys.Time + 2 + while (L0 > Sys.Time){} + call 15 + jog1..5=180000 + call 16 + call 15 + abslinear X(1000)Y(0)U(0)V(0)W(0) + dwell 100 + abslinear X(0)Y(1000)U(0)V(0)W(0) + dwell 100 + abslinear X(0)Y(0)U(0)V(0)W(0) + dwell 100 + jog1..5=0 + call 16 +close +b1r +cpx call15;abslinear X(1000)Y(0)U(0)V(0)W(0);call16; +cpx call15;jog1..5=0;call16; +``` + + + +towards IOC 29.3.18 +------------------- +``` +PPMAC=MOTTEST-CPPM-CRM0515 +ssh root@$PPMAC +cd /ioc/SAR-CPPM-EXPMX3 +iocsh startup.script +dbl + +export EPICS_CA_ADDR_LIST="129.129.126.255" + +export EPICS_CA_ADDR_LIST=$PPMAC +caQtDM -macro 'P=SAR-EXPMX' ESB_MX_exp +caQtDM -macro 'P=SAR-EXPMX' ESB_MX_5cam + + + + +PPMAC=SAR-CPPM-EXPMX2 +cd /home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX +PBInspect --host $PPMAC --cfg PBInspect2.pbi + +cd /home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/cfg +gpasciiCommander --host $PPMAC -i +$$$*** +!common() +!SAR-EXPMX2() + + + +``` diff --git a/SAR-EXPMX3.subs b/SAR-EXPMX3.subs index 1d484e0..6b8051b 100644 --- a/SAR-EXPMX3.subs +++ b/SAR-EXPMX3.subs @@ -16,10 +16,16 @@ file asyn.template {{P="$(P_M)3", PORT=$(PORT_M)}} file PPMACMotor.template { -pattern{ DESC , P , M , PORT , ADDR, DIR, VELO, HVEL, ACCL, JAR, MRES , PREC, EGU , DHLM, DLLM} - { "Girder 1", "$(P_M)", "MOT_GIRDER1", "$(PORT_M)", 1 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 } - { "Girder 2", "$(P_M)", "MOT_GIRDER2", "$(PORT_M)", 2 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 } - { "Girder 3", "$(P_M)", "MOT_GIRDER3", "$(PORT_M)", 3 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 } - { "Girder 4", "$(P_M)", "MOT_GIRDER4", "$(PORT_M)", 4 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 } - { "Girder 5", "$(P_M)", "MOT_GIRDER5", "$(PORT_M)", 5 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 } +pattern +{ DESC , P , M , PORT , ADDR, DIR, VELO, HVEL, ACCL, JAR, MRES , PREC, EGU , DHLM, DLLM} +{ "Girder 1", "$(P_M)", "MOT_GIR_1", "$(PORT_M)", 1 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 } +{ "Girder 2", "$(P_M)", "MOT_GIR_2", "$(PORT_M)", 2 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 } +{ "Girder 3", "$(P_M)", "MOT_GIR_3", "$(PORT_M)", 3 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 } +{ "Girder 4", "$(P_M)", "MOT_GIR_4", "$(PORT_M)", 4 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 } +{ "Girder 5", "$(P_M)", "MOT_GIR_5", "$(PORT_M)", 5 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 } +{ "Girder X", "$(P_M)", "MOT_GIR_X", "$(PORT_M)", 9 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 } +{ "Girder Y", "$(P_M)", "MOT_GIR_Y", "$(PORT_M)", 10 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 } +{ "Girder U", "$(P_M)", "MOT_GIR_U", "$(PORT_M)", 11 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 } +{ "Girder V", "$(P_M)", "MOT_GIR_V", "$(PORT_M)", 12 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 } +{ "Girder W", "$(P_M)", "MOT_GIR_W", "$(PORT_M)", 13 , 0 , .3 , .3 , 0.1 , 20 , -0.001, 3 , "mm", 0 , 0 } } diff --git a/add_EXPMX2.cmd b/add_EXPMX2.cmd index 00dc0c7..44081c3 100644 --- a/add_EXPMX2.cmd +++ b/add_EXPMX2.cmd @@ -12,7 +12,7 @@ powerPmacCreateAxis($(PORT), 2) powerPmacCreateAxis($(PORT), 3) powerPmacCreateAxis($(PORT), 4) powerPmacCreateAxis($(PORT), 5) -#powerPmacCreateAxis($(PORT), 6) +powerPmacCreateAxis($(PORT), 6) #powerPmacCreateAxis($(PORT), 7) #powerPmacCreateAxis($(PORT), 8) diff --git a/add_EXPMX3.cmd b/add_EXPMX3.cmd index c974668..f30dadb 100644 --- a/add_EXPMX3.cmd +++ b/add_EXPMX3.cmd @@ -18,25 +18,35 @@ powerPmacCreateAxis($(PORT), 5) #powerPmacCreateVirtualAxis(, , , , Sys.Time){} + //send 1"wait done\n" +close + +//post +open subprog SP_LockBrk + define(EndTime='L1'); // Local variable + //wait until all motors are in pos + EndTime = Sys.Time + 10; // time + 10 sec. + //send 1"wait." + while (EndTime > Sys.Time) + { + if(Coord[1].InPos) + { + send 1"inPos\n" + break + } + //if(Motor[1].InPos && Motor[2].InPos&& Motor[3].InPos&& Motor[4].InPos&& Motor[5].InPos) + // break + //send 1"." + } + //send 1"done\n" + + Motor[1].IdCmd=0;Motor[1].InPosBand=10 + Motor[2].IdCmd=0;Motor[2].InPosBand=10 + Motor[3].IdCmd=0;Motor[3].InPosBand=10 + Motor[4].IdCmd=0;Motor[4].InPosBand=10 + Motor[5].IdCmd=0;Motor[5].InPosBand=10 + PowerBrick[1].GpioData[0].16.5=$0 +close -// //NEW: -// //the motor has 512*200*100 usteps per revolution (512 uystep/step, 200 steps/rev 1:100 gear) -// //the ssi-encoder has 2**18=262144 steps per revolution -// //motor_u_steps/inc_enc_step=39.0625 -// //JogSpeed=102.4 ustep/ms=102400ustep/s = 512*200= 1 rev/sec -// posSf : position scale factor: encoder position to motor u-steps, 1 motor step is 512 motor u-steps -// motor_u_steps=posSf*encoder_steps -> posSf = motor_u_steps/encoder_steps -// default is 1.0 (1 motor_u_steps = 1 encoder_steps) +//for motor #2 +//PowerBrick[0].GpioData[0].17=1 +//#2j:360000 +//PowerBrick[0].GpioData[0].17=0 +//#2k +//!cm_brake(mot=2,curOn=1000,cs=1,delay=200,gpio=17) + -// !encoder_ssi(enc=1,numBits=18,posSf=39.0625) -// !encoder_ssi(enc=2,numBits=18,posSf=39.0625) -// !encoder_ssi(enc=3,numBits=18,posSf=39.0625) -// !encoder_ssi(enc=4,numBits=18,posSf=39.0625) -// !encoder_ssi(enc=5,numBits=18,posSf=39.0625) -// !motor(mot=1,dirCur=600,JogSpeed=102.4) -// !motor(mot=2,dirCur=600,JogSpeed=102.4) -// !motor(mot=3,dirCur=600,JogSpeed=102.4) -// !motor(mot=4,dirCur=600,JogSpeed=102.4) -// !motor(mot=5,dirCur=600,JogSpeed=102.4) -// !cm_brake(mot=1,curOn=600,cs=1,delay=200,gpio=16) -// !cm_brake(mot=2,curOn=600,cs=1,delay=200,gpio=17) -// !cm_brake(mot=3,curOn=600,cs=1,delay=200,gpio=18) -// !cm_brake(mot=4,curOn=600,cs=1,delay=200,gpio=19) -// !cm_brake(mot=5,curOn=600,cs=1,delay=200,gpio=20) diff --git a/cfg/MX3_setup_sim.cfg b/cfg/MX3_setup_sim.cfg new file mode 100644 index 0000000..3aff032 --- /dev/null +++ b/cfg/MX3_setup_sim.cfg @@ -0,0 +1,19 @@ +!encoder_sim(enc=1,tbl=1,mot=1) +!motor(mot=1,dirCur=0,contCur=100,peakCur=100,timeAtPeak=1,JogSpeed=100.,numPhase=3,invDir=True) +Motor[1].pLimits=0;Motor[1].AmpFaultLevel=0;Motor[1].pAmpEnable=0;Motor[1].pAmpFault=0 + +!encoder_sim(enc=2,tbl=2,mot=2) +!motor(mot=2,dirCur=0,contCur=100,peakCur=1000,timeAtPeak=1,JogSpeed=100.,numPhase=3,invDir=True) +Motor[2].pLimits=0;Motor[2].AmpFaultLevel=0;Motor[2].pAmpEnable=0;Motor[2].pAmpFault=0 + +!encoder_sim(enc=3,tbl=3,mot=3) +!motor(mot=3,dirCur=0,contCur=100,peakCur=1000,timeAtPeak=1,JogSpeed=100.,numPhase=3,invDir=True) +Motor[3].pLimits=0;Motor[3].AmpFaultLevel=0;Motor[3].pAmpEnable=0;Motor[3].pAmpFault=0 + +!encoder_sim(enc=4,tbl=4,mot=4) +!motor(mot=4,dirCur=0,contCur=100,peakCur=1000,timeAtPeak=1,JogSpeed=100.,numPhase=3,invDir=True) +Motor[4].pLimits=0;Motor[4].AmpFaultLevel=0;Motor[4].pAmpEnable=0;Motor[4].pAmpFault=0 + +!encoder_sim(enc=5,tbl=5,mot=5) +!motor(mot=5,dirCur=0,contCur=100,peakCur=1000,timeAtPeak=1,JogSpeed=100.,numPhase=3,invDir=True) +Motor[5].pLimits=0;Motor[5].AmpFaultLevel=0;Motor[5].pAmpEnable=0;Motor[5].pAmpFault=0 diff --git a/cfg/SAR-EXPMX3.cfg b/cfg/SAR-EXPMX3.cfg index e965fc6..cc0a7e3 100644 --- a/cfg/SAR-EXPMX3.cfg +++ b/cfg/SAR-EXPMX3.cfg @@ -1,5 +1,32 @@ !MX3_setup() +//!MX3_setup_sim() // comment out !MX3_setup() when this is active //!MX3_home() //using 360000 for 1 rev. -> 1.7453292519943296e-05=np.pi/180000 -!MX3_coordTrf(exc=1000,height=2000,width=3000,length=4000,camSf=1.7453292519943296e-05) \ No newline at end of file +//excentricity= 5mm +//height = 2mm ? +//width = 50cm ? +//length = 100cm ? +!MX3_coordTrf(exc=5000,height=2000,width=500000,length=1000000,camSf=1.7453292519943296e-05) + + +Coord[1].Ta=10 +Coord[1].Td=10 +Coord[1].AltFeedRate=1000 +Coord[1].Tm=-10000 //1000um/FeedTime -> 1mm/sec +Coord[1].FeedTime=1000 //default value 1000um + + +Motor[1].InPosBand=10 +Motor[2].InPosBand=10 +Motor[3].InPosBand=10 +Motor[4].InPosBand=10 +Motor[5].InPosBand=10 + +#1..5hmz +#1..5j/ +&1 +cpx call 16 //lock brakes, motor current off + + + diff --git a/cfg/sim_8_motors.cfg b/cfg/sim_8_motors.cfg index 765bbdd..5444aee 100644 --- a/cfg/sim_8_motors.cfg +++ b/cfg/sim_8_motors.cfg @@ -1,6 +1,6 @@ //simulated 8 motors without needing real ones -$$$*** -!common() +//$$$*** +//!common() //use some step and direction lines to setup simulate motors // /afs/psi.ch/user/h/humar_t/public/Modules/XMI/cfg/xmi.cfg diff --git a/python/5camMeas.py b/python/5camMeas.py new file mode 100755 index 0000000..6b7ed23 --- /dev/null +++ b/python/5camMeas.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python +# *-----------------------------------------------------------------------* +# | | +# | Copyright (c) 2017 by Paul Scherrer Institute (http://www.psi.ch) | +# | | +# | Author Thierry Zamofing (thierry.zamofing@psi.ch) | +# *-----------------------------------------------------------------------* +''' +generate code to find HomeOffset for the 5cam systems + +the results are: +amplitude: 5mm +#1: homeoffset: -20907.5928142 +#2: homeoffset: 102320.329068 +#3: homeoffset: 168946.772022 +#4: homeoffset: -87830.7554146 +#5: homeoffset: -47956.2759182 +''' +import numpy as np +import matplotlib.pyplot as plt + +def meas_rot_ctr(y,per=1): + # find the amplitude bias and phase of an equidistant sampled sinus + # it needs at least 3 measurements e.g. at 0,120 240 deg or 0 90 180 270 deg + # per is the number of persiods, default is 1 period =360 deg + n=len(y) + f = np.fft.fft(y) + idx=int(per) + bias=np.absolute(f[0]/n) + phase=np.angle(f[idx]) + ampl=np.absolute(f[idx])*2/n + print('len: '+str(n)) + print('bias: '+str(bias)) + print('amplitude: '+str(ampl)) + print('phase: '+str(phase*360./2/np.pi)) + print('homeoffset: '+str(-phase*360./2/np.pi*1000)) + +def gen_code(): + pos=np.arange(0,360000,12000) + mot=range(1,6) + #mot=range(1,2) + for m in mot: + print('''open prog %i + call15 + abslinear + '''%(10+m)) + for p in pos: + print(""" jog%i=%i + dwell 5000"""%(m,p)) + print(""" jog%i=0 + call16 +close +"""%(m,)) + for m in mot: + print("&1;b%ir"%(10+m)) + +def plot(): + ''' + &1;b11r + &1;b12r + &1;b13r + &1;b14r + &1;b15r + ''' + data1=[0,-.475,-1.123,-1.916,-2.819,-3.797,-4.799,-5.786,-6.708,-7.531,-8.219,-8.746,-9.085,-9.229,-9.176,-8.929,-8.499,-7.895,-7.142,-6.271,-5.320,-4.325,-3.329,-2.377,-1.513,-.780,-.216,.151,.305,.241] + data2=[0,1.04,2.092,3.108,4.041,4.847,5.496,5.946,6.184,6.196,5.976,5.540,4.907,4.110,3.181,2.162,1.103,0.051,-.953,-1.859,-2.639,-3.252,-3.677,-3.892,-3.893,-3.677,-3.256,-2.648,-1.878,-.980] + data3=[0,.296,0.785,1.445,2.248,3.160,4.146,5.165,6.170,7.120,7.968,8.676,9.210,9.541,9.660,9.564,9.274,8.807,8.154,7.340,6.398,5.378,4.318,3.271,2.310,1.485,.790,.282,-.028,-.130,] + data4=[0,-1.035,-2.021,-2.930,-3.713,-4.333,-4.777,-5.018,-5.057,-4.888,-4.522,-3.967,-3.249,-2.393,-1.430,-0.402,.650,1.678,2.633,3.470,4.146,4.626,4.887,4.916,4.711,4.297,3.69,2.917,2.010,1.021] + data5=[0,-.847,-1.786,-2.794,-3.815,-4.808,-5.727,-6.537,-7.194,-7.681,-7.987,-8.089,-7.990,-7.688,-7.204,-6.547,-5.745,-4.831,-3.840,-2.814,-1.799,-.844,0.015,.726,1.257,1.58,1.683,1.562,1.223,.685] + data=[data1,data2,data3,data4,data5] + for d in data: + meas_rot_ctr(d,1) + plt.plot(d) + plt.show() +gen_code() +plot() + + diff --git a/qt/ESB_MX_5cam.ui b/qt/ESB_MX_5cam.ui new file mode 100644 index 0000000..3737f41 --- /dev/null +++ b/qt/ESB_MX_5cam.ui @@ -0,0 +1,219 @@ + + + Form + + + + 0 + 0 + 776 + 342 + + + + Form + + + + + 20 + 10 + 721 + 28 + + + + + 18 + 75 + true + + + + ESB MX 5 cam girder $(P) + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + 160 + 160 + 164 + + + + + + + 20 + 70 + 725 + 240 + + + + +P=$(P),M=MOT_GIR_1; +P=$(P),M=MOT_GIR_2; +P=$(P),M=MOT_GIR_3; +P=$(P),M=MOT_GIR_4; +P=$(P),M=MOT_GIR_5; +P=$(P),M=MOT_GIR_X; +P=$(P),M=MOT_GIR_Y; +P=$(P),M=MOT_GIR_U; +P=$(P),M=MOT_GIR_V; +P=$(P),M=MOT_GIR_W + + + ESB_MX_motor.ui + + + 10 + + + + + + 20 + 50 + 731 + 21 + + + + + 2 + + + + + + 0 + 0 + + + + DESC + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + VAL + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + RBV + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 25 + 0 + + + + + 20 + 16777215 + + + + LLS + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 25 + 0 + + + + + 20 + 16777215 + + + + HLS + + + Qt::AlignCenter + + + + + + + Motors Panels + + + Qt::AlignCenter + + + + + + + + + caLabel + QLabel +
caLabel
+
+ + caInclude + QWidget +
caInclude
+
+
+ + +
diff --git a/qt/ESB_MX_exp.ui b/qt/ESB_MX_exp.ui index abd0bca..9113de1 100644 --- a/qt/ESB_MX_exp.ui +++ b/qt/ESB_MX_exp.ui @@ -354,6 +354,48 @@ P=$(P),M=MOT_GIRDER5 HEXGIR + + ESB_MX_5cam.ui + + + NAME=$(P), NAME1=$(P) + + + caRowColMenu::Menu + + + false;false;false;false;false;false;false;false;false;false;false;false;false;false;false;false + + + + + + 340 + 620 + 151 + 30 + + + + -ESB_MX Girder(old) + + + + 0 + 0 + 0 + + + + + 89 + 126 + 225 + + + + HEXGIR + S_CS_HEXGIR_5Dbasic.ui