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