control_systems_torbox 0.2.1

Control systems toolbox
Documentation
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
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
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
<HTML>
<HEAD><TITLE>TB04AD - SLICOT Library Routine Documentation</TITLE>
</HEAD>
<BODY>

<H2><A Name="TB04AD">TB04AD</A></H2>
<H3>
Transfer matrix of a given state-space representation (A,B,C,D)
</H3>
<A HREF ="#Specification"><B>[Specification]</B></A>
<A HREF ="#Arguments"><B>[Arguments]</B></A>
<A HREF ="#Method"><B>[Method]</B></A>
<A HREF ="#References"><B>[References]</B></A>
<A HREF ="#Comments"><B>[Comments]</B></A>
<A HREF ="#Example"><B>[Example]</B></A>

<P>
<B><FONT SIZE="+1">Purpose</FONT></B>
<PRE>
  To find the transfer matrix T(s) of a given state-space
  representation (A,B,C,D). T(s) is expressed as either row or
  column polynomial vectors over monic least common denominator
  polynomials.

</PRE>
<A name="Specification"><B><FONT SIZE="+1">Specification</FONT></B></A>
<PRE>
      SUBROUTINE TB04AD( ROWCOL, N, M, P, A, LDA, B, LDB, C, LDC, D,
     $                   LDD, NR, INDEX, DCOEFF, LDDCOE, UCOEFF, LDUCO1,
     $                   LDUCO2, TOL1, TOL2, IWORK, DWORK, LDWORK,
     $                   INFO )
C     .. Scalar Arguments ..
      CHARACTER         ROWCOL
      INTEGER           INFO, LDA, LDB, LDC, LDD, LDDCOE, LDUCO1,
     $                  LDUCO2, LDWORK, M, N, NR, P
      DOUBLE PRECISION  TOL1, TOL2
C     .. Array Arguments ..
      INTEGER           INDEX(*), IWORK(*)
      DOUBLE PRECISION  A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*),
     $                  DCOEFF(LDDCOE,*), DWORK(*),
     $                  UCOEFF(LDUCO1,LDUCO2,*)

</PRE>
<A name="Arguments"><B><FONT SIZE="+1">Arguments</FONT></B></A>
<P>

<B>Mode Parameters</B>
<PRE>
  ROWCOL  CHARACTER*1
          Indicates whether the transfer matrix T(s) is required
          as rows or columns over common denominators as follows:
          = 'R':  T(s) is required as rows over common denominators;
          = 'C':  T(s) is required as columns over common
                  denominators.

