CFPRIME INE3N5                                                          INE3N5      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 INE3N5                                                 INE3N5      3
CD                                                                      INE3N5      4
CD    TO PERFORM INITIALIZATION AND DATA CHECK FOR EXCITER TYPES 3 AND 5INE3N5      5
CD                                                                      INE3N5      6
CD    THE DATA STRUCTURE AFTER THE INITIALIZATION IS GIVEN BELOW.       INE3N5      7
CD                                                                      INE3N5      8
CD                                                                      INE3N5      9
CD   3.2 Exciter type 3                                                 INE3N5     10
CD                                                                      INE3N5     11
CD     Exciter data                                                     INE3N5     12
CD                                                                      INE3N5     13
CD     IDDAT(JE+ 1)   = IVTN         : sensing bus number               INE3N5     14
CD     DDAT(JE+ 2)    = KA                                              INE3N5     15
CD     DDAT(JE+ 3)    = TA                                              INE3N5     16
CD     DDAT(JE+ 4)    = KE                                              INE3N5     17
CD     DDAT(JE+ 5)    = TE                                              INE3N5     18
CD     DDAT(JE+ 6)    = SE(VSAT) or AEX                                 INE3N5     19
CD     DDAT(JE+ 7)    = SE(0.75VSAT) or BEX                             INE3N5     20
CD     DDAT(JE+ 8)    = VSAT                                            INE3N5     21
CD     DDAT(JE+ 9)    = KC                                              INE3N5     22
CD     DDAT(JE+10)    = KF                                              INE3N5     23
CD     DDAT(JE+11)    = TF                                              INE3N5     24
CD     DDAT(JE+12)    = TC                                              INE3N5     25
CD     DDAT(JE+13)    = TB                                              INE3N5     26
CD     DDAT(JE+14)    = VRMAX                                           INE3N5     27
CD     DDAT(JE+15)    = VRMIN                                           INE3N5     28
CD     DDAT(JE+16)    = VEMIN                                           INE3N5     29
CD     DDAT(JE+17)    = TK                                              INE3N5     30
CD     DDAT(JE+18)    = TR                                              INE3N5     31
CD     DDAT(JE+19)    = RC                                              INE3N5     32
CD     DDAT(JE+20)    = XC                                              INE3N5     33
CD     DDAT(JE+21)    = XDE                                             INE3N5     34
CD     DDAT(JE+22)    = X'DE                                            INE3N5     35
CD     DDAT(JE+23)    = TC1                                             INE3N5     36
CD     DDAT(JE+24)    = TB1                                             INE3N5     37
CD     DDAT(JE+25)    = (reserved for future use)                       INE3N5     38
CD     DDAT(JE+26)    = KETL                                            INE3N5     39
CD     DDAT(JE+27)    = TL1                                             INE3N5     40
CD     DDAT(JE+28)    = TL2                                             INE3N5     41
CD     DDAT(JE+29)    = ETLMT                                           INE3N5     42
CD     DDAT(JE+30)    = VOMX                                            INE3N5     43
CD     DDAT(JE+31)    = K21                                             INE3N5     44
CD     DDAT(JE+32)    = K22                                             INE3N5     45
CD                                                                      INE3N5     46
CD     Exciter states                                                   INE3N5     47
CD                                                                      INE3N5     48
CD     XSTATE(JES+1)  = TR block     : compulsory                       INE3N5     49
CD     XSTATE(JES+2)  = K22 block    : compulsory                       INE3N5     50
CD     XSTATE(JES+3)  = TL2 block    : compulsory                       INE3N5     51
CD     XSTATE(JES+4)  = TF block     : compulsory                       INE3N5     52
CD     XSTATE(JES+5)  = TB block     : compulsory                       INE3N5     53
CD     XSTATE(JES+6)  = TA block     : compulsory                       INE3N5     54
CD     XSTATE(JES+7)  = TE block     : compulsory                       INE3N5     55
CD     XSTATE(JES+8)  = TB1 block    : optional                         INE3N5     56
CD                                                                      INE3N5     57
CD     Exciter Y-variables                                              INE3N5     58
CD                                                                      INE3N5     59
CD     VREG(JYE+1)    = VC (input to the TR block)                      INE3N5     60
CD     VREF(JYE+2)    = reference value                                 INE3N5     61
CD                                                                      INE3N5     62
CD   3.4 Exciter type 5                                                 INE3N5     63
CD                                                                      INE3N5     64
CD     Exciter data                                                     INE3N5     65
CD                                                                      INE3N5     66
CD     IDDAT(JE+ 1)   = IVTN         : sensing bus number               INE3N5     67
CD     DDAT(JE+ 2)    = KA                                              INE3N5     68
CD     DDAT(JE+ 3)    = TA                                              INE3N5     69
CD     DDAT(JE+ 4)    = KE                                              INE3N5     70
CD     DDAT(JE+ 5)    = TE                                              INE3N5     71
CD     DDAT(JE+ 6)    = SE(VSAT) or AEX                                 INE3N5     72
CD     DDAT(JE+ 7)    = SE(0.75VSAT) or BEX                             INE3N5     73
CD     DDAT(JE+ 8)    = VSAT                                            INE3N5     74
CD     DDAT(JE+ 9)    = KC                                              INE3N5     75
CD     DDAT(JE+10)    = KF                                              INE3N5     76
CD     DDAT(JE+11)    = TF                                              INE3N5     77
CD     DDAT(JE+12)    = TC                                              INE3N5     78
CD     DDAT(JE+13)    = TB                                              INE3N5     79
CD     DDAT(JE+14)    = VRMAX                                           INE3N5     80
CD     DDAT(JE+15)    = VRMIN                                           INE3N5     81
CD     DDAT(JE+16)    = VEMIN                                           INE3N5     82
CD     DDAT(JE+17)    = T6                                              INE3N5     83
CD     DDAT(JE+18)    = TR                                              INE3N5     84
CD     DDAT(JE+19)    = RC                                              INE3N5     85
CD     DDAT(JE+20)    = XC                                              INE3N5     86
CD     DDAT(JE+21)    = XDE                                             INE3N5     87
CD     DDAT(JE+22)    = X'DE                                            INE3N5     88
CD     DDAT(JE+23)    = TC2                                             INE3N5     89
CD     DDAT(JE+24)    = TB2                                             INE3N5     90
CD     DDAT(JE+25)    = VAMAX                                           INE3N5     91
CD     DDAT(JE+26)    = KETL                                            INE3N5     92
CD     DDAT(JE+27)    = TL1                                             INE3N5     93
CD     DDAT(JE+28)    = TL2                                             INE3N5     94
CD     DDAT(JE+29)    = ETLMT                                           INE3N5     95
CD     DDAT(JE+30)    = VOMX                                            INE3N5     96
CD     DDAT(JE+31)    = K21                                             INE3N5     97
CD     DDAT(JE+32)    = K22                                             INE3N5     98
CD     DDAT(JE+33)    = VAMIN                                           INE3N5     99
CD                                                                      INE3N5    100
CD                                                                      INE3N5    101
CD     Exciter states                                                   INE3N5    102
CD                                                                      INE3N5    103
CD     XSTATE(JES+1)  = TR block     : compulsory                       INE3N5    104
CD     XSTATE(JES+2)  = K22 block    : compulsory                       INE3N5    105
CD     XSTATE(JES+3)  = TL2 block    : compulsory                       INE3N5    106
CD     XSTATE(JES+4)  = TF block     : compulsory                       INE3N5    107
CD     XSTATE(JES+5)  = TB block     : compulsory                       INE3N5    108
CD     XSTATE(JES+6)  = TA block     : compulsory                       INE3N5    109
CD     XSTATE(JES+7)  = TE block     : compulsory                       INE3N5    110
CD     XSTATE(JES+8)  = TB2 block    : optional                         INE3N5    111
CD                                                                      INE3N5    112
CD     Exciter Y-variables                                              INE3N5    113
CD                                                                      INE3N5    114
CD     VREG(JYE+1)    = VC (input to the TR block)                      INE3N5    115
CD     VREF(JYE+2)    = reference value                                 INE3N5    116
CD                                                                      INE3N5    117
      INCLUDE 'PARX.INS'                                                INE3N5    118
      INCLUDE 'CNMDAT.INS'                                              INE3N5    119
      INCLUDE 'CNSTN.INS'                                               INE3N5    120
      INCLUDE 'CNB1.INS'                                                INE3N5    121
      INCLUDE 'CNB4.INS'                                                INE3N5    122
      INCLUDE 'CNMSTA.INS'                                              INE3N5    123
      INCLUDE 'CNXSTA.INS'                                              INE3N5    124
      INCLUDE 'CNB8.INS'                                                INE3N5    125
      INCLUDE 'CNEXC.INS'                                               INE3N5    126
      INCLUDE 'CNMYVA.INS'                                              INE3N5    127
      INCLUDE 'CNYVAR.INS'                                              INE3N5    128
      INCLUDE 'CNUNIT.INS'                                              INE3N5    129
      INCLUDE 'CNMSG.INS'                                               INE3N5    130
      INCLUDE 'CNXDOT.INS'                                              INE3N5    131
