CFPRIME MOTINT                                                          MOTINT      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 MOTINT(*,*)                                            MOTINT      3
CD                                                                      MOTINT      4
CD    TO PERFORM INDUCTION MOTOR INITIALIZATION.                        MOTINT      5
CD                                                                      MOTINT      6
CD    THE DATA STRUCTURE AFTER THE INITIALIZATION IS GIVEN BELOW.       MOTINT      7
CD                                                                      MOTINT      8
CD   10.1 Induction motor data                                          MOTINT      9
CD                                                                      MOTINT     10
CD     NMOTL                         : induction motor number           MOTINT     11
CD     JM        = JMDAT(NMOTL)      : pointer for `DDAT' (data)        MOTINT     12
CD     NLF       = NMOTB(NMOTL)      : bus number (load flow number)    MOTINT     13
CD                 > 0 normal motor                                     MOTINT     14
CD                 < 0 motor within A-LOAD                              MOTINT     15
CD     MLF       = NMOLD(NMOTL)      : bus number (program number)      MOTINT     16
CD     MUID      = NDMC(NMOTL)       : unit ID                          MOTINT     17
CD     JSTATE    = JXIMO(NMOTL)      : pointer for `XSTATE' (state      MOTINT     18
CD                                     vector)                          MOTINT     19
CD     JY        = JVIMO(NMOTL)      : pointer for the Y-variables      MOTINT     20
CD                                                                      MOTINT     21
CD   10.2 Motor type convention                                         MOTINT     22
CD                                                                      MOTINT     23
CD     TYPE 1    -    single cage model, with 3 states                  MOTINT     24
CD     TYPE 2    -    deep bar rotor model, with 3 states               MOTINT     25
CD     TYPE 3    -    double cage model, with 3 states                  MOTINT     26
CD     TYPE 6    -    simplified single cage model, with 1 state        MOTINT     27
CD     TYPE 7    -    simplified deep bar rotor model, with 1 state     MOTINT     28
CD     TYPE 8    -    simplified double cage model, with 1 state        MOTINT     29
CD     TYPE 11   -    same as type 1 within A-LOAD                      MOTINT     30
CD     TYPE 12   -    same as type 2 within A-LOAD                      MOTINT     31
CD     TYPE 13   -    same as type 3 within A-LOAD                      MOTINT     32
CD     TYPE 16   -    same as type 6 within A-LOAD                      MOTINT     33
CD     TYPE 17   -    same as type 7 within A-LOAD                      MOTINT     34
CD     TYPE 18   -    same as type 8 within A-LOAD                      MOTINT     35
CD                                                                      MOTINT     36
CD     Motor states                                                     MOTINT     37
CD                                                                      MOTINT     38
CD     For motor types with 3 states (full models), the states are:     MOTINT     39
CD                                                                      MOTINT     40
CD     real part of stator voltage VD                                   MOTINT     41
CD     imaginary part of stator voltage VQ                              MOTINT     42
CD     slip S                                                           MOTINT     43
CD                                                                      MOTINT     44
CD     For simplified motor models, the only state is slip S.           MOTINT     45
CD                                                                      MOTINT     46
CD     Motor Y-variables                                                MOTINT     47
CD                                                                      MOTINT     48
CD     DXM(JY+1)      = saturation factor                               MOTINT     49
CD     TLM(JY+2)      = mechanical torque                               MOTINT     50
CD     ANGXM3(JY+3)   = slip                                            MOTINT     51
CD     GSM(JY+4)      = equivalent conductance                          MOTINT     52
CD     BSM(JY+5)      = equivalent susceptance                          MOTINT     53
CD     GSMO(JY+6)     = equivalent conductance at steady state          MOTINT     54
CD     BSMO(JY+7)     = equivalent susceptance at steady state          MOTINT     55
CD     CDM(JY+8)      = real part of terminal current                   MOTINT     56
CD     CQM(JY+9)      = imaginary part of terminal current              MOTINT     57
CD     VC1D(JY+10)    = real part of stator voltage                     MOTINT     58
CD     VC1Q(JY+11)    = imaginary part of stator voltage                MOTINT     59
CD                                                                      MOTINT     60
CD   10.3 Induction motor DDAT mapping                                  MOTINT     61
CD                                                                      MOTINT     62
CD     Induction motor types 1 and 6                                    MOTINT     63
CD                                                                      MOTINT     64
CD     IDDAT(JM+ 1)   = NTYPE                                           MOTINT     65
CD     IDDAT(JM+ 2)   = IPFAX                                           MOTINT     66
CD     DDAT(JM+ 3)    = QFAX                                            MOTINT     67
CD     IDDAT(JM+ 4)   = ISATX                                           MOTINT     68
CD     IDDAT(JM+ 5)   = ILTYPE                                          MOTINT     69
CD     DDAT(JM+ 6)    = H                                               MOTINT     70
CD     DDAT(JM+ 7)    = n or A                                          MOTINT     71
CD     DDAT(JM+ 8)    = m or B                                          MOTINT     72
CD     DDAT(JM+ 9)    = K1 or C                                         MOTINT     73
CD     DDAT(JM+10)    = K2                                              MOTINT     74
CD     DDAT(JM+11)    = BASPR                                           MOTINT     75
CD     DDAT(JM+12)    = BASVR                                           MOTINT     76
CD     DDAT(JM+13)    = WXBASE in rads/sec                              MOTINT     77
CD     DDAT(JM+14)    = VI                                              MOTINT     78
CD     DDAT(JM+15)    = TI                                              MOTINT     79
CD     DDAT(JM+16)    = XM                                              MOTINT     80
CD     DDAT(JM+17)    = XS                                              MOTINT     81
CD     DDAT(JM+18)    = RS                                              MOTINT     82
CD     DDAT(JM+19)    = XR                                              MOTINT     83
CD     DDAT(JM+20)    = RR                                              MOTINT     84
CD     DDAT(JM+21)    = XS1                                             MOTINT     85
CD     DDAT(JM+22)    = DR                                              MOTINT     86
CD     DDAT(JM+23)    = DS                                              MOTINT     87
CD     DDAT(JM+24)    = XSO                                             MOTINT     88
CD     DDAT(JM+25)    = XRO                                             MOTINT     89
CD     DDAT(JM+26)    = CSO                                             MOTINT     90
CD     DDAT(JM+27)    = CRO                                             MOTINT     91
CD     DDAT(JM+28)    = V1                                              MOTINT     92
CD     DDAT(JM+29)    = V2                                              MOTINT     93
CD     DDAT(JM+30)    = G1                                              MOTINT     94
CD     DDAT(JM+31)    = G2                                              MOTINT     95
CD                                                                      MOTINT     96
CD                                                                      MOTINT     97
CD     Induction motor types 2 and 7                                    MOTINT     98
CD                                                                      MOTINT     99
CD     Same DDAT data as TYPE 1, except                                 MOTINT    100
CD                                                                      MOTINT    101
CD     DDAT(JM+19)    = DBF                                             MOTINT    102
CD                                                                      MOTINT    103
CD     Induction motor types 3 and 8                                    MOTINT    104
CD                                                                      MOTINT    105
CD     Same DDAT data as TYPE 1, except                                 MOTINT    106
CD                                                                      MOTINT    107
CD     DDAT(JM+20)    = R1                                              MOTINT    108
CD     DDAT(JM+32)    = X2                                              MOTINT    109
CD     DDAT(JM+33)    = R2                                              MOTINT    110
CD                                                                      MOTINT    111
CD                                                                      MOTINT    112
CD     Induction motor types 11, 12, 13, 16, 17, and 18                 MOTINT    113
CD                                                                      MOTINT    114
CD     Same DDAT data as TYPE 1, 2, 3, 6, 7 and 8 respectively, adding  MOTINT    115
CD                                                                      MOTINT    116
CD     IDDAT(JM+36)   = 1 for large motor in A-LOAD                     MOTINT    117
CD                      2 for small motor in A-LOAD                     MOTINT    118
CD     DDAT(JM+37)    = VREAL of the low tension bus at the A-LOAD      MOTINT    119
CD     DDAT(JM+38)    = VIMAG of the low tension bus at the A-LOAD      MOTINT    120
CD                                                                      MOTINT    121
      INCLUDE 'PARX.INS'                                                MOTINT    122
      INCLUDE 'CNB19.INS'                                               MOTINT    123
      INCLUDE 'CNFLAG.INS'                                              MOTINT    124
      INCLUDE 'CNPT.INS'                                                MOTINT    125
      INCLUDE 'CNMDAT.INS'                                              MOTINT    126
      INCLUDE 'CNMPAR.INS'                                              MOTINT    127
      INCLUDE 'CNXSTA.INS'                                              MOTINT    128
      INCLUDE 'CNYVAR.INS'                                              MOTINT    129
      INCLUDE 'CNXDOT.INS'                                              MOTINT    130
