CFPRIME RSVCDA                                                          RSVCDA      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 RSVCDA(IUX,IUY,IEBK)                                   RSVCDA      3
CD                                                                      RSVCDA      4
CD    TO READ SVC DATA.                                                 RSVCDA      5
CD                                                                      RSVCDA      6
CD    ROUTINE INPUTS:                                                   RSVCDA      7
CD                                                                      RSVCDA      8
CD    IUX IS THE UNIT OF WHICH THE DATA IS READ                         RSVCDA      9
CD    IUY IS THE UNIS OF WHICH THE ERROR AND WARNING MESSAGE ARE WRITTENRSVCDA     10
CD    IEBK IS THE ERROR INDICATOR                                       RSVCDA     11
CD    IEBK =1 WHEN NUMBER OF SVC EXCEEDS THE PROGRAM LIMIT              RSVCDA     12
CD    IEBK =2 WHEN THE SVC BUS IS NOT IN THE LOAD FLOW CASE.            RSVCDA     13
CD            THE SVC DATA WILL BE IGNORED IN THIS CASE                 RSVCDA     14
CD                                                                      RSVCDA     15
      INCLUDE 'PARX.INS'                                                RSVCDA     16
      INCLUDE 'CNPARX.INS'                                              RSVCDA     17
      INCLUDE 'CNFLAG.INS'                                              RSVCDA     18
      INCLUDE 'CNB19.INS'                                               RSVCDA     19
      INCLUDE 'CNMNEW.INS'                                              RSVCDA     20
      INCLUDE 'CNPT.INS'                                                RSVCDA     21
      INCLUDE 'CNJPT.INS'                                               RSVCDA     22
      INCLUDE 'CNJDAT.INS'                                              RSVCDA     23
      INCLUDE 'CNTGED.INS'                                              RSVCDA     24
      INCLUDE 'CNGSRC.INS'                                              RSVCDA     25
      INCLUDE 'CNTMDA.INS'                                              RSVCDA     26
      INCLUDE 'CNUNIT.INS'                                              RSVCDA     27
      INCLUDE 'CNMSG.INS'                                               RSVCDA     28
C                                                                       RSVCDA     29
      CHARACTER*40 LCARD(2)                                             RSVCDA     30
C                                                                       RSVCDA     31
      CHARACTER*80 SIMBUF                                               RSVCDA     32
      CHARACTER*12 SVRNA1,SVRNA2,SVRNAM,IBLK12                          RSVCDA     33
      CHARACTER GENCKT*2,LCKT*2,NGRI*4                                  RSVCDA     34
C                                                                       RSVCDA     35
      DATA IBLK12/'            '/                                       RSVCDA     36
C                                                                       RSVCDA     37
C     READING SVC DATA                                                  RSVCDA     38
C                                                                       RSVCDA     39
      LDEB=(JDEB(8).NE.0)                                               RSVCDA     40
C                                                                       RSVCDA     41
      LCARD(1)='     START OF THE SVC DATA              '               RSVCDA     42
      LCARD(2)='                                        '               RSVCDA     43
      IEBK=0                                                            RSVCDA     44
      NVSENX=0                                                          RSVCDA     45
C                                                                       RSVCDA     46
  100 CONTINUE                                                          RSVCDA     47
      JPQ=0                                                             RSVCDA     48
      JTHGSR=0                                                          RSVCDA     49
      CALL GETLIN (IUX,SIMBUF)                                          RSVCDA     50
      IF (SIMBUF(1:5).EQ.'EDATA')GOTO 150                               RSVCDA     51
