CFPRIME REBUS                                                           REBUS       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 REBUS                                                  REBUS       3
CD                                                                      REBUS       4
CD    THIS ROUTINE RE-NUMBERS AND SETS UP ARRAYS FOR CROSS REFERENCING  REBUS       5
CD    BETWEEN THE LOAD FLOW BUS NUMBER AND THE PROGRAM BUS NUMBER.      REBUS       6
CD                                                                      REBUS       7
      INCLUDE 'PARX.INS'                                                REBUS       8
      INCLUDE 'CNPT.INS'                                                REBUS       9
      INCLUDE 'CNMNEW.INS'                                              REBUS      10
      INCLUDE 'CNNNEW.INS'                                              REBUS      11
      INCLUDE 'CNB1.INS'                                                REBUS      12
      INCLUDE 'CNB3.INS'                                                REBUS      13
      INCLUDE 'CNB6.INS'                                                REBUS      14
      INCLUDE 'CNB8.INS'                                                REBUS      15
      INCLUDE 'CNMDAT.INS'                                              REBUS      16
      INCLUDE 'CNMON.INS'                                               REBUS      17
      INCLUDE 'CNSVS.INS'                                               REBUS      18
      INCLUDE 'CNRAN.INS'                                               REBUS      19
      INCLUDE 'CNSTP.INS'                                               REBUS      20
      INCLUDE 'CNSDB.INS'                                               REBUS      21
      INCLUDE 'CNIPTR.INS'                                              REBUS      22
      INCLUDE 'CNFLAG.INS'                                              REBUS      23
      INCLUDE 'CNPARX.INS'                                              REBUS      24
      INCLUDE 'CNLSTA.INS'                                              REBUS      25
      INCLUDE 'CNLFDA.INS'                                              REBUS      26
      INCLUDE 'CNREN.INS'                                               REBUS      27
      INCLUDE 'CNUNIT.INS'                                              REBUS      28
      INCLUDE 'UDCF.INS'                                                REBUS      29
      INCLUDE 'CNULTC.INS'                                              REBUS      30
      INCLUDE 'CNREC1.INS'                                              REBUS      31
      INCLUDE 'CNSPC1.INS'                                              REBUS      32
      INCLUDE 'CNMSG.INS'                                               REBUS      33
C                                                                       REBUS      34
      INTEGER*4 ITFK                                                    REBUS      35
*IF -MI2                                                                REBUS      36
      INTEGER*2 NNBUS                                                   REBUS      37
*ENDIF                                                                  REBUS      38
      DIMENSION NNBUS(NZL)                                              REBUS      39
      CHARACTER*4 NDGCJ                                                 REBUS      40
C                                                                       REBUS      41
      LDEB=(JDEB(25).NE.0)                                              REBUS      42
C                                                                       REBUS      43
      WRITE(LOUT,'(/A/)') '  RENUMBERING BUSES.  WAIT ...'              REBUS      44
C                                                                       REBUS      45
      IF(LDEB)WRITE(IUD6,7480) NLFBUS                                   REBUS      46
C                                                                       REBUS      47
      DO 100 I=1,NLFBUS                                                 REBUS      48
  100 LBUS(I)=NOLD(I)                                                   REBUS      49
C                                                                       REBUS      50
      NLFBUS=0                                                          REBUS      51
CD                                                                      REBUS      52
CD    1. SEQUENCE OF BUS RE-NUMBERING                                   REBUS      53
CD                                                                      REBUS      54
      IEBK=0                                                            REBUS      55
C                                                                       REBUS      56
CD       DETAILED GENERATOR                                             REBUS      57
CD                                                                      REBUS      58
      IPNODE=0                                                          REBUS      59
      IF(NT.NE.0)THEN                                                   REBUS      60
C                                                                       REBUS      61
      I=0                                                               REBUS      62
  140 I=I+1                                                             REBUS      63
      NLF=NDGE(I)                                                       REBUS      64
      IF(NNEW(NLF).EQ.0)THEN                                            REBUS      65
      NLFBUS=NLFBUS+1                                                   REBUS      66
      NOLD(NLFBUS)=NLF                                                  REBUS      67
      NNEW(NLF)=NLFBUS                                                  REBUS      68
      NTHG(NLFBUS)=I                                                    REBUS      69
      ENDIF                                                             REBUS      70
      IF(I.LT.NT)GOTO 140                                               REBUS      71
                                                                        REBUS      72
      NTHG(NLFBUS+1)=NT+1                                               REBUS      73
      IPNODE=NLFBUS                                                     REBUS      74
      IF(LDEB)WRITE(IUD6,6000) (NOLD(I),NTHG(I),I=1,IPNODE)             REBUS      75
C                                                                       REBUS      76
C     CHECKING GENERATOR IDENTITY                                       REBUS      77
C                                                                       REBUS      78
      DO 300 I=1,IPNODE                                                 REBUS      79
      IFIN=NTHG(I+1)                                                    REBUS      80
      I1=NTHG(I)                                                        REBUS      81
      N=IFIN-I1                                                         REBUS      82
      KTHGE(I)=N                                                        REBUS      83
      IF(N.LE.1)GOTO 300                                                REBUS      84
      J=I1-1                                                            REBUS      85
  180 J=J+1                                                             REBUS      86
      NDGCJ=NDGC(J)                                                     REBUS      87
      K=I1-1                                                            REBUS      88
  220 K=K+1                                                             REBUS      89
      IF(J.EQ.K)GOTO 260                                                REBUS      90
      IF(NDGCJ.EQ.NDGC(K))THEN                                          REBUS      91
      NLF=NOLD(I)                                                       REBUS      92
      IF(KLFO.EQ.0)THEN                                                 REBUS      93
      WRITE(MSG(1),6040) NLF                                            REBUS      94
      ELSE                                                              REBUS      95
      JK=MNEW(NLF)                                                      REBUS      96
      JK=JK*8                                                           REBUS      97
      WRITE(MSG(1),6120) NAMES(JK-2),NAMES(JK-1),NAMES(JK)              REBUS      98
      ENDIF                                                             REBUS      99
      WRITE(MSG(2),6080) (NDGC(I1-1+KK),KK=1,N/2)                       REBUS     100
      WRITE(MSG(3),6080) (NDGC(I1-1+KK),KK=1+N/2,N)                     REBUS     101
      CALL PRTMSG(3)                                                    REBUS     102
      ENDIF                                                             REBUS     103
  260 IF(K.LT.IFIN-1)GOTO 220                                           REBUS     104
      IF(J.LT.IFIN-1)GOTO 180                                           REBUS     105
  300 CONTINUE                                                          REBUS     106
C                                                                       REBUS     107
      ENDIF                                                             REBUS     108
C                                                                       REBUS     109
CD                                                                      REBUS     110
CD       INDUCTION MOTOR                                                REBUS     111
CD                                                                      REBUS     112
      IMNODE=0                                                          REBUS     113
      IF(NMOTL.NE.0)THEN                                                REBUS     114
      CALL MOVE(0,NEXTIM,NEXTIM,NMOTL)                                  REBUS     115
      I=0                                                               REBUS     116
  340 I=I+1                                                             REBUS     117
      NLF=NMOTB(I)                                                      REBUS     118
      NMOLD(I)=IABS(NLF)                                                REBUS     119
      IF(NLF.LE.0)GOTO 540                                              REBUS     120
      IF(NNEW(NLF).NE.0)GOTO 420                                        REBUS     121
      IF(MNEW(NLF).NE.0)GOTO 380                                        REBUS     122
      IEBK=1                                                            REBUS     123
      IF(KLFO.EQ.0)THEN                                                 REBUS     124
      WRITE(MSG(1),6400) NLF                                            REBUS     125
      ELSE                                                              REBUS     126
      JK=MNEW(NLF)                                                      REBUS     127
      JK=JK*8                                                           REBUS     128
      WRITE(MSG(1),6440) NAMES(JK-2),NAMES(JK-1),NAMES(JK)              REBUS     129
      ENDIF                                                             REBUS     130
      CALL PRTMSG(1)                                                    REBUS     131
      GOTO 540                                                          REBUS     132
  380 NLFBUS=NLFBUS+1                                                   REBUS     133
      NNEW(NLF)=NLFBUS                                                  REBUS     134
      NOLD(NLFBUS)=NLF                                                  REBUS     135
      NTHM(2,NLFBUS)=I                                                  REBUS     136
      GOTO 540                                                          REBUS     137
  420 CONTINUE                                                          REBUS     138
      J=NNEW(NLF)                                                       REBUS     139
      IMACH=NTHM(2,J)                                                   REBUS     140
      IF(IMACH.EQ.0)THEN                                                REBUS     141
      NTHM(2,J)=I                                                       REBUS     142
      ELSE                                                              REBUS     143
      IMACH1=NEXTIM(IMACH)                                              REBUS     144
      IF(IMACH1.EQ.0)GOTO 500                                           REBUS     145
  460 CONTINUE                                                          REBUS     146
      IMACH=IMACH1                                                      REBUS     147
      IMACH1=NEXTIM(IMACH)                                              REBUS     148
      IF(IMACH1.GT.0)GOTO 460                                           REBUS     149
  500 CONTINUE                                                          REBUS     150
      NEXTIM(IMACH)=I                                                   REBUS     151
      ENDIF                                                             REBUS     152
  540 IF(I.LT.NMOTL)GOTO 340                                            REBUS     153
      IMNODE=NLFBUS                                                     REBUS     154
C                                                                       REBUS     155
      ENDIF                                                             REBUS     156
C                                                                       REBUS     157
CD       THERMOSTACALLY CONTROLLED LOAD                                 REBUS     158
CD                                                                      REBUS     159
      ITNODE=0                                                          REBUS     160
      IF (NTSCL.NE.0) THEN                                              REBUS     161
         I=0                                                            REBUS     162
  580    I=I+1                                                          REBUS     163
         JTSC=JTCDAT(I)                                                 REBUS     164
         NLF=IDDAT(JTSC+1)                                              REBUS     165
         IF (NNEW(NLF).NE.0) GOTO 660                                   REBUS     166
         IF (MNEW(NLF).NE.0) GOTO 620                                   REBUS     167
         IEBK=1                                                         REBUS     168
         IF (KLFO.EQ.0) THEN                                            REBUS     169
         WRITE(MSG(1),9160) NLF                                         REBUS     170
         CALL PRTMSG(1)                                                 REBUS     171
         END IF                                                         REBUS     172
         GOTO 700                                                       REBUS     173
  620    NLFBUS=NLFBUS+1                                                REBUS     174
         NNEW(NLF)=NLFBUS                                               REBUS     175
         NOLD(NLFBUS)=NLF                                               REBUS     176
         IDDAT(JTSC+1)=NLFBUS                                           REBUS     177
         GOTO 700                                                       REBUS     178
  660    CONTINUE                                                       REBUS     179
         IDDAT(JTSC+1)=NNEW(NLF)                                        REBUS     180
  700    IF (I.LT.NTSCL) GOTO 580                                       REBUS     181
C                                                                       REBUS     182
         ITNODE=NLFBUS                                                  REBUS     183
C                                                                       REBUS     184
      END IF                                                            REBUS     185
C                                                                       REBUS     186
CD       STATIC VAR COMPENSATOR                                         REBUS     187
CD                                                                      REBUS     188
      ISVNOE=0                                                          REBUS     189
      IF(NSVC.NE.0)THEN                                                 REBUS     190
         I=0                                                            REBUS     191
  740    I=I+1                                                          REBUS     192
         NLF=NSAB(I)                                                    REBUS     193
         NROLD(I)=NLF                                                   REBUS     194
         IF(NNEW(NLF).NE.0) THEN                                        REBUS     195
            J=NNEW(NLF)                                                 REBUS     196
            IF(NTHSR(3,J).NE.0)THEN                                     REBUS     197
               IEBK=1                                                   REBUS     198
               IF(KLFO.EQ.0)THEN                                        REBUS     199
               WRITE(MSG(1),9000) NLF                                   REBUS     200
               ELSE                                                     REBUS     201
               JK=MNEW(NLF)                                             REBUS     202
               JK=JK*8                                                  REBUS     203
      WRITE(MSG(1),9040) NAMES(JK-2),NAMES(JK-1),NAMES(JK)              REBUS     204
               ENDIF                                                    REBUS     205
               CALL PRTMSG(1)                                           REBUS     206
            ELSE                                                        REBUS     207
            NTHSR(3,J)=I                                                REBUS     208
            ENDIF                                                       REBUS     209
            GOTO 780                                                    REBUS     210
         ENDIF                                                          REBUS     211
         IF(MNEW(NLF).NE.0)THEN                                         REBUS     212
            NLFBUS=NLFBUS+1                                             REBUS     213
            NNEW(NLF)=NLFBUS                                            REBUS     214
            NOLD(NLFBUS)=NLF                                            REBUS     215
            NTHSR(3,NLFBUS)=I                                           REBUS     216
            GOTO 780                                                    REBUS     217
         ELSE                                                           REBUS     218
            IF(KLFO.EQ.0)THEN                                           REBUS     219
            WRITE(MSG(1),6480) NLF                                      REBUS     220
            CALL PRTMSG(1)                                              REBUS     221
            ENDIF                                                       REBUS     222
            IEBK=1                                                      REBUS     223
         ENDIF                                                          REBUS     224
  780    IF(I.LT.NSVC)GOTO 740                                          REBUS     225
         ISVNOE=NLFBUS                                                  REBUS     226
      ENDIF                                                             REBUS     227
                                                                        REBUS     228
C                                                                       REBUS     229
CD       ULTC                                                           REBUS     230
CD                                                                      REBUS     231
CD    IF ULTC CONNECTION IS INCORRECT SET MOULTC(*)=0                   REBUS     232
CD                                                                      REBUS     233
      ITCNOE = 0                                                        REBUS     234
      IF (NULTC .LE. 0) GOTO 900                                        REBUS     235
      I=0                                                               REBUS     236
  820 I=I+1                                                             REBUS     237
      JTC = JULTCD(I)                                                   REBUS     238
