CFPRIME LSWITD                                                          LSWITD      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 LSWITD(IEBK,IPSWIT,IUY)                                LSWITD      3
CD                                                                      LSWITD      4
CD    THIS IS THE MAIN DRIVER TO READ IN AND TRANSLATE THE USER INPUT   LSWITD      5
CD    SIMULATION SPECIFICATION CARDS.                                   LSWITD      6
CD                                                                      LSWITD      7
      INCLUDE 'PARX.INS'                                                LSWITD      8
      INCLUDE 'CNFLAG.INS'                                              LSWITD      9
      INCLUDE 'CNPT.INS'                                                LSWITD     10
      INCLUDE 'CNIPTR.INS'                                              LSWITD     11
      INCLUDE 'CNB0.INS'                                                LSWITD     12
      INCLUDE 'CNB1.INS'                                                LSWITD     13
      INCLUDE 'CNB3.INS'                                                LSWITD     14
      INCLUDE 'CNB4.INS'                                                LSWITD     15
      INCLUDE 'CNB8.INS'                                                LSWITD     16
      INCLUDE 'CNB19.INS'                                               LSWITD     17
      INCLUDE 'CNPARX.INS'                                              LSWITD     18
      INCLUDE 'CNNNEW.INS'                                              LSWITD     19
      INCLUDE 'CNVOLT.INS'                                              LSWITD     20
      INCLUDE 'CNQSTA.INS'                                              LSWITD     21
      INCLUDE 'EQQSTA.INS'                                              LSWITD     22
      INCLUDE 'CNLFDA.INS'                                              LSWITD     23
      INCLUDE 'CNAUTO.INS'                                              LSWITD     24
      INCLUDE 'CNMON.INS'                                               LSWITD     25
      INCLUDE 'CNSELI.INS'                                              LSWITD     26
      INCLUDE 'CNLKN1.INS'                                              LSWITD     27
      INCLUDE 'CNLIN1.INS'                                              LSWITD     28
      INCLUDE 'CNLUN.INS'                                               LSWITD     29
      INCLUDE 'CNUNIT.INS'                                              LSWITD     30
      INCLUDE 'CNSTN.INS'                                               LSWITD     31
      INCLUDE 'CNREC1.INS'                                              LSWITD     32
      INCLUDE 'CNMYVA.INS'                                              LSWITD     33
      INCLUDE 'CNYVAR.INS'                                              LSWITD     34
      INCLUDE 'CNMDAT.INS'                                              LSWITD     35
      INCLUDE 'CNMPAR.INS'                                              LSWITD     36
      INCLUDE 'CNLSTA.INS'                                              LSWITD     37
      INCLUDE 'CNMSG.INS'                                               LSWITD     38
C                                                                       LSWITD     39
      DIMENSION LPAD(128)                                               LSWITD     40
      INTEGER  LISMON(NPL)                                              LSWITD     41
      EQUIVALENCE (BUDAT(1),LISMON(1))                                  LSWITD     42
      CHARACTER*4 IRADX(MONL*12),IRORIG(MONL*12),IXORIG(MONL*12)        LSWITD     43
      EQUIVALENCE                                                       LSWITD     44
     &(RADX(1),IRADX(1)),(RORIG(1),IRORIG(1)),(XORIG(1),IXORIG(1))      LSWITD     45
      CHARACTER*4 ADD1,ADD2,ADD3(10),CKTID                              LSWITD     46
      INTEGER*4 ITFK,IADD1,IADD2,IADD3(10)                              LSWITD     47
      EQUIVALENCE (IADD1,ADD1),(IADD2,ADD2),(IADD3(1),ADD3(1))          LSWITD     48
      EQUIVALENCE (ICKTID,CKTID)                                        LSWITD     49
C                                                                       LSWITD     50
      COMMON/CNFALT/ ZFAULT(6)                                          LSWITD     51
      INTEGER*4 JFAULT(6)                                               LSWITD     52
      EQUIVALENCE (ZFAULT(1),JFAULT(1))                                 LSWITD     53
C                                                                       LSWITD     54
      DIMENSION KKR1(1),KKR2(1),KKR3(1),KKR4(1),KKR5(1),XKR5(1)         LSWITD     55
      EQUIVALENCE (KKR5(1),ISPEED),(XKR5(1),ERTOL)                      LSWITD     56
     1,(KKR1(1),LFNO),(KKR2(1),NT),(KKR3(1),NPKPR),(KKR4(1),IALPT)      LSWITD     57
      CHARACTER*80 CARD,FRSHNT,TOSHNT                                   LSWITD     58
      CHARACTER*12 BNAME1,BNAME2,IBLK12                                 LSWITD     59
      DIMENSION  INAME1(3),INAME2(3)                                    LSWITD     60
      EQUIVALENCE(BNAME1,INAME1(1)),(BNAME2,INAME2(1))                  LSWITD     61
C                                                                       LSWITD     62
      CHARACTER*120 DWORD                                               LSWITD     63
      CHARACTER*80 STRING,EMSG,LCARD,SWTEXT,BLANK                       LSWITD     64
      CHARACTER*7 SUBPMT                                                LSWITD     65
C                                                                       LSWITD     66
      DIMENSION STIME(200),ISCARD(200),JECARD(200),IREDLB(200)          LSWITD     67
C                                                                       LSWITD     68
      CHARACTER*50 FILNAM                                               LSWITD     69
      CHARACTER*12 FMTOUT,AWV1(7)                                       LSWITD     70
      CHARACTER*12 KWORD,FKEYW(35),AFAULT,ZEROP,NAME1,NAME2             LSWITD     71
      CHARACTER*3 CODE                                                  LSWITD     72
      CHARACTER*2 SID,CID,CKK,MCID                                      LSWITD     73
      EQUIVALENCE (SWTEXT,ISWTEX(1))                                    LSWITD     74
C                                                                       LSWITD     75
      LOGICAL IENTER,LSUMM                                              LSWITD     76
      LOGICAL ESCMOD                                                    LSWITD     77
C                                                                       LSWITD     78
      REAL TT(2)                                                        LSWITD     79
      COMPLEX PQ                                                        LSWITD     80
      EQUIVALENCE (PQ,TT(1),PP),(TT(2),QQ)                              LSWITD     81
C                                                                       LSWITD     82
      INCLUDE 'CNISOC.INS'                                              LSWITD     83
C                                                                       LSWITD     84
C                                                                       LSWITD     85
      DATA IENTER/.FALSE./,LSUMM/.FALSE./                               LSWITD     86
      DATA IBLK12/'            '/                                       LSWITD     87
      DATA ADD1/'ADD '/,ADD2/'BUS#'/                                    LSWITD     88
      DATA ADD3/'0001','0002','0003','0004','0005','0006','0007',       LSWITD     89
     &          '0008','0009','0010'/                                   LSWITD     90
C                                                                       LSWITD     91
      DATA FKEYW/                                                       LSWITD     92
C       123456789012   123456789012   123456789012   123456789012       LSWITD     93
     & 'DESCRIPTION ','SIMULATION  ','CONTINGENCY ','AT TIME     '      LSWITD     94
     &,'INTERVAL    ','INTEGRATION ','STEP        ','SOLUTION    '      LSWITD     95
     &,'THREE       ','TWO         ','LINE        ','CLEAR       '      LSWITD     96
     &,'ZERO        ','REMOVE      ','FLASH       ','REINSERT    '      LSWITD     97
     &,'DISCONNECT  ','ADD         ','MODIFY      ','ALTER       '      LSWITD     98
     &,'CHANGE      ','RESTORE     ','RECONNECT   ','PRINT       '      LSWITD     99
     &,'PLOT        ','REDUCE      ','SHED        ','NOFAULT     '      LSWITD    100
     &,'NOMORE      ','END         ','MOTOR       ','REPORT      '      LSWITD    101
     &,'OPEN        ','APPLY       ','INSERT      '/                    LSWITD    102
                                                                        LSWITD    103
C                                                                       LSWITD    104
      DATA BLANK/' '/                                                   LSWITD    105
C                                                                       LSWITD    106
      IEBK=0                                                            LSWITD    107
      JLENG=50                                                          LSWITD    108
      IKEY=4                                                            LSWITD    109
      CALL OPENRE(IU31,FILNAM,JLENG,IKEY,ISTAT,0)                       LSWITD    110
      LUNITS(IU31)=.TRUE.                                               LSWITD    111
C                                                                       LSWITD    112
      CALL FMOVE(0,STIME,STIME,200)                                     LSWITD    113
      CALL MOVE(0,ISCARD,ISCARD,200)                                    LSWITD    114
      CALL MOVE(0,JECARD,JECARD,200)                                    LSWITD    115
      CALL MOVE(0,IREDLB,IREDLB,200)                                    LSWITD    116
C                                                                       LSWITD    117
      TNOFA=0.0                                                         LSWITD    118
      NSTIME=0                                                          LSWITD    119
      JREC=0                                                            LSWITD    120
      ISORT=1                                                           LSWITD    121
      ISCARD(1)=1                                                       LSWITD    122
C                                                                       LSWITD    123
C     INITINALIZE BLANK CARD                                            LSWITD    124
C                                                                       LSWITD    125
      HN=0.01                                                           LSWITD    126
      IDC=-1                                                            LSWITD    127
      IMT=-1                                                            LSWITD    128
      IMTH=-1                                                           LSWITD    129
      STEPS=-1.0                                                        LSWITD    130
      IREPRT=1                                                          LSWITD    131
      IPRINT=1                                                          LSWITD    132
      IPLOT=1                                                           LSWITD    133
C                                                                       LSWITD    134
C     INITIALIZE ESC CARD                                               LSWITD    135
C                                                                       LSWITD    136
      IFAULT=-1                                                         LSWITD    137
      JZEROP=-1                                                         LSWITD    138
      AFAULT='-1          '                                             LSWITD    139
      ZEROP='-1          '                                              LSWITD    140
      CODE='   '                                                        LSWITD    141
C                                                                       LSWITD    142
C         IREDL=0 DO NOT REDUCE LOAD BUS                                LSWITD    143
C                                                                       LSWITD    144
      IREDL=0                                                           LSWITD    145
C                                                                       LSWITD    146
      GOTO 150                                                          LSWITD    147
  50  CONTINUE                                                          LSWITD    148
      CODE='   '                                                        LSWITD    149
 100  IF(CODE.EQ.'   ') THEN                                            LSWITD    150
       MSG(1)=                                                          LSWITD    151
     * ' *** WARNING FOLLOWING CARD IS IGNORED BECAUSE OF SYNTAX ERROR' LSWITD    152
       MSG(2)=LCARD                                                     LSWITD    153
       CALL PRTMSG(2)                                                   LSWITD    154
      ELSE                                                              LSWITD    155
       JREC=JREC+1                                                      LSWITD    156
       WRITE(IU31,REC=JREC) CARD                                        LSWITD    157
       CODE='   '                                                       LSWITD    158
      ENDIF                                                             LSWITD    159
C                                                                       LSWITD    160
C      GET THE FIRST KEY WORD                                           LSWITD    161
C                                                                       LSWITD    162
 150  CONTINUE                                                          LSWITD    163
      CARD=BLANK                                                        LSWITD    164
C                                                                       LSWITD    165
      CALL FSWIDA(IU16,LIN,IU52,LCARD,KWORD,LKWORD,DWORD,LDWORD)        LSWITD    166
C                                                                       LSWITD    167
C      MATCH THE FIRST KEY WORD                                         LSWITD    168
C                                                                       LSWITD    169
      DO 200 IFKEYW=1,35                                                LSWITD    170
      IF(KWORD(1:3).EQ.FKEYW(IFKEYW)(1:3))GOTO 250                      LSWITD    171
 200  CONTINUE                                                          LSWITD    172
C                                                                       LSWITD    173
      WRITE(MSG(1),7400)                                                LSWITD    174
      WRITE(MSG(2),7410)                                                LSWITD    175
      MSG(3)=LCARD                                                      LSWITD    176
      CALL PRTMSG(3)                                                    LSWITD    177
      GOTO 150                                                          LSWITD    178
C                                                                       LSWITD    179
C                                                                       LSWITD    180
 250  CONTINUE                                                          LSWITD    181
      R=0.                                                              LSWITD    182
      X=0.                                                              LSWITD    183
      R1=0.                                                             LSWITD    184
      X1=0.                                                             LSWITD    185
      R2=0.                                                             LSWITD    186
      X2=0.                                                             LSWITD    187
      CODE='   '                                                        LSWITD    188
      CID='  '                                                          LSWITD    189
      SID='  '                                                          LSWITD    190
C                                                                       LSWITD    191
C         'DES','SIM','CON','AT ','INT','INT','STE','SOL','THR'         LSWITD    192
      GOTO(300,  350,  400,  450,  650,  650,  700,  750,  900,         LSWITD    193
C         ,'TWO','LIN','CLE','ZER','REM','FLA','REI','DIS'              LSWITD    194
     &     1100, 1050, 1400, 1450, 1600, 1500, 1550, 1650,              LSWITD    195
C         ,'ADD ','MOD','ALT','CHA','RES','REC','PRI','PLO'             LSWITD    196
     &     1700,  1750, 1750, 1750, 2150, 2150, 2350, 2400,             LSWITD    197
C         ,'RED','SHE','NOF','NOM','END','MOT','REP','OPE'              LSWITD    198
     &     2450, 2250, 1300, 2600, 2600, 2410, 2340,  1600,             LSWITD    199
C         ,'APP','INS'                                                  LSWITD    200
     &     1700, 1700),IFKEYW                                           LSWITD    201
C                                                                       LSWITD    202
C   DESCRIPTION                                                         LSWITD    203
C                                                                       LSWITD    204
 300  CONTINUE                                                          LSWITD    205
C                                                                       LSWITD    206
C     STORE THE DESCRIPTION TO SWTEX ARRAY                              LSWITD    207
C                                                                       LSWITD    208
      SWTEXT=' '                                                        LSWITD    209
      SWTEXT(1:LDWORD)=DWORD(1:LDWORD)                                  LSWITD    210
      GOTO 150                                                          LSWITD    211
C                                                                       LSWITD    212
C   SIMULATION                                                          LSWITD    213
C                                                                       LSWITD    214
 350  CONTINUE                                                          LSWITD    215
C                                                                       LSWITD    216
C     POSSIBLE TEXT:                                                    LSWITD    217
C     (SIMULATION) FOR XXXXX SECONDS                                    LSWITD    218
C                                                                       LSWITD    219
      I1=INDEX(DWORD(1:LDWORD),'FOR')+3                                 LSWITD    220
      IF(I1.EQ.3) I1=1                                                  LSWITD    221
      READ(DWORD(I1:LDWORD),*,IOSTAT=IOS) TL                            LSWITD    222
      IF(IOS.NE.0)GOTO 50                                               LSWITD    223
      IF(INDEX(DWORD(I1:LDWORD),'CYC').NE.0) TL=TL/FQBASE               LSWITD    224
      IF(STEPS.GT.0.0) HN=STEPS                                         LSWITD    225
      GOTO 150                                                          LSWITD    226
C                                                                       LSWITD    227
 400  CONTINUE                                                          LSWITD    228
C                                                                       LSWITD    229
C CONTINGENCY CASES TO BE IMPLEMENTED LATER                             LSWITD    230
C                                                                       LSWITD    231
C                                                                       LSWITD    232
 450  CONTINUE                                                          LSWITD    233
C                                                                       LSWITD    234
C   AT TIME                                                             LSWITD    235
C     POSSIBLE TEXT:                                                    LSWITD    236
C     (AT )  XXXXXX  SECONDS/CYC                                        LSWITD    237
C                                                                       LSWITD    238
C                                                                       LSWITD    239
C     READ IN THE TIME                                                  LSWITD    240
C                                                                       LSWITD    241
      I1=INDEX(DWORD,'TIME')+4                                          LSWITD    242
      IF(I1.EQ.4) I1=1                                                  LSWITD    243
      READ(DWORD(I1:LDWORD),*,IOSTAT=IOS) TC                            LSWITD    244
      IF(IOS.NE.0)GOTO 50                                               LSWITD    245
      IF(INDEX(DWORD,'CYC').NE.0) TC=TC/FQBASE                          LSWITD    246
C                                                                       LSWITD    247
C     CREATE CARD AND WRITE IT INTO IU31                                LSWITD    248
C                                                                       LSWITD    249
 500     CODE='ESC'                                                     LSWITD    250
         IF(KLFO.EQ.0)THEN                                              LSWITD    251
            WRITE(CARD,6700) CODE,IFAULT,JZEROP                         LSWITD    252
         ELSE                                                           LSWITD    253
            WRITE(CARD,6650) CODE,AFAULT,ZEROP                          LSWITD    254
         ENDIF                                                          LSWITD    255
C                                                                       LSWITD    256
C     CREATE BLANK AND WRITE IT INTO IU31                               LSWITD    257
C                                                                       LSWITD    258
         JREC=JREC+1                                                    LSWITD    259
         WRITE(IU31,REC=JREC) CARD                                      LSWITD    260
         CARD=BLANK                                                     LSWITD    261
         JECARD(ISORT)=JREC                                             LSWITD    262
         WRITE(CARD,7700) STEPS,IDC,IMT,IPRINT,IPLOT,IMTH,IREPRT        LSWITD    263
         JREC=JREC+1                                                    LSWITD    264
         WRITE(IU31,REC=JREC) CARD                                      LSWITD    265
         CARD=BLANK                                                     LSWITD    266
C                                                                       LSWITD    267
         IREDLB(ISORT)=IREDL                                            LSWITD    268
C                                                                       LSWITD    269
         IFAULT=-1                                                      LSWITD    270
         JZEROP=-1                                                      LSWITD    271
         AFAULT='-1          '                                          LSWITD    272
         ZEROP='-1          '                                           LSWITD    273
         IREDL=-1                                                       LSWITD    274
         STEPS=-1.                                                      LSWITD    275
         IDC=-1                                                         LSWITD    276
         IMT=-1                                                         LSWITD    277
         IPRINT=-1                                                      LSWITD    278
         IPLOT=-1                                                       LSWITD    279
         IMTH=-1                                                        LSWITD    280
         IREPRT=-1                                                      LSWITD    281
C                                                                       LSWITD    282
C   SORT THE ATTIMES IN ASSENDING ORDER                                 LSWITD    283
C                                                                       LSWITD    284
         NSTIME=NSTIME+1                                                LSWITD    285
         DO 550 I=NSTIME,1,-1                                           LSWITD    286
            IF(STIME(I).LE.TC) GOTO 600                                 LSWITD    287
            STIME(I+1)=STIME(I)                                         LSWITD    288
            ISCARD(I+1)=ISCARD(I)                                       LSWITD    289
            JECARD(I+1)=JECARD(I)                                       LSWITD    290
            IREDLB(I+1)=IREDLB(I)                                       LSWITD    291
 550     CONTINUE                                                       LSWITD    292
C                                                                       LSWITD    293
 600     ISORT=I+1                                                      LSWITD    294
C                                                                       LSWITD    295
      STIME(ISORT)=TC                                                   LSWITD    296
      ISCARD(ISORT)=JREC+1                                              LSWITD    297
      IF(KWORD(1:3).EQ.'NOM') GOTO 2600                                 LSWITD    298
      GOTO 150                                                          LSWITD    299
C                                                                       LSWITD    300
C   INTERVAL OR INTEGRATION                                             LSWITD    301
C                                                                       LSWITD    302
 650  CONTINUE                                                          LSWITD    303
C                                                                       LSWITD    304
C     INTERVAL                                                          LSWITD    305
C     POSSIBLE TEXT                                                     LSWITD    306
C     (INTERVAL) SIZE XXXXX SECOND/CYCLES                               LSWITD    307
C                                                                       LSWITD    308
      IF(KWORD(1:LKWORD).EQ.FKEYW(IFKEYW)(1:LKWORD)) GOTO 700           LSWITD    309
C                                                                       LSWITD    310
C     INTEGRATION                                                       LSWITD    311
C     POSSIBLE TEXT                                                     LSWITD    312
C     (INTEGRATION) TRAP/RKG2/RKG3/RKG4/RK2/RK3/RK4/ME                  LSWITD    313
C                                                                       LSWITD    314
      IF(KWORD(1:LKWORD).NE.FKEYW(IFKEYW+1)(1:LKWORD)) GOTO 150         LSWITD    315
      IF(INDEX(DWORD,'TRAP').NE.0)THEN                                  LSWITD    316
         IMTH=11                                                        LSWITD    317
      ELSEIF(INDEX(DWORD,'RKG4').NE.0)THEN                              LSWITD    318
         IMTH=1                                                         LSWITD    319
      ELSEIF(INDEX(DWORD,'RKG3').NE.0)THEN                              LSWITD    320
         IMTH=2                                                         LSWITD    321
      ELSEIF(INDEX(DWORD,'RKG2').NE.0)THEN                              LSWITD    322
         IMTH=3                                                         LSWITD    323
      ELSEIF(INDEX(DWORD,'RK4').NE.0)THEN                               LSWITD    324
         IMTH=1                                                         LSWITD    325
      ELSEIF(INDEX(DWORD,'RK3').NE.0)THEN                               LSWITD    326
         IMTH=2                                                         LSWITD    327
      ELSEIF(INDEX(DWORD,'RK2').NE.0)THEN                               LSWITD    328
         IMTH=3                                                         LSWITD    329
      ELSEIF(INDEX(DWORD,'ME').NE.0)THEN                                LSWITD    330
         IMTH=4                                                         LSWITD    331
      ELSE                                                              LSWITD    332
         IMTH=11                                                        LSWITD    333
         WRITE(MSG(1),7550)                                             LSWITD    334
         WRITE(MSG(2),7551)                                             LSWITD    335
         MSG(3)=LCARD                                                   LSWITD    336
         CALL PRTMSG(3)                                                 LSWITD    337
      ENDIF                                                             LSWITD    338
      GOTO 150                                                          LSWITD    339
C                                                                       LSWITD    340
C   STEP SIZE                                                           LSWITD    341
C                                                                       LSWITD    342
 700  CONTINUE                                                          LSWITD    343
C                                                                       LSWITD    344
C   POSSIBLE TEXT                                                       LSWITD    345
C   (STEP) SIZE XXXXX SEC/CYC                                           LSWITD    346
C                                                                       LSWITD    347
      I1=INDEX(DWORD,'SIZE')+4                                          LSWITD    348
      IF(I1.EQ.4) I1=1                                                  LSWITD    349
      READ(DWORD(I1:LDWORD),*,IOSTAT=IOS) STEPS                         LSWITD    350
      IF(IOS.NE.0)GOTO 50                                               LSWITD    351
      IF(INDEX(DWORD(1:LDWORD),'CYC').NE.0) STEPS=STEPS/FQBASE          LSWITD    352
      GOTO 150                                                          LSWITD    353
C                                                                       LSWITD    354
C   SOLUTION CONTROL                                                    LSWITD    355
C                                                                       LSWITD    356
 750  CONTINUE                                                          LSWITD    357
C                                                                       LSWITD    358
C     POSSIBLE TEXT:                                                    LSWITD    359
C     (SOLUTION) CONTROL MAXIMUM PER ITERATION IIIII                    LSWITD    360
C     (SOLUTION) CONTROL NETWORK CONVERGENCE TOLERANCE XXXXX            LSWITD    361
C     (SOLUTION) CONTROL ADD UNIFORM DAMPING                            LSWITD    362
C                                                                       LSWITD    363
      I1=INDEX(DWORD,'DAMPING')+7                                       LSWITD    364
      IF(I1.GT.7)THEN                                                   LSWITD    365
         READ(DWORD(I1:LDWORD),*,IOSTAT=IOS) R                          LSWITD    366
         IF(IOS.NE.0)GOTO 50                                            LSWITD    367
         CODE='AUD'                                                     LSWITD    368
         WRITE(CARD,6350) CODE,0,R                                      LSWITD    369
      ELSE                                                              LSWITD    370
         CODE='TO '                                                     LSWITD    371
         R=0.0                                                          LSWITD    372
         X=0.0                                                          LSWITD    373
         I1=MOD(INDEX(DWORD,'TOLERANCE')+111,112)+10                    LSWITD    374
         I2=MOD(INDEX(DWORD,'ITERATION')+111,112)+10                    LSWITD    375
         READ(DWORD(I1:LDWORD),*,IOSTAT=IOS) R,X                        LSWITD    376
         IF(IOS.NE.0)GOTO 50                                            LSWITD    377
         IF(I1.GT.I2)THEN                                               LSWITD    378
            WRITE(CARD,6350) CODE,INT(R),X                              LSWITD    379
         ELSE                                                           LSWITD    380
            WRITE(CARD,6350) CODE,INT(X),R                              LSWITD    381
         ENDIF                                                          LSWITD    382
      ENDIF                                                             LSWITD    383
      GOTO 100                                                          LSWITD    384
