enhance generate.py
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -9,6 +9,7 @@
|
||||
*.original
|
||||
|
||||
.cvsignore
|
||||
gen/
|
||||
.idea/
|
||||
.tmp_versions/
|
||||
gather/
|
||||
@@ -45,4 +46,3 @@ src/usrServo/usrServo.sublime-workspace
|
||||
*Doc/*.blg
|
||||
|
||||
|
||||
|
||||
|
||||
4
Makefile
4
Makefile
@@ -1,8 +1,8 @@
|
||||
include /ioc/tools/driver.makefile
|
||||
MODULE = $(notdir $(shell pwd))
|
||||
BUILDCLASSES = Linux
|
||||
ARCH_FILTER = eldk42%
|
||||
EXCLUDE_VERSIONS = 3.14 7.0.6
|
||||
ARCH_FILTER = ARCH_FILTER = $(EPICS_HOST_ARCH) eldk42%
|
||||
EXCLUDE_VERSIONS = 3.14 # 7.0.6
|
||||
#EPICS_VERSIONS = 7.0.7
|
||||
|
||||
#SCRIPTS+=$(wildcard add_EXPMX*.cmd cfg/*.cfg cfg/*.py cfg/*.pbi python/*.py)
|
||||
|
||||
@@ -2,7 +2,7 @@ record(motor,"$(P):$(M)")
|
||||
{
|
||||
field(DESC,"$(DESC)")
|
||||
field(DTYP,"asynMotor")
|
||||
field(OUT,"@asyn($(PORT),$(ADDR))")
|
||||
field(OUT,"@asyn($(PORT=PPMAC),$(ADDR))")
|
||||
field(DIR,"$(DIR=0)")
|
||||
field(VMAX,"$(VMAX=0)")
|
||||
field(VELO,"$(VELO)")
|
||||
|
||||
@@ -74,3 +74,9 @@ caput SARES30-SMX:ASYN.AOUT :GST0
|
||||
|
||||
|
||||
caget SARES30-SMX:ASYN.TINP
|
||||
|
||||
|
||||
|
||||
/home/zamofing_t/Documents/prj/SwissFEL/driver_modules_epics/motorBase/motorApp/MotorSrc/asynMotorController.h
|
||||
|
||||
if the position can not be reached, the $(S):$(M).MISS is set to 1
|
||||
@@ -1,27 +0,0 @@
|
||||
################################################################################
|
||||
#P - prefix of the PV
|
||||
#PORT - Name of the ppmac controller port created by powerPmacCreateController
|
||||
#ADDR - Axis index - second parameter of powerPmacCreateAxis and powerPmacCreateVirtualAxis
|
||||
################################################################################
|
||||
|
||||
#Position Units are in um
|
||||
|
||||
#ms to achive speed VELO -> same as Motor[1].JogTa (if positive). Motor[1].JogTa will be set to a caculated negative number
|
||||
# JAR = EGU/s^2 -> JAR = VELO/ACCL (Jog acceleration)
|
||||
|
||||
#caput SAROP21-OAPU092:ASYN.AOUT '&1;#1..2p'
|
||||
#caget SAROP21-OAPU092:ASYN.TINP
|
||||
#caput SAROP21-OAPU092:ASYN.AOUT '&1;cpx abs;X(-900)Y(10)A(5200)B(5100)'
|
||||
|
||||
file asyn.template {{P="$(P_M)1", PORT=$(PORT_M)}}
|
||||
|
||||
file PPMACMotor.template {
|
||||
pattern{ DESC , P , M , PORT , ADDR, DIR, VELO, HVEL, ACCL, JAR, MRES , PREC, EGU , DHLM, DLLM}
|
||||
{ "Sample F-Trans Y", "$(P_M)", "MOT_FY" , "$(PORT_M)", 1 , 0 , 16 , 2 , 0.1 , 20 , 0.001, 4 , "mm" , 0 , 0 }
|
||||
{ "Sample F-Trans X", "$(P_M)", "MOT_FX" , "$(PORT_M)", 2 , 1 , 16 , 2 , 0.1 , 20 , 0.001, 4 , "mm" , 0 , 0 }
|
||||
{ "Rotation Y" , "$(P_M)", "MOT_ROT_Y", "$(PORT_M)", 3 , 0 , 50 , 50 , 0.1 , 20 , 0.001, 4 , "deg", 0 , 0 }
|
||||
{ "Sample C-Trans X", "$(P_M)", "MOT_CX" , "$(PORT_M)", 4 , 1 , 2 , 2 , 0.1 , 20 , 0.001, 4 , "mm" , 0 , 0 }
|
||||
{ "Sample C-Trans Z", "$(P_M)", "MOT_CZ" , "$(PORT_M)", 5 , 1 , 2 , 2 , 0.1 , 20 , 0.001, 4 , "mm" , 0 , 0 }
|
||||
{ "Interfero Y" , "$(P_M)", "ENC_FY" , "$(PORT_M)", 6 , 0 , 2 , 2 , 0.1 , 20 , 0.001, 4 , "mm" , 0 , 0 }
|
||||
{ "Interfero X" , "$(P_M)", "ENC_FX" , "$(PORT_M)", 7 , 0 , 2 , 2 , 0.1 , 20 , 0.001, 4 , "mm" , 0 , 0 }
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
################################################################################
|
||||
#P - prefix of the PV
|
||||
#PORT - Name of the ppmac controller port created by powerPmacCreateController
|
||||
#ADDR - Axis index - second parameter of powerPmacCreateAxis and powerPmacCreateVirtualAxis
|
||||
################################################################################
|
||||
|
||||
#Position Units are in um
|
||||
|
||||
#ms to achive speed VELO -> same as Motor[1].JogTa (if positive). Motor[1].JogTa will be set to a caculated negative number
|
||||
# JAR = EGU/s^2 -> JAR = VELO/ACCL (Jog acceleration)
|
||||
|
||||
#caput SAROP21-OAPU092:ASYN.AOUT '&1;#1..2p'
|
||||
#caget SAROP21-OAPU092:ASYN.TINP
|
||||
#caput SAROP21-OAPU092:ASYN.AOUT '&1;cpx abs;X(-900)Y(10)A(5200)B(5100)'
|
||||
|
||||
file asyn.template {{P="$(P_M)2", PORT=$(PORT_M)}}
|
||||
|
||||
file PPMACMotor.template {
|
||||
pattern{ DESC , P , M , PORT , ADDR, DIR, VELO, HVEL, ACCL, JAR, MRES , PREC, EGU , DHLM, DLLM}
|
||||
{ "Wedge 1" , "$(P_M)", "MOT_WEDGE1", "$(PORT_M)", 1 , 0 , 1. , .5 , 0.1 , 20 , 0.001, 3 , "mm" , 0 , 0 }
|
||||
{ "Wedge 2" , "$(P_M)", "MOT_WEDGE2", "$(PORT_M)", 2 , 0 , 1. , .5 , 0.1 , 20 , 0.001, 3 , "mm" , 0 , 0 }
|
||||
{ "Wedge 3" , "$(P_M)", "MOT_WEDGE3", "$(PORT_M)", 3 , 0 , 1. , .5 , 0.1 , 20 , 0.001, 3 , "mm" , 0 , 0 }
|
||||
{ "Wedge 4" , "$(P_M)", "MOT_WEDGE4", "$(PORT_M)", 4 , 0 , 1. , .5 , 0.1 , 20 , 0.001, 3 , "mm" , 0 , 0 }
|
||||
{ "Wedge X" , "$(P_M)", "MOT_WEDGEX", "$(PORT_M)", 9 , 1 , 1. , .5 , 0.1 , 20 , 0.001, 3 , "mm" , 0 , 0 }
|
||||
{ "Wedge Y" , "$(P_M)", "MOT_WEDGEY", "$(PORT_M)", 10 , 0 , 1. , .5 , 0.1 , 20 , 0.001, 3 , "mm" , 0 , 0 }
|
||||
{ "Wedge A" , "$(P_M)", "MOT_WEDGEA", "$(PORT_M)", 11 , 0 , 1. , .5 , 0.1 , 20 , 0.001, 3 , "mm" , 0 , 0 }
|
||||
{ "Wedge B" , "$(P_M)", "MOT_WEDGEB", "$(PORT_M)", 12 , 1 , 1. , .5 , 0.1 , 20 , 0.001, 3 , "mm" , 0 , 0 }
|
||||
{ "Backlight", "$(P_M)", "MOT_BLGT" , "$(PORT_M)", 5 , 1 , 40E3, 20E3, 0.1 , 20 , 1 , 0 , "usr", 0 , 0 }
|
||||
{ "Cryojet" , "$(P_M)", "MOT_CRYO" , "$(PORT_M)", 6 , 1 , 10., 5. , 0.1 , 20 , 0.001, 3 , "mm", 0 , 0 }
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
################################################################################
|
||||
#P - prefix of the PV
|
||||
#PORT - Name of the ppmac controller port created by powerPmacCreateController
|
||||
#ADDR - Axis index - second parameter of powerPmacCreateAxis and powerPmacCreateVirtualAxis
|
||||
################################################################################
|
||||
|
||||
#Position Units are in um
|
||||
|
||||
#ms to achive speed VELO -> same as Motor[1].JogTa (if positive). Motor[1].JogTa will be set to a caculated negative number
|
||||
# JAR = EGU/s^2 -> JAR = VELO/ACCL (Jog acceleration)
|
||||
|
||||
#caput SAROP21-OAPU092:ASYN.AOUT '&1;#1..2p'
|
||||
#caget SAROP21-OAPU092:ASYN.TINP
|
||||
#caput SAROP21-OAPU092:ASYN.AOUT '&1;cpx abs;X(-900)Y(10)A(5200)B(5100)'
|
||||
|
||||
file PPMACMotor.template {
|
||||
pattern
|
||||
{ DESC , P , M , PORT , ADDR, DIR, VELO, MRES , PREC, EGU }
|
||||
{ "Girder 1", "$(P_M)", "MOT_GIR_1", "$(PORT_M)", 1 , 0 , 40 , 0.001, 3 , "deg" }
|
||||
{ "Girder 2", "$(P_M)", "MOT_GIR_2", "$(PORT_M)", 2 , 0 , 40 , 0.001, 3 , "deg" }
|
||||
{ "Girder 3", "$(P_M)", "MOT_GIR_3", "$(PORT_M)", 3 , 0 , 40 , 0.001, 3 , "deg" }
|
||||
{ "Girder 4", "$(P_M)", "MOT_GIR_4", "$(PORT_M)", 4 , 0 , 40 , 0.001, 3 , "deg" }
|
||||
{ "Girder 5", "$(P_M)", "MOT_GIR_5", "$(PORT_M)", 5 , 0 , 40 , 0.001, 3 , "deg" }
|
||||
{ "Girder X", "$(P_M)", "MOT_GIR_X", "$(PORT_M)", 9 , 0 , 40 , 0.001, 3 , "mm" }
|
||||
{ "Girder Y", "$(P_M)", "MOT_GIR_Y", "$(PORT_M)", 10 , 0 , 40 , 0.001, 3 , "mm" }
|
||||
{ "Girder U", "$(P_M)", "MOT_GIR_U", "$(PORT_M)", 11 , 0 , 40 , 0.001, 3 , "mrad"}
|
||||
{ "Girder V", "$(P_M)", "MOT_GIR_V", "$(PORT_M)", 12 , 0 , 40 , 0.001, 3 , "mrad"}
|
||||
{ "Girder W", "$(P_M)", "MOT_GIR_W", "$(PORT_M)", 13 , 0 , 40 , 0.001, 3 , "mrad"}
|
||||
{ "Detector Z", "$(P_M)", "MOT_DET_Z", "$(PORT_M)", 6 , 1 , 4 , 0.001, 3 , "mm" }
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
###########################
|
||||
! $(gpasciiCommander_DIR)/gpasciiCommander --path $(ESB_MX_DIR) $(ESB_MX_DIR)/$(P)1.cfg
|
||||
|
||||
powerPmacCreateAxis($(PORT), 1)
|
||||
powerPmacCreateAxis($(PORT), 2)
|
||||
powerPmacCreateAxis($(PORT), 3)
|
||||
powerPmacCreateAxis($(PORT), 4)
|
||||
powerPmacCreateAxis($(PORT), 5)
|
||||
powerPmacCreateAxis($(PORT), 6)
|
||||
powerPmacCreateAxis($(PORT), 7)
|
||||
#powerPmacCreateAxis($(PORT), 8)
|
||||
|
||||
# Load databse
|
||||
dbLoadTemplate("$(ESB_MX_TEMPLATES)/$(P)1.subs", "PORT_M=$(PORT),P_M=$(P)")
|
||||
@@ -1,21 +0,0 @@
|
||||
###########################
|
||||
! $(gpasciiCommander_DIR)/gpasciiCommander --path $(ESB_MX_DIR) $(ESB_MX_DIR)/$(P)2.cfg
|
||||
|
||||
powerPmacCreateAxis($(PORT), 1)
|
||||
powerPmacCreateAxis($(PORT), 2)
|
||||
powerPmacCreateAxis($(PORT), 3)
|
||||
powerPmacCreateAxis($(PORT), 4)
|
||||
powerPmacCreateAxis($(PORT), 5)
|
||||
powerPmacCreateAxis($(PORT), 6)
|
||||
#powerPmacCreateAxis($(PORT), 7)
|
||||
#powerPmacCreateAxis($(PORT), 8)
|
||||
|
||||
#powerPmacCreateVirtualAxis(<port_name>, <axis_index>, <coord_sys_index>, <axis_name>,<commaSeparatedMotorIndices)
|
||||
# !!! COMMENTS AFTER 'powerPmacCreateVirtualAxis("$(PORT)", 9, 1, "X",1)' IS NOT ALLOWED !!!
|
||||
powerPmacCreateVirtualAxis("$(PORT)", 9 , 1, "X",1,2,3,4)
|
||||
powerPmacCreateVirtualAxis("$(PORT)", 10, 1, "Y",1,2,3,4)
|
||||
powerPmacCreateVirtualAxis("$(PORT)", 11, 1, "A",1,2,3,4)
|
||||
powerPmacCreateVirtualAxis("$(PORT)", 12, 1, "B",1,2,3,4)
|
||||
|
||||
# Load databse
|
||||
dbLoadTemplate("$(ESB_MX_TEMPLATES)/$(P)2.subs", "PORT_M=$(PORT),P_M=$(P)")
|
||||
@@ -1,40 +0,0 @@
|
||||
###########################
|
||||
! $(gpasciiCommander_DIR)/gpasciiCommander --path $(ESB_MX_DIR) $(ESB_MX_DIR)/$(P)3.cfg
|
||||
|
||||
powerPmacCreateAxis($(PORT), 1)
|
||||
powerPmacCreateAxis($(PORT), 2)
|
||||
powerPmacCreateAxis($(PORT), 3)
|
||||
powerPmacCreateAxis($(PORT), 4)
|
||||
powerPmacCreateAxis($(PORT), 5)
|
||||
powerPmacCreateAxis($(PORT), 6)
|
||||
#powerPmacCreateAxis($(PORT), 7)
|
||||
#powerPmacCreateAxis($(PORT), 8)
|
||||
|
||||
#powerPmacCreateVirtualAxis(<port_name>, <axis_index>, <coord_sys_index>, <axis_name>,<commaSeparatedMotorIndices)
|
||||
# !!! COMMENTS AFTER 'powerPmacCreateVirtualAxis("$(PORT)", 9, 1, "X",1)' IS NOT ALLOWED !!!
|
||||
powerPmacCreateVirtualAxis("$(PORT)", 9 , 1, "X",1,2,3,4)
|
||||
powerPmacCreateVirtualAxis("$(PORT)", 10, 1, "Y",1,2,3,4)
|
||||
powerPmacCreateVirtualAxis("$(PORT)", 11, 1, "U",1,2,3,4)
|
||||
powerPmacCreateVirtualAxis("$(PORT)", 12, 1, "V",1,2,3,4)
|
||||
powerPmacCreateVirtualAxis("$(PORT)", 13, 1, "W",1,2,3,4)
|
||||
|
||||
# Load databse
|
||||
dbLoadTemplate("$(ESB_MX_TEMPLATES)/$(P)3.subs", "PORT_M=$(PORT),P_M=$(P)")
|
||||
|
||||
require PB_EXTRA
|
||||
#- Brakes - need to load motor status PVs as well
|
||||
dbLoadRecords("$(PB_EXTRA_TEMPLATES)motorStatus.db" "SYS=${P}, PORT=${PORT}, M=MOT_GIR_1, M_NO=1")
|
||||
dbLoadRecords("$(PB_EXTRA_TEMPLATES)motorStatus.db" "SYS=${P}, PORT=${PORT}, M=MOT_GIR_2, M_NO=2")
|
||||
dbLoadRecords("$(PB_EXTRA_TEMPLATES)motorStatus.db" "SYS=${P}, PORT=${PORT}, M=MOT_GIR_3, M_NO=3")
|
||||
dbLoadRecords("$(PB_EXTRA_TEMPLATES)motorStatus.db" "SYS=${P}, PORT=${PORT}, M=MOT_GIR_4, M_NO=4")
|
||||
dbLoadRecords("$(PB_EXTRA_TEMPLATES)motorStatus.db" "SYS=${P}, PORT=${PORT}, M=MOT_GIR_5, M_NO=5")
|
||||
dbLoadRecords("${PB_EXTRA_TEMPLATES}motorBrake.db", "SYS=${P}, PORT=${PORT}, M=MOT_GIR_1, M_NO=1")
|
||||
dbLoadRecords("${PB_EXTRA_TEMPLATES}motorBrake.db", "SYS=${P}, PORT=${PORT}, M=MOT_GIR_2, M_NO=2")
|
||||
dbLoadRecords("${PB_EXTRA_TEMPLATES}motorBrake.db", "SYS=${P}, PORT=${PORT}, M=MOT_GIR_3, M_NO=3")
|
||||
dbLoadRecords("${PB_EXTRA_TEMPLATES}motorBrake.db", "SYS=${P}, PORT=${PORT}, M=MOT_GIR_4, M_NO=4")
|
||||
dbLoadRecords("${PB_EXTRA_TEMPLATES}motorBrake.db", "SYS=${P}, PORT=${PORT}, M=MOT_GIR_5, M_NO=5")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
#Powerbrick for new commissioning of fast scanning stage
|
||||
#FOR NOW IT IS AN EMPTY CPNFIG !
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
record(asyn,"$(P):ASYN")
|
||||
record(asyn,"$(P):$(R=asyn)")
|
||||
{
|
||||
field(DTYP,"asynRecordDevice")
|
||||
field(PORT,"$(PORT)")
|
||||
|
||||
354
generate.py
354
generate.py
@@ -8,8 +8,9 @@
|
||||
'''
|
||||
generate .subs and _startup.script files
|
||||
mode bits:
|
||||
0x001: genIOC()
|
||||
0x008: genLauncher()
|
||||
0x001: genYAML()
|
||||
0x002: genIOC()
|
||||
0x004: genLauncher()
|
||||
|
||||
Long Doc'''
|
||||
from __future__ import print_function
|
||||
@@ -28,36 +29,107 @@ class Generate:
|
||||
'SARES30-CPCL-MCSSMX' : ('saresc-softioc-11' , 50001 , '7.0.6' , 'x86_64' , 'RHEL7' , 'rhel' , ) ,
|
||||
}
|
||||
|
||||
mxSmarAct={
|
||||
'port':'MCS',
|
||||
'host':'129.129.244.32',
|
||||
'prefix':'SARES30-SMX',
|
||||
'motLst':(
|
||||
# description , PV name , axis , hlm , llm , dir , sens ,
|
||||
('COLLI:TX' , 'MCS1' , 0 , 12 , -10 , 1 , 'S' ) ,
|
||||
('COLLI:TY' , 'MCS2' , 1 , 12 , -10 , 1 , 'S' ) ,
|
||||
('Motor3' , 'MCS3' , 2 , 10 , -10 , 0 , 'S' ) ,
|
||||
('POSTTUBE:TX1' , 'MCS4' , 3 , 10 , -10 , 0 , 'S' ) ,
|
||||
('POSTTUBE:TX2' , 'MCS5' , 4 , 10 , -10 , 0 , 'S' ) ,
|
||||
('POSTTUBE:TY1' , 'MCS6' , 5 , 15 , -20 , 0 , 'S' ) ,
|
||||
('POSTTUBE:TY2' , 'MCS7' , 6 , 15 , -20 , 0 , 'S' ) ,
|
||||
('POSTTUBE:TZ' , 'MCS8' , 7 , 10 , -10 , 1 , 'S' ) ,
|
||||
('Motor9' , 'MCS9' , 8 , 10 , -10 , 0 , 'S' ) ,
|
||||
('SLITS:X1' , 'MCS10' , 9 , 10 , -10 , 1 , 'S' ) ,
|
||||
('SLITS:X2' , 'MCS11' , 10 , 10 , -10 , 1 , 'S' ) ,
|
||||
('SLITS:Y1' , 'MCS12' , 11 , 10 , -10 , 1 , 'S' ) ,
|
||||
('SLITS:Y2' , 'MCS13' , 12 , 10 , -10 , 1 , 'S' ) ,
|
||||
('XEYE:TX' , 'MCS14' , 13 , 10 , -10 , 0 , 'S' ) ,
|
||||
('XEYE:TY' , 'MCS15' , 14 , 10 , -10 , 0 , 'S' ) ,
|
||||
),
|
||||
iocSmarAct={
|
||||
'SARES30-CPCL-MCSSMX':
|
||||
{
|
||||
'port':'MCS',
|
||||
'host':'129.129.244.32', # 00:04:a3:a2:71:35, MCS0060 Serial: 3762
|
||||
'prefix':'SARES30-SMX',
|
||||
'loc':'EH.057 MobRack',
|
||||
|
||||
'motLst':(
|
||||
# description , PV name , axis , hlm , llm , dir , egu , sens ,
|
||||
('COLLI:TX' , 'MCS1' , 0 , 12 , -10 , 1 , 'mm' , 'S' ) ,
|
||||
('COLLI:TY' , 'MCS2' , 1 , 12 , -10 , 1 , 'mm' , 'S' ) ,
|
||||
('Motor3' , 'MCS3' , 2 , 10 , -10 , 0 , 'mm' , 'S' ) ,
|
||||
('POSTTUBE:TX1' , 'MCS4' , 3 , 10 , -10 , 0 , 'mm' , 'S' ) ,
|
||||
('POSTTUBE:TX2' , 'MCS5' , 4 , 10 , -10 , 0 , 'mm' , 'S' ) ,
|
||||
('POSTTUBE:TY1' , 'MCS6' , 5 , 15 , -20 , 0 , 'mm' , 'S' ) ,
|
||||
('POSTTUBE:TY2' , 'MCS7' , 6 , 15 , -20 , 0 , 'mm' , 'S' ) ,
|
||||
('POSTTUBE:TZ' , 'MCS8' , 7 , 10 , -10 , 1 , 'mm' , 'S' ) ,
|
||||
('Motor9' , 'MCS9' , 8 , 10 , -10 , 0 , 'mm' , 'S' ) ,
|
||||
('SLITS:X1' , 'MCS10' , 9 , 10 , -10 , 1 , 'mm' , 'S' ) ,
|
||||
('SLITS:X2' , 'MCS11' , 10 , 10 , -10 , 1 , 'mm' , 'S' ) ,
|
||||
('SLITS:Y1' , 'MCS12' , 11 , 10 , -10 , 1 , 'mm' , 'S' ) ,
|
||||
('SLITS:Y2' , 'MCS13' , 12 , 10 , -10 , 1 , 'mm' , 'S' ) ,
|
||||
('XEYE:TX' , 'MCS14' , 13 , 10 , -10 , 0 , 'mm' , 'S' ) ,
|
||||
('XEYE:TY' , 'MCS15' , 14 , 10 , -10 , 0 , 'mm' , 'S' ) ,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
pb_host2param={
|
||||
iocPowerBrick={
|
||||
# HOST runScript
|
||||
'SAR-CPPM-EXPMX1':('','require ESB_MX\nrunScript $(ESB_MX_DIR)/add_EXPMX1.cmd "P=SAR-EXPMX,PORT=PPMAC1"',),
|
||||
'SAR-CPPM-EXPMX2':('','require ESB_MX\nrunScript $(ESB_MX_DIR)/add_EXPMX2.cmd "P=SAR-EXPMX,PORT=PPMAC1"',),
|
||||
'SAR-CPPM-EXPMX3':('','require ESB_MX\nrunScript $(ESB_MX_DIR)/add_EXPMX3.cmd "P=SAR-EXPMX,PORT=PPMAC1"',),
|
||||
'SAR-CPPM-EXPMX4':('','require ESB_MX\nrunScript $(ESB_MX_DIR)/add_EXPMX4.cmd "P=SAR-EXPMX,PORT=PPMAC1"',),
|
||||
'SAR-CPPM-EXPMX1':{
|
||||
'port':'PPMAC',
|
||||
'prefix':'SAR-EXPMX',
|
||||
'loc':'EH.057 MobRack',
|
||||
'fmt':
|
||||
'{{{P:10},{M:10},{ADDR:4},{DESC:19},{DIR:3},{VELO:4},{HVEL:4},{MRES:5},{PREC:4},{EGU:4}}}\n',
|
||||
'motLst':(
|
||||
( 'DESC' , 'M' , 'ADDR' , 'DIR' , 'VELO' , 'HVEL' , 'MRES' , 'PREC' , 'EGU' ) ,
|
||||
( '"Sample F-Trans Y"' , 'MOT_FY' , 1 , 0 , 16 , 2 , 0.001 , 4 , 'mm' ) ,
|
||||
( '"Sample F-Trans X"' , 'MOT_FX' , 2 , 1 , 16 , 2 , 0.001 , 4 , 'mm' ) ,
|
||||
( '"Rotation Y"' , 'MOT_ROT_Y' , 3 , 0 , 50 , 50 , 0.001 , 4 , 'deg' ) ,
|
||||
( '"Sample C-Trans X"' , 'MOT_CX' , 4 , 1 , 2 , 2 , 0.001 , 4 , 'mm' ) ,
|
||||
( '"Sample C-Trans Z"' , 'MOT_CZ' , 5 , 1 , 2 , 2 , 0.001 , 4 , 'mm' ) ,
|
||||
( '"Interfero Y"' , 'ENC_FY' , 6 , 0 , 2 , 2 , 0.001 , 4 , 'mm' ) ,
|
||||
( '"Interfero X"' , 'ENC_FX' , 7 , 0 , 2 , 2 , 0.001 , 4 , 'mm' ) ,
|
||||
),
|
||||
},
|
||||
'SAR-CPPM-EXPMX2':{
|
||||
'port':'PPMAC',
|
||||
'prefix':'SAR-EXPMX',
|
||||
'loc':'EH.057 MobRack',
|
||||
'fmt':
|
||||
'{{{P:10},{M:10},{ADDR:4},{DESC:12},{DIR:3},{VELO:4},{HVEL:4},{MRES:5},{PREC:4},{EGU:4}}}\n',
|
||||
'motLst':(
|
||||
( 'DESC' , 'M' , 'ADDR' , 'DIR' , 'VELO' , 'HVEL' , 'MRES' , 'PREC' , 'EGU' ) ,
|
||||
( '"Wedge 1"' , 'MOT_WEDGE1' , 1 , 0 , 1. , .5 , 0.001 , 3 , 'mm' ) ,
|
||||
( '"Wedge 2"' , 'MOT_WEDGE2' , 2 , 0 , 1. , .5 , 0.001 , 3 , 'mm' ) ,
|
||||
( '"Wedge 3"' , 'MOT_WEDGE3' , 3 , 0 , 1. , .5 , 0.001 , 3 , 'mm' ) ,
|
||||
( '"Wedge 4"' , 'MOT_WEDGE4' , 4 , 0 , 1. , .5 , 0.001 , 3 , 'mm' ) ,
|
||||
( '"Wedge X"' , 'MOT_WEDGEX' , 9 , 1 , 1. , .5 , 0.001 , 3 , 'mm' ) ,
|
||||
( '"Wedge Y"' , 'MOT_WEDGEY' , 10 , 0 , 1. , .5 , 0.001 , 3 , 'mm' ) ,
|
||||
( '"Wedge A"' , 'MOT_WEDGEA' , 11 , 0 , 1. , .5 , 0.001 , 3 , 'mm' ) ,
|
||||
( '"Wedge B"' , 'MOT_WEDGEB' , 12 , 1 , 1. , .5 , 0.001 , 3 , 'mm' ) ,
|
||||
( '"Backlight"' , 'MOT_BLGT' , 5 , 1 , 40E3 , 20E3 , 1 , 0 , 'usr' ) ,
|
||||
( '"Cryojet"' , 'MOT_CRYO' , 6 , 1 , 10. , 5. , 0.001 , 3 , 'mm' ) ,
|
||||
),
|
||||
},
|
||||
'SAR-CPPM-EXPMX3':{
|
||||
'port':'PPMAC',
|
||||
'prefix':'SAR-EXPMX',
|
||||
'loc':'EH.057 MobRack',
|
||||
'fmt':
|
||||
'{{{P:10},{M:10},{ADDR:4},{DESC:13},{DIR:3},{VELO:4},{MRES:5},{PREC:4},{EGU:4}}}\n',
|
||||
'motLst':(
|
||||
( 'DESC' , 'M' , 'ADDR' , 'DIR' , 'VELO' , 'MRES' , 'PREC' , 'EGU' ) ,
|
||||
( '"Girder 1"' , 'MOT_GIR_1' , 1 , 0 , 40 , 0.001 , 3 , 'deg' ) ,
|
||||
( '"Girder 2"' , 'MOT_GIR_2' , 2 , 0 , 40 , 0.001 , 3 , 'deg' ) ,
|
||||
( '"Girder 3"' , 'MOT_GIR_3' , 3 , 0 , 40 , 0.001 , 3 , 'deg' ) ,
|
||||
( '"Girder 4"' , 'MOT_GIR_4' , 4 , 0 , 40 , 0.001 , 3 , 'deg' ) ,
|
||||
( '"Girder 5"' , 'MOT_GIR_5' , 5 , 0 , 40 , 0.001 , 3 , 'deg' ) ,
|
||||
( '"Girder X"' , 'MOT_GIR_X' , 9 , 0 , 40 , 0.001 , 3 , 'mm' ) ,
|
||||
( '"Girder Y"' , 'MOT_GIR_Y' , 10 , 0 , 40 , 0.001 , 3 , 'mm' ) ,
|
||||
( '"Girder U"' , 'MOT_GIR_U' , 11 , 0 , 40 , 0.001 , 3 , 'mrad' ) ,
|
||||
( '"Girder V"' , 'MOT_GIR_V' , 12 , 0 , 40 , 0.001 , 3 , 'mrad' ) ,
|
||||
( '"Girder W"' , 'MOT_GIR_W' , 13 , 0 , 40 , 0.001 , 3 , 'mrad' ) ,
|
||||
( '"Detector Z"' , 'MOT_DET_Z' , 6 , 1 , 4 , 0.001 , 3 , 'mm' ) ,
|
||||
),
|
||||
},
|
||||
'SAR-CPPM-EXPMX4':{
|
||||
'port':'PPMAC',
|
||||
'prefix':'SAR-EXPMX',
|
||||
'loc':'EH.057 MobRack',
|
||||
'fmt':
|
||||
'{{{P:10},{M:10},{ADDR:4},{DESC:27},{DIR:3},{VELO:4},{MRES:5},{PREC:4},{EGU:4}}}\n',
|
||||
'motLst':(
|
||||
('DESC', 'M', 'ADDR', 'DIR', 'VELO', 'MRES', 'PREC', 'EGU'),
|
||||
# desc , m , addr , dir , velo , hvel , accl , jar , mres , prec , egu , dhlm , dllm ,
|
||||
# NOT YET ANY MOTOR
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
tplYaml='''\
|
||||
@@ -73,26 +145,34 @@ os_id: {osys_id}
|
||||
'None':11, 'LC':12, 'L':13}
|
||||
|
||||
tplMcsCtrl='''\
|
||||
epicsEnvSet("ENGINEER", "T. Zamofing (zamofing_t)")
|
||||
epicsEnvSet("LOCATION", "0.Z553.58")
|
||||
###################################################################
|
||||
# DO NOT EDIT: Generated with epics_ioc_modules/ESB_MX/generate.py
|
||||
# This is the IOC {ioc} on {ioc_host}:{ioc_port}
|
||||
##################################################################
|
||||
|
||||
#load module
|
||||
epicsEnvSet("ENGINEER", "T. Zamofing (zamofing_t)")
|
||||
epicsEnvSet("LOCATION", "{loc}")
|
||||
|
||||
###### require modules ############
|
||||
# motorSmarAct community driver
|
||||
# smarActMot PSI templates and other files
|
||||
require motorSmarAct zamofing_t
|
||||
#require motorSmarAct
|
||||
require motorSmarAct
|
||||
require smarActMot
|
||||
# -------------
|
||||
require ESB_MX
|
||||
|
||||
###### initialize device ############
|
||||
drvAsynIPPortConfigure("asyn{port}", "{host}:5000", 0, 0, 0)
|
||||
# PORT, MCS_PORT, number of axes, active poll period (sec), idle poll period (sec)
|
||||
smarActMCSCreateController("{port}", "asyn{port}", {num_ax}, 0.1, 1.0)
|
||||
|
||||
###### initialize axes ############
|
||||
'''
|
||||
|
||||
tplMcsAxis='''\
|
||||
smarActMCSCreateAxis({port}, {axis}, {chan})
|
||||
'''
|
||||
|
||||
mcs_subs_hdr='''\
|
||||
mcsSubsHdr='''\
|
||||
file asyn.template {{{{P={prefix}, PORT=asyn{port}}}}}
|
||||
|
||||
##### MCS
|
||||
@@ -102,43 +182,49 @@ file $(smarActMot_DIR)/db/MCS_axis.template
|
||||
{{PORT ,S ,M ,ADDR,DESC ,DIR,VBAS,VMAX,DHLM,DLLM,EGU,SENSOR ,UDSENS,RTRY}}
|
||||
'''
|
||||
|
||||
tplScriptPowerBrickIOC='''\
|
||||
tplPwrBrkCtrl='''\
|
||||
##########################################
|
||||
# DO NOT EDIT: Generated with generate.py
|
||||
# This is the IOC on host {host}
|
||||
# This is the IOC on host {ioc}
|
||||
##########################################
|
||||
# PPMAC responsible: Thierry Zamofing
|
||||
##########################################
|
||||
|
||||
###### initialize device ############
|
||||
require PB_COMMON
|
||||
{req}
|
||||
|
||||
############################################
|
||||
#------! Common PPMAC configuration !------#
|
||||
############################################
|
||||
# Load common configuration
|
||||
require PB_COMMON
|
||||
|
||||
# Define controller
|
||||
#powerPmacCreateController(<port_name>, <moving_poll_pseriod [ms]>, <idle_poll_period [ms]>)
|
||||
powerPmacCreateController("PPMAC1", 200, 1000)
|
||||
powerPmacCreateController("{port}", 200, 1000)
|
||||
|
||||
############################################
|
||||
#--------! Devices configuration ---------!#
|
||||
############################################
|
||||
{devConf}
|
||||
###### initialize axes ############
|
||||
'''
|
||||
|
||||
tplEVR='''\
|
||||
####### initialise EVR ##############################
|
||||
tplPwrBrkAxis='''\
|
||||
powerPmacCreateAxis({PORT}, {ADDR})
|
||||
'''
|
||||
|
||||
tplEVR='''
|
||||
###### initialize EVR ############
|
||||
# https://git.psi.ch/epics_driver_modules/mrfioc2
|
||||
require mrfioc2
|
||||
runScript $(mrfioc2_DIR)/mrfioc2_evr-PCIe.cmd, "DEVICE=EVR0,EVR_SUBS=$(ESB_MX_DIR)/db/evr_PCIe-300DC.subs,EVR_DOMAIN=0x2,EVR_BUS=0x21,SYS=SAR-EXPMX"
|
||||
|
||||
####### initialise EVR data buffer ##################
|
||||
###### initialize EVR data buffer ############
|
||||
# https://git.psi.ch/epics_driver_modules/mrfioc2_regDev
|
||||
require mrfioc2_regDev
|
||||
runScript $(mrfioc2_regDev_DIR)/mrfioc2_regDev_pulseID_RX.cmd, "DEVICE=EVR0,SYS=SAR-EXPMX"
|
||||
'''
|
||||
|
||||
pwrBrkSubsHdr='''\
|
||||
file asyn.template {{{{P={prefix}, PORT={port},R=asyn{idx}}}}}
|
||||
|
||||
file PPMACMotor.template
|
||||
{{
|
||||
pattern
|
||||
'''
|
||||
|
||||
|
||||
def __init__(self):
|
||||
os.makedirs('gen/ioc/',exist_ok=True)
|
||||
#os.makedirs('gen/db/',exist_ok=True)
|
||||
@@ -156,26 +242,14 @@ runScript $(mrfioc2_regDev_DIR)/mrfioc2_regDev_pulseID_RX.cmd, "DEVICE=EVR0,SYS=
|
||||
|
||||
def genIOC(self):
|
||||
print('### genIOC ###')
|
||||
tplIOC=Generate.tplScriptPowerBrickIOC
|
||||
yamlParam=Generate.yamlParam
|
||||
pb_h2p=Generate.pb_host2param
|
||||
tplEVR=Generate.tplEVR
|
||||
fh=open('gen/ioc/Makefile','w')
|
||||
fh.write('include /ioc/tools/ioc.makefile\n')
|
||||
fh.close()
|
||||
for host in yamlParam.keys():
|
||||
if not host in pb_h2p:
|
||||
assert(host=='SARES30-CPCL-MCSSMX')
|
||||
self.genSmarActIOC(host)
|
||||
continue
|
||||
req,devConf=pb_h2p[host]
|
||||
fn='gen/ioc/{host}_startup.script'.format(host=host)
|
||||
print('generate '+fn+' ...')
|
||||
fh=open(fn,'w')
|
||||
fh.write(tplIOC.format(host=host,req=req,devConf=devConf))
|
||||
if host=='SAR-CPPM-EXPMX1':
|
||||
fh.write(tplEVR)
|
||||
fh.close()
|
||||
fn='gen/ioc/Makefile'
|
||||
print('generate '+fn+' ...')
|
||||
with open(fn,'w') as fh:
|
||||
fh.write('include /ioc/tools/ioc.makefile\n')
|
||||
self.genPowerBrickIOC()
|
||||
self.genSmarActIOC()
|
||||
|
||||
|
||||
print('done.')
|
||||
|
||||
def genLauncher(self):
|
||||
@@ -191,35 +265,125 @@ runScript $(mrfioc2_regDev_DIR)/mrfioc2_regDev_pulseID_RX.cmd, "DEVICE=EVR0,SYS=
|
||||
#'''.format(dev=dev))
|
||||
# fh.close()
|
||||
|
||||
def genSmarActIOC(self,ioc):
|
||||
def genPowerBrickIOC(self):
|
||||
yamlParam=Generate.yamlParam
|
||||
tplEVR=Generate.tplEVR
|
||||
tplCtrl=Generate.tplPwrBrkCtrl
|
||||
tplAxis=Generate.tplPwrBrkAxis
|
||||
#tplAxSR=Generate.tplMcsAxisSaveRestore
|
||||
subsHdr=Generate.pwrBrkSubsHdr
|
||||
|
||||
for ioc,v in Generate.iocPowerBrick.items():
|
||||
# fh_ss startup script
|
||||
# fh_sb substitution
|
||||
# fh_sr save restore
|
||||
|
||||
fmt=' '+v['fmt']
|
||||
hdr=v['motLst'][0]
|
||||
if len(v['motLst'])>1:
|
||||
motLst=v['motLst'][1:]
|
||||
else:
|
||||
motLst=tuple()
|
||||
param= {k: v[k] for k in {'port','prefix','loc'}}
|
||||
param['ioc']=ioc
|
||||
param['idx']=ioc[-1]
|
||||
param['num_ax']=len(motLst)
|
||||
param['req']='require ESB_MX\n\n! $(gpasciiCommander_DIR)/gpasciiCommander --path $(ESB_MX_DIR) $(ESB_MX_DIR)/{prefix}{idx}.cfg'.format(**param)
|
||||
#print(param)
|
||||
|
||||
fn=f'gen/ioc/{ioc}_startup.script'
|
||||
print('generate '+fn+' ...')
|
||||
fh_ss=open(fn,'w')
|
||||
|
||||
fn=f'gen/ioc/{ioc}_gen.subs' # with a name _* the .subs file is recognize by the 'ioc install' tool
|
||||
print('generate '+fn+' ...')
|
||||
fh_sb=open(fn,'w')
|
||||
|
||||
#fn=f'gen/ioc/cfg/{ioc}_sr.req'
|
||||
#print('generate '+fn+' ...')
|
||||
#fh_sr=open(fn,'w')
|
||||
|
||||
fh_ss.write(tplCtrl.format(**param))
|
||||
|
||||
fh_sb.write(subsHdr.format(**param))
|
||||
port=param['port']
|
||||
prefix=param['prefix']
|
||||
motPar=dict(zip(hdr, hdr))
|
||||
motPar['PORT']='PORT'
|
||||
motPar['P']='P'
|
||||
fh_sb.write(fmt.format(**motPar))
|
||||
for motPar in motLst:
|
||||
motPar=dict(zip(hdr, motPar))
|
||||
motPar['PORT']=v['port']
|
||||
motPar['P']=v['prefix']
|
||||
fh_sb.write(fmt.format(**motPar))
|
||||
fh_ss.write(tplAxis.format(**motPar))
|
||||
#fh_sr.write(tplAxSR.format(prefix=prefix,m=m))
|
||||
fh_sb.write('}\n\n')
|
||||
|
||||
if ioc=='SAR-CPPM-EXPMX1':
|
||||
fh_ss.write(tplEVR)
|
||||
fh_ss.close()
|
||||
fh_sb.close()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def genSmarActIOC(self):
|
||||
tplCtrl=Generate.tplMcsCtrl
|
||||
tplAxis=Generate.tplMcsAxis
|
||||
motLst=Generate.mxSmarAct['motLst']
|
||||
subs=Generate.mcs_subs_hdr
|
||||
host=Generate.mxSmarAct['host']
|
||||
prefix=Generate.mxSmarAct['prefix']
|
||||
port=Generate.mxSmarAct['port']
|
||||
#tplAxSR=Generate.tplMcsAxisSaveRestore
|
||||
subsHdr=Generate.mcsSubsHdr
|
||||
lutSens=Generate.lutSensMcs
|
||||
num_ax=len(motLst)
|
||||
fn=f'gen/ioc/{ioc}_startup.script'
|
||||
print('generate '+fn+' ...')
|
||||
with open(fn,'w') as fh_ss:
|
||||
fh_ss.write(tplCtrl.format(host=host,port=port,num_ax=num_ax))
|
||||
os.makedirs('gen/ioc/cfg/',exist_ok=True)
|
||||
for ioc,v in Generate.iocSmarAct.items():
|
||||
# fh_ss startup script
|
||||
# fh_sb substitution
|
||||
# fh_sr save restore
|
||||
|
||||
fn_subs=f'gen/ioc/{ioc}_gen.subs' # with a name _* the .subs file is recognize by the 'ioc install' tool
|
||||
print('generate '+fn_subs+'...')
|
||||
with open(fn_subs,'w') as fh:
|
||||
fh.write(subs.format(port=port,prefix=prefix))
|
||||
for d, m, a, hlm, llm, dir,sens in motLst:
|
||||
sens=lutSens[sens]
|
||||
param={'PORT':port,'S':prefix,'M':m,'ADDR':a,'DESC':'"'+d+'"',
|
||||
'DIR':dir,'VBAS':0,'VMAX':2,'DHLM':hlm,'DLLM':llm,'EGU':'mm','SENSOR':sens,'UDSENS':0,'RTRY':1}
|
||||
fh.write(' {{{PORT:10},{S:16},{M:10},{ADDR:4},{DESC:27},{DIR:3},{VBAS:4},{VMAX:4},{DHLM:4},{DLLM:4},{EGU:3},{SENSOR:7},{UDSENS:5}{RTRY:5}}}\n'.format(**param))
|
||||
fh_ss.write(tplAxis.format(port=port,axis=a,chan=a))
|
||||
fh.write('}\n\n')
|
||||
motLst=v['motLst']
|
||||
param= {k: v[k] for k in {'port','host','prefix','loc'}}
|
||||
ioc_host,ioc_port=Generate.yamlParam[ioc][:2]
|
||||
param['ioc']=ioc
|
||||
param['ioc_host']=ioc_host
|
||||
param['ioc_port']=ioc_port
|
||||
param['num_ax']=len(motLst)
|
||||
#print(param)
|
||||
|
||||
fn=f'gen/ioc/{ioc}_startup.script'
|
||||
print('generate '+fn+' ...')
|
||||
fh_ss=open(fn,'w')
|
||||
|
||||
fn=f'gen/ioc/{ioc}_gen.subs' # with a name _* the .subs file is recognize by the 'ioc install' tool
|
||||
print('generate '+fn+' ...')
|
||||
fh_sb=open(fn,'w')
|
||||
|
||||
#fn=f'gen/ioc/cfg/{ioc}_sr.req'
|
||||
#print('generate '+fn+' ...')
|
||||
#fh_sr=open(fn,'w')
|
||||
|
||||
fh_ss.write(tplCtrl.format(**param))
|
||||
|
||||
fh_sb.write(subsHdr.format(**param))
|
||||
port=param['port']
|
||||
prefix=param['prefix']
|
||||
for d, m, a, hlm, llm, dir,egu,sens in motLst:
|
||||
sens=lutSens[sens]
|
||||
param={'PORT':port,'S':prefix,'M':m,'ADDR':a,'DESC':'"'+d+'"',
|
||||
'DIR':dir,'VBAS':0,'VMAX':2,'DHLM':hlm,'DLLM':llm,'EGU':egu,'SENSOR':sens,'UDSENS':0,'RTRY':1}
|
||||
fh_sb.write(' {{{PORT:10},{S:16},{M:10},{ADDR:4},{DESC:27},{DIR:3},{VBAS:4},{VMAX:4},{DHLM:4},{DLLM:4},{EGU:3},{SENSOR:7},{UDSENS:5}{RTRY:5}}}\n'.format(**param))
|
||||
fh_ss.write(tplAxis.format(port=port,axis=a,chan=a))
|
||||
#fh_sr.write(tplAxSR.format(prefix=prefix,m=m))
|
||||
fh_sb.write('}\n\n')
|
||||
fh_ss.close()
|
||||
fh_sb.close()
|
||||
#fh_sr.close()
|
||||
|
||||
#fn='gen/ioc/asyn.template'
|
||||
#print('generate '+fn+' ...')
|
||||
#with open(fn,'w') as fh:
|
||||
# fh.write(Generate.tpl_asyn)
|
||||
|
||||
if __name__=='__main__':
|
||||
def parse_args():
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>797</width>
|
||||
<height>673</height>
|
||||
<width>645</width>
|
||||
<height>680</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -60,7 +60,7 @@
|
||||
<rect>
|
||||
<x>5</x>
|
||||
<y>53</y>
|
||||
<width>784</width>
|
||||
<width>626</width>
|
||||
<height>612</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -83,7 +83,7 @@
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>640</x>
|
||||
<x>470</x>
|
||||
<y>30</y>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
@@ -96,7 +96,7 @@
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>satus bits</string>
|
||||
<string>Relative</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_6">
|
||||
|
||||
Reference in New Issue
Block a user