CFPRIME USLINE                                                          USLINE      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  USLINE (V1, V2, NUM, XILINE, XICAP)                   USLINE      3
CD -------------------------------------------------------------------  USLINE      4
CD                                                                      USLINE      5
CD              *****     USLINE  ROUTINE   *****                       USLINE      6
CD                                                                      USLINE      7
CD -------------------------------------------------------------------  USLINE      8
CD                                                                      USLINE      9
CD       PURPOSE:  Calculates line currents for dc lines.               USLINE     10
CD                                                                      USLINE     11
CD                                                                      USLINE     12
CD       DEFINITION OF LOCAL VARIABLES:                                 USLINE     13
CD          (P)    XILINE  -  line current.                             USLINE     14
CD          (P)    NUM     -  line position number.                     USLINE     15
CD                 JPOSN   -  storage position for dc information.      USLINE     16
CD          (P)    V1      -  voltage at bus 1 of line.                 USLINE     17
CD          (P)    V2      -  voltage at bus 2 of line.                 USLINE     18
CD                                                                      USLINE     19
CD -------------------------------------------------------------------  USLINE     20
      INCLUDE 'PARX.INS'                                                USLINE     21
      INCLUDE 'GRDC01.INS'                                              USLINE     22
      INCLUDE 'UDCJ.INS'                                                USLINE     23
C                                                                       USLINE     24
C---------------------------------------------------------------------  USLINE     25
C                                                                       USLINE     26
C     Calculate current .                                               USLINE     27
C                                                                       USLINE     28
      JPOSN = NUM                                                       USLINE     29
      IF(JPOSN .LT. 0) JPOSN = -JPOSN                                   USLINE     30
      XICAP = 0.0                                                       USLINE     31
C                                                                       USLINE     32
C                                                                       USLINE     33
      IF(LINTYP(JPOSN).EQ.'R')THEN                                      USLINE     34
         XILINE = (V1 - V2) / RDCOHM(JPOSN)                             USLINE     35
C                                                                       USLINE     36
C                                                                       USLINE     37
C                                                                       USLINE     38
      ELSEIF(LINTYP(JPOSN).EQ.'RL')THEN                                 USLINE     39
         IF(NUM .GT. 0)THEN                                             USLINE     40
            XILINE = XJ1(JPOSN) + (V1 - V2) / REQ(JPOSN)                USLINE     41
         ELSE                                                           USLINE     42
            XILINE = (V1 - V2) / REQ(JPOSN) - XJ1(JPOSN)                USLINE     43
         END IF                                                         USLINE     44
C                                                                       USLINE     45
C                                                                       USLINE     46
C                                                                       USLINE     47
      ELSEIF(LINTYP(JPOSN).EQ.'RLC')THEN                                USLINE     48
         IF(NUM .GT. 0)THEN                                             USLINE     49
            XILINE = XJ1(JPOSN) - XJ2(JPOSN) + V1 * REQ2(JPOSN)         USLINE     50
     1              + (V1 - V2) / REQ(JPOSN)                            USLINE     51
            XICAP = V1 * REQ2(JPOSN) - XJ2(JPOSN)                       USLINE     52
         ELSE                                                           USLINE     53
            XILINE = V1 * REQ3(JPOSN) + (V1 - V2) / REQ(JPOSN)          USLINE     54
     1              - XJ1(JPOSN) - XJ3(JPOSN)                           USLINE     55
            XICAP = V1 * REQ3(JPOSN) - XJ3(JPOSN)                       USLINE     56
         END IF                                                         USLINE     57
      END IF                                                            USLINE     58
C                                                                       USLINE     59
C---------------------------------------------------------------------  USLINE     60
C                                                                       USLINE     61
      RETURN                                                            USLINE     62
C                                                                       USLINE     63
C---------------------------------------------------------------------  USLINE     64
C                                                                       USLINE     65
      END                                                               USLINE     66
