CFPRIME UDMINT                                                          UDMINT      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 UDMINT(NUF,VMG,NLF1,KN1,CID)                           UDMINT      3
CD                                                                      UDMINT      4
CD    TO PERFORMS THE INITIALIZATION OF AC USER DEFINED DYNAMIC MODEL.  UDMINT      5
CD                                                                      UDMINT      6
      INCLUDE 'PARX.INS'                                                UDMINT      7
      INCLUDE 'CNB1.INS'                                                UDMINT      8
      INCLUDE 'CNB19.INS'                                               UDMINT      9
      INCLUDE 'CNVOLT.INS'                                              UDMINT     10
      INCLUDE 'CNNNEW.INS'                                              UDMINT     11
      INCLUDE 'CNIPTR.INS'                                              UDMINT     12
      INCLUDE 'CNMDAT.INS'                                              UDMINT     13
      INCLUDE 'CNEXC.INS'                                               UDMINT     14
      INCLUDE 'CNSTN.INS'                                               UDMINT     15
      INCLUDE 'CNXSTA.INS'                                              UDMINT     16
      INCLUDE 'CNYVAR.INS'                                              UDMINT     17
      INCLUDE 'CNUNIT.INS'                                              UDMINT     18
      INCLUDE 'CNUDM.INS'                                               UDMINT     19
      INCLUDE 'CNMSG.INS'                                               UDMINT     20
      INCLUDE 'CNFLAG.INS'                                              UDMINT     21
      INCLUDE 'CNUDIC.INS'                                              UDMINT     22
C                                                                       UDMINT     23
      CHARACTER*4 BLNAM3,BLNAM4,IUNAME(60),IXNAME(80)                   UDMINT     24
      CHARACTER*3 BTYPE(71)                                             UDMINT     25
      CHARACTER*6 UNAM(9)                                               UDMINT     26
      CHARACTER*2 CID                                                   UDMINT     27
C                                                                       UDMINT     28
      EQUIVALENCE (IUNAME(1),IXNAME(21))                                UDMINT     29
C                                                                       UDMINT     30
      DATA UNAM/'UD EXC','UD PSS','UD EXL','UD GOV','UD SVC','UDRANI'   UDMINT     31
     &         ,'UD STC','UD SPS','UD SDB'/                             UDMINT     32
C                                                                       UDMINT     33
      DATA BTYPE/' GN',' IN',' PI',' WO',' LL',' SW',' HV',' LV','MUL', UDMINT     34
     1           'DIV','IVL','DEL','SIN','COS','TAN','ASN','ACS','ATN', UDMINT     35
     2           'EXP','LOG','ABS',' SS','NLF',' TF','DIG','A/D','LSW', UDMINT     36
     3           'TIM','HYS','CTR',' E1',' E2',' E3',' E4',' E5',' E6', UDMINT     37
     4           ' E7',' E8','E15','E30','E31','E34','RHL',' T1',' T4', UDMINT     38
     5           'T20','T22','OF2','OF1',' LF','SD1','SD2','SD3','SD4', UDMINT     39
     6           'SD5','SD6','SD7','SD8','SD9','   ','   ','   ','   ', UDMINT     40
     7           '   ','   ','   ','   ','   ','POW','COM',' FL'/       UDMINT     41
C                                                                       UDMINT     42
      DATA IUNAME/'VR01','VR02','VR03','VR04','VR05','VR06','VR07',     UDMINT     43
     1            'VR08','VR09','VR10','AR01','AR02','AR03','AR04',     UDMINT     44
     2            'AR05','AR06','AR07','AR08','AR09','AR10','IR01',     UDMINT     45
     3            'IR02','IR03','IR04','IR05','IR06','IR07','IR08',     UDMINT     46
     4            'IR09','IR10','PR01','PR02','PR03','PR04','PR05',     UDMINT     47
     5            'PR06','PR07','PR08','PR09','PR10','QR01','QR02',     UDMINT     48
     6            'QR03','QR04','QR05','QR06','QR07','QR08','QR09',     UDMINT     49
     7            'QR10','PF01','PF02','PF03','PF04','PF05','PF06',     UDMINT     50
     8            'PF07','PF08','PF09','PF10'/                          UDMINT     51
C                                                                       UDMINT     52
      DATA II/0/                                                        UDMINT     53
C                                                                       UDMINT     54
      LDEB=(JDEB(261).NE.0)                                             UDMINT     55
CD                                                                      UDMINT     56
CD    STEP 1. DEFINE THE POINTERS                                       UDMINT     57
CD                                                                      UDMINT     58
      NRBUS=IDDAT(JE1)                                                  UDMINT     59
      JE2=JE1+3*NRBUS+1                                                 UDMINT     60
      NRLIN=IDDAT(JE2)                                                  UDMINT     61
      JE3=JE2+4*NRLIN+1                                                 UDMINT     62
      NUDB=IDDAT(JE3)                                                   UDMINT     63
      JE4=JE3+17*NUDB+1                                                 UDMINT     64
      JE5=JE4+3*NUDB+1                                                  UDMINT     65
      INTUD=IDDAT(JE5)                                                  UDMINT     66
      JE6=JE5+2*INTUD+1                                                 UDMINT     67
      INPUD=IDDAT(JE6)                                                  UDMINT     68
      JE7=JE6+3*INPUD                                                   UDMINT     69
      IBEND=IDDAT(JE7+1)                                                UDMINT     70
CD                                                                      UDMINT     71
CD    STEP 2. ORDER THE CONTROL BLOCKS FOR SOLUTION AND CHECK LOOPS     UDMINT     72
CD                                                                      UDMINT     73
      CALL UDMORD(NLF1,KN1,CID)                                         UDMINT     74
      IF(NUF.LT.5) THEN                                                 UDMINT     75
         J3=JE6-3                                                       UDMINT     76
         DO 190 J=1,INPUD                                               UDMINT     77
         J3=J3+3                                                        UDMINT     78
         IDDX=IDDAT(J3+2)                                               UDMINT     79
         IF(IDDX.EQ.3.OR.IDDX.EQ.10.OR.IDDX.EQ.11.OR.IDDX.EQ.8.OR.      UDMINT     80
     &   IDDX.EQ.9) DDAT(J3+3)=DDAT(J3+3)/BASPRN                        UDMINT     81
         IF(IDDX.EQ.12) DDAT(J3+3)=DDAT(J3+3)/WXBASE                    UDMINT     82
  190    CONTINUE                                                       UDMINT     83
      ENDIF                                                             UDMINT     84
      CALL UDMSTR(KSUD)                                                 UDMINT     85
      IF(JSTATE+KSUD.GT.NSI)THEN                                        UDMINT     86
         WRITE(MSG(1),2070) NSI                                         UDMINT     87
         CALL PRTMSG(1)                                                 UDMINT     88
         CALL ASTOP(MSG(1),1)                                           UDMINT     89
      ENDIF                                                             UDMINT     90
      IF(NUF.LT.5) THEN                                                 UDMINT     91
         J3=JE6-3                                                       UDMINT     92
         DO 195 J=1,INPUD                                               UDMINT     93
         J3=J3+3                                                        UDMINT     94
         IDDX=IDDAT(J3+2)                                               UDMINT     95
         IF(IDDX.EQ.3.OR.IDDX.EQ.10.OR.IDDX.EQ.11.OR.IDDX.EQ.8.OR.      UDMINT     96
     &   IDDX.EQ.9) DDAT(J3+3)=DDAT(J3+3)*BASPRN                        UDMINT     97
         IF(IDDX.EQ.12) DDAT(J3+3)=DDAT(J3+3)*WXBASE                    UDMINT     98
  195    CONTINUE                                                       UDMINT     99
      ENDIF                                                             UDMINT    100
CD                                                                      UDMINT    101
CD    STEP 3. GET THE KNOWN INPUTS                                      UDMINT    102
CD                                                                      UDMINT    103
      VALIN(13)=1.0                                                     UDMINT    104
      IF(NRBUS.NE.0) THEN                                               UDMINT    105
         DO 170 I=1,NRBUS                                               UDMINT    106
         IBUS=IDDAT(JE1+3*I-2)                                          UDMINT    107
         M3=IBUS*3                                                      UDMINT    108
         VRE=REAL(VOLT(IBUS))                                           UDMINT    109
         VIM=AIMAG(VOLT(IBUS))                                          UDMINT    110
         VMGR=SQRT(VRE**2+VIM**2)                                       UDMINT    111
         VALIN(20+I)=VMGR                                               UDMINT    112
         IF(VMGR.GT.0.05) VALIN(30+I)=ATAN2(VIM,VRE)                    UDMINT    113
         IDDAT(JE1+3*I-1)=0                                             UDMINT    114
         DDAT(JE1+3*I)=VALIN(30+I)                                      UDMINT    115
  170    CONTINUE                                                       UDMINT    116
      ENDIF                                                             UDMINT    117
      IF(NRLIN.NE.0) THEN                                               UDMINT    118
         NR4=JE2-4                                                      UDMINT    119
         DO 180 I=1,NRLIN                                               UDMINT    120
         NR4=NR4+4                                                      UDMINT    121
         IBUS1=IDDAT(NR4+1)                                             UDMINT    122
         IBUS1=NNEW(IBUS1)                                              UDMINT    123
         IBUS2=IDDAT(NR4+2)                                             UDMINT    124
         IBUS2=NNEW(IBUS2)                                              UDMINT    125
         M3=IBUS1*3                                                     UDMINT    126
         N3=IBUS2*3                                                     UDMINT    127
         LOC=IDDAT(NR4+4)                                               UDMINT    128
         CALL GETCUR(CURR,CURI,LOC)                                     UDMINT    129
         IDDAT(NR4+1)=IBUS1                                             UDMINT    130
         VALIN(40+I)=SQRT(CURR**2+CURI**2)                              UDMINT    131
         VRE=REAL(VOLT(IBUS1))                                          UDMINT    132
         VIM=AIMAG(VOLT(IBUS1))                                         UDMINT    133
         VALIN(50+I)=VRE*CURR+VIM*CURI                                  UDMINT    134
         VALIN(60+I)=VIM*CURR-VRE*CURI                                  UDMINT    135
         S1=SQRT(VALIN(50+I)**2+VALIN(60+I)**2)                         UDMINT    136
         IF(S1.GT.0.0) THEN                                             UDMINT    137
            VALIN(70+I)=VALIN(50+I)/S1                                  UDMINT    138
         ELSE                                                           UDMINT    139
            VALIN(70+I)=1.0                                             UDMINT    140
         ENDIF                                                          UDMINT    141
  180    CONTINUE                                                       UDMINT    142
      ENDIF                                                             UDMINT    143