C                                                                       INE3N5    132
C  IEX=3 & 5                                                            INE3N5    133
C                                                                       INE3N5    134
      IF(DDAT(JE+3).LT.TMIN.AND.IDDAT(JE+3).NE.0)THEN                   INE3N5    135
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE3N5    136
     *            ,NDGC(N)                                              INE3N5    137
         IF(IEXN.EQ.3)THEN                                              INE3N5    138
            WRITE(MSG(2),9040)                                          INE3N5    139
         ELSE                                                           INE3N5    140
            WRITE(MSG(2),9041)                                          INE3N5    141
         ENDIF                                                          INE3N5    142
         IF(MTFLAG.EQ.0) THEN                                           INE3N5    143
            WRITE(MSG(3),9050) 'TA',DDAT(JE+3),TMIN                     INE3N5    144
         ELSE                                                           INE3N5    145
            WRITE(MSG(3),9050) 'TA',DDAT(JE+3),TMIN,'TA',0.0            INE3N5    146
            DDAT(JE+3)=0.0                                              INE3N5    147
         ENDIF                                                          INE3N5    148
         CALL PRTMSG(3)                                                 INE3N5    149
      ENDIF                                                             INE3N5    150
C                                                                       INE3N5    151
      IF (DDAT(JE+5).LE.0.0) THEN                                       INE3N5    152
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE3N5    153
     *                     ,NDGC(N)                                     INE3N5    154
         IF(IEXN.EQ.3)THEN                                              INE3N5    155
            WRITE(MSG(2),9040)                                          INE3N5    156
         ELSE                                                           INE3N5    157
            WRITE(MSG(2),9041)                                          INE3N5    158
         ENDIF                                                          INE3N5    159
         WRITE(MSG(3),9220) DDAT(JE+5)                                  INE3N5    160
         CALL PRTMSG(3)                                                 INE3N5    161
         CALL ASTOP('INE3N5: FATAL ERROR',19)                           INE3N5    162
      ELSE IF (DDAT(JE+5).LT.10.0*TMIN) THEN                            INE3N5    163
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE3N5    164
     *            ,NDGC(N)                                              INE3N5    165
         IF(IEXN.EQ.3)THEN                                              INE3N5    166
            WRITE(MSG(2),9040)                                          INE3N5    167
         ELSE                                                           INE3N5    168
            WRITE(MSG(2),9041)                                          INE3N5    169
         ENDIF                                                          INE3N5    170
         IF(MTFLAG.EQ.0) THEN                                           INE3N5    171
            WRITE(MSG(3),9050) 'TE',DDAT(JE+5),10.0*TMIN                INE3N5    172
         ELSE                                                           INE3N5    173
            WRITE(MSG(3),9050) 'TE',DDAT(JE+5),10.0*TMIN,'TE',10.0*TMIN INE3N5    174
            DDAT(JE+5)=10.0*TMIN                                        INE3N5    175
         ENDIF                                                          INE3N5    176
         CALL PRTMSG(3)                                                 INE3N5    177
      END IF                                                            INE3N5    178
