CFPRIME SWIDAT                                                          SWIDAT      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 SWIDAT(CARD1,CARD3,KSWITC,IEBK)                        SWIDAT      3
CD                                                                      SWIDAT      4
CD    THIS SUBROUTINE READS IN THE SWITCHING DATA OF RELAYS.            SWIDAT      5
CD                                                                      SWIDAT      6
      INCLUDE 'PARX.INS'                                                SWIDAT      7
      INCLUDE 'CNPT.INS'                                                SWIDAT      8
      INCLUDE 'CNMNEW.INS'                                              SWIDAT      9
      INCLUDE 'CNAUTO.INS'                                              SWIDAT     10
      INCLUDE 'CNLFDA.INS'                                              SWIDAT     11
      INCLUDE 'CNB19.INS'                                               SWIDAT     12
      INCLUDE 'CNFLAG.INS'                                              SWIDAT     13
      INCLUDE 'CNPARX.INS'                                              SWIDAT     14
      INCLUDE 'CNREN.INS'                                               SWIDAT     15
      INCLUDE 'CNUNIT.INS'                                              SWIDAT     16
      INCLUDE 'CNMSG.INS'                                               SWIDAT     17
C                                                                       SWIDAT     18
      CHARACTER*80 CARD1,CARD3                                          SWIDAT     19
      CHARACTER*2  ICKT,ISCKT                                           SWIDAT     20
      CHARACTER*12 BNAME1,BNAME2                                        SWIDAT     21
C                                                                       SWIDAT     22
      INCLUDE 'CNISOC.INS'                                              SWIDAT     23
C                                                                       SWIDAT     24
      LDEB=(JDEB(15).NE.0)                                              SWIDAT     25
      IEBK=0                                                            SWIDAT     26
C                                                                       SWIDAT     27
      VMG1=0.0                                                          SWIDAT     28
      VPHS1=0.0                                                         SWIDAT     29
C                                                                       SWIDAT     30
      IF(LDEB)WRITE(IUD6,2000)CARD1                                     SWIDAT     31
 2000 FORMAT(' **** SWIDAT***',5X,A80)                                  SWIDAT     32
      READ (CARD1,3060)ITYP                                             SWIDAT     33
      IF(LDEB) WRITE(IUD6,2100)ITYP                                     SWIDAT     34
 2100 FORMAT(' ***** SWIDAT ***** ',A3)                                 SWIDAT     35
      DO 200 I=1,KTYP                                                   SWIDAT     36
      IF(ITYP.EQ.ISOC(I))GOTO 210                                       SWIDAT     37
 200  CONTINUE                                                          SWIDAT     38
      IEBK=1                                                            SWIDAT     39
      WRITE(MSG(1),3070)                                                SWIDAT     40
      MSG(2)=CARD1                                                      SWIDAT     41
      CALL PRTMSG(2)                                                    SWIDAT     42
      RETURN                                                            SWIDAT     43
 210  CONTINUE                                                          SWIDAT     44
C                                                                       SWIDAT     45
C            1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  SWIDAT     46
C          ALI ATR APL ABT RLI RTR RPL RBT ASL RSL DLI DTR DPL DLR DBT  SWIDAT     47
      GOTO(420,420,420,420,420,420,420,420,420,420,420,420,420,420,420  SWIDAT     48
C                                                                       SWIDAT     49
C                                F   F   F                              SWIDAT     50
C       16  17  18  19  20  21  22  23  24  25  26  27  28  29          SWIDAT     51
C      DSL MLI MTR MPL MSL RCG FCG  ZA  ZR  YK LGF LLF LGR LLR          SWIDAT     52
     &,420,420,420,420,420,420,420,230,230,230,550,550,550,550          SWIDAT     53
C                                                                       SWIDAT     54
C       30  31  32  33  34  35  36                                      SWIDAT     55
C      SLD RLD  TH  TO  DN AUD RUD                                      SWIDAT     56
     &,220,220,550,550,550,550,550                                      SWIDAT     57
C                                                                       SWIDAT     58
C        F   F   F   F   F   F   F   F   F   F   F   F                  SWIDAT     59
C       37  38  39  40  41  42  43  44  45  46  47  48                  SWIDAT     60
C       GR  GM GFD  PR  PM  VR  FV  OF  SR TEB DIM RIM                  SWIDAT     61
     &,260,260,260,260,260,260,260,260,260,260,410,410                  SWIDAT     62
C                                                                       SWIDAT     63
C       49  50  51  52  53                                              SWIDAT     64
C       DF  DR  DI  DP ESC                                              SWIDAT     65
     &,550,550,550,550,600),I                                           SWIDAT     66
