CFPRIME INE15                                                           INE15       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 INE15                                                  INE15       3
CD                                                                      INE15       4
CD    TO PERFORM INITIALIZATION AND DATA CHECK FOR EXCITER TYPE 15.     INE15       5
CD                                                                      INE15       6
CD    THE DATA STRUCTURE AFTER THE INITIALIZATION IS GIVEN BELOW.       INE15       7
CD                                                                      INE15       8
CD   3.11 Exciter type 15                                               INE15       9
CD                                                                      INE15      10
CD     Exciter data                                                     INE15      11
CD                                                                      INE15      12
CD     IDDAT(JE+ 1)   = IVTN         : sensing bus number               INE15      13
CD     DDAT(JE+ 2)    = KA                                              INE15      14
CD     DDAT(JE+ 3)    = TA                                              INE15      15
CD     DDAT(JE+ 4)    = KF                                              INE15      16
CD     DDAT(JE+ 5)    = TF                                              INE15      17
CD     DDAT(JE+ 6)    = (reserved for future use)                       INE15      18
CD     DDAT(JE+ 7)    = (reserved for future use)                       INE15      19
CD     DDAT(JE+ 8)    = TF1                                             INE15      20
CD     DDAT(JE+ 9)    = TF2                                             INE15      21
CD     DDAT(JE+10)    = TB                                              INE15      22
CD     DDAT(JE+11)    = VRMAX                                           INE15      23
CD     DDAT(JE+12)    = VRMIN                                           INE15      24
CD     DDAT(JE+13)    = EFDMAX                                          INE15      25
CD     DDAT(JE+14)    = EFDMIN                                          INE15      26
CD     DDAT(JE+15)    = (reserved for future use)                       INE15      27
CD     DDAT(JE+16)    = (reserved for future use)                       INE15      28
CD     DDAT(JE+17)    = (reserved for future use)                       INE15      29
CD     DDAT(JE+18)    = TR                                              INE15      30
CD     DDAT(JE+19)    = RC                                              INE15      31
CD     DDAT(JE+20)    = XC                                              INE15      32
CD                                                                      INE15      33
CD     Exciter states                                                   INE15      34
CD                                                                      INE15      35
CD     XSTATE(JES+1)  = TR block     : compulsory                       INE15      36
CD     XSTATE(JES+2)  = TF block     : compulsory                       INE15      37
CD     XSTATE(JES+3)  = TB block     : compulsory                       INE15      38
CD     XSTATE(JES+4)  = TA block     : compulsory                       INE15      39
CD     XSTATE(JES+5)  = TF2 block    : compulsory                       INE15      40
CD                                                                      INE15      41
CD     Exciter Y-variables                                              INE15      42
CD                                                                      INE15      43
CD     VREG(JYE+1)    = VC (input to the TR block)                      INE15      44
CD     VREF(JYE+2)    = reference value                                 INE15      45
CD     VRFIN(JYE+3)   = output of TA block                              INE15      46
CD                                                                      INE15      47
      INCLUDE 'PARX.INS'                                                INE15      48
      INCLUDE 'CNMDAT.INS'                                              INE15      49
      INCLUDE 'CNMSTA.INS'                                              INE15      50
      INCLUDE 'CNXSTA.INS'                                              INE15      51
      INCLUDE 'CNEXC.INS'                                               INE15      52
      INCLUDE 'CNMYVA.INS'                                              INE15      53
      INCLUDE 'CNYVAR.INS'                                              INE15      54
      INCLUDE 'CNFLAG.INS'                                              INE15      55
      INCLUDE 'CNUNIT.INS'                                              INE15      56
      INCLUDE 'CNSTN.INS'                                               INE15      57
      INCLUDE 'CNB1.INS'                                                INE15      58
      INCLUDE 'CNB4.INS'                                                INE15      59
      INCLUDE 'CNMSG.INS'                                               INE15      60
      INCLUDE 'CNXDOT.INS'                                              INE15      61
C                                                                       INE15      62
      DATA BIG/99.9/                                                    INE15      63
C                                                                       INE15      64
      LDEB=(JDEB(70).NE.0)                                              INE15      65
