Overview
Comment:Now uses abg2sympar_m2txt to get the arguments
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: d986cfb4849455110bc3c8f635f95ca707b73c976b0903c19f92f0f3fbf75da0
User & Date: gawthrop@users.sourceforge.net on 2001-06-11 16:53:49
Other Links: branch diff | manifest | tags
Context
2001-06-11
19:43:50
MTT is now much more sophisticated in generating lbl files
Labels can contain maths
Repetative components are now broken
check-in: 3bc428aa0c user: gawthrop@users.sourceforge.net tags: origin/master, trunk
16:53:49
Now uses abg2sympar_m2txt to get the arguments check-in: d986cfb484 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
16:45:22
Now has third argument for use in abg2lbl_fig2txt check-in: 85d7f0ef2b user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/abg2lbl_fig2txt from [9b3dd18d71] to [c8cd5a2aaa].

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.13  2001/06/04 08:13:37  gawthrop
## Various changes to support PPP
##
## Revision 1.12  2001/05/08 15:18:10  gawthrop
## Added trig and hyperbolic functions to argument exclusion list
##
## Revision 1.11  2000/09/19 11:14:30  peterg







>
>
>







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Acausal bond graph to causal bond graph: mfile format

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.14  2001/06/11 15:06:58  gawthrop
## Now handles user-defined components
##
## Revision 1.13  2001/06/04 08:13:37  gawthrop
## Various changes to support PPP
##
## Revision 1.12  2001/05/08 15:18:10  gawthrop
## Added trig and hyperbolic functions to argument exclusion list
##
## Revision 1.11  2000/09/19 11:14:30  peterg
114
115
116
117
118
119
120


121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203

204
205
206
207
208

209


210


211

212

213
214
215
grep -v  '\[[0-9]*\]'  $1_unique_raw_list | \
awk --field-separator ':' '
 BEGIN {
    OldComponent="None";
 }
 { 
  Component = $1;


  ##Aliases
  if (Component == "SS") {
    port_alias[++j] = $2;
  }
  else {
    alias[++i] = $2;
    if (length(sensitivity)>0) {
      s_arg = sprintf("%ss",$2);
      alias[++i] = s_arg;
      s_arg = sprintf(";%s",s_arg);
      Component = substr(Component,2);
      lin = "slin"
    }
   else {
      lin = "lin"
    }
  
 }

    ## Table of components
    cr["SS"] = "SS";  arg["SS"] = "external,external";

    cr["Se"] = "SS";  arg["Se"] = sprintf("external%s", s_arg);
    cr["Sf"] = "SS";  arg["Sf"] = sprintf("external%s", s_arg);

    cr["De"] = "SS";  arg["De"] = "external";
    cr["Df"] = "SS";  arg["Df"] = "external";

    cr["R"] = lin;  arg["R"]  = sprintf("flow,%s%s", $2, s_arg);
    cr["C"] = lin;  arg["C"]  = sprintf("effort,%s%s", $2, s_arg);
    cr["I"] = lin;  arg["I"]  = sprintf("flow,%s%s", $2, s_arg);

    cr["CS"] = "lin";  arg["CS"]  = sprintf("effort,%s;%s_x0%s", $2, $2, s_arg);
    cr["IS"] = "lin";  arg["IS"]  = sprintf("flow,%s;%s_x0%s", $2, $2, s_arg);
    cr["INTFS"] = "lin";  arg["INTFS"]  = sprintf("%s_x0%s", $2, s_arg);

    cr["TF"] = "lin";  arg["TF"]  = sprintf("flow,%s%s", $2, s_arg);
    cr["GY"] = "lin";  arg["GY"]  = sprintf("flow,%s%s", $2, s_arg);

    cr["AE"] = "lin";  arg["AE"]  = sprintf("%s%s", $2, s_arg);
    cr["AF"] = "lin";  arg["AF"]  = sprintf("%s%s", $2, s_arg);

    cr["CDx"] = "lin";  arg["CDx"]  = sprintf("%s%s", $2, s_arg);


    cr["RS"] = lin;  arg["RS"]  = sprintf("flow,%s%s", $2, s_arg);


  ## Heading
  if (Component !~ OldComponent) print "\n% Component type", Component

  ## Component
    printf("\t%s\t", Component);
    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")
    }

    ##print  "\t" $2 "\t" cr[Component] "\t\t" arg[Component];
    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)
          print "%ALIAS\t" port_name "\t" port_name >> "mtt_junk_alias.txt";
        else
          print "%ALIAS\t" port_name "\t" port_name "_1," port_name "_2" >> "mtt_junk_alias.txt";
      }
    }

    print "\n% Argument aliases" >> "mtt_junk_alias.txt";
    for (k=1;k<=i;k++){
      print "%ALIAS\t\$" k "\t" alias[k] >> "mtt_junk_alias.txt";
    }

 }' sensitivity=$sensitivity > mtt_junk_body.txt

