CFPRIME AEXC                                                            AEXC        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 AEXC                                                   AEXC        3
CD                                                                      AEXC        4
CD    TO FORMULATE THE JACOBIAN MATRICES OF USER DEFINED EXCITERS FOR   AEXC        5
CD    USE IN THE IMPLICIT INTEGRATION METHOD.                           AEXC        6
CD                                                                      AEXC        7
CD    THE INTERCONNECTION OF THE JACOBIANS OF THE USER DEFINED EXCITERS AEXC        8
CD    WITH THOSE OF THE MACHINES IS DONE IN SUBROUTINE DGENLN.          AEXC        9
CD                                                                      AEXC       10
      INCLUDE 'PARX.INS'                                                AEXC       11
      INCLUDE 'CNPT.INS'                                                AEXC       12
      INCLUDE 'CNB5.INS'                                                AEXC       13
      INCLUDE 'CNB8.INS'                                                AEXC       14
      INCLUDE 'CNB19.INS'                                               AEXC       15
      INCLUDE 'CNEXC.INS'                                               AEXC       16
      INCLUDE 'CNGDAT.INS'                                              AEXC       17
      INCLUDE 'CNFLAG.INS'                                              AEXC       18
      INCLUDE 'CNVOLT.INS'                                              AEXC       19
      INCLUDE 'CNUDM.INS'                                               AEXC       20
      INCLUDE 'CNUDMA.INS'                                              AEXC       21
      INCLUDE 'CNUDMB.INS'                                              AEXC       22
      INCLUDE 'CNUNIT.INS'                                              AEXC       23
      INCLUDE 'CNABAK.INS'                                              AEXC       24
C                                                                       AEXC       25
      LDEB=.FALSE.                                                      AEXC       26
C                                                                       AEXC       27
      VCM=VALIN(1)                                                      AEXC       28
      VCD=VCM*COS(VALIN(2))                                             AEXC       29
      VCQ=VCM*SIN(VALIN(2))                                             AEXC       30
      VM=VALIN(4)                                                       AEXC       31
      VD=VALIN(6)                                                       AEXC       32
      VQ=VALIN(7)                                                       AEXC       33
      CR=VALIN(8)*BASPRN                                                AEXC       34
      CI=VALIN(9)*BASPRN                                                AEXC       35
C                                                                       AEXC       36
C     FORM: DEL U0=XUI*DEL I+XUV*DEL V+XUY*DEL YB+XUREF*DEL VREF        AEXC       37
C           +XUVS*DEL VS+XUVU*DEL VU+XUW*DEL W+XUIF*DEL IF+XUTM*DEL TM  AEXC       38
C                                                                       AEXC       39
      DO 50 I=1,20                                                      AEXC       40
      DO 40 J=1,NXUDB                                                   AEXC       41
      XUY(I,J)=0.0                                                      AEXC       42
  40  CONTINUE                                                          AEXC       43
      DO 50 J=1,LOUTP                                                   AEXC       44
      XUI(I,J)=0.0                                                      AEXC       45
      XUV(I,J)=0.0                                                      AEXC       46
  50  CONTINUE                                                          AEXC       47
      CALL FMOVE(0,XUVS,XUVS,20)                                        AEXC       48
      CALL FMOVE(0,XUVU,XUVU,20)                                        AEXC       49
      CALL FMOVE(0,XUW,XUW,20)                                          AEXC       50
      CALL FMOVE(0,XUIF,XUIF,20)                                        AEXC       51
      CALL FMOVE(0,XUTM,XUTM,20)                                        AEXC       52
C                                                                       AEXC       53
      IBEND=IUDAT(JE7+1)                                                AEXC       54
C                                                                       AEXC       55
      XUI(3,1)=-VD-2.0*RK*CR                                            AEXC       56
      XUI(3,2)=-VQ-2.0*RK*CI                                            AEXC       57
      XUI(8,1)=1.0                                                      AEXC       58
      XUI(9,2)=1.0                                                      AEXC       59
      XUI(10,1)=VD                                                      AEXC       60
      XUI(10,2)=VQ                                                      AEXC       61
      XUI(11,1)=VQ                                                      AEXC       62
      XUI(11,2)=-VD                                                     AEXC       63
C                                                                       AEXC       64
      XUV(1,1)=VCD/VCM                                                  AEXC       65
      XUV(1,2)=VCQ/VCM                                                  AEXC       66
      XUV(2,1)=-VCQ/VCM/VCM                                             AEXC       67
      XUV(2,2)=VCD/VCM/VCM                                              AEXC       68
      XUV(3,1)=-CR                                                      AEXC       69
      XUV(3,2)=-CI                                                      AEXC       70
      XUV(4,1)=VD/VM                                                    AEXC       71
      XUV(4,2)=VQ/VM                                                    AEXC       72
      XUV(5,1)=-VQ/VM/VM                                                AEXC       73
      XUV(5,2)=VD/VM/VM                                                 AEXC       74
      XUV(6,1)=1.0                                                      AEXC       75
      XUV(7,2)=1.0                                                      AEXC       76
      XUV(10,1)=CR                                                      AEXC       77
      XUV(10,2)=CI                                                      AEXC       78
      XUV(11,1)=-CI                                                     AEXC       79
      XUV(11,2)=CR                                                      AEXC       80
