Overview
Comment:*** empty log message ***
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 72f66b24e23bec39c7c5f55acc14cf3d629120e3fe316d75e01874502796c487
User & Date: gawthrop@users.sourceforge.net on 2000-12-28 12:31:15
Other Links: branch diff | manifest | tags
Context
2000-12-28
12:48:53
Put under RCS check-in: f928abb12e user: gawthrop@users.sourceforge.net tags: origin/master, trunk
12:31:15
*** empty log message *** check-in: 72f66b24e2 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
12:29:52
Initial revision check-in: 06c7bff9a7 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/abg2cbg_m from [021928d3b8] to [592fbd67e0].

9
10
11
12
13
14
15



16
17
18
19
20
21
22
# Acausal bond graph to causal bond graph: mfile format

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



## Revision 1.12  1998/07/10 08:43:46  peterg
## Added -I switch
##
## Revision 1.11  1998/01/23 13:29:54  peterg
## $RMATRIX --> $MATRIX
##
# Revision 1.10  1996/12/04  21:51:02  peterg







>
>
>







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Acausal bond graph to causal bond graph: mfile format

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.13  1998/07/27 20:30:12  peterg
## *** empty log message ***
##
## Revision 1.12  1998/07/10 08:43:46  peterg
## Added -I switch
##
## Revision 1.11  1998/01/23 13:29:54  peterg
## $RMATRIX --> $MATRIX
##
# Revision 1.10  1996/12/04  21:51:02  peterg
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# P.J.Gawthrop May 1996
# Copyright (c) P.J.Gawthrop, 1996.


# P.J.Gawthrop May 1996
# Copyright (c) P.J.Gawthrop, 1996.


while [ -n "`echo $1 | grep '^-'`" ]; do
  case $1 in
	-I )
                info=info;;


	*)
		echo "$1 is an invalid argument - ignoring" ;;
  esac
  shift
done

infofile='mtt_info.txt'
errorfile='mtt_error.txt'
typefile="$1_type.sh"

# Remove the old log file
rm -f abg2cbg_m.log
rm -f $1_cbg.m
rm -f $typefile
rm -f $infofile


#Inform user
echo Creating $1_cbg.m
echo Creating $1_type.sh

# Use matrix manipulation to accomplish the transformation
$MATRIX << EOF  >abg2cbg_m.log  #2>mtt_error.txt

  infofilenum  = fopen("$infofile",'w');
  errorfilenum = fopen("$errorfile",'w');
  typefilenum  = fopen("$typefile",'w');

  %Convert from acausal to causal bond graph in m-file form.
  system_name='$1';

  port_bonds = [];
  port_direction = [];
  port_status = [];
  [cbonds,status] = abg2cbg(system_name, '', '', port_bonds, port_direction, port_status, ...
      typefilenum, infofilenum, errorfilenum);

EOF

if [ "$info" = "info" ]; then
  cat $infofile
fi

# cp $1_$1_cbg.m $1_cbg.m 2>> mtt_error.txt 

# Print errors, if any.
mtt_error mtt_error.txt








>




>
>


















|
















|












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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# P.J.Gawthrop May 1996
# Copyright (c) P.J.Gawthrop, 1996.


# P.J.Gawthrop May 1996
# Copyright (c) P.J.Gawthrop, 1996.

derivative=0;blurb=integral
while [ -n "`echo $1 | grep '^-'`" ]; do
  case $1 in
	-I )
                info=info;;
	-derivative )
                derivative=1; blurb=derivative;;
	*)
		echo "$1 is an invalid argument - ignoring" ;;
  esac
  shift
done

infofile='mtt_info.txt'
errorfile='mtt_error.txt'
typefile="$1_type.sh"

# Remove the old log file
rm -f abg2cbg_m.log
rm -f $1_cbg.m
rm -f $typefile
rm -f $infofile


#Inform user
echo "Creating $1_cbg.m (maximise $blurb causality)"
echo Creating $1_type.sh

# Use matrix manipulation to accomplish the transformation
$MATRIX << EOF  >abg2cbg_m.log  #2>mtt_error.txt

  infofilenum  = fopen("$infofile",'w');
  errorfilenum = fopen("$errorfile",'w');
  typefilenum  = fopen("$typefile",'w');

  %Convert from acausal to causal bond graph in m-file form.
  system_name='$1';

  port_bonds = [];
  port_direction = [];
  port_status = [];
  [cbonds,status] = abg2cbg(system_name, '', '', port_bonds, port_direction, port_status, ...
      $derivative,typefilenum, infofilenum, errorfilenum);