C                                                                       INE3N5    179
      IF(DDAT(JE+11).LT.TMIN.AND.IDDAT(JE+11).NE.0)THEN                 INE3N5    180
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE3N5    181
     *            ,NDGC(N)                                              INE3N5    182
         IF(IEXN.EQ.3)THEN                                              INE3N5    183
            WRITE(MSG(2),9040)                                          INE3N5    184
         ELSE                                                           INE3N5    185
            WRITE(MSG(2),9041)                                          INE3N5    186
         ENDIF                                                          INE3N5    187
         IF(MTFLAG.EQ.0) THEN                                           INE3N5    188
            WRITE(MSG(3),9050) 'TF',DDAT(JE+11),TMIN                    INE3N5    189
         ELSE                                                           INE3N5    190
            WRITE(MSG(3),9050) 'TF',DDAT(JE+11),TMIN,'TF',0.0           INE3N5    191
            DDAT(JE+11)=0.0                                             INE3N5    192
         ENDIF                                                          INE3N5    193
         CALL PRTMSG(3)                                                 INE3N5    194
      ENDIF                                                             INE3N5    195
C                                                                       INE3N5    196
      IF(DDAT(JE+13).LT.TMIN.AND.IDDAT(JE+13).NE.0)THEN                 INE3N5    197
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE3N5    198
     *            ,NDGC(N)                                              INE3N5    199
         IF(IEXN.EQ.3)THEN                                              INE3N5    200
            WRITE(MSG(2),9040)                                          INE3N5    201
         ELSE                                                           INE3N5    202
            WRITE(MSG(2),9041)                                          INE3N5    203
         ENDIF                                                          INE3N5    204
         IF(MTFLAG.EQ.0) THEN                                           INE3N5    205
            WRITE(MSG(3),9050) 'TB',DDAT(JE+13),TMIN                    INE3N5    206
         ELSE                                                           INE3N5    207
            WRITE(MSG(3),9050) 'TB',DDAT(JE+13),TMIN,'TB',0.0           INE3N5    208
            DDAT(JE+13)=0.0                                             INE3N5    209
         ENDIF                                                          INE3N5    210
         CALL PRTMSG(3)                                                 INE3N5    211
      ENDIF                                                             INE3N5    212