C                                                                       LSWITD    385
C   THREE PAHSE FAULT                                                   LSWITD    386
C                                                                       LSWITD    387
 900  CONTINUE                                                          LSWITD    388
C                                                                       LSWITD    389
C   POSSIBLE TEXT                                                       LSWITD    390
C   (THREE) PHASE FAULT AT BUS#/BUS NAME                                LSWITD    391
C                          :XXX                                         LSWITD    392
C   (THREE) PHASE FAULT ON LINE:XXX :YYY :CID DIS FROM CC/              LSWITD    393
C                                                                       LSWITD    394
      I1=INDEX(DWORD,';')                                               LSWITD    395
      IF(I1.EQ.0)GOTO 50                                                LSWITD    396
C                                                                       LSWITD    397
      IF(INDEX(DWORD,'ON LINE').NE.0)THEN                               LSWITD    398
C                                                                       LSWITD    399
        I2=I1+INDEX(DWORD(I1+1:LDWORD),';')                             LSWITD    400
        IF(I1.EQ.I2)GOTO 50                                             LSWITD    401
        I3=I2+INDEX(DWORD(I2+1:LDWORD),';')                             LSWITD    402
        IF(I2.EQ.I3)GOTO 50                                             LSWITD    403
        I4=I3+3                                                         LSWITD    404
        IF(KLFO.EQ.0)THEN                                               LSWITD    405
          READ(DWORD(I1+1:I2-1),*,IOSTAT=IOS)NLFI                       LSWITD    406
          IF(IOS.NE.0)GOTO 50                                           LSWITD    407
          READ(DWORD(I2+1:I3-1),*,IOSTAT=IOS)NLFJ                       LSWITD    408
          IF(IOS.NE.0)GOTO 50                                           LSWITD    409
        ELSE                                                            LSWITD    410
          NAME1=DWORD(I1+1:I2-1)                                        LSWITD    411
          NAME2=DWORD(I2+1:I3-1)                                        LSWITD    412
          CALL CHKBUS(NAME1,NLFI)                                       LSWITD    413
          CALL CHKBUS(NAME2,NLFJ)                                       LSWITD    414
        ENDIF                                                           LSWITD    415
C                                                                       LSWITD    416
        NPBNOI=0                                                        LSWITD    417
        NPBNOJ=0                                                        LSWITD    418
        IF(NLFI.NE.0)NPBNOI=NNEW(NLFI)                                  LSWITD    419
        IF(NLFJ.NE.0)NPBNOJ=NNEW(NLFJ)                                  LSWITD    420
        IF(NPBNOI.EQ.0.OR.NPBNOJ.EQ.0)THEN                              LSWITD    421
          IEBK=1                                                        LSWITD    422
          MSG(1)=' *** ERROR - BUS  NOT IN SYSTEM - CHECK '//           LSWITD    423
     +           'THE FOLLOWING CARD.'                                  LSWITD    424
          MSG(2)=LCARD                                                  LSWITD    425
          CALL PRTMSG(2)                                                LSWITD    426
          GOTO 150                                                      LSWITD    427
        ENDIF                                                           LSWITD    428
        CID=DWORD(I3+1:I3+2)                                            LSWITD    429
        CALL LOLINE(NPBNOI,NPBNOJ,CID,JNL)                              LSWITD    430
        IF(JNL.EQ.0)THEN                                                LSWITD    431
          IEBK=1                                                        LSWITD    432
          MSG(1)=' *** ERROR - BRANCH NOT IN SYSTEM - CHECK '//         LSWITD    433
     +           'THE FOLLOWING CARD.'                                  LSWITD    434
          MSG(2)=LCARD                                                  LSWITD    435
          CALL PRTMSG(2)                                                LSWITD    436
          GOTO 150                                                      LSWITD    437
        ENDIF                                                           LSWITD    438
        JNL5=IABS(JNL)*5                                                LSWITD    439
        JTRF=LTRANC(JNL5)                                               LSWITD    440
        IF(JTRF.NE.0)THEN                                               LSWITD    441
          IEBK=1                                                        LSWITD    442
          MSG(1)=' *** ERROR - A TRANSFORMER IS NOT ALLOWED '//         LSWITD    443
     +           'IN THE FOLLOWING CARD.'                               LSWITD    444
          MSG(2)=LCARD                                                  LSWITD    445
          CALL PRTMSG(2)                                                LSWITD    446
          GOTO 150                                                      LSWITD    447
        ENDIF                                                           LSWITD    448
        ITFK=LFTB(JNL5-4)                                               LSWITD    449
        CALL UNPACK(CKK,NJSELI,ITFK)                                    LSWITD    450
        IF(NJSELI.NE.0)THEN                                             LSWITD    451
          IF(LCONE(6,NJSELI).GT.1)THEN                                  LSWITD    452
            IEBK=1                                                      LSWITD    453
            MSG(1)='*** ERROR - MULTI SECTION IS NOT ALLOWED '//        LSWITD    454
     +             'IN THE FOLLOWING CARD AT PRESENT.'                  LSWITD    455
            MSG(2)=LCARD                                                LSWITD    456
            CALL PRTMSG(2)                                              LSWITD    457
            GOTO 150                                                    LSWITD    458
          ENDIF                                                         LSWITD    459
          GIJ=EQPI(1,NJSELI)                                            LSWITD    460
          BIJ=-EQPI(2,NJSELI)                                           LSWITD    461
        ELSE                                                            LSWITD    462
          GIJ=GA(JNL5-2)                                                LSWITD    463
          BIJ=-BA(JNL5-1)                                               LSWITD    464
        ENDIF                                                           LSWITD    465
        DMAG=GIJ*GIJ+BIJ*BIJ                                            LSWITD    466
        IF(DMAG.LE.ZILTOL)THEN                                          LSWITD    467
          IEBK=1                                                        LSWITD    468
          MSG(1)=' *** ERROR - THREE PHASE LINE FAULT '//               LSWITD    469
     +           'CANNOT BE APPLIED ON A ZERO IMPEDANCE LINE.'          LSWITD    470
          MSG(2)=LCARD                                                  LSWITD    471
          CALL PRTMSG(2)                                                LSWITD    472
          GOTO 150                                                      LSWITD    473
        ENDIF                                                           LSWITD    474
C                                                                       LSWITD    475
        IF(I4.GE.LDWORD)THEN                                            LSWITD    476
          READ (DWORD(I4:LDWORD),*,IOSTAT=IOS)DISTR                     LSWITD    477
          IF(IOS.NE.0)GOTO 50                                           LSWITD    478
        ELSE                                                            LSWITD    479
          DISTR=0.0                                                     LSWITD    480
        ENDIF                                                           LSWITD    481
        IF(DISTR.LT.0.0001)DISTR=0.0001                                 LSWITD    482
C                                                                       LSWITD    483
        CODE='LF3'                                                      LSWITD    484
        WRITE(CARD,4910)CODE,NLFI,NLFJ,CID,DISTR                        LSWITD    485
        IF(KLFO.EQ.0)THEN                                               LSWITD    486
          IFAULT=NLFI                                                   LSWITD    487
        ELSE                                                            LSWITD    488
          AFAULT=NAME1                                                  LSWITD    489
        ENDIF                                                           LSWITD    490
C                                                                       LSWITD    491
        GOTO 100                                                        LSWITD    492
C                                                                       LSWITD    493
      ELSE                                                              LSWITD    494
C                                                                       LSWITD    495
        IF(KLFO.EQ.0)THEN                                               LSWITD    496
          READ(DWORD(I1+1:LDWORD),*,IOSTAT=IOS) IFAULT                  LSWITD    497
          IF(IOS.NE.0)GOTO 50                                           LSWITD    498
          JZEROP=IFAULT                                                 LSWITD    499
        ELSE                                                            LSWITD    500
          AFAULT=DWORD(I1+1:I1+12)                                      LSWITD    501
          ZEROP=AFAULT                                                  LSWITD    502
        ENDIF                                                           LSWITD    503
C                                                                       LSWITD    504
      ENDIF                                                             LSWITD    505
C                                                                       LSWITD    506
      GOTO 150                                                          LSWITD    507
C                                                                       LSWITD    508
C   LINE                                                                LSWITD    509
C                                                                       LSWITD    510
 1050 CONTINUE                                                          LSWITD    511
C                                                                       LSWITD    512
C     POSSIBLE TEXT                                                     LSWITD    513
C     (LINE) TO GROUND FAULT AT BUS#/BUSNAME                            LSWITD    514
C                                   :XXX                                LSWITD    515
      CODE='LGF'                                                        LSWITD    516
      GOTO 1150                                                         LSWITD    517
C                                                                       LSWITD    518
C   TWO LINE TO GROUND FAULT                                            LSWITD    519
C                                                                       LSWITD    520
 1100 CONTINUE                                                          LSWITD    521
C                                                                       LSWITD    522
C     POSSIBLE TEXT                                                     LSWITD    523
C     (TWO) LINE TO GROUND FAULT AT BUS#/BUSNAME                        LSWITD    524
C                                   :XXX                                LSWITD    525
      CODE='LLF'                                                        LSWITD    526
 1150 I1=INDEX(DWORD,';')+1                                             LSWITD    527
      IF(I1.EQ.1) GOTO 50                                               LSWITD    528
      IF(KLFO.EQ.0)THEN                                                 LSWITD    529
         IF(CODE(3:3).EQ.'F')THEN                                       LSWITD    530
            READ(DWORD(I1:LDWORD),*,IOSTAT=IOS) IFBUS,R,X,R1,X1         LSWITD    531
            IF(IOS.NE.0)GOTO 50                                         LSWITD    532
         ELSE                                                           LSWITD    533
            READ(DWORD(I1:LDWORD),*,IOSTAT=IOS) IFBUS                   LSWITD    534
            IF(IOS.NE.0)GOTO 50                                         LSWITD    535
         ENDIF                                                          LSWITD    536
         WRITE(CARD,6250) CODE,IFBUS,R,X,R1,X1                          LSWITD    537
      ELSE                                                              LSWITD    538
         NAME1=DWORD(I1:I1+11)                                          LSWITD    539
         IF(CODE(3:3).EQ.'F')                                           LSWITD    540
     *      READ(DWORD(I1+12:LDWORD),*,IOSTAT=IOS) R,X,R1,X1            LSWITD    541
         IF(IOS.NE.0)GOTO 50                                            LSWITD    542
 1570    WRITE(CARD,6150) CODE,NAME1,R,X,R1,X1                          LSWITD    543
      ENDIF                                                             LSWITD    544
      IF(CODE(3:3).EQ.'F')THEN                                          LSWITD    545
      RF=R+R1                                                           LSWITD    546
      XF=X+X1                                                           LSWITD    547
      ZMAG=RF*RF+XF*XF                                                  LSWITD    548
      IF(ZMAG.EQ.0.0)THEN                                               LSWITD    549
         IEBK=1                                                         LSWITD    550
         WRITE(MSG(1),7200)                                             LSWITD    551
         MSG(2)=LCARD                                                   LSWITD    552
         CALL PRTMSG(2)                                                 LSWITD    553
      ENDIF                                                             LSWITD    554
      ENDIF                                                             LSWITD    555
      GOTO 100                                                          LSWITD    556
C                                                                       LSWITD    557
C   NOFAULT                                                             LSWITD    558
C                                                                       LSWITD    559
 1300 CONTINUE                                                          LSWITD    560
C                                                                       LSWITD    561
C   POSSIBLE TEXT:                                                      LSWITD    562
C     (NOFAULT)                                                         LSWITD    563
C                                                                       LSWITD    564
 1350 IFAULT=0                                                          LSWITD    565
      AFAULT='            '                                             LSWITD    566
      JZEROP=0                                                          LSWITD    567
      ZEROP='            '                                              LSWITD    568
C                                                                       LSWITD    569
      CODE='CLF'                                                        LSWITD    570
      CARD='CLF'                                                        LSWITD    571
      IF(TC.GT.TNOFA)TNOFA=TC                                           LSWITD    572
      GOTO 100                                                          LSWITD    573
C                                                                       LSWITD    574
C   CLEAR                                                               LSWITD    575
C                                                                       LSWITD    576
 1400 CONTINUE                                                          LSWITD    577
C                                                                       LSWITD    578
C   POSSIBLE TEXT:                                                      LSWITD    579
C     (CLEAR) LINE TO GROUND FAULT AT BUS#/BUSNAME                      LSWITD    580
C     (CLEAR) TWO LINE TO GROUND FAULT AT BUS#/BUSNAME                  LSWITD    581
C     (CLEAR) THREE PHASE FAULT AT BUS#/BUS NAME                        LSWITD    582
C     (CLEAR) THREE PHASE LINE FAULT AT NEAR END                        LSWITD    583
C     (CLEAR) THREE PHASE LINE FAULT AT FAR END                         LSWITD    584
C     (CLEAR) THREE PHASE LINE FAULT                                    LSWITD    585
C                                                                       LSWITD    586
      IF(INDEX(DWORD,'NEAR').NE.0)CODE='CFN'                            LSWITD    587
      IF(INDEX(DWORD,'FAR').NE.0)CODE='CFF'                             LSWITD    588
      IF(CODE.NE.' ')THEN                                               LSWITD    589
        CARD=CODE                                                       LSWITD    590
        GOTO 100                                                        LSWITD    591
      ENDIF                                                             LSWITD    592
      IF(INDEX(DWORD,'GROUND').EQ.0) GOTO 1350                          LSWITD    593
      CODE='LGR'                                                        LSWITD    594
      IF(INDEX(DWORD,'TWO').NE.0) CODE='LLR'                            LSWITD    595
      GOTO 1150                                                         LSWITD    596
C                                                                       LSWITD    597
C   ZERO VOLTAGE/POTIENTIAL  BUS/LINE                                   LSWITD    598
C                                                                       LSWITD    599
 1450 CONTINUE                                                          LSWITD    600
C                                                                       LSWITD    601
C   POSSIBLE TEXT:                                                      LSWITD    602
C   (ZERO) VOLTAGE/POTENTIAL BUS BUS#/BUSNAME                           LSWITD    603
C                                                                       LSWITD    604
      I1=INDEX(DWORD,';')+1                                             LSWITD    605
      IF(I1.EQ.1) GOTO 50                                               LSWITD    606
      IF(KLFO.EQ.0)THEN                                                 LSWITD    607
         READ(DWORD(I1:LDWORD),*,IOSTAT=IOS) JZEROP                     LSWITD    608
         IF(IOS.NE.0)GOTO 50                                            LSWITD    609
      ELSE                                                              LSWITD    610
         ZEROP=DWORD(I1:I1+11)                                          LSWITD    611
      ENDIF                                                             LSWITD    612
      GOTO 150                                                          LSWITD    613
C                                                                       LSWITD    614
C   FLASH CAPACITOR GAP                                                 LSWITD    615
C                                                                       LSWITD    616
 1500 CONTINUE                                                          LSWITD    617
C                                                                       LSWITD    618
C   POSSIBLE TEXT:                                                      LSWITD    619
C   (FLASH) CAPACITOR GAP :XX:YY:SID                                    LSWITD    620
C                                                                       LSWITD    621
      CODE='FCG'                                                        LSWITD    622
      GOTO 1900                                                         LSWITD    623
C                                                                       LSWITD    624
C   REINSERT CAPACITOR                                                  LSWITD    625
C                                                                       LSWITD    626
 1550 CONTINUE                                                          LSWITD    627
C                                                                       LSWITD    628
C   POSSIBLE TEXT:                                                      LSWITD    629
C   (REINSERT) CAPACITOR  :XX:YY:SID                                    LSWITD    630
C                                                                       LSWITD    631
      CODE='RCG'                                                        LSWITD    632
      GOTO 1900                                                         LSWITD    633
C                                                                       LSWITD    634
C   REMOVE/OPEN GENERATOR/LINE                                          LSWITD    635
C                                                                       LSWITD    636
 1600 CONTINUE                                                          LSWITD    637
C                                                                       LSWITD    638
C   POSSIBLE TEXT:                                                      LSWITD    639
C   (REMOVE) TRANSFORMER :XX:YY:ID                                      LSWITD    640
C   (REMOVE) LINE :XX:YY:ID                                             LSWITD    641
C   (REMOVE) PI LINE :XX:YY:ID                                          LSWITD    642
C   (REMOVE) SECTIONAL LINE :XX:YY:ID:SID                               LSWITD    643
C   (REMOVE) GENERATOR :XX:ID                                           LSWITD    644
C   (REMOVE) STABILIZER :XX:ID                                          LSWITD    645
C   (REMOVE) TRANSIENT EXCITATION BOSSTER :XX:ID                        LSWITD    646
C   (REMOVE) INDUCTION MOTOR :XX:ID                                     LSWITD    647
C   (REMOVE) ADMITTANCE :XX G B                                         LSWITD    648
C   (REMOVE) IMPEDANCE :XX R X                                          LSWITD    649
C   (REMOVE) BRAKE :XX R                                                LSWITD    650
C   (OPEN) TRANSFORMER :XX:YY:ID                                        LSWITD    651
C   (OPEN) LINE :XX:YY:ID                                               LSWITD    652
C   (OPEN) PI LINE :XX:YY:ID                                            LSWITD    653
C   (OPEN) SECTIONAL LINE :XX:YY:ID:SID                                 LSWITD    654
C   (OPEN) GENERATOR :XX:ID                                             LSWITD    655
C   (OPEN) STABILIZER :XX:ID                                            LSWITD    656
C   (OPEN) TRANSIENT EXCITATION BOSSTER :XX:ID                          LSWITD    657
C   (OPEN) INDUCTION MOTOR :XX:ID                                       LSWITD    658
C                                                                       LSWITD    659
C                                                                       LSWITD    660
C   DISCONNECT LINE                                                     LSWITD    661
C                                                                       LSWITD    662
      IF(INDEX(DWORD,'BRAKE').NE.0)THEN                                 LSWITD    663
        CODE='ZR '                                                      LSWITD    664
        GOTO 1730                                                       LSWITD    665
      ENDIF                                                             LSWITD    666
C                                                                       LSWITD    667
      IF(INDEX(DWORD,'IMPEDANCE').NE.0) CODE='ZR '                      LSWITD    668
      IF(INDEX(DWORD,'ADMITTANCE').NE.0) CODE='YR '                     LSWITD    669
      IF(CODE.EQ.'ZR '.OR.CODE.EQ.'YR ') GOTO 1720                      LSWITD    670
C                                                                       LSWITD    671
 1650 CONTINUE                                                          LSWITD    672
C   POSSIBLE TEXT:                                                      LSWITD    673
C   (DISCONNECT) TRANSFORMER :XX:YY:ID                                  LSWITD    674
C   (DISCONNECT) LINE :XX:YY:ID                                         LSWITD    675
C   (DISCONNECT) PI LINE :XX:YY:ID                                      LSWITD    676
C   (DISCONNECT) SECTIONAL LINE :XX:YY:ID:SID                           LSWITD    677
C   (DISCONNECT) GENERATOR :XX:ID                                       LSWITD    678
C   (DISCONNECT) STABILIZER :XX:ID                                      LSWITD    679
C   (DISCONNECT) INDUCTION MOTOR :XX:ID                                 LSWITD    680
C   (DISCONNECT) BRAKE :XX R                                            LSWITD    681
C                                                                       LSWITD    682
      IF(INDEX(DWORD,'BRAKE').NE.0)THEN                                 LSWITD    683
        CODE='ZR '                                                      LSWITD    684
        GOTO 1730                                                       LSWITD    685
      ENDIF                                                             LSWITD    686
C                                                                       LSWITD    687
      IF(INDEX(DWORD,'LINE').NE.0)THEN                                  LSWITD    688
         CODE='DLI'                                                     LSWITD    689
        IF(INDEX(DWORD,'PI').NE.0) CODE='DPL'                           LSWITD    690
        IF(INDEX(DWORD,'SECTIONAL').NE.0) CODE='DSL'                    LSWITD    691
      ENDIF                                                             LSWITD    692
      IF(INDEX(DWORD,'TRANSFORMER').NE.0) CODE='DTR'                    LSWITD    693
      IF(CODE.NE.'   ') GOTO 1900                                       LSWITD    694
      IF(INDEX(DWORD,'INDUCTION').NE.0 .AND.                            LSWITD    695
     *   INDEX(DWORD,' MOTOR').NE.0) CODE='DIM'                         LSWITD    696
      IF(INDEX(DWORD,'GENERATOR').NE.0) CODE='GR '                      LSWITD    697
      IF(INDEX(DWORD,'STABILIZER').NE.0) CODE='SR '                     LSWITD    698
C                                                                       LSWITD    699
 1800 IF(CODE.EQ.'   ') GOTO 100                                        LSWITD    700
      I1=INDEX(DWORD,';')                                               LSWITD    701
      I2=I1+INDEX(DWORD(I1+1:LDWORD),';')                               LSWITD    702
      IF(I1.EQ.I2) GOTO 50                                              LSWITD    703
      I3=I2+3                                                           LSWITD    704
C                                                                       LSWITD    705
      IF(CODE.EQ.'PM '.OR.CODE.EQ.'FV '.OR.CODE.EQ.'PR '.OR.            LSWITD    706
     *   CODE.EQ.'VR '.OR.CODE.EQ.'GFD'.OR.CODE.EQ.'GM ')THEN           LSWITD    707
         READ(DWORD(I3:LDWORD+2),*,IOSTAT=IOS) R                        LSWITD    708
         IF(IOS.NE.0)GOTO 50                                            LSWITD    709
         MVAFLG=INDEX(DWORD(I3:LDWORD),'M')                             LSWITD    710
      ENDIF                                                             LSWITD    711
      CID=DWORD(I2+1:LDWORD)                                            LSWITD    712
      IF(KLFO.EQ.0)THEN                                                 LSWITD    713
         READ(DWORD(I1+1:I2-1),*,IOSTAT=IOS) NLFI                       LSWITD    714
         IF(IOS.NE.0)GOTO 50                                            LSWITD    715
      ELSE                                                              LSWITD    716
         NAME1=DWORD(I1+1:I2-1)                                         LSWITD    717
         CALL CHKBUS(NAME1,NLFI)                                        LSWITD    718
      ENDIF                                                             LSWITD    719
      IF(NLFI.NE.0) NLFI=NNEW(NLFI)                                     LSWITD    720
      IF(NLFI.EQ.0.OR.(NLFI.GT.ICNODX.AND.CODE.NE.'DIM'))THEN           LSWITD    721
         IF(CODE.EQ.'DIM')THEN                                          LSWITD    722
            WRITE(MSG(1),5850)                                          LSWITD    723
         ELSE                                                           LSWITD    724
            WRITE(MSG(1),5500)                                          LSWITD    725
         ENDIF                                                          LSWITD    726
         MSG(2)=LCARD                                                   LSWITD    727
         CALL PRTMSG(2)                                                 LSWITD    728
         IEBK=1                                                         LSWITD    729
         CODE='   '                                                     LSWITD    730
         GOTO 150                                                       LSWITD    731
      ENDIF                                                             LSWITD    732
