9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# Acausal bond graph to causal bond graph: mfile format
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.16 2001/06/11 19:43:49 gawthrop
## MTT is now much more sophisticated in generating lbl files
## Labels can contain maths
## Repetative components are now broken
##
## Revision 1.15 2001/06/11 16:53:49 gawthrop
## Now uses abg2sympar_m2txt to get the arguments
|
>
>
>
>
|
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# Acausal bond graph to causal bond graph: mfile format
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.17 2001/06/13 10:41:06 gawthrop
## Further changes towards aouto creation of lbl files.
## Prettified lbl files
##
## Revision 1.16 2001/06/11 19:43:49 gawthrop
## MTT is now much more sophisticated in generating lbl files
## Labels can contain maths
## Repetative components are now broken
##
## Revision 1.15 2001/06/11 16:53:49 gawthrop
## Now uses abg2sympar_m2txt to get the arguments
|
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
#diff $1_unique_raw_list $1_raw_list | grep '>' | sed 's/>/ /'
#Write out the outline lbl file
grep -v '\[[0-9]*\]' $1_unique_raw_list | \
awk --field-separator ':' '
BEGIN {
OldComponent="None";
}
{
Component = $1;
Name = $2;
Arg = $3;
##Aliases
|
>
|
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
#diff $1_unique_raw_list $1_raw_list | grep '>' | sed 's/>/ /'
#Write out the outline lbl file
grep -v '\[[0-9]*\]' $1_unique_raw_list | \
awk --field-separator ':' '
BEGIN {
OldComponent="None";
default_cr = "lin";
}
{
Component = $1;
Name = $2;
Arg = $3;
##Aliases
|
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
|
## Put in the explicit arguments
if (length(Arg)>0) {
arg[Component] = Arg;
if (match(Arg,"=")>0) # Its an equation type cr
cr[Component] = "cr"
else # assume a linear cr
cr[Component] = "lin";
}
## Heading
if (Component !~ OldComponent) print "\n## Component type", Component
## Component
printf("\t%s\t", Name);
if (Component in cr)
printf("%s\t\t", cr[Component])
else
printf("none\t\t");
if (Component in arg)
printf("%s\t\t\n", arg[Component])
else {
print "lbl2args_txt2out", Component | "/bin/sh"; close("/bin/sh")
}
OldComponent=Component;
}
END{
print "\n## Port aliases" >> "mtt_junk_alias.txt";
for (k=1;k<=j;k++){
if (port_alias[k] ~ "\\["){ # Only do ports
port_name = substr(port_alias[k],2,length(port_alias[k])-2);
if (length(sensitivity)==0)
|
|
|
|
>
>
|
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
|
## Put in the explicit arguments
if (length(Arg)>0) {
arg[Component] = Arg;
if (match(Arg,"=")>0) # Its an equation type cr
cr[Component] = "cr"
else # assume a linear cr
cr[Component] = "lin";
}
## Heading
if (Component !~ OldComponent) print "\n## Component type", Component
## Component
printf("\t%s\t", Name);
if (Component in cr)
printf("%s\t\t", cr[Component])
else
printf("%s\t\t",default_cr);
if (Component in arg)
printf("%s\t\t\n", arg[Component])
else {
print "lbl2args_txt2out", Component | "/bin/sh"; close("/bin/sh")
}
OldComponent=Component;
delete arg[Component]; # Zap the element
delete cr[Component]; # Zap the element
}
END{
print "\n## Port aliases" >> "mtt_junk_alias.txt";
for (k=1;k<=j;k++){
if (port_alias[k] ~ "\\["){ # Only do ports
port_name = substr(port_alias[k],2,length(port_alias[k])-2);
if (length(sensitivity)==0)
|