CFPRIME INE6                                                            INE6        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 INE6                                                   INE6        3
CD                                                                      INE6        4
CD    TO PERFORM INITIALIZATION AND DATA CHECK FOR EXCITER TYPE 6.      INE6        5
CD                                                                      INE6        6
CD    THE DATA STRUCTURE AFTER THE INITIALIZATION IS GIVEN BELOW.       INE6        7
CD                                                                      INE6        8
CD   3.5 Exciter type 6                                                 INE6        9
CD                                                                      INE6       10
CD     Exciter data                                                     INE6       11
CD                                                                      INE6       12
CD     IDDAT(JE+ 1)   = IVTN         : sensing bus number               INE6       13
CD     DDAT(JE+ 2)    = KA                                              INE6       14
CD     DDAT(JE+ 3)    = TA                                              INE6       15
CD     DDAT(JE+ 4)    = KE                                              INE6       16
CD     DDAT(JE+ 5)    = TE                                              INE6       17
CD     DDAT(JE+ 6)    = SE(VSAT) or AEX                                 INE6       18
CD     DDAT(JE+ 7)    = SE(0.75VSAT) or BEX                             INE6       19
CD     DDAT(JE+ 8)    = VSAT                                            INE6       20
CD     DDAT(JE+ 9)    = KC                                              INE6       21
CD     DDAT(JE+10)    = KF                                              INE6       22
CD     DDAT(JE+11)    = TF                                              INE6       23
CD     DDAT(JE+12)    = TC                                              INE6       24
CD     DDAT(JE+13)    = TB                                              INE6       25
CD     DDAT(JE+14)    = VAMAX                                           INE6       26
CD     DDAT(JE+15)    = VAMIN                                           INE6       27
CD     DDAT(JE+16)    = VRMAX                                           INE6       28
CD     DDAT(JE+17)    = VRMIN                                           INE6       29
CD     DDAT(JE+18)    = TR                                              INE6       30
CD     DDAT(JE+19)    = RC                                              INE6       31
CD     DDAT(JE+20)    = XC                                              INE6       32
CD     DDAT(JE+21)    = XDE                                             INE6       33
CD     DDAT(JE+22)    = X'DE                                            INE6       34
CD     DDAT(JE+23)    = KB                                              INE6       35
CD     DDAT(JE+24)    = KH                                              INE6       36
CD     DDAT(JE+25)    = KL                                              INE6       37
CD     DDAT(JE+26)    = VLNT                                            INE6       38
CD     DDAT(JE+27)    = VFEMAX                                          INE6       39
CD                                                                      INE6       40
CD     Exciter states                                                   INE6       41
CD                                                                      INE6       42
CD     XSTATE(JES+1)  = TR block     : compulsory                       INE6       43
CD     XSTATE(JES+2)  = TF block     : compulsory                       INE6       44
CD     XSTATE(JES+3)  = TB block     : compulsory                       INE6       45
CD     XSTATE(JES+4)  = TA block     : compulsory                       INE6       46
CD     XSTATE(JES+5)  = TE block     : compulsory                       INE6       47
CD                                                                      INE6       48
CD     Exciter Y-variables                                              INE6       49
CD                                                                      INE6       50
CD     VREG(JYE+1)    = VC (input to the TR block)                      INE6       51
CD     VREF(JYE+2)    = reference value                                 INE6       52
CD                                                                      INE6       53
      INCLUDE 'PARX.INS'                                                INE6       54
      INCLUDE 'CNMDAT.INS'                                              INE6       55
      INCLUDE 'CNSTN.INS'                                               INE6       56
      INCLUDE 'CNB1.INS'                                                INE6       57
      INCLUDE 'CNB4.INS'                                                INE6       58
      INCLUDE 'CNMSTA.INS'                                              INE6       59
      INCLUDE 'CNXSTA.INS'                                              INE6       60
      INCLUDE 'CNB8.INS'                                                INE6       61
      INCLUDE 'CNEXC.INS'                                               INE6       62
      INCLUDE 'CNMYVA.INS'                                              INE6       63
      INCLUDE 'CNYVAR.INS'                                              INE6       64
      INCLUDE 'CNFLAG.INS'                                              INE6       65
      INCLUDE 'CNUNIT.INS'                                              INE6       66
      INCLUDE 'CNMSG.INS'                                               INE6       67
      INCLUDE 'CNXDOT.INS'                                              INE6       68
