CFPRIME YMOTS                                                           YMOTS       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 YMOTS(K)                                               YMOTS       3
CD                                                                      YMOTS       4
CD    TO PERFORM THE INITIALIZATION FOR INDUCTION MOTOR.                YMOTS       5
CD                                                                      YMOTS       6
      INCLUDE 'PARX.INS'                                                YMOTS       7
      INCLUDE 'CNB1.INS'                                                YMOTS       8
      INCLUDE 'CNB6.INS'                                                YMOTS       9
      INCLUDE 'CNB19.INS'                                               YMOTS      10
      INCLUDE 'CNFLAG.INS'                                              YMOTS      11
      INCLUDE 'CNVOLT.INS'                                              YMOTS      12
      INCLUDE 'CNSTN.INS'                                               YMOTS      13
      INCLUDE 'CNPT.INS'                                                YMOTS      14
      INCLUDE 'CNIPTR.INS'                                              YMOTS      15
      INCLUDE 'CNJDAT.INS'                                              YMOTS      16
      INCLUDE 'CNMDAT.INS'                                              YMOTS      17
      INCLUDE 'CNMPAR.INS'                                              YMOTS      18
      INCLUDE 'CNMNEW.INS'                                              YMOTS      19
      INCLUDE 'CNNNEW.INS'                                              YMOTS      20
      INCLUDE 'CNPARX.INS'                                              YMOTS      21
      INCLUDE 'CNREN.INS'                                               YMOTS      22
      INCLUDE 'CNUNIT.INS'                                              YMOTS      23
      INCLUDE 'CNSPDI.INS'                                              YMOTS      24
      INCLUDE 'CNQSTA.INS'                                              YMOTS      25
      INCLUDE 'CNMSG.INS'                                               YMOTS      26
      INCLUDE 'EQQSTA.INS'                                              YMOTS      27
C                                                                       YMOTS      28
      COMPLEX VOLTK                                                     YMOTS      29
C                                                                       YMOTS      30
      COMMON /MCUR/DATMOT(NMT,12),TMAX(NMT),FNATF(NMT)                  YMOTS      31
      LOGICAL LOS                                                       YMOTS      32
C                                                                       YMOTS      33
      LDEB=(JDEB(29).NE.0)                                              YMOTS      34
C                                                                       YMOTS      35
      KK=NMOLD(K)                                                       YMOTS      36
      KV=KK+KK                                                          YMOTS      37
      KN=KV+KK                                                          YMOTS      38
      JM=JMDAT(K)                                                       YMOTS      39
      MSATK=IDDAT(JM+4)                                                 YMOTS      40
C      MOTYPK=IDDAT(JM+1)                                               YMOTS      41
      IF (IDDAT(JM+1) .LT. 0) THEN                                      YMOTS      42
        LOS = .TRUE.                                                    YMOTS      43
      ELSE                                                              YMOTS      44
        LOS = .FALSE.                                                   YMOTS      45
      ENDIF                                                             YMOTS      46
      MOTYPK=IABS(IDDAT(JM+1))                                          YMOTS      47
      PDM(1,K)=PDM(1,K)*BASPC/DDAT(JM+11)                               YMOTS      48
      IF (MOTYPK.LT.10) THEN                                            YMOTS      49
         VOLTK=VOLT(KK)                                                 YMOTS      50
         VREAL=REAL(VOLTK)                                              YMOTS      51
         VIMAG=AIMAG(VOLTK)                                             YMOTS      52
      ELSE                                                              YMOTS      53
         VREAL=DDAT(JM+36)                                              YMOTS      54
         VIMAG=DDAT(JM+37)                                              YMOTS      55
         MOTYPK=MOTYPK-10                                               YMOTS      56
      END IF                                                            YMOTS      57
      VT2=VREAL*VREAL+VIMAG*VIMAG                                       YMOTS      58
      VT=SQRT(VT2)                                                      YMOTS      59
      DELTA=ATAN2(VIMAG,VREAL)                                          YMOTS      60
      IF (IDDAT(JM+28).EQ.0) DDAT(JM+28)=99.999                         YMOTS      61
      IF (IDDAT(JM+29).EQ.0) DDAT(JM+29)=99.999                         YMOTS      62
      XS=DDAT(JM+17)+DDAT(JM+24)                                        YMOTS      63
      RR=DDAT(JM+20)                                                    YMOTS      64
      IF (MOTYPK.EQ.2.OR.MOTYPK.EQ.7) THEN                              YMOTS      65