CD                                                                      UDMINT    144
CD    STEP 4. ORDER THE CONTROL BLOCKS FOR INITIALIZATION               UDMINT    145
CD                                                                      UDMINT    146
      JORD=0                                                            UDMINT    147
      IBREF=0                                                           UDMINT    148
      NEXTB=0                                                           UDMINT    149
      NEXTF=0                                                           UDMINT    150
      CALL FMOVE(0,VALOUT,VALOUT,NXUDB)                                 UDMINT    151
      CALL MOVE(0,JUDE,JUDE,NXUDB)                                      UDMINT    152
CD                                                                      UDMINT    153
CD            ORDER THE END BLOCK FIRST                                 UDMINT    154
CD                                                                      UDMINT    155
      IF(NUF.NE.2.AND.NUF.NE.3) THEN                                    UDMINT    156
         IF(NUF.NE.9) THEN                                              UDMINT    157
            JORD=JORD+1                                                 UDMINT    158
            JUDE(IBEND)=JORD                                            UDMINT    159
         ENDIF                                                          UDMINT    160
         JEB=JE3+17*IBEND-17                                            UDMINT    161
         NBINT1=IDDAT(JEB+1)                                            UDMINT    162
         NBINT2=IDDAT(JEB+17)                                           UDMINT    163
         LTYP=IDDAT(JEB+2)                                              UDMINT    164
         BLTYP=BTYPE(LTYP)                                              UDMINT    165
         IF(LTYP.EQ.31) THEN                                            UDMINT    166
            VALOUT(IBEND)=EFDN                                          UDMINT    167
            CALL IUDB31(IBEND,NLF1,KN1,CID)                             UDMINT    168
         ELSEIF(LTYP.EQ.32) THEN                                        UDMINT    169
            VALOUT(IBEND)=EFDN                                          UDMINT    170
            CALL IUDB32(IBEND,NLF1,KN1,CID)                             UDMINT    171
         ELSEIF(LTYP.EQ.33) THEN                                        UDMINT    172
            VALOUT(IBEND)=EFDN                                          UDMINT    173
            CALL IUDB33(IBEND,NLF1,KN1,CID)                             UDMINT    174
         ELSEIF(LTYP.EQ.34) THEN                                        UDMINT    175
            VALOUT(IBEND)=EFDN                                          UDMINT    176
            CALL IUDB34(IBEND,NLF1,KN1,CID)                             UDMINT    177
         ELSEIF(LTYP.EQ.35) THEN                                        UDMINT    178
            VALOUT(IBEND)=EFDN                                          UDMINT    179
            CALL IUDB33(IBEND,NLF1,KN1,CID)                             UDMINT    180
         ELSEIF(LTYP.EQ.36) THEN                                        UDMINT    181
            VALOUT(IBEND)=EFDN                                          UDMINT    182
            CALL IUDB36(IBEND,NLF1,KN1,CID)                             UDMINT    183
         ELSEIF(LTYP.EQ.37) THEN                                        UDMINT    184
            VALOUT(IBEND)=EFDN                                          UDMINT    185
            CALL IUDB37(IBEND,NLF1,KN1,CID)                             UDMINT    186
         ELSEIF(LTYP.EQ.38) THEN                                        UDMINT    187
            VALOUT(IBEND)=EFDN                                          UDMINT    188
            CALL IUDB38(IBEND,NLF1,KN1,CID)                             UDMINT    189
         ELSEIF(LTYP.EQ.39) THEN                                        UDMINT    190
            VALOUT(IBEND)=EFDN                                          UDMINT    191
            CALL IUDB39(IBEND,NLF1,KN1,CID)                             UDMINT    192
         ELSEIF(LTYP.EQ.40) THEN                                        UDMINT    193
            VALOUT(IBEND)=EFDN                                          UDMINT    194
            CALL IUDB40(IBEND,NLF1,KN1,CID)                             UDMINT    195
         ELSEIF(LTYP.EQ.41) THEN                                        UDMINT    196
            VALOUT(IBEND)=EFDN                                          UDMINT    197
            CALL IUDB41(IBEND,NLF1,KN1,CID)                             UDMINT    198
         ELSEIF(LTYP.EQ.42) THEN                                        UDMINT    199
            VALOUT(IBEND)=EFDN                                          UDMINT    200
            CALL IUDB42(IBEND,NLF1,KN1,CID)                             UDMINT    201
         ELSEIF(LTYP.EQ.44) THEN                                        UDMINT    202
            BASER(JYP+3)=BASPRN                                         UDMINT    203
            VALOUT(IBEND)=TIN(JYG+1)/BASPRN                             UDMINT    204
            PMAX=DDAT(JEB+9)                                            UDMINT    205
            IF(PMAX.LE.0.0) THEN                                        UDMINT    206
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    207
     &            ,INAME(KN1),CID                                       UDMINT    208
                  WRITE(MSG(2),1080) UNAM(NUF),IBEND,BLNAM1,BLNAM2      UDMINT    209
                  WRITE(MSG(3),1081)                                    UDMINT    210
                  CALL PRTMSG(3)                                        UDMINT    211
               MSG(1)='UDMINT: UDM BASE ERROR'                          UDMINT    212
               CALL ASTOP(MSG(1),22)                                    UDMINT    213
            ENDIF                                                       UDMINT    214
            CALL IUDB44(IBEND,NEXTB,CID)                                UDMINT    215
         ELSEIF(LTYP.EQ.45) THEN                                        UDMINT    216
            BASER(JYP+3)=BASPRN                                         UDMINT    217
            VALOUT(IBEND)=TIN(JYG+1)/BASPRN                             UDMINT    218
            PMAX=DDAT(JEB+9)                                            UDMINT    219
            IF(PMAX.LE.0.0) THEN                                        UDMINT    220
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    221
     &            ,INAME(KN1),CID                                       UDMINT    222
                  WRITE(MSG(2),1080) UNAM(NUF),IBEND,BLNAM1,BLNAM2      UDMINT    223
                  WRITE(MSG(3),1081)                                    UDMINT    224
                  CALL PRTMSG(3)                                        UDMINT    225
               MSG(1)='UDMINT: UDM BASE ERROR'                          UDMINT    226
               CALL ASTOP(MSG(1),22)                                    UDMINT    227
            ENDIF                                                       UDMINT    228
            CALL IUDB45(IBEND,VMG,CID)                                  UDMINT    229
         ELSEIF(LTYP.EQ.46) THEN                                        UDMINT    230
            BASER(JYP+3)=BASPRN                                         UDMINT    231
            VALOUT(IBEND)=TIN(JYG+1)/BASPRN                             UDMINT    232
            PMAX=DDAT(JEB+8)                                            UDMINT    233
            IF(PMAX.LE.0.0) THEN                                        UDMINT    234
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    235
     &            ,INAME(KN1),CID                                       UDMINT    236
                  WRITE(MSG(2),1080) UNAM(NUF),IBEND,BLNAM1,BLNAM2      UDMINT    237
                  WRITE(MSG(3),1081)                                    UDMINT    238
                  CALL PRTMSG(3)                                        UDMINT    239
               MSG(1)='UDMINT: UDM BASE ERROR'                          UDMINT    240
               CALL ASTOP(MSG(1),22)                                    UDMINT    241
            ENDIF                                                       UDMINT    242
            CALL IUDB46(IBEND,CID)                                      UDMINT    243
         ELSEIF(LTYP.EQ.47) THEN                                        UDMINT    244
            BASER(JYP+3)=BASPRN                                         UDMINT    245
            VALOUT(IBEND)=TIN(JYG+1)/BASPRN                             UDMINT    246
            PMAX=DDAT(JEB+9)                                            UDMINT    247
            IF(PMAX.LE.0.0) THEN                                        UDMINT    248
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    249
     &            ,INAME(KN1),CID                                       UDMINT    250
                  WRITE(MSG(2),1080) UNAM(NUF),IBEND,BLNAM1,BLNAM2      UDMINT    251
                  WRITE(MSG(3),1081)                                    UDMINT    252
                  CALL PRTMSG(3)                                        UDMINT    253
               MSG(1)='UDMINT: UDM BASE ERROR'                          UDMINT    254
               CALL ASTOP(MSG(1),22)                                    UDMINT    255
            ENDIF                                                       UDMINT    256
            CALL IUDB47(IBEND,CID)                                      UDMINT    257
         ELSEIF(LTYP.EQ.51) THEN                                        UDMINT    258
            QLB=DDAT(JEB+3)                                             UDMINT    259
            QCB=DDAT(JEB+4)                                             UDMINT    260
            IF(QLB.LE.0.0.OR.QCB.LT.0.0) THEN                           UDMINT    261
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    262
     &            ,INAME(KN1),CID                                       UDMINT    263
                  WRITE(MSG(2),1180) UNAM(NUF),IBEND,BLNAM1,BLNAM2      UDMINT    264
                  WRITE(MSG(3),1181)                                    UDMINT    265
                  WRITE(MSG(4),1182) QLB,QCB                            UDMINT    266
                  CALL PRTMSG(4)                                        UDMINT    267
               MSG(1)='UDMINT: UDM SD1 BLOCK QL OR QC ERROR'            UDMINT    268
               CALL ASTOP(MSG(1),36)                                    UDMINT    269
            ENDIF                                                       UDMINT    270
            BASER(JY+4)=QLB/BASPC                                       UDMINT    271
            IF(NUF.EQ.5) VALOUT(IBEND)=BSVC(JY+2)/BASER(JY+4)           UDMINT    272
            IF(NUF.EQ.6) VALOUT(IBEND)=BRANI(JY+2)/BASER(JY+4)          UDMINT    273
            CALL IUDB51(IBEND,NLF1,KN1,CID)                             UDMINT    274
            VALIN(1)=VMG*VALIN(5)                                       UDMINT    275
            VALIN(2)=VMG*VALIN(6)                                       UDMINT    276
            VALIN(3)=VMG*VALIN(1)                                       UDMINT    277
            VALIN(4)=VMG*VALIN(2)                                       UDMINT    278
         ELSEIF(LTYP.EQ.52) THEN                                        UDMINT    279
            QLB=DDAT(JEB+3)                                             UDMINT    280
            QCB=DDAT(JEB+4)                                             UDMINT    281
            IF(QLB.LE.0.0.OR.QCB.LT.0.0) THEN                           UDMINT    282
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    283
     &            ,INAME(KN1),CID                                       UDMINT    284
                  WRITE(MSG(2),1230) UNAM(NUF),IBEND,BLNAM1,BLNAM2      UDMINT    285
                  WRITE(MSG(3),1181)                                    UDMINT    286
                  WRITE(MSG(4),1182) QLB,QCB                            UDMINT    287
                  CALL PRTMSG(4)                                        UDMINT    288
               MSG(1)='UDMINT: UDM SD2 BLOCK QL OR QC ERROR'            UDMINT    289
               CALL ASTOP(MSG(1),36)                                    UDMINT    290
            ENDIF                                                       UDMINT    291
            BASER(JY+4)=QLB/BASPC                                       UDMINT    292
            IF(NUF.EQ.5) VALOUT(IBEND)=BSVC(JY+2)/BASER(JY+4)           UDMINT    293
            IF(NUF.EQ.6) VALOUT(IBEND)=BRANI(JY+2)/BASER(JY+4)          UDMINT    294
            CALL IUDB52(IBEND,NLF1,KN1,CID)                             UDMINT    295
            VALIN(1)=VMG*VALIN(5)                                       UDMINT    296
            VALIN(2)=VMG*VALIN(6)                                       UDMINT    297
            VALIN(3)=VMG*VALIN(1)                                       UDMINT    298
            VALIN(4)=VMG*VALIN(2)                                       UDMINT    299
         ELSEIF(LTYP.EQ.53) THEN                                        UDMINT    300
            QLB=DDAT(JEB+3)                                             UDMINT    301
            QCB=DDAT(JEB+4)                                             UDMINT    302
            QBAS=QLB+QCB                                                UDMINT    303
            IF(QLB.LT.0.0.OR.QCB.LE.0.0) THEN                           UDMINT    304
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    305
     &            ,INAME(KN1),CID                                       UDMINT    306
                  WRITE(MSG(2),1240) UNAM(NUF),IBEND,BLNAM1,BLNAM2      UDMINT    307
                  WRITE(MSG(3),1241)                                    UDMINT    308
                  WRITE(MSG(4),1182) QLB,QCB                            UDMINT    309
                  CALL PRTMSG(4)                                        UDMINT    310
               MSG(1)='UDMINT: UDM SD3 BLOCK QL OR QC ERROR'            UDMINT    311
               CALL ASTOP(MSG(1),36)                                    UDMINT    312
            ENDIF                                                       UDMINT    313
            BASER(JY+4)=QBAS/BASPC                                      UDMINT    314
            IF(NUF.EQ.5) VALOUT(IBEND)=BSVC(JY+2)/BASER(JY+4)           UDMINT    315
            IF(NUF.EQ.6) VALOUT(IBEND)=BRANI(JY+2)/BASER(JY+4)          UDMINT    316
            CALL IUDB53(IBEND,NEXTB,NLF1,KN1,CID)                       UDMINT    317
            VALIN(1)=VMG*VALIN(5)                                       UDMINT    318
            VALIN(2)=VMG*VALIN(6)                                       UDMINT    319
            VALIN(3)=VMG*VALIN(1)                                       UDMINT    320
            VALIN(4)=VMG*VALIN(2)                                       UDMINT    321
         ELSEIF(LTYP.EQ.54) THEN                                        UDMINT    322
            IF(NUF.EQ.7) VALOUT(IBEND)=TSTC(JYTC+2)                     UDMINT    323
            IF(NUF.EQ.8) VALOUT(IBEND)=TSPS(JYPS+2)                     UDMINT    324
            CALL IUDB54(IBEND,NLF1,KN1,CID)                             UDMINT    325
            IF(NUF.EQ.7) VALIN(5)=VALOUT(IBEND)                         UDMINT    326
            IF(NUF.EQ.8) VALIN(6)=VALOUT(IBEND)                         UDMINT    327
         ELSEIF(LTYP.EQ.55) THEN                                        UDMINT    328
            SBAS=DDAT(JEB+3)                                            UDMINT    329
            PBAS=ABS(SBAS)                                              UDMINT    330
            IF(PBAS.LE.0.0.AND.PBAS.GE.0.0) THEN                        UDMINT    331
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    332
     &            ,INAME(KN1),CID                                       UDMINT    333
                  WRITE(MSG(2),1080) UNAM(NUF),IBEND,BLNAM1,BLNAM2      UDMINT    334
                  WRITE(MSG(3),1081)                                    UDMINT    335
                  CALL PRTMSG(3)                                        UDMINT    336
               MSG(1)='UDMINT: UDM SD5 BLOCK MY ERROR'                  UDMINT    337
               CALL ASTOP(MSG(1),30)                                    UDMINT    338
            ENDIF                                                       UDMINT    339
            BASER(JY+4)=SBAS/BASPC                                      UDMINT    340
         ELSEIF(LTYP.EQ.56) THEN                                        UDMINT    341
            PG=DDAT(JEB+3)                                              UDMINT    342
            IF(PG.LT.0.0) THEN                                          UDMINT    343
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    344
     &            ,INAME(KN1),CID                                       UDMINT    345
                  WRITE(MSG(2),1290) UNAM(NUF),IBEND,BLNAM1,BLNAM2      UDMINT    346
                  WRITE(MSG(3),1291) PG                                 UDMINT    347
                  CALL PRTMSG(3)                                        UDMINT    348
               MSG(1)='UDMINT: UDM SD6 BLOCK PG ERROR'                  UDMINT    349
               CALL ASTOP(MSG(1),30)                                    UDMINT    350
            ENDIF                                                       UDMINT    351
            BASER(JY+4)=PG/BASPC                                        UDMINT    352
            VALOUT(IBEND)=BRANI(JY+2)/BASER(JY+4)                       UDMINT    353
            CALL IUDB56(IBEND,NLF1,KN1,CID)                             UDMINT    354
            VALIN(1)=VMG*VALIN(15)                                      UDMINT    355
            VALIN(16)=VMG*VALIN(1)                                      UDMINT    356
            BRANI(JY+2)=VALOUT(IBEND)*BASER(JY+4)                       UDMINT    357
            BRANI(JY+3)=BRANI(JY+2)                                     UDMINT    358
         ELSEIF(LTYP.EQ.57) THEN                                        UDMINT    359
            QLB=DDAT(JEB+3)                                             UDMINT    360
            QCB=DDAT(JEB+4)                                             UDMINT    361
            IF(QLB.LT.0.0.OR.QCB.LT.0.0.OR.QLB+QCB.LE.0.0) THEN         UDMINT    362
               WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)        UDMINT    363
     &         ,INAME(KN1),CID                                          UDMINT    364
               WRITE(MSG(2),1183) UNAM(NUF),IBEND,BLNAM1,BLNAM2         UDMINT    365
               WRITE(MSG(3),1184)                                       UDMINT    366
               WRITE(MSG(4),1185) QLB,QCB                               UDMINT    367
               CALL PRTMSG(4)                                           UDMINT    368
               MSG(1)='UDMINT: UDM SD7 BLOCK QL OR QC ERROR'            UDMINT    369
               CALL ASTOP(MSG(1),36)                                    UDMINT    370
            ENDIF                                                       UDMINT    371
            BASER(JY+4)=(QLB+QCB)/BASPC                                 UDMINT    372
            IF(NUF.EQ.5) THEN                                           UDMINT    373
               BSVC(JY+2)=BSVC(JY+2)*VMG                                UDMINT    374
               VALOUT(IBEND)=BSVC(JY+2)/BASER(JY+4)                     UDMINT    375
               BASER(JY+4)=-BASER(JY+4)                                 UDMINT    376
            ENDIF                                                       UDMINT    377
            IF(NUF.EQ.6) THEN                                           UDMINT    378
               BRANI(JY+2)=BRANI(JY+2)*VMG                              UDMINT    379
               VALOUT(IBEND)=BRANI(JY+2)/BASER(JY+4)                    UDMINT    380
            ENDIF                                                       UDMINT    381
            CALL IUDB57(IBEND,NLF1,KN1,CID)                             UDMINT    382
            VALIN(1)=VALOUT(IBEND)                                      UDMINT    383
            VALIN(3)=VMG*VALIN(1)                                       UDMINT    384
            VALIN(5)=VALIN(1)/VMG                                       UDMINT    385
         ELSEIF(LTYP.EQ.58) THEN                                        UDMINT    386
            QTB=DDAT(JEB+3)                                             UDMINT    387
            IF(QTB.LE.0.0) THEN                                         UDMINT    388
               WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)        UDMINT    389
     &         ,INAME(KN1),CID                                          UDMINT    390
               WRITE(MSG(2),1186) UNAM(NUF),IBEND,BLNAM1,BLNAM2         UDMINT    391
               WRITE(MSG(3),1187)                                       UDMINT    392
               WRITE(MSG(4),1188) QTB                                   UDMINT    393
               CALL PRTMSG(4)                                           UDMINT    394
               MSG(1)='UDMINT: UDM SD8 BLOCK QT ERROR'                  UDMINT    395
               CALL ASTOP(MSG(1),30)                                    UDMINT    396
            ENDIF                                                       UDMINT    397
            BASER(JY+4)=QTB/BASPC                                       UDMINT    398
            VALOUT(IBEND)=BSVC(JY+2)/BASER(JY+4)                        UDMINT    399
            NSD=8                                                       UDMINT    400
            CALL IUDB58(IBEND,NLF1,KN1,CID,NSD)                         UDMINT    401
            VALIN(5)=VALOUT(IBEND)                                      UDMINT    402
            VALIN(1)=VMG*VALIN(5)                                       UDMINT    403
            VALIN(3)=VMG*VALIN(1)                                       UDMINT    404
            BSVC(JY+8)=BSVC(JY+2)-VALOUT(IBEND)*BASER(JY+4)             UDMINT    405
         ELSEIF(LTYP.EQ.59) THEN                                        UDMINT    406
            XPC=DDAT(JEB+3)                                             UDMINT    407
            IF(XPC.LE.0.0.OR.XPC.GE.100.0) THEN                         UDMINT    408
               WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)        UDMINT    409
     &         ,INAME(KN1),CID                                          UDMINT    410
               WRITE(MSG(2),1189) UNAM(NUF),IBEND,BLNAM1,BLNAM2         UDMINT    411
               WRITE(MSG(3),1190)                                       UDMINT    412
               WRITE(MSG(4),1191) XPC                                   UDMINT    413
               CALL PRTMSG(4)                                           UDMINT    414
               MSG(1)='UDMINT: UDM SD9 BLOCK %X ERROR'                  UDMINT    415
               CALL ASTOP(MSG(1),30)                                    UDMINT    416
            ENDIF                                                       UDMINT    417
            Y02=BRANO(JY+9)**2+BRANO(JY+3)**2                           UDMINT    418
            XRAN=BRANO(JY+3)/Y02                                        UDMINT    419
            BASER(JY+4)=XRAN*XPC/100.0                                  UDMINT    420
            VALOUT(IBEND)=BRANI(JY+2)/BASER(JY+4)                       UDMINT    421
            NSD=9                                                       UDMINT    422
            CALL IUDB58(IBEND,NLF1,KN1,CID,NSD)                         UDMINT    423
            VALIN(1)=VMG*SQRT(Y02)*BASER(JY+4)                          UDMINT    424
            VALIN(3)=VALOUT(IBEND)*VALIN(1)*VALIN(1)                    UDMINT    425
            VALIN(17)=VALOUT(IBEND)                                     UDMINT    426
            BRANI(JY+2)=BRANO(JY+3)                                     UDMINT    427
            BRANO(JY+10)=VALOUT(IBEND)*BASER(JY+4)                      UDMINT    428
         ELSE                                                           UDMINT    429
            MSG(1)='UDMINT: 1'                                          UDMINT    430
            CALL ASTOP(MSG(1),9)                                        UDMINT    431
         ENDIF                                                          UDMINT    432
      ENDIF                                                             UDMINT    433
      IF(JORD.EQ.NUDB) RETURN                                           UDMINT    434
