#! /bin/sh

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

# Bourne shell script: ssl_r2tex
# Reduce constrained-state matrices to LaTex constrained-state matrices.
# P.J.Gawthrop  January 8th 1997
# Copyright (c) P.J.Gawthrop, 1997

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.1  1998/01/22 13:16:30  peterg
## Initial revision
##
###############################################################


# Inform user
echo Creating $1_ssl.tex

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

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

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

%Read the obsever gains file
in "$1_ssl.r";

%Read the substitution file
in "$1_subs.r";

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

%Read the formatting function
in "$MTTPATH/trans/latex_matrix.r";

OFF Echo;
OFF Nat;
OFF EXP;
%ON Rounded;
%Precision 5;


OUT "$1_ssl.tex";

%Write out the canonical matrices
write "%Canonical-form  matrices $1";
write "%File: $1_ssl.tex";
write"";


write "%  - Gain matrix - controller form";
MTT_Matrix := MTTL_o$ 
MTT_Matrix_name := "MTTL_o"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := 1$
Latex_Matrix()$

write "%  - Gain matrix - physical form";
MTT_Matrix := MTTL$ 
MTT_Matrix_name := "MTTL"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := 1$
Latex_Matrix()$

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