C                                                                       LSWITD    733
      IF(CODE.EQ.'DIM')THEN                                             LSWITD    734
         IMAC=NTHM(2,NLFI)                                              LSWITD    735
 1805    IF(IMAC.NE.0)THEN                                              LSWITD    736
           IF(CID.EQ.NDMC(IMAC)(3:4))THEN                               LSWITD    737
             JM=JMDAT(IMAC)                                             LSWITD    738
             MOTYPK=IABS(IDDAT(JM+1))                                   LSWITD    739
             IF(MOTYPK.GT.10)THEN                                       LSWITD    740
               WRITE(MSG(1),5940)                                       LSWITD    741
               MSG(2)=LCARD                                             LSWITD    742
               CALL PRTMSG(2)                                           LSWITD    743
               IEBK=1                                                   LSWITD    744
               CODE='   '                                               LSWITD    745
               GOTO 150                                                 LSWITD    746
             ENDIF                                                      LSWITD    747
             IMACH=IMAC                                                 LSWITD    748
             GOTO 1820                                                  LSWITD    749
           ELSE                                                         LSWITD    750
             IMAC=NEXTIM(IMAC)                                          LSWITD    751
             GOTO 1805                                                  LSWITD    752
           ENDIF                                                        LSWITD    753
         ENDIF                                                          LSWITD    754
         WRITE(MSG(1),5900)                                             LSWITD    755
         MSG(2)=LCARD                                                   LSWITD    756
         CALL PRTMSG(2)                                                 LSWITD    757
         IEBK=1                                                         LSWITD    758
         CODE='   '                                                     LSWITD    759
         GOTO 150                                                       LSWITD    760
      ENDIF                                                             LSWITD    761
C                                                                       LSWITD    762
C  FIND THE GENERATOR                                                   LSWITD    763
C                                                                       LSWITD    764
      IFIN=NTHG(NLFI+1)                                                 LSWITD    765
      IMACH=NTHG(NLFI)-1                                                LSWITD    766
 1810 IMACH=IMACH+1                                                     LSWITD    767
      IF(IMACH.GE.IFIN)THEN                                             LSWITD    768
        WRITE(MSG(1),5500)                                              LSWITD    769
        MSG(2)=LCARD                                                    LSWITD    770
        CALL PRTMSG(2)                                                  LSWITD    771
        IEBK=1                                                          LSWITD    772
        CODE='   '                                                      LSWITD    773
        GOTO 150                                                        LSWITD    774
      ENDIF                                                             LSWITD    775
      MCID=NDGC(IMACH)(3:4)                                             LSWITD    776
      CALL LOGEN(CID,MCID,JFOUND)                                       LSWITD    777
      IF(JFOUND.NE.1) GOTO 1810                                         LSWITD    778
C                                                                       LSWITD    779
      IF (CODE.EQ.'GM ') THEN                                           LSWITD    780
         IF(MVAFLG.NE.0)R=R*100.0/(PDGT(1,IMACH)*BASPC)                 LSWITD    781
         IF (R.LT.0.0.OR.R.GT.95.0) THEN                                LSWITD    782
            WRITE(MSG(1),7810) R                                        LSWITD    783
            WRITE(MSG(2),7820)                                          LSWITD    784
            IF (R.LT.0.0) THEN                                          LSWITD    785
               R=0.0                                                    LSWITD    786
            ELSE IF (R.GT.95.0) THEN                                    LSWITD    787
               R=95.0                                                   LSWITD    788
            END IF                                                      LSWITD    789
            WRITE(MSG(3),7830) R                                        LSWITD    790
            MSG(4)=LCARD                                                LSWITD    791
            CALL PRTMSG(4)                                              LSWITD    792
         END IF                                                         LSWITD    793
      ELSEIF(CODE.EQ.'SR '.AND.ICONTA(5,IMACH).LE.0)THEN                LSWITD    794
         WRITE(MSG(1),5750)                                             LSWITD    795
         MSG(2)=LCARD                                                   LSWITD    796
         CALL PRTMSG(2)                                                 LSWITD    797
         IEBK=1                                                         LSWITD    798
         CODE='   '                                                     LSWITD    799
         GOTO 150                                                       LSWITD    800
      ELSEIF(CODE.EQ.'VR '.OR.CODE.EQ.'OF '.OR.CODE.EQ.'TEB')THEN       LSWITD    801
         IF(ICONTA(4,IMACH).LE.0)THEN                                   LSWITD    802
            WRITE(MSG(1),5600)                                          LSWITD    803
            MSG(2)=LCARD                                                LSWITD    804
            CALL PRTMSG(2)                                              LSWITD    805
            IEBK=1                                                      LSWITD    806
            CODE='   '                                                  LSWITD    807
            GOTO 150                                                    LSWITD    808
         ENDIF                                                          LSWITD    809
         IF(CODE.EQ.'TEB'.AND.ICONTA(11,IMACH).LE.0)THEN                LSWITD    810
            WRITE(MSG(1),5650)                                          LSWITD    811
            MSG(2)=LCARD                                                LSWITD    812
            CALL PRTMSG(2)                                              LSWITD    813
            IEBK=1                                                      LSWITD    814
            CODE='   '                                                  LSWITD    815
            GOTO 150                                                    LSWITD    816
         ENDIF                                                          LSWITD    817
      ELSEIF(CODE.EQ.'PR '.AND.ICONTA(2,IMACH).LE.0)THEN                LSWITD    818
         WRITE(MSG(1),5700)                                             LSWITD    819
         MSG(2)=LCARD                                                   LSWITD    820
         CALL PRTMSG(2)                                                 LSWITD    821
         IEBK=1                                                         LSWITD    822
         CODE='   '                                                     LSWITD    823
         GOTO 150                                                       LSWITD    824
      ELSEIF(CODE.EQ.'PM '.AND.ICONTA(1,IMACH).LT.12)THEN               LSWITD    825
         WRITE(MSG(1),5800)                                             LSWITD    826
         WRITE(MSG(2),5830)                                             LSWITD    827
         MSG(3)=LCARD                                                   LSWITD    828
         CALL PRTMSG(3)                                                 LSWITD    829
         IEBK=1                                                         LSWITD    830
         CODE='   '                                                     LSWITD    831
         GOTO 150                                                       LSWITD    832
      ELSEIF(CODE.EQ.'GFD')THEN                                         LSWITD    833
         IF(ICONTA(1,IMACH).GE.12)THEN                                  LSWITD    834
            WRITE(MSG(1),5810)                                          LSWITD    835
            WRITE(MSG(2),5830)                                          LSWITD    836
            MSG(3)=LCARD                                                LSWITD    837
            CALL PRTMSG(3)                                              LSWITD    838
            IEBK=1                                                      LSWITD    839
            CODE='   '                                                  LSWITD    840
            GOTO 150                                                    LSWITD    841
         ENDIF                                                          LSWITD    842
         R=-R                                                           LSWITD    843
      ELSEIF(CODE.EQ.'FV '.AND.ICONTA(4,IMACH).GT.0)THEN                LSWITD    844
         WRITE(MSG(1),5820)                                             LSWITD    845
         WRITE(MSG(2),5830)                                             LSWITD    846
         MSG(3)=LCARD                                                   LSWITD    847
         CALL PRTMSG(3)                                                 LSWITD    848
         IEBK=1                                                         LSWITD    849
         CODE='   '                                                     LSWITD    850
         GOTO 150                                                       LSWITD    851
      ENDIF                                                             LSWITD    852
 1820 CONTINUE                                                          LSWITD    853
      WRITE(CARD,6500) CODE,NLFI,IMACH,CID,R                            LSWITD    854
      GOTO 100                                                          LSWITD    855
C                                                                       LSWITD    856
C   ADD LINE                                                            LSWITD    857
C                                                                       LSWITD    858
 1700 CONTINUE                                                          LSWITD    859
C   POSSIBLE TEXT:                                                      LSWITD    860
C   (ADD) NEW TRANSFORMER :XX:YY:ID R,X,ONR,PHASE                       LSWITD    861
C   (ADD) NEW LINE :XX:YY:ID R,X,C                                      LSWITD    862
C   (ADD) NEW PI LINE :XX:YY:ID R,X,R1,X1,R2,X2                         LSWITD    863
C   (ADD) NEW SECTIONAL LINE :XX:YY:ID:SID R,X,R1,X1,R2,X2              LSWITD    864
C   (ADD) TRANSIENT EXCITATION BOSSTER :XX:ID                           LSWITD    865
C   (APPLY) BRAKE :XX R                                                 LSWITD    866
C                                                                       LSWITD    867
      IF(INDEX(DWORD,'BRAKE').NE.0)THEN                                 LSWITD    868
        CODE='ZA '                                                      LSWITD    869
        GOTO 1730                                                       LSWITD    870
      ENDIF                                                             LSWITD    871
C                                                                       LSWITD    872
      IF(INDEX(DWORD,'DAMPING').NE.0) GOTO 750                          LSWITD    873
      IF(INDEX(DWORD,'TRANSFORMER').NE.0) CODE='ATR'                    LSWITD    874
      IF(INDEX(DWORD,'LINE').NE.0) THEN                                 LSWITD    875
        CODE='ALI'                                                      LSWITD    876
        IF(INDEX(DWORD,'PI').NE.0) CODE='APL'                           LSWITD    877
        IF(INDEX(DWORD,'SECTIONAL').NE.0) CODE='ASL'                    LSWITD    878
      ENDIF                                                             LSWITD    879
      IF(INDEX(DWORD,'ADMITTANCE').NE.0) CODE='YK '                     LSWITD    880
      IF(INDEX(DWORD,'IMPEDANCE').NE.0) CODE='ZA '                      LSWITD    881
      IF(INDEX(DWORD,'TRANSIENT').NE.0 .AND.                            LSWITD    882
     *   INDEX(DWORD,' EXCITATION').NE.0)THEN                           LSWITD    883
         CODE='TEB'                                                     LSWITD    884
         GOTO 1800                                                      LSWITD    885
      ENDIF                                                             LSWITD    886
      IF(CODE.NE.'ZA '.AND.CODE.NE.'YK ') GOTO 1900                     LSWITD    887
C                                                                       LSWITD    888
 1720 I1=INDEX(DWORD,';')+1                                             LSWITD    889
      IF(I1.EQ.1)THEN                                                   LSWITD    890
         IEBK=1                                                         LSWITD    891
         MSG(1)=' *** ERROR ; IS EXPECTED BEFORE BUS# OR BUS NAME.'     LSWITD    892
         MSG(2)=LCARD                                                   LSWITD    893
         CALL PRTMSG(2)                                                 LSWITD    894
         GOTO 150                                                       LSWITD    895
      ENDIF                                                             LSWITD    896
C                                                                       LSWITD    897
      IF(KLFO.EQ.0)THEN                                                 LSWITD    898
C                                                                       LSWITD    899
        I2=I1                                                           LSWITD    900
        READ(DWORD(I1:LDWORD),*,IOSTAT=IOS) IFBUS,R,X                   LSWITD    901
        IF(IOS.NE.0)GOTO 50                                             LSWITD    902
C                                                                       LSWITD    903
      ELSE                                                              LSWITD    904
C                                                                       LSWITD    905
        NAME1=DWORD(I1:I1+11)                                           LSWITD    906
        CALL CHKBUS(NAME1,IFBUS)                                        LSWITD    907
        I2=I1+12                                                        LSWITD    908
        READ(DWORD(I2:LDWORD),*,IOSTAT=IOS) R,X                         LSWITD    909
        IF(IOS.NE.0)GOTO 50                                             LSWITD    910
C                                                                       LSWITD    911
      ENDIF                                                             LSWITD    912
C                                                                       LSWITD    913
      IBUS=0                                                            LSWITD    914
      IF(IFBUS.NE.0) IBUS=NNEW(IFBUS)                                   LSWITD    915
      IF(IBUS.EQ.0)THEN                                                 LSWITD    916
        IEBK=1                                                          LSWITD    917
        WRITE(MSG(1),7300)                                              LSWITD    918
        MSG(2)=LCARD                                                    LSWITD    919
        CALL PRTMSG(2)                                                  LSWITD    920
        CODE='   '                                                      LSWITD    921
        GOTO 150                                                        LSWITD    922
      ENDIF                                                             LSWITD    923
C                                                                       LSWITD    924
      IF (R.EQ.0.0.AND.X.EQ.0.0) THEN                                   LSWITD    925
        IEBK=1                                                          LSWITD    926
        MSG(1)=' *** ERROR - SPECIFIED PARAMETER VALUE(S) IS/ARE '//    LSWITD    927
     +         'NOT ACCEPTABLE.'                                        LSWITD    928
        MSG(2)=LCARD                                                    LSWITD    929
        CALL PRTMSG(2)                                                  LSWITD    930
        GOTO 150                                                        LSWITD    931
      ENDIF                                                             LSWITD    932
C                                                                       LSWITD    933
      MVAFLG=INDEX(DWORD(I2:LDWORD),'M')                                LSWITD    934
      IF(MVAFLG.NE.0)THEN                                               LSWITD    935
        PQ=VOLT(IBUS)                                                   LSWITD    936
        VMAG2=PP*PP+QQ*QQ                                               LSWITD    937
        PQ=VMAG2*BASPC/CMPLX(R,X)                                       LSWITD    938
        IF(CODE(1:1).EQ.'Y')PQ=1.0/PQ                                   LSWITD    939
        R=PP                                                            LSWITD    940
        X=QQ                                                            LSWITD    941
      ENDIF                                                             LSWITD    942
C                                                                       LSWITD    943
      IF(CODE.EQ.'YR ')THEN                                             LSWITD    944
        CODE='YK '                                                      LSWITD    945
        R=-R                                                            LSWITD    946
        X=-X                                                            LSWITD    947
      ENDIF                                                             LSWITD    948
C                                                                       LSWITD    949
      IF(KLFO .EQ. 0) THEN                                              LSWITD    950
        WRITE(CARD,6250) CODE,IFBUS,R,X                                 LSWITD    951
      ELSE                                                              LSWITD    952
        WRITE(CARD,6150) CODE,NAME1,R,X                                 LSWITD    953
      ENDIF                                                             LSWITD    954
C                                                                       LSWITD    955
      GOTO 100                                                          LSWITD    956
C                                                                       LSWITD    957
1730  I1=INDEX(DWORD,';')+1                                             LSWITD    958
      IF(I1.EQ.1)THEN                                                   LSWITD    959
        IEBK=1                                                          LSWITD    960
        MSG(1)=' *** ERROR ; IS EXPECTED BEFORE BUS# OR BUS NAME.'      LSWITD    961
        MSG(2)=LCARD                                                    LSWITD    962
        CALL PRTMSG(2)                                                  LSWITD    963
        GOTO 150                                                        LSWITD    964
      ENDIF                                                             LSWITD    965
C                                                                       LSWITD    966
      IF(KLFO.EQ.0)THEN                                                 LSWITD    967
C                                                                       LSWITD    968
        I2=I1                                                           LSWITD    969
        READ(DWORD(I1:LDWORD),*,IOSTAT=IOS) IFBUS,R                     LSWITD    970
        IF(IOS.NE.0)GOTO 50                                             LSWITD    971
C                                                                       LSWITD    972
      ELSE                                                              LSWITD    973
C                                                                       LSWITD    974
        NAME1=DWORD(I1:I1+11)                                           LSWITD    975
        CALL CHKBUS(NAME1,IFBUS)                                        LSWITD    976
        I2=I1+12                                                        LSWITD    977
        READ(DWORD(I2:LDWORD),*,IOSTAT=IOS) R                           LSWITD    978
        IF(IOS.NE.0)GOTO 50                                             LSWITD    979
C                                                                       LSWITD    980
      ENDIF                                                             LSWITD    981
C                                                                       LSWITD    982
      IBUS=0                                                            LSWITD    983
      IF(IFBUS.NE.0) IBUS=NNEW(IFBUS)                                   LSWITD    984
      IF(IBUS.EQ.0)THEN                                                 LSWITD    985
        IEBK=1                                                          LSWITD    986
        WRITE(MSG(1),7300)                                              LSWITD    987
        MSG(2)=LCARD                                                    LSWITD    988
        CALL PRTMSG(2)                                                  LSWITD    989
        CODE='   '                                                      LSWITD    990
        GOTO 150                                                        LSWITD    991
      ENDIF                                                             LSWITD    992
C                                                                       LSWITD    993
      IF (R.EQ.0.0) THEN                                                LSWITD    994
        IEBK=1                                                          LSWITD    995
        MSG(1)=' *** ERROR - SPECIFIED PARAMETER VALUE IS '//           LSWITD    996
     +         'NOT ACCEPTABLE.'                                        LSWITD    997
        MSG(2)=LCARD                                                    LSWITD    998
        CALL PRTMSG(2)                                                  LSWITD    999
        GOTO 150                                                        LSWITD   1000
      ENDIF                                                             LSWITD   1001
C                                                                       LSWITD   1002
      MVAFLG=INDEX(DWORD(I2:LDWORD),'M')                                LSWITD   1003
      IF(MVAFLG.NE.0)THEN                                               LSWITD   1004
        PQ=VOLT(IBUS)                                                   LSWITD   1005
        VMAG2=PP*PP+QQ*QQ                                               LSWITD   1006
        R=VMAG2*BASPC/R                                                 LSWITD   1007
      ELSEIF(INDEX(DWORD(1:I1-2),'CONDUCTANCE').NE.0)THEN               LSWITD   1008
        R=1.0/R                                                         LSWITD   1009
      ENDIF                                                             LSWITD   1010
C                                                                       LSWITD   1011
      X=0.0                                                             LSWITD   1012
      IF(KLFO .EQ. 0) THEN                                              LSWITD   1013
        WRITE(CARD,6250) CODE,IFBUS,R,X                                 LSWITD   1014
      ELSE                                                              LSWITD   1015
        WRITE(CARD,6150) CODE,NAME1,R,X                                 LSWITD   1016
      ENDIF                                                             LSWITD   1017
C                                                                       LSWITD   1018
      GOTO 100                                                          LSWITD   1019
C                                                                       LSWITD   1020
C   MODIFY                                                              LSWITD   1021
C                                                                       LSWITD   1022
 1750 CONTINUE                                                          LSWITD   1023
C                                                                       LSWITD   1024
C   POSSIBLE TEXT:                                                      LSWITD   1025
C   (MODIFY) TRANSFORMER :XX:YY:ID R,X,ONR,PHASE                        LSWITD   1026
C   (MODIFY) LINE :XX:YY:ID R,X,C                                       LSWITD   1027
C   (MODIFY) PI LINE :XX:YY:ID R,X,R1,X1,R2,X2                          LSWITD   1028
C   (MODIFY) SECTIONAL LINE :XX:YY:ID:SID R,X,R1,X1,R2,X2               LSWITD   1029
C   (MODIFY) GENERATOR FILED VOLTAGE :XX:ID                             LSWITD   1030
C   (MODIFY) SYNCHRONOUS MOTOR TORQUE/SPEED CHARACTERISTIC :XX:ID XXX   LSWITD   1031
C   (MODIFY) GENERATOR FIELD VOLTAGE :XX:ID XXX                         LSWITD   1032
C   (MODIFY) GENERATOR AVR REFERENCE :XX:ID XXX                         LSWITD   1033
C   (MODIFY) GENERATOR GOVERENOR REFERENCE :XX:ID XXX                   LSWITD   1034
C   (MODIFY) GENERATOR TMECH :XX:ID XXX                                 LSWITD   1035
C                                                                       LSWITD   1036
C                                                                       LSWITD   1037
C   ALTER                                                               LSWITD   1038
C                                                                       LSWITD   1039
C                                                                       LSWITD   1040
C   POSSIBLE TEXT:                                                      LSWITD   1041
C   (ALTER) TRANSFORMER :XX:YY:ID R,X,ONR,PHASE                         LSWITD   1042
C   (ALTER) LINE :XX:YY:ID R,X,C                                        LSWITD   1043
C   (ALTER) PI LINE :XX:YY:ID R,X,R1,X1,R2,X2                           LSWITD   1044
C   (ALTER) SECTIONAL LINE :XX:YY:ID:SID R,X,R1,X1,R2,X2                LSWITD   1045
C   (ALTER) GENERATOR FILED VOLTAGE :XX:ID                              LSWITD   1046
C   (ALTER) SYNCHRONOUS MOTOR TORQUE/SPEED CHARACTERISTIC :XX:ID XXX    LSWITD   1047
C   (ALTER) GENERATOR FIELD VOLTAGE :XX:ID XXX                          LSWITD   1048
C   (ALTER) GENERATOR AVR REFERENCE :XX:ID XXX                          LSWITD   1049
C   (ALTER) GENERATOR GOVERENOR REFERENCE :XX:ID XXX                    LSWITD   1050
C   (ALTER) GENERATOR TMECH :XX:ID XXX                                  LSWITD   1051
C                                                                       LSWITD   1052
C                                                                       LSWITD   1053
C   CHANGE                                                              LSWITD   1054
C                                                                       LSWITD   1055
C                                                                       LSWITD   1056
C   POSSIBLE TEXT:                                                      LSWITD   1057
C   (CHANGE) TRANSFORMER :XX:YY:ID R,X,ONR,PHASE                        LSWITD   1058
C   (CHANGE) LINE :XX:YY:ID R,X,C                                       LSWITD   1059
C   (CHANGE) PI LINE :XX:YY:ID R,X,R1,X1,R2,X2                          LSWITD   1060
C   (CHANGE) SECTIONAL LINE :XX:YY:ID:SID R,X,R1,X1,R2,X2               LSWITD   1061
C   (CHANGE) GENERATOR FILED VOLTAGE :XX:ID                             LSWITD   1062
C   (CHANGE) SYNCHRONOUS MOTOR TORQUE/SPEED CHARACTERISTIC :XX:ID XXX   LSWITD   1063
C   (CHANGE) GENERATOR FIELD VOLTAGE :XX:ID XXX                         LSWITD   1064
C   (CHANGE) GENERATOR AVR REFERENCE :XX:ID XXX                         LSWITD   1065
C   (CHANGE) GENERATOR GOVERENOR REFERENCE :XX:ID XXX                   LSWITD   1066
C   (CHANGE) GENERATOR TMECH :XX:ID XXX                                 LSWITD   1067
C                                                                       LSWITD   1068
      IF(INDEX(DWORD,'MECHANICAL').NE.0) CODE='PM '                     LSWITD   1069
      IF(INDEX(DWORD,'FIELD VOLTAGE').NE.0) CODE='FV '                  LSWITD   1070
      IF(INDEX(DWORD,'AVR ').NE.0) CODE='VR '                           LSWITD   1071
      IF(INDEX(DWORD,'GOVERNOR').NE.0) CODE='PR '                       LSWITD   1072
      IF(INDEX(DWORD,'TMECH').NE.0) CODE='GFD'                          LSWITD   1073
      IF(CODE.NE.'   ') GOTO 1800                                       LSWITD   1074
      IF(INDEX(DWORD,'TRANSFORMER').NE.0) CODE='MTR'                    LSWITD   1075
      IF(INDEX(DWORD,'LINE').NE.0)THEN                                  LSWITD   1076
        CODE='MLI'                                                      LSWITD   1077
        IF(INDEX(DWORD,'PI').NE.0) CODE='MPL'                           LSWITD   1078
        IF(INDEX(DWORD,'SECTIONAL').NE.0) CODE='MSL'                    LSWITD   1079
      ENDIF                                                             LSWITD   1080
C                                                                       LSWITD   1081
 1900 IF(CODE.EQ.'   ') GOTO 100                                        LSWITD   1082
      I1=INDEX(DWORD,';')                                               LSWITD   1083
      I2=I1+INDEX(DWORD(I1+1:LDWORD),';')                               LSWITD   1084
      I3=I2+INDEX(DWORD(I2+1:LDWORD),';')                               LSWITD   1085
      IF(I2.EQ.I3) GOTO 50                                              LSWITD   1086
      I4=I3+INDEX(DWORD(I3+1:LDWORD),';')                               LSWITD   1087
      I5=I4+3                                                           LSWITD   1088
