1
2
3
4
5
6
7
8
9
10
11
12
13
14
| function write_cbg(system_name,system_type,system,Flipped)
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.4 1998/08/26 12:26:17 peterg
## Replaced if N>0 by if (N>0)&&(M>0) # Flipped ports exist
##
## Revision 1.3 1998/08/25 20:05:33 peterg
## Write flipped port info
##
## Revision 1.2 1998/08/25 06:21:19 peterg
|
>
>
>
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| function write_cbg(system_name,system_type,system,Flipped)
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.5 2004/09/12 22:27:27 geraint
## Appended 't' to fopen mode string to open in text mode.
##
## Revision 1.4 1998/08/26 12:26:17 peterg
## Replaced if N>0 by if (N>0)&&(M>0) # Flipped ports exist
##
## Revision 1.3 1998/08/25 20:05:33 peterg
## Write flipped port info
##
## Revision 1.2 1998/08/25 06:21:19 peterg
|
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
| fprintf(fid,"# Generated by MTT on %s",ctime(time));
fprintf(fid,"# The file is in Octave format\n");
fprintf(fid,"\n# Acausal bond graph structure\n");
fprintf(fid," [%s] = %s_abg;\n", system_name, system_type);
fprintf(fid,"\n# Status information\n");
# if struct_contains(system,"ports")
# for [port,name]=system.ports
# fprintf(fid,StatusFormat,system_name,"ports",name,port.status);
# endfor;
# endif
if struct_contains(system,"subsystems")
for [subsystem,name]=system.subsystems
fprintf(fid,StatusFormat,system_name,"subsystems",name,subsystem.status);
endfor;
endif
[N,M]=size(system.bonds); # Bonds
fprintf(fid,"\n# Causal bond information\n");
|
|
|
| 35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
| fprintf(fid,"# Generated by MTT on %s",ctime(time));
fprintf(fid,"# The file is in Octave format\n");
fprintf(fid,"\n# Acausal bond graph structure\n");
fprintf(fid," [%s] = %s_abg;\n", system_name, system_type);
fprintf(fid,"\n# Status information\n");
# if isfield(system,"ports")
# for [port,name]=system.ports
# fprintf(fid,StatusFormat,system_name,"ports",name,port.status);
# endfor;
# endif
if isfield(system,"subsystems")
for [subsystem,name]=system.subsystems
fprintf(fid,StatusFormat,system_name,"subsystems",name,subsystem.status);
endfor;
endif
[N,M]=size(system.bonds); # Bonds
fprintf(fid,"\n# Causal bond information\n");
|