CFPRIME NETSOL                                                          NETSOL      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 NETSOL (H,KVOLT,ITERMI,IPREF,IIL,NRSTEP)               NETSOL      3
CD                                                                      NETSOL      4
CD    TO SOLVE THE NETWORK ALGEBRAIC EQUATIONS                          NETSOL      5
CD                                                                      NETSOL      6
      INCLUDE 'PARX.INS'                                                NETSOL      7
      INCLUDE 'CNPT.INS'                                                NETSOL      8
      INCLUDE 'CNFLAG.INS'                                              NETSOL      9
      INCLUDE 'CNIPTR.INS'                                              NETSOL     10
      INCLUDE 'CNB0.INS'                                                NETSOL     11
      INCLUDE 'CNB1.INS'                                                NETSOL     12
      INCLUDE 'CNB3.INS'                                                NETSOL     13
      INCLUDE 'CNB4.INS'                                                NETSOL     14
      INCLUDE 'CNB5.INS'                                                NETSOL     15
      INCLUDE 'CNB6.INS'                                                NETSOL     16
      INCLUDE 'CNB8.INS'                                                NETSOL     17
      INCLUDE 'CNB9.INS'                                                NETSOL     18
      INCLUDE 'CNB10.INS'                                               NETSOL     19
      INCLUDE 'CNB19.INS'                                               NETSOL     20
      INCLUDE 'CNREN.INS'                                               NETSOL     21
      INCLUDE 'CNLSTA.INS'                                              NETSOL     22
      INCLUDE 'CNUVAR.INS'                                              NETSOL     23
      INCLUDE 'CNMPAR.INS'                                              NETSOL     24
      INCLUDE 'CNSVS.INS'                                               NETSOL     25
      INCLUDE 'CNRAN.INS'                                               NETSOL     26
      INCLUDE 'CNSTP.INS'                                               NETSOL     27
      INCLUDE 'CNSDB.INS'                                               NETSOL     28
      INCLUDE 'CNPARX.INS'                                              NETSOL     29
      INCLUDE 'CNMDAT.INS'                                              NETSOL     30
      INCLUDE 'CNXSTA.INS'                                              NETSOL     31
      INCLUDE 'CNCUR.INS'                                               NETSOL     32
      INCLUDE 'CNVOLT.INS'                                              NETSOL     33
      INCLUDE 'CNSPC1.INS'                                              NETSOL     34
      INCLUDE 'CNSPVI.INS'                                              NETSOL     35
      INCLUDE 'CNSPDI.INS'                                              NETSOL     36
      INCLUDE 'CNMSTA.INS'                                              NETSOL     37
      INCLUDE 'CNSPC0.INS'                                              NETSOL     38
      INCLUDE 'CNMYVA.INS'                                              NETSOL     39
      INCLUDE 'CNYVAR.INS'                                              NETSOL     40
C      INCLUDE 'NLTERM.INS/LIST'                                        NETSOL     41
      INCLUDE 'CNUNIT.INS'                                              NETSOL     42
      INCLUDE 'CNSTN.INS'                                               NETSOL     43
      INCLUDE 'CNNNEW.INS'                                              NETSOL     44
      INCLUDE 'CNULTC.INS'                                              NETSOL     45
      INCLUDE 'GRDC01.INS'                                              NETSOL     46
      INCLUDE 'GRDC03.INS'                                              NETSOL     47
      INCLUDE 'GRPDCS.INS'                                              NETSOL     48
      INCLUDE 'UDCF.INS'                                                NETSOL     49
      INCLUDE 'UDCJ.INS'                                                NETSOL     50
      INCLUDE 'CNLSMB.INS'                                              NETSOL     51
C                                                                       NETSOL     52
C--                                                                     NETSOL     53
      INCLUDE 'CNMASK.INS'                                              NETSOL     54
C--                                                                     NETSOL     55
      INCLUDE 'CNRED.INS'                                               NETSOL     56
C                                                                       NETSOL     57
      INCLUDE 'CNPREV.INS'                                              NETSOL     58
C                                                                       NETSOL     59
      LOGICAL IPREF,IVMG,INLBS,LDEB1,LDEB2,LDEB3                        NETSOL     60
      COMPLEX CUREAL(NB),YTCO,YTCA,YCONT,XICRRP,XICRRS                  NETSOL     61
      CHARACTER*56 PROUT1,PROUT2                                        NETSOL     62
      CHARACTER*80 MSG                                                  NETSOL     63
C                                                                       NETSOL     64
C      COMPLEX VOLBAR                                                   NETSOL     65
C      COMMON/MOTVOL/VOLBAR(NZL)                                        NETSOL     66
*IF -MI2                                                                NETSOL     67
      INTEGER*2 IVOLC                                                   NETSOL     68
*ENDIF                                                                  NETSOL     69
      COMMON/SCRAT8/CUREAL,IVOLC(NB),INLBS(NZL)                         NETSOL     70
C                                                                       NETSOL     71
      INCLUDE 'CNLCOM.INS'                                              NETSOL     72
C                                                                       NETSOL     73
      LOGICAL LIMFLT                                                    NETSOL     74
      COMMON /MOTVF/ VOLDRE(NMT), VOLDIM(NMT), BUSFRQ(NMT), TSPREV,     NETSOL     75
     &               GSMOLD, BSMOLD, LIMFLT                             NETSOL     76
C                                                                       NETSOL     77
      DATA HPI/1.570795/, DEGREE/57.29578/                              NETSOL     78
C                                                                       NETSOL     79
      INCLUDE 'CDLCOM.INS'                                              NETSOL     80
C                                                                       NETSOL     81
C                                                                       NETSOL     82
C                                                                       NETSOL     83
C      INCLUDE 'TIMEHEAD.INS/LIST'                                      NETSOL     84
C      ISR=4                                                            NETSOL     85
C      INCLUDE 'TIMEINIT.INS/LIST'                                      NETSOL     86
C                                                                       NETSOL     87
      LDEB=(JDEB(38).NE.0)                                              NETSOL     88
      LDEB1=(JDEB(294).NE.0)                                            NETSOL     89
      LDEB2=(JDEB(41).NE.0)                                             NETSOL     90
      LDEB3=(JDEB(42).NE.0)                                             NETSOL     91
C                                                                       NETSOL     92
      IF(LDEB)WRITE(IUD6,6300)NBFT,NT,NMOTL,NSALI,NSVC,NACBU2,NLBS      NETSOL     93
     &,NCLD,NKCUR,NKMVA                                                 NETSOL     94
      ILL=61                                                            NETSOL     95
      KCUR=0                                                            NETSOL     96
      ITER=0                                                            NETSOL     97
      KCULTC = 0                                                        NETSOL     98
C                                                                       NETSOL     99
C     IF ULTC MOVED, ALWAYS ITERATE                                     NETSOL    100
C                                                                       NETSOL    101
      IF (ITCFLG .GT. 0 .AND. NREFUC .LE. 0) LITER=0                    NETSOL    102
C                                                                       NETSOL    103
C                                                                       NETSOL    104
C     COMPUTE SYSTEM ANGLE CHANGE                                       NETSOL    105
C                                                                       NETSOL    106
         DSYSA=0.0                                                      NETSOL    107
         DO 100 I=1,NT                                                  NETSOL    108
C                                                                       NETSOL    109
C     NOTE THE INERTIA IS STORED IN ITS INVERS                          NETSOL    110
C                                                                       NETSOL    111
            JDG=JCONTA(1,I)                                             NETSOL    112
         IF(IDDAT(JDG+1).NE.0)THEN                                      NETSOL    113
            JSG=MSTATE(1,I)                                             NETSOL    114
            DSYSA=DSYSA+(XSTATE(JSG+2)-ANGXC2(I))/DDAT(JDG+1)           NETSOL    115
         ENDIF                                                          NETSOL    116
  100    CONTINUE                                                       NETSOL    117
         DSYSA=DSYSA*SYSTH                                              NETSOL    118
         CSYSA=COS(DSYSA)                                               NETSOL    119
         SSYSA=SIN(DSYSA)                                               NETSOL    120
         IF(LDEB)WRITE(IUD6,5050) DSYSA,SYSTH,NT,NBFT                   NETSOL    121
C                                                                       NETSOL    122
      IF(NLBS.NE.0)THEN                                                 NETSOL    123
C                                                                       NETSOL    124
C     PREDICT FREQUENCY FOR THE NON-LINEAR LOADS                        NETSOL    125
C                                                                       NETSOL    126
         IF(LDEB)WRITE(IUD6,5150) IR,LITER,ITER,H,TSOLD,TS              NETSOL    127
         IF(.NOT.LDISC)THEN                                             NETSOL    128
            HOLD=TS-TSOLD                                               NETSOL    129
            IF(ABS(HOLD).GT.1.E-4)THEN                                  NETSOL    130
               HOLD=HOLD*WOBASE                                         NETSOL    131
               HNEW=H*WOBASE                                            NETSOL    132
C==                                                                     NETSOL    133
               ISHIFT=0                                                 NETSOL    134
               DO 250 I=1,NLOD                                          NETSOL    135
                JNLBS=0                                                 NETSOL    136
                NCOMP=NLCOMP(1,I)                                       NETSOL    137
                DO 200 ICOMP=1,NCOMP                                    NETSOL    138
                 ISHIFT=ISHIFT+1                                        NETSOL    139
                 IF(NLTYPE(ISHIFT).EQ.3)THEN                            NETSOL    140
                  JNLBS=ISHIFT                                          NETSOL    141
                 ENDIF                                                  NETSOL    142
  200           CONTINUE                                                NETSOL    143
                IF(JNLBS.EQ.0)GOTO 250                                  NETSOL    144
C==                                                                     NETSOL    145
               K=NLDOLD(I)                                              NETSOL    146
               JNL=JDNLL(JNLBS)                                         NETSOL    147
               ANGOLD=DDAT(JNL+6)                                       NETSOL    148
               V1=REAL(VOLT(K))                                         NETSOL    149
               V2=AIMAG(VOLT(K))                                        NETSOL    150
               IF(ABS(V1).GT.1.E-6.OR.ABS(V2).GT.1.E-6)THEN             NETSOL    151
                  ANGNEW=ATAN2(V2,V1)                                   NETSOL    152
               ELSE                                                     NETSOL    153
                  ANGNEW=0.0                                            NETSOL    154
               ENDIF                                                    NETSOL    155
               DEFNEW=ANGNEW-ANGOLD                                     NETSOL    156
               IF(ABS(ANGOLD).GT.HPI.OR.ABS(ANGNEW).GT.HPI)THEN         NETSOL    157
                  ANX=ANGNEW*ANGOLD                                     NETSOL    158
                  IF(ANX.LT.0.0)THEN                                    NETSOL    159
                     IF(ANGOLD.GT.0.0)THEN                              NETSOL    160
C                                                                       NETSOL    161
C     ANGOLD=+VE  ANGNEW=-VE                                            NETSOL    162
C                                                                       NETSOL    163
                        DEFNEW=4.0/PI+DEFNEW                            NETSOL    164
C                                                                       NETSOL    165
                     ELSE                                               NETSOL    166
C                                                                       NETSOL    167
C     ANGOLD=-VE  ANGNEW=+VE                                            NETSOL    168
C                                                                       NETSOL    169
                        DEFNEW=DEFNEW-4.0/PI                            NETSOL    170
C                                                                       NETSOL    171
                     ENDIF                                              NETSOL    172
                  ENDIF                                                 NETSOL    173
               ENDIF                                                    NETSOL    174
C                                                                       NETSOL    175
               DEFNEW=DEFNEW/HOLD                                       NETSOL    176
C               DEFOLD=DDAT(JNL+7)                                      NETSOL    177
C               DEFPRE=DEFNEW+(DEFNEW-DEFOLD)*HNEW/HOLD                 NETSOL    178
               DEFPRE=DEFNEW                                            NETSOL    179
               IF(LDEB)WRITE(IUD6,5200) I,HOLD,ANGNEW,DDAT(JNL+6)       NETSOL    180
     &         ,DEFNEW,DDAT(JNL+7),DEFPRE,DDAT(JNL+8)                   NETSOL    181
               DDAT(JNL+7)=DEFNEW                                       NETSOL    182
               DDAT(JNL+6)=ANGNEW                                       NETSOL    183
               DDAT(JNL+8)=DEFPRE                                       NETSOL    184
  250          CONTINUE                                                 NETSOL    185
               TSOLD=TS                                                 NETSOL    186
C                                                                       NETSOL    187
C     ENDIF HOLD.GT.1.E-4                                               NETSOL    188
C                                                                       NETSOL    189
            ENDIF                                                       NETSOL    190
C                                                                       NETSOL    191
C     ENDIF .NOT.LDISC                                                  NETSOL    192
C                                                                       NETSOL    193
         ENDIF                                                          NETSOL    194
C                                                                       NETSOL    195
C     ENDIF NLBS.NE.0                                                   NETSOL    196
C                                                                       NETSOL    197
      ENDIF                                                             NETSOL    198
C                                                                       NETSOL    199
C     COMPUTE INTERNAL CURRENT FOR CONSTANT FLUX MACHINE                NETSOL    200
C                                                                       NETSOL    201
C***NEED VERIFICATION                                                   NETSOL    202
      IF(NBFT.NE.0)THEN                                                 NETSOL    203
         DO 300 I=1,NBFT                                                NETSOL    204
         NTHGI=KCGEN(2,I)                                               NETSOL    205
         JSG=MSTATE(1,NTHGI)                                            NETSOL    206
         JYG=MYVAR(1,NTHGI)                                             NETSOL    207
         XJ=XSTATE(JSG+2)                                               NETSOL    208
         CDG(1,NTHGI)=EMG(JYG+4)*SIN(XJ)                                NETSOL    209
         CDG(2,NTHGI)=-EMG(JYG+4)*COS(XJ)                               NETSOL    210
  300    CONTINUE                                                       NETSOL    211
      ENDIF                                                             NETSOL    212
C                                                                       NETSOL    213
C     COMPUTE INTERNAL CURRENT FOR DETAILED GENERATOR BUS               NETSOL    214
C                                                                       NETSOL    215
C***NEED VERTIFICATION                                                  NETSOL    216
      IF(NPGEN.NE.0)THEN                                                NETSOL    217
         DO 400 I=1,NPGEN                                               NETSOL    218
         NTHGI=KPGEN(2,I)                                               NETSOL    219
         CDG(1,NTHGI)=-UVAR(5,NTHGI)                                    NETSOL    220
         CDG(2,NTHGI)=-UVAR(6,NTHGI)                                    NETSOL    221
  400    CONTINUE                                                       NETSOL    222
      ENDIF                                                             NETSOL    223
C                                                                       NETSOL    224
C     COMPUTE INTERNAL CURRENT FOR INDUCTION MOTOR                      NETSOL    225
C                                                                       NETSOL    226
      IF (NMOTL.NE.0) THEN                                              NETSOL    227
         DO 450 KK=1,NMOTL                                              NETSOL    228
            NLF=NMOTB(KK)                                               NETSOL    229
            IF (NLF.LT.0) GOTO 450                                      NETSOL    230
            JM=JMDAT(KK)                                                NETSOL    231
            IF (DDAT(JM+15).LT.0.0) GOTO 450                            NETSOL    232
            IF (IDDAT(JM+1).LT.0) GOTO 450                              NETSOL    233
            JY=JVIMO(KK)                                                NETSOL    234
            JSTATE=JXIMO(KK)                                            NETSOL    235
            NTYPE=IDDAT(JM+1)                                           NETSOL    236
            GLK=GSM(JY+4)                                               NETSOL    237
            BLK=BSM(JY+5)                                               NETSOL    238
            IF (NTYPE.LE.3) THEN                                        NETSOL    239
               XS1=XSTATE(JSTATE+1)                                     NETSOL    240
               XS2=XSTATE(JSTATE+2)                                     NETSOL    241
               CDM(JY+8)=GLK*XS1+BLK*XS2                                NETSOL    242
               CQM(JY+9)=GLK*XS2-BLK*XS1                                NETSOL    243
            ELSE                                                        NETSOL    244
               CDM(JY+8)=0.0                                            NETSOL    245
               CQM(JY+9)=0.0                                            NETSOL    246
            END IF                                                      NETSOL    247
  450    CONTINUE                                                       NETSOL    248
      END IF                                                            NETSOL    249
