CFPRIME DYNDAT                                                          DYNDAT      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 DYNDAT(FILENA,LENPAR,IUY,KLAYER)                       DYNDAT      3
CD                                                                      DYNDAT      4
CD    THIS IS THE MAIN DRIVER TO READ THE DYNAMIC DATA FROM A           DYNDAT      5
CD    USER REPARED DATA FILE. THE READING OF DIFFERENT TYPES OF DYNAMIC DYNDAT      6
CD    DEVICE DATA IS CONTROLLED BY THE FOLLOWING KEY WORDS:             DYNDAT      7
CD                                                                      DYNDAT      8
CD    KEY                                                               DYNDAT      9
CD    WORD   FUNCTION                                                   DYNDAT     10
CD    -----  -----------------------------------------                  DYNDAT     11
CD    BPAW - DYNAMIC DATA IN BPA/WSCC FORMAT                            DYNDAT     12
CD    EPGE - DYNAMIC DATA IN EPRI(OLD) FORMAT                           DYNDAT     13
CD    PECO - DYNAMIC DATA IN PECO FORMAT                                DYNDAT     14
CD    IEEE - DYNANIC DATA IN IEEE FORMAT                                DYNDAT     15
CD    PTID - DYNAMIC DATA IN PTI FORMAT                                 DYNDAT     16
CD    DGEN - DETAILED GENERATOR DATA IN EPRI FORMAT                     DYNDAT     17
CD    CGEN - CLASSICAL GENERATOR DATA IN EPRI FORMAT - MESSAGE ONLY     DYNDAT     18
CD    IBUS - INFINITE BUS DATA IN EPRI FORMAT                           DYNDAT     19
CD    MOTO - INDUCTION MOTOR DATA IN EPRI FORMAT                        DYNDAT     20
CD    NSVC - SVC DATA IN EPRI FORMAT                                    DYNDAT     21
CD    ULTC - ULTC DATA IN EPRI FORMAT                                   DYNDAT     22
CD    NSTP - STP DATA IN EPRI FORMAT                                    DYNDAT     23
CD    NSDB - DYNAMIC BRAKING DATA IN EPRI FORMAT                        DYNDAT     24
CD    NLBS - NONLINEAR LOAD DATA IN EPRI FORMAT                         DYNDAT     25
CD    NDCL - UDC DATA IN EPRI FORMAT                                    DYNDAT     26
CD   EDATA - TERMINATOR OF DATA BLOCK                                   DYNDAT     27
CD                                                                      DYNDAT     28
      INCLUDE 'PARX.INS'                                                DYNDAT     29
      INCLUDE 'CNPARX.INS'                                              DYNDAT     30
      INCLUDE 'CNB0.INS'                                                DYNDAT     31
      INCLUDE 'CNPT.INS'                                                DYNDAT     32
      INCLUDE 'CNREN.INS'                                               DYNDAT     33
      INCLUDE 'CNMNEW.INS'                                              DYNDAT     34
      INCLUDE 'CNB19.INS'                                               DYNDAT     35
      INCLUDE 'CNFLAG.INS'                                              DYNDAT     36
      INCLUDE 'UDCA.INS'                                                DYNDAT     37
      INCLUDE 'UDCB.INS'                                                DYNDAT     38
      INCLUDE 'UDCF.INS'                                                DYNDAT     39
      INCLUDE 'UDCG.INS'                                                DYNDAT     40
      INCLUDE 'UDCH.INS'                                                DYNDAT     41
C                                                                       DYNDAT     42
      INCLUDE 'CNLSTA.INS'                                              DYNDAT     43
      INCLUDE 'CNJPT.INS'                                               DYNDAT     44
      INCLUDE 'CNJDAT.INS'                                              DYNDAT     45
      INCLUDE 'CNTGED.INS'                                              DYNDAT     46
      INCLUDE 'CNLUN.INS'                                               DYNDAT     47
      INCLUDE 'CNUNIT.INS'                                              DYNDAT     48
      INCLUDE 'CNMSG.INS'                                               DYNDAT     49
C                                                                       DYNDAT     50
      INTEGER INVBS(NM)                                                 DYNDAT     51