C                                                                       INE15      66
C  IEX=15                                                               INE15      67
C                                                                       INE15      68
C  INPUT TIME CONSTANTS CHECK AND RESET                                 INE15      69
C                                                                       INE15      70
      IF(DDAT(JE+3).LT.TMIN.AND.IDDAT(JE+3).NE.0)THEN                   INE15      71
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE15      72
     *                     ,NDGC(N)                                     INE15      73
         WRITE(MSG(2),9020) 'TA',DDAT(JE+3),TMIN                        INE15      74
         IF(MTFLAG.EQ.0) THEN                                           INE15      75
            CALL PRTMSG(2)                                              INE15      76
         ELSE                                                           INE15      77
         WRITE(MSG(3),9030) 'TA',0.0                                    INE15      78
         CALL PRTMSG(3)                                                 INE15      79
         DDAT(JE+3)=0.0                                                 INE15      80
         ENDIF                                                          INE15      81
      ENDIF                                                             INE15      82
C                                                                       INE15      83
      IF(DDAT(JE+5).LT.TMIN.AND.IDDAT(JE+5).NE.0)THEN                   INE15      84
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE15      85
     *                     ,NDGC(N)                                     INE15      86
         WRITE(MSG(2),9020) 'TF',DDAT(JE+5),TMIN                        INE15      87
         IF(MTFLAG.EQ.0) THEN                                           INE15      88
            CALL PRTMSG(2)                                              INE15      89
         ELSE                                                           INE15      90
         WRITE(MSG(3),9030) 'TF',0.0                                    INE15      91
         CALL PRTMSG(3)                                                 INE15      92
         DDAT(JE+5)=0.0                                                 INE15      93
         ENDIF                                                          INE15      94
      ENDIF                                                             INE15      95
C                                                                       INE15      96
      IF(DDAT(JE+9).LT.TMIN.AND.IDDAT(JE+9).NE.0)THEN                   INE15      97
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE15      98
     *                     ,NDGC(N)                                     INE15      99
         WRITE(MSG(2),9020) 'TF2',DDAT(JE+9),TMIN                       INE15     100
         IF(MTFLAG.EQ.0) THEN                                           INE15     101
            CALL PRTMSG(2)                                              INE15     102
         ELSE                                                           INE15     103
         WRITE(MSG(3),9030) 'TF2',0.0                                   INE15     104
         CALL PRTMSG(3)                                                 INE15     105
         DDAT(JE+9)=0.0                                                 INE15     106
         ENDIF                                                          INE15     107
      ENDIF                                                             INE15     108
C                                                                       INE15     109
      IF(DDAT(JE+10).LT.TMIN.AND.IDDAT(JE+10).NE.0)THEN                 INE15     110
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE15     111
     *                     ,NDGC(N)                                     INE15     112
         WRITE(MSG(2),9020) 'TB',DDAT(JE+10),TMIN                       INE15     113
         IF(MTFLAG.EQ.0) THEN                                           INE15     114
            CALL PRTMSG(2)                                              INE15     115
         ELSE                                                           INE15     116
         IF (IDDAT(JE+4).EQ.0.OR.IDDAT(JE+5).EQ.0.OR.                   INE15     117
     *       IDDAT(JE+3).NE.0) THEN                                     INE15     118
         WRITE(MSG(3),9030) 'TB',0.0                                    INE15     119
         CALL PRTMSG(3)                                                 INE15     120
         DDAT(JE+10)=0.0                                                INE15     121
         ELSE                                                           INE15     122
         WRITE(MSG(3),9030) 'TB',TMIN                                   INE15     123
         CALL PRTMSG(3)                                                 INE15     124
         DDAT(JE+10)=TMIN                                               INE15     125
         ENDIF                                                          INE15     126
         ENDIF                                                          INE15     127
      ELSE IF (IDDAT(JE+10).EQ.0.AND.IDDAT(JE+3).EQ.0.AND.              INE15     128
     *         IDDAT(JE+4).NE.0.AND.IDDAT(JE+5).NE.0) THEN              INE15     129
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE15     130
     *                     ,NDGC(N)                                     INE15     131
         WRITE(MSG(2),9040)                                             INE15     132
         IF(MTFLAG.EQ.0) THEN                                           INE15     133
            CALL PRTMSG(2)                                              INE15     134
         ELSE                                                           INE15     135
         WRITE(MSG(3),9050) TMIN                                        INE15     136
         CALL PRTMSG(3)                                                 INE15     137
         DDAT(JE+10)=TMIN                                               INE15     138
         ENDIF                                                          INE15     139
      ENDIF                                                             INE15     140