C                                                                       INE3N5    213
      IF(DDAT(JE+18).LT.TMIN.AND.IDDAT(JE+18).NE.0)THEN                 INE3N5    214
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE3N5    215
     *            ,NDGC(N)                                              INE3N5    216
         IF(IEXN.EQ.3)THEN                                              INE3N5    217
            WRITE(MSG(2),9040)                                          INE3N5    218
         ELSE                                                           INE3N5    219
            WRITE(MSG(2),9041)                                          INE3N5    220
         ENDIF                                                          INE3N5    221
         IF(MTFLAG.EQ.0) THEN                                           INE3N5    222
            WRITE(MSG(3),9050) 'TR',DDAT(JE+18),TMIN                    INE3N5    223
         ELSE                                                           INE3N5    224
            WRITE(MSG(3),9050) 'TR',DDAT(JE+18),TMIN,'TR',0.0           INE3N5    225
            DDAT(JE+18)=0.0                                             INE3N5    226
         ENDIF                                                          INE3N5    227
         CALL PRTMSG(3)                                                 INE3N5    228
      ENDIF                                                             INE3N5    229
C                                                                       INE3N5    230
      IF(DDAT(JE+24).LT.TMIN.AND.IDDAT(JE+24).NE.0)THEN                 INE3N5    231
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE3N5    232
     *            ,NDGC(N)                                              INE3N5    233
         IF(IEXN.EQ.3)THEN                                              INE3N5    234
            WRITE(MSG(2),9040)                                          INE3N5    235
         ELSE                                                           INE3N5    236
            WRITE(MSG(2),9041)                                          INE3N5    237
         ENDIF                                                          INE3N5    238
         IF(MTFLAG.EQ.0) THEN                                           INE3N5    239
            WRITE(MSG(3),9050) 'TB1',DDAT(JE+24),TMIN                   INE3N5    240
         ELSE                                                           INE3N5    241
            WRITE(MSG(3),9050) 'TB1',DDAT(JE+24),TMIN,'TB1',0.0         INE3N5    242
            DDAT(JE+24)=0.0                                             INE3N5    243
         ENDIF                                                          INE3N5    244
         CALL PRTMSG(3)                                                 INE3N5    245
      ENDIF                                                             INE3N5    246
