Overview
Comment:Changed %1.0f to %d format.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 9449b621f0e0648f4dc49832fe556cf5df2919e36b9fdc2d72afad9debd02b1e
User & Date: gawthrop@users.sourceforge.net on 1997-03-22 15:50:59
Other Links: branch diff | manifest | tags
Context
1997-03-22
17:09:11
Fixed bug in recursive cr.txt generation.
Fixed bug in recursive sympar.txt generation.
check-in: efcb3a59e0 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
15:50:59
Changed %1.0f to %d format. check-in: 9449b621f0 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
15:15:44
Ignores symbolic ($i) crs. check-in: 86bbc7c15d user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/lib/comp/simple/SS_eqn.m from [66c0b94308] to [756e73c8d6].

15
16
17
18
19
20
21




22
23
24
25
26
27
28

			
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$




% %% Revision 1.7  1996/12/07 17:17:40  peterg
% %% Added some ;
% %%
% %% Revision 1.6  1996/12/05 09:49:09  peterg
% %% Explicit computation of port number from string.
% %%
% %% Revision 1.5  1996/12/04 21:27:53  peterg







>
>
>
>







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

			
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.8  1996/12/10 16:52:29  peterg
% %% Detect null string using strcmp, not length.
% %% Put filnum argument to mtt_info.
% %%
% %% Revision 1.7  1996/12/07 17:17:40  peterg
% %% Added some ;
% %%
% %% Revision 1.6  1996/12/05 09:49:09  peterg
% %% Explicit computation of port number from string.
% %%
% %% Revision 1.5  1996/12/04 21:27:53  peterg
49
50
51
52
53
54
55


56
57
58
59
60
61
62
% internal indicates an internal variable
% anything else is the name of a constant.
% Blank is taken to be external
% If its a numbered port:
%     cr contains 'MTT_port'
%     arg contains port number



effort_attribute = cr;
flow_attribute = args;

if strcmp(effort_attribute,'')
  effort_attribute = 'external';
end;








>
>







53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
% internal indicates an internal variable
% anything else is the name of a constant.
% Blank is taken to be external
% If its a numbered port:
%     cr contains 'MTT_port'
%     arg contains port number

STDerr = 2; % Standard output

effort_attribute = cr;
flow_attribute = args;

if strcmp(effort_attribute,'')
  effort_attribute = 'external';
end;

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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167

if strcmp(effort_attribute, 'MTT_port') % Its a numbered port
  % Convert string to number
  port_number = abs(flow_attribute)-abs('0');

  % Effort 
  if bonds(1,1)==-1 % Source
    fprintf(filenum, '%s := %s_MTTu%1.0f;\n', ...
        varname(name, bond_number,1), name, port_number);
  else % Sensor
    fprintf(filenum, '%s_MTTy%1.0f := %s;\n', ...
        name, port_number, varname(name, bond_number,1));
  end;
  % Flow 
  if bonds(1,2)==1 % Source
    fprintf(filenum, '%s := %s_MTTu%1.0f;\n', ...
        varname(name, bond_number,-1), name, port_number);
  else % Sensor
    fprintf(filenum, '%s_MTTy%1.0f := %s;\n', ...
        name, port_number, varname(name, bond_number,-1));
  end;  
  return
end;


% Effort
if strcmp(effort_attribute, 'external')
  if bonds(1,1)==-1 % Source
    inputs = inputs+1;
    fprintf(filenum, '%s := MTTu(%1.0f,1);\n', ...
        varname(name, bond_number,1),inputs);
  else % Sensor
    outputs = outputs+1;
    fprintf(filenum, 'MTTy(%1.0f,1) := %s;\n', ...
        outputs, varname(name, bond_number,1));
  end;
elseif strcmp(effort_attribute, 'internal')
  % Do nothing
else % named constant
  if bonds(1,1)==-1 % Source
    fprintf(filenum, '%s := %s;\n', ...
	varname(name, bond_number,1), effort_attribute);
  else % Sensor
    if strcmp(effort_attribute, 'zero') %Zero output
      zero_outputs = zero_outputs + 1;
      fprintf(filenum, 'MTTyz%1.0f := %s;\n', ...
	  zero_outputs, varname(name, bond_number,1));
      fprintf(filenum, '%s := MTTUi%1.0f;\n', ...
	  varname(name, bond_number,-1), zero_outputs);
    else
      mtt_info([effort_attribute, ' not appropriate for an output '],filenum);
    end;
  end;
end;