C                                                                       NETSOL    250
C      SET FLAG TO PREVENT VOLTAGE FLAP FLOP DURING ITERATION           NETSOL    251
C      ESPECIALLY DURING FAULT                                          NETSOL    252
C                                                                       NETSOL    253
      DO 500 I=1,NLOD                                                   NETSOL    254
       INLBS(I)=.FALSE.                                                 NETSOL    255
  500 CONTINUE                                                          NETSOL    256
C                                                                       NETSOL    257
C STORE OLD BUS VOLTAGE OF INDUCTION MACHINES                           NETSOL    258
      IF (ITERMI.LE.1.AND.NMOTL.NE.0) THEN                              NETSOL    259
        DO 510 NN=1,NMOTL                                               NETSOL    260
          MM=NMOTB(NN)                                                  NETSOL    261
          IF(MM.LT.0) GOTO 510                                          NETSOL    262
          IF (IDDAT(JM+1) .LT. 0) GOTO 510                              NETSOL    263
          MM=NMOLD(NN)                                                  NETSOL    264
          VOLDRE(NN) = REAL(VOLT(MM))                                   NETSOL    265
          VOLDIM(NN) = AIMAG(VOLT(MM))                                  NETSOL    266
  510   CONTINUE                                                        NETSOL    267
      ENDIF                                                             NETSOL    268
C                                                                       NETSOL    269
C                                                                       NETSOL    270
C     NETSOL ITERATION LOOP                                             NETSOL    271
C                                                                       NETSOL    272
  550 CONTINUE                                                          NETSOL    273
C                                                                       NETSOL    274
      JL1=0                                                             NETSOL    275
      JL2=0                                                             NETSOL    276
C                                                                       NETSOL    277
C     STORE OLD VOLTAGES FOR CONVERGENCE TEST                           NETSOL    278
C                                                                       NETSOL    279
      IF(LDEB)WRITE(IUD6,6200)LASTCU,JSOUR                              NETSOL    280
C     DO 180 I=1,LASTCU                                                 NETSOL    281
C                                                                       NETSOL    282
      IF(LOBUS.EQ.1)THEN                                                NETSOL    283
       NDO=NLAST                                                        NETSOL    284
      ELSE                                                              NETSOL    285
       NDO=LASTCU                                                       NETSOL    286
      ENDIF                                                             NETSOL    287
C                                                                       NETSOL    288
      DO 600 I=1,NDO                                                    NETSOL    289
      OVOLT(I)=VOLT(I)                                                  NETSOL    290
      IVOLC(I)=0                                                        NETSOL    291
      IF(LDEB)WRITE(IUD6,6000)I,VOLT(I),IVOLC(I)                        NETSOL    292
  600 CONTINUE                                                          NETSOL    293
C                                                                       NETSOL    294
      IF(KCUR.NE.0)THEN                                                 NETSOL    295
         DO 650 K=1,LASTCU                                              NETSOL    296
         VOLT(K)=CUREAL(K)                                              NETSOL    297
  650    CONTINUE                                                       NETSOL    298
         DO 700 K=LASTCU+1,NLAST                                        NETSOL    299
         VOLT(K)=CMPLX(0.0,0.0)                                         NETSOL    300
  700    CONTINUE                                                       NETSOL    301
C                                                                       NETSOL    302
C                                                                       NETSOL    303
      ELSE                                                              NETSOL    304
C                                                                       NETSOL    305
C     SUMING BUS CURRENT INJECTION TO CALCULATE BUS VOLTAGE             NETSOL    306
C                                                                       NETSOL    307
         DO 750 K=1,NLAST                                               NETSOL    308
         VOLT(K)=CMPLX(0.0,0.0)                                         NETSOL    309
  750    CONTINUE                                                       NETSOL    310
C                                                                       NETSOL    311
C***NEED VERTIFICATION                                                  NETSOL    312
C                                                                       NETSOL    313
         DO 800 I=1,NPGEN                                               NETSOL    314
         K=KPGEN(1,I)                                                   NETSOL    315
         N=KPGEN(2,I)                                                   NETSOL    316
         MSKK=MSK(K)                                                    NETSOL    317
         VOLT(MSKK)=VOLT(MSKK)+CMPLX(CDG(1,N),CDG(2,N))                 NETSOL    318
  800    CONTINUE                                                       NETSOL    319
         DO 810 I=1,NBFT                                                NETSOL    320
         K=KCGEN(1,I)                                                   NETSOL    321
         N=KCGEN(2,I)                                                   NETSOL    322
         MSKK=MSK(K)                                                    NETSOL    323
         VOLT(MSKK)=VOLT(MSKK)+CMPLX(CDG(1,N),CDG(2,N))                 NETSOL    324
  810    CONTINUE                                                       NETSOL    325
C                                                                       NETSOL    326
         IF(NMOTL.NE.0)THEN                                             NETSOL    327
            DO 900 K=1,NMOTL                                            NETSOL    328
            I=NMOTB(K)                                                  NETSOL    329
            IF(I.LT.0) GOTO 900                                         NETSOL    330
            JY=JVIMO(K)                                                 NETSOL    331
            I=NMOLD(K)                                                  NETSOL    332
            MSKI=MSK(I)                                                 NETSOL    333
            VOLT(MSKI)=VOLT(MSKI)+CMPLX(CDM(JY+8),CQM(JY+9))            NETSOL    334
  900       CONTINUE                                                    NETSOL    335
         ENDIF                                                          NETSOL    336
         IF(LITER.EQ.0)THEN                                             NETSOL    337
            KCUR=1                                                      NETSOL    338
            DO 950 I=1,LASTCU                                           NETSOL    339
            CUREAL(I)=VOLT(I)                                           NETSOL    340
  950       CONTINUE                                                    NETSOL    341
         ENDIF                                                          NETSOL    342
C                                                                       NETSOL    343
C     ENDIF KCUR.NE.0                                                   NETSOL    344
C                                                                       NETSOL    345
      ENDIF                                                             NETSOL    346
C                                                                       NETSOL    347
C                                                                       NETSOL    348
C     SUMING SALIENCY CURRENT CORRECTION                                NETSOL    349
C                                                                       NETSOL    350
C***NEED VERIFICATION                                                   NETSOL    351
      IF(NSALI.NE.0)THEN                                                NETSOL    352
         DO 1050 I=1,NPGEN                                              NETSOL    353
             K=KPGEN(1,I)                                               NETSOL    354
         NGTHI=KPGEN(2,I)                                               NETSOL    355
         IF(ISAL(NGTHI))THEN                                            NETSOL    356
            ERGK=REAL(OVOLT(K))                                         NETSOL    357
            EIGK=AIMAG(OVOLT(K))                                        NETSOL    358
            IF(ITER.EQ.0)THEN                                           NETSOL    359
               IF(IVOLC(K).EQ.0)THEN                                    NETSOL    360
                  JSG=MSTATE(1,NGTHI)                                   NETSOL    361
                  DXC2=XSTATE(JSG+2)-ANGXC2(NGTHI)                      NETSOL    362
                  SDXC2=SIN(DXC2)                                       NETSOL    363
                  CDXC2=COS(DXC2)                                       NETSOL    364
                  IF(LDEB)WRITE(IUD6,5800) K,J,NGTHI,DXC2               NETSOL    365
                  ERGK=ERGK*CDXC2-EIGK*SDXC2                            NETSOL    366
                  EIGK=EIGK*CDXC2+REAL(OVOLT(K))*SDXC2                  NETSOL    367
                  OVOLT(K)=CMPLX(ERGK,EIGK)                             NETSOL    368
               ENDIF                                                    NETSOL    369
            ENDIF                                                       NETSOL    370
            IVOLC(K)=1                                                  NETSOL    371
            IF(LDEB)WRITE(IUD6,6050)ITER,K,IVOLC(K)                     NETSOL    372
            U1K=UVAR(1,NGTHI)-BUVAR(1,NGTHI)                            NETSOL    373
            U2K=UVAR(2,NGTHI)-BUVAR(2,NGTHI)                            NETSOL    374
            U3K=UVAR(3,NGTHI)-BUVAR(3,NGTHI)                            NETSOL    375
            U4K=UVAR(4,NGTHI)-BUVAR(4,NGTHI)                            NETSOL    376
            IF(LDEB)                                                    NETSOL    377
     &      WRITE(IUD6,6100)(UVAR(LJ,NGTHI),BUVAR(LJ,NGTHI),LJ=1,4)     NETSOL    378
            IF(LDEB)WRITE(IUD6,5850) K,J,NGTHI,U1K,U2K,U3K,U4K          NETSOL    379
            XX=(U1K*ERGK+U2K*EIGK)                                      NETSOL    380
            YY=(U3K*ERGK+U4K*EIGK)                                      NETSOL    381
C--                                                                     NETSOL    382
            MSKK=MSK(K)                                                 NETSOL    383
            VOLT(MSKK)=VOLT(MSKK)+CMPLX(XX,YY)                          NETSOL    384
         ENDIF                                                          NETSOL    385
 1050    CONTINUE                                                       NETSOL    386
      ENDIF                                                             NETSOL    387
C                                                                       NETSOL    388
C     COMPUTE COMPENSATING CURRENT FOR INDUCTION MOTOR                  NETSOL    389
C                                                                       NETSOL    390
      IF (NMOTL.NE.0) THEN                                              NETSOL    391
         DO 1100 I=1,NMOTL                                              NETSOL    392
            K=NMOTB(I)                                                  NETSOL    393
            IF (K.LT.0) GOTO 1100                                       NETSOL    394
            JM=JMDAT(I)                                                 NETSOL    395
            IF (IDDAT(JM+1) .LT. 0) GOTO 1100                           NETSOL    396
            JY=JVIMO(I)                                                 NETSOL    397
            IF (DDAT(JM+15).GE.0.0) THEN                                NETSOL    398
C                                                                       NETSOL    399
               K=NMOLD(I)                                               NETSOL    400
               ERGK=REAL(OVOLT(K))                                      NETSOL    401
               EIGK=AIMAG(OVOLT(K))                                     NETSOL    402
               DGSM=GSM(JY+4)-GSMO(JY+6)                                NETSOL    403
               DBSM=BSM(JY+5)-BSMO(JY+7)                                NETSOL    404
               U1K=-(DGSM*ERGK+DBSM*EIGK)                               NETSOL    405
               U2K=+(DBSM*ERGK-DGSM*EIGK)                               NETSOL    406
C                                                                       NETSOL    407
            ELSE IF (DDAT(JM+15).GT.-999998.0) THEN                     NETSOL    408
C                                                                       NETSOL    409
               DGSM=GSMO(JY+6)                                          NETSOL    410
               DBSM=BSMO(JY+7)                                          NETSOL    411
               K=NMOLD(I)                                               NETSOL    412
               ERGK=REAL(OVOLT(K))                                      NETSOL    413
               EIGK=AIMAG(OVOLT(K))                                     NETSOL    414
               U1K=DGSM*ERGK+DBSM*EIGK                                  NETSOL    415
               U2K=DBSM*ERGK-DGSM*EIGK                                  NETSOL    416
C                                                                       NETSOL    417
            ELSE                                                        NETSOL    418
C                                                                       NETSOL    419
               U1K=0.0                                                  NETSOL    420
               U2K=0.0                                                  NETSOL    421
C                                                                       NETSOL    422
            END IF                                                      NETSOL    423
C                                                                       NETSOL    424
            MSKK=MSK(K)                                                 NETSOL    425
            VOLT(MSKK)=VOLT(MSKK)+CMPLX(U1K,U2K)                        NETSOL    426
 1100    CONTINUE                                                       NETSOL    427
      END IF                                                            NETSOL    428
C                                                                       NETSOL    429
C     COMPUTE COMPENSATING CURRENT FOR TSC LOAD                         NETSOL    430
C                                                                       NETSOL    431
      IF (NTSCL.NE.0)THEN                                               NETSOL    432
         DO 1150 I=1,NTSCL                                              NETSOL    433
            JTSC=JTCDAT(I)                                              NETSOL    434
            JSTATE=JXTSC(I)                                             NETSOL    435
            NLF=IDDAT(JTSC+1)                                           NETSOL    436
            GTSC0=DDAT(JTSC+10)                                         NETSOL    437
            GTSC=DDAT(JTSC+11)                                          NETSOL    438
            ERGK=REAL(OVOLT(NLF))                                       NETSOL    439
            EIGK=AIMAG(OVOLT(NLF))                                      NETSOL    440
C                                                                       NETSOL    441
            DGSM=GTSC-GTSC0                                             NETSOL    442
            U1K=-DGSM*ERGK                                              NETSOL    443
            U2K=-DGSM*EIGK                                              NETSOL    444
C                                                                       NETSOL    445
            MSKK=MSK(NLF)                                               NETSOL    446
            VOLT(MSKK)=VOLT(MSKK)+CMPLX(U1K,U2K)                        NETSOL    447
 1150    CONTINUE                                                       NETSOL    448
      END IF                                                            NETSOL    449
C                                                                       NETSOL    450
C     COMPUTE STATIC COMPENSATOR AND SATURABLE REACTOR CURRENT          NETSOL    451
C                                                                       NETSOL    452
      IF(NSVC.NE.0)THEN                                                 NETSOL    453
         DO 1200 I=1,NSVC                                               NETSOL    454
         K=NROLD(I)                                                     NETSOL    455
         VREAL=REAL(OVOLT(K))                                           NETSOL    456
         VIMAG=AIMAG(OVOLT(K))                                          NETSOL    457
         JS=JSDAT(I)                                                    NETSOL    458
         JY=JVSVR(I)                                                    NETSOL    459
         IF(IDDAT(JS+9).EQ.50) THEN                                     NETSOL    460
            IF(BASER(JY+4).GT.0.0) THEN                                 NETSOL    461
               U2K=BSVCO(JY+3)-BSVC(JY+2)                               NETSOL    462
            ELSE                                                        NETSOL    463
               U2K=BSVCO(JY+3)                                          NETSOL    464
               U3K=BSVC(JY+2)                                           NETSOL    465
            ENDIF                                                       NETSOL    466
         ELSE                                                           NETSOL    467
            U2K=BSVC(JY+2)                                              NETSOL    468
            IF(IDDAT(JS+9).EQ.6) U2K=U2K*DDAT(JS+6)                     NETSOL    469
            U2K=BSVCO(JY+3)-U2K                                         NETSOL    470
         ENDIF                                                          NETSOL    471
C                                                                       NETSOL    472
         IF(ITER.EQ.0)THEN                                              NETSOL    473
            IF(IVOLC(K).EQ.0)THEN                                       NETSOL    474
               VREAL=VREAL*CSYSA-VIMAG*SSYSA                            NETSOL    475
               VIMAG=VIMAG*CSYSA+REAL(OVOLT(K))*SSYSA                   NETSOL    476
               OVOLT(K)=CMPLX(VREAL,VIMAG)                              NETSOL    477
            ENDIF                                                       NETSOL    478
         ENDIF                                                          NETSOL    479
         IF(IVOLC(K).EQ.0)IVOLC(K)=3                                    NETSOL    480
C                                                                       NETSOL    481
         MSKK=MSK(K)                                                    NETSOL    482
         VOLT(MSKK)=VOLT(MSKK)+CMPLX(U2K*VIMAG,-U2K*VREAL)              NETSOL    483
         IF(IDDAT(JS+9).EQ.50) THEN                                     NETSOL    484
            IF(BASER(JY+4).LT.0.0) THEN                                 NETSOL    485
               VMG=SQRT(VREAL**2+VIMAG**2)                              NETSOL    486
               IF(VMG.GT.0.0001) THEN                                   NETSOL    487
                  COSF=VREAL/VMG                                        NETSOL    488
                  SINF=VIMAG/VMG                                        NETSOL    489
                  VOLT(MSKK)=VOLT(MSKK)+CMPLX(-U3K*SINF,U3K*COSF)       NETSOL    490
               ENDIF                                                    NETSOL    491
            ENDIF                                                       NETSOL    492
         ENDIF                                                          NETSOL    493
 1200    CONTINUE                                                       NETSOL    494
      ENDIF                                                             NETSOL    495
C                                                                       NETSOL    496
C     COMPUTE ULTC CURRENT INJECTION                                    NETSOL    497
C                                                                       NETSOL    498
      IF (NULTC .LE. 0 .OR. NREFUC .GT. 0) GOTO 1300                    NETSOL    499
      IF (ITCFLG .EQ. 0) GOTO 1300                                      NETSOL    500