CD                                                                      UDMINT    435
CD            ORDER THE BLOCKS WITH ALL INPUTS KNOWN SECOND             UDMINT    436
CD                                                                      UDMINT    437
      JEB=JE3-17                                                        UDMINT    438
      DO 230 I=1,NUDB                                                   UDMINT    439
      JEB=JEB+17                                                        UDMINT    440
      NBINT1=IDDAT(JEB+1)                                               UDMINT    441
      NBINT2=IDDAT(JEB+17)                                              UDMINT    442
      LTYP=IDDAT(JEB+2)                                                 UDMINT    443
      BLTYP=BTYPE(LTYP)                                                 UDMINT    444
      K3=JE6-3                                                          UDMINT    445
      DO 200 K=1,INPUD                                                  UDMINT    446
      K3=K3+3                                                           UDMINT    447
      IF(IDDAT(K3+2).EQ.20.AND.IDDAT(K3+1).EQ.I) THEN                   UDMINT    448
         IBREF=I                                                        UDMINT    449
         GO TO 220                                                      UDMINT    450
      ENDIF                                                             UDMINT    451
  200 CONTINUE                                                          UDMINT    452
      J2=JE5-2                                                          UDMINT    453
      DO 210 J=1,INTUD                                                  UDMINT    454
      J2=J2+2                                                           UDMINT    455
      IDD=IDDAT(J2+2)                                                   UDMINT    456
      IDD=IABS(IDD)                                                     UDMINT    457
      IF(IDD.EQ.I) GO TO 220                                            UDMINT    458
  210 CONTINUE                                                          UDMINT    459
      IF((LTYP.GT.30.AND.LTYP.LT.65).AND.LTYP.NE.43.AND.LTYP.NE.48      UDMINT    460
     &   .AND.LTYP.NE.49.AND.LTYP.NE.50.AND.LTYP.NE.55) GO TO 220       UDMINT    461
      JORD=JORD+1                                                       UDMINT    462
      JUDE(I)=JORD                                                      UDMINT    463
      INDEX=0                                                           UDMINT    464
      IF(LTYP.EQ.1) THEN                                                UDMINT    465
         CALL IUDB1(I,INDEX,NLF1,KN1,CID)                               UDMINT    466
      ELSEIF(LTYP.EQ.2) THEN                                            UDMINT    467
         CALL IUDB2(I,INDEX,NLF1,KN1,CID)                               UDMINT    468
      ELSEIF(LTYP.EQ.3) THEN                                            UDMINT    469
         CALL IUDB3(I,INDEX,NLF1,KN1,CID)                               UDMINT    470
      ELSEIF(LTYP.EQ.4) THEN                                            UDMINT    471
         CALL IUDB4(I,INDEX,NLF1,KN1,CID)                               UDMINT    472
      ELSEIF(LTYP.EQ.5) THEN                                            UDMINT    473
         CALL IUDB5(I,INDEX,NLF1,KN1,CID)                               UDMINT    474
      ELSEIF(LTYP.EQ.6) THEN                                            UDMINT    475
         CALL IUDB6(I,INDEX,NLF1,KN1,CID)                               UDMINT    476
      ELSEIF(LTYP.EQ.7) THEN                                            UDMINT    477
         CALL IUDB7(I,INDEX,NLF1,KN1,CID)                               UDMINT    478
      ELSEIF(LTYP.EQ.8) THEN                                            UDMINT    479
         CALL IUDB8(I,INDEX,NLF1,KN1,CID)                               UDMINT    480
      ELSEIF(LTYP.EQ.9) THEN                                            UDMINT    481
         CALL IUDB9(I,INDEX,NLF1,KN1,CID)                               UDMINT    482
      ELSEIF(LTYP.EQ.10) THEN                                           UDMINT    483
         CALL IUDB10(I,INDEX,NLF1,KN1,CID)                              UDMINT    484
      ELSEIF(LTYP.EQ.11) THEN                                           UDMINT    485
         CALL IUDB11(I,INDEX,NLF1,KN1,CID)                              UDMINT    486
      ELSEIF(LTYP.EQ.12) THEN                                           UDMINT    487
         CALL IUDB12(I,INDEX,NLF1,KN1,CID)                              UDMINT    488
      ELSEIF(LTYP.EQ.13) THEN                                           UDMINT    489
         CALL IUDB13(I,INDEX,NLF1,KN1,CID)                              UDMINT    490
      ELSEIF(LTYP.EQ.14) THEN                                           UDMINT    491
         CALL IUDB14(I,INDEX,NLF1,KN1,CID)                              UDMINT    492
      ELSEIF(LTYP.EQ.15) THEN                                           UDMINT    493
         CALL IUDB15(I,INDEX,NLF1,KN1,CID)                              UDMINT    494
      ELSEIF(LTYP.EQ.16) THEN                                           UDMINT    495
         CALL IUDB16(I,INDEX,NLF1,KN1,CID)                              UDMINT    496
      ELSEIF(LTYP.EQ.17) THEN                                           UDMINT    497
         CALL IUDB17(I,INDEX,NLF1,KN1,CID)                              UDMINT    498
      ELSEIF(LTYP.EQ.18) THEN                                           UDMINT    499
         CALL IUDB18(I,INDEX,NLF1,KN1,CID)                              UDMINT    500
      ELSEIF(LTYP.EQ.19) THEN                                           UDMINT    501
         CALL IUDB19(I,INDEX,NLF1,KN1,CID)                              UDMINT    502
      ELSEIF(LTYP.EQ.20) THEN                                           UDMINT    503
         CALL IUDB20(I,INDEX,NLF1,KN1,CID)                              UDMINT    504
      ELSEIF(LTYP.EQ.21) THEN                                           UDMINT    505
         CALL IUDB21(I,INDEX,NLF1,KN1,CID)                              UDMINT    506
      ELSEIF(LTYP.EQ.22) THEN                                           UDMINT    507
         CALL IUDB22(I,INDEX,NLF1,KN1,CID)                              UDMINT    508
      ELSEIF(LTYP.EQ.23) THEN                                           UDMINT    509
         CALL IUDB23(I,INDEX,NLF1,KN1,CID)                              UDMINT    510
      ELSEIF(LTYP.EQ.24) THEN                                           UDMINT    511
         CALL IUDB24(I,INDEX,NLF1,KN1,CID)                              UDMINT    512
      ELSEIF(LTYP.EQ.25) THEN                                           UDMINT    513
         CALL IUDB25(I,INDEX,NLF1,KN1,CID)                              UDMINT    514
      ELSEIF(LTYP.EQ.26) THEN                                           UDMINT    515
         CALL IUDB26(I,INDEX,NLF1,KN1,CID)                              UDMINT    516
      ELSEIF(LTYP.EQ.27) THEN                                           UDMINT    517
         CALL IUDB27(I,INDEX,NLF1,KN1,CID)                              UDMINT    518
      ELSEIF(LTYP.EQ.28) THEN                                           UDMINT    519
         CALL IUDB28(I,INDEX,NLF1,KN1,CID)                              UDMINT    520
      ELSEIF(LTYP.EQ.29) THEN                                           UDMINT    521
         CALL IUDB29(I,INDEX,NLF1,KN1,CID)                              UDMINT    522
      ELSEIF(LTYP.EQ.30) THEN                                           UDMINT    523
         CALL IUDB30(I,INDEX,NLF1,KN1,CID)                              UDMINT    524
      ELSEIF(LTYP.EQ.43) THEN                                           UDMINT    525
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    526
     &            ,INAME(KN1),CID                                       UDMINT    527
                  WRITE(MSG(2),1050) UNAM(NUF)                          UDMINT    528
                  WRITE(MSG(3),1031) I,BLNAM1,BLNAM2                    UDMINT    529
                  CALL PRTMSG(3)                                        UDMINT    530
         MSG(1)='UDMINT: UDM RHL BLOCK HAS BEEN WRONGLY USED'           UDMINT    531
         CALL ASTOP(MSG(1),43)                                          UDMINT    532
      ELSEIF(LTYP.EQ.48) THEN                                           UDMINT    533
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    534
     &            ,INAME(KN1),CID                                       UDMINT    535
                  WRITE(MSG(2),1250) UNAM(NUF)                          UDMINT    536
                  WRITE(MSG(3),1031) I,BLNAM1,BLNAM2                    UDMINT    537
                  CALL PRTMSG(3)                                        UDMINT    538
         MSG(1)='UDMINT: UDM OVERRIDE BLOCK HAS BEEN WRONGLY USED'      UDMINT    539
         CALL ASTOP(MSG(1),48)                                          UDMINT    540
      ELSEIF(LTYP.EQ.49) THEN                                           UDMINT    541
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    542
     &            ,INAME(KN1),CID                                       UDMINT    543
                  WRITE(MSG(2),1250) UNAM(NUF)                          UDMINT    544
                  WRITE(MSG(3),1031) I,BLNAM1,BLNAM2                    UDMINT    545
                  CALL PRTMSG(3)                                        UDMINT    546
         MSG(1)='UDMINT: UDM OVERRIDE BLOCK HAS BEEN WRONGLY USED'      UDMINT    547
         CALL ASTOP(MSG(1),48)                                          UDMINT    548
      ELSEIF(LTYP.EQ.50) THEN                                           UDMINT    549
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    550
     &            ,INAME(KN1),CID                                       UDMINT    551
                  WRITE(MSG(2),1260) UNAM(NUF)                          UDMINT    552
                  WRITE(MSG(3),1031) I,BLNAM1,BLNAM2                    UDMINT    553
                  CALL PRTMSG(3)                                        UDMINT    554
         MSG(1)='UDMINT: UDM LF BLOCK HAS BEEN WRONGLY USED'            UDMINT    555
         CALL ASTOP(MSG(1),42)                                          UDMINT    556
      ELSEIF(LTYP.EQ.55) THEN                                           UDMINT    557
         CALL IUDB55(I,NLF1,KN1,CID)                                    UDMINT    558
      ELSEIF(LTYP.EQ.69) THEN                                           UDMINT    559
         CALL IUDB69(I,INDEX,NLF1,KN1,CID)                              UDMINT    560
      ELSEIF(LTYP.EQ.70) THEN                                           UDMINT    561
         CALL IUDB70(I,NLF1,KN1,CID)                                    UDMINT    562
      ELSEIF(LTYP.EQ.71) THEN                                           UDMINT    563
         CALL IUDB71(I,INDEX,NLF1,KN1,CID)                              UDMINT    564
      ELSE                                                              UDMINT    565
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    566
     &            ,INAME(KN1),CID                                       UDMINT    567
                  WRITE(MSG(2),1080)                                    UDMINT    568
                  WRITE(MSG(3),1081)                                    UDMINT    569
                  CALL PRTMSG(3)                                        UDMINT    570
         MSG(1)='UDMINT: WRONG BLOCK TYPE'                              UDMINT    571
         CALL ASTOP(MSG(1),24)                                          UDMINT    572
      ENDIF                                                             UDMINT    573
  220 CONTINUE                                                          UDMINT    574
  230 CONTINUE                                                          UDMINT    575
      IF(JORD.EQ.NUDB) RETURN                                           UDMINT    576
