CFPRIME INGV07                                                          INGV07      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 INGV07                                                 INGV07      3
CD                                                                      INGV07      4
CD    TO PERFORM INITIALIZATION AND DATA CHECK FOR GOVERNOR TYPE 7.     INGV07      5
CD                                                                      INGV07      6
CD    THE DATA STRUCTURE AFTER THE INITIALIZATION IS GIVEN BELOW.       INGV07      7
CD                                                                      INGV07      8
CD   9.5 Prime-mover turbine-governor model type 7                      INGV07      9
CD                                                                      INGV07     10
CD     Governor data                                                    INGV07     11
CD                                                                      INGV07     12
CD     DDAT(JGG+ 1)   = R                                               INGV07     13
CD     DDAT(JGG+ 2)   = T1                                              INGV07     14
CD     DDAT(JGG+ 3)   = T2                                              INGV07     15
CD     DDAT(JGG+ 4)   = T3                                              INGV07     16
CD     DDAT(JGG+ 5)   = PFL                                             INGV07     17
CD     DDAT(JGG+ 6)   = VMIN                                            INGV07     18
CD     DDAT(JGG+ 7)   = DT                                              INGV07     19
CD     DDAT(JGG+ 8)   = T4                                              INGV07     20
CD     DDAT(JGG+ 9)   = KT                                              INGV07     21
CD     DDAT(JGG+10)   = LL                                              INGV07     22
CD                                                                      INGV07     23
CD     Governor states                                                  INGV07     24
CD                                                                      INGV07     25
CD     XSTATE(JPS+ 1) = T1 block                    : compulsory        INGV07     26
CD     XSTATE(JPS+ 2) = T3 block                    : compulsory        INGV07     27
CD     XSTATE(JPS+ 3) = T4 block                    : compulsory        INGV07     28
CD                                                                      INGV07     29
CD     Governor Y-variables                                             INGV07     30
CD                                                                      INGV07     31
CD     XLDREF(JYP+1)  = load reference signal                           INGV07     32
CD                                                                      INGV07     33
      INCLUDE 'PARX.INS'                                                INGV07     34
      INCLUDE 'CNB1.INS'                                                INGV07     35
      INCLUDE 'CNB3.INS'                                                INGV07     36
      INCLUDE 'CNB4.INS'                                                INGV07     37
      INCLUDE 'CNB8.INS'                                                INGV07     38
      INCLUDE 'CNB10.INS'                                               INGV07     39
      INCLUDE 'CNB19.INS'                                               INGV07     40
      INCLUDE 'CNPARX.INS'                                              INGV07     41
      INCLUDE 'CNXSTA.INS'                                              INGV07     42
      INCLUDE 'CNMDAT.INS'                                              INGV07     43
      INCLUDE 'CNMSTA.INS'                                              INGV07     44
      INCLUDE 'CNEXC.INS'                                               INGV07     45
      INCLUDE 'CNSTN.INS'                                               INGV07     46
      INCLUDE 'CNMYVA.INS'                                              INGV07     47
      INCLUDE 'CNYVAR.INS'                                              INGV07     48
      INCLUDE 'CNUNIT.INS'                                              INGV07     49
      INCLUDE 'CNPRGV.INS'                                              INGV07     50
      INCLUDE 'CNMSG.INS'                                               INGV07     51
C                                                                       INGV07     52
C   TYPE 7                                                              INGV07     53
C                                                                       INGV07     54
C                                                                       INGV07     55
C  INPUT TIME CONSTANTS CHECK AND RESET                                 INGV07     56
C                                                                       INGV07     57
      IF(DDAT(JGG+2).LT.TMIN)THEN                                       INGV07     58
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),                INGV07     59
     *    INAME(KN),NDGC(N)                                             INGV07     60
         WRITE(MSG(2),9030) 'T1',DDAT(JGG+2),TMIN                       INGV07     61
         IF(MTFLAG.EQ.0) THEN                                           INGV07     62
            CALL PRTMSG(2)                                              INGV07     63
         ELSE                                                           INGV07     64
            WRITE(MSG(3),9040) 'T1',TMIN                                INGV07     65
            CALL PRTMSG(3)                                              INGV07     66
            DDAT(JGG+2)=TMIN                                            INGV07     67
         ENDIF                                                          INGV07     68
      ENDIF                                                             INGV07     69
C                                                                       INGV07     70
      IF(DDAT(JGG+4).LT.TMIN.AND.IDDAT(JGG+4).NE.0)THEN                 INGV07     71
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),                INGV07     72
     *    INAME(KN),NDGC(N)                                             INGV07     73
         WRITE(MSG(2),9030) 'T3',DDAT(JGG+4),TMIN                       INGV07     74
         IF(MTFLAG.EQ.0) THEN                                           INGV07     75
            CALL PRTMSG(2)                                              INGV07     76
         ELSE                                                           INGV07     77
            WRITE(MSG(3),9040) 'T3',0.                                  INGV07     78
            CALL PRTMSG(3)                                              INGV07     79
            DDAT(JGG+4)=0.0                                             INGV07     80
         ENDIF                                                          INGV07     81
      ENDIF                                                             INGV07     82
