CFPRIME SCGINT                                                          SCGINT      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 SCGINT(IEBK)                                           SCGINT      3
CD                                                                      SCGINT      4
CD    THIS SUBROUTINE INITIALIZES THE SERIES CAPACITOR GAP RELAY GAP.   SCGINT      5
CD    IT ALSO SEARCHES THE REMOTE RELAY TABLES TO FIND THE INDICES OF   SCGINT      6
CD    THE REMOTE RELAYS FOR THIS RELAY.                                 SCGINT      7
CD                                                                      SCGINT      8
CD    IEBK IS THE ERROR INDICATOR                                       SCGINT      9
CD    IEBK = 0 NO ERROR                                                 SCGINT     10
CD    IEBK = 1 WHEN SPECIFIED LINE CANNOT BE FOUND IN LOADFLOW          SCGINT     11
CD                                                                      SCGINT     12
CD                                                                      SCGINT     13
CD     LSCGRE          Starting position of IDATPT array  of SCGR relay SCGINT     14
CD                     scheme, LSCGRE is in the common labelled PT of   SCGINT     15
CD                     include file CNPT.                               SCGINT     16
CD                                                                      SCGINT     17
CD     NSCGRE          Finishing position of IDATPT array of SCGR relay SCGINT     18
CD                     scheme, NSCGRE is in common labelled AUTO of     SCGINT     19
CD                     include file CNAUTO.                             SCGINT     20
CD                                                                      SCGINT     21
CD     let k = k-th SCGR RELAY                                          SCGINT     22
CD                                                                      SCGINT     23
CD     N = IDATPT(k)    IDATPT is the array that stores the start       SCGINT     24
CD                      position of the K-TH SCGR relay scheme data     SCGINT     25
CD                                                                      SCGINT     26
CD                                                                      SCGINT     27
CD ADATA(N+1)=ICD1RG     LOCAL RELAY TRIP STATUS:                       SCGINT     28
CD                       1 = CAPACITOR GAP NOT FIRED                    SCGINT     29
CD                       2 = CAPACITOR GAP PERMANENTLY FIRED REMOTE     SCGINT     30
CD                           RELAY NOT TRIPPED                          SCGINT     31
CD                       3 = CAPACITOR GAP PERNANEMTLY FIRED REMOTE     SCGINT     32
CD                           RELAY TRIPPED                              SCGINT     33
CD                       4 = GAP SHORTED I .GT. IFC PERM TIMER STARTED  SCGINT     34
CD                       5 = GAP SHORTED I .LT. IRE PERM TIMER STARTED  SCGINT     35
CD                       6 = GAP SHORTED I .LT. IRE REINSERTION TIMER   SCGINT     36
CD                           STARTED                                    SCGINT     37
CD                                                                      SCGINT     38
CD IADATA(N+2)=IBUSRG    LEFT HAND BUS NUMBER                           SCGINT     39
CD IADATA(N+3)=JBUSRG    RIGHT HAND BUS NUMBER                          SCGINT     40
CD IADATA(N+4)=IPARRG    PARALLEL IDENTIFICATION FOR THIS LINE          SCGINT     41
CD IADATA(N+5)(=KSECRG   SECTION IDENTIFICATION FOR THIS CAPACITOR      SCGINT     42
CD IADATA(N+6)(=NRECRG   MAXIMUM NUMBER OF REINSERTION ATTEMPTS.  CAPS  SCGINT     43
CD                       WILL BE PERMANENTLY SHORT CIRCUITED WHEN THIS  SCGINT     44
CD                       NUMBER IS REACHED.                             SCGINT     45
CD IADATA(N+7)=ICD3RG    COUNTS THE NUMBER OF REINSERTION ATTEMPTS      SCGINT     46
CD IADATA(N+8)=KBORRG    TRANSFER TRIP STATUS                           SCGINT     47
CD                       1 = 'B' REMOTE RELAY TRANSFER TRIP ACTIVATED   SCGINT     48
CD                               THE FIRST TIME THE GAP IS FIRED.       SCGINT     49
CD                       2 = 'E' REMOTE RELAY TRANSFER TRIP ACTIVATED   SCGINT     50
CD                               AFTER GAP IS PERMANENTLY SHORTED       SCGINT     51
CD                       3 = REMOTE RELAY TRANSFER TRIP ACTIVATED       SCGINT     52
CD                       4 = REMOTE RELAY TRANSFER TRIP COMPLETE        SCGINT     53
CD                                                                      SCGINT     54
CD ADATA(N+9)=GPFRG      GAP FIRING CURRENT PER UNIT                    SCGINT     55
CD                                                                      SCGINT     56
CD ADATA(N+10)=RINCRG    GAP REINSETION CURRENT PER UNIT                SCGINT     57
CD                                                                      SCGINT     58
CD ADATA(N+11)=RETDRG    REINSERTION TIME DELAY IN CYCLES.  CAPACITOR   SCGINT     59
CD                       CURRENT MUST REMAIN BELOW REINSERTION CURRENT  SCGINT     60
CD                       FOR THIS LENGTH OF TIME BEFORE CAPS ARE        SCGINT     61
CD                       REINSERTED.                                    SCGINT     62
CD                                                                      SCGINT     63
CD ADATA(N+12)=PERMRG    PERMANENT SHORTING SWITCH TIME DELAY.  IF GAP  SCGINT     64
CD                       REMAINS FIRED FOR THIS LENGTH OF TIME, IT WILL SCGINT     65
CD                       BE PERMANENTLY SHORT CIRCUITED.                SCGINT     66
CD                                                                      SCGINT     67
CD ADATA(N+13)=TIMPRG    PERMANENT SHORT CIRCUIT TIMER                  SCGINT     68
CD                                                                      SCGINT     69
CD ADATA(N+14)=TIMRRG    REINSERTION TIMER                              SCGINT     70
CD                                                                      SCGINT     71
CD ADATA(N+15)           NO. OF  REMOTE RELAY                           SCGINT     72
CD                                                                      SCGINT     73
CD ADATA(N+16)=TTRPG     REMOTE RELAY TRIP FLAG                         SCGINT     74
CD                                                                      SCGINT     75
CD                                                                      SCGINT     76
CD ADATA(N+17)=GIJARG                                                   SCGINT     77
CD ADATA(N+18)=BIJARG                                                   SCGINT     78
CD ADATA(N+19)=GIOARG    PI EQUIVALENT ADMITTANCES FOR TOTAL LINE       SCGINT     79
CD ADATA(N+20)=BIOARG                                                   SCGINT     80
CD ADATA(N+21)=GJOARG                                                   SCGINT     81
CD ADATA(N+22)=BJOARG                                                   SCGINT     82
CD                                                                      SCGINT     83
CD ADATA(N+23)=GIJPRG                                                   SCGINT     84
CD ADATA(N+24)=BIJPRG                                                   SCGINT     85
CD ADATA(N+25)=GIOPRG    PI EQUIVALENT ADMITTANCES FOR LINE SECTION     SCGINT     86
CD ADATA(N+26)=BIOPRG    TO THE LEFT OF THE CAPACITOR                   SCGINT     87
CD ADATA(N+27)=GJOPRG                                                   SCGINT     88
CD ADATA(N+28)=BJOPRG                                                   SCGINT     89
CD                                                                      SCGINT     90
CD ADATA(N+29)=GIJSRG                                                   SCGINT     91
CD ADATA(N+30)=BIJSRG                                                   SCGINT     92
CD ADATA(N+31)=GIOSRG    PI EQUIVALENT ADMITTANCES FOR TOTAL LINE       SCGINT     93
CD ADATA(N+32)=BIOSRG    WITH CAPACITOR SHORT CIRCUITED                 SCGINT     94
CD ADATA(N+33)=GJOSRG                                                   SCGINT     95
CD ADATA(N+34)=BJOSRG                                                   SCGINT     96
CD                                                                      SCGINT     97
CD                                                                      SCGINT     98
      INCLUDE 'PARX.INS'                                                SCGINT     99
      INCLUDE 'CNPT.INS'                                                SCGINT    100
      INCLUDE 'CNAUTO.INS'                                              SCGINT    101
      INCLUDE 'CNNNEW.INS'                                              SCGINT    102
      INCLUDE 'CNSTN.INS'                                               SCGINT    103
      INCLUDE 'CNB19.INS'                                               SCGINT    104
      INCLUDE 'CNUNIT.INS'                                              SCGINT    105
      INCLUDE 'CNLFDA.INS'                                              SCGINT    106
      INCLUDE 'CNMSG.INS'                                               SCGINT    107
C                                                                       SCGINT    108
      CHARACTER*2 CID                                                   SCGINT    109
CD                                                                      SCGINT    110
CD STEP 1. REORDER BUS NUMBERS IN SERIES CAPACITOR TABLE                SCGINT    111
CD                                                                      SCGINT    112
      IEBK=0                                                            SCGINT    113
      DO 1000 I=LSCGRE,NSCGRE                                           SCGINT    114
C                                                                       SCGINT    115
      K=IDATPT(I)                                                       SCGINT    116
      IF(IADATA(K+1).GT.9)GOTO 1000                                     SCGINT    117
C                                                                       SCGINT    118
      NLFI=IADATA(K+2)                                                  SCGINT    119
      NLFJ=IADATA(K+3)                                                  SCGINT    120
      NPROGI=NNEW(NLFI)                                                 SCGINT    121
      NPROGJ=NNEW(NLFJ)                                                 SCGINT    122
      IADATA(K+1)=1                                                     SCGINT    123
      IADATA(K+2)=NPROGI                                                SCGINT    124
      IADATA(K+3)=NPROGJ                                                SCGINT    125
      NI3=NPROGI*3                                                      SCGINT    126
      NJ3=NPROGJ*3                                                      SCGINT    127
      ITFK=IADATA(K+4)                                                  SCGINT    128
      CALL UNPACK(CID,JJJ,ITFK)                                         SCGINT    129
      IDRRR=IADATA(K+15)                                                SCGINT    130
CD                                                                      SCGINT    131
CD STEP 2. FIND THE LINE                                                SCGINT    132
CD                                                                      SCGINT    133
      CALL LOLINE(NPROGI,NPROGJ,CID,JNL)                                SCGINT    134
      IF(JNL.EQ.0)THEN                                                  SCGINT    135
      IEBK=1                                                            SCGINT    136
      WRITE(MSG(1),3220)NLFI,INAME(NI3-2),INAME(NI3-1),INAME(NI3)       SCGINT    137
     &,NLFJ,INAME(NJ3-2),INAME(NJ3-1),INAME(NJ3)                        SCGINT    138
      WRITE(MSG(2),3230)                                                SCGINT    139
      CALL PRTMSG(1)                                                    SCGINT    140
C                                                                       SCGINT    141
      ELSE                                                              SCGINT    142
C                                                                       SCGINT    143
      ADATA(K+13)=0.0                                                   SCGINT    144
      ADATA(K+14)=0.0                                                   SCGINT    145
      IADATA(K+16)=0                                                    SCGINT    146
CD                                                                      SCGINT    147
CD STEP 3. CONVERT CYCLE INTO SEC.                                      SCGINT    148
CD                                                                      SCGINT    149
      ADATA(K+11)=ADATA(K+11)/FQBASE                                    SCGINT    150
      ADATA(K+12)=ADATA(K+12)/FQBASE                                    SCGINT    151
C                                                                       SCGINT    152
CD                                                                      SCGINT    153
CD STEP 4. SETUP REMOTE RELAYS                                          SCGINT    154
CD                                                                      SCGINT    155
      IF(IDRRR.NE.0)THEN                                                SCGINT    156
       KADD=K+34                                                        SCGINT    157
       CALL REMINT(KADD,IDRRR)                                          SCGINT    158
      ENDIF                                                             SCGINT    159
C                                                                       SCGINT    160
      ENDIF                                                             SCGINT    161
C                                                                       SCGINT    162
 1000 CONTINUE                                                          SCGINT    163
C                                                                       SCGINT    164
      RETURN                                                            SCGINT    165
 3220 FORMAT(' *** ERROR LINE BETWEEN BUSES',2(I6,1X,3A4))              SCGINT    166
 3230 FORMAT('     CANNOT BE FOUND.')                                   SCGINT    167
C                                                                       SCGINT    168
      END                                                               SCGINT    169
