CFPRIME GUFMON                                                          GUFMON      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 GUFMON(IDISW,H)                                        GUFMON      3
CD                                                                      GUFMON      4
CD     THIS SUBROUTINE CHECKS THE STATUS OF                             GUFMON      5
CD     UNDERFREQUENCY GENERATOR DROPPING RELAYS.                        GUFMON      6
CD                                                                      GUFMON      7
CD                                                                      GUFMON      8
CD     LGUFRE           Starting position of IDATPT array  of GUFR      GUFMON      9
CD                       relay scheme LGUFRE is in the common labelled  GUFMON     10
CD                       PT of include file CNPT.                       GUFMON     11
CD                                                                      GUFMON     12
CD     NGUFRE            Finishing position of IDATPT array of GUFR     GUFMON     13
CD                       relay scheme NUFRE is in common labelled AUTO  GUFMON     14
CD                       of include file CNAUTO.                        GUFMON     15
CD                                                                      GUFMON     16
CD     let k = k-th GUFR RELAY                                          GUFMON     17
CD                                                                      GUFMON     18
CD     N = IDATPT(k)    IDATPT is the array that stores the start       GUFMON     19
CD                      position of the K-TH GUFR relay scheme data     GUFMON     20
CD                                                                      GUFMON     21
CD                                                                      GUFMON     22
CD ADATA(N+1)=IRMTCD    TRIP CODE 1= NOT TRIPPED, 2= TRIPPED            GUFMON     23
CD                                                                      GUFMON     24
CD ADATA(N+2)=IRMGNO    GENERATOR INDEX NUMBER                          GUFMON     25
CD                                                                      GUFMON     26
CD ADATA(N+3)=IRMBNO    GENERATOR BUS NUMBER                            GUFMON     27
CD                                                                      GUFMON     28
CD ADATA(N+4)=RMGID     GNERATOR ID                                     GUFMON     29
CD                                                                      GUFMON     30
CD IADATA(N+5)=IFLAG    =0 :  CONTROL BOTH LOCAL AND REMOTE             GUFMON     31
CD                      =1 :  CONTROL THE REMOTE ONLY                   GUFMON     32
CD                                                                      GUFMON     33
CD IADATA(N+6)=IDRRR    NO. OF REMOTE RELAY                             GUFMON     34
CD                                                                      GUFMON     35
CD IADATA(N+7)          REMOTE RELAY TRIP FLAG                          GUFMON     36
CD                                                                      GUFMON     37
CD ADATA(N+8)=RMFQ1     FIRST LEVEL TRIP FREQUENCY (DELAYED)            GUFMON     38
CD                                                                      GUFMON     39
CD ADATA(N+9)=RMFQ2     SECOND LEVEL TRIP FREQUENCY (ISTANTANEOUS)      GUFMON     40
CD                                                                      GUFMON     41
CD ADATA(N+10)=RMTRP1   TRIP DELAY FOR FIRST LEVEL TRIP                 GUFMON     42
CD                                                                      GUFMON     43
CD ADATA(N+11)=RMTRP2   BREAKER TIME DELAY                              GUFMON     44
CD                                                                      GUFMON     45
CD ADATA(N+12)=RMRTIM   RELAY TIMER                                     GUFMON     46
CD                                                                      GUFMON     47
CD ADATA(N+13)=RMBTIM   BREAKER TIMER                                   GUFMON     48
CD                                                                      GUFMON     49
CD ADATA(N+14)=RMEYR    REAL COMPONENT OF PRESENT BUS VOLTAGE           GUFMON     50
CD                                                                      GUFMON     51
CD ADATA(N+15)=RMEYI    IMAGINARY COMPONENT OF PRESENT BUS VOLTAGE      GUFMON     52
CD                                                                      GUFMON     53
CD ADATA(N+16)=RMFREQ   PRESENT BUS FREQUENCY                           GUFMON     54
CD                                                                      GUFMON     55
CD                                                                      GUFMON     56
      INCLUDE 'PARX.INS'                                                GUFMON     57
      INCLUDE 'CNPT.INS'                                                GUFMON     58
      INCLUDE 'CNB4.INS'                                                GUFMON     59
      INCLUDE 'CNB19.INS'                                               GUFMON     60
      INCLUDE 'CNAUTO.INS'                                              GUFMON     61
      INCLUDE 'CNVOLT.INS'                                              GUFMON     62