C                                                                       DYNDAT     52
      LOGICAL READOK                                                    DYNDAT     53
C                                                                       DYNDAT     54
      CHARACTER*80 SIMBUF,EMSG,STRING,TITLE(6)                          DYNDAT     55
      CHARACTER*12 BUSNAM,BUSR1(5),IBLK12,CASEID                        DYNDAT     56
      CHARACTER*4 ISEM,IEND,ISIDAT(19)                                  DYNDAT     57
      CHARACTER*5 EDATA                                                 DYNDAT     58
C                                                                       DYNDAT     59
      CHARACTER*7 SUBPMT                                                DYNDAT     60
      CHARACTER*50 FILENA                                               DYNDAT     61
C                                                                       DYNDAT     62
      EQUIVALENCE (CASEID,ICASID(1))                                    DYNDAT     63
      EQUIVALENCE (TITLE(1),ITITLE(1,1))                                DYNDAT     64
C                                                                       DYNDAT     65
      DATA ISIDAT/'DESC','BSTA','BPAW','EPGE','PECO','IEEE','PTID',     DYNDAT     66
     +            'DGEN','CGEN','RGEN','IBUS','MOTO','NSVC','ULTC',     DYNDAT     67
     +            'NRAN','NSTP','NSDB','NLBS','NDCL'/                   DYNDAT     68
      DATA IEND/' END'/,EDATA/'EDATA'/,IBLK12/'            '/           DYNDAT     69
C                                                                       DYNDAT     70
      DATA READOK /.TRUE./                                              DYNDAT     71
C                                                                       DYNDAT     72
      LDEB=(JDEB(4).NE.0)                                               DYNDAT     73
C                                                                       DYNDAT     74
      SUBPMT='DYNDAT '                                                  DYNDAT     75
      IEBK=0                                                            DYNDAT     76
C                                                                       DYNDAT     77
C                                                                       DYNDAT     78
       STRING='ENTER DYNAMIC DATA FILE NAME:'                           DYNDAT     79
       EMSG='ERROR IN OPENING DYNAMIC DATA FILE'                        DYNDAT     80
C                                                                       DYNDAT     81
      IKEY=1                                                            DYNDAT     82
      JLENG=0                                                           DYNDAT     83
C                                                                       DYNDAT     84
      WRITE(LOUT,*)                                                     DYNDAT     85
C                                                                       DYNDAT     86
      IF(.NOT.CFLRUN)THEN                                               DYNDAT     87
        CALL FILEMG(IU50,29,STRING,34,EMSG,SUBPMT,IKEY,JLENG,IEBK)      DYNDAT     88
        IF(IEBK.NE.0)RETURN                                             DYNDAT     89
      ENDIF                                                             DYNDAT     90
C                                                                       DYNDAT     91
      WRITE(LOUT,'(/A/)') '  READING DYNAMIC DATA FILE.  WAIT ...'      DYNDAT     92
C                                                                       DYNDAT     93
      IUX=IU50                                                          DYNDAT     94
C                                                                       DYNDAT     95
  100 CONTINUE                                                          DYNDAT     96
      JSEM=0                                                            DYNDAT     97
      CALL GETLIN(IUX,SIMBUF)                                           DYNDAT     98
      READ(SIMBUF,1010) ISEM                                            DYNDAT     99
      IF(LDEB)WRITE(LOUT,1230) ISEM                                     DYNDAT    100
      IF(ISEM.EQ.IEND) GOTO 500                                         DYNDAT    101
  110 JSEM=JSEM+1                                                       DYNDAT    102
      IF(JSEM.GT.19)GOTO 490                                            DYNDAT    103
      IF(ISEM.EQ.ISIDAT(JSEM)) GOTO 120                                 DYNDAT    104
      GOTO 110                                                          DYNDAT    105
C           'DESC','BSTA','BPAW','EPGE','PECO','IEEE','PTID','DGEN',    DYNDAT    106
  120 GOTO ( 125,   128,   130,   135,   140,   150 ,  160,   170,      DYNDAT    107
C           'CGEN','RGEN','IBUS','MOTO','NSVC','ULTC','NRAN','NSTP',    DYNDAT    108
     +       175,   180,    190,   260,   290,   300,   310,   320,     DYNDAT    109
C           'NSDB','NLBS','NDCL'                                        DYNDAT    110
     +       330,    340,   400) JSEM                                   DYNDAT    111
