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