CFPRIME SCHECK                                                          SCHECK      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 SCHECK(H)                                              SCHECK      3
CD                                                                      SCHECK      4
CD    TO PERFORM THE VOLTAGE LIMIT CHECK.                               SCHECK      5
CD    ROUTINE INPUT H IS THE INTEGRATION INTERVAL SIZE.                 SCHECK      6
CD                                                                      SCHECK      7
      INCLUDE 'PARX.INS'                                                SCHECK      8
      INCLUDE 'CNPT.INS'                                                SCHECK      9
      INCLUDE 'CNIPTR.INS'                                              SCHECK     10
      INCLUDE 'CNSTN.INS'                                               SCHECK     11
      INCLUDE 'CNB4.INS'                                                SCHECK     12
      INCLUDE 'CNB19.INS'                                               SCHECK     13
      INCLUDE 'CNUNIT.INS'                                              SCHECK     14
      INCLUDE 'CNVOLT.INS'                                              SCHECK     15
      INCLUDE 'CNVMAX.INS'                                              SCHECK     16
      INCLUDE 'CNPARX.INS'                                              SCHECK     17
      INCLUDE 'CNSPC1.INS'                                              SCHECK     18
C                                                                       SCHECK     19
      COMMON /LBVXXX/ LBV                                               SCHECK     20
C                                                                       SCHECK     21
      DATA ILDEF/60/                                                    SCHECK     22
CD                                                                      SCHECK     23
CD    STEP 1. CHECK GENERATOR BUS VOLTAGE                               SCHECK     24
CD                                                                      SCHECK     25
C                                                                       SCHECK     26
C     LBV IS THE FLAG FOR IMMEDIATE PRINTING WHICH WILL BE NONZERO      SCHECK     27
C     WHENEVER BUS(NOT ALREADY IN THE LIST) VOLTAGE EXCEEDS OR BELOW    SCHECK     28
C     THE LIMITS                                                        SCHECK     29
C                                                                       SCHECK     30
      LBV=0                                                             SCHECK     31
C                                                                       SCHECK     32
      DO 100 K=1,IPNODX-1                                               SCHECK     33
C                                                                       SCHECK     34
      EC=CABS(VOLT(K))                                                  SCHECK     35
C                                                                       SCHECK     36
      IF(EC.LT.GVTMIN)THEN                                              SCHECK     37
CD                                                                      SCHECK     38
CD        FOR BUS VOLTAGE LESS THAN GVTMIN                              SCHECK     39
CD                                                                      SCHECK     40
CD        CHECK AND STORE BUS VOLTAGE IF IT IS ALREADY ON THE LIST      SCHECK     41
CD                                                                      SCHECK     42
      IVMAXK=IVMAX(K)                                                   SCHECK     43
C                                                                       SCHECK     44
            IF(IVMAXK.EQ.0)THEN                                         SCHECK     45
            IVMAX(K)=JVLAST                                             SCHECK     46
            VMTI(JVLAST+1)=EC                                           SCHECK     47
            VMTI(JVLAST+2)=TS                                           SCHECK     48
            JVLAST=JVLAST+4                                             SCHECK     49
C                                                                       SCHECK     50
            ELSE                                                        SCHECK     51
CD                                                                      SCHECK     52
CD        CHECK AND STORE IF BUS VOLTAGE IS LOWER THAN PREVIOUS VALUE   SCHECK     53
CD                                                                      SCHECK     54
            IF(EC.GE.VMTI(IVMAXK+1))GOTO 100                            SCHECK     55
            VMTI(IVMAXK+1)=EC                                           SCHECK     56
            VMTI(IVMAXK+2)=TS                                           SCHECK     57
            ENDIF                                                       SCHECK     58
C                                                                       SCHECK     59
C                                                                       SCHECK     60
      ELSEIF(EC.GT.GVTMAX)THEN                                          SCHECK     61
CD                                                                      SCHECK     62
CD        FOR BUS VOLTAGE HIGHER THAN GVTMAX                            SCHECK     63
CD                                                                      SCHECK     64
CD        CHECK AND STORE BUS VOLTAGE IF IT IS ALREADY ON THE LIST      SCHECK     65
CD                                                                      SCHECK     66
      IVMAXK=IVMAX(K)                                                   SCHECK     67