C                                                                       NETSOL    501
      KCULTC = KCULTC+1                                                 NETSOL    502
      DO 1250 ITC = 1,NULTC                                             NETSOL    503
        IF (MOULTC(ITC) .EQ. 0) GOTO 1250                               NETSOL    504
        ITC4 = 4*ITC                                                    NETSOL    505
        JTC = JULTCD(ITC)                                               NETSOL    506
        NLFPN = IDDAT(JTC+1)                                            NETSOL    507
        NLFSN = IDDAT(JTC+2)                                            NETSOL    508
C                                                                       NETSOL    509
        IF (IVOLC(NLFPN) .EQ. 0) IVOLC(NLFPN) = 6                       NETSOL    510
        IF (IVOLC(NLFSN) .EQ. 0) IVOLC(NLFSN) = 6                       NETSOL    511
        MSKKP = MSK(NLFPN)                                              NETSOL    512
        MSKKS = MSK(NLFSN)                                              NETSOL    513
C                                                                       NETSOL    514
        ATCO = DDAT(JTC+22)                                             NETSOL    515
        ATCA = ONRSTA(ITC4-3)                                           NETSOL    516
        GTCO = DDAT(JTC+20)                                             NETSOL    517
        BTCO = DDAT(JTC+21)                                             NETSOL    518
C                                                                       NETSOL    519
C *** GTCA & BTCA SHOULD BE MODIFIED IF TRANSFORMER IMPEDANCE           NETSOL    520
C     CORRECTION IS TO BE CONSIDERED                                    NETSOL    521
C                                                                       NETSOL    522
C       YO = GTCO - J BTCO                                              NETSOL    523
C       Y  = GTCA - J BTCA                                              NETSOL    524
C                                                                       NETSOL    525
        GTCA = GTCO                                                     NETSOL    526
        BTCA = BTCO                                                     NETSOL    527
        YTCO = CMPLX(GTCO,-BTCO)                                        NETSOL    528
        YTCA = CMPLX(GTCA,-BTCA)                                        NETSOL    529
C                                                                       NETSOL    530
        YCONT = (1./ATCA*YTCA-1./ATCO*YTCO)                             NETSOL    531
C                                                                       NETSOL    532
        XICRRP = (1./(ATCO**2)*YTCO-1./(ATCA**2)*YTCA)*OVOLT(NLFPN)     NETSOL    533
     1           + YCONT*OVOLT(NLFSN)                                   NETSOL    534
        XICRRS = YCONT*OVOLT(NLFPN)                                     NETSOL    535
     1           +(YTCO-YTCA)*OVOLT(NLFSN)                              NETSOL    536
C                                                                       NETSOL    537
        VOLT(MSKKP) = VOLT(MSKKP)+XICRRP                                NETSOL    538
        VOLT(MSKKS) = VOLT(MSKKS)+XICRRS                                NETSOL    539
 1250 CONTINUE                                                          NETSOL    540
C                                                                       NETSOL    541
 1300 CONTINUE                                                          NETSOL    542
C                                                                       NETSOL    543
C     COMPUTE RANI CURRENT                                              NETSOL    544
C                                                                       NETSOL    545
      IF(NRANI.NE.0)THEN                                                NETSOL    546
         DO 1350 I=1,NRANI                                              NETSOL    547
         JR=JRDAT(I)                                                    NETSOL    548
         K1=IDDAT(JR+1)                                                 NETSOL    549
         K2=IDDAT(JR+2)                                                 NETSOL    550
         IRANF=IDDAT(JR+6)                                              NETSOL    551
         VREAL1=REAL(OVOLT(K1))                                         NETSOL    552
         VIMAG1=AIMAG(OVOLT(K1))                                        NETSOL    553
         VREAL2=REAL(OVOLT(K2))                                         NETSOL    554
         VIMAG2=AIMAG(OVOLT(K2))                                        NETSOL    555
         JY=JVRAN(I)                                                    NETSOL    556
         IF(IRANF.EQ.0.OR.IRANF.EQ.1) THEN                              NETSOL    557
            U2K=BRANO(JY+3)-BRANI(JY+2)                                 NETSOL    558
         ELSEIF(IRANF.EQ.2) THEN                                        NETSOL    559
            U1K=BRANO(JY+9)-BRANI(JY+8)                                 NETSOL    560
            U2K=BRANO(JY+3)-BRANI(JY+2)                                 NETSOL    561
         ELSEIF(IRANF.EQ.3) THEN                                        NETSOL    562
            U2K=BRANO(JY+3)                                             NETSOL    563
            U3K=BRANI(JY+2)                                             NETSOL    564
         ENDIF                                                          NETSOL    565
C                                                                       NETSOL    566
         IF(ITER.EQ.0) THEN                                             NETSOL    567
            IF(IVOLC(K1).EQ.0)THEN                                      NETSOL    568
               VREAL1=VREAL1*CSYSA-VIMAG1*SSYSA                         NETSOL    569
               VIMAG1=VIMAG1*CSYSA+REAL(OVOLT(K1))*SSYSA                NETSOL    570
               OVOLT(K1)=CMPLX(VREAL1,VIMAG1)                           NETSOL    571
            ENDIF                                                       NETSOL    572
            IF(IVOLC(K2).EQ.0)THEN                                      NETSOL    573
               VREAL2=VREAL2*CSYSA-VIMAG2*SSYSA                         NETSOL    574
               VIMAG2=VIMAG2*CSYSA+REAL(OVOLT(K2))*SSYSA                NETSOL    575
               OVOLT(K2)=CMPLX(VREAL2,VIMAG2)                           NETSOL    576
            ENDIF                                                       NETSOL    577
         ENDIF                                                          NETSOL    578
         IF(IVOLC(K1).EQ.0)IVOLC(K1)=3                                  NETSOL    579
         IF(IVOLC(K2).EQ.0)IVOLC(K2)=3                                  NETSOL    580
C                                                                       NETSOL    581
         MSKK1=MSK(K1)                                                  NETSOL    582
         MSKK2=MSK(K2)                                                  NETSOL    583
         VREAL=VREAL1-VREAL2                                            NETSOL    584
         VIMAG=VIMAG1-VIMAG2                                            NETSOL    585
         IF(IRANF.EQ.0) THEN                                            NETSOL    586
            CREAL=U2K*VIMAG                                             NETSOL    587
            CIMAG=-U2K*VREAL                                            NETSOL    588
         ELSEIF(IRANF.EQ.1) THEN                                        NETSOL    589
            CREAL=U2K*VREAL                                             NETSOL    590
            CIMAG=U2K*VIMAG                                             NETSOL    591
         ELSEIF(IRANF.EQ.2) THEN                                        NETSOL    592
            CREAL=U1K*VREAL+U2K*VIMAG                                   NETSOL    593
            CIMAG=U1K*VIMAG-U2K*VREAL                                   NETSOL    594
         ELSEIF(IRANF.EQ.3) THEN                                        NETSOL    595
            VMG=SQRT(VREAL**2+VIMAG**2)                                 NETSOL    596
            CREAL=( U2K-U3K/VMG)*VIMAG                                  NETSOL    597
            CIMAG=(-U2K+U3K/VMG)*VREAL                                  NETSOL    598
         ENDIF                                                          NETSOL    599
         VOLT(MSKK1)=VOLT(MSKK1)+CMPLX(CREAL,CIMAG)                     NETSOL    600
         VOLT(MSKK2)=VOLT(MSKK2)-CMPLX(CREAL,CIMAG)                     NETSOL    601
 1350    CONTINUE                                                       NETSOL    602
      ENDIF                                                             NETSOL    603
C                                                                       NETSOL    604
C     COMPUTE STP CURRENT                                               NETSOL    605
C                                                                       NETSOL    606
      IF(NTCPS.NE.0)THEN                                                NETSOL    607
         DO 1400 I=1,NTCPS                                              NETSOL    608
         JTP=JTPDAT(I)                                                  NETSOL    609
         K1=IDDAT(JTP+1)                                                NETSOL    610
         K2=IDDAT(JTP+2)                                                NETSOL    611
         VREAL1=REAL(OVOLT(K1))                                         NETSOL    612
         VIMAG1=AIMAG(OVOLT(K1))                                        NETSOL    613
         VREAL2=REAL(OVOLT(K2))                                         NETSOL    614
         VIMAG2=AIMAG(OVOLT(K2))                                        NETSOL    615
         JY=JVSTP(I)                                                    NETSOL    616
         G11=YVAR(JY+9)-YVAR(JY+1)                                      NETSOL    617
         B11=YVAR(JY+10)-YVAR(JY+2)                                     NETSOL    618
         G12=YVAR(JY+11)-YVAR(JY+3)                                     NETSOL    619
         B12=YVAR(JY+12)-YVAR(JY+4)                                     NETSOL    620
         G21=YVAR(JY+13)-YVAR(JY+5)                                     NETSOL    621
         B21=YVAR(JY+14)-YVAR(JY+6)                                     NETSOL    622
         G22=YVAR(JY+15)-YVAR(JY+7)                                     NETSOL    623
         B22=YVAR(JY+16)-YVAR(JY+8)                                     NETSOL    624
C                                                                       NETSOL    625
         IF(ITER.EQ.0)THEN                                              NETSOL    626
            IF(IVOLC(K1).EQ.0)THEN                                      NETSOL    627
               VREAL1=VREAL1*CSYSA-VIMAG1*SSYSA                         NETSOL    628
               VIMAG1=VIMAG1*CSYSA+REAL(OVOLT(K1))*SSYSA                NETSOL    629
               OVOLT(K1)=CMPLX(VREAL1,VIMAG1)                           NETSOL    630
            ENDIF                                                       NETSOL    631
            IF(IVOLC(K2).EQ.0)THEN                                      NETSOL    632
               VREAL2=VREAL2*CSYSA-VIMAG2*SSYSA                         NETSOL    633
               VIMAG2=VIMAG2*CSYSA+REAL(OVOLT(K2))*SSYSA                NETSOL    634
               OVOLT(K2)=CMPLX(VREAL2,VIMAG2)                           NETSOL    635
            ENDIF                                                       NETSOL    636
         ENDIF                                                          NETSOL    637
         IF(IVOLC(K1).EQ.0)IVOLC(K1)=3                                  NETSOL    638
         IF(IVOLC(K2).EQ.0)IVOLC(K2)=3                                  NETSOL    639
C                                                                       NETSOL    640
         MSKK1=MSK(K1)                                                  NETSOL    641
         MSKK2=MSK(K2)                                                  NETSOL    642
         CREAL1=G11*VREAL1-B11*VIMAG1+G12*VREAL2-B12*VIMAG2             NETSOL    643
         CIMAG1=B11*VREAL1+G11*VIMAG1+B12*VREAL2+G12*VIMAG2             NETSOL    644
         CREAL2=G21*VREAL1-B21*VIMAG1+G22*VREAL2-B22*VIMAG2             NETSOL    645
         CIMAG2=B21*VREAL1+G21*VIMAG1+B22*VREAL2+G22*VIMAG2             NETSOL    646
         VOLT(MSKK1)=VOLT(MSKK1)+CMPLX(CREAL1,CIMAG1)                   NETSOL    647
         VOLT(MSKK2)=VOLT(MSKK2)+CMPLX(CREAL2,CIMAG2)                   NETSOL    648
 1400    CONTINUE                                                       NETSOL    649
      ENDIF                                                             NETSOL    650
C                                                                       NETSOL    651
C     COMPUTE SDB CURRENT                                               NETSOL    652
C                                                                       NETSOL    653
      IF(NSDB.NE.0)THEN                                                 NETSOL    654
         DO 1450 I=1,NSDB                                               NETSOL    655
         JD=JDDAT(I)                                                    NETSOL    656
         K=IDDAT(JD+1)                                                  NETSOL    657
         VREAL=REAL(OVOLT(K))                                           NETSOL    658
         VIMAG=AIMAG(OVOLT(K))                                          NETSOL    659
         JY=JVSDB(I)                                                    NETSOL    660
         U2K=-YSDB(JY+1)                                                NETSOL    661
C                                                                       NETSOL    662
         IF(ITER.EQ.0) THEN                                             NETSOL    663
            IF(IVOLC(K).EQ.0)THEN                                       NETSOL    664
               VREAL=VREAL*CSYSA-VIMAG*SSYSA                            NETSOL    665
               VIMAG=VIMAG*CSYSA+REAL(OVOLT(K))*SSYSA                   NETSOL    666
               OVOLT(K)=CMPLX(VREAL,VIMAG)                              NETSOL    667
            ENDIF                                                       NETSOL    668
         ENDIF                                                          NETSOL    669
         IF(IVOLC(K).EQ.0)IVOLC(K)=3                                    NETSOL    670
C                                                                       NETSOL    671
         MSKK=MSK(K)                                                    NETSOL    672
         IF(U2K.GT.0.0) THEN                                            NETSOL    673
            VOLT(MSKK)=VOLT(MSKK)+CMPLX(U2K*VIMAG,-U2K*VREAL)           NETSOL    674
         ELSE                                                           NETSOL    675
            VOLT(MSKK)=VOLT(MSKK)+CMPLX(U2K*VREAL,U2K*VIMAG)            NETSOL    676
         ENDIF                                                          NETSOL    677
 1450    CONTINUE                                                       NETSOL    678
      ENDIF                                                             NETSOL    679
C                                                                       NETSOL    680
C     COMPUTE HVDC LINE COMMUTATED CONVERTER CURRENT                    NETSOL    681
C                                                                       NETSOL    682
      IF(NACBUS.NE.0)THEN                                               NETSOL    683
         DO 1500 J=1,NACBUS                                             NETSOL    684
         K=IUQABU(J)                                                    NETSOL    685
         VROLD=DCEAT(J)                                                 NETSOL    686
         VIOLD=DCEBT(J)                                                 NETSOL    687
         VMOLD=(VROLD**2+VIOLD**2)                                      NETSOL    688
C                                                                       NETSOL    689
         VREAL=REAL(OVOLT(K))                                           NETSOL    690
         VIMAG=AIMAG(OVOLT(K))                                          NETSOL    691
         IF(LDEB) WRITE(IUD6,6250)VREAL,VIMAG                           NETSOL    692
         IF(ITER.EQ.0)THEN                                              NETSOL    693
            IF(IVOLC(K).EQ.0)THEN                                       NETSOL    694
               VREAL=VREAL*CSYSA-VIMAG*SSYSA                            NETSOL    695
               VIMAG=VIMAG*CSYSA+REAL(OVOLT(K))*SSYSA                   NETSOL    696
               OVOLT(K)=CMPLX(VREAL,VIMAG)                              NETSOL    697
            ENDIF                                                       NETSOL    698
         ENDIF                                                          NETSOL    699
         IF(LDEB) WRITE(IUD6,6250)VREAL,VIMAG                           NETSOL    700
         VMG=(VREAL**2+VIMAG**2)                                        NETSOL    701
         IF(IVOLC(K).EQ.0)IVOLC(K)=4                                    NETSOL    702
C                                                                       NETSOL    703
         IF(LDEB)WRITE(IUD6,6150)SQRT(VMG),SQRT(VMOLD),PTHVDC(J)        NETSOL    704
     &   ,QTHVDC(J),VOLT(K),J,K                                         NETSOL    705
C                                                                       NETSOL    706
         IF(VMG.LT.0.1.OR.VMOLD.LT.0.1) GO TO 1500                      NETSOL    707
         VMM=SQRT(VMG*VMOLD)                                            NETSOL    708
         VX=(VREAL*PTHVDC(J)+VIMAG*QTHVDC(J))/VMM                       NETSOL    709
         VY=(VIMAG*PTHVDC(J)-VREAL*QTHVDC(J))/VMM                       NETSOL    710
         MSKK=MSK(K)                                                    NETSOL    711
         VOLT(MSKK)=VOLT(MSKK)+CMPLX(VX,VY)                             NETSOL    712
         IF(LDEB) WRITE(IUD6,6150) VMG,VMOLD,PTHVDC(J),QTHVDC(J)        NETSOL    713
     &   ,VOLT(K),J,K                                                   NETSOL    714
 1500    CONTINUE                                                       NETSOL    715
      ENDIF                                                             NETSOL    716
