CFPRIME READEP                                                          READEP      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 READEP(IUX,IUY)                                        READEP      3
CD                                                                      READEP      4
CD    THIS ROUTINE READS DYNAMIC MODEL DATA IN BPA/WSCC/EPRI(OLD)       READEP      5
CD    FORMAT. THESE DATA ARE THEN TRANSLATED INTO THE EPRI(NEW) BUS     READEP      6
CD    NUMBER FORMAT AND STORED IN THE PROGRAM ARRAYS.                   READEP      7
CD                                                                      READEP      8
CD    SECTION 1                                                         READEP      9
CD    ---------                                                         READEP     10
CD                                                                      READEP     11
CD    REPEAT...                                                         READEP     12
CD                                                                      READEP     13
CD      READ A CARD                                                     READEP     14
CD      IF CARD IS TYPE M,    -MACHINE                                  READEP     15
CD                            -SET FILE POINTER MB()                    READEP     16
CD      IF CARD IS TYPE MC,   -CLASSICAL MACHINE                        READEP     17
CD                            -SET FILE POINTER MC()                    READEP     18
CD                            -STORE BUS NAME IN MFNAME()               READEP     19
CD      IF CARD IS TYPE MF,   -DETAIL MACHINE                           READEP     20
CD                            -SET FILE POINTER MF()                    READEP     21
CD                            -STORE BUS NAME IN MFNAME()               READEP     22
CD      IF CARD IS TYPE E,    -EXCITER                                  READEP     23
CD                            -SET FILE POINTER EXCEP()                 READEP     24
CD      IF CARD IS TYPE S,    -STABILIZER                               READEP     25
CD                            -SET FILE POINTER STAB()                  READEP     26
CD      IF CARD IS TYPE G,    -GOVERNOR                                 READEP     27
CD                            -SET FILE POINTER GOV()                   READEP     28
CD      IF CARD IS TYPE IEEE, -IEEE EXCITER                             READEP     29
CD                            -SET FILE POINTER IEEEX()                 READEP     30
CD      IF CARD IS TYPE T,    -TURBINE                                  READEP     31
CD                            -SET FILE POINTER TB()                    READEP     32
CD                                                                      READEP     33
CD    UNTIL AN 'EPEND' IS REACHED.                                      READEP     34
CD    SORT THE MFNAME(),MF() AND MC() ARRAYS.                           READEP     35
CD                                                                      READEP     36
CD    SECTION 2                                                         READEP     37
CD    ---------                                                         READEP     38
CD                                                                      READEP     39
CD    REPEAT...                                                         READEP     40
CD                                                                      READEP     41
CD      FOR EACH MACHINE IN ARRAY MFNAME(), POINTED TO BY MF()          READEP     42
CD      SEARCH IN FILE WITH RECORD=MB()  TO PROCESS SUBTRANSIENT DATA   READEP     43
CD      SEARCH IN FILE WITH RECORD=EXCEP() TO PROCESS EXCITER DATA      READEP     44
CD      IF NO WSCC EXCITER FOR THIS MACHINE THEN                        READEP     45
CD         SEARCH FILE WITH RECORD=IEEEX() FOR IEEE TYPE EXCITER        READEP     46
CD      ENDIF                                                           READEP     47
CD      SEARCH IN FILE WITH RECORD=STAB() TO PROCESS STABILIZER DATA    READEP     48
CD      SEARCH IN FILE WITH RECORD=GOV() TO PROCESS GOVERNOR DATA       READEP     49
CD      IF JGOV=4 THEN                                                  READEP     50
CD         SEARCH IN FILE WITH RECORD=TB() TO PROCESS TURBINE MODELS    READEP     51
CD      ENDIF                                                           READEP     52
CD      CALL SUBROUTINE STGEND TO FILL TDDAT ARRAY                      READEP     53
CD      FOR CLASSICAL MACHINES ONLY GOVERNORS ARE ALLOWED.              READEP     54
CD                                                                      READEP     55
CD    UNTIL ALL MACHINES HAVE BEEN PROCESSED.                           READEP     56
CD                                                                      READEP     57
C-----------------------------------------------------------------------READEP     58
C                                                                       READEP     59
      INCLUDE 'PARX.INS'                                                READEP     60
      INCLUDE 'CNLFDA.INS'                                              READEP     61
      INCLUDE 'CNMNEW.INS'                                              READEP     62
      INCLUDE 'CNPT.INS'                                                READEP     63
      INCLUDE 'CNPARX.INS'                                              READEP     64
      INCLUDE 'CNFLAG.INS'                                              READEP     65
      INCLUDE 'CNUNIT.INS'                                              READEP     66
      INCLUDE 'CNAUTO.INS'                                              READEP     67
      INCLUDE 'CNREN.INS'                                               READEP     68
      INCLUDE 'CNTMDA.INS'                                              READEP     69
      INCLUDE 'CNJDAT.INS'                                              READEP     70
      INCLUDE 'CNJPT.INS'                                               READEP     71
      INCLUDE 'CNIPTR.INS'                                              READEP     72
      INCLUDE 'CNTGED.INS'                                              READEP     73
      INCLUDE 'CNMSG.INS'                                               READEP     74
      INCLUDE 'CNLUN.INS'                                               READEP     75
      INCLUDE 'CNFRUN.INS'                                              READEP     76
      INCLUDE 'CNCPT3.INS'                                              READEP     77
      INCLUDE 'CNSVCD.INS'                                              READEP     78
      INCLUDE 'EPBUS.INS'                                               READEP     79
C                                                                       READEP     80
      CHARACTER*1  COL1(12),COL2M(3),COL2U(6),COL2R(12),COL2S(6)        READEP     81
      CHARACTER*1  COL34R(5),TFLAG,ROPT                                 READEP     82
      CHARACTER*2  CID2,GTYPE                                           READEP     83
      CHARACTER*4  LPGID                                                READEP     84
      CHARACTER*32 FILNAM                                               READEP     85
      CHARACTER*12 BSNAME,MANE,ARNAME,NOBUSS,ZNNAME                     READEP     86
      CHARACTER*13 JFNAME(20),MFNAME(NM)                                READEP     87
      CHARACTER*80 CARD1,CARD3,LINE,LINE1,LINOUT,MFB,MFB1,MFB2,MFB3     READEP     88
      CHARACTER*80 IEEEX1,IEEEX2,IEEEX3,IEEEX4,IEEEX5                   READEP     89
C                                                                       READEP     90
      INTEGER JBUS(3),JAREA(3),JZONE(3)                                 READEP     91
      EQUIVALENCE (JBUS(1),BSNAME),(JAREA(1),ARNAME),(JZONE(1),ZNNAME)  READEP     92
      EQUIVALENCE (LPGID,ILPGID)                                        READEP     93
C                                                                       READEP     94
      INTEGER MB(NM),MC(NM),MF(NM),EXCEP(NM),EXCIE(NM),IEEEX(NM)        READEP     95
      INTEGER STAB(NM),GOV(NM),TB(NM)                                   READEP     96
C                                                                       READEP     97
      INTEGER NTHREL(NB/3)                                              READEP     98
      INTEGER RLBUS1(NB/3),RLBUS2(NB/3)                                 READEP     99
      INTEGER RELBUS                                                    READEP    100
      INTEGER NTHMOT(NMT),MOTBUS(NMT)                                   READEP    101
      INTEGER LSVCBN(NB),LSVC(NSR),LSVCA(NSR),LSVCB(NSR)                READEP    102
      INTEGER LSVCC(NSR),LSVCD(NSR),LSVCE(NSR),LSVCF(NSR)               READEP    103
      INTEGER LFSVCO(NSR),LFSVCR(NSR),LFSAR(NSR),LFSBRF(NSR)            READEP    104
      INTEGER LFSBRT(NSR),LFSCR(NSR),ITHGEN(20)                         READEP    105
C                                                                       READEP    106
      LOGICAL IHPLP,JAUTB,RDMODS                                        READEP    107
C............................................                           READEP    108
C                                                                       READEP    109
C     PUT THESE LOCAL VARIABLES IN A COMMON SCRATCH AREA.               READEP    110
C                                                                       READEP    111
      COMMON/SCRAT2/ JFNAME,CARD1,CARD3,LINE,MFB,MFB1,MFB2,MFB3         READEP    112
     &              ,IEEEX1,IEEEX2,IEEEX3,IEEEX4,IEEEX5                 READEP    113
      COMMON/SCRAT8/ MFNAME                                             READEP    114
C                                                                       READEP    115
*IF -MI2                                                                READEP    116
      INTEGER*2 NTHGEL,NEXTG,NGSTAT,KRELTY,IFSLSD,INXLSD,ILSREC,        READEP    117
     +          IRRREC,IBSNLD,IZNNLD,IARNLD                             READEP    118
*ENDIF                                                                  READEP    119
      COMMON /SCRAT4/ NTHGEL(NB),NEXTG(NM)                              READEP    120
     &,NGSTAT(NM),KRELTY(NB/3)                                          READEP    121
C                                                                       READEP    122
      COMMON /SCRAT3/ MB,MC,MF,EXCEP,EXCIE,IEEEX,STAB,GOV,TB            READEP    123
     +               ,NTHREL,RLBUS1,RLBUS2                              READEP    124
     +               ,IBSNLD(NB),IZNNLD(JZN),IARNLD(JAR),NTHMOT,MOTBUS  READEP    125
     +               ,LSVCBN,LSVC,LSVCA,LSVCB,LSVCC,LSVCD,LSVCE         READEP    126
     +               ,LSVCF,LFSVCO,LFSVCR,LFSAR,LFSBRF                  READEP    127
     +               ,LFSBRT,LFSCR,ITHGEN                               READEP    128
     +               ,IFSLSD(NB),INXLSD(MAXSET),ILSREC(MAXSET)          READEP    129
     +               ,IRRREC(15*MAXSET)                                 READEP    130
C                                                                       READEP    131
C ------------------|                                                   READEP    132
      DATA NOBUSS/'            '/                                       READEP    133
C                                                                       READEP    134
      DATA COL1/'M','E','F','S','G','I','T','U','R','L','V','W'/        READEP    135
      DATA COL2M/' ','C','F'/                                           READEP    136
      DATA COL2U/'F','V','D','1','2','3'/                               READEP    137
      DATA COL2R/'A','D','G','L','M','O','U','R','Y','1','2','3'/       READEP    138
      DATA COL2S/'A','B','C','D','E','F'/                               READEP    139
      DATA COL34R/'M','D','R','B','G'/                                  READEP    140
      DATA ICO1                 /12/                                    READEP    141
      DATA ICO2M                /3/                                     READEP    142
      DATA ICO2U                /6/                                     READEP    143
      DATA ICO2R                /12/                                    READEP    144
      DATA ICO2S                /6/                                     READEP    145
      DATA ICO34R               /5/                                     READEP    146
C                                                                       READEP    147
C ----------------------------------------------------------------------READEP    148
C                        FIRST EXECUTABLE STATEMENT                     READEP    149
C ----------------------------------------------------------------------READEP    150
C                                                                       READEP    151
      LDEB=(JDEB(91).NE.0)                                              READEP    152
C                                                                       READEP    153
      CALL HMOVE(0,NTHGEL,NTHGEL,NLFBUS)                                READEP    154
      CALL HMOVE(0,NEXTG,NEXTG,NM)                                      READEP    155
      CALL MOVE(0,LSVCBN,LSVCBN,NB)                                     READEP    156
C                                                                       READEP    157
      CALL HMOVE(0,IFSLSD,IFSLSD,NLFBUS)                                READEP    158
      CALL HMOVE(0,INXLSD,INXLSD,MAXSET)                                READEP    159
      CALL HMOVE(0,IRRREC,IRRREC,15*MAXSET)                             READEP    160
C                                                                       READEP    161
      CALL HMOVE(0,IBSNLD,IBSNLD,NB)                                    READEP    162
      CALL HMOVE(0,IZNNLD,IZNNLD,JZN)                                   READEP    163
      CALL HMOVE(0,IARNLD,IARNLD,JAR)                                   READEP    164
      ITLNLD=0                                                          READEP    165
C                                                                       READEP    166
      RDMODS=.FALSE.                                                    READEP    167
      IBUSO2=0                                                          READEP    168
      IRELAY=0                                                          READEP    169
      JSCHEM=0                                                          READEP    170
      LGBUS=0                                                           READEP    171
      RELBUS=0                                                          READEP    172
      NGEN=0                                                            READEP    173
      NMOTBS=0                                                          READEP    174
      NSVCBS=0                                                          READEP    175
      NTLSD=0                                                           READEP    176
C                                                                       READEP    177
      LASTBU=0                                                          READEP    178
C                                                                       READEP    179
      JREC=0                                                            READEP    180
C                                                                       READEP    181
      JLENG=50                                                          READEP    182
      IKEY=4                                                            READEP    183
      CALL OPENRE(IU31,FILNAM,JLENG,IKEY,ISTAT,0)                       READEP    184
      LUNITS(IU31)=.TRUE.                                               READEP    185
C                                                                       READEP    186
      IF(IBPAFL.EQ.1)THEN                                               READEP    187
        LINOUT=' BPAW'                                                  READEP    188
        WRITE(IUY,7000)LINOUT                                           READEP    189
      ELSEIF(IBPAFL.EQ.2)THEN                                           READEP    190
        LINOUT=' EPGE'                                                  READEP    191
        WRITE(IUY,7000)LINOUT                                           READEP    192
      ENDIF                                                             READEP    193
C                                                                       READEP    194
C                             ==============                            READEP    195
C                              :  SECTION 1 :                           READEP    196
C                             ==============                            READEP    197
C                                                                       READEP    198
 100  IF(.NOT.RDMODS)THEN                                               READEP    199
C                                                                       READEP    200
        CALL GETLIN(IUX,LINE)                                           READEP    201
        IF(LINE(1:5).EQ.'EDATA')THEN                                    READEP    202
          IF(CFLRUN.AND.IFSPTR(IBPADY).NE.0)THEN                        READEP    203
            KREC=IFSPTR(IBPADY)                                         READEP    204
            READ(IU56,REC=KREC)LINE                                     READEP    205
            IF(LINE(1:5).NE.' EPGE')THEN                                READEP    206
              MSG(1)=' *** KEYWORD EPGE MISSING IN THE FOLLOWING'       READEP    207
     +               //' DYN MOD CARD.'                                 READEP    208
              MSG(2)=LINE                                               READEP    209
              MSG(3)=' *** ALL DYN MOD CARDS WILL BE IGNORED'           READEP    210
              CALL PRTMSG(3)                                            READEP    211
              GOTO 450                                                  READEP    212
            ENDIF                                                       READEP    213
            KREC=INXPTR(KREC)                                           READEP    214
            RDMODS=.TRUE.                                               READEP    215
            GOTO 100                                                    READEP    216
          ELSE                                                          READEP    217
            GOTO 450                                                    READEP    218
          ENDIF                                                         READEP    219
        ENDIF                                                           READEP    220
C                                                                       READEP    221
      ELSE                                                              READEP    222
C                                                                       READEP    223
        IF(KREC.EQ.0)GOTO 450                                           READEP    224
        READ(IU56,REC=KREC)LINE                                         READEP    225
        IF(LINE(1:5).EQ.'EDATA')GOTO 450                                READEP    226
        KREC=INXPTR(KREC)                                               READEP    227
C                                                                       READEP    228
      ENDIF                                                             READEP    229
C                                                                       READEP    230
      DO 110 I=1,ICO1                                                   READEP    231
        IF(LINE(1:1).EQ.COL1(I))THEN                                    READEP    232
          ICODE=I                                                       READEP    233
          GOTO 120                                                      READEP    234
        ENDIF                                                           READEP    235
  110 CONTINUE                                                          READEP    236
C                                                                       READEP    237
C-----------------------------------------------------------------------READEP    238
C     DOESN'T RECOGNIZE THIS KEY WORD IN COLUMN 1                       READEP    239
C                                                                       READEP    240
      WRITE(MSG(1),1000)                                                READEP    241
      MSG(2)=LINE                                                       READEP    242
      CALL PRTMSG(2)                                                    READEP    243
      IF(RDMODS)THEN                                                    READEP    244
        LINE='READEP:  CHECK COLUMN 1 IN DYN MOD CARDS'                 READEP    245
        CALL ASTOP(LINE,44)                                             READEP    246
      ELSE                                                              READEP    247
        LINE='READEP:  CHECK COLUMN 1 IN BPA/OLD DYNAMIC DATA CARDS'    READEP    248
        CALL ASTOP(LINE,53)                                             READEP    249
      ENDIF                                                             READEP    250
C                                                                       READEP    251
C-----------------------------------------------------------------------READEP    252
C                                                                       READEP    253
  120 CONTINUE                                                          READEP    254
C                                                                       READEP    255
C     KEY WORD MATCH. CHECK IF THE BUS NAME EXIST                       READEP    256
C     ICODE=6 IS IEEE KEYWORD. BUS NAME IS NOT INVOLVED IN THIS CARD    READEP    257
C                                                                       READEP    258
C           'M'  'E'  'F'  'S'  'G'  'I'  'T'  'U'  'R'  'L'            READEP    259
      GOTO (130, 130, 130, 130, 130, 130, 130, 340, 390, 430,           READEP    260
C           'V'  'W'                                                    READEP    261
     1      440, 447) ICODE                                             READEP    262
C                                                                       READEP    263
C     MACHINE DATA                                                      READEP    264
C                                                                       READEP    265
 130  CONTINUE                                                          READEP    266
C                                                                       READEP    267
C     CHECK IF THE CARD IS INDUCTION MOTOR CARD                         READEP    268
C                                                                       READEP    269
      IF(LINE(1:2).EQ.'MI') GOTO 435                                    READEP    270
C                                                                       READEP    271
      IF(ICODE.EQ.6)THEN                                                READEP    272
        IF(RDMODS)THEN                                                  READEP    273
          MSG(1)=' *** IEEE EXCITERS ARE NOT ALLOWED IN DYN '//         READEP    274
     +           'MOD CARDS.'                                           READEP    275
          MSG(2)=LINE                                                   READEP    276
          CALL PRTMSG(2)                                                READEP    277
          LINE='READEP: IEEE EXCITERS MUST BE REMOVED.'                 READEP    278
          CALL ASTOP(LINE,38)                                           READEP    279
        ENDIF                                                           READEP    280
        CALL GETLIN(IUX,LINE)                                           READEP    281
        IEEEX1=LINE                                                     READEP    282
        BSNAME=LINE(7:18)                                               READEP    283
        LINE(4:15)=BSNAME                                               READEP    284
        LINE(16:16)=LINE(20:20)                                         READEP    285
      ENDIF                                                             READEP    286
C                                                                       READEP    287
 140  BSNAME=LINE(4:15)                                                 READEP    288
      CALL CHKBUS(BSNAME,IBUSOK)                                        READEP    289
      IF(IBUSOK.LE.0)THEN                                               READEP    290
