2018-10-04 15:19:34 +02:00
2017-01-27 11:23:31 +01:00
2018-10-03 10:18:07 +02:00
2018-10-04 15:19:34 +02:00
2018-10-04 15:19:34 +02:00
2018-09-18 11:05:44 +02:00
2017-06-12 09:51:02 +02:00
2018-10-03 10:18:07 +02:00
2017-12-22 12:12:59 +01:00
2018-03-29 16:53:23 +02:00
2018-04-05 08:44:37 +02:00
2018-09-18 11:05:44 +02:00
2018-10-03 10:18:07 +02:00
2018-04-03 15:11:03 +02:00
2018-10-03 10:18:07 +02:00
2018-04-17 08:47:38 +02:00
2018-08-14 11:59:01 +02:00
2018-10-03 10:18:07 +02:00

Various motor documents

  • /home/zamofing_t/Documents/doc-ext/SwissFEL/ESB-MX-Stage

Parker stage

- encoder is incremental encoder
25mm or 50mm travel stage
Stall Current Continuous 0.8
Peak Current Amps RMS 2.4    (->sqrt(2)*2.4=3.39A_peak)
Resistance Ohms 8.8
Inductance mH 2.4
Max.BuxVoltage V 80

Continous Force 4N -> assume 1kg load -> acceleration=a=F/m=4m/s^2
Weight top stage: 250g=2.5N

Mecapion rot stage

http://www.lsmecapion.com/eng/
http://www.lsmecapion.com/eng/contents/sub01/sub02_03.php
http://www.a2v.fr/program/mdm-dc06d.htm
http://www.parkem.ch/medien/produkte/direktantriebstechnik/pdf/MDM_Rundtisch_katalog.pdf
http://www.goto.si/wp-content/uploads/2016/kat/L7%20Series%20catalog.pdf
http://farasys.ir/wp-content/uploads/2015/Direct%20Drive%20Rotary%20Motors.pdf
http://www.inmoco.co.uk/Upload/product/1037_DD_Series_Motors_79.pdf

- encoder is biss 20 bit
- Rated Current 1.46 Arms
- Max Current 4.38 Arms
- 32 pole (16 einraster per rev)

Testing ServoFrq.

!common(PhaseFreq=20000,PhasePerServo=4) -> 25000points, 20um error  leads the trajectory in x
!common(PhaseFreq=20000,PhasePerServo=2) -> 25000points, 6.6um error
!common(PhaseFreq=20000,PhasePerServo=1) -> 25000points, 6.1um error ossilates in y, x is quite good

-> the servo loop has to be optimized!

Testing linear,pvt,spline moves

Tested with shapepath.py: THE BEST TRAJECTORY RESULT IST WITH PVT MOTION

Optimize/Test Parameters with Parker Stage

used ESB_MX/python/move_record.py to record and plot friction
used src/usrServo/usrcode.c to filter the following error of the stage

Check Simulink project at /home/zamofing_t/afs/ESB-MX
subl /home/zamofing_t/afs/ESB-MX/Readme.md

cd /home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/cfg
gpasciiCommander --host SAR-CPPM-EXPMX1 -i
!mx-stage()
#1..3$
&1
#1..3j/

load program prg/testPerfGrid.prg
b2r

cd ~/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/src/usrServo
make #will install the user servo loop
watch P3000 (average following error)
tweak servo parameters ->!motor_servo(mot=3,ctrl='ServoCtrl',Kp=20,Kvfb=220,Ki=0.02,Kvff=240,Kaff=1500,MaxInt=1000)

Same for motor 2 -> watcp P2000
Increase load will need an increase of gains to compensate following error

Motor[2].Servo.Kp=20
Motor[2].Servo.Kvfb=1000
Motor[2].Servo.Ki=0.07
Motor[2].Servo.Kvff=1000
Motor[2].Servo.Kaff=4000


Motor[3].Servo.Kp=20
Motor[3].Servo.Kvfb=220
Motor[3].Servo.Ki=0.02
Motor[3].Servo.Kvff=240
Motor[3].Servo.Kaff=1500

 ./shapepath.py --yx
