16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
## [bonds,status] = abg2cbg(system_name, system_type, full_name, port_bonds, infofile)
## ###############################################################
## ## Version control history
## ###############################################################
## ## $Id$
## ## $Log$
## ## Revision 1.46 2000/02/17 16:14:49 peterg
## ## *** empty log message ***
## ##
## ## Revision 1.45 1999/11/01 03:17:45 peterg
## ## Added extra info - current subsystem
## ##
## ## Revision 1.44 1999/03/11 23:54:11 peterg
|
>
>
>
|
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
## [bonds,status] = abg2cbg(system_name, system_type, full_name, port_bonds, infofile)
## ###############################################################
## ## Version control history
## ###############################################################
## ## $Id$
## ## $Log$
## ## Revision 1.47 2000/03/20 16:45:26 peterg
## ## *** empty log message ***
## ##
## ## Revision 1.46 2000/02/17 16:14:49 peterg
## ## *** empty log message ***
## ##
## ## Revision 1.45 1999/11/01 03:17:45 peterg
## ## Added extra info - current subsystem
## ##
## ## Revision 1.44 1999/03/11 23:54:11 peterg
|
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
|
end;
## Are we at the top level of the heirarchy?
at_top_level = strcmp(full_name, '');
## Create a file to contain shell commands which map subsystem types
## onto components
if at_top_level # Then at top level
fprintf(typefile, "# Commands to map types onto subsystems\n");
fprintf(typefile, "# File %s_type.sh\n", system_name);
fprintf(typefile, "# Generated by MTT at %s\n\n", ctime(time));
end;
## Create the (full) system name
if at_top_level
full_name = system_name;
system_type = system_name;
else
full_name = [full_name, "_", system_name];
end;
## Add to file to contain shell commands which map subsystem types
## onto components
fprintf(typefile, "$1%s$2%s$3\n", system_type, full_name);
fun_name = [system_type, "_abg"];
disp("====================================");
disp(["BEGIN: ", full_name, " (", fun_name, ")"]);
disp("====================================");
## If no such function - then there is nothing to be done.
|
|
|
|
|
|
<
<
<
<
<
|
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
end;
## Are we at the top level of the heirarchy?
at_top_level = strcmp(full_name, '');
## Create a file to contain shell commands which map subsystem types
## onto components
# if at_top_level # Then at top level
# fprintf(typefile, "# Commands to map types onto subsystems\n");
# fprintf(typefile, "# File %s_type.sh\n", system_name);
# fprintf(typefile, "# Generated by MTT at %s\n\n", ctime(time));
# end;
## Create the (full) system name
if at_top_level
full_name = system_name;
system_type = system_name;
else
full_name = [full_name, "_", system_name];
end;
fun_name = [system_type, "_abg"];
disp("====================================");
disp(["BEGIN: ", full_name, " (", fun_name, ")"]);
disp("====================================");
## If no such function - then there is nothing to be done.
|
484
485
486
487
488
489
490
491
492
493
494
495
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
|
if Done<100
mtt_error(sprintf("Unable to complete causality"),errorfile);
end;
endif # at_top_level
disp(["Writing ", full_name]);
write_cbg(full_name,system_type,ABG,Flipped);
## Return the port bonds - arrow orientated causality - and the direction
status=0;
if !at_top_level # Not at top level
port_bonds = ABG.bonds(port_bond_index,:); # Return port bonds
endif; # at top level
for [subsystem,name] = ABG.subsystems
if subsystem.status==-1 # Under causal
status=-1;
mtt_info(sprintf("Component %s (%s) is undercausal", name, subsystem.type), ...
infofile);
elseif subsystem.status==1; # Over causal
status=-1;
mtt_info(sprintf("Component %s (%s) is overcausal", name, subsystem.type), ...
infofile);
endif;
endfor; # [subsystem,name] = ABG.subsystems
status, port_bonds
disp("====================================");
disp(["END: ", full_name, " (", fun_name, ")"]);
disp("====================================");
endfunction;
|
|
<
>
>
>
>
>
>
>
>
<
|
<
<
<
<
<
|
482
483
484
485
486
487
488
489
490
491
492
493
494
495
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
|
if Done<100
mtt_error(sprintf("Unable to complete causality"),errorfile);
end;
endif # at_top_level
## Return the port bonds - arrow orientated causality - and the direction
status=0;
if !at_top_level # Not at top level
port_bonds = ABG.bonds(port_bond_index,:); # Return port bonds
endif; # at top level
for [subsystem,name] = ABG.subsystems
if subsystem.status==-1 # Under causal
status=-1;
mtt_info(sprintf("Component %s (%s) is undercausal", name, subsystem.type), ...
infofile);
elseif subsystem.status==1; # Over causal
status=-1;
mtt_info(sprintf("Component %s (%s) is overcausal", name, subsystem.type), ...
infofile);
endif;
endfor; # [subsystem,name] = ABG.subsystems
if (status==0) # write out the component .cbg file
disp(["Writing ", full_name]);
write_cbg(full_name,system_type,ABG,Flipped);
fprintf(typefile, "$1%s$2%s$3\n", system_type, full_name);
endif
status, port_bonds
disp("====================================");
disp(["END: ", full_name, " (", fun_name, ")"]);
disp("====================================");
endfunction;
|