CFPRIME FLTMON                                                          FLTMON      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 FLTMON(IDISW,H)                                        FLTMON      3
CD                                                                      FLTMON      4
CD    THIS SUBROUTINE CHECKS THE STATUS OF THE UNDER/OVER --FREQUENCY   FLTMON      5
CD    LINE TRIPPING RELAYS DURING THE SIMULATION.                       FLTMON      6
CD                                                                      FLTMON      7
CD                                                                      FLTMON      8
CD     LUFLTR          Starting position of IDATPT array  of UFLT       FLTMON      9
CD                     relay scheme, LUFLTR is in the common labelled   FLTMON     10
CD                     PT of include file CNPT.                         FLTMON     11
CD                                                                      FLTMON     12
CD     NUFLTR          Finishing position of IDATPT array of UFLT       FLTMON     13
CD                     relay scheme, NUFLTR is in common labelled AUTO  FLTMON     14
CD                     of include file CNAUTO.                          FLTMON     15
CD                                                                      FLTMON     16
CD     let k = k-th UFLT RELAY                                          FLTMON     17
CD                                                                      FLTMON     18
CD     N = IDATPT(k)    IDATPT is the array that stores the start       FLTMON     19
CD                      position of the K-TH UFLT relay scheme data     FLTMON     20
CD                                                                      FLTMON     21
CD                                                                      FLTMON     22
CD  IADATA(K+1)=ICD1RU  LOCAL RELAY TRIP STATUS                         FLTMON     23
CD                      = 1 RELAY NOT TRIPPED                           FLTMON     24
CD                      = 2 RELAY TRIPPED BREAKER STILL CLOSED          FLTMON     25
CD                      = 3 RELAY TRIPPED BREAKER TRIPPED,REMOTE        FLTMON     26
CD                          TRIPPING AND RECLOSING TIMER STARTED        FLTMON     27
CD                      = 4 LOCAL AND REMOTE TRIPPING COMPLETED,        FLTMON     28
CD                          LOCAL LINE NOT RECLOSED YET.                FLTMON     29
CD                      = 5 ALL TRIP AND RECLOSING ACTIVITIES COMPLETED FLTMON     30
CD                                                                      FLTMON     31
CD  IADATA(K+2)=IBUSRU  LEFT HAND SIDE BUS NUMBER                       FLTMON     32
CD                                                                      FLTMON     33
CD  IADATA(K+3)=JBUSRU  RIGHT HAND SIDE BUS NUMBER                      FLTMON     34
CD                                                                      FLTMON     35
CD  IADATA(K+4)=IPARRU  PARALLEL IDENTIFICATION FOR THE LINE            FLTMON     36
CD                                                                      FLTMON     37
CD  IADATA(K+5)=ICD3RU  =1 USE SIGNAL TO TRIP THE LINE                  FLTMON     38
CD                      =C OR 2 DO NOT TRIP THE LINE ;                  FLTMON     39
CD                         SIGNAL IS USED FOR REMOTE TRIPPING           FLTMON     40
CD                                                                      FLTMON     41
CD  IADATA(K+6)=ICD4RU  NUMBER OF REMOTE RELAY ATTACHED TO THE LOCAL    FLTMON     42
CD                      RELAY                                           FLTMON     43
CD                                                                      FLTMON     44
CD  IADATA(K+7)=NJSELI  FLAG FOR LINE MODEL                             FLTMON     45
CD                                                                      FLTMON     46
CD  ADATA(K+8)=FTRPRU   THRESHOLD VALUE OF THE BUS FREQUENCY IN HZ.     FLTMON     47
CD                                                                      FLTMON     48
CD  ADATA(K+9)=TRLYRU   REQUIRED DURATION FOR BUS FREQUENCY TO REMAIN   FLTMON     49
CD                      BELOW THRESHOLD VALUE OF A TRIP (IN CYCLES)     FLTMON     50
CD                                                                      FLTMON     51
CD  ADATA(K+10)=TIMERU  UNDER FREQUENCY RELAY TIMER                     FLTMON     52
CD                                                                      FLTMON     53
CD  ADATA(K+11)=TRPCRU  TIME DELAY FOR COMMUNICATION AND BREAKER        FLTMON     54
CD                                                                      FLTMON     55
CD  ADATA(K+12)=TRIPRU  REMOTE RELAY TRIP STATUS                        FLTMON     56
CD                                                                      FLTMON     57
CD  ADATA(K+13)=TRCLSE  TIME DELAY FOR RECLOSING                        FLTMON     58
CD                                                                      FLTMON     59
CD  ADATA(K+14)=RTIMER  TIMER FOR RECLOSING                             FLTMON     60
CD                                                                      FLTMON     61
CD  ADATA(K+15)=WNOWRU  BUS FREQUENCY DEVIATION                         FLTMON     62
CD                      NOTE: BUS FREQUENCY IS CALCULATED USING THE     FLTMON     63
CD                            LEFT HAND SIDE BUS INFORMATION.           FLTMON     64
CD                                                                      FLTMON     65
CD  ADATA(K+16)=EIRU    REAL PART OF THE BUS VOLTAGE AT THE PREVIOUS    FLTMON     66
CD                      TIME STEP                                       FLTMON     67
CD                                                                      FLTMON     68
CD  ADATA(K+17)=FIRU    IMAGINARY PART OF THE BUS VOLTAGE AT THE        FLTMON     69
CD                      PREVIOUS TIME STEP                              FLTMON     70
CD                                                                      FLTMON     71
CD                                                                      FLTMON     72
      INCLUDE 'PARX.INS'                                                FLTMON     73
      INCLUDE 'CNPT.INS'                                                FLTMON     74
      INCLUDE 'CNAUTO.INS'                                              FLTMON     75
      INCLUDE 'CNVOLT.INS'                                              FLTMON     76
      INCLUDE 'CNFLAG.INS'                                              FLTMON     77
      INCLUDE 'CNB4.INS'                                                FLTMON     78
      INCLUDE 'CNB19.INS'                                               FLTMON     79
      INCLUDE 'CNUNIT.INS'                                              FLTMON     80
