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
<HTML>
<HEAD><TITLE>SB08CD - SLICOT Library Routine Documentation</TITLE>
</HEAD>
<BODY>

<H2><A Name="SB08CD">SB08CD</A></H2>
<H3>
Left coprime factorization with inner denominator
</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 construct, for a given system G = (A,B,C,D), an output
  injection matrix H, an orthogonal transformation matrix Z, and a
  gain matrix V, such that the systems

       Q = (Z'*(A+H*C)*Z, Z'*(B+H*D), V*C*Z, V*D)
  and
       R = (Z'*(A+H*C)*Z, Z'*H, V*C*Z, V)

  provide a stable left coprime factorization of G in the form
                -1
           G = R  * Q,

  where G, Q and R are the corresponding transfer-function matrices
  and the denominator R is co-inner, that is, R(s)*R'(-s) = I in
  the continuous-time case, or R(z)*R'(1/z) = I in the discrete-time
  case. The Z matrix is not explicitly computed.

  Note: G must have no observable poles on the imaginary axis
  for a continuous-time system, or on the unit circle for a
  discrete-time system. If the given state-space representation
  is not detectable, the undetectable part of the original
  system is automatically deflated and the order of the systems
  Q and R is accordingly reduced.

</PRE>
<A name="Specification"><B><FONT SIZE="+1">Specification</FONT></B></A>
<PRE>
      SUBROUTINE SB08CD( DICO, N, M, P, A, LDA, B, LDB, C, LDC, D, LDD,
     $                   NQ, NR, BR, LDBR, DR, LDDR, TOL, DWORK, LDWORK,
     $                   IWARN, INFO )
C     .. Scalar Arguments ..
      CHARACTER         DICO
      INTEGER           INFO, IWARN, LDA, LDB, LDBR, LDC, LDD, LDDR,
     $                  LDWORK, M, N, NQ, NR, P
      DOUBLE PRECISION  TOL
C     .. Array Arguments ..
      DOUBLE PRECISION  A(LDA,*), B(LDB,*), BR(LDBR,*), C(LDC,*),
     $                  D(LDD,*), DR(LDDR,*), DWORK(*)

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

<B>Mode Parameters</B>
<PRE>
  DICO    CHARACTER*1
          Specifies the type of the original system as follows:
          = 'C':  continuous-time system;
          = 'D':  discrete-time system.

</PRE>
<B>Input/Output Parameters</B>
<PRE>
  N       (input) INTEGER
          The dimension of the state vector, i.e. the order of the
          matrix A, and also the number of rows of the matrices B
          and BR, and the number of columns of the matrix C.
          N &gt;= 0.

  M       (input) INTEGER
          The dimension of input vector, i.e. the number of columns
          of the matrices B and D.  M &gt;= 0.

  P       (input) INTEGER
          The dimension of output vector, i.e. the number of rows
          of the matrices C, D and DR, and the number of columns
          of the matrices BR and DR.  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 state dynamics matrix A. The matrix A must not
          have observable eigenvalues on the imaginary axis, if
          DICO = 'C', or on the unit circle, if DICO = 'D'.
          On exit, the leading NQ-by-NQ part of this array contains
          the leading NQ-by-NQ part of the matrix Z'*(A+H*C)*Z, the
          state dynamics matrix of the numerator factor Q, in a
          real Schur form. The leading NR-by-NR part of this matrix
          represents the state dynamics matrix of a minimal
          realization of the denominator factor R.

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

  B       (input/output) DOUBLE PRECISION array, dimension
          (LDB,MAX(M,P))
          On entry, the leading N-by-M part of this array must
          contain the input/state matrix.
          On exit, the leading NQ-by-M part of this array contains
          the leading NQ-by-M part of the matrix Z'*(B+H*D), the
          input/state matrix of the numerator factor Q.
          The remaining part of this array is needed as workspace.

  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 state/output matrix C.
          On exit, the leading P-by-NQ part of this array contains
          the leading P-by-NQ part of the matrix V*C*Z, the
          state/output matrix of the numerator factor Q.
          The first NR columns of this array represent the
          state/output matrix of a minimal realization of the
          denominator factor R.
          The remaining part of this array is needed as workspace.

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

  D       (input/output) DOUBLE PRECISION array, dimension
          (LDD,MAX(M,P))
          On entry, the leading P-by-M part of this array must
          contain the input/output matrix.
          On exit, the leading P-by-M part of this array contains
          the matrix V*D representing the input/output matrix
          of the numerator factor Q.
          The remaining part of this array is needed as workspace.

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

  NQ      (output) INTEGER
          The order of the resulting factors Q and R.
          Generally, NQ = N - NS, where NS is the number of
          unobservable eigenvalues outside the stability region.

  NR      (output) INTEGER
          The order of the minimal realization of the factor R.
          Generally, NR is the number of observable eigenvalues
          of A outside the stability region (the number of modified
          eigenvalues).

  BR      (output) DOUBLE PRECISION array, dimension (LDBR,P)
          The leading NQ-by-P part of this array contains the
          leading NQ-by-P part of the output injection matrix
          Z'*H, which reflects the eigenvalues of A lying outside
          the stable region to values which are symmetric with
          respect to the imaginary axis (if DICO = 'C') or the unit
          circle (if DICO = 'D'). The first NR rows of this matrix
          form the input/state matrix of a minimal realization of
          the denominator factor R.

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

  DR      (output) DOUBLE PRECISION array, dimension (LDDR,P)
          The leading P-by-P part of this array contains the lower
          triangular matrix V representing the input/output matrix
          of the denominator factor R.

  LDDR    INTEGER
          The leading dimension of array DR.  LDDR &gt;= MAX(1,P).

