CFPRIME INE34                                                           INE34       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 INE34                                                  INE34       3
CD                                                                      INE34       4
CD    TO PERFORM INITIALIZATION AND DATA CHECK FOR EXCITER TYPE 34.     INE34       5
CD                                                                      INE34       6
CD    THE DATA STRUCTURE AFTER THE INITIALIZATION IS GIVEN BELOW.       INE34       7
CD                                                                      INE34       8
CD   3.15 Exciter type 34                                               INE34       9
CD                                                                      INE34      10
CD     Exciter data                                                     INE34      11
CD                                                                      INE34      12
CD     IDDAT(JE+ 1)   = IVTN         : sensing bus number               INE34      13
CD     DDAT(JE+ 2)    = KA                                              INE34      14
CD     DDAT(JE+ 3)    = TA                                              INE34      15
CD     DDAT(JE+ 4)    = KF                                              INE34      16
CD     DDAT(JE+ 5)    = TF                                              INE34      17
CD     DDAT(JE+ 6)    = VIMAX                                           INE34      18
CD     DDAT(JE+ 7)    = VIMIN                                           INE34      19
CD     DDAT(JE+ 8)    = TC                                              INE34      20
CD     DDAT(JE+ 9)    = TB                                              INE34      21
CD     DDAT(JE+10)    = TC1                                             INE34      22
CD     DDAT(JE+11)    = TB1                                             INE34      23
CD     DDAT(JE+12)    = VAMAX                                           INE34      24
CD     DDAT(JE+13)    = VAMIN                                           INE34      25
CD     DDAT(JE+14)    = VRMAX                                           INE34      26
CD     DDAT(JE+15)    = VRMIN                                           INE34      27
CD     DDAT(JE+16)    = KC                                              INE34      28
CD     DDAT(JE+17)    = (reserved for future use)                       INE34      29
CD     DDAT(JE+18)    = TR                                              INE34      30
CD     DDAT(JE+19)    = RC                                              INE34      31
CD     DDAT(JE+20)    = XC                                              INE34      32
CD     DDAT(JE+21)    = KLR                                             INE34      33
CD     DDAT(JE+22)    = ILR                                             INE34      34
CD                                                                      INE34      35
CD     Exciter states                                                   INE34      36
CD                                                                      INE34      37
CD     XSTATE(JES+1)  = TR block     : compulsory                       INE34      38
CD     XSTATE(JES+2)  = TA block     : compulsory                       INE34      39
CD     XSTATE(JES+3)  = TF block     : optional                         INE34      40
CD     XSTATE(JES+4)  = TB block     : optional                         INE34      41
CD     XSTATE(JES+5)  = TB1 block    : optional                         INE34      42
CD                                                                      INE34      43
CD     Exciter Y-variables                                              INE34      44
CD                                                                      INE34      45
CD     VREG(JYE+1)    = VC (input to the TR block)                      INE34      46
CD     VREF(JYE+2)    = reference value                                 INE34      47
CD     VRFIN(JYE+3)   = output of the HV gate (exciter EFD)             INE34      48
CD                                                                      INE34      49
      INCLUDE 'PARX.INS'                                                INE34      50
      INCLUDE 'CNMDAT.INS'                                              INE34      51
      INCLUDE 'CNMSTA.INS'                                              INE34      52
      INCLUDE 'CNXSTA.INS'                                              INE34      53
      INCLUDE 'CNEXC.INS'                                               INE34      54
      INCLUDE 'CNMYVA.INS'                                              INE34      55
      INCLUDE 'CNYVAR.INS'                                              INE34      56
      INCLUDE 'CNUNIT.INS'                                              INE34      57
      INCLUDE 'CNFLAG.INS'                                              INE34      58
      INCLUDE 'CNSTN.INS'                                               INE34      59
      INCLUDE 'CNB1.INS'                                                INE34      60
      INCLUDE 'CNB4.INS'                                                INE34      61
      INCLUDE 'CNIMPR.INS'                                              INE34      62
      INCLUDE 'CNMSG.INS'                                               INE34      63
      INCLUDE 'CNXDOT.INS'                                              INE34      64
C                                                                       INE34      65
      DATA BIG/99.9/                                                    INE34      66
C                                                                       INE34      67
      LDEB=(JDEB(71).NE.0)                                              INE34      68
C                                                                       INE34      69
C  IEX=34                                                               INE34      70
C                                                                       INE34      71
C  INPUT TIME CONSTANTS CHECK AND RESET                                 INE34      72
C                                                                       INE34      73
      IF(DDAT(JE+3).LT.TMIN.AND.IDDAT(JE+3).NE.0)THEN                   INE34      74
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE34      75
     *                     ,NDGC(N)                                     INE34      76
         WRITE(MSG(2),9030) 'TA',DDAT(JE+3),TMIN                        INE34      77
         IF(MTFLAG.EQ.0) THEN                                           INE34      78
            CALL PRTMSG(2)                                              INE34      79
         ELSE                                                           INE34      80
         WRITE(MSG(3),9040) 'TA',0.0                                    INE34      81
         CALL PRTMSG(3)                                                 INE34      82
         DDAT(JE+3)=0.0                                                 INE34      83
      ENDIF                                                             INE34      84
      ENDIF                                                             INE34      85