C                                                                       RSVCDA     52
      IF(KLFO.EQ.0)THEN                                                 RSVCDA     53
         READ (SIMBUF,1000,IOSTAT=IOS) NLF,NGRI,NRTYPX,IQFARX,IDIVX     RSVCDA     54
     &,NVSENX                                                           RSVCDA     55
         IF(IOS.NE.0) GOTO 900                                          RSVCDA     56
               IF (NLF.GT.N99999) THEN                                  RSVCDA     57
                  WRITE(MSG(2),1200) N99999                             RSVCDA     58
                  MSG(1)=SIMBUF                                         RSVCDA     59
                  CALL PRTMSG(2)                                        RSVCDA     60
                  JDSTAT=5                                              RSVCDA     61
               ENDIF                                                    RSVCDA     62
      ELSE                                                              RSVCDA     63
         READ(SIMBUF,1060,IOSTAT=IOS) SVRNAM,NGRI,NRTYPX,IQFARX,IDIVX   RSVCDA     64
     &,SVRNA2                                                           RSVCDA     65
         IF(IOS.NE.0) GOTO 900                                          RSVCDA     66
         CALL CHKBUS(SVRNAM,NLF)                                        RSVCDA     67
      ENDIF                                                             RSVCDA     68
      LCARD(1)=SIMBUF(1:40)                                             RSVCDA     69
      LCARD(2)=SIMBUF(41:80)                                            RSVCDA     70
      IF (KLFO.EQ.0) THEN                                               RSVCDA     71
         IF(MNEW(NLF).EQ.0)THEN                                         RSVCDA     72
            JDSTAT=5                                                    RSVCDA     73
            IEBK=2                                                      RSVCDA     74
            WRITE(MSG(1),1170) NLF,NGRI                                 RSVCDA     75
            WRITE(MSG(2),1171)                                          RSVCDA     76
            CALL PRTMSG(2)                                              RSVCDA     77
         ENDIF                                                          RSVCDA     78
      ELSE                                                              RSVCDA     79
         IF (NLF.LE.0) THEN                                             RSVCDA     80
            JDSTAT=5                                                    RSVCDA     81
            IEBK=2                                                      RSVCDA     82
            WRITE(MSG(1),1180) SVRNAM,NGRI                              RSVCDA     83
            WRITE(MSG(2),1171)                                          RSVCDA     84
            CALL PRTMSG(2)                                              RSVCDA     85
         ENDIF                                                          RSVCDA     86
      ENDIF                                                             RSVCDA     87
C                                                                       RSVCDA     88
      IF(NGSREC.NE.0)THEN                                               RSVCDA     89
      LCKT=NGRI(3:4)                                                    RSVCDA     90
      CALL ADFGEN(1,JTHGSR,NGSREC,NLF,LCKT,LFGEN,XGEID,NSORDE)          RSVCDA     91
           IF(JTHGSR.LE.0)THEN                                          RSVCDA     92
           JTHGSR=0                                                     RSVCDA     93
           JDSTAT=3                                                     RSVCDA     94
           ELSE                                                         RSVCDA     95
           JPQ=1                                                        RSVCDA     96
           JDSTAT=IGENST(JTHGSR)                                        RSVCDA     97
           JTHGSR=NSORDE(JTHGSR)                                        RSVCDA     98
           ENDIF                                                        RSVCDA     99
C                                                                       RSVCDA    100
      ELSE                                                              RSVCDA    101
      JDSTAT=1                                                          RSVCDA    102
      ENDIF                                                             RSVCDA    103
C                                                                       RSVCDA    104
C     NOTE: IEBK=2 FOR SVC NOT FOUND IN BASE LOADFLOW.                  RSVCDA    105
C           AN INTERACTIVE LOGIC CAN BE IMPLEMENTED HERE TO             RSVCDA    106
C           PROMPT USER HOW TO HANDLE THE SITUATION.                    RSVCDA    107
C           CURRENTLY, THE SVC IS IGNORED.                              RSVCDA    108
C                                                                       RSVCDA    109
C                                                                       RSVCDA    110
      JSVC=JSVC+1                                                       RSVCDA    111
      IF(JSVC.GT.NXSR)GOTO 140                                          RSVCDA    112
      JSAB(JSVC)=NLF                                                    RSVCDA    113
      SVCID(JSVC)=NGRI                                                  RSVCDA    114
      JSTHGS(JSVC)=JTHGSR                                               RSVCDA    115
      JDSSAB(JSVC)=JDSTAT                                               RSVCDA    116
      JJSDAT(JSVC)=JTLN                                                 RSVCDA    117
      ITDDAT(JTLN+9)=NRTYPX                                             RSVCDA    118
      ITDDAT(JTLN+10)=0                                                 RSVCDA    119
      IF(IDIVX.LT.1)IDIVX=1                                             RSVCDA    120
      ITDDAT(JTLN+12)=IDIVX                                             RSVCDA    121
      IF(JPQ.EQ.0)THEN                                                  RSVCDA    122
      ITDDAT(JTLN+11)=IQFARX                                            RSVCDA    123
      ELSE                                                              RSVCDA    124
      TDDAT(JTLN+11)=GSRCD(2,JTHGSR)                                    RSVCDA    125
      IGENST(JTHGSR)=IGENST(JTHGSR)*I16B                                RSVCDA    126
      ENDIF                                                             RSVCDA    127
      IF(NRTYPX.EQ.50) GO TO 130                                        RSVCDA    128