average error x 0.313575 um, y 0.461707 um, 0.629583 um

./shapepath.py
average error x 0.371877 um, y 0.317152 um, 0.542073 um

Start motion on external signal

open plc 1
Coord[1].DesTimeBase=0       // freezes timebase at boot
while(1)
{
  if(PowerBrick[0].GpioData[0].0.1==1)
  {
     PowerBrick[0].GpioData[0].16.8=255
     Coord[1].DesTimeBase=Sys.ServoPeriod
  }
  else
  {
    PowerBrick[0].GpioData[0].16.8=7
     Coord[1].DesTimeBase=0
  }
}
close
enable plc 1
-> run motion program. press gpio 0 to run at 100%

29.9.17 Testing in MX-LAB

Start the powerbrick. ioc is started automatically
zamofing_t@ganymede:~$ ssh x06mx-cons-1

caget SAR-ESB_MX:MOTOR_AX
cd /net/slsfs-crtl/export/sf/common/config/qt/
startDM -macro 'P=SAR-ESB_MX' ESB_MX_exp
press homing button
-> all axes can be moved.

(on thierrys laptop only)
cd /home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/python
./shapepath.py
will execute the custom motion. No problems with EPICS

(on other machines)
module is installed in:
ls /net/slsfs-crtl/export/sf/ioc/modules/ESB_MX/zamofing_t/R3.14.12/
PATH=/net/slsfs-crtl/export/sf/controls/bin/:$PATH
source /opt/gfa/python-2.7/2.3.0/bin/activate xblpython > /dev/null 2>&1
cd /net/slsfs-crtl/export/sf/ioc/modules/ESB_MX/zamofing_t/R3.14.12/
./shapepath.py

export EPICS_CA_ADDR_LIST="129.129.109.255" export EPICS_CA_ADDR_LIST="129.129.126.255" caQtDm -macro 'P=SAR-ESB_MX' ESB_MX_exp

HelicalScan

PPMAC=MOTTEST-CPPM-CRM0485

cd /home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX
PBInspect --host $PPMAC --cfg PBInspect1.pbi

cd /home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/cfg
gpasciiCommander --host $PPMAC sim_8_motors.cfg -i

ssh root@$PPMAC
sendgetsends -1
cpx send 1"SampleMessage\n"

cd /home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/python
./helicalscan.py

fwd/inv kinematic stuff

Coord[1].SegMoveTime=.05,   will calculate all 0.05 sec the inverse kinematic.
default Coord[1].SegMoveTime=0, calculates inv kin. only at endpoints

&1p  ->this will trigger:forward kinematic
cpx pmatch  ->this will trigger:forward kinematic

cpx ;linear rel; X0Y0Z0B0  ->this will trigger: inverse

test_coord_trf() (w is in mdeg) -> Output:
input  : cx:0.2 cz:0.3 w:5729.58 fy:0.4
fwd_trf: dx:-1.14768 dz:-19.0991 w:5729.58 fy:0.4
inv_trf: cx:0.2 cz:0.3 w:5729.58 fy:0.4

input  : dx:0.2 dz:0.3 w:5729.58 fy:0.4
inv_trf: cx:1.54768 cz:19.6991 w:5729.58 fy:0.4
fwd_trf: dx:0.2 dz:0.3 w:5729.58 fy:0.4

#4j=0.2 //cx
#5j=0.3 //cz
#3j=5729.58 //w
#1j=0.4 //fy
&1p
forward kinematic 0.199997 0.300003 5729.58 0.399994
forward result    -1.14769 -19.0991 5729.58 0.399994

cpx ;linear abs; X.2Y.4Z.3B5729.58
inverse kinematic 0.2 0.3 5729.58 0.4
inverse result    1.54579 19.7026 5729.58 0.4


input  : cx:10 cz:20 w:171887 fy:40
fwd_trf: dx:28.9419 dz:-5.52304 w:171887 fy:40
inv_trf: cx:10 cz:20 w:171887 fy:40
#4j=10 //cx
#5j=20 //cz
#3j=171887 //w
#1j=40 //fy
&1p
forward kinematic 10 20 171887 40
forward result    28.942 -5.52296 171887 40

