CFPRIME RUDMDA                                                          RUDMDA      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 RUDMDA(NUF,IUX,IU16X,JTLN1,SIMBUF)                     RUDMDA      3
CD                                                                      RUDMDA      4
CD    TO READ THE COMMON DATA OF AN USER DEFINED AC DYNAMIC MODELS.     RUDMDA      5
CD                                                                      RUDMDA      6
CD    ROUTINE INPUTS:                                                   RUDMDA      7
CD                                                                      RUDMDA      8
CD    NUF=1 USER DEFINED EXCITER                                        RUDMDA      9
CD       =2              STABILIZER                                     RUDMDA     10
CD       =3              UEL (JTLN1=0), OEL (JTLN1=1)                   RUDMDA     11
CD       =4              GOVERNOR                                       RUDMDA     12
CD       =5              SVC                                            RUDMDA     13
CD       =6*             RANI          (NEEDS JTLN1)                    RUDMDA     14
CD       =7              STC                                            RUDMDA     15
CD       =8              STP                                            RUDMDA     16
CD       =9              SDB                                            RUDMDA     17
CD                                                                      RUDMDA     18
CD    IUX IS THE UNIT OF WHICH THE DATA IS READ                         RUDMDA     19
CD    IU16X IS NOT USED IN THE CURRENT VERSION                          RUDMDA     20
CD    JTNL1 IS THE POSITION OF TDDAT USED BY RANI                       RUDMDA     21
CD    SIMBUF IS THE 80 CHARACTER BUF                                    RUDMDA     22
CD                                                                      RUDMDA     23
*IF FACTS                                                               RUDMDA     24
      INCLUDE 'PARX.INS'                                                RUDMDA     25
      INCLUDE 'CNPT.INS'                                                RUDMDA     26
      INCLUDE 'CNB19.INS'                                               RUDMDA     27
      INCLUDE 'CNFLAG.INS'                                              RUDMDA     28
      INCLUDE 'CNPARX.INS'                                              RUDMDA     29
      INCLUDE 'CNUNIT.INS'                                              RUDMDA     30
      INCLUDE 'CNTMDA.INS'                                              RUDMDA     31
      INCLUDE 'CNMSG.INS'                                               RUDMDA     32
C                                                                       RUDMDA     33
      CHARACTER*80 SIMBUF                                               RUDMDA     34
      CHARACTER*8 BLNAME                                                RUDMDA     35
      CHARACTER*12 BUSNAM,BUSR1(2),BUSR2(2),BUSNX(5),LPGNAM             RUDMDA     36
      CHARACTER*4 INPNA(4),IENAME(20),IGNAME(20),ISNAME(20),IRNAME(20)  RUDMDA     37
     &,ITNAME(20),IPNAME(20),IDNAME(20),IUNAME(60),IXNAME(80),LPGID     RUDMDA     38
      CHARACTER*3 INUL3,BLTYP,BTYPE(71),UNAM(9)                         RUDMDA     39
      CHARACTER*2 KCKT(8)                                               RUDMDA     40
      INTEGER*4 IBUSN(3),JCKT                                           RUDMDA     41
      CHARACTER*2 CKT                                                   RUDMDA     42
      DIMENSION XNSIGN(4),NIBL(16)                                      RUDMDA     43
C                                                                       RUDMDA     44
      EQUIVALENCE (IBUSN(1),BUSNAM,BLNAME)                              RUDMDA     45
C                                                                       RUDMDA     46
      EQUIVALENCE (IUNAME(1),IXNAME(21))                                RUDMDA     47
C                                                                       RUDMDA     48
      EQUIVALENCE (LPGID,ILPGID)                                        RUDMDA     49
C                                                                       RUDMDA     50
      DATA INUL3/'   '/                                                 RUDMDA     51
C                                                                       RUDMDA     52
C     USER DEFINED DEVICE NAME                                          RUDMDA     53
C                                                                       RUDMDA     54
      DATA UNAM/'EXC','PSS','EXL','GOV','SVC','RAN','STC','SPS','SDB'/  RUDMDA     55
C                                                                       RUDMDA     56
C     BLOCK TYPE GENERAL AND END BLOCKS                                 RUDMDA     57
C                                                                       RUDMDA     58
      DATA BTYPE/' GN',' IN',' PI',' WO',' LL',' SW',' HV',' LV','MUL', RUDMDA     59
     1           'DIV','IVL','DEL','SIN','COS','TAN','ASN','ACS','ATN', RUDMDA     60
     2           'EXP','LOG','ABS',' SS','NLF',' TF','DIG','A/D','LSW', RUDMDA     61
     3           'TIM','HYS','CTR',' E1',' E2',' E3',' E4',' E5',' E6', RUDMDA     62
     4           ' E7',' E8','E15','E30','E31','E34','RHL',' T1',' T4', RUDMDA     63
     5           'T20','T22','OF2','OF1',' LF','SD1','SD2','SD3','SD4', RUDMDA     64
     6           'SD5','SD6','SD7','SD8','SD9','   ','   ','   ','   ', RUDMDA     65
     7           '   ','   ','   ','   ','   ','POW','COM',' FL'/       RUDMDA     66
C                                                                       RUDMDA     67
C     INPUT SIGNAL NAMES OF EXCITATION SYSTEM, PSS AND UEL              RUDMDA     68
C                                                                       RUDMDA     69
      DATA IENAME/'  VC','  AC','PACC','  VT','  AT','  VD','  VQ',     RUDMDA     70
     1            '  ID','  IQ','  PT','  QT','  DW','CONT','TIME',     RUDMDA     71
     2            ' EFD',' IFD','  VS','  VU','  VF','VREF'/            RUDMDA     72
C                                                                       RUDMDA     73
C     INPUT SIGNAL NAMES OF GENERATOR PRIME MOVER                       RUDMDA     74
C                                                                       RUDMDA     75
      DATA IGNAME/'  VG',' VG2','PACC','  VT','  AT','  VD','  VQ',     RUDMDA     76
     1            '  ID','  IQ','  PT','  QT','  DW','CONT','TIME',     RUDMDA     77
     2            '    ','    ','    ','    ','    ','VREF'/            RUDMDA     78
C                                                                       RUDMDA     79
C     INPUT SIGNAL NAMES OF SVC                                         RUDMDA     80
C                                                                       RUDMDA     81
      DATA ISNAME/'ISVC','ITCR','QSVC','QTCR','BSVC','BTCR','VSVC',     RUDMDA     82
     1            '    ','ASVC','    ','STCR','SSVC','CONT','TIME',     RUDMDA     83
     2            '    ','    ','    ','    ','    ','VREF'/            RUDMDA     84
C                                                                       RUDMDA     85
C     INPUT SIGNAL NAMES OF RANI                                        RUDMDA     86
C                                                                       RUDMDA     87
      DATA IRNAME/'IRAN','ITCR','QRAN','QTCR','BRAN','BTCR','  V1',     RUDMDA     88
     1            '  V2','  A1','  A2','STCR','SRAN','CONT','TIME',     RUDMDA     89
     2            'GRAN','PRAN','XRAN','    ','    ','VREF'/            RUDMDA     90
C                                                                       RUDMDA     91
C     INPUT SIGNAL NAMES OF STC                                         RUDMDA     92
C                                                                       RUDMDA     93
      DATA ITNAME/'  I1','  I2','  P1','  P2','TSTC','    ','  V1',     RUDMDA     94
     1            '  V2','  A1','  A2','SSTC','    ','CONT','TIME',     RUDMDA     95
     2            '  Q1','  Q2','    ','    ','    ','VREF'/            RUDMDA     96