C                                                                       RSVCDA    129
      CALL GETLIN (IUX,SIMBUF)                                          RSVCDA    130
      IF(NRTYPX.GT.5) THEN                                              RSVCDA    131
         READ (SIMBUF,1020,IOSTAT=IOS) (TDDAT(JTLN+J),J=1,4)            RSVCDA    132
         IF(IOS.NE.0) GOTO 900                                          RSVCDA    133
         JTLN=JTLN+12                                                   RSVCDA    134
         CALL MCHECK (NLF,14,JTLN,'RSVCDA')                             RSVCDA    135
         GOTO 100                                                       RSVCDA    136
      ELSE                                                              RSVCDA    137
         IF(KLFO.EQ.0)THEN                                              RSVCDA    138
            IF(NVSENX.GT.0)THEN                                         RSVCDA    139
               IF(MNEW(NVSENX).EQ.0)THEN                                RSVCDA    140
                  WRITE(MSG(1),1050) NVSENX,NLF                         RSVCDA    141
                  WRITE(MSG(2),1051)                                    RSVCDA    142
                  CALL PRTMSG(2)                                        RSVCDA    143
                  CALL ASTOP('RSVCDA: FATAL ERROR',19)                  RSVCDA    144
               ENDIF                                                    RSVCDA    145
            ELSE                                                        RSVCDA    146
               NVSENX=NLF                                               RSVCDA    147
            ENDIF                                                       RSVCDA    148
         ELSE                                                           RSVCDA    149
            IF(SVRNA2.NE.IBLK12)THEN                                    RSVCDA    150
               CALL CHKBUS(SVRNA2,NVSENX)                               RSVCDA    151
               IF (NVSENX.LE.0) THEN                                    RSVCDA    152
                  WRITE(MSG(1),1055) SVRNA2,SVRNAM                      RSVCDA    153
                  WRITE(MSG(2),1051)                                    RSVCDA    154
                  CALL PRTMSG(2)                                        RSVCDA    155
                  CALL ASTOP('RSVCDA: FATAL ERROR',19)                  RSVCDA    156
               ENDIF                                                    RSVCDA    157
            ELSE                                                        RSVCDA    158
               NVSENX=NLF                                               RSVCDA    159
            ENDIF                                                       RSVCDA    160
         ENDIF                                                          RSVCDA    161
         ITDDAT(JTLN+10)=NVSENX                                         RSVCDA    162
         IF(NRTYPX.EQ.1) THEN                                           RSVCDA    163
            READ (SIMBUF,1020,IOSTAT=IOS) (TDDAT(JTLN+J),J=1,8)         RSVCDA    164
            IF(IOS.NE.0) GOTO 900                                       RSVCDA    165
            IF(TDDAT(JTLN+1).LE.0.0) THEN                               RSVCDA    166
               WRITE(MSG(1),1150) JSVC,TDDAT(JTLN+1)                    RSVCDA    167
               CALL PRTMSG(1)                                           RSVCDA    168
               SIMBUF='RSVCDA: SVC DATA ERROR'                          RSVCDA    169
               CALL ASTOP(SIMBUF,22)                                    RSVCDA    170
            ENDIF                                                       RSVCDA    171
            IF(TDDAT(JTLN+2).LE.0.0.OR.TDDAT(JTLN+3).LT.0.0) THEN       RSVCDA    172
               WRITE(MSG(1),1030) JSVC                                  RSVCDA    173
               WRITE(MSG(2),1031) TDDAT(JTLN+2),TDDAT(JTLN+3)           RSVCDA    174
               CALL PRTMSG(2)                                           RSVCDA    175
               SIMBUF='RSVCDA: SVC DATA ERROR'                          RSVCDA    176
               CALL ASTOP(SIMBUF,22)                                    RSVCDA    177
            ENDIF                                                       RSVCDA    178
