CFPRIME GUFDAT                                                          GUFDAT      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 GUFDAT(IEBK)                                           GUFDAT      3
CD                                                                      GUFDAT      4
CD    TO READ GENERATOR UNDER FREQUENCY RELAY DATA.                     GUFDAT      5
CD                                                                      GUFDAT      6
CD                                                                      GUFDAT      7
CD     LGUFRE           Starting position of IDATPT array  of GUFR      GUFDAT      8
CD                       relay scheme LGUFRE is in the common labelled  GUFDAT      9
CD                       PT of include file CNPT.                       GUFDAT     10
CD                                                                      GUFDAT     11
CD     NGUFRE            Finishing position of IDATPT array of GUFR     GUFDAT     12
CD                       relay scheme NUFRE is in common labelled AUTO  GUFDAT     13
CD                       of include file CNAUTO.                        GUFDAT     14
CD                                                                      GUFDAT     15
CD     let k = k-th GUFR RELAY                                          GUFDAT     16
CD                                                                      GUFDAT     17
CD     N = IDATPT(k)    IDATPT is the array that stores the start       GUFDAT     18
CD                      position of the K-TH GUFR relay scheme data     GUFDAT     19
CD                                                                      GUFDAT     20
CD                                                                      GUFDAT     21
CD ADATA(N+1)=IRMTCD    TRIP CODE 1= NOT TRIPPED, 2= TRIPPED            GUFDAT     22
CD                                                                      GUFDAT     23
CD ADATA(N+2)=IRMGNO    GENERATOR INDEX NUMBER                          GUFDAT     24
CD                                                                      GUFDAT     25
CD ADATA(N+3)=IRMBNO    GENERATOR BUS NUMBER                            GUFDAT     26
CD                                                                      GUFDAT     27
CD ADATA(N+4)=RMGID     GENERATOR ID                                    GUFDAT     28
CD                                                                      GUFDAT     29
CD IADATA(N+5)=IFLAG    =0 :  CONTROL BOTH LOCAL AND REMOTE             GUFDAT     30
CD                      =1 :  CONTROL THE REMOTE ONLY                   GUFDAT     31
CD                                                                      GUFDAT     32
CD IADATA(N+6)=IDRRR    NO. OF REMOTE RELAY                             GUFDAT     33
CD                                                                      GUFDAT     34
CD IADATA(N+7)          REMOTE RELAY TRIP FLAG                          GUFDAT     35
CD                                                                      GUFDAT     36
CD ADATA(N+8)=RMFQ1     FIRST LEVEL TRIP FREQUENCY (DELAYED)            GUFDAT     37
CD                                                                      GUFDAT     38
CD ADATA(N+9)=RMFQ2     SECOND LEVEL TRIP FREQUENCY (ISTANTANEOUS)      GUFDAT     39
CD                                                                      GUFDAT     40
CD ADATA(N+10)=RMTRP1   TRIP DELAY FOR FIRST LEVEL TRIP                 GUFDAT     41
CD                                                                      GUFDAT     42
CD ADATA(N+11)=RMTRP2   BREAKER TIME DELAY                              GUFDAT     43
CD                                                                      GUFDAT     44
CD ADATA(N+12)=RMRTIM   RELAY TIMER                                     GUFDAT     45
CD                                                                      GUFDAT     46
CD ADATA(N+13)=RMBTIM   BREAKER TIMER                                   GUFDAT     47
CD                                                                      GUFDAT     48
CD ADATA(N+14)=RMEYR    REAL COMPONENT OF PRESENT BUS VOLTAGE           GUFDAT     49
CD                                                                      GUFDAT     50
CD ADATA(N+15)=RMEYI    IMAGINARY COMPONENT OF PRESENT BUS VOLTAGE      GUFDAT     51
CD                                                                      GUFDAT     52
CD ADATA(N+16)=RMFREQ   PRESENT BUS FREQUENCY                           GUFDAT     53
CD                                                                      GUFDAT     54
CD                                                                      GUFDAT     55
C                                                                       GUFDAT     56
      INCLUDE 'PARX.INS'                                                GUFDAT     57
      INCLUDE 'CNPT.INS'                                                GUFDAT     58
      INCLUDE 'CNMNEW.INS'                                              GUFDAT     59
      INCLUDE 'CNAUTO.INS'                                              GUFDAT     60
      INCLUDE 'CNLFDA.INS'                                              GUFDAT     61
      INCLUDE 'CNB19.INS'                                               GUFDAT     62
      INCLUDE 'CNFLAG.INS'                                              GUFDAT     63
      INCLUDE 'CNPARX.INS'                                              GUFDAT     64
      INCLUDE 'CNREN.INS'                                               GUFDAT     65
      INCLUDE 'CNUNIT.INS'                                              GUFDAT     66
      INCLUDE 'CNMSG.INS'                                               GUFDAT     67