C                                                                       SWIDAT     67
 220  CONTINUE                                                          SWIDAT     68
C                                                                       SWIDAT     69
C   NOTE : IT STORES THE LOADFLOW BUS NO.                               SWIDAT     70
C                                                                       SWIDAT     71
C   READ IN LOAD CHANGE (LD & LS) CARD1                                 SWIDAT     72
C                                                                       SWIDAT     73
      IF(KLFO.EQ.0)THEN                                                 SWIDAT     74
       READ(CARD1,3140)ITYP,NLFI,ISHUNT,PSHED,QSHED,TDELAY              SWIDAT     75
       IF(MNEW(NLFI).EQ.0)NLFI=0                                        SWIDAT     76
      ELSE                                                              SWIDAT     77
       READ(CARD1,3145)ITYP,BNAME1,ISHUNT,PSHED,QSHED,TDELAY            SWIDAT     78
       CALL CHKBUS(BNAME1,NLFI)                                         SWIDAT     79
      ENDIF                                                             SWIDAT     80
      IF(NLFI.EQ.0)THEN                                                 SWIDAT     81
       IEBK=1                                                           SWIDAT     82
       WRITE(MSG(1),3050)                                               SWIDAT     83
       MSG(2)=CARD1                                                     SWIDAT     84
       CALL PRTMSG(2)                                                   SWIDAT     85
       RETURN                                                           SWIDAT     86
      ENDIF                                                             SWIDAT     87
      KSWITC=KSWITC+1                                                   SWIDAT     88
      ADATA(JLNA+1)=TDELAY                                              SWIDAT     89
      ADATA(JLNA+2)=0.0                                                 SWIDAT     90
      IADATA(JLNA+3)=I                                                  SWIDAT     91
      IADATA(JLNA+4)=NLFI                                               SWIDAT     92
      IADATA(JLNA+5)=ISHUNT                                             SWIDAT     93
      ADATA(JLNA+6)=PSHED                                               SWIDAT     94
      ADATA(JLNA+7)=QSHED                                               SWIDAT     95
C                                                                       SWIDAT     96
      JLNA=JLNA+7                                                       SWIDAT     97
C                                                                       SWIDAT     98
      RETURN                                                            SWIDAT     99
C                                                                       SWIDAT    100
 230  CONTINUE                                                          SWIDAT    101
C                                                                       SWIDAT    102
C   READ IN ZR,ZA,YK CARD                                               SWIDAT    103
C                                                                       SWIDAT    104
      IF(KLFO.EQ.0)THEN                                                 SWIDAT    105
       READ(CARD1,4000) ITYP,NLFI,XREAL,XIMAG,TDELAY                    SWIDAT    106
       IF(MNEW(NLFI).EQ.0)NLFI=0                                        SWIDAT    107
      ELSE                                                              SWIDAT    108
       READ(CARD1,3090) ITYP,BNAME1,XREAL,XIMAG,TDELAY                  SWIDAT    109
       CALL CHKBUS(BNAME1,NLFI)                                         SWIDAT    110
      ENDIF                                                             SWIDAT    111
       IF(NLFI.EQ.0)THEN                                                SWIDAT    112
        IEBK=1                                                          SWIDAT    113
       WRITE(MSG(1),3050)                                               SWIDAT    114
       MSG(2)=CARD1                                                     SWIDAT    115
       CALL PRTMSG(2)                                                   SWIDAT    116
        RETURN                                                          SWIDAT    117
       ENDIF                                                            SWIDAT    118
      KSWITC=KSWITC+1                                                   SWIDAT    119
      ADATA(JLNA+1)=TDELAY                                              SWIDAT    120
      ADATA(JLNA+2)=0.0                                                 SWIDAT    121
      IADATA(JLNA+3)=I                                                  SWIDAT    122
      IADATA(JLNA+4)=NLFI                                               SWIDAT    123
      ADATA(JLNA+5)=XREAL                                               SWIDAT    124
      ADATA(JLNA+6)=XIMAG                                               SWIDAT    125
