AB05RD

Closed-loop system for a mixed output and state feedback control law

[Specification] [Arguments] [Method] [References] [Comments] [Example]

Purpose

  To construct for a given state space system (A,B,C,D) the closed-
  loop system (Ac,Bc,Cc,Dc) corresponding to the mixed output and
  state feedback control law

       u = alpha*F*y + beta*K*x + G*v
       z = H*y.

Specification
      SUBROUTINE AB05RD( FBTYPE, JOBD, N, M, P, MV, PZ, ALPHA, BETA, A,
     $                   LDA, B, LDB, C, LDC, D, LDD, F, LDF, K, LDK,
     $                   G, LDG, H, LDH, RCOND, BC, LDBC, CC, LDCC,
     $                   DC, LDDC, IWORK, DWORK, LDWORK, INFO )
C     .. Scalar Arguments ..
      CHARACTER         FBTYPE, JOBD
      INTEGER           INFO, LDA, LDB, LDBC, LDC, LDCC, LDD, LDDC,
     $                  LDF, LDG, LDH, LDK, LDWORK, M, MV, N, P, PZ
      DOUBLE PRECISION  ALPHA, BETA, RCOND
C     .. Array Arguments ..
      INTEGER           IWORK(*)
      DOUBLE PRECISION  A(LDA,*), B(LDB,*), BC(LDBC,*), C(LDC,*),
     $                  CC(LDCC,*), D(LDD,*), DC(LDDC,*), DWORK(*),
     $                  F(LDF,*), G(LDG,*), H(LDH,*), K(LDK,*)

Arguments

Mode Parameters

  FBTYPE  CHARACTER*1
          Specifies the type of the feedback law as follows:
          = 'I':  Unitary output feedback (F = I);
          = 'O':  General output feedback.

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

