CFPRIME RSTPDA                                                          RSTPDA      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 RSTPDA(IUX,IUY,IEBK)                                   RSTPDA      3
CD                                                                      RSTPDA      4
CD    TO READ STP DATA.                                                 RSTPDA      5
CD                                                                      RSTPDA      6
CD    ROUTINE INPUTS:                                                   RSTPDA      7
CD                                                                      RSTPDA      8
CD    IUX IS THE UNIT OF WHICH STP DATA IS READ                         RSTPDA      9
CD    IUY IS THE UNIT OF WHICH ERROR AND WARNING MESSAGE IS WRITTEN     RSTPDA     10
CD    IEBK IS THE ERROR INDICATOR                                       RSTPDA     11
CD    IEBK = 1 WHEN NUMBER OF STP BUSES EXCEEDS THE PROGRAM LIMIT       RSTPDA     12
CD                                                                      RSTPDA     13
      INCLUDE 'PARX.INS'                                                RSTPDA     14
      INCLUDE 'CNFLAG.INS'                                              RSTPDA     15
      INCLUDE 'CNB19.INS'                                               RSTPDA     16
      INCLUDE 'CNMNEW.INS'                                              RSTPDA     17
      INCLUDE 'CNJPT.INS'                                               RSTPDA     18
      INCLUDE 'CNJDAT.INS'                                              RSTPDA     19
      INCLUDE 'CNTMDA.INS'                                              RSTPDA     20
      INCLUDE 'CNUNIT.INS'                                              RSTPDA     21
      INCLUDE 'CNMSG.INS'                                               RSTPDA     22
      INCLUDE 'CNPARX.INS'                                              RSTPDA     23
*IF FACTS                                                               RSTPDA     24
C                                                                       RSTPDA     25
      CHARACTER*40 LCARD(2)                                             RSTPDA     26
C                                                                       RSTPDA     27
      CHARACTER*80 SIMBUF                                               RSTPDA     28
      CHARACTER*12 STPA1,STPA2                                          RSTPDA     29
      CHARACTER*2 KCKT1                                                 RSTPDA     30
C                                                                       RSTPDA     31
      DATA LCARD(1)/'     START OF THE STP DATA              '/         RSTPDA     32
      DATA LCARD(2)/'                                        '/         RSTPDA     33
C                                                                       RSTPDA     34
      LDEB=(JDEB(8).NE.0)                                               RSTPDA     35
C                                                                       RSTPDA     36
C     READING STP DATA                                                  RSTPDA     37
C                                                                       RSTPDA     38
  100 CONTINUE                                                          RSTPDA     39
      CALL GETLIN (IUX,SIMBUF)                                          RSTPDA     40
      IF (SIMBUF(1:5).EQ.'EDATA')GOTO 150                               RSTPDA     41
C                                                                       RSTPDA     42
      LDSTAT=1                                                          RSTPDA     43
      IF(KLFO.EQ.0)THEN                                                 RSTPDA     44
         READ(SIMBUF,1010,IOSTAT=IOS) NLF1,NLF2,KCKT1,NTTYPX,NPTYPX     RSTPDA     45
     &   ,ITABT,ITABP,IDIVX                                             RSTPDA     46
         IF(IOS.NE.0) GOTO 900                                          RSTPDA     47
         IF(NLF1.GT.N99999.OR.NLF2.GT.N99999) THEN                      RSTPDA     48
            WRITE(MSG(1),1070) N99999                                   RSTPDA     49
            MSG(2)=SIMBUF                                               RSTPDA     50
            CALL PRTMSG(2)                                              RSTPDA     51
            LDSTAT=5                                                    RSTPDA     52
         ENDIF                                                          RSTPDA     53
      ELSE                                                              RSTPDA     54
         READ(SIMBUF,1040,IOSTAT=IOS) STPA1,STPA2,KCKT1,NTTYPX,NPTYPX   RSTPDA     55
     &   ,ITABT,ITABP,IDIVX                                             RSTPDA     56
         IF(IOS.NE.0) GOTO 900                                          RSTPDA     57
         CALL CHKBUS(STPA1,NLF1)                                        RSTPDA     58
         CALL CHKBUS(STPA2,NLF2)                                        RSTPDA     59
      ENDIF                                                             RSTPDA     60
      LCARD(1)=SIMBUF(1:40)                                             RSTPDA     61
      LCARD(2)=SIMBUF(41:80)                                            RSTPDA     62
      IF (KLFO.NE.0) THEN                                               RSTPDA     63
         IF (NLF1.LE.0) THEN                                            RSTPDA     64
            WRITE(MSG(1),1030)                                          RSTPDA     65
            MSG(2)=SIMBUF                                               RSTPDA     66
            CALL PRTMSG(2)                                              RSTPDA     67
            LDSTAT=5                                                    RSTPDA     68
         ENDIF                                                          RSTPDA     69
         IF (NLF2.LE.0) THEN                                            RSTPDA     70
            WRITE(MSG(1),1030)                                          RSTPDA     71
            MSG(2)=SIMBUF                                               RSTPDA     72
            CALL PRTMSG(2)                                              RSTPDA     73
            LDSTAT=5                                                    RSTPDA     74
         ENDIF                                                          RSTPDA     75
      ELSE                                                              RSTPDA     76
         IF(MNEW(NLF1).EQ.0)THEN                                        RSTPDA     77
            WRITE(MSG(1),1030)                                          RSTPDA     78
            MSG(2)=SIMBUF                                               RSTPDA     79
            CALL PRTMSG(2)                                              RSTPDA     80
            LDSTAT=5                                                    RSTPDA     81
         ELSE                                                           RSTPDA     82
         ENDIF                                                          RSTPDA     83
         IF(MNEW(NLF2).EQ.0)THEN                                        RSTPDA     84
            WRITE(MSG(1),1030)                                          RSTPDA     85
            MSG(2)=SIMBUF                                               RSTPDA     86
            CALL PRTMSG(2)                                              RSTPDA     87
            LDSTAT=5                                                    RSTPDA     88
         ENDIF                                                          RSTPDA     89
      ENDIF                                                             RSTPDA     90
