CFPRIME USBRKR                                                          USBRKR      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 USBRKR (JBLK)                                          USBRKR      3
CD -------------------------------------------------------------------  USBRKR      4
CD                                                                      USBRKR      5
CD              *****     USBRKR   ROUTINE   *****                      USBRKR      6
CD                                                                      USBRKR      7
CD -------------------------------------------------------------------  USBRKR      8
CD                                                                      USBRKR      9
CD       PURPOSE:  Performs the solution of the udc type BREAKR.        USBRKR     10
CD                                                                      USBRKR     11
CD                                                                      USBRKR     12
CD       DEFINITION OF LOCAL VARIABLES:                                 USBRKR     13
CD                 BLK    -  current udc block.                         USBRKR     14
CD                 BNAME  -  current udc block name.                    USBRKR     15
CD                 BRKPTR -  pointer to breaker data.                   USBRKR     16
CD                 CDELAY -  close delay time.                          USBRKR     17
CD                 CREQST -  close request input.                       USBRKR     18
CD                 CTIMER -  close timer value.                         USBRKR     19
CD                 CURMAX -  maximum current.                           USBRKR     20
CD                 CUROPN -  minimum opening current.                   USBRKR     21
CD                 I      -  loop counter.                              USBRKR     22
CD                 IINPUT -  array containing integer input values.     USBRKR     23
CD                 LEN    -  length of current udc block name.          USBRKR     24
CD                 ODELAY -  open delay time.                           USBRKR     25
CD                 OLDRAT -  previous RATE value.                       USBRKR     26
CD                 OLDVOL -  preious VOLTAGE value.                     USBRKR     27
CD                 OREQST -  open request input.                        USBRKR     28
CD                 OTIMER -  open timer.                                USBRKR     29
CD                 RATE   -  voltage rise rate (integrator)             USBRKR     30
CD                 RINPUT -  real input values.                         USBRKR     31
CD                 SUBNAM -  subroutine name.                           USBRKR     32
CD                 TNAME  -  UDC type name.                             USBRKR     33
CD                 VOLMAX -  maximum voltage value.                     USBRKR     34
CD                 VOLRIS -  voltage rise time (in seconds)             USBRKR     35
CD                                                                      USBRKR     36
CD -------------------------------------------------------------------  USBRKR     37
C                                                                       USBRKR     38
      INCLUDE 'CNUNIT.INS'                                              USBRKR     39
      INCLUDE 'CNMSG.INS'                                               USBRKR     40
      INCLUDE 'PARX.INS'                                                USBRKR     41
      INCLUDE 'CNPARX.INS'                                              USBRKR     42
      INCLUDE 'UDCA.INS'                                                USBRKR     43
      INCLUDE 'UDCC.INS'                                                USBRKR     44
      INCLUDE 'UDCG.INS'                                                USBRKR     45
      INCLUDE 'UDCH.INS'                                                USBRKR     46
      INCLUDE 'UDCJ.INS'                                                USBRKR     47
      INCLUDE 'GRDC01.INS'                                              USBRKR     48
      INCLUDE 'GRDC03.INS'                                              USBRKR     49
C                                                                       USBRKR     50
      LOGICAL       AND, LOGEXP(2), ONE, OR, RESET, SET, ZERO           USBRKR     51
      LOGICAL       LARSET, LASET, SAVE, DONE, DONE1, END               USBRKR     52
C                                                                       USBRKR     53
      DIMENSION     RINPUT(20), IINPUT(20)                              USBRKR     54
      DIMENSION     PARM(4)                                             USBRKR     55
C                                                                       USBRKR     56
      CHARACTER*20  SUBNAM                                              USBRKR     57
      CHARACTER*17  BNAME                                               USBRKR     58
      CHARACTER*8   TNAME                                               USBRKR     59
      CHARACTER*2   OPER                                                USBRKR     60
C                                                                       USBRKR     61
      INCLUDE 'GRBRKR.INS'                                              USBRKR     62
      INCLUDE 'GRLIMT.INS'                                              USBRKR     63
      INCLUDE 'GRLOGC.INS'                                              USBRKR     64
      INCLUDE 'GROTHR.INS'                                              USBRKR     65
      INCLUDE 'GRSSSP.INS'                                              USBRKR     66
      INCLUDE 'GRUNA.INS'                                               USBRKR     67
C                                                                       USBRKR     68
      IF (SDBG) THEN                                                    USBRKR     69
         SUBNAM = 'USBRKR ROUTINE.'                                     USBRKR     70
      ELSE                                                              USBRKR     71
         SUBNAM = ' '                                                   USBRKR     72
      END IF                                                            USBRKR     73
      TNAME = TPNAME(IBREAK)                                            USBRKR     74
      BNAME = UDNAME(JBLK)                                              USBRKR     75
      LEN = IUDLEN(JBLK)                                                USBRKR     76
C                                                                       USBRKR     77
C     Retrieve input values.                                            USBRKR     78
C     ---------------------                                             USBRKR     79
C                                                                       USBRKR     80
      NEXTI = IUNIPT(JBLK)                                              USBRKR     81
      NEXTP = IUDPPT(JBLK)                                              USBRKR     82
      I = 0                                                             USBRKR     83
C                                                                       USBRKR     84
20    IF ((NEXTI .EQ. 0) .OR. (NEXTP .EQ. 0)) GO TO 40                  USBRKR     85
         I = I + 1                                                      USBRKR     86
         IF (UIDENT(NEXTI) .EQ. ' ') THEN                               USBRKR     87
            IF (IUDINT(NEXTI) .NE. 0) THEN                              USBRKR     88
C                                                                       USBRKR     89
C              Retrieve any integer input (BREAKER POINTER)             USBRKR     90
C                                                                       USBRKR     91
               IINPUT(I) = IUDINT(NEXTI)                                USBRKR     92
            ELSE                                                        USBRKR     93
C                                                                       USBRKR     94
C              Retrieve real parameters.                                USBRKR     95
C                                                                       USBRKR     96
               RINPUT(I) = UDPARM(NEXTP)                                USBRKR     97
            END IF                                                      USBRKR     98
         ELSE                                                           USBRKR     99
            IF (IUDINT(NEXTI) .NE. 0) THEN                              USBRKR    100
C                                                                       USBRKR    101
C              Retrieve input from other blocks.                        USBRKR    102
C                                                                       USBRKR    103
               RINPUT(I) = UDVAL(IUDINT(NEXTI))                         USBRKR    104
            END IF                                                      USBRKR    105
         END IF                                                         USBRKR    106
         NEXTI = IUDINX(NEXTI)                                          USBRKR    107
         NEXTP = IUDPNX(NEXTP)                                          USBRKR    108
         GO TO 20                                                       USBRKR    109
40    CONTINUE                                                          USBRKR    110
C                                                                       USBRKR    111
C     ------------------------------------------------------            USBRKR    112
C     Assign the input values to the corresponding variables.           USBRKR    113
C     ------------------------------------------------------            USBRKR    114
C                                                                       USBRKR    115
      IF (IUDSUB(JBLK) .EQ. JBREAK) THEN                                USBRKR    116
         IBRKPT = IINPUT(1)                                             USBRKR    117
         OREQST = RINPUT(2)                                             USBRKR    118
         ODELAY = RINPUT(3)                                             USBRKR    119
         VOLRIS = RINPUT(4)                                             USBRKR    120
         VOLMAX = RINPUT(5)                                             USBRKR    121
         CURMAX = RINPUT(6)                                             USBRKR    122
         CUROPN = RINPUT(7)                                             USBRKR    123
         CREQST = RINPUT(8)                                             USBRKR    124
         CDELAY = RINPUT(9)                                             USBRKR    125
         RATE = 0.0                                                     USBRKR    126
      ELSE IF (IUDSUB(JBLK) .EQ. JDISCO) THEN                           USBRKR    127
         IBRKPT = IINPUT(1)                                             USBRKR    128
         OREQST = RINPUT(2)                                             USBRKR    129
         CURMAX = RINPUT(3)                                             USBRKR    130
         CREQST = RINPUT(4)                                             USBRKR    131
      END IF                                                            USBRKR    132
C                                                                       USBRKR    133
C     --------------------------------                                  USBRKR    134
C     Perform the block solution.                                       USBRKR    135
C     --------------------------------                                  USBRKR    136
C                                                                       USBRKR    137
      IF (IUDSUB(JBLK) .EQ. JBREAK) THEN                                USBRKR    138
C                                                                       USBRKR    139
C        Retrieve the open and close timer variables.                   USBRKR    140
C                                                                       USBRKR    141
         NEXTS = IUDSPT(JBLK)                                           USBRKR    142
         IF (NEXTS .EQ. 0) THEN                                         USBRKR    143
            IERCNT = IERCNT + 1                                         USBRKR    144
            WRITE (MSG(1),9000) SUBNAM                                  USBRKR    145
            WRITE(MSG(2),9001) TNAME                                    USBRKR    146
            WRITE(MSG(3),9002) BNAME(1:LEN)                             USBRKR    147
            WRITE(MSG(4),9003)                                          USBRKR    148
            CALL PRTMSG(4)                                              USBRKR    149
         ELSE                                                           USBRKR    150
            OTIMER  = UDOLD(NEXTS)                                      USBRKR    151
            NEXTS = IUDSNX(NEXTS)                                       USBRKR    152
         END IF                                                         USBRKR    153
         IF (NEXTS .EQ. 0) THEN                                         USBRKR    154
            IERCNT = IERCNT + 1                                         USBRKR    155
            WRITE (MSG(1),9000) SUBNAM                                  USBRKR    156
            WRITE(MSG(2),9001) TNAME                                    USBRKR    157
            WRITE(MSG(3),9002) BNAME(1:LEN)                             USBRKR    158
            WRITE(MSG(4),9003)                                          USBRKR    159
            CALL PRTMSG(4)                                              USBRKR    160
         ELSE                                                           USBRKR    161
            CTIMER  = UDOLD(NEXTS)                                      USBRKR    162
            NEXTS = IUDSNX(NEXTS)                                       USBRKR    163
         END IF                                                         USBRKR    164
C                                                                       USBRKR    165
C        Retrieve the previous value for RATE.                          USBRKR    166
C                                                                       USBRKR    167
         IF (NEXTS .EQ. 0) THEN                                         USBRKR    168
            IERCNT = IERCNT + 1                                         USBRKR    169
            WRITE (MSG(1),9000) SUBNAM                                  USBRKR    170
            WRITE(MSG(2),9001) TNAME                                    USBRKR    171
            WRITE(MSG(3),9002) BNAME(1:LEN)                             USBRKR    172
            WRITE(MSG(4),9003)                                          USBRKR    173
            CALL PRTMSG(4)                                              USBRKR    174
         ELSE                                                           USBRKR    175
            OLDRAT = UDOLD(NEXTS)                                       USBRKR    176
         END IF                                                         USBRKR    177
C                                                                       USBRKR    178
C        If an open or close request has occurred - process it.         USBRKR    179
C                                                                       USBRKR    180
         IF (OREQST .NE. 0.0) THEN                                      USBRKR    181
            CTIMER = 0.0                                                USBRKR    182
            IF (UDOU2(JBLK) .EQ. 'CLOSED') THEN                         USBRKR    183
               IF (OTIMER .EQ. 0.0) OTIMER = TIME + ODELAY              USBRKR    184
            END IF                                                      USBRKR    185
         ELSE IF (CREQST .NE. 0.0) THEN                                 USBRKR    186
            OTIMER = 0.0                                                USBRKR    187
            IF (UDOU2(JBLK) .NE. 'CLOSED') THEN                         USBRKR    188
               IF (CTIMER .EQ. 0.0) CTIMER = TIME + CDELAY              USBRKR    189
            END IF                                                      USBRKR    190
         END IF                                                         USBRKR    191
C                                                                       USBRKR    192
         IF (UDOU2(JBLK) .EQ. 'CLOSED') THEN                            USBRKR    193
C                                                                       USBRKR    194
C           If the open timer has timed out AND breaker current is less USBRKR    195
C           than the maximum then mode is updated to OPENNG.            USBRKR    196
C                                                                       USBRKR    197
            IF (OTIMER .GT. 0.0 .AND. TIME .GE. OTIMER) THEN            USBRKR    198
               IF (ABS(UBCURR(IBRKPT)*1000.) .LE. CURMAX) THEN          USBRKR    199
                  UDOU2(JBLK) = 'OPENING'                               USBRKR    200
                  OTIMER = 0.0                                          USBRKR    201
               END IF                                                   USBRKR    202
            END IF                                                      USBRKR    203
            UDVAL(JBLK) = 0.0                                           USBRKR    204
C                                                                       USBRKR    205
         ELSE IF (UDOU2(JBLK) .EQ. 'OPENED') THEN                       USBRKR    206
C                                                                       USBRKR    207
C           If the close timer has timed out then the mode becomes      USBRKR    208
C           CLOSED.                                                     USBRKR    209
C                                                                       USBRKR    210
            IF (CTIMER .GT. 0.0 .AND. TIME .GE. CTIMER) THEN            USBRKR    211
               UDOU2(JBLK) = 'CLOSED'                                   USBRKR    212
               CTIMER = 0.0                                             USBRKR    213
            END IF                                                      USBRKR    214
            UDVAL(JBLK) = 0.0                                           USBRKR    215
C                                                                       USBRKR    216
         ELSE IF (UDOU2(JBLK) .EQ. 'OPENING') THEN                      USBRKR    217
C                                                                       USBRKR    218
C                                                                       USBRKR    219
C           When the breaker current reaches 0 (within given            USBRKR    220
C           tolerance) the status becomes OPEN.                         USBRKR    221
C                                                                       USBRKR    222
            IF (ABS(UBCURR(IBRKPT)*1000.) .LE. ABS(CUROPN) .OR.         USBRKR    223
     1          UBCURR(IBRKPT) * OLDRAT .LT. 0.0) THEN                  USBRKR    224
               UDOU2(JBLK) = 'OPENED'                                   USBRKR    225
               UDVAL(JBLK) = 0.0                                        USBRKR    226
            ELSE                                                        USBRKR    227
               IF (OLDRAT .EQ. 0) THEN                                  USBRKR    228
C                                                                       USBRKR    229
C                 Initialize the integrator.                            USBRKR    230
C                                                                       USBRKR    231
                  IF (UBCURR(IBRKPT) .GE. 0.0) THEN                     USBRKR    232
                     RATE = ABS(VOLMAX) / VOLRIS                        USBRKR    233
                  ELSE                                                  USBRKR    234
                     RATE = - ABS(VOLMAX) / VOLRIS                      USBRKR    235
                  END IF                                                USBRKR    236
               ELSE                                                     USBRKR    237
                  RATE = OLDRAT                                         USBRKR    238
               END IF                                                   USBRKR    239
C                                                                       USBRKR    240
               OLDVOL = UDVAL(JBLK)                                     USBRKR    241
C                                                                       USBRKR    242
               UDVAL(JBLK) = OLDVOL + (CTIME/2.0)*((1. + ALPHAT)*RATE + USBRKR    243
     1                                            (1. - ALPHAT)*OLDRAT) USBRKR    244
               IF (ABS(UDVAL(JBLK)) .GE. ABS(VOLMAX)) THEN              USBRKR    245
                  IF (UDVAL(JBLK) .LT. 0) THEN                          USBRKR    246
                     UDVAL(JBLK) = - (ABS(VOLMAX))                      USBRKR    247
                  ELSE                                                  USBRKR    248
                     UDVAL(JBLK) = ABS(VOLMAX)                          USBRKR    249
                  END IF                                                USBRKR    250
                  RATE = 0.0                                            USBRKR    251
               END IF                                                   USBRKR    252
            END IF                                                      USBRKR    253
         END IF                                                         USBRKR    254
C                                                                       USBRKR    255
C        Save the timer and rate variables into storage for this block. USBRKR    256
C                                                                       USBRKR    257
         NEXTS = IUDSPT(JBLK)                                           USBRKR    258
         IF (NEXTS .NE. 0) THEN                                         USBRKR    259
            UDOLD(NEXTS) = OTIMER                                       USBRKR    260
            NEXTS = IUDSNX(NEXTS)                                       USBRKR    261
         END IF                                                         USBRKR    262
         IF (NEXTS .NE. 0) THEN                                         USBRKR    263
            UDOLD(NEXTS) = CTIMER                                       USBRKR    264
            NEXTS = IUDSNX(NEXTS)                                       USBRKR    265
         END IF                                                         USBRKR    266
         IF (NEXTS .NE. 0) THEN                                         USBRKR    267
            UDOLD(NEXTS) = RATE                                         USBRKR    268
         END IF                                                         USBRKR    269