Input/Output Parameters
  N       (input) INTEGER
          The dimension of state vector x, i.e. the order of the
          matrix A, the number of rows of B and the number of
          columns of C.  N >= 0.

  M       (input) INTEGER
          The dimension of input vector u, i.e. the number of
          columns of matrices B and D, and the number of rows of F.
          M >= 0.

  P       (input) INTEGER
          The dimension of output vector y, i.e. the number of rows
          of matrices C and D, and the number of columns of F.
          P >= 0 and P = M if FBTYPE = 'I'.

  MV      (input) INTEGER
          The dimension of the new input vector v, i.e. the number
          of columns of matrix G.  MV >= 0.

  PZ      (input) INTEGER.
          The dimension of the new output vector z, i.e. the number
          of rows of matrix H.  PZ >= 0.

  ALPHA   (input) DOUBLE PRECISION
          The coefficient alpha in the output feedback law.

  BETA    (input) DOUBLE PRECISION.
          The coefficient beta in the state feedback law.

  A       (input/output) DOUBLE PRECISION array, dimension (LDA,N)
          On entry, the leading N-by-N part of this array must
          contain the system state transition matrix A.
          On exit, the leading N-by-N part of this array contains
          the state matrix Ac of the closed-loop system.

  LDA     INTEGER
          The leading dimension of array A.  LDA >= 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 system input matrix B.
          On exit, the leading N-by-M part of this array contains
          the intermediary input matrix B1 (see METHOD).

  LDB     INTEGER
          The leading dimension of array B.  LDB >= 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 system output matrix C.
          On exit, the leading P-by-N part of this array contains
          the intermediary output matrix C1+BETA*D1*K (see METHOD).

  LDC     INTEGER
          The leading dimension of array C.
          LDC >= MAX(1,P) if N > 0.
          LDC >= 1 if N = 0.

  D       (input/output) 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.
          On exit, the leading P-by-M part of this array contains
          the intermediary direct input/output transmission matrix
          D1 (see METHOD).
          The array D is not referenced if JOBD = 'Z'.

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

  F       (input) DOUBLE PRECISION array, dimension (LDF,P)
          If FBTYPE = 'O', the leading M-by-P part of this array
          must contain the output feedback matrix F.
          If FBTYPE = 'I', then the feedback matrix is assumed to be
          an M x M order identity matrix.
          The array F is not referenced if FBTYPE = 'I'  or
          ALPHA = 0.

  LDF     INTEGER
          The leading dimension of array F.
          LDF >= MAX(1,M) if FBTYPE = 'O' and ALPHA <> 0.
          LDF >= 1 if FBTYPE = 'I' or ALPHA = 0.

  K       (input) DOUBLE PRECISION array, dimension (LDK,N)
          The leading M-by-N part of this array must contain the
          state feedback matrix K.
          The array K is not referenced if BETA = 0.

  LDK     INTEGER
          The leading dimension of the array K.
          LDK >= MAX(1,M) if BETA <> 0.
          LDK >= 1 if BETA = 0.

  G       (input) DOUBLE PRECISION array, dimension (LDG,MV)
          The leading M-by-MV part of this array must contain the
          system input scaling matrix G.

  LDG     INTEGER
          The leading dimension of the array G.  LDG >= MAX(1,M).

  H       (input) DOUBLE PRECISION array, dimension (LDH,P)
          The leading PZ-by-P part of this array must contain the
          system output scaling matrix H.

  LDH     INTEGER
          The leading dimension of the array H.  LDH >= MAX(1,PZ).

  RCOND   (output) DOUBLE PRECISION
          The reciprocal condition number of the matrix
          I - alpha*D*F.

  BC      (output) DOUBLE PRECISION array, dimension (LDBC,MV)
          The leading N-by-MV part of this array contains the input
          matrix Bc of the closed-loop system.

  LDBC    INTEGER
          The leading dimension of array BC.  LDBC >= MAX(1,N).

  CC      (output) DOUBLE PRECISION array, dimension (LDCC,N)
          The leading PZ-by-N part of this array contains the
          system output matrix Cc of the closed-loop system.

  LDCC    INTEGER
          The leading dimension of array CC.
          LDCC >= MAX(1,PZ) if N > 0.
          LDCC >= 1 if N = 0.

  DC      (output) DOUBLE PRECISION array, dimension (LDDC,MV)
          If JOBD = 'D', the leading PZ-by-MV part of this array
          contains the direct input/output transmission matrix Dc
          of the closed-loop system.
          The array DC is not referenced if JOBD = 'Z'.

  LDDC    INTEGER
          The leading dimension of array DC.
          LDDC >= MAX(1,PZ) if JOBD = 'D'.
          LDDC >= 1 if JOBD = 'Z'.

Workspace
  IWORK   INTEGER array, dimension (LIWORK)
          LIWORK >= MAX(1,2*P) if JOBD = 'D'.
          LIWORK >= 1 if JOBD = 'Z'.
          IWORK is not referenced if JOBD = 'Z'.

  DWORK   DOUBLE PRECISION array, dimension (LDWORK)

  LDWORK  INTEGER
          The length of the array DWORK.
          LDWORK >= wspace, where
                wspace = MAX( 1, M, P*MV, P*P + 4*P ) if JOBD = 'D',
                wspace = MAX( 1, M ) if JOBD = 'Z'.
          For best performance, LDWORK >= MAX( wspace, N*M, N*P ).

Error Indicator
  INFO    INTEGER
          = 0:  successful exit;
          < 0:  if INFO = -i, the i-th argument had an illegal
                value;
          = 1:  if the matrix I - alpha*D*F is numerically singular.

Method
  The matrices of the closed-loop system have the expressions:

  Ac = A1 + beta*B1*K,      Bc = B1*G,
  Cc = H*(C1 + beta*D1*K),  Dc = H*D1*G,

  where

  A1 = A + alpha*B*F*E*C,   B1 = B + alpha*B*F*E*D,
  C1 = E*C,                 D1 = E*D,

  with E = (I - alpha*D*F)**-1.

Numerical Aspects
  The accuracy of computations basically depends on the conditioning
  of the matrix I - alpha*D*F. If RCOND is very small, it is likely
  that the computed results are inaccurate.

Further Comments
  None
Example

Program Text