C                                                                       REBUS     239
      NLFP = IDDAT(JTC+1)                                               REBUS     240
      NPROG=MNEW(NLFP)                                                  REBUS     241
      IF(NPROG.EQ.0)THEN                                                REBUS     242
         IF(KLFO.EQ.0)THEN                                              REBUS     243
         WRITE(MSG(1),8640) NLFP                                        REBUS     244
         CALL PRTMSG(1)                                                 REBUS     245
         ENDIF                                                          REBUS     246
         MOULTC(I)=0                                                    REBUS     247
         GOTO 860                                                       REBUS     248
      ELSE                                                              REBUS     249
        IF(JBSTAT(NPROG).GT.2)THEN                                      REBUS     250
        MOULTC(I)=0                                                     REBUS     251
        GOTO 860                                                        REBUS     252
        ENDIF                                                           REBUS     253
        IF(NNEW(NLFP).EQ.0)THEN                                         REBUS     254
           NLFBUS=NLFBUS+1                                              REBUS     255
           NNEW(NLFP)=NLFBUS                                            REBUS     256
           NOLD(NLFBUS)=NLFP                                            REBUS     257
        ENDIF                                                           REBUS     258
      ENDIF                                                             REBUS     259
C                                                                       REBUS     260
      NLFS = IDDAT(JTC+2)                                               REBUS     261
      NPROG=MNEW(NLFS)                                                  REBUS     262
      IF(NPROG.EQ.0)THEN                                                REBUS     263
         IF(KLFO.EQ.0)THEN                                              REBUS     264
            WRITE(MSG(1),8640) NLFS                                     REBUS     265
            CALL PRTMSG(1)                                              REBUS     266
            ENDIF                                                       REBUS     267
         MOULTC(I)=0                                                    REBUS     268
         GOTO 860                                                       REBUS     269
      ELSE                                                              REBUS     270
        IF(JBSTAT(NPROG).GT.2)THEN                                      REBUS     271
        MOULTC(I)=0                                                     REBUS     272
        GOTO 860                                                        REBUS     273
        ENDIF                                                           REBUS     274
        IF(NNEW(NLFS).EQ.0)THEN                                         REBUS     275
           NLFBUS=NLFBUS+1                                              REBUS     276
           NNEW(NLFS)=NLFBUS                                            REBUS     277
           NOLD(NLFBUS)=NLFS                                            REBUS     278
        ENDIF                                                           REBUS     279
      ENDIF                                                             REBUS     280
C                                                                       REBUS     281
      NLFR = IDDAT(JTC+4)                                               REBUS     282
      IF(NLFR .LT. 0) NLFR =IABS(NLFR)                                  REBUS     283
      NPROG=MNEW(NLFR)                                                  REBUS     284
      IF(NPROG.EQ.0)THEN                                                REBUS     285
         IF(KLFO.EQ.0)THEN                                              REBUS     286
         WRITE(MSG(1),8640) NLFR                                        REBUS     287
         CALL PRTMSG(1)                                                 REBUS     288
         ENDIF                                                          REBUS     289
         MOULTC(I)=0                                                    REBUS     290
         GOTO 860                                                       REBUS     291
      ELSE                                                              REBUS     292
        IF(JBSTAT(NPROG).GT.2)THEN                                      REBUS     293
        MOULTC(I)=0                                                     REBUS     294
        GOTO 860                                                        REBUS     295
        ENDIF                                                           REBUS     296
        IF(NNEW(NLFR).EQ.0)THEN                                         REBUS     297
           NLFBUS=NLFBUS+1                                              REBUS     298
           NNEW(NLFR)=NLFBUS                                            REBUS     299
           NOLD(NLFBUS)=NLFR                                            REBUS     300
        ENDIF                                                           REBUS     301
      ENDIF                                                             REBUS     302
C                                                                       REBUS     303
      MOULTC(I)=1                                                       REBUS     304
C                                                                       REBUS     305
  860 IF(I.LT.NULTC) GOTO 820                                           REBUS     306
      ITCNOE = NLFBUS                                                   REBUS     307
C                                                                       REBUS     308
  900 CONTINUE                                                          REBUS     309
C                                                                       REBUS     310
CD       RANI                                                           REBUS     311
CD                                                                      REBUS     312
      IRANOE=0                                                          REBUS     313
      IF(NRANI.NE.0)THEN                                                REBUS     314
         I=0                                                            REBUS     315
  940    I=I+1                                                          REBUS     316
         JR=JRDAT(I)                                                    REBUS     317
         NLF1=IDDAT(JR+1)                                               REBUS     318
         IF(NNEW(NLF1).NE.0) GOTO 980                                   REBUS     319
         IF(MNEW(NLF1).NE.0)THEN                                        REBUS     320
            NLFBUS=NLFBUS+1                                             REBUS     321
            NNEW(NLF1)=NLFBUS                                           REBUS     322
            NOLD(NLFBUS)=NLF1                                           REBUS     323
            GOTO 980                                                    REBUS     324
         ELSE                                                           REBUS     325
            IF(KLFO.EQ.0)THEN                                           REBUS     326
            WRITE(MSG(1),7120) NLF1                                     REBUS     327
            CALL PRTMSG(1)                                              REBUS     328
            ENDIF                                                       REBUS     329
            IEBK=1                                                      REBUS     330
         ENDIF                                                          REBUS     331
  980    IDDAT(JR+1)=NNEW(NLF1)                                         REBUS     332
         NLF2=IDDAT(JR+2)                                               REBUS     333
         IF(NNEW(NLF2).NE.0) GOTO 1020                                  REBUS     334
         IF(MNEW(NLF2).NE.0)THEN                                        REBUS     335
            NLFBUS=NLFBUS+1                                             REBUS     336
            NNEW(NLF2)=NLFBUS                                           REBUS     337
            NOLD(NLFBUS)=NLF2                                           REBUS     338
            GOTO 1020                                                   REBUS     339
         ELSE                                                           REBUS     340
            IF(KLFO.EQ.0)THEN                                           REBUS     341
            WRITE(MSG(1),7120) NLF2                                     REBUS     342
            CALL PRTMSG(1)                                              REBUS     343
            ENDIF                                                       REBUS     344
            IEBK=1                                                      REBUS     345
         ENDIF                                                          REBUS     346
 1020    IDDAT(JR+2)=NNEW(NLF2)                                         REBUS     347
         IF(I.LT.NRANI) GOTO 940                                        REBUS     348
         IRANOE=NLFBUS                                                  REBUS     349
      ENDIF                                                             REBUS     350
C                                                                       REBUS     351
CD       STP                                                            REBUS     352
CD                                                                      REBUS     353
      ITPNOE=0                                                          REBUS     354
      IF(NTCPS.NE.0)THEN                                                REBUS     355
         I=0                                                            REBUS     356
 1060    I=I+1                                                          REBUS     357
         JTP=JTPDAT(I)                                                  REBUS     358
         NLF1=IDDAT(JTP+1)                                              REBUS     359
         IF(NNEW(NLF1).NE.0) GOTO 1100                                  REBUS     360
         IF(MNEW(NLF1).NE.0)THEN                                        REBUS     361
            NLFBUS=NLFBUS+1                                             REBUS     362
            NNEW(NLF1)=NLFBUS                                           REBUS     363
            NOLD(NLFBUS)=NLF1                                           REBUS     364
            GOTO 1100                                                   REBUS     365
         ELSE                                                           REBUS     366
            IF(KLFO.EQ.0)THEN                                           REBUS     367
            WRITE(MSG(1),7200) NLF1                                     REBUS     368
            CALL PRTMSG(1)                                              REBUS     369
            ENDIF                                                       REBUS     370
            IEBK=1                                                      REBUS     371
         ENDIF                                                          REBUS     372
 1100    IDDAT(JTP+1)=NNEW(NLF1)                                        REBUS     373
         NLF2=IDDAT(JTP+2)                                              REBUS     374
         IF(NNEW(NLF2).NE.0) GOTO 1140                                  REBUS     375
         IF(MNEW(NLF2).NE.0)THEN                                        REBUS     376
            NLFBUS=NLFBUS+1                                             REBUS     377
            NNEW(NLF2)=NLFBUS                                           REBUS     378
            NOLD(NLFBUS)=NLF2                                           REBUS     379
            GOTO 1140                                                   REBUS     380
         ELSE                                                           REBUS     381
            IF(KLFO.EQ.0)THEN                                           REBUS     382
            WRITE(MSG(1),7200) NLF2                                     REBUS     383
            CALL PRTMSG(1)                                              REBUS     384
            ENDIF                                                       REBUS     385
            IEBK=1                                                      REBUS     386
         ENDIF                                                          REBUS     387
 1140    IDDAT(JTP+2)=NNEW(NLF2)                                        REBUS     388
         IF(I.LT.NTCPS) GOTO 1060                                       REBUS     389
         ITPNOE=NLFBUS                                                  REBUS     390
      ENDIF                                                             REBUS     391
C                                                                       REBUS     392
CD       SDB                                                            REBUS     393
CD                                                                      REBUS     394
      IDBNOE=0                                                          REBUS     395
      IF(NSDB.NE.0)THEN                                                 REBUS     396
         I=0                                                            REBUS     397
 1180    I=I+1                                                          REBUS     398
         JD=JDDAT(I)                                                    REBUS     399
         NLF=IDDAT(JD+1)                                                REBUS     400
         IF(NNEW(NLF).NE.0) GOTO 1220                                   REBUS     401
         IF(MNEW(NLF).NE.0)THEN                                         REBUS     402
            NLFBUS=NLFBUS+1                                             REBUS     403
            NNEW(NLF)=NLFBUS                                            REBUS     404
            NOLD(NLFBUS)=NLF                                            REBUS     405
            GOTO 1220                                                   REBUS     406
         ELSE                                                           REBUS     407
            IF(KLFO.EQ.0)THEN                                           REBUS     408
            WRITE(MSG(1),7040) NLF                                      REBUS     409
            CALL PRTMSG(1)                                              REBUS     410
            ENDIF                                                       REBUS     411
            IEBK=1                                                      REBUS     412
         ENDIF                                                          REBUS     413
 1220    IDDAT(JD+1)=NNEW(NLF)                                          REBUS     414
         IF(I.LT.NSDB) GOTO 1180                                        REBUS     415
         IDBNOE=NLFBUS                                                  REBUS     416
      ENDIF                                                             REBUS     417
C                                                                       REBUS     418
      IDCNOE=0                                                          REBUS     419
      IF(KCDC.NE.0)THEN                                                 REBUS     420
C                                                                       REBUS     421
CD       CONVERTER AC BUS OF THE DC SYSTEM                              REBUS     422
CD                                                                      REBUS     423
      DO 1260 I=1,NACBU2                                                REBUS     424
      NLF=IUQABU(I)                                                     REBUS     425
      NPROG=MNEW(NLF)                                                   REBUS     426
      IF(NPROG.EQ.0)THEN                                                REBUS     427
      IEBK=1                                                            REBUS     428
         IF(KLFO.EQ.0)THEN                                              REBUS     429
         WRITE(MSG(1),6960) NLF                                         REBUS     430
         CALL PRTMSG(1)                                                 REBUS     431
         ENDIF                                                          REBUS     432
         GOTO 1260                                                      REBUS     433
      ELSE                                                              REBUS     434
       IF(JBSTAT(NPROG).GT.2)THEN                                       REBUS     435
        IF(KLFO.EQ.0)THEN                                               REBUS     436
        WRITE(MSG(1),6960) NLF                                          REBUS     437
        ELSE                                                            REBUS     438
        JK=MNEW(NLF)                                                    REBUS     439
        JK=JK*8                                                         REBUS     440
        WRITE(MSG(1),7000) NAMES(JK-2),NAMES(JK-1),NAMES(JK)            REBUS     441
        ENDIF                                                           REBUS     442
        IEBK=1                                                          REBUS     443
       CALL PRTMSG(1)                                                   REBUS     444
       GOTO 1260                                                        REBUS     445
       ENDIF                                                            REBUS     446
      ENDIF                                                             REBUS     447
      IF(NNEW(NLF).EQ.0)THEN                                            REBUS     448
      NLFBUS=NLFBUS+1                                                   REBUS     449
      NOLD(NLFBUS)=NLF                                                  REBUS     450
      NNEW(NLF)=NLFBUS                                                  REBUS     451
      ELSE                                                              REBUS     452
       IEBK=1                                                           REBUS     453
       IF(KLFO.EQ.0)THEN                                                REBUS     454
       WRITE(MSG(2),6680) NLF                                           REBUS     455
       ELSE                                                             REBUS     456
       JK=MNEW(NLF)                                                     REBUS     457
       JK=JK*8                                                          REBUS     458
       WRITE(MSG(2),6720) NAMES(JK-2),NAMES(JK-1),NAMES(JK)             REBUS     459
       ENDIF                                                            REBUS     460
       WRITE(MSG(1),6640)                                               REBUS     461
       WRITE(MSG(3),6740)                                               REBUS     462
       WRITE(MSG(4),6750)                                               REBUS     463
       CALL PRTMSG(4)                                                   REBUS     464
      ENDIF                                                             REBUS     465
 1260 CONTINUE                                                          REBUS     466
      IDCNOE=NLFBUS                                                     REBUS     467
C                                                                       REBUS     468
      ENDIF                                                             REBUS     469
C                                                                       REBUS     470
CD       NONLINEAR LOAD WITH A-LOAD AND VOLTAGE EXPONENTIAL LOAD FIRST  REBUS     471
CD                                                                      REBUS     472
      ILNODE=0                                                          REBUS     473
      IF(NLOD.NE.0)THEN                                                 REBUS     474
      I=0                                                               REBUS     475
      ISHIFT=1                                                          REBUS     476
 1300 I=I+1                                                             REBUS     477
C                                                                       REBUS     478
      NCOMP=NLCOMP(1,I)                                                 REBUS     479
      IF(NLCOMP(2,I).EQ.0)GOTO 1340                                     REBUS     480
C                                                                       REBUS     481
      NLF=NLDB(I)                                                       REBUS     482
      NLDOLD(I)=NLF                                                     REBUS     483
      IF(NNEW(NLF).NE.0)THEN                                            REBUS     484
      J=NNEW(NLF)                                                       REBUS     485
      NTHL(1,J)=ISHIFT                                                  REBUS     486