</PRE>
<B>Input/Output Parameters</B>
<PRE>
  N       (input) INTEGER
          The order of the state-space representation, i.e. the
          order of the original state dynamics matrix A.  N &gt;= 0.

  M       (input) INTEGER
          The number of system inputs.  M &gt;= 0.

  P       (input) INTEGER
          The number of system outputs.  P &gt;= 0.

  A       (input/output) DOUBLE PRECISION array, dimension (LDA,N)
          On entry, the leading N-by-N part of this array must
          contain the original state dynamics matrix A.
          On exit, the leading NR-by-NR part of this array contains
          the upper block Hessenberg state dynamics matrix A of a
          transformed representation for the original system: this
          is completely controllable if ROWCOL = 'R', or completely
          observable if ROWCOL = 'C'.

  LDA     INTEGER
          The leading dimension of array A.  LDA &gt;= MAX(1,N).

  B       (input/output) DOUBLE PRECISION array, dimension (LDB,M),
          if ROWCOL = 'R', and (LDB,MAX(M,P)) if ROWCOL = 'C'.
          On entry, the leading N-by-M part of this array must
          contain the original input/state matrix B; if
          ROWCOL = 'C', the remainder of the leading N-by-MAX(M,P)
          part is used as internal workspace.
          On exit, the leading NR-by-M part of this array contains
          the transformed input/state matrix B.

  LDB     INTEGER
          The leading dimension of array B.  LDB &gt;= MAX(1,N).

  C       (input/output) DOUBLE PRECISION array, dimension (LDC,N)
          On entry, the leading P-by-N part of this array must
          contain the original state/output matrix C; if
          ROWCOL = 'C', the remainder of the leading MAX(M,P)-by-N
          part is used as internal workspace.
          On exit, the leading P-by-NR part of this array contains
          the transformed state/output matrix C.

  LDC     INTEGER
          The leading dimension of array C.
          LDC &gt;= MAX(1,P)   if ROWCOL = 'R';
          LDC &gt;= MAX(1,M,P) if ROWCOL = 'C'.

  D       (input) DOUBLE PRECISION array, dimension (LDD,M),
          if ROWCOL = 'R', and (LDD,MAX(M,P)) if ROWCOL = 'C'.
          The leading P-by-M part of this array must contain the
          original direct transmission matrix D; if ROWCOL = 'C',
          this array is modified internally, but restored on exit,
          and the remainder of the leading MAX(M,P)-by-MAX(M,P)
          part is used as internal workspace.

  LDD     INTEGER
          The leading dimension of array D.
          LDD &gt;= MAX(1,P)   if ROWCOL = 'R';
          LDD &gt;= MAX(1,M,P) if ROWCOL = 'C'.

  NR      (output) INTEGER
          The order of the transformed state-space representation.

  INDEX   (output) INTEGER array, dimension (porm), where porm = P,
          if ROWCOL = 'R', and porm = M, if ROWCOL = 'C'.
          The degrees of the denominator polynomials.

  DCOEFF  (output) DOUBLE PRECISION array, dimension (LDDCOE,N+1)
          The leading porm-by-kdcoef part of this array contains
          the coefficients of each denominator polynomial, where
          kdcoef = MAX(INDEX(I)) + 1.
          DCOEFF(I,K) is the coefficient in s**(INDEX(I)-K+1) of
          the I-th denominator polynomial, where K = 1,2,...,kdcoef.

  LDDCOE  INTEGER
          The leading dimension of array DCOEFF.
          LDDCOE &gt;= MAX(1,P) if ROWCOL = 'R';
          LDDCOE &gt;= MAX(1,M) if ROWCOL = 'C'.

  UCOEFF  (output) DOUBLE PRECISION array, dimension
          (LDUCO1,LDUCO2,N+1)
          If ROWCOL = 'R' then porp = M, otherwise porp = P.
          The leading porm-by-porp-by-kdcoef part of this array
          contains the coefficients of the numerator matrix U(s).
          UCOEFF(I,J,K) is the coefficient in s**(INDEX(iorj)-K+1)
          of polynomial (I,J) of U(s), where K = 1,2,...,kdcoef;
          if ROWCOL = 'R' then iorj = I, otherwise iorj = J.
          Thus for ROWCOL = 'R', U(s) =
          diag(s**INDEX(I))*(UCOEFF(.,.,1)+UCOEFF(.,.,2)/s+...).

  LDUCO1  INTEGER
          The leading dimension of array UCOEFF.
          LDUCO1 &gt;= MAX(1,P) if ROWCOL = 'R';
          LDUCO1 &gt;= MAX(1,M) if ROWCOL = 'C'.

  LDUCO2  INTEGER
          The second dimension of array UCOEFF.
          LDUCO2 &gt;= MAX(1,M) if ROWCOL = 'R';
          LDUCO2 &gt;= MAX(1,P) if ROWCOL = 'C'.

</PRE>
<B>Tolerances</B>
<PRE>
  TOL1    DOUBLE PRECISION
          The tolerance to be used in determining the i-th row of
          T(s), where i = 1,2,...,porm. If the user sets TOL1 &gt; 0,
          then the given value of TOL1 is used as an absolute
          tolerance; elements with absolute value less than TOL1 are
          considered neglijible. If the user sets TOL1 &lt;= 0, then
          an implicitly computed, default tolerance, defined in
          the SLICOT Library routine TB01ZD, is used instead.

  TOL2    DOUBLE PRECISION
          The tolerance to be used to separate out a controllable
          subsystem of (A,B,C). If the user sets TOL2 &gt; 0, then
          the given value of TOL2 is used as a lower bound for the
          reciprocal condition number (see the description of the
          argument RCOND in the SLICOT routine MB03OD);  a
          (sub)matrix whose estimated condition number is less than
          1/TOL2 is considered to be of full rank.  If the user sets
          TOL2 &lt;= 0, then an implicitly computed, default tolerance,
          defined in the SLICOT Library routine TB01UD, is used
          instead.