CD                                                                      UDMINT    577
CD    IF ALL BLOCKS HAVE NOT YET BEEN ORDERED, ORDER ANOHTER BLOCK      UDMINT    578
CD    WHOSE ALL INPUT BLOCKS HAVE ALREADY BEEN ORDERED,                 UDMINT    579
CD    OR ARE WASHOUT, OR SWITCH.                                        UDMINT    580
CD                                                                      UDMINT    581
  240 JORD1=JORD                                                        UDMINT    582
      JEB=JE3-17                                                        UDMINT    583
      DO 260 I=1,NUDB                                                   UDMINT    584
      JEB=JEB+17                                                        UDMINT    585
      NBINT1=IDDAT(JEB+1)                                               UDMINT    586
      NBINT2=IDDAT(JEB+17)                                              UDMINT    587
      LTYP=IDDAT(JEB+2)                                                 UDMINT    588
      BLTYP=BTYPE(LTYP)                                                 UDMINT    589
      IF(JUDE(I).NE.0.OR.IBREF.EQ.I) GO TO 260                          UDMINT    590
      J2=JE5-2                                                          UDMINT    591
      DO 250 J=1,INTUD                                                  UDMINT    592
      J2=J2+2                                                           UDMINT    593
      IDD=IDDAT(J2+1)                                                   UDMINT    594
      LTYP1=IDDAT(JE3+17*IDD-15)                                        UDMINT    595
      IDD1=IDDAT(J2+2)                                                  UDMINT    596
      IDD1=IABS(IDD1)                                                   UDMINT    597
      IF(IDD1.EQ.I.AND.JUDE(IDD).EQ.0) THEN                             UDMINT    598
         IF(LTYP1.NE.4.AND.LTYP1.NE.6) GO TO 260                        UDMINT    599
      END IF                                                            UDMINT    600
  250 CONTINUE                                                          UDMINT    601
      JORD=JORD+1                                                       UDMINT    602
      JUDE(I)=JORD                                                      UDMINT    603
      INDEX=1                                                           UDMINT    604
      IF(LTYP.EQ.1) THEN                                                UDMINT    605
         CALL IUDB1(I,INDEX,NLF1,KN1,CID)                               UDMINT    606
      ELSEIF(LTYP.EQ.2) THEN                                            UDMINT    607
         CALL IUDB2(I,INDEX,NLF1,KN1,CID)                               UDMINT    608
      ELSEIF(LTYP.EQ.3) THEN                                            UDMINT    609
         CALL IUDB3(I,INDEX,NLF1,KN1,CID)                               UDMINT    610
      ELSEIF(LTYP.EQ.4) THEN                                            UDMINT    611
         CALL IUDB4(I,INDEX,NLF1,KN1,CID)                               UDMINT    612
      ELSEIF(LTYP.EQ.5) THEN                                            UDMINT    613
         CALL IUDB5(I,INDEX,NLF1,KN1,CID)                               UDMINT    614
      ELSEIF(LTYP.EQ.6) THEN                                            UDMINT    615
         CALL IUDB6(I,INDEX,NLF1,KN1,CID)                               UDMINT    616
      ELSEIF(LTYP.EQ.7) THEN                                            UDMINT    617
         CALL IUDB7(I,INDEX,NLF1,KN1,CID)                               UDMINT    618
      ELSEIF(LTYP.EQ.8) THEN                                            UDMINT    619
         CALL IUDB8(I,INDEX,NLF1,KN1,CID)                               UDMINT    620
      ELSEIF(LTYP.EQ.9) THEN                                            UDMINT    621
         CALL IUDB9(I,INDEX,NLF1,KN1,CID)                               UDMINT    622
      ELSEIF(LTYP.EQ.10) THEN                                           UDMINT    623
         CALL IUDB10(I,INDEX,NLF1,KN1,CID)                              UDMINT    624
      ELSEIF(LTYP.EQ.11) THEN                                           UDMINT    625
         CALL IUDB11(I,INDEX,NLF1,KN1,CID)                              UDMINT    626
      ELSEIF(LTYP.EQ.12) THEN                                           UDMINT    627
         CALL IUDB12(I,INDEX,NLF1,KN1,CID)                              UDMINT    628
      ELSEIF(LTYP.EQ.13) THEN                                           UDMINT    629
         CALL IUDB13(I,INDEX,NLF1,KN1,CID)                              UDMINT    630
      ELSEIF(LTYP.EQ.14) THEN                                           UDMINT    631
         CALL IUDB14(I,INDEX,NLF1,KN1,CID)                              UDMINT    632
      ELSEIF(LTYP.EQ.15) THEN                                           UDMINT    633
         CALL IUDB15(I,INDEX,NLF1,KN1,CID)                              UDMINT    634
      ELSEIF(LTYP.EQ.16) THEN                                           UDMINT    635
         CALL IUDB16(I,INDEX,NLF1,KN1,CID)                              UDMINT    636
      ELSEIF(LTYP.EQ.17) THEN                                           UDMINT    637
         CALL IUDB17(I,INDEX,NLF1,KN1,CID)                              UDMINT    638
      ELSEIF(LTYP.EQ.18) THEN                                           UDMINT    639
         CALL IUDB18(I,INDEX,NLF1,KN1,CID)                              UDMINT    640
      ELSEIF(LTYP.EQ.19) THEN                                           UDMINT    641
         CALL IUDB19(I,INDEX,NLF1,KN1,CID)                              UDMINT    642
      ELSEIF(LTYP.EQ.20) THEN                                           UDMINT    643
         CALL IUDB20(I,INDEX,NLF1,KN1,CID)                              UDMINT    644
      ELSEIF(LTYP.EQ.21) THEN                                           UDMINT    645
         CALL IUDB21(I,INDEX,NLF1,KN1,CID)                              UDMINT    646
      ELSEIF(LTYP.EQ.22) THEN                                           UDMINT    647
         CALL IUDB22(I,INDEX,NLF1,KN1,CID)                              UDMINT    648
      ELSEIF(LTYP.EQ.23) THEN                                           UDMINT    649
         CALL IUDB23(I,INDEX,NLF1,KN1,CID)                              UDMINT    650
      ELSEIF(LTYP.EQ.24) THEN                                           UDMINT    651
         CALL IUDB24(I,INDEX,NLF1,KN1,CID)                              UDMINT    652
      ELSEIF(LTYP.EQ.25) THEN                                           UDMINT    653
         CALL IUDB25(I,INDEX,NLF1,KN1,CID)                              UDMINT    654
      ELSEIF(LTYP.EQ.26) THEN                                           UDMINT    655
         CALL IUDB26(I,INDEX,NLF1,KN1,CID)                              UDMINT    656
      ELSEIF(LTYP.EQ.27) THEN                                           UDMINT    657
         CALL IUDB27(I,INDEX,NLF1,KN1,CID)                              UDMINT    658
      ELSEIF(LTYP.EQ.28) THEN                                           UDMINT    659
         CALL IUDB28(I,INDEX,NLF1,KN1,CID)                              UDMINT    660
      ELSEIF(LTYP.EQ.29) THEN                                           UDMINT    661
         CALL IUDB29(I,INDEX,NLF1,KN1,CID)                              UDMINT    662
      ELSEIF(LTYP.EQ.30) THEN                                           UDMINT    663
         CALL IUDB30(I,INDEX,NLF1,KN1,CID)                              UDMINT    664
      ELSEIF(LTYP.EQ.43) THEN                                           UDMINT    665
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    666
     &            ,INAME(KN1),CID                                       UDMINT    667
                  WRITE(MSG(2),1050) UNAM(NUF)                          UDMINT    668
                  WRITE(MSG(3),1031) I,BLNAM1,BLNAM2                    UDMINT    669
                  CALL PRTMSG(3)                                        UDMINT    670
         MSG(1)='UDMINT: UDM RHL BLOCK HAS BEEN WRONGLY USED'           UDMINT    671
         CALL ASTOP(MSG(1),43)                                          UDMINT    672
      ELSEIF(LTYP.EQ.48) THEN                                           UDMINT    673
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    674
     &            ,INAME(KN1),CID                                       UDMINT    675
                  WRITE(MSG(2),1250) UNAM(NUF)                          UDMINT    676
                  WRITE(MSG(3),1031) I,BLNAM1,BLNAM2                    UDMINT    677
                  CALL PRTMSG(3)                                        UDMINT    678
         MSG(1)='UDMINT: UDM OVERRIDE BLOCK HAS BEEN WRONGLY USED'      UDMINT    679
         CALL ASTOP(MSG(1),48)                                          UDMINT    680
      ELSEIF(LTYP.EQ.49) THEN                                           UDMINT    681
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    682
     &            ,INAME(KN1),CID                                       UDMINT    683
                  WRITE(MSG(2),1250) UNAM(NUF)                          UDMINT    684
                  WRITE(MSG(3),1031) I,BLNAM1,BLNAM2                    UDMINT    685
                  CALL PRTMSG(3)                                        UDMINT    686
         MSG(1)='UDMINT: UDM OVERRIDE BLOCK HAS BEEN WRONGLY USED'      UDMINT    687
         CALL ASTOP(MSG(1),48)                                          UDMINT    688
      ELSEIF(LTYP.EQ.50) THEN                                           UDMINT    689
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    690
     &            ,INAME(KN1),CID                                       UDMINT    691
                  WRITE(MSG(2),1260) UNAM(NUF)                          UDMINT    692
                  WRITE(MSG(3),1031) I,BLNAM1,BLNAM2                    UDMINT    693
                  CALL PRTMSG(3)                                        UDMINT    694
         MSG(1)='UDMINT: UDM LF BLOCK HAS BEEN WRONGLY USED'            UDMINT    695
         CALL ASTOP(MSG(1),42)                                          UDMINT    696
      ELSEIF(LTYP.EQ.55) THEN                                           UDMINT    697
         CALL IUDB55(I,NLF1,KN1,CID)                                    UDMINT    698
      ELSEIF(LTYP.EQ.69) THEN                                           UDMINT    699
         CALL IUDB69(I,INDEX,NLF1,KN1,CID)                              UDMINT    700
      ELSEIF(LTYP.EQ.70) THEN                                           UDMINT    701
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    702
     &            ,INAME(KN1),CID                                       UDMINT    703
                  WRITE(MSG(2),1261) UNAM(NUF)                          UDMINT    704
                  WRITE(MSG(3),1031) I,BLNAM1,BLNAM2                    UDMINT    705
                  CALL PRTMSG(3)                                        UDMINT    706
         MSG(1)='UDMINT: UDM COM BLOCK HAS BEEN WRONGLY USED'           UDMINT    707
         CALL ASTOP(MSG(1),43)                                          UDMINT    708
      ELSEIF(LTYP.EQ.71) THEN                                           UDMINT    709
         CALL IUDB71(I,INDEX,NLF1,KN1,CID)                              UDMINT    710
      ELSE                                                              UDMINT    711
         MSG(1)='UDMINT: 3'                                             UDMINT    712
         CALL ASTOP(MSG(1),9)                                           UDMINT    713
      ENDIF                                                             UDMINT    714
  260 CONTINUE                                                          UDMINT    715
