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
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
<HTML>
<HEAD><TITLE>SB16CD - SLICOT Library Routine Documentation</TITLE>
</HEAD>
<BODY>

<H2><A Name="SB16CD">SB16CD</A></H2>
<H3>
Coprime factorization based frequency-weighted state feedback controller reduction
</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 compute, for a given open-loop model (A,B,C,D), and for
  given state feedback gain F and full observer gain G,
  such that A+B*F and A+G*C are stable, a reduced order
  controller model (Ac,Bc,Cc) using a coprime factorization
  based controller reduction approach. For reduction of
  coprime factors, a stability enforcing frequency-weighted
  model reduction is performed using either the square-root or
  the balancing-free square-root versions of the Balance & Truncate
  (B&T) model reduction method.

</PRE>
<A name="Specification"><B><FONT SIZE="+1">Specification</FONT></B></A>
<PRE>
      SUBROUTINE SB16CD( DICO, JOBD, JOBMR, JOBCF, ORDSEL, N, M, P, NCR,
     $                   A, LDA, B, LDB, C, LDC, D, LDD, F, LDF, G, LDG,
     $                   HSV, TOL, IWORK, DWORK, LDWORK, IWARN, INFO )
C     .. Scalar Arguments ..
      CHARACTER         DICO, JOBCF, JOBD, JOBMR, ORDSEL
      INTEGER           INFO, IWARN, LDA, LDB, LDC, LDD,
     $                  LDF, LDG, LDWORK, M, N, NCR, P
      DOUBLE PRECISION  TOL
C     .. Array Arguments ..
      INTEGER           IWORK(*)
      DOUBLE PRECISION  A(LDA,*), B(LDB,*), C(LDC,*), D(LDD,*),
     $                  DWORK(*), F(LDF,*), G(LDG,*), HSV(*)

</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 open-loop system as follows:
          = 'C':  continuous-time system;
          = 'D':  discrete-time system.

  JOBD    CHARACTER*1
          Specifies whether or not a non-zero matrix D appears
          in the given state space model, as follows:
          = 'D':  D is present;
          = 'Z':  D is assumed a zero matrix.

  JOBMR   CHARACTER*1
          Specifies the model reduction approach to be used
          as follows:
          = 'B':  use the square-root B&T method;
          = 'F':  use the balancing-free square-root B&T method.

  JOBCF   CHARACTER*1
          Specifies whether left or right coprime factorization
          of the controller is to be used as follows:
          = 'L':  use left coprime factorization;
          = 'R':  use right coprime factorization.

  ORDSEL  CHARACTER*1
          Specifies the order selection method as follows:
          = 'F':  the resulting controller order NCR is fixed;
          = 'A':  the resulting controller order NCR is
                  automatically determined on basis of the given
                  tolerance TOL.

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

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

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

  NCR     (input/output) INTEGER
          On entry with ORDSEL = 'F', NCR is the desired order of
          the resulting reduced order controller.  0 &lt;= NCR &lt;= N.
          On exit, if INFO = 0, NCR is the order of the resulting
          reduced order controller. NCR is set as follows:
          if ORDSEL = 'F', NCR is equal to MIN(NCR,NCRMIN), where
          NCR is the desired order on entry, and NCRMIN is the
          number of Hankel-singular values greater than N*EPS*S1,
          where EPS is the machine precision (see LAPACK Library
          Routine DLAMCH) and S1 is the largest Hankel singular
          value (computed in HSV(1)); NCR can be further reduced
          to ensure HSV(NCR) &gt; HSV(NCR+1);
          if ORDSEL = 'A', NCR is equal to the number of Hankel
          singular values greater than MAX(TOL,N*EPS*S1).

  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, if INFO = 0, the leading NCR-by-NCR part of this
          array contains the state dynamics matrix Ac of the reduced
          controller.

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

  B       (input/output) DOUBLE PRECISION array, dimension (LDB,M)
          On entry, the leading N-by-M part of this array must
          contain the open-loop system input/state matrix B.
          On exit, this array is overwritten with a NCR-by-M
          B&T approximation of the 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 open-loop system state/output matrix C.
          On exit, this array is overwritten with a P-by-NCR
          B&T approximation of the matrix C.

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

  D       (input) DOUBLE PRECISION array, dimension (LDD,M)
          On entry, if JOBD = 'D', the leading P-by-M part of this
          array must contain the system direct input/output
          transmission matrix D.
          The array D is not referenced if JOBD = 'Z'.

  LDD     INTEGER
          The leading dimension of array D.
          LDD &gt;= MAX(1,P), if JOBD = 'D';
          LDD &gt;= 1,        if JOBD = 'Z'.

  F       (input/output) DOUBLE PRECISION array, dimension (LDF,N)
          On entry, the leading M-by-N part of this array must
          contain a stabilizing state feedback matrix.
          On exit, if INFO = 0, the leading M-by-NCR part of this
          array contains the output/state matrix Cc of the reduced
          controller.

  LDF     INTEGER
          The leading dimension of array F.  LDF &gt;= MAX(1,M).

  G       (input/output) DOUBLE PRECISION array, dimension (LDG,P)
          On entry, the leading N-by-P part of this array must
          contain a stabilizing observer gain matrix.
          On exit, if INFO = 0, the leading NCR-by-P part of this
          array contains the input/state matrix Bc of the reduced
          controller.

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

  HSV     (output) DOUBLE PRECISION array, dimension (N)
          If INFO = 0, HSV contains the N frequency-weighted
          Hankel singular values ordered decreasingly (see METHOD).