C                                                                       DYNDAT    112
  125 CONTINUE                                                          DYNDAT    113
C --------------------------------------------------                    DYNDAT    114
C !  READ CASE ID AND TITLES                                            DYNDAT    115
C --------------------------------------------------                    DYNDAT    116
C                                                                       DYNDAT    117
      CALL GETLIN (IUX,SIMBUF)                                          DYNDAT    118
      IF(SIMBUF(1:5).EQ.EDATA) GOTO 100                                 DYNDAT    119
      READ (SIMBUF,'(A12)') CASEID                                      DYNDAT    120
      DO 127 II=1,6                                                     DYNDAT    121
        CALL GETLIN (IUX,SIMBUF)                                        DYNDAT    122
        IF(SIMBUF(1:5).EQ.EDATA) GOTO 100                               DYNDAT    123
        READ (SIMBUF,'(A80)') TITLE(II)                                 DYNDAT    124
127   CONTINUE                                                          DYNDAT    125
C                                                                       DYNDAT    126
      CALL GETLIN (IUX,SIMBUF)                                          DYNDAT    127
      IF(SIMBUF(1:5).NE.EDATA) THEN                                     DYNDAT    128
        ISEM=SIMBUF(2:5)                                                DYNDAT    129
        GOTO 490                                                        DYNDAT    130
      ENDIF                                                             DYNDAT    131
C                                                                       DYNDAT    132
      GOTO 100                                                          DYNDAT    133
C                                                                       DYNDAT    134
  128 CONTINUE                                                          DYNDAT    135
C --------------------------------------------------                    DYNDAT    136
C !  BSTA FLAG                                                          DYNDAT    137
C --------------------------------------------------                    DYNDAT    138
C                                                                       DYNDAT    139
      CALL GETLIN (IUX,SIMBUF)                                          DYNDAT    140
      IF(SIMBUF(1:5).EQ.EDATA) GOTO 100                                 DYNDAT    141
      READ (SIMBUF,'(I5)') II                                           DYNDAT    142
C                                                                       DYNDAT    143
      IF(II.EQ.1)THEN                                                   DYNDAT    144
        IBGSTA=-NGSREC                                                  DYNDAT    145
        IF(IBGSTA.EQ.0)IBGSTA=1                                         DYNDAT    146
        NGSREC=0                                                        DYNDAT    147
      ELSE                                                              DYNDAT    148
        NGSREC=-IBGSTA                                                  DYNDAT    149
        IF(NGSREC.LT.0)NGSREC=0                                         DYNDAT    150
        IBGSTA=0                                                        DYNDAT    151
      ENDIF                                                             DYNDAT    152
C                                                                       DYNDAT    153
      CALL GETLIN (IUX,SIMBUF)                                          DYNDAT    154
      IF(SIMBUF(1:5).NE.EDATA) THEN                                     DYNDAT    155
        ISEM=SIMBUF(2:5)                                                DYNDAT    156
        GOTO 490                                                        DYNDAT    157
      ENDIF                                                             DYNDAT    158
C                                                                       DYNDAT    159
      GOTO 100                                                          DYNDAT    160
C --------------------------------------------------                    DYNDAT    161
C !  GENERATOR AND CONTROL DATA IN BPA/WSCC FORMAT !                    DYNDAT    162
C --------------------------------------------------                    DYNDAT    163
C                                                                       DYNDAT    164
  130 CONTINUE                                                          DYNDAT    165
C                                                                       DYNDAT    166
      IF(KLFO.EQ.0)THEN                                                 DYNDAT    167
        MSG(1)=' *** ERROR IMPROPER USE OF BPAW DATA BLOCK WITH BUS'    DYNDAT    168
        MSG(2)='     NUMBER BASED LOAD FLOW FORMAT'                     DYNDAT    169
        CALL PRTMSG(2)                                                  DYNDAT    170
        IEBK=99                                                         DYNDAT    171
        GOTO 500                                                        DYNDAT    172
      ELSE                                                              DYNDAT    173
        IUY=IU58                                                        DYNDAT    174
        IF(READOK)THEN                                                  DYNDAT    175
          CALL READBP(IUX,IUY)                                          DYNDAT    176
          READOK=.FALSE.                                                DYNDAT    177
          GOTO 100                                                      DYNDAT    178
        ELSE                                                            DYNDAT    179
          GOTO 495                                                      DYNDAT    180
        ENDIF                                                           DYNDAT    181
      ENDIF                                                             DYNDAT    182
