Index: mttroot/mtt/bin/trans/cbg2ese_m2r ================================================================== --- mttroot/mtt/bin/trans/cbg2ese_m2r +++ mttroot/mtt/bin/trans/cbg2ese_m2r @@ -14,10 +14,14 @@ ## Version control history ############################################################### ## $Id$ ## ## $Log$ +## Revision 1.8 1996/12/05 10:05:28 peterg +## Removed the Octave switch: empty_list_elements_ok = 1; +## This is now in .octaverc +## # Revision 1.7 1996/08/30 11:29:49 peter # Added constitutive relationship to argument list. # Put in explicit argument list to cbg2ese. # # Revision 1.6 1996/08/26 13:25:07 peterg @@ -45,40 +49,39 @@ deffile="$1_def.r"; # Remove the old log file rm -f cbg2ese_m.log rm -f $1_ese.r -rm -f $1_def.r -rm -f $infofile - -touch $infofile #Inform user echo Creating $eqnfile echo Creating $1_def.r # Use matrix manipulation to accomplish the transformation $RMATRIX > cbg2ese_m2r.log 2>mtt_error.txt << EOF infofile = '$infofile';; +infofilenum = fopen(infofile,'w'); +deffile = '$1_def.r'; +deffilenum = fopen(deffile,'w'); + system_name = '$1'; system_type = ''; system_cr = ''; system_args = ''; full_name = ''; full_name_repetition = ''; -deffile = '$1_def.r'; % Structure matrix [states,nonstates,inputs,outputs,zero_outputs] structure = zeros(1,5); structure = cbg2ese(system_name, system_type, system_cr, ... system_args, full_name, full_name_repetition, ... - 1, structure, infofile); -makedef(structure,deffile); + 1, structure, infofilenum); +makedef(structure,deffilenum); EOF cat $infofile Index: mttroot/mtt/bin/trans/m/makedef.m ================================================================== --- mttroot/mtt/bin/trans/m/makedef.m +++ mttroot/mtt/bin/trans/m/makedef.m @@ -1,12 +1,15 @@ -function makedef(structure,deffile); +function makedef(structure,deffilenum); % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% Version control history % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% $Id$ % %% $Log$ +% %% Revision 1.5 1996/11/09 21:05:44 peterg +% %% Only generates MTTIm when at least 2 states! +% %% % %% Revision 1.4 1996/08/30 19:42:36 peter % %% Added newline at end of file. % %% % %% Revision 1.3 1996/08/24 15:06:22 peter % %% Write `END;' at end to please reduce. @@ -16,80 +19,77 @@ % %% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -filenum = fopen(deffile,'w'); - states = structure(1); nonstates=structure(2); inputs=structure(3); outputs=structure(4); zero_outputs = structure(5); pc = '%'; % Declare reduce constants; -fprintf(filenum, 'MTTNx := %1.0f;\n', states); -fprintf(filenum, 'MTTNz := %1.0f;\n', nonstates); -fprintf(filenum, 'MTTNu := %1.0f;\n', inputs); -fprintf(filenum, 'MTTNy := %1.0f;\n', outputs); -fprintf(filenum, 'MTTNyz := %1.0f;\n', zero_outputs); +fprintf(deffilenum, 'MTTNx := %1.0f;\n', states); +fprintf(deffilenum, 'MTTNz := %1.0f;\n', nonstates); +fprintf(deffilenum, 'MTTNu := %1.0f;\n', inputs); +fprintf(deffilenum, 'MTTNy := %1.0f;\n', outputs); +fprintf(deffilenum, 'MTTNyz := %1.0f;\n', zero_outputs); % Declare reduce matrices -fprintf(filenum, '%s Declare reduce matrices\n', pc); +fprintf(deffilenum, '%s Declare reduce matrices\n', pc); if states>0 - fprintf(filenum, 'matrix MTTx(%1.0f,1);\n', states); - fprintf(filenum, 'matrix MTTdx(%1.0f,1);\n', states); + fprintf(deffilenum, 'matrix MTTx(%1.0f,1);\n', states); + fprintf(deffilenum, 'matrix MTTdx(%1.0f,1);\n', states); end; if nonstates>0 - fprintf(filenum, 'matrix MTTz(%1.0f,1);\n', nonstates); - fprintf(filenum, 'matrix MTTdz(%1.0f,1);\n', nonstates); + fprintf(deffilenum, 'matrix MTTz(%1.0f,1);\n', nonstates); + fprintf(deffilenum, 'matrix MTTdz(%1.0f,1);\n', nonstates); end; if inputs>0 - fprintf(filenum, 'matrix MTTu(%1.0f,1);\n', inputs); + fprintf(deffilenum, 'matrix MTTu(%1.0f,1);\n', inputs); end; if outputs>0 - fprintf(filenum, 'matrix MTTy(%1.0f,1);\n', outputs); + fprintf(deffilenum, 'matrix MTTy(%1.0f,1);\n', outputs); end; if zero_outputs>0 - fprintf(filenum, 'matrix MTTyz(%1.0f,1);\n', zero_outputs); - fprintf(filenum, 'matrix MTTui(%1.0f,1);\n', zero_outputs); + fprintf(deffilenum, 'matrix MTTyz(%1.0f,1);\n', zero_outputs); + fprintf(deffilenum, 'matrix MTTui(%1.0f,1);\n', zero_outputs); end; % Make an Nx x Nx unit matrix if states>0 - fprintf(filenum, 'matrix MTTI(%1.0f,%1.0f);\n', states,states); + fprintf(deffilenum, 'matrix MTTI(%1.0f,%1.0f);\n', states,states); for i = 1:states - fprintf(filenum, 'MTTI(%1.0f,%1.0f) := 1;\n', i, i); + fprintf(deffilenum, 'MTTI(%1.0f,%1.0f) := 1;\n', i, i); end end; % Make an Nx/2 x Nx/2 unit matrix if states>1 - fprintf(filenum, 'matrix MTTIm(%1.0f,%1.0f);\n', states/2,states/2); + fprintf(deffilenum, 'matrix MTTIm(%1.0f,%1.0f);\n', states/2,states/2); for i = 1:states/2 - fprintf(filenum, 'MTTIM(%1.0f,%1.0f) := 1;\n', i, i); + fprintf(deffilenum, 'MTTIM(%1.0f,%1.0f) := 1;\n', i, i); end end; % Set the y, yz, u, x and dx matrices -fprintf(filenum, '%s Set the y, yz, u and x matrices\n', pc); +fprintf(deffilenum, '%s Set the y, yz, u and x matrices\n', pc); for i=1:outputs - fprintf(filenum, 'MTTy(%1.0f,1) := MTTy%1.0f;\n', i, i); + fprintf(deffilenum, 'MTTy(%1.0f,1) := MTTy%1.0f;\n', i, i); end; for i=1:zero_outputs - fprintf(filenum, 'MTTyz(%1.0f,1) := MTTyz%1.0f;\n', i, i); - fprintf(filenum, 'MTTui(%1.0f,1) := MTTui%1.0f;\n', i, i); + fprintf(deffilenum, 'MTTyz(%1.0f,1) := MTTyz%1.0f;\n', i, i); + fprintf(deffilenum, 'MTTui(%1.0f,1) := MTTui%1.0f;\n', i, i); end; for i=1:inputs - fprintf(filenum, 'MTTu(%1.0f,1) := MTTu%1.0f;\n', i, i); + fprintf(deffilenum, 'MTTu(%1.0f,1) := MTTu%1.0f;\n', i, i); end; for i=1:states - fprintf(filenum, 'MTTx(%1.0f,1) := MTTx%1.0f;\n', i, i); + fprintf(deffilenum, 'MTTx(%1.0f,1) := MTTx%1.0f;\n', i, i); end; for i=1:nonstates - fprintf(filenum, 'MTTdz(%1.0f,1) := MTTdz%1.0f;\n', i, i); + fprintf(deffilenum, 'MTTdz(%1.0f,1) := MTTdz%1.0f;\n', i, i); end; -fprintf(filenum, 'END;\n'); -fclose(filenum); +fprintf(deffilenum, 'END;\n');