Differences From Artifact [ac9707fae1]:

To Artifact [1b58ea9614]:


12
13
14
15
16
17
18



19
20
21
22
23
24
25
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28







+
+
+









###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.15  2000/12/04 08:23:25  peterg
## Put logic in-line - avoids the if statements
##
## Revision 1.14  2000/11/09 10:29:21  peterg
## open --> mtt_open
##
## Revision 1.13  2000/11/09 10:19:12  peterg
## Explicitly write out the open switches ....
##
## Revision 1.12  2000/11/09 09:52:07  peterg
58
59
60
61
62
63
64
65

66
67
68
69
70
71
72
61
62
63
64
65
66
67

68
69
70
71
72
73
74
75







-
+







Nx=`mtt_getsize $1 x` # States

#Write some file headers
#lang_header $1 switch m 'mttx' '[mttx]' > $1_switch.m

#echo Creating  $1_switch.m
# Set states to zero
# awk '{
# gawk '{
#   if ($1=="#"){
#     printf("#== Switches set element of state vector to zero ==#\n")
#   }
#   else{
#   printf("\n#== Switch: %s ==#\n",$1)
#   printf("if (%s==0.0) \n", $1);
#   printf("  mttx(%s)=0.0;\n", $2);
91
92
93
94
95
96
97
98

99
100
101
102
103
104
105
94
95
96
97
98
99
100

101
102
103
104
105
106
107
108







-
+








## User defined logic (from $1_logic.m)

#EOF
#cat $1_logic.txt >> $1_switchopen.m

# Set states to zero
awk '{
gawk '{
  if ($1=="#"){
    printf("#== mttopen - boolean vector of open switches ==#\n")
    for (i=1;i<=Nx;i++)
     printf("mttopen(%i) = 0; # Default to not open\n", i);
  }
  else{
  printf("\n#== Switch: %s ==#\n",$1)
117
118
119
120
121
122
123
124

125
126
127
128
129
130
131
120
121
122
123
124
125
126

127
128
129
130
131
132
133
134







-
+







}' Nx=$Nx < $1_switch.txt #>> $1_switchopen.m

#echo Creating  $1_switcha.m

# Implicit integration version
#Write some file headers
# lang_header $1 switcha m 'mttAA,mttx' '[mttAA]' > $1_switcha.m
# awk '{
# gawk '{
#   if ($1=="#"){
#     printf("#== Switches set row and column of A matrix to zero ==#\n")
#   }
#   else{
#   printf("#== Switch: %s ==#\n",$1)
#   printf("if (%s==0.0) \n", $1);
#   printf("  for  MTTi=1:%s\n",Nx)

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