CFPRIME SNODEV                                                          SNODEV      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  SNODEV (JSLNVE)                                       SNODEV      3
CD--------------------------------------------------------------------- SNODEV      4
CD                                                                      SNODEV      5
CD               *****     SNODEV  ROUTINE   *****                      SNODEV      6
CD                                                                      SNODEV      7
CD--------------------------------------------------------------------- SNODEV      8
CD                                                                      SNODEV      9
CD        PURPOSE:  Solves for the reduced voltage vector, VDPRIM.      SNODEV     10
CD                  Then reconstructs the full node voltage vector,     SNODEV     11
CD                  VDCNOD.                                             SNODEV     12
CD                                                                      SNODEV     13
CD                                                                      SNODEV     14
CD        DEFINITION OF LOCAL VARIABLES:                                SNODEV     15
CD                  I      -  first converter bus.                      SNODEV     16
CD                  J      -  second converter bus.                     SNODEV     17
CD                  JOB    -  the transpose of the matrix is not done.  SNODEV     18
CD                  K      - 'do' loop index.                           SNODEV     19
CD                  JPOSN   -  storage position for dc information.     SNODEV     20
CD           (P)    JSLNVE -  pointer to storage of bus voltage         SNODEV     21
CD                            solution data.                            SNODEV     22
CD                                                                      SNODEV     23
CD                                                                      SNODEV     24
CD        SUBROUTINES REQUIRED:  DGESL1                                 SNODEV     25
CD                                                                      SNODEV     26
CD--------------------------------------------------------------------- SNODEV     27
      INCLUDE 'PARX.INS'                                                SNODEV     28
      INCLUDE 'GRDC01.INS'                                              SNODEV     29
      INCLUDE 'GRDC03.INS'                                              SNODEV     30
      INCLUDE 'UDCA.INS'                                                SNODEV     31
      INCLUDE 'UDCJ.INS'                                                SNODEV     32
C                                                                       SNODEV     33
      DIMENSION    JSLNVE(NDCN)                                         SNODEV     34
C                                                                       SNODEV     35
C---------------------------------------------------------------------  SNODEV     36
C                                                                       SNODEV     37
      JOB = 0                                                           SNODEV     38
C                                                                       SNODEV     39
      IF(ISIZEG .GT. 0)THEN                                             SNODEV     40
C                                                                       SNODEV     41
         CALL DGESL2 (GMATRX, NDCN, ISIZEG, JSLNVE, XINJVE, JOB)        SNODEV     42
C                                                                       SNODEV     43
C                                                                       SNODEV     44
C        Re-construct the node voltage vector.                          SNODEV     45
C                                                                       SNODEV     46
         DO 20 K = 1, NUMNOD                                            SNODEV     47
            IF(NXFIND(K) .LE. ISIZEV)THEN                               SNODEV     48
               VDCNOD(K) = XINJVE(NXFIND(K))                            SNODEV     49
            END IF                                                      SNODEV     50
20       CONTINUE                                                       SNODEV     51
C                                                                       SNODEV     52
      ELSE                                                              SNODEV     53
C                                                                       SNODEV     54
         DO 40 K = 1, NUMNOD                                            SNODEV     55
            VDCNOD(K) = 0.0                                             SNODEV     56
40       CONTINUE                                                       SNODEV     57
C                                                                       SNODEV     58
      END IF                                                            SNODEV     59
C                                                                       SNODEV     60
C                                                                       SNODEV     61
C     Add voltages for the nodes that were deleted.                     SNODEV     62
C                                                                       SNODEV     63
      DO 60 K = 1, ICDC                                                 SNODEV     64
C                                                                       SNODEV     65
         IF(IDC(K) .NE. 0)THEN                                          SNODEV     66
            JPOSN = IDC(K)                                              SNODEV     67
C                                                                       SNODEV     68
            IF(UMODE(JPOSN).EQ.'VOLTAGE') THEN                          SNODEV     69
               IF(UMOD2(JPOSN).EQ.'BYPASS' .OR.                         SNODEV     70
     1            UMOD2(JPOSN).EQ.'COMFAIL') THEN                       SNODEV     71
                  I = ICONRE(JPOSN,1)                                   SNODEV     72
                  J = ICONRE(JPOSN,2)                                   SNODEV     73
C                                                                       SNODEV     74
                  IF(I .NE. 0.AND.J .NE. 0)THEN                         SNODEV     75
                     VDCNOD(J) = VDCNOD(I) - USETP2(JPOSN)              SNODEV     76
                  ELSEIF(I.EQ.0)THEN                                    SNODEV     77
                     VDCNOD(J) = - USETP2(JPOSN)                        SNODEV     78
                  ELSE                                                  SNODEV     79
                     VDCNOD(I) = USETP2(JPOSN)                          SNODEV     80
                  END IF                                                SNODEV     81
               ELSEIF(UMOD2(JPOSN).EQ.'ALPHA' .OR.                      SNODEV     82
     1            UMOD2(JPOSN).EQ.'GAMMA' .OR.                          SNODEV     83
     2            UMOD2(JPOSN).EQ.'NONE') THEN                          SNODEV     84
                  I = ICONRE(JPOSN,1)                                   SNODEV     85
                  J = ICONRE(JPOSN,2)                                   SNODEV     86