</PRE>
<B>Tolerances</B>
<PRE>
  TOL     DOUBLE PRECISION
          If ORDSEL = 'A', TOL contains the tolerance for
          determining the order of reduced controller.
          The recommended value is TOL = c*S1, where c is a constant
          in the interval [0.00001,0.001], and S1 is the largest
          Hankel singular value (computed in HSV(1)).
          The value TOL = N*EPS*S1 is used by default if
          TOL &lt;= 0 on entry, where EPS is the machine precision
          (see LAPACK Library Routine DLAMCH).
          If ORDSEL = 'F', the value of TOL is ignored.

</PRE>
<B>Workspace</B>
<PRE>
  IWORK   INTEGER array, dimension (LIWORK)
          LIWORK = 0,   if JOBMR = 'B';
          LIWORK = N,   if JOBMR = 'F'.

  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;= 2*N*N + MAX( 1, 2*N*N + 5*N, N*MAX(M,P),
                                 N*(N + MAX(N,MP) + MIN(N,MP) + 6)),
          where     MP = M, if JOBCF = 'L';
                    MP = P, if JOBCF = 'R'.
          For optimum performance LDWORK should be larger.

</PRE>
<B>Warning Indicator</B>
<PRE>
  IWARN   INTEGER
          = 0:  no warning;
          = 1:  with ORDSEL = 'F', the selected order NCR is
                greater than the order of a minimal realization
                of the controller;
          = 2:  with ORDSEL = 'F', the selected order NCR
                corresponds to repeated singular values, which are
                neither all included nor all excluded from the
                reduced controller. In this case, the resulting NCR
                is set automatically to the largest value such that
                HSV(NCR) &gt; HSV(NCR+1).

</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:  eigenvalue computation failure;
          = 2:  the matrix A+G*C is not stable;
          = 3:  the matrix A+B*F is not stable;
          = 4:  the Lyapunov equation for computing the
                observability Grammian is (nearly) singular;
          = 5:  the Lyapunov equation for computing the
                controllability Grammian is (nearly) singular;
          = 6:  the computation of Hankel singular values failed.