</PRE>
<B>Tolerances</B>
<PRE>
  TOL     DOUBLE PRECISION
          The absolute tolerance level below which the elements of
          C are considered zero (used for observability tests).
          If the user sets TOL &lt;= 0, then an implicitly computed,
          default tolerance, defined by  TOLDEF = N*EPS*NORM(C),
          is used instead, where EPS is the machine precision
          (see LAPACK Library routine DLAMCH) and NORM(C) denotes
          the infinity-norm of C.

</PRE>
<B>Workspace</B>
<PRE>
  DWORK   DOUBLE PRECISION array, dimension (LDWORK)
          On exit, if INFO = 0, DWORK(1) returns the optimal value
          of LDWORK.

  LDWORK  INTEGER
          The dimension of working array DWORK.
          LDWORK &gt;= MAX( 1, P*N + MAX( N*(N+5),P*(P+2),4*P,4*M ) ).
          For optimum performance LDWORK should be larger.

</PRE>
<B>Warning Indicator</B>
<PRE>
  IWARN   INTEGER
          = 0:  no warning;
          = K:  K violations of the numerical stability condition
                NORM(H) &lt;= 10*NORM(A)/NORM(C) occured during the
                assignment of eigenvalues.

</PRE>
<B>Error Indicator</B>
<PRE>
  INFO    INTEGER
          = 0:  successful exit;
          &lt; 0:  if INFO = -i, the i-th argument had an illegal
                value;
          = 1:  the reduction of A to a real Schur form failed;
          = 2:  a failure was detected during the ordering of the
                real Schur form of A, or in the iterative process
                for reordering the eigenvalues of Z'*(A + H*C)*Z
                along the diagonal;
          = 3:  if DICO = 'C' and the matrix A has an observable
                eigenvalue on the imaginary axis, or DICO = 'D' and
                A has an observable eigenvalue on the unit circle.

</PRE>
<A name="Method"><B><FONT SIZE="+1">Method</FONT></B></A>
<PRE>
  The subroutine uses the right coprime factorization algorithm with
  inner denominator of [1] applied to G'.

</PRE>
<A name="References"><B><FONT SIZE="+1">References</FONT></B></A>
<PRE>
  [1] Varga A.
      A Schur method for computing coprime factorizations with
      inner denominators and applications in model reduction.
      Proc. ACC'93, San Francisco, CA, pp. 2130-2131, 1993.

</PRE>
<A name="Numerical Aspects"><B><FONT SIZE="+1">Numerical Aspects</FONT></B></A>
<PRE>                                         3
  The algorithm requires no more than 14N  floating point
  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>
