10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# Copyright (c) P.J.Gawthrop 1998
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.2 1998/01/22 13:25:22 peterg
## Added END;; to output file.
##
## Revision 1.1 1998/01/22 13:16:43 peterg
## Initial revision
##
###############################################################
|
>
>
>
|
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# Copyright (c) P.J.Gawthrop 1998
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.3 2000/09/11 10:53:54 peterg
## Uses 1st io of mimo to create siso
##
## Revision 1.2 1998/01/22 13:25:22 peterg
## Added END;; to output file.
##
## Revision 1.1 1998/01/22 13:16:43 peterg
## Initial revision
##
###############################################################
|
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
|
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
|
|
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
|
>
>
>
>
>
>
>
>
>
>
>
>
|
|
>
>
>
>
>
|
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
|
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_tf.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;
%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 observer form
% MTTA_o matrix
matrix MTTA_o(MTTNx,MTTNx);
% First column is ai coefficients
for i := 1:MTTNx do
MTTA_o(i,1) := -part(ai,i);
% (MTTNx-1)x(MTTNx-1) unit matrix in upper right-hand corner (if n>1)
if MTTNx>1 then
for i := 1:MTTNx-1 do
MTTA_o(i,i+1) := 1;
% C_o vector;
matrix MTTC_o(1,MTTNx);
MTTC_o(1,1) := 1;
MTTC_o;
% B_o vector;
matrix MTTB_o(MTTNx,1);
for i := 1:MTTm+1 do
MTTB_o(i+MTTNx-MTTm-1,1) := part(bi,i);
% D_o
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
|