Overview
Comment:Added info messages a bit busy now!
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: fa1ab1c7c21f75ec80b939ea6291b922dc2d728b130dd928a8d19c5973c76947
User & Date: gawthrop@users.sourceforge.net on 1998-07-03 14:39:09
Other Links: branch diff | manifest | tags
Context
1998-07-03
14:43:24
Added parameter aliases check-in: 0a58b8e2d3 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
14:39:09
Added info messages a bit busy now! check-in: fa1ab1c7c2 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
14:01:43
Aliases for parameters check-in: 26ae39787b user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/m/cbg2ese.m from [9fa465f8d1] to [8a2f5d4fdd].

19
20
21
22
23
24
25



26
27
28
29
30
31
32
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35







+
+
+







% Structure matrix [states,nonstates,inputs,outputs,zero_outputs]

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.19  1998/04/12 11:58:19  peterg
% %% Rename port components by changing name_r to [name_r
% %%
% %% Revision 1.18  1998/04/11 18:59:16  peterg
% %% at_top_level now global - passed to SS components
% %%
% %% Revision 1.17  1998/04/04 10:47:31  peterg
% %% Uses (coerced) components from _cbg file - _abg not now used here.
% %%
% %% Revision 1.16  1998/03/06 09:38:58  peterg
127
128
129
130
131
132
133


134
135
136
137
138
139
140
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145







+
+







    pc, pc, full_name_repetition, ese_name);
fprintf(ese_file, '%s%s Generated by MTT\n\n', pc, pc);

% Evaluate the system function to get the bonds
  eval(['[bonds,status,system_type,components] = ', cbg_name, ';']);
  abg_name = [system_type, '_abg'];
  cmp_name = [system_type, '_cmp'];
  alias_name = [system_type, '_alias'];

% No longer needed - cbg now has components:  
%  eval(['[junk,components]=', abg_name, ';']);

  % Find number of bonds
  [n_bonds,columns] = size(bonds);
  if (columns ~= 2)&(n_bonds>0)
    error('Incorrect bonds matrix: must have 2 columns');
154
155
156
157
158
159
160
161


162
163

164
165























166
167
168

169
170

171
172
173
174
175
176
177
178
179
180
181

182
183
184
185
186
187
188
189
159
160
161
162
163
164
165

166
167
168

169
170

171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195

196
197

198
199
200
201
202
203
204
205
206
207


208

209
210
211
212
213
214
215







-
+
+

-
+

-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+


-
+

-
+









-
-
+
-







  
  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;
    

disp('---- Component ---');    
    % Get the component details
    eval([ '[comp_type,comp_name,cr,args,repetitions] = ', cmp_name, '(i);' ...
    eval([ '[comp_type,comp_name,cr,args,repetitions] = ', cmp_name, '(i)' ...
	  ]);
    
						   
    % Alias the args list
    eval([ "alias = ", alias_name ";"]);
    if is_struct(alias)
      if length(args>0)
        Args = split(args,";"); args="";
        [N,M]= size(Args);
        for i=1:N
           arg = deblank(Args(i,:));
          _arg = strrep(arg,",","__");
          if struct_contains(alias,_arg)
            eval(["new_arg = alias.", _arg, ";"]);
  	    mtt_info(["Replacing ", arg, "\t by ",\
            new_arg, " for component ", comp_name,\
            " (", comp_type,") within ", full_name]);
            arg = new_arg;
          end
          args = sprintf("%s;%s", args, arg);
        end
        args = substr(args,2); % loose leading ;
      end
    end;

    % Substitute positional ($1 etc) arguments
    cr = subs_arg(cr,system_cr, ...
	'lin',full_name,comp_type,comp_name,infofile);
	'lin',full_name,comp_type,comp_name);
    args = subs_arg(args,system_args, ...
	'1',full_name,comp_type,comp_name, infofile);
	'1',full_name,comp_type,comp_name);
    
    % 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;
    
    comp_type = comp_type
    ports = length(bond_list)
    ports = length(bond_list);
    repetitions = repetitions
    
    if repetitions>1
      port_pairs = ports/2;
      if round(port_pairs)~=port_pairs;
	mtt_info(['Repeated component ', comp_name, ...
	      ' has an odd number of ports - ignoring repetitions']);
	repetitions = 1;
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
345
346
347
348
349
350
351






352
353
354
355







-
-
-
-
-
-




	
      end;
    end;
  end;

  % Close the files
  fclose(ese_file);
  










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