Differences From Artifact [56bda1e9ba]:

To Artifact [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 ]