C                                                                       MOTINT    131
      COMMON /MCUR/ DATMOT(NMT,12),TMAX(NMT),FNATF(NMT)                 MOTINT    132
      LOGICAL LOS                                                       MOTINT    133
C                                                                       MOTINT    134
      LDEB=(JDEB(29).NE.0)                                              MOTINT    135
C                                                                       MOTINT    136
      JIMLVT=0                                                          MOTINT    137
      DO 210 K=1,NMOTL                                                  MOTINT    138
      JM=JMDAT(K)                                                       MOTINT    139
      IF(JSTATE+3.GT.NSI) RETURN 1                                      MOTINT    140
      IF(JY+11.GT.NSI) RETURN 2                                         MOTINT    141
      JXIMO(K)=JSTATE                                                   MOTINT    142
      JVIMO(K)=JY                                                       MOTINT    143
      IF (IDDAT(JM+1) .LT. 0) THEN                                      MOTINT    144
        LOS = .TRUE.                                                    MOTINT    145
      ELSE                                                              MOTINT    146
        LOS = .FALSE.                                                   MOTINT    147
      ENDIF                                                             MOTINT    148
      MOTYPK=IABS(IDDAT(JM+1))                                          MOTINT    149
      IF (MOTYPK.GT.10) MOTYPK=MOTYPK-10                                MOTINT    150