input  : dx:10 dz:20 w:171887 fy:40
inv_trf: cx:-8.94193 cz:45.523 w:171887 fy:40
fwd_trf: dx:10 dz:20 w:171887 fy:40

cpx ;linear abs; X10 Z20 B171887 Y40
inverse kinematic 10 20 171887 40
inverse result    -8.94198 45.523 171887 40

Motors final setup 20.12.17

SAR-CPPM-EXPMX1: biss:y timing:y
  1: fy
  2: fx
  3: ry
  4: cx
  5: cz
  6: interfero y
  7: interfero x

labels:
MOT_FY      EXPMX1.1 MOT_FX      EXPMX1.2 MOT_ROT_Y   EXPMX1.3 MOT_CX      EXPMX1.4 MOT_CZ      EXPMX1.5
ENC_FY      EXPMX1.1 ENC_FX      EXPMX1.2 ENC_ROT_Y   EXPMX1.3 ENC_CX      EXPMX1.4 ENC_CZ      EXPMX1.5
IFR_FY      EXPMX1.6 IFR_FX      EXPMX1.7

SAR-CPPM-EXPMX2: biss:n timing:n
  1: wedge1
  2: wedge2
  3: wedge3
  4: wedge4
  5: backlight
  6: cryojet

SAR-CPPM-EXPMX3: biss:n timing:y
  1: girder1
  2: girder2
  3: girder3
  4: girder4
  5: girder5


PPMAC=MOTTEST-CPPM-CRM0485
ssh root@$PPMAC
cd /ioc/SAR-CPPM-EXPMX1;iocsh startup.script
sendgetsends -1


ssh x06mx-cons-1
export CAQTDM_DISPLAY_PATH=/net/slsfs-crtl/export/sf/common/config/qt/:/net/slsfs-crtl/export/sf/controls/config/qt/


export EPICS_CA_ADDR_LIST="129.129.126.255"
caqtdm -macro "P=SAR-EXPMX" ESB_MX_exp.ui

TODO 5.1.18

Fwd/inv kinematic is not yet fully correct for PVT moves:
Inverse kinematic need to calculate velocities:
Now a simplified approach with no dependencies is implemented:
  vqCX=vDX
  vqCZ=vDZ
  vqW=vW
  vqFY=vY

To see the differences compare:
  hs.gen_prog(fnPrg='/tmp/prg.cfg',host='MOTTEST-CPPM-CRM0485',mode=1,cntHor=1,cntVert=5,wRng=(120000,120000),pt2pt_time=100)
  hs.gen_prog(fnPrg='/tmp/prg.cfg',host='MOTTEST-CPPM-CRM0485',mode=1,cntHor=1,cntVert=5,wRng=(120000,120000),pt2pt_time=100,smt=0)

  hs.gen_prog(fnPrg='/tmp/prg.cfg',host='MOTTEST-CPPM-CRM0485',mode=1,cntHor=1,cntVert=5,wRng=(0,360000))
  hs.gen_prog(fnPrg='/tmp/prg.cfg',host='MOTTEST-CPPM-CRM0485',mode=1,cntHor=1,cntVert=5,wRng=(0,360000),smt=0)

When using segmented mode (SegMoveTime>0) the velocities are not needed.
With SegMoveTime=0 these velocities are needed and will result in a non optimal trajectory (with the current buggy calculation).

Testing Helicalscan with real motors 8.1.18

PPMAC=SAR-CPPM-EXPMX1
cd /home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/cfg
gpasciiCommander --host $PPMAC -i

$$$***
!common()
!SAR-EXPMX1()
enable plc 1

export EPICS_CA_ADDR_LIST=$PPMAC
caQtDM -macro 'P=SAR-EXPMX' ESB_MX_exp

do homing (or call plc 1)
cd /home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/python
./helicalscan.py

Testing Wedge mover

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()