C                                                                       SCHECK     68
            IF(IVMAXK.EQ.0)THEN                                         SCHECK     69
            IVMAX(K)=JVLAST                                             SCHECK     70
            VMTI(JVLAST+3)=EC                                           SCHECK     71
            VMTI(JVLAST+4)=TS                                           SCHECK     72
            JVLAST=JVLAST+4                                             SCHECK     73
C                                                                       SCHECK     74
            ELSE                                                        SCHECK     75
CD                                                                      SCHECK     76
CD        CHECK AND STORE IF BUS VOLTAGE IS HIGHER THAN PREVIOUS VALUE  SCHECK     77
CD                                                                      SCHECK     78
            IF(EC.LE.VMTI(IVMAXK+3))GOTO 100                            SCHECK     79
            VMTI(IVMAXK+3)=EC                                           SCHECK     80
            VMTI(IVMAXK+4)=TS                                           SCHECK     81
            ENDIF                                                       SCHECK     82
C                                                                       SCHECK     83
      ELSE                                                              SCHECK     84
C                                                                       SCHECK     85
      GOTO 100                                                          SCHECK     86
C                                                                       SCHECK     87
      ENDIF                                                             SCHECK     88
C                                                                       SCHECK     89
      LBV=K                                                             SCHECK     90
C                                                                       SCHECK     91
  100 CONTINUE                                                          SCHECK     92
CD                                                                      SCHECK     93
CD    STEP 2. VOLTAGES OF OTHER CALCULATED BUSES                        SCHECK     94
CD                                                                      SCHECK     95
      DO 200 K=IPNODX,LASTV2                                            SCHECK     96
C                                                                       SCHECK     97
      EC=CABS(VOLT(K))                                                  SCHECK     98
C                                                                       SCHECK     99
      IF(EC.LT.BUVMIN)THEN                                              SCHECK    100
CD                                                                      SCHECK    101
CD        FOR BUS VOLTAGE LOWER THAN BUVMIN                             SCHECK    102
CD                                                                      SCHECK    103
CD        CHECK AND STORE BUS VOLTAGE IF IT IS ALREADY ON THE LIST      SCHECK    104
CD                                                                      SCHECK    105
CD                                                                      SCHECK    106
      IVMAXK=IVMAX(K)                                                   SCHECK    107
C                                                                       SCHECK    108
            IF(IVMAXK.EQ.0)THEN                                         SCHECK    109
            IVMAX(K)=JVLAST                                             SCHECK    110
            VMTI(JVLAST+1)=EC                                           SCHECK    111
            VMTI(JVLAST+2)=TS                                           SCHECK    112
            JVLAST=JVLAST+4                                             SCHECK    113
C                                                                       SCHECK    114
            ELSE                                                        SCHECK    115
CD                                                                      SCHECK    116
CD        CHECK AND STORE IF BUS VOLTAGE IS LOWER THAN PREVIOUS VALUE   SCHECK    117
CD                                                                      SCHECK    118
            IF(EC.GE.VMTI(IVMAXK+1))GOTO 200                            SCHECK    119
            VMTI(IVMAXK+1)=EC                                           SCHECK    120
            VMTI(IVMAXK+2)=TS                                           SCHECK    121
            ENDIF                                                       SCHECK    122
C                                                                       SCHECK    123
C                                                                       SCHECK    124
      ELSEIF(EC.GT.BUVMAX)THEN                                          SCHECK    125
CD                                                                      SCHECK    126
CD        FOR BUS VOLTAGE HIGHER THAN BUVMAX                            SCHECK    127
CD                                                                      SCHECK    128
CD        CHECK AND STORE BUS VOLTAGE IF IT IS ALREADY ON THE LIST      SCHECK    129
CD                                                                      SCHECK    130
      IVMAXK=IVMAX(K)                                                   SCHECK    131
