CFPRIME RCPMON                                                          RCPMON      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
                                                                        RCPMON      3
      SUBROUTINE RCPMON(IDISW,H)                                        RCPMON      4
CD                                                                      RCPMON      5
CD THIS SUBROUTINE CHECKS THE STATUS OF ALL RATE OF CHANGE OF POWER     RCPMON      6
CD RELAYS.                                                              RCPMON      7
CD                                                                      RCPMON      8
CD ROUTINE INPUTS:                                                      RCPMON      9
CD                                                                      RCPMON     10
CD IDISW : A LOGICAL DISCONTINUITY INDICATOR                            RCPMON     11
CD         SET TRUE FOR DISCONTINUITY                                   RCPMON     12
CD     H : IS THE INTEGRATION STEP SIZE IN SECONDS                      RCPMON     13
CD                                                                      RCPMON     14
CD                                                                      RCPMON     15
CD     LRCRPA          Starting position of IDATPT array  of RCPR relay RCPMON     16
CD                     scheme, LRCRPA is in the common labelled PT of   RCPMON     17
CD                     include file CNPT.                               RCPMON     18
CD                                                                      RCPMON     19
CD     NRCPRA          Finishing position of IDATPT array of RCPR relay RCPMON     20
CD                     scheme, NRCPRA is in common labelled AUTO of     RCPMON     21
CD                     include file CNAUTO.                             RCPMON     22
CD                                                                      RCPMON     23
CD     let k = k-th RCPR RELAY                                          RCPMON     24
CD                                                                      RCPMON     25
CD     N = IDATPT(k)    IDATPT is the array that stores the start       RCPMON     26
CD                      position of the K-TH RCPR relay scheme data     RCPMON     27
CD                                                                      RCPMON     28
CD       IADATA(N+1)=ICD1R1  LOCAL RELAY TRIP STATUS                    RCPMON     29
CD                           = 1 RELAY NOT TRIP                         RCPMON     30
CD                           = 2 LOCAL RELAY TRIPPED, REMOTE RELAY IN   RCPMON     31
CD                               PROGRESS                               RCPMON     32
CD                           = 3 BOTH LOCAL AND REMOTE RELAY TRIPPED.   RCPMON     33
CD                           = 4 BOTH LOCAL AND REMOTE RELAY            RCPMON     34
CD                               TRIPPED,LOCAL LINE BRK RECLOSED.       RCPMON     35
CD                                                                      RCPMON     36
CD       IADATA(N+2)=IBUSR1  LEFT HAND SET BUS NO.                      RCPMON     37
CD                                                                      RCPMON     38
CD       IADATA(N+3)=JBUSR1  RIGHT HAND SIDE BUS NO.                    RCPMON     39
CD                                                                      RCPMON     40
CD       IADATA(N+4)=IPARR1  PARALLEL IDENTIFICATION FOR THE LINE       RCPMON     41
CD                                                                      RCPMON     42
CD       IADATA(N+5)=ICD2R1  TYPE OF RELAY MODEL                        RCPMON     43
CD                           = 5  R1 MODEL                              RCPMON     44
CD                           = 6  R2 MODEL                              RCPMON     45
CD                           = 7  R3 MODEL                              RCPMON     46
CD                                                                      RCPMON     47
CD       IADATA(N+6)=ICD3R1  =1 USE SIGNAL TO TRIP THE LINE             RCPMON     48
CD                           =2 DO NOT TRIP THE LINE, SIGNAL IS         RCPMON     49
CD                              USED FOR REMOTE TRIPPING.               RCPMON     50
CD                                                                      RCPMON     51
CD       IADATA(N+7)=ICD4R1   NO. OF REMOTE RELAY ATTACHED TO THE LOCAL RCPMON     52
CD                            RELAY                                     RCPMON     53
CD                                                                      RCPMON     54
CD       ADATA(N+8)=RBR1      R1 & R2 MODELS: RATE SETTLING (MW/SEC)    RCPMON     55
CD                 =RMAXR1    R3 MODEL: UPPER RATE LIMIT       (MW/SEC) RCPMON     56
CD                                                                      RCPMON     57
CD       ADATA(N+9)=RMINR1    R1 & R2 MODELS: UPPER RATE LIMIT (MW/SEC) RCPMON     58
CD                            LOWER = - UPPER                           RCPMON     59
CD                            R3 MODEL: LOWER RATE LIMIT (MW/SEC)       RCPMON     60
CD                                                                      RCPMON     61
CD       ADATA(N+10)=RSR1     RATE SETTING (COMMON TO ALL MODELS)       RCPMON     62
CD                            (MW/SEC)                                  RCPMON     63
CD                                                                      RCPMON     64
CD       ADATA(N+11)=BIASR1   FOR R1 & R2 MODELS: BAIS SETTING          RCPMON     65
CD                            FOR R3 MODEL: LEAVE BLANK                 RCPMON     66
CD                                                                      RCPMON     67
CD       ADATA(N+12)=PSR1     POWER LEVEL SETTING (MW)                  RCPMON     68
CD                                                                      RCPMON     69
CD       ADATA(N+13)=TCR1     INTEGRATOR TIME CONSTANT (SEC)            RCPMON     70
CD                                                                      RCPMON     71
CD       ADATA(N+14)=TDR1     FOR R1 & R2 MODELS: BLOCK RATE TIME       RCPMON     72
CD                            DELAY (CYCLES)                            RCPMON     73
CD                  =TER1     FOR R3 MODEL: ENABLE HOLD TIME DELAY      RCPMON     74
CD                            (CYCLES)                                  RCPMON     75
CD                                                                      RCPMON     76
CD       ADATA(N+15)=THR1     FOR R1 & R2 MODEL: BLANK                  RCPMON     77
CD                            FOR R3 MODEL: AUX RELAY TIME DELAY        RCPMON     78
CD                            (CYCLES)                                  RCPMON     79
CD                                                                      RCPMON     80
CD       ADATA(N+16)=T1R1     TIMER FOR LOCAL RELAY                     RCPMON     81
CD                                                                      RCPMON     82
CD       ADATA(N+17)=T2R1     TIMER FOR LOCAL RELAY                     RCPMON     83
CD                                                                      RCPMON     84
CD       IADATA(N+18)         REMOTE RELAY TRIP STATUS                  RCPMON     85
CD                                                                      RCPMON     86
CD       ADATA(N+19)=PIODR1   PAST VALUE OF TIE LINE POWER              RCPMON     87
CD                                                                      RCPMON     88
CD       ADATA(N+20)=PIIR1    PAST VALUE OF BLOCK 'A' OUTPUT            RCPMON     89
CD                                                                      RCPMON     90
CD       ADATA(N+21)=PIIIR1   PAST VALUE OF BLOCK 'B' OUTPUT            RCPMON     91
CD                                                                      RCPMON     92
CD       ADATA(N+22)=RIR1     OUTPUT OF THE RS BLOCK                    RCPMON     93
CD                                                                      RCPMON     94
CD       ADATA(N+23)=RIIR1    OUTPUT OF THE TC BLOCK FOR R1 & R2 MODELS RCPMON     95
CD                  =QOLDR1   OUTPUT OF THE TC BLOCK FOR R3 MODEL       RCPMON     96
CD                                                                      RCPMON     97
CD       ADATA(N+24)=TRCLSE   TIME DELAY FOR RECLOSING                  RCPMON     98
CD                                                                      RCPMON     99
CD       ADATA(N+25)=RTIMER   TIMER FOR RECLOSING                       RCPMON    100
CD                                                                      RCPMON    101
CD                                                                      RCPMON    102
CD                                                                      RCPMON    103
CD    LINE PARAMETER IN PI-CIRCUIT FORM                                 RCPMON    104
CD                                                                      RCPMON    105
CD       ADATA(N+26)=GIJR1    GKM                                       RCPMON    106
CD       ADATA(N+27)=BIJR1    BKM                                       RCPMON    107
CD       ADATA(N+28)=GIOR1    GK1                                       RCPMON    108
CD       ADATA(N+29)=BIOR1    BK1                                       RCPMON    109
CD       ADATA(N+30)=GJOR1    GK2                                       RCPMON    110
CD       ADATA(N+31)=BJOR1    BK2                                       RCPMON    111
CD       IADATA(N+32)=NJSELI  FLAG FOR THE LINE TYPE                    RCPMON    112
CD                                                                      RCPMON    113
CD                                                                      RCPMON    114
CD       ADATA(N+33)=TAR1     TIME CONSTANT FOR 'A' BLOCK               RCPMON    115
CD       ADATA(N+34)=TBR1     TIME CONSTANT FOR 'B' BLOCK               RCPMON    116
CD                                                                      RCPMON    117
CD                                                                      RCPMON    118
      INCLUDE 'PARX.INS'                                                RCPMON    119
      INCLUDE 'CNPT.INS'                                                RCPMON    120
      INCLUDE 'CNAUTO.INS'                                              RCPMON    121
      INCLUDE 'CNVOLT.INS'                                              RCPMON    122
      INCLUDE 'CNFLAG.INS'                                              RCPMON    123
      INCLUDE 'CNB4.INS'                                                RCPMON    124
      INCLUDE 'CNB19.INS'                                               RCPMON    125
      INCLUDE 'CNUNIT.INS'                                              RCPMON    126