!!! WATCH OUT !!!
if the send buffer overruns, the programs will abort in an unexplainable way:
    send 1"inv_res    %f %f %f %f\\n",qCX,qCZ,qW,qFY
without reading it with sendgetsends -1

5 CAM mover

/home/zamofing_t/Documents/doc-ext/SwissFEL/Devices/5CAM
/home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/5CAM_SYSTEM/
git@git.psi.ch:epics_ioc_modules/5CAM_SYSTEM.git

copied the coordTrf.py from /home/zamofing_t/Documents/doc-ext/SwissFEL/Devices/5CAM
to /cfg/MX3_coordTrf.py and modify it

PPMAC=MOTTEST-CPPM-CRM0485
cd /home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX
PBInspect --host $PPMAC --cfg PBInspect3.pbi

PPMAC=MOTTEST-CPPM-CRM0485
ssh root@$PPMAC
sendgetsends -1



cd /home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_modules/ESB_MX/cfg
gpasciiCommander --host $PPMAC -i
$$$***
!common()
!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-EXPMX3()

caput SAR-EXPMX3:ASYN.AOUT '&1;#1..5j/;cpx call 15'
caput SAR-EXPMX3:ASYN.AOUT '&1;cpx jog1..5=000;call 16'
caput SAR-EXPMX3:ASYN.AOUT '&1;#1..5j/;cpx call 15'
caput SAR-EXPMX3:ASYN.AOUT '&1;cpx jog1..5=10000;call 16'
caput SAR-EXPMX3:ASYN.AOUT cpx call 16
caput SAR-EXPMX3:ASYN.AOUT cpx call 15
caput SAR-EXPMX3:ASYN.debug cpx call 16
caput SAR-EXPMX3:ASYN.debug0 cpx call 16

see also:

/home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_boot_sf/SARES20-CSSU-ESB1/SARES20-CSSU-ESB1_startup.script
/home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_boot_sf/SARES20-CSSU-ESB1/SARES20-CSSU-ESB1_hexpodPI.subs
/home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_boot_sf/SARES20-CSSU-ESB1/hpod.template
/home/zamofing_t/Documents/prj/SwissFEL/epics_ioc_boot_sf/SARES20-CSSU-ESB1/cfg/hpod.proto

caQtDM -macro "P=SAR-EXPMX:,R=asyn" asynRecord.ui
caQtDM -macro "P=SAR-EXPMX:,R=asyn" asynSerialPortSetup.ui
caQtDM -macro "P=SAR-EXPMX:,R=asyn" asynOctet.ui
caQtDM -macro "P=SAR-EXPMX:,R=debug0" asynOctet.ui


caput SAR-EXPMX:asyn.AOUT '&1;#1..5j/;cpx call 15'
caput SAR-EXPMX:asyn.AOUT '&1;#1..5j/;cpx call 16'

caput -S SAR-EXPMX:debug '&1;#1..5j/;cpx call 15;jog1..5=0; call 16'
caput -S SAR-EXPMX:debug '&1;#1..5j/;cpx call 15;jog1..5=10000; call 16'


caput -S SAR-EXPMX:debug '&1;#1..5j/;cpx call15;abslinear X(1000)Y(0)U(0)V(0)W(0);call16'

caput -S SAR-EXPMX:debug '&1;#1..5j/;cpx call15;abslinear X(1000)Y(0)U(0)V(0)W(0);call16'
caput -S SAR-EXPMX:debug '&1;#1..5j/;cpx call15;abslinear X(00)Y(0)U(0)V(0)W(0);call16'
caput -S SAR-EXPMX:debug '&1;#1..5j/;cpx call15;abslinear X(1000)Y(0)U(0)V(0)W(0);call16'
caput -S SAR-EXPMX:debug '&1;#1..5j/;cpx call15;abslinear X(00)Y(0)U(0)V(0)W(0);call16'
caput -S SAR-EXPMX:debug '&1;#1..5j/;cpx call15;abslinear X(1000)Y(0)U(0)V(0)W(0);call16'