C      ISHIFT=ISHIFT+NCOMP                                              REBUS     487
      GOTO 1340                                                         REBUS     488
      ENDIF                                                             REBUS     489
      IF(MNEW(NLF).NE.0)THEN                                            REBUS     490
      NLFBUS=NLFBUS+1                                                   REBUS     491
      NNEW(NLF)=NLFBUS                                                  REBUS     492
      NOLD(NLFBUS)=NLF                                                  REBUS     493
      NTHL(1,NLFBUS)=ISHIFT                                             REBUS     494
C      ISHIFT=ISHIFT+NCOMP                                              REBUS     495
      GOTO 1340                                                         REBUS     496
      ELSE                                                              REBUS     497
      IF(KLFO.EQ.0)THEN                                                 REBUS     498
      WRITE(MSG(1),6560) NLF                                            REBUS     499
      CALL PRTMSG(1)                                                    REBUS     500
      ENDIF                                                             REBUS     501
      IEBK=1                                                            REBUS     502
      ENDIF                                                             REBUS     503
 1340 ISHIFT=ISHIFT+NCOMP                                               REBUS     504
C 350  CONTINUE                                                         REBUS     505
      IF(I.LT.NLOD)GOTO 1300                                            REBUS     506
      ILNODE=NLFBUS                                                     REBUS     507
C                                                                       REBUS     508
      ENDIF                                                             REBUS     509
C                                                                       REBUS     510
C     LSTART & LFINSH ARE LIMITS FOR THE NON-LINEAR LOAD BUSES          REBUS     511
C     THAT CAN BE REDUCED                                               REBUS     512
C                                                                       REBUS     513
      LSTART=NLFBUS                                                     REBUS     514
C                                                                       REBUS     515
CD       CONSTANT CURRENT AND MVA LOAD IN THE NONLINEAR LOAD            REBUS     516
CD                                                                      REBUS     517
      IKPNOD=0                                                          REBUS     518
      IF(NLOD.NE.0)THEN                                                 REBUS     519
      I=0                                                               REBUS     520
      ISHIFT=1                                                          REBUS     521
 1380 I=I+1                                                             REBUS     522
C                                                                       REBUS     523
      NCOMP=NLCOMP(1,I)                                                 REBUS     524
      IF(NLCOMP(2,I).EQ.1)GOTO 1420                                     REBUS     525
C                                                                       REBUS     526
      NLF=NLDB(I)                                                       REBUS     527
      NLDOLD(I)=NLF                                                     REBUS     528
      IF(NNEW(NLF).NE.0)THEN                                            REBUS     529
      J=NNEW(NLF)                                                       REBUS     530
      NTHL(1,J)=ISHIFT                                                  REBUS     531
C      ISHIFT=ISHIFT+NCOMP                                              REBUS     532
      GOTO 1420                                                         REBUS     533
      ENDIF                                                             REBUS     534
      IF(MNEW(NLF).NE.0)THEN                                            REBUS     535
      NLFBUS=NLFBUS+1                                                   REBUS     536
      NNEW(NLF)=NLFBUS                                                  REBUS     537
      NOLD(NLFBUS)=NLF                                                  REBUS     538
      NTHL(1,NLFBUS)=ISHIFT                                             REBUS     539
C      ISHIFT=ISHIFT+NCOMP                                              REBUS     540
      GOTO 1420                                                         REBUS     541
      ELSE                                                              REBUS     542
      IF(KLFO.EQ.0)THEN                                                 REBUS     543
      WRITE(MSG(1),6560) NLF                                            REBUS     544
      ELSE                                                              REBUS     545
      JK=MNEW(NLF)                                                      REBUS     546
      JK=JK*8                                                           REBUS     547
      WRITE(MSG(1),6600) NAMES(JK-2),NAMES(JK-1),NAMES(JK)              REBUS     548
      ENDIF                                                             REBUS     549
      CALL PRTMSG(1)                                                    REBUS     550
      IEBK=1                                                            REBUS     551
      ENDIF                                                             REBUS     552
 1420 ISHIFT=ISHIFT+NCOMP                                               REBUS     553
C 370  CONTINUE                                                         REBUS     554
      IF(I.LT.NLOD)GOTO 1380                                            REBUS     555
C                                                                       REBUS     556
C   RESET THE NLCOMP ARRAY                                              REBUS     557
C   SO THAT IT CAN BE USED IN THE IMPLICIT PATH                         REBUS     558
C                                                                       REBUS     559
      DO 1460 I=1,NLOD                                                  REBUS     560
       NLCOMP(2,I)=0                                                    REBUS     561
 1460 CONTINUE                                                          REBUS     562
C                                                                       REBUS     563
      IKPNOD=NLFBUS                                                     REBUS     564
C                                                                       REBUS     565
      ENDIF                                                             REBUS     566
C                                                                       REBUS     567
      LFINSH=NLFBUS                                                     REBUS     568
      KRBUS=0                                                           REBUS     569
CD                                                                      REBUS     570
CD    LAST CURRENT INJECTING BUS                                        REBUS     571
CD                                                                      REBUS     572
      LASTCU=NLFBUS                                                     REBUS     573
      IF(LDEB) WRITE(IUD6,8600) LASTCU                                  REBUS     574
CD                                                                      REBUS     575
CD    RENUMBER SVC REMOTE BUSES AND LINES                               REBUS     576
CD                                                                      REBUS     577
      IF (NSVC.NE.0) THEN                                               REBUS     578
         I=0                                                            REBUS     579
 1500    I=I+1                                                          REBUS     580
         JS=JSDAT(I)                                                    REBUS     581
         IF (IDDAT(JS+9).EQ.50) GOTO 1740                               REBUS     582
         IF (IDDAT(JS+9).GT.5) GOTO 1980                                REBUS     583
         NLF=IDDAT(JS+10)                                               REBUS     584
         NPROG=MNEW(NLF)                                                REBUS     585
         IF (NPROG.EQ.0) THEN                                           REBUS     586
            IF (KLFO.EQ.0) THEN                                         REBUS     587
               WRITE(MSG(1),7280) NLF                                   REBUS     588
               CALL PRTMSG(1)                                           REBUS     589
            END IF                                                      REBUS     590
            IEBK=1                                                      REBUS     591
            GOTO 1580                                                   REBUS     592
         ELSE                                                           REBUS     593
            IF (JBSTAT(NPROG).GT.2) THEN                                REBUS     594
               IF (KLFO.EQ.0) THEN                                      REBUS     595
                  WRITE(MSG(1),7320) NLF                                REBUS     596
               ELSE                                                     REBUS     597
                  JK=NPROG*8                                            REBUS     598
                  WRITE(MSG(1),7360) NAMES(JK-2),NAMES(JK-1),NAMES(JK)  REBUS     599
               END IF                                                   REBUS     600
               CALL PRTMSG(1)                                           REBUS     601
               IEBK=1                                                   REBUS     602
               GOTO 1580                                                REBUS     603
            END IF                                                      REBUS     604
            IF(NNEW(NLF).EQ.0)THEN                                      REBUS     605
               NLFBUS=NLFBUS+1                                          REBUS     606
               NNEW(NLF)=NLFBUS                                         REBUS     607
               NOLD(NLFBUS)=NLF                                         REBUS     608
               IDDAT(JS+10)=NLFBUS                                      REBUS     609
               GOTO 1580                                                REBUS     610
            ELSE                                                        REBUS     611
               NOLDI=NLF                                                REBUS     612
               IDDAT(JS+10)=NNEW(NOLDI)                                 REBUS     613
C                                                                       REBUS     614
               ASSIGN 1540 TO I2000                                     REBUS     615
               GOTO 4860                                                REBUS     616
 1540          CONTINUE                                                 REBUS     617
C                                                                       REBUS     618
            END IF                                                      REBUS     619
         ENDIF                                                          REBUS     620
 1580    CONTINUE                                                       REBUS     621
         IF(IDDAT(JS+9).EQ.3) THEN                                      REBUS     622
            MT1=IDDAT(JS+20)                                            REBUS     623
            IF(MT1.EQ.0) THEN                                           REBUS     624
               NLF1=IDDAT(JS+22)                                        REBUS     625
               NLF2=IDDAT(JS+23)                                        REBUS     626
               MLIN=IDDAT(JS+8)                                         REBUS     627
               DO 1620 J=1,MLIN                                         REBUS     628
               ITFK=IDDAT(JS+37+2*J-1)                                  REBUS     629
               CALL RELINE(NLF1,NLF2,ITFK)                              REBUS     630
               IDDAT(JS+37+2*J)=ITFK                                    REBUS     631
 1620          CONTINUE                                                 REBUS     632
            ELSEIF(MT1.EQ.1) THEN                                       REBUS     633
               NLF1=IDDAT(JS+23)                                        REBUS     634
               NPROG=MNEW(NLF1)                                         REBUS     635
               IF(NPROG.EQ.0)THEN                                       REBUS     636
                  IF(KLFO.EQ.0)THEN                                     REBUS     637
                  WRITE(MSG(1),7280) NLF1                               REBUS     638
                  CALL PRTMSG(1)                                        REBUS     639
                  ENDIF                                                 REBUS     640
                  IEBK=1                                                REBUS     641
                  GOTO 1980                                             REBUS     642
               ELSE                                                     REBUS     643
                  IF(JBSTAT(NPROG).GT.2)THEN                            REBUS     644
                  IF(KLFO.EQ.0)THEN                                     REBUS     645
                  WRITE(MSG(1),7320) NLF1                               REBUS     646
                  ELSE                                                  REBUS     647
                  JK=NPROG*8                                            REBUS     648
                  WRITE(MSG(1),7360) NAMES(JK-2),NAMES(JK-1),NAMES(JK)  REBUS     649
                  ENDIF                                                 REBUS     650
                  CALL PRTMSG(1)                                        REBUS     651
                  IEBK=1                                                REBUS     652
                  GOTO 1980                                             REBUS     653
                  ENDIF                                                 REBUS     654
                  IF(NNEW(NLF1).EQ.0)THEN                               REBUS     655
                     NLFBUS=NLFBUS+1                                    REBUS     656
                     NNEW(NLF1)=NLFBUS                                  REBUS     657
                     NOLD(NLFBUS)=NLF1                                  REBUS     658
                     IDDAT(JS+23)=NLFBUS                                REBUS     659
                     GOTO 1980                                          REBUS     660
                  ELSE                                                  REBUS     661
                     NOLDI=NLF1                                         REBUS     662
                     IDDAT(JS+23)=NNEW(NOLDI)                           REBUS     663
                     ASSIGN 1660 TO I2000                               REBUS     664
                     GOTO 4860                                          REBUS     665
 1660                CONTINUE                                           REBUS     666
                  ENDIF                                                 REBUS     667
               ENDIF                                                    REBUS     668
            ELSE                                                        REBUS     669
               NLF1=IDDAT(JS+22)                                        REBUS     670
               NPROG=MNEW(NLF1)                                         REBUS     671
               IF(MNEW(NLF1).EQ.0)THEN                                  REBUS     672
                  IF(KLFO.EQ.0)THEN                                     REBUS     673
                  WRITE(MSG(1),7280) NLF1                               REBUS     674
                  CALL PRTMSG(1)                                        REBUS     675
                  ENDIF                                                 REBUS     676
                  IEBK=1                                                REBUS     677
                  GOTO 1980                                             REBUS     678
               ELSE                                                     REBUS     679
                   IF(JBSTAT(NPROG).GT.2)THEN                           REBUS     680
                   IF(KLFO.EQ.0)THEN                                    REBUS     681
                   WRITE(MSG(1),7320) NLF1                              REBUS     682
                   ELSE                                                 REBUS     683
                   JK=NPROG*8                                           REBUS     684
                   WRITE(MSG(1),7360) NAMES(JK-2),NAMES(JK-1),NAMES(JK) REBUS     685
                   ENDIF                                                REBUS     686
                   CALL PRTMSG(1)                                       REBUS     687
                   IEBK=1                                               REBUS     688
                   GOTO 1980                                            REBUS     689
            ENDIF                                                       REBUS     690
                  IF(NNEW(NLF1).EQ.0)THEN                               REBUS     691
                     NLFBUS=NLFBUS+1                                    REBUS     692
                     NNEW(NLF1)=NLFBUS                                  REBUS     693
                     NOLD(NLFBUS)=NLF1                                  REBUS     694
                     IDDAT(JS+22)=NLFBUS                                REBUS     695
                     GOTO 1980                                          REBUS     696
                  ELSE                                                  REBUS     697
                     NOLDI=NLF1                                         REBUS     698
                     IDDAT(JS+22)=NNEW(NOLDI)                           REBUS     699
                     ASSIGN 1700 TO I2000                               REBUS     700
                     GOTO 4860                                          REBUS     701
 1700                CONTINUE                                           REBUS     702
                  ENDIF                                                 REBUS     703
               ENDIF                                                    REBUS     704
            ENDIF                                                       REBUS     705
         ENDIF                                                          REBUS     706
         GO TO 1980                                                     REBUS     707
 1740    CONTINUE                                                       REBUS     708
         JS=JS+13                                                       REBUS     709
         NVTN=IDDAT(JS)                                                 REBUS     710
         IF(NVTN.NE.0) THEN                                             REBUS     711
            JJ=0                                                        REBUS     712
 1780       JJ=JJ+1                                                     REBUS     713
            JS=JS+1                                                     REBUS     714
            IVTN=IDDAT(JS)                                              REBUS     715
            IF(NNEW(IVTN).NE.0) GO TO 1860                              REBUS     716
            NPROG=MNEW(IVTN)                                            REBUS     717
            IF(NPROG.NE.0)THEN                                          REBUS     718
              IF(JBSTAT(NPROG).GT.2)THEN                                REBUS     719
               IF(KLFO.EQ.0)THEN                                        REBUS     720
               WRITE(MSG(1),7320) IVTN                                  REBUS     721
               ELSE                                                     REBUS     722
               JK=NPROG*8                                               REBUS     723
               WRITE(MSG(1),7360) NAMES(JK-2),NAMES(JK-1),NAMES(JK)     REBUS     724
               ENDIF                                                    REBUS     725
               CALL PRTMSG(1)                                           REBUS     726
               IEBK=1                                                   REBUS     727
               GOTO 1980                                                REBUS     728
              ELSE                                                      REBUS     729
              GOTO 1820                                                 REBUS     730
              ENDIF                                                     REBUS     731
            ELSE                                                        REBUS     732
            IEBK=1                                                      REBUS     733
            IF(KLFO.EQ.0)THEN                                           REBUS     734
            WRITE(MSG(1),8040) IVTN                                     REBUS     735
            CALL PRTMSG(1)                                              REBUS     736
            ENDIF                                                       REBUS     737
            GOTO 1980                                                   REBUS     738
            ENDIF                                                       REBUS     739
 1820       CONTINUE                                                    REBUS     740
            NLFBUS=NLFBUS+1                                             REBUS     741
            NNEW(IVTN)=NLFBUS                                           REBUS     742
            NOLD(NLFBUS)=IVTN                                           REBUS     743
 1860       IDDAT(JS)=NNEW(IVTN)                                        REBUS     744
            JS=JS+2                                                     REBUS     745
