CFPRIME GSPCHK                                                          GSPCHK      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 GSPCHK                                                 GSPCHK      3
CD                                                                      GSPCHK      4
CD    THIS ROUTINE PERFORMS THE FOLLOWING                               GSPCHK      5
CD                                                                      GSPCHK      6
CD    1. CHECK THE SPEEDS OF GENERATORS. THE SIMULATION IS TERMINATED   GSPCHK      7
CD       IF ANY OF GENERATOR SPEED EXCEEDS THE SET LIMIT.               GSPCHK      8
CD                                                                      GSPCHK      9
CD    2. CHECK THE UNDER-VOLTAGE TRIPPING CONDITION FOR INDUCTION       GSPCHK     10
CD       MOTORS.                                                        GSPCHK     11
CD                                                                      GSPCHK     12
      INCLUDE 'PARX.INS'                                                GSPCHK     13
      INCLUDE 'CNPT.INS'                                                GSPCHK     14
      INCLUDE 'CNIPTR.INS'                                              GSPCHK     15
      INCLUDE 'CNSTN.INS'                                               GSPCHK     16
      INCLUDE 'CNB1.INS'                                                GSPCHK     17
      INCLUDE 'CNB4.INS'                                                GSPCHK     18
      INCLUDE 'CNB8.INS'                                                GSPCHK     19
      INCLUDE 'CNB19.INS'                                               GSPCHK     20
      INCLUDE 'CNUNIT.INS'                                              GSPCHK     21
      INCLUDE 'CNMDAT.INS'                                              GSPCHK     22
      INCLUDE 'CNMSTA.INS'                                              GSPCHK     23
      INCLUDE 'CNXSTA.INS'                                              GSPCHK     24
      INCLUDE 'CNMSG.INS'                                               GSPCHK     25
      INCLUDE 'CNGEAR.INS'                                              GSPCHK     26
      INCLUDE 'CNMPAR.INS'                                              GSPCHK     27
      INCLUDE 'CNVOLT.INS'                                              GSPCHK     28
      INCLUDE 'CNYVAR.INS'                                              GSPCHK     29
      INCLUDE 'CNFLAG.INS'                                              GSPCHK     30
      INCLUDE 'CNAUTO.INS'                                              GSPCHK     31
C                                                                       GSPCHK     32
      CHARACTER*4 CID                                                   GSPCHK     33
C                                                                       GSPCHK     34
      LDEB=.FALSE.                                                      GSPCHK     35
C                                                                       GSPCHK     36
C     CHECK MACHINES REPRESENTED IN DETAILED FORM                       GSPCHK     37
C                                                                       GSPCHK     38
      DO 30 K=1,IPNODE                                                  GSPCHK     39
      N=NTHG(K)-1                                                       GSPCHK     40
      NEND=NTHG(K+1)-1                                                  GSPCHK     41
 10   N=N+1                                                             GSPCHK     42
      JSTATE=MSTATE(1,N)                                                GSPCHK     43
      JG=JCONTA(1,N)                                                    GSPCHK     44
      HM=DDAT(JG+1)                                                     GSPCHK     45
      IF(HM.LT.1.0E-5)GOTO 20                                           GSPCHK     46
      IF(ABS(XSTATE(JSTATE+1)).LT.XMAXSD)GOTO 20                        GSPCHK     47
      ITSTRN=1                                                          GSPCHK     48
      AXSP=XMAXSD/WOBASE                                                GSPCHK     49
      KN=K*3                                                            GSPCHK     50
      NLF=NOLD(K)                                                       GSPCHK     51
      CID(1:2)=NDGC(N)(3:4)                                             GSPCHK     52
      WRITE(MSG(1),5000) TS                                             GSPCHK     53
      WRITE(MSG(2),5010) NLF,INAME(KN-2),INAME(KN-1),INAME(KN),CID      GSPCHK     54
      WRITE(MSG(3),5020) AXSP                                           GSPCHK     55
      CALL PRTMSG(3)                                                    GSPCHK     56
 20   CONTINUE                                                          GSPCHK     57
      IF(N.LT.NEND)GOTO 10                                              GSPCHK     58
 30   CONTINUE                                                          GSPCHK     59