C                                                                       RCPMON    127
      CHARACTER*2 CID                                                   RCPMON    128
C                                                                       RCPMON    129
      LOGICAL IDISW                                                     RCPMON    130
C                                                                       RCPMON    131
      COMPLEX VOLTK                                                     RCPMON    132
      DIMENSION VOLTX(2)                                                RCPMON    133
      EQUIVALENCE (VOLTK,VOLTX(1)),(VOLTX(1),VREAL),(VOLTX(2),VIMAG)    RCPMON    134
C                                                                       RCPMON    135
C                                                                       RCPMON    136
      LDEB=(JDEB(37).NE.0)                                              RCPMON    137
      DO 2400 I = LRCPRA,NRCPRA                                         RCPMON    138
      K=IDATPT(I)                                                       RCPMON    139
      ICD1 = IADATA(K+1)                                                RCPMON    140
      IF(ICD1.GT.9)GOTO 2400                                            RCPMON    141
      ICD2 = IADATA(K+5)                                                RCPMON    142
      ICD3 = IADATA(K+6)                                                RCPMON    143
      ICD4 = IADATA(K+7)                                                RCPMON    144
CD                                                                      RCPMON    145
CD    ICD IS A STATUS FLAG                                              RCPMON    146
CD                                                                      RCPMON    147
CD     IF ICD1 = 4,BOTH LOCAL AND REMOTE TRIPPED,LOCAL BREAKER          RCPMON    148
CD                 RECLOSED  RCPMON     41                              RCPMON    149
C                                                                       RCPMON    150
       IF(ICD1 .EQ. 4)GOTO 2400                                         RCPMON    151
