File mttroot/mtt/bin/trans/sm_r2m artifact 30c0587225 part of check-in 7f5b9f0bd7


#!/bin/sh

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

# Bourne shell script: sm_r2m
# Reduce constained state-space A,B,C,D and E matrices to Matlab
# P.J.Gawthrop July 1990, Feb 1991, May 1991, Sep 91, Dec 93, Jan 94, May 94.
# Copyright (c) P.J.Gawthrop, 1989, 1990, 1991, 1993, 1994, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.7  1998/06/23 19:18:33  peterg
## Added optional state argument.
##
# Revision 1.6  1997/02/24  14:43:21  peterg
# Now ignores parameters that are numerical.
#
## Revision 1.5  1996/09/12 18:34:44  peter
## Back under rcs.
##
# Revision 1.4  1996/08/24  14:12:26  peter
# Global parameter passing.
#
## Revision 1.3  1996/08/19 18:38:43  peter
## Read in the numerical params etc ...
##
## Revision 1.2  1996/08/19 16:25:18  peter
## Fixed bug when Nx=0.
##
## Revision 1.1  1996/08/19 15:14:51  peter
## Initial revision
##
###############################################################


# Inform user
echo Creating $1_sm.m

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

#Header
lang_header $1 sm m '' '[mtta,mttb,mttc,mttd]' >$1_sm.m

# Use reduce to accomplish the transformation
$SYMBOLIC >sm_r2m.log << EOF

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

%Read the reduce state-space A,B,C and D matrices file
IN "$1_sm.r";

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

OUT "$1_sm.m1";

%Fortran switches - one line expressions
OFF echo;
ON fort$
cardno!* := 1$
fortwidth!* := 100$
OFF period$

write "mtta = zeros(", MTTNx, ",", MTTNx, ");";
write "mttb = zeros(", MTTNx, ",", MTTNu, ");";
write "mttc = zeros(", MTTNy, ",", MTTNx, ");";
write "mttd = zeros(", MTTNy, ",", MTTNu, ");";

ON NERO;	% Suppress zero elements.
mtta := mtta;
mttb := mttb;
mttc := mttc;
mttd := mttd;

OFF FORT;
write "";

SHUT "$1_sm.m1";
EOF

cat $1_sm.m1 >> $1_sm.m
#rm -f $1_sm.m1


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