CFPRIME GUFINT                                                          GUFINT      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 GUFINT(IEBK)                                           GUFINT      3
CD                                                                      GUFINT      4
CD     THIS SUBROUTINE INITIALIZES DATA TABLES FOR THE UNDER            GUFINT      5
CD     FREQUENCY GENERATOR DROPPING MODEL.                              GUFINT      6
CD                                                                      GUFINT      7
CD                                                                      GUFINT      8
CD     LGUFRE           Starting position of IDATPT array  of GUFR      GUFINT      9
CD                       relay scheme LGUFRE is in the common labelled  GUFINT     10
CD                       PT of include file CNPT.                       GUFINT     11
CD                                                                      GUFINT     12
CD     NGUFRE            Finishing position of IDATPT array of GUFR     GUFINT     13
CD                       relay scheme NUFRE is in common labelled AUTO  GUFINT     14
CD                       of include file CNAUTO.                        GUFINT     15
CD                                                                      GUFINT     16
CD     let k = k-th GUFR RELAY                                          GUFINT     17
CD                                                                      GUFINT     18
CD     N = IDATPT(k)    IDATPT is the array that stores the start       GUFINT     19
CD                      position of the K-TH GUFR relay scheme data     GUFINT     20
CD                                                                      GUFINT     21
CD                                                                      GUFINT     22
CD ADATA(N+1)=IRMTCD    TRIP CODE 1= NOT TRIPPED, 2= TRIPPED            GUFINT     23
CD                                                                      GUFINT     24
CD ADATA(N+2)=IRMGNO    GENERATOR INDEX NUMBER                          GUFINT     25
CD                                                                      GUFINT     26
CD ADATA(N+3)=IRMBNO    GENERATOR BUS NUMBER                            GUFINT     27
CD                                                                      GUFINT     28
CD ADATA(N+4)=RMGID     GNERATOR ID                                     GUFINT     29
CD                                                                      GUFINT     30
CD IADATA(N+5)=IFLAG    =0 :  CONTROL BOTH LOCAL AND REMOTE             GUFINT     31
CD                      =1 :  CONTROL THE REMOTE ONLY                   GUFINT     32
CD                                                                      GUFINT     33
CD IADATA(N+6)=IDRRR    NO. OF REMOTE RELAY                             GUFINT     34
CD                                                                      GUFINT     35
CD IADATA(N+7)          REMOTE RELAY TRIP FLAG                          GUFINT     36
CD                                                                      GUFINT     37
CD ADATA(N+8)=RMFQ1     FIRST LEVEL TRIP FREQUENCY (DELAYED)            GUFINT     38
CD                                                                      GUFINT     39
CD ADATA(N+9)=RMFQ2     SECOND LEVEL TRIP FREQUENCY (ISTANTANEOUS)      GUFINT     40
CD                                                                      GUFINT     41
CD ADATA(N+10)=RMTRP1   TRIP DELAY FOR FIRST LEVEL TRIP                 GUFINT     42
CD                                                                      GUFINT     43
CD ADATA(N+11)=RMTRP2   BREAKER TIME DELAY                              GUFINT     44
CD                                                                      GUFINT     45
CD ADATA(N+12)=RMRTIM   RELAY TIMER                                     GUFINT     46
CD                                                                      GUFINT     47
CD ADATA(N+13)=RMBTIM   BREAKER TIMER                                   GUFINT     48
CD                                                                      GUFINT     49
CD ADATA(N+14)=RMEYR    REAL COMPONENT OF PRESENT BUS VOLTAGE           GUFINT     50
CD                                                                      GUFINT     51
CD ADATA(N+15)=RMEYI    IMAGINARY COMPONENT OF PRESENT BUS VOLTAGE      GUFINT     52
CD                                                                      GUFINT     53
CD ADATA(N+16)=RMFREQ   PRESENT BUS FREQUENCY                           GUFINT     54
CD                                                                      GUFINT     55
CD                                                                      GUFINT     56
      INCLUDE 'PARX.INS'                                                GUFINT     57
      INCLUDE 'CNIPTR.INS'                                              GUFINT     58
      INCLUDE 'CNB1.INS'                                                GUFINT     59
      INCLUDE 'CNB19.INS'                                               GUFINT     60
      INCLUDE 'CNVOLT.INS'                                              GUFINT     61
      INCLUDE 'CNSTN.INS'                                               GUFINT     62
      INCLUDE 'CNPT.INS'                                                GUFINT     63
      INCLUDE 'CNUNIT.INS'                                              GUFINT     64
      INCLUDE 'CNNNEW.INS'                                              GUFINT     65
      INCLUDE 'CNAUTO.INS'                                              GUFINT     66
      INCLUDE 'CNMSG.INS'                                               GUFINT     67