C                                                                       RUDMDA     97
C     INPUT SIGNAL NAMES OF SPS                                         RUDMDA     98
C                                                                       RUDMDA     99
      DATA IPNAME/'  I1','  I2','  P1','  P2','    ','TSPS','  V1',     RUDMDA    100
     1            '  V2','  A1','  A2','SSTC','    ','CONT','TIME',     RUDMDA    101
     2            '  Q1','  Q2','    ','    ','    ','VREF'/            RUDMDA    102
C                                                                       RUDMDA    103
C     INPUT SIGNAL NAMES OF SDB                                         RUDMDA    104
C                                                                       RUDMDA    105
      DATA IDNAME/'ISDB','    ','MSDB','    ','YSDB','    ','VSDB',     RUDMDA    106
     1            '    ','ASDB','    ','    ','SSDB','CONT','TIME',     RUDMDA    107
     2            '    ','    ','    ','    ','    ','    '/            RUDMDA    108
C                                                                       RUDMDA    109
      DATA IUNAME/'VR01','VR02','VR03','VR04','VR05','VR06','VR07',     RUDMDA    110
     1            'VR08','VR09','VR10','AR01','AR02','AR03','AR04',     RUDMDA    111
     2            'AR05','AR06','AR07','AR08','AR09','AR10','IR01',     RUDMDA    112
     3            'IR02','IR03','IR04','IR05','IR06','IR07','IR08',     RUDMDA    113
     4            'IR09','IR10','PR01','PR02','PR03','PR04','PR05',     RUDMDA    114
     5            'PR06','PR07','PR08','PR09','PR10','QR01','QR02',     RUDMDA    115
     6            'QR03','QR04','QR05','QR06','QR07','QR08','QR09',     RUDMDA    116
     7            'QR10','PF01','PF02','PF03','PF04','PF05','PF06',     RUDMDA    117
     8            'PF07','PF08','PF09','PF10'/                          RUDMDA    118
C                                                                       RUDMDA    119
C                                                                       RUDMDA    120
C                                                                       RUDMDA    121
      LDEB=(JDEB(268).NE.0)                                             RUDMDA    122
C                                                                       RUDMDA    123
CD                                                                      RUDMDA    124
CD    SETUP IXNAME TABLE ACCORDING TO TYPE OF USER DEFINED MODEL        RUDMDA    125
CD                                                                      RUDMDA    126
      ISVC1=0                                                           RUDMDA    127
      NBEND=0                                                           RUDMDA    128
      IF(NUF.LE.3) THEN                                                 RUDMDA    129
         DO 100 J=1,20                                                  RUDMDA    130
         IXNAME(J)=IENAME(J)                                            RUDMDA    131
  100    CONTINUE                                                       RUDMDA    132
      ELSEIF(NUF.EQ.4) THEN                                             RUDMDA    133
         DO 110 J=1,20                                                  RUDMDA    134
         IXNAME(J)=IGNAME(J)                                            RUDMDA    135
  110    CONTINUE                                                       RUDMDA    136
      ELSEIF(NUF.EQ.5) THEN                                             RUDMDA    137
         DO 120 J=1,20                                                  RUDMDA    138
         IXNAME(J)=ISNAME(J)                                            RUDMDA    139
  120    CONTINUE                                                       RUDMDA    140
      ELSEIF(NUF.EQ.6) THEN                                             RUDMDA    141
         DO 130 J=1,20                                                  RUDMDA    142
         IXNAME(J)=IRNAME(J)                                            RUDMDA    143
  130    CONTINUE                                                       RUDMDA    144
      ELSEIF(NUF.EQ.7) THEN                                             RUDMDA    145
         DO 140 J=1,20                                                  RUDMDA    146
         IXNAME(J)=ITNAME(J)                                            RUDMDA    147
  140    CONTINUE                                                       RUDMDA    148
      ELSEIF(NUF.EQ.8) THEN                                             RUDMDA    149
         DO 150 J=1,20                                                  RUDMDA    150
         IXNAME(J)=IPNAME(J)                                            RUDMDA    151
  150    CONTINUE                                                       RUDMDA    152
      ELSEIF(NUF.EQ.9) THEN                                             RUDMDA    153
         DO 160 J=1,20                                                  RUDMDA    154
         IXNAME(J)=IDNAME(J)                                            RUDMDA    155
  160    CONTINUE                                                       RUDMDA    156
      ENDIF                                                             RUDMDA    157
CD                                                                      RUDMDA    158
CD     STEP 1. READ REMOTE BUSES                                        RUDMDA    159
CD                                                                      RUDMDA    160
      JTLN=JTLN+1                                                       RUDMDA    161
      JTLNB=JTLN                                                        RUDMDA    162
      NITEM=0                                                           RUDMDA    163
      K=0                                                               RUDMDA    164
      IF(KLFO.EQ.0)THEN                                                 RUDMDA    165
         CALL GETLIN(IUX,SIMBUF)                                        RUDMDA    166
         READ(SIMBUF,1200,IOSTAT=IOS) (NIBL(J),J=1,10)                  RUDMDA    167
         IF(IOS.NE.0) GOTO 900                                          RUDMDA    168
         IF(LDEB)WRITE(IUD6,1200) (NIBL(J),J=1,10)                      RUDMDA    169
       DO 170 J=1,10                                                    RUDMDA    170
       IF(NIBL(J).EQ.0)GOTO 200                                         RUDMDA    171
       NITEM=NITEM+1                                                    RUDMDA    172
       JTLN=JTLN+1                                                      RUDMDA    173
       ITDDAT(JTLN)=NIBL(J)                                             RUDMDA    174
 170   CONTINUE                                                         RUDMDA    175
       ELSE                                                             RUDMDA    176
 180     K=K+1                                                          RUDMDA    177
         CALL GETLIN(IUX,SIMBUF)                                        RUDMDA    178
         READ(SIMBUF,1180,IOSTAT=IOS) (BUSNX(J),J=1,5)                  RUDMDA    179
         IF(IOS.NE.0) GOTO 900                                          RUDMDA    180
         DO 190 J=1,5                                                   RUDMDA    181
         IF(BUSNX(J).EQ.'            ')GOTO 200                         RUDMDA    182
         BUSNAM=BUSNX(J)                                                RUDMDA    183
         ITDDAT(JTLN+1)=IBUSN(1)                                        RUDMDA    184
         ITDDAT(JTLN+2)=IBUSN(2)                                        RUDMDA    185
         ITDDAT(JTLN+3)=IBUSN(3)                                        RUDMDA    186
         JTLN=JTLN+3                                                    RUDMDA    187
         NITEM=NITEM+1                                                  RUDMDA    188
  190    CONTINUE                                                       RUDMDA    189
         IF(K.LT.2)GOTO 180                                             RUDMDA    190
      ENDIF                                                             RUDMDA    191
C                                                                       RUDMDA    192
  200 CONTINUE                                                          RUDMDA    193
C                                                                       RUDMDA    194
      ITDDAT(JTLNB)=NITEM                                               RUDMDA    195
CD                                                                      RUDMDA    196
CD    STEP 2. READ REMOTE LINES                                         RUDMDA    197
CD                                                                      RUDMDA    198
      NITEM=0                                                           RUDMDA    199
      JTLN=JTLN+1                                                       RUDMDA    200
      JTLNB=JTLN                                                        RUDMDA    201
      K=0                                                               RUDMDA    202
      IF(KLFO.EQ.0)THEN                                                 RUDMDA    203