C                                                                       REBUS     746
            IF(NNEW(IVTN).NE.0)THEN                                     REBUS     747
               NOLDI=IVTN                                               REBUS     748
               ASSIGN 1900 TO I2000                                     REBUS     749
               GOTO 4860                                                REBUS     750
            ENDIF                                                       REBUS     751
C                                                                       REBUS     752
 1900      CONTINUE                                                     REBUS     753
         IF(JJ.LT.NVTN)GOTO 1780                                        REBUS     754
         ENDIF                                                          REBUS     755
         JS=JS+1                                                        REBUS     756
         NVTN=IDDAT(JS)                                                 REBUS     757
         IF(NVTN.NE.0) THEN                                             REBUS     758
            DO 1940 JJ=1,NVTN                                           REBUS     759
            JS=JS+1                                                     REBUS     760
            IVTN1=IDDAT(JS)                                             REBUS     761
            JS=JS+1                                                     REBUS     762
            IVTN2=IDDAT(JS)                                             REBUS     763
            JS=JS+1                                                     REBUS     764
            ITFK=IDDAT(JS)                                              REBUS     765
            CALL RELINE(IVTN1,IVTN2,ITFK)                               REBUS     766
            JS=JS+1                                                     REBUS     767
            IDDAT(JS)=ITFK                                              REBUS     768
 1940       CONTINUE                                                    REBUS     769
         ENDIF                                                          REBUS     770
 1980 IF(I.LT.NSVC)GOTO 1500                                            REBUS     771
C                                                                       REBUS     772
      ENDIF                                                             REBUS     773
CD                                                                      REBUS     774
CD    RENUMBER ALL RANI REMOTE BUSES AND LINES                          REBUS     775
CD                                                                      REBUS     776
      IF(NRANI.NE.0)THEN                                                REBUS     777
         I=0                                                            REBUS     778
 2020    I=I+1                                                          REBUS     779
         JR=JRDAT(I)                                                    REBUS     780
         IF(IDDAT(JR+4).NE.50)GOTO 2260                                 REBUS     781
         JR=JR+12                                                       REBUS     782
         NVTN=IDDAT(JR)                                                 REBUS     783
         IF(NVTN.NE.0) THEN                                             REBUS     784
            JJ=0                                                        REBUS     785
 2060       JJ=JJ+1                                                     REBUS     786
            JR=JR+1                                                     REBUS     787
            IVTN=IDDAT(JR)                                              REBUS     788
            IF(NNEW(IVTN).NE.0) GO TO 2140                              REBUS     789
            IF(MNEW(IVTN).NE.0) GO TO 2100                              REBUS     790
            IEBK=1                                                      REBUS     791
            IF(KLFO.EQ.0)THEN                                           REBUS     792
            WRITE(MSG(1),8120) IVTN                                     REBUS     793
            CALL PRTMSG(1)                                              REBUS     794
            ENDIF                                                       REBUS     795
 2100       CONTINUE                                                    REBUS     796
            NLFBUS=NLFBUS+1                                             REBUS     797
            NNEW(IVTN)=NLFBUS                                           REBUS     798
            NOLD(NLFBUS)=IVTN                                           REBUS     799
 2140       IDDAT(JR)=NNEW(IVTN)                                        REBUS     800
            JR=JR+2                                                     REBUS     801
C                                                                       REBUS     802
               IF(NNEW(IVTN).NE.0)THEN                                  REBUS     803
               NOLDI=IVTN                                               REBUS     804
               ASSIGN 2180 TO I2000                                     REBUS     805
               GOTO 4860                                                REBUS     806
               ENDIF                                                    REBUS     807
C                                                                       REBUS     808
 2180       CONTINUE                                                    REBUS     809
          IF(JJ.LT.NVTN)GOTO 2060                                       REBUS     810
         ENDIF                                                          REBUS     811
         JR=JR+1                                                        REBUS     812
         NVTN=IDDAT(JR)                                                 REBUS     813
         IF(NVTN.NE.0) THEN                                             REBUS     814
            DO 2220 JJ=1,NVTN                                           REBUS     815
            JR=JR+1                                                     REBUS     816
            IVTN1=IDDAT(JR)                                             REBUS     817
            JR=JR+1                                                     REBUS     818
            IVTN2=IDDAT(JR)                                             REBUS     819
            JR=JR+1                                                     REBUS     820
            ITFK=IDDAT(JR)                                              REBUS     821
            CALL RELINE(IVTN1,IVTN2,ITFK)                               REBUS     822
            JR=JR+1                                                     REBUS     823
            IDDAT(JR)=ITFK                                              REBUS     824
 2220       CONTINUE                                                    REBUS     825
         ENDIF                                                          REBUS     826
 2260    IF(I.LT.NRANI)GOTO 2020                                        REBUS     827
C                                                                       REBUS     828
      ENDIF                                                             REBUS     829
CD                                                                      REBUS     830
CD    RENUMBER ALL STP REMOTE BUSES AND LINES                           REBUS     831
CD                                                                      REBUS     832
      IF(NTCPS.NE.0)THEN                                                REBUS     833
         I=0                                                            REBUS     834
 2300    I=I+1                                                          REBUS     835
         JTP=JTPDAT(I)                                                  REBUS     836
         IF(IDDAT(JTP+4).NE.50)GOTO 2540                                REBUS     837
         JR=JTDAT(I)+1                                                  REBUS     838
         NVTN=IDDAT(JR)                                                 REBUS     839
         IF(NVTN.NE.0) THEN                                             REBUS     840
           JJ=0                                                         REBUS     841
 2340      JJ=JJ+1                                                      REBUS     842
            JR=JR+1                                                     REBUS     843
            IVTN=IDDAT(JR)                                              REBUS     844
            IF(NNEW(IVTN).NE.0) GO TO 2420                              REBUS     845
            IF(MNEW(IVTN).NE.0) GO TO 2380                              REBUS     846
            IEBK=1                                                      REBUS     847
               IF(KLFO.EQ.0)THEN                                        REBUS     848
               WRITE(MSG(1),8200) IVTN                                  REBUS     849
               CALL PRTMSG(1)                                           REBUS     850
               ENDIF                                                    REBUS     851
 2380       CONTINUE                                                    REBUS     852
            NLFBUS=NLFBUS+1                                             REBUS     853
            NNEW(IVTN)=NLFBUS                                           REBUS     854
            NOLD(NLFBUS)=IVTN                                           REBUS     855
 2420       IDDAT(JR)=NNEW(IVTN)                                        REBUS     856
            JR=JR+2                                                     REBUS     857
C                                                                       REBUS     858
               IF(NNEW(IVTN).NE.0)THEN                                  REBUS     859
               NOLDI=IVTN                                               REBUS     860
               ASSIGN 2460 TO I2000                                     REBUS     861
               GOTO 4860                                                REBUS     862
               ENDIF                                                    REBUS     863
C                                                                       REBUS     864
 2460       IF(JJ.LT.NVTN)GOTO 2340                                     REBUS     865
         ENDIF                                                          REBUS     866
         JR=JR+1                                                        REBUS     867
         NVTN=IDDAT(JR)                                                 REBUS     868
         IF(NVTN.NE.0) THEN                                             REBUS     869
            DO 2500 JJ=1,NVTN                                           REBUS     870
            JR=JR+1                                                     REBUS     871
            IVTN1=IDDAT(JR)                                             REBUS     872
            JR=JR+1                                                     REBUS     873
            IVTN2=IDDAT(JR)                                             REBUS     874
            JR=JR+1                                                     REBUS     875
            ITFK=IDDAT(JR)                                              REBUS     876
            CALL RELINE(IVTN1,IVTN2,ITFK)                               REBUS     877
            JR=JR+1                                                     REBUS     878
            IDDAT(JR)=ITFK                                              REBUS     879
 2500       CONTINUE                                                    REBUS     880
         ENDIF                                                          REBUS     881
 2540    CONTINUE                                                       REBUS     882
         IF(IDDAT(JTP+5).NE.50)GOTO 2780                                REBUS     883
         JR=JPDAT(I)+1                                                  REBUS     884
         NVTN=IDDAT(JR)                                                 REBUS     885
          IF(NVTN.NE.0) THEN                                            REBUS     886
            JJ=0                                                        REBUS     887
 2580       JJ=JJ+1                                                     REBUS     888
            JR=JR+1                                                     REBUS     889
            IVTN=IDDAT(JR)                                              REBUS     890
            IF(NNEW(IVTN).NE.0) GO TO 2660                              REBUS     891
            IF(MNEW(IVTN).NE.0) GO TO 2620                              REBUS     892
            IEBK=1                                                      REBUS     893
             IF(KLFO.EQ.0)THEN                                          REBUS     894
             WRITE(MSG(1),8280) IVTN                                    REBUS     895
             CALL PRTMSG(1)                                             REBUS     896
             ENDIF                                                      REBUS     897
 2620       CONTINUE                                                    REBUS     898
            NLFBUS=NLFBUS+1                                             REBUS     899
            NNEW(IVTN)=NLFBUS                                           REBUS     900
            NOLD(NLFBUS)=IVTN                                           REBUS     901
 2660       IDDAT(JR)=NNEW(IVTN)                                        REBUS     902
            JR=JR+2                                                     REBUS     903
C                                                                       REBUS     904
              IF(NNEW(IVTN).NE.0)THEN                                   REBUS     905
               NOLDI=IVTN                                               REBUS     906
               ASSIGN 2700 TO I2000                                     REBUS     907
               GOTO 4860                                                REBUS     908
              ENDIF                                                     REBUS     909
C                                                                       REBUS     910
 2700       IF(JJ.LT.NVTN)GOTO 2580                                     REBUS     911
         ENDIF                                                          REBUS     912
         JR=JR+1                                                        REBUS     913
         NVTN=IDDAT(JR)                                                 REBUS     914
         IF(NVTN.NE.0) THEN                                             REBUS     915
            DO 2740 JJ=1,NVTN                                           REBUS     916
            JR=JR+1                                                     REBUS     917
            IVTN1=IDDAT(JR)                                             REBUS     918
            JR=JR+1                                                     REBUS     919
            IVTN2=IDDAT(JR)                                             REBUS     920
            JR=JR+1                                                     REBUS     921
            ITFK=IDDAT(JR)                                              REBUS     922
            CALL RELINE(IVTN1,IVTN2,ITFK)                               REBUS     923
            JR=JR+1                                                     REBUS     924
            IDDAT(JR)=ITFK                                              REBUS     925
 2740       CONTINUE                                                    REBUS     926
         ENDIF                                                          REBUS     927
 2780    IF(I.LT.NTCPS)GOTO 2300                                        REBUS     928
C                                                                       REBUS     929
      ENDIF                                                             REBUS     930
CD                                                                      REBUS     931
CD    RENUMBER ALL SDB REMOTE BUSES AND LINES                           REBUS     932
CD                                                                      REBUS     933
      IF(NSDB.NE.0)THEN                                                 REBUS     934
         I=0                                                            REBUS     935
 2820    I=I+1                                                          REBUS     936
         JR=JDDAT(I)                                                    REBUS     937
         IF(IDDAT(JR+2).NE.50)GOTO 3060                                 REBUS     938
         JR=JR+6                                                        REBUS     939
         NVTN=IDDAT(JR)                                                 REBUS     940
         IF(NVTN.NE.0) THEN                                             REBUS     941
            JJ=0                                                        REBUS     942
 2860       JJ=JJ+1                                                     REBUS     943
            JR=JR+1                                                     REBUS     944
            IVTN=IDDAT(JR)                                              REBUS     945
            IF(NNEW(IVTN).NE.0) GO TO 2940                              REBUS     946
            IF(MNEW(IVTN).NE.0) GO TO 2900                              REBUS     947
            IEBK=1                                                      REBUS     948
            IF(KLFO.EQ.0)THEN                                           REBUS     949
            WRITE(MSG(1),8360) IVTN                                     REBUS     950
            CALL PRTMSG(1)                                              REBUS     951
            ENDIF                                                       REBUS     952
 2900       CONTINUE                                                    REBUS     953
            NLFBUS=NLFBUS+1                                             REBUS     954
            NNEW(IVTN)=NLFBUS                                           REBUS     955
            NOLD(NLFBUS)=IVTN                                           REBUS     956
 2940       IDDAT(JR)=NNEW(IVTN)                                        REBUS     957
            JR=JR+2                                                     REBUS     958
C                                                                       REBUS     959
              IF(NNEW(IVTN).NE.0)THEN                                   REBUS     960
               NOLDI=IVTN                                               REBUS     961
               ASSIGN 2980 TO I2000                                     REBUS     962
               GOTO 4860                                                REBUS     963
              ENDIF                                                     REBUS     964
