Overview
Comment:Now writes to standard output
Write the name, not the array
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: b836715b25e28accb40ee1ebc3e7980d53ef4ad1dd871835ac08b53e4cee6644
User & Date: gawthrop@users.sourceforge.net on 2000-10-17 09:55:55
Other Links: branch diff | manifest | tags
Context
2000-10-17
11:07:59
*** empty log message *** check-in: 8d896d87c9 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
09:55:55
Now writes to standard output
Write the name, not the array
check-in: b836715b25 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
09:55:21
Added logic rep check-in: f8ae8dbdd3 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/switch_txt2m from [f9c4ead64c] to [64a1d69398].

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.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
## Removed switch.m generation - redundant
##
35
36
37
38
39
40
41
42

43
44
45

46
47
48
49
50
51
52
38
39
40
41
42
43
44

45
46
47

48
49
50
51
52
53
54
55







-
+


-
+







## Revision 1.5  1998/10/01 16:05:34  peterg
## Separate switch.m file for euler and implicit integration
##
###############################################################


# 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=="#"){
#     printf("#== Switches set element of state vector to zero ==#\n")
#   }
61
62
63
64
65
66
67
68

69
70
71

72
73
74

75
76
77
78
79


80
81
82
83
84
85
86
87
88
89
90

91
92
93
94


95
96
97
98
99
100

101
102
103
104
105
106
107
64
65
66
67
68
69
70

71
72
73

74
75
76

77
78
79
80


81
82
83
84
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







-
+


-
+


-
+



-
-
+
+










-
+


-
-
+
+





-
+







#   printf("  end;\n");
#   printf("end;\n");

#   }
# }' 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 <<EOF
#cat  >> $1_switchopen.m <<EOF

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

EOF
cat $1_logic.txt >> $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")
    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
# lang_header $1 switcha m 'mttAA,mttx' '[mttAA]' > $1_switcha.m
# awk '{


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