CFPRIME DISINT                                                          DISINT      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 DISINT(IEBK)                                           DISINT      3
CD                                                                      DISINT      4
CD    THIS SUBROUTINE DECODES THE DISTANCE RELAY DATA CARD. IT ALSO     DISINT      5
CD    SEARCHES THE REMOTE RELAY TABLES TO FIND THE INDICES OF THE REMOTEDISINT      6
CD    RELAYS FOR THIS RELAY.                                            DISINT      7
CD                                                                      DISINT      8
CD     LDISTR          Starting position of IDATPT array  of DIST relay DISINT      9
CD                     scheme, LDISTR is in the common labelled PT of   DISINT     10
CD                     include file CNPT.                               DISINT     11
CD                                                                      DISINT     12
CD     NDISTR          Finishing position of IDATPT array of DIST relay DISINT     13
CD                     scheme, NDISTR is in common labelled AUTO of     DISINT     14
CD                     include file CNAUTO.                             DISINT     15
CD                                                                      DISINT     16
CD     let k = k-th DIST RELAY                                          DISINT     17
CD                                                                      DISINT     18
CD     N = IDATPT(k)    IDATPT is the array that stores the start       DISINT     19
CD                      position of the K-TH DIST relay scheme data     DISINT     20
CD                                                                      DISINT     21
CD     IADATA(N+1)=ICD1RD   LOCAL RELAY STATUS                          DISINT     22
CD                          = 1 RELAY NOT TRIPPED                       DISINT     23
CD                          = 2 LOCAL TRIPPING COMPLETED,REMOTE         DISINT     24
CD                              TRIPPING STARTED                        DISINT     25
CD                          = 3 BOTH LOCAL AND REMOTE TRIPPING HAVE     DISINT     26
CD                              BEEN COMPLETED.                         DISINT     27
CD                                                                      DISINT     28
CD     IADATA(N+2)=IBUSRD   LEFT HAND SIDE BUS NO.                      DISINT     29
CD                                                                      DISINT     30
CD     IADATA(N+3)=JBUSRD   RIGHT HAND SIDE BUS NO.                     DISINT     31
CD                                                                      DISINT     32
CD     IADATA(N+4)=IPARRD   PARALLEL IDENTIFICATION FOR THE LINE        DISINT     33
CD                                                                      DISINT     34
CD     IADATA(N+5)=ICD3RD   =1      USE SIGNAL TO TRIP THE LINE         DISINT     35
CD                          =C OR 2 DO NOT TRIP THE LINE; SIGNAL        DISINT     36
CD                                  IS USED FOR REMOTE TRIPPING.        DISINT     37
CD                                                                      DISINT     38
CD     IADATA(N+6)=ICD2RD   RELAY TYPE OPTION                           DISINT     39
CD                          =1 IMPEDANCE RELAY (T1)                     DISINT     40
CD                          =2 DEFAULT DISTANT RELAY (T2)               DISINT     41
CD                                                                      DISINT     42
CD     IADATA(N+7)=ICD4RD   NUMBER OF REMOTE RELAY ATTACH TO THE LOCAL  DISINT     43
CD                          RELAY                                       DISINT     44
CD                                                                      DISINT     45
CD     IADATA(N+8)          REMOTE RELAY TRIP FLAG                      DISINT     46
CD                                                                      DISINT     47
CD                                                                      DISINT     48
CD     ADATA(N+9) =TRCRD    T1 :READ IN AS THE Tcenter, INITIALIZED AS  DISINT     49
CD                              Tcenter*COS(TANGLE) FOR CIRCLE T.       DISINT     50
CD                          T2 :USER SUPPLIED R/X RATIO                 DISINT     51
CD                                                                      DISINT     52
CD                                                                      DISINT     53
CD     ADATA(N+10)=TXCRD    T1 :READ IN AS THE TORQUE ANGLE, INITIALIZEDDISINT     54
CD                              AS Tcenter*SIN(TANGLE) FOR CIRCLE T.    DISINT     55
CD                          T2 :ZONE ONE REACH (DEFAULT=0.8)            DISINT     56
CD                                                                      DISINT     57
CD     ADATA(N+11)=TRD2RD   T1 :READ IN AS THE DIAMETER OF THE CIRCLE T;DISINT     58
CD                              STORE AS THE RADIUS SQUARE OF CIRCLE T. DISINT     59
CD                          T2 :ZONE TWO REACH (DEFAULT=1.2)            DISINT     60
CD                                                                      DISINT     61
CD                                                                      DISINT     62
CD     ADATA(N+12)=TTRPRD   T1 :CIRCLE T TRIP TIME IN CIRCLE            DISINT     63
CD                          T2 :MIN TORQUE ANGLE OVER WHICH THE RELAY   DISINT     64
CD                              LOGIC WILL BE ACTIVIATED.(DEFAULT=60)   DISINT     65
CD                                                                      DISINT     66
CD     ADATA(N+13)=TZDYRD   T1 :ZONE 1 (CIRCLE T)  TIMER                DISINT     67
CD                          T2 :NOT USED                                DISINT     68
CD                                                                      DISINT     69
CD                                                                      DISINT     70
CD     ADATA(N+14)=BRCRD    T1 :READ IN AS THE Bcenter, INITIALIZED     DISINT     71
CD                              AS Bcenter*COS(BANGLE) FOR CIRCLE B.    DISINT     72
CD                          T2 : MAX TORQUE ANGLE (DEFAULT=75)          DISINT     73
CD                                                                      DISINT     74
CD     ADATA(N+15)=BXCRD    T1 :READ IN AS THE TORQUE ANGLE, INITIALIZEDDISINT     75
CD                              AS Bcenter*SIN(BANGLE) FOR CIRCLE B.    DISINT     76
CD                          T2 :NOT USED                                DISINT     77
CD                                                                      DISINT     78
CD     ADATA(N+16)=BRD2RD   T1 :READ IN AS THE DIAMETER OF THE CIRCLE B;DISINT     79
CD                              STORE AS THE RADIUS SQUARE OF CIRCLE B. DISINT     80
CD                          T2 :NOT USED                                DISINT     81
CD                                                                      DISINT     82
CD     ADATA(N+17)=BTRPRD   T1 :CYCLE B  TRIP TIME IN CYCLES            DISINT     83
CD                          T2 :NOT USED                                DISINT     84
CD                                                                      DISINT     85
CD     ADATA(N+18)=BZDYRD   T1 :ZONE 2 (CYCLE B) TIMER                  DISINT     86
CD                          T2 :RELAY TIMER                             DISINT     87
CD                                                                      DISINT     88
CD     ADATA(N+19)=TRCLSE   T1,T2 :RECLOSING TIME DELAY.                DISINT     89
CD                                                                      DISINT     90
CD     ADATA(N+20)=RTIMER   T1,T2 :RECLOSING TIMER                      DISINT     91
CD                                                                      DISINT     92
CD                                                                      DISINT     93
CD     FOR T1: LINE PARAMETER IN PI-CIRCUIT FORM                        DISINT     94
CD                                                                      DISINT     95
CD                                                                      DISINT     96
CD     ADATA(N+21)=GIJRD    GKM                                         DISINT     97
CD     ADATA(N+22)=BIJRD    BKM                                         DISINT     98
CD     ADATA(N+23)=GIORD    GK1                                         DISINT     99
CD     ADATA(N+24)=BIORD    BK1                                         DISINT    100
CD     ADATA(N+25)=GJORD    GK2                                         DISINT    101
CD     ADATA(N+26)=BJORD    BK2                                         DISINT    102
CD                                                                      DISINT    103
CD                                                                      DISINT    104
CD     FOR T2:                                                          DISINT    105
CD                                                                      DISINT    106
CD                                                                      DISINT    107
CD     ADATA(N+21)         TAN60                                        DISINT    108
CD     ADATA(N+22)         A1                                           DISINT    109
CD     ADATA(N+23)         B1                                           DISINT    110
CD     ADATA(N+24)         A2                                           DISINT    111
CD     ADATA(N+25)         B2                                           DISINT    112
CD     ADATA(N+26)         NOT USED                                     DISINT    113
CD                                                                      DISINT    114
CD     IADATA(N+27)        NJSELI        FLAG FOR PI-LINE WITH UNEQUAL  DISINT    115
CD                                       SHUNTS.                        DISINT    116
CD                                                                      DISINT    117
CD                                                                      DISINT    118
      INCLUDE 'PARX.INS'                                                DISINT    119
      INCLUDE 'CNPT.INS'                                                DISINT    120
      INCLUDE 'CNAUTO.INS'                                              DISINT    121
      INCLUDE 'CNNNEW.INS'                                              DISINT    122
      INCLUDE 'CNSTN.INS'                                               DISINT    123
      INCLUDE 'CNB19.INS'                                               DISINT    124
      INCLUDE 'CNUNIT.INS'                                              DISINT    125
      INCLUDE 'CNLFDA.INS'                                              DISINT    126
      INCLUDE 'CNSELI.INS'                                              DISINT    127
      INCLUDE 'CNMSG.INS'                                               DISINT    128
      CHARACTER*2 CID                                                   DISINT    129
