CFPRIME DPADAT                                                          DPADAT      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
C                                                                       DPADAT      3
      SUBROUTINE DPADAT(IEBK)                                           DPADAT      4
CD                                                                      DPADAT      5
CD   THIS SUBROUTINE READS IN THE POWER ANGLE RELAY DATA                DPADAT      6
CD   FROM A GIVEN FILE.                                                 DPADAT      7
CD                                                                      DPADAT      8
      INCLUDE 'PARX.INS'                                                DPADAT      9
      INCLUDE 'CNPT.INS'                                                DPADAT     10
      INCLUDE 'CNMNEW.INS'                                              DPADAT     11
      INCLUDE 'CNAUTO.INS'                                              DPADAT     12
      INCLUDE 'CNLFDA.INS'                                              DPADAT     13
      INCLUDE 'CNB19.INS'                                               DPADAT     14
      INCLUDE 'CNFLAG.INS'                                              DPADAT     15
      INCLUDE 'CNPARX.INS'                                              DPADAT     16
      INCLUDE 'CNREN.INS'                                               DPADAT     17
      INCLUDE 'CNUNIT.INS'                                              DPADAT     18
      INCLUDE 'CNMSG.INS'                                               DPADAT     19
C                                                                       DPADAT     20
      CHARACTER*80 CARD1,CARD                                           DPADAT     21
      CHARACTER*12 BNAME1,BNAME2,BNAME3,BLANK                           DPADAT     22
      CHARACTER*2 CID2                                                  DPADAT     23
      INTEGER*4 ICID                                                    DPADAT     24
      CHARACTER*5 EDATA                                                 DPADAT     25
      CHARACTER*3 ESC,MPI                                               DPADAT     26
      DATA EDATA/'EDATA'/,BLANK/'           '/,ESC/'ESC'/,MPI/'MPI'/    DPADAT     27
C                                                                       DPADAT     28
      LDEB=.FALSE.                                                      DPADAT     29
C                                                                       DPADAT     30
C     READ POWER ANGLE RELAY DATA CARDS                                 DPADAT     31
C                                                                       DPADAT     32
      LDPDA=LRTEMP                                                      DPADAT     33
  110 CONTINUE                                                          DPADAT     34
      CALL GETLIN(IU54,CARD1)                                           DPADAT     35
      IF(CARD1(1:5).NE.EDATA)THEN                                       DPADAT     36
       IF(KLFO.EQ.0)THEN                                                DPADAT     37
        READ (CARD1,2010) NLFI,NLFJ,CID2,NABUS,IFLAG                    DPADAT     38
        IF(NABUS.EQ.0)NABUS=NLFI                                        DPADAT     39
           IF(NLFI.GT.N99999.OR.NLFJ.GT.N99999.OR.NABUS.GT.N99999)THEN  DPADAT     40
            IEBK=1                                                      DPADAT     41
            WRITE(MSG(1),2060) N99999                                   DPADAT     42
            MSG(2)=CARD1                                                DPADAT     43
            CALL PRTMSG(2)                                              DPADAT     44
 112        CALL GETLIN(IU54,CARD)                                      DPADAT     45
            IF(CARD(1:3).EQ.ESC)THEN                                    DPADAT     46
             GOTO 110                                                   DPADAT     47
             ELSE                                                       DPADAT     48
             GOTO 112                                                   DPADAT     49
            ENDIF                                                       DPADAT     50
           ENDIF                                                        DPADAT     51
           IF(MNEW(NLFI).EQ.0.OR.MNEW(NLFJ).EQ.0                        DPADAT     52
     &        .OR.MNEW(NABUS).EQ.0)THEN                                 DPADAT     53
            IEBK=1                                                      DPADAT     54
            WRITE(MSG(1),2030)                                          DPADAT     55
            MSG(2)=CARD1                                                DPADAT     56
            CALL PRTMSG(2)                                              DPADAT     57
 115        CALL GETLIN(IU54,CARD)                                      DPADAT     58
            IF(CARD(1:3).EQ.ESC)THEN                                    DPADAT     59
             GOTO 110                                                   DPADAT     60
            ELSE                                                        DPADAT     61
             GOTO 115                                                   DPADAT     62
            ENDIF                                                       DPADAT     63
           ENDIF                                                        DPADAT     64
       ELSE                                                             DPADAT     65
        READ (CARD1,2020) BNAME1,BNAME2,CID2,BNAME3,IFLAG               DPADAT     66
        IF(BNAME3.EQ.BLANK)BNAME3=BNAME1                                DPADAT     67
        CALL CHKBUS(BNAME1,NLFI)                                        DPADAT     68
        CALL CHKBUS(BNAME2,NLFJ)                                        DPADAT     69
        CALL CHKBUS(BNAME3,NABUS)                                       DPADAT     70
           IF(NLFI.EQ.0.OR.NLFJ.EQ.0.OR.NABUS.EQ.0)THEN                 DPADAT     71
            IEBK=1                                                      DPADAT     72
            WRITE(MSG(1),2030)                                          DPADAT     73
            MSG(2)=CARD1                                                DPADAT     74
            CALL PRTMSG(2)                                              DPADAT     75
 125        CALL GETLIN(IU54,CARD)                                      DPADAT     76
            IF(CARD(1:3).EQ.ESC)THEN                                    DPADAT     77
             GOTO 110                                                   DPADAT     78
            ELSE                                                        DPADAT     79
             GOTO 125                                                   DPADAT     80
            ENDIF                                                       DPADAT     81
           ENDIF                                                        DPADAT     82
      ENDIF                                                             DPADAT     83