C                                                                       SWIDAT    126
      JLNA=JLNA+6                                                       SWIDAT    127
      RETURN                                                            SWIDAT    128
C                                                                       SWIDAT    129
 260  CONTINUE                                                          SWIDAT    130
C                                                                       SWIDAT    131
C   GENERATOR RELATED SWITCHING                                         SWIDAT    132
C                                                                       SWIDAT    133
      IF(KLFO.EQ.0)THEN                                                 SWIDAT    134
      READ(CARD1,4010) ITYP,NLFI,ICKT,XREAL,TDELAY                      SWIDAT    135
      IF(MNEW(NLFI).EQ.0)NLFI=0                                         SWIDAT    136
      ELSE                                                              SWIDAT    137
      READ(CARD1,4020) ITYP,BNAME1,ICKT,XREAL,TDELAY                    SWIDAT    138
      CALL CHKBUS(BNAME1,NLFI)                                          SWIDAT    139
      ENDIF                                                             SWIDAT    140
      IF(NLFI.EQ.0)THEN                                                 SWIDAT    141
      IEBK=1                                                            SWIDAT    142
      WRITE(MSG(1),4050)                                                SWIDAT    143
      MSG(2)=CARD1                                                      SWIDAT    144
      CALL PRTMSG(2)                                                    SWIDAT    145
      RETURN                                                            SWIDAT    146
      ENDIF                                                             SWIDAT    147
C                                                                       SWIDAT    148
C   GENERATION SYSTEM CHANGE                                            SWIDAT    149
C                                                                       SWIDAT    150
      KSWITC=KSWITC+1                                                   SWIDAT    151
      ADATA(JLNA+1)=TDELAY                                              SWIDAT    152
      ADATA(JLNA+2)=0.0                                                 SWIDAT    153
      IADATA(JLNA+3)=I                                                  SWIDAT    154
      IADATA(JLNA+4)=NLFI                                               SWIDAT    155
      CALL PACK(ICKT,0,JLID)                                            SWIDAT    156
      IADATA(JLNA+5)=JLID                                               SWIDAT    157
      IADATA(JLNA+6)=0                                                  SWIDAT    158
      ADATA(JLNA+7)=XREAL                                               SWIDAT    159
C                                                                       SWIDAT    160
      JLNA=JLNA+7                                                       SWIDAT    161
      RETURN                                                            SWIDAT    162
C                                                                       SWIDAT    163
 410  CONTINUE                                                          SWIDAT    164
C                                                                       SWIDAT    165
C   INDUCTION MOTOR SWITCHING                                           SWIDAT    166
C                                                                       SWIDAT    167
      IF(KLFO.EQ.0)THEN                                                 SWIDAT    168
       READ(CARD1,4010) ITYP,NLFI,ICKT,TDELAY                           SWIDAT    169
       IF(MNEW(NLFI).EQ.0)NLFI=0                                        SWIDAT    170
      ELSE                                                              SWIDAT    171
       READ(CARD1,4020) ITYP,BNAME1,ICKT,TDELAY                         SWIDAT    172
       CALL CHKBUS(BNAME1,NLFI)                                         SWIDAT    173
      ENDIF                                                             SWIDAT    174
       IF(NLFI.EQ.0)THEN                                                SWIDAT    175
        IEBK=1                                                          SWIDAT    176
       WRITE(MSG(1),3050)                                               SWIDAT    177
       MSG(2)=CARD1                                                     SWIDAT    178
       CALL PRTMSG(2)                                                   SWIDAT    179
        RETURN                                                          SWIDAT    180
       ENDIF                                                            SWIDAT    181
C                                                                       SWIDAT    182
      KSWITC=KSWITC+1                                                   SWIDAT    183
      ADATA(JLNA+1)=TDELAY                                              SWIDAT    184
      ADATA(JLNA+2)=0.0                                                 SWIDAT    185
      IADATA(JLNA+3)=I                                                  SWIDAT    186
      IADATA(JLNA+4)=NLFI                                               SWIDAT    187
      ADATA(JLNA+5)=0                                                   SWIDAT    188
C                                                                       SWIDAT    189
      JLNA=JLNA+5                                                       SWIDAT    190
      RETURN                                                            SWIDAT    191
C                                                                       SWIDAT    192
 420  CONTINUE                                                          SWIDAT    193