C                                                                       SCHECK    132
            IF(IVMAXK.EQ.0)THEN                                         SCHECK    133
            IVMAX(K)=JVLAST                                             SCHECK    134
            VMTI(JVLAST+3)=EC                                           SCHECK    135
            VMTI(JVLAST+4)=TS                                           SCHECK    136
            JVLAST=JVLAST+4                                             SCHECK    137
C                                                                       SCHECK    138
            ELSE                                                        SCHECK    139
CD                                                                      SCHECK    140
CD        CHECK AND STORE IF BUS VOLTAGE IS HIGHER THAN PREVIOUS VALUE  SCHECK    141
CD                                                                      SCHECK    142
            IF(EC.LE.VMTI(IVMAXK+3))GOTO 200                            SCHECK    143
            VMTI(IVMAXK+3)=EC                                           SCHECK    144
            VMTI(IVMAXK+4)=TS                                           SCHECK    145
C                                                                       SCHECK    146
            ENDIF                                                       SCHECK    147
      ELSE                                                              SCHECK    148
        GOTO 200                                                        SCHECK    149
C                                                                       SCHECK    150
      ENDIF                                                             SCHECK    151
C                                                                       SCHECK    152
      LBV=K                                                             SCHECK    153
C                                                                       SCHECK    154
  200 CONTINUE                                                          SCHECK    155
C                                                                       SCHECK    156
      IVLAST=MAX0(IVLAST,LBV)                                           SCHECK    157
C                                                                       SCHECK    158
      DO 210 I=1,NVADD                                                  SCHECK    159
C                                                                       SCHECK    160
      K=IVADD(I)                                                        SCHECK    161
C                                                                       SCHECK    162
      EC=CABS(VOLT(K))                                                  SCHECK    163
C                                                                       SCHECK    164
      IF(EC.LT.BUVMIN)THEN                                              SCHECK    165
CD                                                                      SCHECK    166
CD        FOR BUS VOLTAGE LOWER THAN BUVMIN                             SCHECK    167
CD                                                                      SCHECK    168
CD        CHECK AND STORE BUS VOLTAGE IF IT IS ALREADY ON THE LIST      SCHECK    169
CD                                                                      SCHECK    170
CD                                                                      SCHECK    171
      IVMAXK=IVMAX(K)                                                   SCHECK    172
C                                                                       SCHECK    173
            IF(IVMAXK.EQ.0)THEN                                         SCHECK    174
            IVMAX(K)=JVLAST                                             SCHECK    175
            VMTI(JVLAST+1)=EC                                           SCHECK    176
            VMTI(JVLAST+2)=TS                                           SCHECK    177
            JVLAST=JVLAST+4                                             SCHECK    178
C                                                                       SCHECK    179
            ELSE                                                        SCHECK    180
CD                                                                      SCHECK    181
CD        CHECK AND STORE IF BUS VOLTAGE IS LOWER THAN PREVIOUS VALUE   SCHECK    182
CD                                                                      SCHECK    183
            IF(EC.GE.VMTI(IVMAXK+1))GOTO 210                            SCHECK    184
            VMTI(IVMAXK+1)=EC                                           SCHECK    185
            VMTI(IVMAXK+2)=TS                                           SCHECK    186
            ENDIF                                                       SCHECK    187
C                                                                       SCHECK    188
C                                                                       SCHECK    189
      ELSEIF(EC.GT.BUVMAX)THEN                                          SCHECK    190
CD                                                                      SCHECK    191
CD        FOR BUS VOLTAGE HIGHER THAN BUVMAX                            SCHECK    192
CD                                                                      SCHECK    193
CD        CHECK AND STORE BUS VOLTAGE IF IT IS ALREADY ON THE LIST      SCHECK    194
CD                                                                      SCHECK    195
      IVMAXK=IVMAX(K)                                                   SCHECK    196
C                                                                       SCHECK    197
            IF(IVMAXK.EQ.0)THEN                                         SCHECK    198
            IVMAX(K)=JVLAST                                             SCHECK    199
            VMTI(JVLAST+3)=EC                                           SCHECK    200
            VMTI(JVLAST+4)=TS                                           SCHECK    201
            JVLAST=JVLAST+4                                             SCHECK    202