CD                                                                      RCPMON    152
CD     IF ICD1 = 3, BOTH LOCAL AND REMOTE TRIPPING HAS BEEN COMPLETED   RCPMON    153
CD                                                                      RCPMON    154
      IF(ICD1 .EQ. 3) GO TO 2350                                        RCPMON    155
C                                                                       RCPMON    156
CD     IF ICD1 = 2 LOCAL TRIPPING IS COMPLETE BUT TRANSFER              RCPMON    157
CD                 IS STILL IN PROGRESS                                 RCPMON    158
CD                                                                      RCPMON    159
      IF(ICD1 .EQ. 2)GO TO 2250                                         RCPMON    160
C                                                                       RCPMON    161
C * * * TEST FOR FIRST TEN CYCLE BYPASS                                 RCPMON    162
C * * *                                                                 RCPMON    163
C      IF(MRELAY .EQ. 1 .AND. TO .LE. 10.)GO TO 2400                    RCPMON    164
C                                                                       RCPMON    165
      IF(IDISW) GO TO 2400                                              RCPMON    166
      IBUS = IADATA(K+2)                                                RCPMON    167
      JBUS = IADATA(K+3)                                                RCPMON    168
      ITFK = IADATA(K+4)                                                RCPMON    169
      CALL UNPACK (CID, JJJ, ITFK)                                      RCPMON    170