SAR-EXPMX:MOT_GIR_W.SPMG
Plugin: epics3 : loaded & connected
=====================================
Description: Stop
TimeStamp: Apr 04, 2018 11:57:02.623574449
Type: DBF_ENUM
Count: 1
Value: 0
nbStates: 4
States:
     0 Stop
     1 Pause
     2 Move
     3 Go

Check some coord trf 4.4.18

$$$***
!common()
!SAR-EXPMX3()   //with !MX3_setup_sim()


using trf:
!MX3_coordTrf(exc=5000,height=2000,width=500000,length=1000000,camSf=1.7453292519943296e-05)

open forward
//  define(AA1='L1',AA2='L2',AA3='L3',AA4='L4',AA5='L5')
//  define(r='L6',scl='L7')
//  define(S1='L11',S2='L12',S3='L13',S4='L14',S5='L15')
//  define(X='C6',Y='C7',U='C3',V='C4',W='C5')
  L6=2000/500000
  L7=5000/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)

  send 1"fwd_inp(%f)  %f %f %f %f %f\n",D0,L1,L2,L3,L4,L5
  send 1"fwd_inp(%f)  %f %f %f %f %f\n",D0,L11,L12,L13,L14,L15


  //C6=D^-1*S
  C6=+.5*L11     -.5*L12   +(L6+.5)*L13    +(L6-.5)*L14    +(.5-L6)*1.41421356237*L15
  C7=+.5*L11     +.5*L12      +.25*L13       +.25*L14       +.25*1.41421356237*L15
  C3=                        -.5*L13        -.5*L14        +.5*1.41421356237*L15
  C4=-.5*L11     +1.*L12      +1.5*L13        -.5*L14        -.5*1.41421356237*L15
  C5=-.5*L11     -1.*L12       +.5*L13        +.5*L14        +.5*1.41421356237*L15

  send 1"fwd_res     %f %f %f %f %f\n",C6,C7,C3,C4,C5

  D0=$000000f8; //C3=$8 C4=$10 C5=$20 C6=$40 C7=$80 hex(8+int('10',16)+int('20',16)+int('40',16)+int('80',16)) -> '0xf8'
close

open inverse
//  define(AA1='L1',AA2='L2',AA3='L3',AA4='L4',AA5='L5')
//  define(r='L6',scl='L7')
//  define(S1='L11',S2='L12',S3='L13',S4='L14',S5='L15')
//  define(X='C6',Y='C7',U='C3',V='C4',W='C5')

  //if(D0>0)
  //  send 1"Velocity calculation NOT SUPPORTED\n"

  send 1"inv_inp(%f)  %f %f %f %f %f\n",D0,C6,C7,C3,C4,C5

  L6=2000/500000

  L11=+.5*C6          +.5*C7    +(0)       *C3    -.5*C4          +.5*C5
  L12=-.5*C6          +.5*C7    +(0)       *C3    +.5*C4          +.5*C5
  L13=+.5*C6          +.5*C7    -(.5)      *C3    +.5*C4          -.5*C5
  L14=-.5*C6          +.5*C7    -(.5)      *C3    -.5*C4          -.5*C5
  L15=         .5*1.41421356237*C7     +.5*1.41421356237*C3            -.5*1.41421356237*C5

  L7=1.41421356237/5000
  L1=asin(L11*L7)/1.74532925199e-05
  L2=asin(L12*L7)/1.74532925199e-05
  L3=asin(L13*L7)/1.74532925199e-05
  L4=asin(L14*L7)/1.74532925199e-05
  L5=asin(L15*L7)/1.74532925199e-05

  send 1"inv_res     %f %f %f %f %f\n",L1,L2,L3,L4,L5

close


&1;cpx abs linear;jog1=0;jog2=0;jog3=0;jog4=0;jog5=0
&1;cpx abs linear;jog1=10000;jog2=20000;jog3=30000;jog4=40000;jog5=50000

&1;cpx abs linear;X(1365.89)Y(2879.23)U(-105.071)V(502.495)W(2419.1)

&1;cpx abs linear;X(-10.000000)Y(200.000000)U(3.00000)V(4.00000)W(5.00000)