% Flow
if strcmp(flow_attribute, 'external')
  if bonds(1,2)==1 % Source
    inputs = inputs+1;
    fprintf(filenum, '%s := MTTu(%1.0f,1);\n', varname(name, bond_number,-1),inputs);
  else % Sensor
    outputs = outputs+1;
    fprintf(filenum, 'MTTy(%1.0f,1) := %s;\n', outputs, ...
        varname(name, bond_number,-1));
  end;
elseif strcmp(flow_attribute, 'internal')
  % Do nothing
else % Named constant
  if bonds(1,2)==1 % Source
    fprintf(filenum, '%s := %s;\n', ...
	varname(name, bond_number,-1), flow_attribute);
  else % Sensor
    if strcmp(flow_attribute, 'zero') %Zero output
      zero_outputs = zero_outputs + 1;
      fprintf(filenum, 'MTTyz%1.0f := %s;\n', ...
	  zero_outputs, varname(name, bond_number,-1));
      fprintf(filenum, '%s := MTTUi%1.0f;\n', ...
	  varname(name, bond_number,1), zero_outputs);
    else
      mtt_info([effort_attribute, ' not appropriate for an output '], filenum);
    end;
  end;
end;

  
structure(3) = inputs;
structure(4) = outputs;
structure(5) = zero_outputs;  

  
  













|


|




|


|










|



|











|

|


|








|


|











|

|


|




<
<
<
<
<
<
<
<
<
<
<
<
<
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160














if strcmp(effort_attribute, 'MTT_port') % Its a numbered port
  % Convert string to number
  port_number = abs(flow_attribute)-abs('0');

  % Effort 
  if bonds(1,1)==-1 % Source
    fprintf(filenum, '%s := %s_MTTu%d;\n', ...
        varname(name, bond_number,1), name, port_number);
  else % Sensor
    fprintf(filenum, '%s_MTTy%d := %s;\n', ...
        name, port_number, varname(name, bond_number,1));
  end;
  % Flow 
  if bonds(1,2)==1 % Source
    fprintf(filenum, '%s := %s_MTTu%d;\n', ...
        varname(name, bond_number,-1), name, port_number);
  else % Sensor
    fprintf(filenum, '%s_MTTy%d := %s;\n', ...
        name, port_number, varname(name, bond_number,-1));
  end;  
  return
end;


% Effort
if strcmp(effort_attribute, 'external')
  if bonds(1,1)==-1 % Source
    inputs = inputs+1;
    fprintf(filenum, '%s := MTTu(%d,1);\n', ...
        varname(name, bond_number,1),inputs);
  else % Sensor
    outputs = outputs+1;
    fprintf(filenum, 'MTTy(%d,1) := %s;\n', ...
        outputs, varname(name, bond_number,1));
  end;
elseif strcmp(effort_attribute, 'internal')
  % Do nothing
else % named constant
  if bonds(1,1)==-1 % Source
    fprintf(filenum, '%s := %s;\n', ...
	varname(name, bond_number,1), effort_attribute);
  else % Sensor
    if strcmp(effort_attribute, 'zero') %Zero output
      zero_outputs = zero_outputs + 1;
      fprintf(filenum, 'MTTyz%d := %s;\n', ...
	  zero_outputs, varname(name, bond_number,1));
      fprintf(filenum, '%s := MTTUi%d;\n', ...
	  varname(name, bond_number,-1), zero_outputs);
    else
      mtt_info([effort_attribute, ' not appropriate for an output '],STDerr);
    end;
  end;
end;

% Flow
if strcmp(flow_attribute, 'external')
  if bonds(1,2)==1 % Source
    inputs = inputs+1;
    fprintf(filenum, '%s := MTTu(%d,1);\n', varname(name, bond_number,-1),inputs);
  else % Sensor
    outputs = outputs+1;
    fprintf(filenum, 'MTTy(%d,1) := %s;\n', outputs, ...
        varname(name, bond_number,-1));
  end;
elseif strcmp(flow_attribute, 'internal')
  % Do nothing
else % Named constant
  if bonds(1,2)==1 % Source
    fprintf(filenum, '%s := %s;\n', ...
	varname(name, bond_number,-1), flow_attribute);
  else % Sensor
    if strcmp(flow_attribute, 'zero') %Zero output
      zero_outputs = zero_outputs + 1;
      fprintf(filenum, 'MTTyz%d := %s;\n', ...
	  zero_outputs, varname(name, bond_number,-1));
      fprintf(filenum, '%s := MTTUi%d;\n', ...
	  varname(name, bond_number,1), zero_outputs);
    else
      mtt_info([effort_attribute, ' not appropriate for an output '], STDerr);
    end;
  end;
end;















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