C                                                                       READEP    291
C     BUS NOT EXIST WRITE OUT WARNING MESSAGE AND SKIP THIS CARD        READEP    292
C                                                                       READEP    293
        WRITE(MSG(1),1190)                                              READEP    294
        MSG(2)=LINE                                                     READEP    295
        CALL PRTMSG(2)                                                  READEP    296
        IF(ICODE.EQ.6)THEN                                              READEP    297
          DO 150 I=1,4                                                  READEP    298
            IF(.NOT.RDMODS)THEN                                         READEP    299
              CALL GETLIN(IUX,LINE)                                     READEP    300
            ELSE                                                        READEP    301
              READ(IU56,REC=KREC)LINE                                   READEP    302
              KREC=INXPTR(KREC)                                         READEP    303
            ENDIF                                                       READEP    304
            READ(LINE,1310) LINE                                        READEP    305
            WRITE(MSG(1),1190)                                          READEP    306
            MSG(2)=LINE                                                 READEP    307
            CALL PRTMSG(2)                                              READEP    308
 150      CONTINUE                                                      READEP    309
        ENDIF                                                           READEP    310
        GOTO 100                                                        READEP    311
C                                                                       READEP    312
C     BUS EXIST CHECK NTHGEL LIST                                       READEP    313
C                                                                       READEP    314
      ELSE                                                              READEP    315
C                                                                       READEP    316
        KTHGEN=NTHGEL(IBUSOK)                                           READEP    317
        IF(KTHGEN.EQ.0)THEN                                             READEP    318
          NGEN=NGEN+1                                                   READEP    319
          IF(NGEN.GT.NXM)THEN                                           READEP    320
            WRITE(MSG(1),1360)                                          READEP    321
            MSG(2)=LINE                                                 READEP    322
            CALL PRTMSG(2)                                              READEP    323
            LINE='READEP: YOU HAVE TOO MANY GENERATORS'                 READEP    324
            CALL ASTOP(LINE,36)                                         READEP    325
          ENDIF                                                         READEP    326
          KTHGEN=NGEN                                                   READEP    327
          NTHGEL(IBUSOK)=KTHGEN                                         READEP    328
          MFNAME(KTHGEN)=LINE(4:16)                                     READEP    329
          NGSTAT(KTHGEN)=0                                              READEP    330
          MB(KTHGEN)=0                                                  READEP    331
          MC(KTHGEN)=0                                                  READEP    332
          MF(KTHGEN)=0                                                  READEP    333
          STAB(KTHGEN)=0                                                READEP    334
          IEEEX(KTHGEN)=0                                               READEP    335
          EXCEP(KTHGEN)=0                                               READEP    336
          EXCIE(KTHGEN)=0                                               READEP    337
          GOV(KTHGEN)=0                                                 READEP    338
          TB(KTHGEN)=0                                                  READEP    339
          IF(IBUSOK.GT.LGBUS)LGBUS=IBUSOK                               READEP    340
          GOTO 170                                                      READEP    341
        ELSE                                                            READEP    342
  160     IF(LINE(4:16).EQ.MFNAME(KTHGEN))THEN                          READEP    343
C                                                                       READEP    344
C EXISTING GENERATOR - REPLACE DATA                                     READEP    345
C                                                                       READEP    346
            GOTO 170                                                    READEP    347
          ENDIF                                                         READEP    348
          LTHGEN=KTHGEN                                                 READEP    349
          KTHGEN=NEXTG(KTHGEN)                                          READEP    350
          IF(KTHGEN.EQ.0)THEN                                           READEP    351
            NGEN=NGEN+1                                                 READEP    352
            IF(NGEN.GT.NXM)THEN                                         READEP    353
              WRITE(MSG(1),1360)                                        READEP    354
              MSG(2)=LINE                                               READEP    355
              CALL PRTMSG(2)                                            READEP    356
              LINE='READEP: YOU HAVE TOO MANY GENERATORS'               READEP    357
              CALL ASTOP(LINE,36)                                       READEP    358
            ENDIF                                                       READEP    359
            KTHGEN=NGEN                                                 READEP    360
            NEXTG(LTHGEN)=KTHGEN                                        READEP    361
            MFNAME(KTHGEN)=LINE(4:16)                                   READEP    362
            NGSTAT(KTHGEN)=0                                            READEP    363
            MB(KTHGEN)=0                                                READEP    364
            MC(KTHGEN)=0                                                READEP    365
            MF(KTHGEN)=0                                                READEP    366
            STAB(KTHGEN)=0                                              READEP    367
            IEEEX(KTHGEN)=0                                             READEP    368
            EXCEP(KTHGEN)=0                                             READEP    369
            EXCIE(KTHGEN)=0                                             READEP    370
            GOV(KTHGEN)=0                                               READEP    371
            TB(KTHGEN)=0                                                READEP    372
            GOTO 170                                                    READEP    373
          ELSE                                                          READEP    374
            GOTO 160                                                    READEP    375
          ENDIF                                                         READEP    376
        ENDIF                                                           READEP    377
      ENDIF                                                             READEP    378
C                                                                       READEP    379
 170  CONTINUE                                                          READEP    380
C-----------------------------------------------------------------------READEP    381
C     BUS NAME CHECKED OUT OK                                           READEP    382
C                                                                       READEP    383
C     CARD CODE IS ONE OF : M-MACHINE, E-EXCITER, S-STABILIZER,G-GOVERNOREADEP    384
C                                        I-IEEE,U-USER DEFINED MODELS.  READEP    385
C             M    E    F    S    G    I    T                           READEP    386
      GOTO( 180, 240, 250, 260, 300, 310, 330) ICODE                    READEP    387
C                                                                       READEP    388
C-----------------------------------------------------------------------READEP    389
C     MACHINE DATA                                                      READEP    390
C                                                                       READEP    391
  180 CONTINUE                                                          READEP    392
      IF(LDEB) WRITE(IUD6,1040) LINE                                    READEP    393
C                                                                       READEP    394
      DO 190 I=1,ICO2M                                                  READEP    395
      IF(LINE(2:2).EQ.COL2M(I))THEN                                     READEP    396
         ICODE2=I                                                       READEP    397
         GOTO 200                                                       READEP    398
      ENDIF                                                             READEP    399
  190 CONTINUE                                                          READEP    400
C                                                                       READEP    401
C................................................................       READEP    402
C     DOESN'T RECOGNIZE COLUMN 2 KEY WORD FOR MACHINE CARD              READEP    403
C                                                                       READEP    404
      WRITE(MSG(1),1010)                                                READEP    405
      MSG(2)=LINE                                                       READEP    406
      CALL PRTMSG(2)                                                    READEP    407
      LINE='READEP: CHECK COLUMN 2 IN MACHINE DATA CARDS'               READEP    408
      CALL ASTOP(LINE,44)                                               READEP    409
C                                                                       READEP    410
C.................................................................      READEP    411
C                                                                       READEP    412
  200 CONTINUE                                                          READEP    413
C                                                                       READEP    414
C     MACHINE COULD BE CLASSICAL (C) , OR DETAILED (F) MODEL            READEP    415
C                                                                       READEP    416
C            ' '   C    F                                               READEP    417
      GOTO( 210, 220, 230) ICODE2                                       READEP    418
C                                                                       READEP    419
C..................................................................     READEP    420
C     BLANK IN COLUMN 2 , MACHINE CARD                                  READEP    421
C                                                                       READEP    422
  210 CONTINUE                                                          READEP    423
C                                                                       READEP    424
      IF(MB(KTHGEN).EQ.0)THEN                                           READEP    425
        JREC=JREC+1                                                     READEP    426
        MB(KTHGEN)=JREC                                                 READEP    427
      ENDIF                                                             READEP    428
      IREC=MB(KTHGEN)                                                   READEP    429
      WRITE(IU31,REC=IREC) LINE                                         READEP    430
C                                                                       READEP    431
      GOTO 100                                                          READEP    432
C                                                                       READEP    433
C.................................................................      READEP    434
C     'C' IN COLUMN 2 , MACHINE CARD                                    READEP    435
C                                                                       READEP    436
  220 CONTINUE                                                          READEP    437
C                                                                       READEP    438
      IF(MC(KTHGEN).EQ.0)THEN                                           READEP    439
        JREC=JREC+1                                                     READEP    440
        MC(KTHGEN)=JREC                                                 READEP    441
      ENDIF                                                             READEP    442
      NGSTAT(KTHGEN)=1                                                  READEP    443
      IREC=MC(KTHGEN)                                                   READEP    444
      WRITE(IU31,REC=IREC) LINE                                         READEP    445
C                                                                       READEP    446
      GOTO 100                                                          READEP    447
C                                                                       READEP    448
C..................................................................     READEP    449
C     'F' IN COLUMN 2 , MACHINE CARD                                    READEP    450
C                                                                       READEP    451
  230 CONTINUE                                                          READEP    452
C                                                                       READEP    453
      IF(MF(KTHGEN).EQ.0)THEN                                           READEP    454
        JREC=JREC+1                                                     READEP    455
        MF(KTHGEN)=JREC                                                 READEP    456
      ENDIF                                                             READEP    457
      NGSTAT(KTHGEN)=2                                                  READEP    458
      IREC=MF(KTHGEN)                                                   READEP    459
      WRITE(IU31,REC=IREC) LINE                                         READEP    460
      GOTO 100                                                          READEP    461
C                                                                       READEP    462
C-----------------------------------------------------------------------READEP    463
C     EXCITER DATA                                                      READEP    464
  240 CONTINUE                                                          READEP    465
C                                                                       READEP    466
      IF(IBPAFL.GT.0)WRITE(IUY,7000)LINE                                READEP    467
C                                                                       READEP    468
      IF(LDEB) WRITE(IUD6,1060) LINE                                    READEP    469
      IF(EXCEP(KTHGEN).EQ.0)THEN                                        READEP    470
        JREC=JREC+1                                                     READEP    471
        EXCEP(KTHGEN)=JREC                                              READEP    472
      ENDIF                                                             READEP    473
      IREC=EXCEP(KTHGEN)                                                READEP    474
      WRITE(IU31,REC=IREC) LINE                                         READEP    475
C                                                                       READEP    476
      GOTO 100                                                          READEP    477
C                                                                       READEP    478
C-----------------------------------------------------------------------READEP    479
C    BPA-IEEE EXCITER DATA                                              READEP    480
  250 CONTINUE                                                          READEP    481
C                                                                       READEP    482
      IF(LDEB) WRITE(IUD6,1060) LINE                                    READEP    483
C                                                                       READEP    484
      IF(EXCIE(KTHGEN).EQ.0)THEN                                        READEP    485
        JREC=JREC+1                                                     READEP    486
        EXCIE(KTHGEN)=JREC                                              READEP    487
        IREC=EXCIE(KTHGEN)                                              READEP    488
C                                                                       READEP    489
        IF(IBPAFL.GT.0)THEN                                             READEP    490
          LINOUT=LINE                                                   READEP    491
          IF(IBPAFL.EQ.1)LINOUT(3:3)='1'                                READEP    492
          WRITE(IUY,7000)LINOUT                                         READEP    493
        ENDIF                                                           READEP    494
C                                                                       READEP    495
        WRITE(IU31,REC=IREC) LINE                                       READEP    496
C                             Second card required for a new generator  READEP    497
        IF(.NOT.RDMODS)THEN                                             READEP    498
          CALL GETLIN(IUX,LINE1)                                        READEP    499
        ELSE                                                            READEP    500
          READ(IU56,REC=KREC)LINE1                                      READEP    501
          KREC=INXPTR(KREC)                                             READEP    502
        ENDIF                                                           READEP    503
        IF(LDEB) WRITE(IUD6,1060) LINE1                                 READEP    504
        IF(LINE1(1:2).EQ.'FZ')THEN                                      READEP    505
C                                                                       READEP    506
          IF(IBPAFL.GT.0)THEN                                           READEP    507
            IF(IBPAFL.EQ.1)THEN                                         READEP    508
              LINOUT=LINE1                                              READEP    509
              LINOUT(2:2)=LINE(2:2)                                     READEP    510
              LINOUT(3:3)='2'                                           READEP    511
            ENDIF                                                       READEP    512
            WRITE(IUY,7000)LINOUT                                       READEP    513
          ENDIF                                                         READEP    514
C                                                                       READEP    515
          JREC=JREC+1                                                   READEP    516
          IREC=JREC                                                     READEP    517
          WRITE(IU31,REC=IREC) LINE1                                    READEP    518
        ELSE                                                            READEP    519
          MSG(1)=' *** ERROR IN READING SECOND EXCITER CARD FOR'        READEP    520
          MSG(2)=LINE                                                   READEP    521
          CALL PRTMSG(2)                                                READEP    522
          LINE='READEP: SECOND EXCITER CARD IS INVALID'                 READEP    523
          CALL ASTOP(LINE,38)                                           READEP    524
        ENDIF                                                           READEP    525
      ELSE                                                              READEP    526
        IREC=EXCIE(KTHGEN)                                              READEP    527
        LINOUT=LINE                                                     READEP    528
        IF(LINE(2:2).EQ.'Z')THEN                                        READEP    529
          READ(IU31,REC=IREC)LINE1                                      READEP    530
          IF(IBPAFL.EQ.1)THEN                                           READEP    531
            LINOUT(2:2)=LINE1(2:2)                                      READEP    532
            LINOUT(3:3)='2'                                             READEP    533
          ENDIF                                                         READEP    534
          IREC=IREC+1                                                   READEP    535
        ELSE                                                            READEP    536
          LINOUT(3:3)='1'                                               READEP    537
        ENDIF                                                           READEP    538
        IF(IBPAFL.GT.0)WRITE(IUX,7000)LINOUT                            READEP    539
        WRITE(IU31,REC=IREC) LINE                                       READEP    540
      ENDIF                                                             READEP    541
C                                                                       READEP    542
      GOTO 100                                                          READEP    543
C ----------------------------------------------------------------      READEP    544
C     STABILIZER DATA                                                   READEP    545
C                                                                       READEP    546
  260 CONTINUE                                                          READEP    547
C                                                                       READEP    548
      IF(IBPAFL.GT.0)THEN                                               READEP    549
        LINOUT=LINE                                                     READEP    550
        IF(IBPAFL.EQ.1)LINOUT(3:3)='1'                                  READEP    551
        WRITE(IUY,7000)LINOUT                                           READEP    552
      ENDIF                                                             READEP    553
C                                                                       READEP    554
      IF(LINE(2:2).EQ.'T')THEN                                          READEP    555
        WRITE(MSG(1),6100)                                              READEP    556
        MSG(2)=LINE                                                     READEP    557
        CALL PRTMSG(2)                                                  READEP    558
      ELSE                                                              READEP    559
        IF(LDEB) WRITE(IUD6,1080) LINE                                  READEP    560
        IF(STAB(KTHGEN).EQ.0)THEN                                       READEP    561
          JREC=JREC+1                                                   READEP    562
          STAB(KTHGEN)=JREC                                             READEP    563
        ENDIF                                                           READEP    564
        IREC=STAB(KTHGEN)                                               READEP    565
        WRITE(IU31,REC=IREC) LINE                                       READEP    566
      ENDIF                                                             READEP    567
C                                                                       READEP    568
      GOTO 100                                                          READEP    569
C                                                                       READEP    570
C-----------------------------------------------------------------------READEP    571
C     GOVERNOR DATA                                                     READEP    572
C                                                                       READEP    573
  300 CONTINUE                                                          READEP    574
C                                                                       READEP    575
      IF(IBPAFL.GT.0)WRITE(IUY,7000)LINE                                READEP    576
C                                                                       READEP    577
      IF(LDEB) WRITE(IUD6,1090) LINE                                    READEP    578
      IF(GOV(KTHGEN).EQ.0)THEN                                          READEP    579
        JREC=JREC+1                                                     READEP    580
        GOV(KTHGEN)=JREC                                                READEP    581
      ENDIF                                                             READEP    582
      IREC=GOV(KTHGEN)                                                  READEP    583
      WRITE(IU31,REC=IREC) LINE                                         READEP    584
C                                                                       READEP    585
      GOTO 100                                                          READEP    586
C                                                                       READEP    587
C-----------------------------------------------------------------------READEP    588
C     IEEE FORMAT EXCITER TYPE DATA                                     READEP    589
C                                                                       READEP    590
C       REPEAT                                                          READEP    591
C         READ 5 CARDS,                                                 READEP    592
C         STORE THE 5 CARDS INTO ARRAY IEEEX(5,MP)                      READEP    593
C       UNTIL (LINE(1:4)='WSCC')                                        READEP    594
C                                                                       READEP    595
C       KIEEE=NUMBER OF IEEE EXCITERS.                                  READEP    596
C                                                                       READEP    597
  310    CONTINUE                                                       READEP    598
C                                                                       READEP    599
         IF(IBPAFL.GT.0)WRITE(IUY,7000)IEEEX1                           READEP    600
C                                                                       READEP    601
         IEEEX(KTHGEN)=JREC+1                                           READEP    602
         JREC=JREC+1                                                    READEP    603
         WRITE(IU31,REC=JREC) IEEEX1                                    READEP    604
C        READ AND STORE 4 MORE CARD                                     READEP    605
         DO 320 I=1,4                                                   READEP    606
           CALL GETLIN(IUX,LINE)                                        READEP    607
C                                                                       READEP    608
           IF(IBPAFL.GT.0)WRITE(IUY,7000)LINE                           READEP    609
C                                                                       READEP    610
           JREC=JREC+1                                                  READEP    611
           WRITE(IU31,REC=JREC) LINE                                    READEP    612
  320    CONTINUE                                                       READEP    613
C                                                                       READEP    614
         CALL GETLIN(IUX,LINE)                                          READEP    615
         IF(LINE(1:5).EQ.'EDATA')GOTO 450                               READEP    616
C                                                                       READEP    617
         IF(IBPAFL.GT.0)WRITE(IUY,7000)LINE                             READEP    618
C                                                                       READEP    619
         IF(LINE(1:4).EQ.'WSCC')THEN                                    READEP    620
           GOTO 100                                                     READEP    621
         ELSEIF(LINE(1:4).NE.'WSCC'.AND. LINE(1:1).EQ.' ')THEN          READEP    622
           IEEEX1=LINE                                                  READEP    623
           BSNAME=LINE(7:18)                                            READEP    624
           LINE(4:15)=BSNAME                                            READEP    625
           LINE(16:16)=LINE(20:20)                                      READEP    626
           GOTO 140                                                     READEP    627
         ELSEIF(LINE(1:4).EQ.'IEEE')THEN                                READEP    628
           GOTO 130                                                     READEP    629
C                                                                       READEP    630
C     ERROR. NOT IEEE KEY WORD..                                        READEP    631
C                                                                       READEP    632
         ELSE                                                           READEP    633
           WRITE(MSG(1),1020)                                           READEP    634
           MSG(2)=LINE                                                  READEP    635
           CALL PRTMSG(2)                                               READEP    636
           LINE='READEP: CHECK COLUMN 1 TO 4 IEEE EXCITER DATA'         READEP    637
           CALL ASTOP(LINE,45)                                          READEP    638
         ENDIF                                                          READEP    639
C                                                                       READEP    640
C    -------------------------------------------------------------      READEP    641
C     TURBINE DATA                                                      READEP    642
C                                                                       READEP    643
  330 CONTINUE                                                          READEP    644
C                                                                       READEP    645
      IF(IBPAFL.GT.0)WRITE(IUY,7000)LINE                                READEP    646
C                                                                       READEP    647
      IF(LDEB) WRITE(IUD6,1090) LINE                                    READEP    648
      IF(TB(KTHGEN).EQ.0)THEN                                           READEP    649
        JREC=JREC+1                                                     READEP    650
        TB(KTHGEN)=JREC                                                 READEP    651
      ENDIF                                                             READEP    652
      IREC=TB(KTHGEN)                                                   READEP    653
      WRITE(IU31,REC=IREC) LINE                                         READEP    654