C                                                                       RUDMDA    204
C   BUS NUMBER CASE                                                     RUDMDA    205
C                                                                       RUDMDA    206
 210  K=K+1                                                             RUDMDA    207
      CALL GETLIN(IUX,SIMBUF)                                           RUDMDA    208
      READ(SIMBUF,1070,IOSTAT=IOS)                                      RUDMDA    209
     *    (NIBL(J),NIBL(J+5),KCKT(J),J=1,5)                             RUDMDA    210
      IF(IOS.NE.0) GOTO 900                                             RUDMDA    211
      IF(LDEB)WRITE(IUD6,1070) (NIBL(J),NIBL(J+5),KCKT(J),J=1,5)        RUDMDA    212
      DO 220 J=1,5                                                      RUDMDA    213
      IF(NIBL(J).EQ.0)GOTO 250                                          RUDMDA    214
      NITEM=NITEM+1                                                     RUDMDA    215
      ITDDAT(JTLN+1)=NIBL(J)                                            RUDMDA    216
      ITDDAT(JTLN+2)=NIBL(J+5)                                          RUDMDA    217
      CKT=KCKT(J)                                                       RUDMDA    218
      CALL PACK(CKT,0,JCKT)                                             RUDMDA    219
      ITDDAT(JTLN+3)=JCKT                                               RUDMDA    220
      JTLN=JTLN+3                                                       RUDMDA    221
 220  CONTINUE                                                          RUDMDA    222
      IF(K.LT.2)GOTO 210                                                RUDMDA    223
C                                                                       RUDMDA    224
      ELSE                                                              RUDMDA    225
C                                                                       RUDMDA    226
C   BUS NAME CASE                                                       RUDMDA    227
C                                                                       RUDMDA    228
 240  K=K+1                                                             RUDMDA    229
      CALL GETLIN(IUX,SIMBUF)                                           RUDMDA    230
      READ(SIMBUF,1190,IOSTAT=IOS)                                      RUDMDA    231
     &BUSR1(1),BUSR2(1),KCKT(1),BUSR1(2),BUSR2(2),KCKT(2)               RUDMDA    232
      IF(IOS.NE.0) GOTO 900                                             RUDMDA    233
      IF(LDEB)WRITE(IUD6,1190)                                          RUDMDA    234
     &BUSR1(1),BUSR2(1),KCKT(1),BUSR1(2),BUSR2(2),KCKT(2)               RUDMDA    235
      IF(BUSR1(1).EQ.'            ')GOTO 250                            RUDMDA    236
      NITEM=NITEM+1                                                     RUDMDA    237
      BUSNAM=BUSR1(1)                                                   RUDMDA    238
      ITDDAT(JTLN+1)=IBUSN(1)                                           RUDMDA    239
      ITDDAT(JTLN+2)=IBUSN(2)                                           RUDMDA    240
      ITDDAT(JTLN+3)=IBUSN(3)                                           RUDMDA    241
      BUSNAM=BUSR2(1)                                                   RUDMDA    242
      ITDDAT(JTLN+4)=IBUSN(1)                                           RUDMDA    243
      ITDDAT(JTLN+5)=IBUSN(2)                                           RUDMDA    244
      ITDDAT(JTLN+6)=IBUSN(3)                                           RUDMDA    245
      CKT=KCKT(1)                                                       RUDMDA    246
      CALL PACK(CKT,0,JCKT)                                             RUDMDA    247
      ITDDAT(JTLN+7)=JCKT                                               RUDMDA    248
      JTLN=JTLN+7                                                       RUDMDA    249
      IF(BUSR1(2).EQ.'            ')GOTO 250                            RUDMDA    250
      NITEM=NITEM+1                                                     RUDMDA    251
      BUSNAM=BUSR1(2)                                                   RUDMDA    252
      ITDDAT(JTLN+1)=IBUSN(1)                                           RUDMDA    253
      ITDDAT(JTLN+2)=IBUSN(2)                                           RUDMDA    254
      ITDDAT(JTLN+3)=IBUSN(3)                                           RUDMDA    255
      BUSNAM=BUSR2(2)                                                   RUDMDA    256
      ITDDAT(JTLN+4)=IBUSN(1)                                           RUDMDA    257
      ITDDAT(JTLN+5)=IBUSN(2)                                           RUDMDA    258
      ITDDAT(JTLN+6)=IBUSN(3)                                           RUDMDA    259
      CKT=KCKT(2)                                                       RUDMDA    260
      CALL PACK(CKT,0,JCKT)                                             RUDMDA    261
      ITDDAT(JTLN+7)=JCKT                                               RUDMDA    262
      JTLN=JTLN+7                                                       RUDMDA    263
      IF(K.LT.5)GOTO 240                                                RUDMDA    264
C                                                                       RUDMDA    265
      ENDIF                                                             RUDMDA    266
C                                                                       RUDMDA    267
 250  ITDDAT(JTLNB)=NITEM                                               RUDMDA    268
CD                                                                      RUDMDA    269
CD    STEP 3. READ INDIVIDUAL BLOCKS                                    RUDMDA    270
CD                                                                      RUDMDA    271
      JTLN=JTLN+1                                                       RUDMDA    272
      JTLNB=JTLN                                                        RUDMDA    273
      IBEND=0                                                           RUDMDA    274
      IVREF=0                                                           RUDMDA    275
      NBLOCK=0                                                          RUDMDA    276
  280 CALL GETLIN(IUX,SIMBUF)                                           RUDMDA    277
      READ (SIMBUF,1210,IOSTAT=IOS) BLNAME,BLTYP                        RUDMDA    278
      IF(IOS.NE.0) GOTO 900                                             RUDMDA    279
      IF(LDEB)WRITE(IUD6,1210) BLNAME,BLTYP                             RUDMDA    280
      IF(BLTYP.EQ.INUL3)GOTO 490                                        RUDMDA    281
      NBLOCK=NBLOCK+1                                                   RUDMDA    282
         J=0                                                            RUDMDA    283
  290    J=J+1                                                          RUDMDA    284
         IF(BLTYP.EQ.BTYPE(J)) THEN                                     RUDMDA    285
            IF(J.LE.30.OR.(J.GE.65.AND.J.LE.70)) GOTO 380               RUDMDA    286
C                                                                       RUDMDA    287
C NUF        1   2   3   4   5   6   7   8   9                          RUDMDA    288
      GOTO(300,370,370,320,340,330,350,350,360),NUF                     RUDMDA    289
C                                                                       RUDMDA    290
  300  CONTINUE                                                         RUDMDA    291
       IF(J.LE.43.OR.J.EQ.71)GOTO 380                                   RUDMDA    292
       GOTO 370                                                         RUDMDA    293
  320  CONTINUE                                                         RUDMDA    294
       IF(J.GE.44.AND.J.LE.47) GOTO 380                                 RUDMDA    295
       GOTO 370                                                         RUDMDA    296
  330  CONTINUE                                                         RUDMDA    297
       IF(J.EQ.56.OR.J.EQ.59) GOTO 380                                  RUDMDA    298
       IF(J.EQ.58) GO TO 370                                            RUDMDA    299
  340  CONTINUE                                                         RUDMDA    300
       IF(J.EQ.57.OR.(J.GE.48.AND.J.LT.54).OR.J.EQ.58) GOTO 380         RUDMDA    301
       GOTO 370                                                         RUDMDA    302
  350  CONTINUE                                                         RUDMDA    303
       IF(J.EQ.54) GOTO 380                                             RUDMDA    304
       GOTO 370                                                         RUDMDA    305
  360  CONTINUE                                                         RUDMDA    306
       IF(J.EQ.55) GOTO 380                                             RUDMDA    307
  370  CONTINUE                                                         RUDMDA    308
       WRITE(MSG(1),1230) UNAM(NUF),BLNAME,BLTYP                        RUDMDA    309
       CALL PRTMSG(1)                                                   RUDMDA    310
       SIMBUF='RUDMDA: UDM DATA ERROR'                                  RUDMDA    311
       CALL ASTOP(SIMBUF,22)                                            RUDMDA    312
  380  CONTINUE                                                         RUDMDA    313
       ITDDAT(JTLN+1)=IBUSN(1)                                          RUDMDA    314
       ITDDAT(JTLN+2)=IBUSN(2)                                          RUDMDA    315
       ITDDAT(JTLN+3)=J                                                 RUDMDA    316
