Index: mttroot/mtt/lib/comp/simple/SS_eqn.m ================================================================== --- mttroot/mtt/lib/comp/simple/SS_eqn.m +++ mttroot/mtt/lib/comp/simple/SS_eqn.m @@ -17,10 +17,14 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% 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. @@ -51,10 +55,12 @@ % 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'; @@ -73,22 +79,22 @@ % 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', ... + fprintf(filenum, '%s := %s_MTTu%d;\n', ... varname(name, bond_number,1), name, port_number); else % Sensor - fprintf(filenum, '%s_MTTy%1.0f := %s;\n', ... + 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%1.0f;\n', ... + fprintf(filenum, '%s := %s_MTTu%d;\n', ... varname(name, bond_number,-1), name, port_number); else % Sensor - fprintf(filenum, '%s_MTTy%1.0f := %s;\n', ... + fprintf(filenum, '%s_MTTy%d := %s;\n', ... name, port_number, varname(name, bond_number,-1)); end; return end; @@ -95,15 +101,15 @@ % Effort if strcmp(effort_attribute, 'external') if bonds(1,1)==-1 % Source inputs = inputs+1; - fprintf(filenum, '%s := MTTu(%1.0f,1);\n', ... + fprintf(filenum, '%s := MTTu(%d,1);\n', ... varname(name, bond_number,1),inputs); else % Sensor outputs = outputs+1; - fprintf(filenum, 'MTTy(%1.0f,1) := %s;\n', ... + fprintf(filenum, 'MTTy(%d,1) := %s;\n', ... outputs, varname(name, bond_number,1)); end; elseif strcmp(effort_attribute, 'internal') % Do nothing else % named constant @@ -111,28 +117,28 @@ 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', ... + fprintf(filenum, 'MTTyz%d := %s;\n', ... zero_outputs, varname(name, bond_number,1)); - fprintf(filenum, '%s := MTTUi%1.0f;\n', ... + fprintf(filenum, '%s := MTTUi%d;\n', ... varname(name, bond_number,-1), zero_outputs); else - mtt_info([effort_attribute, ' not appropriate for an output '],filenum); + 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(%1.0f,1);\n', varname(name, bond_number,-1),inputs); + fprintf(filenum, '%s := MTTu(%d,1);\n', varname(name, bond_number,-1),inputs); else % Sensor outputs = outputs+1; - fprintf(filenum, 'MTTy(%1.0f,1) := %s;\n', outputs, ... + fprintf(filenum, 'MTTy(%d,1) := %s;\n', outputs, ... varname(name, bond_number,-1)); end; elseif strcmp(flow_attribute, 'internal') % Do nothing else % Named constant @@ -140,28 +146,15 @@ 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', ... + fprintf(filenum, 'MTTyz%d := %s;\n', ... zero_outputs, varname(name, bond_number,-1)); - fprintf(filenum, '%s := MTTUi%1.0f;\n', ... + fprintf(filenum, '%s := MTTUi%d;\n', ... varname(name, bond_number,1), zero_outputs); else - mtt_info([effort_attribute, ' not appropriate for an output '], filenum); + mtt_info([effort_attribute, ' not appropriate for an output '], STDerr); end; end; end; - - -structure(3) = inputs; -structure(4) = outputs; -structure(5) = zero_outputs; - - - - - - - -