C                                                                       READEP    655
      GOTO 100                                                          READEP    656
C---------------------------------------------------------------        READEP    657
C     LOAD SHEDDING DATA                                                READEP    658
C                                                                       READEP    659
 340  CONTINUE                                                          READEP    660
C                                                                       READEP    661
      IF(IBPAFL.GT.0)THEN                                               READEP    662
        LINOUT=LINE                                                     READEP    663
        IF(IBPAFL.EQ.1)LINOUT(3:3)='1'                                  READEP    664
        WRITE(IUY,7000)LINOUT                                           READEP    665
      ENDIF                                                             READEP    666
C                                                                       READEP    667
      DO 345 I=1,ICO2U                                                  READEP    668
        IF(LINE(2:2).EQ.COL2U(I))THEN                                   READEP    669
          JTYPE=I                                                       READEP    670
          GOTO 346                                                      READEP    671
        ENDIF                                                           READEP    672
 345  CONTINUE                                                          READEP    673
C                                                                       READEP    674
      WRITE(MSG(1),1380)                                                READEP    675
      MSG(2)=LINE                                                       READEP    676
      CALL PRTMSG(2)                                                    READEP    677
      LINE='READEP: CHECK COLUMN 2 IN LOAD SHEDDING DATA CARS'          READEP    678
      CALL ASTOP(LINE,49)                                               READEP    679
C                                                                       READEP    680
 346  JFLAG=1                                                           READEP    681
      BSNAME=LINE(4:15)                                                 READEP    682
      CALL CHKBUS(BSNAME,IBUSOK)                                        READEP    683
      IF(IBUSOK.GT.0)THEN                                               READEP    684
        JFLAG=0                                                         READEP    685
      ELSEIF (LINE(4:13).EQ.' ')THEN                                    READEP    686
        ZNNAME=LINE(14:15)                                              READEP    687
        CALL CHZONE (ZNNAME,IZONOK)                                     READEP    688
        IF(IZONOK.GT.0)JFLAG=-1                                         READEP    689
      ELSEIF(LINE(4:8).EQ.'TOTAL'.OR.LINE(4:9).EQ.'SYSTEM')THEN         READEP    690
        IF(LINE(9:15).EQ.' ')JFLAG=-3                                   READEP    691
      ELSEIF (LINE(14:15).EQ.' ')THEN                                   READEP    692
        ARNAME=LINE(4:13)                                               READEP    693
        CALL CHAREA (ARNAME,IAREOK)                                     READEP    694
        IF(IAREOK.GT.0)JFLAG=-2                                         READEP    695
      ENDIF                                                             READEP    696
C                                                                       READEP    697
      IF(JFLAG.EQ.1)THEN                                                READEP    698
        WRITE(MSG(1),6000)                                              READEP    699
        MSG(2)=LINE                                                     READEP    700
        CALL PRTMSG(2)                                                  READEP    701
        GOTO 100                                                        READEP    702
      ENDIF                                                             READEP    703
C                                                                       READEP    704
      JREC=JREC+1                                                       READEP    705
      IREC=JREC                                                         READEP    706
      WRITE(IU31,REC=IREC) JFLAG,JTYPE,LINE                             READEP    707
      IF(LINE(16:16).EQ.'S')THEN                                        READEP    708
        ISOPT=1                                                         READEP    709
      ELSE                                                              READEP    710
        ISOPT=0                                                         READEP    711
      ENDIF                                                             READEP    712
C                                                                       READEP    713
      IF(JFLAG.EQ.0)THEN                                                READEP    714
        IF(IBUSOK.GT.LASTBU)LASTBU=IBUSOK                               READEP    715
        IPTR=IBUSOK                                                     READEP    716
        CALL EPLSB1(IPTR,JREC,NTLSD,JTYPE,JFLAG,IERR)                   READEP    717
        IF(IERR.NE.0)GOTO 357                                           READEP    718
      ELSEIF(JFLAG.EQ.-1)THEN                                           READEP    719
        K=0                                                             READEP    720
        KK=0                                                            READEP    721
        DO 352 II=1,NLFBUS                                              READEP    722
          K=K+4                                                         READEP    723
          KK=KK+8                                                       READEP    724
          ILK=IBAR(K-1)                                                 READEP    725
          CALL UPACKI(IZONE,JJJ,ILK)                                    READEP    726
          IF(IZONE.EQ.IZONOK)THEN                                       READEP    727
            IF((IBAR(K-2).NE.0.OR.IBAR(K-3).NE.0).OR.                   READEP    728
     +         ((ISOPT.EQ.1).AND.                                       READEP    729
     +          (RYGR(KK-3).NE.0.0.OR.RYGR(KK-4).NE.0.0)))THEN          READEP    730
              IF(II.GT.LASTBU)LASTBU=II                                 READEP    731
              IPTR=II                                                   READEP    732
              CALL EPLSB1(IPTR,JREC,NTLSD,JTYPE,JFLAG,IERR)             READEP    733
              IF(IERR.NE.0)GOTO 357                                     READEP    734
            ENDIF                                                       READEP    735
          ENDIF                                                         READEP    736
 352    CONTINUE                                                        READEP    737
      ELSEIF(JFLAG.EQ.-2)THEN                                           READEP    738
        K=0                                                             READEP    739
        KK=0                                                            READEP    740
        DO 354 II=1,NLFBUS                                              READEP    741
          K=K+4                                                         READEP    742
          KK=KK+8                                                       READEP    743
          ILK=IBAR(K-1)                                                 READEP    744
          CALL UPACKI(JJJ,IAREA,ILK)                                    READEP    745
          IF(IAREA.EQ.IAREOK)THEN                                       READEP    746
            IF((IBAR(K-2).NE.0.OR.IBAR(K-3).NE.0).OR.                   READEP    747
     +         ((ISOPT.EQ.1).AND.                                       READEP    748
     +          (RYGR(KK-3).NE.0.0.OR.RYGR(KK-4).NE.0.0)))THEN          READEP    749
              IF(II.GT.LASTBU)LASTBU=II                                 READEP    750
              IPTR=II                                                   READEP    751
              CALL EPLSB1(IPTR,JREC,NTLSD,JTYPE,JFLAG,IERR)             READEP    752
              IF(IERR.NE.0)GOTO 357                                     READEP    753
            ENDIF                                                       READEP    754
          ENDIF                                                         READEP    755
 354    CONTINUE                                                        READEP    756
      ELSE                                                              READEP    757
        K=0                                                             READEP    758
        KK=0                                                            READEP    759
        DO 356 II=1,NLFBUS                                              READEP    760
          K=K+4                                                         READEP    761
          KK=KK+8                                                       READEP    762
          IF((IBAR(K-2).NE.0.OR.IBAR(K-3).NE.0).OR.                     READEP    763
     +       ((ISOPT.EQ.1).AND.                                         READEP    764
     +        (RYGR(KK-3).NE.0.0.OR.RYGR(KK-4).NE.0.0)))THEN            READEP    765
            IF(II.GT.LASTBU)LASTBU=II                                   READEP    766
            IPTR=II                                                     READEP    767
            CALL EPLSB1(IPTR,JREC,NTLSD,JTYPE,JFLAG,IERR)               READEP    768
            IF(IERR.NE.0)GOTO 357                                       READEP    769
          ENDIF                                                         READEP    770
 356    CONTINUE                                                        READEP    771
      ENDIF                                                             READEP    772
C                                                                       READEP    773
      GOTO 100                                                          READEP    774
C                                                                       READEP    775
 357  WRITE(MSG(1),1370)                                                READEP    776
      MSG(2)=LINE                                                       READEP    777
      CALL PRTMSG(2)                                                    READEP    778
      LINE='READEP: THERE ARE TOO MANY LOAD SHEDDING BUSSES'            READEP    779
      CALL ASTOP(LINE,47)                                               READEP    780
C                                                                       READEP    781
C---------------------------------------------------------------        READEP    782
C                                                                       READEP    783
C     RELAY DATA                                                        READEP    784
C                                                                       READEP    785
 390  CONTINUE                                                          READEP    786
C                                                                       READEP    787
      IF(IBPAFL.GT.0)THEN                                               READEP    788
        LINOUT=LINE                                                     READEP    789
        IF(IBPAFL.EQ.1)LINOUT(3:3)='1'                                  READEP    790
        WRITE(IUY,7000)LINOUT                                           READEP    791
      ENDIF                                                             READEP    792
C                                                                       READEP    793
      BSNAME=LINE(7:18)                                                 READEP    794
      CALL CHKBUS(BSNAME,IBUSO1)                                        READEP    795
C                                                                       READEP    796
C     BUS NOT FOUND WRITE OUT WARNING MESSAGE AND SKIP THIS CARD        READEP    797
C                                                                       READEP    798
      IF(IBUSO1.LE.0)THEN                                               READEP    799
        WRITE(MSG(1),1190)                                              READEP    800
        MSG(2)=LINE                                                     READEP    801
        CALL PRTMSG(2)                                                  READEP    802
        GOTO 100                                                        READEP    803
      ENDIF                                                             READEP    804
C                                                                       READEP    805
      IBUSO2=0                                                          READEP    806
      BSNAME=LINE(20:31)                                                READEP    807
      IF(BSNAME.NE.NOBUSS)THEN                                          READEP    808
        CALL CHKBUS(BSNAME,IBUSO2)                                      READEP    809
        IF(IBUSO2.LE.0)THEN                                             READEP    810
          WRITE(MSG(1),1190)                                            READEP    811
          MSG(2)=LINE                                                   READEP    812
          CALL PRTMSG(2)                                                READEP    813
          GOTO 100                                                      READEP    814
        ENDIF                                                           READEP    815
      ENDIF                                                             READEP    816
C                                                                       READEP    817
      DO 400 I=1,ICO2R                                                  READEP    818
        IF(LINE(2:2).EQ.COL2R(I))THEN                                   READEP    819
          ICODE2=I                                                      READEP    820
          GOTO 410                                                      READEP    821
        ENDIF                                                           READEP    822
 400  CONTINUE                                                          READEP    823
C                                                                       READEP    824
C     DOESN'T RECOGNIZE COLUMN 2 KEY WORD IN RELAY DATA                 READEP    825
C                                                                       READEP    826
      WRITE(MSG(1),2030)                                                READEP    827
      MSG(2)=LINE                                                       READEP    828
      CALL PRTMSG(2)                                                    READEP    829
      LINE='READEP: CHECK COLUMN 2 IN RELAY DATA CARDS'                 READEP    830
      CALL ASTOP(LINE,42)                                               READEP    831
C                                                                       READEP    832
 410  CONTINUE                                                          READEP    833
C          'A', 'D', 'G', 'L', 'M', 'O', 'U', 'R', 'Y',                 READEP    834
C          '1', '2', '3'                                                READEP    835
      GOTO(415, 420, 415, 415, 415, 415, 415, 420, 415,                 READEP    836
     1     415, 415, 415) ICODE2                                        READEP    837
C                                                                       READEP    838
 415  CONTINUE                                                          READEP    839
      WRITE(MSG(1),2040)                                                READEP    840
      MSG(2)=LINE                                                       READEP    841
      CALL PRTMSG(2)                                                    READEP    842
      LINE='READEP: RELAY DATA FORMAT NOT READY'                        READEP    843
      CALL ASTOP(LINE,35)                                               READEP    844
C                                                                       READEP    845
 420  CONTINUE                                                          READEP    846
      RELBUS=RELBUS+1                                                   READEP    847
      IF(RELBUS.GT.NB/3)THEN                                            READEP    848
        WRITE(MSG(1),1400)                                              READEP    849
        MSG(2)=LINE                                                     READEP    850
        CALL PRTMSG(2)                                                  READEP    851
        LINE='READEP: YOU HAVE TOO MANY RELAY BUSES'                    READEP    852
        CALL ASTOP(LINE,37)                                             READEP    853
      ENDIF                                                             READEP    854
      RLBUS1(RELBUS)=IBUSO1                                             READEP    855
      RLBUS2(RELBUS)=IBUSO2                                             READEP    856
      KRELTY(RELBUS)=ICODE2                                             READEP    857
      JREC=JREC+1                                                       READEP    858
      NTHREL(RELBUS)=JREC                                               READEP    859
      IREC=JREC                                                         READEP    860
C                                                                       READEP    861
 422  WRITE(IU31,REC=IREC) LINE                                         READEP    862
      GOTO 100                                                          READEP    863
C                                                                       READEP    864
C     NONLINEAR LOAD DATA                                               READEP    865
C                                                                       READEP    866
 430  CONTINUE                                                          READEP    867
C                                                                       READEP    868
      IF(IBPAFL.GT.0)WRITE(IUY,7000)LINE                                READEP    869
C                                                                       READEP    870
      READ(LINE,3030)AP1,AQ1,AP2,AQ2,AP3,AQ3,AP4,AQ4,ALDP,ALDQ          READEP    871
C                                                                       READEP    872
      IF(LINE(2:2).EQ.'A')THEN                                          READEP    873
        ATP=AP1+AP2+AP3+AP4                                             READEP    874
        ATQ=AQ1+AQ2+AQ3+AQ4                                             READEP    875
      ELSEIF(LINE(2:2).EQ.'B')THEN                                      READEP    876
        ATP=AP1+AP2+AP3                                                 READEP    877
        ATQ=AQ1+AQ2+AQ3                                                 READEP    878
      ELSE                                                              READEP    879
        WRITE(MSG(1),1020)                                              READEP    880
        MSG(2)=LINE                                                     READEP    881
        CALL PRTMSG(2)                                                  READEP    882
        GOTO 100                                                        READEP    883
      ENDIF                                                             READEP    884
C                                                                       READEP    885
      ITP=ATP*100                                                       READEP    886
      ITQ=ATQ*100                                                       READEP    887
      IF(ITP.NE.100.OR.ITQ.NE.100)THEN                                  READEP    888
        WRITE(MSG(1),3020)                                              READEP    889
        MSG(2)=LINE                                                     READEP    890
        GOTO 100                                                        READEP    891
      ENDIF                                                             READEP    892
C                                                                       READEP    893
      ARNAME=LINE(18:27)                                                READEP    894
      IF(ARNAME(1:5).EQ.'TOTAL'.OR.ARNAME(1:6).EQ.'SYSTEM')THEN         READEP    895
        IF(ITLNLD.EQ.0)THEN                                             READEP    896
          JREC=JREC+1                                                   READEP    897
          ITLNLD=JREC                                                   READEP    898
        ENDIF                                                           READEP    899
        IREC=ITLNLD                                                     READEP    900
        GOTO 432                                                        READEP    901
      ENDIF                                                             READEP    902
C                                                                       READEP    903
      CALL CHAREA (ARNAME,IAREOK)                                       READEP    904
      IF(IAREOK.GT.0)THEN                                               READEP    905
        IF(IARNLD(IAREOK).EQ.0)THEN                                     READEP    906
          JREC=JREC+1                                                   READEP    907
          IARNLD(IAREOK)=JREC                                           READEP    908
        ENDIF                                                           READEP    909
        IREC=IARNLD(IAREOK)                                             READEP    910
        GOTO 432                                                        READEP    911
      ENDIF                                                             READEP    912
C                                                                       READEP    913
      ZNNAME=LINE(16:17)                                                READEP    914
      CALL CHZONE (ZNNAME,IZONOK)                                       READEP    915
      IF(IZONOK.GT.0)THEN                                               READEP    916
        IF(IZNNLD(IZONOK).EQ.0)THEN                                     READEP    917
          JREC=JREC+1                                                   READEP    918
          IZNNLD(IZONOK)=JREC                                           READEP    919
        ENDIF                                                           READEP    920
        IREC=IZNNLD(IZONOK)                                             READEP    921
        GOTO 432                                                        READEP    922
      ENDIF                                                             READEP    923
C                                                                       READEP    924
      BSNAME=LINE(4:15)                                                 READEP    925
      CALL CHKBUS (BSNAME,IBUSOK)                                       READEP    926
      IF(IBUSOK.GT.0)THEN                                               READEP    927
        IF(IBSNLD(IBUSOK).EQ.0)THEN                                     READEP    928
          JREC=JREC+1                                                   READEP    929
          IBSNLD(IBUSOK)=JREC                                           READEP    930
        ENDIF                                                           READEP    931
        IREC=IBSNLD(IBUSOK)                                             READEP    932
        GOTO 432                                                        READEP    933
      ENDIF                                                             READEP    934
C                                                                       READEP    935
      WRITE(MSG(1),6000)                                                READEP    936
      MSG(2)=LINE                                                       READEP    937
      CALL PRTMSG(2)                                                    READEP    938
      GOTO 100                                                          READEP    939
C                                                                       READEP    940
 432  WRITE(IU31,REC=IREC) LINE                                         READEP    941
      GOTO 100                                                          READEP    942
C                                                                       READEP    943
C     INDUCTION MOTOR DATA CARD                                         READEP    944
C                                                                       READEP    945
 435  CONTINUE                                                          READEP    946
      BSNAME=LINE(4:15)                                                 READEP    947
      CALL CHKBUS(BSNAME,IBUSOK)                                        READEP    948
      IF(IBUSOK.LE.0)THEN                                               READEP    949
C                                                                       READEP    950
C     BUS NOT EXIST WRITE OUT WARNING MESSAGE AND SKIP THIS CARD        READEP    951
C                                                                       READEP    952
        WRITE(MSG(1),1190)                                              READEP    953
        MSG(2)=LINE                                                     READEP    954
        CALL PRTMSG(2)                                                  READEP    955
        GOTO 100                                                        READEP    956
      ENDIF                                                             READEP    957
C                                                                       READEP    958
      DO 436 I=1,NMOTBS                                                 READEP    959
        IF(MOTBUS(I).EQ.IBUSOK)THEN                                     READEP    960
          IRECX=NTHMOT(I)                                               READEP    961
          READ(IU31,REC=IRECX)CARD1                                     READEP    962
          IF(CARD1(16:16).EQ.LINE(16:16))THEN                           READEP    963
            IREC=IRECX                                                  READEP    964
            GOTO 437                                                    READEP    965
          ENDIF                                                         READEP    966
        ENDIF                                                           READEP    967
 436  CONTINUE                                                          READEP    968
C                                                                       READEP    969
      NMOTBS=NMOTBS+1                                                   READEP    970
      IF(NMOTBS.GT.NXMT)THEN                                            READEP    971
        WRITE(MSG(1),2090)                                              READEP    972
        MSG(2)=LINE                                                     READEP    973
        CALL PRTMSG(2)                                                  READEP    974
        LINE='READEP: YOU HAVE TOO MANY INDUCTION MOTORS'               READEP    975
        CALL ASTOP(LINE,42)                                             READEP    976
      ENDIF                                                             READEP    977
      JREC=JREC+1                                                       READEP    978
      NTHMOT(NMOTBS)=JREC                                               READEP    979
      MOTBUS(NMOTBS)=IBUSOK                                             READEP    980
      IREC=JREC                                                         READEP    981
C                                                                       READEP    982
 437  WRITE(IU31,REC=IREC)LINE                                          READEP    983
      GOTO 100                                                          READEP    984
C                                                                       READEP    985
C     SVC FIRST CARD ('V')                                              READEP    986
C                                                                       READEP    987
 440  CONTINUE                                                          READEP    988