C                                                                       NETSOL    717
C                                                                       NETSOL    718
C     COMPUTE HVDC SELF COMMUTATED CONVERTER CURRENT                    NETSOL    719
C                                                                       NETSOL    720
      IF(ICDC.GT.LCDC)THEN                                              NETSOL    721
         DO 1501 J1=LCDC+1,ICDC                                         NETSOL    722
         JPOSN=IDC(J1)                                                  NETSOL    723
         J=IDCBNU(JPOSN)                                                NETSOL    724
         IF(J.EQ.0) GO TO 1501                                          NETSOL    725
         K=IUQABU(J)                                                    NETSOL    726
         J2=IDCBN2(JPOSN)                                               NETSOL    727
         IF(J2.EQ.0) THEN                                               NETSOL    728
            VROLD=DCEAT(J)                                              NETSOL    729
            VIOLD=DCEBT(J)                                              NETSOL    730
            VREAL=REAL(OVOLT(K))                                        NETSOL    731
            VIMAG=AIMAG(OVOLT(K))                                       NETSOL    732
            IF(LDEB) WRITE(IUD6,6250)VREAL,VIMAG                        NETSOL    733
C                                                                       NETSOL    734
            IF(ITER.EQ.0)THEN                                           NETSOL    735
               IF(IVOLC(K).EQ.0)THEN                                    NETSOL    736
                  VREAL=VREAL*CSYSA-VIMAG*SSYSA                         NETSOL    737
                  VIMAG=VIMAG*CSYSA+REAL(OVOLT(K))*SSYSA                NETSOL    738
                  OVOLT(K)=CMPLX(VREAL,VIMAG)                           NETSOL    739
               ENDIF                                                    NETSOL    740
            ENDIF                                                       NETSOL    741
            IF(LDEB) WRITE(IUD6,6250)VREAL,VIMAG                        NETSOL    742
            IF(IVOLC(K).EQ.0)IVOLC(K)=4                                 NETSOL    743
C                                                                       NETSOL    744
            VMOLD=(VROLD**2+VIOLD**2)                                   NETSOL    745
            VMG=(VREAL**2+VIMAG**2)                                     NETSOL    746
            IF(LDEB) WRITE(IUD6,6151) VMG,VMOLD,PAHVDC(JPOSN)           NETSOL    747
     &      ,QAHVDC(JPOSN),Q2HVDC(JPOSN),XCCONV(JPOSN)                  NETSOL    748
            IF(VMG.LT.0.01.OR.VMOLD.LT.0.01) GO TO 1501                 NETSOL    749
            VMM=SQRT(VMG*VMOLD)                                         NETSOL    750
            VX=(VREAL*PAHVDC(JPOSN)+VIMAG*QAHVDC(JPOSN))/VMM/PABASE     NETSOL    751
            VY=(VIMAG*PAHVDC(JPOSN)-VREAL*QAHVDC(JPOSN))/VMM/PABASE     NETSOL    752
            MSKK=MSK(K)                                                 NETSOL    753
            VOLT(MSKK)=VOLT(MSKK)+CMPLX(VX,VY)                          NETSOL    754
         ELSE                                                           NETSOL    755
            K2=IUQABU(J2)                                               NETSOL    756
            VR1O=DCEAT(J)                                               NETSOL    757
            VI1O=DCEBT(J)                                               NETSOL    758
            VROLD=VR1O-DCEAT(J2)                                        NETSOL    759
            VIOLD=VI1O-DCEBT(J2)                                        NETSOL    760
            VREAL1=REAL(OVOLT(K))                                       NETSOL    761
            VIMAG1=AIMAG(OVOLT(K))                                      NETSOL    762
            VREAL2=REAL(OVOLT(K2))                                      NETSOL    763
            VIMAG2=AIMAG(OVOLT(K2))                                     NETSOL    764
            IF(LDEB) WRITE(IUD6,6252) VREAL1,VIMAG1,VR1O,VI1O           NETSOL    765
C                                                                       NETSOL    766
            IF(ITER.EQ.0)THEN                                           NETSOL    767
               IF(IVOLC(K).EQ.0)THEN                                    NETSOL    768
                  VREAL1=VREAL1*CSYSA-VIMAG1*SSYSA                      NETSOL    769
                  VIMAG1=VIMAG1*CSYSA+REAL(OVOLT(K))*SSYSA              NETSOL    770
                  OVOLT(K)=CMPLX(VREAL1,VIMAG1)                         NETSOL    771
               ENDIF                                                    NETSOL    772
               IF(IVOLC(K2).EQ.0)THEN                                   NETSOL    773
                  VREAL2=VREAL2*CSYSA-VIMAG2*SSYSA                      NETSOL    774
                  VIMAG2=VIMAG2*CSYSA+REAL(OVOLT(K2))*SSYSA             NETSOL    775
                  OVOLT(K2)=CMPLX(VREAL2,VIMAG2)                        NETSOL    776
               ENDIF                                                    NETSOL    777
            ENDIF                                                       NETSOL    778
            IF(LDEB) WRITE(IUD6,6252) VREAL1,VIMAG1,VR1O,VI1O           NETSOL    779
            VREAL=VREAL1-VREAL2                                         NETSOL    780
            VIMAG=VIMAG1-VIMAG2                                         NETSOL    781
            IF(LDEB) WRITE(IUD6,6250)VREAL,VIMAG                        NETSOL    782
            IF(IVOLC(K).EQ.0)IVOLC(K)=4                                 NETSOL    783
            IF(IVOLC(K2).EQ.0)IVOLC(K2)=4                               NETSOL    784
C                                                                       NETSOL    785
            VMOLD=(VROLD**2+VIOLD**2)                                   NETSOL    786
            VMG=(VREAL**2+VIMAG**2)                                     NETSOL    787
            IF(LDEB) WRITE(IUD6,6151) VMG,VMOLD,PAHVDC(JPOSN)           NETSOL    788
     &      ,QAHVDC(JPOSN),Q2HVDC(JPOSN),XCCONV(JPOSN)                  NETSOL    789
            IF(VMG.LT.1.0E-10.OR.VMOLD.LT.1.0E-10) GO TO 1501           NETSOL    790
            VM1O=(VR1O**2+VI1O**2)                                      NETSOL    791
            VM1N=(VREAL1**2+VIMAG1**2)                                  NETSOL    792
            IF(VM1N.LT.0.01.OR.VM1O.LT.0.01) GO TO 1501                 NETSOL    793
            VMM=SQRT(VM1N*VM1O)                                         NETSOL    794
            PA=PAHVDC(JPOSN)/VMM/VMOLD/PABASE                           NETSOL    795
            QA=QAHVDC(JPOSN)/VMM/VMOLD/PABASE                           NETSOL    796
            VX1=VROLD*PA+VIOLD*QA                                       NETSOL    797
            VX2=VREAL1*VR1O+VIMAG1*VI1O                                 NETSOL    798
            VY1=VIOLD*PA-VROLD*QA                                       NETSOL    799
            VY2=VIMAG1*VR1O-VREAL1*VI1O                                 NETSOL    800
            VX=VX1*VX2-VY1*VY2                                          NETSOL    801
            VY=VX1*VY2+VY1*VX2                                          NETSOL    802
            MSKK=MSK(K)                                                 NETSOL    803
            VOLT(MSKK)=VOLT(MSKK)+CMPLX(VX,VY)                          NETSOL    804
            MSKK=MSK(K2)                                                NETSOL    805
            VOLT(MSKK)=VOLT(MSKK)-CMPLX(VX,VY)                          NETSOL    806
         ENDIF                                                          NETSOL    807
 1501    CONTINUE                                                       NETSOL    808
      ENDIF                                                             NETSOL    809
C                                                                       NETSOL    810
      IF(NLOD.NE.0)THEN                                                 NETSOL    811
C                                                                       NETSOL    812
C     COMPUTE CURRENT FOR NON-LINEAR LOAD BUSES                         NETSOL    813
C                                                                       NETSOL    814
C      NTYPE =1 CONST. CUR  ,  NTYPE=2  CONST. MVA,                     NETSOL    815
C                                                                       NETSOL    816
C      NTYPE=3 VOLT-EXP     ,  NTYPE=4 COMP. LOAD                       NETSOL    817
C                                                                       NETSOL    818
         ISHIFT=0                                                       NETSOL    819
C                                                                       NETSOL    820
         DO 2450 I=1,NLOD                                               NETSOL    821
         NCOMP=NLCOMP(1,I)                                              NETSOL    822
         K=NLDOLD(I)                                                    NETSOL    823
         MSKK=MSK(K)                                                    NETSOL    824
C                                                                       NETSOL    825
              VREAL=REAL(OVOLT(K))                                      NETSOL    826
              VIMAG=AIMAG(OVOLT(K))                                     NETSOL    827
              VMG=SQRT(VREAL**2+VIMAG**2)                               NETSOL    828
              IF(ITER.EQ.0)THEN                                         NETSOL    829
                 IF(IVOLC(K).EQ.0)THEN                                  NETSOL    830
                    VREAL=VREAL*CSYSA-VIMAG*SSYSA                       NETSOL    831
                    VIMAG=VIMAG*CSYSA+REAL(OVOLT(K))*SSYSA              NETSOL    832
                    OVOLT(K)=CMPLX(VREAL,VIMAG)                         NETSOL    833
                 ENDIF                                                  NETSOL    834
              ENDIF                                                     NETSOL    835
              IF(IVOLC(K).EQ.0)IVOLC(K)=5                               NETSOL    836
              IF(VMG.LE.VTHZH)INLBS(I)=.TRUE.                           NETSOL    837
C                                                                       NETSOL    838
         DO 2400 ICOMP=1,NCOMP                                          NETSOL    839
          ISHIFT=ISHIFT+1                                               NETSOL    840
          IF(KNLBS(I) .EQ. 1)GOTO 2400                                  NETSOL    841
          NTYPE=NLTYPE(ISHIFT)                                          NETSOL    842
C                                                                       NETSOL    843
C                                                                       NETSOL    844
          GOTO (1550,1600,1650,1700)NTYPE                               NETSOL    845
C                                                                       NETSOL    846
C        FOR CONSTANT CURRENT LOAD REPRESENTATION                       NETSOL    847
C                                                                       NETSOL    848
 1550    CONTINUE                                                       NETSOL    849
C                                                                       NETSOL    850
              K3=K*3                                                    NETSOL    851
C                                                                       NETSOL    852
              IF(INLBS(I))GOTO 2400                                     NETSOL    853
C                                                                       NETSOL    854
C               IF(VMG.LE.VTHZH)THEN                                    NETSOL    855
C                CDLI=0.0                                               NETSOL    856
C                CQLI=0.0                                               NETSOL    857
C               ELSE                                                    NETSOL    858
               JNL=JDNLL(ISHIFT)                                        NETSOL    859
               CDKZ=DDAT(JNL+4)*VREAL-DDAT(JNL+5)*VIMAG                 NETSOL    860
               CQKZ=DDAT(JNL+4)*VIMAG+DDAT(JNL+5)*VREAL                 NETSOL    861
               CDLI=CDKZ-(DDAT(JNL+2)*VREAL+DDAT(JNL+3)*VIMAG)/VMG      NETSOL    862
               CQLI=CQKZ-(DDAT(JNL+2)*VIMAG-DDAT(JNL+3)*VREAL)/VMG      NETSOL    863
C               ENDIF                                                   NETSOL    864
           IF((LDEB))WRITE(IUD6,6400)K, INAME(K3-2),                    NETSOL    865
     &      INAME(K3-1),INAME(K3), VMG,CDLI,CQLI                        NETSOL    866
C--                                                                     NETSOL    867
               VOLT(MSKK)=VOLT(MSKK)+CMPLX(CDLI,CQLI)                   NETSOL    868
C                                                                       NETSOL    869
           GOTO 2400                                                    NETSOL    870
C                                                                       NETSOL    871
C         CONSTANT MVA LOAD REPRESENTATION                              NETSOL    872
C                                                                       NETSOL    873
 1600     CONTINUE                                                      NETSOL    874
C                                                                       NETSOL    875
                 K3=K*3                                                 NETSOL    876
C                                                                       NETSOL    877
              IF(INLBS(I))GOTO 2400                                     NETSOL    878
C                                                                       NETSOL    879
C                 IF(VMG.LE.VTHZH)THEN                                  NETSOL    880
C                   CDLI=0.0                                            NETSOL    881
C                   CQLI=0.0                                            NETSOL    882
C                 ELSE                                                  NETSOL    883
                   JNL=JDNLL(ISHIFT)                                    NETSOL    884
                   VMG1=VMG*VMG                                         NETSOL    885
                   CMW=DDAT(JNL+2)                                      NETSOL    886
                   CMX=DDAT(JNL+3)                                      NETSOL    887
                   VMG2=DDAT(JNL+4)                                     NETSOL    888
C  CURRENT DUE TO THE CONSTANT Z                                        NETSOL    889
                   CD1=CMW*VREAL+CMX*VIMAG                              NETSOL    890
                   CQ1=CMW*VIMAG-CMX*VREAL                              NETSOL    891
                   CDLI=CD1*(1.0/VMG2-1.0/VMG1)                         NETSOL    892
                   CQLI=CQ1*(1.0/VMG2-1.0/VMG1)                         NETSOL    893
C                 ENDIF                                                 NETSOL    894
C--                                                                     NETSOL    895
                 VOLT(MSKK)=VOLT(MSKK)+CMPLX(CDLI,CQLI)                 NETSOL    896
            IF(LDEB)WRITE(IUD6,6450)K,INAME(K3-2),                      NETSOL    897
     &        INAME(K3-1),INAME(K3),VMG,CDLI,CQLI                       NETSOL    898
C                                                                       NETSOL    899
      GOTO 2400                                                         NETSOL    900
C                                                                       NETSOL    901
C   VOLTAGE EXP LOAD                                                    NETSOL    902
C                                                                       NETSOL    903
 1650  CONTINUE                                                         NETSOL    904
C                                                                       NETSOL    905
C         IF(NTHL(1,K).NE.0)THEN                                        NETSOL    906
C                                                                       NETSOL    907
C     IF BUS VOLTAGE MAGNITUDE GREATER THAN ZERO, CALCULATE CURRENT     NETSOL    908
C     OTHERWISE SET CURRENT TO ZERO                                     NETSOL    909
C                                                                       NETSOL    910
               JNL=JDNLL(ISHIFT)                                        NETSOL    911
            IF(VMG.LE.0.0)THEN                                          NETSOL    912
               CDLI=0.0                                                 NETSOL    913
               CQLI=0.0                                                 NETSOL    914
C               IVOLC(K)=0                                              NETSOL    915
            ELSE                                                        NETSOL    916
C                                                                       NETSOL    917
C     RESTORE THE POINTER TO "DDAT"                                     NETSOL    918
C                                                                       NETSOL    919
               JK=IDDAT(JNL+1)                                          NETSOL    920
               ITERMP=ITERML(JK,1)                                      NETSOL    921
               ITERMQ=ITERML(JK,2)                                      NETSOL    922
               DEF=DDAT(JNL+8)                                          NETSOL    923
               VMNL=DDAT(JNL+3)                                         NETSOL    924
C                                                                       NETSOL    925
C     ACCOUNT FOR THE VOLTAGE EFFECT ON EXPONENTIAL ADJUSTMENT          NETSOL    926
C                                                                       NETSOL    927
               IF(VMG.LT.VTHZH)THEN                                     NETSOL    928
                  IVMG=.TRUE.                                           NETSOL    929
                  VMGL=VMG-VTHZL                                        NETSOL    930
                  IF(VMGL.LT.0.0) VMGL=0.0                              NETSOL    931
                  VTHZ=VTHZH-VTHZL                                      NETSOL    932
                  IF(VTHZ.LE.0.0)THEN                                   NETSOL    933
                   VXY=0.0                                              NETSOL    934
                  ELSE                                                  NETSOL    935
                   VXY=VMGL/VTHZ                                        NETSOL    936
                  ENDIF                                                 NETSOL    937
                  VFACT=1.0-VXY                                         NETSOL    938
               ELSE                                                     NETSOL    939
                  IVMG=.FALSE.                                          NETSOL    940
               ENDIF                                                    NETSOL    941
               IF((LDEB).AND.(IVMG))THEN                                NETSOL    942
                K3=K*3                                                  NETSOL    943
                WRITE(IUD6,5100)K,INAME(K3-2),INAME(K3-1),INAME(K3),    NETSOL    944
     &      IVMG,IVOLC(K),VMG,VTHZH,VTHZL,VFACT                         NETSOL    945
               ENDIF                                                    NETSOL    946
C                                                                       NETSOL    947
C     CURRENT COMPUTATION                                               NETSOL    948
C                                                                       NETSOL    949
               JL=JNL+10                                                NETSOL    950