*     AB05RD EXAMPLE PROGRAM TEXT
*     Copyright (c) 2002-2017 NICONET e.V.
*
*     .. Parameters ..
      INTEGER          NIN, NOUT
      PARAMETER        ( NIN = 5, NOUT = 6 )
      INTEGER          NMAX, MMAX, MVMAX, PMAX, PZMAX
      PARAMETER        ( NMAX = 20, MMAX = 20, MVMAX = 20,
     $                   PMAX = 20, PZMAX = 20 )
      INTEGER          LDA, LDB, LDBC, LDC, LDCC, LDD, LDDC, LDF, LDG,
     $                 LDH, LDK, LDWORK, LIWORK
      PARAMETER        ( LDA = NMAX, LDB = NMAX, LDBC = NMAX,
     $                   LDC = PMAX, LDCC = PZMAX,
     $                   LDD = PMAX, LDDC = PZMAX, LDF = MMAX,
     $                   LDG = MMAX, LDH  = PZMAX, LDK = MMAX,
     $                   LDWORK = MAX( MMAX, PMAX*MVMAX,
     $                   PMAX*PMAX + 4*PMAX ), LIWORK = 2*PMAX )
*     .. Parameters ..
      DOUBLE PRECISION ZERO
      PARAMETER        ( ZERO = 0.0D0 )
*     .. Local Scalars ..
      LOGICAL          LJOBD, OUTPF
      CHARACTER*1      FBTYPE, JOBD
      INTEGER          I, INFO, J, M, MV, N, P, PZ
      DOUBLE PRECISION ALPHA, BETA, RCOND
*     .. Local Arrays ..
      INTEGER          IWORK(LIWORK)
      DOUBLE PRECISION A(LDA,NMAX), B(LDB,MMAX), BC(LDBC,MVMAX),
     $                 C(LDC,NMAX), CC(LDCC,NMAX),
     $                 D(LDD,MMAX), DC(LDDC,MVMAX),  DWORK(LDWORK),
     $                 F(LDF,PMAX), G(LDG,MVMAX), H(LDH,PMAX),
     $                 K(LDK,NMAX)
*     .. External functions ..
      LOGICAL          LSAME
      EXTERNAL         LSAME
*     .. External Subroutines ..
      EXTERNAL         AB05RD
*     .. 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, MV, PZ, ALPHA, BETA, FBTYPE, JOBD
      OUTPF = LSAME( FBTYPE, 'O' )
      LJOBD = LSAME( JOBD, 'D' )
      IF ( N.LE.0 .OR. N.GT.NMAX ) THEN
         WRITE ( NOUT, FMT = 99992 ) N
      ELSE
         READ ( NIN, FMT = * ) ( ( A(I,J), J = 1,N ), I = 1,N )
         IF ( M.LE.0 .OR. M.GT.MMAX ) THEN
            WRITE ( NOUT, FMT = 99991 ) M
         ELSE
            READ ( NIN, FMT = * ) ( ( B(I,J), I = 1,N ), J = 1,M )
            IF ( BETA.NE.ZERO )
     $         READ ( NIN, FMT = * ) ( ( K(I,J), J = 1,N ), I = 1,M )
            IF ( P.LE.0 .OR. P.GT.PMAX ) THEN
               WRITE ( NOUT, FMT = 99990 ) P
            ELSE
               READ ( NIN, FMT = * ) ( ( C(I,J), J = 1,N ), I = 1,P )
               IF ( LJOBD )
     $            READ ( NIN, FMT = * ) ( ( D(I,J), J = 1,M ), I = 1,P )
               IF ( OUTPF.AND.ALPHA.NE.ZERO )
     $            READ ( NIN, FMT = * ) ( ( F(I,J), J = 1,P ), I = 1,M )
               IF ( MV.LE.0 .OR. MV.GT.MVMAX ) THEN
                  WRITE ( NOUT, FMT = 99989 ) MV
               ELSE
                  READ ( NIN, FMT = * )
     $                 ( ( G(I,J), J = 1,MV ), I = 1,M )
                  IF ( PZ.LE.0 .OR. PZ.GT.PZMAX ) THEN
                     WRITE ( NOUT, FMT = 99988 ) PZ
                  ELSE
                     READ ( NIN, FMT = * )
     $                    ( ( H(I,J), J = 1,P ), I = 1,PZ )