C                                                                       RSTPDA     91
      IF(LDSTAT.EQ.1)THEN                                               RSTPDA     92
      NPROG=MNEW(NLF1)                                                  RSTPDA     93
      LDSTAT=JBSTAT(NPROG)                                              RSTPDA     94
      ENDIF                                                             RSTPDA     95
      IF(LDSTAT.LT.3)THEN                                               RSTPDA     96
      NPROG=MNEW(NLF2)                                                  RSTPDA     97
      LDSTAT=JBSTAT(NPROG)                                              RSTPDA     98
      ENDIF                                                             RSTPDA     99
C                                                                       RSTPDA    100
      JTCPS=JTCPS+1                                                     RSTPDA    101
      JSTTP(JTCPS)=LDSTAT                                               RSTPDA    102
      IF(JTCPS.GT.NXSTP)GOTO 140                                        RSTPDA    103
      JJTPDA(JTCPS)=JTLN                                                RSTPDA    104
      ITDDAT(JTLN+1)=NLF1                                               RSTPDA    105
      ITDDAT(JTLN+2)=NLF2                                               RSTPDA    106
      CALL PACK(KCKT1,0,JCKID)                                          RSTPDA    107
      ITDDAT(JTLN+3)=JCKID                                              RSTPDA    108
      ITDDAT(JTLN+4)=NTTYPX                                             RSTPDA    109
      ITDDAT(JTLN+5)=NPTYPX                                             RSTPDA    110
      ITDDAT(JTLN+6)=ITABT                                              RSTPDA    111
      ITDDAT(JTLN+7)=ITABP                                              RSTPDA    112
      IF(IDIVX.LT.1)IDIVX=1                                             RSTPDA    113
      ITDDAT(JTLN+20)=IDIVX                                             RSTPDA    114
      CALL GETLIN (IUX,SIMBUF)                                          RSTPDA    115
      READ(SIMBUF,1000,IOSTAT=IOS) (TDDAT(JTLN+JJ),JJ=8,11)             RSTPDA    116
      IF(IOS.NE.0) GOTO 900                                             RSTPDA    117
      JTLN=JTLN+20                                                      RSTPDA    118
      IF(ITABT.GT.0) THEN                                               RSTPDA    119
         CALL GETLIN (IUX,SIMBUF)                                       RSTPDA    120
         READ(SIMBUF,1000,IOSTAT=IOS) (TDDAT(JTLN+JJ),JJ=1,8)           RSTPDA    121
         IF(IOS.NE.0) GOTO 900                                          RSTPDA    122
         IF(ITABT.GT.4) THEN                                            RSTPDA    123
            CALL GETLIN (IUX,SIMBUF)                                    RSTPDA    124
            READ(SIMBUF,1000,IOSTAT=IOS) (TDDAT(JTLN+JJ),JJ=9,16)       RSTPDA    125
            IF(IOS.NE.0) GOTO 900                                       RSTPDA    126
            IF(ITABT.GT.8) THEN                                         RSTPDA    127
               CALL GETLIN (IUX,SIMBUF)                                 RSTPDA    128
               READ(SIMBUF,1000,IOSTAT=IOS) (TDDAT(JTLN+JJ),JJ=17,24)   RSTPDA    129
               IF(IOS.NE.0) GOTO 900                                    RSTPDA    130
               IF(ITABT.GT.12) THEN                                     RSTPDA    131
                  CALL GETLIN (IUX,SIMBUF)                              RSTPDA    132
                  READ(SIMBUF,1000,IOSTAT=IOS)                          RSTPDA    133
     *                (TDDAT(JTLN+JJ),JJ=25,32)                         RSTPDA    134
                  IF(IOS.NE.0) GOTO 900                                 RSTPDA    135
                  IF(ITABT.GT.16) THEN                                  RSTPDA    136
                     CALL GETLIN (IUX,SIMBUF)                           RSTPDA    137
                     READ(SIMBUF,1000,IOSTAT=IOS)                       RSTPDA    138
     *                   (TDDAT(JTLN+JJ),JJ=33,40)                      RSTPDA    139
                     IF(IOS.NE.0) GOTO 900                              RSTPDA    140
                  ENDIF                                                 RSTPDA    141
               ENDIF                                                    RSTPDA    142
            ENDIF                                                       RSTPDA    143
         ENDIF                                                          RSTPDA    144
         JTLN=JTLN+2*ITABT                                              RSTPDA    145
      ENDIF                                                             RSTPDA    146
      IF(ITABP.GT.0) THEN                                               RSTPDA    147
         CALL GETLIN (IUX,SIMBUF)                                       RSTPDA    148
         READ(SIMBUF,1000,IOSTAT=IOS) (TDDAT(JTLN+JJ),JJ=1,8)           RSTPDA    149
         IF(IOS.NE.0) GOTO 900                                          RSTPDA    150
         IF(ITABP.GT.4) THEN                                            RSTPDA    151
            CALL GETLIN (IUX,SIMBUF)                                    RSTPDA    152
            READ(SIMBUF,1000,IOSTAT=IOS) (TDDAT(JTLN+JJ),JJ=9,16)       RSTPDA    153
            IF(IOS.NE.0) GOTO 900                                       RSTPDA    154
            IF(ITABP.GT.8) THEN                                         RSTPDA    155
               CALL GETLIN (IUX,SIMBUF)                                 RSTPDA    156
               READ(SIMBUF,1000,IOSTAT=IOS) (TDDAT(JTLN+JJ),JJ=17,24)   RSTPDA    157
               IF(IOS.NE.0) GOTO 900                                    RSTPDA    158
               IF(ITABP.GT.12) THEN                                     RSTPDA    159
                  CALL GETLIN (IUX,SIMBUF)                              RSTPDA    160
                  READ(SIMBUF,1000,IOSTAT=IOS)                          RSTPDA    161
     *                (TDDAT(JTLN+JJ),JJ=25,32)                         RSTPDA    162
                  IF(IOS.NE.0) GOTO 900                                 RSTPDA    163
                  IF(ITABP.GT.16) THEN                                  RSTPDA    164
                     CALL GETLIN (IUX,SIMBUF)                           RSTPDA    165
                     READ(SIMBUF,1000,IOSTAT=IOS)                       RSTPDA    166
     *                   (TDDAT(JTLN+JJ),JJ=33,40)                      RSTPDA    167
                     IF(IOS.NE.0) GOTO 900                              RSTPDA    168
                  ENDIF                                                 RSTPDA    169
               ENDIF                                                    RSTPDA    170
            ENDIF                                                       RSTPDA    171
         ENDIF                                                          RSTPDA    172
         JTLN=JTLN+2*ITABP                                              RSTPDA    173
      ENDIF                                                             RSTPDA    174
