245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
|
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
|
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
-
+
+
+
+
|
end;
end;
## Print all the components - coloured acording to causality.
## Miss out the ports
for i = N_rports+1:N_rcomponents
eval(['[comp_type,comp_name] = ', system_type, '_cmp(i);']);
eval(["comp_status = CBG.subsystems.", comp_name, ".status;"]);
if i>N_ports # Subsystem
comp_name = CBG.subsystemlist(i-N_ports,:);
eval(["comp_status = CBG.subsystems.", comp_name, ".status;"]);
else
comp_name = CBG.portlist(i,:);
eval(["comp_status = CBG.ports.", comp_name, ".status;"]);
end
i,comp_name,N_rcomponents,N_rports
# if i>N_rports # Subsystem
# comp_name = CBG.subsystemlist(i-N_rports,:);
# eval(["comp_status = CBG.subsystems.", comp_name, ".status;"]);
# else
# comp_name = CBG.portlist(i,:);
# eval(["comp_status = CBG.ports.", comp_name, ".status;"]);
# end
fig_params = rcomponents(i,3:M_components);
coords = rcomponents(i,1:2);
if comp_status==-1 # Then under causal
fig_params(3) = comp_colour_u;
fig_params(6) = comp_font;
end;
if comp_status==1 # Then over causal
fig_params(3) = comp_colour_o;
fig_params(6) = comp_font;
end;
## Now print the component in fig format
eval(['[comp_type,comp_name] = ', system_type, '_cmp(i);']);
if index(comp_name,"mtt")==1 # Its a dummy name
typename = comp_type; # just show type
else
typename = [comp_type,":",comp_name];
endif;
Terminator = [bs, '001'];
Terminator = [bs, '001'];
real_index = 8;
for j = 1:length(fig_params)
if j==real_index
fprintf(filenum, '%2.4f ', fig_params(j));
else
fprintf(filenum, '%1.0f ', fig_params(j));
fprintf(filenum, '%i ', fig_params(j));
endif
endfor
fprintf(filenum, '%1.0f %1.0f ', coords(1), coords(2));
fprintf(filenum, '%s%s\n', typename, Terminator);
|