File mttroot/mtt/bin/trans/cse_r2tex artifact a29ae4ed19 part of check-in e2c406bf9d


#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: cse_r2tex
# Reduce constrained-state to LaTex constrained-state equations.
# P.J.Gawthrop 10th May 199, 8th August 1991, April 1994, Jan 1995
# Copyright (c) P.J.Gawthrop, 1991, 1994.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################

#Inform user
echo Creating $1_cse.tex

# Remove the old log file
rm -f cse_r2tex.log

# Use reduce to accomplish the transformation
reduce >cse_r2tex.log << EOF

%Read the definitions file
in "$1_def.r";

%Read the symbolic parameter file
in "$1_sympar.r";

%Read the constrained-state equations file
in "$1_cse.r";

OFF Echo;
OFF Nat;
%%%%OFF Exp; ON GCD;


%Change some names - rather yuccy
MTTx1 := MTTx!_1;
MTTx2 := MTTx!_2;
MTTx3 := MTTx!_3;
MTTx4 := MTTx!_4;
MTTx5 := MTTx!_5;
MTTx6 := MTTx!_6;
MTTx7 := MTTx!_7;
MTTx8 := MTTx!_8;
MTTx9 := MTTx!_9;

MTTdx1 := MTTdx!_1;
MTTdx2 := MTTdx!_2;
MTTdx3 := MTTdx!_3;
MTTdx4 := MTTdx!_4;
MTTdx5 := MTTdx!_5;
MTTdx6 := MTTdx!_6;
MTTdx7 := MTTdx!_7;
MTTdx8 := MTTdx!_8;
MTTdx9 := MTTdx!_9;

MTTu1 := MTTu!_1;
MTTu2 := MTTu!_2;
MTTu3 := MTTu!_3;
MTTu4 := MTTu!_4;
MTTu5 := MTTu!_5;
MTTu6 := MTTu!_6;
MTTu7 := MTTu!_7;
MTTu8 := MTTu!_8;
MTTu9 := MTTu!_9;

MTTdu1 := MTTdu!_1;
MTTdu2 := MTTdu!_2;
MTTdu3 := MTTdu!_3;
MTTdu4 := MTTdu!_4;
MTTdu5 := MTTdu!_5;
MTTdu6 := MTTdu!_6;
MTTdu7 := MTTdu!_7;
MTTdu8 := MTTdu!_8;
MTTdu9 := MTTdu!_9;




MTTy1 := MTTy!_1;
MTTy2 := MTTy!_2;
MTTy3 := MTTy!_3;
MTTy4 := MTTy!_4;
MTTy5 := MTTy!_5;
MTTy6 := MTTy!_6;
MTTy7 := MTTy!_7;
MTTy8 := MTTy!_8;
MTTy9 := MTTy!_9;

%ON Rounded;
%Precision 5;



OUT "$1_cse.tex";

%Write out the  constrained-state equations.

write "%File: $1_cse.tex";

write "%constrained-state equations";
	IF MTTNx>0 THEN
	FOR Row := 1:MTTNx DO
	BEGIN
		write"\begin{equation} \label{eq_$1_cse_X", Row, "}";
		write "\dot MTTEX_{", Row, "} = ";
		write "{";
		write MTTEdX(Row,1);
		write "}";
		write"\end{equation}";
	END;



	IF MTTNy>0 THEN
	FOR Row := 1:MTTNy DO
	BEGIN
		write"\begin{equation} \label{eq_$1_cse_y", Row, "}";
		write "MTTy_{", Row, "} = ";
		write "{";
		write MTTy(Row,1);
		write "}";
		write"\end{equation}";
	END;


IF MTTNx NEQ 0 THEN
BEGIN
write "%  - E matrix";
write "\begin{equation} \label{eq_$1_cse_E}";
write "MTTE = \left \matrix {";
	FOR Row := 1:MTTNx DO
	BEGIN
		FOR Col := 1:MTTNx DO
		BEGIN
			Write "{", MTTE(Row,Col), "}";
			IF Col<MTTNx THEN Write "&"
		END;

	IF Row<MTTNx THEN Write "\cr";
	END;
	Write "} \right";
write "\end{equation}";
END;



%write "%  - E matrix";
%write "\begin{eqnarray} \label{eq_$1_cse_Ea}";
%	FOR Row := 1:MTTNx DO
%	BEGIN
%	  FOR Col := 1:MTTNx DO %IF MTTE(Row,Col) NEQ 0 THEN
%	  BEGIN
%	      Write "MTTE_{", Row, Col, "} &=& {", MTTE(Row,Col), "}";
% 	      IF Row<MTTNx OR Col<MTTNx THEN Write "\cr";
%	  END;   
%	END;
%write "\end{eqnarray}";


SHUT "$1_cse.tex";
quit;
EOF


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