Skip to content
Snippets Groups Projects
Unverified Commit 7836eb9d authored by ThomasFayESS's avatar ThomasFayESS Committed by GitHub
Browse files

Merge pull request #17 from icshwi/alias

Changes the mechanism of setting alias and description.
parents 2178047b 94410690
No related branches found
No related tags found
No related merge requests found
#channel num, PV name, description
0,CvtFld,Cavity Field
1,Refer,Reference
2,PreAmpFwd,PreAmp Fwd
3,PwrAmpFwd,PowerAmp Fwd
4,PwrAmpRefl,PowerAmp Refl
5,CvtFwd,Cavity Forward
6,CvtRfl,Cavity Refl
7,VM,Vector Modulator
8,VMOut,Vector Modulator Out
9,AI9,Analog Channel 9
function usage() { #!/bin/bash
echo "usage: configChannels.sh" if [ $# -ne 2 ]; then
echo "-a channel number - amplifier power" echo "usage: configChannels.sh <digitiser instance> <config input file>"
echo "-c channel number - cavity power" echo "There is an example for config input file: configChannels.input"
echo "-n digitiser instance - as integer starting from 1" exit
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
fi fi
installPath=/iocs/sis8300llrf installPath=/iocs/sis8300llrf
if [ ! -d $installPath ]; then
echo "Folder $installPath not found!"
exit
fi
if [ ! -w $installPath ]; then
echo "You cannot write on $installPath !"
exit
fi
iNum=$1
confFile=$2
fPath=$installPath/config-aliasing$iNum.iocsh fPath=$installPath/config-aliasing$iNum.iocsh
fPathDesc=$installPath/config-desc$iNum.iocsh
# Populate IOC snippet for alias values # Populate IOC snippet for alias values
if [ -f $fPath ]; then if [ -f $fPath ]; then
rm $fPath rm $fPath
fi fi
if [ -f $fPathDesc ]; then
rm $fPathDesc
fi
# Populate iocsh snippet containing alias definitions. # Populate iocsh snippet containing alias definitions.
echo "# Alias definitions for digitiser card number $iNum" > $fPath echo "# Alias definitions for digitiser card number $iNum" > $fPath
template0="dbLoadRecords(\$(E3_CMD_TOP)/alias.template, \"O=$LLRF_IOC_NAME$iNum:AI" template0="dbLoadRecords(\$(E3_CMD_TOP)/alias.template, \"O=$LLRF_IOC_NAME$iNum:AI"
if [ ${#chAmp} -gt 0 ]; then template1="dbLoadRecords(\$(E3_CMD_TOP)/desc.template, "
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 read
while IFS=, read -r ch pv_name desc
do
ch=$(echo $ch | sed -e 's/^[ \t]*//')
pv_name=$(echo $pv_name | sed -e 's/^[ \t]*//')
desc=$(echo $desc | sed -e 's/^[ \t]*//')
if [ ${#desc} -gt 41 ]; then
echo "Warning: Description truncated to char[41] - ${desc:0:40}"
desc=${desc:0:40}
fi
# If alias is the same as channel, doesn't set alias
if [ $pv_name != "AI$ch" ]; then
echo "# Board $iNum, Channel $ch = $pv_name" >> $fPath
oPrefix="$template0$ch"
aPrefix="$LLRF_IOC_NAME:$pv_name"
# set aliases
echo "$oPrefix, A=$aPrefix\")" >> $fPath
echo "$oPrefix-ATT, A=$aPrefix-ATT\")" >> $fPath
echo "$oPrefix-ATT-RBV, A=$aPrefix-ATT-RBV\")" >> $fPath
echo "$oPrefix-DECF, A=$aPrefix-DECF\")" >> $fPath
echo "$oPrefix-DECF-RBV, A=$aPrefix-DECF-RBV\")" >> $fPath
echo "$oPrefix-DECO, A=$aPrefix-DECO\")" >> $fPath
echo "$oPrefix-DECO-RBV, A=$aPrefix-DECO-RBV\")" >> $fPath
echo "$oPrefix-FileName, A=$aPrefix-FileName\")" >> $fPath
echo "$oPrefix-Slope, A=$aPrefix-Slope\")" >> $fPath
echo "$oPrefix-Offset, A=$aPrefix-Offset\")" >> $fPath
echo "$oPrefix-InputValues, A=$aPrefix-InputValues\")" >> $fPath
echo "$oPrefix-DigitisedValues, A=$aPrefix-DigitisedValues\")" >> $fPath
echo "$oPrefix-FittedLine, A=$aPrefix-FittedLine\")" >> $fPath
fi
# set descriptions
echo "$template1\"A=$LLRF_IOC_NAME:pv_name, D=$desc\")" >> $fPathDesc
done
} < $confFile
...@@ -18,7 +18,8 @@ if [ ${#slots_fpga} -lt 1 ] ; then ...@@ -18,7 +18,8 @@ if [ ${#slots_fpga} -lt 1 ] ; then
snippet="epicsEnvSet(\"LLRF_PREFIX\" \"$LLRF_IOC_NAME\" ) \\\n \ snippet="epicsEnvSet(\"LLRF_PREFIX\" \"$LLRF_IOC_NAME\" ) \\\n \
epicsEnvSet(\"LLRF_SLOT\" \"<slot>\" ) \\\n \ epicsEnvSet(\"LLRF_SLOT\" \"<slot>\" ) \\\n \
iocshLoad $\(E3_CMD_TOP\)\/llrf.iocsh \\\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" echo "snippet = $snippet"
eval "sed -e $'s/<snippet>/$snippet/g' < $EPICS_SRC/e3-sis8300llrf/startup/llrf_template.cmd > $siteApp/llrf.cmd" eval "sed -e $'s/<snippet>/$snippet/g' < $EPICS_SRC/e3-sis8300llrf/startup/llrf_template.cmd > $siteApp/llrf.cmd"
else else
...@@ -32,7 +33,8 @@ else ...@@ -32,7 +33,8 @@ else
epicsEnvSet(\"LLRF_PREFIX\" \"$LLRF_IOC_NAME$i\" ) \\\n \ epicsEnvSet(\"LLRF_PREFIX\" \"$LLRF_IOC_NAME$i\" ) \\\n \
epicsEnvSet(\"LLRF_SLOT\" \"$slot_fpga\" ) \\\n \ epicsEnvSet(\"LLRF_SLOT\" \"$slot_fpga\" ) \\\n \
iocshLoad $\(E3_CMD_TOP\)\/llrf.iocsh \\\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)) i=$(($i+1))
done done
#Populate digitiser slot and IOC Name in startup script. #Populate digitiser slot and IOC Name in startup script.
...@@ -56,3 +58,6 @@ fi ...@@ -56,3 +58,6 @@ fi
# Alias template # Alias template
cp $EPICS_SRC/e3-sis8300llrf/startup/alias.template $siteApp/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