CFPRIME DEGV08                                                          DEGV08      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 DEGV08(JSGV)                                           DEGV08      3
CD                                                                      DEGV08      4
CD    TO CALCULATE THE DERIVATIVES OF THE STATES OF TYPE 8 GOVERNOR,    DEGV08      5
CD    USED BY BOTH RUNGE-KUTTA AND TRAPEZOIDAL METHOD.                  DEGV08      6
CD                                                                      DEGV08      7
CD    THE DATA STRUCTURE FOR THIS TYPE OF GOVERNOR IS GIVEN BELOW.      DEGV08      8
CD                                                                      DEGV08      9
CD   9.6 Prime-mover turbine-governor model type 8                      DEGV08     10
CD                                                                      DEGV08     11
CD     Governor data                                                    DEGV08     12
CD                                                                      DEGV08     13
CD     DDAT(JGG+ 1)   = K1                                              DEGV08     14
CD     DDAT(JGG+ 2)   = T1                                              DEGV08     15
CD     DDAT(JGG+ 3)   = T2                                              DEGV08     16
CD     DDAT(JGG+ 4)   = T3                                              DEGV08     17
CD     DDAT(JGG+ 5)   = PMAX                                            DEGV08     18
CD     DDAT(JGG+ 6)   = VMIN                                            DEGV08     19
CD     DDAT(JGG+ 7)   = T4                                              DEGV08     20
CD     DDAT(JGG+ 8)   = T5                                              DEGV08     21
CD     DDAT(JGG+ 9)   = T6                                              DEGV08     22
CD                                                                      DEGV08     23
CD     Governor states                                                  DEGV08     24
CD                                                                      DEGV08     25
CD     XSTATE(JPS+ 1) = T1 block                    : compulsory        DEGV08     26
CD     XSTATE(JPS+ 2) = T3 block                    : compulsory        DEGV08     27
CD     XSTATE(JPS+ 3) = T4 block                    : compulsory        DEGV08     28
CD     XSTATE(JPS+ 4) = T5 block                    : compulsory        DEGV08     29
CD                                                                      DEGV08     30
CD     Governor Y-variables                                             DEGV08     31
CD                                                                      DEGV08     32
CD     XLDREF(JYP+1)  = load reference signal                           DEGV08     33
CD                                                                      DEGV08     34
      INCLUDE 'PARX.INS'                                                DEGV08     35
      INCLUDE 'CNB3.INS'                                                DEGV08     36
      INCLUDE 'CNB8.INS'                                                DEGV08     37
      INCLUDE 'CNB10.INS'                                               DEGV08     38
      INCLUDE 'CNB19.INS'                                               DEGV08     39
      INCLUDE 'CNPARX.INS'                                              DEGV08     40
      INCLUDE 'CNXSTA.INS'                                              DEGV08     41
      INCLUDE 'CNMDAT.INS'                                              DEGV08     42
      INCLUDE 'CNEXC.INS'                                               DEGV08     43
      INCLUDE 'CNPRGV.INS'                                              DEGV08     44
      INCLUDE 'CNMYVA.INS'                                              DEGV08     45
      INCLUDE 'CNYVAR.INS'                                              DEGV08     46
C                                                                       DEGV08     47
C                                                                       DEGV08     48
C     TYPE 8                                                            DEGV08     49
C                                                                       DEGV08     50
      JSGV=JSTATE                                                       DEGV08     51
C                                                                       DEGV08     52
C  GAIN K AND X1 BLOCK (T1,T2)                                          DEGV08     53
C                                                                       DEGV08     54
      XINM=DDAT(JGG+1)*XSPU                                             DEGV08     55
C==                                                                     DEGV08     56
C      WRITE(IDU6,711) XSPU,XINM                                        DEGV08     57
C 711  FORMAT(1X,'DB.DEGV08:XSPU,XINM ',2G12.5)                         DEGV08     58
C==                                                                     DEGV08     59
      IF(IDDAT(JGG+2).NE.0) THEN                                        DEGV08     60
         DSTATE(LSTATE+1)=(XINM-XSTATE(JSTATE+1))/DDAT(JGG+2)           DEGV08     61
         XINM=XSTATE(JSTATE+1)+DDAT(JGG+3)*DSTATE(LSTATE+1)             DEGV08     62
      ELSE                                                              DEGV08     63
         DSTATE(LSTATE+1)=0.0                                           DEGV08     64
         XSTATE(JSTATE+1)=XINM                                          DEGV08     65
      ENDIF                                                             DEGV08     66