C                                                                       RSVCDA    179
            JTLN=JTLN+12                                                RSVCDA    180
            CALL MCHECK (NLF,14,JTLN,'RSVCDA')                          RSVCDA    181
            GOTO 100                                                    RSVCDA    182
C                                                                       RSVCDA    183
C     WSCC SVC'S                                                        RSVCDA    184
C                                                                       RSVCDA    185
         ELSEIF(NRTYPX.EQ.2.OR.NRTYPX.EQ.3)THEN                         RSVCDA    186
            READ (SIMBUF,1020,IOSTAT=IOS) (TDDAT(JTLN+J),J=1,7)         RSVCDA    187
            IF(IOS.NE.0) GOTO 900                                       RSVCDA    188
            IF(TDDAT(JTLN+7).LE.0.0) THEN                               RSVCDA    189
               WRITE(MSG(1),1150) JSVC,TDDAT(JTLN+7)                    RSVCDA    190
               CALL PRTMSG(1)                                           RSVCDA    191
               SIMBUF='RSVCDA: SVC DATA ERROR'                          RSVCDA    192
               CALL ASTOP(SIMBUF,22)                                    RSVCDA    193
            ENDIF                                                       RSVCDA    194
C                                                                       RSVCDA    195
            CALL GETLIN (IUX,SIMBUF)                                    RSVCDA    196
            READ (SIMBUF,1020,IOSTAT=IOS) (TDDAT(JTLN+J),J=13,19)       RSVCDA    197
            IF(IOS.NE.0) GOTO 900                                       RSVCDA    198
            IF(TDDAT(JTLN+14).LE.0.0.OR.TDDAT(JTLN+17).LT.0.0) THEN     RSVCDA    199
               WRITE(MSG(1),1030) JSVC                                  RSVCDA    200
               WRITE(MSG(2),1031) TDDAT(JTLN+2),TDDAT(JTLN+3)           RSVCDA    201
               CALL PRTMSG(2)                                           RSVCDA    202
               SIMBUF='RSVCDA: SVC DATA ERROR'                          RSVCDA    203
               CALL ASTOP(SIMBUF,22)                                    RSVCDA    204
            ENDIF                                                       RSVCDA    205
C                                                                       RSVCDA    206
            CALL GETLIN (IUX,SIMBUF)                                    RSVCDA    207
            READ (SIMBUF,1020,IOSTAT=IOS) (TDDAT(JTLN+J),J=21,27)       RSVCDA    208
            IF(IOS.NE.0) GOTO 900                                       RSVCDA    209
            ITDDAT(JTLN+8)=0                                            RSVCDA    210
            JTLN=JTLN+27                                                RSVCDA    211
            IF(NRTYPX.EQ.3) THEN                                        RSVCDA    212
C                                                                       RSVCDA    213
               CALL GETLIN (IUX,SIMBUF)                                 RSVCDA    214
C                                                                       RSVCDA    215
C                    PRE READ                                           RSVCDA    216
C                                                                       RSVCDA    217
               READ (SIMBUF,1010,IOSTAT=IOS) MT1                        RSVCDA    218
               IF(IOS.NE.0) GOTO 900                                    RSVCDA    219