C                                                                       RUDMDA    317
C     READING THE FIRST LINE DATA                                       RUDMDA    318
C                                                                       RUDMDA    319
            IF(J.EQ.22) THEN                                            RUDMDA    320
               READ(SIMBUF,1140,IOSTAT=IOS) NAA,NBB                     RUDMDA    321
               IF(IOS.NE.0) GOTO 900                                    RUDMDA    322
               IF(LDEB) WRITE(IUD6,1140) NAA,NBB                        RUDMDA    323
               ITDDAT(JTLN+4)=NAA                                       RUDMDA    324
               ITDDAT(JTLN+5)=NBB                                       RUDMDA    325
               DO 400 LL=1,NAA                                          RUDMDA    326
               CALL GETLIN(IUX,SIMBUF)                                  RUDMDA    327
               READ(SIMBUF,1220,IOSTAT=IOS)                             RUDMDA    328
     *             (TDDAT(JTLN+LJ+17),LJ=1,NAA)                         RUDMDA    329
               IF(IOS.NE.0) GOTO 900                                    RUDMDA    330
               IF(LDEB) WRITE (IUD6,1220) (TDDAT(JTLN+LJ+17),LJ=1,NAA)  RUDMDA    331
               JTLN=JTLN+NAA                                            RUDMDA    332
  400          CONTINUE                                                 RUDMDA    333
               DO 410 LL=1,NAA                                          RUDMDA    334
               CALL GETLIN(IUX,SIMBUF)                                  RUDMDA    335
               READ(SIMBUF,1220,IOSTAT=IOS)                             RUDMDA    336
     *             (TDDAT(JTLN+LJ+17),LJ=1,NBB)                         RUDMDA    337
               IF(IOS.NE.0) GOTO 900                                    RUDMDA    338
               IF(LDEB) WRITE (IUD6,1220) (TDDAT(JTLN+LJ+17),LJ=1,NBB)  RUDMDA    339
               JTLN=JTLN+NBB                                            RUDMDA    340
  410          CONTINUE                                                 RUDMDA    341
               CALL GETLIN(IUX,SIMBUF)                                  RUDMDA    342
               READ (SIMBUF,1220,IOSTAT=IOS)                            RUDMDA    343
     *              (TDDAT(JTLN+LJ+17),LJ=1,NAA)                        RUDMDA    344
               IF(IOS.NE.0) GOTO 900                                    RUDMDA    345
               IF(LDEB) WRITE (IUD6,1220) (TDDAT(JTLN+LJ+17),LJ=1,NAA)  RUDMDA    346
               JTLN=JTLN+NAA                                            RUDMDA    347
               CALL GETLIN(IUX,SIMBUF)                                  RUDMDA    348
               READ (SIMBUF,1220,IOSTAT=IOS)                            RUDMDA    349
     *              (TDDAT(JTLN+LJ+17),LJ=1,NBB)                        RUDMDA    350
               IF(IOS.NE.0) GOTO 900                                    RUDMDA    351
               IF(LDEB) WRITE (IUD6,1220) (TDDAT(JTLN+LJ+17),LJ=1,NBB)  RUDMDA    352
               JTLN=JTLN+NBB                                            RUDMDA    353
C                                                                       RUDMDA    354
            ELSEIF(J.EQ.24.OR.J.EQ.26) THEN                             RUDMDA    355
               READ(SIMBUF,1150,IOSTAT=IOS) ITDDAT(JTLN+4),             RUDMDA    356
     &         (TDDAT(JTLN+LJ+3),LJ=2,6)                                RUDMDA    357
               IF(IOS.NE.0) GOTO 900                                    RUDMDA    358
               IF(LDEB) WRITE(IUD6,1150) ITDDAT(JTLN+4),                RUDMDA    359
     &         (TDDAT(JTLN+LJ+3),LJ=2,6)                                RUDMDA    360
            ELSEIF(J.EQ.30)THEN                                         RUDMDA    361
               READ(SIMBUF,1300,IOSTAT=IOS) (TDDAT(JTLN+LJ+3),LJ=1,4)   RUDMDA    362
     &         ,ITDDAT(JTLN+8),ITDDAT(JTLN+9),ITDDAT(JTLN+10)           RUDMDA    363
               IF(IOS.NE.0) GOTO 900                                    RUDMDA    364
               IF(LDEB) WRITE(IUD6,1300) (TDDAT(JTLN+LJ+3),LJ=1,4)      RUDMDA    365
     &         ,ITDDAT(JTLN+8),ITDDAT(JTLN+9),ITDDAT(JTLN+10)           RUDMDA    366
            ELSEIF(J.EQ.53)THEN                                         RUDMDA    367
               READ(SIMBUF,1240,IOSTAT=IOS) (TDDAT(JTLN+LJ+3),LJ=1,5)   RUDMDA    368
     &         ,ITDDAT(JTLN+9)                                          RUDMDA    369
               IF(IOS.NE.0) GOTO 900                                    RUDMDA    370
               IF(LDEB) WRITE(IUD6,1240) (TDDAT(JTLN+LJ+3),LJ=1,5)      RUDMDA    371
     &         ,ITDDAT(JTLN+9)                                          RUDMDA    372
            ELSEIF(J.EQ.54)THEN                                         RUDMDA    373
               READ(SIMBUF,1260,IOSTAT=IOS) TDDAT(JTLN+4)               RUDMDA    374
     &         ,TDDAT(JTLN+5),ITDDAT(JTLN+6),ITDDAT(JTLN+7)             RUDMDA    375
               IF(IOS.NE.0) GOTO 900                                    RUDMDA    376
               IF(LDEB) WRITE(IUD6,1260) TDDAT(JTLN+4)                  RUDMDA    377
     &         ,TDDAT(JTLN+5),ITDDAT(JTLN+6),ITDDAT(JTLN+7)             RUDMDA    378
            ELSEIF(J.EQ.55.OR.J.EQ.56)THEN                              RUDMDA    379
               READ(SIMBUF,1250,IOSTAT=IOS) (TDDAT(JTLN+LJ+3),LJ=1,3)   RUDMDA    380
     &         ,ITDDAT(JTLN+7),ITDDAT(JTLN+8)                           RUDMDA    381
               IF(IOS.NE.0) GOTO 900                                    RUDMDA    382
               IF(LDEB) WRITE(IUD6,1250) (TDDAT(JTLN+LJ+3),LJ=1,3)      RUDMDA    383
     &         ,ITDDAT(JTLN+7),ITDDAT(JTLN+8)                           RUDMDA    384
            ELSEIF(J.EQ.58.OR.J.EQ.59)THEN                              RUDMDA    385
               READ(SIMBUF,1310,IOSTAT=IOS) (TDDAT(JTLN+LJ+3),LJ=1,3)   RUDMDA    386
     &         ,(ITDDAT(JTLN+LJ+6),LJ=1,3)                              RUDMDA    387
               IF(IOS.NE.0) GOTO 900                                    RUDMDA    388
               IF(LDEB) WRITE(IUD6,1310) (TDDAT(JTLN+LJ+3),LJ=1,3)      RUDMDA    389
     &         ,(ITDDAT(JTLN+LJ+6),LJ=1,3)                              RUDMDA    390
            ELSEIF(J.EQ.70)THEN                                         RUDMDA    391
               READ(SIMBUF,1320,IOSTAT=IOS) (TDDAT(JTLN+LJ+3),LJ=1,2)   RUDMDA    392
     &         ,(ITDDAT(JTLN+LJ+5),LJ=1,3)                              RUDMDA    393
               IF(IOS.NE.0) GOTO 900                                    RUDMDA    394
               IF(LDEB) WRITE(IUD6,1320) (TDDAT(JTLN+LJ+3),LJ=1,2)      RUDMDA    395
     &         ,(ITDDAT(JTLN+LJ+5),LJ=1,3)                              RUDMDA    396
            ELSE                                                        RUDMDA    397
               READ (SIMBUF,1080,IOSTAT=IOS) (TDDAT(JTLN+LJ+3),LJ=1,6)  RUDMDA    398
               IF(IOS.NE.0) GOTO 900                                    RUDMDA    399
               IF(LDEB) WRITE (IUD6,1080) (TDDAT(JTLN+LJ+3),LJ=1,6)     RUDMDA    400
            ENDIF                                                       RUDMDA    401