CD                                                                      UDMINT    716
CD    IF NO BLOCKS WITH ALL INPUT BLOCKS ORDERED IS FOUND, LOOK FOR     UDMINT    717
CD    A BLOCK WITH KNOWN OUTPUT.                                        UDMINT    718
CD                                                                      UDMINT    719
      IF(JORD.EQ.JORD1) THEN                                            UDMINT    720
         JEB=JE3-17                                                     UDMINT    721
         DO 310 I=1,NUDB                                                UDMINT    722
         JEB=JEB+17                                                     UDMINT    723
         NBINT1=IDDAT(JEB+1)                                            UDMINT    724
         NBINT2=IDDAT(JEB+17)                                           UDMINT    725
         LTYP=IDDAT(JEB+2)                                              UDMINT    726
         BLTYP=BTYPE(LTYP)                                              UDMINT    727
         IF(JUDE(I).NE.0) GO TO 310                                     UDMINT    728
         J2=JE5-2                                                       UDMINT    729
         DO 290 J=1,INTUD                                               UDMINT    730
         J2=J2+2                                                        UDMINT    731
         IDD=IDDAT(J2+2)                                                UDMINT    732
         IDD=IABS(IDD)                                                  UDMINT    733
         IDD1=IDDAT(J2+1)                                               UDMINT    734
         IF(IDD1.EQ.I.AND.JUDE(IDD).NE.0) THEN                          UDMINT    735
            LBY=0                                                       UDMINT    736
            IF(LTYP.NE.4.AND.LTYP.NE.6) LBY=LBY+1                       UDMINT    737
            K2=JE5-2                                                    UDMINT    738
            DO 280 K=1,INTUD                                            UDMINT    739
            K2=K2+2                                                     UDMINT    740
            IDD2=IDDAT(K2+1)                                            UDMINT    741
            IDD3=IDDAT(K2+2)                                            UDMINT    742
            IDD3=IABS(IDD3)                                             UDMINT    743
            JEJ=JE3+17*IDD3-15                                          UDMINT    744
            LTYP2=IDDAT(JEJ)                                            UDMINT    745
            IF(IDD2.EQ.I.AND.K.NE.J) THEN                               UDMINT    746
               IF(LTYP2.NE.4.AND.LTYP2.NE.6) LBY=LBY+1                  UDMINT    747
               IF(LBY.GT.1) THEN                                        UDMINT    748