C                                                                       READEP    989
      IF(IBPAFL.GT.0)THEN                                               READEP    990
        LINOUT=LINE                                                     READEP    991
        IF(IBPAFL.EQ.1)LINOUT(2:2)='W'                                  READEP    992
        WRITE(IUY,7000)LINOUT                                           READEP    993
      ENDIF                                                             READEP    994
C                                                                       READEP    995
      BSNAME=LINE(69:80)                                                READEP    996
      IF(BSNAME.NE.NOBUSS)THEN                                          READEP    997
        CALL CHKBUS(BSNAME,IBUSOR)                                      READEP    998
        IF(IBUSOR.LE.0)THEN                                             READEP    999
C                                                                       READEP   1000
C       REMOTE BUS NOT EXIST WRITE OUT WARNING AND SKIP THE CARD        READEP   1001
C                                                                       READEP   1002
          WRITE(MSG(1),1190)                                            READEP   1003
          MSG(2)=LINE                                                   READEP   1004
          CALL PRTMSG(2)                                                READEP   1005
          GOTO 100                                                      READEP   1006
        ENDIF                                                           READEP   1007
      ELSE                                                              READEP   1008
        IBUSOR=0                                                        READEP   1009
      ENDIF                                                             READEP   1010
C                                                                       READEP   1011
      BSNAME=LINE(4:15)                                                 READEP   1012
      CALL CHKBUS(BSNAME,IBUSOK)                                        READEP   1013
      IF(IBUSOK.LE.0)THEN                                               READEP   1014
C                                                                       READEP   1015
C     BUS NOT EXIST WRITE OUT WARNING MESSAGE AND SKIP THIS CARD        READEP   1016
C                                                                       READEP   1017
        WRITE(MSG(1),1190)                                              READEP   1018
        MSG(2)=LINE                                                     READEP   1019
        CALL PRTMSG(2)                                                  READEP   1020
        GOTO 100                                                        READEP   1021
      ENDIF                                                             READEP   1022
C                                                                       READEP   1023
      DO 441 I=1,NSVCBS                                                 READEP   1024
        IRECX=LSVC(I)                                                   READEP   1025
        READ(IU31,REC=IRECX)CARD1                                       READEP   1026
        IF(CARD1(4:16).EQ.LINE(4:16))THEN                               READEP   1027
          IREC=IRECX                                                    READEP   1028
          ISVC=I                                                        READEP   1029
          GOTO 442                                                      READEP   1030
        ENDIF                                                           READEP   1031
441   CONTINUE                                                          READEP   1032
C                                                                       READEP   1033
      NSVCBS=NSVCBS+1                                                   READEP   1034
      IF(NSVCBS.GT.NSR)THEN                                             READEP   1035
        WRITE(MSG(1),3080)                                              READEP   1036
        MSG(2)=LINE                                                     READEP   1037
        CALL PRTMSG(2)                                                  READEP   1038
        LINE='READEP: YOU HAVE TOO MANY SVCS'                           READEP   1039
        CALL ASTOP(LINE,30)                                             READEP   1040
      END IF                                                            READEP   1041
      LFSVCO(NSVCBS)=IBUSOK                                             READEP   1042
      JREC=JREC+1                                                       READEP   1043
      LSVC(NSVCBS)=JREC                                                 READEP   1044
      LSVCA(NSVCBS)=0                                                   READEP   1045
      LSVCB(NSVCBS)=0                                                   READEP   1046
      LSVCC(NSVCBS)=0                                                   READEP   1047
      LSVCD(NSVCBS)=0                                                   READEP   1048
      LSVCE(NSVCBS)=0                                                   READEP   1049
      LSVCF(NSVCBS)=0                                                   READEP   1050
      LSVCBN(IBUSOK)=NSVCBS                                             READEP   1051
      IREC=JREC                                                         READEP   1052
      ISVC=NSVCBS                                                       READEP   1053
C                                                                       READEP   1054
 442  LFSVCR(ISVC)=IBUSOR                                               READEP   1055
      WRITE(IU31,REC=IREC) LINE                                         READEP   1056
      GOTO 100                                                          READEP   1057
C                                                                       READEP   1058
C     SVC SECOND OR THIRD CARD ('W')                                    READEP   1059
C                                                                       READEP   1060
 447  CONTINUE                                                          READEP   1061
C                                                                       READEP   1062
      IF(IBPAFL.GT.0)WRITE(IUY,7000)LINE                                READEP   1063
C                                                                       READEP   1064
      BSNAME=LINE(4:15)                                                 READEP   1065
      CALL CHKBUS(BSNAME,IBUSOK)                                        READEP   1066
      IF(IBUSOK.LE.0)THEN                                               READEP   1067
C                                                                       READEP   1068
C     BUS NOT EXIST WRITE OUT WARNING MESSAGE AND SKIP THIS CARD        READEP   1069
C                                                                       READEP   1070
        WRITE(MSG(1),1190)                                              READEP   1071
        MSG(2)=LINE                                                     READEP   1072
        CALL PRTMSG(2)                                                  READEP   1073
        GOTO 100                                                        READEP   1074
      ENDIF                                                             READEP   1075
C                                                                       READEP   1076
      ISVC=LSVCBN(IBUSOK)                                               READEP   1077
      IF(ISVC.LE.0)THEN                                                 READEP   1078
        WRITE(MSG(1),4000)                                              READEP   1079
        MSG(2)=LINE                                                     READEP   1080
        CALL PRTMSG(2)                                                  READEP   1081
        LINE='READEP: FIRST CARD OF SVC DATA NOT SPECIFIED'             READEP   1082
        CALL ASTOP(LINE,44)                                             READEP   1083
      ENDIF                                                             READEP   1084
C                                                                       READEP   1085
      DO 448 I=1,ICO2S                                                  READEP   1086
        IF(LINE(2:2).EQ.COL2S(I))THEN                                   READEP   1087
          ICODE2=I                                                      READEP   1088
          GOTO 449                                                      READEP   1089
        ENDIF                                                           READEP   1090
 448  CONTINUE                                                          READEP   1091
C                                                                       READEP   1092
      WRITE(MSG(1),3090)                                                READEP   1093
      MSG(2)=LINE                                                       READEP   1094
      CALL PRTMSG(2)                                                    READEP   1095
      LINE='READEP: SVC SUPPLEMENTARY CONTROL TYPE NOT RECOGNIZED'      READEP   1096
      CALL ASTOP(LINE,53)                                               READEP   1097
C                                                                       READEP   1098
 449  WRITE(MSG(1),3100)                                                READEP   1099
      MSG(2)=LINE                                                       READEP   1100
      CALL PRTMSG(2)                                                    READEP   1101
C           'A'  'B'  'C'  'D'  'E'  'F'                                READEP   1102
      GOTO (451, 452, 453, 454, 455, 456) ICODE2                        READEP   1103
C                                                                       READEP   1104
 451  CONTINUE                                                          READEP   1105
C                                                                       READEP   1106
      BSNAME=LINE(54:65)                                                READEP   1107
      CALL CHKBUS(BSNAME,IBUSOR)                                        READEP   1108
      IF(IBUSOR.LE.0)THEN                                               READEP   1109
C                                                                       READEP   1110
C       REMOTE BUS NOT EXIST WRITE OUT WARNING AND SKIP THE CARD        READEP   1111
C                                                                       READEP   1112
        WRITE(MSG(1),1190)                                              READEP   1113
        MSG(2)=LINE                                                     READEP   1114
        CALL PRTMSG(2)                                                  READEP   1115
        GOTO 100                                                        READEP   1116
      ENDIF                                                             READEP   1117
C                                                                       READEP   1118
      IREC=LSVCA(ISVC)+LSVCB(ISVC)+LSVCC(ISVC)                          READEP   1119
      IF(IREC.EQ.0)THEN                                                 READEP   1120
        JREC=JREC+1                                                     READEP   1121
        IREC=JREC                                                       READEP   1122
      ELSE                                                              READEP   1123
        LSVCB(ISVC)=0                                                   READEP   1124
        LSVCC(ISVC)=0                                                   READEP   1125
      ENDIF                                                             READEP   1126
      LSVCA(ISVC)=IREC                                                  READEP   1127
      LFSAR(ISVC)=IBUSOK                                                READEP   1128
      WRITE(IU31,REC=IREC) LINE                                         READEP   1129
      GOTO 100                                                          READEP   1130
C                                                                       READEP   1131
 452  CONTINUE                                                          READEP   1132
C                                                                       READEP   1133
      BSNAME=LINE(54:65)                                                READEP   1134
      CALL CHKBUS(BSNAME,IBUSOF)                                        READEP   1135
      IF(IBUSOF.LE.0)THEN                                               READEP   1136
C                                                                       READEP   1137
C       REMOTE BUS NOT EXIST WRITE OUT WARNING AND SKIP THE CARD        READEP   1138
C                                                                       READEP   1139
        WRITE(MSG(1),1190)                                              READEP   1140
        MSG(2)=LINE                                                     READEP   1141
        CALL PRTMSG(2)                                                  READEP   1142
        GOTO 100                                                        READEP   1143
      ENDIF                                                             READEP   1144
C                                                                       READEP   1145
      BSNAME=LINE(67:78)                                                READEP   1146
      CALL CHKBUS(BSNAME,IBUSOT)                                        READEP   1147
      IF(IBUSOT.LE.0)THEN                                               READEP   1148
C                                                                       READEP   1149
C       REMOTE BUS NOT EXIST WRITE OUT WARNING AND SKIP THE CARD        READEP   1150
C                                                                       READEP   1151
        WRITE(MSG(1),1190)                                              READEP   1152
        MSG(2)=LINE                                                     READEP   1153
        CALL PRTMSG(2)                                                  READEP   1154
        GOTO 100                                                        READEP   1155
      ENDIF                                                             READEP   1156
C                                                                       READEP   1157
      IREC=LSVCA(ISVC)+LSVCB(ISVC)+LSVCC(ISVC)                          READEP   1158
      IF(IREC.EQ.0)THEN                                                 READEP   1159
        JREC=JREC+1                                                     READEP   1160
        IREC=JREC                                                       READEP   1161
      ELSE                                                              READEP   1162
        LSVCA(ISVC)=0                                                   READEP   1163
        LSVCC(ISVC)=0                                                   READEP   1164
      ENDIF                                                             READEP   1165
      LSVCB(ISVC)=IREC                                                  READEP   1166
      LFSBRF(ISVC)=IBUSOF                                               READEP   1167
      LFSBRT(ISVC)=IBUSOT                                               READEP   1168
      WRITE(IU31,REC=IREC) LINE                                         READEP   1169
      GOTO 100                                                          READEP   1170
C                                                                       READEP   1171
 453  CONTINUE                                                          READEP   1172
C                                                                       READEP   1173
      BSNAME=LINE(54:65)                                                READEP   1174
      IF(BSNAME.NE.NOBUSS)THEN                                          READEP   1175
        CALL CHKBUS(BSNAME,IBUSOR)                                      READEP   1176
        IF(IBUSOR.LE.0)THEN                                             READEP   1177
C                                                                       READEP   1178
C       REMOTE BUS NOT EXIST WRITE OUT WARNING AND SKIP THE CARD        READEP   1179
C                                                                       READEP   1180
          WRITE(MSG(1),1190)                                            READEP   1181
          MSG(2)=LINE                                                   READEP   1182
          CALL PRTMSG(2)                                                READEP   1183
          GOTO 100                                                      READEP   1184
        ENDIF                                                           READEP   1185
      ELSE                                                              READEP   1186
        IBUSOR=0                                                        READEP   1187
      ENDIF                                                             READEP   1188
C                                                                       READEP   1189
      IREC=LSVCA(ISVC)+LSVCB(ISVC)+LSVCC(ISVC)                          READEP   1190
      IF(IREC.EQ.0)THEN                                                 READEP   1191
        JREC=JREC+1                                                     READEP   1192
        IREC=JREC                                                       READEP   1193
      ELSE                                                              READEP   1194
        LSVCA(ISVC)=0                                                   READEP   1195
        LSVCB(ISVC)=0                                                   READEP   1196
      ENDIF                                                             READEP   1197
      LSVCC(ISVC)=IREC                                                  READEP   1198
      LFSCR(ISVC)=IBUSOR                                                READEP   1199
      WRITE(IU31,REC=IREC) LINE                                         READEP   1200
      GOTO 100                                                          READEP   1201
C                                                                       READEP   1202
 454  CONTINUE                                                          READEP   1203
C                                                                       READEP   1204
      IREC=LSVCD(ISVC)+LSVCE(ISVC)+LSVCF(ISVC)                          READEP   1205
      IF(IREC.EQ.0)THEN                                                 READEP   1206
        JREC=JREC+1                                                     READEP   1207
        IREC=JREC                                                       READEP   1208
      ELSE                                                              READEP   1209
        LSVCE(ISVC)=0                                                   READEP   1210
        LSVCF(ISVC)=0                                                   READEP   1211
      ENDIF                                                             READEP   1212
      LSVCD(ISVC)=IREC                                                  READEP   1213
      WRITE(IU31,REC=IREC) LINE                                         READEP   1214
      GOTO 100                                                          READEP   1215
C                                                                       READEP   1216
 455  CONTINUE                                                          READEP   1217
C                                                                       READEP   1218
      IREC=LSVCD(ISVC)+LSVCE(ISVC)+LSVCF(ISVC)                          READEP   1219
      IF(IREC.EQ.0)THEN                                                 READEP   1220
        JREC=JREC+1                                                     READEP   1221
        IREC=JREC                                                       READEP   1222
      ELSE                                                              READEP   1223
        LSVCD(ISVC)=0                                                   READEP   1224
        LSVCF(ISVC)=0                                                   READEP   1225
      ENDIF                                                             READEP   1226
      LSVCE(ISVC)=IREC                                                  READEP   1227
      WRITE(IU31,REC=IREC) LINE                                         READEP   1228
      GOTO 100                                                          READEP   1229
C                                                                       READEP   1230
 456  CONTINUE                                                          READEP   1231
C                                                                       READEP   1232
      IREC=LSVCD(ISVC)+LSVCE(ISVC)+LSVCF(ISVC)                          READEP   1233
      IF(IREC.EQ.0)THEN                                                 READEP   1234
        JREC=JREC+1                                                     READEP   1235
        IREC=JREC                                                       READEP   1236
      ELSE                                                              READEP   1237
        LSVCD(ISVC)=0                                                   READEP   1238
        LSVCE(ISVC)=0                                                   READEP   1239
      ENDIF                                                             READEP   1240
      LSVCF(ISVC)=IREC                                                  READEP   1241
      WRITE(IU31,REC=IREC) LINE                                         READEP   1242
      GOTO 100                                                          READEP   1243
C=======================================================================READEP   1244
C                                                                       READEP   1245
C                        =============                                  READEP   1246
C                         : SECTION 2 :                                 READEP   1247
C                        =============                                  READEP   1248
C                                                                       READEP   1249
C=======================================================================READEP   1250
C     ARRANGE THE DATA CARD IN THE FOLLOWING ORDER FOR EACH OF THE MACHIREADEP   1251
C                                                                       READEP   1252
C               DETAIL MACHINE MODEL    (MF)                            READEP   1253
C               SUB TRANSIENT DATA      (M)                             READEP   1254
C               EXCITER DATA            (E*)                            READEP   1255
C               STABILIZER DATA         (S*)                            READEP   1256
C               GOVERNOR DATA           (G*)                            READEP   1257
C                   .....                                               READEP   1258
C                (NEXT MACHINE)                                         READEP   1259
C                   ....                                                READEP   1260
C                (LAST DETAIL MACHINE)                                  READEP   1261
C               CLASSICAL MACHINE DATA  (MC)                            READEP   1262
C                (NEXT CLASSICAL M/C)                                   READEP   1263
C                (LAST CLASSICAL M/C)                                   READEP   1264
C                                                                       READEP   1265
C----------------------------                                           READEP   1266
C     FOR EACH DETAIL MACHINE..                                         READEP   1267
C----------------------------                                           READEP   1268
C                                                                       READEP   1269
C                                                                       READEP   1270
  450 CONTINUE                                                          READEP   1271
      IF(LDEB)THEN                                                      READEP   1272
       DO 460 I=1,LGBUS                                                 READEP   1273
       WRITE(IUD6,1350)I,MB(I),MC(I),MF(I),EXCEP(I),IEEEX(I),           READEP   1274
     & STAB(I),GOV(I),TB(I),NTHGEL(I),NEXTG(I),NGSTAT(I)                READEP   1275
  460  CONTINUE                                                         READEP   1276
      ENDIF                                                             READEP   1277
C                                                                       READEP   1278
      LPGID='   L'                                                      READEP   1279
      IVTN=0                                                            READEP   1280
      JFLTN=0                                                           READEP   1281
      UH=99.0                                                           READEP   1282
      BASVR=1.0                                                         READEP   1283
      IRMBU1=0                                                          READEP   1284
      IOHTY1=0                                                          READEP   1285
      IM=0                                                              READEP   1286
      IN=0                                                              READEP   1287
      CMTL=0.0                                                          READEP   1288
C                                                                       READEP   1289
      DO 530 K=1,LGBUS                                                  READEP   1290
C                                                                       READEP   1291
C    FELTCH THE GENERATORS CONNECTED TO K BUS                           READEP   1292
C                                                                       READEP   1293
        JGEN=0                                                          READEP   1294
C                                                                       READEP   1295
        KTHGEN=NTHGEL(K)                                                READEP   1296
        IF(KTHGEN.EQ.0)GOTO 530                                         READEP   1297
470     JGEN=JGEN+1                                                     READEP   1298
        ITHGEN(JGEN)=KTHGEN                                             READEP   1299
        JFNAME(JGEN)=MFNAME(KTHGEN)                                     READEP   1300
        KTHGEN=NEXTG(KTHGEN)                                            READEP   1301
        IF(KTHGEN.NE.0)GOTO 470                                         READEP   1302
C                                                                       READEP   1303
C   SORT THE GENERATORS IN ALPHATICAL ORDER                             READEP   1304
C                                                                       READEP   1305
      IF(JGEN.GT.1)CALL BSORT1(JFNAME,JGEN,ITHGEN)                      READEP   1306
C                                                                       READEP   1307
      IHPLP=.FALSE.                                                     READEP   1308
      DO 520 LI=1,JGEN                                                  READEP   1309
      I=ITHGEN(LI)                                                      READEP   1310
      IF(LDEB) WRITE(IUD6,1240) JFNAME(I)                               READEP   1311
C                                                                       READEP   1312
      JREAD=MC(I)                                                       READEP   1313
      IF(JREAD.EQ.0)JREAD=MF(I)                                         READEP   1314
C                                                                       READEP   1315
      READ(IU31,REC=JREAD) MFB                                          READEP   1316
C                                                                       READEP   1317
      IF(IBPAFL.GT.0)THEN                                               READEP   1318
        LINOUT=MFB                                                      READEP   1319
        IF(IBPAFL.EQ.1)LINOUT(3:3)='1'                                  READEP   1320
        WRITE(IUY,7000)LINOUT                                           READEP   1321
      ENDIF                                                             READEP   1322