C                                                                       USBRKR    270
C                                                                       USBRKR    271
C                                                                       USBRKR    272
      ELSE IF (IUDSUB(JBLK) .EQ. JDISCO) THEN                           USBRKR    273
C                                                                       USBRKR    274
C        If an open or close request has occurred - process it.         USBRKR    275
C                                                                       USBRKR    276
         IF (OREQST .NE. 0.0) THEN                                      USBRKR    277
            IF (ABS(UBCURR(IBRKPT)) .LE. CURMAX) THEN                   USBRKR    278
               UDOU2(JBLK) = 'OPENED'                                   USBRKR    279
            END IF                                                      USBRKR    280
         ELSE IF (CREQST .NE. 0.0) THEN                                 USBRKR    281
            UDOU2(JBLK) = 'CLOSED'                                      USBRKR    282
         END IF                                                         USBRKR    283
C                                                                       USBRKR    284
      END IF                                                            USBRKR    285
C                                                                       USBRKR    286
      RETURN                                                            USBRKR    287
C                                                                       USBRKR    288
9000  FORMAT(' *** ERROR', 5X, A)                                       USBRKR    289
9001  FORMAT(11X,'DURING THE SOLUTION OF UDC "',A,'" BLOCKS, BLOCK')    USBRKR    290
9002  FORMAT(11X,'"', A, '" DOES NOT HAVE THE SAVED INITIALIZATION')    USBRKR    291
9003  FORMAT(11X,'VALUES. THIS IS AN ERROR IN THE CODE.')               USBRKR    292
C                                                                       USBRKR    293
C---------------------------------------------------------------------  USBRKR    294
C                                                                       USBRKR    295
      ENTRY USINTF (JBLK)                                               USBRKR    296
CD -------------------------------------------------------------------  USBRKR    297
CD                                                                      USBRKR    298
CD              *****     USINTF  ROUTINE   *****                       USBRKR    299
CD                                                                      USBRKR    300
CD -------------------------------------------------------------------  USBRKR    301
CD                                                                      USBRKR    302
CD       PURPOSE:  Performs the solution of the udc type INTERFACE.     USBRKR    303
CD                                                                      USBRKR    304
CD -------------------------------------------------------------------  USBRKR    305
C                                                                       USBRKR    306
      NEXTR = IUDRPT(JBLK)                                              USBRKR    307
      NEXTI = IUNIPT(JBLK)                                              USBRKR    308
      NUM = IUDINT(NEXTI)                                               USBRKR    309
      NEXTI = IUDINX(NEXTI)                                             USBRKR    310
      NEXTP = IUDPPT(JBLK)                                              USBRKR    311
      DONE = .FALSE.                                                    USBRKR    312
      DONE1 = .FALSE.                                                   USBRKR    313
      IDONE = 0                                                         USBRKR    314
120   IF(NEXTR.EQ.0 .OR. DONE) GOTO 140                                 USBRKR    315
         IF(UIDENT(NEXTI).EQ.' ')THEN                                   USBRKR    316
            VALUE = UDPARM(NEXTP)                                       USBRKR    317
         ELSE                                                           USBRKR    318
            N = IUDINT(NEXTI)                                           USBRKR    319
            VALUE = UDVAL(N)                                            USBRKR    320
         END IF                                                         USBRKR    321
C                                                                       USBRKR    322
         IF(UDRKW(NEXTR).EQ.'ALPHA' .OR.                                USBRKR    323
     1       UDRKW(NEXTR).EQ.'GAMMA' .OR.                               USBRKR    324
     2       UDRKW(NEXTR).EQ.'VOLTAGE' .OR.                             USBRKR    325
     3       UDRKW(NEXTR).EQ.'CURRENT' .OR.                             USBRKR    326
     4       UDRKW(NEXTR).EQ.'BLOCK' .OR.                               USBRKR    327
     5       UDRKW(NEXTR).EQ.'BYPASS' .OR.                              USBRKR    328
     6       UDRKW(NEXTR).EQ.'COMFAIL')THEN                             USBRKR    329
C                                                                       USBRKR    330
            IF(IUDBNM(NEXTR) .LE. 0)THEN                                USBRKR    331
               VALUE1 = UDPRM1(NEXTR)                                   USBRKR    332
            ELSE                                                        USBRKR    333
               JBLOCK = IUDBNM(NEXTR)                                   USBRKR    334
               VALUE1 = UDVAL(JBLOCK)                                   USBRKR    335
            END IF                                                      USBRKR    336
            OPER = UDRELA(NEXTR)                                        USBRKR    337
            IF(JUDBNM(NEXTR) .LE. 0)THEN                                USBRKR    338
               VALUE2 = UDPRM2(NEXTR)                                   USBRKR    339
            ELSE                                                        USBRKR    340
               JBLOCK = JUDBNM(NEXTR)                                   USBRKR    341
               VALUE2 = UDVAL(JBLOCK)                                   USBRKR    342
            END IF                                                      USBRKR    343
C                                                                       USBRKR    344
            IF(.NOT.DONE1.OR.IDONE.GT.0) THEN                           USBRKR    345
               IF(OPER.EQ.'EQ')THEN                                     USBRKR    346
                  IF(VALUE1.EQ.VALUE2) DONE = .TRUE.                    USBRKR    347
               ELSEIF(OPER.EQ.'NE')THEN                                 USBRKR    348
                  IF(VALUE1 .NE. VALUE2) DONE = .TRUE.                  USBRKR    349
               ELSEIF(OPER.EQ.'LE')THEN                                 USBRKR    350
                  IF(VALUE1 .LE. VALUE2) DONE = .TRUE.                  USBRKR    351
               ELSEIF(OPER.EQ.'LT')THEN                                 USBRKR    352
                  IF(VALUE1 .LT. VALUE2) DONE = .TRUE.                  USBRKR    353
               ELSEIF(OPER.EQ.'GE')THEN                                 USBRKR    354
                  IF(VALUE1 .GE. VALUE2) DONE = .TRUE.                  USBRKR    355
               ELSEIF(OPER.EQ.'GT')THEN                                 USBRKR    356
                  IF(VALUE1 .GT. VALUE2) DONE = .TRUE.                  USBRKR    357
               ELSE                                                     USBRKR    358
                  DONE = .TRUE.                                         USBRKR    359
               END IF                                                   USBRKR    360
            END IF                                                      USBRKR    361
            IF(IABS(ICTYPE(NUM)) .EQ. 1) THEN                           USBRKR    362
               IF(DONE) THEN                                            USBRKR    363
                  IDONE = 1                                             USBRKR    364
                  DONE1 = .TRUE.                                        USBRKR    365
                  NEXTR1 = NEXTR                                        USBRKR    366
                  VALU1 = VALUE                                         USBRKR    367
               ENDIF                                                    USBRKR    368
            ELSE                                                        USBRKR    369
               IF(DONE) THEN                                            USBRKR    370
                  IF(IDONE.EQ.0) THEN                                   USBRKR    371
                     DONE1 = .TRUE.                                     USBRKR    372
                     DONE = .FALSE.                                     USBRKR    373
                     NEXTR1 = NEXTR                                     USBRKR    374
                     VALU1 = VALUE                                      USBRKR    375
                  ELSE                                                  USBRKR    376
                     IDONE = 2                                          USBRKR    377
                  ENDIF                                                 USBRKR    378
               ENDIF                                                    USBRKR    379
            ENDIF                                                       USBRKR    380
         ELSEIF(UDRKW(NEXTR).EQ.'INITIAL') THEN                         USBRKR    381
            IDONE = IDONE + 1                                           USBRKR    382
         END IF                                                         USBRKR    383
C                                                                       USBRKR    384
         IF(.NOT. DONE)THEN                                             USBRKR    385
            NEXTR = IUDRNX(NEXTR)                                       USBRKR    386
            NEXTI = IUDINX(NEXTI)                                       USBRKR    387
            NEXTP = IUDPNX(NEXTP)                                       USBRKR    388
         END IF                                                         USBRKR    389
         GOTO 120                                                       USBRKR    390
140   CONTINUE                                                          USBRKR    391
C                                                                       USBRKR    392
      IF(IDONE.EQ.1)THEN                                                USBRKR    393
         IF(DONE1) THEN                                                 USBRKR    394
            UDVAL(JBLK) = VALU1                                         USBRKR    395
            UDOU2(JBLK) = UDRKW(NEXTR1)                                 USBRKR    396
         ENDIF                                                          USBRKR    397
      ELSEIF(IDONE.EQ.2) THEN                                           USBRKR    398
         IF(DONE1) THEN                                                 USBRKR    399
            UDVAL(JBLK) = VALU1                                         USBRKR    400
            UDOU2(JBLK) = UDRKW(NEXTR1)                                 USBRKR    401
         ENDIF                                                          USBRKR    402
         IF(DONE) THEN                                                  USBRKR    403
            UDVA3(JBLK) = VALUE                                         USBRKR    404
            UDOU4(JBLK) = UDRKW(NEXTR)                                  USBRKR    405
         ENDIF                                                          USBRKR    406
      END IF                                                            USBRKR    407
C                                                                       USBRKR    408
      RETURN                                                            USBRKR    409
C                                                                       USBRKR    410
C---------------------------------------------------------------------  USBRKR    411
C                                                                       USBRKR    412
      ENTRY USLIMT (JBLK)                                               USBRKR    413
CD -------------------------------------------------------------------  USBRKR    414
CD                                                                      USBRKR    415
CD              *****     USLIMT  ROUTINE   *****                       USBRKR    416
CD                                                                      USBRKR    417
CD -------------------------------------------------------------------  USBRKR    418
CD                                                                      USBRKR    419
CD       PURPOSE:  Performs the solution of the udc type LIMIT.         USBRKR    420
CD                                                                      USBRKR    421
CD -------------------------------------------------------------------  USBRKR    422
C                                                                       USBRKR    423
      IF(SDBG)THEN                                                      USBRKR    424
         SUBNAM = 'USLIMT ROUTINE.'                                     USBRKR    425
      ELSE                                                              USBRKR    426
         SUBNAM = ' '                                                   USBRKR    427
      END IF                                                            USBRKR    428
      TNAME = TPNAME(LIMITR)                                            USBRKR    429
      BNAME = UDNAME(JBLK)                                              USBRKR    430
      LEN = IUDLEN(JBLK)                                                USBRKR    431
C                                                                       USBRKR    432
C     Determine what variables and how many are required for the        USBRKR    433
C     specified type.                                                   USBRKR    434
C                                                                       USBRKR    435
C                                                                       USBRKR    436
      NEXTI = IUNIPT(JBLK)                                              USBRKR    437
      NEXTP = IUDPPT(JBLK)                                              USBRKR    438
      NEXTR = IUDRPT(JBLK)                                              USBRKR    439
      NEXTS = IUDSPT(JBLK)                                              USBRKR    440
C                                                                       USBRKR    441
      LBLOCK = IUDINT(NEXTI)                                            USBRKR    442
      VALUE = UDVAL(LBLOCK)                                             USBRKR    443
      NEXTI = IUDINX(NEXTI)                                             USBRKR    444
C                                                                       USBRKR    445
C     Static limit.                                                     USBRKR    446
C                                                                       USBRKR    447
      IF(IUDSUB(JBLK).EQ.ISTATC)THEN                                    USBRKR    448
C                                                                       USBRKR    449
C     Gain value.                                                       USBRKR    450
C                                                                       USBRKR    451
         GAIN = UDPARM(NEXTP)                                           USBRKR    452
         NEXTP = IUDPNX(NEXTP)                                          USBRKR    453
C                                                                       USBRKR    454
C     Dynamic limit.                                                    USBRKR    455
C                                                                       USBRKR    456
      ELSEIF(IUDSUB(JBLK).EQ.IDYNMC)THEN                                USBRKR    457
C                                                                       USBRKR    458
C        A value                                                        USBRKR    459
C                                                                       USBRKR    460
         DO 220 I = 1, 4                                                USBRKR    461
            PARM(I) = UDPARM(NEXTP)                                     USBRKR    462
            NEXTP = IUDPNX(NEXTP)                                       USBRKR    463
220      CONTINUE                                                       USBRKR    464
C                                                                       USBRKR    465
C     Variable rate limit.                                              USBRKR    466
C                                                                       USBRKR    467
      ELSEIF(IUDSUB(JBLK).EQ.IVRATE)THEN                                USBRKR    468
C                                                                       USBRKR    469
C        T value.                                                       USBRKR    470
C                                                                       USBRKR    471
         IF(UIDENT(NEXTI).NE.' ')THEN                                   USBRKR    472
            LBLOCK= IUDINT(NEXTI)                                       USBRKR    473
            T = UDVAL(LBLOCK)                                           USBRKR    474
         ELSE                                                           USBRKR    475
            T = UDPARM(NEXTP)                                           USBRKR    476
         END IF                                                         USBRKR    477
         IF(T.LT.3.0*CTIME)THEN                                         USBRKR    478
            WRITE(MSG(1),9102) SUBNAM                                   USBRKR    479
            WRITE(MSG(2),9103) TNAME                                    USBRKR    480
            WRITE(MSG(3),9104) BNAME(1:LEN), T                          USBRKR    481
            WRITE(MSG(4),9105) 3.0*CTIME                                USBRKR    482
            CALL PRTMSG(4)                                              USBRKR    483
            IERCNT = IERCNT + 1                                         USBRKR    484
         ENDIF                                                          USBRKR    485
         NEXTI = IUDINX(NEXTI)                                          USBRKR    486
         NEXTP = IUDPNX(NEXTP)                                          USBRKR    487
C                                                                       USBRKR    488
      END IF                                                            USBRKR    489
C                                                                       USBRKR    490
C     RATE and VRATE blocks now have common data.                       USBRKR    491
C                                                                       USBRKR    492
      IF(IUDSUB(JBLK).EQ.IVRATE.OR.IUDSUB(JBLK).EQ.IRATES)THEN          USBRKR    493
C                                                                       USBRKR    494
C        Down rate value.                                               USBRKR    495
C                                                                       USBRKR    496
         IF(UIDENT(NEXTI).NE.' ')THEN                                   USBRKR    497
            LBLOCK= IUDINT(NEXTI)                                       USBRKR    498
            DNRATE= UDVAL(LBLOCK)                                       USBRKR    499
         ELSE                                                           USBRKR    500
            DNRATE= UDPARM(NEXTP)                                       USBRKR    501
         END IF                                                         USBRKR    502
         NEXTI = IUDINX(NEXTI)                                          USBRKR    503
         NEXTP = IUDPNX(NEXTP)                                          USBRKR    504
C                                                                       USBRKR    505
C        Up rate value.                                                 USBRKR    506
C                                                                       USBRKR    507
         IF(UIDENT(NEXTI).NE.' ')THEN                                   USBRKR    508
            LBLOCK= IUDINT(NEXTI)                                       USBRKR    509
            UPRATE= UDVAL(LBLOCK)                                       USBRKR    510
         ELSE                                                           USBRKR    511
            UPRATE= UDPARM(NEXTP)                                       USBRKR    512
         END IF                                                         USBRKR    513
         NEXTI = IUDINX(NEXTI)                                          USBRKR    514
         NEXTP = IUDPNX(NEXTP)                                          USBRKR    515
      ENDIF                                                             USBRKR    516
C                                                                       USBRKR    517
C                                                                       USBRKR    518
C     Low limit.                                                        USBRKR    519
C                                                                       USBRKR    520
      IF(UIDENT(NEXTI) .NE. ' ')THEN                                    USBRKR    521
         LBLOCK = IUDINT(NEXTI)                                         USBRKR    522
         XLOW = UDVAL(LBLOCK)                                           USBRKR    523
      ELSE                                                              USBRKR    524
         XLOW = UDPARM(NEXTP)                                           USBRKR    525
      END IF                                                            USBRKR    526
      NEXTI = IUDINX(NEXTI)                                             USBRKR    527
      NEXTP = IUDPNX(NEXTP)                                             USBRKR    528
C                                                                       USBRKR    529
C     High limit.                                                       USBRKR    530
C                                                                       USBRKR    531
      IF(UIDENT(NEXTI) .NE. ' ')THEN                                    USBRKR    532
         LBLOCK = IUDINT(NEXTI)                                         USBRKR    533
         HIGH = UDVAL(LBLOCK)                                           USBRKR    534
      ELSE                                                              USBRKR    535
         HIGH = UDPARM(NEXTP)                                           USBRKR    536
      END IF                                                            USBRKR    537
      NEXTI = IUDINX(NEXTI)                                             USBRKR    538
      NEXTP = IUDPNX(NEXTP)                                             USBRKR    539