C                                                                       RSVCDA    220
C           MT1=0 CASE                                                  RSVCDA    221
C                                                                       RSVCDA    222
                  IF(MT1.EQ.0) THEN                                     RSVCDA    223
                    IF(KLFO.EQ.0)THEN                                   RSVCDA    224
                     READ(SIMBUF,1090,IOSTAT=IOS)                       RSVCDA    225
     *                   (ITDDAT(JTLN+J),J=1,2),NVSEN1,NVSEN2,LCKT      RSVCDA    226
                     IF(IOS.NE.0) GOTO 900                              RSVCDA    227
                     IF(NVSEN1.GT.0)THEN                                RSVCDA    228
                        IF(MNEW(NVSEN1).EQ.0)THEN                       RSVCDA    229
                           WRITE(MSG(1),1050) NVSEN1,NLF                RSVCDA    230
                           WRITE(MSG(2),1051)                           RSVCDA    231
                           CALL PRTMSG(2)                               RSVCDA    232
                           CALL ASTOP('RSVCDA: FATAL ERROR',19)         RSVCDA    233
                        ENDIF                                           RSVCDA    234
                     ELSE                                               RSVCDA    235
                        NVSEN1=NLF                                      RSVCDA    236
                     ENDIF                                              RSVCDA    237
                     IF(NVSEN2.GT.0)THEN                                RSVCDA    238
                        IF(MNEW(NVSEN2).EQ.0)THEN                       RSVCDA    239
                           WRITE(MSG(1),1050) NVSEN2,NLF                RSVCDA    240
                           WRITE(MSG(2),1051)                           RSVCDA    241
                           CALL PRTMSG(2)                               RSVCDA    242
                           CALL ASTOP('RSVCDA: FATAL ERROR',19)         RSVCDA    243
                        ENDIF                                           RSVCDA    244
                     ELSE                                               RSVCDA    245
                        NVSEN2=NLF                                      RSVCDA    246
                     ENDIF                                              RSVCDA    247
C                                                                       RSVCDA    248
                    ELSE                                                RSVCDA    249
C                                                                       RSVCDA    250
                     READ(SIMBUF,1120,IOSTAT=IOS)                       RSVCDA    251
     *                   (ITDDAT(JTLN+J),J=1,2),SVRNA1,SVRNA2,LCKT      RSVCDA    252
                     IF(IOS.NE.0) GOTO 900                              RSVCDA    253
                     IF(SVRNA1.NE.IBLK12)THEN                           RSVCDA    254
                        CALL CHKBUS(SVRNA1,NVSEN1)                      RSVCDA    255
                        IF (NVSEN1.LE.0) THEN                           RSVCDA    256
                           WRITE(MSG(1),1055) SVRNA1,SVRNAM             RSVCDA    257
                           WRITE(MSG(2),1051)                           RSVCDA    258
                           CALL PRTMSG(2)                               RSVCDA    259
                           CALL ASTOP('RSVCDA: FATAL ERROR',19)         RSVCDA    260
                        ENDIF                                           RSVCDA    261
                     ELSE                                               RSVCDA    262
                        NVSEN1=NLF                                      RSVCDA    263
                     ENDIF                                              RSVCDA    264
                     IF(SVRNA2.NE.IBLK12)THEN                           RSVCDA    265
                        CALL CHKBUS(SVRNA2,NVSEN2)                      RSVCDA    266
                        IF (NVSEN2.LE.0) THEN                           RSVCDA    267
                           WRITE(MSG(1),1055) SVRNA2,SVRNAM             RSVCDA    268
                           WRITE(MSG(2),1051)                           RSVCDA    269
                           CALL PRTMSG(2)                               RSVCDA    270
                           CALL ASTOP('RSVCDA: FATAL ERROR',19)         RSVCDA    271
                        ENDIF                                           RSVCDA    272
                     ELSE                                               RSVCDA    273
                        NVSEN2=NLF                                      RSVCDA    274
                     ENDIF                                              RSVCDA    275
                    ENDIF                                               RSVCDA    276
C                                                                       RSVCDA    277
                     ITDDAT(JTLN+3)=NVSEN1                              RSVCDA    278
                     ITDDAT(JTLN+4)=NVSEN2                              RSVCDA    279
                     CALL PACK(LCKT,0,JLCKT)                            RSVCDA    280
                     ITDDAT(JTLN+5)=JLCKT                               RSVCDA    281
