Overview
| Comment: | Sorted out file naming sceme |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | origin/master | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
6804a09be35f496345570d81c047b3dd |
| User & Date: | gawthrop@users.sourceforge.net on 1996-08-08 18:08:11.000 |
| Other Links: | branch diff | manifest | tags |
Context
|
1996-08-08
| ||
| 18:08:37 | Sorted out file naming scheme. check-in: 8643f0088a user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
| 18:08:11 | Sorted out file naming sceme check-in: 6804a09be3 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
| 18:07:31 | Sorted out naming scheme for files check-in: 708dd6c35f user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/bin/trans/m/cbg2ese.m
from [8dd538a7e7]
to [f07d43dd6f].
|
| | < > > > | > | | < > > | > | > > > > > > > | > > > > > | | | | > > > > > > > > > > > | 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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
function structure = cbg2ese(system_name, system_type, full_name, infofile)
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%% Model Transformation Tools %%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Matlab function cbg2ese.m
% Acausal bond graph to causal bond graph: mfile format
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.1 1996/08/08 15:53:23 peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
pc = '%';
if nargin<3
eqnfile = 'stdout';
end;
if nargin<4
infofile = 'stdout';
end;
% Create the (full) system name
if length(full_name)==0
full_name = system_name;
system_type = system_name;
else
full_name = [full_name, '_', system_name];
end;
full_name_type = [full_name, '_', system_type];
ese_name = [system_name, '_ese.r'];
cbg_name = [full_name_type, '_cbg'];
abg_name = [system_type, '_abg'];
cmp_name = [system_type, '_cmp'];
% Return if cbg file doesn't exist
if exist(cbg_name)~=2
return
end;
% Setup file
filenum = fopen(ese_name, 'w');
% Evaluate the system function to get the bonds
eval(['[junk,components]=', abg_name, ';']);
eval(['bonds=', cbg_name, ';']);
% Find number of bonds
[n_bonds,columns] = size(bonds);
if (columns ~= 2)&(n_bonds>0)
error('Incorrect bonds matrix: must have 2 columns');
end;
% Find number of components
[n_components,columns] = size(components);
%Structure matrix [states,nonstates,inputs,outputs]
structure = zeros(1,4);
for i = 1:n_components
comp = nozeros(components(i,:));
bond_list = abs(comp);
direction = sign(comp)'*[1 1];
% Convert from arrow orientated to component orientated causality
comp_bonds = bonds(bond_list,:).*direction;
eval([ '[comp_type,comp_name,cr,args] = ', cmp_name, '(i);' ]);
% change name of 0 and 1 components -- matlab doesn't like numbers here
if strcmp(comp_type,'0')
comp_type = 'zero';
end;
if strcmp(comp_type,'1')
comp_type = 'one';
end;
% Invoke the appropriate equation-generating procedure
eqn_name = [comp_type, '_eqn']
if exist(eqn_name)~=2 % Try a compound component
cbg2ese(comp_name, comp_type, full_name, infofile);
else % its a simple component
eval(['structure = ', ...
eqn_name, '(bond_list,comp_bonds,direction,cr,args,structure,filenum);' ]);
end;
end;
fclose(filenum);
|