CFPRIME GNETWK                                                          GNETWK      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  GNETWK                                                GNETWK      3
CD -------------------------------------------------------------------  GNETWK      4
CD                                                                      GNETWK      5
CD              *****     GNETWK  ROUTINE   *****                       GNETWK      6
CD                                                                      GNETWK      7
CD -------------------------------------------------------------------  GNETWK      8
CD                                                                      GNETWK      9
CD       PURPOSE:  To add the network related parts of the G matrix.    GNETWK     10
CD                                                                      GNETWK     11
CD                                                                      GNETWK     12
CD       DEFINITION OF LOCAL VARIABLES:                                 GNETWK     13
CD                 I      - 'do' loop index.                            GNETWK     14
CD                 NONE   -  line has no resistance, inductance, or     GNETWK     15
CD                           conductance.                               GNETWK     16
CD                 JPOSN   -  storage position for dc information.      GNETWK     17
CD                 R      -  line has resistance.                       GNETWK     18
CD                 RL     -  line has resistance and inductance.        GNETWK     19
CD                 RLCD   -  line has resistance, inductance, and       GNETWK     20
CD                           conductance.                               GNETWK     21
CD                                                                      GNETWK     22
CD -------------------------------------------------------------------  GNETWK     23
      INCLUDE 'PARX.INS'                                                GNETWK     24
      INCLUDE 'GRDC01.INS'                                              GNETWK     25
      INCLUDE 'UDCJ.INS'                                                GNETWK     26
C                                                                       GNETWK     27
      CHARACTER*3   NONE, R, RL, RLC                                    GNETWK     28
C                                                                       GNETWK     29
      DATA          NONE  / ' ' /,     R  / 'R' /,     RL  /'RL' /,     GNETWK     30
     1              RLC   /'RLC'/                                       GNETWK     31
C                                                                       GNETWK     32
C---------------------------------------------------------------------  GNETWK     33
C                                                                       GNETWK     34
C     For all dc lines, determine if they have resistance, capacitance, GNETWK     35
C     and inductance defined.                                           GNETWK     36
C                                                                       GNETWK     37
      DO 20 I = 1, ILDC                                                 GNETWK     38
C                                                                       GNETWK     39
         IF(IDCL(I) .NE. 0)THEN                                         GNETWK     40
C                                                                       GNETWK     41
            JPOSN = IDCL(I)                                             GNETWK     42
C                                                                       GNETWK     43
C           Determine the properties of the dc line.                    GNETWK     44
C                                                                       GNETWK     45
            IF(ABS(RDCOHM(JPOSN)).GT.0.0.AND.                           GNETWK     46
     *         ABS(XLDC(JPOSN)).LE.0.0.AND.                             GNETWK     47
     *         ABS(CDCA(JPOSN)).LE.0.0.AND.                             GNETWK     48
     *         ABS(CDCB(JPOSN)).LE.0.0)THEN                             GNETWK     49
C                                                                       GNETWK     50
C              DC line has resistance, but no inductance or             GNETWK     51
C              capacitance.                                             GNETWK     52
C                                                                       GNETWK     53
               LINTYP(JPOSN) = R                                        GNETWK     54
               CALL GTYR (JPOSN)                                        GNETWK     55
C                                                                       GNETWK     56
            ELSEIF(ABS(RDCOHM(JPOSN)).GT.0.0.AND.                       GNETWK     57
     *             ABS(XLDC(JPOSN)).GT.0.0.AND.                         GNETWK     58
     *             ABS(CDCA(JPOSN)).LE.0.0.AND.                         GNETWK     59
     *             ABS(CDCB(JPOSN)).LE.0.0)THEN                         GNETWK     60
C                                                                       GNETWK     61
C              DC line has resistance and inductance, but no            GNETWK     62
C              capacitance.                                             GNETWK     63
C                                                                       GNETWK     64
               LINTYP(JPOSN) = RL                                       GNETWK     65
               CALL GTYRL (JPOSN)                                       GNETWK     66
C                                                                       GNETWK     67
            ELSEIF(ABS(RDCOHM(JPOSN)).GT.0.0.AND.                       GNETWK     68
     *             ABS(XLDC(JPOSN)).GT.0.0.AND.                         GNETWK     69
     *             (ABS(CDCA(JPOSN)).GT.0.0.OR.                         GNETWK     70
     *             ABS(CDCB(JPOSN)).GT.0.0))THEN                        GNETWK     71
C                                                                       GNETWK     72
C              DC line has resistance, inductance and capacitance.      GNETWK     73
C                                                                       GNETWK     74
               LINTYP(JPOSN) = RLC                                      GNETWK     75
               CALL GTYRLC (JPOSN)                                      GNETWK     76
C                                                                       GNETWK     77
            ELSE                                                        GNETWK     78
C                                                                       GNETWK     79
               LINTYP(JPOSN) = NONE                                     GNETWK     80
C                                                                       GNETWK     81
            END IF                                                      GNETWK     82
C                                                                       GNETWK     83
         END IF                                                         GNETWK     84
C                                                                       GNETWK     85
20    CONTINUE                                                          GNETWK     86
C                                                                       GNETWK     87
C---------------------------------------------------------------------  GNETWK     88
C                                                                       GNETWK     89
      RETURN                                                            GNETWK     90
C                                                                       GNETWK     91
C---------------------------------------------------------------------  GNETWK     92
C                                                                       GNETWK     93
      END                                                               GNETWK     94