cat mtt_junk_top.txt mtt_junk_alias.txt mtt_junk_blurb.txt mtt_junk_body.txt > $1_lbl.txt























>
>
|

|


|

|




















|
|
|

|
|
|

|
|

|
|

|


|






|











<














|
|
|
<
>
|

<

|
>

>
>

>
>

>

>



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189

190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206

207
208
209

210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
grep -v  '\[[0-9]*\]'  $1_unique_raw_list | \
awk --field-separator ':' '
 BEGIN {
    OldComponent="None";
 }
 { 
  Component = $1;
  Name = $2;
  
##Aliases
  if (Component == "SS") {
    port_alias[++j] = Name;
  }
  else {
    alias[++i] = Name;
    if (length(sensitivity)>0) {
      s_arg = sprintf("%ss",Name);
      alias[++i] = s_arg;
      s_arg = sprintf(";%s",s_arg);
      Component = substr(Component,2);
      lin = "slin"
    }
   else {
      lin = "lin"
    }
  
 }

    ## Table of components
    cr["SS"] = "SS";  arg["SS"] = "external,external";

    cr["Se"] = "SS";  arg["Se"] = sprintf("external%s", s_arg);
    cr["Sf"] = "SS";  arg["Sf"] = sprintf("external%s", s_arg);

    cr["De"] = "SS";  arg["De"] = "external";
    cr["Df"] = "SS";  arg["Df"] = "external";

    cr["R"] = lin;  arg["R"]  = sprintf("flow,%s%s", Name, s_arg);
    cr["C"] = lin;  arg["C"]  = sprintf("effort,%s%s", Name, s_arg);
    cr["I"] = lin;  arg["I"]  = sprintf("flow,%s%s", Name, s_arg);

    cr["CS"] = "lin";  arg["CS"]  = sprintf("effort,%s;%s_x0%s", Name, Name, s_arg);
    cr["IS"] = "lin";  arg["IS"]  = sprintf("flow,%s;%s_x0%s", Name, Name, s_arg);
    cr["INTFS"] = "lin";  arg["INTFS"]  = sprintf("%s_x0%s", Name, s_arg);

    cr["TF"] = "lin";  arg["TF"]  = sprintf("flow,%s%s", Name, s_arg);
    cr["GY"] = "lin";  arg["GY"]  = sprintf("flow,%s%s", Name, s_arg);

    cr["AE"] = "lin";  arg["AE"]  = sprintf("%s%s", Name, s_arg);
    cr["AF"] = "lin";  arg["AF"]  = sprintf("%s%s", Name, s_arg);

    cr["CDx"] = "lin";  arg["CDx"]  = sprintf("%s%s", Name, s_arg);


    cr["RS"] = lin;  arg["RS"]  = sprintf("flow,%s%s", Name, s_arg);


  ## 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)
          print "%ALIAS\t" port_name "\t" port_name >> "mtt_junk_alias.txt";
        else
          print "%ALIAS\t" port_name "\t" port_name "_1," port_name "_2" >> "mtt_junk_alias.txt";
      }
    }

#    print "\n% Argument aliases" >> "mtt_junk_alias.txt";
#    for (k=1;k<=i;k++){
#      print "%ALIAS\t\$" k "\t" alias[k] >> "mtt_junk_alias.txt";

#    }
 }' sensitivity=$sensitivity > $1_lbl.txt



## Create argument aliases
cat > mtt_junk_arg_alias.txt<<EOF

# Argument aliases
EOF

abg2sympar_m2txt $1 "" use_label_file |\
 awk '{printf("#ALIAS $%i %s\n", ++i, $1)}' >> mtt_junk_arg_alias.txt

mv  $1_lbl.txt mtt_junk_body.txt

cat mtt_junk_top.txt mtt_junk_alias.txt mtt_junk_arg_alias.txt mtt_junk_blurb.txt mtt_junk_body.txt > $1_lbl.txt




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