C                                                                       LSWITD   1089
      IF(CODE.EQ.'ATR'.OR.CODE.EQ.'MTR')THEN                            LSWITD   1090
         READ(DWORD(I5:LDWORD+2),*,IOSTAT=IOS) R,X,R1,X1                LSWITD   1091
         IF(IOS.NE.0)GOTO 50                                            LSWITD   1092
      ELSEIF(CODE.EQ.'ALI'.OR.CODE.EQ.'MLI')THEN                        LSWITD   1093
         READ(DWORD(I5:LDWORD+2),*,IOSTAT=IOS) R,X,R1                   LSWITD   1094
         IF(IOS.NE.0)GOTO 50                                            LSWITD   1095
      ELSEIF(CODE.EQ.'APL'.OR.CODE.EQ.'MPL')THEN                        LSWITD   1096
         READ(DWORD(I5:LDWORD+2),*,IOSTAT=IOS) R,X,R1,X1,R2,X2          LSWITD   1097
         IF(IOS.NE.0)GOTO 50                                            LSWITD   1098
      ENDIF                                                             LSWITD   1099
      CID=DWORD(I4+1:LDWORD)                                            LSWITD   1100
      IF(I3.NE.I4)THEN                                                  LSWITD   1101
         SID=CID                                                        LSWITD   1102
         CID=DWORD(I3+1:I4-1)                                           LSWITD   1103
      ENDIF                                                             LSWITD   1104
      IF(KLFO.EQ.0)THEN                                                 LSWITD   1105
         READ(DWORD(I1+1:I2-1),*,IOSTAT=IOS) NLFI                       LSWITD   1106
         IF(IOS.NE.0)GOTO 50                                            LSWITD   1107
         READ(DWORD(I2+1:I3-1),*,IOSTAT=IOS) NLFJ                       LSWITD   1108
         IF(IOS.NE.0)GOTO 50                                            LSWITD   1109
      ELSE                                                              LSWITD   1110
         NAME1=DWORD(I1+1:I2-1)                                         LSWITD   1111
         NAME2=DWORD(I2+1:I3-1)                                         LSWITD   1112
         CALL CHKBUS(NAME1,NLFI)                                        LSWITD   1113
         CALL CHKBUS(NAME2,NLFJ)                                        LSWITD   1114
         IF(NLFI.EQ.0.AND.NLFJ.EQ.0)THEN                                LSWITD   1115
            IF(NADX.NE.0)THEN                                           LSWITD   1116
               DO 1910 I=1,NADX                                         LSWITD   1117
                  NEWB=NLAD(NADX)                                       LSWITD   1118
                  NEWB3=NEWB*3                                          LSWITD   1119
                  INAME1(1)=INAME(NEWB3-2)                              LSWITD   1120
                  INAME1(2)=INAME(NEWB3-1)                              LSWITD   1121
                  INAME1(3)=INAME(NEWB)                                 LSWITD   1122
                  IF(BNAME1.EQ.NAME1)NLFI=NOLD(NEWB)                    LSWITD   1123
                  IF(BNAME1.EQ.NAME2)NLFJ=NOLD(NEWB)                    LSWITD   1124
 1910          CONTINUE                                                 LSWITD   1125
               IF(NLFI.EQ.0 .AND. NLFJ.EQ.0)THEN                        LSWITD   1126
                  IEBK=1                                                LSWITD   1127
                  WRITE(MSG(1),7350) NAME1,NAME2                        LSWITD   1128
                  MSG(2)=LCARD                                          LSWITD   1129
                  CALL PRTMSG(2)                                        LSWITD   1130
               ENDIF                                                    LSWITD   1131
            ELSE                                                        LSWITD   1132
               WRITE(MSG(1),7350) NAME1,NAME2                           LSWITD   1133
               MSG(2)=LCARD                                             LSWITD   1134
               CALL PRTMSG(2)                                           LSWITD   1135
            ENDIF                                                       LSWITD   1136
         ENDIF                                                          LSWITD   1137
      ENDIF                                                             LSWITD   1138
C                                                                       LSWITD   1139
      IF(NLFI.NE.0)THEN                                                 LSWITD   1140
         NPBNOI=NNEW(NLFI)                                              LSWITD   1141
      ELSE                                                              LSWITD   1142
         LBUSNO=LBUSNO+1                                                LSWITD   1143
         NLFI=LBUSNO                                                    LSWITD   1144
         NPBNOI=0                                                       LSWITD   1145
      ENDIF                                                             LSWITD   1146
C                                                                       LSWITD   1147
      IF(NLFJ.NE.0)THEN                                                 LSWITD   1148
         NPBNOJ=NNEW(NLFJ)                                              LSWITD   1149
      ELSE                                                              LSWITD   1150
         LBUSNO=LBUSNO+1                                                LSWITD   1151
         NLFJ=LBUSNO                                                    LSWITD   1152
         NPBNOJ=0                                                       LSWITD   1153
      ENDIF                                                             LSWITD   1154
C                                                                       LSWITD   1155
      IF(NPBNOI.GT.0.AND.NPBNOJ.GT.0)THEN                               LSWITD   1156
         CALL LOLINE(NPBNOI,NPBNOJ,CID,JNL)                             LSWITD   1157
      ELSE                                                              LSWITD   1158
         JNL=0                                                          LSWITD   1159
      ENDIF                                                             LSWITD   1160
C                                                                       LSWITD   1161
      IF(CODE(1:1).EQ.'A')THEN                                          LSWITD   1162
         IF(JNL.NE.0)THEN                                               LSWITD   1163
            IEBK=1                                                      LSWITD   1164
            WRITE(MSG(1),5100)                                          LSWITD   1165
            WRITE(MSG(2),5101)                                          LSWITD   1166
            MSG(3)=LCARD                                                LSWITD   1167
            CALL PRTMSG(3)                                              LSWITD   1168
            CODE='   '                                                  LSWITD   1169
            GOTO 150                                                    LSWITD   1170
         ENDIF                                                          LSWITD   1171
         GMAG=R*R+X*X                                                   LSWITD   1172
         IF(GMAG.LT.1.0E-6)THEN                                         LSWITD   1173
            IEBK=1                                                      LSWITD   1174
            WRITE(MSG(1),6100)                                          LSWITD   1175
            MSG(2)=LCARD                                                LSWITD   1176
            CALL PRTMSG(2)                                              LSWITD   1177
            CODE='   '                                                  LSWITD   1178
            GOTO 150                                                    LSWITD   1179
         ENDIF                                                          LSWITD   1180
C                                                                       LSWITD   1181
C   CHECK IF FROM AND TO BUS EXIST                                      LSWITD   1182
C                                                                       LSWITD   1183
      IF(NPBNOI.EQ.0)THEN                                               LSWITD   1184
        NADX=NADX+1                                                     LSWITD   1185
        LLBUS=LLBUS+1                                                   LSWITD   1186
        IADBUS=LLBUS*3                                                  LSWITD   1187
        NOLD(LLBUS)=NLFI                                                LSWITD   1188
        NNEW(NLFI)=LLBUS                                                LSWITD   1189
        NPBNOI=LLBUS                                                    LSWITD   1190
        NLAD(NADX)=LLBUS                                                LSWITD   1191
C                                                                       LSWITD   1192
       IF(KLFO .NE. 0)THEN                                              LSWITD   1193
        BNAME1=NAME1                                                    LSWITD   1194
        INAME(IADBUS-2)=INAME1(1)                                       LSWITD   1195
        INAME(IADBUS-1)=INAME1(2)                                       LSWITD   1196
        INAME(IADBUS)=INAME1(3)                                         LSWITD   1197
       ELSE                                                             LSWITD   1198
        INAME(IADBUS-2)=IADD1                                           LSWITD   1199
        INAME(IADBUS-1)=IADD2                                           LSWITD   1200
        INAME(IADBUS)=IADD3(NADX)                                       LSWITD   1201
       ENDIF                                                            LSWITD   1202
C                                                                       LSWITD   1203
      ENDIF                                                             LSWITD   1204
C                                                                       LSWITD   1205
      IF(NPBNOJ.EQ.0)THEN                                               LSWITD   1206
        NADX=NADX+1                                                     LSWITD   1207
        LLBUS=LLBUS+1                                                   LSWITD   1208
        IADBUS=LLBUS*3                                                  LSWITD   1209
        NOLD(LLBUS)=NLFJ                                                LSWITD   1210
        NNEW(NLFJ)=LLBUS                                                LSWITD   1211
        NPBNOJ=LLBUS                                                    LSWITD   1212
        NLAD(NADX)=LLBUS                                                LSWITD   1213
C                                                                       LSWITD   1214
       IF(KLFO .NE. 0)THEN                                              LSWITD   1215
        BNAME2=NAME2                                                    LSWITD   1216
        INAME(IADBUS-2)=INAME2(1)                                       LSWITD   1217
        INAME(IADBUS-1)=INAME2(2)                                       LSWITD   1218
        INAME(IADBUS)=INAME2(3)                                         LSWITD   1219
       ELSE                                                             LSWITD   1220
        INAME(IADBUS-2)=IADD1                                           LSWITD   1221
        INAME(IADBUS-1)=IADD2                                           LSWITD   1222
        INAME(IADBUS)=IADD3(NADX)                                       LSWITD   1223
       ENDIF                                                            LSWITD   1224
      ENDIF                                                             LSWITD   1225
C                                                                       LSWITD   1226
      ELSEIF(CODE(1:1).NE.'A'.AND.JNL.EQ.0)THEN                         LSWITD   1227
         IEBK=1                                                         LSWITD   1228
         WRITE(MSG(1),6850)                                             LSWITD   1229
         MSG(2)=LCARD                                                   LSWITD   1230
         CALL PRTMSG(2)                                                 LSWITD   1231
         CODE='   '                                                     LSWITD   1232
         GOTO 150                                                       LSWITD   1233
      ENDIF                                                             LSWITD   1234
      AWV1(1)=FMTOUT(R)                                                 LSWITD   1235
      AWV1(2)=FMTOUT(X)                                                 LSWITD   1236
      AWV1(3)=FMTOUT(R1)                                                LSWITD   1237
      AWV1(4)=FMTOUT(X1)                                                LSWITD   1238
      AWV1(5)=FMTOUT(R2)                                                LSWITD   1239
      AWV1(6)=FMTOUT(X2)                                                LSWITD   1240
      WRITE(CARD,5060) CODE,NLFI,NLFJ,CID,SID,(AWV1(I)(1:10),I=1,6)     LSWITD   1241
      GOTO 100                                                          LSWITD   1242
C                                                                       LSWITD   1243
C   RESTORE                                                             LSWITD   1244
C                                                                       LSWITD   1245
 2150 CONTINUE                                                          LSWITD   1246
C                                                                       LSWITD   1247
C   POSSIBLE TEXT                                                       LSWITD   1248
C   (RESTORE) LOAD AT BUS#/BUSNAME ISHUNTR,ISHUNTX PPPP QQQQ            LSWITD   1249
C   (RESTORE) TRANSFORMER :XX:YY:ID                                     LSWITD   1250
C   (RESTORE) LINE :XX:YY:ID                                            LSWITD   1251
C   (RESTORE) PI LINE :XX:YY:ID                                         LSWITD   1252
C   (RESTORE) SECTIONAL LINE :XX:YY:ID:SID                              LSWITD   1253
C   (RESTORE) STABILIZER :XX:ID                                         LSWITD   1254
C   (RESTORE) INDUCTION MOTOR :XX:ID                                    LSWITD   1255
C                                                                       LSWITD   1256
C                                                                       LSWITD   1257
C     RECONNECT                                                         LSWITD   1258
C                                                                       LSWITD   1259
C                                                                       LSWITD   1260
C   POSSIBLE TEXT:                                                      LSWITD   1261
C   (RECONNECT) TRANSFORMER :XX:YY:ID                                   LSWITD   1262
C   (RECONNECT) LINE :XX:YY:ID                                          LSWITD   1263
C   (RECONNECT) PI LINE :XX:YY:ID                                       LSWITD   1264
C   (RECONNECT) SECTIONAL LINE :XX:YY:ID:SID                            LSWITD   1265
C   (RECONNECT) STABILIZER :XX:ID                                       LSWITD   1266
C   (RECONNECT) INDUCTION MOTOR :XX:ID                                  LSWITD   1267
C                                                                       LSWITD   1268
      IF(INDEX(DWORD,'LINE').NE.0) THEN                                 LSWITD   1269
         CODE='RLI'                                                     LSWITD   1270
         IF(INDEX(DWORD,'PI').NE.0) CODE='RPL'                          LSWITD   1271
         IF(INDEX(DWORD,'SECTIONAL').NE.0) CODE='RSL'                   LSWITD   1272
      ENDIF                                                             LSWITD   1273
      IF(INDEX(DWORD,'TRANSFORMER').NE.0) CODE='RTR'                    LSWITD   1274
C      IF(INDEX(DWORD,'INDUCTION').NE.0 .AND.                           LSWITD   1275
C     *   INDEX(DWORD,' MOTOR').NE.0) THEN                              LSWITD   1276
C         CODE='RIM'                                                    LSWITD   1277
C         GOTO 2300                                                     LSWITD   1278
C      ENDIF                                                            LSWITD   1279
      IF(INDEX(DWORD,'LOAD').EQ.0) GOTO 1900                            LSWITD   1280
      CODE='RLD'                                                        LSWITD   1281
      GOTO 2300                                                         LSWITD   1282
C                                                                       LSWITD   1283
 2250 CODE='SLD'                                                        LSWITD   1284
 2300 I1=INDEX(DWORD,';')+1                                             LSWITD   1285
      IF(I1.EQ.1) GOTO 50                                               LSWITD   1286
      IF(KLFO.EQ.0)THEN                                                 LSWITD   1287
         READ(DWORD(I1:LDWORD),*,IOSTAT=IOS) IFBUS,IS,R,X               LSWITD   1288
         IF(IOS.NE.0)GOTO 50                                            LSWITD   1289
      ELSE                                                              LSWITD   1290
         NAME1=DWORD(I1:LDWORD)                                         LSWITD   1291
         CALL CHKBUS(NAME1,IFBUS)                                       LSWITD   1292
         READ(DWORD(I1+12:LDWORD),*,IOSTAT=IOS) IS,R,X                  LSWITD   1293
         IF(IOS.NE.0)GOTO 50                                            LSWITD   1294
      ENDIF                                                             LSWITD   1295
      IF(IFBUS.NE.0) IFBUS=NNEW(IFBUS)                                  LSWITD   1296
C                                                                       LSWITD   1297
C      IF(IFBUS.EQ.0.OR.(IFBUS.GT.ICNODX.AND.CODE.NE.'RIM'))THEN        LSWITD   1298
C         IF(CODE.EQ.'RIM')THEN                                         LSWITD   1299
C           IF(NTHM(2,IFBUS).EQ.0)THEN                                  LSWITD   1300
C              WRITE(MSG(1),5900)                                       LSWITD   1301
C           ELSE                                                        LSWITD   1302
C             WRITE(MSG(1),5850)                                        LSWITD   1303
C           ENDIF                                                       LSWITD   1304
C         ELSE                                                          LSWITD   1305
C            WRITE(MSG(1),7300)                                         LSWITD   1306
C         ENDIF                                                         LSWITD   1307
C      ENDIF                                                            LSWITD   1308
      IF(IFBUS.EQ.0)THEN                                                LSWITD   1309
         IEBK=1                                                         LSWITD   1310
         WRITE(MSG(1),7300)                                             LSWITD   1311
         MSG(2)=LCARD                                                   LSWITD   1312
         CALL PRTMSG(2)                                                 LSWITD   1313
         CODE='   '                                                     LSWITD   1314
         GOTO 150                                                       LSWITD   1315
      ELSE                                                              LSWITD   1316
         WRITE(CARD,5350) CODE,IFBUS,IS,R,X                             LSWITD   1317
      ENDIF                                                             LSWITD   1318
      GOTO 100                                                          LSWITD   1319
C                                                                       LSWITD   1320
C     REPORT                                                            LSWITD   1321
C                                                                       LSWITD   1322
 2340 CONTINUE                                                          LSWITD   1323
C                                                                       LSWITD   1324
C     PRINT                                                             LSWITD   1325
C                                                                       LSWITD   1326
 2350 CONTINUE                                                          LSWITD   1327
C                                                                       LSWITD   1328
C     POSSIBLE TEXT                                                     LSWITD   1329
C      (PRINT) EVERY XXX INTERVAL/SETP/                                 LSWITD   1330
C                                                                       LSWITD   1331
 2400 CONTINUE                                                          LSWITD   1332
      I1=INDEX(DWORD,'EVERY')+5                                         LSWITD   1333
      IF(I1.EQ.5) I1=1                                                  LSWITD   1334
      IF(IFKEYW.EQ.32) THEN                                             LSWITD   1335
        READ(DWORD(I1:LDWORD),*,IOSTAT=IOS) IREPRT                      LSWITD   1336
        IF(IOS.NE.0)GOTO 50                                             LSWITD   1337
      ENDIF                                                             LSWITD   1338
      IF(IFKEYW.EQ.24) THEN                                             LSWITD   1339
        READ(DWORD(I1:LDWORD),*,IOSTAT=IOS) IPRINT                      LSWITD   1340
        IF(IOS.NE.0)GOTO 50                                             LSWITD   1341
      ENDIF                                                             LSWITD   1342
      IF(IFKEYW.EQ.25) THEN                                             LSWITD   1343
        READ(DWORD(I1:LDWORD),*,IOSTAT=IOS) IPLOT                       LSWITD   1344
        IF(IOS.NE.0)GOTO 50                                             LSWITD   1345
      ENDIF                                                             LSWITD   1346
      GOTO 150                                                          LSWITD   1347
C                                                                       LSWITD   1348
C     MOTOr INTERVAL                                                    LSWITD   1349
C                                                                       LSWITD   1350
 2410 CONTINUE                                                          LSWITD   1351
      I1=INDEX(DWORD,'INTERVAL')+8                                      LSWITD   1352
      IF(I1.EQ.8) I1=1                                                  LSWITD   1353
      READ(DWORD(I1:LDWORD),*,IOSTAT=IOS) IMT                           LSWITD   1354
      IF(IOS.NE.0)GOTO 50                                               LSWITD   1355
      GOTO 150                                                          LSWITD   1356
C                                                                       LSWITD   1357
C     REDUCE LOAD BUS                                                   LSWITD   1358
C                                                                       LSWITD   1359
 2450 CONTINUE                                                          LSWITD   1360
C                                                                       LSWITD   1361
C     POSSIBLE TEXT                                                     LSWITD   1362
C     (REDUCE) LOAD BUS                                                 LSWITD   1363
C     (REDUCE) GENERATION :XX:ID FACT                                   LSWITD   1364
C     (REDUCE) GENERATOR TMECH :XX:ID TMECH                             LSWITD   1365
C                                                                       LSWITD   1366
      IF(INDEX(DWORD,'TMECH').NE.0) GOTO 1750                           LSWITD   1367
      IF(INDEX(DWORD,'GENERATION').NE.0)THEN                            LSWITD   1368
         CODE='GM '                                                     LSWITD   1369
         GOTO 1800                                                      LSWITD   1370
      ENDIF                                                             LSWITD   1371
      IREDL=1                                                           LSWITD   1372
C                                                                       LSWITD   1373
      GOTO 150                                                          LSWITD   1374
C                                                                       LSWITD   1375
C 2500 CONTINUE                                                         LSWITD   1376
C      IEBK=1                                                           LSWITD   1377
C      WRITE(MSG(1),'(A)') CARD                                         LSWITD   1378
C      STOP 'SWITCH FILE ERROR'                                         LSWITD   1379
C                                                                       LSWITD   1380
C      MATCHING THE SECOND AND SEQUENT KEY WORDS                        LSWITD   1381
C                                                                       LSWITD   1382
C                                                                       LSWITD   1383
C   END                                                                 LSWITD   1384
C                                                                       LSWITD   1385
C   NOMORE                                                              LSWITD   1386
C                                                                       LSWITD   1387
 2600 CONTINUE                                                          LSWITD   1388
      TC=88889.                                                         LSWITD   1389
      IF(STIME(NSTIME+1).LT.TC) GOTO 500                                LSWITD   1390
C                                                                       LSWITD   1391
C=                                                                      LSWITD   1392
C=   PREPARE THE SWICHING FILE:                                         LSWITD   1393
C=                                                                      LSWITD   1394
C=     (1) READ THE SWICHING INPUT DATA                                 LSWITD   1395
C=     (2) CHECK WHETHER THIS SWICHING CAN BE APPLIED, I.E., WHETHER    LSWITD   1396
C=         THE DEVICE CONCERNED THE SWICHING EXISTS                     LSWITD   1397
C=     (3) INTERNALLY FIND THE NECESSARY INFORMATION BASED ON THE INPUT LSWITD   1398
C=         AND WRITE IT (ONE RECORD) INTO UNIT=ISWF(11)                 LSWITD   1399
C=                                                                      LSWITD   1400
C                                                                       LSWITD   1401
 2650 LDEB=(JDEB(24).NE.0)                                              LSWITD   1402
C                                                                       LSWITD   1403
C                                                                       LSWITD   1404
C    RESTORE THE LOAD FLOW NETWORK AND LINE STATUS                      LSWITD   1405
C    AND UPDATE ACCORDINGLY                                             LSWITD   1406
C                                                                       LSWITD   1407
      SUBPMT=' LSWITD'                                                  LSWITD   1408
C                                                                       LSWITD   1409
      IF(IENTER)THEN                                                    LSWITD   1410
      REWIND IU3                                                        LSWITD   1411
      READ(IU3) NL,ITRF,NLFBUS                                          LSWITD   1412
      CALL FLWR(IU3,1,NL*5,GBFT)                                        LSWITD   1413
      CALL IFWR(IU3,1,NXTR,ITRAN)                                       LSWITD   1414
      IF(ITRF.NE.0)CALL FLWR(IU3,1,ITRF*2,TRANS)                        LSWITD   1415
      CALL IHWR(IU3,1,NL,LTRANC)                                        LSWITD   1416
C                                                                       LSWITD   1417
C      RESTORE AND UPDATE THE PI-LINE DATA                              LSWITD   1418
C                                                                       LSWITD   1419
      IF(NSEL .NE.0)THEN                                                LSWITD   1420
      READ(IU3)NSEL                                                     LSWITD   1421
      CALL FLWR(IU3,1,18*NSEL,EQPI)                                     LSWITD   1422
      CALL FLWR(IU3,1,24*NSEL,PSELIN)                                   LSWITD   1423
      CALL IHWR(IU3,1,6*NSEL,LCONE)                                     LSWITD   1424
      CALL IHWR(IU3,1,12*NSEL,NEXTSL)                                   LSWITD   1425
      ENDIF                                                             LSWITD   1426
C                                                                       LSWITD   1427
C       RESTORE THE ORIGINAL LINE MONITOR                               LSWITD   1428
C                                                                       LSWITD   1429
      READ(IU3)KNET                                                     LSWITD   1430
      CALL IFWR(IU3,1,KNET*2,LINEPO)                                    LSWITD   1431
      CALL IFWR(IU3,1,KNET,IARCCT)                                      LSWITD   1432
      CALL IFWR(IU3,1,NL,LISMON)                                        LSWITD   1433
C                                                                       LSWITD   1434
      IF(NADX.NE.0)THEN                                                 LSWITD   1435
      DO 2700 I=1,NADX                                                  LSWITD   1436
      NLFI=NLAD(NADX)                                                   LSWITD   1437
      NNEW(NLFI)=0                                                      LSWITD   1438
      LPAD(NADX)=0                                                      LSWITD   1439
      NLAD(NADX)=0                                                      LSWITD   1440
 2700 CONTINUE                                                          LSWITD   1441
      NADX=0                                                            LSWITD   1442
      ENDIF                                                             LSWITD   1443
C                                                                       LSWITD   1444
      IENTER=.TRUE.                                                     LSWITD   1445
C                                                                       LSWITD   1446
      ENDIF                                                             LSWITD   1447
C                                                                       LSWITD   1448
C                                                                       LSWITD   1449
      LLBUS=NLFBUS                                                      LSWITD   1450
      NXL=NL                                                            LSWITD   1451
      NSELL=NSEL                                                        LSWITD   1452