EOF

if [ "$info" = "info" ]; then
  cat $infofile
fi

# cp $1_$1_cbg.m $1_cbg.m 2>> mtt_error.txt 

# Print errors, if any.
mtt_error mtt_error.txt

Modified mttroot/mtt/bin/trans/can_r2tex from [b135c10fbf] to [5939f4edfe].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49


50
51
52
53
54
55
56
57
58
59
60
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
108
109
110
111
112





113

114



115
116



117


118
119
120

121
122

123
124






125
126

127


128





129
130
131
132

133
134
135
136
137
#! /bin/sh

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

# Bourne shell script: sm_r2tex
# Reduce constrained-state matrices to LaTex constrained-state matrices.
# P.J.Gawthrop  9 Sep 1991, May 1994
# Copyright (c) P.J.Gawthrop, 1991, May 1994, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
# Revision 1.3  1997/06/13  13:50:11  peterg
# Matrices in amstex format
#
# Revision 1.2  1997/04/18  12:54:00  peterg
# No longer does labels.
#
# Revision 1.1  1996/08/19  15:19:23  peter
# Initial revision
#
###############################################################


# Inform user
echo Creating $1_sm.tex

# Remove the old log file
rm -f sm_r2tex.log

# Use reduce to accomplish the transformation
reduce >sm_r2tex.log << EOF

%Read the definitions file
in "$1_def.r";

%Read the constrained-state matrices file
in "$1_sm.r";

%Read the symbolic parameters file
in "$1_sympar.r";

%Read the simplification file
in "$1_simp.r";




OFF Echo;
OFF Nat;
OFF EXP;
%ON Rounded;
%Precision 5;


OUT "$1_sm.tex";

%Write out the state matrices.
write "%state  matrices $1";
write "%File: $1.rcm";
write"";

write "%constrained-state matrices";




IF MTTNx>0 THEN
BEGIN
write "%  - A matrix";

write "\begin{equation}";
write "MTTA = \begin{pmatrix}";

	FOR Row := 1:MTTNx DO
	BEGIN
		FOR Col := 1:MTTNx DO

		BEGIN
			Write "{", MTTA(Row,Col), "}";

			IF Col<MTTNx THEN Write "&"


		END;


	IF Row<MTTNx THEN Write "\cr";




	END;
	Write "\end{pmatrix}";




write "\end{equation}";






write "%  - B matrix";
write "\begin{equation}";
write "MTTB = \begin{pmatrix}";

	FOR Row := 1:MTTNx DO
	BEGIN
		FOR Col := 1:MTTNu DO

		BEGIN
			Write "{", MTTB(Row,Col), "}";
			IF Col<MTTNu THEN Write "&"
		END;





	IF Row<MTTNx THEN Write "\cr";





	END;

	Write "\end{pmatrix}";




write "\end{equation}";







write "%  - C matrix";
write "\begin{equation}";
write "MTTC = \begin{pmatrix}";
	FOR Row := 1:MTTNy DO
	BEGIN
		FOR Col := 1:MTTNx DO
		BEGIN
			Write "{", MTTC(Row,Col), "}";
			IF Col<MTTNx THEN Write "&"
		END;

	IF Row<MTTNy THEN Write "\cr";





	END;

	Write "\end{pmatrix}";



write "\end{equation}";




END; %Nx>0



write "%  - D matrix";
write "\begin{equation}";

write "MTTD = \begin{pmatrix}";
	FOR Row := 1:MTTNy DO

	BEGIN
		FOR Col := 1:MTTNu DO






		BEGIN
			Write "{", MTTD(Row,Col), "}";

			IF Col<MTTNu THEN Write "&"


		END;






	IF Row<MTTNy THEN Write "\cr";
	END;
	Write "\end{pmatrix}";

write "\end{equation}";

SHUT "$1_sm.tex";
quit;
EOF






|

|
|






<
<
<
<
<
<
<
<
<




|


|


|




|
|

|
|




>
>



<
<
<

<
|

|
|
|


<

>
>
>
|
<
|
>
|
|
>
|
<
|
>
|
|
>
|
>
>
|

>
|
>
>
>
>
|
|
>
>
>
>
|
>
>
>
>
>

|
<
|
>
|
<
|
>
|
|
|
<
>
>
>
>

|
>
>
>
>
>
|
>
|
>
>
>
>
|
>
>
>
>
>
>

|
<
|
|
<
|
<
|
|
|