C                                                                       FLTMON     81
      CHARACTER*2 CID                                                   FLTMON     82
C                                                                       FLTMON     83
      LOGICAL IDISW                                                     FLTMON     84
C                                                                       FLTMON     85
      COMPLEX VOLTK                                                     FLTMON     86
      DIMENSION VOLTX(2)                                                FLTMON     87
      EQUIVALENCE (VOLTK,VOLTX(1)),(VOLTX(1),VREAL),(VOLTX(2),VIMAG)    FLTMON     88
C                                                                       FLTMON     89
C                                                                       FLTMON     90
      LDEB=(JDEB(37).NE.0)                                              FLTMON     91
C                                                                       FLTMON     92
C                                                                       FLTMON     93
CD                                                                      FLTMON     94
CD      FLAG ICD1:                                                      FLTMON     95
CD                                                                      FLTMON     96
CD      ICD1 = 1 RELAY NOT TRIPPED                                      FLTMON     97
CD      ICD1 = 2 RELAY TRIPPED BREAKER STILL CLOSED                     FLTMON     98
CD      ICD1 = 3 RELAY TRIPPED BREAKER TRIPPED REMOTE TRIPPING AND      FLTMON     99
CD               RECLOSING TIMER STARTED                                FLTMON    100
CD      ICD1 = 4 ALL TRIPPING COMPLETE,LINE NOT RECLOSED                FLTMON    101
CD      ICD1 = 5 ALL TRIPPING AND RECLOSING ACTIVITIES COMPLETED        FLTMON    102
CD                                                                      FLTMON    103
      DO 2400 I = LUFLTR,NUFLTR                                         FLTMON    104
      K=IDATPT(I)                                                       FLTMON    105
      ICD1 = IADATA(K+1)                                                FLTMON    106
