SFELPHOTON-1527: rework ARESvix IOC simulation

This commit is contained in:
2025-06-04 14:47:29 +02:00
parent b9e56ec958
commit a81d19ec2a
8 changed files with 411 additions and 7 deletions

View File

@@ -0,0 +1,16 @@
record(ai, IOCXX:AI) {
field(DESC, "IOCXX:AI desc")
field(PREC, 3)
field(HIHI, 1000) field(HHSV,MAJOR)
field(HIGH, 100) field(HSV, MINOR)
field(LOW, -100) field(LSV, MINOR)
field(LOLO,-1000) field(LLSV,MAJOR)
}
record(mbbi, IOCXX:MBBI) {
field(DESC, "IOCXX:MBBI desc")
field(ZRST,'Off') field(ZRVL,0) field(ZRSV, MAJOR )
field(ONST,'On' ) field(ONVL,1) field(ONSV, NO_ALARM )
}

View File

@@ -0,0 +1,89 @@
file motor.template { pattern
{ P M ID VEL MRES TWV PREC EGU}
{ SATES30-RIXS MOT_RY 0 1E+2 1E-3 5 4 'deg'}
{ SATES30-ARES MOT_2TRY 1 1E+2 1E-3 5 4 'deg'}
{ SATES30-ARES MOT_JFRY 2 1E+2 1E-3 5 4 'deg'}
{ SATES30-ARES MOT_DRY 3 1E+2 1E-3 5 4 'deg'}
{ SATES30-ARES MOT_STX 4 1E+2 1E-3 5 4 'mm'}
{ SATES30-ARES MOT_STZ 5 1E+2 1E-3 5 4 'mm'}
{ SATES30-ARES MOT_SRY 6 1E+2 1E-3 5 4 'deg'}
{ SATES30-MCS001 MOT_6 7 1E+2 1E-3 10 4 'mm' }
{ SATES30-ACSFM MOT_TZ 8 1E+2 1E-3 10 4 'mm' }
{ SATOP11-OSGM087 MOT_GR 9 1E+2 1E-3 0.1 4 ''}
{ SATOP11-OSGM087 MOT_GT 10 1E+2 1E-3 0.1 4 ''}
{ SATOP11-OSGM087 MOT_MR 11 1E+2 1E-3 0.1 4 ''}
}

View File