C                                                                       USBRKR    540
C     Static limit.                                                     USBRKR    541
C                                                                       USBRKR    542
      IF(IUDSUB(JBLK).EQ.ISTATC)THEN                                    USBRKR    543
C                                                                       USBRKR    544
         UDVAL(JBLK) = MAX(GAIN * VALUE, XLOW)                          USBRKR    545
         UDVAL(JBLK) = MIN(UDVAL(JBLK), HIGH)                           USBRKR    546
C                                                                       USBRKR    547
C                                                                       USBRKR    548
C     Dynamic limit.                                                    USBRKR    549
C                                                                       USBRKR    550
      ELSEIF(IUDSUB(JBLK).EQ.IDYNMC)THEN                                USBRKR    551
C                                                                       USBRKR    552
         A1 = PARM(1)                                                   USBRKR    553
         A0 = PARM(2)                                                   USBRKR    554
         C1 = PARM(3)                                                   USBRKR    555
         C0 = PARM(4)                                                   USBRKR    556
C                                                                       USBRKR    557
         A = - C0 / C1                                                  USBRKR    558
         B = 1.0                                                        USBRKR    559
         C = 1.0 / C1 * (A0 - A1 * C0 / C1)                             USBRKR    560
         D = A1 / C1                                                    USBRKR    561
C                                                                       USBRKR    562
         OLDX = UDOLD(NEXTS)                                            USBRKR    563
         NEXTS = IUDSNX(NEXTS)                                          USBRKR    564
C                                                                       USBRKR    565
         OLDV = UDOLD(NEXTS)                                            USBRKR    566
         NEXTS = IUDSNX(NEXTS)                                          USBRKR    567
C                                                                       USBRKR    568
         H = (CTIME / 2.0) * ((1. + ALPHAT) * B * VALUE + (1. - ALPHAT) USBRKR    569
     1       * B * OLDV)                                                USBRKR    570
C                                                                       USBRKR    571
         X = OLDX + ((CTIME / 2.0) * (1. - ALPHAT) * A * OLDX) + H      USBRKR    572
C                                                                       USBRKR    573
         X = X / (1.0 - ((CTIME / 2.0) * (1. + ALPHAT) * A))            USBRKR    574
C                                                                       USBRKR    575
C                                                                       USBRKR    576
C        Apply limits to X.                                             USBRKR    577
C                                                                       USBRKR    578
         Y = C * X + D * VALUE                                          USBRKR    579
C                                                                       USBRKR    580
C        If limits are exceeded calculate new X using the limit which   USBRKR    581
C        was exceeded.                                                  USBRKR    582
C                                                                       USBRKR    583
         IF(Y .LT. XLOW)THEN                                            USBRKR    584
            Y = XLOW                                                    USBRKR    585
            X = (Y - (A1 * VALUE / C1))  /  ((A0 / C1) - (A1 * C0 /     USBRKR    586
     1          C1**2))                                                 USBRKR    587
         ELSEIF(Y .GT. HIGH)THEN                                        USBRKR    588
            Y = HIGH                                                    USBRKR    589
            X = (Y - (A1 * VALUE / C1))  /  ((A0 / C1) - (A1 * C0 /     USBRKR    590
     1          C1**2))                                                 USBRKR    591
         END IF                                                         USBRKR    592
C                                                                       USBRKR    593
C        Store current x and value.                                     USBRKR    594
C                                                                       USBRKR    595
         NEXTS = IUDSPT(JBLK)                                           USBRKR    596
         UDOLD(NEXTS) = X                                               USBRKR    597
         NEXTS = IUDSNX(NEXTS)                                          USBRKR    598
C                                                                       USBRKR    599
         UDOLD(NEXTS) = VALUE                                           USBRKR    600
         NEXTS = IUDSNX(NEXTS)                                          USBRKR    601
C                                                                       USBRKR    602
         UDVAL(JBLK) = C * X + D * VALUE                                USBRKR    603
C                                                                       USBRKR    604
C     Rate limit                                                        USBRKR    605
C                                                                       USBRKR    606
      ELSEIF(IUDSUB(JBLK).EQ.IRATES)THEN                                USBRKR    607
         ERROR = VALUE - UDVAL(JBLK)                                    USBRKR    608
         UPERR = UPRATE * CTIME                                         USBRKR    609
         DNERR = DNRATE * CTIME                                         USBRKR    610
         IF(ERROR.GT.UPERR)THEN                                         USBRKR    611
            ERROR = UPERR                                               USBRKR    612
         END IF                                                         USBRKR    613
         IF(ERROR.LT.DNERR)THEN                                         USBRKR    614
            ERROR = DNERR                                               USBRKR    615
         END IF                                                         USBRKR    616
         UDVAL(JBLK) = UDVAL(JBLK) + ERROR                              USBRKR    617
C                                                                       USBRKR    618
C     Apply limits.                                                     USBRKR    619
C                                                                       USBRKR    620
         IF(UDVAL(JBLK).LT.XLOW)THEN                                    USBRKR    621
            UDVAL(JBLK) = XLOW                                          USBRKR    622
         ENDIF                                                          USBRKR    623
         IF(UDVAL(JBLK).GT.HIGH)THEN                                    USBRKR    624
            UDVAL(JBLK) = HIGH                                          USBRKR    625
         ENDIF                                                          USBRKR    626
C                                                                       USBRKR    627
C     Variable rate limit.                                              USBRKR    628
C                                                                       USBRKR    629
      ELSEIF(IUDSUB(JBLK).EQ.IVRATE)THEN                                USBRKR    630
         OLDX = UDOLD(NEXTS)                                            USBRKR    631
         NEXTS = IUDSNX(NEXTS)                                          USBRKR    632
C                                                                       USBRKR    633
         OLDV = UDOLD(NEXTS)                                            USBRKR    634
         NEXTS = IUDSNX(NEXTS)                                          USBRKR    635
C                                                                       USBRKR    636
C     Apply limits.                                                     USBRKR    637
C                                                                       USBRKR    638
         VALUE = (VALUE - OLDX) / T                                     USBRKR    639
         VALUE = MAX(VALUE,DNRATE)                                      USBRKR    640
         VALUE = MIN(VALUE,UPRATE)                                      USBRKR    641
C                                                                       USBRKR    642
         H = (CTIME / 2.0)*((1.0+ALPHAT)*VALUE+(1.0-ALPHAT)*OLDV)       USBRKR    643
         X = OLDX + H                                                   USBRKR    644
C                                                                       USBRKR    645
C     Set output value - subject to limits                              USBRKR    646
C                                                                       USBRKR    647
         IF(X.LT.XLOW) THEN                                             USBRKR    648
            X=XLOW                                                      USBRKR    649
         ELSEIF(X.GT.HIGH) THEN                                         USBRKR    650
            X=HIGH                                                      USBRKR    651
         ENDIF                                                          USBRKR    652
         UDVAL(JBLK) = X                                                USBRKR    653
C                                                                       USBRKR    654
C     Store current X and value.                                        USBRKR    655
C                                                                       USBRKR    656
         NEXTS = IUDSPT(JBLK)                                           USBRKR    657
         UDOLD(NEXTS) = X                                               USBRKR    658
         NEXTS = IUDSNX(NEXTS)                                          USBRKR    659
C                                                                       USBRKR    660
         UDOLD(NEXTS) = VALUE                                           USBRKR    661
         NEXTS = IUDSNX(NEXTS)                                          USBRKR    662
      END IF                                                            USBRKR    663
C                                                                       USBRKR    664
      RETURN                                                            USBRKR    665
C                                                                       USBRKR    666
9102  FORMAT(' *** WARNING', 5X, A)                                     USBRKR    667
9103  FORMAT(14X,'DURING THE SOLUTION OF UDC "', A, '" BLOCKS, THE ',   USBRKR    668
     2        'BLOCK')                                                  USBRKR    669
9104  FORMAT(14X,'"', A, '" HAS AN INVALID VALUE FOR ',                 USBRKR    670
     3        '"T" OF "', F7.4, '". THE VALUE')                         USBRKR    671
9105  FORMAT(14X,'OF "T" WILL BE SET TO "', F7.4, '".')                 USBRKR    672
C                                                                       USBRKR    673
C---------------------------------------------------------------------  USBRKR    674
C                                                                       USBRKR    675
      ENTRY USLOGC (JBLK)                                               USBRKR    676
CD -------------------------------------------------------------------  USBRKR    677
CD                                                                      USBRKR    678
CD              *****     USLOGCD ROUTINE   *****                       USBRKR    679
CD                                                                      USBRKR    680
CD -------------------------------------------------------------------  USBRKR    681
CD                                                                      USBRKR    682
CD       PURPOSE:  Performs the solution of the udc type LOGIC.         USBRKR    683
CD                                                                      USBRKR    684
CD -------------------------------------------------------------------  USBRKR    685
C                                                                       USBRKR    686
      NEXTI = IUNIPT(JBLK)                                              USBRKR    687
      NEXTP = IUDPPT(JBLK)                                              USBRKR    688
      NEXTR = IUDRPT(JBLK)                                              USBRKR    689
C                                                                       USBRKR    690
C     If the subtype has a logical expression, evaluate it.             USBRKR    691
C                                                                       USBRKR    692
      IF(IUDSUB(JBLK).EQ.ISWTCH .OR. IUDSUB(JBLK).EQ.ITIMER .OR.        USBRKR    693
     1    IUDSUB(JBLK).EQ.IEXPRE .OR. IUDSUB(JBLK).EQ.IFFLOP .OR.       USBRKR    694
     2    IUDSUB(JBLK).EQ.ICOUNT)THEN                                   USBRKR    695
C                                                                       USBRKR    696
         LOGEXP(1) = .FALSE.                                            USBRKR    697
         LOGEXP(2) = .FALSE.                                            USBRKR    698
         J = 0                                                          USBRKR    699
C                                                                       USBRKR    700
320      IF(NEXTR.EQ.0 .OR. J .GE. 2) GOTO 340                          USBRKR    701
C                                                                       USBRKR    702
C           Retrieve the logical expression.                            USBRKR    703
C                                                                       USBRKR    704
            J = J + 1                                                   USBRKR    705
            IF(IUDBNM(NEXTR) .LE. 0)THEN                                USBRKR    706
               VALUE1 = UDPRM1(NEXTR)                                   USBRKR    707
            ELSE                                                        USBRKR    708
               JBLOCK = IUDBNM(NEXTR)                                   USBRKR    709
               VALUE1 = UDVAL(JBLOCK)                                   USBRKR    710
            END IF                                                      USBRKR    711
            OPER = UDRELA(NEXTR)                                        USBRKR    712
            IF(JUDBNM(NEXTR) .LE. 0)THEN                                USBRKR    713
               VALUE2 = UDPRM2(NEXTR)                                   USBRKR    714
            ELSE                                                        USBRKR    715
               JBLOCK = JUDBNM(NEXTR)                                   USBRKR    716
               VALUE2 = UDVAL(JBLOCK)                                   USBRKR    717
            END IF                                                      USBRKR    718
C                                                                       USBRKR    719
C           Evaluate the logical expression.                            USBRKR    720
C                                                                       USBRKR    721
            LOGEXP(J) = .FALSE.                                         USBRKR    722
            IF(OPER.EQ.'EQ')THEN                                        USBRKR    723
               IF(VALUE1.EQ.VALUE2) LOGEXP(J) = .TRUE.                  USBRKR    724
            ELSEIF(OPER.EQ.'NE')THEN                                    USBRKR    725
               IF(VALUE1 .NE. VALUE2) LOGEXP(J) = .TRUE.                USBRKR    726
            ELSEIF(OPER.EQ.'LT')THEN                                    USBRKR    727
               IF(VALUE1 .LT. VALUE2) LOGEXP(J) = .TRUE.                USBRKR    728
            ELSEIF(OPER.EQ.'LE')THEN                                    USBRKR    729
               IF(VALUE1 .LE. VALUE2) LOGEXP(J) = .TRUE.                USBRKR    730
            ELSEIF(OPER.EQ.'GT')THEN                                    USBRKR    731
               IF(VALUE1 .GT. VALUE2) LOGEXP(J) = .TRUE.                USBRKR    732
            ELSEIF(OPER.EQ.'GE')THEN                                    USBRKR    733
               IF(VALUE1 .GE. VALUE2) LOGEXP(J) = .TRUE.                USBRKR    734
            END IF                                                      USBRKR    735
C                                                                       USBRKR    736
            LASTR = NEXTR                                               USBRKR    737
            NEXTR = IUDRNX(NEXTR)                                       USBRKR    738
C                                                                       USBRKR    739
            GOTO 320                                                    USBRKR    740
340      CONTINUE                                                       USBRKR    741
      END IF                                                            USBRKR    742
C                                                                       USBRKR    743
C                                                                       USBRKR    744
C---------------------------------------------------------------------  USBRKR    745
C                                                                       USBRKR    746
C                                                                       USBRKR    747
C     Logical expression.                                               USBRKR    748
C                                                                       USBRKR    749
      IF(IUDSUB(JBLK).EQ.IEXPRE)THEN                                    USBRKR    750
C                                                                       USBRKR    751
         IF(LOGEXP(1))THEN                                              USBRKR    752
            UDVAL(JBLK) = 1.0                                           USBRKR    753
         ELSE                                                           USBRKR    754
            UDVAL(JBLK) = 0.0                                           USBRKR    755
         END IF                                                         USBRKR    756
C                                                                       USBRKR    757
C                                                                       USBRKR    758
C                                                                       USBRKR    759
C     Boolean AND function.                                             USBRKR    760
C                                                                       USBRKR    761
      ELSEIF(IUDSUB(JBLK).EQ.IANDS)THEN                                 USBRKR    762
C                                                                       USBRKR    763
C        AND function is true if all of its inputs are non-zero.        USBRKR    764
C                                                                       USBRKR    765
         AND = .TRUE.                                                   USBRKR    766
360      IF(NEXTI.EQ.0 .OR. NEXTP.EQ.0) GOTO 380                        USBRKR    767
            IF(UIDENT(NEXTI).EQ.' ')THEN                                USBRKR    768
               VALUE1 = UDPARM(NEXTP)                                   USBRKR    769
            ELSE                                                        USBRKR    770
               VALUE1 = UDVAL(IUDINT(NEXTI))                            USBRKR    771
            END IF                                                      USBRKR    772
            IF(VALUE1.EQ.0.0)THEN                                       USBRKR    773
               AND = .FALSE.                                            USBRKR    774
               NEXTI = 0                                                USBRKR    775
               NEXTP = 0                                                USBRKR    776
            ELSE                                                        USBRKR    777
               NEXTI = IUDINX(NEXTI)                                    USBRKR    778
               NEXTP = IUDPNX(NEXTP)                                    USBRKR    779
            END IF                                                      USBRKR    780
            GOTO 360                                                    USBRKR    781
380      CONTINUE                                                       USBRKR    782
C                                                                       USBRKR    783
         IF(AND)THEN                                                    USBRKR    784
            UDVAL(JBLK) = 1.0                                           USBRKR    785
         ELSE                                                           USBRKR    786
            UDVAL(JBLK) = 0.0                                           USBRKR    787
         END IF                                                         USBRKR    788
C                                                                       USBRKR    789
C                                                                       USBRKR    790
C                                                                       USBRKR    791
C     Boolean OR function.                                              USBRKR    792
C                                                                       USBRKR    793
      ELSEIF(IUDSUB(JBLK).EQ.IORS)THEN                                  USBRKR    794
C                                                                       USBRKR    795
C        OR function is true if any of its inputs are non-zero.         USBRKR    796
C                                                                       USBRKR    797
         OR = .FALSE.                                                   USBRKR    798
400      IF(NEXTI.EQ.0 .OR. NEXTP.EQ.0) GOTO 420                        USBRKR    799
            IF(UIDENT(NEXTI).EQ.' ')THEN                                USBRKR    800
               VALUE1 = UDPARM(NEXTP)                                   USBRKR    801
            ELSE                                                        USBRKR    802
               VALUE1 = UDVAL(IUDINT(NEXTI))                            USBRKR    803
            END IF                                                      USBRKR    804
            IF(VALUE1 .NE. 0.0)THEN                                     USBRKR    805
               OR = .TRUE.                                              USBRKR    806
               NEXTI = 0                                                USBRKR    807
               NEXTP = 0                                                USBRKR    808
            ELSE                                                        USBRKR    809
               NEXTI = IUDINX(NEXTI)                                    USBRKR    810
               NEXTP = IUDPNX(NEXTP)                                    USBRKR    811
            END IF                                                      USBRKR    812
            GOTO 400                                                    USBRKR    813
