CFPRIME OCRDAT                                                          OCRDAT      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
C                                                                       OCRDAT      3
       SUBROUTINE OCRDAT (IEBK)                                         OCRDAT      4
CD                                                                      OCRDAT      5
CD  This subroutine reads in the overcurrent relay data from a          OCRDAT      6
CD  given file                                                          OCRDAT      7
CD                                                                      OCRDAT      8
C---------------------------------------------------------------------  OCRDAT      9
C                                                        Include files  OCRDAT     10
C                                                                       OCRDAT     11
      INCLUDE 'PARX.INS'                                                OCRDAT     12
      INCLUDE 'CNPT.INS'                                                OCRDAT     13
      INCLUDE 'CNMNEW.INS'                                              OCRDAT     14
      INCLUDE 'CNAUTO.INS'                                              OCRDAT     15
      INCLUDE 'CNLFDA.INS'                                              OCRDAT     16
      INCLUDE 'CNB19.INS'                                               OCRDAT     17
      INCLUDE 'CNFLAG.INS'                                              OCRDAT     18
      INCLUDE 'CNPARX.INS'                                              OCRDAT     19
      INCLUDE 'CNREN.INS'                                               OCRDAT     20
      INCLUDE 'CNUNIT.INS'                                              OCRDAT     21
      INCLUDE 'CNMSG.INS'                                               OCRDAT     22
C---------------------------------------------------------------------  OCRDAT     23
C                                                      Local Variables  OCRDAT     24
C                                                                       OCRDAT     25
       CHARACTER*2   CID                                                OCRDAT     26
       CHARACTER*3   ESC, MPI                                           OCRDAT     27
       CHARACTER*5   EDATA                                              OCRDAT     28
       CHARACTER*80  CARD, CARD1                                        OCRDAT     29
C                                                                       OCRDAT     30
       DATA          ESC / 'ESC' /,                                     OCRDAT     31
     +               MPI / 'MPI' /,                                     OCRDAT     32
     +               EDATA / 'EDATA' /                                  OCRDAT     33
C---------------------------------------------------------------------  OCRDAT     34
C                                                       Initialization  OCRDAT     35
C                                                                       OCRDAT     36
      LDEB=.FALSE.                                                      OCRDAT     37
       LOCRE = LRTEMP                                                   OCRDAT     38
C---------------------------------------------------------------------  OCRDAT     39
CD                                                                      OCRDAT     40
CD  1.  Read OCRE relay branch specification                            OCRDAT     41
CD                                                                      OCRDAT     42
1000   CALL GETLIN (IU54, CARD)                                         OCRDAT     43
       IF (CARD(1:5) .EQ. EDATA) GOTO 9000                              OCRDAT     44
C                                                                       OCRDAT     45
       IF (KLFO .EQ. 0) THEN                                            OCRDAT     46
C                                                          Bus numbers  OCRDAT     47
         READ (CARD, 5100) NLFI, NLFJ, CID                              OCRDAT     48
         IF (NLFI .GT. N99999 .OR. NLFJ .GT. N99999) THEN               OCRDAT     49
           WRITE (MSG(1), 6100) N99999                                  OCRDAT     50
           GOTO 2000                                                    OCRDAT     51
         ENDIF                                                          OCRDAT     52
C                                                                       OCRDAT     53
         IF (MNEW(NLFI) .EQ. 0 .OR. MNEW(NLFJ) .EQ. 0) THEN             OCRDAT     54
           WRITE (MSG(1), 6200)                                         OCRDAT     55
           GOTO 2000                                                    OCRDAT     56
         ENDIF                                                          OCRDAT     57
C                                                                       OCRDAT     58
       ELSE                                                             OCRDAT     59
C                                                            Bus names  OCRDAT     60
         READ (CARD, 5200) BNAME1, BNAME2, CID                          OCRDAT     61
         CALL CHKBUS (BNAME1, NLFI)                                     OCRDAT     62
         CALL CHKBUS (BNAME2, NLFJ)                                     OCRDAT     63
         IF (NLFI .EQ. 0 .OR. NLFJ .EQ. 0) THEN                         OCRDAT     64
           WRITE (MSG(1), 6200)                                         OCRDAT     65
           GOTO 2000                                                    OCRDAT     66
         ENDIF                                                          OCRDAT     67
C                                                                       OCRDAT     68
       ENDIF                                                            OCRDAT     69
C                                       Store the branch specification  OCRDAT     70
       IF (NAUT .GE. MAXSET) THEN                                       OCRDAT     71
         WRITE (MSG(1), 6300) MAXSET                                    OCRDAT     72
         GOTO 2000                                                      OCRDAT     73
       ENDIF                                                            OCRDAT     74