C                                                                       READEP   1323
      READ(MFB,1250) MANE,EMWS,PFA,QFA,BASPR,RA,XPD,XPQ,XD,XQ,          READEP   1324
     1TPDO,TPQO,XL,GSAT1,GSAT2,DAMP                                     READEP   1325
      IF(LDEB) WRITE(IUD6,1100) MFB(1:2),MFB(4:15),EMWS,PFA,QFA,        READEP   1326
     1BASPR,RA,XPD,XPQ,XD,XQ,TPDO,TPQO,XL,GSAT1,GSAT2,DAMP              READEP   1327
      IF(MFB(23:28).EQ.'      ')THEN                                    READEP   1328
         PFA=1.0                                                        READEP   1329
         QFA=1.0                                                        READEP   1330
      ENDIF                                                             READEP   1331
      IPFA=NINT(PFA*100)                                                READEP   1332
      IQFA=NINT(QFA*100)                                                READEP   1333
      IF(BASPR.EQ.0.0)BASPR=100.0                                       READEP   1334
C                                                                       READEP   1335
C     SET SUB TRANSIENT DATA TO DEFAULT VALUES FIRST                    READEP   1336
C                                                                       READEP   1337
      GMRATE=0.0                                                        READEP   1338
      XPPD=0.0                                                          READEP   1339
      XPPQ=0.0                                                          READEP   1340
      TPPDO=0.0                                                         READEP   1341
      TPPQO=0.0                                                         READEP   1342
C                                                                       READEP   1343
C   READ MB CARD                                                        READEP   1344
C                                                                       READEP   1345
      JREAD=MB(I)                                                       READEP   1346
      JSAT=1                                                            READEP   1347
      IF(JREAD.NE.0)THEN                                                READEP   1348
        READ(IU31,REC=JREAD)MFB                                         READEP   1349
C                                                                       READEP   1350
        IF(IBPAFL.GT.0)THEN                                             READEP   1351
          LINOUT=MFB                                                    READEP   1352
          IF(IBPAFL.EQ.1)THEN                                           READEP   1353
            IF(MC(I).NE.0)THEN                                          READEP   1354
              LINOUT(2:2)='C'                                           READEP   1355
            ELSE                                                        READEP   1356
              LINOUT(2:2)='F'                                           READEP   1357
            ENDIF                                                       READEP   1358
            LINOUT(3:3)='2'                                             READEP   1359
          ENDIF                                                         READEP   1360
          WRITE(IUY,7000)LINOUT                                         READEP   1361
        ENDIF                                                           READEP   1362
C                                                                       READEP   1363
        READ(MFB,1260) GMRATE,GRPF,IGNUM,GTYPE,XPPD,XPPQ                READEP   1364
     &  ,TPPDO,TPPQO                                                    READEP   1365
        IF(LDEB)WRITE(IUD6,1120) MFB(1:2),MFB(4:15),GMRATE              READEP   1366
     1  ,GRPF,IGNUM,GTYPE,XPPD,XPPQ,TPPDO,TPPQO                         READEP   1367
        IF(MFB(31:32).EQ.'H ')JSAT=0                                    READEP   1368
      ENDIF                                                             READEP   1369
C                                                                       READEP   1370
      IF(GMRATE.NE.0.0)THEN                                             READEP   1371
        FACT=GMRATE/BASPR                                               READEP   1372
        BASPR=GMRATE                                                    READEP   1373
        XPPD=XPPD*FACT                                                  READEP   1374
        XPPQ=XPPQ*FACT                                                  READEP   1375
        RA=RA*FACT                                                      READEP   1376
        XPD=XPD*FACT                                                    READEP   1377
        XPQ=XPQ*FACT                                                    READEP   1378
        XD=XD*FACT                                                      READEP   1379
        XQ=XQ*FACT                                                      READEP   1380
        XL=XL*FACT                                                      READEP   1381
      ENDIF                                                             READEP   1382
C                                                                       READEP   1383
      HM=EMWS/BASPR                                                     READEP   1384
C                                                                       READEP   1385
      IF(MC(I).NE.0)THEN                                                READEP   1386
        IGEN=3                                                          READEP   1387
        JEXC=0                                                          READEP   1388
        JSTAB=0                                                         READEP   1389
        GOTO 480                                                        READEP   1390
      ELSE                                                              READEP   1391
        IGEN=0                                                          READEP   1392
      ENDIF                                                             READEP   1393
C                                                                       READEP   1394
C     ----------------------------------------------------              READEP   1395
C     . GET THE EXCITER FOR THIS MACHINE                  .             READEP   1396
C     .   WARN IF THERE ARE MORE THAN 1 EXCITER           .             READEP   1397
C     .     MEXC=COUNTER TO KEEP TRACK OF # OF EXC CARDS  .             READEP   1398
C     .   CONVERT EPRI EXCITER TYPE TO MASSS EXCITER TYPE .             READEP   1399
C     .   IF NO EXCITER OR CONVERSION FAILED, SET JEXC=0  .             READEP   1400
C     ----------------------------------------------------              READEP   1401
      JREAD=EXCEP(I)                                                    READEP   1402
      JEXC=0                                                            READEP   1403
      IF(JREAD.NE.0)THEN                                                READEP   1404
        READ(IU31,REC=JREAD) MFB                                        READEP   1405
        CALL EPEXCV (EXC,JEXC,MFB,IEEEX6)                               READEP   1406
      ENDIF                                                             READEP   1407
C                                                                       READEP   1408
      JREAD=EXCIE(I)                                                    READEP   1409
      IF(JREAD.NE.0)THEN                                                READEP   1410
      READ(IU31,REC=JREAD) IEEEX1                                       READEP   1411
      READ(IU31,REC=JREAD+1) IEEEX2                                     READEP   1412
C                                                                       READEP   1413
C     SET KEYWORD IN CARD 3 TO INDICATE ITS A BPA-IEEE CARD FORMAT      READEP   1414
C                                                                       READEP   1415
      WRITE(IEEEX3(1:8),'(A8)')'BPA-IEEE'                               READEP   1416
            CALL EPIECV (EXC,JEXC,IEEEX1,IEEEX2,IEEEX3,IEEEX4,IEEEX5,   READEP   1417
     +                   IEEEX6)                                        READEP   1418
      ENDIF                                                             READEP   1419
C                                                                       READEP   1420
C     ............................................................. ..  READEP   1421
C     :CHECK FOR IEEE TYPE EXCITERS PRVIDED THERE ARE NO WSCC EXCITERS: READEP   1422
C     :ALREADY PROCESSED FOR THIS MACHINE (ABOVE)                     : READEP   1423
C     :...............................................................: READEP   1424
C                                                                       READEP   1425
         JREAD=IEEEX(I)                                                 READEP   1426
         IF(JREAD.NE.0)THEN                                             READEP   1427
         READ(IU31,REC=JREAD) IEEEX1                                    READEP   1428
         READ(IU31,REC=JREAD+1) IEEEX2                                  READEP   1429
         READ(IU31,REC=JREAD+2) IEEEX3                                  READEP   1430
         READ(IU31,REC=JREAD+3) IEEEX4                                  READEP   1431
         READ(IU31,REC=JREAD+4) IEEEX5                                  READEP   1432
            CALL EPIECV (EXC,JEXC,IEEEX1,IEEEX2,IEEEX3,IEEEX4,IEEEX5,   READEP   1433
     +                   IEEEX6)                                        READEP   1434
         ENDIF                                                          READEP   1435
C                                                                       READEP   1436
C     ----------------------------------------------------              READEP   1437
C     . GET THE STABILIZER FOR THIS MACHINE              .              READEP   1438
C     .   MSTAB=COUNTER TO KEEP TRACK OF # OF STAB CARDS .              READEP   1439
C     .   WARN IF THERE ARE MORE THAN 1 STABILIZER CARD  .              READEP   1440
C     .   CONVERT EPRI STABILIZER TYPE TO MASSS TYPE     .              READEP   1441
C     .   JSTAB=0 IF NO STABILIZER REPRESENTED           .              READEP   1442
C     ----------------------------------------------------              READEP   1443
C                                                                       READEP   1444
      JREAD=STAB(I)                                                     READEP   1445
      JSTAB=0                                                           READEP   1446
      JTEB=0                                                            READEP   1447
      IF(JREAD.NE.0)THEN                                                READEP   1448
        READ(IU31,REC=JREAD) MFB                                        READEP   1449
        CALL EPSTCV (IRMBUS,IOHTYP,EXS,JSTAB,EXB,JTEB,MFB,MFB1,         READEP   1450
     +               MFB2,MFB3)                                         READEP   1451
      ENDIF                                                             READEP   1452
C                                                                       READEP   1453
C     -------------------------------------------------------------     READEP   1454
C     . GET THE GOVERNOR AND TURBINE FOR THIS MACHINE             .     READEP   1455
C     .   MGOV=COUNTER TO KEEP TRACK OF # OF GOVERNOR CARDS       .     READEP   1456
C     .   MTB=COUNTER TO KEEP TRACK OF # OF TURBINE  CARDS       .      READEP   1457
C     .   WARN IF THERE ARE MORE THAN 1 GOVERNOR OR TURBINE CARDS .     READEP   1458
C     .   CONVERT EPRI GOVERNOR TYPE TO MASSS TYPE                .     READEP   1459
C     .   IF MASSS GOVERNOR IS TYPE 4 THEN                        .     READEP   1460
C     .      CONVERT EPRI TURBINE TO MASSS TYPE                   .     READEP   1461
C     .   ENDIF                                                   .     READEP   1462
C     .   IF TURBINE CONVERSION FAILED THEN                    .        READEP   1463
C     .      SET JGOV=0 AND WRITE WARNING MSG                  .        READEP   1464
C     .   ENDIF                                                         READEP   1465
C     -------------------------------------------------------------     READEP   1466
C                                                                       READEP   1467
 480  IF(IHPLP)THEN                                                     READEP   1468
         JGOV=5                                                         READEP   1469
      ELSE                                                              READEP   1470
         ITBD=0                                                         READEP   1471
         JGOV=0                                                         READEP   1472
         JREAD=GOV(I)                                                   READEP   1473
         IF(JREAD.NE.0)THEN                                             READEP   1474
         READ(IU31,REC=JREAD) MFB                                       READEP   1475
         CALL EPGOCV (JGOV,ITBD,EXG,BASPR,MFB)                          READEP   1476
         ENDIF                                                          READEP   1477
         IF(ITBD.NE.0)THEN                                              READEP   1478
           JREAD=TB(I)                                                  READEP   1479
           IF(JREAD.NE.0)THEN                                           READEP   1480
             READ(IU31,REC=JREAD) MFB                                   READEP   1481
             CALL EPTBCV (EXG,ITB,MFB)                                  READEP   1482
             IF(ITB.EQ.5)THEN                                           READEP   1483
               IHPLP=.TRUE.                                             READEP   1484
               IF(MC(I).NE.0)THEN                                       READEP   1485
                 IGEN=7                                                 READEP   1486
               ELSE                                                     READEP   1487
                 IGEN=4                                                 READEP   1488
               ENDIF                                                    READEP   1489
               IEXG(1)=K                                                READEP   1490
               IEXG(2)=ILPGID                                           READEP   1491
             ELSEIF(ITB.LE.0)THEN                                       READEP   1492
               JGOV=0                                                   READEP   1493
               WRITE(MSG(1),1180) MFB(4:16)                             READEP   1494
               WRITE(MSG(2),1181)                                       READEP   1495
               CALL PRTMSG(2)                                           READEP   1496
             ENDIF                                                      READEP   1497
           ELSE                                                         READEP   1498
             WRITE(MSG(1),6200)                                         READEP   1499
             WRITE(MSG(2),6300) MFB(4:16)                               READEP   1500
           ENDIF                                                        READEP   1501
         ENDIF                                                          READEP   1502
      ENDIF                                                             READEP   1503
C                                                                       READEP   1504
C     ENTER GENERATOR DATA INTO COMMON AND THEN CALL STGEND             READEP   1505
C                                                                       READEP   1506
      NLF=K                                                             READEP   1507
      BUSNAM=MFNAME(I)(1:12)                                            READEP   1508
      NGRI=' '                                                          READEP   1509
      KCCT=MFNAME(I)(13:13)                                             READEP   1510
      ISAT=0                                                            READEP   1511
C                                                                       READEP   1512
C     ................................................................. READEP   1513
C     : MACHINE SATURATION.. IF(SG1.0) OR (SG1.2) IS SPECIFIED, ALL  :  READEP   1514
C     : MACHINE REACTANCES ARE GIVEN AS UNSATURATED VALUES. CODINGS   : READEP   1515
C     : BELOW CONVERTS SATURATION VALUES TO MASSS FORMAT              : READEP   1516
C     :...............................................................: READEP   1517
C                                                                       READEP   1518
      IF((GSAT1.NE.0) .AND. (GSAT2.NE.0))THEN                           READEP   1519
         ISAT=JSAT+1                                                    READEP   1520
         AA=GSAT1-1.2*GSAT2                                             READEP   1521
         AB=2.4*(GSAT2-GSAT1)                                           READEP   1522
         AC=1.44*GSAT1 - 1.2*GSAT2                                      READEP   1523
C                                                                       READEP   1524
         AP=(-AB+SQRT(AB**2-4*AA*AC))/(2*AA)                            READEP   1525
         AM=(-AB-SQRT(AB**2-4*AA*AC))/(2*AA)                            READEP   1526
         UL=0.0                                                         READEP   1527
C                                                                       READEP   1528
         IF((AP .LT. 1.) .AND. (AP. GT. 0.))THEN                        READEP   1529
            UL=AP                                                       READEP   1530
         ENDIF                                                          READEP   1531
         IF((AM .LT. 1.) .AND. (AM .GT. 0))THEN                         READEP   1532
            IF(AM .GT. AP) UL=AM                                        READEP   1533
         ENDIF                                                          READEP   1534
         PI10=GSAT1                                                     READEP   1535
         PI12=1.2*(GSAT2)                                               READEP   1536
         PI1012=PI12/PI10                                               READEP   1537
         BSAT=LOG(PI1012)/0.2                                           READEP   1538
         ASAT=PI10/(EXP(BSAT*(1.0-UL)))                                 READEP   1539
C                                                                       READEP   1540
C     ..................................................................READEP   1541
C     : IF THERE IS A CONVERSION PROBLEM, GIVE WARNING AND SET ISAT= 0  READEP   1542
C     :.................................................................READEP   1543
C                                                                       READEP   1544
         IF(UL .EQ. 0.0)THEN                                            READEP   1545
           WRITE(MSG(1),1200)                                           READEP   1546
           WRITE(MSG(2),1201) MFNAME(I)                                 READEP   1547
           CALL PRTMSG(2)                                               READEP   1548
           ISAT=0                                                       READEP   1549
         ENDIF                                                          READEP   1550
      ENDIF                                                             READEP   1551
C                                                                       READEP   1552
      IF(JGOV.EQ.5)IHPLP=.FALSE.                                        READEP   1553
C                                                                       READEP   1554
C     FILL THE DDAT ARRAYS                                              READEP   1555
C                                                                       READEP   1556
      CALL STGEND                                                       READEP   1557
C                                                                       READEP   1558
C-----------------------------------------------------------------------READEP   1559
C     FINISH PROCESSING THIS DETAILED MACHINE ..                        READEP   1560
C     GO BACK TO PROCESS THE NEXT ONE .                                 READEP   1561
C-----------------------------------------------------------------------READEP   1562
C                                                                       READEP   1563
  520 CONTINUE                                                          READEP   1564
C                                                                       READEP   1565
  530 CONTINUE                                                          READEP   1566
C                                                                       READEP   1567
      IF(IBPAFL.GT.0)THEN                                               READEP   1568
        LINOUT='EDATA'                                                  READEP   1569
        WRITE(IUY,7000)LINOUT                                           READEP   1570
        LINOUT='  END'                                                  READEP   1571
        WRITE(IUY,7000)LINOUT                                           READEP   1572
      ENDIF                                                             READEP   1573
C=======================================================================READEP   1574
C                                                                       READEP   1575
C     SORT OUT RR TYPE RELAYS                                           READEP   1576
C                                                                       READEP   1577
      DO 594 I=1,RELBUS                                                 READEP   1578
        ICODE2=KRELTY(I)                                                READEP   1579
        IF(ICODE2.NE.8)GOTO 594                                         READEP   1580
C                                                                       READEP   1581
        JREC=NTHREL(I)                                                  READEP   1582
        READ(IU31,REC=JREC)LINE                                         READEP   1583
        BSNAME=LINE(7:18)                                               READEP   1584
        CALL CHKBUS(BSNAME,IBUSOK)                                      READEP   1585
C                                                                       READEP   1586
        IF(LINE(19:19).EQ.'F')THEN                                      READEP   1587
          JTYPE=1                                                       READEP   1588
        ELSEIF(LINE(19:19).EQ.'V')THEN                                  READEP   1589
          JTYPE=2                                                       READEP   1590
        ELSE                                                            READEP   1591
          GOTO 594                                                      READEP   1592
        ENDIF                                                           READEP   1593
C                                                                       READEP   1594
        IPTR=IFSLSD(IBUSOK)                                             READEP   1595
 591    IF(IPTR.NE.0)THEN                                               READEP   1596
          JREC1=ILSREC(IPTR)                                            READEP   1597
          READ(IU31,REC=JREC1)JJFLAG,JJTYPE,LINE1                       READEP   1598
          IF(JJTYPE.EQ.JTYPE) GOTO 592                                  READEP   1599
          IPTR=INXLSD(IPTR)                                             READEP   1600
          GOTO 591                                                      READEP   1601
        ENDIF                                                           READEP   1602
C                                                                       READEP   1603
        WRITE(MSG(1),4050)                                              READEP   1604
        MSG(2)=LINE                                                     READEP   1605
        CALL PRTMSG(2)                                                  READEP   1606
        LINE='READEP: REMOTE RELAY DATA ERROR'                          READEP   1607
        CALL ASTOP(LINE,31)                                             READEP   1608
C                                                                       READEP   1609
 592    JPTR=(IPTR-1)*15                                                READEP   1610
        DO 593 II=1,15                                                  READEP   1611
          IF(IRRREC(JPTR+II).EQ.0)THEN                                  READEP   1612
            IRRREC(JPTR+II)=JREC                                        READEP   1613
            GOTO 594                                                    READEP   1614
          ENDIF                                                         READEP   1615
 593    CONTINUE                                                        READEP   1616
C                                                                       READEP   1617
        WRITE(MSG(1),4070)                                              READEP   1618
        MSG(2)=LINE                                                     READEP   1619
        CALL PRTMSG(2)                                                  READEP   1620
        LINE='READEP: TOO MANY REMOTE RELAYS'                           READEP   1621
        CALL ASTOP(LINE,30)                                             READEP   1622
C                                                                       READEP   1623
 594  CONTINUE                                                          READEP   1624
C-----------------------------------------------------------------------READEP   1625
C                                                                       READEP   1626
C     PUT THE LOAD SHEDDING DATA INTO PERMANENT ARRAYS                  READEP   1627
C                                                                       READEP   1628
      LUFVDB=LRTEMP                                                     READEP   1629
C                                                                       READEP   1630
      DO 600 I=1,LASTBU                                                 READEP   1631
        IPTR=IFSLSD(I)                                                  READEP   1632
        JAUTB=.TRUE.                                                    READEP   1633
        NSCHEM=0                                                        READEP   1634
        IBUSOK=I                                                        READEP   1635
 601    IF(IPTR.EQ.0)GOTO 600                                           READEP   1636
        JREC=ILSREC(IPTR)                                               READEP   1637