C                                                                       NETSOL    951
C     ACCOUNT FOR TERMS IN P                                            NETSOL    952
C                                                                       NETSOL    953
               IF(ITERMP.EQ.0)THEN                                      NETSOL    954
                  CMW=0.0                                               NETSOL    955
                  JL=JL-4                                               NETSOL    956
               ELSE                                                     NETSOL    957
                  APPWR=DDAT(JL+2)                                      NETSOL    958
                  APPWR1=APPWR                                          NETSOL    959
                  CKMW=DDAT(JL+4)                                       NETSOL    960
                  IF(IVMG)THEN                                          NETSOL    961
                     APPWR1=APPWR*VXY                                   NETSOL    962
                     IF(IDDAT(JL+2).NE.0)CKMW=CKMW*VMNL**(APPWR*VFACT)  NETSOL    963
                  ENDIF                                                 NETSOL    964
                  FKMW=1.0+DEF*DDAT(JL+3)                               NETSOL    965
                  CMW=DDAT(JL+4)*VMNL**APPWR-CKMW*FKMW*VMG**APPWR1      NETSOL    966
                  IF(ITERMP.EQ.2)THEN                                   NETSOL    967
                     JL=JL+4                                            NETSOL    968
                     APPWR=DDAT(JL+2)                                   NETSOL    969
                     APPWR1=APPWR                                       NETSOL    970
                     CKMW=DDAT(JL+4)                                    NETSOL    971
                     IF(IVMG)THEN                                       NETSOL    972
                        APPWR1=APPWR*VXY                                NETSOL    973
                       IF(IDDAT(JL+2).NE.0)CKMW=                        NETSOL    974
     &                  CKMW*VMNL**(APPWR*VFACT)                        NETSOL    975
                     ENDIF                                              NETSOL    976
                     FKMW=1.0+DEF*DDAT(JL+3)                            NETSOL    977
                    CMW=CMW+DDAT(JL+4)*VMNL**APPWR-CKMW*FKMW*VMG**APPWR1NETSOL    978
                  ENDIF                                                 NETSOL    979
               ENDIF                                                    NETSOL    980
C                                                                       NETSOL    981
C     ACCOUNT FOR TERMS IN Q                                            NETSOL    982
C                                                                       NETSOL    983
               IF(ITERMQ.EQ.0)THEN                                      NETSOL    984
                  CMX=0.0                                               NETSOL    985
               ELSE                                                     NETSOL    986
                  JL=JL+4                                               NETSOL    987
                  AQPWR=DDAT(JL+2)                                      NETSOL    988
                  AQPWR1=AQPWR                                          NETSOL    989
                  CKMX=DDAT(JL+4)                                       NETSOL    990
                  IF(IVMG)THEN                                          NETSOL    991
                   AQPWR1=AQPWR*VXY                                     NETSOL    992
                   IF(IDDAT(JL+2).NE.0)CKMX=CKMX*VMNL**(AQPWR*VFACT)    NETSOL    993
                  ENDIF                                                 NETSOL    994
                  FKMX=1.0+DEF*DDAT(JL+3)                               NETSOL    995
                  CMX=DDAT(JL+4)*VMNL**AQPWR-CKMX*FKMX*VMG**AQPWR1      NETSOL    996
                  IF(ITERMQ.EQ.2)THEN                                   NETSOL    997
                     JL=JL+4                                            NETSOL    998
                     AQPWR=DDAT(JL+2)                                   NETSOL    999
                     AQPWR1=AQPWR                                       NETSOL   1000
                     CKMX=DDAT(JL+4)                                    NETSOL   1001
                     IF(IVMG)THEN                                       NETSOL   1002
                        AQPWR1=AQPWR*VXY                                NETSOL   1003
                        IF(IDDAT(JL+2).NE.0)CKMX=                       NETSOL   1004
     &                  CKMX*VMNL**(AQPWR*VFACT)                        NETSOL   1005
                     ENDIF                                              NETSOL   1006
                     FKMX=1.0+DEF*DDAT(JL+3)                            NETSOL   1007
                    CMX=CMX+DDAT(JL+4)*VMNL**AQPWR-CKMX*FKMX*VMG**AQPWR1NETSOL   1008
                  ENDIF                                                 NETSOL   1009
               ENDIF                                                    NETSOL   1010
C                                                                       NETSOL   1011
C     EVALUATE THE NON-LINEAR LOAD CURRENT                              NETSOL   1012
C                                                                       NETSOL   1013
               CDLI=CMW*VREAL+CMX*VIMAG                                 NETSOL   1014
               CQLI=CMW*VIMAG-CMX*VREAL                                 NETSOL   1015
               IF(LDEB) WRITE(IUD6,6350)ITERMP,ITERMQ,JNL,CDLI,CQLI     NETSOL   1016
C                                                                       NETSOL   1017
C     END OF IF(VMG.LT.0.0)                                             NETSOL   1018
C                                                                       NETSOL   1019
            ENDIF                                                       NETSOL   1020
C                                                                       NETSOL   1021
C     ACCOUNT FOR THE NON-LINEAR LOAD CURRENT IN THE CURRENT VECTOR     NETSOL   1022
C                                                                       NETSOL   1023
            DDAT(JNL+4)=CDLI                                            NETSOL   1024
            DDAT(JNL+5)=CQLI                                            NETSOL   1025
C--                                                                     NETSOL   1026
            VOLT(MSKK)=VOLT(MSKK)+CMPLX(CDLI,CQLI)                      NETSOL   1027
C                                                                       NETSOL   1028
C     ENDIF NTHL(1,K).NE.0                                              NETSOL   1029
C                                                                       NETSOL   1030
C         ENDIF                                                         NETSOL   1031
C                                                                       NETSOL   1032
      GOTO 2400                                                         NETSOL   1033
C                                                                       NETSOL   1034
C     FOR COMPOSITE LOAD REPRESENTATION                                 NETSOL   1035
C                                                                       NETSOL   1036
 1700 CONTINUE                                                          NETSOL   1037
C                                                                       NETSOL   1038
            JNL=JDNLL(ISHIFT)                                           NETSOL   1039
C                                                                       NETSOL   1040
C     IF BUS VOLTAGE MAGNITUDE GREATER THAN ZERO, CALCULATE CURRENT     NETSOL   1041
C     OTHERWISE SET CURRENT TO ZERO                                     NETSOL   1042
C                                                                       NETSOL   1043
            CDLI=0.0                                                    NETSOL   1044
            CQLI=0.0                                                    NETSOL   1045
            IF(VMG.LE.0.0)GOTO 2450                                     NETSOL   1046
C                                                                       NETSOL   1047
C     GET DATA AT BAR BUS                                               NETSOL   1048
C                                                                       NETSOL   1049
            RTB=DDAT(JNL+1)                                             NETSOL   1050
            XTB=DDAT(JNL+2)                                             NETSOL   1051
            GKKB=DDAT(JNL+4)                                            NETSOL   1052
            BKKB=DDAT(JNL+5)                                            NETSOL   1053
            VBAR2=DDAT(JNL+6)                                           NETSOL   1054
            VBARVR=DDAT(JNL+7)                                          NETSOL   1055
            VBARVI=DDAT(JNL+8)                                          NETSOL   1056
            CBARVR=VBARVR*RTB-VBARVI*XTB                                NETSOL   1057
            CBARVI=VBARVR*XTB+VBARVI*RTB                                NETSOL   1058
            VBARR=VREAL*VBARVR-VIMAG*VBARVI                             NETSOL   1059
            VBARI=VREAL*VBARVI+VIMAG*VBARVR                             NETSOL   1060
            VBAR=SQRT(VBAR2)                                            NETSOL   1061
            JL=JNL+11                                                   NETSOL   1062
            IF(LDEB2) WRITE(IUD6,6550)RTB,XTB,GKKB,BKKB                 NETSOL   1063
     &                ,VBARR,VBARI,VBAR                                 NETSOL   1064
C                                                                       NETSOL   1065
      ITRN=0                                                            NETSOL   1066
C                                                                       NETSOL   1067
C     ACCOUNT FOR THE VOLTAGE EFFECT ON EACH ALOAD COMPONENT            NETSOL   1068
C                                                                       NETSOL   1069
            VBARRK=VBARR                                                NETSOL   1070
            VBARIK=VBARI                                                NETSOL   1071
C                                                                       NETSOL   1072
            JLOLD=JL                                                    NETSOL   1073
C                                                                       NETSOL   1074
 1750       CONTINUE                                                    NETSOL   1075
            JL=JLOLD                                                    NETSOL   1076
            IF(VBARRK.LE.0..AND.VBARIK.LE.0.)GOTO 2450                  NETSOL   1077
            VBARK2=VBARRK*VBARRK+VBARIK*VBARIK                          NETSOL   1078
            VBARK=SQRT(VBARK2)                                          NETSOL   1079
            IF(VBARK2.NE.0)THEN                                         NETSOL   1080
              VBVBK2=VBAR2/VBARK2                                       NETSOL   1081
            ELSE                                                        NETSOL   1082
              VBVBK2=1.0                                                NETSOL   1083
            ENDIF                                                       NETSOL   1084
            VBVBK=SQRT(VBVBK2)                                          NETSOL   1085
            GKVRB=GKKB*VBARRK                                           NETSOL   1086
            GKVIB=GKKB*VBARIK                                           NETSOL   1087
            BKVRB=-BKKB*VBARRK                                          NETSOL   1088
            BKVIB=-BKKB*VBARIK                                          NETSOL   1089
            IF(LDEB2) WRITE(IUD6,6600)VBARRK,VBARIK,VBARK,VBVBK         NETSOL   1090
     &                ,GKVRB,GKVIB,BKVRB,BKVIB                          NETSOL   1091
C                                                                       NETSOL   1092
C-                                      LARGE MOTOR                     NETSOL   1093
            NLF=NOLD(K)                                                 NETSOL   1094
            KK=NLFLMB(NLF)                                              NETSOL   1095
            IF(KK.EQ.0)GOTO 1850                                        NETSOL   1096
            IF(NMOLD(KK).EQ.K)THEN                                      NETSOL   1097
              ASSIGN 1800 TO I700                                       NETSOL   1098
              GOTO 1950                                                 NETSOL   1099
 1800         CONTINUE                                                  NETSOL   1100
            ENDIF                                                       NETSOL   1101
C                                                                       NETSOL   1102
C-                                      SMALL MOTOR                     NETSOL   1103
 1850       CONTINUE                                                    NETSOL   1104
            NLF=NOLD(K)                                                 NETSOL   1105
            KK=NLFSMB(NLF)                                              NETSOL   1106
            IF(KK.EQ.0)GOTO 2000                                        NETSOL   1107
            IF(NMOLD(KK).EQ.K)THEN                                      NETSOL   1108
              ASSIGN 1900 TO I700                                       NETSOL   1109
              GOTO 1950                                                 NETSOL   1110
 1900         CONTINUE                                                  NETSOL   1111
            ENDIF                                                       NETSOL   1112
            GOTO 2000                                                   NETSOL   1113
C                                                                       NETSOL   1114
C     COMPUTE TERMINAL CURRENT FOR INDUCTION MOTOR(S)                   NETSOL   1115
C                                                                       NETSOL   1116
 1950       JSTATE=JXIMO(KK)                                            NETSOL   1117
            JM=JMDAT(KK)                                                NETSOL   1118
            IF (DDAT(JM+15).LT.0.0) GOTO I700                           NETSOL   1119
            IF (IDDAT(JM+1) .LT. 0) GOTO I700                           NETSOL   1120
            JY=JVIMO(KK)                                                NETSOL   1121
            NTYPE=IDDAT(JM+1)-10                                        NETSOL   1122
            DDAT(JM+37)=VBARRK                                          NETSOL   1123
            DDAT(JM+38)=VBARIK                                          NETSOL   1124
            GLK=GSM(JY+4)                                               NETSOL   1125
            BLK=BSM(JY+5)                                               NETSOL   1126
            IF (NTYPE.LE.3) THEN                                        NETSOL   1127
               VDBAR=XSTATE(JSTATE+1)                                   NETSOL   1128
               VQBAR=XSTATE(JSTATE+2)                                   NETSOL   1129
            ELSE                                                        NETSOL   1130
               VDBAR=0.0                                                NETSOL   1131
               VQBAR=0.0                                                NETSOL   1132
            END IF                                                      NETSOL   1133
            CDM(JY+8)=GLK*(VBARRK-VDBAR)+BLK*(VBARIK-VQBAR)             NETSOL   1134
            CQM(JY+9)=GLK*(VBARIK-VQBAR)-BLK*(VBARRK-VDBAR)             NETSOL   1135
            IF(LDEB2) WRITE(IUD6,6650)GLK,BLK,VREAL,VDBAR,VIMAG,VQBAR   NETSOL   1136
            IF(LDEB2) WRITE(IUD6,6700)CDM(JY+8),CQM(JY+9)               NETSOL   1137
C                                                                       NETSOL   1138
            CLMTP=IDDAT(JM+2)/100.                                      NETSOL   1139
            CLMTQ=DDAT(JM+3)/100.                                       NETSOL   1140
            CDLT=CDM(JY+8)-GKVRB*CLMTP-BKVIB*CLMTQ                      NETSOL   1141
            CQLT=CQM(JY+9)-GKVIB*CLMTP+BKVRB*CLMTQ                      NETSOL   1142
            CDLI=CDLI+CDLT                                              NETSOL   1143
            CQLI=CQLI+CQLT                                              NETSOL   1144
            IF(LDEB2) WRITE(IUD6,6750)CLMTP,CLMTQ,CDLT,CQLT,CDLI,CQLI   NETSOL   1145
            GOTO I700                                                   NETSOL   1146
C                                                                       NETSOL   1147
 2000     CONTINUE                                                      NETSOL   1148
            FCI=1.0-VBVBK                                               NETSOL   1149
            FCP=1.0-VBVBK2                                              NETSOL   1150
C                                                                       NETSOL   1151
 2050     JTYPE=IDDAT(JL+1)                                             NETSOL   1152
          IF(JTYPE.EQ.0)GOTO 2300                                       NETSOL   1153
C                                                                       NETSOL   1154
          GOTO(2100,2150,2200,2250)JTYPE                                NETSOL   1155
C                                                                       NETSOL   1156
 2100     CONTINUE                                                      NETSOL   1157
C-                                      DISCHARGE LIGHTING              NETSOL   1158
C                                                                       NETSOL   1159
              CLDLP=IDDAT(JL+2)/100.                                    NETSOL   1160
              PK1=DDAT(JL+3)                                            NETSOL   1161
              PK2=DDAT(JL+4)                                            NETSOL   1162
              QK=DDAT(JL+5)                                             NETSOL   1163
              JL=JL+6                                                   NETSOL   1164
C                                                                       NETSOL   1165
              GRAT=VBARVR*GKKB-VBARVI*BKKB                              NETSOL   1166
              BRAT=VBARVI*GKKB+VBARVR*BKKB                              NETSOL   1167
              QCV=-0.435890*CLDLP*GRAT/BRAT                             NETSOL   1168
              IF(VBARK.GT.0.75)THEN                                     NETSOL   1169
                PCI=CLDLP*PK2*VBAR                                      NETSOL   1170
                PCP=CLDLP*(1.0-PK2*VBAR)                                NETSOL   1171
                FCVDL=1.0-VBVBK**(2.0-QK)                               NETSOL   1172
                CDLI=CDLI+(PCI*FCI+PCP*FCP)*GKVRB+QCV*BKVIB*FCVDL       NETSOL   1173
                CQLI=CQLI+(PCI*FCI+PCP*FCP)*GKVIB-QCV*BKVRB*FCVDL       NETSOL   1174
              ELSE                                                      NETSOL   1175
                IF(VBARK.GT.0.65)THEN                                   NETSOL   1176
                PCI1=CLDLP*(PK1-PK2)*(VBAR-0.75)                        NETSOL   1177
                PCI=CLDLP*PK1*VBAR                                      NETSOL   1178
                PCP=CLDLP*((1.0-PK2*VBAR)-0.75*(PK1-PK2))               NETSOL   1179
                FCVDL=1.0-VBVBK**(2.0-QK)                               NETSOL   1180
                CDLI=CDLI+(PCI*FCI+PCP*FCP-PCI1)*GKVRB+QCV*BKVIB*FCVDL  NETSOL   1181
                CQLI=CQLI+(PCI*FCI+PCP*FCP-PCI1)*GKVIB-QCV*BKVRB*FCVDL  NETSOL   1182
                ELSE                                                    NETSOL   1183
                CDLI=CDLI+GKVRB*CLDLP+BKVIB*QCV                         NETSOL   1184
                CQLI=CQLI+GKVIB*CLDLP-BKVRB*QCV                         NETSOL   1185
                ENDIF                                                   NETSOL   1186
              ENDIF                                                     NETSOL   1187
              IF(LDEB2) WRITE(IUD6,6800)CLDLP,PK1,PK2,QK,PCI            NETSOL   1188
     &                  ,PCP,QCV,FCVDL,CDLI,CQLI                        NETSOL   1189
              IF(LDEB3) WRITE(IUD6,7050)TS,VBAR,CDLI,CQLI               NETSOL   1190