|
>
>
>
>
>
|
>
|
>
>
>
|

>
>
>
|
>
>

|
|
>
|
|
>
|
|
>
>
>
>
>
>
|
|
>
|
>
>
|
>
>
>
>
>

|
|
|
>


|


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16









17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45



46

47
48
49
50
51
52
53

54
55
56
57
58

59
60
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129

130
131

132

133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
#! /bin/sh

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

# Bourne shell script: can_r2tex
# Reduce constrained-state matrices to LaTex constrained-state matrices.
# P.J.Gawthrop  January 8th 1997
# Copyright (c) P.J.Gawthrop, 1997

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









###############################################################


# Inform user
echo Creating $1_can.tex

# Remove the old log file
rm -f can_r2tex.log

# Use reduce to accomplish the transformation
reduce >can_r2tex.log<< EOF

%Read the definitions file
in "$1_def.r";

%Read the canonical-form matrices file
in "$1_can.r";

%Read the substitution file
in "$1_subs.r";

%Read the simplification file
in "$1_simp.r";

%Read the formatting function
in "$MTTPATH/trans/latex_matrix.r";

OFF Echo;
OFF Nat;





OUT "$1_can.tex";

%Write out the canonical matrices
write "%Canonical-form  matrices $1";
write "%File: $1_can.tex";
write"";



% Controllable form
MTT_Matrix := MTTA_c$ 
MTT_Matrix_name := "MTTA_c"$
MTT_Matrix_n := MTTNx$

MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

MTT_Matrix := MTTB_c$ 
MTT_Matrix_name := "MTTB_c"$
MTT_Matrix_n := MTTNx$

MTT_Matrix_m := MTTNu$
LaTeX_Matrix()$

MTT_Matrix := MTTC_c$ 
MTT_Matrix_name := "MTTC_c"$
MTT_Matrix_n := MTTNy$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$


% Observable form
MTT_Matrix := MTTA_o$ 
MTT_Matrix_name := "MTTA_o"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

MTT_Matrix := MTTB_o$ 
MTT_Matrix_name := "MTTB_o"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNu$
LaTeX_Matrix()$

MTT_Matrix := MTTC_o$ 
MTT_Matrix_name := "MTTC_o"$
MTT_Matrix_n := MTTNy$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

write "%  - Controllability matrix";

MTT_Matrix := MTTCon$ 
MTT_Matrix_name := "MTTCon"$
MTT_Matrix_n := MTTNx$

MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

write "%  -Observability matrix";
MTT_Matrix := MTTObs$ 

MTT_Matrix_name := "MTTObs"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

write "%  -Controllability matrix - controller form";
MTT_Matrix := MTTCon_c$ 
MTT_Matrix_name := "MTTCon_c"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

write "%  - Transformation matrix - controller form";
MTT_Matrix := MTTT_c$ 
MTT_Matrix_name := "MTTT_c"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

write "%  - Gain matrix - controller form";
MTT_Matrix := MTTK_c$ 
MTT_Matrix_name := "MTTK_c"$
MTT_Matrix_n := MTTNu$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

write "%  - Gain matrix - physical form";

MTT_Matrix := MTTK$ 
MTT_Matrix_name := "MTTK"$

MTT_Matrix_n := MTTNu$

MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$


write "%  -Observability matrix - Observer form";
MTT_Matrix := MTTObs_o$ 
MTT_Matrix_name := "MTTObs_o"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

write "%  - Transformation matrix - Observer form";
MTT_Matrix := MTTT_o$ 
MTT_Matrix_name := "MTTT_o"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

write "%  - Observer Gain matrix - observer form";
MTT_Matrix := MTTL_o$ 
MTT_Matrix_name := "MTTL_o"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNy$
LaTeX_Matrix()$

write "%  - Gain matrix - physical form";
MTT_Matrix := MTTL$ 
MTT_Matrix_name := "MTTL"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNy$
LaTeX_Matrix()$


% Controllable form
MTT_Matrix := MTTA_comp$ 
MTT_Matrix_name := "MTTA_comp"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$

MTT_Matrix := MTTB_comp$ 
MTT_Matrix_name := "MTTB_comp"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNu$
LaTeX_Matrix()$

MTT_Matrix := MTTC_comp$ 
MTT_Matrix_name := "MTTC_comp"$
MTT_Matrix_n := MTTNy$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$



write "\begin{equation}";
  write "MTTur = {", MTTu_r, "}";
write "\end{equation}";

