Overview
Comment: | Argument substitution implemented. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
aa1d5449a44ff091549879a352e4c4ff |
User & Date: | gawthrop@users.sourceforge.net on 1996-08-30 11:23:13 |
Other Links: | branch diff | manifest | tags |
Context
1996-08-30
| ||
11:29:49 |
Added constitutive relationship to argument list. Put in explicit argument list to cbg2ese. check-in: 4fb1bcb629 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
11:23:13 | Argument substitution implemented. check-in: aa1d5449a4 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
11:10:37 | More files in clean up. check-in: 310ce6b99f user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/bin/trans/m/cbg2ese.m from [0dd01471dd] to [7ba39af301].
|
| | > > > > | 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 | function structure = cbg2ese(system_name, system_type, system_cr, ... system_args, full_name, ... repetition,... structure, infofile) % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %%%%% Model Transformation Tools %%%%% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Matlab function cbg2ese.m % Acausal bond graph to causal bond graph: mfile format % Structure matrix [states,nonstates,inputs,outputs,zero_outputs] % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% Version control history % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% $Id$ % %% $Log$ % %% Revision 1.6 1996/08/27 08:04:52 peterg % %% Handles complex components and repetative components. % %% % %% Revision 1.5 1996/08/24 15:02:23 peter % %% Writes `END;' to keep reduce happy. % %% % %% Revision 1.4 1996/08/19 09:03:41 peter % %% Handles repeating components. % %% % %% Revision 1.3 1996/08/18 20:08:02 peter |
︙ | ︙ | |||
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 | if exist(cbg_name)~=2 return end; % Setup file ese_name = sprintf('%s_%1.0f_ese.r', full_name, repetition); 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); n_components = n_components 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; | > > > > > | > > > > > > | 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 101 102 103 104 105 106 | if exist(cbg_name)~=2 return end; % Setup file ese_name = sprintf('%s_%1.0f_ese.r', full_name, repetition); filenum = fopen(ese_name, 'w'); fprintf(filenum, '\n%s%s Equation file for system %s (file %s)\n', ... pc, pc, full_name, ese_name); fprintf(filenum, '%s%s Generated by MTT\n\n', pc, pc); % 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); n_components = n_components 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; % Get the component details eval([ '[comp_type,comp_name,cr,args,repetitions] = ', cmp_name, '(i);' ... ]); % Substitute positional ($1 etc) arguments cr = subs_arg(cr,system_cr); args = subs_arg(args,system_args); % 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; |
︙ | ︙ | |||
126 127 128 129 130 131 132 133 134 | bond_list(2:2:ports) = new_bonds; end; end; % Invoke the appropriate equation-generating procedure name_r = sprintf('%s_%1.0f', full_name, repetition); eqn_name = [comp_type, '_eqn'] if exist(eqn_name)~=2 % Try a compound component disp('---PUSH---'); | > | > | > > | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | bond_list(2:2:ports) = new_bonds; end; end; % Invoke the appropriate equation-generating procedure name_r = sprintf('%s_%1.0f', full_name, repetition); eqn_name = [comp_type, '_eqn'] if exist(eqn_name)~=2 % Try a compound component disp('---PUSH---'); structure = cbg2ese(comp_name, comp_type, cr, args, full_name, k, ... structure, infofile); % Link up the bonds fprintf(filenum, ... '\n\t%s Equations linking up subsystem %s (%s)\n\n', ... pc, comp_name, comp_type); name_comp_name = sprintf('%s_%s_%1.0f', full_name, comp_name, k); for port_number=1:length(bond_list) % Effort if comp_bonds(port_number,1)==1 % Source fprintf(filenum, '%s_MTT_inport_%1.0f := %s;\n', ... name_comp_name, port_number, varname(name_r, ... |
︙ | ︙ | |||
159 160 161 162 163 164 165 166 167 168 169 170 171 172 | varname(name_r, ... bond_list(port_number),-1), name_comp_name, port_number); end; end; disp('---POP---'); else % its a simple component eval(['structure = ', ... eqn_name, ... '(name_r,bond_list,comp_bonds,direction,cr,args,structure,filenum);' ]); end; end; end; | > > > | 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | varname(name_r, ... bond_list(port_number),-1), name_comp_name, port_number); end; end; disp('---POP---'); else % its a simple component fprintf(filenum, '\n\t%s Equations for component %s (%s)\n\n', ... pc, comp_name, comp_type); eval(['structure = ', ... eqn_name, ... '(name_r,bond_list,comp_bonds,direction,cr,args,structure,filenum);' ]); end; end; end; |
︙ | ︙ |