&1;cpx abs linear;X(0.000000)Y(0.000000)U(0.00000)V(0.00000)W(0.00000)
&1;cpx abs linear;X(-10.000000)Y(200.000000)U(3.00000)V(4.00000)W(5.00000)




#1..5p

&1p
pmatch

fwd_inp(0)  0 0 0 0 0
fwd_inp(0)  0 0 0 0 0
fwd_res     0 0 0 0 0
inv_inp(0)  0 0 0 0 0
inv_res     0 0 0 0 0

fwd_inp(0)  10000 20000 30000 40000 50000
fwd_inp(0)  613.939 1209.22 1767.77 2272.6 2708.38
fwd_res     1365.89 2879.23 -105.071 502.495 2419.1

fwd_res     1365.89 2879.23 -105.071 502.495 2419.1
inv_inp(0)  1365.89 2879.23 -105.071 502.495 2419.1
inv_res     60621.7 38843.4 20130.6 -10620.2 4072.1


Checking Homeoffset init bug

//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
//posSf = userUnits/encoder_steps
//servoSf=motor_u_steps/userUnits

512*200*100/262144


cpx PowerBrick[1].GpioData[0].16.5=$1f;motor[1].idCmd=1000;jog1=-1000;PowerBrick[1].GpioData[0].16.5=$0;motor[1].idCmd=0
!encoder_ssi(enc=1,numBits=18,posSf=5625./4096.)

cpx PowerBrick[1].GpioData[0].16.5=$1f;motor[1].idCmd=1000;jog1=361000;PowerBrick[1].GpioData[0].16.5=$0;motor[1].idCmd=0
!encoder_ssi(enc=1,numBits=18,posSf=5625./4096.)

cpx PowerBrick[1].GpioData[0].16.5=$1f;motor[1].idCmd=1000;jog1=1000;PowerBrick[1].GpioData[0].16.5=$0;motor[1].idCmd=0
!encoder_ssi(enc=1,numBits=18,posSf=5625./4096.)

cpx PowerBrick[1].GpioData[0].16.5=$1f;motor[1].idCmd=1000;jog1=0;PowerBrick[1].GpioData[0].16.5=$0;motor[1].idCmd=0
!encoder_ssi(enc=1,numBits=18,posSf=5625./4096.)



$$$***
!common()
!encoder_ssi(enc=1,numBits=18,posSf=5625./4096.)
!motor(mot=1,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=0.)
#1hmz

$$$***
!common()
!encoder_ssi(enc=1,numBits=18,posSf=1.)
!motor(mot=1,dirCur=1000,JogSpeed=40,servoSf= 39.0625,InPosBand=0,FatalFeLimit=1000,HomeOffset=0.)
#1hmz



cpx PowerBrick[1].GpioData[0].16.5=$1f;jog1=-1000;PowerBrick[1].GpioData[0].16.5=$0
Motor[1].idCmd=0

EncTable[1].PrevEnc
Motor[1].HomeOffset
Motor[1].HomePos
Motor[1].ActPos

EncTable[1].PrevEnc=-2490368


!encoder_ssi(enc=1,numBits=18,posSf=5625./4096.)
!motor(mot=1,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=0.)
#1hmz


!encoder_ssi(enc=1,numBits=18,posSf=5625./4096.)
!motor(mot=1,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=-20907.)
#1hmz



Motor[1].HomeOffset=-20907
Motor[1].HomePos=-1100471.57226169435
Motor[1].ActPos=-1100474.61749599339

!encoder_ssi(enc=1,numBits=18,posSf=5625./4096.) -> reate wrong values



Motor[1].HomeOffset=0
Motor[1].HomePos=-1439342.11669405433
Motor[1].ActPos=-1100474.61749599339

!motor(mot=1,dirCur=1000,JogSpeed=40,servoSf=256./9.,InPosBand=0,FatalFeLimit=1000,HomeOffset=-20907.)




Motor[1].HomeOffset=-20907
Motor[1].HomePos=-372569.750242860231
Motor[1].ActPos=-8.86266251358743773e-17
#1p 372569.7502428602
but should be -8000

