CFPRIME ZILCHG                                                          ZILCHG      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 ZILCHG                                                 ZILCHG      3
CD                                                                      ZILCHG      4
CD    TO PERFORM ZERO IMPEDANCE LINE SWITCHING.                         ZILCHG      5
CD                                                                      ZILCHG      6
      INCLUDE 'PARX.INS'                                                ZILCHG      7
      INCLUDE 'CNPT.INS'                                                ZILCHG      8
      INCLUDE 'CNMASK.INS'                                              ZILCHG      9
      INCLUDE 'CNUNIT.INS'                                              ZILCHG     10
      INCLUDE 'CNFLAG.INS'                                              ZILCHG     11
      INCLUDE 'CNMSG.INS'                                               ZILCHG     12
CD                                                                      ZILCHG     13
CD    NOTE:                                                             ZILCHG     14
CD                                                                      ZILCHG     15
CD    SET UP THE MASKED BUS TABLE "MSK", "MSKNEW" & "MSKOLD"            ZILCHG     16
CD                                                                      ZILCHG     17
C                                                                       ZILCHG     18
      LDEB=(JDEB(299).NE.0)                                             ZILCHG     19
      NBACTL=NLFBUS                                                     ZILCHG     20
      NELB=0                                                            ZILCHG     21
      IF (NZLINE.EQ.0) THEN                                             ZILCHG     22
         DO 280 I=1,NLFBUS                                              ZILCHG     23
         MSK(I)=I                                                       ZILCHG     24
  280    CONTINUE                                                       ZILCHG     25
      ELSE                                                              ZILCHG     26
