Overview
Comment:*** empty log message ***
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 49d12edd476451da3819d5c993eaaf59e94e7dbff14c32c73680e1aa21fbcf78
User & Date: gawthrop@users.sourceforge.net on 1996-12-31 11:42:36
Other Links: branch diff | manifest | tags
Context
1996-12-31
11:49:09
Don't copy port bond causality if already set -- allows subsystem
causality to be preset directely on named SS.
check-in: 084adb76c9 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
11:42:36
*** empty log message *** check-in: 49d12edd47 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
11:25:57
Clearer error messages for incorrect ports. check-in: 6a86eec1d3 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/m/abg2cbg.m from [2795ee140c] to [e9b917dd58].

1
2
3

4
5
6
7
8
9
10
11
12
13
14
15
16
17
18




19
20
21
22
23
24
25
function [port_bonds, status] = abg2cbg(system_name, ...
    system_type, full_name, ...
    port_bonds, typefile, infofile)

% abg2cbg - acausal to causal bg conversion
%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  abg2cbg.m
% Acausal bond graph to causal bond graph: mfile format
% [bonds,status] = abg2cbg(system_name, system_type, full_name, port_bonds, infofile)

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




% %% Revision 1.10  1996/12/04 21:48:55  peterg
% %% Compares full-name with empty string (instead of testing for zero
% %% length.
% %%
% %% Revision 1.9  1996/08/30  12:55:40  peter
% %% More heirachical stuff added.
% %%



>















>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function [port_bonds, status] = abg2cbg(system_name, ...
    system_type, full_name, ...
    port_bonds, typefile, infofile)

% abg2cbg - acausal to causal bg conversion
%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
%     %%%%% Model Transformation Tools %%%%%
%     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% Matlab function  abg2cbg.m
% Acausal bond graph to causal bond graph: mfile format
% [bonds,status] = abg2cbg(system_name, system_type, full_name, port_bonds, infofile)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.11  1996/12/07  17:10:48  peterg
% %% Allows port SS at top level - ie takes it to be an ardianry SS at top
% %% level.
% %%
% %% Revision 1.10  1996/12/04 21:48:55  peterg
% %% Compares full-name with empty string (instead of testing for zero
% %% length.
% %%
% %% Revision 1.9  1996/08/30  12:55:40  peter
% %% More heirachical stuff added.
% %%
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
% Find number of components
[n_components,columns] = size(components);
if n_components==0 % there is nothing to be done
  return
end;

% If not at top level, then sort out the port bonds.
if !at_top_level 
  % Find number of port bonds
  [n_port_bonds,columns] = size(port_bonds);

  % Check compatibility - if ok copy port bonds to the internal bonds list.
  if n_port_bonds~=n_ports
    mtt_info(sprintf('%1.0f port bonds incompatible with %1.0f ports', ...
	n_port_bonds, n_ports), infofile);







|







117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
% Find number of components
[n_components,columns] = size(components);
if n_components==0 % there is nothing to be done
  return
end;

% If not at top level, then sort out the port bonds.
if at_top_level==0 
  % Find number of port bonds
  [n_port_bonds,columns] = size(port_bonds);

  % Check compatibility - if ok copy port bonds to the internal bonds list.
  if n_port_bonds~=n_ports
    mtt_info(sprintf('%1.0f port bonds incompatible with %1.0f ports', ...
	n_port_bonds, n_ports), infofile);
241
242
243
244
245
246
247
248

249

250
251
252
253
254
255
256
    eval([ '[comp_type,name] = ', system_type, '_cmp(i);' ]);
    mtt_info(sprintf('Component %s (%s) is undercausal', name, comp_type), ...
      infofile);
  end;
end;

% $$$ file_name = [full_name, '_', system_type]
file_name = full_name;

write_cbg(file_name,system_type,bonds,status);


% Return the port bonds
for i = 1:n_ports % The port SSs come first
    j = abs(components(i,1)); % Get the bonds attached to the ports
    direction = -sign(components(i,1)); 
    port_bonds(i,:) = direction*bonds(j,:);
end;







|
>
|
>







246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
    eval([ '[comp_type,name] = ', system_type, '_cmp(i);' ]);
    mtt_info(sprintf('Component %s (%s) is undercausal', name, comp_type), ...
      infofile);
  end;
end;

% $$$ file_name = [full_name, '_', system_type]
file_name = [full_name, '_cbg.m']
cbgfilenum = fopen(file_name,'w');
write_cbg(cbgfilenum,full_name,system_type,bonds,status);
fclose(cbgfilenum);

% Return the port bonds
for i = 1:n_ports % The port SSs come first
    j = abs(components(i,1)); % Get the bonds attached to the ports
    direction = -sign(components(i,1)); 
    port_bonds(i,:) = direction*bonds(j,:);
end;


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