19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
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.40 2001/02/05 01:50:29 geraint
## ## No unit type comparison at ports if either is "none".
## ##
## ## Revision 1.40 2000/12/16 08:10:55 geraint
## ## No unit type comparison at ports if either is "none".
## ##
## ## Revision 1.39 2000/11/16 12:54:14 peterg
## ## Added checking of unit consistency at ports
## ##
## ## Revision 1.38 2000/11/16 10:00:57 peterg
|
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
+
-
+
|
disp([cbg_name, " does not exist"]);
return
end;
## Setup files
ese_name = [full_name_repetition, "_ese.r"];
ese_file = fopen(ese_name, "w") # open file (first time)
icd_file = fopen([full_name_repetition,"_icd.txt2"],"w")
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, ";"]);
|
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
|
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
|
-
+
|
if AliasingCRs # Alias the CR list if appropriate
message = sprintf("\tfor component %s (%s) within %s",\
comp_name,subsystem.type,full_name);
if struct_contains(CBG,"alias")
subsystem.cr = alias_args(subsystem.cr,CBG.alias,";",message,infofilenum,full_name);
endif;
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, ...
"1",full_name,subsystem.type,comp_name,infofilenum);
## change name of 0 and 1 components -- matlab doesn't like numbers here
|
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
|
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
structure_name(which_index,:), value-k+1, ...
comp_name, full_name_repetition, comp_name, repetition);
endfor;
endfor;
endif;
endif
endfor
## component interface definition
if struct_contains(CBG,"icd")
if struct_contains(CBG.icd,comp_name)
if AliasingArguments
subsystem.icd = alias_args(eval(["CBG.icd.",comp_name]),CBG.alias,";",message,infofilenum,full_name);
endif
endif
if (struct_contains(subsystem,"icd"))
subsystem.icd = subs_arg(subsystem.icd,system_args, ...
"null",full_name,subsystem.type,comp_name,infofilenum);
fprintf(icd_file,"%s_%s\t%s\t",full_name_repetition,comp_name,subsystem.icd);
if (comp_bonds(1) == 1)
fprintf(icd_file,"output,");
elseif (comp_bonds(1) == -1)
fprintf(icd_file,"input,");
endif
if (comp_bonds(2) == 1)
fprintf(icd_file,"input\n");
elseif (comp_bonds(2) == -1)
fprintf(icd_file,"output\n");
endif
endif
endif # End of component interface definition
endfor # [subsystem,comp_name] = CBG_field
endif # struct_contains(CBG,field)
endfor # i=1:2
fclose(icd_file);
fclose(ese_file); # Close
endfunction
|