C                                                                       DISINT    130
      DATA ANGCON/0.017453/                                             DISINT    131
C                                                                       DISINT    132
C     REORDER BUS NUMBERS IN DISTANCE RELAY TABLE                       DISINT    133
C                                                                       DISINT    134
      DO 1000 I=LDISTR,NDISTR                                           DISINT    135
C                                                                       DISINT    136
      K=IDATPT(I)                                                       DISINT    137
      IF(IADATA(K+1).GT.9)GOTO 1000                                     DISINT    138
C                                                                       DISINT    139
      NLFI=IADATA(K+2)                                                  DISINT    140
      NLFJ=IADATA(K+3)                                                  DISINT    141
      NPROGI=NNEW(NLFI)                                                 DISINT    142
      NPROGJ=NNEW(NLFJ)                                                 DISINT    143
      IADATA(K+1)=1                                                     DISINT    144
      IADATA(K+2)=NPROGI                                                DISINT    145
      IADATA(K+3)=NPROGJ                                                DISINT    146
      NI3=NPROGI*3                                                      DISINT    147
      NJ3=NPROGJ*3                                                      DISINT    148
      ICID=IADATA(K+4)                                                  DISINT    149
      CALL UNPACK(CID,LLL,ICID)                                         DISINT    150
      IOPT=IADATA(K+6)                                                  DISINT    151
      IDRRR=IADATA(K+7)                                                 DISINT    152
