9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
format_hp = " %s.bonds.bond%i.head.ports\t= \"%s\";\n";
format_tp = " %s.bonds.bond%i.tail.ports\t= \"%s\";\n";
format_ce = " %s.bonds.bond%i.causality.effort\t= \"%s\";\n";
format_cf = " %s.bonds.bond%i.causality.flow\t= \"%s\";\n";
fprintf(fid, "## -*-octave-*-\n\n");
fprintf(fid, "function [%s] = %s_ibg\n\n", system_name, system_name);
fprintf(fid, " ## Intermediate bond graph representation of %s\n", \
system_name);
fprintf(fid, " ## Generated by MTT on %s\n", ctime(time));
fprintf(fid, " ## head refers to the harpoon end of a bond\n");
fprintf(fid, " ## tail refers to the other end of a bond\n");
fprintf(fid, " ## causality.? is the end at which ? is imposed\n\n");
for i=1:nbonds
fprintf(fid, "\n ## bond %i\n", i);
fprintf(fid, format_hc, system_name, i, \
eval(sprintf("bonds.bond%i.head.component", i)));
fprintf(fid, format_tc, system_name, i, \
eval(sprintf("bonds.bond%i.tail.component", i)));
fprintf(fid, format_hp, system_name, i, \
eval(sprintf("bonds.bond%i.head.ports", i)));
fprintf(fid, format_tp, system_name, i, \
eval(sprintf("bonds.bond%i.tail.ports", i)));
fprintf(fid, format_ce, system_name, i, \
eval(sprintf("bonds.bond%i.causality.effort", i)));
fprintf(fid, format_cf, system_name, i, \
eval(sprintf("bonds.bond%i.causality.flow", i)));
endfor;
fprintf(fid, "\nendfunction\n");
fclose(fid);
endfunction;
|
|
|
|
|
|
|
|
|
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
format_hp = " %s.bonds.bond%i.head.ports\t= \"%s\";\n";
format_tp = " %s.bonds.bond%i.tail.ports\t= \"%s\";\n";
format_ce = " %s.bonds.bond%i.causality.effort\t= \"%s\";\n";
format_cf = " %s.bonds.bond%i.causality.flow\t= \"%s\";\n";
fprintf(fid, "## -*-octave-*-\n\n");
fprintf(fid, "function [%s] = %s_ibg\n\n", system_name, system_name);
fprintf(fid, " ## Intermediate bond graph representation of %s\n", ...
system_name);
fprintf(fid, " ## Generated by MTT on %s\n", ctime(time));
fprintf(fid, " ## head refers to the harpoon end of a bond\n");
fprintf(fid, " ## tail refers to the other end of a bond\n");
fprintf(fid, " ## causality.? is the end at which ? is imposed\n\n");
for i=1:nbonds
fprintf(fid, "\n ## bond %i\n", i);
fprintf(fid, format_hc, system_name, i, ...
eval(sprintf("bonds.bond%i.head.component", i)));
fprintf(fid, format_tc, system_name, i, ...
eval(sprintf("bonds.bond%i.tail.component", i)));
fprintf(fid, format_hp, system_name, i, ...
eval(sprintf("bonds.bond%i.head.ports", i)));
fprintf(fid, format_tp, system_name, i, ...
eval(sprintf("bonds.bond%i.tail.ports", i)));
fprintf(fid, format_ce, system_name, i, ...
eval(sprintf("bonds.bond%i.causality.effort", i)));
fprintf(fid, format_cf, system_name, i, ...
eval(sprintf("bonds.bond%i.causality.flow", i)));
endfor;
fprintf(fid, "\nendfunction\n");
fclose(fid);
endfunction;
|