C                                                                       RSVCDA    282
C             MT1=1 CASE                                                RSVCDA    283
C                                                                       RSVCDA    284
                  ELSEIF(MT1.EQ.1) THEN                                 RSVCDA    285
                     IF(KLFO.EQ.0)THEN                                  RSVCDA    286
                     READ(SIMBUF,1100,IOSTAT=IOS)                       RSVCDA    287
     *                   (ITDDAT(JTLN+J),J=1,2),TDDAT(JTLN+3),NVSEN1    RSVCDA    288
                     IF(IOS.NE.0) GOTO 900                              RSVCDA    289
                     IF(TDDAT(JTLN+3).EQ.0.0) TDDAT(JTLN+3)=0.02        RSVCDA    290
                     IF(NVSEN1.GT.0)THEN                                RSVCDA    291
                        IF(MNEW(NVSEN1).EQ.0)THEN                       RSVCDA    292
                           WRITE(MSG(1),1050) NVSEN1,NLF                RSVCDA    293
                           WRITE(MSG(2),1051)                           RSVCDA    294
                           CALL PRTMSG(2)                               RSVCDA    295
                           CALL ASTOP('RSVCDA: FATAL ERROR',19)         RSVCDA    296
                        ENDIF                                           RSVCDA    297
                     ELSE                                               RSVCDA    298
                        NVSEN1=NLF                                      RSVCDA    299
                     ENDIF                                              RSVCDA    300
                     ELSE                                               RSVCDA    301
                     READ(SIMBUF,1130,IOSTAT=IOS)                       RSVCDA    302
     *                   (ITDDAT(JTLN+J),J=1,2),TDDAT(JTLN+3),SVRNA1    RSVCDA    303
                     IF(IOS.NE.0) GOTO 900                              RSVCDA    304
                     IF(TDDAT(JTLN+3).EQ.0.0) TDDAT(JTLN+3)=0.02        RSVCDA    305
                     IF(SVRNA1.NE.IBLK12)THEN                           RSVCDA    306
                        CALL CHKBUS(SVRNA1,NVSEN1)                      RSVCDA    307
                        IF (NVSEN1.LE.0) THEN                           RSVCDA    308
                           WRITE(MSG(1),1055) SVRNA1,SVRNAM             RSVCDA    309
                           WRITE(MSG(2),1051)                           RSVCDA    310
                           CALL PRTMSG(2)                               RSVCDA    311
                           CALL ASTOP('RSVCDA: FATAL ERROR',19)         RSVCDA    312
                        ENDIF                                           RSVCDA    313
                     ELSE                                               RSVCDA    314
                        NVSEN1=NLF                                      RSVCDA    315
                     ENDIF                                              RSVCDA    316
                     ENDIF                                              RSVCDA    317
                     ITDDAT(JTLN+4)=NVSEN1                              RSVCDA    318
C                                                                       RSVCDA    319
C                 MT1=2  CASE                                           RSVCDA    320
C                                                                       RSVCDA    321
                  ELSE                                                  RSVCDA    322