C                                                                       SCHECK    203
            ELSE                                                        SCHECK    204
CD                                                                      SCHECK    205
CD        CHECK AND STORE IF BUS VOLTAGE IS HIGHER THAN PREVIOUS VALUE  SCHECK    206
CD                                                                      SCHECK    207
            IF(EC.LE.VMTI(IVMAXK+3))GOTO 210                            SCHECK    208
            VMTI(IVMAXK+3)=EC                                           SCHECK    209
            VMTI(IVMAXK+4)=TS                                           SCHECK    210
C                                                                       SCHECK    211
            ENDIF                                                       SCHECK    212
      ELSE                                                              SCHECK    213
        GOTO 210                                                        SCHECK    214
C                                                                       SCHECK    215
      ENDIF                                                             SCHECK    216
C                                                                       SCHECK    217
      IVLAST=MAX0(IVLAST,K)                                             SCHECK    218
C                                                                       SCHECK    219
  210 CONTINUE                                                          SCHECK    220
C                                                                       SCHECK    221
      RETURN                                                            SCHECK    222
C                                                                       SCHECK    223
      ENTRY PVMXMN(IL)                                                  SCHECK    224
C                                                                       SCHECK    225
      IF(LBV.EQ.0)RETURN                                                SCHECK    226
CD                                                                      SCHECK    227
CD     STEP 3. PRINT MIN VOLTAGE BUS                                    SCHECK    228
CD                                                                      SCHECK    229
      KK=0                                                              SCHECK    230
      DO 300 K=1,IVLAST                                                 SCHECK    231
         IVMAXK=IVMAX(K)                                                SCHECK    232
         IF(IVMAXK.EQ.0.OR.IVMTI(IVMAXK+1).EQ.0) GOTO 300               SCHECK    233
         KK=KK+1                                                        SCHECK    234
         IF(IL.LT.100.OR.IL.GE.ILDEF+100)THEN                           SCHECK    235
            IF(IL.LT.100) IL=MOD(IL,100)+104                            SCHECK    236
            IF(IL.GE.ILDEF+98)THEN                                      SCHECK    237
              CALL PAGE6                                                SCHECK    238
              IL=108                                                    SCHECK    239
            ENDIF                                                       SCHECK    240
            WRITE(IU6,2000)                                             SCHECK    241
         ENDIF                                                          SCHECK    242
         NLF=NOLD(K)                                                    SCHECK    243
         K3=K*3                                                         SCHECK    244
         IF(KK.EQ.1)THEN                                                SCHECK    245
            WRITE(IU6,2030)NLF,INAME(K3-2),INAME(K3-1),INAME(K3)        SCHECK    246
     *         ,VMTI(IVMAXK+2),VMTI(IVMAXK+1)                           SCHECK    247
         ELSEIF(KK.EQ.2)THEN                                            SCHECK    248
            WRITE(IU6,2040)NLF,INAME(K3-2),INAME(K3-1),INAME(K3)        SCHECK    249
     *         ,VMTI(IVMAXK+2),VMTI(IVMAXK+1)                           SCHECK    250
         ELSE                                                           SCHECK    251
            KK=0                                                        SCHECK    252
            IL=IL+1                                                     SCHECK    253
            WRITE(IU6,2050) NLF,INAME(K3-2),INAME(K3-1),INAME(K3)       SCHECK    254
     *         ,VMTI(IVMAXK+2),VMTI(IVMAXK+1)                           SCHECK    255
         ENDIF                                                          SCHECK    256
 300  CONTINUE                                                          SCHECK    257
C                                                                       SCHECK    258
      IF(KK.NE.0)THEN                                                   SCHECK    259
         KK=0                                                           SCHECK    260
         IL=IL+1                                                        SCHECK    261
       ENDIF                                                            SCHECK    262