CD                                                                      UDMINT    749
CD    THIS A THE CONDITION FOR AVR BEING OUT OF SEQUENCE.               UDMINT    750
CD    PRINT THE MESSAGE.                                                UDMINT    751
CD                                                                      UDMINT    752
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    753
     &            ,INAME(KN1),CID                                       UDMINT    754
                  WRITE(MSG(2),1001) UNAM(NUF)                          UDMINT    755
                  WRITE(MSG(3),1002) I,BLNAM1,BLNAM2                    UDMINT    756
                  WRITE(MSG(4),1003)                                    UDMINT    757
                  CALL PRTMSG(4)                                        UDMINT    758
               MSG(1)='UDMINT: UDM REG BLOCK IS NOT IN RIGHT SEQUENCE'  UDMINT    759
               CALL ASTOP(MSG(1),46)                                    UDMINT    760
               ENDIF                                                    UDMINT    761
            ENDIF                                                       UDMINT    762
            IF(K.EQ.INTUD) THEN                                         UDMINT    763
               IF(NEXTF.EQ.0.AND.NEXTB.NE.0) THEN                       UDMINT    764
                  IF(I.NE.NEXTB) THEN                                   UDMINT    765
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    766
     &            ,INAME(KN1),CID                                       UDMINT    767
                  WRITE(MSG(2),1270) UNAM(NUF)                          UDMINT    768
                  WRITE(MSG(3),1271) I,BLNAM1,BLNAM2                    UDMINT    769
                  CALL PRTMSG(3)                                        UDMINT    770
                  MSG(1)='UDMINT: UDM REG BLOCK IS WRONGLY CONNECTED'   UDMINT    771
                  CALL ASTOP(MSG(1),42)                                 UDMINT    772
                  ENDIF                                                 UDMINT    773
               ENDIF                                                    UDMINT    774
               NEXTF=1                                                  UDMINT    775
               IF(I.EQ.IBREF) THEN                                      UDMINT    776
                  JEBR=JEB                                              UDMINT    777
                  JEB=JE3-17                                            UDMINT    778
                  DO 270 ISW=1,NUDB                                     UDMINT    779
                  JEB=JEB+17                                            UDMINT    780
                  NBINT1=IDDAT(JEB+1)                                   UDMINT    781
                  NBINT2=IDDAT(JEB+17)                                  UDMINT    782
                  LTYP=IDDAT(JEB+2)                                     UDMINT    783
                  BLTYP=BTYPE(LTYP)                                     UDMINT    784
                  IF(JUDE(ISW).NE.0.OR.IBREF.EQ.ISW) GO TO 270          UDMINT    785
                  JORD=JORD+1                                           UDMINT    786
                  JUDE(ISW)=JORD                                        UDMINT    787
                  INDEX=1                                               UDMINT    788
                  IF(LTYP.EQ.4) THEN                                    UDMINT    789
                     CALL IUDB4(ISW,INDEX,NLF1,KN1,CID)                 UDMINT    790
                  ELSEIF(LTYP.EQ.6) THEN                                UDMINT    791
                     CALL IUDB6(ISW,INDEX,NLF1,KN1,CID)                 UDMINT    792
                  ELSE                                                  UDMINT    793
                     MSG(1)='UDMINT: 4'                                 UDMINT    794
                     CALL ASTOP(MSG(1),9)                               UDMINT    795
                  ENDIF                                                 UDMINT    796
  270             CONTINUE                                              UDMINT    797
                  JEB=JEBR                                              UDMINT    798
                  NBINT1=IDDAT(JEB+1)                                   UDMINT    799
                  NBINT2=IDDAT(JEB+17)                                  UDMINT    800
                  LTYP=IDDAT(JEB+2)                                     UDMINT    801
                  BLTYP=BTYPE(LTYP)                                     UDMINT    802
               ENDIF                                                    UDMINT    803
               JORD=JORD+1                                              UDMINT    804
               JUDE(I)=JORD                                             UDMINT    805
               INDEX=2                                                  UDMINT    806
               IF(LTYP.EQ.1) THEN                                       UDMINT    807
                  CALL IUDB1(I,INDEX,NLF1,KN1,CID)                      UDMINT    808
               ELSEIF(LTYP.EQ.2) THEN                                   UDMINT    809
                  CALL IUDB2(I,INDEX,NLF1,KN1,CID)                      UDMINT    810
               ELSEIF(LTYP.EQ.3) THEN                                   UDMINT    811
                  CALL IUDB3(I,INDEX,NLF1,KN1,CID)                      UDMINT    812
               ELSEIF(LTYP.EQ.4) THEN                                   UDMINT    813
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    814
     &            ,INAME(KN1),CID                                       UDMINT    815
                  WRITE(MSG(2),1030) UNAM(NUF)                          UDMINT    816
                  WRITE(MSG(3),1031) I,BLNAM1,BLNAM2                    UDMINT    817
                  CALL PRTMSG(3)                                        UDMINT    818
                  MSG(1)='UDMINT: UDM WASHOUT WAS WRONGLY USED'         UDMINT    819
                  CALL ASTOP(MSG(1),36)                                 UDMINT    820
               ELSEIF(LTYP.EQ.5) THEN                                   UDMINT    821
                  CALL IUDB5(I,INDEX,NLF1,KN1,CID)                      UDMINT    822
               ELSEIF(LTYP.EQ.6) THEN                                   UDMINT    823
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    824
     &            ,INAME(KN1),CID                                       UDMINT    825
                  WRITE(MSG(2),1040) UNAM(NUF)                          UDMINT    826
                  WRITE(MSG(3),1031) I,BLNAM1,BLNAM2                    UDMINT    827
                  CALL PRTMSG(3)                                        UDMINT    828
      MSG(1)='UDMINT: UDM NO SWITCH CAN BE USED IN REG PATH'            UDMINT    829
      CALL ASTOP(MSG(1),45)                                             UDMINT    830
               ELSEIF(LTYP.EQ.7) THEN                                   UDMINT    831
                  CALL IUDB7(I,INDEX,NLF1,KN1,CID)                      UDMINT    832
               ELSEIF(LTYP.EQ.8) THEN                                   UDMINT    833
                  CALL IUDB8(I,INDEX,NLF1,KN1,CID)                      UDMINT    834
               ELSEIF(LTYP.EQ.9) THEN                                   UDMINT    835
                  CALL IUDB9(I,INDEX,NLF1,KN1,CID)                      UDMINT    836
               ELSEIF(LTYP.EQ.10) THEN                                  UDMINT    837
                  CALL IUDB10(I,INDEX,NLF1,KN1,CID)                     UDMINT    838
               ELSEIF(LTYP.EQ.11) THEN                                  UDMINT    839
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    840
     &            ,INAME(KN1),CID                                       UDMINT    841
                  WRITE(MSG(2),1070) UNAM(NUF)                          UDMINT    842
                  WRITE(MSG(3),1031) I,BLNAM1,BLNAM2                    UDMINT    843
                  CALL PRTMSG(3)                                        UDMINT    844
      MSG(1)=                                                           UDMINT    845
     *'UDMINT: UDM NO INITIAL VALUE BLOCK CAN BE USED IN REG BLOCK'     UDMINT    846
      CALL ASTOP(MSG(1),59)                                             UDMINT    847
               ELSEIF(LTYP.EQ.12) THEN                                  UDMINT    848
                  CALL IUDB12(I,INDEX,NLF1,KN1,CID)                     UDMINT    849
               ELSEIF(LTYP.EQ.13) THEN                                  UDMINT    850
                  CALL IUDB13(I,INDEX,NLF1,KN1,CID)                     UDMINT    851
               ELSEIF(LTYP.EQ.14) THEN                                  UDMINT    852
                  CALL IUDB14(I,INDEX,NLF1,KN1,CID)                     UDMINT    853
               ELSEIF(LTYP.EQ.15) THEN                                  UDMINT    854
                  CALL IUDB15(I,INDEX,NLF1,KN1,CID)                     UDMINT    855
               ELSEIF(LTYP.EQ.16) THEN                                  UDMINT    856
                  CALL IUDB16(I,INDEX,NLF1,KN1,CID)                     UDMINT    857
               ELSEIF(LTYP.EQ.17) THEN                                  UDMINT    858
                  CALL IUDB17(I,INDEX,NLF1,KN1,CID)                     UDMINT    859
               ELSEIF(LTYP.EQ.18) THEN                                  UDMINT    860
                  CALL IUDB18(I,INDEX,NLF1,KN1,CID)                     UDMINT    861
               ELSEIF(LTYP.EQ.19) THEN                                  UDMINT    862
                  CALL IUDB19(I,INDEX,NLF1,KN1,CID)                     UDMINT    863
               ELSEIF(LTYP.EQ.20) THEN                                  UDMINT    864
                  CALL IUDB20(I,INDEX,NLF1,KN1,CID)                     UDMINT    865
               ELSEIF(LTYP.EQ.21) THEN                                  UDMINT    866
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    867
     &            ,INAME(KN1),CID                                       UDMINT    868
                  WRITE(MSG(2),1150) UNAM(NUF)                          UDMINT    869
                  WRITE(MSG(3),1031) I,BLNAM1,BLNAM2                    UDMINT    870
                  CALL PRTMSG(3)                                        UDMINT    871
      MSG(1)='UDMINT: UDM ABSOLUTE VALUE BLOCK IS WRONGLY USED'         UDMINT    872
      CALL ASTOP(MSG(1),48)                                             UDMINT    873
               ELSEIF(LTYP.EQ.22) THEN                                  UDMINT    874
                  CALL IUDB22(I,INDEX,NLF1,KN1,CID)                     UDMINT    875
               ELSEIF(LTYP.EQ.23) THEN                                  UDMINT    876
                  CALL IUDB23(I,INDEX,NLF1,KN1,CID)                     UDMINT    877
               ELSEIF(LTYP.EQ.24) THEN                                  UDMINT    878
                  CALL IUDB24(I,INDEX,NLF1,KN1,CID)                     UDMINT    879
               ELSEIF(LTYP.EQ.25) THEN                                  UDMINT    880
                  CALL IUDB25(I,INDEX,NLF1,KN1,CID)                     UDMINT    881
               ELSEIF(LTYP.EQ.26) THEN                                  UDMINT    882
                  CALL IUDB26(I,INDEX,NLF1,KN1,CID)                     UDMINT    883
               ELSEIF(LTYP.EQ.27) THEN                                  UDMINT    884
                  CALL IUDB27(I,INDEX,NLF1,KN1,CID)                     UDMINT    885
               ELSEIF(LTYP.EQ.28) THEN                                  UDMINT    886
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    887
     &            ,INAME(KN1),CID                                       UDMINT    888
                  WRITE(MSG(2),1220) UNAM(NUF)                          UDMINT    889
                  WRITE(MSG(3),1031) I,BLNAM1,BLNAM2                    UDMINT    890
                  CALL PRTMSG(3)                                        UDMINT    891
      MSG(1)='UDMINT: UDM TIMER BLOCK HAS BEEN WRONGLY USED'            UDMINT    892
      CALL ASTOP(MSG(1),45)                                             UDMINT    893
               ELSEIF(LTYP.EQ.29) THEN                                  UDMINT    894
                  CALL IUDB29(I,INDEX,NLF1,KN1,CID)                     UDMINT    895
               ELSEIF(LTYP.EQ.30) THEN                                  UDMINT    896
                  CALL IUDB30(I,INDEX,NLF1,KN1,CID)                     UDMINT    897
               ELSEIF(LTYP.EQ.43) THEN                                  UDMINT    898
                  CALL IUDB43(I,NLF1,KN1,CID)                           UDMINT    899
               ELSEIF(LTYP.EQ.48) THEN                                  UDMINT    900
                  CALL IUDB48(I,NLF1,KN1,CID)                           UDMINT    901
               ELSEIF(LTYP.EQ.49) THEN                                  UDMINT    902
                  CALL IUDB49(I,NLF1,KN1,CID)                           UDMINT    903
               ELSEIF(LTYP.EQ.50) THEN                                  UDMINT    904
                  CALL IUDB50(I,NLF1,KN1,CID)                           UDMINT    905
               ELSEIF(LTYP.EQ.69) THEN                                  UDMINT    906
                  CALL IUDB69(I,INDEX,NLF1,KN1,CID)                     UDMINT    907
               ELSEIF(LTYP.EQ.70) THEN                                  UDMINT    908
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    909
     &            ,INAME(KN1),CID                                       UDMINT    910
                  WRITE(MSG(2),1261) UNAM(NUF)                          UDMINT    911
                  WRITE(MSG(3),1031) I,BLNAM1,BLNAM2                    UDMINT    912
                  CALL PRTMSG(3)                                        UDMINT    913
                  MSG(1)='UDMINT: UDM COM BLOCK HAS BEEN WRONGLY USED'  UDMINT    914
                  CALL ASTOP(MSG(1),43)                                 UDMINT    915
               ELSEIF(LTYP.EQ.71) THEN                                  UDMINT    916
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    917
     &            ,INAME(KN1),CID                                       UDMINT    918
                  WRITE(MSG(2),1030) UNAM(NUF)                          UDMINT    919
                  WRITE(MSG(3),1031) I,BLNAM1,BLNAM2                    UDMINT    920
                  CALL PRTMSG(3)                                        UDMINT    921
                  MSG(1)='UDMINT: UDM WASHOUT WAS WRONGLY USED'         UDMINT    922
                  CALL ASTOP(MSG(1),36)                                 UDMINT    923
               ELSE                                                     UDMINT    924
                  MSG(1)='UDMINT: 5'                                    UDMINT    925
                  CALL ASTOP(MSG(1),9)                                  UDMINT    926
               ENDIF                                                    UDMINT    927
               GO TO 320                                                UDMINT    928
            ENDIF                                                       UDMINT    929
  280       CONTINUE                                                    UDMINT    930
         ENDIF                                                          UDMINT    931
  290    CONTINUE                                                       UDMINT    932
         II=I                                                           UDMINT    933
         BLNAM3=BLNAM1                                                  UDMINT    934
         BLNAM4=BLNAM2                                                  UDMINT    935
  310    CONTINUE                                                       UDMINT    936
         IF(JORD.EQ.JORD1)THEN                                          UDMINT    937
