CFPRIME LSHINT                                                          LSHINT      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 LSHINT(IEBK)                                           LSHINT      3
CD                                                                      LSHINT      4
CD    TO INITIALIZE UFVD LOAD SHEDDING AND LOAD RESTORATION SCHEME.     LSHINT      5
CD                                                                      LSHINT      6
CD     LUFVDB           Starting position of IDATPT array for UFVD      LSHINT      7
CD                      relay scheme LUFVDB is in the common            LSHINT      8
CD                      labelled pt of include file CNPT.               LSHINT      9
CD                                                                      LSHINT     10
CD     NUFVDB           Finishing position of IDATPT array for UFVD     LSHINT     11
CD                      relay scheme LUFVDB is in the common            LSHINT     12
CD                      labelled pt of include file CNPT.               LSHINT     13
CD                                                                      LSHINT     14
CD     let k = k-th UFVD RELAY                                          LSHINT     15
CD                                                                      LSHINT     16
CD     N = IDATPT(k)    IDATPT is the array that stores the start       LSHINT     17
CD                      position of the K-TH UFVD relay scheme data     LSHINT     18
CD                                                                      LSHINT     19
CD                                                                      LSHINT     20
CD     IADATA(N+1)      No. of load shedding scheme the relay has       LSHINT     21
CD                                                                      LSHINT     22
CD     IADATA(N+2)      Bus number where the I_th load shed spec.       LSHINT     23
CD                      applies.                                        LSHINT     24
CD                                                                      LSHINT     25
CD      ADATA(N+3)      Magnitude of initial voltage                    LSHINT     26
CD                                                                      LSHINT     27
CD      ADATA(N+4)      Magnitude of previous voltage                   LSHINT     28
CD                                                                      LSHINT     29
CD      ADATA(N+5)      Angle of previous voltage                       LSHINT     30
CD                                                                      LSHINT     31
CD      ADATA(N+6)      Frequency deviation of previous step            LSHINT     32
CD                                                                      LSHINT     33
CD     IADATA(N+7)      Relay trip flag  = 0  local and remote          LSHINT     34
CD                                       = 1  remote only               LSHINT     35
CD                                                                      LSHINT     36
CD     IADATA(N+8)      Remote relay trip flag.                         LSHINT     37
CD                        -1 : all remote relay tripped.                LSHINT     38
CD                                                                      LSHINT     39
CD     IADATA(N+9)      No.of relays controlled by the local relay.     LSHINT     40
CD                                                                      LSHINT     41
CD RS* ADATA(NS+1)      =1 for under voltage shedding                   LSHINT     42
CD                      =2 for voltage deviation                        LSHINT     43
CD                      =3 for under frequency,in the I-th load shed    LSHINT     44
CD                         spec.                                        LSHINT     45
CD                                                                      LSHINT     46
CD RS  ADATA(NS+2)      = Number of shedding levels in the I-th load    LSHINT     47
CD                        shed spec.                                    LSHINT     48
CD                                                                      LSHINT     49
CD RS  ADATA(NS+3)      =0 no shunt load is to be dropped               LSHINT     50
CD                      =1 shunt load is to be dropped in the I-th      LSHINT     51
CD                         load spec.                                   LSHINT     52
CD                                                                      LSHINT     53
CD RS  ADATA(NS+4)      Amount of PU shunt reactive load to be          LSHINT     54
CD                      dropped for the I-th load spec                  LSHINT     55
CD                                                                      LSHINT     56
CD                                                                      LSHINT     57
CD RL* ADATA(NL+1)      PU voltage deviation for load tripping or       LSHINT     58
CD                      PU voltage for load tripping or                 LSHINT     59
CD                      PU frequency for load tripping thresholds       LSHINT     60
CD                      (expressed in rads/cyc below base freq)         LSHINT     61
CD                      in the I-th shedding level for the J-th         LSHINT     62
CD                      load spec.                                      LSHINT     63
CD                                                                      LSHINT     64
CD RL  ADATA(NL+2)      Relay timer setting in cycles, the length of    LSHINT     65
CD                      time that frequency or voltage must remain      LSHINT     66
CD                      below the threshold before a trip signal is     LSHINT     67
CD                      sent to the PCB, in the I-th shedding level     LSHINT     68
CD                      for the J-th load spec.                         LSHINT     69
CD                                                                      LSHINT     70
CD RL  ADATA(NL+3)      Circuit breaker trip time (cycles) in the I-th  LSHINT     71
CD                      shedding level for the J-th load spec.          LSHINT     72
CD                                                                      LSHINT     73
CD                                                                      LSHINT     74
CD RL  ADATA(NL+4)      Fraction of load to be shed in the I_th         LSHINT     75
CD                      shedding level for the J_th load spec.          LSHINT     76
CD                                                                      LSHINT     77
CD RL  IADATA(NL+5)     Switching status of the I-th shedding level     LSHINT     78
CD                      for the J-th load spec:                         LSHINT     79
CD                      =0 If threshold not reached                     LSHINT     80
CD                      =1 IF threshold relay timer running but not     LSHINT     81
CD                         timed out                                    LSHINT     82
CD                      =2 If relay timed out but PCB delay not         LSHINT     83
CD                         complete. Remote relay timer started(based   LSHINT     84
CD                         on level 1 trip signal)                      LSHINT     85
CD                      =3 If PCB tripped and load dropped, remote      LSHINT     86
CD                         relay not tripped yet                        LSHINT     87
CD                      =4 load shedded ,all remote relay tripped.      LSHINT     88
CD                                                                      LSHINT     89
CD RL  IADATA(NL+6)     =1 If time remaining before threshold relay     LSHINT     90
CD                         or breaker delay complete for I-th shedding  LSHINT     91
CD                         level of J-th load spec.                     LSHINT     92
CD                                                                      LSHINT     93
CD                                                                      LSHINT     94
CD NOTE:                                                                LSHINT     95
CD                                                                      LSHINT     96
CD      1. RS - REPEAT FOR EACH SCHEME                                  LSHINT     97
CD      2. RL - REPEAT FOR EACH LEVEL                                   LSHINT     98
CD                                                                      LSHINT     99
CD                                                                      LSHINT    100
C                                                                       LSHINT    101
      INCLUDE 'PARX.INS'                                                LSHINT    102
      INCLUDE 'CNPT.INS'                                                LSHINT    103
      INCLUDE 'CNNNEW.INS'                                              LSHINT    104
      INCLUDE 'CNAUTO.INS'                                              LSHINT    105
      INCLUDE 'CNVOLT.INS'                                              LSHINT    106
      INCLUDE 'CNB19.INS'                                               LSHINT    107
      INCLUDE 'CNFLAG.INS'                                              LSHINT    108
      INCLUDE 'CNPARX.INS'                                              LSHINT    109
      INCLUDE 'CNUNIT.INS'                                              LSHINT    110
      INCLUDE 'CNNBLD.INS'                                              LSHINT    111
      INCLUDE 'CNMSG.INS'                                               LSHINT    112