C                                                                       GUFMON     63
      LOGICAL IDISW                                                     GUFMON     64
      COMPLEX VOLTK                                                     GUFMON     65
      DIMENSION VOLTX(2)                                                GUFMON     66
      EQUIVALENCE (VOLTK,VOLTX(1)),(VOLTX(1),VREAL),(VOLTX(2),VIMAG)    GUFMON     67
C                                                                       GUFMON     68
      CHARACTER*2 CID                                                   GUFMON     69
C                                                                       GUFMON     70
      DO 200 J=LGUFRE,NGUFRE                                            GUFMON     71
C                                                                       GUFMON     72
      K=IDATPT(J)                                                       GUFMON     73
CD                                                                      GUFMON     74
CD STEP1. BYPASS IF RELAY IS TRIPPED                                    GUFMON     75
CD                                                                      GUFMON     76
      IF(IADATA(K+1).GE.2)GOTO 190                                      GUFMON     77
C                                                                       GUFMON     78
      IDRRR=IADATA(K+6)                                                 GUFMON     79
      NPROG=IADATA(K+3)                                                 GUFMON     80
      VOLTK=VOLT(NPROG)                                                 GUFMON     81
CD                                                                      GUFMON     82
CD STEP 2. CHECK IF BREAKER TIMER ACTIVATED TO TRIP                     GUFMON     83
CD                                                                      GUFMON     84
      IF(ADATA(K+13).EQ.0.0)GOTO 120                                    GUFMON     85
      IF(ADATA(K+13)-.0001.GT.TS)GOTO 200                               GUFMON     86
C                                                                       GUFMON     87
C       INITIATE TO TRIP                                                GUFMON     88
C                                                                       GUFMON     89
  100 IADATA(K+1)=2                                                     GUFMON     90
CD                                                                      GUFMON     91
CD STEP 3.  IF TRIP WRITE GENERATOR REJECTION DATA TO IASWF FILE        GUFMON     92
CD                                                                      GUFMON     93
      IF(IADATA(K+5).EQ.0)THEN                                          GUFMON     94
       IF(IASWX.EQ.0)THEN                                               GUFMON     95
        WRITE(ISWFA,2010) TS                                            GUFMON     96
        NAWR=NAWR+1                                                     GUFMON     97
        IASWX=1                                                         GUFMON     98
       ENDIF                                                            GUFMON     99
       ITFK=IADATA(K+4)                                                 GUFMON    100
       CALL UNPACK (CID, JJJ, ITFK)                                     GUFMON    101
       IMACH=IADATA(K+2)                                                GUFMON    102
       WRITE(ISWFA,2020) NPROG,IMACH,CID                                GUFMON    103
       NAWR=NAWR+1                                                      GUFMON    104
      ENDIF                                                             GUFMON    105
C                                                                       GUFMON    106
C     REMOTE RELAYS                                                     GUFMON    107
C                                                                       GUFMON    108
 190    IF(IDRRR.NE.0)THEN                                              GUFMON    109
         IF(IADATA(K+1).NE.3)THEN                                       GUFMON    110
          IPOINT=7                                                      GUFMON    111
          KBUS=K                                                        GUFMON    112
          KADD=K+16                                                     GUFMON    113
          CALL RETRIP(KADD,KBUS,IDRRR,IPOINT)                           GUFMON    114
          IF(IADATA(KBUS+IPOINT).EQ.-1)IADATA(K+1)=3                    GUFMON    115
         ENDIF                                                          GUFMON    116
        ENDIF                                                           GUFMON    117
C                                                                       GUFMON    118
      GOTO 200                                                          GUFMON    119
C                                                                       GUFMON    120
C       DISCONTINUITY TEST                                              GUFMON    121
C                                                                       GUFMON    122
  120 IF(IDISW)THEN                                                     GUFMON    123
C                                                                       GUFMON    124
C       STORE VOLTAGE AND BYPASS                                        GUFMON    125
C                                                                       GUFMON    126
         ADATA(K+14)=VREAL                                              GUFMON    127
         ADATA(K+15)=VIMAG                                              GUFMON    128
         GOTO 200                                                       GUFMON    129
C                                                                       GUFMON    130
      ENDIF                                                             GUFMON    131