</PRE>
<A name="Method"><B><FONT SIZE="+1">Method</FONT></B></A>
<PRE>
  Let be the linear system

       d[x(t)] = Ax(t) + Bu(t)
       y(t)    = Cx(t) + Du(t),                             (1)

  where d[x(t)] is dx(t)/dt for a continuous-time system and x(t+1)
  for a discrete-time system, and let Go(d) be the open-loop
  transfer-function matrix
                       -1
       Go(d) = C*(d*I-A) *B + D .

  Let F and G be the state feedback and observer gain matrices,
  respectively, chosen such that A+BF and A+GC are stable matrices.
  The controller has a transfer-function matrix K(d) given by
                                    -1
       K(d) = F*(d*I-A-B*F-G*C-G*D*F) *G .

  The closed-loop transfer function matrix is given by
                                 -1
       Gcl(d) = Go(d)(I+K(d)Go(d)) .

  K(d) can be expressed as a left coprime factorization (LCF)
                      -1
       K(d) = M_left(d) *N_left(d),

  or as a right coprime factorization (RCF)
                                  -1
       K(d) = N_right(d)*M_right(d) ,

  where M_left(d), N_left(d), N_right(d), and M_right(d) are
  stable transfer-function matrices.

  The subroutine SB16CD determines the matrices of a reduced
  controller

       d[z(t)] = Ac*z(t) + Bc*y(t)
       u(t)    = Cc*z(t),                                   (2)

  with the transfer-function matrix Kr, using the following
  stability enforcing approach proposed in [1]:

  (1) If JOBCF = 'L', the frequency-weighted approximation problem
      is solved

      min||[M_left(d)-M_leftr(d)  N_left(d)-N_leftr(d)][-Y(d)]|| ,
                                                       [ X(d)]
      where
                           -1
            G(d) = Y(d)*X(d)

      is a RCF of the open-loop system transfer-function matrix.
      The B&T model reduction technique is used in conjunction
      with the method proposed in [1].

  (2) If JOBCF = 'R', the frequency-weighted approximation problem
      is solved

      min || [ -U(d) V(d) ] [ N_right(d)-N_rightr(d) ] || ,
                            [ M_right(d)-M_rightr(d) ]
      where
                      -1
            G(d) = V(d) *U(d)

      is a LCF of the open-loop system transfer-function matrix.
      The B&T model reduction technique is used in conjunction
      with the method proposed in [1].

  If ORDSEL = 'A', the order of the controller is determined by
  computing the number of Hankel singular values greater than
  the given tolerance TOL. The Hankel singular values are
  the square roots of the eigenvalues of the product of
  two frequency-weighted Grammians P and Q, defined as follows.

  If JOBCF = 'L', then P is the controllability Grammian of a system
  of the form (A+BF,B,*,*), and Q is the observability Grammian of a
  system of the form (A+GC,*,F,*). This choice corresponds to an
  input frequency-weighted order reduction of left coprime
  factors [1].

  If JOBCF = 'R', then P is the controllability Grammian of a system
  of the form (A+BF,G,*,*), and Q is the observability Grammian of a
  system of the form (A+GC,*,C,*). This choice corresponds to an
  output frequency-weighted order reduction of right coprime
  factors [1].

  For the computation of truncation matrices, the B&T approach
  is used in conjunction with accuracy enhancing techniques.
  If JOBMR = 'B', the square-root B&T method of [2,4] is used.
  If JOBMR = 'F', the balancing-free square-root version of the
  B&T method [3,4] is used.

</PRE>
<A name="References"><B><FONT SIZE="+1">References</FONT></B></A>
<PRE>
  [1] Liu, Y., Anderson, B.D.O. and Ly, O.L.
      Coprime factorization controller reduction with Bezout
      identity induced frequency weighting.
      Automatica, vol. 26, pp. 233-249, 1990.

  [2] Tombs, M.S. and Postlethwaite I.
      Truncated balanced realization of stable, non-minimal
      state-space systems.
      Int. J. Control, Vol. 46, pp. 1319-1330, 1987.

  [3] Varga, A.
      Efficient minimal realization procedure based on balancing.
      Proc. of IMACS/IFAC Symp. MCTS, Lille, France, May 1991,
      A. El Moudui, P. Borne, S. G. Tzafestas (Eds.), Vol. 2,
      pp. 42-46, 1991.

  [4] Varga, A.
      Coprime factors model reduction method based on square-root
      balancing-free techniques.
      System Analysis, Modelling and Simulation, Vol. 11,
      pp. 303-311, 1993.

</PRE>
<A name="Numerical Aspects"><B><FONT SIZE="+1">Numerical Aspects</FONT></B></A>
<PRE>
  The implemented methods rely on accuracy enhancing square-root or
  balancing-free square-root techniques.
                                      3
  The algorithms require less than 30N  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>
*     SB16CD EXAMPLE PROGRAM TEXT
*
*     .. Parameters ..
      INTEGER          NIN, NOUT
      PARAMETER        ( NIN = 5, NOUT = 6 )
      INTEGER          NMAX, MMAX, PMAX
      PARAMETER        ( NMAX = 20, MMAX = 20, PMAX = 20 )
      INTEGER          LDA, LDB, LDC, LDD, LDDC, LDF, LDG
      PARAMETER        ( LDA = NMAX, LDB = NMAX, LDC = PMAX,
     $                 LDD = PMAX, LDDC = MMAX, LDF = MMAX, LDG = NMAX )
      INTEGER          LDWORK, LIWORK, MPMAX
      PARAMETER        ( LIWORK = 2*NMAX, MPMAX = MAX( MMAX, PMAX ) )
      PARAMETER        ( LDWORK = 2*NMAX*NMAX +
     $                            MAX( 2*NMAX*NMAX + 5*NMAX,
     $                                 NMAX*( NMAX + MAX( NMAX, MPMAX )
     $                                      + MIN( NMAX, MPMAX ) + 6 ) )
     $                 )
      CHARACTER        DICO, JOBCF, JOBD, JOBMR, ORDSEL
      INTEGER          I, INFO, IWARN, J, M, N, NCR, P
      DOUBLE PRECISION TOL
*     .. Local Arrays ..
      DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), C(LDC,NMAX),
     $                 D(LDD,MMAX), DWORK(LDWORK),
     $                 F(LDF,NMAX), G(LDG,PMAX), HSV(NMAX)
      INTEGER          IWORK(LIWORK)