C                                                                       LSWITD   1453
      IPSWIT=0                                                          LSWITD   1454
      SXREAL=0.0                                                        LSWITD   1455
      SXIMAG=0.0                                                        LSWITD   1456
      SVMG=0.0                                                          LSWITD   1457
      SVPHS=0.0                                                         LSWITD   1458
      TRCLSE=0.0                                                        LSWITD   1459
      CALL MOVE(0,JFAULT,JFAULT,6)                                      LSWITD   1460
C                                                                       LSWITD   1461
C   READ IN SWITCHING DECK AND WRITE THE DECK ON ISWF(11)               LSWITD   1462
C                                                                       LSWITD   1463
      ISWF=IU11                                                         LSWITD   1464
      REWIND ISWF                                                       LSWITD   1465
      ITRFX=ITRF                                                        LSWITD   1466
      NADX=0                                                            LSWITD   1467
      ISCA=0                                                            LSWITD   1468
C                                                                       LSWITD   1469
C   CREATE THE SWITCHING FILE AS DOCUMENTED IN THE MANUAL               LSWITD   1470
C                                                                       LSWITD   1471
      ISCA=ISCA+1                                                       LSWITD   1472
      WRITE (ISWF,4800) (ISWTEX(I),I=1,20)                              LSWITD   1473
      IREDL=IREDLB(1)                                                   LSWITD   1474
      ISCA=ISCA+1                                                       LSWITD   1475
      WRITE (ISWF,4850)TL,HN,IREDL                                      LSWITD   1476
C                                                                       LSWITD   1477
      IF (TL.LT.1.E-6)GOTO 4650                                         LSWITD   1478
C                                                                       LSWITD   1479
C                                                                       LSWITD   1480
      IFAULT=0                                                          LSWITD   1481
      JZEROP=0                                                          LSWITD   1482
      AFAULT='            '                                             LSWITD   1483
      ZEROP='            '                                              LSWITD   1484
      IDC=0                                                             LSWITD   1485
      IMT=0                                                             LSWITD   1486
      IMTH=11                                                           LSWITD   1487
      STEPS=0.01                                                        LSWITD   1488
      IREPRT=1                                                          LSWITD   1489
      IPRINT=1                                                          LSWITD   1490
      IPLOT=1                                                           LSWITD   1491
C                                   BUFFERS FOR THREE PHASE LINE FAULT  LSWITD   1492
      FRSHNT=' '                                                        LSWITD   1493
      TOSHNT=' '                                                        LSWITD   1494
C                                                                       LSWITD   1495
      DO 4600 J=1,NSTIME                                                LSWITD   1496
C                                                                       LSWITD   1497
C        FLAG TO INDICATE WHETHER ESC CARD MUST BE MODIFIED TO          LSWITD   1498
C        INDICATE FAULT CLEARING AFTER FAR AND NEAR END CLEARING        LSWITD   1499
C        OF A THREE PHASE LINE FAULT.                                   LSWITD   1500
C                                                                       LSWITD   1501
      ESCMOD=.FALSE.                                                    LSWITD   1502
C                                                                       LSWITD   1503
      IFIRST=ISCARD(J)                                                  LSWITD   1504
      ILAST=JECARD(J)                                                   LSWITD   1505
C                                                                       LSWITD   1506
      DO 4600 K=IFIRST,ILAST                                            LSWITD   1507
      READ(IU31,REC=K) CARD                                             LSWITD   1508
      READ (CARD,4900) ITYP                                             LSWITD   1509
C                                               THREE PHASE LINE FAULT  LSWITD   1510
      IF(ITYP.EQ.'LF3')THEN                                             LSWITD   1511
C                                    ENSURE THAT THE LINE IS CONNECTED  LSWITD   1512
        READ(CARD,4910)CODE,NLFI,NLFJ,CID,DISTR                         LSWITD   1513
        NPBNOI=NNEW(NLFI)                                               LSWITD   1514
        NPBNOJ=NNEW(NLFJ)                                               LSWITD   1515
        CALL LOLINE(NPBNOI,NPBNOJ,CID,JNL)                              LSWITD   1516
        JNL1=IABS(JNL)                                                  LSWITD   1517
        ITFK=LISMON(JNL1)                                               LSWITD   1518
        CALL UPACKI(LSTATU,NMLINE,ITFK)                                 LSWITD   1519
        IF(LSTATU.EQ.1)THEN                                             LSWITD   1520
          IEBK=1                                                        LSWITD   1521
          IF(KLFO.EQ.0)THEN                                             LSWITD   1522
            WRITE(MSG(1),8000)NLFI,NLFJ,CID                             LSWITD   1523
            WRITE(MSG(2),8100)                                          LSWITD   1524
          ELSE                                                          LSWITD   1525
            NBI3=NPBNOI*3                                               LSWITD   1526
            NBJ3=NPBNOJ*3                                               LSWITD   1527
            WRITE(MSG(1),8200) INAME(NBI3-2),INAME(NBI3-1),INAME(NBI3)  LSWITD   1528
     *         ,INAME(NBJ3-2),INAME(NBJ3-1),INAME(NBJ3),CID             LSWITD   1529
            WRITE(MSG(2),8100)                                          LSWITD   1530
          ENDIF                                                         LSWITD   1531
          CALL PRTMSG(2)                                                LSWITD   1532
          GOTO 4600                                                     LSWITD   1533
        ENDIF                                                           LSWITD   1534
C                                                  GET LINE PARAMETERS  LSWITD   1535
        JNL5=JNL1*5                                                     LSWITD   1536
        ITFK=LFTB(JNL5-4)                                               LSWITD   1537
        CALL UNPACK(CKK,NJSELI,ITFK)                                    LSWITD   1538
        IF(NJSELI.EQ.0)THEN                                             LSWITD   1539
          GIJ=GA(JNL5-2)                                                LSWITD   1540
          BIJ=-BA(JNL5-1)                                               LSWITD   1541
          GII=0.0                                                       LSWITD   1542
          BII=BCHG(JNL5)/2.0                                            LSWITD   1543
          GJJ=0.0                                                       LSWITD   1544
          BJJ=BCHG(JNL5)/2.0                                            LSWITD   1545
          ITYP='DPL'                                                    LSWITD   1546
        ELSE                                                            LSWITD   1547
          GIJ=EQPI(1,NJSELI)                                            LSWITD   1548
          BIJ=-EQPI(2,NJSELI)                                           LSWITD   1549
          GII=EQPI(3,NJSELI)                                            LSWITD   1550
          BII=EQPI(4,NJSELI)                                            LSWITD   1551
          GJJ=EQPI(5,NJSELI)                                            LSWITD   1552
          BJJ=EQPI(6,NJSELI)                                            LSWITD   1553
          ITYP='DLI'                                                    LSWITD   1554
        ENDIF                                                           LSWITD   1555
C                                 COMPUTE FR AND TO SHUNTS TO BE ADDED  LSWITD   1556
        DISTR=DISTR/100.0                                               LSWITD   1557
        DMAG=GIJ*GIJ+BIJ*BIJ                                            LSWITD   1558
        RSER=GIJ/DMAG                                                   LSWITD   1559
        XSER=-BIJ/DMAG                                                  LSWITD   1560
        DMAG=(RSER*RSER+XSER*XSER)*DISTR                                LSWITD   1561
        GIITL=GII+RSER/DMAG                                             LSWITD   1562
        BIITL=BII-XSER/DMAG                                             LSWITD   1563
        DMAG=(RSER*RSER+XSER*XSER)*(1.0-DISTR)                          LSWITD   1564
        GJJTL=GJJ+RSER/DMAG                                             LSWITD   1565
        BJJTL=BJJ-XSER/DMAG                                             LSWITD   1566
C                                                                       LSWITD   1567
        IF(GIITL.LT.-2000.0)GIITL=-2000.0                               LSWITD   1568
        IF(GIITL.GT.2000.0)GIITL=2000.0                                 LSWITD   1569
        IF(GJJTL.LT.-2000.0)GJJTL=-2000.0                               LSWITD   1570
        IF(GJJTL.GT.2000.0)GJJTL=2000.0                                 LSWITD   1571
        IF(BIITL.LT.-2000.0)BIITL=-2000.0                               LSWITD   1572
        IF(BIITL.GT.2000.0)BIITL=2000.0                                 LSWITD   1573
        IF(BJJTL.LT.-2000.0)BJJTL=-2000.0                               LSWITD   1574
        IF(BJJTL.GT.2000.0)BJJTL=2000.0                                 LSWITD   1575
C                                                       ADD THE SHUNTS  LSWITD   1576
        CODE='YK '                                                      LSWITD   1577
        ISCA=ISCA+1                                                     LSWITD   1578
        WRITE(FRSHNT,6260)CODE,NPBNOI,GIITL,BIITL                       LSWITD   1579
        WRITE(ISWF,6260)CODE,NPBNOI,GIITL,BIITL                         LSWITD   1580
        ISCA=ISCA+1                                                     LSWITD   1581
        WRITE(TOSHNT,6260)CODE,NPBNOJ,GJJTL,BJJTL                       LSWITD   1582
        WRITE(ISWF,6260)CODE,NPBNOJ,GJJTL,BJJTL                         LSWITD   1583
C                                                  DISCONNECT THE LINE  LSWITD   1584
        CALL PACKII(1,NMLINE,ITFK)                                      LSWITD   1585
        LISMON(JNL1)=ITFK                                               LSWITD   1586
        BIJ=-BIJ                                                        LSWITD   1587
        IF(JNL.LT.0)THEN                                                LSWITD   1588
          NLFI=NPBNOJ                                                   LSWITD   1589
          NLFJ=NPBNOI                                                   LSWITD   1590
        ELSE                                                            LSWITD   1591
          NLFI=NPBNOI                                                   LSWITD   1592
          NLFJ=NPBNOJ                                                   LSWITD   1593
        ENDIF                                                           LSWITD   1594
        SID=' '                                                         LSWITD   1595
        TRCLSE=0.0                                                      LSWITD   1596
        AWV1(1)=FMTOUT(GIJ)                                             LSWITD   1597
        AWV1(2)=FMTOUT(BIJ)                                             LSWITD   1598
        AWV1(3)=FMTOUT(GII)                                             LSWITD   1599
        AWV1(4)=FMTOUT(BII)                                             LSWITD   1600
        AWV1(5)=FMTOUT(GJJ)                                             LSWITD   1601
        AWV1(6)=FMTOUT(BJJ)                                             LSWITD   1602
        AWV1(7)=FMTOUT(TRCLSE)                                          LSWITD   1603
        ISCA=ISCA+1                                                     LSWITD   1604
        WRITE(ISWF,5060)ITYP,NLFI,NLFJ,CID,SID,(AWV1(I)(1:10),I=1,6),   LSWITD   1605
     +                  NMLINE,NJSELI,AWV1(7)(1:10)                     LSWITD   1606
        GOTO 4600                                                       LSWITD   1607
C                             CLEAR THREE PHASE LINE FAULT AT NEAR END  LSWITD   1608
      ELSEIF(ITYP.EQ.'CFN')THEN                                         LSWITD   1609
C              ENSURE THAT THE FAULT EXISTS AND REMOVE SHUNT AT FR END  LSWITD   1610
        IF(FRSHNT.NE.' ')THEN                                           LSWITD   1611
          READ(FRSHNT,6260)CODE,NPBNOI,GIITL,BIITL                      LSWITD   1612
          GIITL=-GIITL                                                  LSWITD   1613
          BIITL=-BIITL                                                  LSWITD   1614
          ISCA=ISCA+1                                                   LSWITD   1615
          WRITE(ISWF,6260)CODE,NPBNOI,GIITL,BIITL                       LSWITD   1616
          ESCMOD=.TRUE.                                                 LSWITD   1617
          FRSHNT=' '                                                    LSWITD   1618
        ELSE                                                            LSWITD   1619
          IEBK=1                                                        LSWITD   1620
          MSG(1)=' *** ERROR CLEARING THREE PHASE LINE FAULT AT '//     LSWITD   1621
     +           'NEAR END.'                                            LSWITD   1622
          MSG(2)=' FAULT DOES NOT EXIST.'                               LSWITD   1623
          CALL PRTMSG(2)                                                LSWITD   1624
        ENDIF                                                           LSWITD   1625
        GOTO 4600                                                       LSWITD   1626
C                              CLEAR THREE PHASE LINE FAULT AT FAR END  LSWITD   1627
      ELSEIF(ITYP.EQ.'CFF')THEN                                         LSWITD   1628
C              ENSURE THAT THE FAULT EXISTS AND REMOVE SHUNT AT TO END  LSWITD   1629
        IF(TOSHNT.NE.' ')THEN                                           LSWITD   1630
          READ(TOSHNT,6260)CODE,NPBNOJ,GJJTL,BJJTL                      LSWITD   1631
          GJJTL=-GJJTL                                                  LSWITD   1632
          BJJTL=-BJJTL                                                  LSWITD   1633
          ISCA=ISCA+1                                                   LSWITD   1634
          WRITE(ISWF,6260)CODE,NPBNOJ,GJJTL,BJJTL                       LSWITD   1635
          ESCMOD=.TRUE.                                                 LSWITD   1636
          TOSHNT=' '                                                    LSWITD   1637
        ELSE                                                            LSWITD   1638
          IEBK=1                                                        LSWITD   1639
          MSG(1)=' *** ERROR CLEARING THREE PHASE LINE FAULT AT '//     LSWITD   1640
     +           'FAR END.'                                             LSWITD   1641
          MSG(2)=' FAULT DOES NOT EXIST.'                               LSWITD   1642
          CALL PRTMSG(2)                                                LSWITD   1643
        ENDIF                                                           LSWITD   1644
        GOTO 4600                                                       LSWITD   1645
C                            CLEAR THREE PHASE LINE FAULT AT BOTH ENDS  LSWITD   1646
      ELSEIF(ITYP.EQ.'CLF')THEN                                         LSWITD   1647
C                                         ENSURE THAT THE FAULT EXISTS  LSWITD   1648
C                                  AND REMOVE SHUNTS AT FR AND TO ENDS  LSWITD   1649
        IF(FRSHNT.EQ.' '.AND.TOSHNT.EQ.' ')THEN                         LSWITD   1650
          GOTO 4600                                                     LSWITD   1651
        ENDIF                                                           LSWITD   1652
        IF(FRSHNT.NE.' ')THEN                                           LSWITD   1653
          READ(FRSHNT,6260)CODE,NPBNOI,GIITL,BIITL                      LSWITD   1654
          GIITL=-GIITL                                                  LSWITD   1655
          BIITL=-BIITL                                                  LSWITD   1656
          ISCA=ISCA+1                                                   LSWITD   1657
          WRITE(ISWF,6260)CODE,NPBNOI,GIITL,BIITL                       LSWITD   1658
          FRSHNT=' '                                                    LSWITD   1659
        ENDIF                                                           LSWITD   1660
        IF(TOSHNT.NE.' ')THEN                                           LSWITD   1661
          READ(TOSHNT,6260)CODE,NPBNOJ,GJJTL,BJJTL                      LSWITD   1662
          GJJTL=-GJJTL                                                  LSWITD   1663
          BJJTL=-BJJTL                                                  LSWITD   1664
          ISCA=ISCA+1                                                   LSWITD   1665
          WRITE(ISWF,6260)CODE,NPBNOJ,GJJTL,BJJTL                       LSWITD   1666
          TOSHNT=' '                                                    LSWITD   1667
        ENDIF                                                           LSWITD   1668
        GOTO 4600                                                       LSWITD   1669
      ENDIF                                                             LSWITD   1670
C                                                                       LSWITD   1671
      DO 2750 I=1,KTYP                                                  LSWITD   1672
      IF(ITYP.EQ.ISOC(I))GOTO 2800                                      LSWITD   1673
 2750 CONTINUE                                                          LSWITD   1674
      IEBK=1                                                            LSWITD   1675
      WRITE(MSG(1),5250)                                                LSWITD   1676
      MSG(2)=CARD                                                       LSWITD   1677
      CALL PRTMSG(2)                                                    LSWITD   1678
      GOTO 4600                                                         LSWITD   1679
 2800 CONTINUE                                                          LSWITD   1680
C                                                                       LSWITD   1681
C            1    2    3    4    5    6    7    8    9   10   11        LSWITD   1682
C           ALI  ATR  APL  ABT  RLI  RTR  RPL  RBT  ASL  RSL  DLI       LSWITD   1683
      GOTO(3750,3750,3750,3750,3750,3750,3750,3750,3750,3750,3750       LSWITD   1684
C                                                                       LSWITD   1685
C       12   13   14   15   16   17   18   19   20   21   22   23       LSWITD   1686
C       DTR  DPL  DLR  DBT  DSL  MLI  MTR  MPL  MSL  RCG  FCG  ZA       LSWITD   1687
     &,3750,3750,3750,3750,3750,3750,3750,3750,3750,3750,3750,2900      LSWITD   1688
C                                                                       LSWITD   1689
C       24   25   26   27   28   29   30   31   32   33   34   35       LSWITD   1690
C       ZR   YK   LGF  LLF  LGR  LLR  SLD  RLD  TH   TO   DN   AUD      LSWITD   1691
     &,2900,2900,2900,2900,2900,2900,2950,2950,2950,2950,2950,2950      LSWITD   1692
C                                                                       LSWITD   1693
C       36   37   38   39   40   41   42   43   44   45   46   47       LSWITD   1694
C       RUD  GR   GM   GFD  PR   PM   VR   FV   OF   SR   TEB  DIM      LSWITD   1695
     &,2950,2950,2950,2950,2950,2950,2950,2950,2950,2950,2950,2950      LSWITD   1696
C                                                                       LSWITD   1697
C       48   49   50   51   52   53                                     LSWITD   1698
C       RIM  DF   DR   DI   DP   ESC                                    LSWITD   1699
     &,2950,3000,3000,3000,3000,4550),I                                 LSWITD   1700
C                                                                       LSWITD   1701
 2900 CONTINUE                                                          LSWITD   1702
C                                                                       LSWITD   1703
C   READ IN ZR,ZA,YK,LGF,LLF,LGR,LLR CARD                               LSWITD   1704
C                                                                       LSWITD   1705
      IF(KLFO.EQ.0)THEN                                                 LSWITD   1706
         READ(CARD,6250) ITYP,NLFI,XREAL,XIMAG,VMG,VPHS                 LSWITD   1707
         NNLFI=NNEW(NLFI)                                               LSWITD   1708
      ELSE                                                              LSWITD   1709
         READ(CARD,6150) ITYP,BNAME1,XREAL,XIMAG,VMG,VPHS               LSWITD   1710
         CALL CHKBUS(BNAME1,NLFI)                                       LSWITD   1711
         IF(NLFI.NE.0)THEN                                              LSWITD   1712
            NNLFI=NNEW(NLFI)                                            LSWITD   1713
         ELSE                                                           LSWITD   1714
            NNLFI=0                                                     LSWITD   1715
         ENDIF                                                          LSWITD   1716
      ENDIF                                                             LSWITD   1717
C                                                                       LSWITD   1718
C   CHECK AND STORE THE SEQUENCE IMPEDANCE                              LSWITD   1719
C                                                                       LSWITD   1720
      IF(ITYP.EQ.ISOC(26).OR.ITYP.EQ.ISOC(27))THEN                      LSWITD   1721
         JFAULT(1)=NLFI                                                 LSWITD   1722
         JFAULT(6)=1                                                    LSWITD   1723
         ZFAULT(2)=XREAL                                                LSWITD   1724
         ZFAULT(3)=XIMAG                                                LSWITD   1725
         ZFAULT(4)=VMG                                                  LSWITD   1726
         ZFAULT(5)=VPHS                                                 LSWITD   1727
      ENDIF                                                             LSWITD   1728
C                                                                       LSWITD   1729
      IF(ITYP.EQ.ISOC(28).OR.ITYP.EQ.ISOC(29))THEN                      LSWITD   1730
         NOBUS=JFAULT(1)                                                LSWITD   1731
         ISTAUS=JFAULT(6)                                               LSWITD   1732
         IF(NOBUS.EQ.NLFI.AND.ISTAUS.EQ.1)THEN                          LSWITD   1733
            XREAL=ZFAULT(2)                                             LSWITD   1734
            XIMAG=ZFAULT(3)                                             LSWITD   1735
            VMG=ZFAULT(4)                                               LSWITD   1736
            VPHS=ZFAULT(5)                                              LSWITD   1737
            JFAULT(6)=0                                                 LSWITD   1738
         ELSE                                                           LSWITD   1739
            IEBK=1                                                      LSWITD   1740
            IF(KLFO.EQ.0)THEN                                           LSWITD   1741
               WRITE(MSG(1),7250) NLFI                                  LSWITD   1742
            ELSE                                                        LSWITD   1743
               WRITE(MSG(1),7250) BNAME1                                LSWITD   1744
            ENDIF                                                       LSWITD   1745
            MSG(2)='     CHECK YOUR SWITCH DATA'                        LSWITD   1746
            CALL PRTMSG(2)                                              LSWITD   1747
            GOTO 4600                                                   LSWITD   1748
         ENDIF                                                          LSWITD   1749
      ENDIF                                                             LSWITD   1750
C                                                                       LSWITD   1751
      IF(NNLFI.EQ.0)THEN                                                LSWITD   1752
         NADX=NADX+1                                                    LSWITD   1753
         NNEW(NLFI)=-NADX                                               LSWITD   1754
         NLAD(NADX)=NLFI                                                LSWITD   1755
         NPAD(NADX)=+0                                                  LSWITD   1756
         LLBUS=LLBUS+1                                                  LSWITD   1757
         LPAD(NADX)=LLBUS                                               LSWITD   1758
      ENDIF                                                             LSWITD   1759
C                                                                       LSWITD   1760
C   ADD MORE CODE FOR LGF LGR LLF LLR*****************                  LSWITD   1761
C                                                                       LSWITD   1762
      ISCA=ISCA+1                                                       LSWITD   1763
      WRITE(ISWF,6250) ITYP,NNLFI,XREAL,XIMAG,VMG,VPHS                  LSWITD   1764
      GOTO 4600                                                         LSWITD   1765
C                                                                       LSWITD   1766
C   READ IN TH,TO AND DN CARD                                           LSWITD   1767
C                                                                       LSWITD   1768
 2950 CONTINUE                                                          LSWITD   1769
      ISCA=ISCA+1                                                       LSWITD   1770
      WRITE(ISWF,4950) CARD                                             LSWITD   1771
      GOTO 4600                                                         LSWITD   1772
 3000 CONTINUE                                                          LSWITD   1773
C                                                                       LSWITD   1774
C   READ IN DCLINK CHANGE DATA (DF,DR,DI,DP)                            LSWITD   1775
C   THESE ACTIVITIES WILL BE INCOPORATED IN FUTURE IF NEED ARISES       LSWITD   1776
C                                                                       LSWITD   1777
      IEBK=1                                                            LSWITD   1778
      WRITE(MSG(1),5450)                                                LSWITD   1779
      MSG(2)=CARD                                                       LSWITD   1780
      CALL PRTMSG(2)                                                    LSWITD   1781
      GOTO 4600                                                         LSWITD   1782
C                                                                       LSWITD   1783
C   READ IN BRANCH CHANGE                                               LSWITD   1784
C (LA,TA,LPA,LR,TR,LPR,LM,TM,LPM,LSA,LSR,LSM,RCG,FCG) CARDS             LSWITD   1785
C                                                                       LSWITD   1786
 3750 CONTINUE                                                          LSWITD   1787
C                                                                       LSWITD   1788
      READ(CARD,5050)                                                   LSWITD   1789
     &ITYP,NLFI,NLFJ,CID,SID,XREAL,XIMAG,VMG,VPHS,VMG1,VPHS1            LSWITD   1790
C                                                                       LSWITD   1791
      IF(NLFI.NE.0) NPBNOI=NNEW(NLFI)                                   LSWITD   1792
      IF(NLFJ.NE.0) NPBNOJ=NNEW(NLFJ)                                   LSWITD   1793
      IF(NPBNOI.NE.0.AND.NPBNOJ.NE.0)                                   LSWITD   1794
     *   CALL LOLINE(NPBNOI,NPBNOJ,CID,JNL)                             LSWITD   1795
      JTYP=I                                                            LSWITD   1796
