Index: mttroot/mtt/bin/trans/mtt_header ================================================================== --- mttroot/mtt/bin/trans/mtt_header +++ mttroot/mtt/bin/trans/mtt_header @@ -10,10 +10,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.37 2001/07/13 04:54:04 geraint +## Branch merge: numerical-algebraic-solution back to main. +## ## Revision 1.36 2001/07/12 04:00:51 gawthrop ## Now zeros y correctly - ie Ny NOT Nx elements ## ## Revision 1.35 2001/06/13 10:39:51 gawthrop ## Zeros output matices in csex and cseo just in case some elements are @@ -165,17 +168,10 @@ if [ -z "$system" ]; then echo 'Usage: mtt_header sys rep lang [stdin]' exit fi -# Find system constants -Nx=`mtt_getsize $system x` # States -Nxx=`mtt_getsize $system xx` # States x States -Nu=`mtt_getsize $system u` # Inputs -Ny=`mtt_getsize $system y` # Outputs -Nyz=`mtt_getsize $system yz` # Zero outputs -##Npar=`wc -l $system\_sympar.txt | awk '{print $1}'` # get octave version octave_development=`octave --version | awk '{print $4}' | awk -F\. '{print $2}'` case `$MATRIX --version | awk -F\. '{print $2}'` in 0) # stable @@ -339,11 +335,19 @@ states=no; inputs=no; parameters=yes; output='mttnum,mttden' args=mttpar; - ;; *) + ;; + type) + states=no; + inputs=no; + parameters=no; + header_only=yes; + ;; + + *) echo Representation $rep not supported - sorry; exit 1 esac ## Sort out parentheses if [ -n "$args" ]; then @@ -367,10 +371,26 @@ noglobals=true; # Fudge to make mtt_m2p work fi start='## BEGIN Code' finish='## END Code' var_declaration= + declarestates=no + declareinputs=no + declareswitches=no + ;; + sh) + modeline='## -*-shell-script-*- Put Emacs into shell-script-mode ##'; + Lc='##'; + Rc=''; + Lb='('; + Rb=')'; + function="" + declaration="" + start='' + parameters=no + states=no + inputs=no declarestates=no declareinputs=no declareswitches=no ;; txt) @@ -404,10 +424,20 @@ esac if [ "$rep" = "simpar" ]; then output=${output}${map} # Output is simpar_map in this case fi + +get_sizes() + { + Nx=`mtt_getsize $system x` # States + Nxx=`mtt_getsize $system xx` # States x States + Nu=`mtt_getsize $system u` # Inputs + Ny=`mtt_getsize $system y` # Outputs + Nyz=`mtt_getsize $system yz` # Zero outputs + ##Npar=`wc -l $system\_sympar.txt | awk '{print $1}'` + } zero_matrices() { ## Set matrices to zero echo @@ -822,10 +852,16 @@ $Lc $declaration $Lc System $system, representation $rep, language $language; $Rc $Lc File $1_$rep.$language; $Rc $Lc Generated by MTT on `date`; $Rc EOF + +if [ -n "${header_only}" ]; then + exit +else + get_sizes; +fi if [ ${language} = "oct" ];then write_standalone_header write_DLD_header map_DLD_inputs ${args}