C                                                                       INE3N5    247
      IF(DDAT(JE+28).LT.TMIN.AND.IDDAT(JE+28).NE.0)THEN                 INE3N5    248
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE3N5    249
     *            ,NDGC(N)                                              INE3N5    250
         IF(IEXN.EQ.3)THEN                                              INE3N5    251
            WRITE(MSG(2),9040)                                          INE3N5    252
         ELSE                                                           INE3N5    253
            WRITE(MSG(2),9041)                                          INE3N5    254
         ENDIF                                                          INE3N5    255
         IF(MTFLAG.EQ.0) THEN                                           INE3N5    256
            WRITE(MSG(3),9050) 'TL2',DDAT(JE+28),TMIN                   INE3N5    257
         ELSE                                                           INE3N5    258
            WRITE(MSG(3),9050) 'TL2',DDAT(JE+28),TMIN,'TL2',0.0         INE3N5    259
            DDAT(JE+28)=0.0                                             INE3N5    260
         ENDIF                                                          INE3N5    261
         CALL PRTMSG(3)                                                 INE3N5    262
      ENDIF                                                             INE3N5    263
C                                                                       INE3N5    264
      IF(IDDAT(JE+14).EQ.0.AND.IDDAT(JE+15).EQ.0)THEN                   INE3N5    265
      DDAT(JE+14)=99.0                                                  INE3N5    266
      DDAT(JE+15)=-99.0                                                 INE3N5    267
      ENDIF                                                             INE3N5    268
C                                                                       INE3N5    269
C  DATA PREPARATION AND INPUT DATA PRINTOUT                             INE3N5    270
C                                                                       INE3N5    271
      IF (IDDAT(JE+8).NE.0) CALL EXSATF                                 INE3N5    272
C                                                                       INE3N5    273
      IF (IEXN.EQ.5) THEN                                               INE3N5    274
         IF(IDDAT(JE+25).EQ.0.AND.IDDAT(JE+33).EQ.0) THEN               INE3N5    275
            DDAT(JE+25)=99.0                                            INE3N5    276
            DDAT(JE+33)=-99.0                                           INE3N5    277
         ENDIF                                                          INE3N5    278
      ENDIF                                                             INE3N5    279
C                                                                       INE3N5    280
C     V/HZ BLOCK                                                        INE3N5    281
C                                                                       INE3N5    282
C     DDAT(JE+34) STORE THE V/HZ LIMIT VALUE                            INE3N5    283
C                                                                       INE3N5    284
      DDAT(JE+34)=XSTATE(JSTATE+1)                                      INE3N5    285
      XSTATE(JSTATE+2)=0.0                                              INE3N5    286