C                                                                       LSWITD   1797
      NMLINE=0                                                          LSWITD   1798
      NJSELI=0                                                          LSWITD   1799
C                                                                       LSWITD   1800
C   FOR LINE AUTO RECLOSING                                             LSWITD   1801
C                                                                       LSWITD   1802
      IF(JTYP .EQ. 14)TRCLSE=XREAL                                      LSWITD   1803
C                                                                       LSWITD   1804
C            1    2    3    4    5    6    7    8    9   10   11        LSWITD   1805
C           ALI  ATR  APL  ABT  RLI  RTR  RPL  RBT  ASL  RSL  DLI       LSWITD   1806
      GOTO(3850,3850,3850,3850,3950,3950,3950,3950,4050,4100,4200       LSWITD   1807
C                                                                       LSWITD   1808
C       12   13   14   15   16   17   18   19   20   21   22            LSWITD   1809
C       DTR  DPL  DLR  DBT  DSL  MLI  MTR  MPL  MSL  RCG  FCG           LSWITD   1810
     &,4200,4200,4200,4200,4250,4000,4000,4000,4150,4300,4400),JTYP     LSWITD   1811
C                                                                       LSWITD   1812
C     ADDING NEW LINE, TRANSFORMER OR PI LINE                           LSWITD   1813
C                                                                       LSWITD   1814
 3850 CONTINUE                                                          LSWITD   1815
C                                                                       LSWITD   1816
C   BRANCH DOES NOT EXIST LA AND TA ADD LINE TO LINE AND TRANSFORMER ARRLSWITD   1817
C                                                                       LSWITD   1818
      NXL=NXL+1                                                         LSWITD   1819
      LISMON(NXL)=0                                                     LSWITD   1820
C                                                                       LSWITD   1821
C    CODE FOR ZIL SWITCHING  ( ABT )                                    LSWITD   1822
C                                                                       LSWITD   1823
      IF(JTYP.EQ.4)GOTO 3900                                            LSWITD   1824
C                                                                       LSWITD   1825
      GMAG=XREAL**2+XIMAG**2                                            LSWITD   1826
      XREAL=XREAL/GMAG                                                  LSWITD   1827
      XIMAG=XIMAG/GMAG                                                  LSWITD   1828
C                                                                       LSWITD   1829
C   ADD EQPI THAT WAS READ IN                                           LSWITD   1830
C                                                                       LSWITD   1831
       IF(JTYP.EQ.3)THEN                                                LSWITD   1832
        ISPR=1                                                          LSWITD   1833
        NSELL=NSELL+1                                                   LSWITD   1834
        NJSELI=NSELL                                                    LSWITD   1835
        LCONE(3,NJSELI)=1                                               LSWITD   1836
        EQPI(1,NJSELI)=XREAL                                            LSWITD   1837
        EQPI(2,NJSELI)=XIMAG                                            LSWITD   1838
        EQPI(3,NJSELI)=VMG                                              LSWITD   1839
        EQPI(4,NJSELI)=VPHS                                             LSWITD   1840
        EQPI(5,NJSELI)=VMG1                                             LSWITD   1841
        EQPI(6,NJSELI)=VPHS1                                            LSWITD   1842
       ENDIF                                                            LSWITD   1843
C                                                                       LSWITD   1844
 3900 CONTINUE                                                          LSWITD   1845
C                                                                       LSWITD   1846
      JNL5=NXL*5                                                        LSWITD   1847
C                                                                       LSWITD   1848
      GA(JNL5-2)=XREAL                                                  LSWITD   1849
      BA(JNL5-1)=XIMAG                                                  LSWITD   1850
C                                                                       LSWITD   1851
       IF(JTYP.EQ.1)THEN                                                LSWITD   1852
       BCHG(JNL5)=VMG                                                   LSWITD   1853
       ELSE                                                             LSWITD   1854
       IF(NPBNOI.GT.NPBNOJ)VMG=-VMG                                     LSWITD   1855
       ITRFX=ITRFX+1                                                    LSWITD   1856
       LTRANC(NXL)=ITRFX                                                LSWITD   1857
       JTRF2=ITRFX*2                                                    LSWITD   1858
       RATIO(JTRF2-1)=VMG                                               LSWITD   1859
       RANG(JTRF2)=VPHS                                                 LSWITD   1860
       ENDIF                                                            LSWITD   1861
C                                                                       LSWITD   1862
C   ADD LINE TO THE LINKNET ARRAYS                                      LSWITD   1863
C                                                                       LSWITD   1864
      IF(JTYP.EQ.3)THEN                                                 LSWITD   1865
      JSEL=NJSELI                                                       LSWITD   1866
      ELSE                                                              LSWITD   1867
      JSEL=0                                                            LSWITD   1868
      ENDIF                                                             LSWITD   1869
C ---------------------------------------------------------------       LSWITD   1870
      CALL PACK(CID,JSEL,ITFK)                                          LSWITD   1871
      LFTB(JNL5-4)=ITFK                                                 LSWITD   1872
      CALL PACKII(NPBNOI,NPBNOJ,ITFK)                                   LSWITD   1873
      LFTB(JNL5-3)=ITFK                                                 LSWITD   1874
      IENDB=NXL+NXL                                                     LSWITD   1875
      IENDA=IENDB-1                                                     LSWITD   1876
      NELI(IENDA)=LBRI(NPBNOI)                                          LSWITD   1877
      LINEPO(IENDA)=NXL                                                 LSWITD   1878
      LBRI(NPBNOI)=IENDA                                                LSWITD   1879
      KTNO(IENDA)=NPBNOJ                                                LSWITD   1880
      NELI(IENDB)=LBRI(NPBNOJ)                                          LSWITD   1881
      LINEPO(IENDB)=-NXL                                                LSWITD   1882
      LBRI(NPBNOJ)=IENDB                                                LSWITD   1883
      KTNO(IENDB)=NPBNOI                                                LSWITD   1884
      CALL PACK(CID,0,ITFK)                                             LSWITD   1885
      IARCCT(NXL)=ITFK                                                  LSWITD   1886
C   -------------------------------------------------                   LSWITD   1887
C                                                                       LSWITD   1888
      GOTO 4500                                                         LSWITD   1889
C                                                                       LSWITD   1890
 3950  CONTINUE                                                         LSWITD   1891
C                                                                       LSWITD   1892
C RECONNECT LINE, TRANSFORMER,OR PI LINE                                LSWITD   1893
C                                                                       LSWITD   1894
      JNL5=IABS(JNL)                                                    LSWITD   1895
      ITFK=LISMON(JNL5)                                                 LSWITD   1896
      CALL UPACKI(LSTATU,NMLINE,ITFK)                                   LSWITD   1897
C                                                                       LSWITD   1898
C   FOR RLI,RTR, RPL, RBT                                               LSWITD   1899
C                                                                       LSWITD   1900
      IF(LSTATU.EQ.0)THEN                                               LSWITD   1901
C                                                                       LSWITD   1902
C   ERROR IF ITEM IS CONNECTED ALREADY                                  LSWITD   1903
C                                                                       LSWITD   1904
      IEBK=1                                                            LSWITD   1905
      IF(KLFO.EQ.0)THEN                                                 LSWITD   1906
         WRITE(MSG(1),6820) NLFI,NLFJ,CID                               LSWITD   1907
         WRITE(MSG(2),6751)                                             LSWITD   1908
      ELSE                                                              LSWITD   1909
         NBI3=NPBNOI*3                                                  LSWITD   1910
         NBJ3=NPBNOJ*3                                                  LSWITD   1911
         WRITE(MSG(1),6800) INAME(NBI3-2),INAME(NBI3-1),INAME(NBI3)     LSWITD   1912
     *      ,INAME(NBJ3-2),INAME(NBJ3-1),INAME(NBJ3),CID                LSWITD   1913
         WRITE(MSG(2),6810)                                             LSWITD   1914
      ENDIF                                                             LSWITD   1915
      CALL PRTMSG(2)                                                    LSWITD   1916
      GOTO 4600                                                         LSWITD   1917
C                                                                       LSWITD   1918
      ELSE                                                              LSWITD   1919
                                                                        LSWITD   1920
      LISMON(JNL5)=NMLINE                                               LSWITD   1921
      JTRF=LTRANC(JNL5)                                                 LSWITD   1922
      JNL5=JNL5*5                                                       LSWITD   1923
      ITFK=LFTB(JNL5-4)                                                 LSWITD   1924
      CALL UNPACK(CKK,NJSELI,ITFK)                                      LSWITD   1925
C                                                                       LSWITD   1926
C      IF(NJSELI.NE.0)JTYP=7                                            LSWITD   1927
C                                                                       LSWITD   1928
C     RECONNECTING PI LINE                                              LSWITD   1929
C                                                                       LSWITD   1930
         IF(NJSELI.NE.0)THEN                                            LSWITD   1931
         LCONE(3,NJSELI)=1                                              LSWITD   1932
         XREAL=EQPI(1,NJSELI)                                           LSWITD   1933
         XIMAG=EQPI(2,NJSELI)                                           LSWITD   1934
         VMG=EQPI(3,NJSELI)                                             LSWITD   1935
         VPHS=EQPI(4,NJSELI)                                            LSWITD   1936
         VMG1=EQPI(5,NJSELI)                                            LSWITD   1937
         VPHS1=EQPI(6,NJSELI)                                           LSWITD   1938
         ITYP=ISOC(7)                                                   LSWITD   1939
         GOTO 4500                                                      LSWITD   1940
         ENDIF                                                          LSWITD   1941
C                                                                       LSWITD   1942
C    RECONNECTING LINE OR TRANSFORMER                                   LSWITD   1943
C                                                                       LSWITD   1944
      XREAL=GA(JNL5-2)                                                  LSWITD   1945
      XIMAG=BA(JNL5-1)                                                  LSWITD   1946
C      ZMAG=1.0/(XREAL*XREAL+XIMAG*XIMAG)                               LSWITD   1947
      IF(ZMAG.NE.0.0)THEN                                               LSWITD   1948
         ZMAG=SQRT(ZMAG)                                                LSWITD   1949
      ELSE                                                              LSWITD   1950
         ZMAG=0.0                                                       LSWITD   1951
      ENDIF                                                             LSWITD   1952
C                                                                       LSWITD   1953
          IF(ZMAG .LE. ZILTOL)THEN                                      LSWITD   1954
           ITYP=ISOC(8)                                                 LSWITD   1955
           XREAL=0.0                                                    LSWITD   1956
           XIMAG=0.0                                                    LSWITD   1957
           GOTO 4500                                                    LSWITD   1958
          ENDIF                                                         LSWITD   1959
C                                                                       LSWITD   1960
          IF(JTRF.EQ.0)THEN                                             LSWITD   1961
          VMG=BCHG(JNL5)                                                LSWITD   1962
          VPHS=0.0                                                      LSWITD   1963
          VMG1=0.0                                                      LSWITD   1964
          VPHS1=0.0                                                     LSWITD   1965
          ITYP=ISOC(5)                                                  LSWITD   1966
          GOTO 4500                                                     LSWITD   1967
C                                                                       LSWITD   1968
          ELSE                                                          LSWITD   1969
C                                                                       LSWITD   1970
C        TYPE RTR                                                       LSWITD   1971
C                                                                       LSWITD   1972
          JTRF2=JTRF*2                                                  LSWITD   1973
          VMG=RATIO(JTRF2-1)                                            LSWITD   1974
          VPHS=RANG(JTRF2)                                              LSWITD   1975
          VMG1=0.0                                                      LSWITD   1976
          VPHS1=0.0                                                     LSWITD   1977
          ITYP=ISOC(6)                                                  LSWITD   1978
          GOTO 4500                                                     LSWITD   1979
C                                                                       LSWITD   1980
          ENDIF                                                         LSWITD   1981
C                                                                       LSWITD   1982
      ENDIF                                                             LSWITD   1983
C                                                                       LSWITD   1984
 4000 CONTINUE                                                          LSWITD   1985
C                                                                       LSWITD   1986
C     MODIFY LINE, TRANSFORMER,OR PI LINE                               LSWITD   1987
C                                                                       LSWITD   1988
      JNL5=IABS(JNL)                                                    LSWITD   1989
      ITFK=LISMON(JNL5)                                                 LSWITD   1990
      CALL UPACKI(LSTATU,NMLINE,ITFK)                                   LSWITD   1991
C                                                                       LSWITD   1992
C   FOR MLI,MTR,MPL                                                     LSWITD   1993
C                                                                       LSWITD   1994
      IF(LSTATU.EQ.1)THEN                                               LSWITD   1995
C                                                                       LSWITD   1996
C   IF ITEM IS DISCONNECTED ALREADY RECONNECT IT                        LSWITD   1997
C                                                                       LSWITD   1998
      LISMON(JNL5)=NMLINE                                               LSWITD   1999
      IFOUND=0                                                          LSWITD   2000
      ELSE                                                              LSWITD   2001
      IFOUND=1                                                          LSWITD   2002
      ENDIF                                                             LSWITD   2003
      GMAG=XREAL*XREAL+XIMAG*XIMAG                                      LSWITD   2004
      XREAL=XREAL/GMAG                                                  LSWITD   2005
      XIMAG=XIMAG/GMAG                                                  LSWITD   2006
C                                                                       LSWITD   2007
      JNL=JNL5                                                          LSWITD   2008
      JNL5=JNL5*5                                                       LSWITD   2009
      GA(JNL5-2)=XREAL                                                  LSWITD   2010
      BA(JNL5-1)=XIMAG                                                  LSWITD   2011
C                                                                       LSWITD   2012
       IF(JTYP.EQ.18)THEN                                               LSWITD   2013
         IF(NPBNOI.GT.NPBNOJ)VMG=-VMG                                   LSWITD   2014
         ITRFX=LTRANC(JNL)                                              LSWITD   2015
         JTRF2=ITRFX*2                                                  LSWITD   2016
         RATIO(JTRF2-1)=VMG                                             LSWITD   2017
         RANG(JTRF2)=VPHS                                               LSWITD   2018
       ELSE                                                             LSWITD   2019
         BCHG(JNL5)=VMG                                                 LSWITD   2020
       ENDIF                                                            LSWITD   2021
       IF( JTYP.EQ.19 .AND. NMLINE.NE.0)THEN                            LSWITD   2022
        EQPI(1,NMLINE)=XREAL                                            LSWITD   2023
        EQPI(2,NMLINE)=XIMAG                                            LSWITD   2024
        EQPI(3,NMLINE)=VMG                                              LSWITD   2025
        EQPI(4,NMLINE)=VPHS                                             LSWITD   2026
        EQPI(5,NMLINE)=VMG1                                             LSWITD   2027
        EQPI(6,NMLINE)=VPHS1                                            LSWITD   2028
       ENDIF                                                            LSWITD   2029
C                                                                       LSWITD   2030
C                                                                       LSWITD   2031
      GOTO 4500                                                         LSWITD   2032
C                                                                       LSWITD   2033
 4050 CONTINUE                                                          LSWITD   2034
C                                                                       LSWITD   2035
C  ADD SECTIONAL LINE  AT PRESENT,                                      LSWITD   2036
C  THE PROGRAM DOES NOT HAVE THIS CAPABLITY                             LSWITD   2037
C                                                                       LSWITD   2038
      IEBK=1                                                            LSWITD   2039
      WRITE(MSG(1),7000)                                                LSWITD   2040
      MSG(2)=CARD                                                       LSWITD   2041
      CALL PRTMSG(2)                                                    LSWITD   2042
      GOTO 4600                                                         LSWITD   2043
C                                                                       LSWITD   2044
 4100 CONTINUE                                                          LSWITD   2045
C                                                                       LSWITD   2046
C RECONNECTING SECTIONAL LINE TYPE RSL                                  LSWITD   2047
C THIS OPITON ALLOWS ONLY THE RECONNECTING OF ENTIRE LINE               LSWITD   2048
C                                                                       LSWITD   2049
      JNL5=IABS(JNL)                                                    LSWITD   2050
      ITFK=LISMON(JNL5)                                                 LSWITD   2051
      CALL UPACKI(LSTATU,NMLINE,ITFK)                                   LSWITD   2052
C                                                                       LSWITD   2053
      IF(LSTATU.EQ.0)THEN                                               LSWITD   2054
C                                                                       LSWITD   2055
C   ERROR IF ITEM IS CONNECTED ALREADY                                  LSWITD   2056
C                                                                       LSWITD   2057
      IEBK=1                                                            LSWITD   2058
      IF(KLFO.EQ.0)THEN                                                 LSWITD   2059
         WRITE(MSG(1),6820) NLFI,NLFJ,CID                               LSWITD   2060
         WRITE(MSG(2),6751)                                             LSWITD   2061
      ELSE                                                              LSWITD   2062
         NBI3=NPBNOI*3                                                  LSWITD   2063
         NBJ3=NPBNOJ*3                                                  LSWITD   2064
         WRITE(MSG(1),6800) INAME(NBI3-2),INAME(NBI3-1),INAME(NBI3)     LSWITD   2065
     *      ,INAME(NBJ3-2),INAME(NBJ3-1),INAME(NBJ3),CID                LSWITD   2066
         WRITE(MSG(2),6810)                                             LSWITD   2067
      ENDIF                                                             LSWITD   2068
      CALL PRTMSG(2)                                                    LSWITD   2069
      GOTO 4600                                                         LSWITD   2070
C                                                                       LSWITD   2071
      ENDIF                                                             LSWITD   2072
                                                                        LSWITD   2073
      LISMON(JNL5)=NMLINE                                               LSWITD   2074
      JTRF=LTRANC(JNL5)                                                 LSWITD   2075
      JNL5=JNL5*5                                                       LSWITD   2076
      ITFK=LFTB(JNL5-4)                                                 LSWITD   2077
      CALL UNPACK(CKK,NJSELI,ITFK)                                      LSWITD   2078
C                                                                       LSWITD   2079
      IF(NJSELI.EQ.0)THEN                                               LSWITD   2080
      ITYP=ISOC(5)                                                      LSWITD   2081
      GOTO 3950                                                         LSWITD   2082
      ENDIF                                                             LSWITD   2083
C                                                                       LSWITD   2084
      IF(LCONE(3,NJSELI).NE.0)THEN                                      LSWITD   2085
      IEBK=1                                                            LSWITD   2086
      IF(KLFO.EQ.0)THEN                                                 LSWITD   2087
         WRITE(MSG(1),6820) NLFI,NLFJ,CID                               LSWITD   2088
         WRITE(MSG(2),6751)                                             LSWITD   2089
      ELSE                                                              LSWITD   2090
         NBI3=NPBNOI*3                                                  LSWITD   2091
         NBJ3=NPBNOJ*3                                                  LSWITD   2092
         WRITE(MSG(1),6800) INAME(NBI3-2),INAME(NBI3-1),INAME(NBI3)     LSWITD   2093
     *      ,INAME(NBJ3-2),INAME(NBJ3-1),INAME(NBJ3),CID                LSWITD   2094
         WRITE(MSG(2),6810)                                             LSWITD   2095
      ENDIF                                                             LSWITD   2096
      CALL PRTMSG(2)                                                    LSWITD   2097
      GOTO 4600                                                         LSWITD   2098
      ENDIF                                                             LSWITD   2099
C                                                                       LSWITD   2100
      LCONE(3,NJSELI)=1                                                 LSWITD   2101
      XREAL=EQPI(1,NJSELI)                                              LSWITD   2102
      XIMAG=EQPI(2,NJSELI)                                              LSWITD   2103
      VMG=EQPI(3,NJSELI)                                                LSWITD   2104
      VPHS=EQPI(4,NJSELI)                                               LSWITD   2105
      VMG1=EQPI(5,NJSELI)                                               LSWITD   2106
      VPHS1=EQPI(6,NJSELI)                                              LSWITD   2107
      GOTO 4500                                                         LSWITD   2108
C                                                                       LSWITD   2109
 4150 CONTINUE                                                          LSWITD   2110
C                                                                       LSWITD   2111
C  MODIFY SECTIONAL LINE  AT PRESENT                                    LSWITD   2112
C  THE PROGRAM DOES NOT HAVE THIS CAPABILITY                            LSWITD   2113
C                                                                       LSWITD   2114
      IEBK=1                                                            LSWITD   2115
      WRITE(MSG(1),7150)                                                LSWITD   2116
      MSG(2)=CARD                                                       LSWITD   2117
      CALL PRTMSG(2)                                                    LSWITD   2118
      GOTO 4600                                                         LSWITD   2119
C                                                                       LSWITD   2120
C                                                                       LSWITD   2121
 4200 CONTINUE                                                          LSWITD   2122
C                                                                       LSWITD   2123
C DISCONNECT LINE,TRANSFORMER AND PI LINE                               LSWITD   2124
C                                                                       LSWITD   2125
      JNL5=IABS(JNL)                                                    LSWITD   2126
      ITFK=LISMON(JNL5)                                                 LSWITD   2127
      CALL UPACKI(LSTATU,NMLINE,ITFK)                                   LSWITD   2128
C                                                                       LSWITD   2129
C   FOR DLI,DTR,DPL                                                     LSWITD   2130
C                                                                       LSWITD   2131
      IF(LSTATU.EQ.1)THEN                                               LSWITD   2132
C                                                                       LSWITD   2133
C   ERROR IF ITEM HAS BEEN DISCONNECTED ALREADY                         LSWITD   2134
C                                                                       LSWITD   2135
      IEBK=1                                                            LSWITD   2136
      IF(KLFO.EQ.0)THEN                                                 LSWITD   2137
         WRITE(MSG(1),6970) NLFI,NLFJ,CID                               LSWITD   2138
         WRITE(MSG(2),6751)                                             LSWITD   2139
      ELSE                                                              LSWITD   2140
         NBI3=NPBNOI*3                                                  LSWITD   2141
         NBJ3=NPBNOJ*3                                                  LSWITD   2142
         WRITE(MSG(1),6950) INAME(NBI3-2),INAME(NBI3-1),INAME(NBI3)     LSWITD   2143
     *      ,INAME(NBJ3-2),INAME(NBJ3-1),INAME(NBJ3),CID                LSWITD   2144
         WRITE(MSG(2),6960)                                             LSWITD   2145
      ENDIF                                                             LSWITD   2146
      CALL PRTMSG(2)                                                    LSWITD   2147
      GOTO 4600                                                         LSWITD   2148
C                                                                       LSWITD   2149
      ELSE                                                              LSWITD   2150
                                                                        LSWITD   2151
      CALL PACKII(1,NMLINE,ITFK)                                        LSWITD   2152
      LISMON(JNL5)=ITFK                                                 LSWITD   2153
      JTRF=LTRANC(JNL5)                                                 LSWITD   2154
      JNL5=JNL5*5                                                       LSWITD   2155
      ITFK=LFTB(JNL5-4)                                                 LSWITD   2156
      CALL UNPACK(CKK,NJSELI,ITFK)                                      LSWITD   2157
C                                                                       LSWITD   2158
C      IF(NJSELI.NE.0)JTYP=13                                           LSWITD   2159
C                                                                       LSWITD   2160
C     DISCONNECTING PI LINE                                             LSWITD   2161
C                                                                       LSWITD   2162
         IF(NJSELI .NE. 0)THEN                                          LSWITD   2163
         XREAL=EQPI(1,NJSELI)                                           LSWITD   2164
         XIMAG=EQPI(2,NJSELI)                                           LSWITD   2165
         VMG=EQPI(3,NJSELI)                                             LSWITD   2166
         VPHS=EQPI(4,NJSELI)                                            LSWITD   2167
         VMG1=EQPI(5,NJSELI)                                            LSWITD   2168
         VPHS1=EQPI(6,NJSELI)                                           LSWITD   2169
         ITYP=ISOC(13)                                                  LSWITD   2170
         GOTO 4500                                                      LSWITD   2171
         ENDIF                                                          LSWITD   2172