C                                                                       INGV07     83
      IF(DDAT(JGG+8).LT.TMIN.AND.IDDAT(JGG+8).NE.0)THEN                 INGV07     84
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),                INGV07     85
     *    INAME(KN),NDGC(N)                                             INGV07     86
         WRITE(MSG(2),9030) 'T4',DDAT(JGG+8),TMIN                       INGV07     87
         IF(MTFLAG.EQ.0) THEN                                           INGV07     88
            CALL PRTMSG(2)                                              INGV07     89
         ELSE                                                           INGV07     90
            WRITE(MSG(3),9040) 'T4',0.                                  INGV07     91
            CALL PRTMSG(3)                                              INGV07     92
            DDAT(JGG+8)=0.0                                             INGV07     93
         ENDIF                                                          INGV07     94
      ENDIF                                                             INGV07     95
C                                                                       INGV07     96
      BASPRN=DDAT(JG+3)/BASPC                                           INGV07     97
      DDAT(JGG+5)=DDAT(JGG+5)*BASPRN                                    INGV07     98
      NXS=3                                                             INGV07     99
C                                                                       INGV07    100
C   STATE AND REFERENCE SIGNAL INITIALIZATION                           INGV07    101
C                                                                       INGV07    102
      XSTATE(JSTATE+1)=TIN(JYG+1)/DDAT(JGG+5)                           INGV07    103
      XSTATE(JSTATE+2)=XSTATE(JSTATE+1)                                 INGV07    104
      XSTATE(JSTATE+3)=XSTATE(JSTATE+1)                                 INGV07    105
C                                                                       INGV07    106
      XLDREF(JYP+1)=XSTATE(JSTATE+1)                                    INGV07    107
C                                                                       INGV07    108
C                                                                       INGV07    109
      IF (XSTATE(JSTATE+1).GT.1.0) THEN                                 INGV07    110
         KX=1                                                           INGV07    111
         XMAX=1.0                                                       INGV07    112
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),                INGV07    113
     *    INAME(KN),NDGC(N)                                             INGV07    114
         WRITE(MSG(2),9010)                                             INGV07    115
         WRITE(MSG(3),9020) KX,XSTATE(JSTATE+KX),XMAX                   INGV07    116
         CALL PRTMSG(3)                                                 INGV07    117
      ENDIF                                                             INGV07    118
      IF (XSTATE(JSTATE+1).LT.DDAT(JGG+6)) THEN                         INGV07    119
         KX=1                                                           INGV07    120
         XMIN=DDAT(JGG+6)                                               INGV07    121
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),                INGV07    122
     *    INAME(KN),NDGC(N)                                             INGV07    123
         WRITE(MSG(2),9100)                                             INGV07    124
         WRITE(MSG(3),9020) KX,XSTATE(JSTATE+KX),XMIN                   INGV07    125
         CALL PRTMSG(3)                                                 INGV07    126
      ENDIF                                                             INGV07    127
      SLVG=DDAT(JGG+10)+DDAT(JGG+9)*(DDAT(JGG+10)-XSTATE(JSTATE+3))     INGV07    128
      IF (SLVG.LT.XSTATE(JSTATE+3)) THEN                                INGV07    129
         WRITE(MSG(1),9050) NLF,INAME(KN-2),INAME(KN-1),                INGV07    130
     *    INAME(KN),NDGC(N)                                             INGV07    131
         WRITE(MSG(2),9200) SLVG                                        INGV07    132
         WRITE(MSG(3),9210) XSTATE(JSTATE+3)                            INGV07    133
         CALL PRTMSG(3)                                                 INGV07    134
      ENDIF                                                             INGV07    135
C                                                                       INGV07    136
      IDDAT(JGG+11)=1                                                   INGV07    137
      JSTATE=JSTATE+NXS                                                 INGV07    138
      MSTATE(6,N)=JSTATE                                                INGV07    139
      JY=JY+1                                                           INGV07    140
C                                                                       INGV07    141
      RETURN                                                            INGV07    142
C                                                                       INGV07    143
 9000 FORMAT(' *** WARNING GENERATOR AT BUS: ',I5,' STATION: ',3A4      INGV07    144
     *,' GID:',A4)                                                      INGV07    145
 9010 FORMAT(5X                                                         INGV07    146
     *,'TYPE 7 GOVERNOR INITIAL CONDITION VIOLATES UPPER LIMIT:')       INGV07    147
 9020 FORMAT(5X,'STATE NO =',I3,' STATE =',G12.5,' LIMIT =',G12.5)      INGV07    148
 9030 FORMAT(5X,'TYPE 7 GOVERNOR ',A,'=',F8.6                           INGV07    149
     *,' IS BELOW THE LIMIT VALUE OF ',F4.2)                            INGV07    150
 9040 FORMAT(5X,A,' HAS BEEN SET TO ',F4.2)                             INGV07    151
 9050 FORMAT(' *** ERROR GENERATOR AT BUS: ',I5,' STATION: ',3A4        INGV07    152
     *,' GID:',A4)                                                      INGV07    153
 9100 FORMAT(5X                                                         INGV07    154
     *,'TYPE 7 GOVERNOR INITIAL CONDITION VIOLATES LOWER LIMIT:')       INGV07    155
 9200 FORMAT(5X,'TYPE 7 GOVERNOR LVG BIAS SIGNAL ',F7.3,' IS LOWER')    INGV07    156
 9210 FORMAT(5X,'THAN THE POWER REFERENCE ',F7.3,', CHECK YOUR DATA.')  INGV07    157
C                                                                       INGV07    158
      END                                                               INGV07    159
