CFPRIME RELINE                                                          RELINE      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  RELINE (NLFF, NLFT, LINPTR)                           RELINE      3
CD                                                                      RELINE      4
CD    TO FIND AND STORE THE MONITIORED AC LINE USED BY THE USER         RELINE      5
CD    DEFINED AC DYNAMIC MODELS.                                        RELINE      6
CD                                                                      RELINE      7
C                                                                       RELINE      8
      INCLUDE 'PARX.INS'                                                RELINE      9
      INCLUDE 'CNPT.INS'                                                RELINE     10
      INCLUDE 'CNUNIT.INS'                                              RELINE     11
      INCLUDE 'CNMON.INS'                                               RELINE     12
      INCLUDE 'CNFLAG.INS'                                              RELINE     13
      INCLUDE 'CNB19.INS'                                               RELINE     14
      INCLUDE 'UDCF.INS'                                                RELINE     15
C                                                                       RELINE     16
      LOGICAL       FOUND                                               RELINE     17
      CHARACTER*2 LCKT,LID                                              RELINE     18
C                                                                       RELINE     19
      LDEB=.FALSE.                                                      RELINE     20
C                                                                       RELINE     21
      CALL UNPACK(LCKT,JJJ,LINPTR)                                      RELINE     22
C                                                                       RELINE     23
      DO 90 J=NACLIN+1,NPFL                                             RELINE     24
      LINLST(J)=J                                                       RELINE     25
   90 CONTINUE                                                          RELINE     26
      NACLIN=NPFL                                                       RELINE     27
C                                                                       RELINE     28
      FOUND=.FALSE.                                                     RELINE     29
      I=1                                                               RELINE     30
  100 IF(FOUND.OR.I.GT.NACLIN)GOTO 110                                  RELINE     31
      JJ=LINLST(I)                                                      RELINE     32
      JNL=JJ*12                                                         RELINE     33
      IF(MLFTB(JNL-6).EQ.NLFF.AND. MLFTB(JNL-5).EQ.NLFT)THEN            RELINE     34
            JLID=MACKT(JNL-9)                                           RELINE     35
         CALL UNPACK(LID,JJJ,JLID)                                      RELINE     36
         IF(LCKT.EQ.LID)THEN                                            RELINE     37
            LINPTR=JJ                                                   RELINE     38
            FOUND=.TRUE.                                                RELINE     39
         ELSE                                                           RELINE     40
            I=I+1                                                       RELINE     41
         ENDIF                                                          RELINE     42
      ELSE                                                              RELINE     43
         I=I+1                                                          RELINE     44
      ENDIF                                                             RELINE     45
      GOTO 100                                                          RELINE     46
  110 CONTINUE                                                          RELINE     47
C                                                                       RELINE     48
      IF(.NOT.FOUND)THEN                                                RELINE     49
C                                                                       RELINE     50
C   STORE LINE CONNECTION INTO MONITORING ARRAY                         RELINE     51
C                                                                       RELINE     52
         IF(NLFF.EQ.0.OR.NLFT.EQ.0)THEN                                 RELINE     53
            LSTATU=10                                                   RELINE     54
         ELSE                                                           RELINE     55
            LSTATU=0                                                    RELINE     56
         ENDIF                                                          RELINE     57
         NPFL=NPFL+1                                                    RELINE     58
         NPFL12=NPFL*12                                                 RELINE     59
         MLFTB(NPFL12-11)=LSTATU                                        RELINE     60
         MLFTB(NPFL12-6)=NLFF                                           RELINE     61
         MLFTB(NPFL12-5)=NLFT                                           RELINE     62
         CALL PACK(LCKT,0,JLID)                                         RELINE     63
         MACKT(NPFL12-9)=JLID                                           RELINE     64
         MTYIRS(NPFL12-8)=0                                             RELINE     65
         JRSKRS(NPFL12-7)=0                                             RELINE     66
         NACLIN=NACLIN+1                                                RELINE     67
         LINPTR=NPFL                                                    RELINE     68
         LINLST(NACLIN)=NPFL                                            RELINE     69
      ENDIF                                                             RELINE     70
C                                                                       RELINE     71
      RETURN                                                            RELINE     72
C                                                                       RELINE     73
      END                                                               RELINE     74