C                                                                       REBUS     965
 2980      IF(JJ.LT.NVTN)GOTO 2860                                      REBUS     966
         ENDIF                                                          REBUS     967
         JR=JR+1                                                        REBUS     968
         NVTN=IDDAT(JR)                                                 REBUS     969
         IF(NVTN.NE.0) THEN                                             REBUS     970
            DO 3020 JJ=1,NVTN                                           REBUS     971
            JR=JR+1                                                     REBUS     972
            IVTN1=IDDAT(JR)                                             REBUS     973
            JR=JR+1                                                     REBUS     974
            IVTN2=IDDAT(JR)                                             REBUS     975
            JR=JR+1                                                     REBUS     976
            ITFK=IDDAT(JR)                                              REBUS     977
            CALL RELINE(IVTN1,IVTN2,ITFK)                               REBUS     978
            JR=JR+1                                                     REBUS     979
            IDDAT(JR)=ITFK                                              REBUS     980
 3020       CONTINUE                                                    REBUS     981
         ENDIF                                                          REBUS     982
 3060    IF(I.LT.NSDB)GOTO 2820                                         REBUS     983
C                                                                       REBUS     984
      ENDIF                                                             REBUS     985
C                                                                       REBUS     986
C     RENUMBER THE EXCITER AND GOVERNOR REMOTE BUSES AND LINES          REBUS     987
C                                                                       REBUS     988
      IF (NT.NE.0)THEN                                                  REBUS     989
      N=0                                                               REBUS     990
 3100 N=N+1                                                             REBUS     991
      IEXX=ICONTA(4,N)                                                  REBUS     992
      IF(IEXX.NE.0)THEN                                                 REBUS     993
      JE=JCONTA(3,N)                                                    REBUS     994
      IF(IEXX.EQ.50) GO TO 3260                                         REBUS     995
      IF(JE.NE.0)THEN                                                   REBUS     996
      IVTN=IDDAT(JE+1)                                                  REBUS     997
      IF (IVTN.NE.0)THEN                                                REBUS     998
      IF (NNEW(IVTN).NE.0) GO TO 3180                                   REBUS     999
      NPROG=MNEW(IVTN)                                                  REBUS    1000
      IF(NPROG.NE.0)THEN                                                REBUS    1001
            IF(JBSTAT(NPROG).GT.2)THEN                                  REBUS    1002
              IF(KLFO.EQ.0)THEN                                         REBUS    1003
              WRITE(MSG(1),7600) IVTN                                   REBUS    1004
              ELSE                                                      REBUS    1005
              JK=NPROG*8                                                REBUS    1006
              WRITE(MSG(1),7640) NAMES(JK-2),NAMES(JK-1),NAMES(JK)      REBUS    1007
              ENDIF                                                     REBUS    1008
             CALL PRTMSG(1)                                             REBUS    1009
             IEBK=1                                                     REBUS    1010
             GOTO 3220                                                  REBUS    1011
            ELSE                                                        REBUS    1012
             GOTO 3140                                                  REBUS    1013
            ENDIF                                                       REBUS    1014
      ELSE                                                              REBUS    1015
      IEBK=1                                                            REBUS    1016
      IF(KLFO.EQ.0)THEN                                                 REBUS    1017
      WRITE(MSG(1),7560) IVTN                                           REBUS    1018
      CALL PRTMSG(1)                                                    REBUS    1019
      GOTO 3220                                                         REBUS    1020
      ENDIF                                                             REBUS    1021
      ENDIF                                                             REBUS    1022
 3140 CONTINUE                                                          REBUS    1023
      NLFBUS=NLFBUS+1                                                   REBUS    1024
      NNEW(IVTN)=NLFBUS                                                 REBUS    1025
      NOLD(NLFBUS)=IVTN                                                 REBUS    1026
 3180 IDDAT(JE+1)=NNEW(IVTN)                                            REBUS    1027
C                                                                       REBUS    1028
           IF(NNEW(IVTN).NE.0)THEN                                      REBUS    1029
               NOLDI=IVTN                                               REBUS    1030
               ASSIGN 3220 TO I2000                                     REBUS    1031
               GOTO 4860                                                REBUS    1032
            ENDIF                                                       REBUS    1033
 3220       CONTINUE                                                    REBUS    1034
C                                                                       REBUS    1035
      ENDIF                                                             REBUS    1036
      ENDIF                                                             REBUS    1037
 3260 CONTINUE                                                          REBUS    1038
C                                                                       REBUS    1039
C   STABILIZER REMOTE SENSING BUS                                       REBUS    1040
C                                                                       REBUS    1041
      ISTABX=ICONTA(5,N)                                                REBUS    1042
      IF(ISTABX.EQ.50) THEN                                             REBUS    1043
         JE=JCONTA(4,N)                                                 REBUS    1044
         GO TO 3540                                                     REBUS    1045
      ENDIF                                                             REBUS    1046
      IF (ISTABX.NE.0.AND.ISTABX.NE.7.AND.ISTABX.NE.8) THEN             REBUS    1047
      JS=JCONTA(4,N)                                                    REBUS    1048
      NSNO1=IDDAT(JS+1)                                                 REBUS    1049
      IF (NSNO1.NE.0)THEN                                               REBUS    1050
       IF(NNEW(NSNO1).NE.0) GOTO 3340                                   REBUS    1051
        NPROG=MNEW(NSNO1)                                               REBUS    1052
         IF(NPROG.NE.0)THEN                                             REBUS    1053
           IF(JBSTAT(NPROG).LE.2)THEN                                   REBUS    1054
           GOTO 3300                                                    REBUS    1055
           ELSE                                                         REBUS    1056
             IF(KLFO.EQ.0)THEN                                          REBUS    1057
             WRITE(MSG(1),7760) NSNO1                                   REBUS    1058
             ELSE                                                       REBUS    1059
             JK=NPROG*8                                                 REBUS    1060
             WRITE(MSG(1),7800) NAMES(JK-2),NAMES(JK-1),NAMES(JK)       REBUS    1061
             ENDIF                                                      REBUS    1062
             CALL PRTMSG(1)                                             REBUS    1063
             IEBK=1                                                     REBUS    1064
             GOTO 3340                                                  REBUS    1065
            ENDIF                                                       REBUS    1066
         ELSE                                                           REBUS    1067
            IF(KLFO.EQ.0)THEN                                           REBUS    1068
            WRITE(MSG(1),7720) NSNO1                                    REBUS    1069
            CALL PRTMSG(1)                                              REBUS    1070
            ENDIF                                                       REBUS    1071
            IEBK=1                                                      REBUS    1072
            GOTO 3340                                                   REBUS    1073
        ENDIF                                                           REBUS    1074
 3300 CONTINUE                                                          REBUS    1075
      NLFBUS=NLFBUS+1                                                   REBUS    1076
      NNEW(NSNO1)=NLFBUS                                                REBUS    1077
      NOLD(NLFBUS)=NSNO1                                                REBUS    1078
 3340 IDDAT(JS+1)=NNEW(NSNO1)                                           REBUS    1079
C                                                                       REBUS    1080
      IF (NSNO1.NE.0) THEN                                              REBUS    1081
         IF (NNEW(NSNO1).NE.0) THEN                                     REBUS    1082
            NOLDI=NSNO1                                                 REBUS    1083
            ASSIGN 3380 TO I2000                                        REBUS    1084
            GOTO 4860                                                   REBUS    1085
         END IF                                                         REBUS    1086
      END IF                                                            REBUS    1087
 3380 CONTINUE                                                          REBUS    1088
C                                                                       REBUS    1089
      ENDIF                                                             REBUS    1090
      IF (ISTABX.EQ.12) THEN                                            REBUS    1091
      NSNO2=IDDAT(JS+3)                                                 REBUS    1092
      IF (NSNO2.NE.0)THEN                                               REBUS    1093
      IF (NNEW(NSNO2).NE.0) GO TO 3460                                  REBUS    1094
        NPROG=MNEW(NSNO2)                                               REBUS    1095
         IF(NPROG.NE.0)THEN                                             REBUS    1096
           IF(JBSTAT(NPROG).LE.2)THEN                                   REBUS    1097
           GOTO 3420                                                    REBUS    1098
           ELSE                                                         REBUS    1099
             IF(KLFO.EQ.0)THEN                                          REBUS    1100
             WRITE(MSG(1),7760) NSNO2                                   REBUS    1101
             ELSE                                                       REBUS    1102
             JK=NPROG*8                                                 REBUS    1103
             WRITE(MSG(1),7800) NAMES(JK-2),NAMES(JK-1),NAMES(JK)       REBUS    1104
             ENDIF                                                      REBUS    1105
             CALL PRTMSG(1)                                             REBUS    1106
             IEBK=1                                                     REBUS    1107
             GOTO 3500                                                  REBUS    1108
             ENDIF                                                      REBUS    1109
           ENDIF                                                        REBUS    1110
         ELSE                                                           REBUS    1111
         IEBK=1                                                         REBUS    1112
         IF(KLFO.EQ.0)THEN                                              REBUS    1113
         WRITE(MSG(1),7720) NSNO2                                       REBUS    1114
         CALL PRTMSG(1)                                                 REBUS    1115
         ENDIF                                                          REBUS    1116
        GOTO 3500                                                       REBUS    1117
        ENDIF                                                           REBUS    1118
 3420 CONTINUE                                                          REBUS    1119
      NLFBUS=NLFBUS+1                                                   REBUS    1120
      NNEW(NSNO2)=NLFBUS                                                REBUS    1121
      NOLD(NLFBUS)=NSNO2                                                REBUS    1122
 3460 IDDAT(JS+3)=NNEW(NSNO2)                                           REBUS    1123
C                                                                       REBUS    1124
          IF(NNEW(NSNO2).NE.0)THEN                                      REBUS    1125
               NOLDI=NSNO2                                              REBUS    1126
               ASSIGN 3500 TO I2000                                     REBUS    1127
               GOTO 4860                                                REBUS    1128
           ENDIF                                                        REBUS    1129
 3500     CONTINUE                                                      REBUS    1130
C                                                                       REBUS    1131
      ENDIF                                                             REBUS    1132
      ENDIF                                                             REBUS    1133
      IF(IEXX.EQ.50) GO TO 3540                                         REBUS    1134
      IUALX=ICONTA(7,N)                                                 REBUS    1135
      IF(IUALX.EQ.50) THEN                                              REBUS    1136
         JE=JCONTA(6,N)                                                 REBUS    1137
         GO TO 3540                                                     REBUS    1138
      ENDIF                                                             REBUS    1139
      GO TO 3780                                                        REBUS    1140
 3540 CONTINUE                                                          REBUS    1141
      JE=JE+9                                                           REBUS    1142
      NVTN=IDDAT(JE)                                                    REBUS    1143
      IF(NVTN.NE.0) THEN                                                REBUS    1144
C                                                                       REBUS    1145
          JJ=0                                                          REBUS    1146
 3580     JJ=JJ+1                                                       REBUS    1147
         JE=JE+1                                                        REBUS    1148
         IVTN=IDDAT(JE)                                                 REBUS    1149
         IF(NNEW(IVTN).NE.0) GO TO 3660                                 REBUS    1150
         NPROG=MNEW(IVTN)                                               REBUS    1151
         IF(NPROG.NE.0)THEN                                             REBUS    1152
           IF(JBSTAT(NPROG).LE.2)THEN                                   REBUS    1153
           GOTO 3620                                                    REBUS    1154
           ELSE                                                         REBUS    1155
             IF(KLFO.EQ.0)THEN                                          REBUS    1156
             WRITE(MSG(1),7880) NSNO2                                   REBUS    1157
             ELSE                                                       REBUS    1158
             JK=NPROG*8                                                 REBUS    1159
             WRITE(MSG(1),7920) NAMES(JK-2),NAMES(JK-1),NAMES(JK)       REBUS    1160
             ENDIF                                                      REBUS    1161
             CALL PRTMSG(1)                                             REBUS    1162
             IEBK=1                                                     REBUS    1163
             GOTO 3700                                                  REBUS    1164
           ENDIF                                                        REBUS    1165
         ELSE                                                           REBUS    1166
         IEBK=1                                                         REBUS    1167
         IF(KLFO.EQ.0)THEN                                              REBUS    1168
         WRITE(MSG(1),7960) IVTN                                        REBUS    1169
         CALL PRTMSG(1)                                                 REBUS    1170
         ENDIF                                                          REBUS    1171
        GOTO 3700                                                       REBUS    1172
        ENDIF                                                           REBUS    1173
 3620    CONTINUE                                                       REBUS    1174
         NLFBUS=NLFBUS+1                                                REBUS    1175
         NNEW(IVTN)=NLFBUS                                              REBUS    1176
         NOLD(NLFBUS)=IVTN                                              REBUS    1177
 3660    IDDAT(JE)=NNEW(IVTN)                                           REBUS    1178
         JE=JE+2                                                        REBUS    1179
C                                                                       REBUS    1180
          IF(NNEW(IVTN).NE.0)THEN                                       REBUS    1181
               NOLDI=IVTN                                               REBUS    1182
               ASSIGN 3700 TO I2000                                     REBUS    1183
               GOTO 4860                                                REBUS    1184
           ENDIF                                                        REBUS    1185
 3700     CONTINUE                                                      REBUS    1186
C                                                                       REBUS    1187
          IF(JJ.LT.NVTN)GOTO 3580                                       REBUS    1188
      ENDIF                                                             REBUS    1189
      JE=JE+1                                                           REBUS    1190
      NVTN=IDDAT(JE)                                                    REBUS    1191
      IF(NVTN.NE.0) THEN                                                REBUS    1192
         DO 3740 JJ=1,NVTN                                              REBUS    1193
         JE=JE+1                                                        REBUS    1194
         IVTN1=IDDAT(JE)                                                REBUS    1195
         JE=JE+1                                                        REBUS    1196
         IVTN2=IDDAT(JE)                                                REBUS    1197
         JE=JE+1                                                        REBUS    1198
         ITFK=IDDAT(JE)                                                 REBUS    1199
         CALL RELINE(IVTN1,IVTN2,ITFK)                                  REBUS    1200
         JE=JE+1                                                        REBUS    1201
         IDDAT(JE)=ITFK                                                 REBUS    1202
 3740    CONTINUE                                                       REBUS    1203
      ENDIF                                                             REBUS    1204
 3780 CONTINUE                                                          REBUS    1205