420      CONTINUE                                                       USBRKR    814
C                                                                       USBRKR    815
         IF(OR)THEN                                                     USBRKR    816
            UDVAL(JBLK) = 1.0                                           USBRKR    817
         ELSE                                                           USBRKR    818
            UDVAL(JBLK) = 0.0                                           USBRKR    819
         END IF                                                         USBRKR    820
C                                                                       USBRKR    821
C                                                                       USBRKR    822
C                                                                       USBRKR    823
C     Flipflop switch.                                                  USBRKR    824
C                                                                       USBRKR    825
      ELSEIF(IUDSUB(JBLK).EQ.IFFLOP)THEN                                USBRKR    826
C                                                                       USBRKR    827
         SET = LOGEXP(1)                                                USBRKR    828
         RESET = LOGEXP(2)                                              USBRKR    829
C                                                                       USBRKR    830
         IF(SET.AND.RESET)THEN                                          USBRKR    831
            SET = .FALSE.                                               USBRKR    832
            RESET = .TRUE.                                              USBRKR    833
         END IF                                                         USBRKR    834
C                                                                       USBRKR    835
         IF(.NOT. (SET .OR. RESET))THEN                                 USBRKR    836
C                                                                       USBRKR    837
C           Neither set nor reset were specified, use previous values.  USBRKR    838
C                                                                       USBRKR    839
            IF(UDPARM(NEXTP).EQ.1.0)THEN                                USBRKR    840
               SET = .TRUE.                                             USBRKR    841
               RESET = .FALSE.                                          USBRKR    842
            ELSE                                                        USBRKR    843
               SET = .FALSE.                                            USBRKR    844
               RESET = .TRUE.                                           USBRKR    845
            END IF                                                      USBRKR    846
         ELSE                                                           USBRKR    847
C                                                                       USBRKR    848
C           Store current set and reset values.                         USBRKR    849
C                                                                       USBRKR    850
            IF(SET)THEN                                                 USBRKR    851
               UDPARM(NEXTP) = 1.0                                      USBRKR    852
            ELSE                                                        USBRKR    853
               UDPARM(NEXTP) = 0.0                                      USBRKR    854
            END IF                                                      USBRKR    855
            NEXTP = IUDPNX(NEXTP)                                       USBRKR    856
         END IF                                                         USBRKR    857
C                                                                       USBRKR    858
C        Calculate UDVAL based on set and reset.                        USBRKR    859
C                                                                       USBRKR    860
         IF(SET)THEN                                                    USBRKR    861
            UDVAL(JBLK) = 1.0                                           USBRKR    862
         END IF                                                         USBRKR    863
C                                                                       USBRKR    864
         IF(RESET)THEN                                                  USBRKR    865
            UDVAL(JBLK) = 0.0                                           USBRKR    866
         END IF                                                         USBRKR    867
C                                                                       USBRKR    868
C                                                                       USBRKR    869
C                                                                       USBRKR    870
C     Boolean NOT function.                                             USBRKR    871
C                                                                       USBRKR    872
      ELSEIF(IUDSUB(JBLK).EQ.NOTS)THEN                                  USBRKR    873
C                                                                       USBRKR    874
         IF(UIDENT(NEXTI).EQ.' ')THEN                                   USBRKR    875
            VALUE1 = UDPARM(NEXTP)                                      USBRKR    876
         ELSE                                                           USBRKR    877
            VALUE1 = UDVAL(IUDINT(NEXTI))                               USBRKR    878
         END IF                                                         USBRKR    879
         NEXTI = IUDINX(NEXTI)                                          USBRKR    880
         NEXTP = IUDPNX(NEXTP)                                          USBRKR    881
C                                                                       USBRKR    882
         IF(VALUE1.EQ.0.0)THEN                                          USBRKR    883
            UDVAL(JBLK) = 1.0                                           USBRKR    884
         ELSE                                                           USBRKR    885
            UDVAL(JBLK) = 0.0                                           USBRKR    886
         END IF                                                         USBRKR    887
C                                                                       USBRKR    888
C                                                                       USBRKR    889
C                                                                       USBRKR    890
C     Boolean XOR function.                                             USBRKR    891
C                                                                       USBRKR    892
      ELSEIF(IUDSUB(JBLK).EQ.IXORS)THEN                                 USBRKR    893
C                                                                       USBRKR    894
C        XOR function is true if any of its inputs are non-zero,        USBRKR    895
C        but not all inputs are non-zero.                               USBRKR    896
C                                                                       USBRKR    897
         ZERO = .FALSE.                                                 USBRKR    898
         ONE = .FALSE.                                                  USBRKR    899
440      IF(NEXTI.EQ.0 .OR. NEXTP.EQ.0) GOTO 460                        USBRKR    900
            IF(UIDENT(NEXTI).EQ.' ')THEN                                USBRKR    901
               VALUE1 = UDPARM(NEXTP)                                   USBRKR    902
            ELSE                                                        USBRKR    903
               VALUE1 = UDVAL(IUDINT(NEXTI))                            USBRKR    904
            END IF                                                      USBRKR    905
            IF(VALUE1.EQ.0.0)THEN                                       USBRKR    906
               ZERO = .TRUE.                                            USBRKR    907
            ELSE                                                        USBRKR    908
               ONE = .TRUE.                                             USBRKR    909
            END IF                                                      USBRKR    910
            NEXTI = IUDINX(NEXTI)                                       USBRKR    911
            NEXTP = IUDPNX(NEXTP)                                       USBRKR    912
            GOTO 440                                                    USBRKR    913
460      CONTINUE                                                       USBRKR    914
C                                                                       USBRKR    915
         IF(ZERO.AND.ONE)THEN                                           USBRKR    916
            UDVAL(JBLK) = 1.0                                           USBRKR    917
         ELSE                                                           USBRKR    918
            UDVAL(JBLK) = 0.0                                           USBRKR    919
         END IF                                                         USBRKR    920
C                                                                       USBRKR    921
C                                                                       USBRKR    922
C                                                                       USBRKR    923
C     Logical control switch.                                           USBRKR    924
C                                                                       USBRKR    925
      ELSEIF(IUDSUB(JBLK).EQ.ISWTCH)THEN                                USBRKR    926
C                                                                       USBRKR    927
C        Input 1 value.                                                 USBRKR    928
C                                                                       USBRKR    929
         IF(UIDENT(NEXTI) .NE. ' ')THEN                                 USBRKR    930
            VALUE1 = UDVAL(IUDINT(NEXTI))                               USBRKR    931
         ELSE                                                           USBRKR    932
            VALUE1 = UDPARM(NEXTP)                                      USBRKR    933
         END IF                                                         USBRKR    934
         NEXTI = IUDINX(NEXTI)                                          USBRKR    935
         NEXTP = IUDPNX(NEXTP)                                          USBRKR    936
C                                                                       USBRKR    937
C        Input 2 value.                                                 USBRKR    938
C                                                                       USBRKR    939
         IF(UIDENT(NEXTI) .NE. ' ')THEN                                 USBRKR    940
            VALUE2 = UDVAL(IUDINT(NEXTI))                               USBRKR    941
         ELSE                                                           USBRKR    942
            VALUE2 = UDPARM(NEXTP)                                      USBRKR    943
         END IF                                                         USBRKR    944
         NEXTI = IUDINX(NEXTI)                                          USBRKR    945
         NEXTP = IUDPNX(NEXTP)                                          USBRKR    946
C                                                                       USBRKR    947
         SET = LOGEXP(1)                                                USBRKR    948
         RESET = LOGEXP(2)                                              USBRKR    949
C                                                                       USBRKR    950
         IF(SET.AND.RESET)THEN                                          USBRKR    951
            SET = .TRUE.                                                USBRKR    952
            RESET = .FALSE.                                             USBRKR    953
         END IF                                                         USBRKR    954
C                                                                       USBRKR    955
         IF(.NOT. (SET .OR. RESET))THEN                                 USBRKR    956
C                                                                       USBRKR    957
C           Neither set nor reset were specified, use previous values.  USBRKR    958
C                                                                       USBRKR    959
            IF(UDPARM(NEXTP).EQ.1.0)THEN                                USBRKR    960
               SET = .TRUE.                                             USBRKR    961
               RESET = .FALSE.                                          USBRKR    962
            ELSE                                                        USBRKR    963
               SET = .FALSE.                                            USBRKR    964
               RESET = .TRUE.                                           USBRKR    965
            END IF                                                      USBRKR    966
         ELSE                                                           USBRKR    967
C                                                                       USBRKR    968
C           Store current set and reset values.                         USBRKR    969
C                                                                       USBRKR    970
            IF(SET)THEN                                                 USBRKR    971
               UDPARM(NEXTP) = 1.0                                      USBRKR    972
            ELSE                                                        USBRKR    973
               UDPARM(NEXTP) = 0.0                                      USBRKR    974
            END IF                                                      USBRKR    975
            NEXTP = IUDPNX(NEXTP)                                       USBRKR    976
         END IF                                                         USBRKR    977
C                                                                       USBRKR    978
C        Calculate UDVAL based on set and reset.                        USBRKR    979
C                                                                       USBRKR    980
         IF(SET)THEN                                                    USBRKR    981
            UDVAL(JBLK) =  VALUE1                                       USBRKR    982
         END IF                                                         USBRKR    983
C                                                                       USBRKR    984
         IF(RESET)THEN                                                  USBRKR    985
            UDVAL(JBLK) = VALUE2                                        USBRKR    986
         END IF                                                         USBRKR    987
C                                                                       USBRKR    988
C                                                                       USBRKR    989
C                                                                       USBRKR    990
C     Logical control timer.                                            USBRKR    991
C                                                                       USBRKR    992
      ELSEIF(IUDSUB(JBLK).EQ.ITIMER)THEN                                USBRKR    993
C                                                                       USBRKR    994
         SET = LOGEXP(1)                                                USBRKR    995
         RESET = LOGEXP(2)                                              USBRKR    996
C                                                                       USBRKR    997
         IF(SET.AND.RESET)THEN                                          USBRKR    998
            SET = .FALSE.                                               USBRKR    999
            RESET = .TRUE.                                              USBRKR   1000
         END IF                                                         USBRKR   1001
C                                                                       USBRKR   1002
         IF(.NOT. (SET .OR. RESET))THEN                                 USBRKR   1003
C                                                                       USBRKR   1004
C           Neither set nor reset were specified, use previous values.  USBRKR   1005
C                                                                       USBRKR   1006
            IF(UDPARM(NEXTP).EQ.1.0)THEN                                USBRKR   1007
               SET = .TRUE.                                             USBRKR   1008
               RESET = .FALSE.                                          USBRKR   1009
            ELSE                                                        USBRKR   1010
               SET = .FALSE.                                            USBRKR   1011
               RESET = .TRUE.                                           USBRKR   1012
            END IF                                                      USBRKR   1013
         ELSE                                                           USBRKR   1014
C                                                                       USBRKR   1015
C           Store current set and reset values.                         USBRKR   1016
C                                                                       USBRKR   1017
            IF(SET)THEN                                                 USBRKR   1018
               UDPARM(NEXTP) = 1.0                                      USBRKR   1019
            ELSE                                                        USBRKR   1020
               UDPARM(NEXTP) = 0.0                                      USBRKR   1021
            END IF                                                      USBRKR   1022
            NEXTP = IUDPNX(NEXTP)                                       USBRKR   1023
         END IF                                                         USBRKR   1024
C                                                                       USBRKR   1025
C        Calculate UDVAL based on set and reset.                        USBRKR   1026
C                                                                       USBRKR   1027
         IF(SET)THEN                                                    USBRKR   1028
            UDVAL(JBLK) = UDVAL(JBLK) + CTIME                           USBRKR   1029
         END IF                                                         USBRKR   1030
C                                                                       USBRKR   1031
         IF(RESET)THEN                                                  USBRKR   1032
            UDVAL(JBLK) = 0.0                                           USBRKR   1033
         END IF                                                         USBRKR   1034
C                                                                       USBRKR   1035
C                                                                       USBRKR   1036
C                                                                       USBRKR   1037
C     Logical counter.                                                  USBRKR   1038
C                                                                       USBRKR   1039
      ELSEIF(IUDSUB(JBLK).EQ.ICOUNT)THEN                                USBRKR   1040
         IF(LOGEXP(1).AND.UDRKW(LASTR).EQ.' ')THEN                      USBRKR   1041
            UDVAL(JBLK) = UDVAL(JBLK) + 1.0                             USBRKR   1042
         END IF                                                         USBRKR   1043
         IF(LOGEXP(1))THEN                                              USBRKR   1044
            UDRKW(LASTR) = 'TRUE'                                       USBRKR   1045
         ELSE                                                           USBRKR   1046
            UDRKW(LASTR) = ' '                                          USBRKR   1047
         END IF                                                         USBRKR   1048
C                                                                       USBRKR   1049
C                                                                       USBRKR   1050
C                                                                       USBRKR   1051
C     Zero Order Hold.                                                  USBRKR   1052
C                                                                       USBRKR   1053
      ELSEIF(IUDSUB(JBLK).EQ.IZEROS)THEN                                USBRKR   1054
C                                                                       USBRKR   1055
         JBLOCK = IUDINT(NEXTI)                                         USBRKR   1056
         VALUE = UDVAL(JBLOCK)                                          USBRKR   1057
C                                                                       USBRKR   1058
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1059
         STEP = UDPARM(NEXTP)                                           USBRKR   1060
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1061
         START = UDPARM(NEXTP)                                          USBRKR   1062
C                                                                       USBRKR   1063
         IF(TIME.EQ.0.0)THEN                                            USBRKR   1064
            UDVAL(JBLK) = VALUE                                         USBRKR   1065
         ELSEIF(TIME - START.GE.STEP)THEN                               USBRKR   1066
            UDVAL(JBLK) = VALUE                                         USBRKR   1067
            UDPARM(NEXTP)=UDPARM(NEXTP)+STEP                            USBRKR   1068
         END IF                                                         USBRKR   1069
      END IF                                                            USBRKR   1070
C                                                                       USBRKR   1071
      RETURN                                                            USBRKR   1072
C                                                                       USBRKR   1073
C---------------------------------------------------------------------  USBRKR   1074
C                                                                       USBRKR   1075
      ENTRY USOTHR (JBLK)                                               USBRKR   1076
CD -------------------------------------------------------------------  USBRKR   1077
CD                                                                      USBRKR   1078
CD              *****     USOTHR  ROUTINE   *****                       USBRKR   1079
CD                                                                      USBRKR   1080
CD -------------------------------------------------------------------  USBRKR   1081
CD                                                                      USBRKR   1082
CD       PURPOSE:  Performs the solution of the udc type OTHER.         USBRKR   1083
CD                                                                      USBRKR   1084
CD -------------------------------------------------------------------  USBRKR   1085
C                                                                       USBRKR   1086
      NEXTI = IUNIPT(JBLK)                                              USBRKR   1087
      NEXTP = IUDPPT(JBLK)                                              USBRKR   1088
      NEXTR = IUDRPT(JBLK)                                              USBRKR   1089
C                                                                       USBRKR   1090
      IF(IUDSUB(JBLK).EQ.LEVELS.OR.IUDSUB(JBLK).EQ.IBRDGE               USBRKR   1091
     1   .OR.IUDSUB(JBLK).EQ.IDCLIN.OR.IUDSUB(JBLK).EQ.ISAMPL           USBRKR   1092
     2   .OR.IUDSUB(JBLK).EQ.IRAMPR)THEN                                USBRKR   1093
         LOGEXP(1) = .FALSE.                                            USBRKR   1094
         LOGEXP(2) = .FALSE.                                            USBRKR   1095
         J = 0                                                          USBRKR   1096
520      IF(NEXTR .EQ. 0 .OR. J .GE. 2) GO TO 540                       USBRKR   1097
C                                                                       USBRKR   1098
C           Retrieve the logical expression.                            USBRKR   1099
C                                                                       USBRKR   1100
            J = J + 1                                                   USBRKR   1101
            IF(IUDBNM(NEXTR) .LE. 0)THEN                                USBRKR   1102
               VALUE1 = UDPRM1(NEXTR)                                   USBRKR   1103
            ELSE                                                        USBRKR   1104
               JBLOCK = IUDBNM(NEXTR)                                   USBRKR   1105
               VALUE1 = UDVAL(JBLOCK)                                   USBRKR   1106
            END IF                                                      USBRKR   1107
            OPER = UDRELA(NEXTR)                                        USBRKR   1108
            IF(JUDBNM(NEXTR) .LE. 0)THEN                                USBRKR   1109
               VALUE2 = UDPRM2(NEXTR)                                   USBRKR   1110
            ELSE                                                        USBRKR   1111
               JBLOCK = JUDBNM(NEXTR)                                   USBRKR   1112
               VALUE2 = UDVAL(JBLOCK)                                   USBRKR   1113
            END IF                                                      USBRKR   1114