C                                                                       INE6       69
      DATA BIG/99.9/                                                    INE6       70
C                                                                       INE6       71
C  IEX=6                                                                INE6       72
C                                                                       INE6       73
      LDEB=(JDEB(72).NE.0)                                              INE6       74
C                                                                       INE6       75
C  INPUT TIME CONSTANTS CHECK AND RESET                                 INE6       76
C                                                                       INE6       77
      IF(DDAT(JE+3).LT.TMIN.AND.IDDAT(JE+3).NE.0)THEN                   INE6       78
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE6       79
     *            ,NDGC(N)                                              INE6       80
         WRITE(MSG(2),9020)                                             INE6       81
         IF(MTFLAG.EQ.0) THEN                                           INE6       82
            WRITE(MSG(3),9030) 'TA',DDAT(JE+3),TMIN                     INE6       83
         ELSE                                                           INE6       84
            WRITE(MSG(3),9030) 'TA',DDAT(JE+3),TMIN,'TA',0.0            INE6       85
            DDAT(JE+3)=0.0                                              INE6       86
         ENDIF                                                          INE6       87
         CALL PRTMSG(3)                                                 INE6       88
      ENDIF                                                             INE6       89
C                                                                       INE6       90
      IF (DDAT(JE+5).LE.0.0) THEN                                       INE6       91
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE6       92
     *                     ,NDGC(N)                                     INE6       93
         WRITE(MSG(2),9020)                                             INE6       94
         WRITE(MSG(3),9050) DDAT(JE+5)                                  INE6       95
         CALL PRTMSG(3)                                                 INE6       96
         CALL ASTOP('INE6: FATAL ERROR',17)                             INE6       97
      ELSE IF (DDAT(JE+5).LT.10.0*TMIN) THEN                            INE6       98
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE6       99
     *            ,NDGC(N)                                              INE6      100
         WRITE(MSG(2),9020)                                             INE6      101
         IF(MTFLAG.EQ.0) THEN                                           INE6      102
            WRITE(MSG(3),9030) 'TE',DDAT(JE+5),10.0*TMIN                INE6      103
         ELSE                                                           INE6      104
            WRITE(MSG(3),9030) 'TE',DDAT(JE+5),10.0*TMIN,'TE',10.0*TMIN INE6      105
            DDAT(JE+5)=10.0*TMIN                                        INE6      106
         ENDIF                                                          INE6      107
         CALL PRTMSG(3)                                                 INE6      108
      END IF                                                            INE6      109
C                                                                       INE6      110
      IF(DDAT(JE+11).LT.TMIN.AND.IDDAT(JE+11).NE.0)THEN                 INE6      111
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE6      112
     *            ,NDGC(N)                                              INE6      113
         WRITE(MSG(2),9020)                                             INE6      114
         IF(MTFLAG.EQ.0) THEN                                           INE6      115
            WRITE(MSG(3),9030) 'TF',DDAT(JE+11),TMIN                    INE6      116
         ELSE                                                           INE6      117
            WRITE(MSG(3),9030) 'TF',DDAT(JE+11),TMIN,'TF',0.0           INE6      118
            DDAT(JE+11)=0.0                                             INE6      119
         ENDIF                                                          INE6      120
         CALL PRTMSG(3)                                                 INE6      121
      ENDIF                                                             INE6      122
