Overview
Comment: | Initial revision |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
c0c8c76bd118fbbf264c0b4cf1a469de |
User & Date: | gawthrop@users.sourceforge.net on 1996-08-08 15:57:15 |
Other Links: | branch diff | manifest | tags |
Context
1996-08-08
| ||
16:19:08 | Initial revision check-in: 5a9d0b5681 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
15:57:15 | Initial revision check-in: c0c8c76bd1 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
15:52:28 |
Recursive version. Fails due to octave bug - reported. check-in: 78c082843d user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
Changes
Added mttroot/mtt/bin/trans/cbg2ese_m2r version [1990bfd309].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | #! /bin/sh ###################################### ##### Model Transformation Tools ##### ###################################### # Bourne shell script: cbg2ese_m # # # P.J.Gawthrop June 1996 # Copyright (c) P.J.Gawthrop, 1996. ############################################################### ## Version control history ############################################################### ## $Id$ ## ## $Log$ ############################################################### infofile='stdout'; eqnfile="$1_ese.r"; deffile="$1_def.r"; # Remove the old log file rm -f cbg2ese_m.log rm -f $1_ese.r rm -f $1_def.r rm -f mtt_info.txt #Inform user echo Creating $eqnfile echo Creating $1_def.r # Use matrix manipulation to accomplish the transformation $MATRIX > cbg2ese_m2r.log 2>> cbg2ese_m2r.log << EOF infofile = '$infofile' eqnfile = '$eqnfile' deffile = '$deffile' system_name = '$1' structure = cbg2ese(system_name,[],eqnfile,infofile) makedef(structure,deffile); EOF |
Added mttroot/mtt/bin/trans/m/cbg2ese.m version [8dd538a7e7].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | function structure = cbg2ese(system_name,bonds,eqnfile,infofile) % cbg2ese(system_name,bonds,infofile) % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %%%%% Model Transformation Tools %%%%% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Matlab function cbg2ese.m % Acausal bond graph to causal bond graph: mfile format % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% Version control history % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% $Id$ % %% $Log$ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% pc = '%'; if nargin<3 eqnfile = 'stdout'; end; if nargin<4 infofile = 'stdout'; end; % Evaluate the system function to get the bonds fun_name = [system_name, '_cbg'] if exist(fun_name)~=2 mtt_info(['m-file ', fun_name, ' does not exist'], infofile); else eval(['bonds=', fun_name, ';']); fun_name = [system_name, '_abg']; eval(['[junk,components]=', fun_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,name,cr,args] = ', system_name, '_cmp(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_type,comp_bonds,eqnfile); else % its a simple component eval(['structure = ', ... eqn_name, '(bond_list,comp_bonds,direction,cr,args,structure,eqnfile);' ]); end; end; end; |