C  END IF 'IEXX.NE.0'                                                   REBUS    1206
      ENDIF                                                             REBUS    1207
C                                                                       REBUS    1208
C     GOVERNOR REMOTE BUSES AND LINES                                   REBUS    1209
C                                                                       REBUS    1210
      IGVN=ICONTA(2,N)                                                  REBUS    1211
      IF(IGVN.EQ.50)THEN                                                REBUS    1212
      JE=JCONTA(2,N)                                                    REBUS    1213
      JE=JE+3                                                           REBUS    1214
      NVTN=IDDAT(JE)                                                    REBUS    1215
C                                                                       REBUS    1216
      IF(NVTN.NE.0) THEN                                                REBUS    1217
C                                                                       REBUS    1218
         JJ=0                                                           REBUS    1219
 3820    JJ=JJ+1                                                        REBUS    1220
         JE=JE+1                                                        REBUS    1221
         IVTN=IDDAT(JE)                                                 REBUS    1222
         IF(NNEW(IVTN).NE.0) GO TO 3900                                 REBUS    1223
         NPROG=MNEW(IVTN)                                               REBUS    1224
         IF(NPROG.NE.0)THEN                                             REBUS    1225
           IF(JBSTAT(NPROG).LE.2)THEN                                   REBUS    1226
           GOTO 3860                                                    REBUS    1227
           ELSE                                                         REBUS    1228
             IF(KLFO.EQ.0)THEN                                          REBUS    1229
             WRITE(MSG(1),8480) IVTN                                    REBUS    1230
             ELSE                                                       REBUS    1231
             JK=NPROG*8                                                 REBUS    1232
             WRITE(MSG(1),8520) NAMES(JK-2),NAMES(JK-1),NAMES(JK)       REBUS    1233
             ENDIF                                                      REBUS    1234
             CALL PRTMSG(1)                                             REBUS    1235
             IEBK=1                                                     REBUS    1236
             GOTO 3940                                                  REBUS    1237
           ENDIF                                                        REBUS    1238
         ELSE                                                           REBUS    1239
         IEBK=1                                                         REBUS    1240
            IF(KLFO.EQ.0)THEN                                           REBUS    1241
            WRITE(MSG(1),8440) IVTN                                     REBUS    1242
            CALL PRTMSG(1)                                              REBUS    1243
            ENDIF                                                       REBUS    1244
        GOTO 3940                                                       REBUS    1245
        ENDIF                                                           REBUS    1246
 3860    CONTINUE                                                       REBUS    1247
         NLFBUS=NLFBUS+1                                                REBUS    1248
         NNEW(IVTN)=NLFBUS                                              REBUS    1249
         NOLD(NLFBUS)=IVTN                                              REBUS    1250
 3900    IDDAT(JE)=NNEW(IVTN)                                           REBUS    1251
         JE=JE+2                                                        REBUS    1252
C                                                                       REBUS    1253
          IF(NNEW(IVTN).NE.0)THEN                                       REBUS    1254
               NOLDI=IVTN                                               REBUS    1255
               ASSIGN 3940 TO I2000                                     REBUS    1256
               GOTO 4860                                                REBUS    1257
           ENDIF                                                        REBUS    1258
C                                                                       REBUS    1259
 3940    IF(JJ.LT.NVTN)GOTO 3820                                        REBUS    1260
C                                                                       REBUS    1261
      ENDIF                                                             REBUS    1262
C                                                                       REBUS    1263
      JE=JE+1                                                           REBUS    1264
      NVTN=IDDAT(JE)                                                    REBUS    1265
      IF(NVTN.NE.0) THEN                                                REBUS    1266
         DO 3980 JJ=1,NVTN                                              REBUS    1267
         JE=JE+1                                                        REBUS    1268
         IVTN1=IDDAT(JE)                                                REBUS    1269
         JE=JE+1                                                        REBUS    1270
         IVTN2=IDDAT(JE)                                                REBUS    1271
         JE=JE+1                                                        REBUS    1272
         ITFK=IDDAT(JE)                                                 REBUS    1273
         CALL RELINE(IVTN1,IVTN2,ITFK)                                  REBUS    1274
         JE=JE+1                                                        REBUS    1275
         IDDAT(JE)=ITFK                                                 REBUS    1276
 3980    CONTINUE                                                       REBUS    1277
      ENDIF                                                             REBUS    1278
C  END IF 'IGVN.EQ.50'                                                  REBUS    1279
      ENDIF                                                             REBUS    1280
       IF(N.LT.NT)GOTO 3100                                             REBUS    1281
C                                                                       REBUS    1282
C   ENDIF.NTL.NE.0                                                      REBUS    1283
C                                                                       REBUS    1284
      ENDIF                                                             REBUS    1285
C                                                                       REBUS    1286
C   RENUMBER THE REMAINING AC BUS OF THE DC SYSTEM                      REBUS    1287
C                                                                       REBUS    1288
      IF(KCDC.GT.0.AND.NACBU2.LT.NACTOT)THEN                            REBUS    1289
C                                                                       REBUS    1290
      I=NACBU2                                                          REBUS    1291
 4020 I=I+1                                                             REBUS    1292
      NLF=IUQABU(I)                                                     REBUS    1293
      NPROG=MNEW(NLF)                                                   REBUS    1294
      IF(NPROG.NE.0)THEN                                                REBUS    1295
         IF(JBSTAT(NPROG).GT.2)THEN                                     REBUS    1296
             IF(KLFO.EQ.0)THEN                                          REBUS    1297
             WRITE(MSG(1),6840) NLF                                     REBUS    1298
             CALL PRTMSG(1)                                             REBUS    1299
             ELSE                                                       REBUS    1300
             JK=NPROG*8                                                 REBUS    1301
             WRITE(MSG(1),6880) NAMES(JK-2),NAMES(JK-1),NAMES(JK)       REBUS    1302
             WRITE(MSG(2),6890)                                         REBUS    1303
             CALL PRTMSG(2)                                             REBUS    1304
             ENDIF                                                      REBUS    1305
             IEBK=1                                                     REBUS    1306
             GOTO 4060                                                  REBUS    1307
         ENDIF                                                          REBUS    1308
      ELSE                                                              REBUS    1309
         IF(KLFO.EQ.0)THEN                                              REBUS    1310
         WRITE(MSG(1),6920) NLF                                         REBUS    1311
         CALL PRTMSG(1)                                                 REBUS    1312
         IEBK=1                                                         REBUS    1313
         GOTO 4060                                                      REBUS    1314
         ENDIF                                                          REBUS    1315
      ENDIF                                                             REBUS    1316
      IF(NNEW(NLF).EQ.0)THEN                                            REBUS    1317
      NLFBUS=NLFBUS+1                                                   REBUS    1318
      NOLD(NLFBUS)=NLF                                                  REBUS    1319
      NNEW(NLF)=NLFBUS                                                  REBUS    1320
C                                                                       REBUS    1321
      ELSE                                                              REBUS    1322
       NOLDI=NLF                                                        REBUS    1323
       ASSIGN 4060 TO I2000                                             REBUS    1324
       GOTO 4860                                                        REBUS    1325
      ENDIF                                                             REBUS    1326
C                                                                       REBUS    1327
 4060  IF(I .LT. NACTOT)GOTO 4020                                       REBUS    1328
C                                                                       REBUS    1329
      ENDIF                                                             REBUS    1330
CD                                                                      REBUS    1331
CD    RENUMBER ALL AUTOMATIC RELAYING BUSES                             REBUS    1332
CD                                                                      REBUS    1333
      IF(NAUTB.GT.0)THEN                                                REBUS    1334
C                                                                       REBUS    1335
      I=0                                                               REBUS    1336
 4100  I=I+1                                                            REBUS    1337
      NLF=NAUBUS(I)                                                     REBUS    1338
      NPROG=MNEW(NLF)                                                   REBUS    1339
      IF(NPROG.NE.0)THEN                                                REBUS    1340
         IF(JBSTAT(NPROG).GT.2)THEN                                     REBUS    1341
             IF(KLFO.EQ.0)THEN                                          REBUS    1342
             WRITE(MSG(1),8720) NLF                                     REBUS    1343
             ELSE                                                       REBUS    1344
             JK=NPROG*8                                                 REBUS    1345
             WRITE(MSG(1),8760) NAMES(JK-2),NAMES(JK-1),NAMES(JK)       REBUS    1346
             ENDIF                                                      REBUS    1347
             CALL PRTMSG(1)                                             REBUS    1348
             IEBK=1                                                     REBUS    1349
             GOTO 4140                                                  REBUS    1350
          ENDIF                                                         REBUS    1351
      ELSE                                                              REBUS    1352
         IF(KLFO.EQ.0)THEN                                              REBUS    1353
         WRITE(MSG(1),8800) NLF                                         REBUS    1354
         CALL PRTMSG(1)                                                 REBUS    1355
         IEBK=1                                                         REBUS    1356
         GOTO 4140                                                      REBUS    1357
         ENDIF                                                          REBUS    1358
      ENDIF                                                             REBUS    1359
      IF(NNEW(NLF).EQ.0)THEN                                            REBUS    1360
       NLFBUS=NLFBUS+1                                                  REBUS    1361
       NOLD(NLFBUS)=NLF                                                 REBUS    1362
       NNEW(NLF)=NLFBUS                                                 REBUS    1363
C                                                                       REBUS    1364
      ELSE                                                              REBUS    1365
C                                                                       REBUS    1366
       NOLDI=NLF                                                        REBUS    1367
       ASSIGN 4140 TO I2000                                             REBUS    1368
       GOTO 4860                                                        REBUS    1369
C                                                                       REBUS    1370
      ENDIF                                                             REBUS    1371
C                                                                       REBUS    1372
 4140  IF(I.LT.NAUTB)GOTO 4100                                          REBUS    1373
C                                                                       REBUS    1374
      ENDIF                                                             REBUS    1375
C                                                                       REBUS    1376
      LASTV1=NLFBUS                                                     REBUS    1377
C                                                                       REBUS    1378
CD                                                                      REBUS    1379
CD    RENUMBERING BUSES OF MONITORED LINES                              REBUS    1380
CD                                                                      REBUS    1381
      IF(NPFL.GT.0)THEN                                                 REBUS    1382
C                                                                       REBUS    1383
      NPFL12=0                                                          REBUS    1384
      N=0                                                               REBUS    1385
 4180 N=N+1                                                             REBUS    1386
      NPFL12=NPFL12+12                                                  REBUS    1387
      IF(MLFTB(NPFL12-11).EQ.0)THEN                                     REBUS    1388
      NLFF=MLFTB(NPFL12-6)                                              REBUS    1389
      DO 4220 IB=1,IFNBUS                                               REBUS    1390
       IBF=NINF(IB)                                                     REBUS    1391
       IF(IBF .EQ. NLFF)GOTO 4260                                       REBUS    1392
 4220  CONTINUE                                                         REBUS    1393
      IF (NNEW(NLFF).EQ.0)THEN                                          REBUS    1394
        NPROG=MNEW(NLFF)                                                REBUS    1395
        IF(NPROG.NE.0)THEN                                              REBUS    1396
          IF(JBSTAT(NPROG).LE.2)THEN                                    REBUS    1397
          NLFBUS=NLFBUS+1                                               REBUS    1398
          NNEW(NLFF)=NLFBUS                                             REBUS    1399
          NOLD(NLFBUS)=NLFF                                             REBUS    1400
          ELSE                                                          REBUS    1401
          MLFTB(NPFL12-11)=10                                           REBUS    1402
          GOTO 4380                                                     REBUS    1403
          ENDIF                                                         REBUS    1404
        ELSE                                                            REBUS    1405
        MLFTB(NPFL12-11)=10                                             REBUS    1406
        GOTO 4380                                                       REBUS    1407
        ENDIF                                                           REBUS    1408
      ELSE                                                              REBUS    1409
C                                                                       REBUS    1410
       NOLDI=NLFF                                                       REBUS    1411
       ASSIGN 4260 TO I2000                                             REBUS    1412
       GOTO 4860                                                        REBUS    1413
C                                                                       REBUS    1414
      ENDIF                                                             REBUS    1415
C                                                                       REBUS    1416
 4260 CONTINUE                                                          REBUS    1417
      NLFT=MLFTB(NPFL12-5)                                              REBUS    1418
      DO 4300 IB=1,IFNBUS                                               REBUS    1419
       IBF=NINF(IB)                                                     REBUS    1420
       IF(IBF .EQ. NLFT)GOTO 4340                                       REBUS    1421
 4300 CONTINUE                                                          REBUS    1422
      IF (NNEW(NLFT).EQ.0)THEN                                          REBUS    1423
        NPROG=MNEW(NLFT)                                                REBUS    1424
        IF(NPROG.NE.0)THEN                                              REBUS    1425
           IF(JBSTAT(NPROG).LE.2)THEN                                   REBUS    1426
           NLFBUS=NLFBUS+1                                              REBUS    1427
           NNEW(NLFT)=NLFBUS                                            REBUS    1428
           NOLD(NLFBUS)=NLFT                                            REBUS    1429
           ELSE                                                         REBUS    1430
           MLFTB(NPFL12-11)=10                                          REBUS    1431
           GOTO 4380                                                    REBUS    1432
           ENDIF                                                        REBUS    1433
        ELSE                                                            REBUS    1434
        MLFTB(NPFL12-11)=10                                             REBUS    1435
        GOTO 4380                                                       REBUS    1436
        ENDIF                                                           REBUS    1437
      ELSE                                                              REBUS    1438
C                                                                       REBUS    1439
       NOLDI=NLFT                                                       REBUS    1440
       ASSIGN 4340 TO I2000                                             REBUS    1441
       GOTO 4860                                                        REBUS    1442
C                                                                       REBUS    1443
      ENDIF                                                             REBUS    1444
 4340 CONTINUE                                                          REBUS    1445