C                                                                       INE6      123
      IF(DDAT(JE+13).LT.TMIN.AND.IDDAT(JE+13).NE.0)THEN                 INE6      124
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE6      125
     *            ,NDGC(N)                                              INE6      126
         WRITE(MSG(2),9020)                                             INE6      127
         IF(MTFLAG.EQ.0) THEN                                           INE6      128
            WRITE(MSG(3),9030) 'TB',DDAT(JE+13),TMIN                    INE6      129
         ELSE                                                           INE6      130
            WRITE(MSG(3),9030) 'TB',DDAT(JE+13),TMIN,'TB',0.0           INE6      131
            DDAT(JE+13)=0.0                                             INE6      132
         ENDIF                                                          INE6      133
         CALL PRTMSG(3)                                                 INE6      134
      ENDIF                                                             INE6      135
C                                                                       INE6      136
      IF(DDAT(JE+18).LT.TMIN.AND.IDDAT(JE+18).NE.0)THEN                 INE6      137
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE6      138
     *            ,NDGC(N)                                              INE6      139
         WRITE(MSG(2),9020)                                             INE6      140
         IF(MTFLAG.EQ.0) THEN                                           INE6      141
            WRITE(MSG(3),9030) 'TR',DDAT(JE+18),TMIN                    INE6      142
         ELSE                                                           INE6      143
            WRITE(MSG(3),9030) 'TR',DDAT(JE+18),TMIN,'TR',0.0           INE6      144
            DDAT(JE+18)=0.0                                             INE6      145
         ENDIF                                                          INE6      146
         CALL PRTMSG(3)                                                 INE6      147
      ENDIF                                                             INE6      148
C                                                                       INE6      149
C  DATA PREPARATION AND INPUT DATA OUTPUT                               INE6      150
C                                                                       INE6      151
      IF (IDDAT(JE+27).EQ.0) DDAT(JE+27)=BIG                            INE6      152
      IF (IDDAT(JE+14).EQ.0.AND.IDDAT(JE+15).EQ.0) THEN                 INE6      153
         DDAT(JE+14)=BIG                                                INE6      154
         DDAT(JE+15)=-BIG                                               INE6      155
      ENDIF                                                             INE6      156
      IF (IDDAT(JE+16).EQ.0.AND.IDDAT(JE+17).EQ.0) THEN                 INE6      157
         DDAT(JE+16)=BIG                                                INE6      158
         DDAT(JE+17)=-BIG                                               INE6      159
      ENDIF                                                             INE6      160
      IF(IDDAT(JE+8).NE.0)CALL EXSATF                                   INE6      161
      IF(LDEB) WRITE(IUD6,7400)(DDAT(JE+L),L=1,27)                      INE6      162
C  RECTIFIER REGULATION                                                 INE6      163
C                                                                       INE6      164
      IF (IDDAT(JE+9).EQ.0)THEN                                         INE6      165
C                                                                       INE6      166
C   KC=0                                                                INE6      167
C                                                                       INE6      168
      VTH=EFDN                                                          INE6      169
C                                                                       INE6      170
C   KC NE 0                                                             INE6      171
C                                                                       INE6      172
      ELSE                                                              INE6      173
      CFKC=CFDN*DDAT(JE+9)                                              INE6      174
      VTH=EFDN+0.577*CFKC                                               INE6      175
      FACT=CFKC/VTH                                                     INE6      176
      IF (FACT.LT.0.433) GO TO 90                                       INE6      177
      VTH=EFDN/1.732+CFKC                                               INE6      178
      FACT=CFKC/VTH                                                     INE6      179
      IF (FACT.GT.0.75) GO TO 90                                        INE6      180
      VTH=(EFDN*EFDN+CFKC*CFKC)/0.75                                    INE6      181
      VTH=SQRT(VTH)                                                     INE6      182
      FACT=CFKC/VTH                                                     INE6      183
      IF (FACT.LE.0.75.AND.FACT.GE.0.433) GO TO 90                      INE6      184
      WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)          INE6      185
     *                  ,NDGC(N)                                        INE6      186
      WRITE(MSG(2),9010)                                                INE6      187
      CALL PRTMSG(2)                                                    INE6      188
      IEEXIN=1                                                          INE6      189