C                                                                       DPADAT     84
C     STORE THE DATA INTO THE PERMANENT ARRAY                           DPADAT     85
C                                                                       DPADAT     86
      IF(NAUT.LT.MAXSET)THEN                                            DPADAT     87
C                                                                       DPADAT     88
       NAUT=NAUT+1                                                      DPADAT     89
C                                                                       DPADAT     90
       NAUTB=NAUTB+3                                                    DPADAT     91
       NAUBUS(NAUTB-2)=NLFI                                             DPADAT     92
       NAUBUS(NAUTB-1)=NLFJ                                             DPADAT     93
       NAUBUS(NAUTB)=NABUS                                              DPADAT     94
       LRTEMP=LRTEMP+1                                                  DPADAT     95
       IDATPT(LRTEMP)=JLNA                                              DPADAT     96
C                                                                       DPADAT     97
       LDSTAT=0                                                         DPADAT     98
       NPROG=MNEW(NLFI)                                                 DPADAT     99
       IF(JBSTAT(NPROG).GT.2)LDSTAT=10                                  DPADAT    100
       IF(LDSTAT.NE.0)THEN                                              DPADAT    101
       NPROG=MNEW(NLFJ)                                                 DPADAT    102
       IF(JBSTAT(NPROG).GT.2)LDSTAT=10                                  DPADAT    103
       ENDIF                                                            DPADAT    104
       IADATA(JLNA+1)=LDSTAT                                            DPADAT    105
C                                                                       DPADAT    106
       IADATA(JLNA+2)=NLFI                                              DPADAT    107
       IADATA(JLNA+3)=NLFJ                                              DPADAT    108
       CALL PACK(CID2,0,ICID)                                           DPADAT    109
       IADATA(JLNA+4)=ICID                                              DPADAT    110
       IADATA(JLNA+5)=NABUS                                             DPADAT    111
       IADATA(JLNA+6)=IFLAG                                             DPADAT    112
C                                                                       DPADAT    113
       CALL GETLIN(IU54,CARD)                                           DPADAT    114
       READ(CARD,2050) ADATA(JLNA+8),ADATA(JLNA+9),ADATA(JLNA+10)       DPADAT    115
     & ,ADATA(JLNA+11),ADATA(JLNA+12)                                   DPADAT    116
C                                                                       DPADAT    117
       CALL GETLIN(IU54,CARD)                                           DPADAT    118
       READ(CARD,2050) ADATA(JLNA+13),ADATA(JLNA+14),ADATA(JLNA+15)     DPADAT    119
     & ,ADATA(JLNA+16),ADATA(JLNA+17),ADATA(JLNA+19),ADATA(JLNA+20)     DPADAT    120
       JSWITC=JLNA+7                                                    DPADAT    121
       JLNA=JLNA+36                                                     DPADAT    122
       KSWITC=0                                                         DPADAT    123
C                                                                       DPADAT    124
C    READ IN THE REMOTE RELAYS                                          DPADAT    125
C                                                                       DPADAT    126
 150  CALL GETLIN(IU54,CARD)                                            DPADAT    127
      IF(CARD(1:3).EQ.ESC)THEN                                          DPADAT    128
       IADATA(JSWITC)=KSWITC                                            DPADAT    129
      ELSE                                                              DPADAT    130
       IF(CARD(1:3).EQ.MPI)THEN                                         DPADAT    131
        CALL GETLIN(IU54,CARD1)                                         DPADAT    132
       ENDIF                                                            DPADAT    133
       CALL SWIDAT(CARD,CARD1,KSWITC,IEBK)                              DPADAT    134
       GOTO 150                                                         DPADAT    135
      ENDIF                                                             DPADAT    136
C                                                                       DPADAT    137
      GOTO 110                                                          DPADAT    138
C                                                                       DPADAT    139
C                                                                       DPADAT    140
      ELSE                                                              DPADAT    141
      WRITE(MSG(1),2040) MAXSET                                         DPADAT    142
      IEBK=1                                                            DPADAT    143
      MSG(2)=CARD1                                                      DPADAT    144
      CALL PRTMSG(2)                                                    DPADAT    145
 135       CALL GETLIN(IU54,CARD)                                       DPADAT    146
           IF(CARD(1:3).EQ.ESC)THEN                                     DPADAT    147
            GOTO 110                                                    DPADAT    148
           ELSE                                                         DPADAT    149
            GOTO 135                                                    DPADAT    150
           ENDIF                                                        DPADAT    151
      ENDIF                                                             DPADAT    152
      ENDIF                                                             DPADAT    153
C                                                                       DPADAT    154
      IF(LRTEMP.NE.LDPDA)THEN                                           DPADAT    155
      LDPDA=LDPDA+1                                                     DPADAT    156
      NDPDA=LRTEMP                                                      DPADAT    157
      ELSE                                                              DPADAT    158
      LDPDA=0                                                           DPADAT    159
      NDPDA=0                                                           DPADAT    160
      ENDIF                                                             DPADAT    161
      RETURN                                                            DPADAT    162
C                                                                       DPADAT    163
C                                                                       DPADAT    164
 2020 FORMAT(2A12,A2,3X,A12,I5)                                         DPADAT    165
 2010 FORMAT(2I5,A2,3X,2I5)                                             DPADAT    166
 2030 FORMAT(' *** ERROR POWER ANGLE RELAY BUS NOT FOUND')              DPADAT    167
 2040 FORMAT(' *** ERROR RELAY SCHEME EXCEEDS THE LIMIT OF ',I3)        DPADAT    168
 2050 FORMAT(8F10.5)                                                    DPADAT    169
 2060 FORMAT(' *** ERROR POWER ANGLE RELAY BUS NUMBER EXCEEDS ',I5)     DPADAT    170
      END                                                               DPADAT    171