SHUT "$1_can.tex";
quit;
EOF

Modified mttroot/mtt/bin/trans/cbg_m2fig from [1fcb6fbad5] to [b85a89ba68].

14
15
16
17
18
19
20



21
22
23
24
25
26
27
# Copyright (c) P.J.Gawthrop, 1996.

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



## Revision 1.9  1998/01/23 13:31:23  peterg
## $RMATRIX --> $MATRIX
##
## Revision 1.8  1996/12/07 19:23:07  peterg
## Registered agian.
##
# Revision 1.7  1996/11/09  19:04:34  peterg







>
>
>







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Copyright (c) P.J.Gawthrop, 1996.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.10  2000/09/14 12:04:48  peterg
## New 2 parameter version
##
## Revision 1.9  1998/01/23 13:31:23  peterg
## $RMATRIX --> $MATRIX
##
## Revision 1.8  1996/12/07 19:23:07  peterg
## Registered agian.
##
# Revision 1.7  1996/11/09  19:04:34  peterg
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Copy the unchaging part of the figure file
cp $1_fig.fig $2_cbg.fig

#Inform user
echo Creating $2_cbg.fig -- component type $1

# Use  matrix manipulation to accomplish the transformation
$MATRIX   <<EOF  2>mtt_error.txt #> cbg_m2fig.log

  system_type = "$1"
  system_name = "$2"

  thick = 3; length = 150; red = 4; blue = 1; green = 12; font = 18;
  cbg2fig(system_name, system_type, '', ...
          length, thick, blue, ...







|







66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Copy the unchaging part of the figure file
cp $1_fig.fig $2_cbg.fig

#Inform user
echo Creating $2_cbg.fig -- component type $1

# Use  matrix manipulation to accomplish the transformation
$MATRIX   <<EOF  2>mtt_error.txt > cbg_m2fig.log

  system_type = "$1"
  system_name = "$2"

  thick = 3; length = 150; red = 4; blue = 1; green = 12; font = 18;
  cbg2fig(system_name, system_type, '', ...
          length, thick, blue, ...

Modified mttroot/mtt/bin/trans/cse2scse_r from [73797dbbb0] to [f23aba8df6].

14
15
16
17
18
19
20
21
22
23

24
25
26
27
28
29
30
31





32





33

34

35

36
37
38
39
40
41
42
# Arguments
system=$1; 
system_def=$1_def.r
system_cse=$1_cse.r
system_scse=$1_scse.r

# Parameters
n=`echo $2 | sed 's/,/ /g' |wc -w`
echo $n_parameters


parameters=`echo $2 | sed 's/,/ /g' |\
 awk '{
   for (i=1; i<=NF; i++) {
      printf("mttpar(%i,1) := %s;\n", i, $i);
      printf("mttcoef(%i,1) := %ss;\n", i, $i);
   }
  }'`






matrix="matrix mttpar("$n",1); matrix mttcoef("$n",1);"







echo $parameters

echo $matrix


# Number of states
Nx=`grep "MTTNx " <$system_def | awk '{print $3}' | sed 's/;//'`

#Inform user
echo Creating $system_scse "(for parameters $2, $Nx states)"








|
<

>








>
>
>
>
>
|
>
>
>
>
>
|
>
|
>
|
>







14
15
16
17
18
19
20
21

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Arguments
system=$1; 
system_def=$1_def.r
system_cse=$1_cse.r
system_scse=$1_scse.r

# Parameters
n=`echo $2 | sed 's/,/ /g' |wc -w` ## Number of parameters


## Parameter information for reduce.
parameters=`echo $2 | sed 's/,/ /g' |\
 awk '{
   for (i=1; i<=NF; i++) {
      printf("mttpar(%i,1) := %s;\n", i, $i);
      printf("mttcoef(%i,1) := %ss;\n", i, $i);
   }
  }'`

## Update sympar list.
echo Recreating $1_sympar.txt
# Zap any sensitivity coeficients
mv $1_sympar.txt mtt_junk
grep -v MTT_Sensitivity_Coefficients mtt_junk > $1_sympar.txt

# Create the new sens coeffs at end of list.
echo $2 | sed 's/,/ /g' |\
awk '{
   for (i=1; i<=NF; i++) {
      printf("%ss\tMTT_Sensitivity_Coefficients\n",$i);
   }
  }' >> $1_sympar.txt

touch $1_sympar.txt

matrix="matrix mttpar("$n",1); matrix mttcoef("$n",1);"

# Number of states
Nx=`grep "MTTNx " <$system_def | awk '{print $3}' | sed 's/;//'`

#Inform user
echo Creating $system_scse "(for parameters $2, $Nx states)"

Modified mttroot/mtt/bin/trans/dae2cse_r from [a8a0f34d9e] to [14e2313fd2].

11
12
13
14
15
16
17



18
19
20
21
22
23
24
# Copyright (c) P.J.Gawthrop 1991, 1992, 1994.

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



## Revision 1.12  2000/10/10 21:00:58  peterg
## New code genration
##
## Revision 1.11  1998/11/26 09:18:55  peterg
## Incluse subs.r
##
## Revision 1.10  1998/11/18 13:50:29  peterg







>
>
>







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Copyright (c) P.J.Gawthrop 1991, 1992, 1994.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.13  2000/10/11 08:52:46  peterg
## Creates csex (cse with dxe only) rep.
##
## Revision 1.12  2000/10/10 21:00:58  peterg
## New code genration
##
## Revision 1.11  1998/11/26 09:18:55  peterg
## Incluse subs.r
##
## Revision 1.10  1998/11/18 13:50:29  peterg
93
94
95
96
97
98
99



100
101
102
103
104
105
106

echo "Creating $1_csex.r"
echo "Creating $1_cseo.r"

# Remove the old log file
rm -f dae2cse_r.log




# Use reduce to accomplish the transformation
$SYMBOLIC >dae2cse_r.log << EOF

%Read the formatting function
in "$MTTPATH/trans/reduce_matrix.r";

OFF Echo;







>
>
>







96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112

echo "Creating $1_csex.r"
echo "Creating $1_cseo.r"

# Remove the old log file
rm -f dae2cse_r.log

# Remove some files
rm -f $1_cse.r? $1_cseo.r?

# Use reduce to accomplish the transformation
$SYMBOLIC >dae2cse_r.log << EOF

%Read the formatting function
in "$MTTPATH/trans/reduce_matrix.r";

OFF Echo;
279
280
281
282
283
284
285


286
287
288

289
290
291
292
293
294
295
write "MATRIX MTTE(", MTTNx, ",", MTTNx, ")$"; 
SHUT "$1_cse.r1";

OUT "$1_csex.r1";
write "MATRIX MTTEdx(", MTTNx, ",", 1, ")$"; 
SHUT "$1_csex.r1";



OUT "$1_cseo.r1";
write "MATRIX MTTY(", MTTNy, ",", MTTNx, ")$"; 
SHUT "$1_cseo.r1";


%%Create the _cse.r file
OUT "$1_cse.r2";
write "%File: $1_cse.r";
in ("$1_cse_write.r");
write "in ""$1_cseo.r"";";
write "END;";







>
>
|
|
|
>







285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
write "MATRIX MTTE(", MTTNx, ",", MTTNx, ")$"; 
SHUT "$1_cse.r1";

OUT "$1_csex.r1";
write "MATRIX MTTEdx(", MTTNx, ",", 1, ")$"; 
SHUT "$1_csex.r1";

IF MTTNy>0 THEN
BEGIN
  OUT "$1_cseo.r1";
  write "MATRIX MTTY(", MTTNy, ",", MTTNx, ")$"; 
  SHUT "$1_cseo.r1";
END;

%%Create the _cse.r file
OUT "$1_cse.r2";
write "%File: $1_cse.r";
in ("$1_cse_write.r");
write "in ""$1_cseo.r"";";
write "END;";
348
349
350
351
352
353
354


355
356
357
358
359

360
361
362


363
364
365
366
367
368
369
370
371
372
OUT "$1_csex.r2";
write "%File: $1_cse.r";
in ("$1_csex_write.r");
write "END;";
SHUT "$1_csex.r2";

%Write out the  output equations


OUT "$1_cseo.r2";
write "%File: $1_cseo.r";
in ("$1_cseo_write.r");
write "END;";
SHUT "$1_cseo.r2";

quit;
EOF



cat $1_cse.r1 $1_cse.r2 > $1_cse.r
cat $1_csex.r1 $1_csex.r2 > $1_csex.r
cat $1_cseo.r1 $1_cseo.r2 > $1_cseo.r

if [ "$solve" = "1" ]; then
    echo "Setting MTTNyz=0 in $1_def.r and removing other $1_def files"
    awk '{
     if ($1=="MTTNyz") 
       print "MTTNyz := 0;" 
     else print $0







>
>





>



>
>
|
|
|







357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
OUT "$1_csex.r2";
write "%File: $1_cse.r";
in ("$1_csex_write.r");
write "END;";
SHUT "$1_csex.r2";

%Write out the  output equations
IF MTTNy>0 THEN
BEGIN
OUT "$1_cseo.r2";
write "%File: $1_cseo.r";
in ("$1_cseo_write.r");
write "END;";
SHUT "$1_cseo.r2";
END;
quit;
EOF

touch $1_cseo.r1
touch $1_cseo.r2
cat $1_cse.r1 $1_cse.r2  > $1_cse.r
cat $1_csex.r1 $1_csex.r2  > $1_csex.r
cat $1_cseo.r1 $1_cseo.r2  > $1_cseo.r

if [ "$solve" = "1" ]; then
    echo "Setting MTTNyz=0 in $1_def.r and removing other $1_def files"
    awk '{
     if ($1=="MTTNyz") 
       print "MTTNyz := 0;" 
     else print $0

Modified mttroot/mtt/bin/trans/dir2rep from [c51343aef8] to [2f10632b5f].

11
12
13
14
15
16
17



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Copyright (c) P.J.Gawthrop, 1997.

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



## Revision 1.1  1998/02/05 13:31:25  peterg
## Initial revision
##
###############################################################

dotdot=$2 # Set to ../ if we are in MTT_work

# Inform user
echo "Creating $1_rep.txt (Directory version)"

# Headings
echo "% Verbal description for directory $1 ($1_rep.txt)"> $1_rep.txt
echo "% Generated by MTT on" `date`. >> $1_rep.txt                  	   

# Create paths for all valid examples - ie dir name is system name
dir2paths $1 $2 | \
awk '{
     print "mtt -t -d " $1,$2 " rep tex";
  }' >> $1_rep.txt