CD                                                                      UDMINT    938
CD    THIS IS THE CONDITION FOR AVR SEQUENCE BEING OPEN.                UDMINT    939
CD    PRINT THE MESSAGE.                                                UDMINT    940
CD                                                                      UDMINT    941
CD                                                                      UDMINT    942
                  WRITE(MSG(1),1000) NLF1,INAME(KN1-2),INAME(KN1-1)     UDMINT    943
     &            ,INAME(KN1),CID                                       UDMINT    944
                  WRITE(MSG(2),1001) UNAM(NUF)                          UDMINT    945
                  WRITE(MSG(3),1002) II,BLNAM3,BLNAM4                   UDMINT    946
                  WRITE(MSG(4),1010)                                    UDMINT    947
                  CALL PRTMSG(4)                                        UDMINT    948
            MSG(1)='UDMINT: UDM REG BLOCKS ARE NOT IN SEQUENCE'         UDMINT    949
            CALL ASTOP(MSG(1),42)                                       UDMINT    950
         ENDIF                                                          UDMINT    951
      END IF                                                            UDMINT    952
  320 IF(JORD.LT.NUDB) GO TO 240                                        UDMINT    953
      JSTATE=JSTATE+KSUD                                                UDMINT    954
C                                                                       UDMINT    955
      IF(NUF.LE.4) NVALUS=NVALUS+1                                      UDMINT    956
      IF(NUF.LE.5) NVALUR=NVALUR+1                                      UDMINT    957
      IF(NUF.LE.6) NVALUT=NVALUT+1                                      UDMINT    958
      IF(NUF.LE.8) NVALUB=NVALUB+1                                      UDMINT    959
      DO 330 J=1,80                                                     UDMINT    960
      NVALIU=NVALIU+1                                                   UDMINT    961
      VALIUD(NVALIU)=VALIN(J)                                           UDMINT    962
  330 CONTINUE                                                          UDMINT    963
      DO 340 J=1,NXUDB                                                  UDMINT    964
      NVALOU=NVALOU+1                                                   UDMINT    965
      VALOUD(NVALOU)=VALOUT(J)                                          UDMINT    966
  340 CONTINUE                                                          UDMINT    967
      RETURN                                                            UDMINT    968