C                                                                       RUDMDA    402
C     READING THE REST OF THE DATA                                      RUDMDA    403
C                                                                       RUDMDA    404
            IF((J.GE.23.AND.J.LE.25).OR.(J.GE.33.AND.J.LE.36).OR.       RUDMDA    405
     &      (J.GE.44.AND.J.LE.47).OR.J.EQ.29.OR.                        RUDMDA    406
     &      J.EQ.38.OR.(J.EQ.26.AND.ITDDAT(JTLN+4).GT.5).OR.            RUDMDA    407
     &      J.EQ.53.OR.J.EQ.71)THEN                                     RUDMDA    408
               CALL GETLIN(IUX,SIMBUF)                                  RUDMDA    409
               IF(J.EQ.45) THEN                                         RUDMDA    410
                  IF(KLFO.EQ.0) THEN                                    RUDMDA    411
                     READ (SIMBUF,1081,IOSTAT=IOS)                      RUDMDA    412
     &               (TDDAT(JTLN+LJ),LJ=10,13),LPGLFN,LPGID             RUDMDA    413
                     IF(IOS.NE.0) GOTO 900                              RUDMDA    414
                     IF(LDEB) WRITE (IUD6,1081)                         RUDMDA    415
     &               (TDDAT(JTLN+LJ),LJ=10,13),LPGLFN,LPGID             RUDMDA    416
                  ELSE                                                  RUDMDA    417
                     READ (SIMBUF,1082,IOSTAT=IOS)                      RUDMDA    418
     &               (TDDAT(JTLN+LJ),LJ=10,13),LPGNAM,LPGID             RUDMDA    419
                     IF(IOS.NE.0) GOTO 900                              RUDMDA    420
                     CALL CHKBUS(LPGNAM,LPGLFN)                         RUDMDA    421
                     IF(LDEB) WRITE (IUD6,1082)                         RUDMDA    422
     &               (TDDAT(JTLN+LJ),LJ=10,13),LPGNAM,LPGID             RUDMDA    423
                  ENDIF                                                 RUDMDA    424
                  ITDDAT(JTLN+14)=LPGLFN                                RUDMDA    425
                  ITDDAT(JTLN+15)=ILPGID                                RUDMDA    426
                  JTLN1=JTLN                                            RUDMDA    427
               ELSE                                                     RUDMDA    428
                  READ (SIMBUF,1080,IOSTAT=IOS)(TDDAT(JTLN+LJ),LJ=10,15)RUDMDA    429
                  IF(IOS.NE.0) GOTO 900                                 RUDMDA    430
                  IF(LDEB) WRITE (IUD6,1080) (TDDAT(JTLN+LJ),LJ=10,15)  RUDMDA    431
               ENDIF                                                    RUDMDA    432
            ENDIF                                                       RUDMDA    433
            JTLN=JTLN+17                                                RUDMDA    434
            IF(J.EQ.44) THEN                                            RUDMDA    435
             CALL GETLIN(IUX,SIMBUF)                                    RUDMDA    436
             READ (SIMBUF,1080,IOSTAT=IOS) (TDDAT(JTLN+LJ),LJ=1,4)      RUDMDA    437
             IF(IOS.NE.0) GOTO 900                                      RUDMDA    438
             IF(LDEB) WRITE (IUD6,1080) (TDDAT(JTLN+LJ),LJ=1,4)         RUDMDA    439
             CALL GETLIN(IUX,SIMBUF)                                    RUDMDA    440
             READ (SIMBUF,1080,IOSTAT=IOS) (TDDAT(JTLN+LJ),LJ=5,8)      RUDMDA    441
             IF(IOS.NE.0) GOTO 900                                      RUDMDA    442
             IF(LDEB) WRITE (IUD6,1080) (TDDAT(JTLN+LJ),LJ=5,8)         RUDMDA    443
             JTLN=JTLN+8                                                RUDMDA    444
            ENDIF                                                       RUDMDA    445
            IF(J.GT.30.AND.J.NE.43.AND.J.NE.48.AND.J.NE.49.AND.J.NE.50  RUDMDA    446
     &         .AND.J.LT.65 )THEN                                       RUDMDA    447
               NBEND=NBLOCK                                             RUDMDA    448
               IBEND=IBEND+1                                            RUDMDA    449
               IF(NUF.EQ.5.AND.J.EQ.57) ISVC1=1                         RUDMDA    450
               IF(NUF.EQ.6) THEN                                        RUDMDA    451
                  IF(J.EQ.56) THEN                                      RUDMDA    452
                     ITDDAT(JTLN1)=1                                    RUDMDA    453
                  ELSEIF(J.EQ.59) THEN                                  RUDMDA    454
                     ITDDAT(JTLN1)=2                                    RUDMDA    455
                  ELSEIF(J.EQ.57) THEN                                  RUDMDA    456
                     ITDDAT(JTLN1)=3                                    RUDMDA    457
                  ELSE                                                  RUDMDA    458
                     ITDDAT(JTLN1)=0                                    RUDMDA    459
                  ENDIF                                                 RUDMDA    460
               ENDIF                                                    RUDMDA    461
            ENDIF                                                       RUDMDA    462
         ELSE                                                           RUDMDA    463
          IF(J.EQ.71) THEN                                              RUDMDA    464
            WRITE(MSG(1),1040) UNAM(NUF),BLTYP                          RUDMDA    465
            CALL PRTMSG(1)                                              RUDMDA    466
            SIMBUF='RUDMDA: UDM DATA ERROR'                             RUDMDA    467
            CALL ASTOP(SIMBUF,22)                                       RUDMDA    468
          ENDIF                                                         RUDMDA    469
          GOTO 290                                                      RUDMDA    470
         ENDIF                                                          RUDMDA    471
         GOTO 280                                                       RUDMDA    472
 490   CONTINUE                                                         RUDMDA    473
C                                                                       RUDMDA    474
      IF(NBLOCK.GT.NXUDB)THEN                                           RUDMDA    475
      WRITE(MSG(1),1280) UNAM(NUF),NXUDB                                RUDMDA    476
      WRITE(MSG(2),1281)                                                RUDMDA    477
      CALL PRTMSG(2)                                                    RUDMDA    478
      SIMBUF='RUDMDA: USER DEFINED MODELS HAVE TOO MANY BLOCKS'         RUDMDA    479
       CALL ASTOP(SIMBUF,48)                                            RUDMDA    480
      ENDIF                                                             RUDMDA    481