>
>
>















|



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Copyright (c) P.J.Gawthrop, 1997.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2  1998/03/11 10:32:11  peterg
## Now uses dir2paths transformation
##
## Revision 1.1  1998/02/05 13:31:25  peterg
## Initial revision
##
###############################################################

dotdot=$2 # Set to ../ if we are in MTT_work

# Inform user
echo "Creating $1_rep.txt (Directory version)"

# Headings
echo "% Verbal description for directory $1 ($1_rep.txt)"> $1_rep.txt
echo "% Generated by MTT on" `date`. >> $1_rep.txt                  	   

# Create paths for all valid examples - ie dir name is system name
dir2paths $1 $2 | sed 's/Introduction/AAAAA/g' | sort | sed 's/AAAAA/Introduction/g' | \
awk '{
     print "mtt -t -d " $1,$2 " rep tex";
  }' >> $1_rep.txt

Modified mttroot/mtt/bin/trans/dm_r2m from [c980f7fdc8] to [dc94c23287].

10
11
12
13
14
15
16



17
18
19
20
21
22
23
# Copyright (c) P.J.Gawthrop, 1989, 1990, 1991, 1993,1994.

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



# Revision 1.6  1997/04/16  13:43:29  peterg
# Added matrix dimenensions
#
# Revision 1.5  1997/02/24  14:44:28  peterg
# Ignores numerical parameters in global list.
#
## Revision 1.4  1996/08/24 14:16:25  peter