C         X6=DDAT(JM+19)**2*RR/6.0                                      YMOTS      66
C         X7=0.0                                                        YMOTS      67
C XR = XRO/2 + XRO/2 * DR +DBF^2*RR/6                                   YMOTS      68
         DDAT(JM+25)=DDAT(JM+25)/2.0                                    YMOTS      69
         X6=DDAT(JM+25)                                                 YMOTS      70
         X7=DDAT(JM+19)**2*RR/6.0                                       YMOTS      71
      ELSE IF (MOTYPK.EQ.3.OR.MOTYPK.EQ.8) THEN                         YMOTS      72
         X6=DDAT(JM+19)                                                 YMOTS      73
         X7=RR*RR*DDAT(JM+32)/(RR+DDAT(JM+33))**2                       YMOTS      74
         RR=RR*DDAT(JM+33)/(RR+DDAT(JM+33))                             YMOTS      75
      ELSE                                                              YMOTS      76
         X6=DDAT(JM+19)                                                 YMOTS      77
         X7=0.0                                                         YMOTS      78
      END IF                                                            YMOTS      79
      XR=DDAT(JM+25)+X6+X7                                              YMOTS      80
      CSOMK=DDAT(JM+26)                                                 YMOTS      81
      CROMK=DDAT(JM+27)                                                 YMOTS      82
      V1=DDAT(JM+28)                                                    YMOTS      83
      V2=DDAT(JM+29)                                                    YMOTS      84
      G1=DDAT(JM+30)                                                    YMOTS      85
      G2=DDAT(JM+31)                                                    YMOTS      86
      CALL SATFU(VT,V1,V2,G1,G2,SFACT)                                  YMOTS      87
      XMMK=DDAT(JM+16)                                                  YMOTS      88
      XM=XMMK/SFACT                                                     YMOTS      89
      DDAT(JM+22)=1.0                                                   YMOTS      90
      DDAT(JM+23)=1.0                                                   YMOTS      91
C                                                                       YMOTS      92
C     CHECK MOTOR DATA                                                  YMOTS      93
C                                                                       YMOTS      94
      M=0                                                               YMOTS      95
      HMX=DDAT(JM+6)                                                    YMOTS      96
      DAMPX=0.0                                                         YMOTS      97
      XS1=XS+XM*XR/(XM+XR)                                              YMOTS      98
      TMAX(K)=VT2*XM*XM/(XM+XR)/(XM+XS)/XS1/2.                          YMOTS      99
      FNATF(K)=(SQRT(DDAT(JM+13)*TMAX(K)/HMX))*PI/4.0                   YMOTS     100
C      S=.001                                                           YMOTS     101
C  INITIAL SLIP (-VE FOR GENERATOR)                                     YMOTS     102
      S=SIGN(0.001, PDM(1,K))                                           YMOTS     103
      S3=0.                                                             YMOTS     104
C             SLIP CALCULATION                                          YMOTS     105
  120 XA=XM+XS                                                          YMOTS     106
      XB=XM+XR                                                          YMOTS     107
      DDAT(JM+21)=XS+XM*XR/XB                                           YMOTS     108
C                                                                       YMOTS     109
C SET INITIAL CONDITIONS OF O/S INDUCTION MACHINE                       YMOTS     110
      IF (LOS) THEN                                                     YMOTS     111
        P1 = 0.0                                                        YMOTS     112
        Q  = 0.0                                                        YMOTS     113
        S  = 1.0                                                        YMOTS     114
        V1D = 0.0                                                       YMOTS     115
        V1Q = 0.0                                                       YMOTS     116
        CDK8 = 0.0                                                      YMOTS     117
        CDK9 = 0.0                                                      YMOTS     118
        DATMOT(K,8) = 0.0                                               YMOTS     119
        DATMOT(K,9) = 0.0                                               YMOTS     120
        GOTO 200                                                        YMOTS     121
      ENDIF                                                             YMOTS     122
      N=0                                                               YMOTS     123
  130 CONTINUE                                                          YMOTS     124
      F=XM*XM/(RR*RR+S*S*XB*XB)                                         YMOTS     125
      ZR=DDAT(JM+18)+RR*F*S                                             YMOTS     126
      ZX=XA-XB*S*S*F                                                    YMOTS     127
      DZR=F*F*(RR*RR-S*S*XB*XB)*RR/(XM**2)                              YMOTS     128
      DZX=-F*F*2.*S*RR*RR*XB/(XM**2)                                    YMOTS     129
      YRX2=1.0/(ZR*ZR+ZX*ZX)                                            YMOTS     130
      P1=VT2*ZR*YRX2                                                    YMOTS     131
      YRX2=YRX2*YRX2                                                    YMOTS     132
      ZXMR2=ZX*ZX-ZR*ZR                                                 YMOTS     133
      DP1=VT2*(ZXMR2*DZR-2.*ZX*ZR*DZX)*YRX2                             YMOTS     134
      S1=S-(P1-PDM(1,K))/DP1                                            YMOTS     135
C      IF (S1.LT.1E-10) GO TO 140                                       YMOTS     136
C      ER=ABS((S1-S)/S1)                                                YMOTS     137
C CHECK THE SLIP (-VE FOR GENERATOR)                                    YMOTS     138
      IF (ABS(S1).LT.1E-10) THEN                                        YMOTS     139
        ER=ABS(S1-S)                                                    YMOTS     140
      ELSE                                                              YMOTS     141
        ER=ABS((S1-S)/S1)                                               YMOTS     142
      ENDIF                                                             YMOTS     143
      IF (ER.LT.1E-6) GO TO 150                                         YMOTS     144
  140 S=S1                                                              YMOTS     145
      N=N+1                                                             YMOTS     146
      IF (N.LE.40.AND.ABS(S).LE.1.0) GO TO 130                          YMOTS     147
      WRITE(MSG(1),360) NOLD(KK),INAME(KN-2),INAME(KN-1),INAME(KN)      YMOTS     148
     1                 ,NDMC(K)                                         YMOTS     149
      WRITE(MSG(2),370)                                                 YMOTS     150
      CALL PRTMSG(2)                                                    YMOTS     151
      GOTO 180                                                          YMOTS     152
C                                                                       YMOTS     153
C             SETS  INITIAL  CONDITIONS                                 YMOTS     154
  150 S=S1                                                              YMOTS     155
      F=XM*XM/(RR*RR+S*S*XB*XB)                                         YMOTS     156
      ZR=DDAT(JM+18)+RR*F*S                                             YMOTS     157
      ZX=XA-XB*S*S*F                                                    YMOTS     158
      YRX2=1.0/(ZR*ZR+ZX*ZX)                                            YMOTS     159
      Q=VT2*ZX*YRX2                                                     YMOTS     160
      P1=VT2*ZR*YRX2                                                    YMOTS     161
      CUR=(P1*P1+Q*Q)/VT2                                               YMOTS     162
      CUR=SQRT(CUR)                                                     YMOTS     163
      PHI=ATAN2(Q,P1)                                                   YMOTS     164
C                                                                       YMOTS     165
      DATMOT(K,8)=CUR*COS(DELTA-PHI)                                    YMOTS     166
      DATMOT(K,9)=CUR*SIN(DELTA-PHI)                                    YMOTS     167
      CDK8=DATMOT(K,8)                                                  YMOTS     168
      CDK9=DATMOT(K,9)                                                  YMOTS     169
C                                                                       YMOTS     170
      V1D=VREAL-DDAT(JM+18)*CDK8+DDAT(JM+21)*CDK9                       YMOTS     171
      V1Q=VIMAG-DDAT(JM+18)*CDK9-DDAT(JM+21)*CDK8                       YMOTS     172
C                                                                       YMOTS     173
      IF (MSATK.EQ.0) GO TO 200                                         YMOTS     174
C      IF (S.LT.1.E-10) GO TO 200                                       YMOTS     175
C      ER=ABS((S3-S)/S)                                                 YMOTS     176
      IF (ABS(S).LT.1E-10) THEN                                         YMOTS     177
        ER=ABS(S3-S)                                                    YMOTS     178
      ELSE                                                              YMOTS     179
        ER=ABS((S3-S)/S3)                                               YMOTS     180
      ENDIF                                                             YMOTS     181
      IF (ER.LT.1.E-3) GO TO 200                                        YMOTS     182
      IF (M.EQ.0) S3=S                                                  YMOTS     183
      XB=XR+XM                                                          YMOTS     184
C                                                                       YMOTS     185
      CRD=V1Q/XM-XM/XB*CDK8                                             YMOTS     186
      CRQ=-V1D/XM-XM/XB*CDK9                                            YMOTS     187
      CR=SQRT(CRD*CRD+CRQ*CRQ)                                          YMOTS     188
      CS=SQRT(CDK8*CDK8+CDK9*CDK9)                                      YMOTS     189
C                                                                       YMOTS     190
      D=1.0                                                             YMOTS     191
      IF (CR.LE.CROMK) GO TO 160                                        YMOTS     192
      RATIO=CROMK/CR                                                    YMOTS     193
      FACT=SQRT(1.0-RATIO*RATIO)                                        YMOTS     194
      ANGX=ATAN(RATIO/FACT)                                             YMOTS     195
      D=(ANGX+RATIO*FACT)*PI                                            YMOTS     196
  160 CONTINUE                                                          YMOTS     197
      XR=DDAT(JM+25)+X7+X6*D                                            YMOTS     198
      DDAT(JM+22)=D                                                     YMOTS     199
      D=1.0                                                             YMOTS     200
      IF (CS.LE.CSOMK) GO TO 170                                        YMOTS     201
      RATIO=CSOMK/CS                                                    YMOTS     202
      FACT=SQRT(1.0-RATIO*RATIO)                                        YMOTS     203
      ANGX=ATAN(RATIO/FACT)                                             YMOTS     204
      D=(ANGX+RATIO*FACT)*PI                                            YMOTS     205
  170 CONTINUE                                                          YMOTS     206
      XS=DDAT(JM+17)*D                                                  YMOTS     207
      XS=DDAT(JM+24)+DDAT(JM+17)*D                                      YMOTS     208
      DDAT(JM+23)=D                                                     YMOTS     209
      M=M+1                                                             YMOTS     210
C                                                                       YMOTS     211
      VMR=VREAL-DDAT(JM+18)*CDK8+XS*CDK9                                YMOTS     212
      VMI=VIMAG-DDAT(JM+18)*CDK9-XS*CDK8                                YMOTS     213
C                                                                       YMOTS     214
      VM=SQRT(VMR*VMR+VMI*VMI)                                          YMOTS     215
      CALL SATFU (VM,V1,V2,G1,G2,SFACT)                                 YMOTS     216
      XMMK=DDAT(JM+16)                                                  YMOTS     217
      XM=XMMK/SFACT                                                     YMOTS     218
      IF (M.EQ.1) GO TO 120                                             YMOTS     219
      IF (M.LT.50) GO TO 190                                            YMOTS     220
      WRITE(MSG(1),360) NOLD(KK),INAME(KN-2),INAME(KN-1),INAME(KN)      YMOTS     221
     1                 ,NDMC(K)                                         YMOTS     222
      WRITE(MSG(2),380)                                                 YMOTS     223
      WRITE(MSG(3),390)                                                 YMOTS     224
      CALL PRTMSG(3)                                                    YMOTS     225
  180 CONTINUE                                                          YMOTS     226
      CALL ASTOP('YMOTS: FATAL ERROR',18)                               YMOTS     227
  190 CONTINUE                                                          YMOTS     228
      S3=S                                                              YMOTS     229
      GO TO 120                                                         YMOTS     230
  200 CONTINUE                                                          YMOTS     231
C                                                                       YMOTS     232
C      STAIRS(KK)=STAIRS(KK)+CMPLX(0.0,Q/VT2)                           YMOTS     233
      PDM(2,K)=Q                                                        YMOTS     234
      PDM(2,K)=PDM(2,K)*DDAT(JM+11)/BASPC                               YMOTS     235
      PDM(1,K)=PDM(1,K)*DDAT(JM+11)/BASPC                               YMOTS     236
C                                                                       YMOTS     237
      RSK=DDAT(JM+18)                                                   YMOTS     238
      XS1K=DDAT(JM+21)                                                  YMOTS     239
C                                                                       YMOTS     240
      YS1=1.0/(RSK**2+XS1K**2)                                          YMOTS     241
      RSK0=RSK*YS1                                                      YMOTS     242
      XS1K0=XS1K*YS1                                                    YMOTS     243
      IF (MOTYPK.LE.3) THEN                                             YMOTS     244
         RSK=RSK0                                                       YMOTS     245
         XS1K=XS1K0                                                     YMOTS     246
      ELSE                                                              YMOTS     247
         WXBASE=DDAT(JM+13)                                             YMOTS     248
         AR=RR*WXBASE/(XM+XR)                                           YMOTS     249
         XSD=XM+XS-XS1K                                                 YMOTS     250
         TRSW=WXBASE*S/AR                                               YMOTS     251
         Z12=XSD/(TRSW*TRSW+1.0)                                        YMOTS     252
         Z11=Z12*TRSW                                                   YMOTS     253
         Z11=RSK+Z11                                                    YMOTS     254
         Z12=XS1K+Z12                                                   YMOTS     255
         YS1=1.0/(Z11**2+Z12**2)                                        YMOTS     256
         RSK=Z11*YS1                                                    YMOTS     257
         XS1K=Z12*YS1                                                   YMOTS     258
      END IF                                                            YMOTS     259
C                                                                       YMOTS     260
      TLMK=V1D*CDK8+V1Q*CDK9                                            YMOTS     261
      ILTYPE=IDDAT(JM+5)                                                YMOTS     262
      IF (ILTYPE.EQ.2) THEN                                             YMOTS     263
         ALL=DDAT(JM+7)                                                 YMOTS     264
         BLL=DDAT(JM+8)                                                 YMOTS     265
         DDAT(JM+9)=1.0-ALL*(1.0-S)**2-BLL*(1.0-S)                      YMOTS     266
      ELSE IF (ILTYPE.NE.3 .AND.ILTYPE.LT.3) THEN                       YMOTS     267
         IF (ILTYPE.EQ.0) THEN                                          YMOTS     268
            IDDAT(JM+5)=1                                               YMOTS     269
         ELSE IF (ILTYPE.NE.1) THEN                                     YMOTS     270
            WRITE(MSG(1),360) NOLD(KK),INAME(KN-2),INAME(KN-1),INAME(KN)YMOTS     271
     1                       ,NDMC(K)                                   YMOTS     272
            WRITE(MSG(2),400)                                           YMOTS     273
            WRITE(MSG(3),410)                                           YMOTS     274
            CALL PRTMSG(3)                                              YMOTS     275
            IDDAT(JM+5)=1                                               YMOTS     276
            DDAT(JM+7)=2.0                                              YMOTS     277
         END IF                                                         YMOTS     278
         IF (DDAT(JM+7).LE.0.0) DDAT(JM+7)=2.0                          YMOTS     279
         IF (LOS) THEN                                                  YMOTS     280
           DDAT(JM+9)=1.0                                               YMOTS     281
         ELSE                                                           YMOTS     282
           EXPN=DDAT(JM+7)                                              YMOTS     283
           EXPM=DDAT(JM+8)                                              YMOTS     284
           COEK2=DDAT(JM+10)                                            YMOTS     285
           DDAT(JM+9)=(1.0-COEK2*S**EXPM)/((1.0-S)**EXPN)               YMOTS     286
         ENDIF                                                          YMOTS     287
      ELSE IF (ILTYPE.EQ.3) THEN                                        YMOTS     288
C CHECK POWER AND TORQUE FOR GENERATOR (BOTH SHOULD BE -VE)             YMOTS     289
         IF ((PDM(1,K)*TLMK) .LT. 0.0) THEN                             YMOTS     290
           WRITE(MSG(1),360) NOLD(KK),INAME(KN-2),INAME(KN-1),INAME(KN) YMOTS     291
     1                 ,NDMC(K)                                         YMOTS     292
           WRITE(MSG(2),440)                                            YMOTS     293
           GOTO 180                                                     YMOTS     294
         END IF                                                         YMOTS     295
      END IF                                                            YMOTS     296
C                                                                       YMOTS     297
C   FOSSIL FIRED PLANT MOTOR                                            YMOTS     298
C                                                                       YMOTS     299
      IF(ILTYPE.EQ.4)THEN                                               YMOTS     300
C                                                                       YMOTS     301
        NR=IDDAT(JM+36)                                                 YMOTS     302
        ITQN=IDDAT(JM+37)+NR                                            YMOTS     303
        ISPD=IDDAT(JM+38)+NR                                            YMOTS     304
        DDAT(ISPD)=1.0-S                                                YMOTS     305
        DDAT(ITQN)=TLMK                                                 YMOTS     306
        ITQK=IDDAT(JM+37)+1                                             YMOTS     307
        IF(ITQK.EQ.318)THEN                                             YMOTS     308
          DDAT(NR+311)=DDAT(ISPD)*DDAT(ISPD+1)                          YMOTS     309
          DDAT(NR+ITQK)=DDAT(ITQN)*DDAT(NR+314)*DDAT(ISPD)*DDAT(NR+309) YMOTS     310
     &                  /(DDAT(NR+300)*DDAT(NR+265))                    YMOTS     311
        ENDIF                                                           YMOTS     312
        IF(ITQK.EQ.258)THEN                                             YMOTS     313
          XDASH=DDAT(NR+197)/(DDAT(NR+6)*DDAT(NR+241))                  YMOTS     314
          DDAT(NR+ITQK)=DDAT(ITQN)*DDAT(NR+254)*DDAT(NR+253)*XDASH/     YMOTS     315
     &                  (DDAT(NR+3)*DDAT(NR+205))                       YMOTS     316
        ENDIF                                                           YMOTS     317
        IF(ITQK.EQ.155)THEN                                             YMOTS     318
          DDAT(NR+ITQK)=DDAT(ITQN)*DDAT(NR+151)*DDAT(NR+150)/           YMOTS     319
     &                  (DDAT(NR+106)*DDAT(NR+113))                     YMOTS     320
        ENDIF                                                           YMOTS     321
      ENDIF                                                             YMOTS     322
C                                                                       YMOTS     323
C    CANDU PLANT MOTOR                                                  YMOTS     324
C                                                                       YMOTS     325
      IF(ILTYPE.EQ.5)THEN                                               YMOTS     326
C                                                                       YMOTS     327
        NR=IDDAT(JM+36)                                                 YMOTS     328
        ITQN=IDDAT(JM+37)+NR                                            YMOTS     329
        ISPD=IDDAT(JM+38)+NR                                            YMOTS     330
        DDAT(ISPD)=1.0-S                                                YMOTS     331
        DDAT(ITQN)=TLMK                                                 YMOTS     332
C        ITQK=IDDAT(JM+37)-1                                            YMOTS     333
        IF(IDDAT(JM+37).EQ.509)THEN                                     YMOTS     334
          DDAT(ITQN-1)=DDAT(ITQN)*DDAT(NR+512)*DDAT(ISPD)               YMOTS     335
     &                  /(DDAT(NR+ 68)*DDAT(NR+ 88))                    YMOTS     336
        ENDIF                                                           YMOTS     337
        IF(IDDAT(JM+37).EQ.315)THEN                                     YMOTS     338
          DDAT(ITQN+1)=DDAT(ITQN)*DDAT(NR+312)*DDAT(ISPD)               YMOTS     339
     &                  /(DDAT(NR+298)*DDAT(NR+269))                    YMOTS     340
        ENDIF                                                           YMOTS     341
      ENDIF                                                             YMOTS     342
C                                                                       YMOTS     343
C     PWR PLANT MOTOR                                                   YMOTS     344
C                                                                       YMOTS     345
      IF(ILTYPE.EQ.6)THEN                                               YMOTS     346