C                                                                       INE6      190
C    ENDIF KC.NE.0                                                      INE6      191
C                                                                       INE6      192
      ENDIF                                                             INE6      193
C                                                                       INE6      194
 90   VE=VTH+EFDN*DDAT(JE+22)                                           INE6      195
C                                                                       INE6      196
C   EXCITER SATURATION BLOCK                                            INE6      197
C                                                                       INE6      198
      SE=DDAT(JE+6)*EXP(DDAT(JE+7)*VE)/VE                               INE6      199
      SEKX=VE*(SE+DDAT(JE+4))                                           INE6      200
      VEMAX=(DDAT(JE+27)-(DDAT(JE+21)-DDAT(JE+22))*CFDN)*VE/SEKX        INE6      201
      SEKX=SEKX+EFDN*(DDAT(JE+21)-DDAT(JE+22))                          INE6      202
      XSTATE(JSTATE+2)=SEKX                                             INE6      203
C                                                                       INE6      204
      VR=SEKX                                                           INE6      205
C                                                                       INE6      206
      V3=DDAT(JE+24)*SEKX+VR/DDAT(JE+23)                                INE6      207
      XSTATE(JSTATE+3)=V3/DDAT(JE+2)                                    INE6      208
      XSTATE(JSTATE+4)=V3                                               INE6      209
C                                                                       INE6      210
      XDFACT(JSTATE+4)=DDAT(JE+2)                                       INE6      211
C                                                                       INE6      212
      XSTATE(JSTATE+5)=VE                                               INE6      213
C                                                                       INE6      214
      VREF(JYE+2)=XSTATE(JSTATE+1)+XSTATE(JSTATE+3)                     INE6      215
C                                                                       INE6      216
C     IDDAT(JE+28) SET TO DEFAULT VALUE                                 INE6      217
C                                                                       INE6      218
      IDDAT(JE+28)=1                                                    INE6      219
C                                                                       INE6      220
      IF(LDEB)THEN                                                      INE6      221
         WRITE(IUD6,7400)(DDAT(JE+L),L=1,27)                            INE6      222
         WRITE(IUD6,7600)(XSTATE(JSTATE+L),L=1,5)                       INE6      223
      ENDIF                                                             INE6      224
      JSTATE=JSTATE+5                                                   INE6      225
      JY=JY+2                                                           INE6      226
C                                                                       INE6      227
C     DETERMINE IF A SUBDIVISION OF THE NORMAL INTEGRATION STEP         INE6      228
C     SHOULD BE USED. IF SO, CALCULATE THE LARGEST STEP SIZE PERMITTED  INE6      229
C                                                                       INE6      230
      IF (IDDAT(JE+10).NE.0.AND.IDDAT(JE+11).NE.0) THEN                 INE6      231
         IDDAT(JE+29)=1                                                 INE6      232
         DDAT(JE+30)=DDAT(JE+11)*DDAT(JE+5)                             INE6      233
     *               /(DDAT(JE+10)*DDAT(JE+2)*DDAT(JE+23))              INE6      234
         IF (IDDAT(JE+13).NE.0) THEN                                    INE6      235
            DDAT(JE+30)=DDAT(JE+30)*DDAT(JE+13)                         INE6      236
            IF (IDDAT(JE+12).NE.0) DDAT(JE+30)=DDAT(JE+30)              INE6      237
     *                                         /(1.0+DDAT(JE+12))       INE6      238
         END IF                                                         INE6      239
         IF (IDDAT(JE+3).NE.0) DDAT(JE+30)=DDAT(JE+30)*DDAT(JE+3)       INE6      240
         IF (DDAT(JE+30).LT.DTMIN) DDAT(JE+30)=DTMIN                    INE6      241
      ELSE                                                              INE6      242
         IDDAT(JE+29)=0                                                 INE6      243
      END IF                                                            INE6      244
