CFPRIME ACLINE                                                          ACLINE      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  ACLINE (NAME, JBPTR1, JBPTR2, LINPTR)                 ACLINE      3
CD -------------------------------------------------------------------  ACLINE      4
CD                                                                      ACLINE      5
CD              *****     ACLINE  ROUTINE   *****                       ACLINE      6
CD                                                                      ACLINE      7
CD -------------------------------------------------------------------  ACLINE      8
CD                                                                      ACLINE      9
CD       PURPOSE:  This subprogram finds the ac line, and copies        ACLINE     10
CD                 all information required by the dc code into         ACLINE     11
CD                 arrays recognized in the dc code.                    ACLINE     12
CD                                                                      ACLINE     13
CD -------------------------------------------------------------------  ACLINE     14
C                                                                       ACLINE     15
      INCLUDE 'PARX.INS'                                                ACLINE     16
      INCLUDE 'CNPT.INS'                                                ACLINE     17
      INCLUDE 'CNUNIT.INS'                                              ACLINE     18
C                                                                       ACLINE     19
      INCLUDE 'UDCF.INS'                                                ACLINE     20
      INCLUDE 'CNMON.INS'                                               ACLINE     21
      INCLUDE 'CNFLAG.INS'                                              ACLINE     22
      INCLUDE 'CNB19.INS'                                               ACLINE     23
C                                                                       ACLINE     24
      LOGICAL       FOUND                                               ACLINE     25
C                                                                       ACLINE     26
      CHARACTER*25  NAME                                                ACLINE     27
C                                                                       ACLINE     28
      CHARACTER*2 LCKT,LID                                              ACLINE     29
      EQUIVALENCE (JLCKT,LCKT)                                          ACLINE     30
C                                                                       ACLINE     31
      LDEB=.FALSE.                                                      ACLINE     32
C                                                                       ACLINE     33
C     Check if the buses existed                                        ACLINE     34
C                                                                       ACLINE     35
      CALL ACFIND(NAME(1:12),NLFF,JBPTR1)                               ACLINE     36
      CALL ACFIND(NAME(13:24),NLFT,JBPTR2)                              ACLINE     37
C                                                                       ACLINE     38
      LCKT(1:2)=NAME(25:25)//' '                                        ACLINE     39
C                                                                       ACLINE     40
      DO 90 J=NACLIN+1,NPFL                                             ACLINE     41
      LINLST(J)=J                                                       ACLINE     42
   90 CONTINUE                                                          ACLINE     43
      NACLIN=NPFL                                                       ACLINE     44
C                                                                       ACLINE     45
      LINPTR=0                                                          ACLINE     46
      IF(NLFF.EQ.0.OR.NLFT.EQ.0)THEN                                    ACLINE     47
      JBPTR1=0                                                          ACLINE     48
      JBPTR2=0                                                          ACLINE     49
      ELSE                                                              ACLINE     50
C                                                                       ACLINE     51
C     Look for the ac line in the copy of ac line table.                ACLINE     52
C                                                                       ACLINE     53
      FOUND=.FALSE.                                                     ACLINE     54
      I=1                                                               ACLINE     55
 20   IF(FOUND.OR.I.GT.NACLIN)GOTO 40                                   ACLINE     56
      JJ=LINLST(I)                                                      ACLINE     57
      JNL=JJ*12                                                         ACLINE     58
      IF(MLFTB(JNL-6).EQ.NLFF.AND.MLFTB(JNL-5).EQ.NLFT)THEN             ACLINE     59
         JLID=MACKT(JNL-9)                                              ACLINE     60
         CALL UNPACK(LID,LL,JLID)                                       ACLINE     61
         IF(LID(1:2).EQ.LCKT(1:2))THEN                                  ACLINE     62
            LINPTR=JJ                                                   ACLINE     63
            FOUND=.TRUE.                                                ACLINE     64
         ELSE                                                           ACLINE     65
            I=I+1                                                       ACLINE     66
         ENDIF                                                          ACLINE     67
      ELSE                                                              ACLINE     68
         I=I+1                                                          ACLINE     69
      ENDIF                                                             ACLINE     70
      GOTO 20                                                           ACLINE     71
40    CONTINUE                                                          ACLINE     72
C                                                                       ACLINE     73
      IF(.NOT.FOUND)THEN                                                ACLINE     74
C                                                                       ACLINE     75
C   STORE LINE CONNECTION INTO MONITORING ARRAY                         ACLINE     76
C                                                                       ACLINE     77
      IF(NLFF.EQ.0.OR.NLFT.EQ.0)THEN                                    ACLINE     78
      LSTATU=10                                                         ACLINE     79
      ELSE                                                              ACLINE     80
      LSTATU=0                                                          ACLINE     81
      ENDIF                                                             ACLINE     82
      NPFL=NPFL+1                                                       ACLINE     83
      NPFL12=NPFL*12                                                    ACLINE     84
      MLFTB(NPFL12-11)=LSTATU                                           ACLINE     85
      MLFTB(NPFL12-6)=NLFF                                              ACLINE     86
      MLFTB(NPFL12-5)=NLFT                                              ACLINE     87
      LID(1:2)=LCKT(1:2)                                                ACLINE     88
      CALL PACK(LID,0,JLID)                                             ACLINE     89
      MACKT(NPFL12-9)=JLID                                              ACLINE     90
      MTYIRS(NPFL12-8)=0                                                ACLINE     91
      JRSKRS(NPFL12-7)=0                                                ACLINE     92
      NACLIN=NACLIN+1                                                   ACLINE     93
      LINPTR=NPFL                                                       ACLINE     94
      LNNAME(LINPTR)=NAME                                               ACLINE     95
      LINLST(NACLIN)=NPFL                                               ACLINE     96
      ENDIF                                                             ACLINE     97
      ENDIF                                                             ACLINE     98
C                                                                       ACLINE     99
C---------------------------------------------------------------------  ACLINE    100
C                                                                       ACLINE    101
      RETURN                                                            ACLINE    102
C                                                                       ACLINE    103
C---------------------------------------------------------------------  ACLINE    104
C                                                                       ACLINE    105
      END                                                               ACLINE    106