>
>
>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Copyright (c) P.J.Gawthrop, 1989, 1990, 1991, 1993,1994.

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.7  1998/04/13 11:01:55  peterg
## Now uses generic header : matlab_header
##
# Revision 1.6  1997/04/16  13:43:29  peterg
# Added matrix dimenensions
#
# Revision 1.5  1997/02/24  14:44:28  peterg
# Ignores numerical parameters in global list.
#
## Revision 1.4  1996/08/24 14:16:25  peter
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118

SHUT "$1_dm.1";


EOF

# Header
matlab_header $1 dm> $1_dm.m

#Define array sizes.
grep -v 'function' $1_def.m | grep -v '%' >>  $1_dm.m
echo 'mtta = zeros(nx+nyz+2*nz,nx+nyz+2*nz);' >>  $1_dm.m
echo 'mttb = zeros(nx+nyz+2*nz,nu);' >>  $1_dm.m
echo 'mttc = zeros(ny,nx+nyz+2*nz);' >>  $1_dm.m
echo 'mttd = zeros(ny,nu);' >>  $1_dm.m







|







107
108
109
110
111
112
113
114
115
116
117
118
119
120
121

SHUT "$1_dm.1";


EOF

# Header
matlab_header $1 dm 'A,B,C,D,E'> $1_dm.m