@@ -0,0 +1,134 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>720</width>
<height>370</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="caInclude" name="ODCM">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>700</width>
<height>214</height>
</rect>
</property>
<property name="macro">
<string>P=SATES30-RIXS,M=MOT_RY;P=SATES30-ARES,M=MOT_JFRY;P=SATES30-ARES,M=MOT_2TRY;P=SATES30-ARES,M=MOT_DRY;P=SATES30-ARES,M=MOT_STX;P=SATES30-ARES,M=MOT_STZ;P=SATES30-ARES,M=MOT_SRY;P=SATES30-MCS001,M=MOT_6;P=SATES30-ACSFM,M=MOT_TZ</string>
</property>
<property name="filename" stdset="0">
<string notr="true">/sf/controls/config/qt/motor_1m.ui</string>
</property>
<property name="numberOfItems" stdset="0">
<number>9</number>
</property>
<property name="verticalSpacing" stdset="0">
<number>2</number>
</property>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>10</x>
<y>240</y>
<width>361</width>
<height>121</height>
</rect>
</property>
<property name="title">
<string>various</string>
</property>
<widget class="caTextEntry" name="catextentry">
<property name="geometry">
<rect>
<x>150</x>
<y>70</y>
<width>191</width>
<height>30</height>
</rect>
</property>
<property name="channel" stdset="0">
<string notr="true">IOCXX:AI</string>
</property>
</widget>
<widget class="caMenu" name="camenu_2">
<property name="geometry">
<rect>
<x>150</x>
<y>30</y>
<width>191</width>
<height>30</height>
</rect>
</property>
<property name="channel" stdset="0">
<string notr="true">IOCXX:MBBI</string>
</property>
</widget>
<widget class="caLineEdit" name="calineedit">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>131</width>
<height>30</height>
</rect>
</property>
<property name="text">
<string>IOCXX:MBBI.DESC</string>
</property>
<property name="channel" stdset="0">
<string notr="true">IOCXX:MBBI.DESC</string>
</property>
</widget>
<widget class="caLineEdit" name="calineedit_3">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>131</width>
<height>30</height>
</rect>
</property>
<property name="text">
<string>IOCXX:AI.DESC</string>
</property>
<property name="channel" stdset="0">
<string notr="true">IOCXX:AI.DESC</string>
</property>
</widget>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>caMenu</class>
<extends>QComboBox</extends>
<header>caMenu</header>
</customwidget>
<customwidget>
<class>caTextEntry</class>
<extends>caLineEdit</extends>
<header>caTextEntry</header>
</customwidget>
<customwidget>
<class>caInclude</class>
<extends>QWidget</extends>
<header>caInclude</header>
</customwidget>
<customwidget>
<class>caLineEdit</class>
<extends>QLineEdit</extends>
<header>caLineEdit</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,50 @@
epicsEnvSet("IOC", "ARESvisSim")
epicsEnvSet("ENGINEER", "zamofing_t")
epicsEnvSet("LOCATION", "simulator")
require motorBase
require motorSim
# require OBLL zamofing_t
motorSimCreateController("tzaSim1", 20)
## motorSimConfigAxis(port, axis, lowLimit, highLimit, home, start) 1E3 NOT ALLOWED USE 1000
motorSimConfigAxis("tzaSim1", 0, 10000000, -10000000, 500, 80000)
motorSimConfigAxis("tzaSim1", 1, 20000000, -20000000, 500, 117000)
motorSimConfigAxis("tzaSim1", 2, 10000000, -10000000, 500, 140000)
motorSimConfigAxis("tzaSim1", 3, 10000000, -10000000, 500, 100000)
motorSimConfigAxis("tzaSim1", 4, 10000000, -10000000, 500, 0)
motorSimConfigAxis("tzaSim1", 5, 10000000, -10000000, 500, 0)
motorSimConfigAxis("tzaSim1", 6, 10000000, -10000000, 500, 10000)
motorSimConfigAxis("tzaSim1", 7, 10000000, -10000000, 500, 60500)
motorSimConfigAxis("tzaSim1", 8, 10000000, -10000000, 500, 0)
motorSimConfigAxis("tzaSim1", 9, 10000000, -10000000, 500, 0)
motorSimConfigAxis("tzaSim1", 10, 10000000, -10000000, 500, 0)
motorSimConfigAxis("tzaSim1", 11, 10000000, -10000000, 500, 0)
motorSimConfigAxis("tzaSim1", 12, 10000000, -10000000, 500, 0)
motorSimConfigAxis("tzaSim1", 13, 10000000, -10000000, 500, 0)
motorSimConfigAxis("tzaSim1", 14, 10000000, -10000000, 500, 0)
motorSimConfigAxis("tzaSim1", 15, 10000000, -10000000, 500, 0)
motorSimConfigAxis("tzaSim1", 16, 10000000, -10000000, 500, 0)
motorSimConfigAxis("tzaSim1", 17, 10000000, -10000000, 500, 0)
motorSimConfigAxis("tzaSim1", 18, 10000000, -10000000, 500, 0)
motorSimConfigAxis("tzaSim1", 19, 10000000, -10000000, 500, 0)
#cd "${TOP}/iocBoot/${IOC}"
## Load record instances
dbLoadTemplate ARESvisSim.subs
dbLoadRecords ARESvisSim.db, "user=zamofing_tHost"
#- Set this to see messages from mySub
#-var mySubDebug 1
#- Run this to trace the stages of iocInit
#-traceIocInit
#cd "${TOP}/iocBoot/${IOC}"
iocInit
## Start any sequence programs
#seq sncExample, "user=zamofing_t"

30
ARESvis/iocSim/epicsMove.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/bin/bash
for i in {1..100}; do
echo $i
caput -c SATES30-RIXS:MOT_RY 40
caput -c SATES30-RIXS:MOT_RY 120
caput -c SATES30-RIXS:MOT_RY 80
caput -c SATES30-ARES:MOT_2TRY 97
caput -c SATES30-ARES:MOT_2TRY 147
caput -c SATES30-ARES:MOT_2TRY 117
caput -c SATES30-ARES:MOT_JFRY 110
caput -c SATES30-ARES:MOT_JFRY 170
caput -c SATES30-ARES:MOT_JFRY 140
caput -c SATES30-ARES:MOT_DRY 70
caput -c SATES30-ARES:MOT_DRY 130
caput -c SATES30-ARES:MOT_DRY 100
caput -c SATES30-ARES:MOT_STX -40
caput -c SATES30-ARES:MOT_STX 40
caput -c SATES30-ARES:MOT_STX 0
caput -c SATES30-ARES:MOT_STZ -60
caput -c SATES30-ARES:MOT_STZ 60
caput -c SATES30-ARES:MOT_STZ 0
caput -c SATES30-ARES:MOT_SRY -20
caput -c SATES30-ARES:MOT_SRY 40
caput -c SATES30-ARES:MOT_SRY 10
caput -c SATES30-MCS001:MOT_6 10.5
caput -c SATES30-MCS001:MOT_6 50.5
caput -c SATES30-MCS001:MOT_6 30.5
done

