File mttroot/mtt/bin/trans/cse_r2tex artifact c81c9ec124 part of check-in 2ed6825306


#! /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$
# Revision 1.2  1996/11/12  09:11:20  peterg
# Removed all the hoorrible name changes
#
# Revision 1.1  1996/11/05  09:19:28  peterg
# Initial revision
#
###############################################################

#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 parameter file
in "$1_params.r";

%Read the simplification file
in "$1_simp.r";

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

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



%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 ]