CFPRIME SUDMDA                                                          SUDMDA      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 SUDMDA(NUF,KLFO,IUX)                                   SUDMDA      3
CD                                                                      SUDMDA      4
CD    TO SKIP A USER DEFINED MODEL DATA IF THE BUSES ASSOCIATED WITH    SUDMDA      5
CD    THE USER DEFINED MODEL ARE NOT FOUND IN BASE LOAD FLOW.           SUDMDA      6
CD                                                                      SUDMDA      7
CD    ON ENTRY                                                          SUDMDA      8
CD                                                                      SUDMDA      9
CD    NUF  = 1 USER DEFINED EXCITER                                     SUDMDA     10
CD         = 2              STABILIZER                                  SUDMDA     11
CD         = 3              UEL                                         SUDMDA     12
CD         = 4              GOVERNOR                                    SUDMDA     13
CD         = 5              SVC                                         SUDMDA     14
CD         = 6              RANI                                        SUDMDA     15
CD         = 7              STC                                         SUDMDA     16
CD         = 8              STP                                         SUDMDA     17
CD         = 9              SDB                                         SUDMDA     18
CD                                                                      SUDMDA     19
CD    KLFO = 0 BUS NUMBER INDEXING                                      SUDMDA     20
CD         > 0 BUS NAME INDEXING                                        SUDMDA     21
CD                                                                      SUDMDA     22
CD    IUX  = LOGICAL UNIT OF DATA FILE                                  SUDMDA     23
CD                                                                      SUDMDA     24
CD    ON RETURN                                                         SUDMDA     25
CD                                                                      SUDMDA     26
CD    NUF  = 900 USER DEFINED MODEL DATA ERROR                          SUDMDA     27
CD                                                                      SUDMDA     28
      CHARACTER*80 SIMBUF                                               SUDMDA     29
      CHARACTER*8 BLNAME                                                SUDMDA     30
      CHARACTER*12 BUSR1(2),BUSR2(2),BUSNX(5)                           SUDMDA     31
      CHARACTER*4 INPNA(4)                                              SUDMDA     32
      CHARACTER*3 INUL3,BLTYP,BTYPE(71)                                 SUDMDA     33
      CHARACTER*2 KCKT(20)                                              SUDMDA     34
      DIMENSION XNSIGN(4),NIBL(16)                                      SUDMDA     35
C                                                                       SUDMDA     36
      DATA INUL3/'   '/                                                 SUDMDA     37
C                                                                       SUDMDA     38
      DATA BTYPE/' GN',' IN',' PI',' WO',' LL',' SW',' HV',' LV','MUL', SUDMDA     39
     1           'DIV','IVL','DEL','SIN','COS','TAN','ASN','ACS','ATN', SUDMDA     40
     2           'EXP','LOG','ABS',' SS','NLF',' TF','DIG','A/D','LSW', SUDMDA     41
     3           'TIM','HYS','CTR',' E1',' E2',' E3',' E4',' E5',' E6', SUDMDA     42
     4           ' E7',' E8','E15','E30','E31','E34','RHL',' T1',' T4', SUDMDA     43
     5           'T20','T22','OF2','OF1',' LF','SD1','SD2','SD3','SD4', SUDMDA     44
     6           'SD5','SD6','SD7','SD8','SD9','   ','   ','   ','   ', SUDMDA     45
     7           '   ','   ','   ','   ','   ','POW','COM',' FL'/       SUDMDA     46
C                                                                       SUDMDA     47
C     SKIPING REMOTE BUSES                                              SUDMDA     48
C                                                                       SUDMDA     49
      NXX=0                                                             SUDMDA     50
      K=0                                                               SUDMDA     51
      IF (KLFO.EQ.0) THEN                                               SUDMDA     52
         CALL GETLIN(IUX,SIMBUF)                                        SUDMDA     53
      ELSE                                                              SUDMDA     54
  180    K=K+1                                                          SUDMDA     55
         CALL GETLIN(IUX,SIMBUF)                                        SUDMDA     56
         READ(SIMBUF,1180,IOSTAT=IOS) (BUSNX(J),J=1,5)                  SUDMDA     57
         IF (IOS.NE.0) GOTO 900                                         SUDMDA     58
         DO 190 J=1,5                                                   SUDMDA     59
            IF (BUSNX(J).EQ.'            ') GOTO 200                    SUDMDA     60
  190    CONTINUE                                                       SUDMDA     61
         IF (K.LT.2) GOTO 180                                           SUDMDA     62
      END IF                                                            SUDMDA     63