C                                                                       RCPMON    171
      VOLTK=VOLT(IBUS)                                                  RCPMON    172
      EI = VREAL                                                        RCPMON    173
      FI = VIMAG                                                        RCPMON    174
      VOLTK=VOLT(JBUS)                                                  RCPMON    175
      EJ = VREAL                                                        RCPMON    176
      FJ = VIMAG                                                        RCPMON    177
      GIJ = ADATA(K+26)                                                 RCPMON    178
      BIJ = ADATA(K+27)                                                 RCPMON    179
      GIO = ADATA(K+28)                                                 RCPMON    180
      BIO = ADATA(K+29)                                                 RCPMON    181
      GT = GIO + GIJ                                                    RCPMON    182
      BT = BIO+BIJ                                                      RCPMON    183
C * * *                                                                 RCPMON    184
C * * * CALCULATE POWER FLOW ON LINE CONTAINING RELAY                   RCPMON    185
C * * *                                                                 RCPMON    186
      C1R = EI*GT - FI*BT                                               RCPMON    187
      C1I = EI*BT + FI*GT                                               RCPMON    188
      C2R = EJ*GIJ - FJ*BIJ                                             RCPMON    189
      C2I = EJ*BIJ + FJ*GIJ                                             RCPMON    190
      CTR = C1R-C2R                                                     RCPMON    191
      CTI = C1I - C2I                                                   RCPMON    192
      PI = EI*CTR + FI*CTI                                              RCPMON    193
      PIIOLD = ADATA(K+21)                                              RCPMON    194
      P3IOLD = ADATA(K+22)                                              RCPMON    195
      IF(IDISW)THEN                                                     RCPMON    196
         PIOLD = PI                                                     RCPMON    197
         PS = ADATA(K+12)                                               RCPMON    198
         ADATA(K+20) = PIOLD                                            RCPMON    199
         GO TO 2400                                                     RCPMON    200
      ENDIF                                                             RCPMON    201
C      TA = ADATA(K+33)                                                 RCPMON    202
       TA=0.0                                                           RCPMON    203
C      TB = ADATA(K+34)                                                 RCPMON    204
       TB=0.0                                                           RCPMON    205
      PS = ADATA(K+12)                                                  RCPMON    206
      PIOLD = ADATA(K+20)                                               RCPMON    207
C * * *                                                                 RCPMON    208
C * * * PII IS THE OUTPUT OF THE A BLOCK                                RCPMON    209
C * * * PIII IS THE OUTPUT OF THE B BLOCK                               RCPMON    210
C * * *                                                                 RCPMON    211
C             EDT IS REPLACED BY H                                      RCPMON    212
C                                                                       RCPMON    213
      PII = (PIIOLD*(2.*TA/H-1.) + PIOLD + PI)/(2.*TA/H + 1.)           RCPMON    214
      PIII = (P3IOLD*(2.*TB/H -1.) + PIIOLD + PII)/(2. * TB/H +1.)      RCPMON    215
      PDOT = (PIII - P3IOLD)/H                                          RCPMON    216
      PIOLD = PI                                                        RCPMON    217
      PIIOLD = PII                                                      RCPMON    218
      P3IOLD = PIII                                                     RCPMON    219
      ADATA(K+20) = PIIOLD                                              RCPMON    220
      ADATA(K+21) = P3IOLD                                              RCPMON    221
      ADATA(K+12) = PS                                                  RCPMON    222
      ADATA(K+19) = PIOLD                                               RCPMON    223