C                                                                       LSWITD   2173
C    DISCONNECTING LINE OR TRANSFORMER                                  LSWITD   2174
C                                                                       LSWITD   2175
      XREAL=GA(JNL5-2)                                                  LSWITD   2176
      XIMAG=BA(JNL5-1)                                                  LSWITD   2177
C                                                                       LSWITD   2178
C      ZMAG=1.0/(XREAL*XREAL+XIMAG*XIMAG)                               LSWITD   2179
      ZMAG=(XREAL*XREAL+XIMAG*XIMAG)                                    LSWITD   2180
      IF(ZMAG.NE.0.0)THEN                                               LSWITD   2181
         ZMAG=SQRT(ZMAG)                                                LSWITD   2182
      ELSE                                                              LSWITD   2183
         ZMAG=0.0                                                       LSWITD   2184
      ENDIF                                                             LSWITD   2185
C                                                                       LSWITD   2186
          IF(ZMAG .LE. ZILTOL)THEN                                      LSWITD   2187
           ITYP=ISOC(15)                                                LSWITD   2188
           XREAL=0.0                                                    LSWITD   2189
           XIMAG=0.0                                                    LSWITD   2190
           GOTO 4500                                                    LSWITD   2191
          ENDIF                                                         LSWITD   2192
C                                                                       LSWITD   2193
          IF(JTRF.EQ.0)THEN                                             LSWITD   2194
          VMG=BCHG(JNL5)                                                LSWITD   2195
          VPHS=0.0                                                      LSWITD   2196
          VMG1=0.0                                                      LSWITD   2197
          VPHS1=0.0                                                     LSWITD   2198
           IF(JTYP .EQ. 14)THEN                                         LSWITD   2199
            ITYP=ISOC(14)                                               LSWITD   2200
           ELSE                                                         LSWITD   2201
            ITYP=ISOC(11)                                               LSWITD   2202
           ENDIF                                                        LSWITD   2203
          GOTO 4500                                                     LSWITD   2204
C                                                                       LSWITD   2205
          ELSE                                                          LSWITD   2206
C                                                                       LSWITD   2207
C        TYPE DTR                                                       LSWITD   2208
C                                                                       LSWITD   2209
          JTRF2=JTRF*2                                                  LSWITD   2210
          VMG=RATIO(JTRF2-1)                                            LSWITD   2211
          VPHS=RANG(JTRF2)                                              LSWITD   2212
          VMG1=0.0                                                      LSWITD   2213
          VPHS1=0.0                                                     LSWITD   2214
          ITYP=ISOC(12)                                                 LSWITD   2215
          GOTO 4500                                                     LSWITD   2216
C                                                                       LSWITD   2217
          ENDIF                                                         LSWITD   2218
C                                                                       LSWITD   2219
      ENDIF                                                             LSWITD   2220
C                                                                       LSWITD   2221
 4250 CONTINUE                                                          LSWITD   2222
C                                                                       LSWITD   2223
C DISCONNECTING SECTIONAL LINE TYPE DSL                                 LSWITD   2224
C THIS OPITON ALLOWS ONLY THE REMOVING OF ENTIRE LINE                   LSWITD   2225
C                                                                       LSWITD   2226
      JNL5=IABS(JNL)                                                    LSWITD   2227
      ITFK=LISMON(JNL5)                                                 LSWITD   2228
      CALL UPACKI(LSTATU,NMLINE,ITFK)                                   LSWITD   2229
C                                                                       LSWITD   2230
      IF(LSTATU.EQ.1)THEN                                               LSWITD   2231
C                                                                       LSWITD   2232
C   ERROR IF ITEM IS DISCONNECTED ALREADY                               LSWITD   2233
C                                                                       LSWITD   2234
      IEBK=1                                                            LSWITD   2235
       IF(KLFO.EQ.0)THEN                                                LSWITD   2236
         WRITE(MSG(1),6970) NLFI,NLFJ,CID                               LSWITD   2237
         WRITE(MSG(2),6751)                                             LSWITD   2238
      ELSE                                                              LSWITD   2239
         NBI3=NPBNOI*3                                                  LSWITD   2240
         NBJ3=NPBNOJ*3                                                  LSWITD   2241
         WRITE(MSG(1),6950) INAME(NBI3-2),INAME(NBI3-1),INAME(NBI3)     LSWITD   2242
     *      ,INAME(NBJ3-2),INAME(NBJ3-1),INAME(NBJ3),CID                LSWITD   2243
         WRITE(MSG(2),6960)                                             LSWITD   2244
      ENDIF                                                             LSWITD   2245
      CALL PRTMSG(2)                                                    LSWITD   2246
      GOTO 4600                                                         LSWITD   2247
C                                                                       LSWITD   2248
      ENDIF                                                             LSWITD   2249
      CALL PACKII(1,NMLINE,ITFK)                                        LSWITD   2250
      LISMON(JNL5)=ITFK                                                 LSWITD   2251
      JTRF=LTRANC(JNL5)                                                 LSWITD   2252
      JNL5=JNL5*5                                                       LSWITD   2253
      ITFK=LFTB(JNL5-4)                                                 LSWITD   2254
      CALL UNPACK(CKK,NJSELI,ITFK)                                      LSWITD   2255
C                                                                       LSWITD   2256
      IF(NJSELI.EQ.0)THEN                                               LSWITD   2257
      JTYP=11                                                           LSWITD   2258
      ITYP=ISOC(11)                                                     LSWITD   2259
      GOTO 4200                                                         LSWITD   2260
      ENDIF                                                             LSWITD   2261
C                                                                       LSWITD   2262
      IF(LCONE(3,NJSELI).NE.1)THEN                                      LSWITD   2263
      IEBK=1                                                            LSWITD   2264
       IF(KLFO.EQ.0)THEN                                                LSWITD   2265
         WRITE(MSG(1),6970) NLFI,NLFJ,CID                               LSWITD   2266
         WRITE(MSG(2),6751)                                             LSWITD   2267
      ELSE                                                              LSWITD   2268
         NBI3=NPBNOI*3                                                  LSWITD   2269
         NBJ3=NPBNOJ*3                                                  LSWITD   2270
         WRITE(MSG(1),6950) INAME(NBI3-2),INAME(NBI3-1),INAME(NBI3)     LSWITD   2271
     *      ,INAME(NBJ3-2),INAME(NBJ3-1),INAME(NBJ3),CID                LSWITD   2272
         WRITE(MSG(2),6960)                                             LSWITD   2273
      ENDIF                                                             LSWITD   2274
      CALL PRTMSG(2)                                                    LSWITD   2275
      GOTO 4600                                                         LSWITD   2276
      ENDIF                                                             LSWITD   2277
C                                                                       LSWITD   2278
      LCONE(3,NJSELI)=0                                                 LSWITD   2279
      XREAL=EQPI(1,NJSELI)                                              LSWITD   2280
      XIMAG=EQPI(2,NJSELI)                                              LSWITD   2281
      VMG=EQPI(3,NJSELI)                                                LSWITD   2282
      VPHS=EQPI(4,NJSELI)                                               LSWITD   2283
      VMG1=EQPI(5,NJSELI)                                               LSWITD   2284
      VPHS1=EQPI(6,NJSELI)                                              LSWITD   2285
      GOTO 4500                                                         LSWITD   2286
C                                                                       LSWITD   2287
 4300 CONTINUE                                                          LSWITD   2288
C                                                                       LSWITD   2289
C     RECONNECT FLASHED CAPACITOR TYPE RCG                              LSWITD   2290
C                                                                       LSWITD   2291
      JNL5=IABS(JNL)                                                    LSWITD   2292
      ITFK=LISMON(JNL5)                                                 LSWITD   2293
      CALL UPACKI(LSTATU,NMLINE,ITFK)                                   LSWITD   2294
      JTRF=LTRANC(JNL5)                                                 LSWITD   2295
      JNL5=JNL5*5                                                       LSWITD   2296
      ITFK=LFTB(JNL5-4)                                                 LSWITD   2297
      CALL UNPACK(CKK,NJSELI,ITFK)                                      LSWITD   2298
C                                                                       LSWITD   2299
         IPOS=LCONE(5,NJSELI)                                           LSWITD   2300
         IPOS1=IPOS+LCONE(6,NJSELI)                                     LSWITD   2301
C                                                                       LSWITD   2302
         KSECT=0                                                        LSWITD   2303
C                                                                       LSWITD   2304
         DO 4350 II=IPOS,IPOS1                                          LSWITD   2305
C                                                                       LSWITD   2306
         IF(CNEXTS(2,II).EQ.SID)THEN                                    LSWITD   2307
C                                                                       LSWITD   2308
C   FOR THE SPECIFIED SECTION                                           LSWITD   2309
C                                                                       LSWITD   2310
             IF(PSELIN(1,II).EQ.0.0.AND.PSELIN(2,II).LT.0.0             LSWITD   2311
     &       .AND.PSELIN(3,II).EQ.0.0.AND.PSELIN(4,II).EQ.0.0           LSWITD   2312
     &       .AND.PSELIN(5,II).EQ.0.0.AND.PSELIN(6,II).EQ.0.0)THEN      LSWITD   2313
C                                                                       LSWITD   2314
                IF(NEXTSL(3,II).NE.1)THEN                               LSWITD   2315
                IEBK=1                                                  LSWITD   2316
      IF(KLFO.EQ.0)THEN                                                 LSWITD   2317
         WRITE(MSG(1),6020) NLFI,NLFJ,CID,SID                           LSWITD   2318
         WRITE(MSG(2),6751)                                             LSWITD   2319
      ELSE                                                              LSWITD   2320
         NBI3=NPBNOI*3                                                  LSWITD   2321
         NBJ3=NPBNOJ*3                                                  LSWITD   2322
         WRITE(MSG(1),6000) INAME(NBI3-2),INAME(NBI3-1),INAME(NBI3)     LSWITD   2323
     *      ,INAME(NBJ3-2),INAME(NBJ3-1),INAME(NBJ3),CID,SID            LSWITD   2324
         WRITE(MSG(2),6010)                                             LSWITD   2325
      ENDIF                                                             LSWITD   2326
      CALL PRTMSG(2)                                                    LSWITD   2327
                GOTO 4600                                               LSWITD   2328
                ELSE                                                    LSWITD   2329
                NEXTSL(3,II)=0                                          LSWITD   2330
                KSECT=1                                                 LSWITD   2331
                ENDIF                                                   LSWITD   2332
            ENDIF                                                       LSWITD   2333
         ENDIF                                                          LSWITD   2334
 4350     CONTINUE                                                      LSWITD   2335
C???                                                                    LSWITD   2336
      IF(KSECT.NE.0) GOTO 4500                                          LSWITD   2337
      IEBK=1                                                            LSWITD   2338
      IF(KLFO.EQ.0)THEN                                                 LSWITD   2339
         WRITE(MSG(1),5970) NLFI,NLFJ,CID,SID                           LSWITD   2340
         WRITE(MSG(2),6751)                                             LSWITD   2341
      ELSE                                                              LSWITD   2342
         NBI3=NPBNOI*3                                                  LSWITD   2343
         NBJ3=NPBNOJ*3                                                  LSWITD   2344
         WRITE(MSG(1),5950) INAME(NBI3-2),INAME(NBI3-1),INAME(NBI3)     LSWITD   2345
     *      ,INAME(NBJ3-2),INAME(NBJ3-1),INAME(NBJ3),CID,SID            LSWITD   2346
         WRITE(MSG(2),5960)                                             LSWITD   2347
      ENDIF                                                             LSWITD   2348
      CALL PRTMSG(2)                                                    LSWITD   2349
      GOTO 4600                                                         LSWITD   2350
C                                                                       LSWITD   2351
 4400 CONTINUE                                                          LSWITD   2352
C                                                                       LSWITD   2353
C   FLASH CAPACITOR GAP TYPE FCG                                        LSWITD   2354
C                                                                       LSWITD   2355
      JNL5=IABS(JNL)                                                    LSWITD   2356
      ITFK=LISMON(JNL5)                                                 LSWITD   2357
      CALL UPACKI(JJJ,NMLINE,ITFK)                                      LSWITD   2358
      JTRF=LTRANC(JNL5)                                                 LSWITD   2359
      JNL5=JNL5*5                                                       LSWITD   2360
      ITFK=LFTB(JNL5-4)                                                 LSWITD   2361
      CALL UNPACK(CKK,NJSELI,ITFK)                                      LSWITD   2362
C                                                                       LSWITD   2363
         IPOS=LCONE(5,NJSELI)                                           LSWITD   2364
         IPOS1=IPOS+LCONE(6,NJSELI)                                     LSWITD   2365
C                                                                       LSWITD   2366
         ISECT=1                                                        LSWITD   2367
         KSECT=0                                                        LSWITD   2368
C                                                                       LSWITD   2369
         DO 4450 II=IPOS,IPOS1                                          LSWITD   2370
C                                                                       LSWITD   2371
          IF(CNEXTS(2,II).EQ.SID)THEN                                   LSWITD   2372
C                                                                       LSWITD   2373
C   FOR THE SPECIFIED SECTION                                           LSWITD   2374
C                                                                       LSWITD   2375
          KSECT=1                                                       LSWITD   2376
             IF(PSELIN(1,II).EQ.0.0.AND.PSELIN(2,II).LT.0.0             LSWITD   2377
     &       .AND.PSELIN(3,II).EQ.0.0.AND.PSELIN(4,II).EQ.0.0           LSWITD   2378
     &       .AND.PSELIN(5,II).EQ.0.0.AND.PSELIN(6,II).EQ.0.0)THEN      LSWITD   2379
C                                                                       LSWITD   2380
C    FOR THE CAPACITOR SECTION                                          LSWITD   2381
C                                                                       LSWITD   2382
                IF(NEXTSL(3,II).NE.0)THEN                               LSWITD   2383
                IEBK=1                                                  LSWITD   2384
      IF(KLFO.EQ.0)THEN                                                 LSWITD   2385
         WRITE(MSG(1),6070) NLFI,NLFJ,CID,SID                           LSWITD   2386
         WRITE(MSG(2),6751)                                             LSWITD   2387
      ELSE                                                              LSWITD   2388
         NBI3=NPBNOI*3                                                  LSWITD   2389
         NBJ3=NPBNOJ*3                                                  LSWITD   2390
         WRITE(MSG(1),6050) INAME(NBI3-2),INAME(NBI3-1),INAME(NBI3)     LSWITD   2391
     *      ,INAME(NBJ3-2),INAME(NBJ3-1),INAME(NBJ3),CID,SID            LSWITD   2392
         WRITE(MSG(2),6060)                                             LSWITD   2393
      ENDIF                                                             LSWITD   2394
      CALL PRTMSG(2)                                                    LSWITD   2395
                GOTO 4600                                               LSWITD   2396
                ELSE                                                    LSWITD   2397
                NEXTSL(3,II)=1                                          LSWITD   2398
                ENDIF                                                   LSWITD   2399
          ENDIF                                                         LSWITD   2400
C                                                                       LSWITD   2401
C   ENDIF CNEXTS(2,II).EQ.SID                                           LSWITD   2402
C                                                                       LSWITD   2403
          ENDIF                                                         LSWITD   2404
C                                                                       LSWITD   2405
 4450    CONTINUE                                                       LSWITD   2406
C                                                                       LSWITD   2407
          IF(KSECT.EQ.0)THEN                                            LSWITD   2408
          IEBK=1                                                        LSWITD   2409
      IF(KLFO.EQ.0)THEN                                                 LSWITD   2410
         WRITE(MSG(1),5970) NLFI,NLFJ,CID,SID                           LSWITD   2411
         WRITE(MSG(2),6751)                                             LSWITD   2412
      ELSE                                                              LSWITD   2413
         NBI3=NPBNOI*3                                                  LSWITD   2414
         NBJ3=NPBNOJ*3                                                  LSWITD   2415
         WRITE(MSG(1),5950) INAME(NBI3-2),INAME(NBI3-1),INAME(NBI3)     LSWITD   2416
     *      ,INAME(NBJ3-2),INAME(NBJ3-1),INAME(NBJ3),CID,SID            LSWITD   2417
         WRITE(MSG(2),5960)                                             LSWITD   2418
      ENDIF                                                             LSWITD   2419
      CALL PRTMSG(2)                                                    LSWITD   2420
          GOTO 4600                                                     LSWITD   2421
          ENDIF                                                         LSWITD   2422
C                                                                       LSWITD   2423
 4500     IF(JNL.LT.0)THEN                                              LSWITD   2424
            NLFI=NPBNOJ                                                 LSWITD   2425
            NLFJ=NPBNOI                                                 LSWITD   2426
           ELSE                                                         LSWITD   2427
            NLFI=NPBNOI                                                 LSWITD   2428
            NLFJ=NPBNOJ                                                 LSWITD   2429
          ENDIF                                                         LSWITD   2430
          ISCA=ISCA+1                                                   LSWITD   2431
      AWV1(1)=FMTOUT(XREAL)                                             LSWITD   2432
      AWV1(2)=FMTOUT(XIMAG)                                             LSWITD   2433
      AWV1(3)=FMTOUT(VMG)                                               LSWITD   2434
      AWV1(4)=FMTOUT(VPHS)                                              LSWITD   2435
      AWV1(5)=FMTOUT(VMG1)                                              LSWITD   2436
      AWV1(6)=FMTOUT(VPHS1)                                             LSWITD   2437
      AWV1(7)=FMTOUT(TRCLSE)                                            LSWITD   2438
      WRITE(ISWF,5060) ITYP,NLFI,NLFJ,CID,SID,(AWV1(I)(1:10),I=1,6)     LSWITD   2439
     *,NMLINE,NJSELI,AWV1(7)(1:10)                                      LSWITD   2440
C                                                                       LSWITD   2441
      GOTO 4600                                                         LSWITD   2442
C                                                                       LSWITD   2443
C    READ IN THE E CARD                                                 LSWITD   2444
C                                                                       LSWITD   2445
 4550 CONTINUE                                                          LSWITD   2446
      IF(KLFO.EQ.0)THEN                                                 LSWITD   2447
         READ(CARD,6700)ITYP,KFAULT,KZV,NSLM                            LSWITD   2448
         IF(ESCMOD)THEN                                                 LSWITD   2449
           IF(FRSHNT.EQ. ' '.AND.TOSHNT.EQ.' ')THEN                     LSWITD   2450
             KFAULT=0                                                   LSWITD   2451
             KZV=0                                                      LSWITD   2452
           ENDIF                                                        LSWITD   2453
         ENDIF                                                          LSWITD   2454
         IF(KFAULT.NE.-1) IFAULT=KFAULT                                 LSWITD   2455
         IF(KZV.NE.-1) JZEROP=KZV                                       LSWITD   2456
      ELSE                                                              LSWITD   2457
         READ(CARD,6650) ITYP,BNAME1,BNAME2,NSLM                        LSWITD   2458
         IF(ESCMOD)THEN                                                 LSWITD   2459
           IF(FRSHNT.EQ. ' '.AND.TOSHNT.EQ.' ')THEN                     LSWITD   2460
             BNAME1=' '                                                 LSWITD   2461
             BNAME2=' '                                                 LSWITD   2462
           ENDIF                                                        LSWITD   2463
         ENDIF                                                          LSWITD   2464
         IF(BNAME1.NE.'-1          ') AFAULT=BNAME1                     LSWITD   2465
         IF(AFAULT.NE.IBLK12)THEN                                       LSWITD   2466
          CALL CHKBUS(AFAULT,IFAULT)                                    LSWITD   2467
         ELSE                                                           LSWITD   2468
          IFAULT=0                                                      LSWITD   2469
         ENDIF                                                          LSWITD   2470
C                                                                       LSWITD   2471
        IF(BNAME2.NE.'-1          ') ZEROP=BNAME2                       LSWITD   2472
        IF(ZEROP.NE.IBLK12)THEN                                         LSWITD   2473
         CALL CHKBUS(ZEROP,JZEROP)                                      LSWITD   2474
        ELSE                                                            LSWITD   2475
         JZEROP=0                                                       LSWITD   2476
        ENDIF                                                           LSWITD   2477
       ENDIF                                                            LSWITD   2478
      IF(JZEROP.NE.0)THEN                                               LSWITD   2479
       IF(NNEW(JZEROP).EQ.0)THEN                                        LSWITD   2480
       IEBK=1                                                           LSWITD   2481
       WRITE (MSG(1),5200) JZEROP                                       LSWITD   2482
       WRITE(MSG(2),6751)                                               LSWITD   2483
       CALL PRTMSG(2)                                                   LSWITD   2484
       ELSE                                                             LSWITD   2485
       JZERP1=NNEW(JZEROP)                                              LSWITD   2486
       ENDIF                                                            LSWITD   2487
      ELSE                                                              LSWITD   2488
       JZERP1=JZEROP                                                    LSWITD   2489
      ENDIF                                                             LSWITD   2490
      IF(IFAULT.NE.0)THEN                                               LSWITD   2491
       IF(NNEW(IFAULT).EQ.0)THEN                                        LSWITD   2492
       IEBK=1                                                           LSWITD   2493
       WRITE (MSG(1),5150) IFAULT                                       LSWITD   2494
       CALL PRTMSG(1)                                                   LSWITD   2495
       ELSE                                                             LSWITD   2496
       IFULT1=NNEW(IFAULT)                                              LSWITD   2497
       ENDIF                                                            LSWITD   2498
      ELSE                                                              LSWITD   2499
       IFULT1=IFAULT                                                    LSWITD   2500
      ENDIF                                                             LSWITD   2501
C                                                                       LSWITD   2502
      READ(IU31,REC=ILAST+1) CARD                                       LSWITD   2503
      READ(CARD,7700)SETPS,JDC,JMT,JPRINT,JPLOT,JMTH,JREPRT             LSWITD   2504
      IF(SETPS.NE.-1.)STEPS=SETPS                                       LSWITD   2505
      IF(JDC.NE.-1)IDC=JDC                                              LSWITD   2506
      IF(JMT.NE.-1)IMT=JMT                                              LSWITD   2507
      IF(JPRINT.NE.-1)IPRINT=JPRINT                                     LSWITD   2508
      IF(JPLOT.NE.-1)IPLOT=JPLOT                                        LSWITD   2509
      IF(JMTH.NE.-1)IMTH=JMTH                                           LSWITD   2510
      IF(JREPRT.NE.-1)IREPRT=JREPRT                                     LSWITD   2511
C                                                                       LSWITD   2512
      IF(STIME(J+1).EQ.STIME(J)) GOTO 4600                              LSWITD   2513
      ISCA=ISCA+1                                                       LSWITD   2514
      WRITE (ISWF,4750) ITYP,IFULT1,JZERP1,NSLM                         LSWITD   2515
C                                                                       LSWITD   2516
      IF(IREDLB(J+1).NE.-1)IREDL=IREDLB(J+1)                            LSWITD   2517
C                                                                       LSWITD   2518
      ISCA=ISCA+1                                                       LSWITD   2519
      WRITE(ISWF,7800)STIME(J+1),STEPS,IDC,IMT,IPRINT,IPLOT,IMTH,       LSWITD   2520
     +                IREPRT,IREDL                                      LSWITD   2521
C                                                                       LSWITD   2522
 4600 CONTINUE                                                          LSWITD   2523
C                                                                       LSWITD   2524
 4650  CONTINUE                                                         LSWITD   2525
C                                                                       LSWITD   2526
      IF(IEBK.NE.0)THEN                                                 LSWITD   2527
      CARD='LSWITD: SIMULATION SPECIFICATION DATA ERROR'                LSWITD   2528
      CALL ASTOP(CARD,43)                                               LSWITD   2529
      ENDIF                                                             LSWITD   2530
C                                                                       LSWITD   2531
      NL=NXL                                                            LSWITD   2532