C                                                                       INE6      245
      IF (VR.GT.DDAT(JE+16).OR.VR.LT.DDAT(JE+17))THEN                   INE6      246
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE6      247
     *                     ,NDGC(N)                                     INE6      248
         WRITE(MSG(2),9020)                                             INE6      249
         WRITE(MSG(3),9100)                                             INE6      250
         WRITE(MSG(4),9110) VR,DDAT(JE+16),DDAT(JE+17)                  INE6      251
         CALL PRTMSG(4)                                                 INE6      252
      ENDIF                                                             INE6      253
      IF(V3.GT.DDAT(JE+14).OR.V3.LT.DDAT(JE+15))THEN                    INE6      254
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE6      255
     *                     ,NDGC(N)                                     INE6      256
         WRITE(MSG(2),9020)                                             INE6      257
         WRITE(MSG(3),9200)                                             INE6      258
         WRITE(MSG(4),9210) V3,DDAT(JE+14),DDAT(JE+15)                  INE6      259
         CALL PRTMSG(4)                                                 INE6      260
      ENDIF                                                             INE6      261
      IF(VE.GT.VEMAX.OR.VE.LT.0.0)THEN                                  INE6      262
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE6      263
     *                     ,NDGC(N)                                     INE6      264
         WRITE(MSG(2),9020)                                             INE6      265
         WRITE(MSG(3),9300)                                             INE6      266
         WRITE(MSG(4),9310) VE,VEMAX,0.                                 INE6      267
         CALL PRTMSG(4)                                                 INE6      268
      ENDIF                                                             INE6      269
C                                                                       INE6      270
      RETURN                                                            INE6      271
C                                                                       INE6      272
 9000 FORMAT(' *** WARNING GENERATOR AT BUS: ',I5,' STATION: ',3A4      INE6      273
     *,' GID:',A4)                                                      INE6      274
 9010 FORMAT(5X,'TYPE 6 EXCITER (WSCC TYPE FF, IEEE TYPE AC2A) FEX'     INE6      275
     *,' FUNCTION OUT OF RANGE')                                        INE6      276
 7400 FORMAT(1X,'DB*INE6_NEW:DDAT1-27 ',/,(10X,10G12.5))                INE6      277
 7600 FORMAT(1X,'DB*INE6_NEW:XSTATE1-5 ',6G12.5)                        INE6      278
 9020 FORMAT(5X,'TYPE 6 EXCITER (WSCC TYPE FF, IEEE TYPE AC2A)')        INE6      279
 9030 FORMAT(5X,A,'=',F8.6,' IS BELOW THE LIMIT VALUE OF',F5.2,:,2X,A   INE6      280
     *,' HAS BEEN SET TO',F5.2)                                         INE6      281
 9050 FORMAT(5X,'TE=',F8.6,' IS LESS THAN OR EQUAL TO ZERO.')           INE6      282
 9100 FORMAT(5X,'VR-OUTPUT OF HVG VIOLATES LIMITS:')                    INE6      283
 9110 FORMAT(5X,'VR = ',G12.5,' VRMAX = ',G12.5,' VRMIN = ',G12.5)      INE6      284
 9200 FORMAT(5X,'VA-X4 VIOLATES LIMITS:')                               INE6      285
 9210 FORMAT(5X,'VA = ',G12.5,' VAMAX = ',G12.5,' VAMIN = ',G12.5)      INE6      286
 9300 FORMAT(5X,'VE-X5 VIOLATES LIMITS:')                               INE6      287
 9310 FORMAT(5X,'VE = ',G12.5,' VEMAX = ',G12.5,' VEMIN = ',G12.5)      INE6      288
C                                                                       INE6      289
      END                                                               INE6      290
                                                                        INE6      291