C                                                                       DYNDAT    183
C --------------------------------------------------                    DYNDAT    184
C !  GENERATOR AND CONTROL DATA IN EPRI/OLD FORMAT !                    DYNDAT    185
C --------------------------------------------------                    DYNDAT    186
C                                                                       DYNDAT    187
  135 CONTINUE                                                          DYNDAT    188
C                                                                       DYNDAT    189
      IF(KLFO.EQ.0)THEN                                                 DYNDAT    190
        MSG(1)=' *** ERROR IMPROPER USE OF EPGE DATA BLOCK WITH BUS'    DYNDAT    191
        MSG(2)='     NUMBER BASED LOAD FLOW FORMAT'                     DYNDAT    192
        CALL PRTMSG(2)                                                  DYNDAT    193
        IEBK=99                                                         DYNDAT    194
        GOTO 500                                                        DYNDAT    195
      ELSE                                                              DYNDAT    196
        IUY=IU58                                                        DYNDAT    197
        IF(READOK)THEN                                                  DYNDAT    198
          CALL READEP(IUX,IUY)                                          DYNDAT    199
          READOK=.FALSE.                                                DYNDAT    200
          GOTO 100                                                      DYNDAT    201
        ELSE                                                            DYNDAT    202
          GOTO 495                                                      DYNDAT    203
        ENDIF                                                           DYNDAT    204
      ENDIF                                                             DYNDAT    205
C                                                                       DYNDAT    206
C ----------------------------------------------                        DYNDAT    207
C !  GENERATOR AND CONTROL DATA IN PECO FORMAT !                        DYNDAT    208
C ----------------------------------------------                        DYNDAT    209
C                                                                       DYNDAT    210
  140 CONTINUE                                                          DYNDAT    211
C                                                                       DYNDAT    212
      IF(KLFO.NE.0)THEN                                                 DYNDAT    213
        MSG(1)=' *** ERROR IMPROPER USE OF PECO DATA BLOCK WITH BUS'    DYNDAT    214
        MSG(2)='     NAME BASED LOAD FLOW FORMAT'                       DYNDAT    215
        CALL PRTMSG(2)                                                  DYNDAT    216
        IEBK=99                                                         DYNDAT    217
        GOTO 500                                                        DYNDAT    218
      ELSE                                                              DYNDAT    219
        MSG(1)=' *** ERROR PECO LOAD FLOW FORMAT NOT INSTALLED'         DYNDAT    220
        CALL PRTMSG(1)                                                  DYNDAT    221
        RETURN                                                          DYNDAT    222
      ENDIF                                                             DYNDAT    223
C ----------------------------------------------                        DYNDAT    224
C !  GENERATOR AND CONTROL DATA IN IEEE FORMAT !                        DYNDAT    225
C ----------------------------------------------                        DYNDAT    226
C                                                                       DYNDAT    227
  150 CONTINUE                                                          DYNDAT    228
      IF(READOK)THEN                                                    DYNDAT    229
        CALL READIE(IUX,IUY)                                            DYNDAT    230
        READOK=.FALSE.                                                  DYNDAT    231
        GOTO 100                                                        DYNDAT    232
      ELSE                                                              DYNDAT    233
        GOTO 495                                                        DYNDAT    234
      ENDIF                                                             DYNDAT    235