C                                                                       INE34      86
      IF(DDAT(JE+5).LT.TMIN.AND.IDDAT(JE+5).NE.0)THEN                   INE34      87
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE34      88
     *                     ,NDGC(N)                                     INE34      89
         WRITE(MSG(2),9030) 'TF',DDAT(JE+5),TMIN                        INE34      90
         IF(MTFLAG.EQ.0) THEN                                           INE34      91
            CALL PRTMSG(2)                                              INE34      92
         ELSE                                                           INE34      93
         WRITE(MSG(3),9040) 'TF',0.0                                    INE34      94
         CALL PRTMSG(3)                                                 INE34      95
         DDAT(JE+5)=0.0                                                 INE34      96
         ENDIF                                                          INE34      97
      ENDIF                                                             INE34      98
C                                                                       INE34      99
      IF(DDAT(JE+9).LT.TMIN.AND.IDDAT(JE+9).NE.0)THEN                   INE34     100
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE34     101
     *                     ,NDGC(N)                                     INE34     102
         WRITE(MSG(2),9030) 'TB',DDAT(JE+9),TMIN                        INE34     103
         IF(MTFLAG.EQ.0) THEN                                           INE34     104
            CALL PRTMSG(2)                                              INE34     105
         ELSE                                                           INE34     106
         WRITE(MSG(3),9040) 'TB',0.0                                    INE34     107
         CALL PRTMSG(3)                                                 INE34     108
         DDAT(JE+9)=0.0                                                 INE34     109
         ENDIF                                                          INE34     110
      ENDIF                                                             INE34     111
C                                                                       INE34     112
      IF(DDAT(JE+11).LT.TMIN.AND.IDDAT(JE+11).NE.0)THEN                 INE34     113
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE34     114
     *                     ,NDGC(N)                                     INE34     115
         WRITE(MSG(2),9030) 'TB1',DDAT(JE+11),TMIN                      INE34     116
         IF(MTFLAG.EQ.0) THEN                                           INE34     117
            CALL PRTMSG(2)                                              INE34     118
         ELSE                                                           INE34     119
         WRITE(MSG(3),9040) 'TB1',0.0                                   INE34     120
         CALL PRTMSG(3)                                                 INE34     121
         DDAT(JE+11)=0.0                                                INE34     122
         ENDIF                                                          INE34     123
      ENDIF                                                             INE34     124
C                                                                       INE34     125
      IF(DDAT(JE+18).LT.TMIN.AND.IDDAT(JE+18).NE.0)THEN                 INE34     126
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE34     127
     *                     ,NDGC(N)                                     INE34     128
         WRITE(MSG(2),9030) 'TR',DDAT(JE+18),TMIN                       INE34     129
         IF(MTFLAG.EQ.0) THEN                                           INE34     130
            CALL PRTMSG(2)                                              INE34     131
         ELSE                                                           INE34     132
         WRITE(MSG(3),9040) 'TR',0.0                                    INE34     133
         CALL PRTMSG(3)                                                 INE34     134
         DDAT(JE+18)=0.0                                                INE34     135
         ENDIF                                                          INE34     136
      ENDIF                                                             INE34     137
C                                                                       INE34     138
C  DATA PREPARATION AND INPUT DATA PRINTOUT                             INE34     139
C                                                                       INE34     140
      IF (IDDAT(JE+6).EQ.0.AND.IDDAT(JE+7).EQ.0) THEN                   INE34     141
         DDAT(JE+6)=BIG                                                 INE34     142
         DDAT(JE+7)=-BIG                                                INE34     143
      ENDIF                                                             INE34     144
      IF (IDDAT(JE+12).EQ.0.AND.IDDAT(JE+13).EQ.0) THEN                 INE34     145
         DDAT(JE+12)=BIG                                                INE34     146
         DDAT(JE+13)=-BIG                                               INE34     147
      ENDIF                                                             INE34     148
C                                                                       INE34     149
C     IDDAT(JE+26) THROUGH IDDAT(JE+28) ARE USED TO STORE THE           INE34     150
C     OPTIONAL BLOCK INFORMATION. USED IN IMPLICIT METHOD ONLY.         INE34     151
C                                                                       INE34     152
      IDDAT(JE+26)=0                                                    INE34     153
      IDDAT(JE+27)=0                                                    INE34     154
      IDDAT(JE+28)=0                                                    INE34     155