CD                                                                      SCHECK    263
CD    STEP 5. PRINT MAX VOLTAGE BUS                                     SCHECK    264
CD                                                                      SCHECK    265
      DO 400 K=1,IVLAST                                                 SCHECK    266
         IVMAXK=IVMAX(K)                                                SCHECK    267
         IF(IVMAXK.EQ.0.OR.IVMTI(IVMAXK+3).EQ.0) GOTO 400               SCHECK    268
         KK=KK+1                                                        SCHECK    269
         IF(IL.LT.200.OR.IL.GE.ILDEF+200)THEN                           SCHECK    270
           IF(IL.LT.200) IL=MOD(IL,100)+204                             SCHECK    271
           IF(IL .GE.ILDEF+198)THEN                                     SCHECK    272
             CALL PAGE6                                                 SCHECK    273
             IL=208                                                     SCHECK    274
           ENDIF                                                        SCHECK    275
           WRITE(IU6,2020)                                              SCHECK    276
         ENDIF                                                          SCHECK    277
         NLF=NOLD(K)                                                    SCHECK    278
         K3=K*3                                                         SCHECK    279
         IF(KK.EQ.1)THEN                                                SCHECK    280
            WRITE(IU6,2030) NLF,INAME(K3-2),INAME(K3-1),INAME(K3)       SCHECK    281
     *         ,VMTI(IVMAXK+4),VMTI(IVMAXK+3)                           SCHECK    282
         ELSEIF(KK.EQ.2)THEN                                            SCHECK    283
            WRITE(IU6,2040) NLF,INAME(K3-2),INAME(K3-1),INAME(K3)       SCHECK    284
     *         ,VMTI(IVMAXK+4),VMTI(IVMAXK+3)                           SCHECK    285
         ELSE                                                           SCHECK    286
            KK=0                                                        SCHECK    287
            IL=IL+1                                                     SCHECK    288
            WRITE(IU6,2050)NLF,INAME(K3-2),INAME(K3-1),INAME(K3)        SCHECK    289
     *         ,VMTI(IVMAXK+4),VMTI(IVMAXK+3)                           SCHECK    290
         ENDIF                                                          SCHECK    291
 400  CONTINUE                                                          SCHECK    292
      IF(KK.NE.0) IL=IL+1                                               SCHECK    293
C                                                                       SCHECK    294
      RETURN                                                            SCHECK    295
C                                                                       SCHECK    296
      ENTRY ISCHEC                                                      SCHECK    297
CD                                                                      SCHECK    298
CD    TO INITIALIZE ARRAYS AND COUNTERS.                                SCHECK    299
CD                                                                      SCHECK    300
      IVLAST=0                                                          SCHECK    301
      JVLAST=0                                                          SCHECK    302
      CALL HMOVE(0,IVMAX,IVMAX,NXB)                                     SCHECK    303
      CALL FMOVE(0,VMTI,VMTI,MONL4)                                     SCHECK    304
C                                                                       SCHECK    305
      RETURN                                                            SCHECK    306
C                                                                       SCHECK    307
 2000 FORMAT(/41X,'***** BUSES WITH VOLTAGE BELOW LIMIT *****'          SCHECK    308
     1,/,3('  BUS# STATION NAME AT TIME VOLTAGE MAG.  ')                SCHECK    309
     &,/,3(' ----- ',12('-'),1X,7('-'),1X,12('-'),2X))                  SCHECK    310
 2010 FORMAT(3(I6,1X,3A4,F8.2,1X,F12.4,2X))                             SCHECK    311
 2020 FORMAT(/41X,'***** BUSES WITH VOLTAGE ABOVE LIMIT *****'          SCHECK    312
     1,/,3('  BUS# STATION NAME AT TIME VOLTAGE MAG.  ')                SCHECK    313
     &,/,3(' ----- ',12('-'),1X,7('-'),1X,12('-'),2X))                  SCHECK    314
 2030 FORMAT(I6,1X,3A4,F8.2,1X,F12.4)                                   SCHECK    315
 2040 FORMAT('+',T42,I6,1X,3A4,F8.2,1X,F12.4)                           SCHECK    316
 2050 FORMAT('+',T84,I6,1X,3A4,F8.2,1X,F12.4)                           SCHECK    317
C                                                                       SCHECK    318
      END                                                               SCHECK    319