C ........................................................              DYNDAT    236
C ---------------------------------------------                         DYNDAT    237
C !  GENERATOR AND CONTROL DATA IN PTI FORMAT !                         DYNDAT    238
C ---------------------------------------------                         DYNDAT    239
C                                                                       DYNDAT    240
  160 CONTINUE                                                          DYNDAT    241
      IF(KLFO.NE.0)THEN                                                 DYNDAT    242
        MSG(1)=' *** ERROR IMPROPER USE OF PTID DATA BLOCK WITH BUS'    DYNDAT    243
        MSG(2)='       NAME BASED LOAD FLOW FORMAT'                     DYNDAT    244
        CALL PRTMSG(2)                                                  DYNDAT    245
        IEBK=99                                                         DYNDAT    246
        GOTO 500                                                        DYNDAT    247
      ELSE                                                              DYNDAT    248
        IF(READOK)THEN                                                  DYNDAT    249
          CALL READPT(IUX,IUY)                                          DYNDAT    250
          READOK=.FALSE.                                                DYNDAT    251
          CALL COVPTD                                                   DYNDAT    252
          GOTO 100                                                      DYNDAT    253
        ELSE                                                            DYNDAT    254
          GOTO 495                                                      DYNDAT    255
        ENDIF                                                           DYNDAT    256
      ENDIF                                                             DYNDAT    257
C ........................................................              DYNDAT    258
C                                                                       DYNDAT    259
  170 CONTINUE                                                          DYNDAT    260
C                                                                       DYNDAT    261
C  READING DETAILED GENERATOR DATA                                      DYNDAT    262
C                                                                       DYNDAT    263
      CALL RDGEDA(ICODE,IUX,IUY,IEBK)                                   DYNDAT    264
      READOK=.FALSE.                                                    DYNDAT    265
      IF(IEBK.NE.0)THEN                                                 DYNDAT    266
         MSG(1)='PROBLEM READING GENERATOR DYNAMIC DATA'                DYNDAT    267
         CALL ASTOP (MSG(1),38)                                         DYNDAT    268
      ENDIF                                                             DYNDAT    269
      GOTO 100                                                          DYNDAT    270
C                                                                       DYNDAT    271
  175 CONTINUE                                                          DYNDAT    272
C                                                                       DYNDAT    273
C  READING CLASSICAL GENERATOR DATA                                     DYNDAT    274
C                                                                       DYNDAT    275
      MSG(1)=' DATA FORMAT FOR CLASSICAL GENERATORS HAS BEEN CHANGED'   DYNDAT    276
      MSG(2)=' PLEASE REFER THE USER MANUAL FOR THE NEW FORMAT'         DYNDAT    277
      CALL PRTMSG(2)                                                    DYNDAT    278
      MSG(1)=' PLEASE MODIFY YOUR DYNAMIC DATA FILE.'                   DYNDAT    279
      CALL ASTOP(MSG(1),38)                                             DYNDAT    280
C                                                                       DYNDAT    281
  180 CONTINUE                                                          DYNDAT    282
C                                                                       DYNDAT    283
C  READING GENERATOR DYNAMIC DATA MODIFICATIONS                         DYNDAT    284
C                                                                       DYNDAT    285
      IF(JNT.LE.0)THEN                                                  DYNDAT    286
        MSG(1)=' *** ERROR - DYNAMIC DATA FOR GENERATORS HAVE '//       DYNDAT    287
     +         'NOT BEEN READ'                                          DYNDAT    288
        CALL PRTMSG(1)                                                  DYNDAT    289
        MSG(1)='DYNDAT: ERROR READING GENERATOR DYNAMIC DATA '//        DYNDAT    290
     +         'MODIFICATIONS'                                          DYNDAT    291
        CALL ASTOP (MSG(1),58)                                          DYNDAT    292
      ENDIF                                                             DYNDAT    293
      CALL RRDGED (ICODE,IUX,IUY,IEBK)                                  DYNDAT    294
      READOK=.FALSE.                                                    DYNDAT    295
      IF(IEBK.NE.0)THEN                                                 DYNDAT    296
        MSG(1)=' *** WARNING - PROBLEM READING GENERATOR '//            DYNDAT    297
     +         'DYNAMIC DATA MODIFICATIONS'                             DYNDAT    298
        CALL PRTMSG(1)                                                  DYNDAT    299
        GOTO 600                                                        DYNDAT    300
      ENDIF                                                             DYNDAT    301
      GOTO 100                                                          DYNDAT    302
C                                                                       DYNDAT    303
  190 CONTINUE                                                          DYNDAT    304
