Overview
Comment:Initial revision
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 1d53b14dfcb00a1788a84bf740501a7d9141c854f38266f9fbf0f43e480ccc59
User & Date: gawthrop@users.sourceforge.net on 1998-01-22 13:17:37
Other Links: branch diff | manifest | tags
Context
1998-01-22
13:25:22
Added END;; to output file. check-in: ccc44264a7 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
13:17:37
Initial revision check-in: 1d53b14dfc user: gawthrop@users.sourceforge.net tags: origin/master, trunk
10:39:01
Initial revision check-in: d611ac00e5 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Added mttroot/mtt/bin/trans/sm2smc_r version [fd501bda09].

































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#! /bin/sh

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

# Bourne shell script: sm2smc_r
# state matrices to controller canonical form + related matrices
# P.J.Gawthrop  12 Jan 1997
# Copyright (c) P.J.Gawthrop 1997

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


# Inform user
echo Creating $1_smc.r -- NOTE this is for SISO systems only.

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

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

in "$1_def.r";
in "$1_sm.r";
in "$1_tf.r";

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


OFF Echo;
OFF Nat;

% Find the controllability matrix
MATRIX MTTCon(MTTNx,MTTNX);
MTTAB := MTTB;
FOR j := 1:MTTNx DO
  BEGIN
   FOR i := 1:MTTNx DO 
      MTTCon(i,j) := MTTAB(i,1);
   MTTAB := MTTA*MTTAB;
  END;


%Canonical forms:
% This statement makes Gs a scalar transfer function
Gs := MTTtf(1,1);

% Numerator and denominator polynomials
bs := num(gs);
as := den(gs);

% extract coeficients and divide by coeff of s^n
% reverse operator puts list with highest oder coeffs first
ai := reverse(coeff(as,s));
a0 := first(ai);
MTTn := length(ai) - 1;


% Normalised coeficients;
ai := reverse(coeff(as/a0,s));
bi := reverse(coeff(bs/a0,s));
MTTm := length(bi)-1;

% Zap the (unity) first element of ai list;
ai := rest(ai);

% System in controller form
% MTTA_c matrix
matrix MTTA_c(MTTn,MTTn);

% First row is ai coefficients
for i := 1:MTTn do
  MTTA_c(1,i) := -part(ai,i);

% (MTTn-1)x(MTTn-1) unit matrix in lower left-land corner (if n>1)
if MTTn>1 then
  for i := 1:MTTn-1 do
    MTTA_c(i+1,i) := 1;

% B_c vector;
matrix MTTB_c(MTTn,1);
MTTB_c(1,1) := 1;

% C_c vector;
matrix MTTC_c(1,MTTn);
for i := 1:MTTm+1 do
  MTTC_c(1,i+MTTn-MTTm-1) := part(bi,i);

% D_c
MTTD_c := MTTD;

%Controllability matrix of controllable form
MATRIX MTTCon_c(MTTNx,MTTNX);
MTTAB := MTTB_c;
FOR j := 1:MTTNx DO
  BEGIN
   FOR i := 1:MTTNx DO 
      MTTCon_c(i,j) := MTTAB(i,1);
   MTTAB := MTTA_c*MTTAB;
  END;

% Transformation matrix;
MTTT_c := MTTCon_c*MTTCon^(-1);



%Create the output file
OUT "$1_smc.r";

%Write out the matrices.

% Controllable form
write "%  - Controller form";
MTT_Matrix := MTTA_c$ 
MTT_Matrix_name := "MTTA_c"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$

MTT_Matrix := MTTB_c$ 
MTT_Matrix_name := "MTTB_c"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNu$
Reduce_Matrix()$

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

MTT_Matrix := MTTD_c$ 
MTT_Matrix_name := "MTTD_c"$
MTT_Matrix_n := MTTNy$
MTT_Matrix_m := MTTNu$
Reduce_Matrix()$


write "%  - Controllability matrix";
MTT_Matrix := MTTCon$ 
MTT_Matrix_name := "MTTCon"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$


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

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

write "END;";

SHUT "$1_smc.r";
quit;

EOF

# Now invoke the standard error handling.
mtt_error_r sm2smc_r.log

Added mttroot/mtt/bin/trans/sm2smo_r version [8e11a95aec].









































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#! /bin/sh

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

# Bourne shell script: sm2smo_r
# state matrices to cobserver form
# P.J.Gawthrop  12 Jan 1997
# Copyright (c) P.J.Gawthrop 1998

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


