CFPRIME EMLNDA                                                          EMLNDA      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 EMLNDA(SUBPMT,IUX,IUY,IEBK)                            EMLNDA      3
CD                                                                      EMLNDA      4
CD    TO READ MONITORED LINE DATA INTERACTIVELY FOR OUTPUT ANALYSIS.    EMLNDA      5
CD                                                                      EMLNDA      6
CD    LET K BE THE K-TH MONITORED LINE                                  EMLNDA      7
CD                                                                      EMLNDA      8
CD               ILINE12 = (K-1)*12                                     EMLNDA      9
CD                                                                      EMLNDA     10
CD           IRD(3,K)    :  RELAY ID                                    EMLNDA     11
CD                                                                      EMLNDA     12
CD      MLFTB(ILINE12+1) :  LINE TYPE | LINE STATUS                     EMLNDA     13
CD      MLFTB(ILINE12+2) :  FROM BUS NUMBER AND TO BUS NUMBER           EMLNDA     14
CD      MACKT(ILINE12+3) :  CKT ID    | SECTION ID                      EMLNDA     15
CD     MTYIRS(ILINE12+4) :  IRS (RELAY DATA FLAG)                       EMLNDA     16
CD                          IRS=0  - RELAY TO BE CIRCLED WITH A REACH   EMLNDA     17
CD                                   OF 125% OF THE LINE                EMLNDA     18
CD                          IRS=1  - RELAY DATA FROM CARD               EMLNDA     19
CD                          IRS=2  - RELAY DATA FROM RELAY DATA BASE    EMLNDA     20
CD                                                                      EMLNDA     21
CD     JRSKRS(ILINE12+5) :  RELAY STATUS FLAGS JRS AND KRS              EMLNDA     22
CD                          JRS=0  - RELAY DIDN'T TRIP                  EMLNDA     23
CD                          JRS=1  - RELAY TRIPED                       EMLNDA     24
CD                          JRS=2  - RELAY TRIPED                       EMLNDA     25
CD                          JRS=3  - RELAY TRIPED                       EMLNDA     26
CD                          KRS=3 - RELAY DATA FROM PROGRAM             EMLNDA     27
CD                          KRS=2 - RELAY DATA FROM CARD                EMLNDA     28
CD                          KRS=1 - ERROR -- RELAY NOT IN DATA BASE     EMLNDA     29
CD                          KRS=(RELAY ID NO.)+10 SETTING DATE          EMLNDA     30
CD                                                 SPECIFIED            EMLNDA     31
CD                          KRS=(RELAY ID NO.)+32678 SETTING DATE       EMLNDA     32
CD                                                 NOT SPECIFIED        EMLNDA     33
CD                                                                      EMLNDA     34
CD      GLM   (ILINE12+6):  R OF EQUIVALENT ADMITTANCE                  EMLNDA     35
CD      BLM   (ILINE12+7):  X OF EQUIVALENT ADMITTANCE                  EMLNDA     36
CD      BLCF  (ILINE12+8):  R OF SHUNT COMPONENT                        EMLNDA     37
CD      BLT   (ILINE12+9):  X OF SHUNT COMPONENT                        EMLNDA     38
CD      RADX (ILINE12+10):  RADIUS OF COMPOSITE CIRCLE                  EMLNDA     39
CD      RORIG(ILINE12+11):  R OF COMPOSITE CIRCLE CENTRE                EMLNDA     40
CD      XORIG(ILINE12+12):  X OF COMPOSITE CIRCLE CENTRE                EMLNDA     41
CD                                                                      EMLNDA     42
      INCLUDE 'PARX.INS'                                                EMLNDA     43
      INCLUDE 'CNPT.INS'                                                EMLNDA     44
      INCLUDE 'CNMON.INS'                                               EMLNDA     45
      INCLUDE 'CNFLAG.INS'                                              EMLNDA     46
      INCLUDE 'CNLFDA.INS'                                              EMLNDA     47
      INCLUDE 'CNMNEW.INS'                                              EMLNDA     48
      INCLUDE 'CNPARX.INS'                                              EMLNDA     49
      INCLUDE 'CNB19.INS'                                               EMLNDA     50
      INCLUDE 'CNUNIT.INS'                                              EMLNDA     51
C                                                                       EMLNDA     52
      INCLUDE 'CNLSTA.INS'                                              EMLNDA     53
      INCLUDE 'CNMSG.INS'                                               EMLNDA     54