</PRE>
<B>Workspace</B>
<PRE>
  IWORK   INTEGER array, dimension (N+MAX(M,P))
          On exit, if INFO = 0, the first nonzero elements of
          IWORK(1:N) return the orders of the diagonal blocks of A.

  DWORK   DOUBLE PRECISION array, dimension (LDWORK)
          On exit, if INFO = 0, DWORK(1) returns the optimal value
          of LDWORK.

  LDWORK  INTEGER
          The length of the array DWORK.
          LDWORK &gt;= MAX(1, N*(N + 1) + MAX(N*MP + 2*N + MAX(N,MP),
                                    3*MP, PM)),
          where MP = M, PM = P, if ROWCOL = 'R';
                MP = P, PM = M, if ROWCOL = 'C'.
          For optimum performance LDWORK should be larger.

</PRE>
<B>Error Indicator</B>
<PRE>
  INFO    INTEGER
          = 0:  successful exit;
          &lt; 0:  if INFO = -i, the i-th argument had an illegal
                value.

</PRE>
<A name="Method"><B><FONT SIZE="+1">Method</FONT></B></A>
<PRE>
  The method for transfer matrices factorized by rows will be
  described here: T(s) factorized by columns is dealt with by
  operating on the dual of the original system.  Each row of
  T(s) is simply a single-output relatively left prime polynomial
  matrix representation, so can be calculated by applying a
  simplified version of the Orthogonal Structure Theorem to a
  minimal state-space representation for the corresponding row of
  the given system. A minimal state-space representation is obtained
  using the Orthogonal Canonical Form to first separate out a
  completely controllable one for the overall system and then, for
  each row in turn, applying it again to the resulting dual SIMO
  (single-input multi-output) system. Note that the elements of the
  transformed matrix A so calculated are individually scaled in a
  way which guarantees a monic denominator polynomial.

</PRE>
<A name="References"><B><FONT SIZE="+1">References</FONT></B></A>
<PRE>
  [1] Williams, T.W.C.
      An Orthogonal Structure Theorem for Linear Systems.
      Control Systems Research Group, Kingston Polytechnic,
      Internal Report 82/2, 1982.

</PRE>
<A name="Numerical Aspects"><B><FONT SIZE="+1">Numerical Aspects</FONT></B></A>
<PRE>                            3
  The algorithm requires 0(N ) operations.

</PRE>

<A name="Comments"><B><FONT SIZE="+1">Further Comments</FONT></B></A>
<PRE>
  None
</PRE>

<A name="Example"><B><FONT SIZE="+1">Example</FONT></B></A>
<P>
<B>Program Text</B>
<PRE>
*     TB04AD EXAMPLE PROGRAM TEXT
*
*     .. Parameters ..
      INTEGER          NIN, NOUT
      PARAMETER        ( NIN = 5, NOUT = 6 )
      INTEGER          NMAX, MMAX, PMAX
      PARAMETER        ( NMAX = 20, MMAX = 20, PMAX = 20 )
      INTEGER          MAXMP
      PARAMETER        ( MAXMP = MAX( MMAX, PMAX ) )
      INTEGER          LDA, LDB, LDC, LDD, LDDCOE, LDUCO1, LDUCO2,
     $                 NMAXP1
      PARAMETER        ( LDA = NMAX, LDB = NMAX, LDC = MAXMP,
     $                   LDD = MAXMP, LDDCOE = MAXMP, LDUCO1 = MAXMP,
     $                   LDUCO2 = MAXMP, NMAXP1 = NMAX+1 )
      INTEGER          LIWORK
      PARAMETER        ( LIWORK = NMAX + MAXMP )
      INTEGER          LDWORK
      PARAMETER        ( LDWORK = NMAX*( NMAX + 1 ) +
     $                            MAX( NMAX*MAXMP + 2*NMAX +
     $                                 MAX( NMAX, MAXMP ), 3*MAXMP ) )