C * * *                                                                 FLTMON    107
C * * * IF ICD1 = 5, ALL TRIPPING IS COMPLETE                           FLTMON    108
C * * *                                                                 FLTMON    109
      IF(ICD1 .GE. 5) GO TO 2400                                        FLTMON    110
       IF(ICD1 .EQ.4)GOTO 2350                                          FLTMON    111
      ICD3 = IADATA(K+5)                                                FLTMON    112
      ICD4 = IADATA(K+6)                                                FLTMON    113
C * * *                                                                 FLTMON    114
C * * * IF ICD1 = 3, RELAY BREAKER HAS TRIPPED BUT REMOTE TRIPPING      FLTMON    115
C * * * IS IN PROGRESS                                                  FLTMON    116
C * * *                                                                 FLTMON    117
      IF(ICD1 .EQ. 3) GO TO 2120                                        FLTMON    118
C * * *                                                                 FLTMON    119
C * * * TEST FOR FIRST TEN CYCLE BYPASS                                 FLTMON    120
C * * *                                                                 FLTMON    121
C      IF(MRELAY .EQ. 1 .AND. TO .LE. 10.)GO TO 2400                    FLTMON    122
C                                                                       FLTMON    123
      IBUS = IADATA(K+2)                                                FLTMON    124
      JBUS = IADATA(K+3)                                                FLTMON    125
      ITFK = IADATA(K+4)                                                FLTMON    126
      CALL UNPACK (CID, JJJ, ITFK)                                      FLTMON    127
C * * *                                                                 FLTMON    128
C * * *  IF ICD1 = 2 RELAY HAS TRIPPED BUT BREAKER HAS NOT TIMED OUT    FLTMON    129
C * * *                                                                 FLTMON    130
      IF(ICD1 .EQ. 2)GO TO 2090                                         FLTMON    131
      VOLTK=VOLT(IBUS)                                                  FLTMON    132
      EI = VREAL                                                        FLTMON    133
      FI = VIMAG                                                        FLTMON    134
C * *                                                                   FLTMON    135
C * * IDISW = TRUE MEANS NETWORK DISCONTINUITY.  STORE NEW PAST VALUES OFLTMON    136
C * *  VOLTAGE TO AVOID DISCONTINUITY IN FREQUENCY                      FLTMON    137
C * *                                                                   FLTMON    138
      IF(IDISW) THEN                                                    FLTMON    139
         ADATA(K+16)=EI                                                 FLTMON    140
         ADATA(K+17)=FI                                                 FLTMON    141
         GO TO 2400                                                     FLTMON    142
      ENDIF                                                             FLTMON    143
C * *                                                                   FLTMON    144
C * * CALCULATE BUS FREQUENCY                                           FLTMON    145
C * *                                                                   FLTMON    146
      EYSQ = EI * EI + FI * FI                                          FLTMON    147
      IF(EYSQ.EQ.0.0) GO TO 1960                                        FLTMON    148
      ADATA(K+15)= (FI * ADATA(K+16) - EI * ADATA(K+17))/               FLTMON    149
     1            (EYSQ * H)                                            FLTMON    150
 1960 ADATA(K+16) = EI                                                  FLTMON    151
      ADATA(K+17) = FI                                                  FLTMON    152
C                                                                       FLTMON    153
      IF(ADATA(K+8).LT.0.0)THEN                                         FLTMON    154
        IF(ADATA(K+15) .LT. ADATA(K+8))GO TO 2020                       FLTMON    155
      ELSE                                                              FLTMON    156
        IF(ADATA(K+15) .GT. ADATA(K+8))GO TO 2020                       FLTMON    157
      ENDIF                                                             FLTMON    158
C                                                                       FLTMON    159
      IF(ADATA(K+10) .EQ. -1.)GO TO 2400                                FLTMON    160
C                                                                       FLTMON    161
      ADATA(K+10) = -1.0                                                FLTMON    162
      GO TO 2400                                                        FLTMON    163