C                                                                       INE34     156
C   LIMITS ON EFD                                                       INE34     157
C                                                                       INE34     158
      VEMAX=DDAT(JE+14)*ET-DDAT(JE+16)*EFDN                             INE34     159
      VEMIN=DDAT(JE+15)*ET                                              INE34     160
C                                                                       INE34     161
C   INITIALZATIONS                                                      INE34     162
C                                                                       INE34     163
      IDDAT(JE+29)=0                                                    INE34     164
      VA=EFDN                                                           INE34     165
      IF (IDDAT(JE+21).NE.0.AND.IDDAT(JE+22).NE.0) THEN                 INE34     166
         V6=(CFDN-DDAT(JE+22))*DDAT(JE+21)                              INE34     167
         IF (V6.LE.0.0) THEN                                            INE34     168
            V6=0.0                                                      INE34     169
         ELSE                                                           INE34     170
            IDDAT(JE+29)=1                                              INE34     171
         END IF                                                         INE34     172
         VA=EFDN+V6                                                     INE34     173
      ENDIF                                                             INE34     174
      VSUM=VA/DDAT(JE+2)                                                INE34     175
C                                                                       INE34     176
      XSTATE(JSTATE+2)=VA                                               INE34     177
C                                                                       INE34     178
      XDFACT(JSTATE+2)=DDAT(JE+2)                                       INE34     179
C                                                                       INE34     180
C     IDDAT(JE+23) = 1 -- NORMAL CASE WITH NON-ZERO TA                  INE34     181
C     IDDAT(JE+23) = 2 -- CASE WITH TA EQUAL TO ZERO                    INE34     182
C                                                                       INE34     183
C     THIS FLAG IS USED IN IMPLICIT METHOD ONLY                         INE34     184
C                                                                       INE34     185
      IF (IDDAT(JE+3).EQ.0) THEN                                        INE34     186
         IDDAT(JE+23)=2                                                 INE34     187
      ELSE                                                              INE34     188
         IDDAT(JE+23)=1                                                 INE34     189
      END IF                                                            INE34     190
C                                                                       INE34     191
      NXS=2                                                             INE34     192
      IF (IDDAT(JE+5).NE.0.AND.IDDAT(JE+4).NE.0) THEN                   INE34     193
         NXS=NXS+1                                                      INE34     194
         XSTATE(JSTATE+NXS)=EFDN                                        INE34     195
         IDDAT(JE+26)=JSTATE+NXS-NSTATE                                 INE34     196
      ENDIF                                                             INE34     197
      IF (IDDAT(JE+9).NE.0) THEN                                        INE34     198
         NXS=NXS+1                                                      INE34     199
         XSTATE(JSTATE+NXS)=VSUM                                        INE34     200
         IDDAT(JE+27)=JSTATE+NXS-NSTATE                                 INE34     201
      ENDIF                                                             INE34     202
      IF (IDDAT(JE+11).NE.0) THEN                                       INE34     203
         NXS=NXS+1                                                      INE34     204
         XSTATE(JSTATE+NXS)=VSUM                                        INE34     205
         IDDAT(JE+28)=JSTATE+NXS-NSTATE                                 INE34     206
      ENDIF                                                             INE34     207
      VREF(JYE+2)=XSTATE(JSTATE+1)+VSUM                                 INE34     208
      VRFIN(JYE+3)=EFDN                                                 INE34     209
C                                                                       INE34     210
C     DETERMINE THE LARGEST TIME STEP PERMITTED                         INE34     211
C                                                                       INE34     212
      TMAX=99.0                                                         INE34     213
      IF (IDDAT(JE+4).NE.0.AND.IDDAT(JE+5).NE.0) THEN                   INE34     214
         IDDAT(JE+24)=1                                                 INE34     215
         TMAX=DDAT(JE+5)/(DDAT(JE+2)*DDAT(JE+4))                        INE34     216
         IF (IDDAT(JE+9).NE.0) THEN                                     INE34     217
            TMAX=TMAX*DDAT(JE+9)                                        INE34     218
            TMAX=TMAX/(1.0+DDAT(JE+8))                                  INE34     219
         END IF                                                         INE34     220
         IF (IDDAT(JE+11).NE.0) THEN                                    INE34     221
            TMAX=TMAX*DDAT(JE+11)                                       INE34     222
            TMAX=TMAX/(1.0+DDAT(JE+10))                                 INE34     223
         END IF                                                         INE34     224
         IF (IDDAT(JE+3).NE.0) TMAX=TMAX*DDAT(JE+3)                     INE34     225
         IF (TMAX.LT.DTMIN) TMAX=DTMIN                                  INE34     226
      ELSE                                                              INE34     227
         IDDAT(JE+24)=0                                                 INE34     228
      END IF                                                            INE34     229
      DDAT(JE+25)=TMAX                                                  INE34     230