C * * *                                                                 RCPMON    224
C * * * ICD2 = 5 FOR THE R1 MODEL                                       RCPMON    225
C * * * ICD2 = 6 FOR THE R2 MODEL                                       RCPMON    226
C * * * ICD2 = 7 FOR THE R3 MODEL                                       RCPMON    227
C * * * THIS LOGIC IS FOR THE R3 MODEL                                  RCPMON    228
C * * *                                                                 RCPMON    229
      IF(ICD2 .LT. 7)GO TO 675                                          RCPMON    230
      PI1 = PIII/PS                                                     RCPMON    231
C                                                                       RCPMON    232
      IN1 = 0                                                           RCPMON    233
C                                                                       RCPMON    234
      T1 = ADATA(K+16)                                                  RCPMON    235
      T2 = ADATA(K+17)                                                  RCPMON    236
      TE = ADATA(K+14)                                                  RCPMON    237
      TH = ADATA(K+15)                                                  RCPMON    238
      IF(PI1 .GE. 1.) T2 = TS                                           RCPMON    239
      IF((T2 + TE) .GE. TS) IN1 = 1                                     RCPMON    240
      RMAX = ADATA(K+8)                                                 RCPMON    241
      RMIN = ADATA(K+9)                                                 RCPMON    242
      IF(PDOT .GT. RMAX) PDOT = RMAX                                    RCPMON    243
      IF(PDOT .LT. RMIN) PDOT = RMIN                                    RCPMON    244
      RS = ADATA(K+10)                                                  RCPMON    245
      TC = ADATA(K+13)                                                  RCPMON    246
      RIIOLD = ADATA(K+23)                                              RCPMON    247
      RIOLD = ADATA(K+22)                                               RCPMON    248
      RI = PDOT/RS                                                      RCPMON    249
C * * *                                                                 RCPMON    250
C * * * RII IS THE OUTPUT OF THE 'C' BLOCK                              RCPMON    251
C * * *                                                                 RCPMON    252
      RII = (RIIOLD*(2.*TC/H -1.) +RIOLD + RI)/(2.*TC/H + 1.)           RCPMON    253
      RIOLD = RI                                                        RCPMON    254
      RIIOLD = RII                                                      RCPMON    255
      ADATA(K+23) = RIIOLD                                              RCPMON    256
      ADATA(K+22) = RIOLD                                               RCPMON    257
C                                                                       RCPMON    258
C                                                                       RCPMON    259
      IN2 = 0                                                           RCPMON    260
      IF(ABS(RII) .GE. 1.) IN2=1                                        RCPMON    261
      IF(IN1 .EQ. 1 .AND. IN2 .EQ. 1) GO TO 700                         RCPMON    262
      T1 = 0.0                                                          RCPMON    263
  650 ADATA(K+16) = T1                                                  RCPMON    264
      ADATA(K+17) = T2                                                  RCPMON    265
      GO TO 2400                                                        RCPMON    266
C * * *                                                                 RCPMON    267
C * * * THIS LOGIC IS FOR THE R1 AND R2 MODELS                          RCPMON    268
C * * *                                                                 RCPMON    269
  675 T1 = ADATA(K+16)                                                  RCPMON    270
      TD = ADATA(K+14)                                                  RCPMON    271
      BIAS = ADATA(K+11)                                                RCPMON    272
      RB = ADATA(K+8)                                                   RCPMON    273
      RMAX = ADATA(K+9)                                                 RCPMON    274
      RS = ADATA(K+10)                                                  RCPMON    275
      TC = ADATA(K+13)                                                  RCPMON    276
      T1 = T1-H                                                         RCPMON    277
      IF(ABS(PDOT) .GT. RB) T1 = TD                                     RCPMON    278