C                                                                       RUDMDA    482
      IF(NUF.NE.2.AND.NUF.NE.3.AND.IBEND.EQ.0) THEN                     RUDMDA    483
         WRITE(MSG(1),1090) UNAM(NUF)                                   RUDMDA    484
         CALL PRTMSG(1)                                                 RUDMDA    485
         SIMBUF='RUDMDA: UDM DATA ERROR'                                RUDMDA    486
         CALL ASTOP(SIMBUF,22)                                          RUDMDA    487
      ENDIF                                                             RUDMDA    488
      IF(NUF.EQ.2.OR.NUF.EQ.3) THEN                                     RUDMDA    489
         IF(IBEND.NE.0) THEN                                            RUDMDA    490
            WRITE(MSG(1),1270) UNAM(NUF)                                RUDMDA    491
            CALL PRTMSG(1)                                              RUDMDA    492
            SIMBUF='RUDMDA: UDM DATA ERROR'                             RUDMDA    493
            CALL ASTOP(SIMBUF,22)                                       RUDMDA    494
         ENDIF                                                          RUDMDA    495
      ENDIF                                                             RUDMDA    496
      IF(IBEND.GT.1) THEN                                               RUDMDA    497
         WRITE(MSG(1),1100) UNAM(NUF)                                   RUDMDA    498
         CALL PRTMSG(1)                                                 RUDMDA    499
         SIMBUF='RUDMDA: UDM DATA ERROR'                                RUDMDA    500
         CALL ASTOP(SIMBUF,22)                                          RUDMDA    501
      ENDIF                                                             RUDMDA    502
C                                                                       RUDMDA    503
      ITDDAT(JTLNB)=NBLOCK                                              RUDMDA    504
CD                                                                      RUDMDA    505
CD    STEP 4. READING BLOCK INTERCONNECTIONS                            RUDMDA    506
CD                                                                      RUDMDA    507
      JTLN=JTLN+1                                                       RUDMDA    508
      JTLNB=JTLN                                                        RUDMDA    509
C                                                                       RUDMDA    510
      NCONEC=0                                                          RUDMDA    511
 520  CALL GETLIN(IUX,SIMBUF)                                           RUDMDA    512
      READ(SIMBUF,1200,IOSTAT=IOS) (NIBL(J),J=1,16)                     RUDMDA    513
      IF(IOS.NE.0) GOTO 900                                             RUDMDA    514
      IF (LDEB) WRITE (IUD6,1200) (NIBL(J),J=1,16)                      RUDMDA    515
      J=0                                                               RUDMDA    516
 530  J=J+2                                                             RUDMDA    517
      IF(NIBL(J-1).EQ.0)GOTO 600                                        RUDMDA    518
      IF(NIBL(J).EQ.0) THEN                                             RUDMDA    519
         WRITE(MSG(1),1050) UNAM(NUF)                                   RUDMDA    520
         WRITE(MSG(2),1051) NIBL(J-1),NIBL(J)                           RUDMDA    521
         CALL PRTMSG(2)                                                 RUDMDA    522
         SIMBUF='RUDMDA: UDM DATA ERROR'                                RUDMDA    523
         CALL ASTOP(SIMBUF,22)                                          RUDMDA    524
      ENDIF                                                             RUDMDA    525
      IF(NIBL(J-1).EQ.NBEND.AND.IBEND.NE.0) THEN                        RUDMDA    526
         WRITE(MSG(1),1130) UNAM(NUF)                                   RUDMDA    527
         WRITE(MSG(2),1131) NIBL(J-1),NIBL(J)                           RUDMDA    528
         CALL PRTMSG(2)                                                 RUDMDA    529
         SIMBUF='RUDMDA: UDM DATA ERROR'                                RUDMDA    530
         CALL ASTOP(SIMBUF,22)                                          RUDMDA    531
      ENDIF                                                             RUDMDA    532
      NCONEC=NCONEC+1                                                   RUDMDA    533
C                                                                       RUDMDA    534
      ITDDAT(JTLN+1)=NIBL(J-1)                                          RUDMDA    535
      ITDDAT(JTLN+2)=NIBL(J)                                            RUDMDA    536
      JTLN=JTLN+2                                                       RUDMDA    537
C                                                                       RUDMDA    538
      IF(J.LT.16)GOTO 530                                               RUDMDA    539
      GOTO 520                                                          RUDMDA    540
C                                                                       RUDMDA    541
 600  CONTINUE                                                          RUDMDA    542
C                                                                       RUDMDA    543
      ITDDAT(JTLNB)=NCONEC                                              RUDMDA    544