C                                                                       RSVCDA    323
                   IF(KLFO.EQ.0)THEN                                    RSVCDA    324
                     READ(SIMBUF,1110,IOSTAT=IOS)                       RSVCDA    325
     *                   (ITDDAT(JTLN+J),J=1,2),NVSEN1,GENCKT           RSVCDA    326
                     IF(IOS.NE.0) GOTO 900                              RSVCDA    327
                     CALL PACK(GENCKT,0,IDGEN)                          RSVCDA    328
                     ITDDAT(JTLN+4)=IDGEN                               RSVCDA    329
                     IF(NVSEN1.GT.0)THEN                                RSVCDA    330
                        IF(MNEW(NVSEN1).EQ.0)THEN                       RSVCDA    331
                           WRITE(MSG(1),1050) NVSEN1,NLF                RSVCDA    332
                           WRITE(MSG(2),1051)                           RSVCDA    333
                           CALL PRTMSG(2)                               RSVCDA    334
                           CALL ASTOP('RSVCDA: FATAL ERROR',19)         RSVCDA    335
                        ENDIF                                           RSVCDA    336
                     ELSE                                               RSVCDA    337
                        NVSEN1=NLF                                      RSVCDA    338
                     ENDIF                                              RSVCDA    339
                     ELSE                                               RSVCDA    340
                     READ(SIMBUF,1140,IOSTAT=IOS)                       RSVCDA    341
     *                   (ITDDAT(JTLN+J),J=1,2),SVRNA1,GENCKT           RSVCDA    342
                     IF(IOS.NE.0) GOTO 900                              RSVCDA    343
                     CALL PACK(GENCKT,0,IDGEN)                          RSVCDA    344
                     ITDDAT(JTLN+4)=IDGEN                               RSVCDA    345
                     IF(SVRNA1.NE.IBLK12)THEN                           RSVCDA    346
                        CALL CHKBUS(SVRNA1,NVSEN1)                      RSVCDA    347
                        IF (NVSEN1.LE.0) THEN                           RSVCDA    348
                           WRITE(MSG(1),1055) SVRNA1,SVRNAM             RSVCDA    349
                           WRITE(MSG(2),1051)                           RSVCDA    350
                           CALL PRTMSG(2)                               RSVCDA    351
                           CALL ASTOP('RSVCDA: FATAL ERROR',19)         RSVCDA    352
                        ENDIF                                           RSVCDA    353
                     ELSE                                               RSVCDA    354
                        NVSEN1=NLF                                      RSVCDA    355
                     ENDIF                                              RSVCDA    356
                     ENDIF                                              RSVCDA    357
                     ITDDAT(JTLN+3)=NVSEN1                              RSVCDA    358
                  ENDIF                                                 RSVCDA    359
               CALL GETLIN (IUX,SIMBUF)                                 RSVCDA    360
               READ(SIMBUF,1020,IOSTAT=IOS) (TDDAT(JTLN+J),J=6,12)      RSVCDA    361
               IF(IOS.NE.0) GOTO 900                                    RSVCDA    362
               IF(ITDDAT(JTLN+10).EQ.0)THEN                             RSVCDA    363
                  WRITE(MSG(1),1160) JSVC,TDDAT(JTLN+10)                RSVCDA    364
                  CALL PRTMSG(1)                                        RSVCDA    365
                  SIMBUF='RSVCDA: SVC DATA ERROR'                       RSVCDA    366
                  CALL ASTOP(SIMBUF,22)                                 RSVCDA    367
               ENDIF                                                    RSVCDA    368
               CALL GETLIN (IUX,SIMBUF)                                 RSVCDA    369
               READ(SIMBUF,1020,IOSTAT=IOS) (TDDAT(JTLN+J),J=13,16)     RSVCDA    370
               IF(IOS.NE.0) GOTO 900                                    RSVCDA    371
               JTLN=JTLN+16                                             RSVCDA    372
            ENDIF                                                       RSVCDA    373
            CALL MCHECK (NLF,14,JTLN,'RSVCDA')                          RSVCDA    374
            GOTO 100                                                    RSVCDA    375
         ELSE                                                           RSVCDA    376
            WRITE(MSG(1),1080) JSVC,NRTYPX                              RSVCDA    377
            CALL PRTMSG(1)                                              RSVCDA    378
            SIMBUF='RSVCDA: SVC TYPE ERROR'                             RSVCDA    379
            CALL ASTOP(SIMBUF,21)                                       RSVCDA    380
         ENDIF                                                          RSVCDA    381
      ENDIF                                                             RSVCDA    382
  130 CONTINUE                                                          RSVCDA    383
C                                                                       RSVCDA    384
C     USER DEFINED SVC DATA                                             RSVCDA    385
C                                                                       RSVCDA    386
      JTLN=JTLN+12                                                      RSVCDA    387
      JTLN1=0                                                           RSVCDA    388
      NUF=5                                                             RSVCDA    389
      CALL RUDMDA(NUF,IUX,IUY,JTLN1,SIMBUF)                             RSVCDA    390
      IF(NUF.EQ.900) GO TO 900                                          RSVCDA    391
      CALL MCHECK (NLF,14,JTLN,'RSVCDA')                                RSVCDA    392
      GOTO 100                                                          RSVCDA    393
C                                                                       RSVCDA    394
  140 CONTINUE                                                          RSVCDA    395
      WRITE (MSG(1),1040) NLF,NXSR                                      RSVCDA    396
      WRITE(MSG(2),1041)                                                RSVCDA    397
      CALL PRTMSG(2)                                                    RSVCDA    398
      IEBK=1                                                            RSVCDA    399