C==                                                                     DEGV08     67
C       WRITE(IU6,712) XSTATE(JSTATE+1),DSTATE(LSTATE+1),XINM           DEGV08     68
C 712   FORMAT(1X,'DB.DEGV08:X1,DX1,XINM ',3G12.5)                      DEGV08     69
C==                                                                     DEGV08     70
C                                                                       DEGV08     71
C  SUMMATION JUNCTION AND LIMITER                                       DEGV08     72
C                                                                       DEGV08     73
      XSUM=XLDREF(JYP+1)-XINM                                           DEGV08     74
C==                                                                     DEGV08     75
C      WRITE(IU6,713) XLDREF(JYP+1),XINM,XSUM                           DEGV08     76
C 713  FORMAT(1X,'DB.DEGV08:XREF,XINM,XSUM ',3G12.5)                    DEGV08     77
C==                                                                     DEGV08     78
      IF(XSUM.GT.1.0) XSUM=1.0                                          DEGV08     79
      IF(XSUM.LT.DDAT(JGG+6)) XSUM=DDAT(JGG+6)                          DEGV08     80
C                                                                       DEGV08     81
C  X2 BLOCK (T3)                                                        DEGV08     82
C                                                                       DEGV08     83
      IF(IDDAT(JGG+4).NE.0) THEN                                        DEGV08     84
         DSTATE(LSTATE+2)=(XSUM-XSTATE(JSTATE+2))/DDAT(JGG+4)           DEGV08     85
         XSUM=XSTATE(JSTATE+2)                                          DEGV08     86
      ELSE                                                              DEGV08     87
         DSTATE(LSTATE+2)=0.0                                           DEGV08     88
         XSTATE(JSTATE+2)=XSUM                                          DEGV08     89
      ENDIF                                                             DEGV08     90
C==                                                                     DEGV08     91
C       WRITE(IU6,714) XSTATE(JSTATE+2),DSTATE(LSTATE+2),XSUM           DEGV08     92
C 714   FORMAT(1X,'DB.DEGV08:X2,DX2,XSUM ',3G12.5)                      DEGV08     93
C==                                                                     DEGV08     94
C                                                                       DEGV08     95
C  X3 BLOCK (T4)                                                        DEGV08     96
C                                                                       DEGV08     97
      IF(IDDAT(JGG+7).NE.0) THEN                                        DEGV08     98
         DSTATE(LSTATE+3)=(XSUM-XSTATE(JSTATE+3))/DDAT(JGG+7)           DEGV08     99
         XSUM=XSTATE(JSTATE+3)                                          DEGV08    100
      ELSE                                                              DEGV08    101
         DSTATE(LSTATE+3)=0.0                                           DEGV08    102
         XSTATE(JSTATE+3)=XSUM                                          DEGV08    103
      ENDIF                                                             DEGV08    104
C==                                                                     DEGV08    105
C       WRITE(IU6,716) XSTATE(JSTATE+3),DSTATE(LSTATE+3),XSUM           DEGV08    106
C 716   FORMAT(1X,'DB.DEGV08:X3,DX3,XSUM ',3G12.5)                      DEGV08    107
C==                                                                     DEGV08    108
C                                                                       DEGV08    109
C  X4 BLOCK (T5,T6)                                                     DEGV08    110
C                                                                       DEGV08    111
      IF(IDDAT(JGG+8).NE.0) THEN                                        DEGV08    112
         DSTATE(LSTATE+4)=(XSUM-XSTATE(JSTATE+4))/DDAT(JGG+8)           DEGV08    113
         XSUM=XSTATE(JSTATE+4)+DDAT(JGG+9)*DSTATE(LSTATE+4)             DEGV08    114
      ELSE                                                              DEGV08    115
         DSTATE(LSTATE+4)=0.0                                           DEGV08    116
         XSTATE(JSTATE+4)=XSUM                                          DEGV08    117
      ENDIF                                                             DEGV08    118
C==                                                                     DEGV08    119
C       WRITE(IU6,717) XSTATE(JSTATE+4),DSTATE(LSTATE+4),XSUM           DEGV08    120
C 717   FORMAT(1X,'DB.DEGV08:X4,DX4,XSUM ',3G12.5)                      DEGV08    121
C==                                                                     DEGV08    122
C                                                                       DEGV08    123
C  UPDATE TIN                                                           DEGV08    124
C                                                                       DEGV08    125
      TIN(JYG+1)=DDAT(JGG+5)*XSUM                                       DEGV08    126
C==                                                                     DEGV08    127
C      WRITE(IU6,718) TIN(JYG+1)                                        DEGV08    128
C 718  FORMAT(1X,'DB.DEGV08:TIN ',G12.5)                                DEGV08    129
C==                                                                     DEGV08    130
C                                                                       DEGV08    131
      LSTATE=LSTATE+4                                                   DEGV08    132
C                                                                       DEGV08    133
      RETURN                                                            DEGV08    134
      END                                                               DEGV08    135