C                                                                       LSHINT    113
      COMPLEX VOLTK                                                     LSHINT    114
      DIMENSION VOLTX(2)                                                LSHINT    115
      EQUIVALENCE (VOLTK,VOLTX(1)),(VOLTX(1),VREAL),(VOLTX(2),VIMAG)    LSHINT    116
C                                                                       LSHINT    117
      LDEB=.FALSE.                                                      LSHINT    118
C                                                                       LSHINT    119
      PII2W=PII*2/WOBASE                                                LSHINT    120
C                                                                       LSHINT    121
C    INITIALIZE UNDERFREQUENCY LOAD SHEDDING SUMMARY TABLES FOR         LSHINT    122
C    SUBROUTINE SUMUFL                                                  LSHINT    123
C                                                                       LSHINT    124
      TUFLOD = 0.0                                                      LSHINT    125
      INDFEQ = 0                                                        LSHINT    126
      IZNUF = 0                                                         LSHINT    127
C                                                                       LSHINT    128
C   PRINT LOAD SHEDDING SCHEME DATA                                     LSHINT    129
C                                                                       LSHINT    130
      DO 220 I=LUFVDB,NUFVDB                                            LSHINT    131
      K=IDATPT(I)-1                                                     LSHINT    132
      IF(IADATA(K+8).GT.9)GOTO 220                                      LSHINT    133
      NSCHEM=IADATA(K+1)                                                LSHINT    134
      NLF=IADATA(K+2)                                                   LSHINT    135
      NPROG=NNEW(NLF)                                                   LSHINT    136
      IADATA(K+2)=NPROG                                                 LSHINT    137