#1p=Motor[1].ActPos-Motor[1].HomePos

open plc 0
  if (Motor[1].ActPos-Motor[1].HomePos>180000)
    Motor[1].HomePos=Motor[1].HomePos+360000
  if (Motor[2].ActPos-Motor[2].HomePos>180000)
    Motor[2].HomePos=Motor[2].HomePos+360000
  if (Motor[3].ActPos-Motor[3].HomePos>180000)
    Motor[3].HomePos=Motor[3].HomePos+360000
  if (Motor[4].ActPos-Motor[4].HomePos>180000)
    Motor[4].HomePos=Motor[4].HomePos+360000
  if (Motor[5].ActPos-Motor[5].HomePos>180000)
    Motor[5].HomePos=Motor[5].HomePos+360000
  disable plc 0
close plc 0

enable plc 0

29.5.18 Calibration ID Lab

PPMAC=MOTTEST-CPPM-CRM0515
ssh root@$PPMAC
cd /ioc/SAR-CPPM-EXPMX3
iocsh startup.script
dbl

export EPICS_CA_ADDR_LIST=$PPMAC
caQtDM -macro 'P=SAR-EXPMX' ESB_MX_exp
caQtDM -macro 'P=SAR-EXPMX' ESB_MX_5cam

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-EXPMX3()

caput SAR-EXPMX3:ASYN.AOUT '&1;#1..5j/;cpx call 15'
caput SAR-EXPMX3:ASYN.AOUT '&1;cpx jog1..5=000;call 16'
caput SAR-EXPMX3:ASYN.AOUT '&1;#1..5j/;cpx call 15'
caput SAR-EXPMX3:ASYN.AOUT '&1;cpx jog1..5=10000;call 16'
caput SAR-EXPMX3:ASYN.AOUT cpx call 16
caput SAR-EXPMX3:ASYN.AOUT cpx call 15
caput SAR-EXPMX3:ASYN.debug cpx call 16
caput SAR-EXPMX3:ASYN.debug0 cpx call 16

#1..5p
-204709.6252433953 -242008.2092276345 -269883.2702626893 -124867.8588862641 -189315.0329582951

-19000
Motor[1].pLimits=PowerBrick[0].Chan[0].Status.a
Motor[2].pLimits=PowerBrick[0].Chan[1].Status.a

29.5.18 Commissioning ESC

[saresb-cons-01 ~]$ caqtdm -macro 'P=SAR-EXPMX' ESB_MX_exp


SAR-EXPMX:MOT_CX       ok
SAR-EXPMX:MOT_CZ       ok
SAR-EXPMX:MOT_FX       encoder ok, failed phasing... cabeling issue. old cable ok.
SAR-EXPMX:MOT_FY       encoder ok, failed phasing... cabeling issue. old cable ok.
SAR-EXPMX:MOT_ROT_Y    ok

SAR-EXPMX:MOT_BLGT     hotor ok, homing fails -> check if ho,ing switsch is on correct pins?
SAR-EXPMX:MOT_CRYO     ok
SAR-EXPMX:MOT_WEDGE1   motor ok, encoder cable issue. old incr. cable works
SAR-EXPMX:MOT_WEDGE2   motor ok, encoder cable issue. old incr. cable works
SAR-EXPMX:MOT_WEDGE3   motor ok, encoder cable issue. old incr. cable works
SAR-EXPMX:MOT_WEDGE4   motor ok, encoder cable issue. old incr. cable works

Backlight: check register Gate3[1].Chan[0].Status when pressing home button...

Wedge mover:
#3,4
#3,4j=-17000 up limit
#3,4j=18000  down limit
#3j=350;#4j=-350  left right
#3j=-2900;#4j=2900  left right


#1j=-13000;#2j=0   up limit
#1j=1000;#2j=14000 down limit

#1j=-6000;#2j=7000 start

#1j=-8500;#2j=9500 left right
#1j=-6000;#2j=7000 also limit ?