C                                                                       READEP   1638
        IF(JAUTB)THEN                                                   READEP   1639
          NAUT=NAUT+1                                                   READEP   1640
          NAUTB=NAUTB+1                                                 READEP   1641
          NLFB=NOLD(IBUSOK)                                             READEP   1642
          NAUBUS(NAUTB)=NLFB                                            READEP   1643
          JAUTB=.FALSE.                                                 READEP   1644
          LRTEMP=LRTEMP+1                                               READEP   1645
          IDATPT(LRTEMP)=JLNA+1                                         READEP   1646
          JSCHEM=JLNA                                                   READEP   1647
          IADATA(JLNA+2)=NLFB                                           READEP   1648
          JLNA7=JLNA+7                                                  READEP   1649
          IADATA(JLNA+7)=1                                              READEP   1650
          IRELAY=JLNA+9                                                 READEP   1651
          KSWITC=0                                                      READEP   1652
          IADATA(JLNA+8)=0                                              READEP   1653
          IADATA(JLNA+9)=0                                              READEP   1654
          JLNA=JLNA+9                                                   READEP   1655
        ENDIF                                                           READEP   1656
C                                                                       READEP   1657
        NSCHEM=NSCHEM+1                                                 READEP   1658
C                                                                       READEP   1659
        READ(IU31,REC=JREC)JFLAG,JTYPE,LINE                             READEP   1660
C                                                                       READEP   1661
        IF(LINE(16:16).EQ.'S')THEN                                      READEP   1662
          ISOPT=1                                                       READEP   1663
        ELSE                                                            READEP   1664
          ISOPT=0                                                       READEP   1665
        ENDIF                                                           READEP   1666
C                                                                       READEP   1667
        IADATA(JLNA+1)=JTYPE                                            READEP   1668
        KPOS=JLNA+2                                                     READEP   1669
        IADATA(JLNA+3)=ISOPT                                            READEP   1670
        ADATA(JLNA+4)=0.0                                               READEP   1671
        JLNA=JLNA+4                                                     READEP   1672
        LEVELS=0                                                        READEP   1673
C                                                                       READEP   1674
        READ(LINE,2020)ATLV1A,ATLV1B,ATLV1C,ATLV1D,                     READEP   1675
     2                 ATLV2A,ATLV2B,ATLV2C,ATLV2D,                     READEP   1676
     3                 ATLV3A,ATLV3B,ATLV3C,ATLV3D,                     READEP   1677
     4                 ATLV4A,ATLV4B,ATLV4C,ATLV4D,                     READEP   1678
     5                 ATLV5A,ATLV5B,ATLV5C,ATLV5D                      READEP   1679
C                                                                       READEP   1680
        IF(ATLV1A.NE.0.0)THEN                                           READEP   1681
          LEVELS=LEVELS+1                                               READEP   1682
          ADATA(JLNA+1)=ATLV1A                                          READEP   1683
          ADATA(JLNA+2)=ATLV1B                                          READEP   1684
          ADATA(JLNA+3)=ATLV1C                                          READEP   1685
          ADATA(JLNA+4)=ATLV1D*100.0                                    READEP   1686
          IADATA(JLNA+5)=0                                              READEP   1687
          IADATA(JLNA+6)=0                                              READEP   1688
          JLNA=JLNA+6                                                   READEP   1689
          IF(ATLV1D.NE.0.0)IADATA(JLNA7)=0                              READEP   1690
        ENDIF                                                           READEP   1691
C                                                                       READEP   1692
        IF(ATLV2A.NE.0.0)THEN                                           READEP   1693
          LEVELS=LEVELS+1                                               READEP   1694
          ADATA(JLNA+1)=ATLV2A                                          READEP   1695
          ADATA(JLNA+2)=ATLV2B                                          READEP   1696
          ADATA(JLNA+3)=ATLV2C                                          READEP   1697
          ADATA(JLNA+4)=ATLV2D*100.0                                    READEP   1698
          IADATA(JLNA+5)=0                                              READEP   1699
          IADATA(JLNA+6)=0                                              READEP   1700
          JLNA=JLNA+6                                                   READEP   1701
          IF(ATLV2D.NE.0.0)IADATA(JLNA7)=0                              READEP   1702
        ENDIF                                                           READEP   1703
C                                                                       READEP   1704
        IF(ATLV3A.NE.0.0)THEN                                           READEP   1705
          LEVELS=LEVELS+1                                               READEP   1706
          ADATA(JLNA+1)=ATLV3A                                          READEP   1707
          ADATA(JLNA+2)=ATLV3B                                          READEP   1708
          ADATA(JLNA+3)=ATLV3C                                          READEP   1709
          ADATA(JLNA+4)=ATLV3D*100.0                                    READEP   1710
          IADATA(JLNA+5)=0                                              READEP   1711
          IADATA(JLNA+6)=0                                              READEP   1712
          JLNA=JLNA+6                                                   READEP   1713
          IF(ATLV3D.NE.0.0)IADATA(JLNA7)=0                              READEP   1714
        ENDIF                                                           READEP   1715
C                                                                       READEP   1716
        IF(ATLV4A.NE.0.0)THEN                                           READEP   1717
          LEVELS=LEVELS+1                                               READEP   1718
          ADATA(JLNA+1)=ATLV4A                                          READEP   1719
          ADATA(JLNA+2)=ATLV4B                                          READEP   1720
          ADATA(JLNA+3)=ATLV4C                                          READEP   1721
          ADATA(JLNA+4)=ATLV4D*100.0                                    READEP   1722
          IADATA(JLNA+5)=0                                              READEP   1723
          IADATA(JLNA+6)=0                                              READEP   1724
          JLNA=JLNA+6                                                   READEP   1725
          IF(ATLV4D.NE.0.0)IADATA(JLNA7)=0                              READEP   1726
        ENDIF                                                           READEP   1727
C                                                                       READEP   1728
        IF(ATLV5A.NE.0.0)THEN                                           READEP   1729
          LEVELS=LEVELS+1                                               READEP   1730
          ADATA(JLNA+1)=ATLV5A                                          READEP   1731
          ADATA(JLNA+2)=ATLV5B                                          READEP   1732
          ADATA(JLNA+3)=ATLV5C                                          READEP   1733
          ADATA(JLNA+4)=ATLV5D*100.0                                    READEP   1734
          IADATA(JLNA+5)=0                                              READEP   1735
          IADATA(JLNA+6)=0                                              READEP   1736
          JLNA=JLNA+6                                                   READEP   1737
          IF(ATLV5D.NE.0.0)IADATA(JLNA7)=0                              READEP   1738
        ENDIF                                                           READEP   1739
C                                                                       READEP   1740
        IADATA(KPOS)=LEVELS                                             READEP   1741
        IADATA(JSCHEM+1)=NSCHEM                                         READEP   1742
C                                                                       READEP   1743
C     FOR REMOTE RELAYS                                                 READEP   1744
C                                                                       READEP   1745
        IF(JTYPE.LE.2)THEN                                              READEP   1746
          JPTR=(IPTR-1)*15                                              READEP   1747
          DO 704 II=1,15                                                READEP   1748
            JREC=IRRREC(JPTR+II)                                        READEP   1749
            IF(JREC.EQ.0)THEN                                           READEP   1750
              IADATA(IRELAY)=KSWITC                                     READEP   1751
              GOTO 602                                                  READEP   1752
            ENDIF                                                       READEP   1753
C                                                                       READEP   1754
            READ(IU31,REC=JREC)LINE                                     READEP   1755
            DO 705 III=1,ICO34R                                         READEP   1756
              IF(LINE(34:34).EQ.COL34R(III))THEN                        READEP   1757
                ICOD34=III                                              READEP   1758
                GOTO 706                                                READEP   1759
              ENDIF                                                     READEP   1760
 705        CONTINUE                                                    READEP   1761
C                                                                       READEP   1762
            WRITE(MSG(1),4080)                                          READEP   1763
            MSG(2)=LINE                                                 READEP   1764
            CALL PRTMSG(2)                                              READEP   1765
            LINE='READEP: REMOTE RELAY DATA ERROR'                      READEP   1766
            CALL ASTOP(LINE,31)                                         READEP   1767
C                                                                       READEP   1768
 706        CONTINUE                                                    READEP   1769
C                                                                       READEP   1770
C            'M', 'D', 'R', 'B', 'G'                                    READEP   1771
            GOTO(711, 712, 713, 714, 715)ICOD34                         READEP   1772
C                                                                       READEP   1773
 711        CARD1=' '                                                   READEP   1774
            CARD3=' '                                                   READEP   1775
            READ(LINE,5000)RRR,XXX,BBB                                  READEP   1776
            WRITE(CARD1,5100)LINE(35:46),LINE(49:60),LINE(61:61),       READEP   1777
     +                       RRR,XXX,BBB                                READEP   1778
            CALL SWIDAT(CARD1,CARD3,KSWITC,IEBK)                        READEP   1779
            IF(IEBK.NE.0)CALL ASTOP(LINE,80)                            READEP   1780
            GOTO 704                                                    READEP   1781
C                                                                       READEP   1782
 712        CARD1=' '                                                   READEP   1783
            CARD3=' '                                                   READEP   1784
            READ(LINE,5800)TTRANS                                       READEP   1785
            WRITE(CARD1,5200)LINE(35:46),LINE(49:60),LINE(61:61),       READEP   1786
     +                       TTRANS                                     READEP   1787
            CALL SWIDAT(CARD1,CARD3,KSWITC,IEBK)                        READEP   1788
            IF(IEBK.NE.0)CALL ASTOP(LINE,80)                            READEP   1789
            GOTO 704                                                    READEP   1790
C                                                                       READEP   1791
 713        CARD1=' '                                                   READEP   1792
            CARD3=' '                                                   READEP   1793
            WRITE(CARD1,5300)LINE(35:46),LINE(49:60),LINE(61:61)        READEP   1794
            CALL SWIDAT(CARD1,CARD3,KSWITC,IEBK)                        READEP   1795
            IF(IEBK.NE.0)CALL ASTOP(LINE,80)                            READEP   1796
            GOTO 704                                                    READEP   1797
C                                                                       READEP   1798
 714        CARD1=' '                                                   READEP   1799
            CARD3=' '                                                   READEP   1800
            IF(LINE(35:46).NE.NOBUSS)THEN                               READEP   1801
              READ(LINE,5500)TTRANS,PDROP1                              READEP   1802
              PDROP1=PDROP1*100.0                                       READEP   1803
              WRITE(CARD1,5400)LINE(35:46),ISOPT,PDROP1,PDROP1,         READEP   1804
     +                         TTRANS                                   READEP   1805
              CALL SWIDAT(CARD1,CARD3,KSWITC,IEBK)                      READEP   1806
              IF(IEBK.NE.0)CALL ASTOP(LINE,80)                          READEP   1807
            ENDIF                                                       READEP   1808
            IF(LINE(49:60).NE.NOBUSS)THEN                               READEP   1809
              READ(LINE,5600) TTRANS,PDROP2                             READEP   1810
              PDROP2=PDROP1*100.0                                       READEP   1811
              WRITE(CARD1,5400)LINE(49:60),ISOPT,PDROP2,PDROP2,         READEP   1812
     +                         TTRANS                                   READEP   1813
              CALL SWIDAT(CARD1,CARD3,KSWITC,IEBK)                      READEP   1814
              IF(IEBK.NE.0)CALL ASTOP(LINE,80)                          READEP   1815
            ENDIF                                                       READEP   1816
            GOTO 704                                                    READEP   1817
C                                                                       READEP   1818
 715        CARD1=' '                                                   READEP   1819
            CARD3=' '                                                   READEP   1820
            IF(LINE(35:46).NE.NOBUSS)THEN                               READEP   1821
              DO 766 IIJ=63,68                                          READEP   1822
                IF(LINE(IIJ:IIJ).NE.' ')THEN                            READEP   1823
                  IIJO=IIJ                                              READEP   1824
                  GOTO 767                                              READEP   1825
                ENDIF                                                   READEP   1826
 766          CONTINUE                                                  READEP   1827
              IIJO=63                                                   READEP   1828
 767          CONTINUE                                                  READEP   1829
              PDROP1=1.0                                                READEP   1830
              WRITE(CARD1,5700)LINE(35:46),LINE(IIJO:IIJO+1),PDROP1     READEP   1831
              CALL SWIDAT(CARD1,CARD3,KSWITC,IEBK)                      READEP   1832
              IF(IEBK.NE.0)CALL ASTOP(LINE,80)                          READEP   1833
            ENDIF                                                       READEP   1834
            IF(LINE(49:60).NE.NOBUSS)THEN                               READEP   1835
              DO 768 IIJ=69,74                                          READEP   1836
                IF(LINE(IIJ:IIJ).NE.' ')THEN                            READEP   1837
                  IIJO=IIJ                                              READEP   1838
                  GOTO 769                                              READEP   1839
                ENDIF                                                   READEP   1840
 768          CONTINUE                                                  READEP   1841
              IIJO=63                                                   READEP   1842
 769          CONTINUE                                                  READEP   1843
              PDROP2=1.0                                                READEP   1844
              WRITE(CARD1,5700)LINE(49:60),LINE(IIJO:IIJO+1),PDROP2     READEP   1845
              CALL SWIDAT(CARD1,CARD3,KSWITC,IEBK)                      READEP   1846
              IF(IEBK.NE.0)CALL ASTOP(LINE,80)                          READEP   1847
            ENDIF                                                       READEP   1848
C                                                                       READEP   1849
 704      CONTINUE                                                      READEP   1850
        ENDIF                                                           READEP   1851
C                                                                       READEP   1852
C     NEXT SCHEME                                                       READEP   1853
C                                                                       READEP   1854
 602    IPTR=INXLSD(IPTR)                                               READEP   1855
        GOTO 601                                                        READEP   1856
C                                                                       READEP   1857
 600  CONTINUE                                                          READEP   1858
C                                                                       READEP   1859
      IF(LRTEMP.NE.LUFVDB)THEN                                          READEP   1860
        LUFVDB=LUFVDB+1                                                 READEP   1861
        NUFVDB=LRTEMP                                                   READEP   1862
      ELSE                                                              READEP   1863
        LUFVDB=0                                                        READEP   1864
        NUFVDB=0                                                        READEP   1865
      ENDIF                                                             READEP   1866
C-----------------------------------------------------------------------READEP   1867
C                                                                       READEP   1868
C     PUT THE RELAY DATA INTO PERMANENT ARRAYS                          READEP   1869
C                                                                       READEP   1870
      LDISTR=LRTEMP                                                     READEP   1871
      DO 610 I=1,RELBUS                                                 READEP   1872
      ICODE2=KRELTY(I)                                                  READEP   1873
      IF(ICODE2.EQ.8) GOTO 610                                          READEP   1874
      JREC=NTHREL(I)                                                    READEP   1875
      NLFI=RLBUS1(I)                                                    READEP   1876
      NLFJ=RLBUS2(I)                                                    READEP   1877
      READ(IU31,REC=JREC) LINE                                          READEP   1878
      CID2(1:1)=LINE(32:32)                                             READEP   1879
      CID2(2:2)=' '                                                     READEP   1880
      TFLAG=LINE(19:19)                                                 READEP   1881
      ROPT=LINE(2:2)                                                    READEP   1882
      IF(NAUT.LT.MAXSET) THEN                                           READEP   1883
      NAUT=NAUT+1                                                       READEP   1884
      NAUTB=NAUTB+2                                                     READEP   1885
      NAUBUS(NAUTB-1)=NLFI                                              READEP   1886
      NAUBUS(NAUTB)=NLFJ                                                READEP   1887
      LRTEMP=LRTEMP+1                                                   READEP   1888
      IDATPT(LRTEMP)=JLNA                                               READEP   1889
      IADATA(JLNA+2)=NLFI                                               READEP   1890
      IADATA(JLNA+3)=NLFJ                                               READEP   1891
      CALL PACK(CID2,0,JI)                                              READEP   1892
      IADATA(JLNA+4)=JI                                                 READEP   1893
      IADATA(JLNA+5)=1                                                  READEP   1894
      IF(TFLAG.EQ.'C') IADATA(JLNA+5)=2                                 READEP   1895
      IADATA(JLNA+6)=1                                                  READEP   1896
      READ(LINE,2050) ADATA(JLNA+9),ADATA(JLNA+10),ADATA(JLNA+11),      READEP   1897
     1                ADATA(JLNA+12),ADATA(JLNA+14),ADATA(JLNA+15),     READEP   1898
     2                ADATA(JLNA+16),ADATA(JLNA+17),ADATA(JLNA+20)      READEP   1899
      IADATA(JLNA+7)=0                                                  READEP   1900
      IADATA(JLNA+8)=0                                                  READEP   1901
      JLNA=JLNA+27                                                      READEP   1902
      ELSE                                                              READEP   1903
      WRITE(MSG(1),2060) MXASCH                                         READEP   1904
      MSG(2)=LINE                                                       READEP   1905
      CALL PRTMSG(2)                                                    READEP   1906
      IEBK=1                                                            READEP   1907
      ENDIF                                                             READEP   1908
 610  CONTINUE                                                          READEP   1909
C                                                                       READEP   1910
      IF(LRTEMP.NE.LDISTR)THEN                                          READEP   1911
      LDISTR=LDISTR+1                                                   READEP   1912
      NDISTR=LRTEMP                                                     READEP   1913
      ELSE                                                              READEP   1914
      LDISTR=0                                                          READEP   1915
      NDISTR=0                                                          READEP   1916
      ENDIF                                                             READEP   1917
C                                                                       READEP   1918
C     PUT NONLINEAR LOAD DATA INTO TEMPORARY ARRAYS                     READEP   1919
C                                                                       READEP   1920
      DO 620 II=1,NLFBUS                                                READEP   1921
        IF(IBSNLD(II).EQ.0)GOTO 620                                     READEP   1922
C                                                                       READEP   1923
        IREC=IBSNLD(II)                                                 READEP   1924
        CALL EPLOSP(JNLD,IREC,JTLN,LINE                                 READEP   1925
     &                  ,ICCP,ICPP,KP1,A1,ICCQ,ICPQ,KQ1,B1              READEP   1926
     &                   ,AP1,AQ1,AP2,AQ2,AP3,AQ3,AP4,AQ4,ALDP,ALDQ)    READEP   1927
        BSNAME=LINE(4:15)                                               READEP   1928
C                                                                       READEP   1929
        ITDDAT(JTLN+1)=2                                                READEP   1930
        ITDDAT(JTLN+2)=JBUS(1)                                          READEP   1931
        ITDDAT(JTLN+3)=JBUS(2)                                          READEP   1932
        ITDDAT(JTLN+4)=JBUS(3)                                          READEP   1933
        ITDDAT(JTLN+5)=ICCP                                             READEP   1934
        ITDDAT(JTLN+6)=ICCQ                                             READEP   1935
        ITDDAT(JTLN+7)=ICPP                                             READEP   1936
        ITDDAT(JTLN+8)=ICPQ                                             READEP   1937
        ITDDAT(JTLN+9)=KP1                                              READEP   1938
        ITDDAT(JTLN+10)=KQ1                                             READEP   1939
        ITDDAT(JTLN+11)=0                                               READEP   1940
        ITDDAT(JTLN+12)=0                                               READEP   1941
        ITDDAT(JTLN+13)=0                                               READEP   1942
        ITDDAT(JTLN+14)=0                                               READEP   1943
        ITDDAT(JTLN+15)=0                                               READEP   1944
        JTLN=JTLN+15                                                    READEP   1945