C * *                                                                   FLTMON    164
C * * FREQUENCY IS LESS THAN/ GREATER THEN TRIP POINT FTRIP             FLTMON    165
C * *                                                                   FLTMON    166
 2020 IF(ADATA(K+10) .EQ. -1.0)GO TO 2040                               FLTMON    167
      IF(ADATA(K+10) .LE. TS + 0.0001)GO TO 2080                        FLTMON    168
      GO TO 2400                                                        FLTMON    169
C * *                                                                   FLTMON    170
C * * SET UNDERFREQUENCY TIMER TIMERU TO CURRENT TIME PLUS TRELY        FLTMON    171
C * *                                                                   FLTMON    172
 2040 ADATA(K+10) = ADATA(K+9) + TS                                     FLTMON    173
C                                                                       FLTMON    174
C     ACTIVIATE THE RECLOSING TIMER                                     FLTMON    175
C                                                                       FLTMON    176
      IF(ADATA(K+14).EQ.-1.0)THEN                                       FLTMON    177
       IF(ICD3.EQ.1 .AND. ADATA(K+13).NE.0.0)                           FLTMON    178
     &             ADATA(K+14)=ADATA(K+13)+TS                           FLTMON    179
      ENDIF                                                             FLTMON    180
      GO TO 2400                                                        FLTMON    181
C * *                                                                   FLTMON    182
C * * UNDERFREQUENCY RELAY HAS TIMED OUT.  START BREAKER TIMER.         FLTMON    183
C * *                                                                   FLTMON    184
 2080 ICD1 = 2                                                          FLTMON    185
      IADATA(K+1) = ICD1                                                FLTMON    186
C                                                                       FLTMON    187
      ADATA(K+10) = ADATA(K+11) + TS                                    FLTMON    188
      IF(ADATA(K+11) .EQ. 0.0 .AND. ICD3 .EQ. 1)GOTO 2095               FLTMON    189
C                                                                       FLTMON    190
      GO TO 2400                                                        FLTMON    191
C * *                                                                   FLTMON    192
C * * CHECK BREAKER TIMEOUT                                             FLTMON    193
C * *                                                                   FLTMON    194
 2090 IF(ADATA(K+10) .LE. TS + 0.001)GO TO 2095                         FLTMON    195
      GO TO 2400                                                        FLTMON    196
C * *                                                                   FLTMON    197
C * * BREAKER HAS TIMED OUT                                             FLTMON    198
C * *                                                                   FLTMON    199
 2095 ICD1 = 3                                                          FLTMON    200
      IADATA(K+1) = ICD1                                                FLTMON    201
C                                                                       FLTMON    202
      IF(ICD4.NE.0)THEN                                                 FLTMON    203
       KADD=K+17                                                        FLTMON    204
       CALL RTIMER(KADD,ICD4)                                           FLTMON    205
      ENDIF                                                             FLTMON    206
C                                                                       FLTMON    207
C                                                                       FLTMON    208
C * *                                                                   FLTMON    209
C * * IF ICD3 .NE. 1, BREAKER IS NOT ACTUALLY TRIPPED C= NOTRIP         FLTMON    210
C * *                                                                   FLTMON    211
      IF(ICD3.NE.1) GO TO 2120                                          FLTMON    212
C                                                                       FLTMON    213
C    GET THE LINE INFORMATION AND WRITE INTO IU12                       FLTMON    214
C                                                                       FLTMON    215
       NJSELI=IADATA(K+7)                                               FLTMON    216
C                                                                       FLTMON    217
       IF(IASWX.EQ.0)THEN                                               FLTMON    218
        WRITE(ISWFA,1100)TS                                             FLTMON    219
        NAWR=NAWR+1                                                     FLTMON    220
        IASWX=1                                                         FLTMON    221
       ENDIF                                                            FLTMON    222