# Inform user
echo Creating $1_smo.r -- NOTE this is for SISO systems only.

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

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

in "$1_def.r";
in "$1_sm.r";
in "$1_smc.r";

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


OFF Echo;
OFF Nat;

% Find  observibility matrix.
MATRIX MTTObs(MTTNx,MTTNX);
MTTCA := MTTC;
FOR i := 1:MTTNx DO
  BEGIN
   FOR j := 1:MTTNx DO 
      MTTObs(i,j) := MTTCA(1,j);
   MTTCA := MTTCA*MTTA;
  END;


%Observable form (dual of controller form)
MTTA_o := tp(MTTA_c);
MTTB_o := tp(MTTC_c);
MTTC_o := tp(MTTB_c);
MTTD_o := MTTD;


%Observability matrix of observer form
MATRIX MTTObs_o(MTTNx,MTTNX);
MTTCA := MTTC_o;
FOR i := 1:MTTNx DO
  BEGIN
   FOR j := 1:MTTNx DO 
      MTTObs_o(i,j) := MTTCA(1,j);
   MTTCA := MTTCA*MTTA_o;
  END;

% Transformation matrix;
MTTT_o := MTTObs^(-1)*MTTObs_o;


%Create the output file
OUT "$1_smo.r";

%Write out the matrices.

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

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

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

MTT_Matrix := MTTD_o$ 
MTT_Matrix_name := "MTTD_o"$
MTT_Matrix_n := MTTNy$
MTT_Matrix_m := MTTNu$
Reduce_Matrix()$

write "%  -Observability matrix";
MTT_Matrix := MTTObs$ 
MTT_Matrix_name := "MTTObs"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$


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

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



SHUT "$1_smo.r";
quit;

EOF

# Now invoke the standard error handling.
mtt_error_r sm2smo_r.log

Added mttroot/mtt/bin/trans/smc2ssk_r version [cfec28a0d7].



















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#! /bin/sh

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

# Bourne shell script: smc2ssk_r
# controller-form state matrices to controller gain k
# P.J.Gawthrop  Jan 1998
# Copyright (c) P.J.Gawthrop 1998

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


# Inform user
echo Creating $1_ssk.r -- NOTE this is for SISO systems only.

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

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

in "$1_def.r";
in "$1_smc.r";

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


OFF Echo;
OFF Nat;


%%%%  Controller design %%%%%

% gain in controller form:
matrix MTTk_c(1,MTTNx);

matrix alpha_c(9,1);
alpha_c(1,1) := alpha_c1;
alpha_c(2,1) := alpha_c2;
alpha_c(3,1) := alpha_c3;
alpha_c(4,1) := alpha_c4;
alpha_c(5,1) := alpha_c5;
alpha_c(6,1) := alpha_c6;
alpha_c(7,1) := alpha_c7;
alpha_c(8,1) := alpha_c8;
alpha_c(9,1) := alpha_c9;


for i := 1:MTTNx do
 MTTk_c(1,i) := alpha_c(i,1) - MTTA_c(1,i);

% Gain in physical form
MTTk := MTTk_c*MTTT_c;


%Create the output file
OUT "$1_ssk.r";

%Write out the matrices.

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

write "%  - Gain matrix - physical form";
MTT_Matrix := MTTK$ 
MTT_Matrix_name := "MTTK"$
MTT_Matrix_n := MTTNu$
MTT_Matrix_m := MTTNx$
Reduce_Matrix()$

SHUT "$1_ssk.r";
quit;

EOF

# Now invoke the standard error handling.
mtt_error_r smc2ssk_r.log

Added mttroot/mtt/bin/trans/smo_r2tex version [a95bf75594].





















































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#! /bin/sh

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

# Bourne shell script: smo_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_smo.tex

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

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

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

%Read the observer-form matrices file
in "$1_smo.r";


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

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

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


OUT "$1_smo.tex";

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


% 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()$

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

write "%  - Observability matrix";
MTT_Matrix := MTTObs$ 
MTT_Matrix_name := "MTTObs"$
MTT_Matrix_n := MTTNx$
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()$


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

Added mttroot/mtt/bin/trans/ssk_r2tex version [eb173156c7].



















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#! /bin/sh

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

# Bourne shell script: ssk_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_ssk.tex

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

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

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

%Read the smconical-form matrices file
in "$1_ssk.r";


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

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

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


OUT "$1_ssk.tex";

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


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()$

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


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