C                                                                       INE15     141
      IF(DDAT(JE+18).LT.TMIN.AND.IDDAT(JE+18).NE.0)THEN                 INE15     142
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE15     143
     *                     ,NDGC(N)                                     INE15     144
         WRITE(MSG(2),9020) 'TR',DDAT(JE+18) ,TMIN                      INE15     145
         IF(MTFLAG.EQ.0) THEN                                           INE15     146
            CALL PRTMSG(2)                                              INE15     147
         ELSE                                                           INE15     148
            WRITE(MSG(3),9030) 'TR',0.0                                 INE15     149
            CALL PRTMSG(3)                                              INE15     150
            DDAT(JE+18)=0.0                                             INE15     151
         ENDIF                                                          INE15     152
      ENDIF                                                             INE15     153
C                                                                       INE15     154
C  DATA PREPARATION AND INPUT DATA PRINTOUT                             INE15     155
C                                                                       INE15     156
      IF (IDDAT(JE+11).EQ.0.AND.IDDAT(JE+12).EQ.0)THEN                  INE15     157
         DDAT(JE+11)=BIG                                                INE15     158
         DDAT(JE+12)=-BIG                                               INE15     159
      ENDIF                                                             INE15     160
      IF (IDDAT(JE+13).EQ.0.AND.IDDAT(JE+14).EQ.0) THEN                 INE15     161
         DDAT(JE+13)=BIG                                                INE15     162
         DDAT(JE+14)=-BIG                                               INE15     163
      ENDIF                                                             INE15     164
C                                                                       INE15     165
      IF (IDDAT(JE+4).EQ.0.OR.IDDAT(JE+5).EQ.0) THEN                    INE15     166
         DDAT(JE+8)=0.0                                                 INE15     167
         DDAT(JE+9)=0.0                                                 INE15     168
      ENDIF                                                             INE15     169
C                                                                       INE15     170
      VR=EFDN/VREG(JYE+1)                                               INE15     171
      IF (VR.GT.DDAT(JE+13).OR.VR.LT.DDAT(JE+14))THEN                   INE15     172
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE15     173
     *                     ,NDGC(N)                                     INE15     174
         WRITE(MSG(2),9100)                                             INE15     175
         WRITE(MSG(3),9010) VR,DDAT(JE+13),DDAT(JE+14)                  INE15     176
         CALL PRTMSG(3)                                                 INE15     177
      ENDIF                                                             INE15     178
      IF(VR.GT.DDAT(JE+11).OR.VR.LT.DDAT(JE+12))THEN                    INE15     179
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       INE15     180
     *                     ,NDGC(N)                                     INE15     181
         WRITE(MSG(2),9100)                                             INE15     182
         WRITE(MSG(3),9110) VR,DDAT(JE+11),DDAT(JE+12)                  INE15     183
         CALL PRTMSG(3)                                                 INE15     184
      ENDIF                                                             INE15     185
C                                                                       INE15     186
      IF(IDDAT(JE+4).NE.0.AND.IDDAT(JE+5).NE.0)THEN                     INE15     187
         XSTATE(JSTATE+2)=VR                                            INE15     188
      ELSE                                                              INE15     189
         XSTATE(JSTATE+2)=0.0                                           INE15     190
      ENDIF                                                             INE15     191
C                                                                       INE15     192
      XSTATE(JSTATE+5)=0.0                                              INE15     193
      XSTATE(JSTATE+4)=VR                                               INE15     194
C                                                                       INE15     195
      XDFACT(JSTATE+4)=DDAT(JE+2)                                       INE15     196
C                                                                       INE15     197
      XSTATE(JSTATE+3)=VR/DDAT(JE+2)                                    INE15     198
      VREF(JYE+2)=XSTATE(JSTATE+1)+VR/DDAT(JE+2)                        INE15     199
      VRFIN(JYE+3)=VR                                                   INE15     200