C                                                                       LSHINT    138
C   STORE VOLTAGE, ANGLE & FREQUENCY DEVIATIONS                         LSHINT    139
C                                                                       LSHINT    140
      VOLTK=VOLT(NPROG)                                                 LSHINT    141
      VMG=CABS(VOLTK)                                                   LSHINT    142
      IF(ABS(VREAL).GT.1.E-6.OR.ABS(VIMAG).GT.1.E-6)THEN                LSHINT    143
      ANGOLD=ATAN2(VIMAG,VREAL)                                         LSHINT    144
      ELSE                                                              LSHINT    145
      ANGOLD=0.0                                                        LSHINT    146
      ENDIF                                                             LSHINT    147
      ADATA(K+3)=VMG                                                    LSHINT    148
      ADATA(K+4)=VMG                                                    LSHINT    149
      ADATA(K+5)=ANGOLD                                                 LSHINT    150
      ADATA(K+6)=0.0                                                    LSHINT    151
      IDRRR=IADATA(K+9)                                                 LSHINT    152
      K=K+9                                                             LSHINT    153
C                                                                       LSHINT    154
C    FOR NSCHEME                                                        LSHINT    155
C                                                                       LSHINT    156
      DO 210 J=1,NSCHEM                                                 LSHINT    157
      ITYPE=IADATA(K+1)                                                 LSHINT    158
C                                                                       LSHINT    159
      IF(ITYPE.EQ.1)THEN                                                LSHINT    160
       IK=JBLD(NPROG)                                                   LSHINT    161
       IF(IK.NE.0)ISUM(IK)=0                                            LSHINT    162
      ENDIF                                                             LSHINT    163
C                                                                       LSHINT    164
      LEVELS=IADATA(K+2)                                                LSHINT    165
      K=K+4                                                             LSHINT    166
      TPP=0.0                                                           LSHINT    167
      DO 200 L=1,LEVELS                                                 LSHINT    168
      K=K+6                                                             LSHINT    169
      TPP=TPP+ADATA(K-2)                                                LSHINT    170
C                                                                       LSHINT    171
C   CONVERT TIME DELAY TO SECONDS                                       LSHINT    172
C                                                                       LSHINT    173
      ADATA(K-4)=ADATA(K-4)*PII2W                                       LSHINT    174
      ADATA(K-3)=ADATA(K-3)*PII2W                                       LSHINT    175
C                                                                       LSHINT    176
 200  CONTINUE                                                          LSHINT    177
C                                                                       LSHINT    178
      NTPP=NINT(TPP)                                                    LSHINT    179
      IF(NTPP.GT.100)THEN                                               LSHINT    180
       IEBK=1                                                           LSHINT    181
       WRITE(MSG(1),2020)                                               LSHINT    182
       CALL PRTMSG(1)                                                   LSHINT    183
      ENDIF                                                             LSHINT    184
C                                                                       LSHINT    185
 210  CONTINUE                                                          LSHINT    186
C                                                                       LSHINT    187
C     IF THE NO. OF REMOTE TRIPPING SCHEME IS NON-ZERO THEN             LSHINT    188
C                                                                       LSHINT    189
      IF(IDRRR.NE.0)THEN                                                LSHINT    190
C      IF(LDEB)THEN                                                     LSHINT    191
C        WRITE(IUD6,2020)K,IDRRR                                        LSHINT    192
C        DO 3000 II=1,23                                                LSHINT    193
C         WRITE(IUD6,2030)ADATA(II),IADATA(II)                          LSHINT    194
C 3000   CONTINUE                                                       LSHINT    195
C       ENDIF                                                           LSHINT    196
       CALL REMINT(K,IDRRR)                                             LSHINT    197
      ENDIF                                                             LSHINT    198
C                                                                       LSHINT    199
                                                                        LSHINT    200
 220  CONTINUE                                                          LSHINT    201
      RETURN                                                            LSHINT    202
 2020 FORMAT(' *** ERROR THE TOTAL OF ALL LEVELS LOAD SHED/RESTORE',    LSHINT    203
     &' EXCEEDS 100%' )                                                 LSHINT    204
      END                                                               LSHINT    205