*                       Find the state-space model (A,B,C,D).
                     CALL AB05RD( FBTYPE, JOBD, N, M, P, MV, PZ, ALPHA,
     $                            BETA, A, LDA, B, LDB, C, LDC, D, LDD,
     $                            F, LDF, K, LDK, G, LDG, H, LDH, RCOND,
     $                            BC, LDBC, CC, LDCC, DC, LDDC, IWORK,
     $                            DWORK, LDWORK, INFO )
*
                     WRITE ( NOUT, FMT = 99987 ) RCOND
                     IF ( INFO.NE.0 ) THEN
                        WRITE ( NOUT, FMT = 99998 ) INFO
                     ELSE
                        WRITE ( NOUT, FMT = 99997 )
                        DO 20 I = 1, N
                           WRITE ( NOUT, FMT = 99996 )
     $                           ( A(I,J), J = 1,N )
   20                   CONTINUE
                        WRITE ( NOUT, FMT = 99995 )
                        DO 40 I = 1, N
                           WRITE ( NOUT, FMT = 99996 )
     $                           ( BC(I,J), J = 1,MV )
   40                   CONTINUE
                        WRITE ( NOUT, FMT = 99994 )
                        DO 60 I = 1, PZ
                           WRITE ( NOUT, FMT = 99996 )
     $                           ( CC(I,J), J = 1,N )
   60                   CONTINUE
                        IF ( LJOBD ) THEN
                           WRITE ( NOUT, FMT = 99993 )
                           DO 80 I = 1, PZ
                              WRITE ( NOUT, FMT = 99996 )
     $                              ( DC(I,J), J = 1,MV )
   80                      CONTINUE
                        END IF
                     END IF
                  END IF
               END IF
            END IF
         END IF
      END IF
      STOP
*
99999 FORMAT (' AB05RD EXAMPLE PROGRAM RESULTS',/1X)
99998 FORMAT (' INFO on exit from AB05RD = ',I2)
99997 FORMAT (' The state transition matrix of the closed-loop system is
     $')
99996 FORMAT (20(1X,F8.4))
99995 FORMAT (/' The input/state matrix of the closed-loop system is ')
99994 FORMAT (/' The state/output matrix of the closed-loop system is ')
99993 FORMAT (/' The input/output matrix of the closed-loop system is ')
99992 FORMAT (/' N is out of range.',/' N = ',I5)
99991 FORMAT (/' M is out of range.',/' M = ',I5)
99990 FORMAT (/' P is out of range.',/' P = ',I5)
99989 FORMAT (/' MV is out of range.',/' MV = ',I5)
99988 FORMAT (/' PZ is out of range.',/' PZ = ',I5)
99987 FORMAT ( ' The reciprocal condition number of the matrix ',
     $         ' I - alpha*D*F is',F8.4,/1X)
      END
Program Data
 AB05RD EXAMPLE PROGRAM DATA
   3     2     2     2     2   1.0   1.0    O     D
   1.0   0.0  -1.0
   0.0  -1.0   1.0
   1.0   1.0   2.0
   1.0   1.0   0.0
   2.0   0.0   1.0
   2.0   1.0   0.0
   1.0   0.0   1.0
   3.0  -2.0   1.0
   0.0   1.0   0.0
   1.0   0.0
   0.0   1.0
   1.0   2.0
   3.0   4.0
   1.0   1.0
   0.0   1.0
   4.0   3.0
   2.0   1.0
Program Results
 AB05RD EXAMPLE PROGRAM RESULTS

 The reciprocal condition number of the matrix  I - alpha*D*F is  0.2000

 The state transition matrix of the closed-loop system is
  -4.8333   0.1667  -2.8333
  -0.8333   0.1667   0.1667
  -1.5000   0.5000   1.5000

 The input/state matrix of the closed-loop system is 
  -0.5000  -0.8333
   0.5000   0.1667
  -0.5000  -0.5000

 The state/output matrix of the closed-loop system is 
   1.1667  -1.8333  -0.8333
   1.8333  -1.1667  -0.1667

 The input/output matrix of the closed-loop system is 
   0.5000  -0.8333
   0.5000  -0.1667

Return to index