C                                                                       RSTPDA    175
      IF (NTTYPX.EQ.0.AND.NPTYPX.EQ.0) GO TO 130                        RSTPDA    176
C                                                                       RSTPDA    177
C     READING STC DATA                                                  RSTPDA    178
C                                                                       RSTPDA    179
      IF(NTTYPX.NE.50) GO TO 110                                        RSTPDA    180
C                                                                       RSTPDA    181
C     USER DEFINED STC DATA                                             RSTPDA    182
C                                                                       RSTPDA    183
      JJTDAT(JTCPS)=JTLN                                                RSTPDA    184
      JTLN1=0                                                           RSTPDA    185
      NUF=7                                                             RSTPDA    186
      CALL RUDMDA(NUF,IUX,IUY,JTLN1,SIMBUF)                             RSTPDA    187
      IF(NUF.EQ.900) GO TO 900                                          RSTPDA    188
  110 CONTINUE                                                          RSTPDA    189
C                                                                       RSTPDA    190
C     STANDARD STC DATA (FOR FUTURE USE)                                RSTPDA    191
C                                                                       RSTPDA    192
C     READING SPS DATA                                                  RSTPDA    193
C                                                                       RSTPDA    194
      IF(NPTYPX.NE.50) GO TO 120                                        RSTPDA    195
