CFPRIME SYMRED                                                          SYMRED      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 SYMRED(IOFSET,ISTATE)                                  SYMRED      3
CD                                                                      SYMRED      4
CD    TO PERFORM ORDERING FOR THE JACOBIAN MATRIX OF                    SYMRED      5
CD    DETAILED MACHINES                                                 SYMRED      6
CD                                                                      SYMRED      7
      INCLUDE 'PARX.INS'                                                SYMRED      8
      INCLUDE 'CNABAK.INS'                                              SYMRED      9
      INCLUDE 'CNJCOB.INS'                                              SYMRED     10
C                                                                       SYMRED     11
      REAL WM1(NSID,NSID)                                               SYMRED     12
      INTEGER JA(NSID,NSID),IWV1(NSID)                                  SYMRED     13
C                                                                       SYMRED     14
      IF (KORDJB.NE.0) GOTO 200                                         SYMRED     15
C                                                                       SYMRED     16
C     PERFORM ORDERING                                                  SYMRED     17
C                                                                       SYMRED     18
      DO 100 I=1,ISTATE                                                 SYMRED     19
         IWV1(I)=0                                                      SYMRED     20
         DO 105 J=1,ISTATE                                              SYMRED     21
            JA(I,J)=IA(I,J)                                             SYMRED     22
  105    CONTINUE                                                       SYMRED     23
  100 CONTINUE                                                          SYMRED     24
C                                                                       SYMRED     25
      DO 110 L=1,ISTATE                                                 SYMRED     26
C                                                                       SYMRED     27
         MINZER=9999                                                    SYMRED     28
         NCOL=0                                                         SYMRED     29
C                                                                       SYMRED     30
         DO 120 N=1,ISTATE                                              SYMRED     31
C                                                                       SYMRED     32
            DO 130 M=1,L-1                                              SYMRED     33
               IF (IWV1(M).EQ.N) GOTO 120                               SYMRED     34
  130       CONTINUE                                                    SYMRED     35
C                                                                       SYMRED     36
            NONZER=0                                                    SYMRED     37
C                                                                       SYMRED     38
            DO 140 I=1,ISTATE                                           SYMRED     39
               IF (JA(I,N).EQ.0.OR.I.EQ.N) GOTO 140                     SYMRED     40
               DO 150 J=1,ISTATE                                        SYMRED     41
                  IF (JA(N,J).NE.0.AND.JA(I,J).EQ.0) NONZER=NONZER+1    SYMRED     42
  150          CONTINUE                                                 SYMRED     43
  140       CONTINUE                                                    SYMRED     44
C                                                                       SYMRED     45
            IF (NONZER.LT.MINZER) THEN                                  SYMRED     46
               MINZER=NONZER                                            SYMRED     47
               NCOL=N                                                   SYMRED     48
            END IF                                                      SYMRED     49
C                                                                       SYMRED     50
  120    CONTINUE                                                       SYMRED     51
C                                                                       SYMRED     52
         IWV1(L)=NCOL                                                   SYMRED     53
C                                                                       SYMRED     54
         DO 160 I=1,ISTATE                                              SYMRED     55
            IF (JA(I,NCOL).EQ.0.OR.I.EQ.NCOL) GOTO 160                  SYMRED     56
            DO 170 J=1,ISTATE                                           SYMRED     57
               IF (JA(NCOL,J).NE.0.AND.JA(I,J).EQ.0) JA(I,J)=1          SYMRED     58
  170       CONTINUE                                                    SYMRED     59
            JA(I,NCOL)=0                                                SYMRED     60
  160    CONTINUE                                                       SYMRED     61
         DO 180 J=1,ISTATE                                              SYMRED     62
            JA(NCOL,J)=0                                                SYMRED     63
  180    CONTINUE                                                       SYMRED     64
         JA(NCOL,NCOL)=1                                                SYMRED     65
C                                                                       SYMRED     66
  110 CONTINUE                                                          SYMRED     67
C                                                                       SYMRED     68
      DO 190 I=1,ISTATE                                                 SYMRED     69
         JCBPEM(IOFSET+I)=IWV1(I)                                       SYMRED     70
  190 CONTINUE                                                          SYMRED     71
C                                                                       SYMRED     72
  200 CONTINUE                                                          SYMRED     73
C                                                                       SYMRED     74
C     RE-ORGANIZE THE MATRIX IN TERMS OF THE NEW ORDERING               SYMRED     75
C                                                                       SYMRED     76
      DO 210 I=1,ISTATE                                                 SYMRED     77
         IWS1=IOFSET+I                                                  SYMRED     78
         DO 220 J=1,ISTATE                                              SYMRED     79
            WM1(I,J)=A(JCBPEM(IWS1),JCBPEM(IOFSET+J))                   SYMRED     80
  220    CONTINUE                                                       SYMRED     81
  210 CONTINUE                                                          SYMRED     82
C                                                                       SYMRED     83
      DO 230 I=1,ISTATE                                                 SYMRED     84
         DO 240 J=1,ISTATE                                              SYMRED     85
            A(I,J)=WM1(I,J)                                             SYMRED     86
  240    CONTINUE                                                       SYMRED     87
  230 CONTINUE                                                          SYMRED     88
C                                                                       SYMRED     89
      RETURN                                                            SYMRED     90
      END                                                               SYMRED     91
