Differences From Artifact [280b194479]:

To Artifact [016a2f4250]:


10
11
12
13
14
15
16



17
18
19
20
21
22
23
# Copyright (c) P.J.Gawthrop 1997

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$



## Revision 1.14  2000/10/16 08:28:56  peterg
## Tidied up:
## SS broken due to incorrect ss.r file
## Switches??
##
## Revision 1.13  2000/03/03 11:33:19  peterg
## *** empty log message ***







>
>
>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Copyright (c) P.J.Gawthrop 1997

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.15  2000/12/28 12:44:31  peterg
## *** empty log message ***
##
## Revision 1.14  2000/10/16 08:28:56  peterg
## Tidied up:
## SS broken due to incorrect ss.r file
## Switches??
##
## Revision 1.13  2000/03/03 11:33:19  peterg
## *** empty log message ***
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127

if [ -n "$steadystate_computation" ]; then 
# Compute inputs from ss.r file
# Inform user
echo Creating $1_input.txt - compute from steady-state information

cat $1_ss.r  $1_struc.txt | sed 's/\$//' |\
awk '{
  if(match($1,"MTTu")>0) {
    j++
    split($0,a,"=");
    u[j]=a[2];
  }
    
  if($1=="input") {
    i++; 
    if (length(u[i])==0) u[i]="0.0;";
    # print  "u(" i ") =\t", u[i], " \# " $4 " (" $3 ")"
    printf("%s =\t%s # MTT initial value from steady state\n", $4, u[i]);
  }
}'  >> $1_input.txt
else
#Write out the defaults -- unit inputs
echo Creating $1_input.txt - using defaults

awk '{
  if ($1=="input") {
      if ($2==1)
        printf("%s = \t%s; # MTT initial value\n", $4, default)
      else
        printf("%s = \t%s; # MTT initial value\n", $4, "0.0")
  }
}' Nu=$Nu  default=$default <$1_struc.txt >> $1_input.txt
fi

#Set some switches
#  echo  >> $1_input.txt
#  echo "# Set the switches"  >> $1_input.txt
#  strip_comments<$1_switch.txt |\
#  awk '{if (length($1)>0) print  tolower($1) "= (t>=0);"}'  >> $1_input.txt










|

















|













|



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130

if [ -n "$steadystate_computation" ]; then 
# Compute inputs from ss.r file
# Inform user
echo Creating $1_input.txt - compute from steady-state information

cat $1_ss.r  $1_struc.txt | sed 's/\$//' |\
gawk '{
  if(match($1,"MTTu")>0) {
    j++
    split($0,a,"=");
    u[j]=a[2];
  }
    
  if($1=="input") {
    i++; 
    if (length(u[i])==0) u[i]="0.0;";
    # print  "u(" i ") =\t", u[i], " \# " $4 " (" $3 ")"
    printf("%s =\t%s # MTT initial value from steady state\n", $4, u[i]);
  }
}'  >> $1_input.txt
else
#Write out the defaults -- unit inputs
echo Creating $1_input.txt - using defaults

gawk '{
  if ($1=="input") {
      if ($2==1)
        printf("%s = \t%s; # MTT initial value\n", $4, default)
      else
        printf("%s = \t%s; # MTT initial value\n", $4, "0.0")
  }
}' Nu=$Nu  default=$default <$1_struc.txt >> $1_input.txt
fi

#Set some switches
#  echo  >> $1_input.txt
#  echo "# Set the switches"  >> $1_input.txt
#  strip_comments<$1_switch.txt |\
#  gawk '{if (length($1)>0) print  tolower($1) "= (t>=0);"}'  >> $1_input.txt




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