C                                                                       GUFDAT     68
      CHARACTER*80 CARD,CARD3                                           GUFDAT     69
      CHARACTER*2  CID                                                  GUFDAT     70
      CHARACTER*12 BUSNAM                                               GUFDAT     71
      CHARACTER*5 EDATA                                                 GUFDAT     72
      CHARACTER*3 ESC,MPI                                               GUFDAT     73
C                                                                       GUFDAT     74
      DATA EDATA/'EDATA'/,ESC/'ESC'/,MPI/'MPI'/                         GUFDAT     75
C                                                                       GUFDAT     76
      LDEB=(JDEB(11).NE.0)                                              GUFDAT     77
C                                                                       GUFDAT     78
      LGUFRE=LRTEMP                                                     GUFDAT     79
C                                                                       GUFDAT     80
C  READING GENERATOR UNDERFREQUENCY RELAY DATA                          GUFDAT     81
C                                                                       GUFDAT     82
  110 CONTINUE                                                          GUFDAT     83
      CALL GETLIN(IU54,CARD)                                            GUFDAT     84
      IF(CARD(1:5).NE.EDATA)THEN                                        GUFDAT     85
       IF(KLFO.EQ.0)THEN                                                GUFDAT     86
        READ (CARD,3000) NLF,CID,IFLAG,X1,X2,X3,X4                      GUFDAT     87
           IF(MNEW(NLF).EQ.0)THEN                                       GUFDAT     88
            IEBK=1                                                      GUFDAT     89
            MSG(1)=CARD                                                 GUFDAT     90
            CALL PRTMSG(1)                                              GUFDAT     91
            GOTO 110                                                    GUFDAT     92
           ENDIF                                                        GUFDAT     93
       ELSE                                                             GUFDAT     94
        READ (CARD,3040) BUSNAM,CID,IFLAG,X1,X2,X3,X4                   GUFDAT     95
        CALL CHKBUS(BUSNAM,NLF)                                         GUFDAT     96
           IF(NLF.EQ.0)THEN                                             GUFDAT     97
            IEBK=1                                                      GUFDAT     98
            MSG(1)=CARD                                                 GUFDAT     99
            CALL PRTMSG(1)                                              GUFDAT    100
            GOTO 110                                                    GUFDAT    101
           ENDIF                                                        GUFDAT    102
       ENDIF                                                            GUFDAT    103
C                                                                       GUFDAT    104
C     STORE THE DATA INTO THE PERMANENT ARRAY                           GUFDAT    105
C                                                                       GUFDAT    106
      IF(NAUT.LT.MAXSET)THEN                                            GUFDAT    107
C                                                                       GUFDAT    108
      NPROG=MNEW(NLF)                                                   GUFDAT    109
      IF(JBSTAT(NPROG).GT.2)THEN                                        GUFDAT    110
      LDSTAT=10                                                         GUFDAT    111
      ELSE                                                              GUFDAT    112
      LDSTAT=0                                                          GUFDAT    113
      ENDIF                                                             GUFDAT    114