C                                                                       DISINT    153
      CALL LOLINE(NPROGI,NPROGJ,CID,JNL)                                DISINT    154
      IF(JNL.EQ.0)THEN                                                  DISINT    155
       IEBK=1                                                           DISINT    156
       WRITE(MSG(1),3220) NLFI,INAME(NI3-2),INAME(NI3-1),INAME(NI3)     DISINT    157
       WRITE(MSG(2),3230)                                               DISINT    158
     *    NLFJ,INAME(NJ3-2),INAME(NJ3-1),INAME(NJ3),CID                 DISINT    159
       CALL PRTMSG(2)                                                   DISINT    160
       GOTO 1000                                                        DISINT    161
      ENDIF                                                             DISINT    162
C                                                                       DISINT    163
      IF(IOPT.EQ.1)THEN                                                 DISINT    164
C                                                                       DISINT    165
C     LOAD THE LINE PARAMETER INTO STORAGE                              DISINT    166
C                                                                       DISINT    167
       JNL5=IABS(JNL)                                                   DISINT    168
       JNL5=JNL5*5                                                      DISINT    169
       ITFK=LFTB(JNL5-4)                                                DISINT    170
       CALL UNPACK(CID,NJSELI,ITFK)                                     DISINT    171
       IADATA(K+27)=NJSELI                                              DISINT    172
       IF(NJSELI.NE.0)THEN                                              DISINT    173
        ADATA(K+21)=EQPI(1,NJSELI)                                      DISINT    174
        ADATA(K+22)=EQPI(2,NJSELI)                                      DISINT    175
        ADATA(K+23)=EQPI(3,NJSELI)                                      DISINT    176
        ADATA(K+24)=EQPI(4,NJSELI)                                      DISINT    177
        ADATA(K+25)=EQPI(5,NJSELI)                                      DISINT    178
        ADATA(K+26)=EQPI(6,NJSELI)                                      DISINT    179
       ELSE                                                             DISINT    180
        ADATA(K+21)=GA(JNL5-2)                                          DISINT    181
        ADATA(K+22)=BA(JNL5-1)                                          DISINT    182
        ADATA(K+23)=0.                                                  DISINT    183
        ADATA(K+24)=BCHG(JNL5)/2.                                       DISINT    184
        ADATA(K+25)=0.                                                  DISINT    185
        ADATA(K+26)=BCHG(JNL5)/2.                                       DISINT    186
       ENDIF                                                            DISINT    187
      ENDIF                                                             DISINT    188
C                                                                       DISINT    189
      IF(IOPT.EQ.1)THEN                                                 DISINT    190
C                                                                       DISINT    191
C    CONVERT CYCLE INTO SEC.                                            DISINT    192
C                                                                       DISINT    193
       ADATA(K+12)=ADATA(K+12)/FQBASE                                   DISINT    194
       ADATA(K+17)=ADATA(K+17)/FQBASE                                   DISINT    195
       ADATA(K+19)=ADATA(K+19)/FQBASE                                   DISINT    196
