CFPRIME AUAL                                                            AUAL        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 AUAL                                                   AUAL        3
CD                                                                      AUAL        4
CD    TO FORMULATE THE JACOBIAN MATRICES OF USER DEFINED UNDEREXCITED   AUAL        5
CD    CURRENT LIMITER FOR USE IN THE IMPLICIT INTEGRATION METHOD.       AUAL        6
CD                                                                      AUAL        7
CD    THE INTERCONNECTION OF THE JACOBIANS OF THE USER DEFINED          AUAL        8
CD    UNDEREXCITED CURRENT LIMITER WITH THOSE OF THE EXCITER AND        AUAL        9
CD    MACHINE IS DONE IN SUBROUTINE DGENLN.                             AUAL       10
CD                                                                      AUAL       11
      INCLUDE 'PARX.INS'                                                AUAL       12
      INCLUDE 'CNPT.INS'                                                AUAL       13
      INCLUDE 'CNB5.INS'                                                AUAL       14
      INCLUDE 'CNB8.INS'                                                AUAL       15
      INCLUDE 'CNB19.INS'                                               AUAL       16
      INCLUDE 'CNEXC.INS'                                               AUAL       17
      INCLUDE 'CNGDAT.INS'                                              AUAL       18
      INCLUDE 'CNFLAG.INS'                                              AUAL       19
      INCLUDE 'CNVOLT.INS'                                              AUAL       20
      INCLUDE 'CNUDM.INS'                                               AUAL       21
      INCLUDE 'CNUDMA.INS'                                              AUAL       22
      INCLUDE 'CNUDMB.INS'                                              AUAL       23
      INCLUDE 'CNUNIT.INS'                                              AUAL       24
      INCLUDE 'CNABAK.INS'                                              AUAL       25
C                                                                       AUAL       26
      LDEB=.FALSE.                                                      AUAL       27
C                                                                       AUAL       28
      VCM=VALIN(1)                                                      AUAL       29
      VCD=VCM*COS(VALIN(2))                                             AUAL       30
      VCQ=VCM*SIN(VALIN(2))                                             AUAL       31
      VM=VALIN(4)                                                       AUAL       32
      VD=VALIN(6)                                                       AUAL       33
      VQ=VALIN(7)                                                       AUAL       34
      CR=VALIN(8)*BASPRN                                                AUAL       35
      CI=VALIN(9)*BASPRN                                                AUAL       36
C                                                                       AUAL       37
C     FORM: DEL U0=XUI*DEL I+XUV*DEL V+XUY*DEL YB+XUW*DEL W+XUTM*DEL TM AUAL       38
C                 +XUIF*DEL IF                                          AUAL       39
C                                                                       AUAL       40
      DO 50 I=1,20                                                      AUAL       41
      DO 40 J=1,NXUDB                                                   AUAL       42
      XUY(I,J)=0.0                                                      AUAL       43
  40  CONTINUE                                                          AUAL       44
      DO 50 J=1,LOUTP                                                   AUAL       45
      XUI(I,J)=0.0                                                      AUAL       46
      XUV(I,J)=0.0                                                      AUAL       47
  50  CONTINUE                                                          AUAL       48
C      CALL FMOVE(0,XUI,XUI,20*LOUTP)                                   AUAL       49
C      CALL FMOVE(0,XUV,XUV,20*LOUTP)                                   AUAL       50
C      CALL FMOVE(0,XUY,XUY,20*NXUDB)                                   AUAL       51
      CALL FMOVE(0,XUVS,XUVS,20)                                        AUAL       52
      CALL FMOVE(0,XUVU,XUVU,20)                                        AUAL       53
      CALL FMOVE(0,XUW,XUW,20)                                          AUAL       54
      CALL FMOVE(0,XUIF,XUIF,20)                                        AUAL       55
      CALL FMOVE(0,XUTM,XUTM,20)                                        AUAL       56
C                                                                       AUAL       57
      IBEND=IUDAT(JE7+1)                                                AUAL       58
C                                                                       AUAL       59
      XUI(3,1)=-VD-2.0*RK*CR                                            AUAL       60
      XUI(3,2)=-VQ-2.0*RK*CI                                            AUAL       61
      XUI(8,1)=1.0                                                      AUAL       62
      XUI(9,2)=1.0                                                      AUAL       63
      XUI(10,1)=VD                                                      AUAL       64
      XUI(10,2)=VQ                                                      AUAL       65
      XUI(11,1)=VQ                                                      AUAL       66
      XUI(11,2)=-VD                                                     AUAL       67