C                                                                       USBRKR   1115
C           Evaluate the logical expression.                            USBRKR   1116
C                                                                       USBRKR   1117
            LOGEXP(J) = .FALSE.                                         USBRKR   1118
            IF(OPER.EQ.'EQ')THEN                                        USBRKR   1119
               IF(VALUE1 .EQ. VALUE2) LOGEXP(J) = .TRUE.                USBRKR   1120
            ELSEIF(OPER.EQ.'NE')THEN                                    USBRKR   1121
               IF(VALUE1 .NE. VALUE2) LOGEXP(J) = .TRUE.                USBRKR   1122
            ELSEIF(OPER.EQ.'LT')THEN                                    USBRKR   1123
               IF(VALUE1 .LT. VALUE2) LOGEXP(J) = .TRUE.                USBRKR   1124
            ELSEIF(OPER.EQ.'LE')THEN                                    USBRKR   1125
               IF(VALUE1 .LE. VALUE2) LOGEXP(J) = .TRUE.                USBRKR   1126
            ELSEIF(OPER.EQ.'GT')THEN                                    USBRKR   1127
               IF(VALUE1 .GT. VALUE2) LOGEXP(J) = .TRUE.                USBRKR   1128
            ELSEIF(OPER.EQ.'GE')THEN                                    USBRKR   1129
               IF(VALUE1 .GE. VALUE2) LOGEXP(J) = .TRUE.                USBRKR   1130
            END IF                                                      USBRKR   1131
C                                                                       USBRKR   1132
            LASTR = NEXTR                                               USBRKR   1133
            NEXTR = IUDRNX(NEXTR)                                       USBRKR   1134
            GO TO 520                                                   USBRKR   1135
540      CONTINUE                                                       USBRKR   1136
      END IF                                                            USBRKR   1137
C                                                                       USBRKR   1138
C     DIGIT:  Digitizer.                                                USBRKR   1139
C                                                                       USBRKR   1140
      IF(IUDSUB(JBLK).EQ.IDIGIT)THEN                                    USBRKR   1141
C                                                                       USBRKR   1142
         NEXTI = IUNIPT(JBLK)                                           USBRKR   1143
         NEXTP = IUDPPT(JBLK)                                           USBRKR   1144
C                                                                       USBRKR   1145
C        Input value.                                                   USBRKR   1146
C                                                                       USBRKR   1147
         IF(UIDENT(NEXTI) .NE. ' ')THEN                                 USBRKR   1148
            VALUE1 = UDVAL(IUDINT(NEXTI))                               USBRKR   1149
         ELSE                                                           USBRKR   1150
            VALUE1 = UDPARM(NEXTP)                                      USBRKR   1151
         END IF                                                         USBRKR   1152
         NEXTI = IUDINX(NEXTI)                                          USBRKR   1153
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1154
C                                                                       USBRKR   1155
C        Quantum.                                                       USBRKR   1156
C                                                                       USBRKR   1157
         QUANTM = UDPARM(NEXTP)                                         USBRKR   1158
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1159
C                                                                       USBRKR   1160
C                                                                       USBRKR   1161
C        Calculate UDVAL.                                               USBRKR   1162
C                                                                       USBRKR   1163
         N = INT(VALUE1 / QUANTM)                                       USBRKR   1164
         UDVAL(JBLK) = REAL (N) * QUANTM                                USBRKR   1165
C                                                                       USBRKR   1166
C     DELAY:  Delay function.                                           USBRKR   1167
C                                                                       USBRKR   1168
      ELSEIF(IUDSUB(JBLK).EQ.IDELAY)THEN                                USBRKR   1169
C                                                                       USBRKR   1170
         NEXTI = IUNIPT(JBLK)                                           USBRKR   1171
         NEXTP = IUDPPT(JBLK)                                           USBRKR   1172
C                                                                       USBRKR   1173
C        Input.                                                         USBRKR   1174
C                                                                       USBRKR   1175
         IF(UIDENT(NEXTI) .NE. ' ')THEN                                 USBRKR   1176
            VALUE1 = UDVAL(IUDINT(NEXTI))                               USBRKR   1177
         ELSE                                                           USBRKR   1178
            VALUE1 = UDPARM(NEXTP)                                      USBRKR   1179
         END IF                                                         USBRKR   1180
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1181
C                                                                       USBRKR   1182
C        Delay time.                                                    USBRKR   1183
C                                                                       USBRKR   1184
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1185
         NEXTI = IUDINX(NEXTI)                                          USBRKR   1186
C                                                                       USBRKR   1187
C        Current pointer for delay list.                                USBRKR   1188
C                                                                       USBRKR   1189
         JCURPT = NEXTP                                                 USBRKR   1190
         JCURRN = INT(UDPARM(JCURPT))                                   USBRKR   1191
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1192
C                                                                       USBRKR   1193
C        Top pointer for delay list.                                    USBRKR   1194
C                                                                       USBRKR   1195
         JTOP = UDPARM(NEXTP)                                           USBRKR   1196
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1197
C                                                                       USBRKR   1198
C        Bottom pointer for delay list.                                 USBRKR   1199
C                                                                       USBRKR   1200
         JBOTOM = UDPARM(NEXTP)                                         USBRKR   1201
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1202
C                                                                       USBRKR   1203
C                                                                       USBRKR   1204
C        Calculate UDVAL.                                               USBRKR   1205
C                                                                       USBRKR   1206
         UDVAL(JBLK) = DELAY(JCURRN)                                    USBRKR   1207
C                                                                       USBRKR   1208
C        Put last input into delay list                                 USBRKR   1209
C                                                                       USBRKR   1210
         DELAY(JCURRN) = VALUE1                                         USBRKR   1211
C                                                                       USBRKR   1212
C        Update pointer to list                                         USBRKR   1213
C                                                                       USBRKR   1214
         IF(JCURRN .GE. JBOTOM)THEN                                     USBRKR   1215
            JCURRN = JTOP                                               USBRKR   1216
         ELSE                                                           USBRKR   1217
            JCURRN = JCURRN + 1                                         USBRKR   1218
         END IF                                                         USBRKR   1219
C                                                                       USBRKR   1220
         UDPARM(JCURPT) = JCURRN                                        USBRKR   1221
C                                                                       USBRKR   1222
C     DC line                                                           USBRKR   1223
C                                                                       USBRKR   1224
      ELSEIF(IUDSUB(JBLK).EQ.IDCLIN)THEN                                USBRKR   1225
C                                                                       USBRKR   1226
         NEXTI = IUNIPT(JBLK)                                           USBRKR   1227
         NEXTP = IUDPPT(JBLK)                                           USBRKR   1228
C                                                                       USBRKR   1229
C        Dc line value.                                                 USBRKR   1230
C                                                                       USBRKR   1231
         LINE = IUDINT(NEXTI)                                           USBRKR   1232
         NEXTI = IUDINX(NEXTI)                                          USBRKR   1233
C                                                                       USBRKR   1234
C        Resistance for dc line.                                        USBRKR   1235
C                                                                       USBRKR   1236
         IF(UIDENT(NEXTI).NE.' ')THEN                                   USBRKR   1237
            R1 = UDVAL(IUDINT(NEXTI))                                   USBRKR   1238
         ELSE                                                           USBRKR   1239
            R1 = UDPARM(NEXTP)                                          USBRKR   1240
         ENDIF                                                          USBRKR   1241
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1242
C                                                                       USBRKR   1243
C        Inductance for dc line.                                        USBRKR   1244
C                                                                       USBRKR   1245
         XXL1 = UDPARM(NEXTP)                                           USBRKR   1246
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1247
C                                                                       USBRKR   1248
C        Capacitance for dc line.                                       USBRKR   1249
C                                                                       USBRKR   1250
         CA1 = UDPARM(NEXTP)                                            USBRKR   1251
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1252
C                                                                       USBRKR   1253
C        Capacitance for dc line.                                       USBRKR   1254
C                                                                       USBRKR   1255
         CB1 = UDPARM(NEXTP)                                            USBRKR   1256
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1257
C                                                                       USBRKR   1258
C        Replace dc line values for the line specified.                 USBRKR   1259
C                                                                       USBRKR   1260
         IF(LINE .NE. 0.AND.LOGEXP(1))THEN                              USBRKR   1261
            RDCOHM(LINE) = R1                                           USBRKR   1262
            XLDC(LINE) = XXL1 * 0.001                                   USBRKR   1263
            CDCA(LINE) = CA1 * 0.000001                                 USBRKR   1264
            CDCB(LINE) = CB1 * 0.000001                                 USBRKR   1265
         DCCHNG = .TRUE.                                                USBRKR   1266
         END IF                                                         USBRKR   1267
         UDVAL(JBLK) = 0.0                                              USBRKR   1268
C                                                                       USBRKR   1269
C        Do nothing for RLC subtype (done in initialization)            USBRKR   1270
C                                                                       USBRKR   1271
      ELSEIF(IUDSUB(JBLK).EQ.IRLCS)THEN                                 USBRKR   1272
         UDVAL(JBLK) = 0.0                                              USBRKR   1273
C                                                                       USBRKR   1274
C     Bridge                                                            USBRKR   1275
C                                                                       USBRKR   1276
      ELSEIF(IUDSUB(JBLK).EQ.IBRDGE)THEN                                USBRKR   1277
C                                                                       USBRKR   1278
         NEXTI = IUNIPT(JBLK)                                           USBRKR   1279
         NEXTP = IUDPPT(JBLK)                                           USBRKR   1280
C                                                                       USBRKR   1281
C        Dc converter value.                                            USBRKR   1282
C                                                                       USBRKR   1283
         LINE = IUDINT(NEXTI)                                           USBRKR   1284
         NEXTI = IUDINX(NEXTI)                                          USBRKR   1285
C                                                                       USBRKR   1286
C        Number of bridges.                                             USBRKR   1287
C                                                                       USBRKR   1288
         BRIDGE = UDPARM(NEXTP)                                         USBRKR   1289
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1290
C                                                                       USBRKR   1291
C        Replace dc converter values for the line specified.            USBRKR   1292
C                                                                       USBRKR   1293
         IF(LINE .NE. 0.AND.LOGEXP(1))THEN                              USBRKR   1294
           NSBRDG(LINE) = BRIDGE                                        USBRKR   1295
           DCCHNG = .TRUE.                                              USBRKR   1296
         END IF                                                         USBRKR   1297
         UDVAL(JBLK) = NSBRDG(LINE)                                     USBRKR   1298
C                                                                       USBRKR   1299
C     Tap                                                               USBRKR   1300
C                                                                       USBRKR   1301
      ELSEIF(IUDSUB(JBLK).EQ.ITAPS)THEN                                 USBRKR   1302
C                                                                       USBRKR   1303
         NEXTI = IUNIPT(JBLK)                                           USBRKR   1304
         NEXTP = IUDPPT(JBLK)                                           USBRKR   1305
C                                                                       USBRKR   1306
C        Input.                                                         USBRKR   1307
C                                                                       USBRKR   1308
         IF(UIDENT(NEXTI) .NE. ' ')THEN                                 USBRKR   1309
            VALUE1 = UDVAL(IUDINT(NEXTI))                               USBRKR   1310
         ELSE                                                           USBRKR   1311
            VALUE1 = UDPARM(NEXTP)                                      USBRKR   1312
         END IF                                                         USBRKR   1313
         NEXTI = IUDINX(NEXTI)                                          USBRKR   1314
         JOLD = NEXTP                                                   USBRKR   1315
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1316
C                                                                       USBRKR   1317
C        Dc converter value.                                            USBRKR   1318
C                                                                       USBRKR   1319
         JCONV = IUDINT(NEXTI)                                          USBRKR   1320
         NEXTI = IUDINX(NEXTI)                                          USBRKR   1321
C                                                                       USBRKR   1322
C        Low limit.                                                     USBRKR   1323
C                                                                       USBRKR   1324
         XLOW = UDPARM(NEXTP)                                           USBRKR   1325
         JOLD = NEXTP                                                   USBRKR   1326
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1327
C                                                                       USBRKR   1328
C        Time1 value.                                                   USBRKR   1329
C                                                                       USBRKR   1330
         TIME1 = UDPARM(NEXTP)                                          USBRKR   1331
         JOLD = NEXTP                                                   USBRKR   1332
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1333
C                                                                       USBRKR   1334
C        High limit.                                                    USBRKR   1335
C                                                                       USBRKR   1336
         HI = UDPARM(NEXTP)                                             USBRKR   1337
         JOLD = NEXTP                                                   USBRKR   1338
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1339
C                                                                       USBRKR   1340
C        Time2 value.                                                   USBRKR   1341
C                                                                       USBRKR   1342
         TIME2 = UDPARM(NEXTP)                                          USBRKR   1343
         JOLD = NEXTP                                                   USBRKR   1344
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1345
C                                                                       USBRKR   1346
C        Step value.                                                    USBRKR   1347
C                                                                       USBRKR   1348
         STEP = UDPARM(NEXTP)                                           USBRKR   1349
         JOLD = NEXTP                                                   USBRKR   1350
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1351
C                                                                       USBRKR   1352
C                                                                       USBRKR   1353
C        Calculate UDVAL.                                               USBRKR   1354
C                                                                       USBRKR   1355
         JTIMER = NEXTP                                                 USBRKR   1356
         IF(VALUE1 .GT. HI .OR. VALUE1 .LT. XLOW)THEN                   USBRKR   1357
            UDPARM(JTIMER) = UDPARM(JTIMER) + CTIME                     USBRKR   1358
         ELSE                                                           USBRKR   1359
            UDPARM(JTIMER) = 0.0                                        USBRKR   1360
         END IF                                                         USBRKR   1361
C                                                                       USBRKR   1362
C                                                                       USBRKR   1363
         IF(UDPARM(JTIMER).GT.TIME1.AND.VALUE1.LT.XLOW)THEN             USBRKR   1364
            TAPPOS(JCONV) = TAPPOS(JCONV) + STEP                        USBRKR   1365
            UDPARM(JTIMER) = 0.0                                        USBRKR   1366
            DCCHNG = .TRUE.                                             USBRKR   1367
            UDVAL(JBLK)=UDVAL(JBLK)+STEP                                USBRKR   1368
         END IF                                                         USBRKR   1369
C                                                                       USBRKR   1370
C                                                                       USBRKR   1371
         IF(UDPARM(JTIMER).GT.TIME2.AND.VALUE1.GT.HI)THEN               USBRKR   1372
            TAPPOS(JCONV) = TAPPOS(JCONV) - STEP                        USBRKR   1373
            UDPARM(JTIMER) = 0.0                                        USBRKR   1374
            DCCHNG = .TRUE.                                             USBRKR   1375
            UDVAL(JBLK)=UDVAL(JBLK)-STEP                                USBRKR   1376
         END IF                                                         USBRKR   1377
C                                                                       USBRKR   1378
C                                                                       USBRKR   1379
C     Level subtype.                                                    USBRKR   1380
C                                                                       USBRKR   1381
      ELSEIF(IUDSUB(JBLK).EQ.LEVELS)THEN                                USBRKR   1382
C                                                                       USBRKR   1383
         NEXTS = IUDSPT(JBLK)                                           USBRKR   1384
         SLOPE = UDOLD(NEXTS)                                           USBRKR   1385
         NEXTS = IUDSNX(NEXTS)                                          USBRKR   1386
         SRTTIM = UDOLD(NEXTS)                                          USBRKR   1387
         NEXTS = IUDSNX(NEXTS)                                          USBRKR   1388
         ENDTIM = UDOLD(NEXTS)                                          USBRKR   1389
         NEXTS = IUDSNX(NEXTS)                                          USBRKR   1390
         RSTTIM = UDOLD(NEXTS)                                          USBRKR   1391
C                                                                       USBRKR   1392
C                                                                       USBRKR   1393
         SRTVAL = UDPARM(NEXTP)                                         USBRKR   1394
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1395
C                                                                       USBRKR   1396
         ENDVAL = UDPARM(NEXTP)                                         USBRKR   1397
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1398
C                                                                       USBRKR   1399
         DURVAL = UDPARM(NEXTP)                                         USBRKR   1400
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1401
C                                                                       USBRKR   1402
         RSTLEN = UDPARM(NEXTP)                                         USBRKR   1403
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1404
C                                                                       USBRKR   1405
C                                                                       USBRKR   1406
         IF(SRTTIM.EQ.0.0.AND.ENDTIM.EQ.0.0.AND.                        USBRKR   1407
     1       RSTTIM.EQ.0.0)THEN                                         USBRKR   1408
            IF(LOGEXP(1))THEN                                           USBRKR   1409