*     SB08CD EXAMPLE PROGRAM TEXT
*
*     .. Parameters ..
      INTEGER          NIN, NOUT
      PARAMETER        ( NIN = 5, NOUT = 6 )
      INTEGER          NMAX, MMAX, PMAX
      PARAMETER        ( NMAX = 20, MMAX = 20, PMAX = 20 )
      INTEGER          MPMAX
      PARAMETER        ( MPMAX = MAX( MMAX, PMAX ) )
      INTEGER          LDA, LDB, LDBR, LDC, LDD, LDDR
      PARAMETER        ( LDA = NMAX, LDB = NMAX, LDBR = NMAX,
     $                   LDC = MPMAX, LDD = MPMAX, LDDR = PMAX )
      INTEGER          LDWORK
      PARAMETER        ( LDWORK = NMAX*PMAX + MAX( NMAX*( NMAX + 5 ),
     $                            PMAX*( PMAX + 2 ), 4*PMAX, 4*MMAX ) )
*     .. Local Scalars ..
      DOUBLE PRECISION TOL
      INTEGER          I, INFO, IWARN, J, M, N, NQ, NR, P
      CHARACTER*1      DICO
*     .. Local Arrays ..
      DOUBLE PRECISION A(LDA,NMAX), B(LDB,MPMAX), BR(LDBR,PMAX),
     $                 C(LDC,NMAX), D(LDD,MPMAX), DR(LDDR,PMAX),
     $                 DWORK(LDWORK)
*     .. External Subroutines ..
      EXTERNAL         SB08CD
*     .. 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, TOL, DICO
      IF ( N.LT.0 .OR. N.GT.NMAX ) THEN
         WRITE ( NOUT, FMT = 99990 ) 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 = 99989 ) M
         ELSE
            READ ( NIN, FMT = * ) ( ( B(I,J), J = 1, M ), I = 1, N )
            IF ( P.LT.0 .OR. P.GT.PMAX ) THEN
               WRITE ( NOUT, FMT = 99988 ) 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 a RCFID for (A,B,C,D).
               CALL SB08CD( DICO, N, M, P, A, LDA, B, LDB, C, LDC,
     $                      D, LDD, NQ, NR, BR, LDBR, DR, LDDR, TOL,
     $                      DWORK, LDWORK, IWARN, INFO )
*
               IF ( INFO.NE.0 ) THEN
                  WRITE ( NOUT, FMT = 99998 ) INFO
               ELSE
                  IF( NQ.GT.0 ) WRITE ( NOUT, FMT = 99996 )
                  DO 20 I = 1, NQ
                     WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1, NQ )
   20             CONTINUE
                  IF( NQ.GT.0 ) WRITE ( NOUT, FMT = 99993 )
                  DO 40 I = 1, NQ
                     WRITE ( NOUT, FMT = 99995 ) ( B(I,J), J = 1, M )
   40             CONTINUE
                  IF( NQ.GT.0 ) WRITE ( NOUT, FMT = 99992 )
                  DO 60 I = 1, P
                     WRITE ( NOUT, FMT = 99995 ) ( C(I,J), J = 1, NQ )
   60             CONTINUE
                  WRITE ( NOUT, FMT = 99991 )
                  DO 70 I = 1, P
                     WRITE ( NOUT, FMT = 99995 ) ( D(I,J), J = 1, M )
   70             CONTINUE
                  IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99986 )
                  DO 80 I = 1, NR
                     WRITE ( NOUT, FMT = 99995 )
     $                     ( A(I,J), J = 1, NR )
   80             CONTINUE
                  IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99985 )
                  DO 90 I = 1, NR
                     WRITE ( NOUT, FMT = 99995 ) ( BR(I,J), J = 1, P )
   90             CONTINUE
                  IF( NR.GT.0 ) WRITE ( NOUT, FMT = 99984 )
                  DO 100 I = 1, P
                     WRITE ( NOUT, FMT = 99995 )
     $                     ( C(I,J), J = 1, NR )
  100             CONTINUE
                  WRITE ( NOUT, FMT = 99983 )
                  DO 110 I = 1, P
                     WRITE ( NOUT, FMT = 99995 ) ( DR(I,J), J = 1, P )
  110             CONTINUE
               END IF
            END IF
         END IF
      END IF
      STOP
