Overview
| Comment: | Now writes out list of ports ans list of subsystems. These ordereded lists determine the order of processing of ports ans subsystems. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | origin/master | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
7428a2fda51cc2572fcbd0e64f6b789e |
| User & Date: | gawthrop@users.sourceforge.net on 1998-09-02 10:30:30.000 |
| Other Links: | branch diff | manifest | tags |
Context
|
1998-09-02
| ||
| 11:14:23 | Revised to use ordered lists of subsystems and ports check-in: 7e28516b8e user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
| 10:30:30 |
Now writes out list of ports ans list of subsystems. These ordereded lists determine the order of processing of ports ans subsystems. check-in: 7428a2fda5 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
|
1998-08-31
| ||
| 11:43:37 | Now lower cases globals in numpar files check-in: ee53e006ef user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/bin/trans/m/write_abg.m
from [bf29cb17dc]
to [d549e629cc].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | function write_abg(system_name,bonds,connections); ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.3 1998/08/26 12:31:07 peterg ## numerical names prefixed by mtt ## ## Revision 1.2 1998/08/26 11:59:20 peterg ## Don't use strrep to remove[] ## ## Revision 1.1 1998/08/25 06:22:02 peterg | > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | function write_abg(system_name,bonds,connections); ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ ## Revision 1.4 1998/08/26 12:45:38 peterg ## Just prefix ports (comps can't start with numeral) ## Prefix with mttp ## ## Revision 1.3 1998/08/26 12:31:07 peterg ## numerical names prefixed by mtt ## ## Revision 1.2 1998/08/26 11:59:20 peterg ## Don't use strrep to remove[] ## ## Revision 1.1 1998/08/25 06:22:02 peterg |
| ︙ | ︙ | |||
28 29 30 31 32 33 34 | Bformat = " %s.bonds = [\n"; fprintf(fid,"function [%s] = %s_abg\n", system_name, system_name); fprintf(fid,"# This function is the acausal bond graph representation of %s\n",system_name); fprintf(fid,"# Generated by MTT on %s",ctime(time)); fprintf(fid,"# The file is in Octave format\n"); | < | > | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
Bformat = " %s.bonds = [\n";
fprintf(fid,"function [%s] = %s_abg\n", system_name, system_name);
fprintf(fid,"# This function is the acausal bond graph representation of %s\n",system_name);
fprintf(fid,"# Generated by MTT on %s",ctime(time));
fprintf(fid,"# The file is in Octave format\n");
fprintf(fid,"\n# Subsystems and Ports\n");
i_port=0; SubsystemList = ""; PortList ="";
for i=1:N
eval(["[comp_type, name, cr, arg, repetitions] = ", system_name, "_cmp(i);"]);
if index(name,"[")==0 # Not a port
SubsystemList = [SubsystemList; name];
fprintf(fid,"\n# Component %s\n", name);
fprintf(fid,Sformat,system_name,name,"type",comp_type);
fprintf(fid,Sformat,system_name,name,"cr",cr);
fprintf(fid,Sformat,system_name,name,"arg",arg);
fprintf(fid,Iformat,system_name,name,"repetitions",repetitions);
c = nozeros(connections(i,:));# Connections to this component
|
| ︙ | ︙ | |||
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
else
name=name(2:length(name)-1); # Strip []
ch=name(1); # First char of name
if (ch>="0")&&(ch<="9") # Its a numeral
name=["mttp",name]; # prefix by mttp
endif;
fprintf(fid,"\n# Port %s\n", name);
fprintf(fid,PIformat,system_name,name,"index",++i_port);
fprintf(fid,PSformat,system_name,name,"type",comp_type);
fprintf(fid,PSformat,system_name,name,"cr",cr);
fprintf(fid,PSformat,system_name,name,"arg",arg);
fprintf(fid,PIformat,system_name,name,"repetitions",repetitions);
c = nozeros(connections(i,:));# Connections to this component
m = length(c); # Number of connections
fprintf(fid,PCformat,system_name,name);
for j=1:m
fprintf(fid,"%i ", c(j));
endfor;
fprintf(fid,"];\n");
endif;
endfor;
| > > > > > > > > | > > > > > > > > > | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 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 |
else
name=name(2:length(name)-1); # Strip []
ch=name(1); # First char of name
if (ch>="0")&&(ch<="9") # Its a numeral
name=["mttp",name]; # prefix by mttp
endif;
PortList = [PortList; name];
fprintf(fid,"\n# Port %s\n", name);
fprintf(fid,PIformat,system_name,name,"index",++i_port);
fprintf(fid,PSformat,system_name,name,"type",comp_type);
fprintf(fid,PSformat,system_name,name,"cr",cr);
fprintf(fid,PSformat,system_name,name,"arg",arg);
fprintf(fid,PIformat,system_name,name,"repetitions",repetitions);
c = nozeros(connections(i,:));# Connections to this component
m = length(c); # Number of connections
fprintf(fid,PCformat,system_name,name);
for j=1:m
fprintf(fid,"%i ", c(j));
endfor;
fprintf(fid,"];\n");
endif;
endfor;
[N,M]=size(PortList);
if N>0 # Put name in list
fprintf(fid,"\n# Ordered list of Port names\n");
for i=1:N
fprintf(fid," %s.portlist(%i,:) = \"%s\";\n", system_name, i, PortList(i,:));
endfor;
endif;
[N,M]=size(SubsystemList);
if N>0 # Put name in list
fprintf(fid,"\n# Ordered list of subsystem names\n");
for i=1:N
fprintf(fid," %s.subsystemlist(%i,:) = \"%s\";\n", system_name, i, SubsystemList(i,:));
endfor;
endif;
fprintf(fid,"\n# Bonds \n");
[N,M]=size(bonds); # Bonds
fprintf(fid,Bformat,system_name);
for i=1:N
fprintf(fid," ");
for j=1:M
fprintf(fid,"%i ", bonds(i,j));
|
| ︙ | ︙ |