C                                                                       SUDMDA     64
  200 CONTINUE                                                          SUDMDA     65
C                                                                       SUDMDA     66
C     SKIPING REMOTE LINES                                              SUDMDA     67
C                                                                       SUDMDA     68
      K=0                                                               SUDMDA     69
      IF (KLFO.EQ.0) THEN                                               SUDMDA     70
  210    K=K+1                                                          SUDMDA     71
         CALL GETLIN(IUX,SIMBUF)                                        SUDMDA     72
         READ(SIMBUF,1070,IOSTAT=IOS)                                   SUDMDA     73
     *       (NIBL(J),NIBL(J+5),KCKT(2*J-1),J=1,5)                      SUDMDA     74
         IF (IOS.NE.0) GOTO 900                                         SUDMDA     75
         DO 220 J=1,5                                                   SUDMDA     76
            IF (NIBL(J).EQ.0) GOTO 250                                  SUDMDA     77
  220    CONTINUE                                                       SUDMDA     78
         IF (K.LT.2) GOTO 210                                           SUDMDA     79
      ELSE                                                              SUDMDA     80
  240    K=K+1                                                          SUDMDA     81
         CALL GETLIN(IUX,SIMBUF)                                        SUDMDA     82
         READ(SIMBUF,1190,IOSTAT=IOS)                                   SUDMDA     83
     *       BUSR1(1),BUSR2(1),KCKT(1),BUSR1(2),BUSR2(2),KCKT(3)        SUDMDA     84
         IF (IOS.NE.0) GOTO 900                                         SUDMDA     85
         IF (BUSR1(1).EQ.'            '.OR.                             SUDMDA     86
     *       BUSR1(2).EQ.'            ') GOTO 250                       SUDMDA     87
         IF (K.LT.5) GOTO 240                                           SUDMDA     88
      END IF                                                            SUDMDA     89
C                                                                       SUDMDA     90
  250 CONTINUE                                                          SUDMDA     91
C                                                                       SUDMDA     92
C     SKIPING BLOCKS                                                    SUDMDA     93
C                                                                       SUDMDA     94
  280 CALL GETLIN(IUX,SIMBUF)                                           SUDMDA     95
      READ (SIMBUF,1210,IOSTAT=IOS) BLNAME,BLTYP                        SUDMDA     96
      IF (IOS.NE.0) GOTO 900                                            SUDMDA     97
      IF (BLTYP.EQ.INUL3) GOTO 490                                      SUDMDA     98
      J=0                                                               SUDMDA     99
  290 J=J+1                                                             SUDMDA    100
      IF (BLTYP.EQ.BTYPE(J)) THEN                                       SUDMDA    101
C                                                                       SUDMDA    102
C     FIRST LINE OF THE BLOCK                                           SUDMDA    103
C                                                                       SUDMDA    104
         IF (J.EQ.22) THEN                                              SUDMDA    105
            READ(SIMBUF,1140,IOSTAT=IOS) NAA,NBB                        SUDMDA    106
            IF (IOS.NE.0) GOTO 900                                      SUDMDA    107
            DO 400 LL=1,NAA                                             SUDMDA    108
               CALL GETLIN(IUX,SIMBUF)                                  SUDMDA    109
  400       CONTINUE                                                    SUDMDA    110
            DO 410 LL=1,NAA                                             SUDMDA    111
               CALL GETLIN(IUX,SIMBUF)                                  SUDMDA    112
  410       CONTINUE                                                    SUDMDA    113
            CALL GETLIN(IUX,SIMBUF)                                     SUDMDA    114
            CALL GETLIN(IUX,SIMBUF)                                     SUDMDA    115
         ELSE IF (J.EQ.26) THEN                                         SUDMDA    116
            READ(SIMBUF,1150,IOSTAT=IOS) NXX                            SUDMDA    117
            IF (IOS.NE.0) GOTO 900                                      SUDMDA    118
         END IF                                                         SUDMDA    119