C                                                                       DYNDAT    305
C  READING INFINITE BUS DATA                                            DYNDAT    306
C                                                                       DYNDAT    307
      CALL GETLIN(IUX,SIMBUF)                                           DYNDAT    308
      IF(SIMBUF(1:5).EQ.EDATA) GOTO 250                                 DYNDAT    309
      IF(KLFO.NE.0)THEN                                                 DYNDAT    310
C        ..........................................                     DYNDAT    311
C        :INFINITE BUS DATA IN ALFA-NUMERIC FORMAT:                     DYNDAT    312
C        :........................................:                     DYNDAT    313
         READ(SIMBUF,1160) (BUSR1(J),J=1,5)                             DYNDAT    314
         DO 210 J=1,5                                                   DYNDAT    315
         BUSNAM=BUSR1(J)                                                DYNDAT    316
         IF(BUSNAM.EQ.IBLK12)GOTO 210                                   DYNDAT    317
         CALL CHKBUS(BUSNAM,NLF)                                        DYNDAT    318
            IF(NLF.LE.0)THEN                                            DYNDAT    319
            WRITE(MSG(1),1035) BUSNAM                                   DYNDAT    320
            CALL PRTMSG(1)                                              DYNDAT    321
            GOTO 210                                                    DYNDAT    322
            ENDIF                                                       DYNDAT    323
         JIFBUS=JIFBUS+1                                                DYNDAT    324
            IF(JIFBUS.GT.NXM)THEN                                       DYNDAT    325
            WRITE(MSG(1),1045) BUSNAM                                   DYNDAT    326
            CALL PRTMSG(1)                                              DYNDAT    327
            IEBK=1                                                      DYNDAT    328
            GOTO 190                                                    DYNDAT    329
            ENDIF                                                       DYNDAT    330
         NIFBUS(JIFBUS)=NLF                                             DYNDAT    331
  210    CONTINUE                                                       DYNDAT    332
C                                                                       DYNDAT    333
       ELSE                                                             DYNDAT    334
C     .....................                                             DYNDAT    335
C     : BUS NUMBER FORMAT :                                             DYNDAT    336
C     :...................:                                             DYNDAT    337
         IF(SIMBUF(1:5).EQ.EDATA) GOTO 250                              DYNDAT    338
         READ(SIMBUF,1020) (INVBS(N),N=1,16)                            DYNDAT    339
         DO 240 N=1,16                                                  DYNDAT    340
           IF(INVBS(N).EQ.0) GOTO 240                                   DYNDAT    341
           NLF=INVBS(N)                                                 DYNDAT    342
           IF(MNEW(NLF).NE.0) GOTO 220                                  DYNDAT    343
           IEBK=1                                                       DYNDAT    344
           WRITE(MSG(1),1030) NLF                                       DYNDAT    345
           CALL PRTMSG(1)                                               DYNDAT    346
           GOTO 240                                                     DYNDAT    347
  220      CONTINUE                                                     DYNDAT    348
           JIFBUS=JIFBUS+1                                              DYNDAT    349
           IF(JIFBUS.GT.NXM)THEN                                        DYNDAT    350
           WRITE(MSG(1),1040) NLF                                       DYNDAT    351
           CALL PRTMSG(1)                                               DYNDAT    352
           IEBK=1                                                       DYNDAT    353
           GOTO 190                                                     DYNDAT    354
           ENDIF                                                        DYNDAT    355
           NIFBUS(JIFBUS)=NLF                                           DYNDAT    356
  240   CONTINUE                                                        DYNDAT    357
      ENDIF                                                             DYNDAT    358
C                                                                       DYNDAT    359
      GOTO 190                                                          DYNDAT    360
C                                                                       DYNDAT    361
  250 CONTINUE                                                          DYNDAT    362
      GOTO 100                                                          DYNDAT    363
  260 CONTINUE                                                          DYNDAT    364
C                                                                       DYNDAT    365
C  READING INDUCTION MOTOR DATA                                         DYNDAT    366
C                                                                       DYNDAT    367
      CALL RIMODA(IUX,IUY,IEBK)                                         DYNDAT    368
      READOK=.FALSE.                                                    DYNDAT    369
