CFPRIME UPDATE                                                          UPDATE      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 UPDATE(JSGV)                                           UPDATE      3
CD                                                                      UPDATE      4
CD    THIS ROUTINE UPDATES VARIABLES OF THE GENERATOR PRIME MOVER       UPDATE      5
CD    AT END OF EVERY RKG INTERMEDIATE STEP.                            UPDATE      6
CD                                                                      UPDATE      7
      INCLUDE 'PARX.INS'                                                UPDATE      8
      INCLUDE 'CNFLAG.INS'                                              UPDATE      9
      INCLUDE 'CNMDAT.INS'                                              UPDATE     10
      INCLUDE 'CNPT.INS'                                                UPDATE     11
      INCLUDE 'CNB3.INS'                                                UPDATE     12
      INCLUDE 'CNB8.INS'                                                UPDATE     13
      INCLUDE 'CNB19.INS'                                               UPDATE     14
      INCLUDE 'CNEXC.INS'                                               UPDATE     15
      INCLUDE 'CNPRGV.INS'                                              UPDATE     16
      INCLUDE 'CNMSTA.INS'                                              UPDATE     17
      INCLUDE 'CNXSTA.INS'                                              UPDATE     18
      INCLUDE 'CNMYVA.INS'                                              UPDATE     19
      INCLUDE 'CNYVAR.INS'                                              UPDATE     20
C                                                                       UPDATE     21
      LDEB=(JDEB(65).NE.0)                                              UPDATE     22
C                                                                       UPDATE     23
C  CODE FOR PRIME MOVER                                                 UPDATE     24
C                                                                       UPDATE     25
C                                                                       UPDATE     26
      IF(IGVN.EQ.46) IGVN=0                                             UPDATE     27
      IF(IGVN.NE.0)THEN                                                 UPDATE     28
C                                                                       UPDATE     29
      JSG1=MSTATE(1,N)                                                  UPDATE     30
      DOMPU=XSTATE(JSG1+1)/WXBASE                                       UPDATE     31
      JGG=JCONTA(2,N)                                                   UPDATE     32
      IGVNB=0                                                           UPDATE     33
*IF LTSP                                                                UPDATE     34
*ENDIF                                                                  UPDATE     46
C                                                                       UPDATE     47
C  TYPE :    1   2   3   4   5   6   7                                  UPDATE     48
C                                                                       UPDATE     49
      GOTO (300,300,900,400,500,600,600,900,900,900,900,900,900,900,    UPDATE     50
C                                20  21  22                             UPDATE     51
     +      900,900,900,900,900,800,810,840), IGVN                      UPDATE     52
 300  CONTINUE                                                          UPDATE     53
C                                                                       UPDATE     54
C     MECHAINCAL TORQUE FOR TYPES 1,2,3,31 & 32                         UPDATE     55
C                                                                       UPDATE     56
      TIN(JYG+1)=DDAT(JGG+22)*XSTATE(JSGV+1)+DDAT(JGG+23)*XSTATE(JSGV+3)UPDATE     57
     + +(1.0-DDAT(JGG+22)-DDAT(JGG+23))*XSTATE(JSGV+4)                  UPDATE     58
C                                                                       UPDATE     59
      TIN(JYG+1)=TIN(JYG+1)*DDAT(JGG+24)                                UPDATE     60
      CVP(JYP+2)=XSTATE(JSGV+5)                                         UPDATE     61
C                                                                       UPDATE     62
C     NOTE THAT THE FOLLOWING CODE MAY BE RECOGNIZED AS UNREACHABLE     UPDATE     63
C     IN ETMSP VERSIONS, BUT KEEP THEM IN. OTHERWISE LTSP WILL HAVE     UPDATE     64
C     PROBLEM.                                                          UPDATE     65
C                                                                       UPDATE     66
      IF(IGVNB.NE.0)IGVN=IGVNB                                          UPDATE     67
      GOTO 900                                                          UPDATE     68
 400  CONTINUE                                                          UPDATE     69
C                                                                       UPDATE     70
C  TYPE=4 5,34 & 35                                                     UPDATE     71
C                                                                       UPDATE     72
      TIN(JYG+1)=XSTATE(JSGV+3)*DDAT(JGG+13)+XSTATE(JSGV+4)*DDAT(JGG+14)UPDATE     73
     + +XSTATE(JSGV+5)*DDAT(JGG+15)                                     UPDATE     74
      TIN(JYG+1)=TIN(JYG+1)+XSTATE(JSGV+6)*DDAT(JGG+16)                 UPDATE     75
      TIN(JYG+1)=TIN(JYG+1)*DDAT(JGG+7)                                 UPDATE     76
C                                                                       UPDATE     77
      CVP(JYP+2)=XSTATE(JSGV+2)                                         UPDATE     78