C                                                                       DISINT    197
       IADATA(K+1)=1                                                    DISINT    198
       TANGLE=ADATA(K+10)*ANGCON                                        DISINT    199
       TCENTR=ADATA(K+9)                                                DISINT    200
       ADATA(K+9)= TCENTR*COS(TANGLE)                                   DISINT    201
       ADATA(K+10)= TCENTR*SIN(TANGLE)                                  DISINT    202
       TRAD=ADATA(K+11)/2.                                              DISINT    203
       ADATA(K+11)= TRAD*TRAD                                           DISINT    204
C                                                                       DISINT    205
       BANGLE=ADATA(K+15)*ANGCON                                        DISINT    206
       BCENTR=ADATA(K+14)                                               DISINT    207
       ADATA(K+14)= BCENTR*COS(BANGLE)                                  DISINT    208
       ADATA(K+15)= BCENTR*SIN(BANGLE)                                  DISINT    209
       BRAD=ADATA(K+16)/2.                                              DISINT    210
       ADATA(K+16)= BRAD*BRAD                                           DISINT    211
       ADATA(K+13)= -1.0                                                DISINT    212
       ADATA(K+18)= -1.0                                                DISINT    213
       ADATA(K+20)= -1.0                                                DISINT    214
      ELSE                                                              DISINT    215
C                                                                       DISINT    216
       IADATA(K+1)=1                                                    DISINT    217
C                                                                       DISINT    218
C    SET THE DEFAULT VALUE                                              DISINT    219
C                                                                       DISINT    220
       IF(IADATA(K+10).EQ.0) ADATA(K+10)=0.8                            DISINT    221
       IF(IADATA(K+11).EQ.0) ADATA(K+11)=1.2                            DISINT    222
       IF(IADATA(K+12).EQ.0) ADATA(K+12)=60.                            DISINT    223
       IF(IADATA(K+14).EQ.0) ADATA(K+14)=75.                            DISINT    224
C                                                                       DISINT    225
C    CONVERT CYCLES INTO SEC.                                           DISINT    226
C                                                                       DISINT    227
       ADATA(K+17)=ADATA(K+17)/FQBASE                                   DISINT    228
       ADATA(K+19)=ADATA(K+19)/FQBASE                                   DISINT    229
C                                                                       DISINT    230
C    INITIALIZE THE TIMER                                               DISINT    231
C                                                                       DISINT    232
       ADATA(K+18)= -1.0                                                DISINT    233
       ADATA(K+20)= -1.0                                                DISINT    234
C                                                                       DISINT    235
C    INITIALIZE BASED ON REACH,TORQUE                                   DISINT    236
C                                                                       DISINT    237
       ADATA(K+21)=TAN(ADATA(K+12)*ANGCON)                              DISINT    238
       ADATA(K+22)=0.5*ADATA(K+10)*COS(ADATA(K+14)*ANGCON)              DISINT    239
       ADATA(K+23)=0.5*ADATA(K+10)*SIN(ADATA(K+14)*ANGCON)              DISINT    240
       ADATA(K+24)=0.5*ADATA(K+11)*COS(ADATA(K+14)*ANGCON)              DISINT    241
       ADATA(K+25)=0.5*ADATA(K+11)*SIN(ADATA(K+14)*ANGCON)              DISINT    242
      ENDIF                                                             DISINT    243
C                                                                       DISINT    244
C     IF THE NO. OF REMOTE TRIPPING SCHEME IS NON-ZERO THEN             DISINT    245
C                                                                       DISINT    246
      IF(IDRRR.NE.0)THEN                                                DISINT    247
       KSHIFT=K+27                                                      DISINT    248
       CALL REMINT(KSHIFT,IDRRR)                                        DISINT    249
      ENDIF                                                             DISINT    250
C                                                                       DISINT    251
 1000 CONTINUE                                                          DISINT    252
C                                                                       DISINT    253
      RETURN                                                            DISINT    254
 3220 FORMAT(' *** ERROR  LINE BETWEEN BUS: ',I5,' STATION: '           DISINT    255
     *,3A4,' AND')                                                      DISINT    256
 3230 FORMAT(14X,'BUS: ',I5,' STATION: ',3A4,' ID: ',A2                 DISINT    257
     *,' CANNOT BE FOUND')                                              DISINT    258
      END                                                               DISINT    259
