CFPRIME DCODAT                                                          DCODAT      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 DCODAT(IEBK)                                           DCODAT      3
CD                                                                      DCODAT      4
CD    THIS SUBROUTINE READS IN THE DOUBLE CIRCLES OR LENS OUT-OF-STEP   DCODAT      5
CD    RELAY DATA                                                        DCODAT      6
CD                                                                      DCODAT      7
CD     LDCOSR          Starting position of IDATPT array  of DCOR relay DCODAT      8
CD                     scheme, LDCOSR is in the common labelled PT of   DCODAT      9
CD                     include file CNPT.                               DCODAT     10
CD                                                                      DCODAT     11
CD     NDCOSR          Finishing position of IDATPT array of DCOR relay DCODAT     12
CD                     scheme, NDCOSR is in common labelled AUTO of     DCODAT     13
CD                     include file CNAUTO.                             DCODAT     14
CD                                                                      DCODAT     15
      INCLUDE 'PARX.INS'                                                DCODAT     16
      INCLUDE 'CNPT.INS'                                                DCODAT     17
      INCLUDE 'CNMNEW.INS'                                              DCODAT     18
      INCLUDE 'CNAUTO.INS'                                              DCODAT     19
      INCLUDE 'CNLFDA.INS'                                              DCODAT     20
      INCLUDE 'CNB19.INS'                                               DCODAT     21
      INCLUDE 'CNFLAG.INS'                                              DCODAT     22
      INCLUDE 'CNPARX.INS'                                              DCODAT     23
      INCLUDE 'CNREN.INS'                                               DCODAT     24
      INCLUDE 'CNUNIT.INS'                                              DCODAT     25
      INCLUDE 'CNMSG.INS'                                               DCODAT     26
C                                                                       DCODAT     27
      CHARACTER*80 CARD1,CARD                                           DCODAT     28
      CHARACTER*12 BNAME1,BNAME2                                        DCODAT     29
      CHARACTER*4 CID                                                   DCODAT     30
      CHARACTER*2 CID2                                                  DCODAT     31
      INTEGER*4 ICID                                                    DCODAT     32
      EQUIVALENCE (ICID,CID)                                            DCODAT     33
      CHARACTER*5 EDATA                                                 DCODAT     34
      CHARACTER*3 ESC,MPI                                               DCODAT     35
      DATA ESC/'ESC'/,MPI/'MPI'/                                        DCODAT     36
      DATA EDATA/'EDATA'/                                               DCODAT     37
C                                                                       DCODAT     38
      LDEB=.FALSE.                                                      DCODAT     39
C                                                                       DCODAT     40
C     READ IN THE RELAY DATA CARDS                                      DCODAT     41
C                                                                       DCODAT     42
      LDCOSR=LRTEMP                                                     DCODAT     43
  110 CONTINUE                                                          DCODAT     44
      CALL GETLIN(IU54,CARD1)                                           DCODAT     45
      IF(CARD1(1:5).EQ.EDATA) GOTO 300                                  DCODAT     46
      IF(KLFO.EQ.0)THEN                                                 DCODAT     47
            READ (CARD1,2010) NLFI,NLFJ,CID2,IFLAG,ITYPE                DCODAT     48
      ELSE                                                              DCODAT     49
            READ (CARD1,2020) BNAME1,BNAME2,CID2,IFLAG,ITYPE            DCODAT     50
            CALL CHKBUS(BNAME1,NLFI)                                    DCODAT     51
            CALL CHKBUS(BNAME2,NLFJ)                                    DCODAT     52
      ENDIF                                                             DCODAT     53
      IF(NLFI.EQ.0.OR.NLFJ.EQ.0.OR.                                     DCODAT     54
     *   MNEW(NLFI).EQ.0.OR.MNEW(NLFJ).EQ.0)THEN                        DCODAT     55
         WRITE(MSG(1),2030)                                             DCODAT     56
         GOTO 200                                                       DCODAT     57
      ENDIF                                                             DCODAT     58
C                                                                       DCODAT     59
C     STORE THE DATA INTO THE PERMANENT ARRAY                           DCODAT     60
C                                                                       DCODAT     61
      IF(NAUT.GE.MAXSET)THEN                                            DCODAT     62
         WRITE(MSG(1),2040) MAXSET                                      DCODAT     63
         GOTO 200                                                       DCODAT     64
      ENDIF                                                             DCODAT     65
