Overview
Comment:Changed arg to args to avoid strange octave bug
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: e0b4cd14a7634efc040c3118a537b470b43cba98f19f397e9af72a5ee25bcaf1
User & Date: gawthrop@users.sourceforge.net on 2004-08-09 14:47:28
Other Links: branch diff | manifest | tags
Context
2004-08-09
17:40:41
-O3 optimisation by default. check-in: ef03940915 user: geraint@users.sourceforge.net tags: origin/master, trunk
14:47:28
Changed arg to args to avoid strange octave bug check-in: e0b4cd14a7 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
14:44:41
Compatible with Octave 2.1.57 check-in: 2179807639 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/m/write_abg.m from [e3b347e99b] to [6d40a77baf].

1
2
3
4
5
6
7



8
9
10
11
12
13
14
function write_abg(system_name,bonds,connections,n_vector_bonds);

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$



## Revision 1.8  1999/10/18 22:41:41  peterg
## Corrected vector junction expansion
##
## Revision 1.7  1999/10/18 05:16:51  peterg
## Now vectorises 0 and 1 junctions !!
##
## Revision 1.6  1998/09/02 11:35:20  peterg







>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function write_abg(system_name,bonds,connections,n_vector_bonds);

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.9  2001/04/15 21:15:41  geraint
## Added interface definition rep: _ICD.(txt|c|cc|m).
##
## Revision 1.8  1999/10/18 22:41:41  peterg
## Corrected vector junction expansion
##
## Revision 1.7  1999/10/18 05:16:51  peterg
## Now vectorises 0 and 1 junctions !!
##
## Revision 1.6  1998/09/02 11:35:20  peterg
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
  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);"]);
    c = nozeros(connections(i,:));# Connections to this component
    m = length(c);		# Number of connections

    ## Vectorise junctions?
    n_bonds = n_vector_bonds(i);
    if strcmp(comp_type,"0")||strcmp(comp_type,"1")
            n_vector = m/n_bonds;







|







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
  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, args, repetitions] = ", system_name, "_cmp(i);"]);
    c = nozeros(connections(i,:));# Connections to this component
    m = length(c);		# Number of connections

    ## Vectorise junctions?
    n_bonds = n_vector_bonds(i);
    if strcmp(comp_type,"0")||strcmp(comp_type,"1")
            n_vector = m/n_bonds;
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
	  new_name = name;
	endif
	
	SubsystemList = [SubsystemList; new_name];
	fprintf(fid,"\n# Component %s\n", new_name);
	fprintf(fid,Sformat,system_name,new_name,"type",comp_type);
	fprintf(fid,Sformat,system_name,new_name,"cr",cr);
	fprintf(fid,Sformat,system_name,new_name,"arg",arg);
	fprintf(fid,Iformat,system_name,new_name,"repetitions",repetitions);
	fprintf(fid,Iformat,system_name,new_name,"status",-1);

	##Connections
	fprintf(fid,Cformat,system_name,new_name);
	## Each vector junction has n*m bonds
	## n - dimension of vector







|







79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
	  new_name = name;
	endif
	
	SubsystemList = [SubsystemList; new_name];
	fprintf(fid,"\n# Component %s\n", new_name);
	fprintf(fid,Sformat,system_name,new_name,"type",comp_type);
	fprintf(fid,Sformat,system_name,new_name,"cr",cr);
	fprintf(fid,Sformat,system_name,new_name,"arg",args);
	fprintf(fid,Iformat,system_name,new_name,"repetitions",repetitions);
	fprintf(fid,Iformat,system_name,new_name,"status",-1);

	##Connections
	fprintf(fid,Cformat,system_name,new_name);
	## Each vector junction has n*m bonds
	## n - dimension of vector
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
	endif;

	PortList = [PortList; name_i]; # Update port list
	
	fprintf(fid,"\n# Port %s\n", name_i); 
	fprintf(fid,PSformat,system_name,name_i,"type",comp_type);
	fprintf(fid,PSformat,system_name,name_i,"cr",cr);
	fprintf(fid,PSformat,system_name,name_i,"arg",arg);
	fprintf(fid,PIformat,system_name,name_i,"repetitions",repetitions);
	fprintf(fid,PIformat,system_name,name_i,"status",-1);
	
	fprintf(fid,PCformat,system_name,name_i);
      	fprintf(fid,"%i ", c(i_port));
	fprintf(fid,"];\n");








|







126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
	endif;

	PortList = [PortList; name_i]; # Update port list
	
	fprintf(fid,"\n# Port %s\n", name_i); 
	fprintf(fid,PSformat,system_name,name_i,"type",comp_type);
	fprintf(fid,PSformat,system_name,name_i,"cr",cr);
	fprintf(fid,PSformat,system_name,name_i,"arg",args);
	fprintf(fid,PIformat,system_name,name_i,"repetitions",repetitions);
	fprintf(fid,PIformat,system_name,name_i,"status",-1);
	
	fprintf(fid,PCformat,system_name,name_i);
      	fprintf(fid,"%i ", c(i_port));
	fprintf(fid,"];\n");


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