C                                                                       NETSOL   1191
              GOTO 2050                                                 NETSOL   1192
C                                                                       NETSOL   1193
 2150        CONTINUE                                                   NETSOL   1194
C-                                      TRANSFORMER SATURATION          NETSOL   1195
C                                                                       NETSOL   1196
              CLTSQ=IDDAT(JL+2)/100.                                    NETSOL   1197
              TV1=DDAT(JL+3)                                            NETSOL   1198
              TG1=1.0/DDAT(JL+4)                                        NETSOL   1199
              TG2=1.0/DDAT(JL+5)                                        NETSOL   1200
              TG12=TG2-TG1                                              NETSOL   1201
              JL=JL+6                                                   NETSOL   1202
C                                                                       NETSOL   1203
              IF(VBARK.LE.TV1)THEN                                      NETSOL   1204
                IF(VBAR.GT.TV1)QCI=1.0-TV1/VBARK                        NETSOL   1205
              ELSE                                                      NETSOL   1206
                IF(VBAR.GT.TV1)THEN                                     NETSOL   1207
                  QCI=TV1*(1.0-VBVBK)/VBAR                              NETSOL   1208
                ELSE                                                    NETSOL   1209
                  QCI=TV1/VBAR-1.0                                      NETSOL   1210
                ENDIF                                                   NETSOL   1211
              ENDIF                                                     NETSOL   1212
              QCI=QCI*TG12                                              NETSOL   1213
              CDLI=CDLI-QCI*VBARIK                                      NETSOL   1214
              CQLI=CQLI+QCI*VBARRK                                      NETSOL   1215
              IF(LDEB2) WRITE(IUD6,6850)CLTSQ,TV1,TG1,TG2,QCI,CDLI,CQLI NETSOL   1216
              IF(LDEB3) WRITE(IUD6,7100)TS,VBAR,CDLI,CQLI               NETSOL   1217
            GOTO 2050                                                   NETSOL   1218
C                                                                       NETSOL   1219
 2200       CONTINUE                                                    NETSOL   1220
C-                                      CONSTANT MVA                    NETSOL   1221
C                                                                       NETSOL   1222
              CLCPP=IDDAT(JL+2)/100.                                    NETSOL   1223
              CLCPQ=IDDAT(JL+3)/100.                                    NETSOL   1224
              JL=JL+5                                                   NETSOL   1225
C                                                                       NETSOL   1226
              IF(VBARK.GT.VTHZH)THEN                                    NETSOL   1227
                PCP=CLCPP                                               NETSOL   1228
                QCP=CLCPQ                                               NETSOL   1229
                CDLI=CDLI+(PCP*GKVRB+QCP*BKVIB)*FCP                     NETSOL   1230
                CQLI=CQLI+(PCP*GKVIB-QCP*BKVRB)*FCP                     NETSOL   1231
              ELSE                                                      NETSOL   1232
                IF(VBARK.GT.VTHZL)THEN                                  NETSOL   1233
                  PCP=CLCPP                                             NETSOL   1234
                  QCP=CLCPQ                                             NETSOL   1235
                  VKP=2.0*(VBARK-VTHZL)/(VTHZH-VTHZL)                   NETSOL   1236
                  FCVCP=1.0-VBVBK**VKP                                  NETSOL   1237
                  CDLI=CDLI+(PCP*GKVRB+QCP*BKVIB)*FCVCP                 NETSOL   1238
                  CQLI=CQLI+(PCP*GKVIB-QCP*BKVRB)*FCVCP                 NETSOL   1239
                ENDIF                                                   NETSOL   1240
              ENDIF                                                     NETSOL   1241
              IF(LDEB2) WRITE(IUD6,6900)CLCPP,CLCPQ,PCP,QCP,CDLI,CQLI   NETSOL   1242
            GOTO 2050                                                   NETSOL   1243
C                                                                       NETSOL   1244
 2250       CONTINUE                                                    NETSOL   1245
C-                                      REMANING LOAD                   NETSOL   1246
C                                                                       NETSOL   1247
              CLRMP=DDAT(JL+2)/100.                                     NETSOL   1248
              CLRMQ=DDAT(JL+3)/100.                                     NETSOL   1249
              RMKP=DDAT(JL+4)                                           NETSOL   1250
              JL=JL+6                                                   NETSOL   1251
C                                                                       NETSOL   1252
              IF(VBARK.GT.VTHZH)THEN                                    NETSOL   1253
                PCV=CLRMP                                               NETSOL   1254
                IF(RMKP.EQ.2.0)THEN                                     NETSOL   1255
                  FCVRM=0.0                                             NETSOL   1256
                ELSE                                                    NETSOL   1257
                  FCVRM=1.0-VBVBK**(2.0-RMKP)                           NETSOL   1258
                ENDIF                                                   NETSOL   1259
                CDLI=CDLI+PCV*GKVRB*FCVRM                               NETSOL   1260
                CQLI=CQLI+PCV*GKVIB*FCVRM                               NETSOL   1261
              ELSE                                                      NETSOL   1262
                IF(VBARK.GT.VTHZL)THEN                                  NETSOL   1263
                  PCV=CLRMP                                             NETSOL   1264
                  VKP=(2.0-RMKP)*(VBARK-VTHZL)/(VTHZH-VTHZL)            NETSOL   1265
                  FCVRM=1.0-VBVBK**VKP                                  NETSOL   1266
                  CDLI=CDLI+PCV*GKVRB*FCVRM                             NETSOL   1267
                  CQLI=CQLI+PCV*GKVIB*FCVRM                             NETSOL   1268
                ENDIF                                                   NETSOL   1269
              ENDIF                                                     NETSOL   1270
              IF(LDEB2) WRITE(IUD6,6950)CLRMP,CLRMQ,PCV,FCVRM,CDLI,CQLI NETSOL   1271
C                                                                       NETSOL   1272
              GOTO 2050                                                 NETSOL   1273
C                                                                       NETSOL   1274
 2300       CONTINUE                                                    NETSOL   1275
C                                                                       NETSOL   1276
            VBARRN=VBARRK+CBARVR*CDLI-CBARVI*CQLI                       NETSOL   1277
            VBARIN=VBARIK+CBARVR*CQLI+CBARVI*CDLI                       NETSOL   1278
C                                                                       NETSOL   1279
            DFVBR=ABS(VBARRK-VBARRN)                                    NETSOL   1280
            DFVBI=ABS(VBARIK-VBARIN)                                    NETSOL   1281
            IF(LDEB2)WRITE(IUD6,7000)VBARRN,VBARIN,VBARRK               NETSOL   1282
     *               ,VBARIK,DFVBR,DFVBI                                NETSOL   1283
            IF(DFVBR.LT.ERTOL)THEN                                      NETSOL   1284
              IF(DFVBI.LT.ERTOL) GOTO 2350                              NETSOL   1285
            ENDIF                                                       NETSOL   1286
            VBARRK=VBARRN                                               NETSOL   1287
            VBARIK=VBARIN                                               NETSOL   1288
            ITRN=ITRN+1                                                 NETSOL   1289
            IF(ITRN.LE.5) GOTO 1750                                     NETSOL   1290
 2350     CONTINUE                                                      NETSOL   1291
          IF(LDEB3.AND.ITRN.NE.0)WRITE(IUD6,7150)ITRN                   NETSOL   1292
C--                                                                     NETSOL   1293
C          VOLBAR(I)=CMPLX(VBARRN,VBARIN)                               NETSOL   1294
          CDLI=VBARVR*CDLI-VBARVI*CQLI                                  NETSOL   1295
          CQLI=VBARVR*CQLI+VBARVI*CDLI                                  NETSOL   1296
          VOLT(MSKK)=VOLT(MSKK)+CMPLX(CDLI,CQLI)                        NETSOL   1297
C                                                                       NETSOL   1298
 2400    CONTINUE                                                       NETSOL   1299
C                                                                       NETSOL   1300
 2450    CONTINUE                                                       NETSOL   1301
C  =============                                                        NETSOL   1302
C    ENDIF FOR NLOD .NE.0                                               NETSOL   1303
      ENDIF                                                             NETSOL   1304
C  =================                                                    NETSOL   1305
C      REDUCED LOAD BUSES                                               NETSOL   1306
C                                                                       NETSOL   1307
         IF(LOBUS.EQ.1)THEN                                             NETSOL   1308
C                                                                       NETSOL   1309
C        FOR CONSTANT CURRENT LOAD REPRESENTATION                       NETSOL   1310
C                                                                       NETSOL   1311
            IF(IKCUR.NE.0)THEN                                          NETSOL   1312
             DO 2500 I=1,IKCUR                                          NETSOL   1313
              II=I*3                                                    NETSOL   1314
              K=ICBUS(II-2)                                             NETSOL   1315
              K3=K*3                                                    NETSOL   1316
C                                                                       NETSOL   1317
              VREAL=REAL(OVOLT(K))                                      NETSOL   1318
              VIMAG=AIMAG(OVOLT(K))                                     NETSOL   1319
C                                                                       NETSOL   1320
              IF(ITER.EQ.0)THEN                                         NETSOL   1321
                 IF(IVOLC(K).EQ.0)THEN                                  NETSOL   1322
                    VREAL=VREAL*CSYSA-VIMAG*SSYSA                       NETSOL   1323
                    VIMAG=VIMAG*CSYSA+REAL(OVOLT(K))*SSYSA              NETSOL   1324
                    OVOLT(K)=CMPLX(VREAL,VIMAG)                         NETSOL   1325
                 ENDIF                                                  NETSOL   1326
              ENDIF                                                     NETSOL   1327
              IF(IVOLC(K).EQ.0)IVOLC(K)=5                               NETSOL   1328
              VMG=SQRT(VREAL**2+VIMAG**2)                               NETSOL   1329
C                                                                       NETSOL   1330
               IF(VMG .GT. 1.0E-6)THEN                                  NETSOL   1331
                CDLI=(CBUS(II-1)*VREAL+CBUS(II)*VIMAG)/VMG              NETSOL   1332
                CQLI=(CBUS(II-1)*VIMAG-CBUS(II)*VREAL)/VMG              NETSOL   1333
               ELSE                                                     NETSOL   1334
                CDLI=0.                                                 NETSOL   1335
                CQLI=0.                                                 NETSOL   1336
               ENDIF                                                    NETSOL   1337
C                                                                       NETSOL   1338
               IF((LDEB))WRITE(IUD6,6400)K, INAME(K3-2),                NETSOL   1339
     &         INAME(K3-1),INAME(K3), VMG,CDLI,CQLI                     NETSOL   1340
C--                                                                     NETSOL   1341
               MSKK=MSK(K)                                              NETSOL   1342
               VOLT(MSKK)=VOLT(MSKK)+CMPLX(CDLI,CQLI)                   NETSOL   1343
C                                                                       NETSOL   1344
 2500        CONTINUE                                                   NETSOL   1345
              ENDIF                                                     NETSOL   1346
C                                                                       NETSOL   1347
C         CONSTANT MVA LOAD REPRESENTATION                              NETSOL   1348
C                                                                       NETSOL   1349
              IF(IKMVA.NE.0)THEN                                        NETSOL   1350
                DO 2550 I=1,IKMVA                                       NETSOL   1351
                 II=I*3                                                 NETSOL   1352
                 K=IPBUS(II-2)                                          NETSOL   1353
                 K3=K*3                                                 NETSOL   1354
                 VREAL=REAL(OVOLT(K))                                   NETSOL   1355
                 VIMAG=AIMAG(OVOLT(K))                                  NETSOL   1356
                 VMG2=VREAL**2+VIMAG**2                                 NETSOL   1357
                 IF(ITER.EQ.0)THEN                                      NETSOL   1358
                    IF(IVOLC(K).EQ.0)THEN                               NETSOL   1359
                       VREAL=VREAL*CSYSA-VIMAG*SSYSA                    NETSOL   1360
                       VIMAG=VIMAG*CSYSA+REAL(OVOLT(K))*SSYSA           NETSOL   1361
                       OVOLT(K)=CMPLX(VREAL,VIMAG)                      NETSOL   1362
                    ENDIF                                               NETSOL   1363
                 ENDIF                                                  NETSOL   1364
C                                                                       NETSOL   1365
                 IF(VMG2.GT.1.0E-6)THEN                                 NETSOL   1366
                   CDLI=(PBUS(II-1)*VREAL+PBUS(II)*VIMAG)/VMG2          NETSOL   1367
                   CQLI=(PBUS(II-1)*VIMAG-PBUS(II)*VREAL)/VMG2          NETSOL   1368
                 ELSE                                                   NETSOL   1369
                   CDLI=0.0                                             NETSOL   1370
                   CQLI=0.0                                             NETSOL   1371
                 ENDIF                                                  NETSOL   1372
C--                                                                     NETSOL   1373
                 MSKK=MSK(K)                                            NETSOL   1374
                 VOLT(MSKK)=VOLT(MSKK)+CMPLX(CDLI,CQLI)                 NETSOL   1375
C                                                                       NETSOL   1376
                 IF(LDEB)WRITE(IUD6,6450)K,INAME(K3-2),                 NETSOL   1377
     &           INAME(K3-1),INAME(K3),SQRT(VMG2),CDLI,CQLI             NETSOL   1378
C                                                                       NETSOL   1379
 2550         CONTINUE                                                  NETSOL   1380
               ENDIF                                                    NETSOL   1381
C                                                                       NETSOL   1382
C                                                                       NETSOL   1383
           ENDIF                                                        NETSOL   1384
C==                                                                     NETSOL   1385
         IF (LDEB1) THEN                                                NETSOL   1386
         IF (TS.LE.0.01.AND.IR.EQ.10)                                   NETSOL   1387
     +        WRITE(99,5000) TS,(VOLT(I),I=1,NLFBUS)                    NETSOL   1388
         ENDIF                                                          NETSOL   1389
C                                                                       NETSOL   1390
C       ADD THE INFINITE BUS CURRENT HERE                               NETSOL   1391
C                                                                       NETSOL   1392
         IF(IFNBUS.NE.0)THEN                                            NETSOL   1393
          DO 2600 II=1,KFBUS                                            NETSOL   1394
           KK=KCINF(II)                                                 NETSOL   1395
           MSKK=MSK(KK)                                                 NETSOL   1396
           VOLT(MSKK)=VOLT(MSKK)+CINF(II)                               NETSOL   1397
 2600     CONTINUE                                                      NETSOL   1398
         ENDIF                                                          NETSOL   1399
C                                                                       NETSOL   1400
C==                                                                     NETSOL   1401
C                                                                       NETSOL   1402
      IF(LDEB)WRITE(IUD6,5900) (VOLT(KK),KK=1,LASTCU)                   NETSOL   1403
      INSTR=4                                                           NETSOL   1404
      CALL AUPDSC (INSTR,NLAST)                                         NETSOL   1405
C                                                                       NETSOL   1406
C                                                                       NETSOL   1407
      NV=1                                                              NETSOL   1408
      CALL ASOLSC (INSTR,NLAST,NV)                                      NETSOL   1409
C                                                                       NETSOL   1410
C     CHECK CONVERGENCE OF SALIENTED GENERATOR BUS                      NETSOL   1411
C     &  NON-LINEAR LOAD BUS VOLTAGE                                    NETSOL   1412
C                                                                       NETSOL   1413
      ERMAX=0.0                                                         NETSOL   1414
      EIMAX=0.0                                                         NETSOL   1415
      ITER=ITER+1                                                       NETSOL   1416
C                                                                       NETSOL   1417
      IF(ISKIP.NE.0)THEN                                                NETSOL   1418
       ISKIP=1                                                          NETSOL   1419
       IRRR=IR*ISKIP                                                    NETSOL   1420
       ELSE                                                             NETSOL   1421
        IRRR=4                                                          NETSOL   1422
      ENDIF                                                             NETSOL   1423