CD                                                                      RUDMDA    545
CD    STEP 5. READ BLOCK INPUT DATA                                     RUDMDA    546
CD                                                                      RUDMDA    547
      JTLN=JTLN+1                                                       RUDMDA    548
      JTLNB=JTLN                                                        RUDMDA    549
      NINPUT=0                                                          RUDMDA    550
  640 CALL GETLIN(IUX,SIMBUF)                                           RUDMDA    551
      READ(SIMBUF,1010,IOSTAT=IOS) (NIBL(J),INPNA(J),XNSIGN(J),J=1,4)   RUDMDA    552
      IF(IOS.NE.0) GOTO 900                                             RUDMDA    553
      IF(LDEB)WRITE(IUD6,1010) (NIBL(J),INPNA(J),XNSIGN(J),J=1,4)       RUDMDA    554
      J=0                                                               RUDMDA    555
  650 J=J+1                                                             RUDMDA    556
      IF(NIBL(J).EQ.0)GOTO 800                                          RUDMDA    557
      K=0                                                               RUDMDA    558
  660 K=K+1                                                             RUDMDA    559
      IF(INPNA(J).EQ.IXNAME(K)) THEN                                    RUDMDA    560
      NINPUT=NINPUT+1                                                   RUDMDA    561
      JTLN=JTLN+3                                                       RUDMDA    562
      ITDDAT(JTLN-2)=NIBL(J)                                            RUDMDA    563
            IF(NUF.EQ.2.OR.NUF.EQ.3) THEN                               RUDMDA    564
               IF(K.EQ.15.OR.K.EQ.19.OR.K.EQ.20) THEN                   RUDMDA    565
                  WRITE(MSG(1),1060) UNAM(NUF),ITDDAT(JTLN-2),INPNA(J)  RUDMDA    566
                  CALL PRTMSG(1)                                        RUDMDA    567
                  SIMBUF='RUDMDA: UDM DATA ERROR'                       RUDMDA    568
                  CALL ASTOP(SIMBUF,22)                                 RUDMDA    569
               ENDIF                                                    RUDMDA    570
            ENDIF                                                       RUDMDA    571
            IF(NUF.EQ.3.AND.JTLN1.EQ.0.AND.K.EQ.17) THEN                RUDMDA    572
                  WRITE(MSG(1),1060) UNAM(NUF),ITDDAT(JTLN-2),INPNA(J)  RUDMDA    573
                  CALL PRTMSG(1)                                        RUDMDA    574
             SIMBUF='RUDMDA: UDM DATA ERROR'                            RUDMDA    575
             CALL ASTOP(SIMBUF,22)                                      RUDMDA    576
            ENDIF                                                       RUDMDA    577
            IF(NUF.EQ.3.AND.JTLN1.EQ.1.AND.(K.EQ.17.OR.K.EQ.18)) THEN   RUDMDA    578
                  WRITE(MSG(1),1060) UNAM(NUF),ITDDAT(JTLN-2),INPNA(J)  RUDMDA    579
                  CALL PRTMSG(1)                                        RUDMDA    580
             SIMBUF='RUDMDA: UDM DATA ERROR'                            RUDMDA    581
             CALL ASTOP(SIMBUF,22)                                      RUDMDA    582
            ENDIF                                                       RUDMDA    583
            IF(NUF.EQ.5) THEN                                           RUDMDA    584
               IF(ISVC1.EQ.0) THEN                                      RUDMDA    585
                  IF(K.EQ.12) THEN                                      RUDMDA    586
                  WRITE(MSG(1),1060) UNAM(NUF),ITDDAT(JTLN-2),INPNA(J)  RUDMDA    587
                  CALL PRTMSG(1)                                        RUDMDA    588
                     SIMBUF='RUDMDA: UDM DATA ERROR'                    RUDMDA    589
                     CALL ASTOP(SIMBUF,22)                              RUDMDA    590
                  ENDIF                                                 RUDMDA    591
               ELSEIF(ISVC1.EQ.1) THEN                                  RUDMDA    592
                  IF(K.EQ.2.OR.K.EQ.4.OR.K.EQ.6.OR.K.EQ.11) THEN        RUDMDA    593
                  WRITE(MSG(1),1060) UNAM(NUF),ITDDAT(JTLN-2),INPNA(J)  RUDMDA    594
                  CALL PRTMSG(1)                                        RUDMDA    595
                     SIMBUF='RUDMDA: UDM DATA ERROR'                    RUDMDA    596
                     CALL ASTOP(SIMBUF,22)                              RUDMDA    597
                  ENDIF                                                 RUDMDA    598
               ENDIF                                                    RUDMDA    599
            ENDIF                                                       RUDMDA    600
            IF(NUF.EQ.6) THEN                                           RUDMDA    601
               IF(ITDDAT(JTLN1).EQ.0) THEN                              RUDMDA    602
                  IF(K.EQ.12.OR.K.EQ.15.OR.K.EQ.16.OR.K.EQ.17) THEN     RUDMDA    603
                  WRITE(MSG(1),1060) UNAM(NUF),ITDDAT(JTLN-2),INPNA(J)  RUDMDA    604
                  CALL PRTMSG(1)                                        RUDMDA    605
                     SIMBUF='RUDMDA: UDM DATA ERROR'                    RUDMDA    606
                     CALL ASTOP(SIMBUF,22)                              RUDMDA    607
                  ENDIF                                                 RUDMDA    608
               ELSEIF(ITDDAT(JTLN1).EQ.1) THEN                          RUDMDA    609
                  IF(K.EQ.2.OR.K.EQ.3.OR.K.EQ.4.OR.K.EQ.5.OR.           RUDMDA    610
     &               K.EQ.6.OR.K.EQ.11.OR.K.EQ.17) THEN                 RUDMDA    611
                  WRITE(MSG(1),1060) UNAM(NUF),ITDDAT(JTLN-2),INPNA(J)  RUDMDA    612
                  CALL PRTMSG(1)                                        RUDMDA    613
                     SIMBUF='RUDMDA: UDM DATA ERROR'                    RUDMDA    614
                     CALL ASTOP(SIMBUF,22)                              RUDMDA    615
                  ENDIF                                                 RUDMDA    616
               ELSEIF(ITDDAT(JTLN1).EQ.2) THEN                          RUDMDA    617
                  IF(K.EQ.2.OR.K.EQ.4.OR.K.EQ.5.OR.K.EQ.6.OR.           RUDMDA    618
     &               K.EQ.11.OR.K.EQ.15.OR.K.EQ.16) THEN                RUDMDA    619
                  WRITE(MSG(1),1060) UNAM(NUF),ITDDAT(JTLN-2),INPNA(J)  RUDMDA    620
                  CALL PRTMSG(1)                                        RUDMDA    621
                     SIMBUF='RUDMDA: UDM DATA ERROR'                    RUDMDA    622
                     CALL ASTOP(SIMBUF,22)                              RUDMDA    623
                  ENDIF                                                 RUDMDA    624
               ELSEIF(ITDDAT(JTLN1).EQ.3) THEN                          RUDMDA    625
                  IF(K.EQ.2.OR.K.EQ.4.OR.K.EQ.6.OR.K.EQ.11.OR.          RUDMDA    626
     &               K.EQ.15.OR.K.EQ.16.OR.K.EQ.17) THEN                RUDMDA    627
                  WRITE(MSG(1),1060) UNAM(NUF),ITDDAT(JTLN-2),INPNA(J)  RUDMDA    628
                  CALL PRTMSG(1)                                        RUDMDA    629
                     SIMBUF='RUDMDA: UDM DATA ERROR'                    RUDMDA    630
                     CALL ASTOP(SIMBUF,22)                              RUDMDA    631
                  ENDIF                                                 RUDMDA    632
               ENDIF                                                    RUDMDA    633
            ENDIF                                                       RUDMDA    634
            IF(NUF.EQ.7) THEN                                           RUDMDA    635
                  IF(K.EQ.6.OR.K.EQ.12) THEN                            RUDMDA    636
                  WRITE(MSG(1),1060) UNAM(NUF),ITDDAT(JTLN-2),INPNA(J)  RUDMDA    637
                  CALL PRTMSG(1)                                        RUDMDA    638
                     SIMBUF='RUDMDA: UDM DATA ERROR'                    RUDMDA    639
                     CALL ASTOP(SIMBUF,22)                              RUDMDA    640
                  ENDIF                                                 RUDMDA    641
            ENDIF                                                       RUDMDA    642
            IF(NUF.EQ.8) THEN                                           RUDMDA    643
                  IF(K.EQ.5.OR.K.EQ.11) THEN                            RUDMDA    644
                  WRITE(MSG(1),1060) UNAM(NUF),ITDDAT(JTLN-2),INPNA(J)  RUDMDA    645
                  CALL PRTMSG(1)                                        RUDMDA    646
                     SIMBUF='RUDMDA: UDM DATA ERROR'                    RUDMDA    647
                     CALL ASTOP(SIMBUF,22)                              RUDMDA    648
                  ENDIF                                                 RUDMDA    649
            ENDIF                                                       RUDMDA    650
            ITDDAT(JTLN-1)=K                                            RUDMDA    651
            IF(K.EQ.20) IVREF=IVREF+1                                   RUDMDA    652
            TDDAT(JTLN)=XNSIGN(J)                                       RUDMDA    653
            IF(LDEB)WRITE(IUD6,1020) ITDDAT(JTLN-2),TDDAT(JTLN)         RUDMDA    654
      GOTO 670                                                          RUDMDA    655
      ENDIF                                                             RUDMDA    656
      IF(K.LT.80)GOTO 660                                               RUDMDA    657
      WRITE(MSG(1),1030)UNAM(NUF),INPNA(J)                              RUDMDA    658
      CALL PRTMSG(1)                                                    RUDMDA    659
      SIMBUF='RUDMDA: UDM DATA ERROR'                                   RUDMDA    660
      CALL ASTOP(SIMBUF,22)                                             RUDMDA    661
C                                                                       RUDMDA    662
 670  IF(J.LT.4) GO TO 650                                              RUDMDA    663
C                                                                       RUDMDA    664
      GOTO 640                                                          RUDMDA    665
C                                                                       RUDMDA    666
 800  CONTINUE                                                          RUDMDA    667
