CFPRIME DBAND                                                           DBAND       1
C***********************************************************************RIGHTE      1
C*                                                                     *RIGHTE      2
C*        Extended Transient-Midterm Stability Program (ETMSP)         *RIGHTE      3
C*        ====================================================         *RIGHTE      4
C*                                                                     *RIGHTE      5
C*       Copyright (C) (1993) Electric Power Research Institute        *RIGHTE      6
C*                                                                     *RIGHTE      7
C* EPRI reserves all rights in the software and associated             *RIGHTE      8
C* documentation as delivered. The software and its associated         *RIGHTE      9
C* documention or any portion thereof may not be reproduced in any form*RIGHTE     10
C* whatsoever without the consent of EPRI, except as explicity provided*RIGHTE     11
C* for by license. Licensee shall submit a detailed description to EPRI*RIGHTE     12
C* of any changes or modifications to the software within two (2)      *RIGHTE     13
C* months after such changes or modifications are made. At EPRI's sole *RIGHTE     14
C* discretion, the software, as changed or modified, shall be given a  *RIGHTE     15
C* new designation sufficiently different from its then current        *RIGHTE     16
C* designation as to prevent mistake,confusion, or deception as between*RIGHTE     17
C* the current software as changed or modified.                        *RIGHTE     18
C*                                                                     *RIGHTE     19
C* A license under EPRI's rights in the software can be obtained       *RIGHTE     20
C* directly from EPRI.                                                 *RIGHTE     21
C*                                                                     *RIGHTE     22
C* This program and supporting materials may be independently available*RIGHTE     23
C* from Electric Power Software centre (EPSC) for an appropriate       *RIGHTE     24
C* distribution fee. The EPSC is a service of                          *RIGHTE     25
C*                                                                     *RIGHTE     26
C*                    Power Computing Company                          *RIGHTE     27
C*                    1930 Hi Line                                     *RIGHTE     28
C*                    Dallas, Tx 75207                                 *RIGHTE     29
C*                                                                     *RIGHTE     30
C* NEITHER EPRI, ANY MEMBER OF EPRI, NOR ANY PERSON OR  ORGANIZATION   *RIGHTE     31
C* ACTING ON BEHAVE OF THEM:                                           *RIGHTE     32
C*                                                                     *RIGHTE     33
C* 1. MAKE ANY WARRANTY OR REPRESENTATION WHATSOEVER, EXPRESS OR       *RIGHTE     34
C*    IMPLIED, INCLUDING ANY WARRANTY OF MERCHANTABILITY OR FITNESS OR *RIGHTE     35
C*    ANY PURPOSE WITH RESPECT TO THE SOFTWARE OR ITS ASSOCIATED       *RIGHTE     36
C*    DOCUMENTATION; OR                                                *RIGHTE     37
C*                                                                     *RIGHTE     38
C* 2. ASSUMES ANY LIABILITY WHATSOEVER WITH RESPECT TO ANY USE OF THE  *RIGHTE     39
C*    SOFTWARE OR ITS ASSOCIATED DOCUMENTATION OR ANY PORTION THEREOF  *RIGHTE     40
C*    OR WITH RESPECT TO ANY DAMAGES WHICH MAY RESULT FROM SUCH USE.   *RIGHTE     41
C*                                                                     *RIGHTE     42
C* THIS NOTICE MAY NOT BE REMOVED FROM THE SOFTWARE BY ANY USER        *RIGHTE     43
C* THEREOF.                                                            *RIGHTE     44
C*                                                                     *RIGHTE     45
C***********************************************************************RIGHTE     46
      SUBROUTINE DBAND (XIN,DBD,DBDA,KTH,MSE,IOSET)                     DBAND       3
CD                                                                      DBAND       4
CD    TO SIMULATE THE DEAD BAND FUNCTION FOR USE IN GOVERNOR            DBAND       5
CD    CALCULATIONS.                                                     DBAND       6
CD                                                                      DBAND       7
      DIMENSION DBDA(MSE)                                               DBAND       8
      KOSET=IOSET+KTH                                                   DBAND       9
      IF (DBD.LT.0.0) GO TO 30                                          DBAND      10
      IF (ABS(XIN).LE.DBD) GO TO 20                                     DBAND      11
      IF (XIN.GT.DBD) GO TO 10                                          DBAND      12
      DBDA(2+KOSET)=XIN+DBD                                             DBAND      13
      RETURN                                                            DBAND      14
 10   DBDA(2+KOSET)=XIN-DBD                                             DBAND      15
      RETURN                                                            DBAND      16
 20   DBDA(2+KOSET)=0.0                                                 DBAND      17
      RETURN                                                            DBAND      18
 30   DBD=ABS(DBD)                                                      DBAND      19
      DELTAX=XIN-DBDA(3+KOSET)                                          DBAND      20
      IF (ABS(DBDA(2+KOSET)).LT.DBD) GO TO 80                           DBAND      21
      SIGN=DELTAX*DBDA(2+KOSET)                                         DBAND      22
      IF (SIGN.LT.0.) GO TO 40                                          DBAND      23
      DELTAY=DELTAX                                                     DBAND      24
      GO TO 110                                                         DBAND      25
 40   CONTINUE                                                          DBAND      26
      IF (DELTAX.LE.0.) GO TO 50                                        DBAND      27
      DELTAX=DELTAX-DBD                                                 DBAND      28
      GO TO 60                                                          DBAND      29
 50   CONTINUE                                                          DBAND      30
      DELTAX=DELTAX+DBD                                                 DBAND      31
 60   CONTINUE                                                          DBAND      32
      IF (ABS(DELTAX).LT.DBD) GO TO 70                                  DBAND      33
      DELTAY=DELTAX                                                     DBAND      34
      DBDA(2+KOSET)=DBD*DELTAX/ABS(DELTAX)                              DBAND      35
      GO TO 110                                                         DBAND      36
 70   CONTINUE                                                          DBAND      37
      DELTAY=0.                                                         DBAND      38
      DBDA(2+KOSET)=DELTAX                                              DBAND      39
      GO TO 110                                                         DBAND      40
 80   CONTINUE                                                          DBAND      41
      DELTAX=DELTAX+DBDA(2+KOSET)                                       DBAND      42
      IF (ABS(DELTAX).LT.DBD) GO TO 100                                 DBAND      43
      IF (DELTAX.LE.0.) GO TO 90                                        DBAND      44
      DELTAY=DELTAX-DBD                                                 DBAND      45
      DBDA(2+KOSET)=DBD                                                 DBAND      46
      GO TO 110                                                         DBAND      47
 90   CONTINUE                                                          DBAND      48
      DELTAY=DELTAX+DBD                                                 DBAND      49
      DBDA(2+KOSET)=-DBD                                                DBAND      50
      GO TO 110                                                         DBAND      51
 100  CONTINUE                                                          DBAND      52
      DELTAY=0.                                                         DBAND      53
      DBDA(2+KOSET)=DELTAX                                              DBAND      54
 110  CONTINUE                                                          DBAND      55
      DBDA(2+KOSET)=DBDA(2+KOSET)+DELTAY                                DBAND      56
      DBDA(3+KOSET)=XIN                                                 DBAND      57
      XIN=DBDA(2+KOSET)                                                 DBAND      58
      RETURN                                                            DBAND      59
C                                                                       DBAND      60
      END                                                               DBAND      61