C                                                                       GUFDAT    115
      NAUT=NAUT+1                                                       GUFDAT    116
C                                                                       GUFDAT    117
      NAUTB=NAUTB+1                                                     GUFDAT    118
      NAUBUS(NAUTB)=NLF                                                 GUFDAT    119
      NGUFRE=NGUFRE+1                                                   GUFDAT    120
      LRTEMP=LRTEMP+1                                                   GUFDAT    121
      IDATPT(LRTEMP)=JLNA                                               GUFDAT    122
      JLNA=JLNA+16                                                      GUFDAT    123
      IADATA(JLNA-15)=LDSTAT                                            GUFDAT    124
      JSWITC=JLNA-10                                                    GUFDAT    125
      IADATA(JLNA-13)=NLF                                               GUFDAT    126
      CALL PACK (CID, 0, ITFK)                                          GUFDAT    127
      IADATA(JLNA-12)=ITFK                                              GUFDAT    128
      IADATA(JLNA-11)=IFLAG                                             GUFDAT    129
      ADATA(JLNA-8)=X1                                                  GUFDAT    130
      ADATA(JLNA-6)=X2                                                  GUFDAT    131
      ADATA(JLNA-7)=X3                                                  GUFDAT    132
      ADATA(JLNA-5)=X4                                                  GUFDAT    133
C                                                                       GUFDAT    134
C    READ IN THE REMOTE RELAYS                                          GUFDAT    135
C                                                                       GUFDAT    136
 150  CALL GETLIN(IU54,CARD)                                            GUFDAT    137
      IF(CARD(1:3).EQ.ESC) GOTO 110                                     GUFDAT    138
      IF(CARD(1:3).EQ.MPI) CALL GETLIN(IU54,CARD3)                      GUFDAT    139
      CALL SWIDAT(CARD,CARD3,KSWITC,IEBK)                               GUFDAT    140
      IADATA(JSWITC)=KSWITC                                             GUFDAT    141
      GOTO 150                                                          GUFDAT    142
C                                                                       GUFDAT    143
      ELSE                                                              GUFDAT    144
      WRITE(MSG(1),3020) MAXSET                                         GUFDAT    145
      MSG(2)=CARD                                                       GUFDAT    146
      CALL PRTMSG(2)                                                    GUFDAT    147
      CALL GETLIN(IU54,CARD)                                            GUFDAT    148
      IEBK=1                                                            GUFDAT    149
      GOTO 110                                                          GUFDAT    150
      ENDIF                                                             GUFDAT    151
      ENDIF                                                             GUFDAT    152
C                                                                       GUFDAT    153
      IF(LRTEMP.NE.LGUFRE)THEN                                          GUFDAT    154
      LGUFRE=LGUFRE+1                                                   GUFDAT    155
      NGUFRE=LRTEMP                                                     GUFDAT    156
      ELSE                                                              GUFDAT    157
      LGUFRE=0                                                          GUFDAT    158
      NGUFRE=0                                                          GUFDAT    159
      ENDIF                                                             GUFDAT    160
C                                                                       GUFDAT    161
      IF(IEBK.EQ.0)RETURN                                               GUFDAT    162
C                                                                       GUFDAT    163
      CARD='GUFDAT: GENERATOR UNDERFREQUENCY RELAY DATA ERROR'          GUFDAT    164
      CALL ASTOP(CARD,49)                                               GUFDAT    165
C                                                                       GUFDAT    166
 3000 FORMAT(I5,1X,A2,I5,4F10.5)                                        GUFDAT    167
 3020 FORMAT(' *** ERROR NO. OF RELAY SCHEME CARDS EXCEEDS ',I5)        GUFDAT    168
 3040 FORMAT(A12,1X,A2,I5,4F10.5)                                       GUFDAT    169
      END                                                               GUFDAT    170