C                                                                       EMLNDA     55
      INTEGER IRADX(MONL*12),IRORIG(MONL*12),IXORIG(MONL*12)            EMLNDA     56
      EQUIVALENCE                                                       EMLNDA     57
     &(RADX(1),IRADX(1)),(RORIG(1),IRORIG(1)),(XORIG(1),IXORIG(1))      EMLNDA     58
      CHARACTER*12 CNAME                                                EMLNDA     59
      INTEGER KNAME(3)                                                  EMLNDA     60
      EQUIVALENCE (KNAME(1),CNAME)                                      EMLNDA     61
      INTEGER*4 JCKID                                                   EMLNDA     62
      CHARACTER*2 UID                                                   EMLNDA     63
      CHARACTER*80 STRING,PMSG                                          EMLNDA     64
      CHARACTER*7 SUBPMT                                                EMLNDA     65
C                                                                       EMLNDA     66
      LDEB=.FALSE.                                                      EMLNDA     67
C                                                                       EMLNDA     68
  100 CONTINUE                                                          EMLNDA     69
C                                                                       EMLNDA     70
C   READING MONITORED LINES                                             EMLNDA     71
C                                                                       EMLNDA     72
      CALL FTNCID(ICODE,NLFF,NLFT,UID,KLFO)                             EMLNDA     73
C                                                                       EMLNDA     74
      IF (ICODE.NE.0) GOTO 220                                          EMLNDA     75
      PMSG='SELECT THE FLAG BY THE NUMBER:'                             EMLNDA     76
  110 WRITE(LOUT,2000)                                                  EMLNDA     77
      CALL REDLIN(LOUT,LIN,IOERR,30,PMSG,SUBPMT,'XXX',STRING,           EMLNDA     78
     &RECORD,IREC,KLAYER,KEND,KREAD,PLAYBA)                             EMLNDA     79
      IF (IOERR.LT.0)THEN                                               EMLNDA     80
      IF(PLAYBA)CALL PSTOP                                              EMLNDA     81
      GOTO 110                                                          EMLNDA     82
      ENDIF                                                             EMLNDA     83
      IF (KLAYER.LT.0) RETURN                                           EMLNDA     84
      STRING(80:80)='/'                                                 EMLNDA     85
      READ(STRING,*,IOSTAT=IOS) IRS                                     EMLNDA     86
      IF (IOS.NE.0.OR.IRS.LT.1.OR.IRS.GT.3) THEN                        EMLNDA     87
         KREAD=.TRUE.                                                   EMLNDA     88
         IF(PLAYBA)CALL PSTOP                                           EMLNDA     89
         GOTO 110                                                       EMLNDA     90
      END IF                                                            EMLNDA     91
C                                                                       EMLNDA     92
      IRS=IRS-1                                                         EMLNDA     93
      NPFL=NPFL+1                                                       EMLNDA     94
      NPFL12=NPFL*12                                                    EMLNDA     95
      IF(NPFL.GT.MXMONL) GOTO 210                                       EMLNDA     96
      MLFTB(NPFL12-11)=0                                                EMLNDA     97
      MLFTB(NPFL12-6)=NLFF                                              EMLNDA     98
      MLFTB(NPFL12-5)=NLFT                                              EMLNDA     99
      CALL PACK(UID,0,JCKID)                                            EMLNDA    100
      MACKT(NPFL12-9)=JCKID                                             EMLNDA    101
C                                                                       EMLNDA    102
      IF(IRS.EQ.1)THEN                                                  EMLNDA    103
 140  WRITE(LOUT,2020)                                                  EMLNDA    104
      CALL READSC(LOUT,LIN,IOERR,STRING,KREAD,PLAYBA)                   EMLNDA    105
      IF(IOERR.NE.0)THEN                                                EMLNDA    106
      IF(PLAYBA)CALL PSTOP                                              EMLNDA    107
      GOTO 140                                                          EMLNDA    108
      ENDIF                                                             EMLNDA    109
      IF(RECORD) WRITE(IREC,'(A)')STRING                                EMLNDA    110
      READ(STRING,*,IOSTAT=IOS) CCRAD,CCROC,CCXOR                       EMLNDA    111
      IF(IOS.EQ.0) GOTO 160                                             EMLNDA    112
      IF(PLAYBA)CALL PSTOP                                              EMLNDA    113
      KREAD=.TRUE.                                                      EMLNDA    114
      GOTO 140                                                          EMLNDA    115
 160  CONTINUE                                                          EMLNDA    116
C                                                                       EMLNDA    117
C   IRS=1 RELAY DATA FROM CARD                                          EMLNDA    118
C                                                                       EMLNDA    119
      RADX(NPFL12-2)=CCRAD                                              EMLNDA    120
      RORIG(NPFL12-1)=CCROC                                             EMLNDA    121
      XORIG(NPFL12)=CCXOR                                               EMLNDA    122
C                                                                       EMLNDA    123
      ELSEIF(IRS.EQ.2)THEN                                              EMLNDA    124