C                                                                       READEP   1946
        IF(KP1.NE.0.OR.KQ1.NE.0)THEN                                    READEP   1947
          TDDAT(JTLN+1)=A1                                              READEP   1948
          TDDAT(JTLN+2)=ALDP                                            READEP   1949
          TDDAT(JTLN+3)=0.0                                             READEP   1950
          TDDAT(JTLN+4)=0.0                                             READEP   1951
          TDDAT(JTLN+5)=B1                                              READEP   1952
          TDDAT(JTLN+6)=ALDQ                                            READEP   1953
          TDDAT(JTLN+7)=0.0                                             READEP   1954
          TDDAT(JTLN+8)=0.0                                             READEP   1955
          JTLN=JTLN+8                                                   READEP   1956
        ENDIF                                                           READEP   1957
620   CONTINUE                                                          READEP   1958
C                                                                       READEP   1959
      DO 630 II=1,NUMZON                                                READEP   1960
        IF(IZNNLD(II).EQ.0)GOTO 630                                     READEP   1961
C                                                                       READEP   1962
        IREC=IZNNLD(II)                                                 READEP   1963
        CALL EPLOSP(JNLD,IREC,JTLN,LINE                                 READEP   1964
     &                  ,ICCP,ICPP,KP1,A1,ICCQ,ICPQ,KQ1,B1              READEP   1965
     &                   ,AP1,AQ1,AP2,AQ2,AP3,AQ3,AP4,AQ4,ALDP,ALDQ)    READEP   1966
        ZNNAME=LINE(16:17)                                              READEP   1967
        ARNAME='            '                                           READEP   1968
        BSNAME='            '                                           READEP   1969
C                                                                       READEP   1970
        ITDDAT(JTLN+1)=4                                                READEP   1971
        ITDDAT(JTLN+2)=JAREA(1)                                         READEP   1972
        ITDDAT(JTLN+3)=JAREA(2)                                         READEP   1973
        ITDDAT(JTLN+4)=JAREA(3)                                         READEP   1974
        ITDDAT(JTLN+5)=JAREA(1)                                         READEP   1975
        ITDDAT(JTLN+6)=JAREA(2)                                         READEP   1976
        ITDDAT(JTLN+7)=JAREA(3)                                         READEP   1977
        ITDDAT(JTLN+8)=JZONE(1)                                         READEP   1978
        ITDDAT(JTLN+9)=JZONE(2)                                         READEP   1979
        ITDDAT(JTLN+10)=JZONE(3)                                        READEP   1980
        ITDDAT(JTLN+11)=JZONE(1)                                        READEP   1981
        ITDDAT(JTLN+12)=JZONE(2)                                        READEP   1982
        ITDDAT(JTLN+13)=JZONE(3)                                        READEP   1983
        ITDDAT(JTLN+14)=JBUS(1)                                         READEP   1984
        ITDDAT(JTLN+15)=JBUS(2)                                         READEP   1985
        ITDDAT(JTLN+16)=JBUS(3)                                         READEP   1986
        ITDDAT(JTLN+17)=JBUS(1)                                         READEP   1987
        ITDDAT(JTLN+18)=JBUS(2)                                         READEP   1988
        ITDDAT(JTLN+19)=JBUS(3)                                         READEP   1989
        JTLN=JTLN+19                                                    READEP   1990
C                                                                       READEP   1991
        TDDAT(JTLN+1)=0.0                                               READEP   1992
        TDDAT(JTLN+2)=0.0                                               READEP   1993
        JTLN=JTLN+2                                                     READEP   1994
C                                                                       READEP   1995
        ITDDAT(JTLN+1)=ICCP                                             READEP   1996
        ITDDAT(JTLN+2)=ICCQ                                             READEP   1997
        ITDDAT(JTLN+3)=ICPP                                             READEP   1998
        ITDDAT(JTLN+4)=ICPQ                                             READEP   1999
        ITDDAT(JTLN+5)=KP1                                              READEP   2000
        ITDDAT(JTLN+6)=KQ1                                              READEP   2001
        ITDDAT(JTLN+7)=0                                                READEP   2002
        ITDDAT(JTLN+8)=0                                                READEP   2003
        ITDDAT(JTLN+9)=0                                                READEP   2004
        ITDDAT(JTLN+10)=0                                               READEP   2005
        ITDDAT(JTLN+11)=0                                               READEP   2006
        JTLN=JTLN+11                                                    READEP   2007
C                                                                       READEP   2008
        IF(KP1.NE.0.OR.KQ1.NE.0)THEN                                    READEP   2009
          TDDAT(JTLN+1)=A1                                              READEP   2010
          TDDAT(JTLN+2)=ALDP                                            READEP   2011
          TDDAT(JTLN+3)=0.0                                             READEP   2012
          TDDAT(JTLN+4)=0.0                                             READEP   2013
          TDDAT(JTLN+5)=B1                                              READEP   2014
          TDDAT(JTLN+6)=ALDQ                                            READEP   2015
          TDDAT(JTLN+7)=0.0                                             READEP   2016
          TDDAT(JTLN+8)=0.0                                             READEP   2017
          JTLN=JTLN+8                                                   READEP   2018
        ENDIF                                                           READEP   2019
630   CONTINUE                                                          READEP   2020
C                                                                       READEP   2021
      DO 640 II=1,NMAREA                                                READEP   2022
        IF(IARNLD(II).EQ.0)GOTO 640                                     READEP   2023
C                                                                       READEP   2024
        IREC=IARNLD(II)                                                 READEP   2025
        CALL EPLOSP(JNLD,IREC,JTLN,LINE                                 READEP   2026
     &                  ,ICCP,ICPP,KP1,A1,ICCQ,ICPQ,KQ1,B1              READEP   2027
     &                   ,AP1,AQ1,AP2,AQ2,AP3,AQ3,AP4,AQ4,ALDP,ALDQ)    READEP   2028
        ARNAME=LINE(18:27)                                              READEP   2029
        ZNNAME='            '                                           READEP   2030
        BSNAME='            '                                           READEP   2031
C                                                                       READEP   2032
        ITDDAT(JTLN+1)=4                                                READEP   2033
        ITDDAT(JTLN+2)=JAREA(1)                                         READEP   2034
        ITDDAT(JTLN+3)=JAREA(2)                                         READEP   2035
        ITDDAT(JTLN+4)=JAREA(3)                                         READEP   2036
        ITDDAT(JTLN+5)=JAREA(1)                                         READEP   2037
        ITDDAT(JTLN+6)=JAREA(2)                                         READEP   2038
        ITDDAT(JTLN+7)=JAREA(3)                                         READEP   2039
        ITDDAT(JTLN+8)=JZONE(1)                                         READEP   2040
        ITDDAT(JTLN+9)=JZONE(2)                                         READEP   2041
        ITDDAT(JTLN+10)=JZONE(3)                                        READEP   2042
        ITDDAT(JTLN+11)=JZONE(1)                                        READEP   2043
        ITDDAT(JTLN+12)=JZONE(2)                                        READEP   2044
        ITDDAT(JTLN+13)=JZONE(3)                                        READEP   2045
        ITDDAT(JTLN+14)=JBUS(1)                                         READEP   2046
        ITDDAT(JTLN+15)=JBUS(2)                                         READEP   2047
        ITDDAT(JTLN+16)=JBUS(3)                                         READEP   2048
        ITDDAT(JTLN+17)=JBUS(1)                                         READEP   2049
        ITDDAT(JTLN+18)=JBUS(2)                                         READEP   2050
        ITDDAT(JTLN+19)=JBUS(3)                                         READEP   2051
        JTLN=JTLN+19                                                    READEP   2052
C                                                                       READEP   2053
        TDDAT(JTLN+1)=0.0                                               READEP   2054
        TDDAT(JTLN+2)=0.0                                               READEP   2055
        JTLN=JTLN+2                                                     READEP   2056
C                                                                       READEP   2057
        ITDDAT(JTLN+1)=ICCP                                             READEP   2058
        ITDDAT(JTLN+2)=ICCQ                                             READEP   2059
        ITDDAT(JTLN+3)=ICPP                                             READEP   2060
        ITDDAT(JTLN+4)=ICPQ                                             READEP   2061
        ITDDAT(JTLN+5)=KP1                                              READEP   2062
        ITDDAT(JTLN+6)=KQ1                                              READEP   2063
        ITDDAT(JTLN+7)=0                                                READEP   2064
        ITDDAT(JTLN+8)=0                                                READEP   2065
        ITDDAT(JTLN+9)=0                                                READEP   2066
        ITDDAT(JTLN+10)=0                                               READEP   2067
        ITDDAT(JTLN+11)=0                                               READEP   2068
        JTLN=JTLN+11                                                    READEP   2069
C                                                                       READEP   2070
        IF(KP1.NE.0.OR.KQ1.NE.0)THEN                                    READEP   2071
          TDDAT(JTLN+1)=A1                                              READEP   2072
          TDDAT(JTLN+2)=ALDP                                            READEP   2073
          TDDAT(JTLN+3)=0.0                                             READEP   2074
          TDDAT(JTLN+4)=0.0                                             READEP   2075
          TDDAT(JTLN+5)=B1                                              READEP   2076
          TDDAT(JTLN+6)=ALDQ                                            READEP   2077
          TDDAT(JTLN+7)=0.0                                             READEP   2078
          TDDAT(JTLN+8)=0.0                                             READEP   2079
          JTLN=JTLN+8                                                   READEP   2080
        ENDIF                                                           READEP   2081
640   CONTINUE                                                          READEP   2082
C                                                                       READEP   2083
      IF(ITLNLD.NE.0)THEN                                               READEP   2084
        IREC=ITLNLD                                                     READEP   2085
        CALL EPLOSP(JNLD,IREC,JTLN,LINE                                 READEP   2086
     &                  ,ICCP,ICPP,KP1,A1,ICCQ,ICPQ,KQ1,B1              READEP   2087
     &                   ,AP1,AQ1,AP2,AQ2,AP3,AQ3,AP4,AQ4,ALDP,ALDQ)    READEP   2088
        ZNNAME='            '                                           READEP   2089
        BSNAME='            '                                           READEP   2090
C                                                                       READEP   2091
        ITDDAT(JTLN+1)=4                                                READEP   2092
        ITDDAT(JTLN+2)=IARE(1,1)                                        READEP   2093
        ITDDAT(JTLN+3)=IARE(1,2)                                        READEP   2094
        ITDDAT(JTLN+4)=IARE(1,3)                                        READEP   2095
        ITDDAT(JTLN+5)=IARE(NMAREA,1)                                   READEP   2096
        ITDDAT(JTLN+6)=IARE(NMAREA,2)                                   READEP   2097
        ITDDAT(JTLN+7)=IARE(NMAREA,3)                                   READEP   2098
        ITDDAT(JTLN+8)=JZONE(1)                                         READEP   2099
        ITDDAT(JTLN+9)=JZONE(2)                                         READEP   2100
        ITDDAT(JTLN+10)=JZONE(3)                                        READEP   2101
        ITDDAT(JTLN+11)=JZONE(1)                                        READEP   2102
        ITDDAT(JTLN+12)=JZONE(2)                                        READEP   2103
        ITDDAT(JTLN+13)=JZONE(3)                                        READEP   2104
        ITDDAT(JTLN+14)=JBUS(1)                                         READEP   2105
        ITDDAT(JTLN+15)=JBUS(2)                                         READEP   2106
        ITDDAT(JTLN+16)=JBUS(3)                                         READEP   2107
        ITDDAT(JTLN+17)=JBUS(1)                                         READEP   2108
        ITDDAT(JTLN+18)=JBUS(2)                                         READEP   2109
        ITDDAT(JTLN+19)=JBUS(3)                                         READEP   2110
        JTLN=JTLN+19                                                    READEP   2111
C                                                                       READEP   2112
        TDDAT(JTLN+1)=0.0                                               READEP   2113
        TDDAT(JTLN+2)=0.0                                               READEP   2114
        JTLN=JTLN+2                                                     READEP   2115
C                                                                       READEP   2116
        ITDDAT(JTLN+1)=ICCP                                             READEP   2117
        ITDDAT(JTLN+2)=ICCQ                                             READEP   2118
        ITDDAT(JTLN+3)=ICPP                                             READEP   2119
        ITDDAT(JTLN+4)=ICPQ                                             READEP   2120
        ITDDAT(JTLN+5)=KP1                                              READEP   2121
        ITDDAT(JTLN+6)=KQ1                                              READEP   2122
        ITDDAT(JTLN+7)=0                                                READEP   2123
        ITDDAT(JTLN+8)=0                                                READEP   2124
        ITDDAT(JTLN+9)=0                                                READEP   2125
        ITDDAT(JTLN+10)=0                                               READEP   2126
        ITDDAT(JTLN+11)=0                                               READEP   2127
        JTLN=JTLN+11                                                    READEP   2128
C                                                                       READEP   2129
        IF(KP1.NE.0.OR.KQ1.NE.0)THEN                                    READEP   2130
          TDDAT(JTLN+1)=A1                                              READEP   2131
          TDDAT(JTLN+2)=ALDP                                            READEP   2132
          TDDAT(JTLN+3)=0.0                                             READEP   2133
          TDDAT(JTLN+4)=0.0                                             READEP   2134
          TDDAT(JTLN+5)=B1                                              READEP   2135
          TDDAT(JTLN+6)=ALDQ                                            READEP   2136
          TDDAT(JTLN+7)=0.0                                             READEP   2137
          TDDAT(JTLN+8)=0.0                                             READEP   2138
          JTLN=JTLN+8                                                   READEP   2139
        ENDIF                                                           READEP   2140
      ENDIF                                                             READEP   2141
C                                                                       READEP   2142
      GOTO 646                                                          READEP   2143
C                                                                       READEP   2144
C     PUT THE INDUCTION MOTOR DATA INTO TEMPORARY ARRAYS                READEP   2145
C                                                                       READEP   2146
 646  DO 650 I=1,NMOTBS                                                 READEP   2147
      JREC=NTHMOT(I)                                                    READEP   2148
      READ(IU31,REC=JREC) LINE                                          READEP   2149
C                                                                       READEP   2150
      READ(LINE,3060)EMWS,PFA,BP,RS,XS,XM,RR,XR,VI,TI,A,B               READEP   2151
C                                                                       READEP   2152
      JMOTL=JMOTL+1                                                     READEP   2153
C                                                                       READEP   2154
      NLFB=MOTBUS(I)                                                    READEP   2155
      JMOTB(JMOTL)=NLFB                                                 READEP   2156
      IPFA1=NINT(PFA*100)                                               READEP   2157
      HM=EMWS/BP                                                        READEP   2158
C                                                                       READEP   2159
      INDMID(JMOTL)='  '//LINE(16:16)//' '                              READEP   2160
      JJMDAT(JMOTL)=JTLN                                                READEP   2161
      ITDDAT(JTLN+1)=1                                                  READEP   2162
      ITDDAT(JTLN+2)=IPFA1                                              READEP   2163
      ITDDAT(JTLN+3)=0                                                  READEP   2164
      ITDDAT(JTLN+4)=2                                                  READEP   2165
C                                                                       READEP   2166
      TDDAT(JTLN+5)=XM                                                  READEP   2167
      TDDAT(JTLN+6)=XS                                                  READEP   2168
      TDDAT(JTLN+7)=RS                                                  READEP   2169
      TDDAT(JTLN+8)=XR                                                  READEP   2170
      TDDAT(JTLN+9)=RR                                                  READEP   2171
      TDDAT(JTLN+10)=HM                                                 READEP   2172
      TDDAT(JTLN+11)=BP                                                 READEP   2173
      TDDAT(JTLN+12)=1.0                                                READEP   2174
      TDDAT(JTLN+13)=0.0                                                READEP   2175
      TDDAT(JTLN+14)=A                                                  READEP   2176
      TDDAT(JTLN+15)=B                                                  READEP   2177
      TDDAT(JTLN+16)=0.0                                                READEP   2178
      TDDAT(JTLN+17)=VI                                                 READEP   2179
      TDDAT(JTLN+18)=TI                                                 READEP   2180
      TDDAT(JTLN+19)=0.0                                                READEP   2181
      TDDAT(JTLN+20)=0.0                                                READEP   2182
      TDDAT(JTLN+21)=10.0                                               READEP   2183
      TDDAT(JTLN+22)=10.0                                               READEP   2184
      TDDAT(JTLN+23)=0.0                                                READEP   2185
      TDDAT(JTLN+24)=0.0                                                READEP   2186
      TDDAT(JTLN+25)=0.0                                                READEP   2187
      TDDAT(JTLN+26)=0.0                                                READEP   2188
C                                                                       READEP   2189
      JTLN=JTLN+26                                                      READEP   2190
      CALL MCHECK (NLFB,13,JTLN,'REPMOT')                               READEP   2191
 650  CONTINUE                                                          READEP   2192
C                                                                       READEP   2193
C     PUT THE SVC DATA INTO TEMPORARY ARRAYS                            READEP   2194
C                                                                       READEP   2195
      IQF=100                                                           READEP   2196
      ISDIV=2                                                           READEP   2197
C                                                                       READEP   2198
      DO 900 I=1,NSVCBS                                                 READEP   2199
        JREC=LSVC(I)                                                    READEP   2200
        JRECA=LSVCA(I)                                                  READEP   2201
        JRECB=LSVCB(I)                                                  READEP   2202
        JRECC=LSVCC(I)                                                  READEP   2203
        JRECD=LSVCD(I)                                                  READEP   2204
        JRECE=LSVCE(I)                                                  READEP   2205
        JRECF=LSVCF(I)                                                  READEP   2206
C                                                                       READEP   2207
        IF(JRECA.LE.0.AND.JRECB.LE.0.AND.JRECC.LE.0)THEN                READEP   2208
          ISVC=2                                                        READEP   2209
        ELSE                                                            READEP   2210
          ISVC=3                                                        READEP   2211
        ENDIF                                                           READEP   2212
C                                                                       READEP   2213
        NLFSV=LFSVCO(I)                                                 READEP   2214
        NVSENX=LFSVCR(I)                                                READEP   2215
        IF(NVSENX.EQ.0)NVSENX=NLFSV                                     READEP   2216
C                                                                       READEP   2217
        READ(IU31,REC=JREC)LINE                                         READEP   2218
        SVCNAM=LINE(4:15)                                               READEP   2219
        SVCKT=' '                                                       READEP   2220
        SVCKT(2:2)=LINE(16:16)                                          READEP   2221
        READ(LINE,4010) TS1,VEMAX,TS2,TS3,TS4,TS5,AKSVS,AKSD,BMAX,      READEP   2222
     +                  BMAXP,BMINP,BMIN,TS6,DV                         READEP   2223
C                                                                       READEP   2224
        IF(AKSVS.LE.0.0)THEN                                            READEP   2225
          WRITE(MSG(1),4020)                                            READEP   2226
          MSG(2)=LINE                                                   READEP   2227
          CALL PRTMSG(2)                                                READEP   2228
          LINE='READEP: SVC DATA ERROR'                                 READEP   2229
          CALL ASTOP (LINE,22)                                          READEP   2230
        ENDIF                                                           READEP   2231