C                                           No error in data until now  OCRDAT     75
       NAUT = NAUT + 1                                                  OCRDAT     76
       NAUBUS(NAUT + 1) = NLFI                                          OCRDAT     77
       NAUBUS(NAUT + 2) = NLFJ                                          OCRDAT     78
       LRTEMP = LRTEMP + 1                                              OCRDAT     79
       IDATPT(LRTEMP) = JLNA                                            OCRDAT     80
       IADATA(JLNA + 1) = NLFI                                          OCRDAT     81
       IADATA(JLNA + 2) = NLFJ                                          OCRDAT     82
       CALL PACK (CID, 0, ITFK)                                         OCRDAT     83
       IADATA(JLNA + 3) = ITFK                                          OCRDAT     84
       GOTO 3000                                                        OCRDAT     85
C                                               On error print message  OCRDAT     86
C                       and skip subsequent cards until the next relay  OCRDAT     87
2000   IEBK = 1                                                         OCRDAT     88
       MSG(2) = CARD                                                    OCRDAT     89
       CALL PRTMSG (2)                                                  OCRDAT     90
2100   CALL GETLIN (IU54, CARD)                                         OCRDAT     91
       IF (CARD(1:3) .EQ. ESC) GOTO 1000                                OCRDAT     92
       GOTO 2100                                                        OCRDAT     93
C---------------------------------------------------------------------  OCRDAT     94
CD                                                                      OCRDAT     95
CD  2.  Read OCRE relay data                                            OCRDAT     96
CD                                                                      OCRDAT     97
3000   CALL GETLIN (IU54, CARD)                                         OCRDAT     98
       READ (CARD, 5300) (ADATA(JLNA + IK), IK = 5, 10)                 OCRDAT     99
       IF (ADATA(JLNA + 6) .LT. 0.0) ADATA(JLNA + 6) = 0.0              OCRDAT    100
       CALL GETLIN (IU54, CARD)                                         OCRDAT    101
       READ (CARD, 5400) (ADATA(JLNA + IK), IK = 11, 17)                OCRDAT    102
       IF (ADATA(JLNA + 17) .LT. 0.0) ADATA(JLNA + 17) = 0.0            OCRDAT    103
       ILNA = JLNA                                                      OCRDAT    104
       JLNA = JLNA + 28                                                 OCRDAT    105
C---------------------------------------------------------------------  OCRDAT    106
CD                                                                      OCRDAT    107
CD  3.  Read OCRE relay remote operation commands                       OCRDAT    108
CD                                                                      OCRDAT    109
       NRMRLY = 0                                                       OCRDAT    110
C                                                                       OCRDAT    111
4000   CALL GETLIN (IU54, CARD)                                         OCRDAT    112
       IF (CARD(1:3) .EQ. ESC) THEN                                     OCRDAT    113
         IADATA(ILNA + 4) = NRMRLY                                      OCRDAT    114
       ELSE                                                             OCRDAT    115
         IF (CARD(1:3) .EQ. MPI) CALL GETLIN (IU54, CARD1)              OCRDAT    116
         CALL SWIDAT (CARD, CARD1, NRMRLY, IEBK)                        OCRDAT    117
         GOTO 4000                                                      OCRDAT    118
       ENDIF                                                            OCRDAT    119
C---------------------------------------------------------------------  OCRDAT    120
       GOTO 1000                                                        OCRDAT    121
C---------------------------------------------------------------------  OCRDAT    122
C                                                              Formats  OCRDAT    123
C                                                                       OCRDAT    124
5100   FORMAT (2I5, A2)                                                 OCRDAT    125
5200   FORMAT (2A12, A2)                                                OCRDAT    126
5300   FORMAT (6F10.5)                                                  OCRDAT    127
5400   FORMAT (7F10.5)                                                  OCRDAT    128
C---------------------------------------------------------------------  OCRDAT    129
C                                                       Error messages  OCRDAT    130
C                                                                       OCRDAT    131
6100   FORMAT (' *** ERROR OCRE RELAY BUS NUMBER EXCEEDS ', I5)         OCRDAT    132
6200   FORMAT (' *** ERROR OCRE RELAY BUS NOT FOUND')                   OCRDAT    133
6300   FORMAT (' *** ERROR RELAY SCHEME EXCEEDS THE LIMIT OF ', I3)     OCRDAT    134
C---------------------------------------------------------------------  OCRDAT    135
9000   IF (LRTEMP .NE. LOCRE) THEN                                      OCRDAT    136
         LOCRE = LOCRE + 1                                              OCRDAT    137
         NOCRE = LRTEMP                                                 OCRDAT    138
       ELSE                                                             OCRDAT    139
         LOCRE = 0                                                      OCRDAT    140
         NOCRE = 0                                                      OCRDAT    141
       ENDIF                                                            OCRDAT    142
C---------------------------------------------------------------------  OCRDAT    143
       RETURN                                                           OCRDAT    144
       END                                                              OCRDAT    145
