1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
+
+
+
+
|
#! /bin/sh
######################################
##### Model Transformation Tools #####
######################################
# Bourne shell script: rbg2abg_m
#
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.19 2002/04/28 18:55:03 geraint
## Fixed [ 549658 ] awk should be gawk.
## Replaced calls to awk with call to gawk.
##
## Revision 1.18 2001/03/30 15:13:58 gawthrop
## Rationalised simulation modes to each return mtt_data
##
## Revision 1.17 2000/12/05 12:04:03 peterg
## Changed function name to name()
##
## Revision 1.16 2000/12/05 09:04:08 peterg
|
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
|
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
|
-
-
+
+
-
-
+
+
+
+
+
|
# Use matrix manipulation to accomplish the transformation
$MATRIX > rbg2abg_m.log 2>mtt_error.txt << EOF
name = '$1'
infofile = fopen('mtt_info.txt', 'w');
errorfile = fopen('mtt_error.txt', 'w');
%Convert from the fig version of the bonds to a structured version
[rbonds,rstrokes,rcomponents,port_coord,port_name,port_list] = $1_rbg;
[n_ports, junk] = size(port_list);
[rbonds,rstrokes,rcomponents,port_coord,port_name,port_list] = $1_rbg
[n_ports, junk] = size(port_list)
N_ports = 0;
for i=1:n_ports # Count the true number of ports.
[subport,n_sub] = split_port(port_list(i,:), ',');
N_ports = N_ports+n_sub;
end;
rbonds = rbonds(:,1:6); # Strip the directional information
[n_bonds,m_bonds] = size(rbonds);
if n_bonds>0
rbonds = rbonds(:,1:6); # Strip the directional information
endif
[bonds,components,n_vector_bonds] = rbg2abg(name,rbonds,rstrokes,rcomponents,port_coord,port_name,\
infofile,errorfile);
%Write the function m-file for the causal bond graph
write_abg(name,bonds,components,n_vector_bonds);
EOF
|