C * * *                                                                 RCPMON    279
C * * * ICD2 = 5 FOR THE R1 MODEL                                       RCPMON    280
C * * * ICD2 = 6 FOR THE R2 MODEL                                       RCPMON    281
C * * * ICD2 = 7 FOR THE R3 MODEL                                       RCPMON    282
C * * *                                                                 RCPMON    283
      IF(ICD2 .NE. 5)THEN                                               RCPMON    284
         IF(T1 .GT. 0.0) PDOT = 0.0                                     RCPMON    285
      ENDIF                                                             RCPMON    286
      IF(PDOT .LT. -RMAX) PDOT = -RMAX                                  RCPMON    287
      IF(PDOT .GT. RMAX) PDOT = RMAX                                    RCPMON    288
      RI = (PDOT/RS) + (PIII-BIAS)/PS                                   RCPMON    289
      QOLD = ADATA(K+23)                                                RCPMON    290
      RIOLD = ADATA(K+22)                                               RCPMON    291
      Q = (QOLD*((2.*TC/H)-1.)+RIOLD + RI)/((2.*TC/H)+1.)               RCPMON    292
      IF(ICD2 .EQ. 6) THEN                                              RCPMON    293
         IF(ABS(Q) .GT. 1.)GO TO 800                                    RCPMON    294
      ENDIF                                                             RCPMON    295
      IF(ICD2 .EQ. 5)THEN                                               RCPMON    296
         IF((T1 .LE. 0.0) .AND.  (ABS(Q) .GT. 1.0)) GO TO 800           RCPMON    297
      ENDIF                                                             RCPMON    298
      ADATA(K+16) = T1                                                  RCPMON    299
      ADATA(K+14) = TD                                                  RCPMON    300
      ADATA(K+23) = Q                                                   RCPMON    301
      ADATA(K+22) = RI                                                  RCPMON    302
      GO TO 2400                                                        RCPMON    303
  700 T1 = T1 + H                                                       RCPMON    304
      IF(T1 .LT. TH) GO TO 650                                          RCPMON    305
C * * *                                                                 RCPMON    306
C * * *  POWER RATE RELAY HAS BEEN TRIPPED SO SET ICD1 = 2 AND          RCPMON    307
C * * *  INITIALIZE TRANSFER TRIP TIMER TTIMR1                          RCPMON    308
C * * *                                                                 RCPMON    309
  800 ICD1 = 2                                                          RCPMON    310
      IADATA(K+1) = ICD1                                                RCPMON    311
      IF(ICD4.NE.0)THEN                                                 RCPMON    312
         KADD=K+32                                                      RCPMON    313
         CALL RTIMER(KADD,ICD4)                                         RCPMON    314
      ENDIF                                                             RCPMON    315
C                                                                       RCPMON    316
C    ICD3 = 1 THE MONITORED LINE IS TRIPPED                             RCPMON    317
C    ICD3 = 2 THE MONITORED LINE IS NOT TRIPPED                         RCPMON    318
C                                                                       RCPMON    319
      IF(ICD3.NE.1)GOTO 2250                                            RCPMON    320
C                                                                       RCPMON    321
      IF(ADATA(K+24).NE.0.0)ADATA(K+25)=ADATA(K+24)+TS                  RCPMON    322
C                                                                       RCPMON    323
C    GET THE LINE INFORMATION AND WRITE INTO IU12                       RCPMON    324
C                                                                       RCPMON    325
       NJSELI=IADATA(K+32)                                              RCPMON    326
C                                                                       RCPMON    327
       IF(IASWX.EQ.0)THEN                                               RCPMON    328
        WRITE(ISWFA,1100)TS                                             RCPMON    329
        NAWR=NAWR+1                                                     RCPMON    330
        IASWX=1                                                         RCPMON    331
       ENDIF                                                            RCPMON    332