do this multiple times until motor 2 is far enough
> #1j-;#2j-
> #1j+;#2j-
then home motor 2
#1j-;#2hm

Measured distances schieblehre:
m1:67.85
m2:67:42
m3:66.73
m4:68.97


Alles bündig bei je 67mm

m3 -330
m4 1900

Wedge Mover Limits:
X -2.13 .. 1.5
Y -1.68 .. 2.28

Individual motor limits:
Y-Min (moving until all limits kick in)
#1..4p
19594 16978 22575.5 21962

Y-Max
#1..4p
-23962.5 -23414 -22669 -22413

right:
#1..4p
-2023 2049 -3362 3379

left
#1..4p
3017 -3170 1415.5 -1693


Y: -1.67

Motor 1,2 tuning

Current loop:
rise time: 0.25ms
overshot 2.74%
damping: 0.753
natural frq:1487Hz

=>system 2ter Ordnung

k*1/(1+T1*s+t2*s^2)


EVR

check git modules:
mrfioc2  -> EVR config
PB_BSREAD -> sample how to configure user Flags

Gate3[1].Chan[0].UserFlag -> is set to 0 when event triggered (mapped to output FronUnivOut4 in the EVR)


Testing Helical Coord Trf

B0.3504637004371034 X-13.68414496427224 Y-8.029999999998836 Z-1483.096457761122


&1p  ->this will trigger:forward kinematic
cpx pmatch  ->this will trigger:forward kinematic

cpx ;linear rel; X0Y0Z0B0
cpx ;linear abs; X-13.68 Y-8.03 Z-1483.1 B0.35
  ->this will trigger: inverse

&1;cpx abs linear;jog1=0;jog2=0;jog3=0;jog4=0;jog5=0


-1:fwd_inp(0)  0.45 -1103.7 0.350464 -7.98
-1:fwd_res     -13.5538 -1481 0.350464 -7.98


//motors CX CZ RY FY
//        4  5  3  1


&1;cpx abs linear;jog1=0;jog2=0;jog3=0;jog4=0;jog5=0

  def calcParam(self,x=((.468,-.627,-.523),(.357,-1.349,.351)),
                     y=(.557,-.008),
                     z=((1.73,.93,2.129),(2.13,.03,1.103))):


&1;cpx abs linear;jog1=557;jog3=0;jog4=-468;jog5=-1730

&1;cpx abs linear;jog1=-8;jog3=240000;jog4=-351;jog5=-1103


caQtDM -macro "NAME=ESB-MX-CAM,CAMNAME=ESB-MX-CAM" /sf/controls/config/qt/Camera/CameraMiniView

#1,3,4,5p
point 1 0,120,240 deg
575.5 0      -241.5 -1401.3
575.5 120000   96.7 -1401.7
575.5 240000  -53.8 -1802.4

point 2 0,120,240 deg
175.5 0      -162.3 -1802.5
175.5 120000 -293.2 -1303.7
175.5 240000  246.4 -1402.25


#1j=575.5; #3j=0     ; #4j=-241.5; #5j=-1401.3
#1j=575.5; #3j=120000; #4j=  96.7; #5j=-1401.7
#1j=575.5; #3j=240000; #4j= -53.8; #5j=-1802.4
#1j=175.5; #3j=0     ; #4j=-162.3; #5j=-1802.5
#1j=175.5; #3j=120000; #4j=-293.2; #5j=-1303.7
#1j=175.5; #3j=240000; #4j= 246.4; #5j=-1402.25


pixel center 1110 1090

#1j=575.5; #3j=0     ; #4j=-241.5; #5j=-1401.3
cpx pmatch


-1:fwd_inp(0)  -241.5 -1401.3 0 575.5
-1:fwd_res     -88.9829 308.514 0 575.5


cpx ;linear abs; X0 Z0 Y575 B0
cpx ;linear abs; X0 Z0 Y575 B100000

Matlab models 3.10.2018


Description
No description provided
Readme 10 MiB
Languages
Python 57.2%
C 15.7%
MATLAB 12.5%
TeX 11.3%
Makefile 3.3%