C                                                                       NETSOL   1424
      IF (LITER.EQ.0) THEN                                              NETSOL   1425
C                                                                       NETSOL   1426
         IF (IRRR.EQ.1.OR.IRRR.EQ.4) THEN                               NETSOL   1427
            ICOUNT=2                                                    NETSOL   1428
C                                                                       NETSOL   1429
            DO 2650 I=1,LASTCU                                          NETSOL   1430
               IF (IVREQ(I).EQ.0) GOTO 2650                             NETSOL   1431
               IF (IVOLC(I).NE.0) THEN                                  NETSOL   1432
                  ERDFK=REAL(VOLT(I))-REAL(OVOLT(I))                    NETSOL   1433
                  EIDFK=AIMAG(VOLT(I))-AIMAG(OVOLT(I))                  NETSOL   1434
                  IF (ABS(ERDFK).GT.ERTOL.OR.ABS(EIDFK).GT.ERTOL) THEN  NETSOL   1435
                     ICOUNT=ICOUNT+1                                    NETSOL   1436
                     JJMOD=MOD(ICOUNT,2)                                NETSOL   1437
                     IF (IPREF) THEN                                    NETSOL   1438
                        IF (IIL.GE.60) THEN                             NETSOL   1439
                           IF (IIL.GE.100) IIL=MOD(IIL,100)+5           NETSOL   1440
                           IF (IIL.GE.58) THEN                          NETSOL   1441
                              CALL PAGE6                                NETSOL   1442
                              IIL=10                                    NETSOL   1443
                           END IF                                       NETSOL   1444
                           WRITE(IU6,5300)                              NETSOL   1445
                        END IF                                          NETSOL   1446
                        IF (ILL.GE.60) THEN                             NETSOL   1447
C                           WRITE(IU17,5300)                            NETSOL   1448
C                           ILL=10                                      NETSOL   1449
                        END IF                                          NETSOL   1450
                        K1=NOLD(I)                                      NETSOL   1451
                        K3=I*3                                          NETSOL   1452
                        IF (JJMOD.NE.0) THEN                            NETSOL   1453
                           WRITE(PROUT1,5350) ITER,K1,INAME(K3-2)       NETSOL   1454
     1                                       ,INAME(K3-1),INAME(K3)     NETSOL   1455
     2                                       ,ERDFK,EIDFK               NETSOL   1456
                        ELSE                                            NETSOL   1457
                           WRITE(PROUT2,5400) K1,INAME(K3-2),INAME(K3-1)NETSOL   1458
     1                                       ,INAME(K3),ERDFK,EIDFK     NETSOL   1459
                        END IF                                          NETSOL   1460
                        IF (JJMOD.EQ.0) THEN                            NETSOL   1461
C                           WRITE(IU17,5450) PROUT1,PROUT2              NETSOL   1462
                           WRITE(IU6,5450) PROUT1,PROUT2                NETSOL   1463
C                           ILL=ILL+1                                   NETSOL   1464
                           IIL=IIL+1                                    NETSOL   1465
                        END IF                                          NETSOL   1466
                     END IF                                             NETSOL   1467
                  END IF                                                NETSOL   1468
                  IF (LDEB) THEN                                        NETSOL   1469
                     NLF=NOLD(I)                                        NETSOL   1470
                     K3=I*3                                             NETSOL   1471
                     WRITE(IUD6,5950) NLF,INAME(K3-2),INAME(K3-1)       NETSOL   1472
     1                               ,INAME(K3),ERDFK,EIDFK             NETSOL   1473
     2                               ,CABS(VOLT(I)),CABS(OVOLT(I))      NETSOL   1474
                  END IF                                                NETSOL   1475
                  IF (ABS(ERDFK).GT.ERMAX) THEN                         NETSOL   1476
                     ERMAX=ABS(ERDFK)                                   NETSOL   1477
                     IRMAX=I                                            NETSOL   1478
                  END IF                                                NETSOL   1479
                  IF (ABS(EIDFK).GT.EIMAX) THEN                         NETSOL   1480
                     EIMAX=ABS(EIDFK)                                   NETSOL   1481
                     IIMAX=I                                            NETSOL   1482
                  END IF                                                NETSOL   1483
               END IF                                                   NETSOL   1484
 2650       CONTINUE                                                    NETSOL   1485
C                                                                       NETSOL   1486
            IF (IPREF) THEN                                             NETSOL   1487
               IF (JJMOD.EQ.1) THEN                                     NETSOL   1488
                  JJMOD=0                                               NETSOL   1489
                  IF (IIL.GE.60) THEN                                   NETSOL   1490
                     IF (IIL.GE.100) IIL=MOD(IIL,100)+5                 NETSOL   1491
                     IF (IIL.GE.58) THEN                                NETSOL   1492
                        CALL PAGE6                                      NETSOL   1493
                        IIL=10                                          NETSOL   1494
                     END IF                                             NETSOL   1495
                     WRITE(IU6,5300)                                    NETSOL   1496
                  END IF                                                NETSOL   1497
C                  IF (ILL.GE.60) THEN                                  NETSOL   1498
C                     WRITE(IU17,5300)                                  NETSOL   1499
C                     ILL=10                                            NETSOL   1500
C                  END IF                                               NETSOL   1501
                  WRITE(IU6,5450) PROUT1                                NETSOL   1502
C                  WRITE(IU17,5450) PROUT1                              NETSOL   1503
               END IF                                                   NETSOL   1504
            END IF                                                      NETSOL   1505
C                                                                       NETSOL   1506
C     DECIDE IF CONVERGENCE CHECK IS NECESSARY                          NETSOL   1507
C                                                                       NETSOL   1508
            IF (ERMAX.GT.ERTOL.OR.EIMAX.GT.ERTOL) THEN                  NETSOL   1509
               IF (ITER.LT.MAXIT) GOTO 550                              NETSOL   1510
               K1=NOLD(IRMAX)                                           NETSOL   1511
               K3=IRMAX*3                                               NETSOL   1512
               KK1=NOLD(IIMAX)                                          NETSOL   1513
               KK3=IIMAX*3                                              NETSOL   1514
               IF (LDEB) WRITE(IUD6,5650) (JJ,VOLT(JJ),JJ=1,LASTV2)     NETSOL   1515
               WRITE(IU6,5250) MAXIT,K1,INAME(K3-2),INAME(K3-1)         NETSOL   1516
     1                         ,INAME(K3),ERMAX,KK1,INAME(KK3-2)        NETSOL   1517
     2                         ,INAME(KK3-1),INAME(KK3),EIMAX,TS        NETSOL   1518
               IR=4                                                     NETSOL   1519
               ITSTRN=2                                                 NETSOL   1520
               MSG='NETSOL:ITERATION COUNT EXCEEDED'                    NETSOL   1521
               CALL ASTOP(MSG,31)                                       NETSOL   1522
            END IF                                                      NETSOL   1523
            IF (IPREF) CALL PAGE6                                       NETSOL   1524
            IF (LDEB) THEN                                              NETSOL   1525
               IF (ITER.GE.10)                                          NETSOL   1526
     1         WRITE(IUD6,5500) ERMAX,NOLD(IRMAX),EIMAX,NOLD(IIMAX)     NETSOL   1527
            END IF                                                      NETSOL   1528
C                                                                       NETSOL   1529
         END IF                                                         NETSOL   1530
C                                                                       NETSOL   1531
C     ENDIF LITER.EQ.0                                                  NETSOL   1532
C                                                                       NETSOL   1533
      END IF                                                            NETSOL   1534
C                                                                       NETSOL   1535
C     SET DEAD BAND TOLERANCE                                           NETSOL   1536
C                                                                       NETSOL   1537
      IF (IPREF) THEN                                                   NETSOL   1538
         DBTOL=REAL(ITER)*ERTOL                                         NETSOL   1539
         IF (DBTOL.GT.0.0005) DBTOL=0.0005                              NETSOL   1540
         DBTOL=0.0                                                      NETSOL   1541
      END IF                                                            NETSOL   1542
C                                                                       NETSOL   1543
C     UPDATE TOTAL ITERATION  COUNT                                     NETSOL   1544
C                                                                       NETSOL   1545
      ITTER=ITTER+ITER                                                  NETSOL   1546
C                                                                       NETSOL   1547
C      IF(KVOLT.NE.0)THEN                                               NETSOL   1548
C                                                                       NETSOL   1549
C                                                                       NETSOL   1550
C         NV=1                                                          NETSOL   1551
C         INSTR=3                                                       NETSOL   1552
C         CALL ASOLSC (INSTR,NLAST,NV)                                  NETSOL   1553
C         KVOLT=0                                                       NETSOL   1554
C      ENDIF                                                            NETSOL   1555
C                                                                       NETSOL   1556
      IF(NRSTEP.EQ.1)THEN                                               NETSOL   1557
         NRSTEP=0                                                       NETSOL   1558
C                                                                       NETSOL   1559
C     FIND GENERATOR WITH MAXIMUM ANGLE CHANGE                          NETSOL   1560
C                                                                       NETSOL   1561
         CSTIME=TS+H                                                    NETSOL   1562
         KGANCH=0                                                       NETSOL   1563
         MGANCH=0                                                       NETSOL   1564
         GANCH=0.0                                                      NETSOL   1565
         DO 2750 K=1,IPNODE                                             NETSOL   1566
            NGANCH=NTHG(K)-1                                            NETSOL   1567
            NEND=NTHG(K+1)-1                                            NETSOL   1568
 2700       NGANCH=NGANCH+1                                             NETSOL   1569
            JDG=JCONTA(1,NGANCH)                                        NETSOL   1570
            IF (DDAT(JDG+1).GT.1.0E-5) THEN                             NETSOL   1571
               JSG=MSTATE(1,NGANCH)                                     NETSOL   1572
               ANGCH=ABS(XSTATE(JSG+2)-XPREV(1,JSG+2))                  NETSOL   1573
               IF (ANGCH.GT.GANCH) THEN                                 NETSOL   1574
                  MGANCH=NGANCH                                         NETSOL   1575
                  KGANCH=K                                              NETSOL   1576
                  GANCH=ANGCH                                           NETSOL   1577
               END IF                                                   NETSOL   1578
            END IF                                                      NETSOL   1579
            IF (NGANCH.LT.NEND) GOTO 2700                               NETSOL   1580
 2750    CONTINUE                                                       NETSOL   1581
C                                                                       NETSOL   1582
C         IF(NBFT.NE.0)THEN                                             NETSOL   1583
C         N=NT                                                          NETSOL   1584
C         NC=0                                                          NETSOL   1585
C         DO 2800 K=IPNODX,ICNODE                                       NETSOL   1586
C         N=N+1                                                         NETSOL   1587
C         NC=NC+1                                                       NETSOL   1588
C         JSG=MSTATB(1,NC)                                              NETSOL   1589
C         JDG=JCONTB(1,NC)                                              NETSOL   1590
C         IF(IDDAT(JDG+1).NE.0)THEN                                     NETSOL   1591
C         JSG=MSTATB(1,NC)                                              NETSOL   1592
C         ANGCH=ABS(XSTATE(JSG+2)-XPREV(1,JSG+2))                       NETSOL   1593
C            IF(ANGCH.GT.GANCH)THEN                                     NETSOL   1594
C            MGANCH=-1                                                  NETSOL   1595
C            KGANCH=K                                                   NETSOL   1596
C            GANCH=ANGCH                                                NETSOL   1597
C            ENDIF                                                      NETSOL   1598
C         ENDIF                                                         NETSOL   1599
C 2800    CONTINUE                                                      NETSOL   1600
C         ENDIF                                                         NETSOL   1601
C                                                                       NETSOL   1602
C                                                                       NETSOL   1603
         GANCH=GANCH*DEGREE                                             NETSOL   1604
         CALL PVMXMN(IIL)                                               NETSOL   1605
         IF(IIL.GE.60)THEN                                              NETSOL   1606
            IF(IIL.GE.100) IIL=MOD(IIL,100)+4                           NETSOL   1607
            IF(IIL .GE. 52)THEN                                         NETSOL   1608
              CALL PAGE6                                                NETSOL   1609
              IIL=7                                                     NETSOL   1610
            ENDIF                                                       NETSOL   1611
            WRITE(IU6,7300)                                             NETSOL   1612
         ENDIF                                                          NETSOL   1613
         K3=KGANCH*3                                                    NETSOL   1614
         IF(MGANCH.GT.0.AND.GANCH.GT.0.0)THEN                           NETSOL   1615
            WRITE(IU6,7200) CSTIME,NOLD(KGANCH),INAME(K3-2),INAME(K3-1) NETSOL   1616
     *                     ,INAME(K3),NDGC(MGANCH),GANCH                NETSOL   1617
         WRITE(LOUT,7200) CSTIME,NOLD(KGANCH),INAME(K3-2),INAME(K3-1)   NETSOL   1618
     *                   ,INAME(K3),NDGC(MGANCH),GANCH                  NETSOL   1619
         ELSEIF(MGANCH.LT.0.AND.GANCH.GT.0.0)THEN                       NETSOL   1620
            WRITE(IU6,7250) CSTIME,NOLD(KGANCH),INAME(K3-2),INAME(K3-1) NETSOL   1621
     *                     ,INAME(K3),GANCH                             NETSOL   1622
         WRITE(LOUT,7250) CSTIME,NOLD(KGANCH),INAME(K3-2),INAME(K3-1)   NETSOL   1623
     *                   ,INAME(K3),GANCH                               NETSOL   1624
         ELSE                                                           NETSOL   1625
         WRITE(IU6,7350) CSTIME,GANCH                                   NETSOL   1626
         WRITE(LOUT,7350) CSTIME,GANCH                                  NETSOL   1627
         ENDIF                                                          NETSOL   1628
         IIL=IIL+1                                                      NETSOL   1629
C                                                                       NETSOL   1630
      ENDIF                                                             NETSOL   1631
C                                                                       NETSOL   1632
      IF(LDEB)THEN                                                      NETSOL   1633
      DO 2850 JJ=1,LASTV2                                               NETSOL   1634
      K1=NOLD(JJ)                                                       NETSOL   1635
      K3=K1*3                                                           NETSOL   1636
      WRITE(IUD6,5700)NOLD(JJ),INAME(K3-2),INAME(K3-1),INAME(K3)        NETSOL   1637
     & ,CABS(VOLT(JJ))                                                  NETSOL   1638
 2850 CONTINUE                                                          NETSOL   1639
      ENDIF                                                             NETSOL   1640
C                                                                       NETSOL   1641
C     COMPUTE TERMINAL CURRENT FOR PARK'S MACHINE                       NETSOL   1642
C***NEED VERIFICATION                                                   NETSOL   1643
C                                                                       NETSOL   1644
      IF(NT.NE.0)THEN                                                   NETSOL   1645
         DO 2950 I=1,NPGEN                                              NETSOL   1646
         K=KPGEN(1,I)                                                   NETSOL   1647
         N=KPGEN(2,I)                                                   NETSOL   1648
         C1=REAL(VOLT(K))                                               NETSOL   1649
         C2=AIMAG(VOLT(K))                                              NETSOL   1650
         CDG(1,N)=UVAR(1,N)*C1+UVAR(2,N)*C2-UVAR(5,N)                   NETSOL   1651
         CDG(2,N)=UVAR(3,N)*C1+UVAR(4,N)*C2-UVAR(6,N)                   NETSOL   1652
         JSG=MSTATE(1,N)                                                NETSOL   1653
         ANGXC2(N)=XSTATE(JSG+2)                                        NETSOL   1654
 2950    CONTINUE                                                       NETSOL   1655
      ENDIF                                                             NETSOL   1656
C                                                                       NETSOL   1657
C     COMPUTE TERMINAL CURRENT FOR CONSTANT FLUX MACHINE                NETSOL   1658
C***NEED VERIFICATION                                                   NETSOL   1659
C                                                                       NETSOL   1660
      IF(NBFT.NE.0)THEN                                                 NETSOL   1661
         DO 3000 I=1,NBFT                                               NETSOL   1662
         K=KCGEN(1,I)                                                   NETSOL   1663
         NTHGI=KCGEN(2,I)                                               NETSOL   1664
         JSG=MSTATE(1,NTHGI)                                            NETSOL   1665
         CDG(1,NTHGI)=CDG(1,NTHGI)-AIMAG(VOLT(K))*XPD(NTHGI)            NETSOL   1666
         CDG(2,NTHGI)=CDG(2,NTHGI)+REAL(VOLT(K))*XPD(NTHGI)             NETSOL   1667
         ANGXC2(NTHGI)=XSTATE(JSG+2)                                    NETSOL   1668
 3000    CONTINUE                                                       NETSOL   1669
      ENDIF                                                             NETSOL   1670