C                                                                       UDMINT    969
 1000 FORMAT(1X,'*** ERROR USER DEFINED MODEL AT BUS:',I5,' STATION:'   UDMINT    970
     *,3A4,' GID:',A4)                                                  UDMINT    971
 1001 FORMAT(11X,A6,' THE REG BLOCKS ARE NOT IN SEQUENCE.')             UDMINT    972
 1002 FORMAT(11X,'CHECK THE INTERCONNECTIONS OF BLOCK #',I3,' (',2A4,   UDMINT    973
     &')')                                                              UDMINT    974
 1003 FORMAT(11X,'TO OTHER BLOCKS FOR A POSSIBLE BYPASS.')              UDMINT    975
 1010 FORMAT(11X,'TO OTHER BLOCKS FOR A POSSIBLE BREAK UP.')            UDMINT    976
 1030 FORMAT(11X,A6,' A WASHOUT CANNOT BE USED IN THE REG')             UDMINT    977
 1031 FORMAT(11X,'INITIAL CONTROL PATH. BLOCK# ',I3,' (',2A4,').')      UDMINT    978
 1040 FORMAT(11X,A6,' A SWITCH CANNOT BE USED IN THE REG')              UDMINT    979
 1050 FORMAT(11X,A6,' RHL BLOCK MAY ONLY BE USED IN THE REG')           UDMINT    980
 1070 FORMAT(11X,A6                                                     UDMINT    981
     *,' AN INITIAL VALUE BLOCK CANNOT BE USED IN THE REG')             UDMINT    982
 1150 FORMAT(11X,A6,' AN ABSOLUTE VALUE CANNOT BE USED IN THE REG')     UDMINT    983
 1220 FORMAT(11X,A6,' A TIMER CANNOT BE USED IN THE REG')               UDMINT    984
 1250 FORMAT(11X,A6,' OVERRIDE BLOCK MAY ONLY BE USED IN THE REG')      UDMINT    985
 1260 FORMAT(11X,A6,' LF BLOCK MAY ONLY BE USED IN THE REG')            UDMINT    986
 1261 FORMAT(11X,A6,' COM BLOCK CANNOT HAVE INPUTS OR BE USED IN THE'   UDMINT    987
     &,' REG')                                                          UDMINT    988
 1080 FORMAT(11X,A6,' IN END BLOCK# ',I3,' (',2A4,')')                  UDMINT    989
 1081 FORMAT(11X,'BASE CONVERTING RATIO MUST BE POSITIVE.')             UDMINT    990
 1180 FORMAT(11X,A6,' IN SD1 BLOCK#',I3,'(',2A4,')')                    UDMINT    991
 1181 FORMAT(11X,'QL MUST BE LARGER THAN ZERO AND QC NON-NEGATIVE.')    UDMINT    992
 1182 FORMAT(11X,' QL=',F10.2,' QC=',F10.2)                             UDMINT    993
 1183 FORMAT(11X,A6,' IN SD7 BLOCK#',I3,'(',2A4,')')                    UDMINT    994
 1184 FORMAT(11X,'QL AND QC MUST BE NON-NEGATIVE, AND QL+QC NON-ZERO.') UDMINT    995
 1185 FORMAT(11X,'QL=',F10.3,' QC=',F10.3)                              UDMINT    996
 1186 FORMAT(11X,A6,' IN SD8 BLOCK#',I3,'(',2A4,')')                    UDMINT    997
 1187 FORMAT(11X,'QT MUST BE POSITIVE.')                                UDMINT    998
 1188 FORMAT(11X,'QT=',F10.3)                                           UDMINT    999
 1189 FORMAT(11X,A6,' IN SD9 BLOCK#',I3,'(',2A4,')')                    UDMINT   1000
 1190 FORMAT(11X,'%X MUST BE POSITIVE AND LESS THAN 100.0.')            UDMINT   1001
 1191 FORMAT(11X,'%X=',F10.3)                                           UDMINT   1002
 1230 FORMAT(11X,A6,' IN SD2 BLOCK#',I3,'(',2A4,')')                    UDMINT   1003
 1240 FORMAT(11X,A6,' IN SD3 BLOCK#',I3,'(',2A4,')')                    UDMINT   1004
 1241 FORMAT(11X,'QL MUST BE NON-NEGATIVE AND QC LARGER THAN ZERO.')    UDMINT   1005
 1270 FORMAT(11X,A6,' REG PATH IS NOT CONNECTED TO THE'                 UDMINT   1006
     &,' FIRST INPUT OF END')                                           UDMINT   1007
 1271 FORMAT(11X,'BLOCK. CHECK CONNECTIONS OF BLOCK#',I3,' (',2A4,')')  UDMINT   1008
 1290 FORMAT(11X,A6,' IN SD6 BLOCK#',I3,'(',2A4,') PG MUST BE')         UDMINT   1009
 1291 FORMAT(11X,'LARGER THAN ZERO.  PG=',F10.5)                        UDMINT   1010
 2070 FORMAT(' *** ERROR TOTAL NUMBER OF STATES IN THE SYSTEM EXCEEDS'  UDMINT   1011
     *,' THE LIMIT OF',I6)                                              UDMINT   1012
      END                                                               UDMINT   1013
