Differences From Artifact [9251859430]:

To Artifact [7be6568792]:


19
20
21
22
23
24
25



26
27
28
29
30
31
32
# Structure matrix [states,nonstates,inputs,outputs,zero_outputs]

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



# ## Revision 1.26  1998/08/24 14:53:55  peterg
# ## Uses new _cbg structure.
# ##
# ## Revision 1.25  1998/07/28 19:05:12  peterg
# ## Sttill has vector SS port bug?
# ##
# ## Revision 1.24  1998/07/27 10:26:02  peterg







>
>
>







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Structure matrix [states,nonstates,inputs,outputs,zero_outputs]

# ###############################################################
# ## Version control history
# ###############################################################
# ## $Id$
# ## $Log$
# ## Revision 1.27  1998/08/25 07:16:49  peterg
# ## Modified to data struture representation
# ##
# ## Revision 1.26  1998/08/24 14:53:55  peterg
# ## Uses new _cbg structure.
# ##
# ## Revision 1.25  1998/07/28 19:05:12  peterg
# ## Sttill has vector SS port bug?
# ##
# ## Revision 1.24  1998/07/27 10:26:02  peterg
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
  fprintf(ese_file, "\n%s%s Equation file for system %s (file %s)\n", ...
	  pc, pc, full_name_repetition, ese_name);
  fprintf(ese_file, "%s%s Generated by MTT\n\n", pc, pc);

# Evaluate the system function to get the bonds
  eval(["CBG = ", cbg_name, ";"]);
  #eval(["[bonds,status,system_type,components] = ", cbg_name, ";"]);
  abg_name = [system_type, "_abg"];
  cmp_name = [system_type, "_cmp"];
  alias_name = [system_type, "_alias"];

# No longer needed - cbg now has components:  
#  eval(["[junk,components]=", abg_name, ";"]);

  # Find number of bonds
  [n_bonds,columns] = size(CBG.bonds);
  if (columns ~= 2)&(n_bonds>0)







|
|
|







153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
  fprintf(ese_file, "\n%s%s Equation file for system %s (file %s)\n", ...
	  pc, pc, full_name_repetition, ese_name);
  fprintf(ese_file, "%s%s Generated by MTT\n\n", pc, pc);

# Evaluate the system function to get the bonds
  eval(["CBG = ", cbg_name, ";"]);
  #eval(["[bonds,status,system_type,components] = ", cbg_name, ";"]);
#  abg_name = [system_type, "_abg"];
#  cmp_name = [system_type, "_cmp"];
#  alias_name = [system_type, "_alias"];

# No longer needed - cbg now has components:  
#  eval(["[junk,components]=", abg_name, ";"]);

  # Find number of bonds
  [n_bonds,columns] = size(CBG.bonds);
  if (columns ~= 2)&(n_bonds>0)
186
187
188
189
190
191
192
193
194
195

196
197
198

199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222

  if (length(system_cr)==0)
    mtt_info(sprintf("No cr given so no cr aliasing done for system %s(%s)",\
		     system_name,system_type), infofilenum);
  endif;


  field=["ports";"subsystems"];	# Do for both ports and subsystems -
				# ports first
  for i=1:2

    if struct_contains(CBG,field(i,:));
      eval(["CBG_field = CBG.",field(i,:), ";"]);
      for [subsystem,comp_name] = CBG_field

				#comp = nozeros(components(i,:));
    	comp = subsystem.connections;
    	bond_list = abs(comp);
    	direction = sign(comp)'*[1 1];
				# Convert from arrow orientated to component orientated causality
    	comp_bonds = CBG.bonds(bond_list,:).*direction;
	
    	disp(["---- ", field(i,:), "Component ---"]);    
				# Get the component details
				#eval([ "[comp_type,comp_name,cr,args,repetitions] = ", cmp_name, "(i)"]);
    	
				# Alias the args list -- if not at top level
    	message = sprintf("\tfor component  %s (%s) within %s",\
			  comp_name,subsystem.type,full_name);    
    	if struct_contains(subsystem,"alias")
	  subsystem.arg = alias_args(subsystem.arg,subsystem.alias,";",message,infofilenum)
	  subsystem.cr = alias_args(subsystem.cr,subsystem.alias,";",message,infofilenum)
    	endif;

	
			# Substitute positional ($1 etc) arguments
    	subsystem.cr = subs_arg(subsystem.cr,system_cr, ...
				"lin",full_name,subsystem.type,comp_name,infofilenum);
    	subsystem.arg = subs_arg(subsystem.arg,system_args, ...







|


>
|
|

>







|






|
|
|







189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227

  if (length(system_cr)==0)
    mtt_info(sprintf("No cr given so no cr aliasing done for system %s(%s)",\
		     system_name,system_type), infofilenum);
  endif;


  fields=["ports";"subsystems"];	# Do for both ports and subsystems -
				# ports first
  for i=1:2
    field=deblank(fields(i,:));
    if struct_contains(CBG,field);
      eval(["CBG_field = CBG.",field, ";"]);
      for [subsystem,comp_name] = CBG_field
i,comp_name
				#comp = nozeros(components(i,:));
    	comp = subsystem.connections;
    	bond_list = abs(comp);
    	direction = sign(comp)'*[1 1];
				# Convert from arrow orientated to component orientated causality
    	comp_bonds = CBG.bonds(bond_list,:).*direction;
	
    	disp(["---- ", field, " ---"]);    
				# Get the component details
				#eval([ "[comp_type,comp_name,cr,args,repetitions] = ", cmp_name, "(i)"]);
    	
				# Alias the args list -- if not at top level
    	message = sprintf("\tfor component  %s (%s) within %s",\
			  comp_name,subsystem.type,full_name);    
    	if struct_contains(CBG,"alias")
	  subsystem.arg = alias_args(subsystem.arg,CBG.alias,";",message,infofilenum)
	  subsystem.cr = alias_args(subsystem.cr,CBG.alias,";",message,infofilenum)
    	endif;

	
			# Substitute positional ($1 etc) arguments
    	subsystem.cr = subs_arg(subsystem.cr,system_cr, ...
				"lin",full_name,subsystem.type,comp_name,infofilenum);
    	subsystem.arg = subs_arg(subsystem.arg,system_args, ...
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
	    	endfor;
 	      endfor;
 	    endif;
	    
	  end;
    	end;
      endfor			# [subsystem,comp_name] = CBG_field
    endif			# struct_contains(CBG,field(i,:))
  endfor			# i=1:2
  # Close the files
  fclose(ese_file);

endfunction










|








364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
	    	endfor;
 	      endfor;
 	    endif;
	    
	  end;
    	end;
      endfor			# [subsystem,comp_name] = CBG_field
    endif			# struct_contains(CBG,field)
  endfor			# i=1:2
  # Close the files
  fclose(ese_file);

endfunction




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