C                                                                       USBRKR   1410
C              Calculate time values for the saved list.                USBRKR   1411
C                                                                       USBRKR   1412
               SRTTIM = TIME                                            USBRKR   1413
               ENDTIM = TIME + DURVAL                                   USBRKR   1414
               RSTTIM = ENDTIM + RSTLEN                                 USBRKR   1415
               NEXTS = IUDSPT(JBLK)                                     USBRKR   1416
               NEXTS = IUDSNX(NEXTS)                                    USBRKR   1417
               UDOLD(NEXTS) = SRTTIM                                    USBRKR   1418
               NEXTS = IUDSNX(NEXTS)                                    USBRKR   1419
               UDOLD(NEXTS) = ENDTIM                                    USBRKR   1420
               NEXTS = IUDSNX(NEXTS)                                    USBRKR   1421
               UDOLD(NEXTS) = RSTTIM                                    USBRKR   1422
               UDVAL(JBLK) = SRTVAL                                     USBRKR   1423
            ELSE                                                        USBRKR   1424
               UDVAL(JBLK) = SRTVAL                                     USBRKR   1425
            END IF                                                      USBRKR   1426
         ELSE                                                           USBRKR   1427
            IF(TIME .GT. SRTTIM.AND.TIME .LT. ENDTIM)THEN               USBRKR   1428
               UDVAL(JBLK) = SLOPE * (TIME - SRTTIM) + SRTVAL           USBRKR   1429
            ELSEIF(TIME .GE. ENDTIM.AND.TIME .LE. RSTTIM)THEN           USBRKR   1430
               UDVAL(JBLK) = ENDVAL                                     USBRKR   1431
            ELSE                                                        USBRKR   1432
               UDVAL(JBLK) = SRTVAL                                     USBRKR   1433
               NEXTS = IUDSPT(JBLK)                                     USBRKR   1434
               NEXTS = IUDSNX(NEXTS)                                    USBRKR   1435
               UDOLD(NEXTS) = 0.0                                       USBRKR   1436
               NEXTS = IUDSNX(NEXTS)                                    USBRKR   1437
               UDOLD(NEXTS) = 0.0                                       USBRKR   1438
               NEXTS = IUDSNX(NEXTS)                                    USBRKR   1439
               UDOLD(NEXTS) = 0.0                                       USBRKR   1440
            END IF                                                      USBRKR   1441
         END IF                                                         USBRKR   1442
C                                                                       USBRKR   1443
C     Hysteresis function.                                              USBRKR   1444
C                                                                       USBRKR   1445
      ELSEIF(IUDSUB(JBLK).EQ.IHYSTR)THEN                                USBRKR   1446
C                                                                       USBRKR   1447
         NEXTS = IUDSPT(JBLK)                                           USBRKR   1448
         SLOPE1 = UDOLD(NEXTS)                                          USBRKR   1449
         NEXTS = IUDSNX(NEXTS)                                          USBRKR   1450
         SLOPE2 = UDOLD(NEXTS)                                          USBRKR   1451
         NEXTS = IUDSNX(NEXTS)                                          USBRKR   1452
         JPATH = INT(UDOLD(NEXTS))                                      USBRKR   1453
C                                                                       USBRKR   1454
C                                                                       USBRKR   1455
C                                                                       USBRKR   1456
         IF(UIDENT(NEXTI) .NE. ' ')THEN                                 USBRKR   1457
            VALUE1 = UDVAL(IUDINT(NEXTI))                               USBRKR   1458
         ELSE                                                           USBRKR   1459
            VALUE1 = UDPARM(NEXTP)                                      USBRKR   1460
         END IF                                                         USBRKR   1461
         NEXTI = IUDINX(NEXTI)                                          USBRKR   1462
         LASTP = NEXTP                                                  USBRKR   1463
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1464
C                                                                       USBRKR   1465
         XLEVEA = UDPARM(NEXTP)                                         USBRKR   1466
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1467
C                                                                       USBRKR   1468
         XLEVEB = UDPARM(NEXTP)                                         USBRKR   1469
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1470
C                                                                       USBRKR   1471
         P1 = UDPARM(NEXTP)                                             USBRKR   1472
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1473
C                                                                       USBRKR   1474
         P2 = UDPARM(NEXTP)                                             USBRKR   1475
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1476
C                                                                       USBRKR   1477
         P3 = UDPARM(NEXTP)                                             USBRKR   1478
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1479
C                                                                       USBRKR   1480
         P4 = UDPARM(NEXTP)                                             USBRKR   1481
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1482
C                                                                       USBRKR   1483
         XINIT = UDPARM(NEXTP)                                          USBRKR   1484
C                                                                       USBRKR   1485
C                                                                       USBRKR   1486
         NEXTS = IUDSPT(JBLK)                                           USBRKR   1487
         SLOPE1 = UDOLD(NEXTS)                                          USBRKR   1488
         NEXTS = IUDSNX(NEXTS)                                          USBRKR   1489
         SLOPE2 = UDOLD(NEXTS)                                          USBRKR   1490
         NEXTS = IUDSNX(NEXTS)                                          USBRKR   1491
         JPATH = INT(UDOLD(NEXTS))                                      USBRKR   1492
         LASTS = NEXTS                                                  USBRKR   1493
C                                                                       USBRKR   1494
         IF(VALUE1 .LT. P1)THEN                                         USBRKR   1495
            IF(JPATH .NE. 1)THEN                                        USBRKR   1496
               JPATH = 1                                                USBRKR   1497
               UDOLD(LASTS) = REAL (JPATH)                              USBRKR   1498
            END IF                                                      USBRKR   1499
         ELSEIF(VALUE1 .GT. P4)THEN                                     USBRKR   1500
            IF(JPATH .NE. 2)THEN                                        USBRKR   1501
               JPATH = 2                                                USBRKR   1502
               UDOLD(LASTS) = REAL (JPATH)                              USBRKR   1503
            END IF                                                      USBRKR   1504
         END IF                                                         USBRKR   1505
C                                                                       USBRKR   1506
C                                                                       USBRKR   1507
C        Calculate the output value.                                    USBRKR   1508
C                                                                       USBRKR   1509
         IF(JPATH.EQ.1)THEN                                             USBRKR   1510
            IF(VALUE1 .GE. P4)THEN                                      USBRKR   1511
               UDVAL(JBLK) = XLEVEA                                     USBRKR   1512
            ELSEIF(VALUE1 .LE. P3)THEN                                  USBRKR   1513
               UDVAL(JBLK) = XLEVEB                                     USBRKR   1514
            ELSE                                                        USBRKR   1515
               UDVAL(JBLK) = XLEVEB + (VALUE1 - P3) * SLOPE1            USBRKR   1516
            END IF                                                      USBRKR   1517
         ELSE                                                           USBRKR   1518
            IF(VALUE1 .GE. P2)THEN                                      USBRKR   1519
               UDVAL(JBLK) = XLEVEA                                     USBRKR   1520
            ELSEIF(VALUE1 .LE. P1)THEN                                  USBRKR   1521
               UDVAL(JBLK) = XLEVEB                                     USBRKR   1522
            ELSE                                                        USBRKR   1523
               UDVAL(JBLK) = XLEVEB + (VALUE1 - P1) * SLOPE2            USBRKR   1524
            END IF                                                      USBRKR   1525
         END IF                                                         USBRKR   1526
C                                                                       USBRKR   1527
C     First deadband function.                                          USBRKR   1528
C                                                                       USBRKR   1529
C                                                                       USBRKR   1530
      ELSEIF(IUDSUB(JBLK).EQ.IDEAD1)THEN                                USBRKR   1531
C                                                                       USBRKR   1532
         IF(UIDENT(NEXTI) .NE. ' ')THEN                                 USBRKR   1533
            VALUE1 = UDVAL(IUDINT(NEXTI))                               USBRKR   1534
         ELSE                                                           USBRKR   1535
            VALUE1 = UDPARM(NEXTP)                                      USBRKR   1536
         END IF                                                         USBRKR   1537
         NEXTI = IUDINX(NEXTI)                                          USBRKR   1538
         LASTP = NEXTP                                                  USBRKR   1539
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1540
C                                                                       USBRKR   1541
         DBP = UDPARM(NEXTP)                                            USBRKR   1542
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1543
C                                                                       USBRKR   1544
         OUTP = UDPARM(NEXTP)                                           USBRKR   1545
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1546
C                                                                       USBRKR   1547
         DBN = UDPARM(NEXTP)                                            USBRKR   1548
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1549
C                                                                       USBRKR   1550
         OUTN = UDPARM(NEXTP)                                           USBRKR   1551
C                                                                       USBRKR   1552
C                                                                       USBRKR   1553
         IF(VALUE1 .GT. DBP)THEN                                        USBRKR   1554
            UDVAL(JBLK) = OUTP                                          USBRKR   1555
         ELSEIF(VALUE1 .LT. DBN)THEN                                    USBRKR   1556
            UDVAL(JBLK) = OUTN                                          USBRKR   1557
         ELSE                                                           USBRKR   1558
            UDVAL(JBLK) = 0.0                                           USBRKR   1559
         END IF                                                         USBRKR   1560
C                                                                       USBRKR   1561
C---------------------------------------------------------------------  USBRKR   1562
C                                                                       USBRKR   1563
C     Second deadband function.                                         USBRKR   1564
C                                                                       USBRKR   1565
C                                                                       USBRKR   1566
      ELSEIF(IUDSUB(JBLK).EQ.IDEAD2)THEN                                USBRKR   1567
C                                                                       USBRKR   1568
         IF(UIDENT(NEXTI) .NE. ' ')THEN                                 USBRKR   1569
            VALUE1 = UDVAL(IUDINT(NEXTI))                               USBRKR   1570
         ELSE                                                           USBRKR   1571
            VALUE1 = UDPARM(NEXTP)                                      USBRKR   1572
         END IF                                                         USBRKR   1573
         NEXTI = IUDINX(NEXTI)                                          USBRKR   1574
         LASTP = NEXTP                                                  USBRKR   1575
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1576
C                                                                       USBRKR   1577
         DBP = UDPARM(NEXTP)                                            USBRKR   1578
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1579
C                                                                       USBRKR   1580
         SLOPEP = UDPARM(NEXTP)                                         USBRKR   1581
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1582
C                                                                       USBRKR   1583
         DBN = UDPARM(NEXTP)                                            USBRKR   1584
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1585
C                                                                       USBRKR   1586
         SLOPEN = UDPARM(NEXTP)                                         USBRKR   1587
C                                                                       USBRKR   1588
C                                                                       USBRKR   1589
         IF(VALUE1 .GT. DBP)THEN                                        USBRKR   1590
            UDVAL(JBLK) = (VALUE1 - DBP) * SLOPEP                       USBRKR   1591
         ELSEIF(VALUE1 .LT. DBN)THEN                                    USBRKR   1592
            UDVAL(JBLK) = (VALUE1 - DBN) * SLOPEN                       USBRKR   1593
         ELSE                                                           USBRKR   1594
            UDVAL(JBLK) = 0.0                                           USBRKR   1595
         END IF                                                         USBRKR   1596
C                                                                       USBRKR   1597
C     Sample & Hold function.                                           USBRKR   1598
C                                                                       USBRKR   1599
C                                                                       USBRKR   1600
      ELSE IF (IUDSUB(JBLK) .EQ. ISAMPL) THEN                           USBRKR   1601
C                                                                       USBRKR   1602
C        Input1 value.                                                  USBRKR   1603
C                                                                       USBRKR   1604
         IF (UIDENT(NEXTI) .NE. ' ') THEN                               USBRKR   1605
            VALUE1 = UDVAL(IUDINT(NEXTI))                               USBRKR   1606
         ELSE                                                           USBRKR   1607
            VALUE1 = UDPARM(NEXTP)                                      USBRKR   1608
         END IF                                                         USBRKR   1609
         NEXTI = IUDINX(NEXTI)                                          USBRKR   1610
         LASTP = NEXTP                                                  USBRKR   1611
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1612
C                                                                       USBRKR   1613
C        Input2 value.                                                  USBRKR   1614
C                                                                       USBRKR   1615
         IF (UIDENT(NEXTI) .NE. ' ') THEN                               USBRKR   1616
            VALUE2 = UDVAL(IUDINT(NEXTI))                               USBRKR   1617
         ELSE                                                           USBRKR   1618
            VALUE2 = UDPARM(NEXTP)                                      USBRKR   1619
         END IF                                                         USBRKR   1620
         NEXTI = IUDINX(NEXTI)                                          USBRKR   1621
         LASTP = NEXTP                                                  USBRKR   1622
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1623
C                                                                       USBRKR   1624
         SET = LOGEXP(1)                                                USBRKR   1625
         RESET= LOGEXP(2)                                               USBRKR   1626
C                                                                       USBRKR   1627
C     Status is 1 if last true was SET, 2 if RESET                      USBRKR   1628
C                                                                       USBRKR   1629
C     RETRIEVE storage OF logic, status                                 USBRKR   1630
C                                                                       USBRKR   1631
         NEXTS = IUDSPT(JBLK)                                           USBRKR   1632
         LASET = (UDOLD(NEXTS) .EQ. 1.0)                                USBRKR   1633
         NEXTS = IUDSNX(NEXTS)                                          USBRKR   1634
         LARSET = (UDOLD(NEXTS). EQ. 1.0)                               USBRKR   1635
         NEXTS = IUDSNX(NEXTS)                                          USBRKR   1636
         STATUS = UDOLD(NEXTS)                                          USBRKR   1637
         IF(.NOT. LASET .AND. SET) THEN                                 USBRKR   1638
            STATUS = 1.0                                                USBRKR   1639
            UDVAL(JBLK) =VALUE1                                         USBRKR   1640
         ELSEIF(STATUS.EQ.2.0)THEN                                      USBRKR   1641
            UDVAL(JBLK) =VALUE2                                         USBRKR   1642
         ELSEIF(RESET)THEN                                              USBRKR   1643
            UDVAL(JBLK) =VALUE2                                         USBRKR   1644
            STATUS = 2.0                                                USBRKR   1645
         END IF                                                         USBRKR   1646
         NEXTS = IUDSPT(JBLK)                                           USBRKR   1647
         UDOLD(NEXTS) = 0.0                                             USBRKR   1648
         IF(SET) UDOLD(NEXTS) = 1.0                                     USBRKR   1649
         NEXTS = IUDSNX(NEXTS)                                          USBRKR   1650
         UDOLD(NEXTS) = 0.0                                             USBRKR   1651
         IF(RESET) UDOLD(NEXTS) = 1.0                                   USBRKR   1652
         NEXTS = IUDSNX(NEXTS)                                          USBRKR   1653
         UDOLD(NEXTS) = STATUS                                          USBRKR   1654
                                                                        USBRKR   1655
C                                                                       USBRKR   1656
C---------------------------------------------------------------------  USBRKR   1657
C                                                                       USBRKR   1658
C     Retriggered Ramp function.                                        USBRKR   1659
C                                                                       USBRKR   1660
C                                                                       USBRKR   1661
      ELSE IF (IUDSUB(JBLK) .EQ. IRAMPR) THEN                           USBRKR   1662
C                                                                       USBRKR   1663
         SET = LOGEXP(1)                                                USBRKR   1664
         RESET= LOGEXP(2)                                               USBRKR   1665
         NEXTS = IUDSPT(JBLK)                                           USBRKR   1666
         STATUS = UDOLD(NEXTS)                                          USBRKR   1667
C                                                                       USBRKR   1668
         IF(STATUS.EQ.0.0)THEN                                          USBRKR   1669
C                                                                       USBRKR   1670
C        LEVEL 0 value.                                                 USBRKR   1671
C                                                                       USBRKR   1672
            IF (UIDENT(NEXTI) .NE. ' ') THEN                            USBRKR   1673
               XLEV0 = UDVAL(IUDINT(NEXTI))                             USBRKR   1674
            ELSE                                                        USBRKR   1675
               XLEV0 = UDPARM(NEXTP)                                    USBRKR   1676
            END IF                                                      USBRKR   1677
            NEXTI = IUDINX(NEXTI)                                       USBRKR   1678
            LASTP = NEXTP                                               USBRKR   1679
            NEXTP = IUDPNX(NEXTP)                                       USBRKR   1680
