Skip to content
Snippets Groups Projects
Commit c04d30c6 authored by Gabriel Fedel's avatar Gabriel Fedel :speech_balloon:
Browse files

Change the way to configure alias and description

Now, using an input file is possible to define alias and description
for the channels.
parent 2178047b
No related branches found
No related tags found
1 merge request!17Change the way to set alias and description
CvtFldCtrl,Cavity Field Ctrl
Refer,Reference
Cvt1Fwd,Cavity 1 Fwd
Cvt1Rfl,Cavity 1 Rflct
Cvt2Fwd,Cavity 2 Fwd
Cvt2Rfl,Cavity 2 Rflct
PwrAmpFwd,PowerAmp Fwd
function usage() {
echo "usage: configChannels.sh"
echo "-a channel number - amplifier power"
echo "-c channel number - cavity power"
echo "-n digitiser instance - as integer starting from 1"
echo "-p channel number - preamplifier power"
echo "-h help"
}
options=":a:c:n:p:h"
while getopts "${options}" opts; do
case "${opts}" in
h) usage ;;
a) chAmp=${OPTARG} ;;
c) chCav=${OPTARG} ;;
n) iNum=${OPTARG} ;;
p) chPreAmp=${OPTARG} ;;
esac
done
if [ $# -lt 3 ]; then
echo "Script requires at least input of digitiser instance and a channel number"
usage
#!/bin/bash
if [ $# -ne 2 ]; then
echo "usage: configChannels.sh <digitiser instance> <config input file>"
echo "There is an example for config input file: configChannels.input"
exit
fi
iNum=$1
confFile=$2
installPath=/iocs/sis8300llrf
fPath=$installPath/config-aliasing$iNum.iocsh
fPathDesc=$installPath/config-desc$iNum.iocsh
# Populate IOC snippet for alias values
if [ -f $fPath ]; then
rm $fPath
fi
if [ -f $fPathDesc ]; then
rm $fPathDesc
fi
# Populate iocsh snippet containing alias definitions.
echo "# Alias definitions for digitiser card number $iNum" > $fPath
template0="dbLoadRecords(\$(E3_CMD_TOP)/alias.template, \"O=$LLRF_IOC_NAME$iNum:AI"
if [ ${#chAmp} -gt 0 ]; then
echo "$template0$chAmp, A=$LLRF_IOC_NAME:AmpPow\")" >> $fPath
echo "$template0$chAmp-ATT, A=$LLRF_IOC_NAME:AmpPow-ATT\")" >> $fPath
echo "$template0$chAmp-ATT-RBV, A=$LLRF_IOC_NAME:AmpPow-ATT-RBV\")" >> $fPath
fi
template1="dbLoadRecords(\$(E3_CMD_TOP)/desc.template, "
i=0
cat $confFile | while read line
do
pv_name=$(echo $line | cut -f 1 -d ,)
desc=$(echo $line | cut -f 2 -d ,)
# set aliases
echo "$template0$i, A=$LLRF_IOC_NAME$iNum:$pv_name\")" >> $fPath
echo "$template0$i-ATT, A=$LLRF_IOC_NAME$iNum:$pv_name-ATT\")" >> $fPath
echo "$template0$i-ATT-RBV, A=$LLRF_IOC_NAME$iNum:$pv_name-ATT-RBV\")" >> $fPath
echo "$template0$i-DECF, A=$LLRF_IOC_NAME$iNum:$pv_name-DECF\")" >> $fPath
echo "$template0$i-DECF-RBV, A=$LLRF_IOC_NAME$iNum:$pv_name-DECF-RBV\")" >> $fPath
echo "$template0$i-DECO, A=$LLRF_IOC_NAME$iNum:$pv_name-DECO\")" >> $fPath
echo "$template0$i-DECO-RBV, A=$LLRF_IOC_NAME$iNum:$pv_name-DECO-RBV\")" >> $fPath
# set descriptions
echo "$template1\"A=$LLRF_IOC_NAME$iNum:$pv_name, D=$desc\")" >> $fPathDesc
i=$(($i+1))
done
......@@ -18,7 +18,8 @@ if [ ${#slots_fpga} -lt 1 ] ; then
snippet="epicsEnvSet(\"LLRF_PREFIX\" \"$LLRF_IOC_NAME\" ) \\\n \
epicsEnvSet(\"LLRF_SLOT\" \"<slot>\" ) \\\n \
iocshLoad $\(E3_CMD_TOP\)\/llrf.iocsh \\\n \
iocshLoad $\(E3_CMD_TOP\)\/config-aliasing1.iocsh \\\n"
iocshLoad $\(E3_CMD_TOP\)\/config-aliasing1.iocsh \\\n \
iocshLoad $\(E3_CMD_TOP\)\/config-desc1.iocsh \\\n"
echo "snippet = $snippet"
eval "sed -e $'s/<snippet>/$snippet/g' < $EPICS_SRC/e3-sis8300llrf/startup/llrf_template.cmd > $siteApp/llrf.cmd"
else
......@@ -32,7 +33,8 @@ else
epicsEnvSet(\"LLRF_PREFIX\" \"$LLRF_IOC_NAME$i\" ) \\\n \
epicsEnvSet(\"LLRF_SLOT\" \"$slot_fpga\" ) \\\n \
iocshLoad $\(E3_CMD_TOP\)\/llrf.iocsh \\\n \
iocshLoad $\(E3_CMD_TOP\)\/config-aliasing$i.iocsh \\\n"
iocshLoad $\(E3_CMD_TOP\)\/config-aliasing$i.iocsh \\\n \
iocshLoad $\(E3_CMD_TOP\)\/config-desc$i.iocsh \\\n"
i=$(($i+1))
done
#Populate digitiser slot and IOC Name in startup script.
......@@ -56,3 +58,6 @@ fi
# Alias template
cp $EPICS_SRC/e3-sis8300llrf/startup/alias.template $siteApp/alias.template
# Description template
cp $EPICS_SRC/e3-sis8300llrf/startup/desc.template $siteApp/desc.template
record("*", "$(A)"){
field(DESC, "$(D)")
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment