CFPRIME UPSTAT                                                          UPSTAT      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 UPSTAT                                                 UPSTAT      3
CD                                                                      UPSTAT      4
CD    TO UPDATE THE STATES OF THE SYSTEM AT THE END OF ONE ITERATION    UPSTAT      5
CD    IN THE TRAPEZOIDAL METHOD, BASED ON THE COMPUTED RESIDUES AND     UPSTAT      6
CD    SYSTEM VOLTAGES. THE MAJOR COMPUTATIONS INVOLVED ARE:             UPSTAT      7
CD                                                                      UPSTAT      8
CD    1. UPDATE STATES FOR ALL DYNAMIC DEVICES IN THE SYSTEM (EXCEPT    UPSTAT      9
CD       FOR DC LINKS)                                                  UPSTAT     10
CD                                                                      UPSTAT     11
CD    2. CHECK NON-WINDUP LIMITS IN CONTROL SYSTEMS                     UPSTAT     12
CD                                                                      UPSTAT     13
CD    3. UPDATE THE CURRENT INJECTIONS FOR USE IN THE NEXT ITERATION    UPSTAT     14
CD                                                                      UPSTAT     15
      INCLUDE 'PARX.INS'                                                UPSTAT     16
      INCLUDE 'CNPT.INS'                                                UPSTAT     17
      INCLUDE 'CNB3.INS'                                                UPSTAT     18
      INCLUDE 'CNB4.INS'                                                UPSTAT     19
      INCLUDE 'CNB5.INS'                                                UPSTAT     20
      INCLUDE 'CNB6.INS'                                                UPSTAT     21
      INCLUDE 'CNB8.INS'                                                UPSTAT     22
      INCLUDE 'CNEXC.INS'                                               UPSTAT     23
      INCLUDE 'CNSVS.INS'                                               UPSTAT     24
      INCLUDE 'CNUDM.INS'                                               UPSTAT     25
      INCLUDE 'CNRAN.INS'                                               UPSTAT     26
      INCLUDE 'CNSTP.INS'                                               UPSTAT     27
      INCLUDE 'CNSDB.INS'                                               UPSTAT     28
      INCLUDE 'CNIPTR.INS'                                              UPSTAT     29
      INCLUDE 'CNVOLT.INS'                                              UPSTAT     30
      INCLUDE 'CNXSTA.INS'                                              UPSTAT     31
      INCLUDE 'CNYVAR.INS'                                              UPSTAT     32
      INCLUDE 'CNUVAR.INS'                                              UPSTAT     33
      INCLUDE 'CNMDAT.INS'                                              UPSTAT     34
      INCLUDE 'CNMSTA.INS'                                              UPSTAT     35
      INCLUDE 'CNMPAR.INS'                                              UPSTAT     36
      INCLUDE 'CNMYVA.INS'                                              UPSTAT     37
      INCLUDE 'CNPREV.INS'                                              UPSTAT     38
      INCLUDE 'CNXDOT.INS'                                              UPSTAT     39
      INCLUDE 'CNIMPR.INS'                                              UPSTAT     40
      INCLUDE 'CNJCOB.INS'                                              UPSTAT     41
      INCLUDE 'CNGOVE.INS'                                              UPSTAT     42
C                                                                       UPSTAT     43
      REAL XUPD(NSID)                                                   UPSTAT     44
      DIMENSION EWS2(2)                                                 UPSTAT     45
      COMPLEX CWS1                                                      UPSTAT     46
      EQUIVALENCE (CWS1,EWS2(1)),(EWS2(1),VREAL),(EWS2(2),VIMAG)        UPSTAT     47
C                                                                       UPSTAT     48
C     DETAILED MACHINE                                                  UPSTAT     49
C                                                                       UPSTAT     50
      ICHPLP=0                                                          UPSTAT     51
      IAIDEX=0                                                          UPSTAT     52
      IBIDEX=0                                                          UPSTAT     53
      ICIDEX=0                                                          UPSTAT     54
      N=0                                                               UPSTAT     55
      DO 100 I=1,IPNODE                                                 UPSTAT     56
C                                                                       UPSTAT     57
         CWS1=VOLT(I)                                                   UPSTAT     58
         EPD=VREAL                                                      UPSTAT     59
         EPQ=VIMAG                                                      UPSTAT     60
         CWS1=VOLT(I)-OVOLT(I)                                          UPSTAT     61
         DEPD=VREAL                                                     UPSTAT     62
         DEPQ=VIMAG                                                     UPSTAT     63
C                                                                       UPSTAT     64
         L=0                                                            UPSTAT     65
 114     L=L+1                                                          UPSTAT     66
         N=N+1                                                          UPSTAT     67
         JG=JCONTA(1,N)                                                 UPSTAT     68
         JYG=MYVAR(1,N)                                                 UPSTAT     69
         JSM=MSTATE(1,N)                                                UPSTAT     70
         ISTATE=MSTATE(1,N+1)-JSM                                       UPSTAT     71
         IGENS=ICONTA(1,N)                                              UPSTAT     72
         IGVN=ICONTA(2,N)                                               UPSTAT     73
         IF(IGVN.EQ.46) IGVN=0                                          UPSTAT     74
C                                                                       UPSTAT     75
         HM=DDAT(JG+1)                                                  UPSTAT     76
C                                                                       UPSTAT     77
         IF (IGENS.EQ.4) THEN                                           UPSTAT     78
C                                                                       UPSTAT     79
C     CLASSICAL MACHINE                                                 UPSTAT     80
C                                                                       UPSTAT     81
            IF (IGVN.EQ.0) THEN                                         UPSTAT     82
               IF (HM.LT.1.0E-5) THEN                                   UPSTAT     83
                  IAIDEX=IAIDEX+4                                       UPSTAT     84
                  IBIDEX=IBIDEX+2                                       UPSTAT     85
                  ICIDEX=ICIDEX+2                                       UPSTAT     86
                  GOTO 110                                              UPSTAT     87
               END IF                                                   UPSTAT     88
               RES1=XRES(JSM+1)+BJCOB(IBIDEX+1)*DEPD+                   UPSTAT     89
     *                          BJCOB(IBIDEX+2)*DEPQ                    UPSTAT     90
               RES2=XRES(JSM+2)                                         UPSTAT     91
               XSTATE(JSM+1)=XSTATE(JSM+1)-AJCOB(IAIDEX+1)*RES1         UPSTAT     92
     *                                    -AJCOB(IAIDEX+2)*RES2         UPSTAT     93
               XSTATE(JSM+2)=XSTATE(JSM+2)-AJCOB(IAIDEX+3)*RES1         UPSTAT     94
     *                                    -AJCOB(IAIDEX+4)*RES2         UPSTAT     95
               DELTA=XSTATE(JSM+2)                                      UPSTAT     96
               CDG(1,N)=EMG(JYG+4)*SIN(DELTA)                           UPSTAT     97
               CDG(2,N)=-EMG(JYG+4)*COS(DELTA)                          UPSTAT     98
C                                                                       UPSTAT     99
               IAIDEX=IAIDEX+4                                          UPSTAT    100
               IBIDEX=IBIDEX+2                                          UPSTAT    101
               ICIDEX=ICIDEX+2                                          UPSTAT    102
C                                                                       UPSTAT    103
               GOTO 110                                                 UPSTAT    104
            ELSE                                                        UPSTAT    105
C                                                                       UPSTAT    106
               IF (HM.LT.1.0E-5) THEN                                   UPSTAT    107
                  IAIDEX=IAIDEX+ISTATE*ISTATE                           UPSTAT    108
                  IBIDEX=IBIDEX+2*ISTATE                                UPSTAT    109
                  ICIDEX=ICIDEX+2*ISTATE                                UPSTAT    110
                  GOTO 110                                              UPSTAT    111
               END IF                                                   UPSTAT    112
               DO 315 IRR=1,ISTATE                                      UPSTAT    113
                  IWS1=JSM+IRR                                          UPSTAT    114
                  XUPD(IRR)=XSTATE(IWS1)-DPFACT*XRES(IWS1)              UPSTAT    115
  315          CONTINUE                                                 UPSTAT    116
C                                                                       UPSTAT    117
               DO 325 IRR=1,ISTATE                                      UPSTAT    118
                  IBIDEX=IBIDEX+2                                       UPSTAT    119
                  WS1=BJCOB(IBIDEX-1)*DEPD+BJCOB(IBIDEX)*DEPQ           UPSTAT    120
                  XUPD(IRR)=XUPD(IRR)-DPFACT*WS1                        UPSTAT    121
  325          CONTINUE                                                 UPSTAT    122
C                                                                       UPSTAT    123
               IAIDEX=IAIDEX+ISTATE*ISTATE                              UPSTAT    124
               ICIDEX=ICIDEX+2*ISTATE                                   UPSTAT    125
C                                                                       UPSTAT    126
            END IF                                                      UPSTAT    127
C                                                                       UPSTAT    128
         ELSE                                                           UPSTAT    129
C                                                                       UPSTAT    130
C     DETAILED MACHINE                                                  UPSTAT    131
C                                                                       UPSTAT    132
            MD=IDDAT(JG+34)                                             UPSTAT    133
            MQ=IDDAT(JG+35)                                             UPSTAT    134
            IF (HM.LT.1.0E-5) THEN                                      UPSTAT    135
               IAIDEX=IAIDEX+ISTATE+2                                   UPSTAT    136
               ICIDEX=ICIDEX+2*(MD+MQ)                                  UPSTAT    137
  112          IBIDEX=IBIDEX+1                                          UPSTAT    138
               KS=IBJCOB(IBIDEX)                                        UPSTAT    139
               IF (KS.EQ.0) GOTO 110                                    UPSTAT    140
               IBIDEX=IBIDEX+2*ISTATE                                   UPSTAT    141
               GOTO 112                                                 UPSTAT    142
            END IF                                                      UPSTAT    143
C                                                                       UPSTAT    144
C     ADD TERM INVERSE(A)*XRES TO XSTATE                                UPSTAT    145
C     NOTE THAT INVERSE(A)*XRES IS ALREADY IN XRES                      UPSTAT    146
C                                                                       UPSTAT    147
            DO 115 IRR=1,ISTATE                                         UPSTAT    148
               IWS1=JSM+IRR                                             UPSTAT    149
               XUPD(IRR)=XSTATE(IWS1)-DPFACT*XRES(IWS1)                 UPSTAT    150
  115       CONTINUE                                                    UPSTAT    151
C                                                                       UPSTAT    152
C     ADD TERM INVERSE(A)*B*DELTA(V) TO XSTATE                          UPSTAT    153
C     NOTE THAT INVERSE(A)*B IS ALREADY IN BJCOB                        UPSTAT    154
C                                                                       UPSTAT    155
  120       IBIDEX=IBIDEX+1                                             UPSTAT    156
            KS=IBJCOB(IBIDEX)                                           UPSTAT    157
            IF (KS.EQ.0) GOTO 126                                       UPSTAT    158
            CWS1=VOLT(KS)-OVOLT(KS)                                     UPSTAT    159
            DEPD=VREAL                                                  UPSTAT    160
            DEPQ=VIMAG                                                  UPSTAT    161
C                                                                       UPSTAT    162
            DO 125 IRR=1,ISTATE                                         UPSTAT    163
               IBIDEX=IBIDEX+2                                          UPSTAT    164
               WS1=BJCOB(IBIDEX-1)*DEPD+BJCOB(IBIDEX)*DEPQ              UPSTAT    165
               XUPD(IRR)=XUPD(IRR)-DPFACT*WS1                           UPSTAT    166
  125       CONTINUE                                                    UPSTAT    167
            GOTO 120                                                    UPSTAT    168
C                                                                       UPSTAT    169
  126       CONTINUE                                                    UPSTAT    170
         END IF                                                         UPSTAT    171
C                                                                       UPSTAT    172
C     CHECK FOR THE POSSIBLE VIOLATION ON LIMITERS AND                  UPSTAT    173
C     DO THE NECESSARY MODIFICATIONS FOR XUPD                           UPSTAT    174
C                                                                       UPSTAT    175
C----------------------                                                 UPSTAT    176
C                                                                       UPSTAT    177
C      EXCITERS                                                         UPSTAT    178
C                                                                       UPSTAT    179
C----------------------                                                 UPSTAT    180
            IEXN=ICONTA(4,N)                                            UPSTAT    181
            IF (IEXN.EQ.0) GOTO 900                                     UPSTAT    182
            JYE=MYVAR(2,N)                                              UPSTAT    183
            JE=JCONTA(3,N)                                              UPSTAT    184
            JSE=MSTATE(2,N)                                             UPSTAT    185
            JSG=JSE-JSM                                                 UPSTAT    186
C                                                                       UPSTAT    187
            IF (IEXN.EQ.50) GOTO 550                                    UPSTAT    188
C                                                                       UPSTAT    189
C                  1   2   3   4   5   6   7   8   9   10  11           UPSTAT    190
            GOTO (210,210,230,240,230,260,270,280,290,300,600,          UPSTAT    191
C                                                                       UPSTAT    192
C                  12  13  14  15  16  17  18  19  20  21  22           UPSTAT    193
     *            600,600,340,350,600,600,600,600,600,600,600,          UPSTAT    194
C                                                                       UPSTAT    195
C                  23  24  25  26  27  28  29  30  31  32  33           UPSTAT    196
     *            600,600,600,600,600,600,600,500,510,520,600,          UPSTAT    197
C                                                                       UPSTAT    198
C                  34                                                   UPSTAT    199
     *            540), IEXN                                            UPSTAT    200
C                                                                       UPSTAT    201
C     TYPE 1 AND 2                                                      UPSTAT    202
C                                                                       UPSTAT    203
 210        IF (IDDAT(JE+16).EQ.0) THEN                                 UPSTAT    204
               ETR=1.0                                                  UPSTAT    205
            ELSE                                                        UPSTAT    206
               ET=SQRT(EPD*EPD+EPQ*EPQ)                                 UPSTAT    207
               ETR=ET/DDAT(JE+16)                                       UPSTAT    208
            END IF                                                      UPSTAT    209
            VRMAX=ETR*DDAT(JE+14)                                       UPSTAT    210
            VRMIN=ETR*DDAT(JE+15)                                       UPSTAT    211
            JSGC=JSG+4                                                  UPSTAT    212
            IF (XUPD(JSGC).GE.VRMAX) THEN                               UPSTAT    213
               XUPD(JSGC)=VRMAX                                         UPSTAT    214
            ELSE IF (XUPD(JSGC).LE.VRMIN) THEN                          UPSTAT    215
               XUPD(JSGC)=VRMIN                                         UPSTAT    216
            END IF                                                      UPSTAT    217
            GOTO 600                                                    UPSTAT    218
C                                                                       UPSTAT    219
C     TYPE 3 AND 5                                                      UPSTAT    220
C                                                                       UPSTAT    221
 230        JSGC=JSG+6                                                  UPSTAT    222
            IF (XUPD(JSGC).GE.DDAT(JE+14)) THEN                         UPSTAT    223
               XUPD(JSGC)=DDAT(JE+14)                                   UPSTAT    224
            ELSE IF (XUPD(JSGC).LE.DDAT(JE+15)) THEN                    UPSTAT    225
               XUPD(JSGC)=DDAT(JE+15)                                   UPSTAT    226
            END IF                                                      UPSTAT    227
            JSGC=JSG+7                                                  UPSTAT    228
            IF (XUPD(JSGC).LE.DDAT(JE+16)) THEN                         UPSTAT    229
               XUPD(JSGC)=DDAT(JE+16)                                   UPSTAT    230
            END IF                                                      UPSTAT    231
            GOTO 600                                                    UPSTAT    232
C                                                                       UPSTAT    233
C     TYPE 4                                                            UPSTAT    234
C                                                                       UPSTAT    235
 240        JSGC=JSG+4                                                  UPSTAT    236
            IF (XUPD(JSGC).GE.DDAT(JE+14)) THEN                         UPSTAT    237
               XUPD(JSGC)=DDAT(JE+14)                                   UPSTAT    238
            ELSE IF (XUPD(JSGC).LE.DDAT(JE+15)) THEN                    UPSTAT    239
               XUPD(JSGC)=DDAT(JE+15)                                   UPSTAT    240
            END IF                                                      UPSTAT    241
            JSEC=JSE+5                                                  UPSTAT    242
            JSGC=JSGC+1                                                 UPSTAT    243
C                                                                       UPSTAT    244
            XDD=DDAT(JE+21)-DDAT(JE+22)                                 UPSTAT    245
            SE=DDAT(JE+4)                                               UPSTAT    246
            VE=XSTATE(JSEC)                                             UPSTAT    247
            IF(ABS(VE).GT.0.0)SE=SE+DDAT(JE+6)*EXP(DDAT(JE+7)*VE)/VE    UPSTAT    248
            VEMAX=(DDAT(JE+27)-XDD*CFD(JYG+5))/SE                       UPSTAT    249
            IF (XUPD(JSGC).GE.VEMAX) THEN                               UPSTAT    250
               XUPD(JSGC)=VEMAX                                         UPSTAT    251
            ELSE IF (XUPD(JSGC).LE.DDAT(JE+16)) THEN                    UPSTAT    252
               XUPD(JSGC)=DDAT(JE+16)                                   UPSTAT    253
            END IF                                                      UPSTAT    254
            GOTO 600                                                    UPSTAT    255
C                                                                       UPSTAT    256
C     TYPE 6                                                            UPSTAT    257
C                                                                       UPSTAT    258
 260        JSGC=JSG+4                                                  UPSTAT    259
            IF (XUPD(JSGC).GE.DDAT(JE+14)) THEN                         UPSTAT    260
               XUPD(JSGC)=DDAT(JE+14)                                   UPSTAT    261
            ELSE IF (XUPD(JSGC).LE.DDAT(JE+15)) THEN                    UPSTAT    262
               XUPD(JSGC)=DDAT(JE+15)                                   UPSTAT    263
            END IF                                                      UPSTAT    264
            JSEC=JSE+5                                                  UPSTAT    265
            JSGC=JSGC+1                                                 UPSTAT    266
C                                                                       UPSTAT    267
            XDD=DDAT(JE+21)-DDAT(JE+22)                                 UPSTAT    268
            SE=DDAT(JE+4)                                               UPSTAT    269
            VE=XSTATE(JSEC)                                             UPSTAT    270
            IF(ABS(VE).GT.0.0)SE=SE+DDAT(JE+6)*EXP(DDAT(JE+7)*VE)/VE    UPSTAT    271
            VEMAX=(DDAT(JE+27)-XDD*CFD(JYG+5))/SE                       UPSTAT    272
            IF (XUPD(JSGC).GE.VEMAX) THEN                               UPSTAT    273
               XUPD(JSGC)=VEMAX                                         UPSTAT    274
            ELSE IF (XUPD(JSGC).LE.0.0) THEN                            UPSTAT    275
               XUPD(JSGC)=0.0                                           UPSTAT    276
            END IF                                                      UPSTAT    277
            GOTO 600                                                    UPSTAT    278
C                                                                       UPSTAT    279
C     TYPE 7                                                            UPSTAT    280
C                                                                       UPSTAT    281
 270        JSGC=JSG+4                                                  UPSTAT    282
            IF (XUPD(JSGC).GE.DDAT(JE+15)) THEN                         UPSTAT    283
               XUPD(JSGC)=DDAT(JE+15)                                   UPSTAT    284
            ELSE IF (XUPD(JSGC).LE.DDAT(JE+16)) THEN                    UPSTAT    285
               XUPD(JSGC)=DDAT(JE+16)                                   UPSTAT    286
            END IF                                                      UPSTAT    287
            JSGC=JSGC+1                                                 UPSTAT    288
            IF (XUPD(JSGC).GE.DDAT(JE+17)) THEN                         UPSTAT    289
               XUPD(JSGC)=DDAT(JE+17)                                   UPSTAT    290
            ELSE IF (XUPD(JSGC).LE.0.0) THEN                            UPSTAT    291
               XUPD(JSGC)=0.0                                           UPSTAT    292
            END IF                                                      UPSTAT    293
            GOTO 600                                                    UPSTAT    294
C                                                                       UPSTAT    295
C     TYPE 8                                                            UPSTAT    296
C                                                                       UPSTAT    297
 280        JSGC=JSG+4                                                  UPSTAT    298
            IF (XUPD(JSGC).GE.DDAT(JE+25)) THEN                         UPSTAT    299
               XUPD(JSGC)=DDAT(JE+25)                                   UPSTAT    300
            ELSE IF (XUPD(JSGC).LE.DDAT(JE+26)) THEN                    UPSTAT    301
               XUPD(JSGC)=DDAT(JE+26)                                   UPSTAT    302
            END IF                                                      UPSTAT    303
            JSGC=JSGC+1                                                 UPSTAT    304
            IF (XUPD(JSGC).GE.DDAT(JE+15)) THEN                         UPSTAT    305
               XUPD(JSGC)=DDAT(JE+15)                                   UPSTAT    306
            ELSE IF (XUPD(JSGC).LE.DDAT(JE+16)) THEN                    UPSTAT    307
               XUPD(JSGC)=DDAT(JE+16)                                   UPSTAT    308
            END IF                                                      UPSTAT    309
            GOTO 600                                                    UPSTAT    310
C                                                                       UPSTAT    311
C     TYPE 9                                                            UPSTAT    312
C                                                                       UPSTAT    313
 290        JSGC=JSG+2                                                  UPSTAT    314
            IF (XUPD(JSGC).GE.DDAT(JE+14)) THEN                         UPSTAT    315
               XUPD(JSGC)=DDAT(JE+14)                                   UPSTAT    316
            ELSE IF (XUPD(JSGC).LE.DDAT(JE+15)) THEN                    UPSTAT    317
               XUPD(JSGC)=DDAT(JE+15)                                   UPSTAT    318
            END IF                                                      UPSTAT    319
            GOTO 600                                                    UPSTAT    320
C                                                                       UPSTAT    321
C     TYPE 10                                                           UPSTAT    322
C                                                                       UPSTAT    323
 300        JSGC=JSG+3                                                  UPSTAT    324
            IF (XUPD(JSGC).GE.DDAT(JE+16)) THEN                         UPSTAT    325
               XUPD(JSGC)=DDAT(JE+16)                                   UPSTAT    326
            ELSE IF (XUPD(JSGC).LE.DDAT(JE+17)) THEN                    UPSTAT    327
               XUPD(JSGC)=DDAT(JE+17)                                   UPSTAT    328
            END IF                                                      UPSTAT    329
            VRFIN(JYE+3)=XUPD(JSGC)                                     UPSTAT    330
            GOTO 600                                                    UPSTAT    331
C                                                                       UPSTAT    332
C     TYPE 14                                                           UPSTAT    333
C                                                                       UPSTAT    334
 340        JSGC=JSG+4                                                  UPSTAT    335
C                                                                       UPSTAT    336
            IF (IDDAT(JE+17).EQ.0) THEN                                 UPSTAT    337
C                                                                       UPSTAT    338
            IF (XUPD(JSGC).GE.DDAT(JE+14)) THEN                         UPSTAT    339
               XUPD(JSGC)=DDAT(JE+14)                                   UPSTAT    340
            ELSE IF (XUPD(JSGC).LE.DDAT(JE+15)) THEN                    UPSTAT    341
               XUPD(JSGC)=DDAT(JE+15)                                   UPSTAT    342
            END IF                                                      UPSTAT    343
C                                                                       UPSTAT    344
            END IF                                                      UPSTAT    345
C                                                                       UPSTAT    346
            JSGC=JSG+5                                                  UPSTAT    347
            IF (XUPD(JSGC).LE.DDAT(JE+16)) THEN                         UPSTAT    348
               XUPD(JSGC)=DDAT(JE+16)                                   UPSTAT    349
            END IF                                                      UPSTAT    350
            JSGC=JSG+6                                                  UPSTAT    351
            IF (XUPD(JSGC).GE.DDAT(JE+31)) THEN                         UPSTAT    352
               XUPD(JSGC)=DDAT(JE+31)                                   UPSTAT    353
            ELSE IF (XUPD(JSGC).LE.0.0) THEN                            UPSTAT    354
               XUPD(JSGC)=0.0                                           UPSTAT    355
            END IF                                                      UPSTAT    356
            GOTO 600                                                    UPSTAT    357
C                                                                       UPSTAT    358
C     TYPE 15                                                           UPSTAT    359
C                                                                       UPSTAT    360
 350        JSGC=JSG+4                                                  UPSTAT    361
            IF (XUPD(JSGC).GE.DDAT(JE+11)) THEN                         UPSTAT    362
               XUPD(JSGC)=DDAT(JE+11)                                   UPSTAT    363
            ELSE IF (XUPD(JSGC).LE.DDAT(JE+12)) THEN                    UPSTAT    364
               XUPD(JSGC)=DDAT(JE+12)                                   UPSTAT    365
            END IF                                                      UPSTAT    366
            VRFIN(JYE+3)=XUPD(JSGC)                                     UPSTAT    367
            GOTO 600                                                    UPSTAT    368
C                                                                       UPSTAT    369
C     TYPE 30                                                           UPSTAT    370
C                                                                       UPSTAT    371
 500        JSGC=IDDAT(JE+34)                                           UPSTAT    372
            IF (JSGC.NE.0) THEN                                         UPSTAT    373
               IF (XUPD(JSGC).GE.DDAT(JE+25)) THEN                      UPSTAT    374
                  XUPD(JSGC)=DDAT(JE+25)                                UPSTAT    375
               END IF                                                   UPSTAT    376
            END IF                                                      UPSTAT    377
C                                                                       UPSTAT    378
            JSGC=IDDAT(JE+38)                                           UPSTAT    379
            IF (IDDAT(JE+3).NE.0) THEN                                  UPSTAT    380
C                                                                       UPSTAT    381
               IF (IDDAT(JE+12).EQ.0) THEN                              UPSTAT    382
                  VEMAX=DDAT(JE+10)-DDAT(JE+13)*CFD(JYG+5)              UPSTAT    383
                  VEMIN=DDAT(JE+11)+DDAT(JE+13)*CFD(JYG+5)              UPSTAT    384
               ELSE                                                     UPSTAT    385
                  VT=CABS(VOLT(I))                                      UPSTAT    386
                  VT=VT/DDAT(JE+12)                                     UPSTAT    387
                  VEMAX=DDAT(JE+10)*VT-DDAT(JE+13)*CFD(JYG+5)           UPSTAT    388
                  VEMIN=DDAT(JE+11)*VT+DDAT(JE+13)*CFD(JYG+5)           UPSTAT    389
               END IF                                                   UPSTAT    390
               IF (XUPD(JSGC).GE.VEMAX) THEN                            UPSTAT    391
                  XUPD(JSGC)=VEMAX                                      UPSTAT    392
               ELSE IF (XUPD(JSGC).LE.VEMIN) THEN                       UPSTAT    393
                  XUPD(JSGC)=VEMIN                                      UPSTAT    394
               END IF                                                   UPSTAT    395
C                                                                       UPSTAT    396
            END IF                                                      UPSTAT    397
            GOTO 600                                                    UPSTAT    398
C                                                                       UPSTAT    399
C     TYPE 31                                                           UPSTAT    400
C                                                                       UPSTAT    401
 510        JSGC=IDDAT(JE+26)                                           UPSTAT    402
            IF (JSGC.NE.0) THEN                                         UPSTAT    403
               IF (XUPD(JSGC).GE.DDAT(JE+25)) THEN                      UPSTAT    404
                  XUPD(JSGC)=DDAT(JE+25)                                UPSTAT    405
               END IF                                                   UPSTAT    406
            END IF                                                      UPSTAT    407
C                                                                       UPSTAT    408
            JSGC=IDDAT(JE+27)                                           UPSTAT    409
            IF (JSGC.NE.0) THEN                                         UPSTAT    410
               IF (XUPD(JSGC).GE.DDAT(JE+10)) THEN                      UPSTAT    411
                  XUPD(JSGC)=DDAT(JE+10)                                UPSTAT    412
               ELSE IF (XUPD(JSGC).LE.DDAT(JE+11)) THEN                 UPSTAT    413
                  XUPD(JSGC)=DDAT(JE+11)                                UPSTAT    414
               END IF                                                   UPSTAT    415
            END IF                                                      UPSTAT    416
            GOTO 600                                                    UPSTAT    417
C                                                                       UPSTAT    418
C     TYPE 32                                                           UPSTAT    419
C                                                                       UPSTAT    420
 520        JSGC=JSG+2                                                  UPSTAT    421
            IF (XUPD(JSGC).GE.DDAT(JE+30)) THEN                         UPSTAT    422
               XUPD(JSGC)=DDAT(JE+30)                                   UPSTAT    423
            ELSE IF (XUPD(JSGC).LE.DDAT(JE+31)) THEN                    UPSTAT    424
               XUPD(JSGC)=DDAT(JE+31)                                   UPSTAT    425
            END IF                                                      UPSTAT    426
C                                                                       UPSTAT    427
            JSGC=IDDAT(JE+45)                                           UPSTAT    428
            IF (IDDAT(JE+3).NE.0) THEN                                  UPSTAT    429
C                                                                       UPSTAT    430
            IF (IDDAT(JE+12).EQ.0) THEN                                 UPSTAT    431
               VEMAX=DDAT(JE+10)-DDAT(JE+13)*CFD(JYG+5)                 UPSTAT    432
               VEMIN=DDAT(JE+11)+DDAT(JE+13)*CFD(JYG+5)                 UPSTAT    433
            ELSE                                                        UPSTAT    434
               VT=CABS(VOLT(I))                                         UPSTAT    435
               VT=VT/DDAT(JE+12)                                        UPSTAT    436
               VEMAX=DDAT(JE+10)*VT-DDAT(JE+13)*CFD(JYG+5)              UPSTAT    437
               VEMIN=DDAT(JE+11)*VT+DDAT(JE+13)*CFD(JYG+5)              UPSTAT    438
            END IF                                                      UPSTAT    439
            IF (XUPD(JSGC).GE.VEMAX) THEN                               UPSTAT    440
               XUPD(JSGC)=VEMAX                                         UPSTAT    441
            ELSE IF (XUPD(JSGC).LE.VEMIN) THEN                          UPSTAT    442
               XUPD(JSGC)=VEMIN                                         UPSTAT    443
            END IF                                                      UPSTAT    444
            END IF                                                      UPSTAT    445
            VRFIN(JYE+3)=XUPD(JSGC)                                     UPSTAT    446
            GOTO 600                                                    UPSTAT    447
C                                                                       UPSTAT    448
C     TYPE 34                                                           UPSTAT    449
C                                                                       UPSTAT    450
 540        JSGC=JSG+2                                                  UPSTAT    451
            IF (XUPD(JSGC).GE.DDAT(JE+12)) THEN                         UPSTAT    452
               XUPD(JSGC)=DDAT(JE+12)                                   UPSTAT    453
            ELSE IF (XUPD(JSGC).LE.DDAT(JE+13)) THEN                    UPSTAT    454
               XUPD(JSGC)=DDAT(JE+13)                                   UPSTAT    455
            END IF                                                      UPSTAT    456
            GOTO 600                                                    UPSTAT    457
C                                                                       UPSTAT    458
C     TYPE 50 EXCITER -- USER DEFINED MODEL                             UPSTAT    459
C                                                                       UPSTAT    460
 550        CONTINUE                                                    UPSTAT    461
C                                                                       UPSTAT    462
C     CHECK NON-WINDUP LIMITERS                                         UPSTAT    463
C                                                                       UPSTAT    464
            JE1=JE+9                                                    UPSTAT    465
            NRBUS=IDDAT(JE1)                                            UPSTAT    466
            JE2=JE1+3*NRBUS+1                                           UPSTAT    467
            NRLIN=IDDAT(JE2)                                            UPSTAT    468
            JE3=JE2+4*NRLIN+1                                           UPSTAT    469
            NUDB=IDDAT(JE3)                                             UPSTAT    470
            JE4=JE3+17*NUDB+1                                           UPSTAT    471
            JE5=JE4+3*NUDB+1                                            UPSTAT    472
            INTUD=IDDAT(JE5)                                            UPSTAT    473
            JE6=JE5+2*INTUD+1                                           UPSTAT    474
            INPUD=IDDAT(JE6)                                            UPSTAT    475
            JE7=JE6+3*INPUD                                             UPSTAT    476
C                                                                       UPSTAT    477
            CALL UDMNW2(1,JSM,XUPD)                                     UPSTAT    478
C                                                                       UPSTAT    479
  600       CONTINUE                                                    UPSTAT    480
C                                                                       UPSTAT    481
C----------------------                                                 UPSTAT    482
C                                                                       UPSTAT    483
C      STABILIZERS                                                      UPSTAT    484
C                                                                       UPSTAT    485
C----------------------                                                 UPSTAT    486
            ISTABN=ICONTA(5,N)                                          UPSTAT    487
            IF (ISTABN.LE.0) GOTO 900                                   UPSTAT    488
            JS=JCONTA(4,N)                                              UPSTAT    489
C                                                                       UPSTAT    490
            IF (ISTABN.EQ.50) GOTO 710                                  UPSTAT    491
C                                                                       UPSTAT    492
C                  1   2   3   4   5   6   7   8   9   10  11           UPSTAT    493
            GOTO (900,700,700,900,700,700,900,900,900,900,900,          UPSTAT    494
C                                                                       UPSTAT    495
C                  12                                                   UPSTAT    496
     *            900), ISTABN                                          UPSTAT    497
C                                                                       UPSTAT    498
C     TYPE 2, 3, 5 AND 6                                                UPSTAT    499
C                                                                       UPSTAT    500
 700        IF (ISTABN.LT.4) THEN                                       UPSTAT    501
               JSGC=IDDAT(JS+26)                                        UPSTAT    502
            ELSE                                                        UPSTAT    503
               JSGC=IDDAT(JS+27)                                        UPSTAT    504
            END IF                                                      UPSTAT    505
            IF (XUPD(JSGC).GE.DDAT(JS+21)) THEN                         UPSTAT    506
               XUPD(JSGC)=DDAT(JS+21)                                   UPSTAT    507
            END IF                                                      UPSTAT    508
            GOTO 900                                                    UPSTAT    509
C                                                                       UPSTAT    510
C     TYPE 50 STABILIZER -- USER DEFINED MODEL                          UPSTAT    511
C                                                                       UPSTAT    512
 710        CONTINUE                                                    UPSTAT    513
C                                                                       UPSTAT    514
C     CHECK NON-WINDUP LIMITERS                                         UPSTAT    515
C                                                                       UPSTAT    516
            JE1=JS+9                                                    UPSTAT    517
            NRBUS=IDDAT(JE1)                                            UPSTAT    518
            JE2=JE1+3*NRBUS+1                                           UPSTAT    519
            NRLIN=IDDAT(JE2)                                            UPSTAT    520
            JE3=JE2+4*NRLIN+1                                           UPSTAT    521
            NUDB=IDDAT(JE3)                                             UPSTAT    522
            JE4=JE3+17*NUDB+1                                           UPSTAT    523
            JE5=JE4+3*NUDB+1                                            UPSTAT    524
            INTUD=IDDAT(JE5)                                            UPSTAT    525
            JE6=JE5+2*INTUD+1                                           UPSTAT    526
            INPUD=IDDAT(JE6)                                            UPSTAT    527
            JE7=JE6+3*INPUD                                             UPSTAT    528
C                                                                       UPSTAT    529
            CALL UDMNW2(0,JSM,XUPD)                                     UPSTAT    530
C                                                                       UPSTAT    531
 900        CONTINUE                                                    UPSTAT    532
C                                                                       UPSTAT    533
C----------------------                                                 UPSTAT    534
C                                                                       UPSTAT    535
C      GOVERNORS                                                        UPSTAT    536
C                                                                       UPSTAT    537
C----------------------                                                 UPSTAT    538
            IF (IGVN.EQ.0) GOTO 1500                                    UPSTAT    539
            JGG=JCONTA(2,N)                                             UPSTAT    540
            JSGV=MSTATE(5,N)                                            UPSTAT    541
            JSGVG=JSGV-JSM                                              UPSTAT    542
            JYP=MYVAR(5,N)                                              UPSTAT    543
C                                                                       UPSTAT    544
            IF (IGVN.EQ.50) GOTO 1250                                   UPSTAT    545
C                                                                       UPSTAT    546
            IF(IGVN.GT.40.AND.IGVN.LT.50) GOTO 1500                     UPSTAT    547
C                                                                       UPSTAT    548
C   IEEE SIMPLIFIED BOILER MODEL TYPE 31,32,34,AND 35                   UPSTAT    549
C                                                                       UPSTAT    550
          IGVNB=0                                                       UPSTAT    551
          IF(IGVN.GE.31.AND.IGVN.LE.35) THEN                            UPSTAT    552
             IGVNB=IGVN                                                 UPSTAT    553
             IGVN=IGVN-30                                               UPSTAT    554
          END IF                                                        UPSTAT    555
C                                                                       UPSTAT    556
C                   1    2    3    4    5    6    7    8                UPSTAT    557
            GOTO (1010,1010,1500,1040,1500,1060,1060,1500,              UPSTAT    558
C                                                                       UPSTAT    559
C                   9   10   11   12   13   14   15   16                UPSTAT    560
     *            1500,1500,1500,1500,1500,1500,1500,1500,              UPSTAT    561
C                                                                       UPSTAT    562
C                  17   18   19   20   21   22                          UPSTAT    563
     *            1500,1500,1500,1200,1210,1500), IGVN                  UPSTAT    564
C                                                                       UPSTAT    565
C     TYPE 1 AND 2 , 31 AND 32                                          UPSTAT    566
C                                                                       UPSTAT    567
1010        JSGVGC=JSGVG+5                                              UPSTAT    568
            IF (XUPD(JSGVGC).GE.1.0) THEN                               UPSTAT    569
               XUPD(JSGVGC)=1.0                                         UPSTAT    570
            ELSE IF (XUPD(JSGVGC).LE.0.0) THEN                          UPSTAT    571
               XUPD(JSGVGC)=0.0                                         UPSTAT    572
            END IF                                                      UPSTAT    573
            JSGVGC=JSGVG+8                                              UPSTAT    574
            IF (XUPD(JSGVGC).GE.1.0) THEN                               UPSTAT    575
               XUPD(JSGVGC)=1.0                                         UPSTAT    576
            ELSE IF (XUPD(JSGVGC).LE.0.0) THEN                          UPSTAT    577
               XUPD(JSGVGC)=0.0                                         UPSTAT    578
            END IF                                                      UPSTAT    579
            IF (IGVNB.NE.0) THEN                                        UPSTAT    580
               JGGB=JGG+78                                              UPSTAT    581
               JSGVGC=JSGVG+19                                          UPSTAT    582
               IF (XUPD(JSGVGC).GE.DDAT(JGGB+11)) THEN                  UPSTAT    583
                  XUPD(JSGVGC)=DDAT(JGGB+11)                            UPSTAT    584
               ELSE IF (XUPD(JSGVGC).LE.DDAT(JGGB+10)) THEN             UPSTAT    585
                  XUPD(JSGVGC)=DDAT(JGGB+10)                            UPSTAT    586
               END IF                                                   UPSTAT    587
               IGVN=IGVNB                                               UPSTAT    588
            END IF                                                      UPSTAT    589
            GOTO 1500                                                   UPSTAT    590
C                                                                       UPSTAT    591
C     TYPE 4 ,34 & 35                                                   UPSTAT    592
C                                                                       UPSTAT    593
1040        JSGVGC=JSGVG+2                                              UPSTAT    594
            IF (XUPD(JSGVGC).GE.1.0) THEN                               UPSTAT    595
               XUPD(JSGVGC)=1.0                                         UPSTAT    596
            ELSE IF (XUPD(JSGVGC).LE.0.0) THEN                          UPSTAT    597
               XUPD(JSGVGC)=0.0                                         UPSTAT    598
            END IF                                                      UPSTAT    599
            IF (IGVNB.NE.0) THEN                                        UPSTAT    600
               JGGB=JGG+16                                              UPSTAT    601
               JSGVGC=JSGVG+15                                          UPSTAT    602
               IF (XUPD(JSGVGC).GE.DDAT(JGGB+11)) THEN                  UPSTAT    603
                  XUPD(JSGVGC)=DDAT(JGGB+11)                            UPSTAT    604
               ELSE IF (XUPD(JSGVGC).LE.DDAT(JGGB+10)) THEN             UPSTAT    605
                  XUPD(JSGVGC)=DDAT(JGGB+10)                            UPSTAT    606
               END IF                                                   UPSTAT    607
               IGVN=IGVNB                                               UPSTAT    608
            END IF                                                      UPSTAT    609
            GOTO 1500                                                   UPSTAT    610
C                                                                       UPSTAT    611
C     TYPE 6 AND 7                                                      UPSTAT    612
C                                                                       UPSTAT    613
1060        JSGVGC=JSGVG+1                                              UPSTAT    614
            IF (XUPD(JSGVGC).GE.1.0) THEN                               UPSTAT    615
               XUPD(JSGVGC)=1.0                                         UPSTAT    616
            ELSE IF (XUPD(JSGVGC).LE.DDAT(JGG+6)) THEN                  UPSTAT    617
               XUPD(JSGVGC)=DDAT(JGG+6)                                 UPSTAT    618
            END IF                                                      UPSTAT    619
            GOTO 1500                                                   UPSTAT    620
C                                                                       UPSTAT    621
C     TYPE 20                                                           UPSTAT    622
C                                                                       UPSTAT    623
1200        JSGVGC=JSGVG+1                                              UPSTAT    624
            IF (XUPD(JSGVGC).GE.1.0) THEN                               UPSTAT    625
               XUPD(JSGVGC)=1.0                                         UPSTAT    626
            ELSE IF (XUPD(JSGVGC).LE.0.0) THEN                          UPSTAT    627
               XUPD(JSGVGC)=0.0                                         UPSTAT    628
            END IF                                                      UPSTAT    629
            GOTO 1500                                                   UPSTAT    630
C                                                                       UPSTAT    631
C     TYPE 21                                                           UPSTAT    632
C                                                                       UPSTAT    633
1210        JSGVGC=JSGVG+1                                              UPSTAT    634
            IF (XUPD(JSGVGC).GE.DDAT(JGG+10)) THEN                      UPSTAT    635
               XUPD(JSGVGC)=DDAT(JGG+10)                                UPSTAT    636
            ELSE IF (XUPD(JSGVGC).LE.DDAT(JGG+11)) THEN                 UPSTAT    637
               XUPD(JSGVGC)=DDAT(JGG+11)                                UPSTAT    638
            END IF                                                      UPSTAT    639
            JSGVGC=JSGVG+2                                              UPSTAT    640
            IF (XUPD(JSGVGC).GE.DDAT(JGG+7)) THEN                       UPSTAT    641
               XUPD(JSGVGC)=DDAT(JGG+7)                                 UPSTAT    642
            ELSE IF (XUPD(JSGVGC).LE.DDAT(JGG+8)) THEN                  UPSTAT    643
               XUPD(JSGVGC)=DDAT(JGG+8)                                 UPSTAT    644
            END IF                                                      UPSTAT    645
            GOTO 1500                                                   UPSTAT    646
C                                                                       UPSTAT    647
C     TYPE 50 GOVERNOR -- USER DEFINED MODEL                            UPSTAT    648
C                                                                       UPSTAT    649
 1250       CONTINUE                                                    UPSTAT    650
C                                                                       UPSTAT    651
C     CHECK NON-WINDUP LIMITERS                                         UPSTAT    652
C                                                                       UPSTAT    653
            JE1=JGG+3                                                   UPSTAT    654
            NRBUS=IDDAT(JE1)                                            UPSTAT    655
            JE2=JE1+3*NRBUS+1                                           UPSTAT    656
            NRLIN=IDDAT(JE2)                                            UPSTAT    657
            JE3=JE2+4*NRLIN+1                                           UPSTAT    658
            NUDB=IDDAT(JE3)                                             UPSTAT    659
            JE4=JE3+17*NUDB+1                                           UPSTAT    660
            JE5=JE4+3*NUDB+1                                            UPSTAT    661
            INTUD=IDDAT(JE5)                                            UPSTAT    662
            JE6=JE5+2*INTUD+1                                           UPSTAT    663
            INPUD=IDDAT(JE6)                                            UPSTAT    664
            JE7=JE6+3*INPUD                                             UPSTAT    665
C                                                                       UPSTAT    666
            CALL UDMNW2(2,JSM,XUPD)                                     UPSTAT    667
C                                                                       UPSTAT    668
1500        CONTINUE                                                    UPSTAT    669
C                                                                       UPSTAT    670
C    UPDATE XSTATE ARRAY                                                UPSTAT    671
C                                                                       UPSTAT    672
            DO 150 IRR=1,ISTATE                                         UPSTAT    673
               IF (IXDOT(JSM+IRR).EQ.0) GOTO 150                        UPSTAT    674
               XSTATE(JSM+IRR)=XUPD(IRR)                                UPSTAT    675
 150        CONTINUE                                                    UPSTAT    676
C                                                                       UPSTAT    677
            IF (IGENS.EQ.4) GOTO 110                                    UPSTAT    678
C                                                                       UPSTAT    679
            CALL UVARB (N,JG,MD,MQ,JSM)                                 UPSTAT    680
            CDG(1,N)=UVAR(1,N)*EPD+UVAR(2,N)*EPQ-UVAR(5,N)              UPSTAT    681
            CDG(2,N)=UVAR(3,N)*EPD+UVAR(4,N)*EPQ-UVAR(6,N)              UPSTAT    682
C                                                                       UPSTAT    683
C     UPDATE COUNTERS                                                   UPSTAT    684
C                                                                       UPSTAT    685
            IAIDEX=IAIDEX+ISTATE+2                                      UPSTAT    686
            ICIDEX=ICIDEX+2*(MD+MQ)                                     UPSTAT    687
C                                                                       UPSTAT    688
 110     CONTINUE                                                       UPSTAT    689
         IF (L.LT.KTHGE(I)) GOTO 114                                    UPSTAT    690
 100  CONTINUE                                                          UPSTAT    691
C                                                                       UPSTAT    692
C     INDUCTION MOTOR                                                   UPSTAT    693
C                                                                       UPSTAT    694
C     NOTE THAT CLOAD MOTORS ARE NOT CONSIDERED YET NOW                 UPSTAT    695
C                                                                       UPSTAT    696
      IF (NMOTL.NE.0) THEN                                              UPSTAT    697
         DO 200 I=1,NMOTL                                               UPSTAT    698
            JM=JMDAT(I)                                                 UPSTAT    699
            MOTYPK=IDDAT(JM+1)                                          UPSTAT    700
            IF (DDAT(JM+15).LT.0.0) THEN                                UPSTAT    701
               IF (MOTYPK.GE.10) MOTYPK=MOTYPK-10                       UPSTAT    702
               IF (MOTYPK.LE.3) THEN                                    UPSTAT    703
                  IBIDEX=IBIDEX+8                                       UPSTAT    704
               ELSE                                                     UPSTAT    705
                  IBIDEX=IBIDEX+4                                       UPSTAT    706
               END IF                                                   UPSTAT    707
               GOTO 200                                                 UPSTAT    708
            END IF                                                      UPSTAT    709
            JZT=JXIMO(I)                                                UPSTAT    710
            JY=JVIMO(I)                                                 UPSTAT    711
            IBIDEX=IBIDEX+1                                             UPSTAT    712
            K=IBJCOB(IBIDEX)                                            UPSTAT    713
            IF (MOTYPK.LT.10) THEN                                      UPSTAT    714
               DEPD=REAL(VOLT(K))                                       UPSTAT    715
               DEPQ=AIMAG(VOLT(K))                                      UPSTAT    716
               CWS1=VOLT(K)-OVOLT(K)                                    UPSTAT    717
            ELSE                                                        UPSTAT    718
               WS1=REAL(VOLT(K))                                        UPSTAT    719
               WS2=AIMAG(VOLT(K))                                       UPSTAT    720
               VBARVR=DDAT(JM+39)                                       UPSTAT    721
               VBARVI=DDAT(JM+40)                                       UPSTAT    722
               DEPD=WS1*VBARVR-WS2*VBARVI                               UPSTAT    723
               DEPQ=WS1*VBARVI+WS2*VBARVR                               UPSTAT    724
               VREAL=DEPD-DDAT(JM+37)                                   UPSTAT    725
               VIMAG=DEPQ-DDAT(JM+38)                                   UPSTAT    726
               MOTYPK=MOTYPK-10                                         UPSTAT    727
            END IF                                                      UPSTAT    728
            IF (MOTYPK.LE.3) THEN                                       UPSTAT    729
               NOSAT=3                                                  UPSTAT    730
            ELSE                                                        UPSTAT    731
               NOSAT=1                                                  UPSTAT    732
            END IF                                                      UPSTAT    733
            DO 170 IRR=1,NOSAT                                          UPSTAT    734
               IBIDEX=IBIDEX+2                                          UPSTAT    735
               WS1=XRES(JZT+IRR)+BJCOB(IBIDEX-1)*VREAL                  UPSTAT    736
     +             +BJCOB(IBIDEX)*VIMAG                                 UPSTAT    737
               XUPD(IRR)=XSTATE(JZT+IRR)-(DPFACT*WS1)                   UPSTAT    738
 170        CONTINUE                                                    UPSTAT    739
            IBIDEX=IBIDEX+1                                             UPSTAT    740
            DO 190 IRR=1,NOSAT                                          UPSTAT    741
               IF (IXDOT(JZT+IRR).EQ.0) GOTO 190                        UPSTAT    742
               XSTATE(JZT+IRR)=XUPD(IRR)                                UPSTAT    743
 190        CONTINUE                                                    UPSTAT    744
C                                                                       UPSTAT    745
            GLK=GSM(JY+4)                                               UPSTAT    746
            BLK=BSM(JY+5)                                               UPSTAT    747
            IF (MOTYPK.LE.3) THEN                                       UPSTAT    748
               XM1=XSTATE(JZT+1)                                        UPSTAT    749
               XM2=XSTATE(JZT+2)                                        UPSTAT    750
            ELSE                                                        UPSTAT    751
               XM1=0.0                                                  UPSTAT    752
               XM2=0.0                                                  UPSTAT    753
            END IF                                                      UPSTAT    754
            CDM(JY+8)=GLK*(DEPD-XM1)+BLK*(DEPQ-XM2)                     UPSTAT    755
            CDM(JY+9)=GLK*(DEPQ-XM2)-BLK*(DEPD-XM1)                     UPSTAT    756
C                                                                       UPSTAT    757
            IF (MOTYPK.LE.3) THEN                                       UPSTAT    758
               IAIDEX=IAIDEX+10                                         UPSTAT    759
               ICIDEX=ICIDEX+6                                          UPSTAT    760
            ELSE                                                        UPSTAT    761
               IAIDEX=IAIDEX+2                                          UPSTAT    762
               ICIDEX=ICIDEX+2                                          UPSTAT    763
            END IF                                                      UPSTAT    764
 200     CONTINUE                                                       UPSTAT    765
      END IF                                                            UPSTAT    766
C                                                                       UPSTAT    767
C     TSC LOAD                                                          UPSTAT    768
C                                                                       UPSTAT    769
      IF (NTSCL.NE.0) THEN                                              UPSTAT    770
         DO 205 I=1,NTSCL                                               UPSTAT    771
            JTSC=JTCDAT(I)                                              UPSTAT    772
            JZT=JXTSC(I)                                                UPSTAT    773
            IBIDEX=IBIDEX+1                                             UPSTAT    774
            K=IBJCOB(IBIDEX)                                            UPSTAT    775
            DEPD=REAL(VOLT(K))                                          UPSTAT    776
            DEPQ=AIMAG(VOLT(K))                                         UPSTAT    777
            CWS1=VOLT(K)-OVOLT(K)                                       UPSTAT    778
            IBIDEX=IBIDEX+2                                             UPSTAT    779
            WS1=XRES(JZT+1)+BJCOB(IBIDEX-1)*VREAL                       UPSTAT    780
     +          +BJCOB(IBIDEX)*VIMAG                                    UPSTAT    781
            XUPD(1)=XSTATE(JZT+1)-(DPFACT*WS1)                          UPSTAT    782
            IBIDEX=IBIDEX+2                                             UPSTAT    783
            WS1=XRES(JZT+2)+BJCOB(IBIDEX-1)*VREAL                       UPSTAT    784
     +          +BJCOB(IBIDEX)*VIMAG                                    UPSTAT    785
            XUPD(2)=XSTATE(JZT+2)-(DPFACT*WS1)                          UPSTAT    786
            IBIDEX=IBIDEX+1                                             UPSTAT    787
            IF (IXDOT(JZT+1).NE.0) THEN                                 UPSTAT    788
               XSTATE(JZT+1)=XUPD(1)                                    UPSTAT    789
            END IF                                                      UPSTAT    790
            IF (IXDOT(JZT+2).NE.0) THEN                                 UPSTAT    791
               GMAX=DDAT(JTSC+7)                                        UPSTAT    792
               IF (XUPD(2).GE.GMAX) THEN                                UPSTAT    793
                  XUPD(2)=GMAX                                          UPSTAT    794
               ELSE IF (XUPD(2).LE.0.0) THEN                            UPSTAT    795
                  XUPD(2)=0.0                                           UPSTAT    796
               END IF                                                   UPSTAT    797
               XSTATE(JZT+2)=XUPD(2)                                    UPSTAT    798
            END IF                                                      UPSTAT    799
C                                                                       UPSTAT    800
            GTSC=DDAT(JTSC+11)                                          UPSTAT    801
C                                                                       UPSTAT    802
            IAIDEX=IAIDEX+4                                             UPSTAT    803
            ICIDEX=ICIDEX+4                                             UPSTAT    804
 205     CONTINUE                                                       UPSTAT    805
      END IF                                                            UPSTAT    806
C                                                                       UPSTAT    807
C     SVC                                                               UPSTAT    808
C                                                                       UPSTAT    809
      IF (NSVC.EQ.0) GOTO 1700                                          UPSTAT    810
C                                                                       UPSTAT    811
      DO 1710 I=1,NSVC                                                  UPSTAT    812
C                                                                       UPSTAT    813
         JS=JSDAT(I)                                                    UPSTAT    814
         JSM=JXSVR(I)                                                   UPSTAT    815
         ISTATE=JXSVR(I+1)-JSM                                          UPSTAT    816
         JY=JVSVR(I)                                                    UPSTAT    817
         NRTYPN=IDDAT(JS+9)                                             UPSTAT    818
C                                                                       UPSTAT    819
         IF (NRTYPN.EQ.6) GOTO 1710                                     UPSTAT    820
C                                                                       UPSTAT    821
         DO 1705 IRR=1,ISTATE                                           UPSTAT    822
            IWS1=JSM+IRR                                                UPSTAT    823
            XUPD(IRR)=XSTATE(IWS1)-DPFACT*XRES(IWS1)                    UPSTAT    824
 1705    CONTINUE                                                       UPSTAT    825
C                                                                       UPSTAT    826
 1715    IBIDEX=IBIDEX+1                                                UPSTAT    827
         KS=IBJCOB(IBIDEX)                                              UPSTAT    828
         IF (KS.EQ.0) GOTO 1725                                         UPSTAT    829
         CWS1=VOLT(KS)-OVOLT(KS)                                        UPSTAT    830
         DEPD=VREAL                                                     UPSTAT    831
         DEPQ=VIMAG                                                     UPSTAT    832
C                                                                       UPSTAT    833
         DO 1720 IRR=1,ISTATE                                           UPSTAT    834
            IBIDEX=IBIDEX+2                                             UPSTAT    835
            WS1=BJCOB(IBIDEX-1)*DEPD+BJCOB(IBIDEX)*DEPQ                 UPSTAT    836
            XUPD(IRR)=XUPD(IRR)-DPFACT*WS1                              UPSTAT    837
 1720    CONTINUE                                                       UPSTAT    838
         GOTO 1715                                                      UPSTAT    839
C                                                                       UPSTAT    840
 1725    CONTINUE                                                       UPSTAT    841
C                                                                       UPSTAT    842
         IF (NRTYPN.EQ.50) GOTO 1850                                    UPSTAT    843
C                                                                       UPSTAT    844
C                1    2    3                                            UPSTAT    845
         GOTO (1810,1820,1820), NRTYPN                                  UPSTAT    846
C                                                                       UPSTAT    847
C     TYPE 1                                                            UPSTAT    848
C                                                                       UPSTAT    849
 1810    IWS1=8                                                         UPSTAT    850
         IWS2=3                                                         UPSTAT    851
         GOTO 1900                                                      UPSTAT    852
C                                                                       UPSTAT    853
C     TYPE 2 AND 3                                                      UPSTAT    854
C                                                                       UPSTAT    855
 1820    IWS1=18                                                        UPSTAT    856
         IWS2=17                                                        UPSTAT    857
         GOTO 1900                                                      UPSTAT    858
C                                                                       UPSTAT    859
 1900    IF (IDDAT(JS+IWS1).NE.0) THEN                                  UPSTAT    860
            XMIN=-DDAT(JS+IWS2)                                         UPSTAT    861
            XMAX=1.0+XMIN                                               UPSTAT    862
            IF (XUPD(ISTATE).GE.XMAX) THEN                              UPSTAT    863
               XUPD(ISTATE)=XMAX                                        UPSTAT    864
            ELSE IF (XUPD(ISTATE).LE.XMIN) THEN                         UPSTAT    865
               XUPD(ISTATE)=XMIN                                        UPSTAT    866
            END IF                                                      UPSTAT    867
         END IF                                                         UPSTAT    868
         GOTO 1910                                                      UPSTAT    869
C                                                                       UPSTAT    870
C     TYPE 50 SVC -- USER DEFINED MODEL                                 UPSTAT    871
C                                                                       UPSTAT    872
 1850    CONTINUE                                                       UPSTAT    873
C                                                                       UPSTAT    874
C     CHECK NON-WINDUP LIMITERS                                         UPSTAT    875
C                                                                       UPSTAT    876
         JE1=JS+13                                                      UPSTAT    877
         NRBUS=IDDAT(JE1)                                               UPSTAT    878
         JE2=JE1+3*NRBUS+1                                              UPSTAT    879
         NRLIN=IDDAT(JE2)                                               UPSTAT    880
         JE3=JE2+4*NRLIN+1                                              UPSTAT    881
         NUDB=IDDAT(JE3)                                                UPSTAT    882
         JE4=JE3+17*NUDB+1                                              UPSTAT    883
         JE5=JE4+3*NUDB+1                                               UPSTAT    884
         INTUD=IDDAT(JE5)                                               UPSTAT    885
         JE6=JE5+2*INTUD+1                                              UPSTAT    886
         INPUD=IDDAT(JE6)                                               UPSTAT    887
         JE7=JE6+3*INPUD                                                UPSTAT    888
C                                                                       UPSTAT    889
         CALL UDMNW2(3,JSM,XUPD)                                        UPSTAT    890
C                                                                       UPSTAT    891
 1910    DO 1730 IRR=1,ISTATE                                           UPSTAT    892
            IF (IXDOT(JSM+IRR).EQ.0) GOTO 1730                          UPSTAT    893
            XSTATE(JSM+IRR)=XUPD(IRR)                                   UPSTAT    894
 1730    CONTINUE                                                       UPSTAT    895
C                                                                       UPSTAT    896
 1710 CONTINUE                                                          UPSTAT    897
C                                                                       UPSTAT    898
 1700 CONTINUE                                                          UPSTAT    899
C                                                                       UPSTAT    900
C     RANI                                                              UPSTAT    901
C                                                                       UPSTAT    902
      IF (NRANI.EQ.0) GOTO 2000                                         UPSTAT    903
C                                                                       UPSTAT    904
      DO 2010 I=1,NRANI                                                 UPSTAT    905
         JR=JRDAT(I)                                                    UPSTAT    906
         JSM=JXRAN(I)                                                   UPSTAT    907
         ISTATE=JXRAN(I+1)-JSM                                          UPSTAT    908
         JY=JVRAN(I)                                                    UPSTAT    909
         NRTYPN=IDDAT(JR+4)                                             UPSTAT    910
         IF (NRTYPN.NE.50) GO TO 2010                                   UPSTAT    911
C                                                                       UPSTAT    912
         DO 2020 IRR=1,ISTATE                                           UPSTAT    913
            IWS1=JSM+IRR                                                UPSTAT    914
            XUPD(IRR)=XSTATE(IWS1)-DPFACT*XRES(IWS1)                    UPSTAT    915
 2020    CONTINUE                                                       UPSTAT    916
C                                                                       UPSTAT    917
 2030    IBIDEX=IBIDEX+1                                                UPSTAT    918
         KS=IBJCOB(IBIDEX)                                              UPSTAT    919
         IF (KS.EQ.0) GOTO 2040                                         UPSTAT    920
         CWS1=VOLT(KS)-OVOLT(KS)                                        UPSTAT    921
         DEPD=VREAL                                                     UPSTAT    922
         DEPQ=VIMAG                                                     UPSTAT    923
C                                                                       UPSTAT    924
         DO 2050 IRR=1,ISTATE                                           UPSTAT    925
            IBIDEX=IBIDEX+2                                             UPSTAT    926
            WS1=BJCOB(IBIDEX-1)*DEPD+BJCOB(IBIDEX)*DEPQ                 UPSTAT    927
            XUPD(IRR)=XUPD(IRR)-DPFACT*WS1                              UPSTAT    928
 2050    CONTINUE                                                       UPSTAT    929
         GOTO 2030                                                      UPSTAT    930
C                                                                       UPSTAT    931
 2040    CONTINUE                                                       UPSTAT    932
C                                                                       UPSTAT    933
C     CHECK NON-WINDUP LIMITERS                                         UPSTAT    934
C                                                                       UPSTAT    935
         JE1=JR+12                                                      UPSTAT    936
         NRBUS=IDDAT(JE1)                                               UPSTAT    937
         JE2=JE1+3*NRBUS+1                                              UPSTAT    938
         NRLIN=IDDAT(JE2)                                               UPSTAT    939
         JE3=JE2+4*NRLIN+1                                              UPSTAT    940
         NUDB=IDDAT(JE3)                                                UPSTAT    941
         JE4=JE3+17*NUDB+1                                              UPSTAT    942
         JE5=JE4+3*NUDB+1                                               UPSTAT    943
         INTUD=IDDAT(JE5)                                               UPSTAT    944
         JE6=JE5+2*INTUD+1                                              UPSTAT    945
         INPUD=IDDAT(JE6)                                               UPSTAT    946
         JE7=JE6+3*INPUD                                                UPSTAT    947
C                                                                       UPSTAT    948
         CALL UDMNW2(3,JSM,XUPD)                                        UPSTAT    949
C                                                                       UPSTAT    950
         DO 2060 IRR=1,ISTATE                                           UPSTAT    951
            IF (IXDOT(JSM+IRR).EQ.0) GOTO 2060                          UPSTAT    952
            XSTATE(JSM+IRR)=XUPD(IRR)                                   UPSTAT    953
 2060    CONTINUE                                                       UPSTAT    954
C                                                                       UPSTAT    955
 2010 CONTINUE                                                          UPSTAT    956
C                                                                       UPSTAT    957
 2000 CONTINUE                                                          UPSTAT    958
C                                                                       UPSTAT    959
C     STP                                                               UPSTAT    960
C                                                                       UPSTAT    961
      IF (NTCPS.EQ.0) GOTO 2070                                         UPSTAT    962
C                                                                       UPSTAT    963
      DO 2080 I=1,NTCPS                                                 UPSTAT    964
         JTP=JTPDAT(I)                                                  UPSTAT    965
         NTTYPN=IDDAT(JTP+4)                                            UPSTAT    966
         NPTYPN=IDDAT(JTP+5)                                            UPSTAT    967
         IF (NTTYPN.NE.50.AND.NPTYPN.NE.50) GO TO 2080                  UPSTAT    968
C                                                                       UPSTAT    969
         JSM=JXSTC(I)                                                   UPSTAT    970
         ISTATE=JXSTC(I+1)-JSM                                          UPSTAT    971
         DO 2090 IRR=1,ISTATE                                           UPSTAT    972
            IWS1=JSM+IRR                                                UPSTAT    973
            XUPD(IRR)=XSTATE(IWS1)-DPFACT*XRES(IWS1)                    UPSTAT    974
 2090    CONTINUE                                                       UPSTAT    975
C                                                                       UPSTAT    976
 2100    IBIDEX=IBIDEX+1                                                UPSTAT    977
         KS=IBJCOB(IBIDEX)                                              UPSTAT    978
         IF (KS.EQ.0) GOTO 2110                                         UPSTAT    979
         CWS1=VOLT(KS)-OVOLT(KS)                                        UPSTAT    980
         DEPD=VREAL                                                     UPSTAT    981
         DEPQ=VIMAG                                                     UPSTAT    982
C                                                                       UPSTAT    983
         DO 2120 IRR=1,ISTATE                                           UPSTAT    984
            IBIDEX=IBIDEX+2                                             UPSTAT    985
            WS1=BJCOB(IBIDEX-1)*DEPD+BJCOB(IBIDEX)*DEPQ                 UPSTAT    986
            XUPD(IRR)=XUPD(IRR)-DPFACT*WS1                              UPSTAT    987
 2120    CONTINUE                                                       UPSTAT    988
         GOTO 2100                                                      UPSTAT    989
C                                                                       UPSTAT    990
 2110    CONTINUE                                                       UPSTAT    991
C                                                                       UPSTAT    992
C     CHECK NON-WINDUP LIMITERS                                         UPSTAT    993
C                                                                       UPSTAT    994
         IF (NTTYPN.EQ.50) THEN                                         UPSTAT    995
            JYTC=JVSTC(I)                                               UPSTAT    996
            JE1=JTDAT(I)+1                                              UPSTAT    997
            NRBUS=IDDAT(JE1)                                            UPSTAT    998
            JE2=JE1+3*NRBUS+1                                           UPSTAT    999
            NRLIN=IDDAT(JE2)                                            UPSTAT   1000
            JE3=JE2+4*NRLIN+1                                           UPSTAT   1001
            NUDB=IDDAT(JE3)                                             UPSTAT   1002
            JE4=JE3+17*NUDB+1                                           UPSTAT   1003
            JE5=JE4+3*NUDB+1                                            UPSTAT   1004
            INTUD=IDDAT(JE5)                                            UPSTAT   1005
            JE6=JE5+2*INTUD+1                                           UPSTAT   1006
            INPUD=IDDAT(JE6)                                            UPSTAT   1007
            JE7=JE6+3*INPUD                                             UPSTAT   1008
            CALL UDMNW2(4,JSM,XUPD)                                     UPSTAT   1009
         END IF                                                         UPSTAT   1010
C                                                                       UPSTAT   1011
         IF (NPTYPN.EQ.50) THEN                                         UPSTAT   1012
            JYPS=JVSPS(I)                                               UPSTAT   1013
            JSM1=JXSPS(I)                                               UPSTAT   1014
            JE1=JPDAT(I)+1                                              UPSTAT   1015
            NRBUS=IDDAT(JE1)                                            UPSTAT   1016
            JE2=JE1+3*NRBUS+1                                           UPSTAT   1017
            NRLIN=IDDAT(JE2)                                            UPSTAT   1018
            JE3=JE2+4*NRLIN+1                                           UPSTAT   1019
            NUDB=IDDAT(JE3)                                             UPSTAT   1020
            JE4=JE3+17*NUDB+1                                           UPSTAT   1021
            JE5=JE4+3*NUDB+1                                            UPSTAT   1022
            INTUD=IDDAT(JE5)                                            UPSTAT   1023
            JE6=JE5+2*INTUD+1                                           UPSTAT   1024
            INPUD=IDDAT(JE6)                                            UPSTAT   1025
            JE7=JE6+3*INPUD                                             UPSTAT   1026
            CALL UDMNW2(5,JSM1,XUPD)                                    UPSTAT   1027
         END IF                                                         UPSTAT   1028
C                                                                       UPSTAT   1029
         DO 2190 IRR=1,ISTATE                                           UPSTAT   1030
            IF (IXDOT(JSM+IRR).EQ.0) GOTO 2190                          UPSTAT   1031
            XSTATE(JSM+IRR)=XUPD(IRR)                                   UPSTAT   1032
 2190    CONTINUE                                                       UPSTAT   1033
                                                                        UPSTAT   1034
 2080 CONTINUE                                                          UPSTAT   1035
C                                                                       UPSTAT   1036
 2070 CONTINUE                                                          UPSTAT   1037
C                                                                       UPSTAT   1038
C     SDB                                                               UPSTAT   1039
C                                                                       UPSTAT   1040
      IF (NSDB.EQ.0) GOTO 2200                                          UPSTAT   1041
C                                                                       UPSTAT   1042
      DO 2210 I=1,NSDB                                                  UPSTAT   1043
         JD=JDDAT(I)                                                    UPSTAT   1044
         JSM=JXSDB(I)                                                   UPSTAT   1045
         ISTATE=JXSDB(I+1)-JSM                                          UPSTAT   1046
         JY=JVSDB(I)                                                    UPSTAT   1047
         NDTYPN=IDDAT(JD+2)                                             UPSTAT   1048
         IF (NDTYPN.NE.50) GO TO 2210                                   UPSTAT   1049
C                                                                       UPSTAT   1050
         DO 2220 IRR=1,ISTATE                                           UPSTAT   1051
            IWS1=JSM+IRR                                                UPSTAT   1052
            XUPD(IRR)=XSTATE(IWS1)-DPFACT*XRES(IWS1)                    UPSTAT   1053
 2220    CONTINUE                                                       UPSTAT   1054
C                                                                       UPSTAT   1055
 2230    IBIDEX=IBIDEX+1                                                UPSTAT   1056
         KS=IBJCOB(IBIDEX)                                              UPSTAT   1057
         IF (KS.EQ.0) GOTO 2240                                         UPSTAT   1058
         CWS1=VOLT(KS)-OVOLT(KS)                                        UPSTAT   1059
         DEPD=VREAL                                                     UPSTAT   1060
         DEPQ=VIMAG                                                     UPSTAT   1061
C                                                                       UPSTAT   1062
         DO 2250 IRR=1,ISTATE                                           UPSTAT   1063
            IBIDEX=IBIDEX+2                                             UPSTAT   1064
            WS1=BJCOB(IBIDEX-1)*DEPD+BJCOB(IBIDEX)*DEPQ                 UPSTAT   1065
            XUPD(IRR)=XUPD(IRR)-DPFACT*WS1                              UPSTAT   1066
 2250    CONTINUE                                                       UPSTAT   1067
         GOTO 2230                                                      UPSTAT   1068
C                                                                       UPSTAT   1069
 2240    CONTINUE                                                       UPSTAT   1070
C                                                                       UPSTAT   1071
C     CHECK NON-WINDUP LIMITERS                                         UPSTAT   1072
C                                                                       UPSTAT   1073
         JE1=JD+6                                                       UPSTAT   1074
         NRBUS=IDDAT(JE1)                                               UPSTAT   1075
         JE2=JE1+3*NRBUS+1                                              UPSTAT   1076
         NRLIN=IDDAT(JE2)                                               UPSTAT   1077
         JE3=JE2+4*NRLIN+1                                              UPSTAT   1078
         NUDB=IDDAT(JE3)                                                UPSTAT   1079
         JE4=JE3+17*NUDB+1                                              UPSTAT   1080
         JE5=JE4+3*NUDB+1                                               UPSTAT   1081
         INTUD=IDDAT(JE5)                                               UPSTAT   1082
         JE6=JE5+2*INTUD+1                                              UPSTAT   1083
         INPUD=IDDAT(JE6)                                               UPSTAT   1084
         JE7=JE6+3*INPUD                                                UPSTAT   1085
C                                                                       UPSTAT   1086
         CALL UDMNW2(6,JSM,XUPD)                                        UPSTAT   1087
C                                                                       UPSTAT   1088
         DO 2260 IRR=1,ISTATE                                           UPSTAT   1089
            IF (IXDOT(JSM+IRR).EQ.0) GOTO 2260                          UPSTAT   1090
            XSTATE(JSM+IRR)=XUPD(IRR)                                   UPSTAT   1091
 2260    CONTINUE                                                       UPSTAT   1092
C                                                                       UPSTAT   1093
 2210 CONTINUE                                                          UPSTAT   1094
C                                                                       UPSTAT   1095
 2200 CONTINUE                                                          UPSTAT   1096
C                                                                       UPSTAT   1097
      RETURN                                                            UPSTAT   1098
      END                                                               UPSTAT   1099