C                                                                       RSVCDA    400
  150 CONTINUE                                                          RSVCDA    401
      RETURN                                                            RSVCDA    402
C                                                                       RSVCDA    403
  900 CONTINUE                                                          RSVCDA    404
      WRITE(MSG(1),1070)                                                RSVCDA    405
      MSG(2)=LCARD(1)//LCARD(2)                                         RSVCDA    406
      MSG(4)=SIMBUF                                                     RSVCDA    407
      WRITE(MSG(3),1071)                                                RSVCDA    408
      CALL PRTMSG(4)                                                    RSVCDA    409
      SIMBUF='RSVCDA: ERROR IN READING SVC DATA'                        RSVCDA    410
      CALL ASTOP(SIMBUF,33)                                             RSVCDA    411
C                                                                       RSVCDA    412
 1000 FORMAT(I5,1X,A4,4I5)                                              RSVCDA    413
 1010 FORMAT(5I10)                                                      RSVCDA    414
 1020 FORMAT (8F10.5)                                                   RSVCDA    415
 1030 FORMAT(1X,'*** ERROR SVC# ',I3,' QL MUST BE LARGER THAN'          RSVCDA    416
     &,' ZERO AND QC NON-NEGATIVE.')                                    RSVCDA    417
 1031 FORMAT(5X,'QL=',F10.5,' MVA  QC=',F10.5,' MVA')                   RSVCDA    418
 1040 FORMAT(1X,'*** ERROR SVC/SATURABLE REACTOR ON BUS ',I4            RSVCDA    419
     &,'EXCEEDS THE LIMIT OF ',I4)                                      RSVCDA    420
 1041 FORMAT(5X,'INCREASE NSR IN PARX.INS')                             RSVCDA    421
 1050 FORMAT(' *** ERROR SENSING BUS ',I5,' OF SVC ON BUS ',I5)         RSVCDA    422
 1051 FORMAT(5X,'IS NOT IN THE BASE LOADFLOW. PLEASE CHECK YOUR DATA.') RSVCDA    423
 1055 FORMAT(' *** ERROR SENSING BUS ',A12,' OF SVC ON BUS ',A12)       RSVCDA    424
 1060 FORMAT (A12,1X,A4,I5,2I5,A12)                                     RSVCDA    425
 1070 FORMAT(1X,'*** READ ERROR CHECK THE CARD:')                       RSVCDA    426
 1071 FORMAT(5X,'THIS IS THE FIRST CARD OF THE',                        RSVCDA    427
     & ' SVC DEVICE LAST READ:')                                        RSVCDA    428
 1080 FORMAT(' *** ERROR SVC# ',I3,'HAS UNKOWN TYPE',I5)                RSVCDA    429
 1090 FORMAT(4I10,8X,A2)                                                RSVCDA    430
 1100 FORMAT(2I10,F10.5,I10)                                            RSVCDA    431
 1110 FORMAT(3I10,6X,A4)                                                RSVCDA    432
 1120 FORMAT(2I10,2A12,A2)                                              RSVCDA    433
 1130 FORMAT(2I10,F10.5,A12)                                            RSVCDA    434
 1140 FORMAT(2I10,A12,A4)                                               RSVCDA    435
 1150 FORMAT(' *** ERROR SVC# ',I3,' KSVC=',F10.5                       RSVCDA    436
     *,' MUST BE LARGER THAN ZERO')                                     RSVCDA    437
 1160 FORMAT(' *** ERROR SVC# ',I3,' TS13=',F10.5,' MUST BE NON-ZERO')  RSVCDA    438
 1170 FORMAT(' *** WARNING SVC BUS',I6,1X,A4)                           RSVCDA    439
 1171 FORMAT(5X,'IS NOT IN THE BASE LOADFLOW. THE SVC IS IGNORED.')     RSVCDA    440
 1180 FORMAT(' *** WARNING SVC BUS ',A12,1X,A4)                         RSVCDA    441
 1200 FORMAT(' *** ERROR BUS NUMBER OF THE ABOVE SVC EXCEEDED',I6)      RSVCDA    442
      END                                                               RSVCDA    443