C                                                                       REBUS    1446
      IF(MNEW(NLFF).NE.0.AND.MNEW(NLFT).NE.0)THEN                       REBUS    1447
      LSTATU=0                                                          REBUS    1448
      ELSE                                                              REBUS    1449
      LSTATU=10                                                         REBUS    1450
      ENDIF                                                             REBUS    1451
      MLFTB(NPFL12-11)=LSTATU                                           REBUS    1452
      ENDIF                                                             REBUS    1453
 4380 CONTINUE                                                          REBUS    1454
      IF(N .LT. NPFL)GOTO 4180                                          REBUS    1455
C                                                                       REBUS    1456
      ENDIF                                                             REBUS    1457
CD                                                                      REBUS    1458
CD    RENUMBERING MONITORED BUSES                                       REBUS    1459
CD                                                                      REBUS    1460
      IF(NVBS.GT.0)THEN                                                 REBUS    1461
C                                                                       REBUS    1462
      N=0                                                               REBUS    1463
 4420 N=N+1                                                             REBUS    1464
      NLF=MVBUS(N)                                                      REBUS    1465
      IF(NLF.NE.0)THEN                                                  REBUS    1466
      DO 4460 IB=1,IFNBUS                                               REBUS    1467
       IBF=NINF(IB)                                                     REBUS    1468
       IF(IBF .EQ. NLF)GOTO 4500                                        REBUS    1469
 4460 CONTINUE                                                          REBUS    1470
C                                                                       REBUS    1471
      NPBNO=NNEW(NLF)                                                   REBUS    1472
         IF(NPBNO.EQ.0)THEN                                             REBUS    1473
            NPROG=MNEW(NLF)                                             REBUS    1474
             IF(NPROG.EQ.0)THEN                                         REBUS    1475
             GOTO 4500                                                  REBUS    1476
             ELSE                                                       REBUS    1477
              IF(JBSTAT(NPROG).LE.2)THEN                                REBUS    1478
              NLFBUS=NLFBUS+1                                           REBUS    1479
              NNEW(NLF)=NLFBUS                                          REBUS    1480
              NOLD(NLFBUS)=NLF                                          REBUS    1481
              ELSE                                                      REBUS    1482
              GOTO 4500                                                 REBUS    1483
              ENDIF                                                     REBUS    1484
             ENDIF                                                      REBUS    1485
         ELSE                                                           REBUS    1486
C                                                                       REBUS    1487
          NOLDI=NLF                                                     REBUS    1488
          ASSIGN 4500 TO I2000                                          REBUS    1489
          GOTO 4860                                                     REBUS    1490
C                                                                       REBUS    1491
      ENDIF                                                             REBUS    1492
C                                                                       REBUS    1493
      ENDIF                                                             REBUS    1494
 4500 IF(N .LT. NVBS)GOTO 4420                                          REBUS    1495
C                                                                       REBUS    1496
      ENDIF                                                             REBUS    1497
C                                                                       REBUS    1498
      NLAST=NLFBUS                                                      REBUS    1499
CD                                                                      REBUS    1500
CD    SET THE LAST VOLTAGE BUS (LASTV2)                                 REBUS    1501
CD                                                                      REBUS    1502
      LASTV2=NLFBUS                                                     REBUS    1503
                                                                        REBUS    1504
CD                                                                      REBUS    1505
CD    CHECK THE DIMENSION LIMIT FOR THE SETSOL ARRAYS                   REBUS    1506
CD                                                                      REBUS    1507
      IF( LASTV2.GT.NDEV .OR. LASTCU.GT.NDEV)THEN                       REBUS    1508
       WRITE(MSG(1),9080)                                               REBUS    1509
       WRITE(MSG(2),9120) NDEV                                          REBUS    1510
       CALL PRTMSG(2)                                                   REBUS    1511
       MSG(1)='REBUS: SPARSE VECTOR DIMENSION EXCEEDED'                 REBUS    1512
       CALL ASTOP(MSG(1),37)                                            REBUS    1513
      ENDIF                                                             REBUS    1514
C                                                                       REBUS    1515
                                                                        REBUS    1516
C                                                                       REBUS    1517
C     DEFINE NTT                                                        REBUS    1518
C                                                                       REBUS    1519
      NTT=NT+NBFT                                                       REBUS    1520
CD                                                                      REBUS    1521
CD    RENUMBER OTHER BUSES. LBUSNO=LARGEST OLD BUS NO.                  REBUS    1522
CD                                                                      REBUS    1523
      I=NLFBUS                                                          REBUS    1524
C                                                                       REBUS    1525
      DO 4620 J=1,LBUSNO                                                REBUS    1526
C                                                                       REBUS    1527
      NPROG=MNEW(J)                                                     REBUS    1528
      IF (NPROG.GT.0)THEN                                               REBUS    1529
      IF(JBSTAT(NPROG).GT.2)GOTO 4620                                   REBUS    1530
      IF (NNEW(J).NE.0) GO TO 4620                                      REBUS    1531
      DO 4540 IB=1,IFNBUS                                               REBUS    1532
       IBF=NINF(IB)                                                     REBUS    1533
       IF(IBF .EQ. J)GOTO 4580                                          REBUS    1534
 4540 CONTINUE                                                          REBUS    1535
      I=I+1                                                             REBUS    1536
      NNEW(J)=I                                                         REBUS    1537
      NOLD(I)=J                                                         REBUS    1538
 4580 CONTINUE                                                          REBUS    1539
      ELSE                                                              REBUS    1540
      IF(MNEW(J).NE.0)THEN                                              REBUS    1541
      M=-MNEW(J)                                                        REBUS    1542
      KK=NNEW(M)                                                        REBUS    1543
      NNEW(J)=KK                                                        REBUS    1544
      ENDIF                                                             REBUS    1545
      ENDIF                                                             REBUS    1546
 4620 CONTINUE                                                          REBUS    1547
C                                                                       REBUS    1548
      NLFBUS=I                                                          REBUS    1549
      NLAST=NLFBUS                                                      REBUS    1550
C                                                                       REBUS    1551
CD                                                                      REBUS    1552
CD    RENUMBER ALL IFINITE BUSES                                        REBUS    1553
CD                                                                      REBUS    1554
      IF(IFNBUS.NE.0)THEN                                               REBUS    1555
      I=0                                                               REBUS    1556
 4660 I=I+1                                                             REBUS    1557
      NLF=NINF(I)                                                       REBUS    1558
      IF(NNEW(NLF).NE.0)THEN                                            REBUS    1559
      IF(KLFO.EQ.0)THEN                                                 REBUS    1560
      WRITE(MSG(1),6280) NLF                                            REBUS    1561
      ELSE                                                              REBUS    1562
      JK=MNEW(NLF)                                                      REBUS    1563
      JK=JK*8                                                           REBUS    1564
      WRITE(MSG(1),6320) NAMES(JK-2),NAMES(JK-1),NAMES(JK)              REBUS    1565
      ENDIF                                                             REBUS    1566
      WRITE(MSG(2),6360)                                                REBUS    1567
      CALL PRTMSG(2)                                                    REBUS    1568
      IEBK=1                                                            REBUS    1569
      ELSE                                                              REBUS    1570
       NLFBUS=NLFBUS+1                                                  REBUS    1571
       NNEW(NLF)=NLFBUS                                                 REBUS    1572
       NOLD(NLFBUS)=NLF                                                 REBUS    1573
      ENDIF                                                             REBUS    1574
      IF(I.LT.IFNBUS) GOTO 4660                                         REBUS    1575
C                                                                       REBUS    1576
      ENDIF                                                             REBUS    1577
C                                                                       REBUS    1578
C                                                                       REBUS    1579
C  NLFBUS=TOTAL NO. OF IN SERVICE BUSES                                 REBUS    1580
C                                                                       REBUS    1581
      IPNODX=IPNODE+1                                                   REBUS    1582
      ICNODX=ICNODE+1                                                   REBUS    1583
      IMNODX=IMNODE+1                                                   REBUS    1584
      ITNODX=ITNODE+1                                                   REBUS    1585
      ISVNOX=ISVNOE+1                                                   REBUS    1586
      ITCNOX=ITCNOE+1                                                   REBUS    1587
      IRANOX=IRANOE+1                                                   REBUS    1588
      ITPNOX=ITPNOE+1                                                   REBUS    1589
      IDBNOX=IDBNOE+1                                                   REBUS    1590
      IDCNOX=IDCNOE+1                                                   REBUS    1591
      ILNODX=ILNODE+1                                                   REBUS    1592
      IKPNOX=IKPNOD+1                                                   REBUS    1593
C                                                                       REBUS    1594
      IF(ICNODE.EQ.0) ICNODX=IPNODX                                     REBUS    1595
      IF(IMNODE.EQ.0) IMNODX=ICNODX                                     REBUS    1596
      IF(ITNODE.EQ.0) ITNODX=IMNODX                                     REBUS    1597
      IF(ISVNOE.EQ.0) ISVNOX=ITNODX                                     REBUS    1598
      IF(ITCNOE.EQ.0) ITCNOX=ISVNOX                                     REBUS    1599
      IF(IRANOE.EQ.0) IRANOX=ITCNOX                                     REBUS    1600
      IF(ITPNOE.EQ.0) ITPNOX=IRANOX                                     REBUS    1601
      IF(IDBNOE.EQ.0) IDBNOX=ITPNOX                                     REBUS    1602
      IF(IDCNOE.EQ.0) IDCNOX=IDBNOX                                     REBUS    1603
      IF(ILNODE.EQ.0) ILNODX=IDCNOX                                     REBUS    1604
      IF(IKPNOD.EQ.0) IKPNOX=ILNODX                                     REBUS    1605
      JSOUR=IKPNOX-1                                                    REBUS    1606
C                                                                       REBUS    1607
      IF(LDEB)WRITE(IUD6,7440) (I,NOLD(I),I=1,NLFBUS)                   REBUS    1608
C                                                                       REBUS    1609
      IF (IEBK.NE.0)THEN                                                REBUS    1610
      MSG(1)='REBUS: FAILED IN BUS RENUMBERING STEP'                    REBUS    1611
      CALL ASTOP(MSG(1),37)                                             REBUS    1612
      ENDIF                                                             REBUS    1613
C                                                                       REBUS    1614
       NDLOAD=LFINSH-LSTART                                             REBUS    1615
       IF(NDLOAD.GT.0)THEN                                              REBUS    1616
C                                                                       REBUS    1617
C       NUMBER OF PURE LOAD BUS AND NO. OF LOAD BUS CAN BE REDUCED      REBUS    1618
C                                                                       REBUS    1619
        NREBUS=NDLOAD-KRBUS                                             REBUS    1620
C                                                                       REBUS    1621
        NCLAST=LASTCU-NREBUS                                            REBUS    1622
C                                                                       REBUS    1623
        IF(LDEB)WRITE(IUD6,8840)NDLOAD,NREBUS,LSTART,LFINSH,NCLAST      REBUS    1624
C                                                                       REBUS    1625
C       BUS TO BE REDUCED                                               REBUS    1626
C                                                                       REBUS    1627
      IF(NREBUS.EQ.NDLOAD)THEN                                          REBUS    1628
       DO 4700 I=1, NDLOAD                                              REBUS    1629
        K=LSTART+I                                                      REBUS    1630
        NLBUS(I)=NOLD(K)                                                REBUS    1631
 4700   CONTINUE                                                        REBUS    1632
       KLBUS=NDLOAD                                                     REBUS    1633
      ELSE                                                              REBUS    1634
       KLBUS=0                                                          REBUS    1635
        DO 4780 K=LSTART+1,LFINSH                                       REBUS    1636
         KOLD=NOLD(K)                                                   REBUS    1637
        DO 4740 I=1,KRBUS                                               REBUS    1638
         IF(NNBUS(I).EQ.KOLD)GOTO 4780                                  REBUS    1639
 4740  CONTINUE                                                         REBUS    1640
         KLBUS=KLBUS+1                                                  REBUS    1641
         NLBUS(KLBUS)=KOLD                                              REBUS    1642
         IF(LDEB)WRITE(IUD6,8880)K,KOLD,NNBUS(I)                        REBUS    1643
 4780  CONTINUE                                                         REBUS    1644
      ENDIF                                                             REBUS    1645
C                                                                       REBUS    1646
      ENDIF                                                             REBUS    1647
      IF(LDEB)THEN                                                      REBUS    1648
       WRITE(IUD6,8920)KLBUS,(NLBUS(I),I=1,KLBUS)                       REBUS    1649
       WRITE(IUD6,8960)KRBUS,(NNBUS(I),NNEW(NNBUS(I)),I=1,KRBUS)        REBUS    1650
       WRITE(IUD6,8960)KRBUS,(NNEW(NNBUS(I)),I=1,KRBUS)                 REBUS    1651
      ENDIF                                                             REBUS    1652
C                                                                       REBUS    1653
      GOTO 4820                                                         REBUS    1654
C                                                                       REBUS    1655
C                                                                       REBUS    1656
C                                                                       REBUS    1657
 4820 CONTINUE                                                          REBUS    1658
C                                                                       REBUS    1659
      RETURN                                                            REBUS    1660
C                                                                       REBUS    1661
 4860          CONTINUE                                                 REBUS    1662
               NLDI=NNEW(NOLDI)                                         REBUS    1663
               IF(NLDI.GT.LSTART .AND. NLDI.LE.LFINSH)THEN              REBUS    1664
                 DO 4900 KI=1,KRBUS                                     REBUS    1665
                 IF(NOLDI.EQ.NNBUS(KI))GOTO 4940                        REBUS    1666
 4900            CONTINUE                                               REBUS    1667
                 KRBUS=KRBUS+1                                          REBUS    1668
                 NNBUS(KRBUS)=NOLDI                                     REBUS    1669
 4940            CONTINUE                                               REBUS    1670
                ENDIF                                                   REBUS    1671
                GOTO I2000                                              REBUS    1672
