9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# Copyright (C) 2000 by Peter J. Gawthrop
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## 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
## split up state and input - different defaults
##
|
>
>
>
|
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# Copyright (C) 2000 by Peter J. Gawthrop
###############################################################
## 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
## split up state and input - different defaults
##
|
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
echo Usage mtt_update system representation [update]
exit
fi
## Extract initial value from steady-state information
initial_value() {
i=$1
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)}'`
else
value=${default}
fi
else
value=${default}
fi
}
|
>
>
>
|
>
>
>
|
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
echo Usage mtt_update system representation [update]
exit
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
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}
fi
}
|
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
else
echo Creating $textfile
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;
echo $new $value |\
gawk '{printf("%s\t= %s; # Default\n",$1,$2)}' >> $textfile
done
exit
fi
# Remove tmp files
|
|
|
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
else
echo Creating $textfile
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 ${default}
echo $new $value |\
gawk '{printf("%s\t= %s; # Default\n",$1,$2)}' >> $textfile
done
exit
fi
# Remove tmp files
|