C                                                                       GSPCHK     60
C                                                                       GSPCHK     61
C     CHECK INDUCTION MOTOR                                             GSPCHK     62
C                                                                       GSPCHK     63
C     NOTE: IF DDAT(JM+34) IS NEGATIVE, THE MOTOR IS IN NORMAL STATUS   GSPCHK     64
C           IF DDAT(JM+34) HAS ANY NON-NEGATIVE VALUE, THE MOTOR        GSPCHK     65
C              TERMINAL VOLTAGE IS LOWER THAN THE THRESHOLD VALUE AND   GSPCHK     66
C              THE TIMER IS ON                                          GSPCHK     67
C           IF DDAT(JM+15)=TI < 0, THE MOTOR HAS ALREADY BEEN TRIPPED   GSPCHK     68
C           IF DDAT(JM+14) < 0.0, THE MOTOR DOES NOT HAVE THE LOW       GSPCHK     69
C              VOLTAGE TRIPPING FEATURE                                 GSPCHK     70
C                                                                       GSPCHK     71
      IF (NMOTL.EQ.0) GOTO 210                                          GSPCHK     72
      DO 200 I=1,NMOTL                                                  GSPCHK     73
         JM=JMDAT(I)                                                    GSPCHK     74
         IF (DDAT(JM+14).LT.0.0.OR.DDAT(JM+15).LT.0.0) GOTO 200         GSPCHK     75
         IF (DDAT(JM+35) .EQ. -1.0) GOTO 200                            GSPCHK     76
         IF (DDAT(JM+34).GE.0.0) THEN                                   GSPCHK     77
            TLAST=TS-DDAT(JM+34)                                        GSPCHK     78
            IF (TLAST.GE.DDAT(JM+15)) THEN                              GSPCHK     79
               DDAT(JM+15)=-TS-0.001                                    GSPCHK     80
               JY=JVIMO(I)                                              GSPCHK     81
               CDM(JY+8)=0.0                                            GSPCHK     82
               CDM(JY+9)=0.0                                            GSPCHK     83
               JIMLVT=JIMLVT+1                                          GSPCHK     84
               KK=NMOLD(I)                                              GSPCHK     85
               KN=3*KK                                                  GSPCHK     86
               WRITE(MSG(1),5100) NOLD(KK),INAME(KN-2),INAME(KN-1)      GSPCHK     87
     1                           ,INAME(KN),NDMC(I)                     GSPCHK     88
               WRITE(MSG(2),5110) TS                                    GSPCHK     89
               WRITE(MSG(3),5120)                                       GSPCHK     90
               CALL PRTMSG(3)                                           GSPCHK     91
               GOTO 200                                                 GSPCHK     92
            END IF                                                      GSPCHK     93
         END IF                                                         GSPCHK     94
         KK=NMOLD(I)                                                    GSPCHK     95
         MOTYPK=IDDAT(JM+1)                                             GSPCHK     96
         IF (MOTYPK.LT.10) THEN                                         GSPCHK     97
            VTM=CABS(VOLT(KK))                                          GSPCHK     98
         ELSE                                                           GSPCHK     99
            WS1=DDAT(JM+37)                                             GSPCHK    100
            WS2=DDAT(JM+38)                                             GSPCHK    101
            VTM=SQRT(WS1*WS1+WS2*WS2)                                   GSPCHK    102
         END IF                                                         GSPCHK    103
C                                                                       GSPCHK    104
         IF (VTM.GE.DDAT(JM+14).AND.DDAT(JM+34).GE.0.0) THEN            GSPCHK    105
            DDAT(JM+34)=-1.0                                            GSPCHK    106
         ELSE IF (VTM.LT.DDAT(JM+14).AND.DDAT(JM+34).LT.0.0) THEN       GSPCHK    107
            DDAT(JM+34)=TS                                              GSPCHK    108
            IF (DDAT(JM+15).LT.H) THEN                                  GSPCHK    109
               DDAT(JM+15)=-TS-0.001                                    GSPCHK    110
               JY=JVIMO(I)                                              GSPCHK    111
               CDM(JY+8)=0.0                                            GSPCHK    112
               CDM(JY+9)=0.0                                            GSPCHK    113
               JIMLVT=JIMLVT+1                                          GSPCHK    114
               KN=3*KK                                                  GSPCHK    115
               WRITE(MSG(1),5100) NOLD(KK),INAME(KN-2),INAME(KN-1)      GSPCHK    116
     1                           ,INAME(KN),NDMC(I)                     GSPCHK    117
               WRITE(MSG(2),5110) TS                                    GSPCHK    118
               WRITE(MSG(3),5120)                                       GSPCHK    119
               CALL PRTMSG(3)                                           GSPCHK    120
            END IF                                                      GSPCHK    121
         END IF                                                         GSPCHK    122