C                                                                       DYNDAT    370
      GOTO 100                                                          DYNDAT    371
C                                                                       DYNDAT    372
  290 CONTINUE                                                          DYNDAT    373
C                                                                       DYNDAT    374
C  READING SVC DATA                                                     DYNDAT    375
C                                                                       DYNDAT    376
      CALL RSVCDA(IUX,IUY,IEBK)                                         DYNDAT    377
      READOK=.FALSE.                                                    DYNDAT    378
      GOTO 100                                                          DYNDAT    379
C                                                                       DYNDAT    380
  300 CONTINUE                                                          DYNDAT    381
C                                                                       DYNDAT    382
C  READING ULTC DATA                                                    DYNDAT    383
C                                                                       DYNDAT    384
      CALL RULTCD(IUX,IUY,IEBK)                                         DYNDAT    385
      GOTO 100                                                          DYNDAT    386
C                                                                       DYNDAT    387
  310 CONTINUE                                                          DYNDAT    388
C                                                                       DYNDAT    389
C  READING RANI DATA                                                    DYNDAT    390
C                                                                       DYNDAT    391
      CALL RRANDA(IUX,IUY,IEBK)                                         DYNDAT    392
      GOTO 100                                                          DYNDAT    393
C                                                                       DYNDAT    394
  320 CONTINUE                                                          DYNDAT    395
C                                                                       DYNDAT    396
C  READING STP DATA                                                     DYNDAT    397
C                                                                       DYNDAT    398
      CALL RSTPDA(IUX,IUY,IEBK)                                         DYNDAT    399
      GOTO 100                                                          DYNDAT    400
C                                                                       DYNDAT    401
  330 CONTINUE                                                          DYNDAT    402
C                                                                       DYNDAT    403
C  READING SDB DATA                                                     DYNDAT    404
C                                                                       DYNDAT    405
      CALL RSDBDA(IUX,IUY,IEBK)                                         DYNDAT    406
      GOTO 100                                                          DYNDAT    407
C                                                                       DYNDAT    408
  340 CONTINUE                                                          DYNDAT    409
C                                                                       DYNDAT    410
C  READING NON-LINEAR LOAD DATA                                         DYNDAT    411
C                                                                       DYNDAT    412
      CALL RNLBDA(IUX,IUY,IEBK)                                         DYNDAT    413
      READOK=.FALSE.                                                    DYNDAT    414
      GOTO 100                                                          DYNDAT    415
C                                                                       DYNDAT    416
C 350  CONTINUE                                                         DYNDAT    417
C                                                                       DYNDAT    418
C  READING NON-LINEAR LOAD DATA IN WSCC FORMAT                          DYNDAT    419
C                                                                       DYNDAT    420
C      CALL EPLDAT(IUX,IUY,IEBK)                                        DYNDAT    421
C      GOTO 100                                                         DYNDAT    422
  400 CONTINUE                                                          DYNDAT    423
C                                                                       DYNDAT    424
C     Read the DCCONT control card                                      DYNDAT    425
C                                                                       DYNDAT    426
      DTIME = 0.01                                                      DYNDAT    427
      STIME = 0.01                                                      DYNDAT    428
      CTIME = 0.01                                                      DYNDAT    429
      ALPHAT = 0.0                                                      DYNDAT    430
      ALPHAC = 0.0                                                      DYNDAT    431
      ALPHAL = 0.0                                                      DYNDAT    432
      XLPTOL = 0.001                                                    DYNDAT    433
C                                                                       DYNDAT    434
      READ (IUX,1220) STIME, CTIME, ALPHAT, ALPHAC, ALPHAL, XLPTOL,     DYNDAT    435
     1                  NDPSTP, NCPSTP                                  DYNDAT    436
C                                                                       DYNDAT    437
      SDBG = .TRUE.                                                     DYNDAT    438
      IF (NDPSTP .LE. 0) NDPSTP = 1                                     DYNDAT    439
      IF (NCPSTP .LE. 0) NCPSTP = 1                                     DYNDAT    440