C                                                                       DCODAT     66
      NAUT=NAUT+1                                                       DCODAT     67
      NAUTB=NAUTB+2                                                     DCODAT     68
      NAUBUS(NAUTB-1)=NLFI                                              DCODAT     69
      NAUBUS(NAUTB)=NLFJ                                                DCODAT     70
      LRTEMP=LRTEMP+1                                                   DCODAT     71
      IDATPT(LRTEMP)=JLNA                                               DCODAT     72
C                                                                       DCODAT     73
      LDSTAT=0                                                          DCODAT     74
      NPROG=MNEW(NLFI)                                                  DCODAT     75
      IF(JBSTAT(NPROG).GT.2)LDSTAT=10                                   DCODAT     76
      IF(LDSTAT.EQ.0)THEN                                               DCODAT     77
      NPROG=MNEW(NLFJ)                                                  DCODAT     78
      IF(JBSTAT(NPROG).GT.2)LDSTAT=10                                   DCODAT     79
      ENDIF                                                             DCODAT     80
      IADATA(JLNA+1)=LDSTAT                                             DCODAT     81
      IADATA(JLNA+2)=NLFI                                               DCODAT     82
      IADATA(JLNA+3)=NLFJ                                               DCODAT     83
      CALL PACK(CID2,0,ICID)                                            DCODAT     84
      IADATA(JLNA+4)=ICID                                               DCODAT     85
      IADATA(JLNA+5)=IFLAG                                              DCODAT     86
      IADATA(JLNA+6)=ITYPE                                              DCODAT     87
C                                                                       DCODAT     88
      CALL GETLIN(IU54,CARD)                                            DCODAT     89
      READ(CARD,2050) (ADATA(JLNA+J),J=8,15)                            DCODAT     90
      CALL GETLIN(IU54,CARD)                                            DCODAT     91
      READ(CARD,2050) (ADATA(JLNA+J),J=16,18),(ADATA(JLNA+J),J=20,23)   DCODAT     92
      JSWITC=JLNA+7                                                     DCODAT     93
      JLNA=JLNA+36                                                      DCODAT     94
      KSWITC=0                                                          DCODAT     95
C                                                                       DCODAT     96
C    READ IN THE REMOTE RELAYS                                          DCODAT     97
C                                                                       DCODAT     98
 150  CALL GETLIN(IU54,CARD)                                            DCODAT     99
      IF(CARD(1:3).EQ.ESC)THEN                                          DCODAT    100
         IADATA(JSWITC)=KSWITC                                          DCODAT    101
      ELSE                                                              DCODAT    102
         IF(CARD(1:3).EQ.MPI) CALL GETLIN(IU54,CARD1)                   DCODAT    103
         CALL SWIDAT(CARD,CARD1,KSWITC,IEBK)                            DCODAT    104
         GOTO 150                                                       DCODAT    105
      ENDIF                                                             DCODAT    106
      GOTO 110                                                          DCODAT    107
C                                                                       DCODAT    108
 200  IEBK=1                                                            DCODAT    109
      MSG(2)=CARD1                                                      DCODAT    110
      CALL PRTMSG(2)                                                    DCODAT    111
      KSWITC=0                                                          DCODAT    112
 115  CALL GETLIN(IU54,CARD)                                            DCODAT    113
      IF(CARD(1:3).EQ.ESC) GOTO 110                                     DCODAT    114
      GOTO 115                                                          DCODAT    115
C                                                                       DCODAT    116
 300  CONTINUE                                                          DCODAT    117
      IF(LRTEMP.NE.LDCOSR)THEN                                          DCODAT    118
         LDCOSR=LDCOSR+1                                                DCODAT    119
         NDCOSR=LRTEMP                                                  DCODAT    120
      ELSE                                                              DCODAT    121
         LDCOSR=0                                                       DCODAT    122
         NDCOSR=0                                                       DCODAT    123
      ENDIF                                                             DCODAT    124
C                                                                       DCODAT    125
      RETURN                                                            DCODAT    126
C                                                                       DCODAT    127
 2020 FORMAT(2A12,A2,3X,3I5)                                            DCODAT    128
 2010 FORMAT(2I5,A2,3X,3I5)                                             DCODAT    129
 2030 FORMAT(' *** ERROR  DOUBLE CIRCLES OR LENS RELAY TRIPPING BUS',   DCODAT    130
     &' NOT FOUND.')                                                    DCODAT    131
 2040 FORMAT(' *** ERROR   RELAY SCHEME EXCEEDS THE LIMIT OF ',I3)      DCODAT    132
 2050 FORMAT(8F10.5)                                                    DCODAT    133
C                                                                       DCODAT    134
      END                                                               DCODAT    135