C                                                                       USBRKR   1681
C        LEVEL 1 value.                                                 USBRKR   1682
C                                                                       USBRKR   1683
            IF (UIDENT(NEXTI) .NE. ' ') THEN                            USBRKR   1684
               XLEV1 = UDVAL(IUDINT(NEXTI))                             USBRKR   1685
            ELSE                                                        USBRKR   1686
               XLEV1 = UDPARM(NEXTP)                                    USBRKR   1687
            END IF                                                      USBRKR   1688
            NEXTI = IUDINX(NEXTI)                                       USBRKR   1689
            LASTP = NEXTP                                               USBRKR   1690
            NEXTP = IUDPNX(NEXTP)                                       USBRKR   1691
C                                                                       USBRKR   1692
C        Time 1 value.                                                  USBRKR   1693
C                                                                       USBRKR   1694
            IF (UIDENT(NEXTI) .NE. ' ') THEN                            USBRKR   1695
               TIME1 = UDVAL(IUDINT(NEXTI))                             USBRKR   1696
            ELSE                                                        USBRKR   1697
               TIME1 = UDPARM(NEXTP)                                    USBRKR   1698
            END IF                                                      USBRKR   1699
            NEXTI = IUDINX(NEXTI)                                       USBRKR   1700
            LASTP = NEXTP                                               USBRKR   1701
            NEXTP = IUDPNX(NEXTP)                                       USBRKR   1702
C                                                                       USBRKR   1703
C        LEVEL 2 value.                                                 USBRKR   1704
C                                                                       USBRKR   1705
            IF (UIDENT(NEXTI) .NE. ' ') THEN                            USBRKR   1706
               XLEV2 = UDVAL(IUDINT(NEXTI))                             USBRKR   1707
            ELSE                                                        USBRKR   1708
               XLEV2 = UDPARM(NEXTP)                                    USBRKR   1709
            END IF                                                      USBRKR   1710
            NEXTI = IUDINX(NEXTI)                                       USBRKR   1711
            LASTP = NEXTP                                               USBRKR   1712
            NEXTP = IUDPNX(NEXTP)                                       USBRKR   1713
C                                                                       USBRKR   1714
C        Time 2 value.                                                  USBRKR   1715
C                                                                       USBRKR   1716
            IF (UIDENT(NEXTI) .NE. ' ') THEN                            USBRKR   1717
               TIME2 = UDVAL(IUDINT(NEXTI))                             USBRKR   1718
            ELSE                                                        USBRKR   1719
               TIME2 = UDPARM(NEXTP)                                    USBRKR   1720
            END IF                                                      USBRKR   1721
            NEXTI = IUDINX(NEXTI)                                       USBRKR   1722
            LASTP = NEXTP                                               USBRKR   1723
            NEXTP = IUDPNX(NEXTP)                                       USBRKR   1724
C                                                                       USBRKR   1725
C        LEVEL 3 value.                                                 USBRKR   1726
C                                                                       USBRKR   1727
            IF (UIDENT(NEXTI) .NE. ' ') THEN                            USBRKR   1728
               XLEV3 = UDVAL(IUDINT(NEXTI))                             USBRKR   1729
            ELSE                                                        USBRKR   1730
               XLEV3 = UDPARM(NEXTP)                                    USBRKR   1731
            END IF                                                      USBRKR   1732
            NEXTI = IUDINX(NEXTI)                                       USBRKR   1733
            LASTP = NEXTP                                               USBRKR   1734
            NEXTP = IUDPNX(NEXTP)                                       USBRKR   1735
C                                                                       USBRKR   1736
C        LEVEL 4 value.                                                 USBRKR   1737
C                                                                       USBRKR   1738
            IF (UIDENT(NEXTI) .NE. ' ') THEN                            USBRKR   1739
               XLEV4 = UDVAL(IUDINT(NEXTI))                             USBRKR   1740
            ELSE                                                        USBRKR   1741
               XLEV4 = UDPARM(NEXTP)                                    USBRKR   1742
            END IF                                                      USBRKR   1743
            NEXTI = IUDINX(NEXTI)                                       USBRKR   1744
            LASTP = NEXTP                                               USBRKR   1745
            NEXTP = IUDPNX(NEXTP)                                       USBRKR   1746
C                                                                       USBRKR   1747
C        Time 4 value.                                                  USBRKR   1748
C                                                                       USBRKR   1749
            IF (UIDENT(NEXTI) .NE. ' ') THEN                            USBRKR   1750
               TIME4 = UDVAL(IUDINT(NEXTI))                             USBRKR   1751
            ELSE                                                        USBRKR   1752
               TIME4 = UDPARM(NEXTP)                                    USBRKR   1753
            END IF                                                      USBRKR   1754
            NEXTI = IUDINX(NEXTI)                                       USBRKR   1755
            LASTP = NEXTP                                               USBRKR   1756
            NEXTP = IUDPNX(NEXTP)                                       USBRKR   1757
C                                                                       USBRKR   1758
C        LEVEL 5 value.                                                 USBRKR   1759
C                                                                       USBRKR   1760
            IF (UIDENT(NEXTI) .NE. ' ') THEN                            USBRKR   1761
               XLEV5 = UDVAL(IUDINT(NEXTI))                             USBRKR   1762
            ELSE                                                        USBRKR   1763
               XLEV5 = UDPARM(NEXTP)                                    USBRKR   1764
            END IF                                                      USBRKR   1765
            NEXTI = IUDINX(NEXTI)                                       USBRKR   1766
            LASTP = NEXTP                                               USBRKR   1767
            NEXTP = IUDPNX(NEXTP)                                       USBRKR   1768
C                                                                       USBRKR   1769
C        Time 5 value.                                                  USBRKR   1770
C                                                                       USBRKR   1771
            IF (UIDENT(NEXTI) .NE. ' ') THEN                            USBRKR   1772
               TIME5 = UDVAL(IUDINT(NEXTI))                             USBRKR   1773
            ELSE                                                        USBRKR   1774
               TIME5 = UDPARM(NEXTP)                                    USBRKR   1775
            END IF                                                      USBRKR   1776
            NEXTI = IUDINX(NEXTI)                                       USBRKR   1777
            LASTP = NEXTP                                               USBRKR   1778
            NEXTP = IUDPNX(NEXTP)                                       USBRKR   1779
C                                                                       USBRKR   1780
         ELSE                                                           USBRKR   1781
C                                                                       USBRKR   1782
C           Recover previous values.                                    USBRKR   1783
C                                                                       USBRKR   1784
            NEXTS = IUDSNX(NEXTS)                                       USBRKR   1785
            STRTIM = UDOLD(NEXTS)                                       USBRKR   1786
            NEXTS = IUDSNX(NEXTS)                                       USBRKR   1787
            XLEV0 = UDOLD(NEXTS)                                        USBRKR   1788
            NEXTS = IUDSNX(NEXTS)                                       USBRKR   1789
            XLEV1 = UDOLD(NEXTS)                                        USBRKR   1790
            NEXTS = IUDSNX(NEXTS)                                       USBRKR   1791
            TIME1 = UDOLD(NEXTS)                                        USBRKR   1792
            NEXTS = IUDSNX(NEXTS)                                       USBRKR   1793
            XLEV2 = UDOLD(NEXTS)                                        USBRKR   1794
            NEXTS = IUDSNX(NEXTS)                                       USBRKR   1795
            TIME2 = UDOLD(NEXTS)                                        USBRKR   1796
            NEXTS = IUDSNX(NEXTS)                                       USBRKR   1797
            XLEV3 = UDOLD(NEXTS)                                        USBRKR   1798
            NEXTS = IUDSNX(NEXTS)                                       USBRKR   1799
            XLEV4 = UDOLD(NEXTS)                                        USBRKR   1800
            NEXTS = IUDSNX(NEXTS)                                       USBRKR   1801
            TIME4 = UDOLD(NEXTS)                                        USBRKR   1802
            NEXTS = IUDSNX(NEXTS)                                       USBRKR   1803
            XLEV5 = UDOLD(NEXTS)                                        USBRKR   1804
            NEXTS = IUDSNX(NEXTS)                                       USBRKR   1805
            TIME5 = UDOLD(NEXTS)                                        USBRKR   1806
         ENDIF                                                          USBRKR   1807
C                                                                       USBRKR   1808
C        Evaluate block output.                                         USBRKR   1809
C                                                                       USBRKR   1810
         SAVE = .FALSE.                                                 USBRKR   1811
         IF(SET.AND.STATUS.EQ.0.0)THEN                                  USBRKR   1812
            SAVE = .TRUE.                                               USBRKR   1813
            STRTIM = TIME                                               USBRKR   1814
            STATUS = 1.0                                                USBRKR   1815
         ENDIF                                                          USBRKR   1816
C                                                                       USBRKR   1817
         IF(RESET) THEN                                                 USBRKR   1818
            UDVAL(JBLK) = XLEV0                                         USBRKR   1819
            STATUS = 0.0                                                USBRKR   1820
            SAVE = .TRUE.                                               USBRKR   1821
         ELSEIF(SET.OR.STATUS.EQ.1.0) THEN                              USBRKR   1822
            DLTTIM = TIME - STRTIM                                      USBRKR   1823
            IF(DLTTIM.LE.TIME1)THEN                                     USBRKR   1824
               UDVAL(JBLK) = XLEV1                                      USBRKR   1825
            ELSEIF(DLTTIM.LE.(TIME1+TIME2))THEN                         USBRKR   1826
               DTTTIM = DLTTIM -TIME1                                   USBRKR   1827
               UDVAL(JBLK) = XLEV2+DTTTIM*(XLEV3-XLEV2)/TIME2           USBRKR   1828
            ELSEIF(DLTTIM.LE.(TIME1+TIME2+TIME4))THEN                   USBRKR   1829
               UDVAL(JBLK) = XLEV4                                      USBRKR   1830
            ELSEIF(DLTTIM.LE.(TIME1+TIME2+TIME4+TIME5))THEN             USBRKR   1831
               UDVAL(JBLK) = XLEV5                                      USBRKR   1832
            ELSE                                                        USBRKR   1833
               UDVAL(JBLK) = XLEV0                                      USBRKR   1834
               STATUS = 0.0                                             USBRKR   1835
               SAVE = .TRUE.                                            USBRKR   1836
            ENDIF                                                       USBRKR   1837
         ELSE                                                           USBRKR   1838
            UDVAL(JBLK) = XLEV0                                         USBRKR   1839
         ENDIF                                                          USBRKR   1840
C                                                                       USBRKR   1841
         IF(SAVE) THEN                                                  USBRKR   1842
            NEXTS = IUDSPT(JBLK)                                        USBRKR   1843
            UDOLD(NEXTS) = STATUS                                       USBRKR   1844
            NEXTS = IUDSNX(NEXTS)                                       USBRKR   1845
            UDOLD(NEXTS) = STRTIM                                       USBRKR   1846
            NEXTS = IUDSNX(NEXTS)                                       USBRKR   1847
            UDOLD(NEXTS) = XLEV0                                        USBRKR   1848
            NEXTS = IUDSNX(NEXTS)                                       USBRKR   1849
            UDOLD(NEXTS) = XLEV1                                        USBRKR   1850
            NEXTS = IUDSNX(NEXTS)                                       USBRKR   1851
            UDOLD(NEXTS) = TIME1                                        USBRKR   1852
            NEXTS = IUDSNX(NEXTS)                                       USBRKR   1853
            UDOLD(NEXTS) = XLEV2                                        USBRKR   1854
            NEXTS = IUDSNX(NEXTS)                                       USBRKR   1855
            UDOLD(NEXTS) = TIME2                                        USBRKR   1856
            NEXTS = IUDSNX(NEXTS)                                       USBRKR   1857
            UDOLD(NEXTS) = XLEV3                                        USBRKR   1858
            NEXTS = IUDSNX(NEXTS)                                       USBRKR   1859
            UDOLD(NEXTS) = XLEV4                                        USBRKR   1860
            NEXTS = IUDSNX(NEXTS)                                       USBRKR   1861
            UDOLD(NEXTS) = TIME4                                        USBRKR   1862
            NEXTS = IUDSNX(NEXTS)                                       USBRKR   1863
            UDOLD(NEXTS) = XLEV5                                        USBRKR   1864
            NEXTS = IUDSNX(NEXTS)                                       USBRKR   1865
            UDOLD(NEXTS) = TIME5                                        USBRKR   1866
            NEXTS = IUDSNX(NEXTS)                                       USBRKR   1867
            UDOLD(NEXTS) = UDVAL(JBLK)                                  USBRKR   1868
         END IF                                                         USBRKR   1869
      ENDIF                                                             USBRKR   1870
C                                                                       USBRKR   1871
      RETURN                                                            USBRKR   1872
C                                                                       USBRKR   1873
C---------------------------------------------------------------------  USBRKR   1874
C                                                                       USBRKR   1875
      ENTRY USSETP (JBLK)                                               USBRKR   1876
CD -------------------------------------------------------------------  USBRKR   1877
CD                                                                      USBRKR   1878
CD              *****     USSETP  ROUTINE   *****                       USBRKR   1879
CD                                                                      USBRKR   1880
CD -------------------------------------------------------------------  USBRKR   1881
CD                                                                      USBRKR   1882
CD       PURPOSE:  Performs the solution of the udc type SETUP.         USBRKR   1883
CD                                                                      USBRKR   1884
CD -------------------------------------------------------------------  USBRKR   1885
C                                                                       USBRKR   1886
      NEXTI = IUNIPT(JBLK)                                              USBRKR   1887
      NEXTP = IUDPPT(JBLK)                                              USBRKR   1888
      NEXTS = IUDSPT(JBLK)                                              USBRKR   1889
C                                                                       USBRKR   1890
      IF(IUDSUB(JBLK).EQ.ISPVAL)THEN                                    USBRKR   1891
C                                                                       USBRKR   1892
         UDVAL(JBLK) = UDVAL(JBLK)                                      USBRKR   1893
C                                                                       USBRKR   1894
C                                                                       USBRKR   1895
C                                                                       USBRKR   1896
C                                                                       USBRKR   1897
      ELSEIF(IUDSUB(JBLK).EQ.ISPOFF)THEN                                USBRKR   1898
C                                                                       USBRKR   1899
C        Omit initial value.                                            USBRKR   1900
C                                                                       USBRKR   1901
         NEXTI = IUDINX(NEXTI)                                          USBRKR   1902
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1903
C                                                                       USBRKR   1904
         IF(NEXTS .NE. 0)THEN                                           USBRKR   1905
            XINIT = UDOLD(NEXTS)                                        USBRKR   1906
         END IF                                                         USBRKR   1907
         INPUT1 = IUDINT(NEXTI)                                         USBRKR   1908
         UDVAL(JBLK) = XINIT + UDVAL(INPUT1)                            USBRKR   1909
C                                                                       USBRKR   1910
      ELSEIF(IUDSUB(JBLK).EQ.ISPINT)THEN                                USBRKR   1911
C                                                                       USBRKR   1912
C        Omit initial value.                                            USBRKR   1913
C                                                                       USBRKR   1914
         NEXTI = IUDINX(NEXTI)                                          USBRKR   1915
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1916
C                                                                       USBRKR   1917
C        Find the input value.                                          USBRKR   1918
C                                                                       USBRKR   1919
         JBLOCK = IUDINT(NEXTI)                                         USBRKR   1920
         VALUE = UDVAL(JBLOCK)                                          USBRKR   1921
         NEXTI = IUDINX(NEXTI)                                          USBRKR   1922
C                                                                       USBRKR   1923
C        Find the gain value.                                           USBRKR   1924
C                                                                       USBRKR   1925
         GAIN = UDPARM(NEXTP)                                           USBRKR   1926
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1927
C                                                                       USBRKR   1928
         OLDX = UDOLD(NEXTS)                                            USBRKR   1929
         NEXTS = IUDSNX(NEXTS)                                          USBRKR   1930
C                                                                       USBRKR   1931
         OLDV = UDOLD(NEXTS)                                            USBRKR   1932
         NEXTS = IUDSNX(NEXTS)                                          USBRKR   1933
C                                                                       USBRKR   1934
         H = (CTIME / 2.0) * ((1. + ALPHAT) * VALUE + (1. - ALPHAT)     USBRKR   1935
     1        * OLDV)                                                   USBRKR   1936
C                                                                       USBRKR   1937
         X = OLDX + H * GAIN                                            USBRKR   1938
C                                                                       USBRKR   1939
C        Set output value                                               USBRKR   1940
C                                                                       USBRKR   1941
         UDVAL(JBLK) = X                                                USBRKR   1942
C                                                                       USBRKR   1943
C        Store current x and value.                                     USBRKR   1944
C                                                                       USBRKR   1945
         NEXTS = IUDSPT(JBLK)                                           USBRKR   1946
         UDOLD(NEXTS) = X                                               USBRKR   1947
         NEXTS = IUDSNX(NEXTS)                                          USBRKR   1948
