File mttroot/mtt/bin/trans/struc2state_txt2txt artifact 36b9471e67 part of check-in 2a27bcb9cc


#! /bin/sh

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

# Bourne shell script: struc2state_txt2txt
# Creates the default state file for the system (txt)

# Copyright (c) P.J.Gawthrop 1998


# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% Version control history
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %% $Id$
# %% $Log$
# %% Revision 1.4  1998/07/25 09:42:37  peterg
# %% Now writes out an array
# %%
# %% Revision 1.3  1998/07/25 08:11:35  peterg
# %% No longer used the SS method - just sets zero states
# %%
# %% Revision 1.2  1998/07/21 16:54:15  peterg
# %% Changed erroneous header
# %%
# %% Revision 1.1  1998/06/27 15:06:40  peterg
# %% Initial revision
# %%
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



# Inform user
echo Creating $1_state.txt

#Create the state file complete with headers.
echo "# Initial state  file ($1_state.txt)" > $1_state.txt
echo "# Generated by MTT at `date`" >> $1_state.txt
cat $MTTPATH/trans/rcs_header.sh  >> $1_state.txt

#Write out the defaults -- states to steady-state values
echo "# Set the states"  >> $1_state.txt
#cat $1_ss.r  $1_struc.txt | sed 's/\$//' |\
#awk '{
#  if(match($1,"MTTx")) {
#    j++
#    x[j]=$3 $4 $5 $6 $7 $8 $9;
#  }
#    
#  if($1=="state") {
#    i++; 
#    print  "x(" i ") =\t", x[i], "; \# " $4 " (" $3 ")"
#  }
#}'  >> $1_state.txt

awk '{
  if ($1=="state") printf("mttx(%s) \t= 0.0; \t\# %s (%s)\n", $2,$3,$4)
}' <$1_struc.txt >> $1_state.txt



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