C                                                                       GUFMON    132
C       CALCULATE BUS FREQ AND TEST RELAY                               GUFMON    133
C                                                                       GUFMON    134
      ENEW = VREAL                                                      GUFMON    135
      FNEW = VIMAG                                                      GUFMON    136
      EFSQ=ENEW**2+FNEW**2                                              GUFMON    137
      IF(EFSQ.NE.0.0)GOTO 130                                           GUFMON    138
      WNEW=ADATA(K+16)                                                  GUFMON    139
      GOTO 150                                                          GUFMON    140
  130 WNEW=(FNEW*ADATA(K+14)-ENEW*ADATA(K+15))/(EFSQ*H*6.2831853)       GUFMON    141
C                                                                       GUFMON    142
C       PRECESS FREQUENCY AND VOLTAGES                                  GUFMON    143
C                                                                       GUFMON    144
      ADATA(K+14)=ENEW                                                  GUFMON    145
      ADATA(K+15)=FNEW                                                  GUFMON    146
      ADATA(K+16)=WNEW                                                  GUFMON    147
C                                                                       GUFMON    148
C       CHECK FOR INSTANTANEOUS TRIP                                    GUFMON    149
C                                                                       GUFMON    150
      IF(WNEW.GE.ADATA(K+9))GOTO 150                                    GUFMON    151
C                                                                       GUFMON    152
C       CHECK IF BREAKER DELAY EXISTS AND SET TIMER OR TRIP ACCORDINGLY GUFMON    153
C                                                                       GUFMON    154
 140   IF(IDRRR.NE.0)THEN                                               GUFMON    155
C                                                                       GUFMON    156
C            REMOTE RELAY ACTIVIATED, NOT ALL TRIPPED                   GUFMON    157
C                                                                       GUFMON    158
          KADD=K+16                                                     GUFMON    159
          CALL RTIMER(KADD,IDRRR)                                       GUFMON    160
        ENDIF                                                           GUFMON    161
C                                                                       GUFMON    162
       IF(ADATA(K+11).EQ.0.0)THEN                                       GUFMON    163
C                                                                       GUFMON    164
C       NO BREAKER TIME DELAY                                           GUFMON    165
C                                                                       GUFMON    166
          GOTO 100                                                      GUFMON    167
      ELSE                                                              GUFMON    168
C                                                                       GUFMON    169
C       ADD BREAKER TIME DELAY AND SET NEXT TRIP TIME--DNXRLY           GUFMON    170
C                                                                       GUFMON    171
          ADATA(K+13)=ADATA(K+11)+TS                                    GUFMON    172
          GOTO 200                                                      GUFMON    173
      ENDIF                                                             GUFMON    174
C                                                                       GUFMON    175
C       CHECK FOR RELAY TRIP WITH DELAY                                 GUFMON    176
C                                                                       GUFMON    177
  150 IF(WNEW.LT.ADATA(K+8))GOTO 160                                    GUFMON    178
C                                                                       GUFMON    179
C       RESET RELAY TIMER AND EXIT                                      GUFMON    180
C                                                                       GUFMON    181
      ADATA(K+12)=0.0                                                   GUFMON    182
      GOTO 200                                                          GUFMON    183
C                                                                       GUFMON    184
C       CHECK RELAY TIMER                                               GUFMON    185
C                                                                       GUFMON    186
  160 IF(ADATA(K+12).EQ.0.0)GOTO 170                                    GUFMON    187
C                                                                       GUFMON    188
C       CHECK RELAY TIMER FOR TRIPPING                                  GUFMON    189
C                                                                       GUFMON    190
      IF(ADATA(K+12)-0.0001.LE.TS)GOTO 140                              GUFMON    191
      GOTO 200                                                          GUFMON    192
C                                                                       GUFMON    193
C SET RELAY TIMER AND EXIT                                              GUFMON    194
C                                                                       GUFMON    195
  170 ADATA(K+12)=ADATA(K+10)+TS                                        GUFMON    196
  200 CONTINUE                                                          GUFMON    197
      RETURN                                                            GUFMON    198
C                                                                       GUFMON    199
 2010 FORMAT(F10.5)                                                     GUFMON    200
 2020 FORMAT('GR ',1X,2I5,1X,A2)                                        GUFMON    201
      END                                                               GUFMON    202