C                                                                       YMOTS     347
        NR=IDDAT(JM+36)                                                 YMOTS     348
        ITQN=IDDAT(JM+37)+NR                                            YMOTS     349
        ISPD=IDDAT(JM+38)+NR                                            YMOTS     350
        DDAT(ISPD)=1.0-S                                                YMOTS     351
        DDAT(ITQN)=TLMK                                                 YMOTS     352
        IF(IDDAT(JM+37).EQ.563)THEN                                     YMOTS     353
          DDAT(ITQN-1)=DDAT(ITQN)*DDAT(NR+566)*DDAT(ISPD)               YMOTS     354
     &                  /(DDAT(NR+188)*DDAT(NR+213))                    YMOTS     355
        ENDIF                                                           YMOTS     356
        IF(IDDAT(JM+37).EQ.123)THEN                                     YMOTS     357
          DDAT(ITQN+1)=DDAT(ITQN)*DDAT(NR+120)*DDAT(NR+78)              YMOTS     358
     &                  /(DDAT(NR+104)*DDAT(NR+ 78))                    YMOTS     359
        ENDIF                                                           YMOTS     360
      ENDIF                                                             YMOTS     361
C                                                                       YMOTS     362
C                                                                       YMOTS     363
      DATMOT(K,1)=SFACT                                                 YMOTS     364
      DATMOT(K,2)=TLMK                                                  YMOTS     365
      DATMOT(K,3)=S                                                     YMOTS     366
      DATMOT(K,4)=RSK                                                   YMOTS     367
      DATMOT(K,5)=XS1K                                                  YMOTS     368
      DATMOT(K,6)=RSK0                                                  YMOTS     369
      DATMOT(K,7)=XS1K0                                                 YMOTS     370
      DATMOT(K,10)=V1D                                                  YMOTS     371
      DATMOT(K,11)=V1Q                                                  YMOTS     372
      DATMOT(K,12)=S                                                    YMOTS     373
C                                                                       YMOTS     374
      IF (IDDAT(JM+14).EQ.0) DDAT(JM+14)=-1.0                           YMOTS     375
      IF (DDAT(JM+14).GE.VT) THEN                                       YMOTS     376
         WRITE(MSG(1),360) NOLD(KK),INAME(KN-2),INAME(KN-1),INAME(KN)   YMOTS     377
     1                    ,NDMC(K)                                      YMOTS     378
         WRITE(MSG(2),420) DDAT(JM+14)                                  YMOTS     379
         WRITE(MSG(3),430) VT                                           YMOTS     380
         CALL PRTMSG(3)                                                 YMOTS     381
         DDAT(JM+14)=-1.0                                               YMOTS     382
      END IF                                                            YMOTS     383
      IF (DDAT(JM+15).LT.0.0) DDAT(JM+15)=0.0                           YMOTS     384
C                                                                       YMOTS     385
      RETURN                                                            YMOTS     386
C                                                                       YMOTS     387
  360 FORMAT(' *** ERROR INDUCTION MOTOR AT BUS ',I5,' NAME ',3A4       YMOTS     388
     1,' MID ',A4)                                                      YMOTS     389
  370 FORMAT('     NEWTON-RAPHSON FAILED TO CALCULATE SLIP.')           YMOTS     390
  380 FORMAT('     STEADY-STATE OPERATING POINT CAN NOT BE OBTAINED')   YMOTS     391
  390 FORMAT('     BASED ON THE SPECIFIED SATURATION CHARACTERISTIC.')  YMOTS     392
  400 FORMAT('     TYPE OF THE LOAD CHARACTERISTIC IS INVALID.')        YMOTS     393
  410 FORMAT('     IT IS SET TO TYPE 1 WITH EXPONENTIAL OF 2.0.')       YMOTS     394
  420 FORMAT('     THRESHOLD VOLTAGE (',F9.6,') FOR DROPPING THE MOTOR' YMOTS     395
     1,' IS GREATER THAN')                                              YMOTS     396
  430 FORMAT('     THE PRE-FAULT VOLTAGE (',F9.6,'). THE DATA IS'       YMOTS     397
     1,' IGNORED.')                                                     YMOTS     398
  440 FORMAT('     CONFLICT IN MACHINE POWER AND CALCULATED TORQUE.')   YMOTS     399
      END                                                               YMOTS     400