C                                                                       RUDMDA    668
      IF(NUF.NE.2.AND.NUF.NE.3.AND.NUF.NE.9.AND.IVREF.EQ.0) THEN        RUDMDA    669
         WRITE(MSG(1),1160) UNAM(NUF)                                   RUDMDA    670
         CALL PRTMSG(1)                                                 RUDMDA    671
         SIMBUF='RUDMDA: UDM DATA ERROR'                                RUDMDA    672
         CALL ASTOP(SIMBUF,22)                                          RUDMDA    673
      ENDIF                                                             RUDMDA    674
      IF(IVREF.GT.1) THEN                                               RUDMDA    675
         WRITE(MSG(1),1170) UNAM(NUF)                                   RUDMDA    676
         CALL PRTMSG(1)                                                 RUDMDA    677
         SIMBUF='RUDMDA: UDM DATA ERROR'                                RUDMDA    678
         CALL ASTOP(SIMBUF,22)                                          RUDMDA    679
      ENDIF                                                             RUDMDA    680
C                                                                       RUDMDA    681
      ITDDAT(JTLNB)=NINPUT                                              RUDMDA    682
CD                                                                      RUDMDA    683
CD    STEP 6. READ AND SET OUTPUT BLOCK                                 RUDMDA    684
CD                                                                      RUDMDA    685
      IF(NUF.EQ.2)THEN                                                  RUDMDA    686
         CALL GETLIN(IUX,SIMBUF)                                        RUDMDA    687
         READ (SIMBUF,1200,IOSTAT=IOS) ITDDAT(JTLN+1),ITDDAT(JTLN+2)    RUDMDA    688
         IF(IOS.NE.0) GOTO 900                                          RUDMDA    689
         IF(LDEB)WRITE(IUD6,1200) ITDDAT(JTLN+1),ITDDAT(JTLN+2)         RUDMDA    690
         JTLN=JTLN+2                                                    RUDMDA    691
      ELSEIF(NUF.EQ.3) THEN                                             RUDMDA    692
         CALL GETLIN(IUX,SIMBUF)                                        RUDMDA    693
         READ (SIMBUF,1200,IOSTAT=IOS) ITDDAT(JTLN+1)                   RUDMDA    694
         IF(IOS.NE.0) GOTO 900                                          RUDMDA    695
         IF(LDEB)WRITE(IUD6,1200) ITDDAT(JTLN+1)                        RUDMDA    696
         JTLN=JTLN+1                                                    RUDMDA    697
      ENDIF                                                             RUDMDA    698
      IF(LDEB)WRITE(IUD6,1000) UNAM(NUF),JTLN                           RUDMDA    699
      RETURN                                                            RUDMDA    700
  900 NUF=900                                                           RUDMDA    701
*ENDIF                                                                  RUDMDA    702
      RETURN                                                            RUDMDA    703
 1000 FORMAT (1X,'END READ UD ',A3,' DATA, JTLN',I5)                    RUDMDA    704
 1010 FORMAT (5(I5,1X,A4,F10.5))                                        RUDMDA    705
 1020 FORMAT (1X,I4,2X,F10.5)                                           RUDMDA    706
 1030 FORMAT(1X,'*** ERROR AT UD ',A3                                   RUDMDA    707
     *,' HAS UNKNOWN SYSTEM INPUT. INPUT=',A5)                          RUDMDA    708
 1040 FORMAT(1X,'*** ERROR AT UD ',A3                                   RUDMDA    709
     *,' HAS UNKNOWN TYPE OF BLOCK. TYPE=',A3)                          RUDMDA    710
 1050 FORMAT(1X,'*** ERROR AT UD ',A3                                   RUDMDA    711
     *,' INCORRECT BLOCK INTERCONNECTION:')                             RUDMDA    712
 1051 FORMAT(11X,'FROM BL',I3,'TO BL',I3)                               RUDMDA    713
 1060 FORMAT(1X,'*** ERROR AT UD ',A3,' INPUT SIGNAL "'                 RUDMDA    714
     &,A4,'" (TO BLOCK',I3,') IS NOT ALLOWED')                          RUDMDA    715
 1070 FORMAT(5(2I5,3X,A2))                                              RUDMDA    716
 1080 FORMAT(20X,6F10.5)                                                RUDMDA    717
 1081 FORMAT(20X,4F10.5,I5,1X,A4)                                       RUDMDA    718
 1082 FORMAT(20X,4F10.5,A12,1X,A4)                                      RUDMDA    719
 1090 FORMAT(1X,'*** ERROR NO END BLOCK HAS BEEN DEFINED FOR UD ',A3)   RUDMDA    720
 1100 FORMAT(1X                                                         RUDMDA    721
     *,'*** ERROR MORE THAN ONE END BLOCK HAS BEEN DEFINED FOR UD ',A3) RUDMDA    722
C 1110 FORMAT(1X,'UD ',A3,' ERROR - INCORRECT LINE DESCRIPTION:'        RUDMDA    723
C     &,' FROM BUS = ',I5,' TO BUS = ',I5)                              RUDMDA    724
C 1120 FORMAT(1X,'UD ',A3,' ERROR - X VALUES HAVE TO BE IN INCREASING'  RUDMDA    725
C     &,' ORDER FOR NG BLOCK.')                                         RUDMDA    726
 1130 FORMAT(1X,'*** ERROR AT UD ',A3                                   RUDMDA    727
     *,' INTERCONNECTION FROM END BLOCK TO')                            RUDMDA    728
 1131 FORMAT(11X,'OTHER BLOCKS IS NOT ALLOWED: FROM BL',I3,'TO BL',I3)  RUDMDA    729
 1140 FORMAT(29X,I1,9X,I1)                                              RUDMDA    730
 1150 FORMAT(28X,I2,5F10.5)                                             RUDMDA    731
 1160 FORMAT(' *** ERROR NO BLOCK HAS "VREF" INPUT IN UD ',A3)          RUDMDA    732
 1170 FORMAT(' *** ERROR "VREF" INPUT HAS BEEN USED MORE THAN ONCE'     RUDMDA    733
     *,' IN THE UD ',A3)                                                RUDMDA    734
 1180 FORMAT(5A12)                                                      RUDMDA    735
 1190 FORMAT(2(2A12,A2))                                                RUDMDA    736
 1200 FORMAT (16I5)                                                     RUDMDA    737
 1210 FORMAT(2X,A8,7X,A3,6F10.5)                                        RUDMDA    738
 1220 FORMAT (8F10.5)                                                   RUDMDA    739
 1230 FORMAT(1X,'*** ERROR AT UD ',A3,' (',A8                           RUDMDA    740
     *,') HAS UNACCEPTABLE TYPE ',A3)                                   RUDMDA    741
 1240 FORMAT(20X,5F10.5,9X,I1)                                          RUDMDA    742
 1250 FORMAT(20X,3F10.5,2I5)                                            RUDMDA    743
 1260 FORMAT(20X,2F10.5,2I5)                                            RUDMDA    744
 1270 FORMAT(1X,'*** ERROR NO END BLOCK IS ALLOWED FOR UD ',A3)         RUDMDA    745
 1280 FORMAT(1X,'*** ERROR AT UD ',A3                                   RUDMDA    746
     *,' NUMBER OF BLOCKS EXCEED THE LIMIT OF',I4)                      RUDMDA    747
 1281 FORMAT(11X,'INCREASE NXUDB IN PARX.INS')                          RUDMDA    748
C 1290 FORMAT(1X,'UD ',A3,' ERROR'                                      RUDMDA    749
C     &,/,' NUMBER OF UD MODELS EXCEEDS THE LIMIT OF ',I4               RUDMDA    750
C     &,/,' INCREASE NUDCM IN PARX.INS')                                RUDMDA    751
 1300 FORMAT(20X,4F10.5,3I5)                                            RUDMDA    752
 1310 FORMAT(20X,3F10.5,3I5)                                            RUDMDA    753
 1320 FORMAT(20X,2F10.5,3I5)                                            RUDMDA    754
      END                                                               RUDMDA    755