C                                                                       GSPCHK    123
  200 CONTINUE                                                          GSPCHK    124
  210 CONTINUE                                                          GSPCHK    125
C                                                                       GSPCHK    126
C     CHECK IF ANY INDUCTION MOTORS ARE TO BE REMOVED FROM NETWORK      GSPCHK    127
C                                                                       GSPCHK    128
C     NOTE:                                                             GSPCHK    129
C          DDAT(JM+15) >= 0.0                                           GSPCHK    130
C              THE INDUCTION MOTOR IS IN THE NORMAL OPERATION MODE      GSPCHK    131
C                                                                       GSPCHK    132
C          -999998.0 < DDAT(JM+15) < 0.0                                GSPCHK    133
C              THE INDUCTION MOTOR HAS BEEN TRIPPED, BUT THE SOURCE     GSPCHK    134
C              ADMITTANCE IS STILL IN THE NETWORK                       GSPCHK    135
C                                                                       GSPCHK    136
C          DDAT(JM+15) < -999998.0                                      GSPCHK    137
C              THE INDUCTION MOTOR HAS BEEN TRIPPED, AND THE SOURCE     GSPCHK    138
C              ADMITTANCE HAS ALSO BEEN TAKEN AWAY FROM THE NETWORK     GSPCHK    139
C                                                                       GSPCHK    140
      IF (NMOTL.EQ.0) GOTO 310                                          GSPCHK    141
      IF (JIMLVT.LT.NIMLVT) GOTO 310                                    GSPCHK    142
      JIMLVT=0                                                          GSPCHK    143
      DO 300 I=1,NMOTL                                                  GSPCHK    144
         JM=JMDAT(I)                                                    GSPCHK    145
         IF (DDAT(JM+15).GE.0.0.OR.DDAT(JM+15).LT.-999998.0) GOTO 300   GSPCHK    146
         DDAT(JM+15)=-999999.0                                          GSPCHK    147
         KK=NMOLD(I)                                                    GSPCHK    148
         IF(IASWX.EQ.0)THEN                                             GSPCHK    149
           WRITE(ISWFA,5500)TS                                          GSPCHK    150
           NAWR=NAWR+1                                                  GSPCHK    151
           IASWX=1                                                      GSPCHK    152
         ENDIF                                                          GSPCHK    153
         WRITE(ISWFA,5600)'DIM',KK,I,NDMC(I)(3:4)                       GSPCHK    154
         NAWR=NAWR+1                                                    GSPCHK    155
  300 CONTINUE                                                          GSPCHK    156
  310 CONTINUE                                                          GSPCHK    157
C                                                                       GSPCHK    158
      RETURN                                                            GSPCHK    159
 5000 FORMAT(' *** TIME = ',F9.4,' SECONDS: THE SIMULATION WILL BE',    GSPCHK    160
     1' TERMINATED AS THE SPEED')                                       GSPCHK    161
 5010 FORMAT('     OF GENERATOR AT BUS ',I5,' STATION: ',3A4,' GID',A2) GSPCHK    162
 5020 FORMAT('     HAS EXCEEDED THE SET LIMIT OF ',F7.5,' P.U.')        GSPCHK    163
 5100 FORMAT(' *** INDUCTION MOTOR AT BUS ',I5,' NAME ',3A4,' MID ',A4) GSPCHK    164
 5110 FORMAT('     IS TRIPPED AT TIME =',F8.3,' SECONDS BY '            GSPCHK    165
     1,'UNDER-VOLTAGE TRIPPING ACTION.')                                GSPCHK    166
 5120 FORMAT('     MOTOR SOURCE ADMITTANCE IS COMPENSATED TO AVOID',    GSPCHK    167
     1' NETWORK REFACTORIZATION.')                                      GSPCHK    168
 5500 FORMAT(F10.5)                                                     GSPCHK    169
 5600 FORMAT(A3,1X,2I5,3X,A2)                                           GSPCHK    170
      END                                                               GSPCHK    171