C                                                                       INE3N5    287
C     TERMINAL VOLTAGE LIMITER BLOCK                                    INE3N5    288
C                                                                       INE3N5    289
      IF (IDDAT(JE+26).EQ.0) THEN                                       INE3N5    290
         DDAT(JE+27)=0.0                                                INE3N5    291
         DDAT(JE+28)=0.0                                                INE3N5    292
         DDAT(JE+29)=99.0                                               INE3N5    293
      ELSE                                                              INE3N5    294
         IF (ET.GT.DDAT(JE+29)) THEN                                    INE3N5    295
            WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)    INE3N5    296
     *                      ,NDGC(N)                                    INE3N5    297
            IF(IEXN.EQ.3)THEN                                           INE3N5    298
               WRITE(MSG(2),9010)                                       INE3N5    299
            ELSE                                                        INE3N5    300
               WRITE(MSG(2),9011)                                       INE3N5    301
            ENDIF                                                       INE3N5    302
            WRITE(MSG(3),9020) ET,DDAT(JE+29)                           INE3N5    303
            CALL PRTMSG(3)                                              INE3N5    304
         ENDIF                                                          INE3N5    305
C                                                                       INE3N5    306
C     V2 PRIME                                                          INE3N5    307
C                                                                       INE3N5    308
         XSTATE(JSTATE+3)=0.0                                           INE3N5    309
C                                                                       INE3N5    310
      END IF                                                            INE3N5    311
C                                                                       INE3N5    312
      VE=EFDN                                                           INE3N5    313
C                                                                       INE3N5    314
C                                                                       INE3N5    315
C  RECTIFIER REGULATION FOR TYPE 3 & 5                                  INE3N5    316
C                                                                       INE3N5    317
      IF (IDDAT(JE+9).EQ.0)THEN                                         INE3N5    318
C                                                                       INE3N5    319
C   KC=0                                                                INE3N5    320
C                                                                       INE3N5    321
      VTH=EFDN                                                          INE3N5    322
C                                                                       INE3N5    323
C   KC NE 0                                                             INE3N5    324
C                                                                       INE3N5    325
      ELSE                                                              INE3N5    326
      CFKC=EFDN*DDAT(JE+9)                                              INE3N5    327
      VTH=EFDN+0.577*CFKC                                               INE3N5    328
      FACT=CFKC/VTH                                                     INE3N5    329
      IF (FACT.LT.0.433) GO TO 90                                       INE3N5    330
      VTH=EFDN/1.732+CFKC                                               INE3N5    331
      FACT=CFKC/VTH                                                     INE3N5    332
      IF (FACT.GT.0.75) GO TO 90                                        INE3N5    333
      VTH=(EFDN*EFDN+CFKC*CFKC)/0.75                                    INE3N5    334
      VTH=SQRT(VTH)                                                     INE3N5    335
      FACT=CFKC/VTH                                                     INE3N5    336
      IF (FACT.LE.0.75.AND.FACT.GE.0.433) GO TO 90                      INE3N5    337
C                                                                       INE3N5    338
      WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)          INE3N5    339
     *                  ,NDGC(N)                                        INE3N5    340
      IF(IEXN.EQ.3)THEN                                                 INE3N5    341
         WRITE(MSG(2),9030)                                             INE3N5    342
      ELSE                                                              INE3N5    343
         WRITE(MSG(2),9031)                                             INE3N5    344
      ENDIF                                                             INE3N5    345
      CALL PRTMSG(2)                                                    INE3N5    346
      IEEXIN=1                                                          INE3N5    347
C                                                                       INE3N5    348
C    ENDIF KC.NE.0                                                      INE3N5    349
C                                                                       INE3N5    350
      ENDIF                                                             INE3N5    351
C                                                                       INE3N5    352
 90   VE=VTH+EFDN*DDAT(JE+22)                                           INE3N5    353
C                                                                       INE3N5    354
C   EXCITER SATURATION BLOCK FOR TYEP 3 & 5                             INE3N5    355
C                                                                       INE3N5    356
      SE=DDAT(JE+6)*EXP(DDAT(JE+7)*VE)/VE                               INE3N5    357
      SEKX=VE*(SE+DDAT(JE+4))+EFDN*(DDAT(JE+21)-DDAT(JE+22))            INE3N5    358