C                                                                       MOTINT    151
C     CHANGE BASE                                                       MOTINT    152
C                                                                       MOTINT    153
      BASPRM=DDAT(JM+11)/BASPC                                          MOTINT    154
      BASVRM=DDAT(JM+12)                                                MOTINT    155
      ZBAS=BASVRM**2/BASPRM                                             MOTINT    156
      DDAT(JM+6)=DDAT(JM+6)*BASPRM                                      MOTINT    157
      DDAT(JM+6)=0.5/DDAT(JM+6)                                         MOTINT    158
      DDAT(JM+16)=DDAT(JM+16)*ZBAS                                      MOTINT    159
      DDAT(JM+17)=DDAT(JM+17)*ZBAS                                      MOTINT    160
      DDAT(JM+18)=DDAT(JM+18)*ZBAS                                      MOTINT    161
      IF (MOTYPK.NE.2.AND.MOTYPK.NE.7) DDAT(JM+19)=DDAT(JM+19)*ZBAS     MOTINT    162
      DDAT(JM+20)=DDAT(JM+20)*ZBAS                                      MOTINT    163
      DDAT(JM+21)=DDAT(JM+21)*ZBAS                                      MOTINT    164
      DDAT(JM+24)=DDAT(JM+24)*ZBAS                                      MOTINT    165
      DDAT(JM+25)=DDAT(JM+25)*ZBAS                                      MOTINT    166
      DDAT(JM+26)=DDAT(JM+26)*BASPRM/BASVRM                             MOTINT    167
      DDAT(JM+27)=DDAT(JM+27)*BASPRM/BASVRM                             MOTINT    168
      DDAT(JM+28)=DDAT(JM+28)*BASVRM                                    MOTINT    169
      DDAT(JM+29)=DDAT(JM+29)*BASVRM                                    MOTINT    170
      IF (MOTYPK.EQ.3.OR.MOTYPK.EQ.8) THEN                              MOTINT    171
      DDAT(JM+32)=DDAT(JM+32)*ZBAS                                      MOTINT    172
      DDAT(JM+33)=DDAT(JM+33)*ZBAS                                      MOTINT    173
      ENDIF                                                             MOTINT    174