*     .. Local Scalars ..
      DOUBLE PRECISION TOL1, TOL2
      INTEGER          I, II, IJ, INDBLK, INFO, J, JJ, KDCOEF, M, N,
     $                 NR, P, PORM, PORP
      CHARACTER*1      ROWCOL
      CHARACTER*132    ULINE
      LOGICAL          LROWCO
*     .. Local Arrays ..
      DOUBLE PRECISION A(LDA,NMAX), B(LDB,MAXMP), C(LDC,NMAX),
     $                 D(LDD,MAXMP), DCOEFF(LDDCOE,NMAXP1),
     $                 DWORK(LDWORK), UCOEFF(LDUCO1,LDUCO2,NMAXP1)
      INTEGER          INDEX(MAXMP), IWORK(LIWORK)
*     .. External Functions ..
      LOGICAL          LSAME
      EXTERNAL         LSAME
*     .. External Subroutines ..
      EXTERNAL         TB04AD
*     .. Intrinsic Functions ..
      INTRINSIC        MAX
*     .. Executable Statements ..
*
      WRITE ( NOUT, FMT = 99999 )
*     Skip the heading in the data file and read the data.
      READ ( NIN, FMT = '()' )
      READ ( NIN, FMT = * ) N, M, P, TOL1, TOL2, ROWCOL
      LROWCO = LSAME( ROWCOL, 'R' )
      ULINE(1:20) = ' '
      DO 20 I = 21, 132
         ULINE(I:I) = '-'
   20 CONTINUE
      IF ( N.LT.0 .OR. N.GT.NMAX ) THEN
         WRITE ( NOUT, FMT = 99986 ) N
      ELSE
         READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N )
         IF ( M.LT.0 .OR. M.GT.MMAX ) THEN
            WRITE ( NOUT, FMT = 99985 ) M
         ELSE
            READ ( NIN, FMT = * ) ( ( B(I,J), I = 1,N ), J = 1,M )
            IF ( P.LT.0 .OR. P.GT.PMAX ) THEN
               WRITE ( NOUT, FMT = 99984 ) P
            ELSE
               READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P )
               READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P )
*              Find the transfer matrix T(s) of (A,B,C,D).
               CALL TB04AD( ROWCOL, N, M, P, A, LDA, B, LDB, C, LDC, D,
     $                      LDD, NR, INDEX, DCOEFF, LDDCOE, UCOEFF,
     $                      LDUCO1, LDUCO2, TOL1, TOL2, IWORK, DWORK,
     $                      LDWORK, INFO )
*
               IF ( INFO.NE.0 ) THEN
                  WRITE ( NOUT, FMT = 99998 ) INFO
               ELSE
                  WRITE ( NOUT, FMT = 99997 ) NR
                  DO 40 I = 1, NR
                     WRITE ( NOUT, FMT = 99996 ) ( A(I,J), J = 1,NR )
   40             CONTINUE
                  WRITE ( NOUT, FMT = 99995 )
                  DO 60 I = 1, NR
                     WRITE ( NOUT, FMT = 99996 ) ( B(I,J), J = 1,M )
   60             CONTINUE
                  WRITE ( NOUT, FMT = 99994 )
                  DO 80 I = 1, P
                     WRITE ( NOUT, FMT = 99996 ) ( C(I,J), J = 1,NR )
   80             CONTINUE
                  INDBLK = 0
                  DO 100 I = 1, N
                     IF ( IWORK(I).NE.0 ) INDBLK = INDBLK + 1
  100             CONTINUE
                  IF ( LROWCO ) THEN
                     PORM = P
                     PORP = M
                     WRITE ( NOUT, FMT = 99993 ) INDBLK,
     $                          ( IWORK(I), I = 1,INDBLK )
                  ELSE
                     PORM = M
                     PORP = P
                     WRITE ( NOUT, FMT = 99992 ) INDBLK,
     $                          ( IWORK(I), I = 1,INDBLK )
                  END IF
                  WRITE ( NOUT, FMT = 99991 ) ( INDEX(I), I = 1,PORM )
                  WRITE ( NOUT, FMT = 99990 )
                  KDCOEF = 0
                  DO 120 I = 1, PORM
                     KDCOEF = MAX( KDCOEF, INDEX(I) )
  120             CONTINUE
                  KDCOEF = KDCOEF + 1
                  DO 160 II = 1, PORM
                     DO 140 JJ = 1, PORP
                        WRITE ( NOUT, FMT = 99989 ) II, JJ,
     $                    ( UCOEFF(II,JJ,IJ), IJ = 1,KDCOEF )
                        WRITE ( NOUT, FMT = 99988 ) ULINE(1:7*KDCOEF+21)
                        WRITE ( NOUT, FMT = 99987 )
     $                        ( DCOEFF(II,IJ), IJ = 1,KDCOEF )
  140                CONTINUE
  160             CONTINUE
               END IF
            END IF
         END IF
      END IF
      STOP
