Differences From Artifact [a1b272fd9e]:

To Artifact [dab3bd6334]:


1
2
3
4
5
6
7
8
9
10
11
12
13



14
15
16
17
18
19
20
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: rbg2abg_m
#
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$



## Revision 1.11  1998/07/25 16:14:44  peterg
## *** empty log message ***
##
## Revision 1.10  1998/07/08 15:34:56  peterg
## Sorted out error exit status
##
## Revision 1.9  1998/07/08 08:24:26  peterg













>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: rbg2abg_m
#
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.12  1998/07/28 19:07:48  peterg
## Writes out N_ports as well as n_ports
##
## Revision 1.11  1998/07/25 16:14:44  peterg
## *** empty log message ***
##
## Revision 1.10  1998/07/08 15:34:56  peterg
## Sorted out error exit status
##
## Revision 1.9  1998/07/08 08:24:26  peterg
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
  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;
 

  [bonds,components] = rbg2abg(name,rbonds,rstrokes,rcomponents,port_coord,port_name,\
                               infofile,errorfile);

  %Write the function m-file for the causal bond graph


  filename = '$1_abg.m';
  filenum = fopen(filename,'w');
  c = '%';
  fprintf(filenum, 'function [bonds,components,n_ports,N_ports] = $1_abg\n');
  fprintf(filenum, '%s [bonds,components,n_ports] = $1_abg\n', c);
  fprintf(filenum, '%s Acausal bond graph created by MTT on %s\n\n', ...
                     c, date);
  mat2mfile(bonds, 'bonds', filenum);
  mat2mfile(components, 'components', filenum);
  fprintf(filenum, 'n_ports = %1.0f;\n', n_ports);
  fprintf(filenum, 'N_ports = %1.0f;\n', N_ports);

EOF











if [ "$info" = "info" ]; then
  cat mtt_info.txt    
fi

if mtt_error mtt_error.txt
then
    exit 0







|



>
>
|
|
|
|
|
|
|
|
|
|
|



>
>
>
>
>

>
>
>
>







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

  [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);    

#  filename = '$1_abg.m';
#  filenum = fopen(filename,'w');
#  c = '%';
#  fprintf(filenum, 'function [bonds,components,n_ports,N_ports] = $1_abg\n');
#  fprintf(filenum, '%s [bonds,components,n_ports] = $1_abg\n', c);
#  fprintf(filenum, '%s Acausal bond graph created by MTT on %s\n\n', ...
#                     c, date);
#  mat2mfile(bonds, 'bonds', filenum);
#  mat2mfile(components, 'components', filenum);
#  fprintf(filenum, 'n_ports = %1.0f;\n', n_ports);
#  fprintf(filenum, 'N_ports = %1.0f;\n', N_ports);

EOF

# Append any VAR declarations
if [ -f "$1_lbl.txt" ]; then
  echo "# Explicit variable declarations" >> $1_abg.m
  grep '^[\s]*[%|#]VAR' $1_lbl.txt | tr '%' '#' >> $1_abg.m    
fi

## Close off the function
echo "endfunction" >> $1_abg.m

## Errors and info
if [ "$info" = "info" ]; then
  cat mtt_info.txt    
fi

if mtt_error mtt_error.txt
then
    exit 0

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