#Define array sizes.
grep -v 'function' $1_def.m | grep -v '%' >>  $1_dm.m
echo 'mtta = zeros(nx+nyz+2*nz,nx+nyz+2*nz);' >>  $1_dm.m
echo 'mttb = zeros(nx+nyz+2*nz,nu);' >>  $1_dm.m
echo 'mttc = zeros(ny,nx+nyz+2*nz);' >>  $1_dm.m
echo 'mttd = zeros(ny,nu);' >>  $1_dm.m

Modified mttroot/mtt/bin/trans/examples_txt2tk from [357d77bc30] to [1100679dcb].

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

40
41
42
43
44
    oldN=split(OLDPATH,oldpath,"/"); # Find last example path
    same=1; menu=basemenu;
    while ((path[same]==oldpath[same])&&(same<=N)){
       menu=menu"."tolower(path[same])
       same++
    }
      oldmenu=menu
      for (i=same;i<=N;i++){
        menu=tolower(menu"."path[i])
        category=path[i];
	printf("\n# Example category %s (%i)\n", category, N)
        printf("%s  add  cascade -label \"%s\" -menu %s \n", oldmenu, category, menu);
        printf("menu %s\n", menu)
	oldmenu=menu
      }
    oldN=N
    OLDPATH=PATH
    oldcategory=category

    example=$2
    printf(" set mtt \"xmtt -example %s\" \n", example); 
    printf("%s add command -label %s -command \"exec $mtt &\"\n", menu, example);
 }
}' 







|










>
|

|


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
    oldN=split(OLDPATH,oldpath,"/"); # Find last example path
    same=1; menu=basemenu;
    while ((path[same]==oldpath[same])&&(same<=N)){
       menu=menu"."tolower(path[same])
       same++
    }
      oldmenu=menu
      for (i=same;i<N;i++){
        menu=tolower(menu"."path[i])
        category=path[i];
	printf("\n# Example category %s (%i)\n", category, N)
        printf("%s  add  cascade -label \"%s\" -menu %s \n", oldmenu, category, menu);
        printf("menu %s\n", menu)
	oldmenu=menu
      }
    oldN=N
    OLDPATH=PATH
    oldcategory=category
    split($2,EXAMPLE,"_");
    example = EXAMPLE[1];
    printf(" set mtt \"xmtt -example %s\" \n", example); 
    printf("%s add command -label %s -command \" exec $mtt &\"\n", menu, example);
 }
}' 

Modified mttroot/mtt/bin/trans/lang_matrix.r from [4e699aa2c6] to [f4b204b20b].

9
10
11
12
13
14
15





16
17
18
19
20
21
22


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$





% % Revision 1.6  2000/08/25 09:23:40  peterg
% % Made both names the same!
% %
% % Revision 1.5  2000/08/24 17:12:01  peterg
% % Now optimises using SCOPE
% %
% % Revision 1.4  1998/07/27 17:34:59  peterg







>
>
>
>
>







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


% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % $Id$
% % $Log$
% % Revision 1.7  2000/08/29 17:33:59  peterg
% % After much fiddling about ..
% %  now does global optimisation (over all elements of matrix / vector)
% %  still fails for _sm.m
% %
% % Revision 1.6  2000/08/25 09:23:40  peterg
% % Made both names the same!
% %
% % Revision 1.5  2000/08/24 17:12:01  peterg
% % Now optimises using SCOPE
% %
% % Revision 1.4  1998/07/27 17:34:59  peterg
33
34
35
36
37
38
39



40
41
42
43
44
45
46
47

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



PROCEDURE Lang_Matrix();
BEGIN



    FOR row := 1:MTT_Matrix_n DO
    BEGIN
      IF MTT_Matrix_m>1 THEN
      BEGIN
        FOR col := 1:MTT_Matrix_m DO
        BEGIN
              IF (row EQ 1) AND (col EQ 1) THEN DELAYOPTS;
              INAME(mtt_o); % Set temp name

              gentran declare mtt_matrix_element:REAL;
              gentran declare mtt_matrix:REAL;
              mtt_matrix_element := mtt_matrix(row,col);
              GENTRAN mtt_matrix(row,col) ::=: mtt_matrix_element;
              IF (row EQ MTT_matrix_n) AND (col EQ MTT_Matrix_m) THEN MAKEOPTS;
            END;
      END
      ELSE
        BEGIN
          IF (row EQ 1) THEN DELAYOPTS;
          INAME(mtt_o); % Set temp name
          GENTRAN mtt_matrix(row) ::=: mtt_matrix(row,1);
          IF (row EQ MTT_matrix_n) THEN MAKEOPTS;
        END;
    END
