Overview
Comment:Now handles ss.r files with implicit zero values
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 1a97bd46dd9c9d3dc46e8744da0baadc3f05c166057a00281f5d03b163cc77dd
User & Date: gawthrop@users.sourceforge.net on 2003-08-05 15:29:36
Other Links: branch diff | manifest | tags
Context
2003-08-06
10:33:42
User now warned not to use -c which is unsupported. check-in: 2c29688eb9 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
2003-08-05
15:29:36
Now handles ss.r files with implicit zero values check-in: 1a97bd46dd user: gawthrop@users.sourceforge.net tags: origin/master, trunk
2003-08-04
09:15:09
-ss switch reinstated check-in: 096f943380 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/mtt_update from [57a4091ca6] to [a732204ed3].

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


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]