C                                                                       AEXC       81
      XUW(3)=-DAMPK                                                     AEXC       82
      XUW(12)=1.0                                                       AEXC       83
C                                                                       AEXC       84
      XUTM(3)=1.0                                                       AEXC       85
      XUY(15,IBEND)=1.0                                                 AEXC       86
      XUIF(16)=1.0                                                      AEXC       87
      XUVS(17)=1.0                                                      AEXC       88
      XUVU(18)=1.0                                                      AEXC       89
C                                                                       AEXC       90
C     FORM THE REMOTE BUS ARRAY AND CONTROL A B C D MATRICES            AEXC       91
C                                                                       AEXC       92
      LCYO=1                                                            AEXC       93
      LWIF=1                                                            AEXC       94
      NBUSS=1                                                           AEXC       95
      NBUSR=0                                                           AEXC       96
      BASERT=1.0                                                        AEXC       97
      CALL AUDMB(LCYO,LWIF,NBUSR,NBUSS)                                 AEXC       98
      IF(KERUDM.NE.0) GO TO 900                                         AEXC       99
      MSUDM(2,1)=NBUSR                                                  AEXC      100
      IF (NBUSR.NE.0) THEN                                              AEXC      101
         DO 100 I=1,NBUSR                                               AEXC      102
            MSUDM(I+2,1)=MBUSR(NBUSS+I)                                 AEXC      103
  100    CONTINUE                                                       AEXC      104
      END IF                                                            AEXC      105
C                                                                       AEXC      106
C     SOLVE THE CONTROL EQUATIONS                                       AEXC      107
C                                                                       AEXC      108
      LOUT=2                                                            AEXC      109
      LREM=2*NBUSR                                                      AEXC      110
      CALL AUDMC(LOUT,LCYO,LWIF,LREM)                                   AEXC      111
      IF(KERUDM.NE.0) GO TO 900                                         AEXC      112
C                                                                       AEXC      113
C     FORM: DEL XDOT = AX*DEL X+BXI*DEL I+BXV*DEL V(S&R)+BXIF DEL IF+   AEXC      114
C                      BXW*DEL W+BXTM*DEL TM+BXVS*DEL VS+BXVU*DEL VU    AEXC      115
C                                                                       AEXC      116
C            DEL EFD = CX*DEL X+ADEV*DEL I+YDEVS*DEL V+YDEVR*DEL VR+    AEXC      117
C                      CXIF*DEL IF+CXW*DEL W+CXTM*DEL TM+CXVS*DEL VS+   AEXC      118
C                      CXVU*DEL VU                                      AEXC      119
C                                                                       AEXC      120
      DO 110 I=1,KORD                                                   AEXC      121
      DO 110 J=1,KORD                                                   AEXC      122
         AX(J,I)=AXB(J,I)                                               AEXC      123
  110 CONTINUE                                                          AEXC      124
C                                                                       AEXC      125
      DO 120 I=1,KORD                                                   AEXC      126
         BXIF(I)=BUIF(I)                                                AEXC      127
         BXW(I)=BUW(I)                                                  AEXC      128
         BXTM(I)=BUTM(I)                                                AEXC      129
         BXVS(I)=BUVS(I)                                                AEXC      130
         BXVU(I)=BUVU(I)                                                AEXC      131
         CX(1,I)=CYX(1,I)                                               AEXC      132
         BXI(I,1)=BUI(I,1)                                              AEXC      133
         BXI(I,2)=BUI(I,2)                                              AEXC      134
         BXV(I,1)=BUV(I,1)                                              AEXC      135
         BXV(I,2)=BUV(I,2)                                              AEXC      136
  120 CONTINUE                                                          AEXC      137
C                                                                       AEXC      138
      CXIF=CYIF(1)                                                      AEXC      139
      CXW=CYW(1)                                                        AEXC      140
      CXTM=CYTM(1)                                                      AEXC      141
      CXVS=CYVS(1)                                                      AEXC      142
      CXVU=CYVU(1)                                                      AEXC      143
      BXVS(KORD+1)=CXVS                                                 AEXC      144
      BXVU(KORD+1)=CXVU                                                 AEXC      145
C                                                                       AEXC      146
      ADEV(1,1)=CYI(1,1)                                                AEXC      147
      ADEV(1,2)=CYI(1,2)                                                AEXC      148
      YDEVS(1,1)=CYV(1,1)                                               AEXC      149
      YDEVS(1,2)=CYV(1,2)                                               AEXC      150
C                                                                       AEXC      151
      IF (NBUSR.EQ.0) GOTO 900                                          AEXC      152
C                                                                       AEXC      153
      DO 150 I=1,KORD                                                   AEXC      154
      DO 150 J=1,2*NBUSR                                                AEXC      155
         BXV(I,J+2)=BUVR(I,J)                                           AEXC      156
  150 CONTINUE                                                          AEXC      157
C                                                                       AEXC      158
      DO 160 I=1,2*NBUSR                                                AEXC      159
         YDEVR(1,I)=CYVR(1,I)                                           AEXC      160
  160 CONTINUE                                                          AEXC      161
C                                                                       AEXC      162
  900 RETURN                                                            AEXC      163
      END                                                               AEXC      164