C                                                                       SWIDAT    194
C   READ IN LINE DATA CHANGE CARD                                       SWIDAT    195
C                                                                       SWIDAT    196
      IF(KLFO.EQ.0)THEN                                                 SWIDAT    197
      READ(CARD1,4030)                                                  SWIDAT    198
     &ITYP,NLFI,NLFJ,ICKT,ISCKT,XREAL,XIMAG,VMG,VPHS,TDELAY             SWIDAT    199
      IF(ITYP.EQ.ISOC(19))THEN                                          SWIDAT    200
       CALL GETLIN(IU54,CARD3)                                          SWIDAT    201
       READ(CARD3,4015)VMG1,VPHS1                                       SWIDAT    202
      ENDIF                                                             SWIDAT    203
       IF(MNEW(NLFI).EQ.0)NLFI=0                                        SWIDAT    204
       IF(MNEW(NLFJ).EQ.0)NLFJ=0                                        SWIDAT    205
      ELSE                                                              SWIDAT    206
       READ(CARD1,4040)                                                 SWIDAT    207
     & ITYP,BNAME1,BNAME2,ICKT,ISCKT,XREAL,XIMAG,VMG,VPHS,TDELAY        SWIDAT    208
      IF(ITYP.EQ.ISOC(19))THEN                                          SWIDAT    209
       CALL GETLIN(IU54,CARD3)                                          SWIDAT    210
       READ(CARD3,4015)VMG1,VPHS1                                       SWIDAT    211
      ENDIF                                                             SWIDAT    212
       CALL CHKBUS(BNAME1,NLFI)                                         SWIDAT    213
       CALL CHKBUS(BNAME2,NLFJ)                                         SWIDAT    214
      ENDIF                                                             SWIDAT    215
       IF(NLFI.EQ.0.OR.NLFJ.EQ.0)THEN                                   SWIDAT    216
        IEBK=1                                                          SWIDAT    217
       WRITE(MSG(1),3050)                                               SWIDAT    218
       MSG(2)=CARD1                                                     SWIDAT    219
       CALL PRTMSG(2)                                                   SWIDAT    220
        RETURN                                                          SWIDAT    221
       ENDIF                                                            SWIDAT    222
C                                                                       SWIDAT    223
      JTYP=I                                                            SWIDAT    224
      KSWITC=KSWITC+1                                                   SWIDAT    225
      ADATA(JLNA+1)=TDELAY                                              SWIDAT    226
      ADATA(JLNA+2)=0.0                                                 SWIDAT    227
      IADATA(JLNA+3)=JTYP                                               SWIDAT    228
      IADATA(JLNA+4)=NLFI                                               SWIDAT    229
      IADATA(JLNA+5)=NLFJ                                               SWIDAT    230
      CALL PACK(ICKT,0,JLID)                                            SWIDAT    231
      IADATA(JLNA+6)=JLID                                               SWIDAT    232
      IADATA(JLNA+7)=0                                                  SWIDAT    233
C                                                                       SWIDAT    234
      IF(LDEB)WRITE(IUD6,2200)JTYP,JLNA,KSWITC,IADATA(JLNA+1),          SWIDAT    235
     &   IADATA(JLNA+2),IADATA(JLNA+3),IADATA(JLNA+4)                   SWIDAT    236
 2200    FORMAT(' *** SWIDAT *** ',7I6)                                 SWIDAT    237
C                                                                       SWIDAT    238
C            1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  SWIDAT    239
C          ALI ATR APL ABT RLI RTR RPL RBT ASL RSL DLI DTR DPL DLR DBT  SWIDAT    240
      GOTO(450,460,470,430,430,430,430,430,550,440,430,430,430,430,430  SWIDAT    241
C                                                                       SWIDAT    242
C       16  17  18  19  20  21  22                                      SWIDAT    243
C      DSL MLI MTR MPL MSL RCG FCG                                      SWIDAT    244
     &,440,450,460,470,550,440,440),JTYP                                SWIDAT    245