C                                                                       LSWITD   2533
 4700 IF (CFLRUN) GOTO 4730                                             LSWITD   2534
      MSG(1)='DO YOU WANT A SUMMARY OF THE SIMULATION '//               LSWITD   2535
     &       'SPECIFICATIONS ? (Y/N)'                                   LSWITD   2536
      WRITE(LOUT,*)                                                     LSWITD   2537
      CALL REDLIN(LOUT,LIN,IOERR,62,MSG(1),SUBPMT,'SW1',STRING,         LSWITD   2538
     &RECORD,IREC,KLAYER,KEND,KREAD,PLAYBA)                             LSWITD   2539
      IF(IOERR.LT.0)THEN                                                LSWITD   2540
      IF(PLAYBA)CALL PSTOP                                              LSWITD   2541
      GOTO 4700                                                         LSWITD   2542
      ENDIF                                                             LSWITD   2543
      IF(STRING(1:1).EQ.'Y'.OR.STRING(1:1).EQ.'y') THEN                 LSWITD   2544
C                                                                       LSWITD   2545
        IF(.NOT.LUNITS(IU18))THEN                                       LSWITD   2546
          IF(.NOT.LSUMM)THEN                                            LSWITD   2547
            IKEY=6                                                      LSWITD   2548
            JLENG=133                                                   LSWITD   2549
            CARD='ENTER THE SWITCHING SUMMARY FILE NAME:'               LSWITD   2550
            EMSG='ERROR IN OPENING THE SWITCHING SUMMARY FILE'          LSWITD   2551
            LMSG=38                                                     LSWITD   2552
            LEMSG=42                                                    LSWITD   2553
            WRITE(LOUT,*)                                               LSWITD   2554
            CALL FILEMG(IU18,LMSG,CARD,LEMSG,EMSG,SUBPMT,IKEY,          LSWITD   2555
     +                  JLENG,LEBK)                                     LSWITD   2556
            IF(LEBK.EQ.0)LSUMM=.TRUE.                                   LSWITD   2557
          ENDIF                                                         LSWITD   2558
          MSG(1)='INPUT DATA AND INITIAL CONDITION REPORT'              LSWITD   2559
          CALL PHEAD(IU18,39,MSG(1))                                    LSWITD   2560
        ENDIF                                                           LSWITD   2561
C                                                                       LSWITD   2562
        IPSWIT=1                                                        LSWITD   2563
        IUY=IU18                                                        LSWITD   2564
C                                                                       LSWITD   2565
      ELSEIF(STRING(1:1).NE.'N'.AND.STRING(1:1).NE.'n') THEN            LSWITD   2566
        IF(PLAYBA)CALL PSTOP                                            LSWITD   2567
        GOTO 4700                                                       LSWITD   2568
      ELSE                                                              LSWITD   2569
        IPSWIT=0                                                        LSWITD   2570
      ENDIF                                                             LSWITD   2571
C                                                                       LSWITD   2572
C     CLOSE IU31                                                        LSWITD   2573
C                                                                       LSWITD   2574
 4730 CALL CLOSEF(IU31)                                                 LSWITD   2575
C                                                                       LSWITD   2576
      RETURN                                                            LSWITD   2577
C                                                                       LSWITD   2578
 4750 FORMAT(A3,3I5)                                                    LSWITD   2579
 4900 FORMAT(A3,1X,2I5,3X,A2,I5,4F8.3)                                  LSWITD   2580
 4910 FORMAT(A3,1X,2I5,3X,A2,1X,F10.5)                                  LSWITD   2581
 5050 FORMAT(A3,1X,2I5,1X,2A2,6F10.5,:,2I5,F10.5)                       LSWITD   2582
 5060 FORMAT(A3,1X,2I5,1X,2A2,6A10,2I5,A10)                             LSWITD   2583
 5350 FORMAT(A3,1X,2I5,4F10.3)                                          LSWITD   2584
 6250 FORMAT(A3,1X,I5,10X,4F10.5)                                       LSWITD   2585
 6260 FORMAT(A3,1X,I5,10X,2F10.4)                                       LSWITD   2586
 6350 FORMAT(A3,I5,15X,2F10.5)                                          LSWITD   2587
 6450 FORMAT(A3,1X,I5,1X,A2,F10.5)                                      LSWITD   2588
 6500 FORMAT(A3,1X,2I5,3X,A2,F10.5)                                     LSWITD   2589
 6700 FORMAT(A3,1X,3I5)                                                 LSWITD   2590
 5400 FORMAT(A3,1X,A12,I5,4F8.3)                                        LSWITD   2591
 6150 FORMAT(A3,1X,A12,4F10.5)                                          LSWITD   2592
 6400 FORMAT(A3,1X,A12,1X,A2,F10.5)                                     LSWITD   2593
 6650 FORMAT(A3,1X,2A12,I5)                                             LSWITD   2594
 6550 FORMAT(A3,1X,2A12,2A2,6F8.3)                                      LSWITD   2595
 4800 FORMAT(20A4)                                                      LSWITD   2596
 4950 FORMAT(A80)                                                       LSWITD   2597
 4850 FORMAT(10X,2F10.5,25X,I5)                                         LSWITD   2598
 5100 FORMAT (' *** ERROR ADDITION OF LINE OR TRANSFORMER')             LSWITD   2599
 5101 FORMAT(11X,'NOT ALLOWED THIS ITEM EXISTS ALREADY CHECK YOUR '     LSWITD   2600
     &,'SWITCHING DATA')                                                LSWITD   2601
 5150 FORMAT(' *** ERROR FAULT BUS#',I6                                 LSWITD   2602
     1,' IS NOT IN THE SYSTEM CHECK YOUR SWITCHING DATA')               LSWITD   2603
 5200 FORMAT(1X,'*** ERROR ZERO POTENTIAL BUS#',I6                      LSWITD   2604
     1,' IS NOT IN THE SYSTEM')                                         LSWITD   2605
 5250 FORMAT(' *** ERROR NO SUCH TYPE OF SWITCHING')                    LSWITD   2606
 5450 FORMAT(' *** ERROR DC LINE MODIFICTAION IS NOT ALLOWED'           LSWITD   2607
     &,' CHECK YOUR SWITCHING DATA')                                    LSWITD   2608
 5500 FORMAT(' *** ERROR GENERATOR IS NOT IN THE SYSTEM CHECK'          LSWITD   2609
     *,' YOUR SWITCHING DATA')                                          LSWITD   2610
 5600 FORMAT(' *** ERROR GENERATOR HAS NO EXCITER,'                     LSWITD   2611
     *,' CHECK YOUR SWITCHING DATA')                                    LSWITD   2612
 5650 FORMAT(' *** ERROR GENERATOR'                                     LSWITD   2613
     &,' HAS NO EXCITATION BOOSTER, CHECK YOUR SWITCHING DATA')         LSWITD   2614
 5700 FORMAT (' *** ERROR GENERATOR'                                    LSWITD   2615
     &,' DOES NOT HAVE A GOVERNOR CHECK YOUR SWITCHING DATA')           LSWITD   2616
 5750 FORMAT (' *** ERROR GENERATOR'                                    LSWITD   2617
     &,' HAS NO STABILIZER CHECK YOUR SWITCHING DATA')                  LSWITD   2618
 5800 FORMAT(' *** ERROR MACHINE IS NOT A SYNCHRONOUS MOTOR')           LSWITD   2619
 5810 FORMAT(' *** ERROR MACHINE IS NOT A SYNCHRONOUS GENERATOR')       LSWITD   2620
 5820 FORMAT (' *** ERROR GENERATOR HAS AN EXCITER - FIELD ',           LSWITD   2621
     +        'VOLTAGE CHANGE IS NOT ALLOWED')                          LSWITD   2622
 5830 FORMAT ('     CHECK YOUR SWITCHING DATA')                         LSWITD   2623
 5850 FORMAT(' *** ERROR INDUCTION MOTOR',                              LSWITD   2624
     &' IS NOT IN THE SYSTEM CHECK YOUR SWITCHING DATA')                LSWITD   2625
 5900 FORMAT(' *** ERROR SPECIFIED INDUCTION MOTOR DOES NOT EXIST')     LSWITD   2626
 5940 FORMAT(' *** ERROR SPECIFIED INDUCTION MOTOR ISA PART OF ALOAD')  LSWITD   2627
 5950 FORMAT(' *** ERROR SECTION OF ;',3A4,';',3A4,';',A,';',A)         LSWITD   2628
 5960 FORMAT(5X,'DOES NOT EXIST, CHECK YOUR SWITCHING DATA')            LSWITD   2629
 5970 FORMAT(' *** ERROR SECTION OF ;',I5,';',I5,';',A,';',A            LSWITD   2630
     *,' DOES NOT EXIST')                                               LSWITD   2631
 6000 FORMAT(' *** ERROR CAPACITOR BETWEEN ;',3A4,';',3A4,';',A,';',A)  LSWITD   2632
 6010 FORMAT(5X,'NOT FLASHED, CHECK YOUR SWITCHING DATA')               LSWITD   2633
 6020 FORMAT(' *** ERROR CAPACITOR BETWEEN ;',I5,';',I5,';',A,';',A     LSWITD   2634
     *,' NOT FLASHED')                                                  LSWITD   2635
 6050 FORMAT(' *** ERROR CAPACITOR BETWEEN ;',3A4,';',3A4,';',A,';',A)  LSWITD   2636
 6060 FORMAT(5X,'FLASHED ALREADY, CHECK YOUR SWITCHING DATA')           LSWITD   2637
 6070 FORMAT(' *** ERROR CAPACITOR BETWEEN ;',I5,';',I5,';',A,';',A     LSWITD   2638
     *,' FLASHED ALREADY')                                              LSWITD   2639
 6100 FORMAT(' *** ERROR ADDING ZERO IMPEDANCE LINE FOR '               LSWITD   2640
     &,' DOES NOT MATCH THE TYPE REQUESTED')                            LSWITD   2641
 6751 FORMAT(5X,'CHECK YOUR SWITCHING DATA')                            LSWITD   2642
 6800 FORMAT(' *** ERROR RECONNECTING OF BRANCH ;',3A4,';',3A4,';',A)   LSWITD   2643
 6810 FORMAT(5X,'IS NOT DISCONNECTED, CHECK YOUR SWITCHING DATA')       LSWITD   2644
 6820 FORMAT(' *** ERROR RECONNECTING OF BRANCH ;',I5,';',I5,';',A      LSWITD   2645
     *,' IS NOT DISCONNECTED')                                          LSWITD   2646
 6850 FORMAT(' *** BRANCH NOT IN THE SYSTEM, CHECK FOLLOWING CARD')     LSWITD   2647
 6900 FORMAT(' *** ERROR DISCONNECTING OF LINE OR TRANSFORMER'          LSWITD   2648
     &,' NOT IN THE SYSTEM,')                                           LSWITD   2649
 6950 FORMAT(' *** ERROR DISCONNECTING OF BRANCH ;',3A4,';',3A4,';',A)  LSWITD   2650
 6960 FORMAT(5X                                                         LSWITD   2651
     *,'THAT HAS ALREADY BEEN DISCONNECTED, CHECK YOUR SWITCHING DATA') LSWITD   2652
 6970 FORMAT(' *** ERROR DISCONNECTING OF BRANCH ;',I5,';',I5,';',A     LSWITD   2653
     *,' DISCONNECTED ALREADY')                                         LSWITD   2654
 7000 FORMAT(' *** ERROR ADDING SECTIONAL LINE FACILITY HAS NOT'        LSWITD   2655
     &,' BEEN PROGRAMMED YET')                                          LSWITD   2656
 7050 FORMAT(' *** DISCONNECTING SECTIONAL LINE',                       LSWITD   2657
     &'THAT HAS ALREADY BEEN DISCONNECTED,')                            LSWITD   2658
 7100 FORMAT(' *** RECONNECTING SECTIONAL LINE ',                       LSWITD   2659
     &'THAT HAS ALREADY BEEN RECONNECTED,')                             LSWITD   2660
 7150 FORMAT(' *** ERROR MODIFYING SECTIONAL LINE FACILITY HAS NOT'     LSWITD   2661
     &,' BEEN PROGRAMMED YET')                                          LSWITD   2662
 7200 FORMAT(                                                           LSWITD   2663
     *' *** ERROR ADDED OR FAULT IMPEDANCE HAS NOT BEEN SPECIFIED')     LSWITD   2664
 7250 FORMAT(' *** ERROR NO FAULT EXISTED PREVIOUSLY ON BUS ;',I6)      LSWITD   2665
 7260 FORMAT(' *** ERROR NO FAULT EXISTED PREVIOUSLY ON BUS ;',A)       LSWITD   2666
 7300 FORMAT(' *** ERROR SPECIFIED BUS DOES NOT EXIST')                 LSWITD   2667
 7350 FORMAT(' *** ERROR THE ADDED LINE BETWEEN',2A12,                  LSWITD   2668
     &' IS AN ISOLATED LINE')                                           LSWITD   2669
 7400 FORMAT(' *** ERROR NO SUCH FIRST SWITCHING KEY WORD. THE'         LSWITD   2670
     *,' FOLLOWING SWITCHING')                                          LSWITD   2671
 7410 FORMAT(5X,'CARD HAS BEEN IGNORED')                                LSWITD   2672
 7450 FORMAT(1X,'LKWORD=',I2,'KWORD(',A12,')',/,1X,'LDWORD=',I3         LSWITD   2673
     &,(/,1X,'(',A60,')'))                                              LSWITD   2674
 7550 FORMAT(' *** ERROR INTEGRATION METHOD KEY WORD'                   LSWITD   2675
     &,' HAS BEEN WRONGLY SPELLED')                                     LSWITD   2676
 7551 FORMAT(5X,'TRAPEZOIDAL METHOD IS ASSUMED')                        LSWITD   2677
 7700 FORMAT(F10.5,6I5)                                                 LSWITD   2678
 7800 FORMAT(F10.4,F10.5,6I5,20X,I5)                                    LSWITD   2679
 7810 FORMAT(' *** ERROR GENERATION REDUCTION PERCENTAGE (',F6.2,')')   LSWITD   2680
 7820 FORMAT('     IS OUTSIDE OF THE VALID RANGE OF 0.0 TO 95.0')       LSWITD   2681
 7830 FORMAT('     THE VALUE HAS BEEN SET TO ',F5.2)                    LSWITD   2682
C                                                                       LSWITD   2683
 8000 FORMAT(' *** BRANCH ;',I5,';',I5,';',A,' IS DISCONNECTED')        LSWITD   2684
 8100 FORMAT(' THREE PHASE LINE FAULT CANNOT BE APPLIED - '//           LSWITD   2685
     +       'CHECK YOUR SWITCHING DATA')                               LSWITD   2686
 8200 FORMAT(' *** BRANCH ;',3A4,';',3A4,';',A,' IS DISCONNECTED')      LSWITD   2687
C                                                                       LSWITD   2688
      END                                                               LSWITD   2689
C                                                                       LSWITD   2690
      SUBROUTINE FSWIDA(                                                LSWITD   2691
     &LOUT,LIN,IUX,LCARD,KWORD,LKWORD,DWORD,LDWORD)                     LSWITD   2692
CD                                                                      LSWITD   2693
CD    THIS SUBROUTINE IS USED IN THE SWITHCING FILE PREPARATION PROCESS LSWITD   2694
CD    TO READ AND ANALYSE A SWITCHING DATA CARD.                        LSWITD   2695
CD                                                                      LSWITD   2696
      CHARACTER*80 STRING,LCARD,TCARD                                   LSWITD   2697
      CHARACTER*120 DWORD                                               LSWITD   2698
      CHARACTER*12 KWORD                                                LSWITD   2699
      LOGICAL KDIN                                                      LSWITD   2700
C                                                                       LSWITD   2701
C     READ A NEW CARD                                                   LSWITD   2702
C                                                                       LSWITD   2703
  140 CALL GETLIN(IUX,LCARD)                                            LSWITD   2704
      TCARD=LCARD                                                       LSWITD   2705
      CALL CLTOUP(LCARD,80)                                             LSWITD   2706
      IF(LCARD(1:1).EQ.'/') GOTO 140                                    LSWITD   2707
      STRING=LCARD                                                      LSWITD   2708
C                                                                       LSWITD   2709
C     LOCATE FIRST NON BLANK                                            LSWITD   2710
C                                                                       LSWITD   2711
      LPOSN=IFNBLK(STRING,77)                                           LSWITD   2712
C                                                                       LSWITD   2713
C     LOCATE THE FIRST BLANK                                            LSWITD   2714
C                                                                       LSWITD   2715
      K=IFBLK(STRING(LPOSN+1:80),80-LPOSN-1)                            LSWITD   2716
C                                                                       LSWITD   2717
      IF(STRING(LPOSN+K-1:LPOSN+K-1).EQ.'/') K=K-1                      LSWITD   2718
      LKWORD=K                                                          LSWITD   2719
          IF(LKWORD.LT.2.OR.LKWORD.GT.12)THEN                           LSWITD   2720
          WRITE(LOUT,5000)                                              LSWITD   2721
          RETURN                                                        LSWITD   2722
          ENDIF                                                         LSWITD   2723
      KWORD=' '                                                         LSWITD   2724
      KWORD(1:LKWORD)=STRING(LPOSN:LPOSN+K-1)                           LSWITD   2725
      LPOSN=LPOSN+K                                                     LSWITD   2726
      IF(KWORD(1:11).EQ.'DESCRIPTION')THEN                              LSWITD   2727
        KDIN=.TRUE.                                                     LSWITD   2728
        STRING=TCARD                                                    LSWITD   2729
      ELSE                                                              LSWITD   2730
        KDIN=.FALSE.                                                    LSWITD   2731
      ENDIF                                                             LSWITD   2732
C                                                                       LSWITD   2733
C     START ACCUMULATE THE SWITCHING DATA BY LOCATING THE FIRST NON BLANLSWITD   2734
C                                                                       LSWITD   2735
      LDWORD=0                                                          LSWITD   2736
      DWORD=' '                                                         LSWITD   2737
C                                                                       LSWITD   2738
 160  CONTINUE                                                          LSWITD   2739
      IS=IFNBLK(STRING(LPOSN:80),80-LPOSN)                              LSWITD   2740
      IF(IS.NE.0)GOTO 180                                               LSWITD   2741
C                                                                       LSWITD   2742
C     ALL BLANK SO READ ANOTHER CARD AND RETURN TO CHECK FOR NON BLANK  LSWITD   2743
C                                                                       LSWITD   2744
      CALL GETLIN(IUX,LCARD)                                            LSWITD   2745
      TCARD=LCARD                                                       LSWITD   2746
      CALL CLTOUP(LCARD,80)                                             LSWITD   2747
      IF(KDIN)THEN                                                      LSWITD   2748
        STRING=TCARD                                                    LSWITD   2749
      ELSE                                                              LSWITD   2750
        STRING=LCARD                                                    LSWITD   2751
      ENDIF                                                             LSWITD   2752
      LPOSN=1                                                           LSWITD   2753
      GOTO 160                                                          LSWITD   2754
 180  CONTINUE                                                          LSWITD   2755
C                                                                       LSWITD   2756
C     RETURN IF NO SUB KEY WORD OR DATA                                 LSWITD   2757
C                                                                       LSWITD   2758
      LPOSN=LPOSN+IS-1                                                  LSWITD   2759
      IF(STRING(LPOSN:LPOSN).EQ.'/')GOTO 300                            LSWITD   2760
C                                                                       LSWITD   2761
C     IF START FROM 80 COLUMN                                           LSWITD   2762
C                                                                       LSWITD   2763
      LDWORD=LDWORD+1                                                   LSWITD   2764
      DWORD(LDWORD:LDWORD)=STRING(LPOSN:LPOSN)                          LSWITD   2765
      IF(LPOSN.EQ.80)THEN                                               LSWITD   2766
      CALL GETLIN(IUX,LCARD)                                            LSWITD   2767
      TCARD=LCARD                                                       LSWITD   2768
      CALL CLTOUP(LCARD,80)                                             LSWITD   2769
      IF(KDIN)THEN                                                      LSWITD   2770
        STRING=TCARD                                                    LSWITD   2771
      ELSE                                                              LSWITD   2772
        STRING=LCARD                                                    LSWITD   2773
      ENDIF                                                             LSWITD   2774
      LPOSN=0                                                           LSWITD   2775
      ENDIF                                                             LSWITD   2776
C                                                                       LSWITD   2777
 190  DO 200 I=LPOSN+1,80                                               LSWITD   2778
      IF(STRING(I:I).EQ.'/'.AND.(I.EQ.80.OR.                            LSWITD   2779
     *   INDEX(STRING(I+1:80),'/').EQ.0)) GOTO 300                      LSWITD   2780
      LDWORD=LDWORD+1                                                   LSWITD   2781
      IF(LDWORD.GT.119)THEN                                             LSWITD   2782
      WRITE(LOUT,5010) KWORD,LCARD                                      LSWITD   2783
      LCARD='SWITDA: SWITCHING DATA EXCEEDS 120 CHARACTERS'             LSWITD   2784
      LMSG=45                                                           LSWITD   2785
      CALL ASTOP(LCARD,LMSG)                                            LSWITD   2786
      ENDIF                                                             LSWITD   2787
      DWORD(LDWORD:LDWORD)=STRING(I:I)                                  LSWITD   2788
 200  CONTINUE                                                          LSWITD   2789
      CALL GETLIN(IUX,LCARD)                                            LSWITD   2790
      TCARD=LCARD                                                       LSWITD   2791
      CALL CLTOUP(LCARD,80)                                             LSWITD   2792
      IF(KDIN)THEN                                                      LSWITD   2793
        STRING=TCARD                                                    LSWITD   2794
      ELSE                                                              LSWITD   2795
        STRING=LCARD                                                    LSWITD   2796
      ENDIF                                                             LSWITD   2797
      LPOSN=0                                                           LSWITD   2798
      GOTO 190                                                          LSWITD   2799
 300  CONTINUE                                                          LSWITD   2800
      LDWORD=LDWORD+1                                                   LSWITD   2801
      DWORD(LDWORD:LDWORD)=' '                                          LSWITD   2802
C                                                                       LSWITD   2803
      RETURN                                                            LSWITD   2804
C                                                                       LSWITD   2805
 5000 FORMAT(/,                                                         LSWITD   2806
     110X,'***********************************************',/,          LSWITD   2807
     210X,'* SWITCHING KEY WORD REQUIRED 2-12 CHARACTERS *',/,          LSWITD   2808
     310X,'*      TYPE "HELP" FOR MORE INFORMATIONS.     *',/,          LSWITD   2809
     410X,'***********************************************',/)          LSWITD   2810
 5010 FORMAT(/,                                                         LSWITD   2811
     11X,'**************************************************',/,        LSWITD   2812
     21X,'* WRONG DATA FOR THE SWITCHING KEY',A12,' *',/,               LSWITD   2813
     31X,'*  THE FOLLOWING SWITCHING CARD HAS BEEN IGNORED *',/,        LSWITD   2814
     41X,'**************************************************',/,        LSWITD   2815
     51X,'(',A80,')',/)                                                 LSWITD   2816
      END                                                               LSWITD   2817
      SUBROUTINE CLTOUP(CARD,LENGTH)                                    LSWITD   2818
CD                                                                      LSWITD   2819
CD    TO CONVERT SMALL LETTERS IN A CHARACTER STRING TO CAPITALS.       LSWITD   2820
CD                                                                      LSWITD   2821
      CHARACTER*(*) CARD                                                LSWITD   2822
      LOGICAL BLANK                                                     LSWITD   2823
C                                                                       LSWITD   2824
      I=0                                                               LSWITD   2825
      BLANK=.TRUE.                                                      LSWITD   2826
C                                                                       LSWITD   2827
  100 I=I+1                                                             LSWITD   2828
      IF(CARD(I:I).GE.'a'.AND.CARD(I:I).LE.'z')                         LSWITD   2829
     *   CARD(I:I)=CHAR(ICHAR(CARD(I:I))-ICHAR('a')+ICHAR('A'))         LSWITD   2830
      IF(CARD(I:I).NE.' ') BLANK=.FALSE.                                LSWITD   2831
      IF(I.LT.LENGTH) GOTO 100                                          LSWITD   2832
      IF(BLANK) CARD(1:1)='/'                                           LSWITD   2833
      RETURN                                                            LSWITD   2834
      END                                                               LSWITD   2835
C                                                                       LSWITD   2836
