CFPRIME LOLINE                                                          LOLINE      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 LOLINE(NODEA,NODEB,CKT,KNET)                           LOLINE      3
CD                                                                      LOLINE      4
CD    GIVEN THE FROM- AND TO-BUS NUMBERS AND CIRCIUT ID, THIS ROUTINE   LOLINE      5
CD    LOCATES THE STORAGE LOCATION, KNET, OF THE LINE PARAMETERS. KNET  LOLINE      6
CD    WILL BE ZERO IF THE LINE CANNOT BE FOUND.                         LOLINE      7
CD                                                                      LOLINE      8
CD    INPUT OF THE ROUTINE ARE:                                         LOLINE      9
CD                                                                      LOLINE     10
CD    1. NODEA AND NODEB ARE THE FROM- AND TO-BUS NUMBER                LOLINE     11
CD    2. ICKT IS THE 4 BYTE CHARACTER CIRCUIT IDENTITY OF THE LINE      LOLINE     12
CD                                                                      LOLINE     13
      INCLUDE 'PARX.INS'                                                LOLINE     14
      INCLUDE 'CNFLAG.INS'                                              LOLINE     15
      INCLUDE 'CNLKN1.INS'                                              LOLINE     16
      INCLUDE 'CNLIN1.INS'                                              LOLINE     17
      INCLUDE 'CNUNIT.INS'                                              LOLINE     18
C                                                                       LOLINE     19
      CHARACTER*2  CKT,CKID                                             LOLINE     20
C                                                                       LOLINE     21
      LDEB=(JDEB(63).NE.0)                                              LOLINE     22
C                                                                       LOLINE     23
      KNET=0                                                            LOLINE     24
C                                                                       LOLINE     25
      IF(NODEA.LE.0.OR.NODEB.LE.0)RETURN                                LOLINE     26
C                                                                       LOLINE     27
      N=LBRI(NODEA)                                                     LOLINE     28
C                                                                       LOLINE     29
      IF(N.EQ.0)RETURN                                                  LOLINE     30
C                                                                       LOLINE     31
  10  IF(KTNO(N).NE.NODEB)THEN                                          LOLINE     32
      N=NELI(N)                                                         LOLINE     33
      IF(N.EQ.0)THEN                                                    LOLINE     34
C                                                                       LOLINE     35
C   BRANCH NOT FOUND                                                    LOLINE     36
C                                                                       LOLINE     37
      KNET=0                                                            LOLINE     38
      RETURN                                                            LOLINE     39
      ELSE                                                              LOLINE     40
      GOTO 10                                                           LOLINE     41
      ENDIF                                                             LOLINE     42
      ELSE                                                              LOLINE     43
C                                                                       LOLINE     44
C   BRANCH EXISTS SO CHECK CCTID                                        LOLINE     45
C                                                                       LOLINE     46
      NN=(N+1)/2                                                        LOLINE     47
      JCKID=IARCCT(NN)                                                  LOLINE     48
      CALL UNPACK(CKID,JJJ,JCKID)                                       LOLINE     49
      IF(LDEB)WRITE(IUD6,1010) CKID,N,NN,CKT                            LOLINE     50
      IF(CKT.EQ.CKID)THEN                                               LOLINE     51
      KNET=LINEPO(N)                                                    LOLINE     52
      IF(LDEB)WRITE(IUD6,1020) N,KNET                                   LOLINE     53
      RETURN                                                            LOLINE     54
      ELSE                                                              LOLINE     55
      N=NELI(N)                                                         LOLINE     56
      IF(N.NE.0)THEN                                                    LOLINE     57
      GOTO 10                                                           LOLINE     58
      ELSE                                                              LOLINE     59
      KNET=0                                                            LOLINE     60
      RETURN                                                            LOLINE     61
      ENDIF                                                             LOLINE     62
      ENDIF                                                             LOLINE     63
      ENDIF                                                             LOLINE     64
C                                                                       LOLINE     65
 1010 FORMAT(1X,' CKID=',A2,' N=',I5,' NN=',I5                          LOLINE     66
     &,' CKT=',A2)                                                      LOLINE     67
 1020 FORMAT(1X,'LINE EXISTS N =',I6,' LINEPO(N) =',I6)                 LOLINE     68
C                                                                       LOLINE     69
      END                                                               LOLINE     70
