Overview
Comment:Added I component
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 594f3299a919ceafa3bc99e617a819ff2192568da99b58ed118a78a869940a8a
User & Date: gawthrop@users.sourceforge.net on 2000-01-26 10:11:10
Other Links: branch diff | manifest | tags
Context
2000-02-07
15:48:33
Initial revision check-in: 748ce71f3b user: gawthrop@users.sourceforge.net tags: origin/master, trunk
2000-01-26
10:11:10
Added I component check-in: 594f3299a9 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
2000-01-19
17:26:12
Now includes the representation title. check-in: 866bcd11d3 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

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

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.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







>
>
>







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.9  1999/11/10 00:47:08  peterg
## Replaced ifs by a table of cr/arg information
##
## 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
46
47
48
49
50
51
52

53
54
55
56
57
58
59
60
61





62

63
64
65
66
67
68
69


# P.J.Gawthrop March 1997
# Copyright (c) P.J.Gawthrop, 1997

infofile='mtt_info.txt'
typefile="$1_type.sh"


# Remove the old log file
rm -f abg2lbl_fig2txt.log
rm -f $1_cbg.m
rm -f $typefile
rm -f $infofile
rm -f mtt_junk*

#Inform user





echo Creating $1_lbl.txt


	( \
	echo "%% Label file for system $1 ($1_lbl.txt)"; \
	echo "%SUMMARY $1"; \
	echo "%DESCRIPTION "; \
	cat $MTTPATH/trans/m/rcs_header.txt; \
        )>mtt_junk_top.txt







>









>
>
>
>
>
|
>







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79


# P.J.Gawthrop March 1997
# Copyright (c) P.J.Gawthrop, 1997

infofile='mtt_info.txt'
typefile="$1_type.sh"
sensitivity=$2;

# Remove the old log file
rm -f abg2lbl_fig2txt.log
rm -f $1_cbg.m
rm -f $typefile
rm -f $infofile
rm -f mtt_junk*

#Inform user


if [ -n "$sensitivity" ]; then
    echo "Creating $1_lbl.txt (sensitivity version)"
else
    echo "Creating $1_lbl.txt"
fi

	( \
	echo "%% Label file for system $1 ($1_lbl.txt)"; \
	echo "%SUMMARY $1"; \
	echo "%DESCRIPTION "; \
	cat $MTTPATH/trans/m/rcs_header.txt; \
        )>mtt_junk_top.txt
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
136
137
138
139
140










#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";


      }
    }

    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";
    }
 }' > mtt_junk_body.txt

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
















>

|

>
|

>
>
>
>
>
>
>
>











|
|
>
|
|


|


|
|






>
|
>
>







|


>
>
>
>
>
>
>
>
>
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
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

#Write out the outline lbl file
grep -v  '\[[0-9]*\]'  $1_unique_raw_list | \
awk --field-separator ':' '
 BEGIN {
 }
 { 
  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);
    }
 }



    ## 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%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["TF"] = "lin";  arg["TF"]  = sprintf("flow,%s%s", $2, s_arg);
    cr["GY"] = "lin";  arg["GY"]  = sprintf("flow,%s%s", $2, s_arg);

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

  ## Component
    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










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