C                                                                       DYNDAT    441
      ITEM = NDPSTP / 2                                                 DYNDAT    442
      IF (ITEM * 2 .EQ. NDPSTP) THEN                                    DYNDAT    443
         NDPSTP = NDPSTP - 1                                            DYNDAT    444
         IF (NDPSTP .LE. 0) NDPSTP = 1                                  DYNDAT    445
      END IF                                                            DYNDAT    446
C                                                                       DYNDAT    447
      ITEM = NCPSTP / 2                                                 DYNDAT    448
      IF (ITEM * 2 .EQ. NCPSTP) THEN                                    DYNDAT    449
         NCPSTP = NCPSTP - 1                                            DYNDAT    450
         IF (NCPSTP .LE. 0) NCPSTP = 1                                  DYNDAT    451
      END IF                                                            DYNDAT    452
C                                                                       DYNDAT    453
      THEVIN = .FALSE.                                                  DYNDAT    454
C                                                                       DYNDAT    455
      CALL UDREAD(IUX)                                                  DYNDAT    456
      IF(IERCNT.GT.0)THEN                                               DYNDAT    457
      MSG(1)=' *** DATA READING TERMINATED DUE TO UDC INPUT ERRORS'     DYNDAT    458
      CALL PRTMSG(1)                                                    DYNDAT    459
      MSG(1)='TERMINATED DUE TO UDC INPUT ERRORS'                       DYNDAT    460
      CALL ASTOP(MSG(1),34)                                             DYNDAT    461
      ENDIF                                                             DYNDAT    462
C                                                                       DYNDAT    463
      GOTO 100                                                          DYNDAT    464
C                                                                       DYNDAT    465
  490 CONTINUE                                                          DYNDAT    466
C                                                                       DYNDAT    467
        WRITE(MSG(1),1240) ISEM                                         DYNDAT    468
        CALL PRTMSG(1)                                                  DYNDAT    469
        IEBK=99                                                         DYNDAT    470
        GOTO 500                                                        DYNDAT    471
C                                                                       DYNDAT    472
  495  MSG(1)=' *** ERROR - DYNAMIC DATA INPUT SEQUENCE IS INVALID'     DYNDAT    473
       CALL PRTMSG(1)                                                   DYNDAT    474
       MSG(1)='DYNDAT: READING OF DYNAMIC DATA IS TERMINATED'           DYNDAT    475
       CALL ASTOP(MSG(1),45)                                            DYNDAT    476
C                                                                       DYNDAT    477
  500 CONTINUE                                                          DYNDAT    478
C                                                                       DYNDAT    479
      IF(IEBK.NE.0) THEN                                                DYNDAT    480
        MSG(1)=' *** WARNING PROBLEM READING DYNAMIC DATA FILE'         DYNDAT    481
        CALL PRTMSG(1)                                                  DYNDAT    482
      ENDIF                                                             DYNDAT    483
C                                                                       DYNDAT    484
 600  CONTINUE                                                          DYNDAT    485
C                                                                       DYNDAT    486
      CALL CLOSEF(IUX)                                                  DYNDAT    487
C                                                                       DYNDAT    488
      RETURN                                                            DYNDAT    489
                                                                        DYNDAT    490
C                                                                       DYNDAT    491
 1010 FORMAT(1X,A4)                                                     DYNDAT    492
 1020 FORMAT(16I5)                                                      DYNDAT    493
 1030 FORMAT(' *** ERROR INFINITE BUS ',I5,' NOT IN BASED LOADFLOW')    DYNDAT    494
 1035 FORMAT(' *** ERROR INFINITE BUS ',A12,' NOT IN BASED LOADFLOW')   DYNDAT    495
 1040 FORMAT(' *** ERROR INFINITE BUS ',I5,' EXCEEDS THE LIMIT OF',I6)  DYNDAT    496
 1045 FORMAT(' *** ERROR INFINITE BUS ',A12,' EXCEEDS THE LIMIT OF',I6) DYNDAT    497
 1160 FORMAT(5A12)                                                      DYNDAT    498
 1220 FORMAT(6F9.5, 2I2)                                                DYNDAT    499
 1230 FORMAT(1X,'ISEM= #',A4,'#')                                       DYNDAT    500
 1240 FORMAT(' *** ERROR INVALID DATA BLOCK KEYWORD: ',A4)              DYNDAT    501
       END                                                              DYNDAT    502
