Differences From Artifact [e85e3a42b3]:

To Artifact [86c7f41797]:


11
12
13
14
15
16
17



18
19
20
21
22
23
24
% Acausal bond graph to causal bond graph: mfile format

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



% %% Revision 1.4  1996/08/08 08:30:06  peter
% %% The cbg filename contains the system name - this makes things easier
% %% when setting up the m to fig translation and m to ese translation
% %%
% %% Revision 1.3  1996/08/05 18:53:21  peter
% %% Fixed bug passing causality from subsystems.
% %%







>
>
>







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
% Acausal bond graph to causal bond graph: mfile format

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.5  1996/08/08 18:06:18  peter
% %% Unified file naming scheme
% %%
% %% Revision 1.4  1996/08/08 08:30:06  peter
% %% The cbg filename contains the system name - this makes things easier
% %% when setting up the m to fig translation and m to ese translation
% %%
% %% Revision 1.3  1996/08/05 18:53:21  peter
% %% Fixed bug passing causality from subsystems.
% %%
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
  end;
end;

% Set initial status
status = -ones(n_components,1);
total = 2*n_bonds;
done = sum(sum(abs(bonds)))/total*100;
% $$$ mtt_info(sprintf('Initial causality is %3.0f%s complete.', done, pc), infofile);

% Set the causality of the ports
old_done = inf;

while done~=old_done
  disp(sprintf('Causality is %3.0f%s complete.', done, pc));
  old_done = done;
  
  for i = 1:n_components







<

<







94
95
96
97
98
99
100

101

102
103
104
105
106
107
108
  end;
end;

% Set initial status
status = -ones(n_components,1);
total = 2*n_bonds;
done = sum(sum(abs(bonds)))/total*100;



old_done = inf;

while done~=old_done
  disp(sprintf('Causality is %3.0f%s complete.', done, pc));
  old_done = done;
  
  for i = 1:n_components
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132


133

134
135
136
137
138
139
140
    if strcmp(comp_type,'0')
      comp_type = 'zero';
    end;
    if strcmp(comp_type,'1')
      comp_type = 'one';
    end;
    
    % Component cuasality procedure name
    cause_name = [comp_type, '_cause'];
    
    % Invoke  the appropriate causality procedure
    if exist(cause_name)~=2 % Try a compound component
      disp('------------PUSH-----------------');
      [comp_bonds,s] = abg2cbg(name, comp_type, full_name, comp_bonds, ...
	  infofile);
      status(i)=max(abs(s));
      disp('------------POP-----------------');
    else % its a simple component


      eval([ '[comp_bonds,status(i)] = ', cause_name, '(comp_bonds);' ]);

    end;
    
    % Update the full bonds list
    % and convert from component orientated to arrow orientated causality
    bonds(bond_list,:) = comp_bonds.*direction; 
  end;








|










>
>

>







116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
    if strcmp(comp_type,'0')
      comp_type = 'zero';
    end;
    if strcmp(comp_type,'1')
      comp_type = 'one';
    end;
    
    % Component causality procedure name
    cause_name = [comp_type, '_cause'];
    
    % Invoke  the appropriate causality procedure
    if exist(cause_name)~=2 % Try a compound component
      disp('------------PUSH-----------------');
      [comp_bonds,s] = abg2cbg(name, comp_type, full_name, comp_bonds, ...
	  infofile);
      status(i)=max(abs(s));
      disp('------------POP-----------------');
    else % its a simple component
      disp(['---', name, ' (', cause_name, ') ---']);
      comp_bonds
      eval([ '[comp_bonds,status(i)] = ', cause_name, '(comp_bonds);' ]);
      comp_bonds
    end;
    
    % Update the full bonds list
    % and convert from component orientated to arrow orientated causality
    bonds(bond_list,:) = comp_bonds.*direction; 
  end;


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