C                                                                       REBUS    1673
 6000 FORMAT(9(3X,'NOLD',3X,'NTHG'),/,(18I7))                           REBUS    1674
 6040 FORMAT(' *** GENERATORS ON LF BUS NO =',I5,                       REBUS    1675
     +' HAVE DUPLICATED IDENTITY')                                      REBUS    1676
 6080 FORMAT(20(1X,A2))                                                 REBUS    1677
 6120 FORMAT(1X,'GENERATORS ON LF BUS =',3A4,                           REBUS    1678
     +' HAVE DUPLICATED IDENTITY')                                      REBUS    1679
 6160 FORMAT(1X,'*** ERROR CLASSICAL MACHINE BUS#=',I5,1X,'IS ALREADY'  REBUS    1680
     +,' IN MACHINE LIST')                                              REBUS    1681
 6200 FORMAT(5X,'CHECK GENERATOR DATA')                                 REBUS    1682
 6240 FORMAT(1X,'*** ERROR CLASSICAL MACHINE BUS=',3A4,1X               REBUS    1683
     *,'IS ALREADY IN MACHINE LIST')                                    REBUS    1684
 6280 FORMAT(1X,'*** ERROR INFINITE BUS#=',I5,1X,'IS ALREADY'           REBUS    1685
     *,' IN DYNAMIC BUS LIST')                                          REBUS    1686
 6320 FORMAT(1X,'*** ERROR INFINITE BUS#=',3A4,1X,'IS ALREADY'          REBUS    1687
     *,' IN DYNAMIC BUS LIST')                                          REBUS    1688
 6360 FORMAT(5X,'CHECK DYNAMIC DATA')                                   REBUS    1689
 6400 FORMAT(1X,'*** ERROR INDUCTION MOTOR BUS ',I5                     REBUS    1690
     *,' NOT IN THE BASE LOAD FLOW')                                    REBUS    1691
 6440 FORMAT(1X,'*** ERROR INDUCTION MOTOR BUS ',3A4                    REBUS    1692
     *,' NOT IN THE BASE LOAD FLOW')                                    REBUS    1693
 6480 FORMAT(' *** ERROR SVC BUS ',I5,' NOT IN THE BASE LOAD FLOW')     REBUS    1694
 6520 FORMAT(' *** ERROR SVC BUS ',3A4,' NOT IN THE BASE LOAD FLOW')    REBUS    1695
 6560 FORMAT(1X,'*** ERROR NONLINEAR LOAD BUS ',I5                      REBUS    1696
     *,' NOT IN THE BASE LOAD FLOW')                                    REBUS    1697
 6600 FORMAT(1X,'*** ERROR NONLINEAR LOAD BUS ',3A4                     REBUS    1698
     *,' NOT IN THE BASE LOAD FLOW')                                    REBUS    1699
 6640 FORMAT(' *** ERROR NO DYNAMIC COMPONENT OR NONLINEAR ',           REBUS    1700
     +'LOAD CAN BE REPRESENTED')                                        REBUS    1701
 6680 FORMAT(5X,'AT A CONVERTER BUS: ',I5                               REBUS    1702
     *,' CHECK YOUR DC CONVERTER DATA')                                 REBUS    1703
 6720 FORMAT(5X,'AT A CONVERTER BUS:',3A4                               REBUS    1704
     *,' CHECK YOUR DC CONVERTER DATA')                                 REBUS    1705
 6740 FORMAT(5X,'THIS PROBLEM CAN BE FIXED BY SPLITTING ',              REBUS    1706
     +          'THE CONVERTER BUS AND INTRODUCING ')                   REBUS    1707
 6750 FORMAT(5X,'A LINE WITH X=0.0005.',                                REBUS    1708
     +       '  X MUST BE GREATER THAN THE ZIL THRESHOLD')              REBUS    1709
 6840 FORMAT(' *** ERROR AC BUS FOR DC SYSTEM ',I5                      REBUS    1710
     *,' IS OUT OF SERVICE IN THE BASE LOAD FLOW')                      REBUS    1711
 6880 FORMAT(' *** ERROR AC BUS FOR DC SYSTEM ',3A4)                    REBUS    1712
 6890 FORMAT('     IS OUT OF SERVICE IN THE BASE LOAD FLOW')            REBUS    1713
 6920 FORMAT(' *** ERROR AC BUS FOR DC SYSTEM ',I5                      REBUS    1714
     *,' IS NOT IN THE BASE LOAD FLOW')                                 REBUS    1715
 6960 FORMAT(' *** ERROR CONVERTER BUS ',I5,' IS NOT IN THE'            REBUS    1716
     *,' BASE LOAD FLOW')                                               REBUS    1717
 7000 FORMAT(' *** ERROR CONVERTER BUS ',3A4,' IS NOT IN THE'           REBUS    1718
     *,' BASE LOAD FLOW')                                               REBUS    1719
 7040 FORMAT(' *** ERROR SDB BUS ',I5,' IS NOT IN THE BASE LOAD FLOW')  REBUS    1720
 7080 FORMAT(' *** ERROR SDB BUS ',3A4,' IS NOT IN THE BASE LOAD FLOW') REBUS    1721
 7120 FORMAT(' *** ERROR RANI BUS ',I5,' IS NOT IN THE BASE LOAD FLOW') REBUS    1722
 7160 FORMAT(' *** ERROR RANI BUS ',3A4,' IS NOT IN THE BASE LOAD FLOW')REBUS    1723
 7200 FORMAT(' *** ERROR STP BUS ',I5,' IS NOT IN THE BASE LOAD FLOW')  REBUS    1724
 7240 FORMAT(' *** ERROR STP BUS ',3A4,' IS NOT IN THE BASE LOAD FLOW') REBUS    1725
 7280 FORMAT(' *** ERROR SVR SENSING BUS ',I5                           REBUS    1726
     *,' IS NOT IN THE BASE LOAD FLOW')                                 REBUS    1727
 7320 FORMAT(' *** ERROR SVR SENSING BUS ',I5                           REBUS    1728
     *,' IS OUT OF SERVICE IN THE BASE LOAD FLOW')                      REBUS    1729
 7360 FORMAT(' *** ERROR SVR SENSING BUS ',3A4                          REBUS    1730
     *,' IS OUT OF SERVICE IN THE BASE LOAD FLOW')                      REBUS    1731
 7400 FORMAT(' *** ERROR SVR SENSING BUS ',3A4                          REBUS    1732
     *,' IS NOT IN THE BASE LOAD FLOW')                                 REBUS    1733
 7440 FORMAT(2X,'I NOLD(I) IN BCHECK',(/,2X,24I5))                      REBUS    1734
 7480 FORMAT(1X,'ROUTINE REBUS TOTAL NUMBER OF BUSES FROM LOADFLOW'     REBUS    1735
     *,' =',I6)                                                         REBUS    1736
 7520 FORMAT(1X,'*** ERROR CONSTANT MVA LOAD BUS',3A4                   REBUS    1737
     *,' NOT IN BASED LOADFLOW')                                        REBUS    1738
 7560 FORMAT(1X,'*** ERROR REG SENSING BUS ',I5                         REBUS    1739
     *,' NOT IN BASE LOADFLOW')                                         REBUS    1740
 7600 FORMAT(1X,'*** ERROR REG SENSING BUS ',I5                         REBUS    1741
     *,' OUT OF SERVICE IN BASE LOADFLOW')                              REBUS    1742
 7640 FORMAT(1X,'*** ERROR REG SENSING BUS ',3A4                        REBUS    1743
     *,' OUT OF SERVICE IN BASE LOADFLOW')                              REBUS    1744
 7680 FORMAT(1X,'*** ERROR REG SENSING BUS ',3A4                        REBUS    1745
     *,' NOT IN BASE LOADFLOW')                                         REBUS    1746
 7720 FORMAT(1X,'*** ERROR STABILIZER SENSING BUS ',I5                  REBUS    1747
     *,' NOT IN BASE LOADFLOW')                                         REBUS    1748
 7760 FORMAT(1X,'*** ERROR STABILIZER SENSING BUS ',I5                  REBUS    1749
     *,' OUT OF SERVICE IN BASE LOADFLOW')                              REBUS    1750
 7800 FORMAT(1X,'*** ERROR STABILIZER SENSING BUS ',3A4                 REBUS    1751
     *,' OUT OF SERVICE IN BASE LOADFLOW')                              REBUS    1752
 7840 FORMAT(' *** ERROR STABILIZER SENSING BUS ',3A4                   REBUS    1753
     *,' NOT IN BASE LOADFLOW')                                         REBUS    1754
 7880 FORMAT(' *** ERROR UD EXC/PSS/UEL REMOTE BUS ',I5                 REBUS    1755
     *,' OUT OF SERVICE IN BASE LOADFLOW')                              REBUS    1756
 7920 FORMAT(' *** ERROR UD EXC/PSS/UEL REMOTE BUS ',3A4                REBUS    1757
     *,' OUT OF SERVICE IN BASE LOADFLOW')                              REBUS    1758
 7960 FORMAT(' *** ERROR UD EXC/PSS/UEL REMOTE BUS ',I5                 REBUS    1759
     *,' NOT IN BASE LOADFLOW')                                         REBUS    1760
 8000 FORMAT(' *** ERROR UD EXC/PSS/UEL REMOTE BUS ',3A4                REBUS    1761
     *,' NOT IN BASE LOADFLOW')                                         REBUS    1762
 8040 FORMAT(' *** ERROR UD SVC REMOTE BUS ',I5                         REBUS    1763
     *,' NOT IN BASE LOADFLOW')                                         REBUS    1764
 8080 FORMAT(' *** ERROR UD SVC REMOTE BUS ',3A4                        REBUS    1765
     *,' NOT IN BASE LOADFLOW')                                         REBUS    1766
 8120 FORMAT(' *** ERROR UD RANI REMOTE BUS ',I5                        REBUS    1767
     *,' NOT IN BASE LOADFLOW')                                         REBUS    1768
 8160 FORMAT(' *** ERROR UD RANI REMOTE BUS ',3A4                       REBUS    1769
     *,' NOT IN BASE LOADFLOW')                                         REBUS    1770
 8200 FORMAT(' *** ERROR UD STC REMOTE BUS ',I5                         REBUS    1771
     *,' NOT IN BASE LOADFLOW')                                         REBUS    1772
 8240 FORMAT(' *** ERROR UD STC REMOTE BUS ',3A4                        REBUS    1773
     *,' NOT IN BASE LOADFLOW')                                         REBUS    1774
 8280 FORMAT(' *** ERROR UD SPS REMOTE BUS ',I5                         REBUS    1775
     *,' NOT IN BASE LOADFLOW')                                         REBUS    1776
 8320 FORMAT(' *** ERROR UD SPS REMOTE BUS ',3A4                        REBUS    1777
     *,' NOT IN BASE LOADFLOW')                                         REBUS    1778
 8360 FORMAT(' *** ERROR UD SDB REMOTE BUS ',I5                         REBUS    1779
     *,' NOT IN BASE LOADFLOW')                                         REBUS    1780
 8400 FORMAT(' *** ERROR UD SDB REMOTE BUS ',3A4                        REBUS    1781
     *,' NOT IN BASE LOADFLOW')                                         REBUS    1782
 8440 FORMAT(' *** ERROR UD GOV REMOTE BUS ',I5                         REBUS    1783
     *,' NOT IN BASE LOADFLOW')                                         REBUS    1784
 8480 FORMAT(' *** ERROR UD GOV REMOTE BUS ',I5                         REBUS    1785
     *,' OUT OF SERVICE IN BASE LOADFLOW')                              REBUS    1786
 8520 FORMAT(' *** ERROR UD GOV REMOTE BUS ',3A4                        REBUS    1787
     *,' OUT OF SERVICE IN BASE LOADFLOW')                              REBUS    1788
 8560 FORMAT(' *** ERROR UD GOV REMOTE BUS ',3A4                        REBUS    1789
     *,' NOT IN BASE LOADFLOW')                                         REBUS    1790
 8600 FORMAT(' LASTCU: ',I10)                                           REBUS    1791
 8640 FORMAT(' *** ERROR: ULTC BUS ',I5,' NOT IN ',                     REBUS    1792
     *'BASE LOADFLOW')                                                  REBUS    1793
 8680 FORMAT(' *** ERROR: ULTC BUS ',3A4,' NOT IN ',                    REBUS    1794
     *'BASE LOADFLOW')                                                  REBUS    1795
 8720 FORMAT(' *** ERROR: RELAY BUS ',I5,' OUT OF SERVICE IN ',         REBUS    1796
     *'BASE LOADFLOW')                                                  REBUS    1797
 8760 FORMAT(' *** ERROR: RELAY BUS ',3A4,' OUT OF SERVICE IN ',        REBUS    1798
     *'BASE LOADFLOW')                                                  REBUS    1799
 8800 FORMAT(' *** ERROR: RELAY BUS ',I5,' NOT IN ',                    REBUS    1800
     *'BASE LOADFLOW')                                                  REBUS    1801
 8840 FORMAT('  IN REBUS: NO. OF PURE LOAD BUS AND NO. BUS CAN BE '     REBUS    1802
     *  ,'REDUCED ',5I10)                                               REBUS    1803
 8880 FORMAT(' K, KOLD, NNBUS ',3I10)                                   REBUS    1804
 8920 FORMAT(' IN REBUS REDUCED BUS: KLBUS,NLBUS(I) ',8I10)             REBUS    1805
 8960 FORMAT(' IN REBUS RETAINED BUS: KRBUS,NNBUS(I) ',8I10)            REBUS    1806
 9000 FORMAT(' *** ERROR DUPLICATED SVC AT BUS',I5)                     REBUS    1807
 9040 FORMAT(' *** ERROR DUPLICATED SVC AT BUS',3A4)                    REBUS    1808
 9080 FORMAT(' *** ERROR THE NUMBER OF CURRENT INJECTION BUS')          REBUS    1809
 9120 FORMAT(5X,'EXCEEDS THE DIMENSION OF ',I6)                         REBUS    1810
 9160 FORMAT(' *** ERROR TSC LOAD BUS',I5                               REBUS    1811
     *,' NOT IN BASED LOADFLOW')                                        REBUS    1812
 9200 FORMAT(' *** ERROR TSC LOAD BUS',3A4                              REBUS    1813
     *,' NOT IN BASED LOADFLOW')                                        REBUS    1814
C                                                                       REBUS    1815
      END                                                               REBUS    1816