C                                                                       READEP   2232
        QC=BMAX*100.0                                                   READEP   2233
        QL=QC-BMIN*100.0                                                READEP   2234
C                                                                       READEP   2235
        IF(QC.LT.0.0.OR.QL.LE.0.0)THEN                                  READEP   2236
          WRITE(MSG(1),4030)                                            READEP   2237
          MSG(2)=LINE                                                   READEP   2238
          CALL PRTMSG(2)                                                READEP   2239
          LINE='READEP: SVC DATA ERROR'                                 READEP   2240
          CALL ASTOP (LINE,22)                                          READEP   2241
        ENDIF                                                           READEP   2242
C                                                                       READEP   2243
        BMAX=-BMINP*100.0/QL                                            READEP   2244
        BMIN=-BMAXP*100.0/QL                                            READEP   2245
C                                                                       READEP   2246
        SVCDA(1)=TS1                                                    READEP   2247
        SVCDA(2)=VEMAX                                                  READEP   2248
        SVCDA(3)=TS2                                                    READEP   2249
        SVCDA(4)=TS3                                                    READEP   2250
        SVCDA(5)=TS4                                                    READEP   2251
        SVCDA(6)=TS5                                                    READEP   2252
        SVCDA(7)=AKSVS                                                  READEP   2253
        SVCDA(8)=0.0                                                    READEP   2254
        SVCDA(9)=AKSD                                                   READEP   2255
        SVCDA(10)=QL                                                    READEP   2256
        SVCDA(11)=BMAX                                                  READEP   2257
        SVCDA(12)=BMIN                                                  READEP   2258
        SVCDA(13)=QC                                                    READEP   2259
        SVCDA(14)=TS6                                                   READEP   2260
        SVCDA(15)=DV                                                    READEP   2261
        SVCDA(16)=0.0                                                   READEP   2262
        SVCDA(17)=0.0                                                   READEP   2263
        SVCDA(18)=0.0                                                   READEP   2264
        SVCDA(19)=0.0                                                   READEP   2265
        SVCDA(20)=0.0                                                   READEP   2266
        SVCDA(21)=0.0                                                   READEP   2267
        SVCDA(22)=0.0                                                   READEP   2268
        SVCDA(23)=0.0                                                   READEP   2269
C                                                                       READEP   2270
        IF(ISVC.EQ.3)THEN                                               READEP   2271
          IF(JRECA.GT.0)THEN                                            READEP   2272
            MT1=2                                                       READEP   2273
            READ(IU31,REC=JRECA)LINE                                    READEP   2274
            NVSEN1=LFSAR(I)                                             READEP   2275
            GENCKT=' '                                                  READEP   2276
            GENCKT(2:2)=LINE(66:66)                                     READEP   2277
          ELSEIF (JRECB.GT.0)THEN                                       READEP   2278
            MT1=0                                                       READEP   2279
            READ(IU31,REC=JRECB)LINE                                    READEP   2280
C                                                                       READEP   2281
            NVSEN1=LFSBRF(I)                                            READEP   2282
            NVSEN2=LFSBRT(I)                                            READEP   2283
            LCKT=' '                                                    READEP   2284
            LCKT(2:2)=LINE(79:79)                                       READEP   2285
          ELSE                                                          READEP   2286
            MT1=1                                                       READEP   2287
            READ(IU31,REC=JRECC)LINE                                    READEP   2288
            NVSEN1=LFSCR(I)                                             READEP   2289
          ENDIF                                                         READEP   2290
C                                                                       READEP   2291
          READ(LINE,4110) KS1,TS7,TS8,TS9,TS13,TS14,KS3,VSCCSM          READEP   2292
C                                                                       READEP   2293
          IF(TS14.EQ.0.0)THEN                                           READEP   2294
            WRITE(MSG(1),4120)                                          READEP   2295
            MSG(2)=LINE                                                 READEP   2296
            CALL PRTMSG(2)                                              READEP   2297
            LINE='READEP: SVC DATA ERROR'                               READEP   2298
            CALL ASTOP (LINE,22)                                        READEP   2299
          ENDIF                                                         READEP   2300
C                                                                       READEP   2301
          IF(TS13.NE.TS14) KS3=KS3*TS13/TS14                            READEP   2302
C                                                                       READEP   2303
          MT2=-1                                                        READEP   2304
          IF(JRECD.GT.0)THEN                                            READEP   2305
            MT2=0                                                       READEP   2306
            READ(IU31,REC=JRECD)LINE                                    READEP   2307
          ELSEIF(JRECE.GT.0)THEN                                        READEP   2308
            MT2=1                                                       READEP   2309
            READ(IU31,REC=JRECE)LINE                                    READEP   2310
          ELSEIF(JRECF.GT.0)THEN                                        READEP   2311
            MT2=2                                                       READEP   2312
            READ(IU31,REC=JRECF)LINE                                    READEP   2313
          ELSE                                                          READEP   2314
            KS2=0.0                                                     READEP   2315
            TS10=0.05                                                   READEP   2316
            TS11=0.01                                                   READEP   2317
            TS12=0.05                                                   READEP   2318
          ENDIF                                                         READEP   2319
C                                                                       READEP   2320
          IF(MT2.EQ.-1)THEN                                             READEP   2321
            MT2=0                                                       READEP   2322
          ELSE                                                          READEP   2323
            READ(LINE,4130)KS2,TS10,TS11,TS12                           READEP   2324
          ENDIF                                                         READEP   2325
C                                                                       READEP   2326
          SVCDA(24)=KS1                                                 READEP   2327
          SVCDA(25)=TS7                                                 READEP   2328
          SVCDA(26)=TS8                                                 READEP   2329
          SVCDA(27)=TS9                                                 READEP   2330
          SVCDA(28)=TS14                                                READEP   2331
          SVCDA(29)=KS3                                                 READEP   2332
          SVCDA(30)=VSCCSM                                              READEP   2333
          SVCDA(31)=KS2                                                 READEP   2334
          SVCDA(32)=TS10                                                READEP   2335
          SVCDA(33)=TS11                                                READEP   2336
          SVCDA(34)=TS12                                                READEP   2337
C                                                                       READEP   2338
        ENDIF                                                           READEP   2339
C                                                                       READEP   2340
        CALL STSVCD                                                     READEP   2341
C                                                                       READEP   2342
 900  CONTINUE                                                          READEP   2343
C                                                                       READEP   2344
      CALL CLOSEF(IU31)                                                 READEP   2345
C                                                                       READEP   2346
      RETURN                                                            READEP   2347
C                                                                       READEP   2348
 1000 FORMAT(' *** ERROR READING THE FOLLOWING DYNAMIC DATA CARD:')     READEP   2349
 1010 FORMAT(' *** ERROR READING THE FOLLOWING MACHINE DATA CARD:')     READEP   2350
 1020 FORMAT(' *** ERROR UNKNOWN CARD TYPE:')                           READEP   2351
 1040 FORMAT(1X,'MACHINE DATA CARD ',/,1X,A80)                          READEP   2352
 1060 FORMAT(1X,'EXCITER DATA CARD ',/,1X,A80)                          READEP   2353
 1080 FORMAT(1X,'STABILIZER DATA CARD ',/,1X,A80)                       READEP   2354
 1090 FORMAT(1X,'GOVERNOR DATA CARD ',/,1X,A80)                         READEP   2355
 1100 FORMAT(1X,'DEBUG (READEP) DETAIL MACHINE ',A2,' BUS :',A12,       READEP   2356
     1       /,1X,F7.1,3F8.2,11F8.3)                                    READEP   2357
 1120 FORMAT(1X,'DEBUG (READEP) DETAIL MACHINE SUB TRANSIENT  ',A2,     READEP   2358
     1       ' BUS :',A15,/,1X,F6.1,F4.2,I4,A3,F7.1,4(1X,F7.3))         READEP   2359
 1180 FORMAT(' *** WARNING TURBINE MODEL CONVERSION FOR BUS ',A13       READEP   2360
     *,'. FAILED.')                                                     READEP   2361
 1181 FORMAT(5X,'NO GOVERNOR OR TURBINE MODEL WILL BE',                 READEP   2362
     2       ' REPRESENTED FOR THIS MACHINE.')                          READEP   2363
 1190 FORMAT(' *** ERROR THE BUS IS NOT IN THE LOAD FLOW DATA SKIPPED.')READEP   2364
 1200 FORMAT(' *** WARNING MACHINE SATURATION CONVERSION ERROR')        READEP   2365
 1201 FORMAT(5X,'CHECK MACHINE DATA FOR : ',A12)                        READEP   2366
 1240 FORMAT(1X,'+++++++++++++++++++++++++++++++++++++',/,1X,A80)       READEP   2367
 1250 FORMAT(BZ,T4,A12,T17,F6.0,T23,F3.2,T26,F3.2,T29,F4.0,T33,F4.4,    READEP   2368
     1       T37,F5.4,T42,F5.4,T47,F5.4,T52,F5.4,T57,F4.2,              READEP   2369
     1       T61,F3.2,T64,F5.4,T69,F5.4,T74,F4.3,T78,F3.2)              READEP   2370
 1260 FORMAT(BZ,T17,F5.1,T23,F3.2,T27,I3,T31,A2,T38,F5.4,T43,F5.4,      READEP   2371
     1       T48,F4.4,T52,F4.4)                                         READEP   2372
 1310 FORMAT(A80)                                                       READEP   2373
 1350 FORMAT(1X,12I8)                                                   READEP   2374
 1360 FORMAT(' *** ERROR TOO MANY GENERATORS')                          READEP   2375
 1370 FORMAT(' *** ERROR TOO MANY LOAD SHEDDING BUSES')                 READEP   2376
 1380 FORMAT(' *** ERROR READING THE FOLLOWING LOAD SHED DATA CARD:')   READEP   2377
 1390 FORMAT(' *** ERROR FOLLOWING LOAD SHED DATA CARD NOT READY :')    READEP   2378
 1400 FORMAT(' *** ERROR TOO MANY RELAY BUSES')                         READEP   2379
 2020 FORMAT(16X,4(F5.3,F3.0,F2.0,F3.3),F4.2,F3.0,F2.0,F3.3)            READEP   2380
 2030 FORMAT(' *** ERROR READING THE FOLLOWING RELAY DATA CARD :')      READEP   2381
 2040 FORMAT(' *** ERROR FOLLOWING RELAY DATA CARD NOT READY :')        READEP   2382
 2050 FORMAT(33X,2(F5.5,F5.2,F5.5,F5.2),F5.2)                           READEP   2383
 2060 FORMAT(' *** RELAY SCHEME EXCEEDS THE LIMIT OF ',I3)              READEP   2384
 2090 FORMAT(' *** ERROR TOO MANY INDUCTION MOTORS')                    READEP   2385
 3020 FORMAT(' *** SUM OF MULTIPLIERS FOR NONLINEAR LOAD IS NOT 1.0 ',  READEP   2386
     +       '- DATA IS IGNORED')                                       READEP   2387
 3030 FORMAT(BZ,27X,10F5.3)                                             READEP   2388
 3060 FORMAT(BZ,T17,F6.0,T23,F3.2,T29,F4.0,T33,F5.4,T38,F5.4,T43,F5.4,  READEP   2389
     1 T48,F5.4,T53,F5.4,T58,F3.2,T61,F4.2,T65,F5.4,T70,F5.4)           READEP   2390
 3080 FORMAT(' *** ERROR TOO MANY SVCS')                                READEP   2391
 3090 FORMAT(' *** ERROR SVC CONTROL TYPE')                             READEP   2392
 3100 FORMAT(' *** WARNING - SUPPLEMENTARY CONTROL SWITCH FOR ',        READEP   2393
     +       'SVC NOT IMPLEMENTED')                                     READEP   2394
 4000 FORMAT(' *** ERROR FIRST CARD OF SVC DATA MISSING')               READEP   2395
 4010 FORMAT(16X,2F3.3,2F4.4,2X,2F3.3,2F4.0,2F4.3,2F4.2,2F3.3)          READEP   2396
 4020 FORMAT(' *** ERROR SVC GAIN KSVS MUST BE LARGER THAN 0')          READEP   2397
 4030 FORMAT(' *** ERROR SVC QL MUST BE LARGER THAN ZERO AND            READEP   2398
     1 QC NON-NEGATIVE')                                                READEP   2399
 4040 FORMAT(' *** ERROR REMOTE RELAY NOT READY')                       READEP   2400
 4050 FORMAT(' *** ERROR CONTROLLING RELAY DOES NOT EXIST FOR ',        READEP   2401
     +       'REMOTE RELAY')                                            READEP   2402
 4070 FORMAT(' *** ERROR TOO MANY REMOTE RELAYS. MAX 15')               READEP   2403
 4080 FORMAT(' *** ERROR KEY WORD AT COLUMN 34 OF REMOTE RELAY CARD'    READEP   2404
     *,' NOT RECOGNIZABLE')                                             READEP   2405
 4110 FORMAT(16X,F4.0,3F4.4,2X,3F4.2,F4.3)                              READEP   2406
 4120 FORMAT(' *** ERROR SVC WASHOUT TIME CONSTANT TS14 ',              READEP   2407
     +       ' MUST BE NON-ZERO')                                       READEP   2408
 4130 FORMAT (16X,F4.0,3F4.4)                                           READEP   2409
 5000 FORMAT(62X,3F6.5)                                                 READEP   2410
 5100 FORMAT('MLI',1X,2A12,A1,3X,3F8.3)                                 READEP   2411
 5200 FORMAT('DLI',1X,2A12,A1,41X,F10.5)                                READEP   2412
 5300 FORMAT('RLI',1X,2A12,A1)                                          READEP   2413
 5400 FORMAT('SLD',1X,A12,I5,2F8.3,33X,F10.5)                           READEP   2414
 5500 FORMAT(3X,F3.0,56X,F6.5)                                          READEP   2415
 5600 FORMAT(3X,F3.0,62X,F6.5)                                          READEP   2416
 5700 FORMAT('GM ',1X,A12,1X,A2,2X,F8.3)                                READEP   2417
 5800 FORMAT(3X,F3.0)                                                   READEP   2418
 6000 FORMAT(' *** WARNING - BUS/AREA/ZONE NOT IN LOAD FLOW',           READEP   2419
     +       ' - DATA IS IGNORED')                                      READEP   2420
 6100 FORMAT(' *** WARNING - TRANSIENT STABILIZER MODEL IS OBSOLETE',   READEP   2421
     +       ' - DATA IS IGNORED')                                      READEP   2422
 6200 FORMAT(' *** WARNING - A TURBINE MODEL IS NOT REPRESENTED')       READEP   2423
 6300 FORMAT('     FOR THE GOVERNOR ON GENERATOR ',A13)                 READEP   2424
 7000 FORMAT(A80)                                                       READEP   2425
        END                                                             READEP   2426
C                                                                       READEP   2427
      SUBROUTINE EPLSB1(IPTR,JREC,NTLSD,JTYPE,JFLAG,IERR)               READEP   2428
      INCLUDE 'PARX.INS'                                                READEP   2429
      INCLUDE 'CNUNIT.INS'                                              READEP   2430
C                                                                       READEP   2431
      CHARACTER*80 LINE1                                                READEP   2432
C                                                                       READEP   2433
      INTEGER MB(NM),MC(NM),MF(NM),EXCEP(NM),EXCIE(NM),IEEEX(NM)        READEP   2434
      INTEGER STAB(NM),GOV(NM),TB(NM)                                   READEP   2435
C                                                                       READEP   2436
      INTEGER NTHREL(NB/3)                                              READEP   2437
      INTEGER RLBUS1(NB/3),RLBUS2(NB/3)                                 READEP   2438
      INTEGER NTHMOT(NMT),MOTBUS(NMT)                                   READEP   2439
      INTEGER LSVCBN(NB),LSVC(NSR),LSVCA(NSR),LSVCB(NSR)                READEP   2440
      INTEGER LSVCC(NSR),LSVCD(NSR),LSVCE(NSR),LSVCF(NSR)               READEP   2441
      INTEGER LFSVCO(NSR),LFSVCR(NSR),LFSAR(NSR),LFSBRF(NSR)            READEP   2442
      INTEGER LFSBRT(NSR),LFSCR(NSR),ITHGEN(20)                         READEP   2443
C                                                                       READEP   2444
*IF -MI2                                                                READEP   2445
      INTEGER*2 IFSLSD,INXLSD,ILSREC,IRRREC,IBSNLD,IZNNLD,IARNLD        READEP   2446
*ENDIF                                                                  READEP   2447
C                                                                       READEP   2448
      COMMON /SCRAT3/ MB,MC,MF,EXCEP,EXCIE,IEEEX,STAB,GOV,TB            READEP   2449
     +               ,NTHREL,RLBUS1,RLBUS2                              READEP   2450
     +               ,IBSNLD(NB),IZNNLD(JZN),IARNLD(JAR),NTHMOT,MOTBUS  READEP   2451
     +               ,LSVCBN,LSVC,LSVCA,LSVCB,LSVCC,LSVCD,LSVCE         READEP   2452
     +               ,LSVCF,LFSVCO,LFSVCR,LFSAR,LFSBRF                  READEP   2453
     +               ,LFSBRT,LFSCR,ITHGEN                               READEP   2454
     +               ,IFSLSD(NB),INXLSD(MAXSET),ILSREC(MAXSET)          READEP   2455
     +               ,IRRREC(15*MAXSET)                                 READEP   2456
C                                                                       READEP   2457
      IERR=0                                                            READEP   2458
C                                                                       READEP   2459
        IF(IFSLSD(IPTR).EQ.0)THEN                                       READEP   2460
        NTLSD=NTLSD+1                                                   READEP   2461
        IF(NTLSD.GT.MAXSET)THEN                                         READEP   2462
        IERR=1                                                          READEP   2463
        RETURN                                                          READEP   2464
        ENDIF                                                           READEP   2465
        IFSLSD(IPTR)=NTLSD                                              READEP   2466
        ILSREC(NTLSD)=JREC                                              READEP   2467
        ELSE                                                            READEP   2468
        II=IFSLSD(IPTR)                                                 READEP   2469
 381    JJREC=ILSREC(II)                                                READEP   2470
        READ(IU31,REC=JJREC) JJFLAG,JJTYPE,LINE1                        READEP   2471
        IF(JJTYPE.EQ.JTYPE.AND.JJFLAG.LE.JFLAG)THEN                     READEP   2472
          ILSREC(II)=JREC                                               READEP   2473
          RETURN                                                        READEP   2474
        ENDIF                                                           READEP   2475
        IF(INXLSD(II).NE.0)THEN                                         READEP   2476
          II=INXLSD(II)                                                 READEP   2477
          GOTO 381                                                      READEP   2478
        ELSE                                                            READEP   2479
          NTLSD=NTLSD+1                                                 READEP   2480
          IF(NTLSD.GT.MAXSET)THEN                                       READEP   2481
          IERR=1                                                        READEP   2482
          RETURN                                                        READEP   2483
          ENDIF                                                         READEP   2484
          INXLSD(II)=NTLSD                                              READEP   2485
          ILSREC(NTLSD)=JREC                                            READEP   2486
        ENDIF                                                           READEP   2487
      ENDIF                                                             READEP   2488
C                                                                       READEP   2489
      RETURN                                                            READEP   2490
      END                                                               READEP   2491
