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.4 1996/08/24 14:16:25 peter
## Global parameter passing.
##
## Revision 1.3 1996/08/18 12:02:46 peter
## Fixed bug when some matrices are empty.
##
## Revision 1.2 1996/08/12 20:22:20 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.5 1997/02/24 14:44:28 peterg
# Ignores numerical parameters in global list.
#
## Revision 1.4 1996/08/24 14:16:25 peter
## Global parameter passing.
##
## Revision 1.3 1996/08/18 12:02:46 peter
## Fixed bug when some matrices are empty.
##
## Revision 1.2 1996/08/12 20:22:20 peter
|
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
|
%Read in the parameter file
in "$1_sympar.r";
%Read the reduce state-space A,B,C and D matrices file
in "$1_dm.r";
OUT "$1_dm.m";
%Headings - Matlab style
%(Note. The ;; are deleted by for2mat)
write "function [MTTA,MTTB,MTTC,MTTD,MTTE] = $1_dm;;";
write "% [MTTA,MTTB,MTTC,MTTD,MTTE] = $1_dm;;";
write "% Linearised descriptor matrices for system $1";
write "% File $1_dm.m";
write "% Generated by MTT";
IF MTTNvar>0 THEN
BEGIN
write "% Set the parameters";
write "global ...;;";
FOR i := 1:MTTNvar DO
BEGIN
IF numberp(MTTVar(i,1))
|
<
<
<
<
<
<
<
<
<
<
<
<
|
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
%Read in the parameter file
in "$1_sympar.r";
%Read the reduce state-space A,B,C and D matrices file
in "$1_dm.r";
IF MTTNvar>0 THEN
BEGIN
write "% Set the parameters";
write "global ...;;";
FOR i := 1:MTTNvar DO
BEGIN
IF numberp(MTTVar(i,1))
|
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
MTTN := MTTNx + 2*MTTNz + MTTNyz;
write "MTTA = zeros(", MTTN, ",", MTTN, ");";
write "MTTB = zeros(", MTTN, ",", MTTNu, ");";
write "MTTC = zeros(", MTTNy, ",", MTTN, ");";
write "MTTD = zeros(", MTTNy, ",", MTTNu, ");";
write "MTTE = zeros(", MTTN, ",", MTTN, ");";
ON NERO; % Suppress zero elements.
MTTA := MTTA;
MTTB := MTTB;
MTTC := MTTC;
MTTD := MTTD;
MTTE := MTTE;
SHUT "$1_dm.m";
|
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
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
|
MTTN := MTTNx + 2*MTTNz + MTTNyz;
write "MTTA = zeros(", MTTN, ",", MTTN, ");";
write "MTTB = zeros(", MTTN, ",", MTTNu, ");";
write "MTTC = zeros(", MTTNy, ",", MTTN, ");";
write "MTTD = zeros(", MTTNy, ",", MTTNu, ");";
write "MTTE = zeros(", MTTN, ",", MTTN, ");";
OUT "$1_dm.1";
ON NERO; % Suppress zero elements.
MTTA := MTTA;
MTTB := MTTB;
MTTC := MTTC;
MTTD := MTTD;
MTTE := MTTE;
SHUT "$1_dm.1";
EOF
#Write some file headers
echo "function [A,B,C,D,E] = $1_dm" > $1_dm.m
echo "% Descriptor matrix function for system $1 ($1_dm.m)" >> $1_dm.m
echo "% Generated by MTT at `date`" >> $1_dm.m
echo >> $1_dm.m
#Globals
sympar2global_txt2m $1 >> $1_dm.m
echo ';'>> $1_dm.m
echo >> $1_dm.m
#Define array sizes.
grep -v 'function' $1_def.m | grep -v '%' >> $1_dm.m
echo 'mtta = zeros(nx+nyz,nx+nyz);' >> $1_dm.m
echo 'mttb = zeros(nx+nyz,nu);' >> $1_dm.m
echo 'mttc = zeros(ny,nx+nyz);' >> $1_dm.m
echo 'mttd = zeros(nu,nu);' >> $1_dm.m
echo 'mtte = zeros(nx+nyz,nx+nyz);' >> $1_dm.m
#Code
cat $1_dm.1 >> $1_dm.m
rm -f $1_dm.1
|