CFPRIME ACFIND                                                          ACFIND      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  ACFIND (BUS, NLF, JBUSPT)                             ACFIND      3
CD -------------------------------------------------------------------  ACFIND      4
CD                                                                      ACFIND      5
CD              *****     ACFIND  ROUTINE   *****                       ACFIND      6
CD                                                                      ACFIND      7
CD -------------------------------------------------------------------  ACFIND      8
CD                                                                      ACFIND      9
CD       PURPOSE:  TO FIND THE AC BUS AS REVIEWED FROM THE DC SYSTEM.   ACFIND     10
CD                                                                      ACFIND     11
CD                                                                      ACFIND     12
CD       DEFINITION OF LOCAL VARIABLES:                                 ACFIND     13
CD          (P)    BUS    -  ac bus name.                               ACFIND     14
CD          (P)    JBUSPT -  internal location for ac bus data in       ACFIND     15
CD                           copy of ac tables.                         ACFIND     16
CD          (P)    NLF    -  integer equivalent of ac bus name.         ACFIND     17
CD                                                                      ACFIND     18
CD -------------------------------------------------------------------  ACFIND     19
      INCLUDE 'PARX.INS'                                                ACFIND     20
      INCLUDE 'CNPT.INS'                                                ACFIND     21
      INCLUDE 'CNUNIT.INS'                                              ACFIND     22
      INCLUDE 'CNFLAG.INS'                                              ACFIND     23
      INCLUDE 'GRPDCS.INS'                                              ACFIND     24
      INCLUDE 'UDCF.INS'                                                ACFIND     25
C                                                                       ACFIND     26
      LOGICAL       FOUND                                               ACFIND     27
C                                                                       ACFIND     28
      CHARACTER*12  BUS                                                 ACFIND     29
      CHARACTER*5  BUSX                                                 ACFIND     30
C                                                                       ACFIND     31
C---------------------------------------------------------------------  ACFIND     32
C                                                                       ACFIND     33
      LDEB=.FALSE.                                                      ACFIND     34
      JBUSPT = 0                                                        ACFIND     35
C                                                                       ACFIND     36
      IF(KLFO.NE.0) THEN                                                ACFIND     37
         CALL CHKBUS(BUS,NLF)                                           ACFIND     38
      ELSE                                                              ACFIND     39
         BUSX='     '                                                   ACFIND     40
         DO 10 I=2,6                                                    ACFIND     41
         IF(BUS(I:I).EQ.' ') THEN                                       ACFIND     42
            BUSX(7-I:5)=BUS(1:I-1)                                      ACFIND     43
            READ(BUSX,1000) NLF                                         ACFIND     44
            GO TO 15                                                    ACFIND     45
         END IF                                                         ACFIND     46
  10     CONTINUE                                                       ACFIND     47
      END IF                                                            ACFIND     48
  15     CONTINUE                                                       ACFIND     49
C                                                                       ACFIND     50
      IF(NLF.NE.0)THEN                                                  ACFIND     51
         FOUND=.FALSE.                                                  ACFIND     52
         I=1                                                            ACFIND     53
20       IF(FOUND.OR.I.GT.NACTOT) GOTO 40                               ACFIND     54
            IF(NLF.EQ.IUQABU(I))THEN                                    ACFIND     55
               JBUSPT=I                                                 ACFIND     56
               FOUND = .TRUE.                                           ACFIND     57
            ELSE                                                        ACFIND     58
               I=I+1                                                    ACFIND     59
            ENDIF                                                       ACFIND     60
            GOTO 20                                                     ACFIND     61
40       CONTINUE                                                       ACFIND     62
C                                                                       ACFIND     63
C                                                                       ACFIND     64
         IF(.NOT. FOUND)THEN                                            ACFIND     65
            NACTOT=NACTOT+1                                             ACFIND     66
            JBUSPT=NACTOT                                               ACFIND     67
            IUQABU(JBUSPT)=NLF                                          ACFIND     68
         ENDIF                                                          ACFIND     69
      ENDIF                                                             ACFIND     70
C                                                                       ACFIND     71
C                                                                       ACFIND     72
C---------------------------------------------------------------------  ACFIND     73
C                                                                       ACFIND     74
      RETURN                                                            ACFIND     75
C                                                                       ACFIND     76
C---------------------------------------------------------------------  ACFIND     77
C                                                                       ACFIND     78
 1000 FORMAT(I5)                                                        ACFIND     79
      END                                                               ACFIND     80