C                                                                       ZILCHG     27
C==                                                                     ZILCHG     28
         IF (LDEB) THEN                                                 ZILCHG     29
         WRITE(IUD6,741) NZLINE                                         ZILCHG     30
  741    FORMAT(//,1X,'DB-ZILCHG: NZLINE = ',I5)                        ZILCHG     31
         DO 780 I=1,NZLINE                                              ZILCHG     32
         WRITE(IUD6,742)I, NZFROM(I),NZTO(I),NZLPO(I),NZSWIT(I)         ZILCHG     33
  742    FORMAT('I NZFROM NZTO NZLPO NZSWIT : ',6I8)                    ZILCHG     34
  780    CONTINUE                                                       ZILCHG     35
         ENDIF                                                          ZILCHG     36
C==                                                                     ZILCHG     37
         DO 300 I=1,NLFBUS                                              ZILCHG     38
         KK=I                                                           ZILCHG     39
  290    KK0=IMSK(KK)                                                   ZILCHG     40
         IF (KK0.EQ.0.OR.KK0.GT.NLFBUS) THEN                            ZILCHG     41
            WRITE(MSG(1),1910) KK                                       ZILCHG     42
            CALL PRTMSG(1)                                              ZILCHG     43
 1910       FORMAT(' *** ERROR KK=',I6)                                 ZILCHG     44
            MSG(1)='ZILCHG: MSK ENTRY IS ZERO'                          ZILCHG     45
            CALL ASTOP(MSG(1),25)                                       ZILCHG     46
         ELSE IF (KK0.GT.0) THEN                                        ZILCHG     47
            IF (KK0.NE.I) THEN                                          ZILCHG     48
               NELB=NELB+1                                              ZILCHG     49
               MSKOLD(NELB)=I                                           ZILCHG     50
               MSKNEW(NELB)=KK0                                         ZILCHG     51
            ENDIF                                                       ZILCHG     52
            MSK(I)=KK0                                                  ZILCHG     53
            GOTO 300                                                    ZILCHG     54
         ELSE                                                           ZILCHG     55
            KK=-KK0                                                     ZILCHG     56
            GOTO 290                                                    ZILCHG     57
         ENDIF                                                          ZILCHG     58
  300    CONTINUE                                                       ZILCHG     59
      ENDIF                                                             ZILCHG     60
C==                                                                     ZILCHG     61
        IF (LDEB) WRITE(IUD6,712)(MSK(I),I=1,NLFBUS)                    ZILCHG     62
  712   FORMAT(1X,'DB-ZILCHG: MSK1-NLFBUS ',/,5X,20I6)                  ZILCHG     63
C==                                                                     ZILCHG     64
C                                                                       ZILCHG     65
      IF (NELB.NE.0) THEN                                               ZILCHG     66
      DO 320 I=1,NELB                                                   ZILCHG     67
      K=I                                                               ZILCHG     68
      MIN=MSKNEW(I)                                                     ZILCHG     69
      I1=I+1                                                            ZILCHG     70
      DO 310 J=I1,NELB                                                  ZILCHG     71
      NEW=MSKNEW(J)                                                     ZILCHG     72
      IF (NEW.LT.MIN) THEN                                              ZILCHG     73
         MIN=NEW                                                        ZILCHG     74
         K=J                                                            ZILCHG     75
      ENDIF                                                             ZILCHG     76
  310 CONTINUE                                                          ZILCHG     77
      IF (K.NE.I) THEN                                                  ZILCHG     78
         INEW=MSKNEW(I)                                                 ZILCHG     79
         MSKNEW(I)=MSKNEW(K)                                            ZILCHG     80
         MSKNEW(K)=INEW                                                 ZILCHG     81
         IOLD=MSKOLD(I)                                                 ZILCHG     82
         MSKOLD(I)=MSKOLD(K)                                            ZILCHG     83
         MSKOLD(K)=IOLD                                                 ZILCHG     84
      ENDIF                                                             ZILCHG     85
  320 CONTINUE                                                          ZILCHG     86
      NZEP=0                                                            ZILCHG     87
      NZEB=0                                                            ZILCHG     88
      NWORK=0                                                           ZILCHG     89
      DO 330 I=1,NELB                                                   ZILCHG     90
         IF(MSKNEW(I).NE.NWORK) THEN                                    ZILCHG     91
            NWORK=MSKNEW(I)                                             ZILCHG     92
            NZEB=NZEB+1                                                 ZILCHG     93
            NZEVB(NZEB)=NWORK                                           ZILCHG     94
            NZEP=NZEP+1                                                 ZILCHG     95
            NZEVP(NZEP)=NZEB                                            ZILCHG     96
         ENDIF                                                          ZILCHG     97
         NZEB=NZEB+1                                                    ZILCHG     98
         NZEVB(NZEB)=MSKOLD(I)                                          ZILCHG     99
  330 CONTINUE                                                          ZILCHG    100
      NZEVP(NZEP+1)=NZEB+1                                              ZILCHG    101
C==                                                                     ZILCHG    102
      IF (LDEB) THEN                                                    ZILCHG    103
      WRITE(IUD6,731) NELB                                              ZILCHG    104
  731 FORMAT(1X,'DB-ZILCHG: NELB ',I6)                                  ZILCHG    105
      DO 781 I=1,NELB                                                   ZILCHG    106
      WRITE(IUD6,732)I,MSKOLD(I),MSKNEW(I)                              ZILCHG    107
  732 FORMAT(' I,MSKOLD,MSKNEW : ',3I6)                                 ZILCHG    108
 781  CONTINUE                                                          ZILCHG    109
      NZEPP1=NZEP+1                                                     ZILCHG    110
      DO 782 I=1,NZEPP1                                                 ZILCHG    111
      WRITE(IUD6,733) NZEP,I,NZEVP(I)                                   ZILCHG    112
  733 FORMAT(' NZEP,I,NZEVP : ',3I8)                                    ZILCHG    113
 782  CONTINUE                                                          ZILCHG    114
      NZEBP1=NZEB+1                                                     ZILCHG    115
      DO 788 I=1,NZEBP1                                                 ZILCHG    116
      WRITE(IUD6,734) NZEB,I,NZEVB(I)                                   ZILCHG    117
  734 FORMAT(' NZEB I NZEVB : ',3I8)                                    ZILCHG    118
 788  CONTINUE                                                          ZILCHG    119
      ENDIF                                                             ZILCHG    120
C==                                                                     ZILCHG    121
      ENDIF                                                             ZILCHG    122
C                                                                       ZILCHG    123
      RETURN                                                            ZILCHG    124
      END                                                               ZILCHG    125
