Index: mttroot/mtt/bin/trans/mtt_update ================================================================== --- mttroot/mtt/bin/trans/mtt_update +++ mttroot/mtt/bin/trans/mtt_update @@ -11,10 +11,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.18 2003/08/04 09:10:30 gawthrop +## Now handles steady-state computation for _state.txt. +## ## Revision 1.17 2002/04/28 18:41:27 geraint ## Fixed [ 549658 ] awk should be gawk. ## Replaced calls to awk with call to gawk. ## ## Revision 1.16 2000/10/17 13:45:18 peterg @@ -81,14 +84,20 @@ fi ## Extract initial value from steady-state information initial_value() { i=$1 + default=$2 ssfile=${sys}_ss.r if [ "${rep}" = "state" ]; then if [ -f "${ssfile}" ]; then - value=`grep "MTTx($i" ${ssfile}| sed 's/ //g' | gawk -F '=' '{print substr($2,1,length($2)-2)}'` + count=`grep -c "^MTTx($i" ${ssfile}`; # See if its there + if [ $count = "1" ]; then + value=`grep "^MTTx($i" ${ssfile}| sed 's/ //g' | gawk -F '=' '{print substr($2,1,length($2)-2)}'` + else + value="0.0" + fi else value=${default} fi else value=${default} @@ -150,11 +159,11 @@ mtt_header $sys $rep $lang > $textfile info=`cut -f1 $infofile | sort` i=0; for new in $info; do let i=$i+1; - initial_value $i; + initial_value $i ${default} echo $new $value |\ gawk '{printf("%s\t= %s; # Default\n",$1,$2)}' >> $textfile done exit fi