#! /bin/bash
function mysub()
{
file=$1; hp=$2; idlerpm=$3; maxrpm=$4
echo Answer: $1, $2, $3, $4
if [[ -e engine/$file ]]
then
if [[ -e engine/testengine.xml ]]
then
unlink engine/testengine.xml
fi
link engine/$file engine/testengine.xml
if [ "$hp" -gt 1000 ]
then
load=10
elif [ "$hp" -gt 200 ]
then
load=5
else
load=1
fi
sed "s|...|$load|" engine/prop_testload.xml -1
idleset=`echo "scale=6; $idlerpm/3000" | bc`
for a in 0 25 50 75 100
do
./src/JSBSim --script=scripts/testcell-script05-$a.xml --outputlogfile=./aaa-$a.csv --property=fcs/advance-cmd-norm[0]=$idleset
done
echo file = $file HP = $hp IdleRPM = $idlerpm "("$idleset")" MaxRPM = $maxrpm
gnuplot testcell05.gnuplot
fi
}
if [ $1 ]
then
read a b c d < <(IFS=,;echo $(grep $1 engines.txt))
mysub $a $b $c $d
else
OIFS=$IFS; IFS=,
while read a b c d
do
mysub $a $b $c $d
done < engines.txt
IFS=$OIFS # Restore original $IFS.
fi