Overview
Comment:Put logic in-line - avoids the if statements
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: c720328b6bde7ac34e4137bcb8c57fe2667b0cb318349d991e08090e579f1727
User & Date: gawthrop@users.sourceforge.net on 2000-12-04 08:23:25
Other Links: branch diff | manifest | tags
Context
2000-12-04
08:24:29
Added swithc logic declarations check-in: 623e883028 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
08:23:25
Put logic in-line - avoids the if statements check-in: c720328b6b user: gawthrop@users.sourceforge.net tags: origin/master, trunk
08:19:27
Added switch declarations - in logic.cc check-in: f0a9ddeb0d user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/switch_txt2m from [5d1e74d0ec] to [ac9707fae1].

12
13
14
15
16
17
18



19
20
21
22
23
24
25


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



## 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
## Removed [] from zero_state output
##
## Revision 1.11  2000/10/17 09:55:55  peterg







>
>
>







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


###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## 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
## Removed [] from zero_state output
##
## Revision 1.11  2000/10/17 09:55:55  peterg
96
97
98
99
100
101
102

103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
  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)

  printf("if (%s_logic==0.0) \n", $1);
  printf("  mttopen(%s) = 1;\n", $2);
  printf("end;\n");
  printf("if (%s_logic<0.0)\n",$1);
  printf("  if (%s<0.0)\n",$1);
  printf("    mttopen(%s) = 1;\n", $2);
  printf("  end;\n");
  printf("end;\n");

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

#echo Creating  $1_switcha.m

# Implicit integration version







>
|
|
|
|
|
|
|
|







99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
  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)
   printf("mttopen(%s) = (abs(%s_logic)<0.5)||((%s_logic<0.0)&&(%s<0.0));\n", $2, $1, $1, $1);
#   printf("if (%s_logic==0.0) \n", $1);
#   printf("  mttopen(%s) = 1;\n", $2);
#   printf("end;\n");
#   printf("if (%s_logic<0.0)\n",$1);
#   printf("  if (%s<0.0)\n",$1);
#   printf("    mttopen(%s) = 1;\n", $2);
#   printf("  end;\n");
#   printf("end;\n");

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

#echo Creating  $1_switcha.m

# Implicit integration version


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