Overview
Comment:Had another go at causality ....
1. Impose external causality onto all port bonds
2. Set C_cause.m so that it DOESN'T set causality
-- I_cause is already ok !
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: b4b9bc1d47a457ea5b5b276b53e6fe379ca3ea0f1cb9d08f456585cee5ee41b7
User & Date: gawthrop@users.sourceforge.net on 1998-07-27 20:29:49
Other Links: branch diff | manifest | tags
Context
1998-07-27
20:30:12
*** empty log message *** check-in: 91db786a12 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
20:29:49
Had another go at causality ....
1. Impose external causality onto all port bonds
2. Set C_cause.m so that it DOESN'T set causality
-- I_cause is already ok !
check-in: b4b9bc1d47 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
20:27:25
Now get parameters for simpar file. check-in: aac26c96ba user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/m/abg2cbg.m from [d6db9ad5be] to [264898a1e7].

13
14
15
16
17
18
19



20
21
22
23
24
25
26
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29







+
+
+







% [bonds,status] = abg2cbg(system_name, system_type, full_name, port_bonds, infofile)

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.29  1998/07/10 09:01:42  peterg
% %% Added error + info file in new form
% %%
% %% Revision 1.28  1998/07/08 09:23:42  peterg
% %% Undid the previous change -- needs more thought.
% %%
% %% Revision 1.27  1998/07/03 19:03:31  peterg
% %% Always override the causality of port bonds!
% %%
% %% Revision 1.26  1998/06/27 13:24:04  peterg
229
230
231
232
233
234
235
236

237
238

239
240
241
242
243
244
245
232
233
234
235
236
237
238

239
240

241
242
243
244
245
246
247
248







-
+

-
+







  mtt_error(sprintf('%s: %1.0f port bonds incompatible with %1.0f ports', ...
               full_name, n_port_bonds, n_ports), errorfile);

  else % Copy the port bonds & status
    for j = 1:n_port_bonds
      jj = port_bond_index(j);
      for k = 1:2
	if bonds(jj,k)==0 % only copy if not already set
#	if bonds(jj,k)==0 % only copy if not already set
	bonds(jj,k) = port_bonds(j,k);
	end;
#	end;
      end;
      status(1:n_ports) = port_status;
    end
  end
else
  n_port_bonds=0;
end;
255
256
257
258
259
260
261
262

263
264
265
266
267
268
269
258
259
260
261
262
263
264

265
266
267
268
269
270
271
272







-
+







while( ci_index>0)
  ci_index
  old_done = inf;
  % Inner loop propagates causality
  while done~=old_done
   % disp(sprintf('Causality is %3.0f%s complete.', done, pc));
    old_done = done;
  
done,ci_index  
    for i = n_port_bonds+1:n_components % Miss out the ports 
      if status(i) ~= 0 % only do this if causality not yet complete

	% Get the bonds on this component
	comp = nozeros(components(i,:));
	bond_list = abs(comp);
	direction = sign(comp)'*[1 1];
329
330
331
332
333
334
335
336
337


338
339
340
341
342
343
344
345
346
347
348

349
350
351
352
353
354
355
356
357
358
359
360
361
362

363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380

381
382
383
384
385
386
387
332
333
334
335
336
337
338


339
340
341
342
343
344
345
346
347
348
349
350

351
352
353
354
355
356
357
358
359
360
361
362
363
364

365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382

383
384
385
386
387
388
389
390







-
-
+
+










-
+













-
+

















-
+







	    status(i) = 1;
	  else           % no component is overcausal but some are undercausal
	    status(i) = -1;
	  end;
	end;

      else % its a simple component -- or explicit causality defined
	% disp(['---', name, ' (', cause_name, ') ---']);
	% comp_bonds_in = comp_bonds;
#	disp(['---', name, ' (', cause_name, ') ---']);
#	comp_bonds_in = comp_bonds

	% Convert from arrow orientated to component orientated causality
	comp_bonds = comp_bonds.*direction;
	
        % Evaluate the built-in causality procedure
	eval([ '[comp_bonds,status(i)] = ', cause_name, '(comp_bonds);' ]);

        % and convert from component orientated to arrow orientated causality
        comp_bonds = comp_bonds.*direction; 
       
       % comp_bonds_out = comp_bonds;
#       comp_bonds_out = comp_bonds
      end;
      
      % Update the full bonds list
      bonds(bond_list,:) = comp_bonds;
    end;
    end;
    
    done = sum(sum(abs(bonds)))/total*100;
    %disp(sprintf('Causality is %3.0f%s complete.', done, pc), infofile));
    
  end;
  
  % Set causality of a C or I which is not already set
  [ci_index,prefered] = getdynamic(status,system_type);
  [ci_index,prefered] = getdynamic(status,system_type)
  if ci_index>0
    disp('Set causality of a C or I which is not already set')
    ci_bond_index = nozeros(components(ci_index,:)); # Get all bonds
    ci_direction = sign(ci_bond_index);
    ci_bond_index = abs(ci_bond_index);
    bonds(ci_bond_index,1:2) = prefered*ci_direction'*[1 1];
  end;
  
end;

% Print final causality
final_done =  (sum(status==zeros(n_components,1))/n_components)*100;

if at_top_level
  mtt_info(sprintf('Final causality of %s is %3.0f%s complete.', ...
      full_name, final_done, pc), infofile);

  if final_done<=100
  if final_done<100
	  mtt_error(sprintf("Unable to complete causality"),errorfile);
  end;
 
  % List overcausal bonds
  [over_causal_bonds,n] = getindex(status,1);
  if n>0
    for i=over_causal_bonds'


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