C                                                                       FLTMON    223
       IF(NJSELI.NE.0)THEN                                              FLTMON    224
        WRITE(ISWFA,1200)IBUS,JBUS,CID                                  FLTMON    225
       ELSE                                                             FLTMON    226
        WRITE(ISWFA,1300)IBUS,JBUS,CID                                  FLTMON    227
       ENDIF                                                            FLTMON    228
        NAWR=NAWR+1                                                     FLTMON    229
C                                                                       FLTMON    230
 2120 ICD4=IADATA(K+6)                                                  FLTMON    231
      IF(ICD4 .EQ. 0) GO TO 2350                                        FLTMON    232
C * * *                                                                 FLTMON    233
C * * * ICD4 IS THE NUMBER OF REMOTE RELAYS ATTACHED TO THIS LOCAL      FLTMON    234
C * * * RELAY.  TTIMR1 IS THE TRANSFER TRIP TIMER.                      FLTMON    235
C * * *                                                                 FLTMON    236
         KBUS=K                                                         FLTMON    237
         KADD=K+17                                                      FLTMON    238
         IPOINT=12                                                      FLTMON    239
C                                                                       FLTMON    240
C   CALL RETRIP TO PROCESS REMOTE RELAY LOGIC                           FLTMON    241
C                                                                       FLTMON    242
         CALL RETRIP(KADD,KBUS,ICD4,IPOINT)                             FLTMON    243
         IF(IADATA(KBUS+IPOINT).EQ.-1)THEN                              FLTMON    244
           IADATA(K+1) = 4                                              FLTMON    245
           IF(ICD3.NE.1 .OR. ADATA(K+13).EQ.0.0)IADATA(K+1)=5           FLTMON    246
         ENDIF                                                          FLTMON    247
C                                                                       FLTMON    248
 2350 CONTINUE                                                          FLTMON    249
C                                                                       FLTMON    250
      IF(ICD3.EQ.1 .AND.ADATA(K+13).NE.0.0)THEN                         FLTMON    251
C                                                                       FLTMON    252
C                                                                       FLTMON    253
C    RECLOSING LOGIC                                                    FLTMON    254
C                                                                       FLTMON    255
        IF(ADATA(K+14).LE.TS)THEN                                       FLTMON    256
         IADATA(K+1)=5                                                  FLTMON    257
        ADATA(K+10)=-1.0                                                FLTMON    258
        ADATA(K+14)=-1.0                                                FLTMON    259
C                                                                       FLTMON    260
C    GET THE LINE INFORMATION AND WRITE INTO IU12                       FLTMON    261
C                                                                       FLTMON    262
          NJSELI=IADATA(K+7)                                            FLTMON    263
C                                                                       FLTMON    264
         IF(IASWX.EQ.0)THEN                                             FLTMON    265
          WRITE(ISWFA,1100)TS                                           FLTMON    266
          NAWR=NAWR+1                                                   FLTMON    267
          IASWX=1                                                       FLTMON    268
         ENDIF                                                          FLTMON    269
C                                                                       FLTMON    270
         IF(NJSELI.NE.0)THEN                                            FLTMON    271
          WRITE(ISWFA,1400)IBUS,JBUS,CID                                FLTMON    272
         ELSE                                                           FLTMON    273
          WRITE(ISWFA,1500)IBUS,JBUS,CID                                FLTMON    274
         ENDIF                                                          FLTMON    275
         NAWR=NAWR+1                                                    FLTMON    276
        ENDIF                                                           FLTMON    277
       ENDIF                                                            FLTMON    278
 2400 CONTINUE                                                          FLTMON    279
      RETURN                                                            FLTMON    280
 1100   FORMAT(F10.5)                                                   FLTMON    281
 1200   FORMAT('DPIA',2I5,1X,A2)                                        FLTMON    282
 1300   FORMAT('DLIA',2I5,1X,A2)                                        FLTMON    283
 1400   FORMAT('RPIA',2I5,1X,A2)                                        FLTMON    284
 1500   FORMAT('RLIA',2I5,1X,A2)                                        FLTMON    285
      END                                                               FLTMON    286