View File

@@ -0,0 +1,14 @@
record(motor, $(P):$(M) )
{
field(DESC, "$(P):$(M)")
field(DTYP, "asynMotor")
field(OUT, "@asyn(tzaSim1, $(ID))")
field(EGU, "$(EGU=)")
field(PREC, $(PREC=6))
field(MRES, $(MRES=1E-6))
field(TWV, $(TWV=.1))
field(VELO, $(VEL=1))
field(HVEL, $(VEL=1))
field(SYNC, 1) #forcs to sync at initialiozation
}

75
ARESvis/tmxARESvisSim.sh Executable file
View File

@@ -0,0 +1,75 @@
#!/bin/bash
# based on ~/Documents/prj/SwissFEL/apps/PhotonicsSim/tmxPhotonicsSim.sh
# >>> PREREQUISITES <<<
#sudo chmod o+w /usr/local/bin/
#rsync -vai sf-lc8:/usr/local/bin/iocsh /usr/local/bin/iocsh
#sudo chmod o-w /usr/local/bin/
help()
{
echo "Usage: $0 [OPTION]...
-s, --session SESSION name of the session (default is: 'ARESvisSim')
-h, --help this help text
example:
gnome-terminal --geometry=90x40 -- ./tmxARESvisSim.sh
"
exit -1
}
SHORT=s:,t:,P:,p:,h
LONG=session:,type:,proxy:,port:,help
if ! OPTS=$(getopt -n $0 --options $SHORT --longoptions $LONG -- "$@"); then
echo 'error!'
exit 1
fi
echo $OPTS
eval set -- "$OPTS"
while :
do
case "$1" in
-s | --session )
SESSION="$2"
shift 2
;;
-h | --help)
help
exit -1
;;
--)
shift;
break
;;
*)
echo "Unexpected option: $1"
exit -1
;;
esac
done
SESSION="${SEPROXYSSION:-ARESvisSim}"
if tmux has -t $SESSION
then
tmux kill-session -t $SESSION
fi
echo 'create new session'
# Start New Session with our name
tmux new-session -d -s $SESSION
tmux set -s base-index 1
tmux set -s pane-base-index 1
tmux splitw -v -p 20 -t .1
tmux send-keys -t.1 "export EPICS_HOST_ARCH=RHEL8-x86_64 && export LD_LIBRARY_PATH=.:/opt/lib:/usr/local/epics/base-7.0.8/lib/RHEL8-x86_64" ENTER
tmux send-keys -t.1 "cd ~/Documents/prj/SwissFEL/apps/EsfRixsApps/ARESvis/iocSim && iocsh ARESvisSim_startup.script" ENTER
tmux send-keys -t.2 "cd ~/Documents/prj/SwissFEL/apps/EsfRixsApps/ARESvis/" ENTER
tmux send-keys -t.2 "unset GNOME_TERMINAL_SCREEN && caqtdm -attach iocSim/ARESvisSim.ui&" ENTER
tmux send-keys -t.2 "./ARESvis.py&" ENTER
tmux send-keys -t.2 "iocSim/epicsMove.sh" ENTER
#tmux send-keys -t.2 "~/Documents/prj/SwissFEL/apps/synoptipy/synTopo/synTopo.py -b aramis&" ENTER
tmux attach

View File

@@ -17,15 +17,11 @@ live visualization of the ARES chamber tools to avoid collisions and beam clippi
![alt ARESvis](ARESvis.png "ARESvis")
rsync -vain ~/Documents/prj/SwissFEL/apps/EsfRixsApps/ARESvis satesf-vcons-01:/sf/furka/applications/EsfRixsApps/ --filter='- ARESvis/__pycache__/'
For simulated ioc and software testing:
cd ~/Documents/prj/SwissFEL/apps/EsfRixsApps/ARESvis
gnome-terminal --geometry=90x40 -- ./tmxARESvisSim.sh
For simulated motor IOC:
/home/zamofing_t/Documents/prj/SwissFEL/test_ioc/MotorSim/iocBoot/ARESvis/ARESvis.cmd
For motor ui:
caQtDM ~/Documents/prj/SwissFEL/test_ioc/MotorSim/iocBoot/ARESvis/ARESvis.ui&
python ARESvis.py
spectrumProc
------------