C                                                                       UPDATE     79
C     NOTE THAT THE FOLLOWING CODE MAY BE RECOGNIZED AS UNREACHABLE     UPDATE     80
C     IN ETMSP VERSIONS, BUT KEEP THEM IN. OTHERWISE LTSP WILL HAVE     UPDATE     81
C     PROBLEM.                                                          UPDATE     82
C                                                                       UPDATE     83
      IF(IGVNB.NE.0)IGVN=IGVNB                                          UPDATE     84
      GOTO 900                                                          UPDATE     85
 500  CONTINUE                                                          UPDATE     86
C                                                                       UPDATE     87
C   TYPE 5                                                              UPDATE     88
C                                                                       UPDATE     89
      JGGM1=JCONTA(2,N-1)                                               UPDATE     90
      JST4=IDDAT(JGG)                                                   UPDATE     91
      TIN(JYG+1)=XSTATE(JST4+2)*DDAT(JGG+1)+XSTATE(JST4+3)              UPDATE     92
     + *DDAT(JGG+2)+XSTATE(JST4+4)*DDAT(JGG+3)                          UPDATE     93
      TIN(JYG+1)=TIN(JYG+1)*DDAT(JGG+4)                                 UPDATE     94
C                                                                       UPDATE     95
C     NOTE THAT THE FOLLOWING CODE MAY BE RECOGNIZED AS UNREACHABLE     UPDATE     96
C     IN ETMSP VERSIONS, BUT KEEP THEM IN. OTHERWISE LTSP WILL HAVE     UPDATE     97
C     PROBLEM.                                                          UPDATE     98
C                                                                       UPDATE     99
      IF(IGVNB.NE.0)IGVN=IGVNB                                          UPDATE    100
      GOTO 900                                                          UPDATE    101
 600  CONTINUE                                                          UPDATE    102
C                                                                       UPDATE    103
C   TYPE 6, 7                                                           UPDATE    104
C                                                                       UPDATE    105
      TIN(JYG+1)=(XSTATE(JSGV+2)-DDAT(JGG+7)*DOMPU)*DDAT(JGG+5)         UPDATE    106
      GOTO 900                                                          UPDATE    107
 800  CONTINUE                                                          UPDATE    108
C                                                                       UPDATE    109
C   TYPE 20                                                             UPDATE    110
C                                                                       UPDATE    111
      WPUI=1.0/(1.0+DOMPU)                                              UPDATE    112
      UDG=XSTATE(JSGV+3)/XSTATE(JSGV+4)                                 UPDATE    113
      UDG=UDG*UDG                                                       UPDATE    114
      TIN(JYG+1)=UDG*DDAT(JGG+7)*WPUI*(XSTATE(JSGV+3)-DDAT(JGG+19))     UPDATE    115
      GOTO 900                                                          UPDATE    116
 810  CONTINUE                                                          UPDATE    117
C                                                                       UPDATE    118
C   TYPE 21                                                             UPDATE    119
C                                                                       UPDATE    120
      TIN(JYG+1)=DDAT(JGG+1)*XSTATE(JSGV+4)                             UPDATE    121
      GOTO 900                                                          UPDATE    122
C                                                                       UPDATE    123
C   TYPE 22                                                             UPDATE    124
C                                                                       UPDATE    125
 840  CONTINUE                                                          UPDATE    126
C                                                                       UPDATE    127
C   CALCULATE INPUT TO THE SUMMATION                                    UPDATE    128
C                                                                       UPDATE    129
      NXS=1                                                             UPDATE    130
      XIN=XSTATE(JSG1+1)/(WXBASE*DDAT(JGG+2))                           UPDATE    131
      IF (IDDAT(JGG+3).NE.0) THEN                                       UPDATE    132
         NXS=NXS+1                                                      UPDATE    133
         X1P=(XIN-XSTATE(JSGV+1))/DDAT(JGG+3)                           UPDATE    134
         XIN=XSTATE(JSGV+1)+DDAT(JGG+4)*X1P                             UPDATE    135
         IF (IDDAT(JGG+5).NE.0) THEN                                    UPDATE    136
            NXS=NXS+1                                                   UPDATE    137
            X2P=(XIN-XSTATE(JSGV+2))/DDAT(JGG+5)                        UPDATE    138
            XIN=XSTATE(JSGV+2)+DDAT(JGG+6)*X2P                          UPDATE    139
         END IF                                                         UPDATE    140
      END IF                                                            UPDATE    141
C                                                                       UPDATE    142
      PGV=XLDREF(JYP+1)-XIN                                             UPDATE    143
      IF (PGV.GT.DDAT(JGG+7)) PGV=DDAT(JGG+7)                           UPDATE    144
      IF (PGV.LT.DDAT(JGG+8)) PGV=DDAT(JGG+8)                           UPDATE    145
      TIN(JYG+1)=DDAT(JGG+1)*(PGV*DDAT(JGG+10)+XSTATE(JSGV+NXS)*        UPDATE    146
     +DDAT(JGG+11))                                                     UPDATE    147
      GOTO 900                                                          UPDATE    148
C                                                                       UPDATE    149
      ENDIF                                                             UPDATE    150
C                                                                       UPDATE    151
 900  CONTINUE                                                          UPDATE    152
C                                                                       UPDATE    153
      RETURN                                                            UPDATE    154
      END                                                               UPDATE    155