C                                                                       SNODEV     87
                  IF(I .NE. 0.AND.J .NE. 0)THEN                         SNODEV     88
                     VDCNOD(J) = VDCNOD(I) - USETPT(JPOSN)              SNODEV     89
                  ELSEIF(I.EQ.0)THEN                                    SNODEV     90
                     VDCNOD(J) = - USETPT(JPOSN)                        SNODEV     91
                  ELSE                                                  SNODEV     92
                     VDCNOD(I) = USETPT(JPOSN)                          SNODEV     93
                  END IF                                                SNODEV     94
               ENDIF                                                    SNODEV     95
            ELSEIF(UMODE(JPOSN).EQ.'BYPASS' .OR.                        SNODEV     96
     1         UMODE(JPOSN).EQ.'COMFAIL') THEN                          SNODEV     97
               I = ICONRE(JPOSN,1)                                      SNODEV     98
               J = ICONRE(JPOSN,2)                                      SNODEV     99
C                                                                       SNODEV    100
               IF(I .NE. 0.AND.J .NE. 0)THEN                            SNODEV    101
                  VDCNOD(J) = VDCNOD(I) - USETPT(JPOSN)                 SNODEV    102
               ELSEIF(I.EQ.0)THEN                                       SNODEV    103
                  VDCNOD(J) = - USETPT(JPOSN)                           SNODEV    104
               ELSE                                                     SNODEV    105
                  VDCNOD(I) = USETPT(JPOSN)                             SNODEV    106
               END IF                                                   SNODEV    107
            ELSEIF(UMODE(JPOSN).EQ.'ALPHA' .OR.                         SNODEV    108
     1         UMODE(JPOSN).EQ.'GAMMA') THEN                            SNODEV    109
               IF(UMOD2(JPOSN).EQ.'VOLTAGE' .OR.                        SNODEV    110
     1            UMOD2(JPOSN).EQ.'BYPASS' .OR.                         SNODEV    111
     2            UMOD2(JPOSN).EQ.'COMFAIL') THEN                       SNODEV    112
                  I = ICONRE(JPOSN,1)                                   SNODEV    113
                  J = ICONRE(JPOSN,2)                                   SNODEV    114
C                                                                       SNODEV    115
                  IF(I .NE. 0.AND.J .NE. 0)THEN                         SNODEV    116
                     VDCNOD(J) = VDCNOD(I) - USETP2(JPOSN)              SNODEV    117
                  ELSEIF(I.EQ.0)THEN                                    SNODEV    118
                     VDCNOD(J) = - USETP2(JPOSN)                        SNODEV    119
                  ELSE                                                  SNODEV    120
                     VDCNOD(I) = USETP2(JPOSN)                          SNODEV    121
                  END IF                                                SNODEV    122
               ENDIF                                                    SNODEV    123
            ELSEIF(UMODE(JPOSN).EQ.'CURRENT') THEN                      SNODEV    124
               IF(UMOD2(JPOSN).EQ.'BYPASS' .OR.                         SNODEV    125
     2            UMOD2(JPOSN).EQ.'COMFAIL') THEN                       SNODEV    126
                  I = ICONRE(JPOSN,1)                                   SNODEV    127
                  J = ICONRE(JPOSN,2)                                   SNODEV    128
C                                                                       SNODEV    129
                  IF(I .NE. 0.AND.J .NE. 0)THEN                         SNODEV    130
                     VDCNOD(J) = VDCNOD(I) - USETP2(JPOSN)              SNODEV    131
                  ELSEIF(I.EQ.0)THEN                                    SNODEV    132
                     VDCNOD(J) = - USETP2(JPOSN)                        SNODEV    133
                  ELSE                                                  SNODEV    134
                     VDCNOD(I) = USETP2(JPOSN)                          SNODEV    135
                  END IF                                                SNODEV    136
               ENDIF                                                    SNODEV    137
C                                                                       SNODEV    138
            END IF                                                      SNODEV    139
C                                                                       SNODEV    140
         END IF                                                         SNODEV    141
C                                                                       SNODEV    142
60    CONTINUE                                                          SNODEV    143
C                                                                       SNODEV    144
C     Add voltage for closed or opening breakers.                       SNODEV    145
C                                                                       SNODEV    146
      DO 80 K=1,IBDC                                                    SNODEV    147
         IF(IDCB(K).NE.0) THEN                                          SNODEV    148
            JPOSN = IDCB(K)                                             SNODEV    149
            IF(IBSTAT(JPOSN).EQ.ICLOSE.OR.IBSTAT(JPOSN).EQ.IOPENG)THEN  SNODEV    150
               I = IBRKRE(JPOSN,1)                                      SNODEV    151
               J = IBRKRE(JPOSN,2)                                      SNODEV    152
               IF(I .NE. 0.AND.J .NE. 0)THEN                            SNODEV    153
                  VDCNOD(J) = VDCNOD(I) - UDVAL(IUBBRE(JPOSN))          SNODEV    154
               ELSEIF(I.EQ.0)THEN                                       SNODEV    155
                  VDCNOD(J) = - UDVAL(IUBBRE(JPOSN))                    SNODEV    156
               ELSE                                                     SNODEV    157
                  VDCNOD(I) = UDVAL(IUBBRE(JPOSN))                      SNODEV    158
               END IF                                                   SNODEV    159
            END IF                                                      SNODEV    160
         END IF                                                         SNODEV    161
80    CONTINUE                                                          SNODEV    162
C                                                                       SNODEV    163
C---------------------------------------------------------------------  SNODEV    164
C                                                                       SNODEV    165
      RETURN                                                            SNODEV    166
C                                                                       SNODEV    167
C---------------------------------------------------------------------  SNODEV    168
C                                                                       SNODEV    169
      END                                                               SNODEV    170
