Index: mttroot/mtt/bin/trans/switch_txt2m ================================================================== --- mttroot/mtt/bin/trans/switch_txt2m +++ mttroot/mtt/bin/trans/switch_txt2m @@ -14,10 +14,13 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.10 2000/10/17 09:04:12 peterg +## *** empty log message *** +## ## Revision 1.9 1999/08/02 12:44:21 peterg ## zero_vector --> zero_state. ## ## Revision 1.8 1999/04/20 00:55:40 peterg ## Changed <= to < in switchopen.m @@ -37,14 +40,14 @@ ## ############################################################### # Find system constants -Nx=`grep "MTTNx " <$1_def.r | awk '{print $3}' | sed 's/;//'` +Nx=`mtt_getsize $1 x` # States #Write some file headers -lang_header $1 switch m 'mttx' '[mttx]' > $1_switch.m +#lang_header $1 switch m 'mttx' '[mttx]' > $1_switch.m #echo Creating $1_switch.m # Set states to zero # awk '{ # if ($1=="#"){ @@ -63,22 +66,22 @@ # } # }' Nx=$Nx < $1_switch.txt >> $1_switch.m ## Set index version -echo Creating $1_switchopen.m +#echo Creating $1_switchopen.m #Write some file headers -lang_header $1 switchopen m 'mttx' '[open]' > $1_switchopen.m +#lang_header $1 switchopen m 'mttx' '[open]' > $1_switchopen.m ## Add the switching logic -cat >> $1_switchopen.m <> $1_switchopen.m <> $1_switchopen.m +#EOF +#cat $1_logic.txt >> $1_switchopen.m # Set states to zero awk '{ if ($1=="#"){ printf("#== open - boolean vector of open switches ==#\n") @@ -85,21 +88,21 @@ printf("[open] = zero_state(%i); # Default to not open\n", Nx); } else{ printf("\n#== Switch: %s ==#\n",$1) - printf("if (%s==0.0) \n", $1); + printf("if (%s_logic==0.0) \n", $1); printf(" open(%s) = 1;\n", $2); printf("end;\n"); - printf("if (%s<0.0)\n",$1); - printf(" if (mttx(%s)<0.0)\n",$2); + printf("if (%s_logic<0.0)\n",$1); + printf(" if (%s<0.0)\n",$1); printf(" open(%s) = 1;\n", $2); printf(" end;\n"); printf("end;\n"); } -}' Nx=$Nx < $1_switch.txt >> $1_switchopen.m +}' Nx=$Nx < $1_switch.txt #>> $1_switchopen.m #echo Creating $1_switcha.m # Implicit integration version #Write some file headers