Overview
Comment:Added separate handling of ports ( poss zero)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 16b65ab26f97a9b4124ef60427acc6feb020bf7504a0cc8f2ffcd60a998526d1
User & Date: gawthrop@users.sourceforge.net on 1998-12-14 15:27:32
Other Links: branch diff | manifest | tags
Context
1999-01-20
22:13:13
Now generates header using lang_header check-in: dffeaface9 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
1998-12-14
15:27:32
Added separate handling of ports ( poss zero) check-in: 16b65ab26f user: gawthrop@users.sourceforge.net tags: origin/master, trunk
15:19:36
Added missing "derivative_causality," argument to recursive call of
this function
check-in: 584472cf6d user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

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

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.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.







>
>
>
>







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

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.9  1998/08/25 06:43:02  peterg
% %% Revised (partially) for data strucures - needs to include graphic info
% %% in abg file.
% %%
% %% 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.
117
118
119
120
121
122
123
124
125
126
127
128









129
130
131
132
133
134
135

% 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;










% Rotation matrix
rot = [0 -1; 1 0];


% Determine coordinates of the arrow end of the bond and the other end
% and other geometry







|




>
>
>
>
>
>
>
>
>







121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148

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

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

[N_components, Columns] = size(CBG.subsystemlist);

if struct_contains(CBG,'portlist')
  [N_ports, Columns] = size(CBG.portlist);
else
  N_ports = 0;
end


% Rotation matrix
rot = [0 -1; 1 0];


% Determine coordinates of the arrow end of the bond and the other end
% and other geometry
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#  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
  for i = index_e % Do the effort stroke - opp. side to arrow

    if cbonds(i,1)==1 % Stroke at arrow end
      stroke_end_1 = arrow_end(i,:);
    else
      stroke_end_1 = other_end(i,:);
    end;







|


|







173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#  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_ef  = getindex(changed,1)';

% Print the new strokes in fig format
if index_ef(1,1)>0
  for i = index_e % Do the effort stroke - opp. side to arrow

    if cbonds(i,1)==1 % Stroke at arrow end
      stroke_end_1 = arrow_end(i,:);
    else
      stroke_end_1 = other_end(i,:);
    end;
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

240
241
242
243
244
245
246
247
248
    fprintf(filenum, '	%4.0f %4.0f %4.0f %4.0f \n', ...
	stroke_end_1(1), stroke_end_1(2), ...
	stroke_end_2(1), stroke_end_2(2) );
  end;
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';
  end
  if comp_type=='1'







|
>
>
>
>
>
>
>
>
>



|
|
|
|

|
|
|
|



|
>
>
>
>
>
>






>

|







223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
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
    fprintf(filenum, '	%4.0f %4.0f %4.0f %4.0f \n', ...
	stroke_end_1(1), stroke_end_1(2), ...
	stroke_end_2(1), stroke_end_2(2) );
  end;
end;

% Print all the components - coloured acording to causality.
for i = 1:N_ports+N_components
  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
  

  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'];   
  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\n', typename, 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';
  end
  if comp_type=='1'


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