*
99999 FORMAT (' SB08CD EXAMPLE PROGRAM RESULTS',/1X)
99998 FORMAT (' INFO on exit from SB08CD = ',I2)
99996 FORMAT (/' The numerator state dynamics matrix AQ is ')
99995 FORMAT (20(1X,F8.4))
99993 FORMAT (/' The numerator input/state matrix BQ is ')
99992 FORMAT (/' The numerator state/output matrix CQ is ')
99991 FORMAT (/' The numerator input/output matrix DQ is ')
99990 FORMAT (/' N is out of range.',/' N = ',I5)
99989 FORMAT (/' M is out of range.',/' M = ',I5)
99988 FORMAT (/' P is out of range.',/' P = ',I5)
99986 FORMAT (/' The denominator state dynamics matrix AR is ')
99985 FORMAT (/' The denominator input/state matrix BR is ')
99984 FORMAT (/' The denominator state/output matrix CR is ')
99983 FORMAT (/' The denominator input/output matrix DR is ')
      END
</PRE>
<B>Program Data</B>
<PRE>
 SB08CD EXAMPLE PROGRAM DATA (Continuous system)
  7  2  3   1.E-10 C
 -0.04165  0.0000  4.9200   0.4920  0.0000   0.0000  0.0000
 -5.2100  -12.500  0.0000   0.0000  0.0000   0.0000  0.0000
  0.0000   3.3300 -3.3300   0.0000  0.0000   0.0000  0.0000
  0.5450   0.0000  0.0000   0.0000  0.0545   0.0000  0.0000
  0.0000   0.0000  0.0000  -0.49200 0.004165 0.0000  4.9200
  0.0000   0.0000  0.0000   0.0000  0.5210  -12.500  0.0000
  0.0000   0.0000  0.0000   0.0000  0.0000   3.3300 -3.3300
  0.0000   0.0000
  12.500   0.0000
  0.0000   0.0000
  0.0000   0.0000
  0.0000   0.0000
  0.0000   12.500
  0.0000   0.0000
  1.0000   0.0000  0.0000   0.0000  0.0000  0.0000  0.0000
  0.0000   0.0000  0.0000   1.0000  0.0000  0.0000  0.0000
  0.0000   0.0000  0.0000   0.0000  1.0000  0.0000  0.0000
  0.0000   0.0000  
  0.0000   0.0000  
  0.0000   0.0000  
</PRE>
<B>Program Results</B>
<PRE>
 SB08CD EXAMPLE PROGRAM RESULTS


 The numerator state dynamics matrix AQ is 
  -0.1605   0.0523   0.9423   2.0193   0.4166   0.2518   1.6140
  -0.4489  -0.1605   1.7955   3.8719  -0.2394   0.0491  -0.8740
   0.0000   0.0000 -12.4245   3.5463  -0.0057   0.0254  -0.0053
   0.0000   0.0000   0.0000  -3.5957  -0.0153  -0.0290  -0.0616
   0.0000   0.0000   0.0000   0.0000 -13.1627  -1.9835  -3.6182
   0.0000   0.0000   0.0000   0.0000   0.0000  -1.4178   5.6218
   0.0000   0.0000   0.0000   0.0000   0.0000  -0.8374  -1.4178

 The numerator input/state matrix BQ is 
  -1.0157   0.2554
   0.5523   0.4443
   0.0056 -11.6989
   0.0490   4.3728
  11.7198  -0.0038
  -2.8173   0.0308
   3.1018  -0.0009

 The numerator state/output matrix CQ is 
   0.1975  -0.1063  -0.0006  -0.0083   0.1279   0.8797   0.3994
   0.8541  -0.4513  -0.0007  -0.0041   0.0305  -0.2562   0.0122
   0.4668   0.8826   0.0248  -0.0506   0.0000   0.0022  -0.0017

 The numerator input/output matrix DQ is 
   0.0000   0.0000
   0.0000   0.0000
   0.0000   0.0000

 The denominator state dynamics matrix AR is 
  -0.1605   0.0523
  -0.4489  -0.1605

 The denominator input/state matrix BR is 
  -0.0158  -0.0692  -0.1688
   0.0306   0.1281  -0.4984

 The denominator state/output matrix CR is 
   0.1975  -0.1063
   0.8541  -0.4513
   0.4668   0.8826

 The denominator input/output matrix DR is 
   1.0000   0.0000   0.0000
   0.0000   1.0000   0.0000
   0.0000   0.0000   1.0000
</PRE>

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