C                                                                       RCPMON    333
       IF(NJSELI.NE.0)THEN                                              RCPMON    334
        WRITE(ISWFA,1200)IBUS,JBUS,CID                                  RCPMON    335
       ELSE                                                             RCPMON    336
        WRITE(ISWFA,1300)IBUS,JBUS,CID                                  RCPMON    337
       ENDIF                                                            RCPMON    338
       NAWR=NAWR+1                                                      RCPMON    339
C                                                                       RCPMON    340
C       ICD4 IS THE NUMBER OF REMOTE RELAYS ATTACHED TO THIS LOCAL      RCPMON    341
C       RELAY.  TTIMR1 IS THE TRANSFER TRIP TIMER.                      RCPMON    342
C                                                                       RCPMON    343
 2250 IF(ICD4.EQ.0) GO TO 2350                                          RCPMON    344
       IF(IADATA(K+1).EQ.2)THEN                                         RCPMON    345
         KADD=K+32                                                      RCPMON    346
         KBUS=K                                                         RCPMON    347
         IPOINT=18                                                      RCPMON    348
C                                                                       RCPMON    349
C   CALL RETRIP TO PROCESS REMOTE RELAY LOGIC                           RCPMON    350
C                                                                       RCPMON    351
         CALL RETRIP(KADD,KBUS,ICD4,IPOINT)                             RCPMON    352
         IF(IADATA(KBUS+IPOINT).EQ.-1)THEN                              RCPMON    353
           IADATA(K+1)=3                                                RCPMON    354
           IF(ICD3.NE.1)IADATA(K+1)=4                                   RCPMON    355
         ENDIF                                                          RCPMON    356
       ENDIF                                                            RCPMON    357
C                                                                       RCPMON    358
C    RECLOSING LOGIC                                                    RCPMON    359
C                                                                       RCPMON    360
 2350 CONTINUE                                                          RCPMON    361
      IF(ADATA(K+24).EQ.0.0.OR.ICD3.NE.1)GOTO 2400                      RCPMON    362
      IF(ADATA(K+25).LE.TS)THEN                                         RCPMON    363
       IADATA(K+1)=4                                                    RCPMON    364
C                                                                       RCPMON    365
C    GET THE LINE INFORMATION AND WRITE INTO IU12                       RCPMON    366
C                                                                       RCPMON    367
       NJSELI=IADATA(K+32)                                              RCPMON    368
C                                                                       RCPMON    369
       IF(IASWX.EQ.0)THEN                                               RCPMON    370
        WRITE(ISWFA,1100)TS                                             RCPMON    371
        NAWR=NAWR+1                                                     RCPMON    372
        IASWX=1                                                         RCPMON    373
       ENDIF                                                            RCPMON    374
C                                                                       RCPMON    375
       IF(NJSELI.NE.0)THEN                                              RCPMON    376
        WRITE(ISWFA,1400)IBUS,JBUS,CID                                  RCPMON    377
       ELSE                                                             RCPMON    378
        WRITE(ISWFA,1500)IBUS,JBUS,CID                                  RCPMON    379
       ENDIF                                                            RCPMON    380
       NAWR=NAWR+1                                                      RCPMON    381
      ENDIF                                                             RCPMON    382
 2400 CONTINUE                                                          RCPMON    383
      RETURN                                                            RCPMON    384
C 1000  FORMAT( ' IN RCPMON : THE LINE BETWEEN BUS#',I6,' AND BUS# ',   RCPMON    385
C     & I6,' DO NOT EXIST')                                             RCPMON    386
 1100   FORMAT(F10.5)                                                   RCPMON    387
 1200   FORMAT('DPIA',2I5,1X,A2)                                        RCPMON    388
 1300   FORMAT('DLIA',2I5,1X,A2)                                        RCPMON    389
 1400   FORMAT('RPIA',2I5,1X,A2)                                        RCPMON    390
 1500   FORMAT('RLIA',2I5,1X,A2)                                        RCPMON    391
      END                                                               RCPMON    392