C                                                                       GUFINT     68
      COMPLEX VOLTK                                                     GUFINT     69
      DIMENSION VOLTX(2)                                                GUFINT     70
      EQUIVALENCE (VOLTK,VOLTX(1)),(VOLTX(1),VREAL),(VOLTX(2),VIMAG)    GUFINT     71
      CHARACTER*2 CID,MCID                                              GUFINT     72
C                                                                       GUFINT     73
      DO 200 L=LGUFRE,NGUFRE                                            GUFINT     74
      K=IDATPT(L)                                                       GUFINT     75
      IF(IADATA(K).NE.0)GOTO 200                                        GUFINT     76
      NLF=IADATA(K+3)                                                   GUFINT     77
      NPROG=NNEW(NLF)                                                   GUFINT     78
      ITFK=IADATA(K+4)                                                  GUFINT     79
      CALL UNPACK (CID, JJJ, ITFK)                                      GUFINT     80
      N3=NPROG*3                                                        GUFINT     81
      VOLTK=VOLT(NPROG)                                                 GUFINT     82
      IADATA(K+3)=NPROG                                                 GUFINT     83
      ADATA(K+14)=VREAL                                                 GUFINT     84
      ADATA(K+15)=VIMAG                                                 GUFINT     85
C                                                                       GUFINT     86
C   MATCH THE GENERATOR ID IF NO MATCH SET GENERATOR TRIPPED AND PRINT MGUFINT     87
C                                                                       GUFINT     88
                                                                        GUFINT     89
      IF(NPROG.GT.IPNODE)THEN                                           GUFINT     90
C                                                                       GUFINT     91
C   CLASSICAL GENERATOR                                                 GUFINT     92
C                                                                       GUFINT     93
      IMACH=NT+NPROG-IPNODE                                             GUFINT     94
      ELSE                                                              GUFINT     95
C                                                                       GUFINT     96
C   DETAILED GENERATOR MATCH GENERATOR ID                               GUFINT     97
C                                                                       GUFINT     98
      IFIN=NTHG(NPROG+1)-1                                              GUFINT     99
      IMACH=NTHG(NPROG)-1                                               GUFINT    100
 120  IMACH=IMACH+1                                                     GUFINT    101
      MCID=NDGC(IMACH)(3:4)                                             GUFINT    102
      CALL LOGEN(UID,MCID,JFOUND)                                       GUFINT    103
      IF(JFOUND.EQ.1)GOTO 140                                           GUFINT    104
      IF(IMACH.LT.IFIN)GOTO 120                                         GUFINT    105
C                                                                       GUFINT    106
C   WRITE ERROR MESSAGE NO SUCH GENERATOR ID                            GUFINT    107
C                                                                       GUFINT    108
      IEBK=1                                                            GUFINT    109
      IADATA(K+1)=2                                                     GUFINT    110
      WRITE(MSG(1),1010) NLF,INAME(N3-2),INAME(N3-1),INAME(N3),CID      GUFINT    111
      MSG(2)=                                                           GUFINT    112
     *'           CHECK YOUR GENERATOR UNDERFREQUENCY RELAY DATA'       GUFINT    113
      CALL PRTMSG(2)                                                    GUFINT    114
      GOTO 200                                                          GUFINT    115
      ENDIF                                                             GUFINT    116
  140 CONTINUE                                                          GUFINT    117
      IADATA(K+1)=0                                                     GUFINT    118
      IADATA(K+2)=IMACH                                                 GUFINT    119
      IDRRR=IADATA(K+6)                                                 GUFINT    120
      IADATA(K+7)=0                                                     GUFINT    121
      ADATA(K+8)=ADATA(K+8)-FQBASE                                      GUFINT    122
      ADATA(K+9)=ADATA(K+9)-FQBASE                                      GUFINT    123
      ADATA(K+13)=0.0                                                   GUFINT    124
      ADATA(K+16)=0.0                                                   GUFINT    125
      ADATA(K+10)=ADATA(K+10)/FQBASE                                    GUFINT    126
      ADATA(K+11)=ADATA(K+11)/FQBASE                                    GUFINT    127
C                                                                       GUFINT    128
C    REMOTE RELAYS                                                      GUFINT    129
C                                                                       GUFINT    130
      IF(IDRRR.NE.0)THEN                                                GUFINT    131
       KADD=K+16                                                        GUFINT    132
       CALL REMINT(KADD,IDRRR)                                          GUFINT    133
      ENDIF                                                             GUFINT    134
C                                                                       GUFINT    135
C                                                                       GUFINT    136
 200  CONTINUE                                                          GUFINT    137
      RETURN                                                            GUFINT    138
C                                                                       GUFINT    139
 1010 FORMAT(' *** ERROR NO GENERATOR AT BUS: ',I5,' STATION: ',3A4     GUFINT    140
     *,' GID: ',A2)                                                     GUFINT    141
C                                                                       GUFINT    142
      END                                                               GUFINT    143