*     .. External Subroutines ..
      EXTERNAL         SB16CD
*     .. Intrinsic Functions ..
      INTRINSIC        MAX, MIN
*     .. 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, NCR, TOL,
     $                      DICO, JOBD, JOBMR, JOBCF, ORDSEL
      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 )
               READ ( NIN, FMT = * ) ( ( F(I,J), J = 1,N ), I = 1,M )
               READ ( NIN, FMT = * ) ( ( G(I,J), J = 1,P ), I = 1,N )
*              Find a reduced ssr for (A,B,C,D).
               CALL SB16CD( DICO, JOBD, JOBMR, JOBCF, ORDSEL, N, M, P,
     $                      NCR, A, LDA, B, LDB, C, LDC, D, LDD, F, LDF,
     $                      G, LDG, HSV, TOL, IWORK, DWORK, LDWORK,
     $                      IWARN, INFO )
*
               IF ( INFO.NE.0 ) THEN
                  WRITE ( NOUT, FMT = 99998 ) INFO
               ELSE
                  WRITE ( NOUT, FMT = 99997 ) NCR
                  WRITE ( NOUT, FMT = 99987 )
                  WRITE ( NOUT, FMT = 99995 ) ( HSV(J), J = 1,N )
                  IF( NCR.GT.0 ) WRITE ( NOUT, FMT = 99996 )
                  DO 20 I = 1, NCR
                     WRITE ( NOUT, FMT = 99995 ) ( A(I,J), J = 1,NCR )
   20             CONTINUE
                  IF( NCR.GT.0 ) WRITE ( NOUT, FMT = 99993 )
                  DO 40 I = 1, NCR
                     WRITE ( NOUT, FMT = 99995 ) ( G(I,J), J = 1,P )
   40             CONTINUE
                  IF( NCR.GT.0 ) WRITE ( NOUT, FMT = 99992 )
                  DO 60 I = 1, M
                     WRITE ( NOUT, FMT = 99995 ) ( F(I,J), J = 1,NCR )
   60             CONTINUE
               END IF
            END IF
         END IF
      END IF
      STOP
*
99999 FORMAT (' SB16CD EXAMPLE PROGRAM RESULTS',/1X)
99998 FORMAT (' INFO on exit from SB16CD = ',I2)
99997 FORMAT (' The order of reduced controller = ',I2)
99996 FORMAT (/' The reduced controller state dynamics matrix Ac is ')
99995 FORMAT (20(1X,F8.4))
99993 FORMAT (/' The reduced controller input/state matrix Bc is ')
99992 FORMAT (/' The reduced controller state/output matrix Cc 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)
99987 FORMAT (/' The frequency-weighted Hankel singular values are:')
      END
</PRE>
<B>Program Data</B>
<PRE>
 SB16CD EXAMPLE PROGRAM DATA (Continuous system)
  8  1  1   2   0.1E0  C  D  F  R  F
         0    1.0000         0         0         0         0         0        0
         0         0         0         0         0         0         0        0
         0         0   -0.0150    0.7650         0         0         0        0
         0         0   -0.7650   -0.0150         0         0         0        0
         0         0         0         0   -0.0280    1.4100         0        0
         0         0         0         0   -1.4100   -0.0280         0        0
         0         0         0         0         0         0   -0.0400    1.850
         0         0         0         0         0         0   -1.8500   -0.040
    0.0260
   -0.2510
    0.0330
   -0.8860
   -4.0170
    0.1450
    3.6040
    0.2800
  -.996 -.105 0.261 .009 -.001 -.043 0.002 -0.026
  0.0
4.472135954999638e-002    6.610515358414598e-001    4.698598960657579e-003  3.601363251422058e-001    1.032530880771415e-001   -3.754055214487997e-002  -4.268536964759344e-002    3.287284547842979e-002
    4.108939884667451e-001
    8.684600000000012e-002
    3.852317308197148e-004
   -3.619366874815911e-003
   -8.803722876359955e-003
    8.420521094001852e-003
    1.234944428038507e-003
    4.263205617645322e-003

</PRE>
<B>Program Results</B>
<PRE>
 SB16CD EXAMPLE PROGRAM RESULTS

 The order of reduced controller =  2

 The frequency-weighted Hankel singular values are:
   3.3073   0.7274   0.1124   0.0784   0.0242   0.0182   0.0101   0.0094

 The reduced controller state dynamics matrix Ac is 
  -0.4334   0.4884
  -0.1950  -0.1093

 The reduced controller input/state matrix Bc is 
  -0.4231
  -0.1785

 The reduced controller state/output matrix Cc is 
  -0.0326  -0.2307
</PRE>

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