Overview
Comment:Replaced ifs by a table of cr/arg information
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: b0b149b31816b0674f127e41d00fb1ef06a5e7acbe7bc283617251572279377e
User & Date: gawthrop@users.sourceforge.net on 1999-11-10 00:47:08
Other Links: branch diff | manifest | tags
Context
1999-11-11
21:48:46
Modified step size adjustment check-in: 4c14f1758d user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1999-11-10
00:47:08
Replaced ifs by a table of cr/arg information check-in: b0b149b318 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1999-11-09
22:32:41
Under RCS ready for using arrays to contaain defaults. check-in: 51995a8d73 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/abg2lbl_fig2txt from [56bda1e9ba] to [c8bb956d34].

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.7  1998/07/04 10:37:21  peterg
## Major revision to include:
## 	aliases
## 	new Style
## 	prettyfied
##
## Revision 1.6  1998/03/05 10:09:47  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.8  1999/11/09 22:32:41  peterg
## Under RCS ready for using arrays to contaain defaults.
##
## Revision 1.7  1998/07/04 10:37:21  peterg
## Major revision to include:
## 	aliases
## 	new Style
## 	prettyfied
##
## Revision 1.6  1998/03/05 10:09:47  peterg
84
85
86
87
88
89
90


91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109


110
111
112
113
114
115
116
117
118

119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#Write out non-unique names
#echo 'Non-unique names (if any):'
#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 ':' '


 { 
#   if (($1 != "0")&&($1 != "1")) 
    { 
      if (Component !~ $1) print "\n% Component type", $1

      if ($1 == "SS") {
	port_alias[++j] = $2
	print  "\t" $2 "\tSS\t\texternal,external";
      }

      else if ($1 == "R") {
	alias[++i] = $2
	print  "\t" $2"\t\tlin\tflow," $2;
      }

      else if ($1 == "I") {
	alias[++i] = $2
	print  "\t" $2"\t\tlin\tflow," $2;
      }



      else if ($1 == "C") {
	alias[++i] = $2
	print  "\t" $2"\t\tlin\teffort," $2;
      }

      else if ($1 == "TF") {
	alias[++i] = $2
	print  "\t" $2"\t\tlin\tflow," $2;

      }

      else if ($1 == "GY") {
	alias[++i] = $2
	print  "\t" $2"\t\tlin\tflow," $2;
      }
      else
	 print  "\t" $2;
      }
      Component=$1
  }
  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);
        print "%ALIAS\t" port_name "\t" port_name >> "mtt_junk_alias.txt";







>
>

<
<
<
|
|
|
<
<
|
<
|
<
|

|
|
<
|
>
>

|
|
<
|
|
<
|
|
>
|
|
<
<
|
|
|
|
<
|







87
88
89
90
91
92
93
94
95
96



97
98
99


100

101

102
103
104
105

106
107
108
109
110
111

112
113

114
115
116
117
118


119
120
121
122

123
124
125
126
127
128
129
130
#Write out non-unique names
#echo 'Non-unique names (if any):'
#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 {
 }
 { 



  ##Aliases
  if ($1 == "SS") 
    port_alias[++j] = $2;


  else

    alias[++i] = $2;



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


    cr["Se"] = "SS";  arg["Se"] = "external";
    cr["Sf"] = "SS";  arg["Sf"] = "external";

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


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

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

  ## Heading


  if (Component !~ $1) print "\n% Component type", $1

  ## Component
    print  "\t" $2 "\t" cr[$1] "\t\t" arg[$1];

    Component=$1
  }
  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);
        print "%ALIAS\t" port_name "\t" port_name >> "mtt_junk_alias.txt";


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