C                                                                       SWIDAT    246
 430  CONTINUE                                                          SWIDAT    247
      JLNA=JLNA+7                                                       SWIDAT    248
      RETURN                                                            SWIDAT    249
 440  CONTINUE                                                          SWIDAT    250
      CALL PACK(ISCKT,0,JLID)                                           SWIDAT    251
      IADATA(JLNA+8)=JLID                                               SWIDAT    252
      JLNA=JLNA+8                                                       SWIDAT    253
      RETURN                                                            SWIDAT    254
 450  CONTINUE                                                          SWIDAT    255
      ADATA(JLNA+8)=XREAL                                               SWIDAT    256
      ADATA(JLNA+9)=XIMAG                                               SWIDAT    257
      ADATA(JLNA+10)=VMG                                                SWIDAT    258
      JLNA=JLNA+10                                                      SWIDAT    259
      RETURN                                                            SWIDAT    260
 460  CONTINUE                                                          SWIDAT    261
      ADATA(JLNA+8)=XREAL                                               SWIDAT    262
      ADATA(JLNA+9)=XIMAG                                               SWIDAT    263
      ADATA(JLNA+10)=VMG                                                SWIDAT    264
      ADATA(JLNA+11)=VPHS                                               SWIDAT    265
      JLNA=JLNA+11                                                      SWIDAT    266
      RETURN                                                            SWIDAT    267
 470  CONTINUE                                                          SWIDAT    268
      CALL PACK(ISCKT,0,JLID)                                           SWIDAT    269
      IADATA(JLNA+8)=JLID                                               SWIDAT    270
      ADATA(JLNA+9)=XREAL                                               SWIDAT    271
      ADATA(JLNA+10)=XIMAG                                              SWIDAT    272
      ADATA(JLNA+11)=VMG                                                SWIDAT    273
      ADATA(JLNA+12)=VPHS                                               SWIDAT    274
      ADATA(JLNA+13)=VMG1                                               SWIDAT    275
      ADATA(JLNA+14)=VPHS1                                              SWIDAT    276
      JLNA=JLNA+14                                                      SWIDAT    277
      RETURN                                                            SWIDAT    278
 550  CONTINUE                                                          SWIDAT    279
      IEBK=1                                                            SWIDAT    280
      WRITE(MSG(1),3020)                                                SWIDAT    281
      MSG(2)=CARD1                                                      SWIDAT    282
      CALL PRTMSG(2)                                                    SWIDAT    283
      RETURN                                                            SWIDAT    284
 600  CONTINUE                                                          SWIDAT    285
C                                                                       SWIDAT    286
      RETURN                                                            SWIDAT    287
C                                                                       SWIDAT    288
 3020 FORMAT(' *** ERROR CONTROL RELAY CROSS TRIPPING '                 SWIDAT    289
     &,'SWITCHING OF THIS TYPE IS NOT ALLOWED')                         SWIDAT    290
 3050 FORMAT (1X,'*** ERROR CONTROL RELAY '                             SWIDAT    291
     &,'BUS OF TRIPPING RELAY NOT FOUND IN LOADFLOW')                   SWIDAT    292
 3060  FORMAT (A3)                                                      SWIDAT    293
 3070 FORMAT(1X,'*** ERROR CONTROL RELAY CROSS TRIPPING,'               SWIDAT    294
     *,' NO SUCH TYPE OF SWITCHING')                                    SWIDAT    295
 3090 FORMAT(A3,1X,A12,2F8.3,T71,F10.5)                                 SWIDAT    296
 3140 FORMAT(A3,1X,2I5,2F8.3,T71,F10.5)                                 SWIDAT    297
 3145 FORMAT(A3,1X,A12,I5,2F8.3,T71,F10.5)                              SWIDAT    298
 4000 FORMAT(A3,1X,I5,2F8.3,T71,F10.5)                                  SWIDAT    299
 4010 FORMAT(A3,1X,I5,1X,A2,F8.3,T71,F10.5)                             SWIDAT    300
 4015 FORMAT(2F8.3)                                                     SWIDAT    301
 4020 FORMAT(A3,1X,A12,1X,A2,F8.3,T71,F10.5)                            SWIDAT    302
 4030 FORMAT(A3,1X,2I5,1X,2A2,4F8.3,T71,F10.5)                          SWIDAT    303
 4040 FORMAT(A3,1X,2A12,2A2,4F8.3,T71,F10.5)                            SWIDAT    304
 4050 FORMAT(1X,' *** ERROR CONTROL RELAY CROSS TRIPPING '              SWIDAT    305
     *,'GENERATOR NOT FOUND')                                           SWIDAT    306
       END                                                              SWIDAT    307
