115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
if (strcmp(cr,"SS")) # Then its the standard file
a = split(args,",");
[N,M]=size(a);
if (N~=2) # Must have 2 arguments
mtt_error(sprintf("SS should have 2 args not %i", N));
else
effort_attribute = a(1,:);
flow_attribute = a(2,:);
end;
else # Old style file
effort_attribute = cr;
flow_attribute = args;
# mtt_info(sprintf("SS component: Hmm... looks like an old-style label file"));
end;
|
|
|
|
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
if (strcmp(cr,"SS")) # Then its the standard file
a = split(args,",");
[N,M]=size(a);
if (N~=2) # Must have 2 arguments
mtt_error(sprintf("SS should have 2 args not %i", N));
else
effort_attribute = deblank(a(1,:));
flow_attribute = deblank(a(2,:));
end;
else # Old style file
effort_attribute = cr;
flow_attribute = args;
# mtt_info(sprintf("SS component: Hmm... looks like an old-style label file"));
end;
|
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
|
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(sname, bond_number,-1),inputs);
else % Sensor
outputs = outputs+1;
fprintf(filenum, "MTTy(%d,1) := %s;\n", outputs, ...
varname(sname, bond_number,-1));
end;
elseif strcmp(flow_attribute, "unknown") % Unknown input
unknown_inputs = unknown_inputs + 1;
fprintf(filenum, "%s := MTTUi%d;\n", ...
varname(sname, bond_number,-1), unknown_inputs);
elseif strcmp(flow_attribute, "internal")
% Do nothing
else % Named constant
if bonds(1,2)==1 % Source
fprintf(filenum, "%s := %s;\n", ...
varname(sname, 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(sname, bond_number,-1));
else
mtt_error([flow_attribute, " not appropriate for an output "]);
end;
end;
end;
|
|
|
|
|
|
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
|
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(sname, bond_number,-1),inputs);
else % Sensor
outputs = outputs+1
fprintf(filenum, "MTTy(%d,1) := %s;\n", outputs, ...
varname(sname, bond_number,-1));
end;
elseif strcmp(flow_attribute, "unknown") % Unknown input
unknown_inputs = unknown_inputs + 1
fprintf(filenum, "%s := MTTUi%d;\n", ...
varname(sname, bond_number,-1), unknown_inputs);
elseif strcmp(flow_attribute, "internal")
% Do nothing
else % Named constant
if bonds(1,2)==1 % Source
fprintf(filenum, "%s := %s;\n", ...
varname(sname, 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(sname, bond_number,-1));
else
mtt_error([flow_attribute, " not appropriate for an output "]);
end;
end;
end;
|