C                                                                       INE15     201
      IF (LDEB)THEN                                                     INE15     202
      WRITE(IUD6,1010) (DDAT(JE+L),L=1,22)                              INE15     203
      WRITE(IUD6,1020) (XSTATE(JSTATE+L),L=1,5)                         INE15     204
      ENDIF                                                             INE15     205
C                                                                       INE15     206
      JSTATE=JSTATE+5                                                   INE15     207
      JY=JY+3                                                           INE15     208
C                                                                       INE15     209
C     OBTAIN THE CASE NUMBER FOR DIFFERENT CONFIGURATION                INE15     210
C                                                                       INE15     211
      IDDAT(JE+21)=1                                                    INE15     212
      IF (IDDAT(JE+3).EQ.0.AND.IDDAT(JE+10).EQ.0) THEN                  INE15     213
         IDDAT(JE+21)=4                                                 INE15     214
      ELSE IF (IDDAT(JE+3).EQ.0) THEN                                   INE15     215
         IDDAT(JE+21)=2                                                 INE15     216
      ELSE IF (IDDAT(JE+10).EQ.0) THEN                                  INE15     217
         IDDAT(JE+21)=3                                                 INE15     218
      END IF                                                            INE15     219
C                                                                       INE15     220
C     DETERMINE IF A SUBDIVISION OF THE NORMAL INTEGRATION STEP         INE15     221
C     SHOULD BE USED. IF SO, CALCULATE THE LARGEST STEP SIZE PERMITTED  INE15     222
C                                                                       INE15     223
      TMAX=99.0                                                         INE15     224
      IF (IDDAT(JE+4).NE.0.AND.IDDAT(JE+5).NE.0) THEN                   INE15     225
         IDDAT(JE+24)=1                                                 INE15     226
         TMAX=DDAT(JE+5)/(DDAT(JE+2)*DDAT(JE+4))                        INE15     227
         IF (IDDAT(JE+9).NE.0) THEN                                     INE15     228
            TMAX=TMAX*DDAT(JE+9)                                        INE15     229
            IF (IDDAT(JE+8).NE.0) TMAX=TMAX/(1.0+DDAT(JE+8))            INE15     230
         END IF                                                         INE15     231
         IF (IDDAT(JE+10).NE.0) TMAX=TMAX*DDAT(JE+10)                   INE15     232
         IF (IDDAT(JE+3).NE.0) TMAX=TMAX*DDAT(JE+3)                     INE15     233
         TMAX=TMAX/2.0                                                  INE15     234
         IF (TMAX.LT.DTMIN) TMAX=DTMIN                                  INE15     235
      ELSE                                                              INE15     236
         IDDAT(JE+24)=0                                                 INE15     237
      END IF                                                            INE15     238
      DDAT(JE+25)=TMAX                                                  INE15     239
C                                                                       INE15     240
 1010 FORMAT(1X,'INE34-DB:DDAT ',/,(10X,10G12.5))                       INE15     241
 1020 FORMAT(1X,'INE34-DB:XSTATE ',10G12.5)                             INE15     242
 9000 FORMAT(' *** WARNING GENERATOR AT BUS: ',I5,' STATION: ',3A4      INE15     243
     *,' GID:',A4)                                                      INE15     244
 9100 FORMAT(5X,'VR-X4 VIOLATES LIMITS:')                               INE15     245
 9010 FORMAT(5X,'VR = ',G12.5,' EFDMAX = ',G12.5,' EFDMIN = ',G12.5)    INE15     246
 9020 FORMAT(5X,'TYPE 15 EXCITER ',A,'=',F8.6                           INE15     247
     *,' IS BELOW THE LIMIT VALUE OF ',F4.2)                            INE15     248
 9030 FORMAT(5X,A,' HAS BEEN SET TO ',F4.2)                             INE15     249
 9040 FORMAT(5X,'TB CAN NOT BE ZERO IF TA IS ZERO AND RATE FEEDBACK',   INE15     250
     *' EXISTS')                                                        INE15     251
 9050 FORMAT(5X,'TB HAS BEEN SET TO ',F4.2)                             INE15     252
 9110 FORMAT(5X,'VR = ',G12.5,' VRMAX = ',G12.5,' VRMIN = ',G12.5)      INE15     253
      RETURN                                                            INE15     254
C                                                                       INE15     255
      END                                                               INE15     256
