CFPRIME AGOV8                                                           AGOV8       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 AGOV8(ISTATE,HM)                                       AGOV8       3
CD                                                                      AGOV8       4
CD    TO FORMULATE THE JACOBIAN MATRICES OF TYPE 8 GOVERNOR.            AGOV8       5
CD                                                                      AGOV8       6
      INCLUDE 'PARX.INS'                                                AGOV8       7
      INCLUDE 'CNB8.INS'                                                AGOV8       8
      INCLUDE 'CNB19.INS'                                               AGOV8       9
      INCLUDE 'CNEXC.INS'                                               AGOV8      10
      INCLUDE 'CNPARX.INS'                                              AGOV8      11
      INCLUDE 'CNMDAT.INS'                                              AGOV8      12
      INCLUDE 'CNMSTA.INS'                                              AGOV8      13
      INCLUDE 'CNXSTA.INS'                                              AGOV8      14
      INCLUDE 'CNSTAB.INS'                                              AGOV8      15
C                                                                       AGOV8      16
      INCLUDE 'CNABAK.INS'                                              AGOV8      17
C                                                                       AGOV8      18
C     SUBSCRIPTS                                                        AGOV8      19
C                                                                       AGOV8      20
      ISUB1=ISTATE+1                                                    AGOV8      21
      ISUB2=ISTATE+2                                                    AGOV8      22
      ISUB3=ISTATE+3                                                    AGOV8      23
      ISUB4=ISTATE+4                                                    AGOV8      24
C                                                                       AGOV8      25
      T6T5=0.0                                                          AGOV8      26
      CCT=DDAT(JGG+1)/WXBASE                                            AGOV8      27
C                                                                       AGOV8      28
C     T1, T2 BLOCK                                                      AGOV8      29
C                                                                       AGOV8      30
      IF (IDDAT(JGG+2).EQ.0) THEN                                       AGOV8      31
         T2T1=1.0                                                       AGOV8      32
      ELSE                                                              AGOV8      33
         T1I=1.0/DDAT(JGG+2)                                            AGOV8      34
         T2T1=DDAT(JGG+3)*T1I                                           AGOV8      35
         A(ISUB1,ISUB1)=-T1I                                            AGOV8      36
         A(ISUB1,1)=-T1I*CCT                                            AGOV8      37
         CCT=CCT*T2T1                                                   AGOV8      38
      END IF                                                            AGOV8      39
C                                                                       AGOV8      40
C     T3 BLOCK                                                          AGOV8      41
C                                                                       AGOV8      42
      IF (IDDAT(JGG+4).EQ.0) THEN                                       AGOV8      43
         G1=1.0                                                         AGOV8      44
      ELSE                                                              AGOV8      45
         G1=0.0                                                         AGOV8      46
         T3I=1.0/DDAT(JGG+4)                                            AGOV8      47
         A(ISUB2,ISUB2)=-T3I                                            AGOV8      48
         A(ISUB2,ISUB1)=-T3I*(1.0-T2T1)                                 AGOV8      49
         A(ISUB2,1)=-T3I*CCT                                            AGOV8      50
      END IF                                                            AGOV8      51
C                                                                       AGOV8      52
C     T4 BLOCK                                                          AGOV8      53
C                                                                       AGOV8      54
      IF (IDDAT(JGG+7).EQ.0) THEN                                       AGOV8      55
         G2=1.0                                                         AGOV8      56
      ELSE                                                              AGOV8      57
         G2=0.0                                                         AGOV8      58
         T4I=1.0/DDAT(JGG+7)                                            AGOV8      59
         A(ISUB3,ISUB3)=-T4I                                            AGOV8      60
         A(ISUB3,ISUB2)=T4I*(1.0-G1)                                    AGOV8      61
         A(ISUB3,ISUB1)=-T4I*G1*(1.0-T2T1)                              AGOV8      62
      END IF                                                            AGOV8      63
      G12=G1*G2                                                         AGOV8      64
C                                                                       AGOV8      65
C     T5, T6 BLOCK                                                      AGOV8      66
C                                                                       AGOV8      67
      IF (IDDAT(JGG+8).NE.0) THEN                                       AGOV8      68
         T5I=1.0/DDAT(JGG+8)                                            AGOV8      69
         T6T5=DDAT(JGG+9)*T5I                                           AGOV8      70
         A(ISUB4,ISUB4)=-T5I                                            AGOV8      71
         A(ISUB4,ISUB3)=T5I*(1.0-G2)                                    AGOV8      72
         A(ISUB4,ISUB2)=T5I*G2*(1.0-G1)                                 AGOV8      73
         A(ISUB4,ISUB1)=-T5I*G12*(1.0-T2T1)                             AGOV8      74
         A(ISUB4,1)=-T5I*G12*CCT                                        AGOV8      75
      END IF                                                            AGOV8      76
C                                                                       AGOV8      77
C     INTEGRATION WITH MACHINE (OUTPUT EQUATION)                        AGOV8      78
C                                                                       AGOV8      79
      PMAX=HM*DDAT(JGG+5)                                               AGOV8      80
      WS1=PMAX*T6T5                                                     AGOV8      81
      WS2=WS1*G12                                                       AGOV8      82
      A(1,ISUB1)=-WS2*(1.0-T2T1)                                        AGOV8      83
      A(1,ISUB2)=WS1*G2-WS2                                             AGOV8      84
      A(1,ISUB3)=WS1*(1.0-G2)                                           AGOV8      85
      A(1,ISUB4)=PMAX-WS1                                               AGOV8      86
C                                                                       AGOV8      87
      DWTERM=-WS2*CCT                                                   AGOV8      88
      A(1,1)=A(1,1)+DWTERM                                              AGOV8      89
C                                                                       AGOV8      90
      ISTATE=ISTATE+4                                                   AGOV8      91
C                                                                       AGOV8      92
      RETURN                                                            AGOV8      93
      END                                                               AGOV8      94