C                                                                       NETSOL   1671
C     COMPUTE TERMINAL CURRENT FOR INDUCTION MOTOR(S)                   NETSOL   1672
C                                                                       NETSOL   1673
      IF (NMOTL.NE.0) THEN                                              NETSOL   1674
         DO 3050 KK=1,NMOTL                                             NETSOL   1675
            NLF=NMOTB(KK)                                               NETSOL   1676
            IF (NLF.LT.0) GOTO 3050                                     NETSOL   1677
            JM=JMDAT(KK)                                                NETSOL   1678
            IF (DDAT(JM+15).LT.0.0) GOTO 3050                           NETSOL   1679
            IF (IDDAT(JM+1) .LT. 0) GOTO 3050                           NETSOL   1680
            JSTATE=JXIMO(KK)                                            NETSOL   1681
            JY=JVIMO(KK)                                                NETSOL   1682
            NTYPE=IDDAT(JM+1)                                           NETSOL   1683
            K=NMOLD(KK)                                                 NETSOL   1684
            VR=REAL(VOLT(K))                                            NETSOL   1685
            VI=AIMAG(VOLT(K))                                           NETSOL   1686
            GLK=GSM(JY+4)                                               NETSOL   1687
            BLK=BSM(JY+5)                                               NETSOL   1688
            IF (NTYPE.LE.3) THEN                                        NETSOL   1689
               XM1=XSTATE(JSTATE+1)                                     NETSOL   1690
               XM2=XSTATE(JSTATE+2)                                     NETSOL   1691
            ELSE                                                        NETSOL   1692
               XM1=0.0                                                  NETSOL   1693
               XM2=0.0                                                  NETSOL   1694
            END IF                                                      NETSOL   1695
            CDM(JY+8)=GLK*(VR-XM1)+BLK*(VI-XM2)                         NETSOL   1696
            CQM(JY+9)=GLK*(VI-XM2)-BLK*(VR-XM1)                         NETSOL   1697
 3050    CONTINUE                                                       NETSOL   1698
      END IF                                                            NETSOL   1699
C                                                                       NETSOL   1700
C     COMPUTE TERMINAL CURRENT FOR TSC LOAD                             NETSOL   1701
C                                                                       NETSOL   1702
      IF (NTSCL.NE.0.AND.LIR4) THEN                                     NETSOL   1703
         DO 3100 KK=1,NTSCL                                             NETSOL   1704
            JTSC=JTCDAT(KK)                                             NETSOL   1705
            JSTATE=JXTSC(KK)                                            NETSOL   1706
            NLF=IDDAT(JTSC+1)                                           NETSOL   1707
            VR=REAL(VOLT(NLF))                                          NETSOL   1708
            VI=AIMAG(VOLT(NLF))                                         NETSOL   1709
            VMG=SQRT(VR*VR+VI*VI)                                       NETSOL   1710
            IF (IDDAT(JTSC+15).EQ.0) THEN                               NETSOL   1711
               IF (VMG.LE.VTHZL) IDDAT(JTSC+15)=1                       NETSOL   1712
            ELSE                                                        NETSOL   1713
               IF (VMG.GT.VTHZH) IDDAT(JTSC+15)=0                       NETSOL   1714
            END IF                                                      NETSOL   1715
 3100    CONTINUE                                                       NETSOL   1716
      END IF                                                            NETSOL   1717
C                                                                       NETSOL   1718
C     COMPUTE TERMINAL CURRENT FOR SVC('S)                              NETSOL   1719
C                                                                       NETSOL   1720
      IF(NSVC.NE.0)THEN                                                 NETSOL   1721
         DO 3150 I=1,NSVC                                               NETSOL   1722
         K=NROLD(I)                                                     NETSOL   1723
C                                                                       NETSOL   1724
C     THIS STATEMENT NEEDS TO BE FIXED LATER                            NETSOL   1725
C      ERP(I)=VOLT(1,K)                                                 NETSOL   1726
C     THIS STATEMENT NEEDS TO BE FIXED LATER                            NETSOL   1727
C      EIP(I)=VOLT(2,K)                                                 NETSOL   1728
 3150    CONTINUE                                                       NETSOL   1729
      ENDIF                                                             NETSOL   1730
C                                                                       NETSOL   1731
C     SET THE HVDC CONVERTER NEW VOLTAGES (SET IN DCNETS BY GETVOL)     NETSOL   1732
C                                                                       NETSOL   1733
C      IF(NACTOT.NE.0.AND.ITERMI.EQ.4)THEN                              NETSOL   1734
C         DO 380 J=1,NACTOT                                             NETSOL   1735
C         K=IUQABU(J)                                                   NETSOL   1736
C         DCEA(J)=REAL(VOLT(K))                                         NETSOL   1737
C         DCEAT(J)=REAL(VOLT(K))                                        NETSOL   1738
C         DCEB(J)=AIMAG(VOLT(K))                                        NETSOL   1739
C         DCEBT(J)=AIMAG(VOLT(K))                                       NETSOL   1740
C  380    CONTINUE                                                      NETSOL   1741
C      ENDIF                                                            NETSOL   1742
C                                                                       NETSOL   1743
      IF(NLBS.NE.0)THEN                                                 NETSOL   1744
         IF(.NOT.LDISC.OR..NOT.LIR4) GOTO 3300                          NETSOL   1745
         IF(LDISC.AND.ITER.EQ.1) GOTO 3300                              NETSOL   1746
C                                                                       NETSOL   1747
C     UPDATE BUS ANGLE                                                  NETSOL   1748
C                                                                       NETSOL   1749
         IF(LDEB)WRITE(IUD6,5550) IR,ITER,H,TSOLD,TS                    NETSOL   1750
         ISHIFT=0                                                       NETSOL   1751
         DO 3250 I=1,NLOD                                               NETSOL   1752
C==                                                                     NETSOL   1753
          JNLBS=0                                                       NETSOL   1754
          NCOMP=NLCOMP(1,I)                                             NETSOL   1755
          DO 3200 ICOMP=1,NCOMP                                         NETSOL   1756
           ISHIFT=ISHIFT+1                                              NETSOL   1757
           IF(NLTYPE(ISHIFT).EQ.3)THEN                                  NETSOL   1758
            JNLBS=ISHIFT                                                NETSOL   1759
           ENDIF                                                        NETSOL   1760
 3200     CONTINUE                                                      NETSOL   1761
          IF(JNLBS.EQ.0)GOTO 3250                                       NETSOL   1762
C==                                                                     NETSOL   1763
          K=NLDOLD(I)                                                   NETSOL   1764
          JNL=JDNLL(JNLBS)                                              NETSOL   1765
         ANG2I=0.0                                                      NETSOL   1766
         V1=REAL(VOLT(K))                                               NETSOL   1767
         V2=AIMAG(VOLT(K))                                              NETSOL   1768
         IF(ABS(V1).GT.1.E-6.OR.ABS(V2).GT.1.E-6) ANG2I=                NETSOL   1769
     +   ATAN2(V2,V1)                                                   NETSOL   1770
         IF(LDEB)WRITE(IUD6,5600) I,DDAT(JNL+6),ANG2I                   NETSOL   1771
         DDAT(JNL+6)=ANG2I                                              NETSOL   1772
 3250    CONTINUE                                                       NETSOL   1773
      ENDIF                                                             NETSOL   1774
C      ENDIF                                                            NETSOL   1775
 3300 CONTINUE                                                          NETSOL   1776
C                                                                       NETSOL   1777
C      INCLUDE 'TIMEACC.INS/LIST'                                       NETSOL   1778
C                                                                       NETSOL   1779
      IF (LDEB) WRITE(IUD6,6500) TS,KCULTC                              NETSOL   1780
      RETURN                                                            NETSOL   1781
C                                                                       NETSOL   1782
 5000 FORMAT(1X,'DB-NETSOL_NEW:TS,VOLT1-NLFBUS ',G12.5,/,(5X,10G12.5))  NETSOL   1783
 5050 FORMAT(1X,'DB:NETSOL:DSYSA=',G12.4,' SYSTH=',G12.4,' NT=',I5,     NETSOL   1784
     &' NBFT=',I5)                                                      NETSOL   1785
 5100 FORMAT(' DB:NETSOL:IVMG,IVOLC,VMG,VTHZH,VTHZL,VFACT '             NETSOL   1786
     &,I5,3A4,L2,I5,4G12.5)                                             NETSOL   1787
 5150 FORMAT(1X,'PREDICT FREQ',3I5,3G12.4)                              NETSOL   1788
 5200 FORMAT(1X,I5,7G12.5)                                              NETSOL   1789
 5250 FORMAT(//,' *** STUDY TERMINATED  AC BUS VOLTAGE SOLUTION'        NETSOL   1790
     +,' ITERATION EXCEEDS',I5,/,' BUS# ',I5,' BUS NAME=',3A4,' ERMAX=',NETSOL   1791
     +G12.6,' BUS# ',I5,' BUS NAME=',3A4,'EIMAX=',G12.6,2X,'TS=',F10.4  NETSOL   1792
     +,'* *')                                                           NETSOL   1793
 5300 FORMAT(25X,'PRE-FAULT VOLTAGE SOLUTION ITERATION:  SUMMARY'       NETSOL   1794
     &,' OF BUSES EXCEED THE VOLTAGE TOLERANCE',/,25X,84('='),//        NETSOL   1795
     *,'  ITER #',2('  BUS#      BUS NAME        DVREAL        DVIMAG'  NETSOL   1796
     *,11X),/,'  ------'                                                NETSOL   1797
     *,2('  ----  ------------  ------------  ------------',11X))       NETSOL   1798
 5350 FORMAT(I7,I7,2X,3A4,2G14.6)                                       NETSOL   1799
 5400 FORMAT(I8,2X,3A4,2G14.6)                                          NETSOL   1800
 5450 FORMAT(A56,9X,A50)                                                NETSOL   1801
 5500 FORMAT(' ERMAX=',G10.4,' IRMAX=',I5,' EIMAX=',G10.4,' IIMAX=',I5) NETSOL   1802
 5550 FORMAT(1X,'UPDATE ANGLE',2I5,3G10.5)                              NETSOL   1803
 5600 FORMAT(1X,I5,2G12.5)                                              NETSOL   1804
 5650 FORMAT(1X,'NETSOL-BUS VOLTAGES : NO VR VI ',/,4(I5,2G12.5))       NETSOL   1805
 5700 FORMAT(1X,'NETSOL-BUS VOLTAGES : NO VR VI ',/,I5,3A4,G12.5)       NETSOL   1806
 5750 FORMAT(1X,'UVAR ',3I5,4E12.5)                                     NETSOL   1807
 5800 FORMAT(1X,'PSHIFT',3I5,E12.5)                                     NETSOL   1808
 5850 FORMAT(1X,'DELTA U',3I5,4E12.5)                                   NETSOL   1809
 5900 FORMAT(1X,'INJECTED CURRENT',/,(10E12.5))                         NETSOL   1810
 5950 FORMAT(1X,'VDIF',I5,3A4,6E12.5)                                   NETSOL   1811
 6000 FORMAT(' THE OLD VOLTAGE, IVOLC(I) ',I5,2F12.5,I5)                NETSOL   1812
 6050 FORMAT('ITER , K, IVOLC(K) ',3I5)                                 NETSOL   1813
 6100 FORMAT(' NETSOL, UVAR,BUVAR=',8F12.5)                             NETSOL   1814
 6150 FORMAT(1X,'VMG,VMOLD,PTHVDC,QTHVDC,VOLT1,VOLT2,J,K:',6F12.6,2I5)  NETSOL   1815
 6151 FORMAT(1X,'VMG,VMOLD,PA,QA,Q2,XC:',6F12.6)                        NETSOL   1816
 6200 FORMAT(1X,'LASTCU: , JSOUR:',2I5)                                 NETSOL   1817
 6250 FORMAT(1X,'VREAL,VIMAG:',2E12.5)                                  NETSOL   1818
 6252 FORMAT(1X,'VREAL1,VIMAG1,VR1O,VI1O:',4E12.5)                      NETSOL   1819
 6300 FORMAT('** NBFT,NT,NMOTL,NSALI,NSVC,NACBU2,NLBS,NCLD,NKCUR,NKMVA' NETSOL   1820
     &,11I5)                                                            NETSOL   1821
 6350 FORMAT(' P TERM, Q TERM,JNL,CDLI,CQLI ',3I5,2F12.5)               NETSOL   1822
 6400 FORMAT(' CONST CURRENT : K, CDLI, CQLI ',I5,1X,3A4,2X,5F12.5)     NETSOL   1823
 6450 FORMAT(' CONST MVA :  K, CDLI, CQLI ',I5,1X,3A4,2X,3F12.5)        NETSOL   1824
 6500 FORMAT(5X,' TIME = ',F6.3,5X,'ULTC ITERATIONS : ',I4)             NETSOL   1825
 6550 FORMAT(1X,'RTB,XTB,GKKB,BKKB,VBARR,VBARI                          NETSOL   1826
     &,VBAR:',/,10E12.5)                                                NETSOL   1827
 6600 FORMAT(1X,'VBARRK,VBARIK,VBARK,VBVBK                              NETSOL   1828
     &,GKVRB,GKVIB,BKVRB,BKVIB:',/,8E12.5)                              NETSOL   1829
 6650 FORMAT(1X,'GLK,BLK,VREAL,VDBAR,VIMAG,VQBAR:',6E12.5)              NETSOL   1830
 6700 FORMAT(1X,'CDM(JY+8),CQM(JY+9):',2E12.5)                          NETSOL   1831
 6750 FORMAT(1X,'CLMTP,CLMTQ,CDLT,CQLT,CDLI,CQLI:',6E12.5)              NETSOL   1832
 6800 FORMAT(1X,'DISCHARGER LIGHTING--CLDLP,PK1,PK2,QK,PCI,PCP,QCV      NETSOL   1833
     &,FCVDL,CDLI,CQLI:',/,10E12.5)                                     NETSOL   1834
 6850 FORMAT(1X,'TRANSFORMER SATURATION: CLTSQ,TV1,TG1,TG2,QCI          NETSOL   1835
     &,CDLI,CQLI:',/,7E12.5)                                            NETSOL   1836
 6900 FORMAT(1X,'CONSTANT MVA: CLCPP,CLCPQ,PCP,QCP,CDLI,CQLI:',/        NETSOL   1837
     &,10E12.5)                                                         NETSOL   1838
 6950 FORMAT(1X,'REMAINING LOAD : CLRMP,CLRMQ,PCV,FCVRM,CDLI,CQLI       NETSOL   1839
     & :',/,10E12.5)                                                    NETSOL   1840
 7000 FORMAT(1X,'VBARRN,VBARIN,VBARRK,VBARIK,DFVBR,DFVBI:',6E12.5)      NETSOL   1841
 7050 FORMAT(1X,'DISCHARGER LIGHTING: TS=',F6.3,' VBAR=',F8.5           NETSOL   1842
     &,' CDLI=',F8.5,' CQLI=',F8.5)                                     NETSOL   1843
 7100 FORMAT(1X,'TRANSFORMER SATURATION: TS=',F6.3,' VBAR=',F8.5        NETSOL   1844
     &,' CDLI=',F8.5,' CQLI=',F8.5)                                     NETSOL   1845
 7150   FORMAT(1X,'ITRN = ',I4)                                         NETSOL   1846
 7200 FORMAT(1X,F8.3,4X,I5,2X,3A4,A4,F9.2)                              NETSOL   1847
 7250 FORMAT(1X,F8.3,4X,I5,2X,3A4,4X,F9.2)                              NETSOL   1848
 7300 FORMAT(/'                                    MAX. ANG.'           NETSOL   1849
     *,'                        MAX. CUR.',/                            NETSOL   1850
     *,'     TIME     BUS#  STATION NAME GID   CHANGE'                  NETSOL   1851
     *,'     BUS#    BUS NAME    MISMATCH',/                            NETSOL   1852
     *,'    -----    -----  ------------ --- --------'                  NETSOL   1853
     *,'    -----  ------------ ---------')                             NETSOL   1854
 7350 FORMAT(1X,F8.3,27X,F9.2)                                          NETSOL   1855
C                                                                       NETSOL   1856
      END                                                               NETSOL   1857
