Overview
Comment:Revised (partially) for data strucures - needs to include graphic info
in abg file.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 8d920e434ff987babbf416aef80c7ae1c4e789b0ea206db7d5a8203256fa814f
User & Date: gawthrop@users.sourceforge.net on 1998-08-25 06:43:02
Other Links: branch diff | manifest | tags
Context
1998-08-25
06:44:40
Furhter revisions check-in: 8285d226a8 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
06:43:02
Revised (partially) for data strucures - needs to include graphic info
in abg file.
check-in: 8d920e434f user: gawthrop@users.sourceforge.net tags: origin/master, trunk
06:22:02
Initial revision check-in: 9b56187ca2 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/m/cbg2fig.m from [e41c48b167] to [77e3be8881].

22
23
24
25
26
27
28



29
30
31
32
33
34
35
% Copyright (c) P.J.Gawthrop, 1996.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$



% %% Revision 1.7  1997/08/19 09:49:19  peterg
% %% Modified to take account of the expanded vector bonds. Only displays
% %% causality corresponding to the bond connecting the first element of
% %% the vector ports.
% %%
% %% Revision 1.6  1997/08/19 09:41:47  peterg
% %% Some debugging lines added.







>
>
>







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
% Copyright (c) P.J.Gawthrop, 1996.

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.8  1998/04/04 10:45:01  peterg
% %% Don't do strokes on port bonds
% %%
% %% Revision 1.7  1997/08/19 09:49:19  peterg
% %% Modified to take account of the expanded vector bonds. Only displays
% %% causality corresponding to the bond connecting the first element of
% %% the vector ports.
% %%
% %% Revision 1.6  1997/08/19 09:41:47  peterg
% %% Some debugging lines added.
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108


109
110
111
112
113
114


115
116
117
118
119
120
121
  full_name = [full_name, '_', system_name];
end;

full_name_type = [full_name, '_', system_type];
% $$$ fig_name = [full_name_type, '_cbg.fig'];
fig_name = [full_name, '_cbg.fig']
 
% Return if cbg file doesn't exist
if exist(fig_name)~=2
  return
end;

% Setup file - append to the fig file
filenum = fopen(fig_name, 'a');

% Get the raw and the processed bonds
eval(['[rbonds,rstrokes,rcomponents] = ', system_type, '_rbg;']);
eval(['[bonds,components,n_ports] = ', system_type, '_abg;']);



% Original number of bonds
[n_bonds,junk] = size(rbonds);

% Get the causal bonds
eval(['[cbonds,status]=', full_name, '_cbg;']);



% Check sizes
[N_components,Columns] = size(rcomponents);
if (Columns ~= 13)
  error('Incorrect rcomponents matrix: must have 13 columns');
end;
M_components = Columns;







|









|
>
>





|
>
>







94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
  full_name = [full_name, '_', system_name];
end;

full_name_type = [full_name, '_', system_type];
% $$$ fig_name = [full_name_type, '_cbg.fig'];
fig_name = [full_name, '_cbg.fig']
 
% Return if initial fig file doesn't exist
if exist(fig_name)~=2
  return
end;

% Setup file - append to the fig file
filenum = fopen(fig_name, 'a');

% Get the raw and the processed bonds
eval(['[rbonds,rstrokes,rcomponents] = ', system_type, '_rbg;']);
%eval(['[bonds,components,n_ports] = ', system_type, '_abg;']);
eval(["ABG = ", system_type, "_abg;"]);
bonds=ABG.bonds;

% Original number of bonds
[n_bonds,junk] = size(rbonds);

% Get the causal bonds
%eval(['[cbonds,status]=', full_name, '_cbg;']);
eval(["CBG = ", full_name, "_cbg;"]);
cbonds=CBG.bonds;

% Check sizes
[N_components,Columns] = size(rcomponents);
if (Columns ~= 13)
  error('Incorrect rcomponents matrix: must have 13 columns');
end;
M_components = Columns;
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
  
% Get indices of bonds with changed causality -- but ignore the extra bonds
% due to vector bond expansion
changed_e = bonds(1:n_bonds,1)~=cbonds(1:n_bonds,1);
changed_f = bonds(1:n_bonds,2)~=cbonds(1:n_bonds,2);
changed = changed_e|changed_f;
% Don't do port bonds
if n_ports>0
  port_bonds = sort(abs(components(1:n_ports,1)));
  changed(port_bonds) = zeros(n_ports,1);
  changed_e(port_bonds) = zeros(n_ports,1);
  changed_f(port_bonds) = zeros(n_ports,1);
end

index_e  = getindex(changed_e,1)'
index_f  = getindex(changed_f,1)'
index  = getindex(changed,1)';

% Print the new strokes in fig format
if index(1,1)>0







|
|
|
|
|
|







151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
  
% Get indices of bonds with changed causality -- but ignore the extra bonds
% due to vector bond expansion
changed_e = bonds(1:n_bonds,1)~=cbonds(1:n_bonds,1);
changed_f = bonds(1:n_bonds,2)~=cbonds(1:n_bonds,2);
changed = changed_e|changed_f;
% Don't do port bonds
#if n_ports>0
#  port_bonds = sort(abs(components(1:n_ports,1)));
#  changed(port_bonds) = zeros(n_ports,1);
#  changed_e(port_bonds) = zeros(n_ports,1);
#  changed_f(port_bonds) = zeros(n_ports,1);
#end

index_e  = getindex(changed_e,1)'
index_f  = getindex(changed_f,1)'
index  = getindex(changed,1)';

% Print the new strokes in fig format
if index(1,1)>0
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
end;

% Print all the components - coloured acording to causality.
for i = 1:N_components
  fig_params = rcomponents(i,3:M_components);
  coords = rcomponents(i,1:2);
  
  if status(i)==-1  %Then under causal
    fig_params(3) = comp_colour_u;
    fig_params(6) = comp_font;
  end;

  if status(i)==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);']);

  Terminator = [bs, '001'];   
  for j = 1:length(fig_params)
    fprintf(filenum, '%1.0f ', fig_params(j));
  end;

  fprintf(filenum, '%1.0f %1.0f ', coords(1), coords(2)); 
  fprintf(filenum, '%s:%s%s\n', comp_type, comp_name, Terminator);
  
  % If it's a subsystem (ie not a component), do the fig file for that as
  % well
  if comp_type=='0'
    comp_type='zero';







|
|
|
|

|
|
|
|









>







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
240
241
242
243
244
245
246
end;

% Print all the components - coloured acording to causality.
for i = 1:N_components
  fig_params = rcomponents(i,3:M_components);
  coords = rcomponents(i,1:2);
  
#  if status(i)==-1  %Then under causal
#    fig_params(3) = comp_colour_u;
#    fig_params(6) = comp_font;
#  end;

#  if status(i)==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);']);

  Terminator = [bs, '001'];   
  for j = 1:length(fig_params)
    fprintf(filenum, '%1.0f ', fig_params(j));
  end;
  
  fprintf(filenum, '%1.0f %1.0f ', coords(1), coords(2)); 
  fprintf(filenum, '%s:%s%s\n', comp_type, comp_name, Terminator);
  
  % If it's a subsystem (ie not a component), do the fig file for that as
  % well
  if comp_type=='0'
    comp_type='zero';


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]