18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
system_scse=$1_scse.r
# Parameters
n=`echo $2 | sed 's/,/ /g' |wc -w` ## Number of parameters
## Parameter information for reduce.
parameters=`echo $2 | sed 's/,/ /g' |\
awk '{
for (i=1; i<=NF; i++) {
printf("mttpar(%i,1) := %s;\n", i, $i);
printf("mttcoef(%i,1) := %ss;\n", i, $i);
}
}'`
## Update sympar list.
echo Recreating $1_sympar.txt
# Zap any sensitivity coeficients
mv $1_sympar.txt mtt_junk
grep -v MTT_Sensitivity_Coefficients mtt_junk > $1_sympar.txt
# Create the new sens coeffs at end of list.
echo $2 | sed 's/,/ /g' |\
awk '{
for (i=1; i<=NF; i++) {
printf("%ss\tMTT_Sensitivity_Coefficients\n",$i);
}
}' >> $1_sympar.txt
touch $1_sympar.txt
matrix="matrix mttpar("$n",1); matrix mttcoef("$n",1);"
# Number of states
Nx=`grep "MTTNx " <$system_def | awk '{print $3}' | sed 's/;//'`
#Inform user
echo Creating $system_scse "(for parameters $2, $Nx states)"
# Remove the old log file
rm -f cse2scse_r.log
|
|
|
|
|
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
system_scse=$1_scse.r
# Parameters
n=`echo $2 | sed 's/,/ /g' |wc -w` ## Number of parameters
## Parameter information for reduce.
parameters=`echo $2 | sed 's/,/ /g' |\
gawk '{
for (i=1; i<=NF; i++) {
printf("mttpar(%i,1) := %s;\n", i, $i);
printf("mttcoef(%i,1) := %ss;\n", i, $i);
}
}'`
## Update sympar list.
echo Recreating $1_sympar.txt
# Zap any sensitivity coeficients
mv $1_sympar.txt mtt_junk
grep -v MTT_Sensitivity_Coefficients mtt_junk > $1_sympar.txt
# Create the new sens coeffs at end of list.
echo $2 | sed 's/,/ /g' |\
gawk '{
for (i=1; i<=NF; i++) {
printf("%ss\tMTT_Sensitivity_Coefficients\n",$i);
}
}' >> $1_sympar.txt
touch $1_sympar.txt
matrix="matrix mttpar("$n",1); matrix mttcoef("$n",1);"
# Number of states
Nx=`grep "MTTNx " <$system_def | gawk '{print $3}' | sed 's/;//'`
#Inform user
echo Creating $system_scse "(for parameters $2, $Nx states)"
# Remove the old log file
rm -f cse2scse_r.log
|
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
|
## Now reorganise the states
mv -f $system_scse mtt_junk
##echo "Nx = $Nx"
awk '{
## Make sure all MTTn variables are followed by a space
gsub(/mttx[0-9]*/, "& ");
for (i=Nx;i>0;i--) {
state = sprintf("mttx%i ",i);
newstate = sprintf("mttx%i ",2*i-1);
|
|
|
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
|
## Now reorganise the states
mv -f $system_scse mtt_junk
##echo "Nx = $Nx"
gawk '{
## Make sure all MTTn variables are followed by a space
gsub(/mttx[0-9]*/, "& ");
for (i=Nx;i>0;i--) {
state = sprintf("mttx%i ",i);
newstate = sprintf("mttx%i ",2*i-1);
|