C                                                                       INE3N5    359
      IF(IEXN.EQ.5)THEN                                                 INE3N5    360
         XSTATE(JSTATE+4)=SEKX                                          INE3N5    361
      ELSE                                                              INE3N5    362
         XSTATE(JSTATE+4)=EFDN                                          INE3N5    363
      ENDIF                                                             INE3N5    364
C                                                                       INE3N5    365
C                                                                       INE3N5    366
      VR=SEKX                                                           INE3N5    367
C                                                                       INE3N5    368
C                                                                       INE3N5    369
      XSTATE(JSTATE+5)=VR/DDAT(JE+2)                                    INE3N5    370
      XSTATE(JSTATE+6)=VR                                               INE3N5    371
C                                                                       INE3N5    372
      XDFACT(JSTATE+6)=DDAT(JE+2)                                       INE3N5    373
C                                                                       INE3N5    374
      XSTATE(JSTATE+7)=VE                                               INE3N5    375
C                                                                       INE3N5    376
      VREF(JYE+2)=XSTATE(JSTATE+1)+XSTATE(JSTATE+5)                     INE3N5    377
C                                                                       INE3N5    378
      IF(IDDAT(JE+24).NE.0)THEN                                         INE3N5    379
         XSTATE(JSTATE+8)=VR                                            INE3N5    380
         JSTATE=JSTATE+8                                                INE3N5    381
      ELSE                                                              INE3N5    382
         JSTATE=JSTATE+7                                                INE3N5    383
      ENDIF                                                             INE3N5    384
      JY=JY+2                                                           INE3N5    385
C                                                                       INE3N5    386
C     DETERMINE IF A SUBDIVISION OF THE NORMAL INTEGRATION STEP         INE3N5    387
C     SHOULD BE USED. IF SO, CALCULATE THE LARGEST STEP SIZE PERMITTED  INE3N5    388
C                                                                       INE3N5    389
      IF (IDDAT(JE+10).NE.0.AND.IDDAT(JE+11).NE.0) THEN                 INE3N5    390
         IDDAT(JE+35)=1                                                 INE3N5    391
         DDAT(JE+36)=DDAT(JE+11)*DDAT(JE+5)                             INE3N5    392
     *               /(DDAT(JE+10)*DDAT(JE+2))                          INE3N5    393
         IF (IDDAT(JE+13).NE.0) THEN                                    INE3N5    394
            DDAT(JE+36)=DDAT(JE+36)*DDAT(JE+13)                         INE3N5    395
            IF (IDDAT(JE+12).NE.0) DDAT(JE+36)=DDAT(JE+36)              INE3N5    396
     *                                         /(1.0+DDAT(JE+12))       INE3N5    397
         END IF                                                         INE3N5    398
         IF (IDDAT(JE+3).NE.0) THEN                                     INE3N5    399
            DDAT(JE+36)=DDAT(JE+36)*DDAT(JE+3)                          INE3N5    400
            IF (IDDAT(JE+17).NE.0) DDAT(JE+36)=DDAT(JE+36)              INE3N5    401
     *                                         /(1.0+DDAT(JE+17))       INE3N5    402
         END IF                                                         INE3N5    403
         IF (IDDAT(JE+24).NE.0) THEN                                    INE3N5    404
            DDAT(JE+36)=DDAT(JE+36)*DDAT(JE+24)                         INE3N5    405
            IF (IDDAT(JE+23).NE.0) DDAT(JE+36)=DDAT(JE+36)              INE3N5    406
     *                                         /(1.0+DDAT(JE+23))       INE3N5    407
         END IF                                                         INE3N5    408
         IF (DDAT(JE+36).LT.DTMIN) DDAT(JE+36)=DTMIN                    INE3N5    409
      ELSE                                                              INE3N5    410
         IDDAT(JE+35)=0                                                 INE3N5    411
      END IF                                                            INE3N5    412
