CFPRIME GETCUR                                                          GETCUR      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 GETCUR(CREAL,CIMAG,ILINE)                              GETCUR      3
CD -------------------------------------------------------------------  GETCUR      4
CD                                                                      GETCUR      5
CD              *****     GETCUR  ROUTINE   *****                       GETCUR      6
CD                                                                      GETCUR      7
CD -------------------------------------------------------------------  GETCUR      8
CD                                                                      GETCUR      9
CD       PURPOSE:  This subprogram computes the currents needed by the  GETCUR     10
CD                 FROMAC blocks.                                       GETCUR     11
CD                                                                      GETCUR     12
CD                                                                      GETCUR     13
CD       DEFINITION OF LOCAL VARIABLES:                                 GETCUR     14
CD          (P)    BASEI  -  current base for ac system.                GETCUR     15
CD                 BCAL   -  mutual susceptance.                        GETCUR     16
CD                 BCHB   -  self susceptance.                          GETCUR     17
CD          (P)    CURI   -  imaginary current.                         GETCUR     18
CD          (P)    CURR   -  real current.                              GETCUR     19
CD                 DUM1   -  the real part of the voltage drop across   GETCUR     20
CD                           the line.                                  GETCUR     21
CD                 DUM2   -  the imaginary part of the voltage drop     GETCUR     22
CD                           across the line.                           GETCUR     23
CD                 EANP   -  the real part of the voltage at the 'from' GETCUR     24
CD                           bus.                                       GETCUR     25
CD                 EANQ   -  the real part of the voltage at the 'to'   GETCUR     26
CD                           bus.                                       GETCUR     27
CD                 EBNP   -  the imaginary part of the voltage at the   GETCUR     28
CD                           'from' bus.                                GETCUR     29
CD                 EBNQ   -  the imaginary part of the voltage at the   GETCUR     30
CD                           'to' bus.                                  GETCUR     31
CD                 EMAG   -  the magnitude of the 'to' bus voltage.     GETCUR     32
CD                 GCAL   -  mutual conductance.                        GETCUR     33
CD                 GCHB   -  self conductance.                          GETCUR     34
CD          (P)    LOCD   -  ac line pointer.                           GETCUR     35
CD          (P)    NP     -  first ac bus pointer.                      GETCUR     36
CD          (P)    NQ     -  second ac bus pointer.                     GETCUR     37
CD                 RATIO  -  the transformer tap ratio.                 GETCUR     38
CD                 VANG   -  voltage angle.                             GETCUR     39
CD                                                                      GETCUR     40
CD -------------------------------------------------------------------  GETCUR     41
C                                                                       GETCUR     42
      INCLUDE 'PARX.INS'                                                GETCUR     43
      INCLUDE 'CNPT.INS'                                                GETCUR     44
      INCLUDE 'CNIPTR.INS'                                              GETCUR     45
      INCLUDE 'CNSTN.INS'                                               GETCUR     46
      INCLUDE 'CNB19.INS'                                               GETCUR     47
      INCLUDE 'CNUNIT.INS'                                              GETCUR     48
      INCLUDE 'CNMON.INS'                                               GETCUR     49
      INCLUDE 'CNVOLT.INS'                                              GETCUR     50
C                                                                       GETCUR     51
      ILIN12=ILINE*12                                                   GETCUR     52
      ITFK=MLFTB(ILIN12-11)                                             GETCUR     53
      CALL UPACKI(JJJ,LSTATU,ITFK)                                      GETCUR     54
      IF(LSTATU.GE.0)THEN                                               GETCUR     55
      ITFK=MLFTB(ILIN12-10)                                             GETCUR     56
      CALL UPACKI(IPBNOF,IPBNOT,ITFK)                                   GETCUR     57
C                                                                       GETCUR     58
      IF(LSTATU.EQ.0)THEN                                               GETCUR     59
      GJJ=GLM(ILIN12-6)                                                 GETCUR     60
      BJJ=BLM(ILIN12-5)                                                 GETCUR     61
      GJK=BLCF(ILIN12-4)                                                GETCUR     62
      BJK=BLT(ILIN12-3)                                                 GETCUR     63
      ERJ=REAL(VOLT(IPBNOF))                                            GETCUR     64
      EIJ=AIMAG(VOLT(IPBNOF))                                           GETCUR     65
      ERK=REAL(VOLT(IPBNOT))                                            GETCUR     66
      EIK=AIMAG(VOLT(IPBNOT))                                           GETCUR     67
      CREAL=(GJJ*ERJ+BJJ*EIJ)-(GJK*ERK+BJK*EIK)                         GETCUR     68
      CIMAG=(GJJ*EIJ-BJJ*ERJ)-(GJK*EIK-BJK*ERK)                         GETCUR     69
      ELSE                                                              GETCUR     70
      CREAL=0.0                                                         GETCUR     71
      CIMAG=0.0                                                         GETCUR     72
      ENDIF                                                             GETCUR     73
C                                                                       GETCUR     74
C   ENDIF LSTATU.GE.0                                                   GETCUR     75
C                                                                       GETCUR     76
      ENDIF                                                             GETCUR     77
C                                                                       GETCUR     78
      RETURN                                                            GETCUR     79
      ENTRY GETIMP(GJK1,BJK1,ILINE)                                     GETCUR     80
CD                                                                      GETCUR     81
CD     ENTRY GETIMP -- FOR USE IN THE IMPLICIT INTEGRATION METHODS      GETCUR     82
CD                                                                      GETCUR     83
C                                                                       GETCUR     84
      ILIN12=ILINE*12                                                   GETCUR     85
      ITFK=MLFTB(ILIN12-11)                                             GETCUR     86
      CALL UPACKI(JJJ,LSTATU,ITFK)                                      GETCUR     87
      IF (LSTATU.GE.0) THEN                                             GETCUR     88
         ITFK=MLFTB(ILIN12-10)                                          GETCUR     89
         CALL UPACKI(IPBNOF,IPBNOT,ITFK)                                GETCUR     90
C                                                                       GETCUR     91
         IF (LSTATU.EQ.0) THEN                                          GETCUR     92
            GJJ1=GLM(ILIN12-6)                                          GETCUR     93
            BJJ1=BLM(ILIN12-5)                                          GETCUR     94
            GJK1=BLCF(ILIN12-4)                                         GETCUR     95
            BJK1=BLT(ILIN12-3)                                          GETCUR     96
         ELSE                                                           GETCUR     97
            GJJ1=0.0                                                    GETCUR     98
            BJJ1=0.0                                                    GETCUR     99
            GJK1=0.0                                                    GETCUR    100
            BJK1=0.0                                                    GETCUR    101
         END IF                                                         GETCUR    102
C                                                                       GETCUR    103
      END IF                                                            GETCUR    104
C                                                                       GETCUR    105
      RETURN                                                            GETCUR    106
      END                                                               GETCUR    107