C                                                                       INE34     231
C                                                                       INE34     232
      IF (LDEB)THEN                                                     INE34     233
      WRITE(IUD6,1010) (DDAT(JE+L),L=1,22)                              INE34     234
      WRITE(IUD6,1020) (XSTATE(JSTATE+L),L=1,NXS)                       INE34     235
      ENDIF                                                             INE34     236
C                                                                       INE34     237
      JSTATE=JSTATE+NXS                                                 INE34     238
      JY=JY+3                                                           INE34     239
C                                                                       INE34     240
      IF(IDDAT(JE+22).NE.0.AND.IDDAT(JE+21).NE.0)THEN                   INE34     241
         IF (EFDN.GT.DDAT(JE+22)) THEN                                  INE34     242
            WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1)              INE34     243
     &          ,INAME(KN),NDGC(N)                                      INE34     244
            WRITE(MSG(2),9010)                                          INE34     245
            WRITE(MSG(3),9020) EFDN,DDAT(JE+22)                         INE34     246
            CALL PRTMSG(3)                                              INE34     247
         ENDIF                                                          INE34     248
      ELSE                                                              INE34     249
         DDAT(JE+21)=0                                                  INE34     250
         DDAT(JE+22)=0                                                  INE34     251
      ENDIF                                                             INE34     252
C                                                                       INE34     253
      IF (EFDN.GT.VEMAX.OR.EFDN.LT.VEMIN) THEN                          INE34     254
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE34     255
     *                   ,NDGC(N)                                       INE34     256
         WRITE(MSG(2),9100)                                             INE34     257
         WRITE(MSG(3),9110) EFDN,VEMAX,VEMIN                            INE34     258
         CALL PRTMSG(3)                                                 INE34     259
      ENDIF                                                             INE34     260
      IF (VSUM.GT.DDAT(JE+6).OR.VSUM.LT.DDAT(JE+7)) THEN                INE34     261
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE34     262
     *                   ,NDGC(N)                                       INE34     263
         WRITE(MSG(2),9200)                                             INE34     264
         WRITE(MSG(3),9210) VSUM,DDAT(JE+6),DDAT(JE+7)                  INE34     265
         CALL PRTMSG(3)                                                 INE34     266
      ENDIF                                                             INE34     267
      IF(VA.GT.DDAT(JE+12).OR.VA.LT.DDAT(JE+13))THEN                    INE34     268
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE34     269
     *                   ,NDGC(N)                                       INE34     270
         WRITE(MSG(2),9300)                                             INE34     271
         WRITE(MSG(3),9310) VA,DDAT(JE+12),DDAT(JE+13)                  INE34     272
         CALL PRTMSG(3)                                                 INE34     273
      ENDIF                                                             INE34     274
C                                                                       INE34     275
 1010 FORMAT(1X,'INE34-DB:DDAT ',/,(10X,10G12.5))                       INE34     276
 1020 FORMAT(1X,'INE34-DB:XSTATE ',10G12.5)                             INE34     277
 9000 FORMAT(' *** WARNING GENERATOR AT BUS: ',I5,' STATION: ',3A4      INE34     278
     *,' GID:',A4)                                                      INE34     279
 9010 FORMAT(5X,'TYPE 34 EXCITER  IFDN GREATER THAN REF SIGNAL:')       INE34     280
 9020 FORMAT(5X,'IFDN = ',G12.5,' ILR = ',G12.5)                        INE34     281
 9030 FORMAT(5X,'TYPE 34 EXCITER ',A,'=',F8.6                           INE34     282
     *,' IS BELOW THE LIMIT VALUE OF ',F4.2)                            INE34     283
 9040 FORMAT(5X,A,' HAS BEEN SET TO ',F4.2)                             INE34     284
 9100 FORMAT(5X,'TYPE 34 EXCITER  EFDN VIOLATES LIMITS:')               INE34     285
 9110 FORMAT(5X,'EFDN = ',G12.5,' VEMAX = ',G12.5,' VEMIN = ',G12.5)    INE34     286
 9200 FORMAT(5X,'TYPE 34 EXCITER  VSUM VIOLATES LIMITS:')               INE34     287
 9210 FORMAT(5X,'VSUM = ',G12.5,' VIMAX = ',G12.5,' VIMIN = ',G12.5)    INE34     288
 9300 FORMAT(5X,'TYPE 34 EXCITER  VA-X2 VIOLATES LIMITS:')              INE34     289
 9310 FORMAT(5X,'VA = ',G12.5,' VAMAX = ',G12.5,' VAMIN = ',G12.5)      INE34     290
C                                                                       INE34     291
      RETURN                                                            INE34     292
C                                                                       INE34     293
      END                                                               INE34     294