*
99999 FORMAT (' TB04AD EXAMPLE PROGRAM RESULTS',/1X)
99998 FORMAT (' INFO on exit from TB04AD = ',I2)
99997 FORMAT (' The order of the transformed state-space representatio',
     $       'n = ',I2,//' The transformed state dynamics matrix A is ')
99996 FORMAT (20(1X,F8.4))
99995 FORMAT (/' The transformed input/state matrix B is ')
99994 FORMAT (/' The transformed state/output matrix C is ')
99993 FORMAT (/' The controllability index of the transformed state-sp',
     $       'ace representation = ',I2,//' The dimensions of the diag',
     $       'onal blocks of the transformed A are ',/20(I5))
99992 FORMAT (/' The observability index of the transformed state-spac',
     $       'e representation = ',I2,//' The dimensions of the diagon',
     $       'al blocks of the transformed A are ',/20(I5))
99991 FORMAT (/' The degrees of the denominator polynomials are',/20(I5)
     $       )
99990 FORMAT (/' The coefficients of polynomials in the transfer matri',
     $       'x T(s) are ')
99989 FORMAT (/' element (',I2,',',I2,') is ',20(1X,F6.2))
99988 FORMAT (1X,A)
99987 FORMAT (20X,20(1X,F6.2))
99986 FORMAT (/' N is out of range.',/' N = ',I5)
99985 FORMAT (/' M is out of range.',/' M = ',I5)
99984 FORMAT (/' P is out of range.',/' P = ',I5)
      END
</PRE>
<B>Program Data</B>
<PRE>
 TB04AD EXAMPLE PROGRAM DATA
   3     2     2  0.0        0.0     R
  -1.0   0.0   0.0
   0.0  -2.0   0.0
   0.0   0.0  -3.0
   0.0   1.0  -1.0
   1.0   1.0   0.0
   0.0   1.0   1.0
   1.0   1.0   1.0
   1.0   0.0
   0.0   1.0
</PRE>
<B>Program Results</B>
<PRE>
 TB04AD EXAMPLE PROGRAM RESULTS

 The order of the transformed state-space representation =  3

 The transformed state dynamics matrix A is 
  -2.5000  -0.2887  -0.4082
  -0.2887  -1.5000  -0.7071
  -0.4082  -0.7071  -2.0000

 The transformed input/state matrix B is 
  -1.4142  -0.7071
   0.0000   1.2247
   0.0000   0.0000

 The transformed state/output matrix C is 
   0.0000   0.8165   1.1547
   0.0000   1.6330   0.5774

 The controllability index of the transformed state-space representation =  2

 The dimensions of the diagonal blocks of the transformed A are 
    2    1

 The degrees of the denominator polynomials are
    2    3

 The coefficients of polynomials in the transfer matrix T(s) are 

 element ( 1, 1) is    1.00   5.00   7.00   0.00
                     -----------------------------
                       1.00   5.00   6.00   0.00

 element ( 1, 2) is    0.00   1.00   3.00   0.00
                     -----------------------------
                       1.00   5.00   6.00   0.00

 element ( 2, 1) is    0.00   0.00   1.00   1.00
                     -----------------------------
                       1.00   6.00  11.00   6.00

 element ( 2, 2) is    1.00   8.00  20.00  15.00
                     -----------------------------
                       1.00   6.00  11.00   6.00
</PRE>

<HR>
<p>
<A HREF=..\libindex.html><B>Return to index</B></A></BODY>
</HTML>