END;

END;;









>
>
>
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|





38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



PROCEDURE Lang_Matrix();
BEGIN
%INAME(mtt_o); % Set temp name
GENTRAN mtt_matrix :=: mtt_matrix;

%     FOR row := 1:MTT_Matrix_n DO
%     BEGIN
%       IF MTT_Matrix_m>1 THEN
%       BEGIN
%         FOR col := 1:MTT_Matrix_m DO
%         BEGIN
%               IF (row EQ 1) AND (col EQ 1) THEN DELAYOPTS;
%               INAME(mtt_o); % Set temp name
%               %SETLENGTH(2); % Adjust optimisation
%               gentran declare mtt_matrix_element:REAL;
%               gentran declare mtt_matrix:REAL;
%               mtt_matrix_element := mtt_matrix(row,col);
%               GENTRAN mtt_matrix(row,col) ::=: mtt_matrix_element;
%               IF (row EQ MTT_matrix_n) AND (col EQ MTT_Matrix_m) THEN MAKEOPTS;
%             END;
%       END
%       ELSE
%         BEGIN
%           IF (row EQ 1) THEN DELAYOPTS;
%           INAME(mtt_o); % Set temp name
%           GENTRAN mtt_matrix(row) ::=: mtt_matrix(row,1);
%           IF (row EQ MTT_matrix_n) THEN MAKEOPTS;
%         END;
%     END
END;

END;;


Modified mttroot/mtt/bin/trans/latex_tidy from [af802e64a1] to [e0750229d8].

10
11
12
13
14
15
16



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

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



## Revision 1.15  1998/04/07 08:44:11  peterg
## zapped eta - it messes up theta
##
## Revision 1.14  1998/02/25 22:12:07  peterg
## Added , to regexp for subscripts
##
## Revision 1.13  1998/02/18 09:06:07  peterg







>
>
>







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

###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.16  2000/10/10 21:03:20  peterg
## *** empty log message ***
##
## Revision 1.15  1998/04/07 08:44:11  peterg
## zapped eta - it messes up theta
##
## Revision 1.14  1998/02/25 22:12:07  peterg
## Added , to regexp for subscripts
##
## Revision 1.13  1998/02/18 09:06:07  peterg
69
70
71
72
73
74
75


76
77
78
79
80
81
82
sed \
    -e "s/_\([a-z0-9,]*\)/_{\1}/g" \
    -e "s/\// \\\over /g" \
    -e "s/[0-9a-z_]*mtty/mtty/g" \
    -e "s/[0-9a-z_]*mttu/mttu/g" \
    -e "s/mttx\([0-9]*\)/x_{\1}/g" \
    -e "s/mttex\([0-9]*\)/\\\chi_{\1}/g" \


    -e "s/mttui\([0-9]*\)/v_{\1}/g" \
    -e "s/mttu\([0-9]*\)/u_{\1}/g" \
    -e "s/mtty\([0-9]*\)/y_{\1}/g" \
    -e "s/mttz\([0-9]*\)/z_{\1}/g" \
    -e "s/mttdx0/\\\dot x_0/g" \
    -e "s/mttdx/\\\dot x/g" \
    -e "s/mttdz/\\\dot z_/g" \







>
>







72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
sed \
    -e "s/_\([a-z0-9,]*\)/_{\1}/g" \
    -e "s/\// \\\over /g" \
    -e "s/[0-9a-z_]*mtty/mtty/g" \
    -e "s/[0-9a-z_]*mttu/mttu/g" \
    -e "s/mttx\([0-9]*\)/x_{\1}/g" \
    -e "s/mttex\([0-9]*\)/\\\chi_{\1}/g" \
    -e "s/mttddui\([0-9]*\)/\\\ddot{v}_{\1}/g" \
    -e "s/mttdui\([0-9]*\)/\\\dot{v}_{\1}/g" \
    -e "s/mttui\([0-9]*\)/v_{\1}/g" \
    -e "s/mttu\([0-9]*\)/u_{\1}/g" \
    -e "s/mtty\([0-9]*\)/y_{\1}/g" \
    -e "s/mttz\([0-9]*\)/z_{\1}/g" \
    -e "s/mttdx0/\\\dot x_0/g" \
    -e "s/mttdx/\\\dot x/g" \
    -e "s/mttdz/\\\dot z_/g" \


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