C                                                                       SUDMDA    120
C     REST LINES OF THE BLOCK                                           SUDMDA    121
C                                                                       SUDMDA    122
         IF (J.EQ.24.OR.J.EQ.33.OR.J.EQ.34.OR.J.EQ.35.OR.J.EQ.36.OR.    SUDMDA    123
     *       J.EQ.38.OR.J.EQ.25.OR.(J.EQ.26.AND.NXX.GT.5).OR.           SUDMDA    124
     *       J.EQ.44.OR.J.EQ.45.OR.J.EQ.46.OR.J.EQ.47.OR.J.EQ.29.OR.    SUDMDA    125
     *       J.EQ.53.OR.J.EQ.23.OR.J.EQ.71) THEN                        SUDMDA    126
            CALL GETLIN(IUX,SIMBUF)                                     SUDMDA    127
         END IF                                                         SUDMDA    128
         IF (J.EQ.44) THEN                                              SUDMDA    129
            CALL GETLIN(IUX,SIMBUF)                                     SUDMDA    130
            CALL GETLIN(IUX,SIMBUF)                                     SUDMDA    131
         END IF                                                         SUDMDA    132
         GOTO 290                                                       SUDMDA    133
      END IF                                                            SUDMDA    134
      GOTO 280                                                          SUDMDA    135
C                                                                       SUDMDA    136
  490 CONTINUE                                                          SUDMDA    137
C                                                                       SUDMDA    138
C     SKIPING BLOCK INTERCONNECTIONS                                    SUDMDA    139
C                                                                       SUDMDA    140
  520 CALL GETLIN(IUX,SIMBUF)                                           SUDMDA    141
      READ(SIMBUF,1200,IOSTAT=IOS) (NIBL(J),J=1,16)                     SUDMDA    142
      IF (IOS.NE.0) GOTO 900                                            SUDMDA    143
      J=0                                                               SUDMDA    144
  530 J=J+2                                                             SUDMDA    145
      IF (NIBL(J-1).EQ.0 ) GOTO 600                                     SUDMDA    146
      IF (J.LT.16) GOTO 530                                             SUDMDA    147
      GOTO 520                                                          SUDMDA    148
C                                                                       SUDMDA    149
  600 CONTINUE                                                          SUDMDA    150
C                                                                       SUDMDA    151
C     SKIPING BLOCK INPUTS                                              SUDMDA    152
C                                                                       SUDMDA    153
  640 CALL GETLIN(IUX,SIMBUF)                                           SUDMDA    154
      READ(SIMBUF,1010,IOSTAT=IOS) (NIBL(J),INPNA(J),XNSIGN(J),J=1,4)   SUDMDA    155
      IF (IOS.NE.0) GOTO 900                                            SUDMDA    156
      J=0                                                               SUDMDA    157
  650 J=J+1                                                             SUDMDA    158
      IF (NIBL(J).EQ.0) GOTO 800                                        SUDMDA    159
  670 IF(J.LT.4) GO TO 650                                              SUDMDA    160
      GOTO 640                                                          SUDMDA    161
C                                                                       SUDMDA    162
  800 CONTINUE                                                          SUDMDA    163
C                                                                       SUDMDA    164
C     SKIPING OUTPUT BLOCK                                              SUDMDA    165
C                                                                       SUDMDA    166
      IF (NUF.EQ.2) THEN                                                SUDMDA    167
         CALL GETLIN(IUX,SIMBUF)                                        SUDMDA    168
      ELSE IF(NUF.EQ.3) THEN                                            SUDMDA    169
         CALL GETLIN(IUX,SIMBUF)                                        SUDMDA    170
      END IF                                                            SUDMDA    171
      RETURN                                                            SUDMDA    172
C                                                                       SUDMDA    173
  900 NUF=900                                                           SUDMDA    174
      RETURN                                                            SUDMDA    175
C                                                                       SUDMDA    176
 1010 FORMAT(5(I5,1X,A4,F10.5))                                         SUDMDA    177
 1070 FORMAT(5(2I5,3X,A2))                                              SUDMDA    178
 1140 FORMAT(29X,I1,9X,I1)                                              SUDMDA    179
 1150 FORMAT(28X,I2)                                                    SUDMDA    180
 1180 FORMAT(5A12)                                                      SUDMDA    181
 1190 FORMAT(2(2A12,A2))                                                SUDMDA    182
 1200 FORMAT(16I5)                                                      SUDMDA    183
 1210 FORMAT(2X,A8,7X,A3,6F10.5)                                        SUDMDA    184
      END                                                               SUDMDA    185