C                                                                       INE3N5    413
      IF (VR.GT.DDAT(JE+14).OR.VR.LT.DDAT(JE+15)) THEN                  INE3N5    414
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE3N5    415
     *                     ,NDGC(N)                                     INE3N5    416
         IF(IEXN.EQ.3)THEN                                              INE3N5    417
            WRITE(MSG(2),9100)                                          INE3N5    418
         ELSE                                                           INE3N5    419
            WRITE(MSG(2),9101)                                          INE3N5    420
         ENDIF                                                          INE3N5    421
         WRITE(MSG(3),9110) VR,DDAT(JE+14),DDAT(JE+15)                  INE3N5    422
         CALL PRTMSG(3)                                                 INE3N5    423
      ENDIF                                                             INE3N5    424
      IF(IEXN.EQ.5) THEN                                                INE3N5    425
         IF (SEKX.GT.DDAT(JE+25).OR.SEKX.LT.DDAT(JE+33)) THEN           INE3N5    426
            WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)    INE3N5    427
     *                        ,NDGC(N)                                  INE3N5    428
            WRITE(MSG(2),9041)                                          INE3N5    429
            WRITE(MSG(3),9200)                                          INE3N5    430
            WRITE(MSG(4),9210) SEKX,DDAT(JE+25),DDAT(JE+33)             INE3N5    431
            CALL PRTMSG(4)                                              INE3N5    432
         ENDIF                                                          INE3N5    433
      ENDIF                                                             INE3N5    434
C                                                                       INE3N5    435
      RETURN                                                            INE3N5    436
C                                                                       INE3N5    437
 9000 FORMAT(' *** WARNING GENERATOR AT BUS: ',I5,' STATION: ',3A4      INE3N5    438
     *,' GID:',A4)                                                      INE3N5    439
 9010 FORMAT(5X,'TYPE 3 EXCITER  ET VIOLATES UPPER LIMIT: ')            INE3N5    440
 9011 FORMAT(5X,'TYPE 5 EXCITER (WSCC TYPE FC, IEEE TYPE AC1A) ET'      INE3N5    441
     *,' VIOLATES UPPER LIMIT: ')                                       INE3N5    442
 9020 FORMAT(5X,'ET = ',G12.5,' ETLMT = ',G12.5)                        INE3N5    443
 9030 FORMAT(5X,'TYPE 3 EXCITER  FEX FUNCTION OUT OF RANGE')            INE3N5    444
 9031 FORMAT(5X,'TYPE 5 EXCITER (WSCC TYPE FC, IEEE TYPE AC1A) FEX'     INE3N5    445
     *,' FUNCTION OUT OF RANGE')                                        INE3N5    446
 9040 FORMAT(5X,'TYPE 3 EXCITER')                                       INE3N5    447
 9041 FORMAT(5X,'TYPE 5 EXCITER (WSCC TYPE FC, IEEE TYPE AC1A)')        INE3N5    448
 9050 FORMAT(5X,A,'=',F8.6,' IS BELOW THE LIMIT VALUE OF',F5.2,:,2X,A   INE3N5    449
     *,' HAS BEEN SET TO',F5.2)                                         INE3N5    450
 9100 FORMAT(5X,'TYPE 3 EXCITER  VR-X4 VIOLATES LIMITS:')               INE3N5    451
 9101 FORMAT(5X,'TYPE 5 EXCITER (WSCC TYPE FC, IEEE TYPE AC1A) VR-X4'   INE3N5    452
     *,' VIOLATES LIMITS:')                                             INE3N5    453
 9110 FORMAT(5X,'VR = ',G12.5,' VRMAX = ',G12.5,' VRMIN = ',G12.5)      INE3N5    454
 9200 FORMAT(5X,'VR-OUTPUT OF HVG VIOLATES LIMITS:')                    INE3N5    455
 9210 FORMAT(5X,'VR = ',G12.5,' VAMAX = ',G12.5,' VAMIN = ',G12.5)      INE3N5    456
 9220 FORMAT(5X,'TE=',F8.6,' IS LESS THAN OR EQUAL TO ZERO.')           INE3N5    457
C                                                                       INE3N5    458
      END                                                               INE3N5    459