C                                                                       EMLNDA    125
C   IRS=2 RELAY DATA FROM RELAY DATA BASE                               EMLNDA    126
C                                                                       EMLNDA    127
 165  WRITE(LOUT,2030)                                                  EMLNDA    128
      CALL READSC(LOUT,LIN,IOERR,STRING,KREAD,PLAYBA)                   EMLNDA    129
      IF(IOERR.NE.0)THEN                                                EMLNDA    130
      IF(PLAYBA)CALL PSTOP                                              EMLNDA    131
      GOTO 165                                                          EMLNDA    132
      ENDIF                                                             EMLNDA    133
      IF(RECORD) WRITE(IREC,'(A)')STRING                                EMLNDA    134
      I1=INDEX(STRING,';')                                              EMLNDA    135
      IF(I1.EQ.0)THEN                                                   EMLNDA    136
        IF(PLAYBA)CALL PSTOP                                            EMLNDA    137
        GOTO 165                                                        EMLNDA    138
      ENDIF                                                             EMLNDA    139
      CNAME=STRING(I1+1:I1+12)                                          EMLNDA    140
      IRADX(NPFL12-2)=KNAME(1)                                          EMLNDA    141
      IRORIG(NPFL12-1)=KNAME(2)                                         EMLNDA    142
      IXORIG(NPFL12)=KNAME(3)                                           EMLNDA    143
C                                                                       EMLNDA    144
C   ENDIF IRS.NE.0                                                      EMLNDA    145
C                                                                       EMLNDA    146
      ENDIF                                                             EMLNDA    147
C                                                                       EMLNDA    148
      MTYIRS(NPFL12-8)=IRS                                              EMLNDA    149
      JRSKRS(NPFL12-7)=0                                                EMLNDA    150
C                                                                       EMLNDA    151
      GOTO 100                                                          EMLNDA    152
  210 CONTINUE                                                          EMLNDA    153
      KREAD=.TRUE.                                                      EMLNDA    154
      IF(KLFO.EQ.0)THEN                                                 EMLNDA    155
         WRITE(MSG(1),2100) NLFF,NLFT,UID,MXMONL                        EMLNDA    156
         CALL PRTMSG(1)                                                 EMLNDA    157
      ELSE                                                              EMLNDA    158
      JJ=MNEW(NLFF)                                                     EMLNDA    159
      KK=MNEW(NLFT)                                                     EMLNDA    160
      JJ=JJ*8                                                           EMLNDA    161
      KK=KK*8                                                           EMLNDA    162
      WRITE(MSG(1),2110) NAMES(JJ-2),NAMES(JJ-1),NAMES(JJ)              EMLNDA    163
     &,NAMES(KK-2),NAMES(KK-1),NAMES(KK),UID                            EMLNDA    164
      WRITE(MSG(2),2120) MXMONL                                         EMLNDA    165
      CALL PRTMSG(2)                                                    EMLNDA    166
      ENDIF                                                             EMLNDA    167
      IF(PLAYBA)CALL PSTOP                                              EMLNDA    168
      GOTO 100                                                          EMLNDA    169
C                                                                       EMLNDA    170
  220 CONTINUE                                                          EMLNDA    171
      RETURN                                                            EMLNDA    172
C                                                                       EMLNDA    173
 2000 FORMAT(//,                                                        EMLNDA    174
     17X,'RELAY DATA FLAG FOR THE MONITORED LINE',/,                    EMLNDA    175
     27X,'--------------------------------------',//,                   EMLNDA    176
     33X,'(1) CIRCULAR RELAY WITH A REACH OF 125% OF THE LINE',/,       EMLNDA    177
     43X,'(2) CIRCULAR RELAY SPECIFIED BY THE USER',/,                  EMLNDA    178
     53X,'(3) RELAY DATA FROM DATA BASE',//)                            EMLNDA    179
 2020 FORMAT(/,' ENTER THE RADIUS AND CENTER OF THE RELAY ',            EMLNDA    180
     *'IN POLAR FORM:')                                                 EMLNDA    181
 2030 FORMAT(/,' ENTER ;RELAY IDENTITY:')                               EMLNDA    182
 2100 FORMAT(' *** ERROR LINE FLOW',2I6,1X,A2,' EXCEEDS THE LIMIT OF '  EMLNDA    183
     *,I5)                                                              EMLNDA    184
 2110 FORMAT(' *** ERROR LINE FLOW ',3A4,1X,3A4,1X,A2,' EXCEEDS')       EMLNDA    185
 2120 FORMAT(5X,'THE LIMIT OF ',I5)                                     EMLNDA    186
      END                                                               EMLNDA    187