C                                                                       RSTPDA    196
C     USER DEFINED SPS DATA                                             RSTPDA    197
C                                                                       RSTPDA    198
      JJPDAT(JTCPS)=JTLN                                                RSTPDA    199
      JTLN1=0                                                           RSTPDA    200
      NUF=8                                                             RSTPDA    201
      CALL RUDMDA(NUF,IUX,IUY,JTLN1,SIMBUF)                             RSTPDA    202
      IF(NUF.EQ.900) GO TO 900                                          RSTPDA    203
      CALL MCHECK (NLF1,14,JTLN,'RSTPDA')                               RSTPDA    204
      GO TO 100                                                         RSTPDA    205
  120 CONTINUE                                                          RSTPDA    206
C                                                                       RSTPDA    207
C     STANDARD SPS DATA (FOR FUTURE)                                    RSTPDA    208
C                                                                       RSTPDA    209
      GOTO 100                                                          RSTPDA    210
C                                                                       RSTPDA    211
  130 CONTINUE                                                          RSTPDA    212
      WRITE(MSG(1),1060) JTCPS                                          RSTPDA    213
      CALL PRTMSG(1)                                                    RSTPDA    214
      SIMBUF='RSTPDA: STP TYPE ERROR'                                   RSTPDA    215
      CALL ASTOP(SIMBUF,22)                                             RSTPDA    216
C                                                                       RSTPDA    217
  140 CONTINUE                                                          RSTPDA    218
      WRITE (MSG(1),1020) NLF1,NLF2,NXSTP                               RSTPDA    219
      WRITE(MSG(2),1021)                                                RSTPDA    220
      CALL PRTMSG(2)                                                    RSTPDA    221
      IEBK=1                                                            RSTPDA    222
  150 CONTINUE                                                          RSTPDA    223
C                                                                       RSTPDA    224
      RETURN                                                            RSTPDA    225
C                                                                       RSTPDA    226
  900 CONTINUE                                                          RSTPDA    227
      WRITE(MSG(1),1050)                                                RSTPDA    228
      MSG(2)=LCARD(1)//LCARD(2)                                         RSTPDA    229
      MSG(4)=SIMBUF                                                     RSTPDA    230
      WRITE(MSG(3),1051)                                                RSTPDA    231
      CALL PRTMSG(4)                                                    RSTPDA    232
      SIMBUF='RSTPDA STP DATA READING ERROR'                            RSTPDA    233
      CALL ASTOP(SIMBUF,29)                                             RSTPDA    234
C                                                                       RSTPDA    235
 1000 FORMAT (8F10.5)                                                   RSTPDA    236
 1010 FORMAT(2I5,3X,A2,5I5)                                             RSTPDA    237
 1020 FORMAT(1X,'*** ERROR STP BETWEEN BUSES ',2I6                      RSTPDA    238
     &,'EXCEEDS THE LIMIT OF ',I4)                                      RSTPDA    239
 1021 FORMAT(11X,'INCREASE NXSTP IN PARX.INS')                          RSTPDA    240
 1030 FORMAT(' *** ERROR EPRI FORMAT STP BUS NAME ERROR',               RSTPDA    241
     &       ' CHECK THE FOLLOWING CARD:')                              RSTPDA    242
 1040 FORMAT (2A12,4X,A2,5I5)                                           RSTPDA    243
 1050 FORMAT(1X,'*** READ ERROR CHECK THE CARD:')                       RSTPDA    244
 1051 FORMAT(11X,'THIS IS THE FIRST CARD OF THE',                       RSTPDA    245
     & ' STP DEVICE LAST READ:')                                        RSTPDA    246
 1060 FORMAT(1X,'*** ERROR STP# ',I3,' BOTH STC AND SPS TYPES',         RSTPDA    247
     &' CANNOT BE ZERO.')                                               RSTPDA    248
 1070 FORMAT(' *** ERROR BUS NUMBER OF THE ABOVE STP/STC EXCEEDED',I6)  RSTPDA    249
*ENDIF                                                                  RSTPDA    250
*IF -FACTS                                                              RSTPDA    251
*ENDIF                                                                  RSTPDA    256
      END                                                               RSTPDA    257