C                                                                       MOTINT    175
C     DDAT(JM+34) IS USED TO MONITOR THE MOTOR TRIPPING STATUS          MOTINT    176
C                                                                       MOTINT    177
      DDAT(JM+34)=-1.0                                                  MOTINT    178
C                                                                       MOTINT    179
C     INITIALIZATION                                                    MOTINT    180
C                                                                       MOTINT    181
      DXM(JY+1)=DATMOT(K,1)                                             MOTINT    182
      TLM(JY+2)=DATMOT(K,2)*BASPRM                                      MOTINT    183
      ANGXM3(JY+3)=DATMOT(K,3)                                          MOTINT    184
      GSM(JY+4)=DATMOT(K,4)/ZBAS                                        MOTINT    185
      BSM(JY+5)=DATMOT(K,5)/ZBAS                                        MOTINT    186
      GSMO(JY+6)=DATMOT(K,6)/ZBAS                                       MOTINT    187
      BSMO(JY+7)=DATMOT(K,7)/ZBAS                                       MOTINT    188
      CDM(JY+8)=DATMOT(K,8)*BASPRM/BASVRM                               MOTINT    189
      CDM(JY+9)=DATMOT(K,9)*BASPRM/BASVRM                               MOTINT    190
      IF (.NOT. LOS) THEN                                               MOTINT    191
        IF (IDDAT(JM+5).EQ.1) THEN                                      MOTINT    192
           DDAT(JM+9)=DDAT(JM+9)*TLM(JY+2)                              MOTINT    193
           DDAT(JM+10)=DDAT(JM+10)*TLM(JY+2)                            MOTINT    194
        ELSE IF (IDDAT(JM+5).EQ.2) THEN                                 MOTINT    195
           DDAT(JM+7)=DDAT(JM+7)*TLM(JY+2)                              MOTINT    196
           DDAT(JM+8)=DDAT(JM+8)*TLM(JY+2)                              MOTINT    197
           DDAT(JM+9)=DDAT(JM+9)*TLM(JY+2)                              MOTINT    198
        END IF                                                          MOTINT    199
      ENDIF                                                             MOTINT    200
      IF (MOTYPK.LE.3) THEN                                             MOTINT    201
         TTRR=(DDAT(JM+19)+DDAT(JM+25)+DDAT(JM+16))/                    MOTINT    202
     *        (DDAT(JM+13)*DDAT(JM+20))                                 MOTINT    203
         XSTATE(JSTATE+1)=DATMOT(K,10)                                  MOTINT    204
         XDFACT(JSTATE+1)=1.0/TTRR                                      MOTINT    205
         XSTATE(JSTATE+2)=DATMOT(K,11)                                  MOTINT    206
         XDFACT(JSTATE+2)=1.0/TTRR                                      MOTINT    207
         XSTATE(JSTATE+3)=DATMOT(K,12)                                  MOTINT    208
         ISTATE=3                                                       MOTINT    209
         JY=JY+9                                                        MOTINT    210
      ELSE                                                              MOTINT    211
         VC1D(JY+10)=DATMOT(K,10)                                       MOTINT    212
         VC1Q(JY+11)=DATMOT(K,11)                                       MOTINT    213
         XSTATE(JSTATE+1)=DATMOT(K,12)                                  MOTINT    214
         ISTATE=1                                                       MOTINT    215
         JY=JY+11                                                       MOTINT    216
      END IF                                                            MOTINT    217
C                                                                       MOTINT    218
      JSTATE=JSTATE+ISTATE                                              MOTINT    219
C                                                                       MOTINT    220
  210 CONTINUE                                                          MOTINT    221
C                                                                       MOTINT    222
      RETURN                                                            MOTINT    223
      END                                                               MOTINT    224