C                                                                       AUAL       68
      XUV(1,1)=VCD/VCM                                                  AUAL       69
      XUV(1,2)=VCQ/VCM                                                  AUAL       70
      XUV(2,1)=-VCQ/VCM/VCM                                             AUAL       71
      XUV(2,2)=VCD/VCM/VCM                                              AUAL       72
      XUV(3,1)=-CR                                                      AUAL       73
      XUV(3,2)=-CI                                                      AUAL       74
      XUV(4,1)=VD/VM                                                    AUAL       75
      XUV(4,2)=VQ/VM                                                    AUAL       76
      XUV(5,1)=-VQ/VM/VM                                                AUAL       77
      XUV(5,2)=VD/VM/VM                                                 AUAL       78
      XUV(6,1)=1.0                                                      AUAL       79
      XUV(7,2)=1.0                                                      AUAL       80
      XUV(10,1)=CR                                                      AUAL       81
      XUV(10,2)=CI                                                      AUAL       82
      XUV(11,1)=-CI                                                     AUAL       83
      XUV(11,2)=CR                                                      AUAL       84
C                                                                       AUAL       85
      XUTM(3)=1.0                                                       AUAL       86
      XUW(3)=-DAMPK                                                     AUAL       87
      XUW(12)=1.0                                                       AUAL       88
      XUIF(16)=1.0                                                      AUAL       89
      XUY(18,IBEND)=1.0                                                 AUAL       90
C                                                                       AUAL       91
C     FORM THE REMOTE BUS ARRAY AND CONTROL A B C D MATRICES            AUAL       92
C                                                                       AUAL       93
      LCYO=1                                                            AUAL       94
      LWIF=1                                                            AUAL       95
      NBUSS=1                                                           AUAL       96
      NBUSR=0                                                           AUAL       97
      NBUSR1=NBUSR                                                      AUAL       98
      BASERT=1.0                                                        AUAL       99
      CALL AUDMB(LCYO,LWIF,NBUSR,NBUSS)                                 AUAL      100
      IF(KERUDM.NE.0) GO TO 900                                         AUAL      101
      MSUDM(2,3)=NBUSR                                                  AUAL      102
      IF (NBUSR.NE.0) THEN                                              AUAL      103
         DO 100 I=1,NBUSR                                               AUAL      104
            MSUDM(I+2,3)=MBUSR(NBUSS+I)                                 AUAL      105
  100    CONTINUE                                                       AUAL      106
      END IF                                                            AUAL      107
C                                                                       AUAL      108
C     SOLVE THE CONTROL EQUATIONS                                       AUAL      109
C                                                                       AUAL      110
      LOUT=2                                                            AUAL      111
      LREM=2*NBUSR                                                      AUAL      112
      CALL AUDMC(LOUT,LCYO,LWIF,LREM)                                   AUAL      113
      IF(KERUDM.NE.0) GO TO 900                                         AUAL      114
C                                                                       AUAL      115
C     FORM: DEL XDOT = AXB*DEL X+BUI*DEL I+BUV*DEL VS+BUVR*DEL VR+      AUAL      116
C                      BUW*DEL W+BUTM*DEL TM+BUIF*DEL IF                AUAL      117
C                                                                       AUAL      118
C             DEL VU = CYX*DEL X+CYI*DEL I+CYV*DEL VS+CYVR*DEL VR+      AUAL      119
C                      CYW*DEL W+CYTM*DEL TM+CYIF*DEL IF                AUAL      120
C                                                                       AUAL      121
      MSEXC=MSUDM(1,1)                                                  AUAL      122
      MSSTA=MSUDM(1,2)                                                  AUAL      123
      IWS1=MSEXC+MSSTA                                                  AUAL      124
      DO 110 I=1,KORD                                                   AUAL      125
         BXTM(IWS1+I)=BUTM(I)                                           AUAL      126
  110 CONTINUE                                                          AUAL      127
      CXTM=CXTM+CXVU*CYTM(1)                                            AUAL      128
C                                                                       AUAL      129
  900 RETURN                                                            AUAL      130
      END                                                               AUAL      131