C                                                                       USBRKR   1949
         UDOLD(NEXTS) = VALUE                                           USBRKR   1950
         NEXTS = IUDSNX(NEXTS)                                          USBRKR   1951
C                                                                       USBRKR   1952
C                                                                       USBRKR   1953
      ELSEIF(IUDSUB(JBLK).EQ.ISPLIN)THEN                                USBRKR   1954
C                                                                       USBRKR   1955
C        Bypass initial value.                                          USBRKR   1956
C                                                                       USBRKR   1957
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1958
         NEXTI = IUDINX(NEXTI)                                          USBRKR   1959
C                                                                       USBRKR   1960
C        Find the input value.                                          USBRKR   1961
C                                                                       USBRKR   1962
         JBLOCK = IUDINT(NEXTI)                                         USBRKR   1963
         VALUE = UDVAL(JBLOCK)                                          USBRKR   1964
         NEXTI = IUDINX(NEXTI)                                          USBRKR   1965
C                                                                       USBRKR   1966
C        Find the gain value.                                           USBRKR   1967
C                                                                       USBRKR   1968
         GAIN = UDPARM(NEXTP)                                           USBRKR   1969
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1970
C                                                                       USBRKR   1971
C        Find the low limit.                                            USBRKR   1972
C                                                                       USBRKR   1973
         IF(UIDENT(NEXTI) .NE. ' ')THEN                                 USBRKR   1974
            JBLOCK = IUDINT(NEXTI)                                      USBRKR   1975
            XLOW = UDVAL(JBLOCK)                                        USBRKR   1976
         ELSE                                                           USBRKR   1977
            XLOW = UDPARM(NEXTP)                                        USBRKR   1978
         END IF                                                         USBRKR   1979
         NEXTI = IUDINX(NEXTI)                                          USBRKR   1980
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1981
C                                                                       USBRKR   1982
C        Find the high limit.                                           USBRKR   1983
C                                                                       USBRKR   1984
         IF(UIDENT(NEXTI) .NE. ' ')THEN                                 USBRKR   1985
            JBLOCK = IUDINT(NEXTI)                                      USBRKR   1986
            HI = UDVAL(JBLOCK)                                          USBRKR   1987
         ELSE                                                           USBRKR   1988
            HI = UDPARM(NEXTP)                                          USBRKR   1989
         END IF                                                         USBRKR   1990
         NEXTI = IUDINX(NEXTI)                                          USBRKR   1991
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   1992
C                                                                       USBRKR   1993
         OLDX = UDOLD(NEXTS)                                            USBRKR   1994
         NEXTS = IUDSNX(NEXTS)                                          USBRKR   1995
C                                                                       USBRKR   1996
         OLDV = UDOLD(NEXTS)                                            USBRKR   1997
         NEXTS = IUDSNX(NEXTS)                                          USBRKR   1998
C                                                                       USBRKR   1999
         H = (CTIME / 2.0) * ((1. + ALPHAT) * VALUE + (1. - ALPHAT)     USBRKR   2000
     1        * OLDV)                                                   USBRKR   2001
C                                                                       USBRKR   2002
         X = OLDX + H * GAIN                                            USBRKR   2003
C                                                                       USBRKR   2004
C        Apply limits                                                   USBRKR   2005
C                                                                       USBRKR   2006
         IF(X .GT. HI) X = HI                                           USBRKR   2007
         IF(X .LE. XLOW) X = XLOW                                       USBRKR   2008
C                                                                       USBRKR   2009
C        Set output value                                               USBRKR   2010
C                                                                       USBRKR   2011
         UDVAL(JBLK) = X                                                USBRKR   2012
C                                                                       USBRKR   2013
C        Store current x and value.                                     USBRKR   2014
C                                                                       USBRKR   2015
         NEXTS = IUDSPT(JBLK)                                           USBRKR   2016
         UDOLD(NEXTS) = X                                               USBRKR   2017
         NEXTS = IUDSNX(NEXTS)                                          USBRKR   2018
C                                                                       USBRKR   2019
         UDOLD(NEXTS) = VALUE                                           USBRKR   2020
         NEXTS = IUDSNX(NEXTS)                                          USBRKR   2021
C                                                                       USBRKR   2022
C                                                                       USBRKR   2023
      ELSE                                                              USBRKR   2024
C                                                                       USBRKR   2025
C        The value of the input block is the output value.              USBRKR   2026
C                                                                       USBRKR   2027
         INPUT1 = IUDINT(NEXTI)                                         USBRKR   2028
         UDVAL(JBLK) = UDVAL(INPUT1)                                    USBRKR   2029
      END IF                                                            USBRKR   2030
C                                                                       USBRKR   2031
      RETURN                                                            USBRKR   2032
C                                                                       USBRKR   2033
C---------------------------------------------------------------------  USBRKR   2034
C                                                                       USBRKR   2035
      ENTRY USUNA (JBLK)                                                USBRKR   2036
CD -------------------------------------------------------------------  USBRKR   2037
CD                                                                      USBRKR   2038
CD              *****     USUNA   ROUTINE   *****                       USBRKR   2039
CD                                                                      USBRKR   2040
CD -------------------------------------------------------------------  USBRKR   2041
CD                                                                      USBRKR   2042
CD       PURPOSE:  Performs the solution of the udc type UNARY.         USBRKR   2043
CD                                                                      USBRKR   2044
CD -------------------------------------------------------------------  USBRKR   2045
C                                                                       USBRKR   2046
      IF(SDBG)THEN                                                      USBRKR   2047
         SUBNAM = 'USUNA ROUTINE.'                                      USBRKR   2048
      ELSE                                                              USBRKR   2049
         SUBNAM = ' '                                                   USBRKR   2050
      END IF                                                            USBRKR   2051
C                                                                       USBRKR   2052
C     Retrieve input value.                                             USBRKR   2053
C                                                                       USBRKR   2054
      NEXTI = IUNIPT(JBLK)                                              USBRKR   2055
      NEXTP = IUDPPT(JBLK)                                              USBRKR   2056
C                                                                       USBRKR   2057
      IF(UIDENT(NEXTI) .NE. ' ')THEN                                    USBRKR   2058
         VALUE = UDVAL(IUDINT(NEXTI))                                   USBRKR   2059
      ELSE                                                              USBRKR   2060
         VALUE = UDPARM(NEXTP)                                          USBRKR   2061
      END IF                                                            USBRKR   2062
C                                                                       USBRKR   2063
      IF(IUDSUB(JBLK).EQ.ISINS .OR. IUDSUB(JBLK).EQ.ICOSS .OR.          USBRKR   2064
     1    IUDSUB(JBLK).EQ.ITANS)THEN                                    USBRKR   2065
C                                                                       USBRKR   2066
C        The value is given in degrees, convert it to radians.          USBRKR   2067
C                                                                       USBRKR   2068
         VALUE = VALUE * PII/180.0                                      USBRKR   2069
C                                                                       USBRKR   2070
      END IF                                                            USBRKR   2071
C                                                                       USBRKR   2072
C                                                                       USBRKR   2073
C                                                                       USBRKR   2074
C     Determine the UDC based on what subtype is stored.                USBRKR   2075
C                                                                       USBRKR   2076
C                                                                       USBRKR   2077
C     SIN subtype.                                                      USBRKR   2078
C                                                                       USBRKR   2079
      IF(IUDSUB(JBLK).EQ.ISINS)THEN                                     USBRKR   2080
         UDVAL(JBLK) = SIN(VALUE)                                       USBRKR   2081
C                                                                       USBRKR   2082
C                                                                       USBRKR   2083
C     COS subtype.                                                      USBRKR   2084
C                                                                       USBRKR   2085
      ELSEIF(IUDSUB(JBLK).EQ.ICOSS)THEN                                 USBRKR   2086
         UDVAL(JBLK) = COS(VALUE)                                       USBRKR   2087
C                                                                       USBRKR   2088
C                                                                       USBRKR   2089
C     TAN subtype.                                                      USBRKR   2090
C                                                                       USBRKR   2091
      ELSEIF(IUDSUB(JBLK).EQ.ITANS)THEN                                 USBRKR   2092
         UDVAL(JBLK) = TAN(VALUE)                                       USBRKR   2093
C                                                                       USBRKR   2094
C                                                                       USBRKR   2095
C     ASIN subtype.                                                     USBRKR   2096
C                                                                       USBRKR   2097
      ELSEIF(IUDSUB(JBLK).EQ.IASINS)THEN                                USBRKR   2098
         IF(ABS(VALUE).GT.1.0)THEN                                      USBRKR   2099
            WRITE(MSG(1),9202) 'ASIN', VALUE                            USBRKR   2100
            CALL PRTMSG(1)                                              USBRKR   2101
            VALUE = SIGN(1.0,VALUE)                                     USBRKR   2102
         ENDIF                                                          USBRKR   2103
         UDVAL(JBLK) = ASIN(VALUE)                                      USBRKR   2104
C                                                                       USBRKR   2105
C                                                                       USBRKR   2106
C     ACOS subtype.                                                     USBRKR   2107
C                                                                       USBRKR   2108
      ELSEIF(IUDSUB(JBLK).EQ.IACOSS)THEN                                USBRKR   2109
         IF(ABS(VALUE).GT.1.0)THEN                                      USBRKR   2110
            WRITE(MSG(1),9202) 'ACOS', VALUE                            USBRKR   2111
            CALL PRTMSG(1)                                              USBRKR   2112
            VALUE = SIGN(1.0,VALUE)                                     USBRKR   2113
         ENDIF                                                          USBRKR   2114
         UDVAL(JBLK) = ACOS(VALUE)                                      USBRKR   2115
C                                                                       USBRKR   2116
C                                                                       USBRKR   2117
C     SINH subtype.                                                     USBRKR   2118
C                                                                       USBRKR   2119
      ELSEIF(IUDSUB(JBLK).EQ.ISINHS)THEN                                USBRKR   2120
         UDVAL(JBLK) = SINH(VALUE)                                      USBRKR   2121
C                                                                       USBRKR   2122
C                                                                       USBRKR   2123
C     COSH subtype.                                                     USBRKR   2124
C                                                                       USBRKR   2125
      ELSEIF(IUDSUB(JBLK).EQ.ICOSHS)THEN                                USBRKR   2126
         UDVAL(JBLK) = COSH(VALUE)                                      USBRKR   2127
C                                                                       USBRKR   2128
C                                                                       USBRKR   2129
C     TANH subtype.                                                     USBRKR   2130
C                                                                       USBRKR   2131
      ELSEIF(IUDSUB(JBLK).EQ.ITANHS)THEN                                USBRKR   2132
         UDVAL(JBLK) = TANH(VALUE)                                      USBRKR   2133
C                                                                       USBRKR   2134
C                                                                       USBRKR   2135
C     ABS subtype.                                                      USBRKR   2136
C                                                                       USBRKR   2137
      ELSEIF(IUDSUB(JBLK).EQ.IABSS)THEN                                 USBRKR   2138
         UDVAL(JBLK) = ABS(VALUE)                                       USBRKR   2139
C                                                                       USBRKR   2140
C                                                                       USBRKR   2141
C     EXP subtype.                                                      USBRKR   2142
C                                                                       USBRKR   2143
      ELSEIF(IUDSUB(JBLK).EQ.IEXPS)THEN                                 USBRKR   2144
         UDVAL(JBLK) = EXP(VALUE)                                       USBRKR   2145
C                                                                       USBRKR   2146
C                                                                       USBRKR   2147
C     LOG subtype.                                                      USBRKR   2148
C                                                                       USBRKR   2149
      ELSEIF(IUDSUB(JBLK).EQ.ILOGS)THEN                                 USBRKR   2150
         IF(VALUE.LE.0.0)THEN                                           USBRKR   2151
            WRITE(MSG(1),9202) 'LOG', VALUE                             USBRKR   2152
            CALL PRTMSG(1)                                              USBRKR   2153
            VALUE = 1.0E-10                                             USBRKR   2154
         ENDIF                                                          USBRKR   2155
         UDVAL(JBLK) = LOG(VALUE)                                       USBRKR   2156
C                                                                       USBRKR   2157
C                                                                       USBRKR   2158
C     INV subtype.                                                      USBRKR   2159
C                                                                       USBRKR   2160
      ELSEIF(IUDSUB(JBLK).EQ.INVS)THEN                                  USBRKR   2161
         IF(VALUE.EQ.0.0)THEN                                           USBRKR   2162
            WRITE(MSG(1),9202) 'INV', VALUE                             USBRKR   2163
            CALL PRTMSG(1)                                              USBRKR   2164
            VALUE = 1.0E-10                                             USBRKR   2165
         ENDIF                                                          USBRKR   2166
         UDVAL(JBLK) = 1.0 / VALUE                                      USBRKR   2167
C                                                                       USBRKR   2168
C                                                                       USBRKR   2169
C     IUDNOL subtype.                                                   USBRKR   2170
C                                                                       USBRKR   2171
      ELSEIF(IUDSUB(JBLK).EQ.IUDNOL)THEN                                USBRKR   2172
         NEXTP = IUDPPT(JBLK)                                           USBRKR   2173
         X1 = UDPARM(NEXTP)                                             USBRKR   2174
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   2175
         Y1 = UDPARM(NEXTP)                                             USBRKR   2176
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   2177
C                                                                       USBRKR   2178
C        Find next defined point of the curve.                          USBRKR   2179
C                                                                       USBRKR   2180
         X2 = UDPARM(NEXTP)                                             USBRKR   2181
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   2182
         Y2 = UDPARM(NEXTP)                                             USBRKR   2183
         NEXTP = IUDPNX(NEXTP)                                          USBRKR   2184
C                                                                       USBRKR   2185
         IF(VALUE .LT. X1)THEN                                          USBRKR   2186
            UDVAL(JBLK) = Y1 - (X1 - VALUE) * (Y2 - Y1) /               USBRKR   2187
     1                   (X2 - X1)                                      USBRKR   2188
            END = .TRUE.                                                USBRKR   2189
         ELSE                                                           USBRKR   2190
            END = .FALSE.                                               USBRKR   2191
         END IF                                                         USBRKR   2192
C                                                                       USBRKR   2193
620      IF(END) GOTO 640                                               USBRKR   2194
            IF(VALUE .GE. X1.AND.VALUE .LE. X2)THEN                     USBRKR   2195
               UDVAL(JBLK) = Y1 + (VALUE - X1) / (X2 - X1) *            USBRKR   2196
     1                      (Y2 - Y1)                                   USBRKR   2197
               END = .TRUE.                                             USBRKR   2198
C                                                                       USBRKR   2199
            ELSEIF(NEXTP.EQ.0)THEN                                      USBRKR   2200
C                                                                       USBRKR   2201
C              Point is outside of the defined curve.                   USBRKR   2202
C                                                                       USBRKR   2203
               UDVAL(JBLK) = Y2 + (VALUE - X2) * (Y2 - Y1) /            USBRKR   2204
     1                      (X2 - X1)                                   USBRKR   2205
               END = .TRUE.                                             USBRKR   2206
C                                                                       USBRKR   2207
            ELSE                                                        USBRKR   2208
C                                                                       USBRKR   2209
C              Find next defined point on the curve.                    USBRKR   2210
C                                                                       USBRKR   2211
               X1 = X2                                                  USBRKR   2212
               Y1 = Y2                                                  USBRKR   2213
               X2 = UDPARM(NEXTP)                                       USBRKR   2214
               NEXTP = IUDPNX(NEXTP)                                    USBRKR   2215
               Y2 = UDPARM(NEXTP)                                       USBRKR   2216
               NEXTP = IUDPNX(NEXTP)                                    USBRKR   2217
            END IF                                                      USBRKR   2218
            GOTO 620                                                    USBRKR   2219
640      CONTINUE                                                       USBRKR   2220
C                                                                       USBRKR   2221
      END IF                                                            USBRKR   2222
C                                                                       USBRKR   2223
C                                                                       USBRKR   2224
      IF(IUDSUB(JBLK).EQ.IASINS .OR. IUDSUB(JBLK).EQ.IACOSS)THEN        USBRKR   2225
C                                                                       USBRKR   2226
C        Convert the answer from radians to degrees.                    USBRKR   2227
C                                                                       USBRKR   2228
         UDVAL(JBLK) = UDVAL(JBLK) * 180.0/PII                          USBRKR   2229
      END IF                                                            USBRKR   2230
C                                                                       USBRKR   2231
      RETURN                                                            USBRKR   2232
C                                                                       USBRKR   2233
9202  FORMAT(' *** INPUT TO FUNCTION ', A, ' INCORRECT AS: ', F12.3)    USBRKR   2234
C                                                                       USBRKR   2235
      END                                                               USBRKR   2236
