CFPRIME UIBIN                                                           UIBIN       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  UIBIN (JBLK)                                          UIBIN       3
CD -------------------------------------------------------------------  UIBIN       4
CD                                                                      UIBIN       5
CD              *****     UIBIN   ROUTINE   *****                       UIBIN       6
CD                                                                      UIBIN       7
CD -------------------------------------------------------------------  UIBIN       8
CD                                                                      UIBIN       9
CD       PURPOSE:  Performs the initialization of the udc type BINARY.  UIBIN      10
CD                                                                      UIBIN      11
CD                                                                      UIBIN      12
CD       DEFINITION OF LOCAL VARIABLES:                                 UIBIN      13
CD          (P)    BLK    -  current udc block.                         UIBIN      14
CD                 BNAME  -  current udc block name.                    UIBIN      15
CD                 LEN    -  length of current udc block name.          UIBIN      16
CD                 MISS   -  used for printing error messages.          UIBIN      17
CD                 SUBNAM -  subroutine name.                           UIBIN      18
CD                 TNAME  -  udc type name.                             UIBIN      19
CD                 VALUE1 -  first operand of binary function.          UIBIN      20
CD                 VALUE2 -  second operand of binary function.         UIBIN      21
CD                                                                      UIBIN      22
CD -------------------------------------------------------------------  UIBIN      23
C                                                                       UIBIN      24
      INCLUDE 'PARX.INS'                                                UIBIN      25
      INCLUDE 'CNFLAG.INS'                                              UIBIN      26
      INCLUDE 'CNUNIT.INS'                                              UIBIN      27
      INCLUDE 'CNMSG.INS'                                               UIBIN      28
      INCLUDE 'CNPARX.INS'                                              UIBIN      29
      INCLUDE 'UDCA.INS'                                                UIBIN      30
      INCLUDE 'UDCC.INS'                                                UIBIN      31
      INCLUDE 'UDCE.INS'                                                UIBIN      32
      INCLUDE 'UDCF.INS'                                                UIBIN      33
      INCLUDE 'UDCG.INS'                                                UIBIN      34
      INCLUDE 'UDCH.INS'                                                UIBIN      35
      INCLUDE 'UDCI.INS'                                                UIBIN      36
      INCLUDE 'UDCJ.INS'                                                UIBIN      37
      INCLUDE 'GRDC01.INS'                                              UIBIN      38
      INCLUDE 'GRDC03.INS'                                              UIBIN      39
C                                                                       UIBIN      40
      LOGICAL       DONE, OK, ERROR, LIMIT, OKEY                        UIBIN      41
      LOGICAL       ALF, CUR, GAM, LOGEXP, VOL                          UIBIN      42
C                                                                       UIBIN      43
      DIMENSION     XINPUT(20),OUTPUT(10)                               UIBIN      44
      DIMENSION AA(11), B(10), C(10), CC(10)                            UIBIN      45
C                                                                       UIBIN      46
      DOUBLE PRECISION    A(10,10)                                      UIBIN      47
C                                                                       UIBIN      48
      CHARACTER*72  STRING                                              UIBIN      49
      CHARACTER*20  SUBNAM                                              UIBIN      50
      CHARACTER*17  BNAME                                               UIBIN      51
      CHARACTER*15  MISS                                                UIBIN      52
      CHARACTER*8   NAM1, NAM2, TNAME                                   UIBIN      53
      CHARACTER*2   OPER                                                UIBIN      54
      CHARACTER*1   MODE                                                UIBIN      55
C                                                                       UIBIN      56
      INCLUDE 'GRBIN.INS'                                               UIBIN      57
      INCLUDE 'GRFRAC.INS'                                              UIBIN      58
      INCLUDE 'GRFRDC.INS'                                              UIBIN      59
      INCLUDE 'GRMLTP.INS'                                              UIBIN      60
      INCLUDE 'GRSBLK.INS'                                              UIBIN      61
      INCLUDE 'GRSRCE.INS'                                              UIBIN      62
C                                                                       UIBIN      63
      DATA              JGROUN /0/                                      UIBIN      64
C                                                                       UIBIN      65
C---------------------------------------------------------------------  UIBIN      66
C                                                                       UIBIN      67
      LDEB=.FALSE.                                                      UIBIN      68
C                                                                       UIBIN      69
      IF(SDBG)THEN                                                      UIBIN      70
         SUBNAM = 'UIBIN ROUTINE.'                                      UIBIN      71
      ELSE                                                              UIBIN      72
         SUBNAM = ' '                                                   UIBIN      73
      END IF                                                            UIBIN      74
      TNAME = TPNAME(IBINAR)                                            UIBIN      75
      BNAME = UDNAME(JBLK)                                              UIBIN      76
      LEN = IUDLEN(JBLK)                                                UIBIN      77
C                                                                       UIBIN      78
C     Retrieve input values.                                            UIBIN      79
C                                                                       UIBIN      80
      NEXTI = IUNIPT(JBLK)                                              UIBIN      81
      NEXTP = IUDPPT(JBLK)                                              UIBIN      82
C                                                                       UIBIN      83
      IF(NEXTI.EQ.0 .OR. NEXTP.EQ.0)THEN                                UIBIN      84
C                                                                       UIBIN      85
C        No input1 was stored.                                          UIBIN      86
C                                                                       UIBIN      87
         MISS = 'INPUT 1'                                               UIBIN      88
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN      89
         WRITE(MSG(2),9001) TNAME                                       UIBIN      90
         WRITE(MSG(3),9002) MISS                                        UIBIN      91
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN      92
         WRITE(MSG(5),9004)                                             UIBIN      93
         CALL PRTMSG(5)                                                 UIBIN      94
         IERCNT = IERCNT + 1                                            UIBIN      95
      ELSE                                                              UIBIN      96
         IF(UIDENT(NEXTI) .NE. ' ')THEN                                 UIBIN      97
            VALUE1 = UDVAL(IUDINT(NEXTI))                               UIBIN      98
         ELSE                                                           UIBIN      99
            VALUE1 = UDPARM(NEXTP)                                      UIBIN     100
         END IF                                                         UIBIN     101
C                                                                       UIBIN     102
         NEXTI = IUDINX(NEXTI)                                          UIBIN     103
         NEXTP = IUDPNX(NEXTP)                                          UIBIN     104
      END IF                                                            UIBIN     105
C                                                                       UIBIN     106
C                                                                       UIBIN     107
      IF(NEXTI.EQ.0 .OR. NEXTP.EQ.0)THEN                                UIBIN     108
C                                                                       UIBIN     109
C        No input2 was stored.                                          UIBIN     110
C                                                                       UIBIN     111
         MISS = 'INPUT 2'                                               UIBIN     112
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN     113
         WRITE(MSG(2),9001) TNAME                                       UIBIN     114
         WRITE(MSG(3),9002) MISS                                        UIBIN     115
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN     116
         WRITE(MSG(5),9004)                                             UIBIN     117
         CALL PRTMSG(5)                                                 UIBIN     118
         IERCNT = IERCNT + 1                                            UIBIN     119
      ELSE                                                              UIBIN     120
         IF(UIDENT(NEXTI) .NE. ' ')THEN                                 UIBIN     121
            VALUE2 = UDVAL(IUDINT(NEXTI))                               UIBIN     122
         ELSE                                                           UIBIN     123
            VALUE2 = UDPARM(NEXTP)                                      UIBIN     124
         END IF                                                         UIBIN     125
C                                                                       UIBIN     126
C        Calculate UDVAL.                                               UIBIN     127
C                                                                       UIBIN     128
C                                                                       UIBIN     129
C        PLUS subtype.                                                  UIBIN     130
C                                                                       UIBIN     131
         IF(IUDSUB(JBLK).EQ.IPLUSS)THEN                                 UIBIN     132
            UDVAL(JBLK) = VALUE1 + VALUE2                               UIBIN     133
C                                                                       UIBIN     134
C                                                                       UIBIN     135
C        MINUS subtype.                                                 UIBIN     136
C                                                                       UIBIN     137
         ELSEIF(IUDSUB(JBLK).EQ.MINUSS)THEN                             UIBIN     138
            UDVAL(JBLK) = VALUE1 - VALUE2                               UIBIN     139
C                                                                       UIBIN     140
C        MULT subtype.                                                  UIBIN     141
C                                                                       UIBIN     142
         ELSEIF(IUDSUB(JBLK).EQ.MULTS)THEN                              UIBIN     143
            UDVAL(JBLK) = VALUE1 * VALUE2                               UIBIN     144
C                                                                       UIBIN     145
C                                                                       UIBIN     146
C        DIV subtype.                                                   UIBIN     147
C                                                                       UIBIN     148
         ELSEIF(IUDSUB(JBLK).EQ.IDIVS)THEN                              UIBIN     149
            IF(VALUE2 .NE. 0)THEN                                       UIBIN     150
               UDVAL(JBLK) = VALUE1 / VALUE2                            UIBIN     151
            ELSE                                                        UIBIN     152
               UDVAL(JBLK) = 99.0                                       UIBIN     153
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN     154
         WRITE(MSG(2),9001) TNAME                                       UIBIN     155
         WRITE(MSG(3),9005) BNAME(1:LEN)                                UIBIN     156
         WRITE(MSG(4),9900)                                             UIBIN     157
         CALL PRTMSG(4)                                                 UIBIN     158
               IERCNT = IERCNT + 1                                      UIBIN     159
            END IF                                                      UIBIN     160
C                                                                       UIBIN     161
C                                                                       UIBIN     162
C        Power subtype.                                                 UIBIN     163
C                                                                       UIBIN     164
         ELSEIF(IUDSUB(JBLK).EQ.IPOWER)THEN                             UIBIN     165
            IF(VALUE1 .LT. 0.0)THEN                                     UIBIN     166
               VALUE1 = 0.0                                             UIBIN     167
            END IF                                                      UIBIN     168
            UDVAL(JBLK) = VALUE1 ** VALUE2                              UIBIN     169
C                                                                       UIBIN     170
C                                                                       UIBIN     171
C        Invalid subtype.                                               UIBIN     172
C                                                                       UIBIN     173
         ELSE                                                           UIBIN     174
            UDVAL(JBLK) = 0.0                                           UIBIN     175
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN     176
         WRITE(MSG(2),9001) TNAME                                       UIBIN     177
         WRITE(MSG(3),9006)                                             UIBIN     178
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN     179
         WRITE(MSG(5),9004)                                             UIBIN     180
         CALL PRTMSG(5)                                                 UIBIN     181
            IERCNT = IERCNT + 1                                         UIBIN     182
         END IF                                                         UIBIN     183
      END IF                                                            UIBIN     184
C                                                                       UIBIN     185
      RETURN                                                            UIBIN     186
C                                                                       UIBIN     187
C                                                                       UIBIN     188
C---------------------------------------------------------------------  UIBIN     189
C                                                                       UIBIN     190
      ENTRY UIFORT (JBLK)                                               UIBIN     191
CD -------------------------------------------------------------------  UIBIN     192
CD                                                                      UIBIN     193
CD              *****     UIFORT  ROUTINE   *****                       UIBIN     194
CD                                                                      UIBIN     195
CD -------------------------------------------------------------------  UIBIN     196
CD                                                                      UIBIN     197
CD       PURPOSE:  Performs the initialization of the udc type FORTRN.  UIBIN     198
CD                                                                      UIBIN     199
CD -------------------------------------------------------------------  UIBIN     200
C                                                                       UIBIN     201
      IF(SDBG)THEN                                                      UIBIN     202
         SUBNAM = 'UIFORT ROUTINE.'                                     UIBIN     203
      ELSE                                                              UIBIN     204
         SUBNAM = ' '                                                   UIBIN     205
      END IF                                                            UIBIN     206
C                                                                       UIBIN     207
      MODE = 'I'                                                        UIBIN     208
      MAXIN = 20                                                        UIBIN     209
      MAXOUT = 10                                                       UIBIN     210
C                                                                       UIBIN     211
      TNAME = TPNAME(IFRTRA)                                            UIBIN     212
      BNAME = UDNAME(JBLK)                                              UIBIN     213
      LEN = IUDLEN(JBLK)                                                UIBIN     214
C                                                                       UIBIN     215
      I = 0                                                             UIBIN     216
      NEXTI = IUNIPT(JBLK)                                              UIBIN     217
      NEXTP = IUDPPT(JBLK)                                              UIBIN     218
C                                                                       UIBIN     219
C     Retrieve all input values for the FORTRAN routine and store       UIBIN     220
C     them in the input array                                           UIBIN     221
C                                                                       UIBIN     222
100   CONTINUE                                                          UIBIN     223
      DONE = (NEXTI.EQ.0) .OR. (NEXTP.EQ.0)                             UIBIN     224
      IF(DONE) GOTO 110                                                 UIBIN     225
C                                                                       UIBIN     226
      I = I + 1                                                         UIBIN     227
      IF(I .GT. MAXIN)THEN                                              UIBIN     228
         IERCNT = IERCNT + 1                                            UIBIN     229
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN     230
         WRITE(MSG(2),9104)                                             UIBIN     231
         WRITE(MSG(3),9106) I,BNAME(1:LEN)                              UIBIN     232
         WRITE(MSG(4),9107) MAXIN                                       UIBIN     233
         CALL PRTMSG(4)                                                 UIBIN     234
         GOTO 110                                                       UIBIN     235
      END IF                                                            UIBIN     236
C                                                                       UIBIN     237
      IF(UIDENT(NEXTI) .NE. ' ')THEN                                    UIBIN     238
         XINPUT(I) = UDVAL(IUDINT(NEXTI))                               UIBIN     239
      ELSE                                                              UIBIN     240
         XINPUT(I) = UDPARM(NEXTP)                                      UIBIN     241
      END IF                                                            UIBIN     242
C                                                                       UIBIN     243
      NEXTI = IUDINX(NEXTI)                                             UIBIN     244
      NEXTP = IUDPNX(NEXTP)                                             UIBIN     245
      GOTO 100                                                          UIBIN     246
C                                                                       UIBIN     247
110   CONTINUE                                                          UIBIN     248
C                                                                       UIBIN     249
C     If no input parameters were found then issue a warning message.   UIBIN     250
C                                                                       UIBIN     251
      IF(I.EQ.0)THEN                                                    UIBIN     252
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN     253
         WRITE(MSG(2),9104)                                             UIBIN     254
         WRITE(MSG(3),9105) BNAME(1:LEN)                                UIBIN     255
         CALL PRTMSG(3)                                                 UIBIN     256
      END IF                                                            UIBIN     257
C                                                                       UIBIN     258
      CALL FORTRN(JBLK,XINPUT,OUTPUT,MODE)                              UIBIN     259
C                                                                       UIBIN     260
C     Get the number of output parameters for this routine.             UIBIN     261
C                                                                       UIBIN     262
      NUM = ISBFNU(IUDSUB(JBLK))                                        UIBIN     263
C                                                                       UIBIN     264
C     If no output parameters were found then issue an error message.   UIBIN     265
C                                                                       UIBIN     266
      IF(NUM .LT. 1 .OR. NUM .GT. MAXOUT)THEN                           UIBIN     267
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN     268
         WRITE(MSG(2),9104)                                             UIBIN     269
         WRITE(MSG(3),9108) NUM,BNAME(1:LEN)                            UIBIN     270
         WRITE(MSG(4),9109) MAXOUT                                      UIBIN     271
         CALL PRTMSG(4)                                                 UIBIN     272
         IERCNT = IERCNT + 1                                            UIBIN     273
         IF(NUM .GT. MAXOUT) NUM = MAXOUT                               UIBIN     274
      END IF                                                            UIBIN     275
C                                                                       UIBIN     276
C     Search the FRTNAM array to locate this particular block.          UIBIN     277
C                                                                       UIBIN     278
      JPTR = 0                                                          UIBIN     279
      DO 115 I=1,IFRTBK                                                 UIBIN     280
         IF(UDNAME(JBLK).EQ.FRTNAM(I))THEN                              UIBIN     281
            JPTR = IDUMPT(I)                                            UIBIN     282
         END IF                                                         UIBIN     283
115   CONTINUE                                                          UIBIN     284
C                                                                       UIBIN     285
      IF(JPTR.EQ.0)THEN                                                 UIBIN     286
         IERCNT = IERCNT + 1                                            UIBIN     287
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN     288
         WRITE(MSG(2),9104)                                             UIBIN     289
         WRITE(MSG(3),9108) NUM,BNAME(1:LEN)                            UIBIN     290
         WRITE(MSG(4),9109) MAXOUT                                      UIBIN     291
         CALL PRTMSG(4)                                                 UIBIN     292
      ELSE                                                              UIBIN     293
C                                                                       UIBIN     294
C        Store the output values in the corresponding DUMMY blocks.     UIBIN     295
C                                                                       UIBIN     296
         DO 120 I=1,NUM                                                 UIBIN     297
            UDVAL(IDUMBK(JPTR)) = OUTPUT(I)                             UIBIN     298
            JPTR = JPTR + 1                                             UIBIN     299
120      CONTINUE                                                       UIBIN     300
      END IF                                                            UIBIN     301
C                                                                       UIBIN     302
      RETURN                                                            UIBIN     303
C                                                                       UIBIN     304
C                                                                       UIBIN     305
C---------------------------------------------------------------------  UIBIN     306
C                                                                       UIBIN     307
      ENTRY UIINTF (JBLK, OKEY)                                         UIBIN     308
CD -------------------------------------------------------------------  UIBIN     309
CD                                                                      UIBIN     310
CD              *****     UIINTF  ROUTINE   *****                       UIBIN     311
CD                                                                      UIBIN     312
CD -------------------------------------------------------------------  UIBIN     313
CD                                                                      UIBIN     314
CD       PURPOSE:  Performs initialization of udc type INTERFACE.       UIBIN     315
CD                                                                      UIBIN     316
CD -------------------------------------------------------------------  UIBIN     317
C                                                                       UIBIN     318
      IF(SDBG)THEN                                                      UIBIN     319
         SUBNAM = 'UIINTF ROUTINE.'                                     UIBIN     320
      ELSE                                                              UIBIN     321
         SUBNAM = ' '                                                   UIBIN     322
      END IF                                                            UIBIN     323
      TNAME = TPNAME(INTERF)                                            UIBIN     324
      BNAME = UDNAME(JBLK)                                              UIBIN     325
      LEN = IUDLEN(JBLK)                                                UIBIN     326
C                                                                       UIBIN     327
      OKEY = .TRUE.                                                     UIBIN     328
      CALC = 0.0                                                        UIBIN     329
      DESIRE = 0.0                                                      UIBIN     330
C                                                                       UIBIN     331
C     Determine the converter number.                                   UIBIN     332
C                                                                       UIBIN     333
      NEXTI = IUNIPT(JBLK)                                              UIBIN     334
      IF(NEXTI.EQ.0)THEN                                                UIBIN     335
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN     336
         WRITE(MSG(2),9001) TNAME                                       UIBIN     337
         WRITE(MSG(3),9312)                                             UIBIN     338
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN     339
         WRITE(MSG(5),9004)                                             UIBIN     340
         CALL PRTMSG(5)                                                 UIBIN     341
         IERCNT = IERCNT + 1                                            UIBIN     342
         NUMBER = 0                                                     UIBIN     343
         OKEY = .FALSE.                                                 UIBIN     344
      ELSE                                                              UIBIN     345
         NUMBER = IUDINT(NEXTI)                                         UIBIN     346
         NEXTI = IUDINX(NEXTI)                                          UIBIN     347
      END IF                                                            UIBIN     348
C                                                                       UIBIN     349
      IF(OKEY)THEN                                                      UIBIN     350
         CALC = 0.0                                                     UIBIN     351
         ALF = .FALSE.                                                  UIBIN     352
         CUR = .FALSE.                                                  UIBIN     353
         GAM = .FALSE.                                                  UIBIN     354
         VOL = .FALSE.                                                  UIBIN     355
         OKEY = .FALSE.                                                 UIBIN     356
C                                                                       UIBIN     357
         NEXTR = IUDRPT(JBLK)                                           UIBIN     358
         NEXTP = IUDPPT(JBLK)                                           UIBIN     359
         DONE = .FALSE.                                                 UIBIN     360
         IDONE = 0                                                      UIBIN     361
140      IF(NEXTR.EQ.0 .OR. NEXTI.EQ.0 .OR. DONE .OR.                   UIBIN     362
     1       NEXTP.EQ.0) GOTO 160                                       UIBIN     363
C                                                                       UIBIN     364
            IF(UDRKW(NEXTR).EQ.'ALPHA' .OR.                             UIBIN     365
     1          UDRKW(NEXTR).EQ.'GAMMA' .OR.                            UIBIN     366
     2          UDRKW(NEXTR).EQ.'VOLTAGE' .OR.                          UIBIN     367
     3          UDRKW(NEXTR).EQ.'CURRENT' .OR.                          UIBIN     368
     4          UDRKW(NEXTR).EQ.'BLOCK' .OR.                            UIBIN     369
     5          UDRKW(NEXTR).EQ.'BYPASS' .OR.                           UIBIN     370
     6          UDRKW(NEXTR).EQ.'COMFAIL')THEN                          UIBIN     371
C                                                                       UIBIN     372
C              Evaluate the logical expression if one exists.           UIBIN     373
C                                                                       UIBIN     374
               IF(IUDBNM(NEXTR) .LE. 0)THEN                             UIBIN     375
                  VALUE1 = UDPRM1(NEXTR)                                UIBIN     376
               ELSE                                                     UIBIN     377
                  VALUE1 = UDVAL(IUDBNM(NEXTR))                         UIBIN     378
               END IF                                                   UIBIN     379
               OPER = UDRELA(NEXTR)                                     UIBIN     380
               IF(JUDBNM(NEXTR) .LE. 0)THEN                             UIBIN     381
                  VALUE2 = UDPRM2(NEXTR)                                UIBIN     382
               ELSE                                                     UIBIN     383
                  VALUE2 = UDVAL(JUDBNM(NEXTR))                         UIBIN     384
               END IF                                                   UIBIN     385
C                                                                       UIBIN     386
               LOGEXP = .FALSE.                                         UIBIN     387
               IF(OPER.EQ.'EQ')THEN                                     UIBIN     388
                  IF(VALUE1.EQ.VALUE2)  LOGEXP = .TRUE.                 UIBIN     389
               ELSEIF(OPER.EQ.'NE')THEN                                 UIBIN     390
                  IF(VALUE1 .NE. VALUE2)  LOGEXP = .TRUE.               UIBIN     391
               ELSEIF(OPER.EQ.'LE')THEN                                 UIBIN     392
                  IF(VALUE1 .LE. VALUE2)  LOGEXP = .TRUE.               UIBIN     393
               ELSEIF(OPER.EQ.'LT')THEN                                 UIBIN     394
                  IF(VALUE1 .LT. VALUE2)  LOGEXP = .TRUE.               UIBIN     395
               ELSEIF(OPER.EQ.'GE')THEN                                 UIBIN     396
                  IF(VALUE1 .GE. VALUE2)  LOGEXP = .TRUE.               UIBIN     397
               ELSEIF(OPER.EQ.'GT')THEN                                 UIBIN     398
                  IF(VALUE1 .GT. VALUE2)  LOGEXP = .TRUE.               UIBIN     399
               ELSE                                                     UIBIN     400
                  LOGEXP = .TRUE.                                       UIBIN     401
               END IF                                                   UIBIN     402
C                                                                       UIBIN     403
C                                                                       UIBIN     404
               IF(UDRKW(NEXTR).EQ.'VOLTAGE')THEN                        UIBIN     405
                  IF(.NOT. VOL.AND.LOGEXP)THEN                          UIBIN     406
                     VOL = .TRUE.                                       UIBIN     407
                     IF(UIDENT(NEXTI) .NE. ' ')THEN                     UIBIN     408
                        JVBLK = IUDINT(NEXTI)                           UIBIN     409
                        VVAL = 0.0                                      UIBIN     410
                     ELSE                                               UIBIN     411
                        JVBLK = 0                                       UIBIN     412
                        VVAL = UDPARM(NEXTP)                            UIBIN     413
                     END IF                                             UIBIN     414
                  END IF                                                UIBIN     415
C                                                                       UIBIN     416
               ELSEIF(UDRKW(NEXTR).EQ.'CURRENT')THEN                    UIBIN     417
                  IF(.NOT. CUR.AND.LOGEXP)THEN                          UIBIN     418
                     CUR = .TRUE.                                       UIBIN     419
                     IF(UIDENT(NEXTI) .NE. ' ')THEN                     UIBIN     420
                        JCBLK = IUDINT(NEXTI)                           UIBIN     421
                        CVAL = 0.0                                      UIBIN     422
                     ELSE                                               UIBIN     423
                        JCBLK = 0                                       UIBIN     424
                        CVAL = UDPARM(NEXTP)                            UIBIN     425
                     END IF                                             UIBIN     426
                  END IF                                                UIBIN     427
C                                                                       UIBIN     428
               ELSEIF(UDRKW(NEXTR).EQ.'ALPHA')THEN                      UIBIN     429
                  IF(.NOT. ALF.AND.LOGEXP)THEN                          UIBIN     430
                     ALF = .TRUE.                                       UIBIN     431
                     IF(UIDENT(NEXTI) .NE. ' ')THEN                     UIBIN     432
                        JABLK = IUDINT(NEXTI)                           UIBIN     433
                        AVAL = 0.0                                      UIBIN     434
                     ELSE                                               UIBIN     435
                        JABLK = 0                                       UIBIN     436
                        AVAL = UDPARM(NEXTP)                            UIBIN     437
                     END IF                                             UIBIN     438
                  END IF                                                UIBIN     439
C                                                                       UIBIN     440
               ELSEIF(UDRKW(NEXTR).EQ.'GAMMA')THEN                      UIBIN     441
                  IF(.NOT. GAM.AND.LOGEXP)THEN                          UIBIN     442
                     GAM = .TRUE.                                       UIBIN     443
                     IF(UIDENT(NEXTI) .NE. ' ')THEN                     UIBIN     444
                        JGBLK = IUDINT(NEXTI)                           UIBIN     445
                        GVAL = 0.0                                      UIBIN     446
                     ELSE                                               UIBIN     447
                        JGBLK = 0                                       UIBIN     448
                        GVAL = UDPARM(NEXTP)                            UIBIN     449
                     END IF                                             UIBIN     450
                  END IF                                                UIBIN     451
               END IF                                                   UIBIN     452
C                                                                       UIBIN     453
C                                                                       UIBIN     454
C                                                                       UIBIN     455
            ELSE                                                        UIBIN     456
               IF(UDRKW(NEXTR).EQ.'INITIAL')THEN                        UIBIN     457
                  LASTR = NEXTR                                         UIBIN     458
C                                                                       UIBIN     459
C                 Determine the desired value.                          UIBIN     460
C                                                                       UIBIN     461
                  IF(JUDBNM(NEXTR) .GT. 0)THEN                          UIBIN     462
C                                                                       UIBIN     463
C                    Output value for a specified block name.           UIBIN     464
C                                                                       UIBIN     465
                     DESIRE = UDVAL(JUDBNM(NEXTR))                      UIBIN     466
C                                                                       UIBIN     467
                  ELSEIF(JUDBNM(NEXTR) .LT. 0)THEN                      UIBIN     468
C                                                                       UIBIN     469
C                    Inputted desired value from UDC card.              UIBIN     470
C                                                                       UIBIN     471
                     DESIRE = UDPRM2(NEXTR)                             UIBIN     472
C                                                                       UIBIN     473
                  ELSE                                                  UIBIN     474
C                                                                       UIBIN     475
C                    Value is determined using the dc converter name.   UIBIN     476
C                                                                       UIBIN     477
                     IF(UDRELA(NEXTR).EQ.'VOLTAGE')THEN                 UIBIN     478
                        DESIRE = VDCONV(NUMBER)                         UIBIN     479
                     ELSEIF(UDRELA(NEXTR).EQ.'CURRENT')THEN             UIBIN     480
                        DESIRE = XDCONV(NUMBER) * 1000.0                UIBIN     481
                     ELSEIF(UDRELA(NEXTR).EQ.'ALPHA')THEN               UIBIN     482
                        IF(IABS(ICTYPE(NUMBER)) .EQ. 1) THEN            UIBIN     483
                           DESIRE = ACOS(CALPHA(NUMBER)) * 180.0/PII    UIBIN     484
                        ELSE                                            UIBIN     485
                           DESIRE = CALPHA(NUMBER) * 180.0/PII          UIBIN     486
                        ENDIF                                           UIBIN     487
                     ELSEIF(UDRELA(NEXTR).EQ.'GAMMA')THEN               UIBIN     488
                        IF(IABS(ICTYPE(NUMBER)) .EQ. 1) THEN            UIBIN     489
                           DESIRE = ACOS(CGAMMA(NUMBER)) * 180.0/PII    UIBIN     490
                        ELSE                                            UIBIN     491
                           DESIRE = CGAMMA(NUMBER)                      UIBIN     492
                        ENDIF                                           UIBIN     493
                     END IF                                             UIBIN     494
                  END IF                                                UIBIN     495
C                                                                       UIBIN     496
C                                                                       UIBIN     497
C                 The matching calculated value for this initial must   UIBIN     498
C                 have been found.                                      UIBIN     499
C                                                                       UIBIN     500
                  IF(UDRELA(NEXTR).EQ.'VOLTAGE')THEN                    UIBIN     501
                     IF(.NOT. VOL)THEN                                  UIBIN     502
                        OKEY = .FALSE.                                  UIBIN     503
                     ELSE                                               UIBIN     504
                        OKEY = .TRUE.                                   UIBIN     505
                        IF(JVBLK.EQ.0)THEN                              UIBIN     506
                           CALC = VVAL                                  UIBIN     507
                        ELSE                                            UIBIN     508
                           CALC = UDVAL(JVBLK)                          UIBIN     509
                        END IF                                          UIBIN     510
                     END IF                                             UIBIN     511
C                                                                       UIBIN     512
                  ELSEIF(UDRELA(NEXTR).EQ.'CURRENT')THEN                UIBIN     513
                     IF(.NOT. CUR)THEN                                  UIBIN     514
                        OKEY = .FALSE.                                  UIBIN     515
                     ELSE                                               UIBIN     516
                        OKEY = .TRUE.                                   UIBIN     517
                        IF(JCBLK.EQ.0)THEN                              UIBIN     518
                           CALC = CVAL                                  UIBIN     519
                        ELSE                                            UIBIN     520
                           CALC = UDVAL(JCBLK)                          UIBIN     521
                        END IF                                          UIBIN     522
                     END IF                                             UIBIN     523
C                                                                       UIBIN     524
                  ELSEIF(UDRELA(NEXTR).EQ.'ALPHA')THEN                  UIBIN     525
                     IF(.NOT. ALF)THEN                                  UIBIN     526
                        OKEY = .FALSE.                                  UIBIN     527
                     ELSE                                               UIBIN     528
                        OKEY = .TRUE.                                   UIBIN     529
                        IF(JABLK.EQ.0)THEN                              UIBIN     530
                           CALC = AVAL                                  UIBIN     531
                        ELSE                                            UIBIN     532
                           CALC = UDVAL(JABLK)                          UIBIN     533
                        END IF                                          UIBIN     534
                     END IF                                             UIBIN     535
C                                                                       UIBIN     536
                  ELSEIF(UDRELA(NEXTR).EQ.'GAMMA')THEN                  UIBIN     537
                     IF(.NOT. GAM)THEN                                  UIBIN     538
                        OKEY = .FALSE.                                  UIBIN     539
                      ELSE                                              UIBIN     540
                        OKEY = .TRUE.                                   UIBIN     541
                        IF(JGBLK.EQ.0)THEN                              UIBIN     542
                           CALC = GVAL                                  UIBIN     543
                        ELSE                                            UIBIN     544
                           CALC = UDVAL(JGBLK)                          UIBIN     545
                        END IF                                          UIBIN     546
                     END IF                                             UIBIN     547
                  END IF                                                UIBIN     548
C                                                                       UIBIN     549
                  IDONE = IDONE + 1                                     UIBIN     550
                  IF(IABS(ICTYPE(NUMBER)) .EQ. 1) THEN                  UIBIN     551
                     DONE = .TRUE.                                      UIBIN     552
                     DESIR1 = DESIRE                                    UIBIN     553
                     CALC1 = CALC                                       UIBIN     554
                     LASTR1 = LASTR                                     UIBIN     555
                  ELSE                                                  UIBIN     556
                     IF(IDONE .EQ. 2) THEN                              UIBIN     557
                        DONE = .TRUE.                                   UIBIN     558
                     ELSE                                               UIBIN     559
                        DESIR1 = DESIRE                                 UIBIN     560
                        CALC1 = CALC                                    UIBIN     561
                        LASTR1 = LASTR                                  UIBIN     562
                        DESIRE = 0.0                                    UIBIN     563
                        CALC = 0.0                                      UIBIN     564
                        ALF = .FALSE.                                   UIBIN     565
                        CUR = .FALSE.                                   UIBIN     566
                        GAM = .FALSE.                                   UIBIN     567
                        VOL = .FALSE.                                   UIBIN     568
                        OKEY = .FALSE.                                  UIBIN     569
                     ENDIF                                              UIBIN     570
                  ENDIF                                                 UIBIN     571
               END IF                                                   UIBIN     572
C                                                                       UIBIN     573
            END IF                                                      UIBIN     574
C                                                                       UIBIN     575
            NEXTI = IUDINX(NEXTI)                                       UIBIN     576
            NEXTP = IUDPNX(NEXTP)                                       UIBIN     577
            NEXTR = IUDRNX(NEXTR)                                       UIBIN     578
            GOTO 140                                                    UIBIN     579
160      CONTINUE                                                       UIBIN     580
         UDVAL(JBLK) = CALC1                                            UIBIN     581
         UDOU2(JBLK) = UDRELA(LASTR1)                                   UIBIN     582
         IF(IDONE.EQ.2) THEN                                            UIBIN     583
            UDVA3(JBLK) = CALC                                          UIBIN     584
            UDOU4(JBLK) = UDRELA(LASTR)                                 UIBIN     585
         ELSE                                                           UIBIN     586
            UDVA3(JBLK) = 0.0                                           UIBIN     587
            UDOU4(JBLK) = 'NONE'                                        UIBIN     588
         ENDIF                                                          UIBIN     589
      END IF                                                            UIBIN     590
C                                                                       UIBIN     591
      IF(ISKTOP .NE. 0)THEN                                             UIBIN     592
         IF(ISKEND(ISKTOP).EQ.JBLK)THEN                                 UIBIN     593
            IF(ISKOUT(ISKTOP) .GE. 2) THEN                              UIBIN     594
               SKCALC(ISKTOP) = CALC                                    UIBIN     595
               SKDESR(ISKTOP) = DESIRE                                  UIBIN     596
            ELSE                                                        UIBIN     597
               SKCALC(ISKTOP) = CALC1                                   UIBIN     598
               SKDESR(ISKTOP) = DESIR1                                  UIBIN     599
            ENDIF                                                       UIBIN     600
         END IF                                                         UIBIN     601
      END IF                                                            UIBIN     602
C                                                                       UIBIN     603
      RETURN                                                            UIBIN     604
C                                                                       UIBIN     605
C                                                                       UIBIN     606
C---------------------------------------------------------------------  UIBIN     607
C                                                                       UIBIN     608
      ENTRY UIFRAC (JBLK)                                               UIBIN     609
CD -------------------------------------------------------------------  UIBIN     610
CD                                                                      UIBIN     611
CD              *****     UIFRACD ROUTINE   *****                       UIBIN     612
CD                                                                      UIBIN     613
CD -------------------------------------------------------------------  UIBIN     614
CD                                                                      UIBIN     615
CD       PURPOSE:  Performs the initialization of the udc type          UIBIN     616
CD                 FROMAC.                                              UIBIN     617
CD                                                                      UIBIN     618
CD -------------------------------------------------------------------  UIBIN     619
C                                                                       UIBIN     620
      IF(SDBG)THEN                                                      UIBIN     621
         SUBNAM = 'UIFRAC ROUTINE.'                                     UIBIN     622
      ELSE                                                              UIBIN     623
         SUBNAM = ' '                                                   UIBIN     624
      ENDIF                                                             UIBIN     625
      TNAME = TPNAME(IFRMAC)                                            UIBIN     626
      BNAME = UDNAME(JBLK)                                              UIBIN     627
      LEN = IUDLEN(JBLK)                                                UIBIN     628
C                                                                       UIBIN     629
C                                                                       UIBIN     630
      OK = .TRUE.                                                       UIBIN     631
      NEXTI = IUNIPT(JBLK)                                              UIBIN     632
C                                                                       UIBIN     633
      IF(NEXTI.EQ.0)THEN                                                UIBIN     634
         OK = .FALSE.                                                   UIBIN     635
         JBUS1 = 0                                                      UIBIN     636
      ELSE                                                              UIBIN     637
         JBUS1 = IUDINT(NEXTI)                                          UIBIN     638
      ENDIF                                                             UIBIN     639
C                                                                       UIBIN     640
C                                                                       UIBIN     641
C                                                                       UIBIN     642
C     Determine what variables and how many are required for the        UIBIN     643
C     specified subtype.                                                UIBIN     644
C                                                                       UIBIN     645
C     VMAG subtype.                                                     UIBIN     646
C                                                                       UIBIN     647
      IF(IUDSUB(JBLK).EQ.IVMAGS)THEN                                    UIBIN     648
         IF(OK)THEN                                                     UIBIN     649
            UDVAL(JBLK) = SQRT(DCEA(JBUS1) * DCEA(JBUS1) +              UIBIN     650
     1                   DCEB(JBUS1) * DCEB(JBUS1))                     UIBIN     651
         ELSE                                                           UIBIN     652
            MISS = 'AC BUS POINTER'                                     UIBIN     653
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN     654
         WRITE(MSG(2),9001) TNAME                                       UIBIN     655
         WRITE(MSG(3),9002) MISS                                        UIBIN     656
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN     657
         WRITE(MSG(5),9004)                                             UIBIN     658
         CALL PRTMSG(5)                                                 UIBIN     659
            IERCNT = IERCNT + 1                                         UIBIN     660
            UDVAL(JBLK) = 0.0                                           UIBIN     661
         ENDIF                                                          UIBIN     662
C                                                                       UIBIN     663
C     VANG subtype.                                                     UIBIN     664
C                                                                       UIBIN     665
      ELSEIF(IUDSUB(JBLK).EQ.IVANGS)THEN                                UIBIN     666
         IF(OK)THEN                                                     UIBIN     667
            VMG=SQRT(DCEA(JBUS1) * DCEA(JBUS1) +                        UIBIN     668
     1                   DCEB(JBUS1) * DCEB(JBUS1))                     UIBIN     669
            THETA=0.0                                                   UIBIN     670
            IF(VMG.GT.0.05)THEN                                         UIBIN     671
               THETA=ATAN2 (DCEB(JBUS1), DCEA(JBUS1))*180.0/PII         UIBIN     672
            ENDIF                                                       UIBIN     673
            UDVAL(JBLK) = THETA                                         UIBIN     674
         ELSE                                                           UIBIN     675
            MISS = 'AC BUS POINTER'                                     UIBIN     676
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN     677
         WRITE(MSG(2),9001) TNAME                                       UIBIN     678
         WRITE(MSG(3),9002) MISS                                        UIBIN     679
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN     680
         WRITE(MSG(5),9004)                                             UIBIN     681
         CALL PRTMSG(5)                                                 UIBIN     682
            IERCNT = IERCNT + 1                                         UIBIN     683
            UDVAL(JBLK) = 0.0                                           UIBIN     684
         ENDIF                                                          UIBIN     685
C                                                                       UIBIN     686
C     IMAG subtype.                                                     UIBIN     687
C                                                                       UIBIN     688
      ELSEIF(IUDSUB(JBLK).EQ.IMAGS .OR. IUDSUB(JBLK).EQ.IPS .OR.        UIBIN     689
     1         IUDSUB(JBLK).EQ.IQS)THEN                                 UIBIN     690
         IF(OK)THEN                                                     UIBIN     691
            NEXTI = IUDINX(NEXTI)                                       UIBIN     692
         ELSE                                                           UIBIN     693
            MISS = 'AC BUS POINTER'                                     UIBIN     694
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN     695
         WRITE(MSG(2),9001) TNAME                                       UIBIN     696
         WRITE(MSG(3),9002) MISS                                        UIBIN     697
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN     698
         WRITE(MSG(5),9004)                                             UIBIN     699
         CALL PRTMSG(5)                                                 UIBIN     700
            IERCNT = IERCNT + 1                                         UIBIN     701
            UDVAL(JBLK) = 0.0                                           UIBIN     702
         ENDIF                                                          UIBIN     703
         IF(NEXTI.NE.0)THEN                                             UIBIN     704
            JBUS2 = IUDINT(NEXTI)                                       UIBIN     705
            NEXTI = IUDINX(NEXTI)                                       UIBIN     706
         ELSE                                                           UIBIN     707
            MISS = 'AC BUS POINTER'                                     UIBIN     708
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN     709
         WRITE(MSG(2),9001) TNAME                                       UIBIN     710
         WRITE(MSG(3),9002) MISS                                        UIBIN     711
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN     712
         WRITE(MSG(5),9004)                                             UIBIN     713
         CALL PRTMSG(5)                                                 UIBIN     714
            IERCNT = IERCNT + 1                                         UIBIN     715
            OK = .FALSE.                                                UIBIN     716
            UDVAL(JBLK) = 0.0                                           UIBIN     717
         ENDIF                                                          UIBIN     718
         IF(NEXTI.NE.0)THEN                                             UIBIN     719
            LOC = IUDINT(NEXTI)                                         UIBIN     720
         ELSE                                                           UIBIN     721
            MISS = 'AC LINE POINTER'                                    UIBIN     722
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN     723
         WRITE(MSG(2),9001) TNAME                                       UIBIN     724
         WRITE(MSG(3),9002) MISS                                        UIBIN     725
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN     726
         WRITE(MSG(5),9004)                                             UIBIN     727
         CALL PRTMSG(5)                                                 UIBIN     728
            IERCNT = IERCNT + 1                                         UIBIN     729
            UDVAL(JBLK) = 0.0                                           UIBIN     730
            OK = .FALSE.                                                UIBIN     731
         ENDIF                                                          UIBIN     732
         IF(OK)THEN                                                     UIBIN     733
C                                                                       UIBIN     734
C   Get line flow                                                       UIBIN     735
C                                                                       UIBIN     736
            CALL GETCUR (CURR,CURI,LOC)                                 UIBIN     737
C                                                                       UIBIN     738
            IF(IUDSUB(JBLK).EQ.IMAGS)THEN                               UIBIN     739
C                                                                       UIBIN     740
               CMAG =SQRT(CURR*CURR+CURI*CURI)*ACIBAS(JBUS1)            UIBIN     741
               UDVAL(JBLK) = CMAG                                       UIBIN     742
C                                                                       UIBIN     743
C        P subtype.                                                     UIBIN     744
C                                                                       UIBIN     745
            ELSEIF(IUDSUB(JBLK).EQ.IPS)THEN                             UIBIN     746
C                                                                       UIBIN     747
               UDVAL(JBLK) = (DCEA(JBUS1) * CURR +                      UIBIN     748
     1                       DCEB(JBUS1) * CURI) * PABASE               UIBIN     749
C                                                                       UIBIN     750
C        Q subtype.                                                     UIBIN     751
C                                                                       UIBIN     752
            ELSEIF(IUDSUB(JBLK).EQ.IQS)THEN                             UIBIN     753
               UDVAL(JBLK) = (DCEB(JBUS1) * CURR -                      UIBIN     754
     1                       DCEA(JBUS1) * CURI) * PABASE               UIBIN     755
            ENDIF                                                       UIBIN     756
         ENDIF                                                          UIBIN     757
C                                                                       UIBIN     758
C     FREQ subtype.                                                     UIBIN     759
C                                                                       UIBIN     760
      ELSEIF(IUDSUB(JBLK).EQ.IFREQS)THEN                                UIBIN     761
         IF(OK)THEN                                                     UIBIN     762
            VMG=SQRT(DCEA(JBUS1) * DCEA(JBUS1) +                        UIBIN     763
     1                   DCEB(JBUS1) * DCEB(JBUS1))                     UIBIN     764
            THETA=0.0                                                   UIBIN     765
            IF(VMG.GT.0.05)THEN                                         UIBIN     766
               THETA=ATAN2 (DCEB(JBUS1), DCEA(JBUS1))                   UIBIN     767
            ENDIF                                                       UIBIN     768
C                                                                       UIBIN     769
C        Store history of bus angle.                                    UIBIN     770
C                                                                       UIBIN     771
            NEXTS = IUDSPT(JBLK)                                        UIBIN     772
            IF(NEXTS.EQ.0)THEN                                          UIBIN     773
               NEXTS = IUDSFR                                           UIBIN     774
               IUDSFR = IUDSNX(IUDSFR)                                  UIBIN     775
               IUDSPT(JBLK) = NEXTS                                     UIBIN     776
               IUDSNX(NEXTS) = 0                                        UIBIN     777
               LASTS = NEXTS                                            UIBIN     778
            ENDIF                                                       UIBIN     779
            UDOLD(NEXTS) = THETA                                        UIBIN     780
            UDVAL(JBLK) = 0.0                                           UIBIN     781
         ELSE                                                           UIBIN     782
            MISS = 'AC BUS POINTER'                                     UIBIN     783
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN     784
         WRITE(MSG(2),9001) TNAME                                       UIBIN     785
         WRITE(MSG(3),9002) MISS                                        UIBIN     786
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN     787
         WRITE(MSG(5),9004)                                             UIBIN     788
         CALL PRTMSG(5)                                                 UIBIN     789
            IERCNT = IERCNT + 1                                         UIBIN     790
            UDVAL(JBLK) = 0.0                                           UIBIN     791
         ENDIF                                                          UIBIN     792
C                                                                       UIBIN     793
C     Invalid subtype.                                                  UIBIN     794
C                                                                       UIBIN     795
      ELSE                                                              UIBIN     796
         UDVAL(JBLK) = 0.0                                              UIBIN     797
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN     798
         WRITE(MSG(2),9001) TNAME                                       UIBIN     799
         WRITE(MSG(3),9006)                                             UIBIN     800
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN     801
         WRITE(MSG(5),9004)                                             UIBIN     802
         CALL PRTMSG(5)                                                 UIBIN     803
      ENDIF                                                             UIBIN     804
C                                                                       UIBIN     805
      RETURN                                                            UIBIN     806
C                                                                       UIBIN     807
C                                                                       UIBIN     808
C---------------------------------------------------------------------  UIBIN     809
C                                                                       UIBIN     810
      ENTRY UIFRDC (JBLK)                                               UIBIN     811
CD -------------------------------------------------------------------  UIBIN     812
CD                                                                      UIBIN     813
CD              *****     UIFRDCD ROUTINE   *****                       UIBIN     814
CD                                                                      UIBIN     815
CD -------------------------------------------------------------------  UIBIN     816
CD                                                                      UIBIN     817
CD       PURPOSE:  Performs the initialization of the udc type FROMDC.  UIBIN     818
CD                                                                      UIBIN     819
CD -------------------------------------------------------------------  UIBIN     820
C                                                                       UIBIN     821
      IF(SDBG)THEN                                                      UIBIN     822
         SUBNAM = 'UIFRDC ROUTINE.'                                     UIBIN     823
      ELSE                                                              UIBIN     824
         SUBNAM = ' '                                                   UIBIN     825
      END IF                                                            UIBIN     826
      TNAME = TPNAME(IFRMDC)                                            UIBIN     827
      BNAME = UDNAME(JBLK)                                              UIBIN     828
      LEN = IUDLEN(JBLK)                                                UIBIN     829
C                                                                       UIBIN     830
C                                                                       UIBIN     831
C     Read the converter number, line number, or node number.           UIBIN     832
C                                                                       UIBIN     833
      OK = .TRUE.                                                       UIBIN     834
      NEXTI = IUNIPT(JBLK)                                              UIBIN     835
      IF(IUDSUB(JBLK) .NE. IVDIFF)THEN                                  UIBIN     836
         IF(NEXTI.EQ.0)THEN                                             UIBIN     837
            OK = .FALSE.                                                UIBIN     838
            NUM = 0                                                     UIBIN     839
         ELSE                                                           UIBIN     840
            NUM = IUDINT(NEXTI)                                         UIBIN     841
            IF(NUM .LT. 0)THEN                                          UIBIN     842
               SIGN= -1.0                                               UIBIN     843
               NUM = -NUM                                               UIBIN     844
            ELSE                                                        UIBIN     845
               SIGN = 1.0                                               UIBIN     846
            END IF                                                      UIBIN     847
            NEXTI = IUDINX(NEXTI)                                       UIBIN     848
         END IF                                                         UIBIN     849
      END IF                                                            UIBIN     850
C                                                                       UIBIN     851
C     Read the bus numbers.                                             UIBIN     852
C                                                                       UIBIN     853
      IF(IUDSUB(JBLK).EQ.IPLINE .OR. IUDSUB(JBLK).EQ.ILINES .OR.        UIBIN     854
     1    IUDSUB(JBLK).EQ.IVDIFF .OR. IUDSUB(JBLK).EQ.ICAPS)THEN        UIBIN     855
         IF(NEXTI.EQ.0)THEN                                             UIBIN     856
            OK = .FALSE.                                                UIBIN     857
            JBUS1 = 0                                                   UIBIN     858
         ELSE                                                           UIBIN     859
            JBUS1 = IUDINT(NEXTI)                                       UIBIN     860
            NEXTI = IUDINX(NEXTI)                                       UIBIN     861
         END IF                                                         UIBIN     862
         IF(NEXTI.EQ.0)THEN                                             UIBIN     863
            OK = .FALSE.                                                UIBIN     864
            JBUS2 = 0                                                   UIBIN     865
         ELSE                                                           UIBIN     866
            JBUS2 = IUDINT(NEXTI)                                       UIBIN     867
         END IF                                                         UIBIN     868
      END IF                                                            UIBIN     869
C                                                                       UIBIN     870
C                                                                       UIBIN     871
C     DC converter voltage.                                             UIBIN     872
C                                                                       UIBIN     873
      IF(IUDSUB(JBLK).EQ.IVCONV)THEN                                    UIBIN     874
         IF(OK)THEN                                                     UIBIN     875
            UDVAL(JBLK) = VDCONV(NUM)                                   UIBIN     876
         ELSE                                                           UIBIN     877
            MISS = 'DC CONVERTER'                                       UIBIN     878
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN     879
         WRITE(MSG(2),9001) TNAME                                       UIBIN     880
         WRITE(MSG(3),9002) MISS                                        UIBIN     881
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN     882
         WRITE(MSG(5),9004)                                             UIBIN     883
         CALL PRTMSG(5)                                                 UIBIN     884
            IERCNT = IERCNT + 1                                         UIBIN     885
            UDVAL(JBLK) = 0.0                                           UIBIN     886
         END IF                                                         UIBIN     887
C                                                                       UIBIN     888
C                                                                       UIBIN     889
C     DC converter current.                                             UIBIN     890
C                                                                       UIBIN     891
      ELSEIF(IUDSUB(JBLK).EQ.ICONVS)THEN                                UIBIN     892
         IF(OK)THEN                                                     UIBIN     893
            UDVAL(JBLK) = XDCONV(NUM) * 1000.0                          UIBIN     894
C                                                                       UIBIN     895
         ELSE                                                           UIBIN     896
            MISS = 'DC CONVERTER'                                       UIBIN     897
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN     898
         WRITE(MSG(2),9001) TNAME                                       UIBIN     899
         WRITE(MSG(3),9002) MISS                                        UIBIN     900
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN     901
         WRITE(MSG(5),9004)                                             UIBIN     902
         CALL PRTMSG(5)                                                 UIBIN     903
            IERCNT = IERCNT + 1                                         UIBIN     904
            UDVAL(JBLK) = 0.0                                           UIBIN     905
         END IF                                                         UIBIN     906
C                                                                       UIBIN     907
C                                                                       UIBIN     908
C     DC node voltage to ground.                                        UIBIN     909
C                                                                       UIBIN     910
      ELSEIF(IUDSUB(JBLK).EQ.IVNODE)THEN                                UIBIN     911
         IF(OK)THEN                                                     UIBIN     912
            UDVAL(JBLK) = VDCNOD(NUM)                                   UIBIN     913
         ELSE                                                           UIBIN     914
            MISS = 'DC NODE'                                            UIBIN     915
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN     916
         WRITE(MSG(2),9001) TNAME                                       UIBIN     917
         WRITE(MSG(3),9002) MISS                                        UIBIN     918
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN     919
         WRITE(MSG(5),9004)                                             UIBIN     920
         CALL PRTMSG(5)                                                 UIBIN     921
            IERCNT = IERCNT + 1                                         UIBIN     922
            UDVAL(JBLK) = 0.0                                           UIBIN     923
         END IF                                                         UIBIN     924
C                                                                       UIBIN     925
C                                                                       UIBIN     926
C     Net current into dc node.                                         UIBIN     927
C                                                                       UIBIN     928
      ELSEIF(IUDSUB(JBLK).EQ.INODES)THEN                                UIBIN     929
         IF(OK)THEN                                                     UIBIN     930
            UDVAL(JBLK) = XDNODE(NUM) * 1000.0                          UIBIN     931
         ELSE                                                           UIBIN     932
            MISS = 'DC NODE'                                            UIBIN     933
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN     934
         WRITE(MSG(2),9001) TNAME                                       UIBIN     935
         WRITE(MSG(3),9002) MISS                                        UIBIN     936
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN     937
         WRITE(MSG(5),9004)                                             UIBIN     938
         CALL PRTMSG(5)                                                 UIBIN     939
            IERCNT = IERCNT + 1                                         UIBIN     940
            UDVAL(JBLK) = 0.0                                           UIBIN     941
         END IF                                                         UIBIN     942
C                                                                       UIBIN     943
C                                                                       UIBIN     944
C     cos (alpha) of dc converter.                                      UIBIN     945
C                                                                       UIBIN     946
      ELSEIF(IUDSUB(JBLK).EQ.IALFAS)THEN                                UIBIN     947
         IF(OK)THEN                                                     UIBIN     948
            IF(IABS(ICTYPE(NUM)) .EQ. 1) THEN                           UIBIN     949
               UDVAL(JBLK) = ACOS(CALPHA(NUM)) * 180.0 / PII            UIBIN     950
            ELSEIF(IABS(ICTYPE(NUM)) .EQ. 2) THEN                       UIBIN     951
               UDVAL(JBLK) = CALPHA(NUM) * 180.0 / PII                  UIBIN     952
            ENDIF                                                       UIBIN     953
         ELSE                                                           UIBIN     954
            MISS = 'DC CONVERTER'                                       UIBIN     955
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN     956
         WRITE(MSG(2),9001) TNAME                                       UIBIN     957
         WRITE(MSG(3),9002) MISS                                        UIBIN     958
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN     959
         WRITE(MSG(5),9004)                                             UIBIN     960
         CALL PRTMSG(5)                                                 UIBIN     961
            IERCNT = IERCNT + 1                                         UIBIN     962
            UDVAL(JBLK) = 0.0                                           UIBIN     963
         END IF                                                         UIBIN     964
C                                                                       UIBIN     965
C                                                                       UIBIN     966
C     cos (gamma) of dc converter.                                      UIBIN     967
C                                                                       UIBIN     968
      ELSEIF(IUDSUB(JBLK).EQ.IGAMAS)THEN                                UIBIN     969
         IF(OK)THEN                                                     UIBIN     970
            IF(IABS(ICTYPE(NUM)) .EQ. 1) THEN                           UIBIN     971
               UDVAL(JBLK) = ACOS(CGAMMA(NUM)) * 180.0 / PII            UIBIN     972
            ELSEIF(IABS(ICTYPE(NUM)) .EQ. 2) THEN                       UIBIN     973
               UDVAL(JBLK) = CGAMMA(NUM)                                UIBIN     974
            ENDIF                                                       UIBIN     975
         ELSE                                                           UIBIN     976
            MISS = 'DC CONVERTER'                                       UIBIN     977
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN     978
         WRITE(MSG(2),9001) TNAME                                       UIBIN     979
         WRITE(MSG(3),9002) MISS                                        UIBIN     980
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN     981
         WRITE(MSG(5),9004)                                             UIBIN     982
         CALL PRTMSG(5)                                                 UIBIN     983
            IERCNT = IERCNT + 1                                         UIBIN     984
            UDVAL(JBLK) = 0.0                                           UIBIN     985
         END IF                                                         UIBIN     986
C                                                                       UIBIN     987
C                                                                       UIBIN     988
C     DC converter real power injection.                                UIBIN     989
C                                                                       UIBIN     990
      ELSEIF(IUDSUB(JBLK).EQ.IPACS)THEN                                 UIBIN     991
         IF(OK)THEN                                                     UIBIN     992
            UDVAL(JBLK) = PAHVDC(NUM)                                   UIBIN     993
         ELSE                                                           UIBIN     994
            MISS = 'DC CONVERTER'                                       UIBIN     995
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN     996
         WRITE(MSG(2),9001) TNAME                                       UIBIN     997
         WRITE(MSG(3),9002) MISS                                        UIBIN     998
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN     999
         WRITE(MSG(5),9004)                                             UIBIN    1000
         CALL PRTMSG(5)                                                 UIBIN    1001
            IERCNT = IERCNT + 1                                         UIBIN    1002
            UDVAL(JBLK) = 0.0                                           UIBIN    1003
         END IF                                                         UIBIN    1004
C                                                                       UIBIN    1005
C                                                                       UIBIN    1006
C     DC converter reactive power injection.                            UIBIN    1007
C                                                                       UIBIN    1008
      ELSEIF(IUDSUB(JBLK).EQ.IQACS)THEN                                 UIBIN    1009
         IF(OK)THEN                                                     UIBIN    1010
            IF(IABS(ICTYPE(NUM)) .EQ. 1) THEN                           UIBIN    1011
               UDVAL(JBLK) = QAHVDC(NUM)                                UIBIN    1012
            ELSEIF(IABS(ICTYPE(NUM)) .EQ. 2) THEN                       UIBIN    1013
               UDVAL(JBLK) = QAHVDC(NUM) + Q2HVDC(NUM)                  UIBIN    1014
            ENDIF                                                       UIBIN    1015
         ELSE                                                           UIBIN    1016
            MISS = 'DC CONVERTER'                                       UIBIN    1017
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1018
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1019
         WRITE(MSG(3),9002) MISS                                        UIBIN    1020
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1021
         WRITE(MSG(5),9004)                                             UIBIN    1022
         CALL PRTMSG(5)                                                 UIBIN    1023
            IERCNT = IERCNT + 1                                         UIBIN    1024
            UDVAL(JBLK) = 0.0                                           UIBIN    1025
         END IF                                                         UIBIN    1026
C                                                                       UIBIN    1027
C                                                                       UIBIN    1028
C     Current flow for dc line.                                         UIBIN    1029
C                                                                       UIBIN    1030
      ELSEIF(IUDSUB(JBLK).EQ.ILINES)THEN                                UIBIN    1031
         IF(OK)THEN                                                     UIBIN    1032
            IF(JBUS1.EQ.JGROUN)THEN                                     UIBIN    1033
               VJBUS1 = 0.0                                             UIBIN    1034
            ELSE                                                        UIBIN    1035
               VJBUS1 = VDCNOD(JBUS1)                                   UIBIN    1036
            END IF                                                      UIBIN    1037
C                                                                       UIBIN    1038
            IF(JBUS2.EQ.JGROUN)THEN                                     UIBIN    1039
               VJBUS2 = 0.0                                             UIBIN    1040
            ELSE                                                        UIBIN    1041
               VJBUS2 = VDCNOD(JBUS2)                                   UIBIN    1042
            END IF                                                      UIBIN    1043
C                                                                       UIBIN    1044
            CFLOW = (VJBUS1 - VJBUS2) / RDCOHM(NUM)                     UIBIN    1045
            UDVAL(JBLK) = CFLOW * 1000.0                                UIBIN    1046
C                                                                       UIBIN    1047
         ELSE                                                           UIBIN    1048
C                                                                       UIBIN    1049
            IF(NUM.EQ.0)THEN                                            UIBIN    1050
               MISS = 'DC LINE'                                         UIBIN    1051
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1052
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1053
         WRITE(MSG(3),9002) MISS                                        UIBIN    1054
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1055
         WRITE(MSG(5),9004)                                             UIBIN    1056
         CALL PRTMSG(5)                                                 UIBIN    1057
               IERCNT = IERCNT + 1                                      UIBIN    1058
            END IF                                                      UIBIN    1059
            IF(JBUS1.EQ.0)THEN                                          UIBIN    1060
               MISS = 'DC NODE 1'                                       UIBIN    1061
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1062
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1063
         WRITE(MSG(3),9002) MISS                                        UIBIN    1064
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1065
         WRITE(MSG(5),9004)                                             UIBIN    1066
         CALL PRTMSG(5)                                                 UIBIN    1067
               IERCNT = IERCNT + 1                                      UIBIN    1068
            END IF                                                      UIBIN    1069
            IF(JBUS2.EQ.0)THEN                                          UIBIN    1070
               MISS = 'DC BUS 2'                                        UIBIN    1071
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1072
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1073
         WRITE(MSG(3),9002) MISS                                        UIBIN    1074
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1075
         WRITE(MSG(5),9004)                                             UIBIN    1076
         CALL PRTMSG(5)                                                 UIBIN    1077
               IERCNT = IERCNT + 1                                      UIBIN    1078
            END IF                                                      UIBIN    1079
            UDVAL(JBLK) = 0.0                                           UIBIN    1080
         END IF                                                         UIBIN    1081
C                                                                       UIBIN    1082
C                                                                       UIBIN    1083
C     Current flow for dc line shunt capacitance                        UIBIN    1084
C                                                                       UIBIN    1085
      ELSEIF(IUDSUB(JBLK).EQ.ICAPS)THEN                                 UIBIN    1086
         IF (OK) THEN                                                   UIBIN    1087
            UDVAL(JBLK) = 0.0                                           UIBIN    1088
C                                                                       UIBIN    1089
         ELSE                                                           UIBIN    1090
            IF(NUM.EQ.0)THEN                                            UIBIN    1091
               MISS = 'DC LINE'                                         UIBIN    1092
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1093
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1094
         WRITE(MSG(3),9002) MISS                                        UIBIN    1095
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1096
         WRITE(MSG(5),9004)                                             UIBIN    1097
         CALL PRTMSG(5)                                                 UIBIN    1098
               IERCNT = IERCNT + 1                                      UIBIN    1099
            END IF                                                      UIBIN    1100
            IF(JBUS1.EQ.0)THEN                                          UIBIN    1101
               MISS = 'DC NODE 1'                                       UIBIN    1102
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1103
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1104
         WRITE(MSG(3),9002) MISS                                        UIBIN    1105
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1106
         WRITE(MSG(5),9004)                                             UIBIN    1107
         CALL PRTMSG(5)                                                 UIBIN    1108
               IERCNT = IERCNT + 1                                      UIBIN    1109
            END IF                                                      UIBIN    1110
            IF(JBUS2.EQ.0)THEN                                          UIBIN    1111
               MISS = 'DC BUS 2'                                        UIBIN    1112
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1113
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1114
         WRITE(MSG(3),9002) MISS                                        UIBIN    1115
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1116
         WRITE(MSG(5),9004)                                             UIBIN    1117
         CALL PRTMSG(5)                                                 UIBIN    1118
               IERCNT = IERCNT + 1                                      UIBIN    1119
            END IF                                                      UIBIN    1120
            UDVAL(JBLK) = 0.0                                           UIBIN    1121
         END IF                                                         UIBIN    1122
C                                                                       UIBIN    1123
C                                                                       UIBIN    1124
C     Power flow for dc line.                                           UIBIN    1125
C                                                                       UIBIN    1126
      ELSEIF(IUDSUB(JBLK).EQ.IPLINE)THEN                                UIBIN    1127
         IF(OK)THEN                                                     UIBIN    1128
            IF(JBUS1.EQ.JGROUN)THEN                                     UIBIN    1129
               VJBUS1 = 0.0                                             UIBIN    1130
            ELSE                                                        UIBIN    1131
               VJBUS1 = VDCNOD(JBUS1)                                   UIBIN    1132
            END IF                                                      UIBIN    1133
            IF(JBUS2.EQ.JGROUN)THEN                                     UIBIN    1134
               VJBUS2 = 0.0                                             UIBIN    1135
            ELSE                                                        UIBIN    1136
               VJBUS2 = VDCNOD(JBUS2)                                   UIBIN    1137
            END IF                                                      UIBIN    1138
C                                                                       UIBIN    1139
            CFLOW = (VJBUS1 - VJBUS2) / RDCOHM(NUM)                     UIBIN    1140
            UDVAL(JBLK) = CFLOW * VJBUS1                                UIBIN    1141
C                                                                       UIBIN    1142
         ELSE                                                           UIBIN    1143
C                                                                       UIBIN    1144
            IF(NUM.EQ.0)THEN                                            UIBIN    1145
               MISS = 'DC LINE'                                         UIBIN    1146
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1147
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1148
         WRITE(MSG(3),9002) MISS                                        UIBIN    1149
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1150
         WRITE(MSG(5),9004)                                             UIBIN    1151
         CALL PRTMSG(5)                                                 UIBIN    1152
               IERCNT = IERCNT + 1                                      UIBIN    1153
            END IF                                                      UIBIN    1154
            IF(JBUS1.EQ.0)THEN                                          UIBIN    1155
               MISS = 'DC NODE 1'                                       UIBIN    1156
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1157
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1158
         WRITE(MSG(3),9002) MISS                                        UIBIN    1159
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1160
         WRITE(MSG(5),9004)                                             UIBIN    1161
         CALL PRTMSG(5)                                                 UIBIN    1162
               IERCNT = IERCNT + 1                                      UIBIN    1163
            END IF                                                      UIBIN    1164
            IF(JBUS2.EQ.0)THEN                                          UIBIN    1165
               MISS = 'DC NODE 2'                                       UIBIN    1166
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1167
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1168
         WRITE(MSG(3),9002) MISS                                        UIBIN    1169
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1170
         WRITE(MSG(5),9004)                                             UIBIN    1171
         CALL PRTMSG(5)                                                 UIBIN    1172
               IERCNT = IERCNT + 1                                      UIBIN    1173
            END IF                                                      UIBIN    1174
            UDVAL(JBLK) = 0.0                                           UIBIN    1175
         END IF                                                         UIBIN    1176
C                                                                       UIBIN    1177
C     Dc breaker current.                                               UIBIN    1178
C                                                                       UIBIN    1179
      ELSEIF(IUDSUB(JBLK).EQ.IBRKRS)THEN                                UIBIN    1180
         IF(OK)THEN                                                     UIBIN    1181
C                                                                       UIBIN    1182
C     Use sign to determine the current direction.                      UIBIN    1183
C                                                                       UIBIN    1184
            IF(SIGN.GT.0)THEN                                           UIBIN    1185
               NAM1 = DCBNAM(NUM)(1:8)                                  UIBIN    1186
               NAM2 = DCBNAM(NUM)(9:16)                                 UIBIN    1187
            ELSE                                                        UIBIN    1188
               NAM2 = DCBNAM(NUM)(1:8)                                  UIBIN    1189
               NAM1 = DCBNAM(NUM)(9:16)                                 UIBIN    1190
            END IF                                                      UIBIN    1191
C                                                                       UIBIN    1192
            IF(NAM1.NE.'GROUND') THEN                                   UIBIN    1193
               CALL BRFLOS(NUM, NAM1, UDVAL(JBLK), POWR)                UIBIN    1194
            ELSEIF(NAM2.NE.'GROUND') THEN                               UIBIN    1195
               CALL BRFLOS(NUM, NAM2, UDVAL(JBLK), POWR)                UIBIN    1196
               UDVAL(JBLK) = -UDVAL(JBLK)                               UIBIN    1197
            ELSE                                                        UIBIN    1198
               UDVAL(JBLK) = 0.0                                        UIBIN    1199
               IERCNT = IERCNT + 1                                      UIBIN    1200
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1201
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1202
         WRITE(MSG(3),9310) BNAME(1:LEN),DCBNAM(NUM)                    UIBIN    1203
         WRITE(MSG(4),9311)                                             UIBIN    1204
         CALL PRTMSG(4)                                                 UIBIN    1205
            END IF                                                      UIBIN    1206
            UDVAL(JBLK) = UDVAL(JBLK)                                   UIBIN    1207
            UBCURR(NUM) = UDVAL(JBLK)/1000.0*SIGN                       UIBIN    1208
C                                                                       UIBIN    1209
         ELSE                                                           UIBIN    1210
            MISS = 'DC BREAKER'                                         UIBIN    1211
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1212
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1213
         WRITE(MSG(3),9002) MISS                                        UIBIN    1214
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1215
         WRITE(MSG(5),9004)                                             UIBIN    1216
         CALL PRTMSG(5)                                                 UIBIN    1217
            IERCNT = IERCNT + 1                                         UIBIN    1218
            UDVAL(JBLK) = 0.0                                           UIBIN    1219
         END IF                                                         UIBIN    1220
C                                                                       UIBIN    1221
C     Dc breaker status.                                                UIBIN    1222
C                                                                       UIBIN    1223
      ELSEIF(IUDSUB(JBLK).EQ.ISBRKR)THEN                                UIBIN    1224
         IF(OK)THEN                                                     UIBIN    1225
            UDVAL(JBLK) = REAL(IBSTAT(NUM))                             UIBIN    1226
         ELSE                                                           UIBIN    1227
            MISS = 'DC BREAKER'                                         UIBIN    1228
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1229
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1230
         WRITE(MSG(3),9002) MISS                                        UIBIN    1231
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1232
         WRITE(MSG(5),9004)                                             UIBIN    1233
         CALL PRTMSG(5)                                                 UIBIN    1234
            IERCNT = IERCNT + 1                                         UIBIN    1235
            UDVAL(JBLK) = 0.0                                           UIBIN    1236
         END IF                                                         UIBIN    1237
C                                                                       UIBIN    1238
C     Bridge subtype.                                                   UIBIN    1239
C                                                                       UIBIN    1240
      ELSEIF(IUDSUB(JBLK).EQ.IBRDGE)THEN                                UIBIN    1241
         IF(OK)THEN                                                     UIBIN    1242
            UDVAL(JBLK) = REAL(NSBRDG(NUM))                             UIBIN    1243
         ELSE                                                           UIBIN    1244
            MISS = 'DC CONVERTER'                                       UIBIN    1245
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1246
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1247
         WRITE(MSG(3),9002) MISS                                        UIBIN    1248
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1249
         WRITE(MSG(5),9004)                                             UIBIN    1250
         CALL PRTMSG(5)                                                 UIBIN    1251
            IERCNT = IERCNT + 1                                         UIBIN    1252
            UDVAL(JBLK) = 0.0                                           UIBIN    1253
         END IF                                                         UIBIN    1254
C                                                                       UIBIN    1255
C     Commutation voltage subtype.                                      UIBIN    1256
C                                                                       UIBIN    1257
      ELSEIF(IUDSUB(JBLK).EQ.IVCOMM)THEN                                UIBIN    1258
         IF(OK)THEN                                                     UIBIN    1259
            IF(IABS(ICTYPE(NUM)) .EQ. 1) THEN                           UIBIN    1260
               UDVAL(JBLK) = VAHVDC(NUM) * TAPPOS(NUM)                  UIBIN    1261
            ELSEIF(IABS(ICTYPE(NUM)) .EQ. 2) THEN                       UIBIN    1262
               UDVAL(JBLK) = VAHVDC(NUM) / TAPPOS(NUM)                  UIBIN    1263
            ENDIF                                                       UIBIN    1264
         ELSE                                                           UIBIN    1265
            MISS = 'DC CONVERTER'                                       UIBIN    1266
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1267
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1268
         WRITE(MSG(3),9002) MISS                                        UIBIN    1269
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1270
         WRITE(MSG(5),9004)                                             UIBIN    1271
         CALL PRTMSG(5)                                                 UIBIN    1272
            IERCNT = IERCNT + 1                                         UIBIN    1273
            UDVAL(JBLK) = 0.0                                           UIBIN    1274
         END IF                                                         UIBIN    1275
C                                                                       UIBIN    1276
C     Commutating Reactance subtype.                                    UIBIN    1277
C                                                                       UIBIN    1278
      ELSEIF(IUDSUB(JBLK).EQ.IXCS)THEN                                  UIBIN    1279
         IF(OK)THEN                                                     UIBIN    1280
            UDVAL(JBLK) = XCCONV(NUM)                                   UIBIN    1281
         ELSE                                                           UIBIN    1282
            MISS = 'DC CONVERTER'                                       UIBIN    1283
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1284
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1285
         WRITE(MSG(3),9002) MISS                                        UIBIN    1286
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1287
         WRITE(MSG(5),9004)                                             UIBIN    1288
         CALL PRTMSG(5)                                                 UIBIN    1289
            IERCNT = IERCNT + 1                                         UIBIN    1290
            UDVAL(JBLK) = 0.0                                           UIBIN    1291
         END IF                                                         UIBIN    1292
C                                                                       UIBIN    1293
C     Tap position subtype.                                             UIBIN    1294
C                                                                       UIBIN    1295
      ELSEIF(IUDSUB(JBLK).EQ.ITAPS)THEN                                 UIBIN    1296
         IF(OK)THEN                                                     UIBIN    1297
            UDVAL(JBLK) = TAPPOS(NUM)                                   UIBIN    1298
         ELSE                                                           UIBIN    1299
            MISS = 'DC CONVERTER'                                       UIBIN    1300
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1301
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1302
         WRITE(MSG(3),9002) MISS                                        UIBIN    1303
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1304
         WRITE(MSG(5),9004)                                             UIBIN    1305
         CALL PRTMSG(5)                                                 UIBIN    1306
            IERCNT = IERCNT + 1                                         UIBIN    1307
            UDVAL(JBLK) = 0.0                                           UIBIN    1308
         END IF                                                         UIBIN    1309
C                                                                       UIBIN    1310
C     Commutation failure monitor.                                      UIBIN    1311
C                                                                       UIBIN    1312
      ELSEIF(IUDSUB(JBLK).EQ.ICOMFL)THEN                                UIBIN    1313
         IF(OK)THEN                                                     UIBIN    1314
            UDVAL(JBLK) = 0.0                                           UIBIN    1315
         ELSE                                                           UIBIN    1316
            MISS = 'DC CONVERTER'                                       UIBIN    1317
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1318
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1319
         WRITE(MSG(3),9002) MISS                                        UIBIN    1320
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1321
         WRITE(MSG(5),9004)                                             UIBIN    1322
         CALL PRTMSG(5)                                                 UIBIN    1323
            IERCNT = IERCNT + 1                                         UIBIN    1324
            UDVAL(JBLK) = 0.0                                           UIBIN    1325
         END IF                                                         UIBIN    1326
C                                                                       UIBIN    1327
C     Block monitoring subtype.                                         UIBIN    1328
C                                                                       UIBIN    1329
      ELSEIF(IUDSUB(JBLK).EQ.JBLOCK)THEN                                UIBIN    1330
         IF(OK)THEN                                                     UIBIN    1331
            UDVAL(JBLK) = 0.0                                           UIBIN    1332
         ELSE                                                           UIBIN    1333
            MISS = 'DC CONVERTER'                                       UIBIN    1334
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1335
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1336
         WRITE(MSG(3),9002) MISS                                        UIBIN    1337
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1338
         WRITE(MSG(5),9004)                                             UIBIN    1339
         CALL PRTMSG(5)                                                 UIBIN    1340
            IERCNT = IERCNT + 1                                         UIBIN    1341
            UDVAL(JBLK) = 0.0                                           UIBIN    1342
         END IF                                                         UIBIN    1343
C                                                                       UIBIN    1344
C     First line capacitance.                                           UIBIN    1345
C                                                                       UIBIN    1346
      ELSEIF(IUDSUB(JBLK).EQ.ICL1S)THEN                                 UIBIN    1347
         IF(OK)THEN                                                     UIBIN    1348
            UDVAL(JBLK) = CDCA(NUM)                                     UIBIN    1349
         ELSE                                                           UIBIN    1350
            MISS = 'DC LINE'                                            UIBIN    1351
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1352
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1353
         WRITE(MSG(3),9002) MISS                                        UIBIN    1354
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1355
         WRITE(MSG(5),9004)                                             UIBIN    1356
         CALL PRTMSG(5)                                                 UIBIN    1357
            IERCNT = IERCNT + 1                                         UIBIN    1358
            UDVAL(JBLK) = 0.0                                           UIBIN    1359
         END IF                                                         UIBIN    1360
C                                                                       UIBIN    1361
C     Second line capacitance.                                          UIBIN    1362
C                                                                       UIBIN    1363
      ELSEIF(IUDSUB(JBLK).EQ.ICL2S)THEN                                 UIBIN    1364
         IF(OK)THEN                                                     UIBIN    1365
            UDVAL(JBLK) = CDCB(NUM)                                     UIBIN    1366
         ELSE                                                           UIBIN    1367
            MISS = 'DC LINE'                                            UIBIN    1368
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1369
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1370
         WRITE(MSG(3),9002) MISS                                        UIBIN    1371
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1372
         WRITE(MSG(5),9004)                                             UIBIN    1373
         CALL PRTMSG(5)                                                 UIBIN    1374
            IERCNT = IERCNT + 1                                         UIBIN    1375
            UDVAL(JBLK) = 0.0                                           UIBIN    1376
         END IF                                                         UIBIN    1377
C                                                                       UIBIN    1378
C     Line inductance.                                                  UIBIN    1379
C                                                                       UIBIN    1380
      ELSEIF(IUDSUB(JBLK).EQ.LLS)THEN                                   UIBIN    1381
         IF(OK)THEN                                                     UIBIN    1382
            UDVAL(JBLK) = XLDC(NUM)                                     UIBIN    1383
         ELSE                                                           UIBIN    1384
            MISS = 'DC LINE'                                            UIBIN    1385
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1386
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1387
         WRITE(MSG(3),9002) MISS                                        UIBIN    1388
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1389
         WRITE(MSG(5),9004)                                             UIBIN    1390
         CALL PRTMSG(5)                                                 UIBIN    1391
            IERCNT = IERCNT + 1                                         UIBIN    1392
            UDVAL(JBLK) = 0.0                                           UIBIN    1393
         END IF                                                         UIBIN    1394
C                                                                       UIBIN    1395
C     Line resistance.                                                  UIBIN    1396
C                                                                       UIBIN    1397
      ELSEIF(IUDSUB(JBLK).EQ.IRLS)THEN                                  UIBIN    1398
         IF(OK)THEN                                                     UIBIN    1399
            UDVAL(JBLK) = RDCOHM(NUM)                                   UIBIN    1400
         ELSE                                                           UIBIN    1401
            MISS = 'DC LINE'                                            UIBIN    1402
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1403
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1404
         WRITE(MSG(3),9002) MISS                                        UIBIN    1405
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1406
         WRITE(MSG(5),9004)                                             UIBIN    1407
         CALL PRTMSG(5)                                                 UIBIN    1408
            IERCNT = IERCNT + 1                                         UIBIN    1409
            UDVAL(JBLK) = 0.0                                           UIBIN    1410
         END IF                                                         UIBIN    1411
C                                                                       UIBIN    1412
C     Run mode.                                                         UIBIN    1413
C                                                                       UIBIN    1414
      ELSEIF(IUDSUB(JBLK).EQ.IRMODE)THEN                                UIBIN    1415
         IF(OK)THEN                                                     UIBIN    1416
            IF(UDVAL(JBLK) .LT. 1.0 .OR. UDVAL(JBLK) .GT. 15.0 .OR.     UIBIN    1417
     1         (UDVAL(JBLK) .GT. 4.0.AND.UDVAL(JBLK) .LT. 8.0))THEN     UIBIN    1418
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1419
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1420
         WRITE(MSG(3),9304) BNAME(1:LEN)                                UIBIN    1421
         WRITE(MSG(4),9305)                                             UIBIN    1422
         WRITE(MSG(5),9004)                                             UIBIN    1423
         CALL PRTMSG(5)                                                 UIBIN    1424
               IERCNT = IERCNT + 1                                      UIBIN    1425
               UDVAL(JBLK) = 0.0                                        UIBIN    1426
            END IF                                                      UIBIN    1427
         ELSE                                                           UIBIN    1428
            MISS = 'DC CONVERTER'                                       UIBIN    1429
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1430
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1431
         WRITE(MSG(3),9002) MISS                                        UIBIN    1432
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1433
         WRITE(MSG(5),9004)                                             UIBIN    1434
         CALL PRTMSG(5)                                                 UIBIN    1435
            IERCNT = IERCNT + 1                                         UIBIN    1436
            UDVAL(JBLK) = 0.0                                           UIBIN    1437
         END IF                                                         UIBIN    1438
C                                                                       UIBIN    1439
C     Initial mode.                                                     UIBIN    1440
C                                                                       UIBIN    1441
      ELSEIF(IUDSUB(JBLK).EQ.IMODES)THEN                                UIBIN    1442
         IF(OK)THEN                                                     UIBIN    1443
C                                                                       UIBIN    1444
C     Convert the initial mode character string to the numeric equivalenUIBIN    1445
C                                                                       UIBIN    1446
            STRING = ' '                                                UIBIN    1447
            STRING(1:4) = SPTYPE(NUM)                                   UIBIN    1448
            STRING(5:6) = SPTYP3(NUM)                                   UIBIN    1449
            CALL USTRNG (STRING, UDVAL(JBLK), JBLK, 'I  ')              UIBIN    1450
C                                                                       UIBIN    1451
            IF(UDVAL(JBLK) .EQ. 0) THEN                                 UIBIN    1452
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1453
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1454
         WRITE(MSG(3),9306) BNAME(1:LEN),SPTYPE(NUM)                    UIBIN    1455
         WRITE(MSG(4),9307) DCCNAM(NUM)                                 UIBIN    1456
         CALL PRTMSG(4)                                                 UIBIN    1457
               IERCNT = IERCNT + 1                                      UIBIN    1458
            END IF                                                      UIBIN    1459
         ELSE                                                           UIBIN    1460
            MISS = 'DC CONVERTER'                                       UIBIN    1461
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1462
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1463
         WRITE(MSG(3),9002) MISS                                        UIBIN    1464
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1465
         WRITE(MSG(5),9004)                                             UIBIN    1466
         CALL PRTMSG(5)                                                 UIBIN    1467
            IERCNT = IERCNT + 1                                         UIBIN    1468
            UDVAL(JBLK) = 0.0                                           UIBIN    1469
         END IF                                                         UIBIN    1470
C                                                                       UIBIN    1471
C                                                                       UIBIN    1472
C     Voltage Difference.                                               UIBIN    1473
C                                                                       UIBIN    1474
      ELSEIF(IUDSUB(JBLK).EQ.IVDIFF)THEN                                UIBIN    1475
         IF(OK)THEN                                                     UIBIN    1476
            IF(JBUS1.EQ.JGROUN)THEN                                     UIBIN    1477
               VJBUS1 = 0.0                                             UIBIN    1478
            ELSE                                                        UIBIN    1479
               VJBUS1 = VDCNOD(JBUS1)                                   UIBIN    1480
            END IF                                                      UIBIN    1481
C                                                                       UIBIN    1482
            IF(JBUS2.EQ.JGROUN)THEN                                     UIBIN    1483
               VJBUS2 = 0.0                                             UIBIN    1484
            ELSE                                                        UIBIN    1485
               VJBUS2 = VDCNOD(JBUS2)                                   UIBIN    1486
            END IF                                                      UIBIN    1487
C                                                                       UIBIN    1488
            UDVAL(JBLK) = VJBUS1 - VJBUS2                               UIBIN    1489
C                                                                       UIBIN    1490
         ELSE                                                           UIBIN    1491
C                                                                       UIBIN    1492
            IF(JBUS1.EQ.0)THEN                                          UIBIN    1493
               MISS = 'DC NODE 1'                                       UIBIN    1494
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1495
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1496
         WRITE(MSG(3),9002) MISS                                        UIBIN    1497
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1498
         WRITE(MSG(5),9004)                                             UIBIN    1499
         CALL PRTMSG(5)                                                 UIBIN    1500
               IERCNT = IERCNT + 1                                      UIBIN    1501
            END IF                                                      UIBIN    1502
            IF(JBUS2.EQ.0)THEN                                          UIBIN    1503
               MISS = 'DC BUS 2'                                        UIBIN    1504
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1505
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1506
         WRITE(MSG(3),9002) MISS                                        UIBIN    1507
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1508
         WRITE(MSG(5),9004)                                             UIBIN    1509
         CALL PRTMSG(5)                                                 UIBIN    1510
               IERCNT = IERCNT + 1                                      UIBIN    1511
            END IF                                                      UIBIN    1512
            UDVAL(JBLK) = 0.0                                           UIBIN    1513
         END IF                                                         UIBIN    1514
C                                                                       UIBIN    1515
C     Invalid subtype.                                                  UIBIN    1516
C                                                                       UIBIN    1517
      ELSE                                                              UIBIN    1518
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1519
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1520
         WRITE(MSG(3),9006)                                             UIBIN    1521
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1522
         WRITE(MSG(5),9004)                                             UIBIN    1523
         CALL PRTMSG(5)                                                 UIBIN    1524
      END IF                                                            UIBIN    1525
C                                                                       UIBIN    1526
      RETURN                                                            UIBIN    1527
C                                                                       UIBIN    1528
C                                                                       UIBIN    1529
C---------------------------------------------------------------------  UIBIN    1530
C                                                                       UIBIN    1531
      ENTRY UIMLTP (JBLK)                                               UIBIN    1532
CD -------------------------------------------------------------------  UIBIN    1533
CD                                                                      UIBIN    1534
CD              *****     UIMLTP  ROUTINE   *****                       UIBIN    1535
CD                                                                      UIBIN    1536
CD -------------------------------------------------------------------  UIBIN    1537
CD                                                                      UIBIN    1538
CD       PURPOSE:  Performs the initialization of the udc type MULTIPLE.UIBIN    1539
CD                                                                      UIBIN    1540
CD -------------------------------------------------------------------  UIBIN    1541
C                                                                       UIBIN    1542
      IF(SDBG)THEN                                                      UIBIN    1543
         SUBNAM = 'UIMLTP ROUTINE.'                                     UIBIN    1544
      ELSE                                                              UIBIN    1545
         SUBNAM = ' '                                                   UIBIN    1546
      ENDIF                                                             UIBIN    1547
      TNAME = TPNAME(MULTI)                                             UIBIN    1548
      BNAME = UDNAME(JBLK)                                              UIBIN    1549
      LEN = IUDLEN(JBLK)                                                UIBIN    1550
C                                                                       UIBIN    1551
C                                                                       UIBIN    1552
C     Retrieve input value.                                             UIBIN    1553
C                                                                       UIBIN    1554
      NEXTI = IUNIPT(JBLK)                                              UIBIN    1555
      NEXTP = IUDPPT(JBLK)                                              UIBIN    1556
C                                                                       UIBIN    1557
C                                                                       UIBIN    1558
      IF(IUDSUB(JBLK) .NE. ISUMR)THEN                                   UIBIN    1559
C                                                                       UIBIN    1560
         IF(NEXTI.EQ.0 .OR. NEXTP.EQ.0)THEN                             UIBIN    1561
C                                                                       UIBIN    1562
C           No input values were defined.                               UIBIN    1563
C                                                                       UIBIN    1564
            MISS = 'INPUT'                                              UIBIN    1565
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1566
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1567
         WRITE(MSG(3),9002) MISS                                        UIBIN    1568
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1569
         WRITE(MSG(5),9004)                                             UIBIN    1570
         CALL PRTMSG(5)                                                 UIBIN    1571
            IERCNT = IERCNT + 1                                         UIBIN    1572
            UDVAL(JBLK) = 0.0                                           UIBIN    1573
C                                                                       UIBIN    1574
         ELSE                                                           UIBIN    1575
C                                                                       UIBIN    1576
C           Initialize output to the first input.                       UIBIN    1577
C                                                                       UIBIN    1578
            IF(UIDENT(NEXTI) .NE. ' ')THEN                              UIBIN    1579
               UDVAL(JBLK) = UDVAL(IUDINT(NEXTI))                       UIBIN    1580
            ELSE                                                        UIBIN    1581
               UDVAL(JBLK) = UDPARM(NEXTP)                              UIBIN    1582
            ENDIF                                                       UIBIN    1583
            NEXTI = IUDINX(NEXTI)                                       UIBIN    1584
            NEXTP = IUDPNX(NEXTP)                                       UIBIN    1585
         ENDIF                                                          UIBIN    1586
C                                                                       UIBIN    1587
C        Keep retrieving input values until no more are stored.         UIBIN    1588
C                                                                       UIBIN    1589
220      IF(NEXTI.EQ.0 .OR. NEXTP.EQ.0) GOTO 240                        UIBIN    1590
            IF(UIDENT(NEXTI) .NE. ' ')THEN                              UIBIN    1591
               VALUE = UDVAL(IUDINT(NEXTI))                             UIBIN    1592
            ELSE                                                        UIBIN    1593
               VALUE = UDPARM(NEXTP)                                    UIBIN    1594
            ENDIF                                                       UIBIN    1595
C                                                                       UIBIN    1596
C                                                                       UIBIN    1597
C           Multiple addition.                                          UIBIN    1598
C                                                                       UIBIN    1599
            IF(IUDSUB(JBLK).EQ.ISUMS)THEN                               UIBIN    1600
               UDVAL(JBLK) = UDVAL(JBLK) + VALUE                        UIBIN    1601
C                                                                       UIBIN    1602
C                                                                       UIBIN    1603
C           Multiple minimum.                                           UIBIN    1604
C                                                                       UIBIN    1605
            ELSEIF(IUDSUB(JBLK).EQ.MINS)THEN                            UIBIN    1606
              UDVAL(JBLK) = MIN(UDVAL(JBLK),VALUE)                      UIBIN    1607
C                                                                       UIBIN    1608
C                                                                       UIBIN    1609
C           Multiple maximum.                                           UIBIN    1610
C                                                                       UIBIN    1611
            ELSEIF(IUDSUB(JBLK).EQ.MAXS)THEN                            UIBIN    1612
               UDVAL(JBLK) = MAX(UDVAL(JBLK),VALUE)                     UIBIN    1613
C                                                                       UIBIN    1614
C                                                                       UIBIN    1615
C           Invalid subtype.                                            UIBIN    1616
C                                                                       UIBIN    1617
            ELSE                                                        UIBIN    1618
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1619
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1620
         WRITE(MSG(3),9006)                                             UIBIN    1621
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1622
         WRITE(MSG(5),9004)                                             UIBIN    1623
         CALL PRTMSG(5)                                                 UIBIN    1624
               IERCNT = IERCNT + 1                                      UIBIN    1625
               UDVAL(JBLK) = 0.0                                        UIBIN    1626
            ENDIF                                                       UIBIN    1627
C                                                                       UIBIN    1628
            NEXTI = IUDINX(NEXTI)                                       UIBIN    1629
            NEXTP = IUDPNX(NEXTP)                                       UIBIN    1630
            GOTO 220                                                    UIBIN    1631
240      CONTINUE                                                       UIBIN    1632
C                                                                       UIBIN    1633
C                                                                       UIBIN    1634
C                                                                       UIBIN    1635
      ELSE                                                              UIBIN    1636
C                                                                       UIBIN    1637
         IF(NEXTI.EQ.0 .OR. NEXTP.EQ.0)THEN                             UIBIN    1638
C                                                                       UIBIN    1639
C           No input values were defined.                               UIBIN    1640
C                                                                       UIBIN    1641
            MISS = 'INPUT'                                              UIBIN    1642
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1643
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1644
         WRITE(MSG(3),9002) MISS                                        UIBIN    1645
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1646
         WRITE(MSG(5),9004)                                             UIBIN    1647
         CALL PRTMSG(5)                                                 UIBIN    1648
            IERCNT = IERCNT + 1                                         UIBIN    1649
            VALUE = 0.0                                                 UIBIN    1650
C                                                                       UIBIN    1651
         ELSE                                                           UIBIN    1652
C                                                                       UIBIN    1653
C           Initialize output to the first input.                       UIBIN    1654
C                                                                       UIBIN    1655
            IF(UIDENT(NEXTI) .NE. ' ')THEN                              UIBIN    1656
               VALUE = UDVAL(IUDINT(NEXTI))                             UIBIN    1657
            ELSE                                                        UIBIN    1658
               VALUE = UDPARM(NEXTP)                                    UIBIN    1659
            ENDIF                                                       UIBIN    1660
            NEXTI = IUDINX(NEXTI)                                       UIBIN    1661
            NEXTP = IUDPNX(NEXTP)                                       UIBIN    1662
         ENDIF                                                          UIBIN    1663
C                                                                       UIBIN    1664
C                                                                       UIBIN    1665
         IF(NEXTP.EQ.0)THEN                                             UIBIN    1666
C                                                                       UIBIN    1667
C           No gain values were defined.                                UIBIN    1668
C                                                                       UIBIN    1669
            MISS = 'GAIN'                                               UIBIN    1670
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1671
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1672
         WRITE(MSG(3),9002) MISS                                        UIBIN    1673
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1674
         WRITE(MSG(5),9004)                                             UIBIN    1675
         CALL PRTMSG(5)                                                 UIBIN    1676
            IERCNT = IERCNT + 1                                         UIBIN    1677
            GAIN = 1.0                                                  UIBIN    1678
C                                                                       UIBIN    1679
         ELSE                                                           UIBIN    1680
C                                                                       UIBIN    1681
C           Multiple first output by gain.                              UIBIN    1682
C                                                                       UIBIN    1683
            GAIN = UDPARM(NEXTP)                                        UIBIN    1684
            NEXTP = IUDPNX(NEXTP)                                       UIBIN    1685
         ENDIF                                                          UIBIN    1686
C                                                                       UIBIN    1687
         UDVAL(JBLK) = VALUE * GAIN                                     UIBIN    1688
C                                                                       UIBIN    1689
260      IF(NEXTI.EQ.0 .OR. NEXTP.EQ.0) GOTO 280                        UIBIN    1690
C                                                                       UIBIN    1691
C           Initialize output to the first input.                       UIBIN    1692
C                                                                       UIBIN    1693
            IF(UIDENT(NEXTI) .NE. ' ')THEN                              UIBIN    1694
               VALUE = UDVAL(IUDINT(NEXTI))                             UIBIN    1695
            ELSE                                                        UIBIN    1696
               VALUE = UDPARM(NEXTP)                                    UIBIN    1697
            ENDIF                                                       UIBIN    1698
            NEXTI = IUDINX(NEXTI)                                       UIBIN    1699
            NEXTP = IUDPNX(NEXTP)                                       UIBIN    1700
C                                                                       UIBIN    1701
C                                                                       UIBIN    1702
            IF(NEXTP.EQ.0)THEN                                          UIBIN    1703
C                                                                       UIBIN    1704
C              No gain values were defined.                             UIBIN    1705
C                                                                       UIBIN    1706
               MISS = 'GAIN'                                            UIBIN    1707
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1708
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1709
         WRITE(MSG(3),9002) MISS                                        UIBIN    1710
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1711
         WRITE(MSG(5),9004)                                             UIBIN    1712
         CALL PRTMSG(5)                                                 UIBIN    1713
               IERCNT = IERCNT + 1                                      UIBIN    1714
               GAIN = 1.0                                               UIBIN    1715
C                                                                       UIBIN    1716
            ELSE                                                        UIBIN    1717
C                                                                       UIBIN    1718
C              Multiple first output by gain.                           UIBIN    1719
C                                                                       UIBIN    1720
               GAIN = UDPARM(NEXTP)                                     UIBIN    1721
               NEXTP = IUDPNX(NEXTP)                                    UIBIN    1722
            ENDIF                                                       UIBIN    1723
C                                                                       UIBIN    1724
            UDVAL(JBLK) = UDVAL(JBLK) + VALUE * GAIN                    UIBIN    1725
C                                                                       UIBIN    1726
            GOTO 260                                                    UIBIN    1727
280      CONTINUE                                                       UIBIN    1728
      ENDIF                                                             UIBIN    1729
C                                                                       UIBIN    1730
      RETURN                                                            UIBIN    1731
C                                                                       UIBIN    1732
C                                                                       UIBIN    1733
C---------------------------------------------------------------------  UIBIN    1734
C                                                                       UIBIN    1735
      ENTRY UISBLK (JBLK)                                               UIBIN    1736
CD -------------------------------------------------------------------  UIBIN    1737
CD                                                                      UIBIN    1738
CD              *****     UISBLK  ROUTINE   *****                       UIBIN    1739
CD                                                                      UIBIN    1740
CD -------------------------------------------------------------------  UIBIN    1741
CD                                                                      UIBIN    1742
CD       PURPOSE:  Performs initialization of udc type SBLOCK.          UIBIN    1743
CD                                                                      UIBIN    1744
CD -------------------------------------------------------------------  UIBIN    1745
C                                                                       UIBIN    1746
      IF(SDBG)THEN                                                      UIBIN    1747
         SUBNAM = 'UISBLK ROUTINE.'                                     UIBIN    1748
      ELSE                                                              UIBIN    1749
         SUBNAM = ' '                                                   UIBIN    1750
      END IF                                                            UIBIN    1751
      TNAME = TPNAME(ISBLCK)                                            UIBIN    1752
      BNAME = UDNAME(JBLK)                                              UIBIN    1753
      LEN = IUDLEN(JBLK)                                                UIBIN    1754
C                                                                       UIBIN    1755
C                                                                       UIBIN    1756
      ERROR = .FALSE.                                                   UIBIN    1757
C                                                                       UIBIN    1758
C                                                                       UIBIN    1759
      NEXTI = IUNIPT(JBLK)                                              UIBIN    1760
      NEXTP = IUDPPT(JBLK)                                              UIBIN    1761
      NEXTS = IUDSPT(JBLK)                                              UIBIN    1762
C                                                                       UIBIN    1763
C     Input block.                                                      UIBIN    1764
C                                                                       UIBIN    1765
      IF(NEXTI.EQ.0)THEN                                                UIBIN    1766
         MISS = 'INPUT VALUE'                                           UIBIN    1767
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1768
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1769
         WRITE(MSG(3),9002) MISS                                        UIBIN    1770
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1771
         WRITE(MSG(5),9004)                                             UIBIN    1772
         CALL PRTMSG(5)                                                 UIBIN    1773
         IERCNT = IERCNT + 1                                            UIBIN    1774
         ERROR = .TRUE.                                                 UIBIN    1775
         VALUE = 0.0                                                    UIBIN    1776
      ELSE                                                              UIBIN    1777
         JBLOCK = IUDINT(NEXTI)                                         UIBIN    1778
         VALUE = UDVAL(JBLOCK)                                          UIBIN    1779
         NEXTI = IUDINX(NEXTI)                                          UIBIN    1780
      END IF                                                            UIBIN    1781
C                                                                       UIBIN    1782
C                                                                       UIBIN    1783
      IF(IUDSUB(JBLK).EQ.LIMITS)THEN                                    UIBIN    1784
C                                                                       UIBIN    1785
C        Read in the limits.                                            UIBIN    1786
C                                                                       UIBIN    1787
         IF(NEXTI.EQ.0 .OR. NEXTP.EQ.0)THEN                             UIBIN    1788
            MISS = 'LOW LIMIT'                                          UIBIN    1789
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1790
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1791
         WRITE(MSG(3),9002) MISS                                        UIBIN    1792
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1793
         WRITE(MSG(5),9004)                                             UIBIN    1794
         CALL PRTMSG(5)                                                 UIBIN    1795
            IERCNT = IERCNT + 1                                         UIBIN    1796
            ERROR = .TRUE.                                              UIBIN    1797
            XLOW = 0.0                                                  UIBIN    1798
         ELSE                                                           UIBIN    1799
            IF(UIDENT(NEXTI) .NE. ' ')THEN                              UIBIN    1800
               XLOW = UDVAL(IUDINT(NEXTI))                              UIBIN    1801
            ELSE                                                        UIBIN    1802
               XLOW = UDPARM(NEXTP)                                     UIBIN    1803
            END IF                                                      UIBIN    1804
            NEXTI = IUDINX(NEXTI)                                       UIBIN    1805
            NEXTP = IUDPNX(NEXTP)                                       UIBIN    1806
         END IF                                                         UIBIN    1807
C                                                                       UIBIN    1808
         IF(NEXTI.EQ.0 .OR. NEXTP.EQ.0)THEN                             UIBIN    1809
            MISS = 'HIGH LIMIT'                                         UIBIN    1810
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1811
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1812
         WRITE(MSG(3),9002) MISS                                        UIBIN    1813
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1814
         WRITE(MSG(5),9004)                                             UIBIN    1815
         CALL PRTMSG(5)                                                 UIBIN    1816
            IERCNT = IERCNT + 1                                         UIBIN    1817
            ERROR = .TRUE.                                              UIBIN    1818
            HIGH = 0.0                                                  UIBIN    1819
         ELSE                                                           UIBIN    1820
            IF(UIDENT(NEXTI) .NE. ' ')THEN                              UIBIN    1821
               HIGH = UDVAL(IUDINT(NEXTI))                              UIBIN    1822
            ELSE                                                        UIBIN    1823
               HIGH = UDPARM(NEXTP)                                     UIBIN    1824
            END IF                                                      UIBIN    1825
            NEXTI = IUDINX(NEXTI)                                       UIBIN    1826
            NEXTP = IUDPNX(NEXTP)                                       UIBIN    1827
         END IF                                                         UIBIN    1828
C                                                                       UIBIN    1829
      END IF                                                            UIBIN    1830
C                                                                       UIBIN    1831
C                                                                       UIBIN    1832
C     Order of equations.                                               UIBIN    1833
C                                                                       UIBIN    1834
      IF(NEXTI.EQ.0)THEN                                                UIBIN    1835
         MISS = 'ORDER'                                                 UIBIN    1836
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1837
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1838
         WRITE(MSG(3),9002) MISS                                        UIBIN    1839
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1840
         WRITE(MSG(5),9004)                                             UIBIN    1841
         CALL PRTMSG(5)                                                 UIBIN    1842
         IERCNT = IERCNT + 1                                            UIBIN    1843
         ERROR = .TRUE.                                                 UIBIN    1844
         JORDER = 0                                                     UIBIN    1845
         KORDER = 0                                                     UIBIN    1846
      ELSE                                                              UIBIN    1847
         JORDER = IUDINT(NEXTI)                                         UIBIN    1848
         KORDER = JORDER + 1                                            UIBIN    1849
         NEXTI = IUDINT(NEXTI)                                          UIBIN    1850
         IF(JORDER .GT. 10)THEN                                         UIBIN    1851
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1852
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1853
         WRITE(MSG(3),9504) BNAME(1:LEN),JORDER                         UIBIN    1854
         WRITE(MSG(4),9505)                                             UIBIN    1855
         WRITE(MSG(5),9506)                                             UIBIN    1856
         CALL PRTMSG(5)                                                 UIBIN    1857
            IERCNT = IERCNT + 1                                         UIBIN    1858
         ERROR = .TRUE.                                                 UIBIN    1859
            JORDER = 0                                                  UIBIN    1860
            KORDER = 0                                                  UIBIN    1861
         END IF                                                         UIBIN    1862
      END IF                                                            UIBIN    1863
C                                                                       UIBIN    1864
C                                                                       UIBIN    1865
C     Read in little a's.                                               UIBIN    1866
C                                                                       UIBIN    1867
      DO 320 I = KORDER, 1, -1                                          UIBIN    1868
         IF(NEXTP.EQ.0)THEN                                             UIBIN    1869
            MISS = 'LITTLE A VALUE'                                     UIBIN    1870
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1871
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1872
         WRITE(MSG(3),9002) MISS                                        UIBIN    1873
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1874
         WRITE(MSG(5),9004)                                             UIBIN    1875
         CALL PRTMSG(5)                                                 UIBIN    1876
            IERCNT = IERCNT + 1                                         UIBIN    1877
            ERROR = .TRUE.                                              UIBIN    1878
            AA(I) = 0.0                                                 UIBIN    1879
         ELSE                                                           UIBIN    1880
            AA(I) = UDPARM(NEXTP)                                       UIBIN    1881
            NEXTP = IUDPNX(NEXTP)                                       UIBIN    1882
         END IF                                                         UIBIN    1883
320   CONTINUE                                                          UIBIN    1884
C                                                                       UIBIN    1885
C                                                                       UIBIN    1886
C     Read in little c's.                                               UIBIN    1887
C                                                                       UIBIN    1888
      DO 340 I = KORDER, 1, -1                                          UIBIN    1889
         IF(NEXTP.EQ.0)THEN                                             UIBIN    1890
            MISS = 'LITTLE C VALUE'                                     UIBIN    1891
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    1892
         WRITE(MSG(2),9001) TNAME                                       UIBIN    1893
         WRITE(MSG(3),9002) MISS                                        UIBIN    1894
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    1895
         WRITE(MSG(5),9004)                                             UIBIN    1896
         CALL PRTMSG(5)                                                 UIBIN    1897
            IERCNT = IERCNT + 1                                         UIBIN    1898
            ERROR = .TRUE.                                              UIBIN    1899
            CC(I) = 0.0                                                 UIBIN    1900
         ELSE                                                           UIBIN    1901
            CC(I) = UDPARM(NEXTP)                                       UIBIN    1902
            NEXTP = IUDPNX(NEXTP)                                       UIBIN    1903
         END IF                                                         UIBIN    1904
340   CONTINUE                                                          UIBIN    1905
C                                                                       UIBIN    1906
C                                                                       UIBIN    1907
      IF(ERROR)THEN                                                     UIBIN    1908
         UDVAL(JBLK) = 0.0                                              UIBIN    1909
      ELSE                                                              UIBIN    1910
         UDVAL(JBLK) = (AA(1) / CC(1)) * VALUE                          UIBIN    1911
C                                                                       UIBIN    1912
C                                                                       UIBIN    1913
C        Zero out arrays.                                               UIBIN    1914
C                                                                       UIBIN    1915
         DO 380 JCOL = 1, JORDER                                        UIBIN    1916
            DO 360 JROW = 1, JORDER                                     UIBIN    1917
               A(JROW,JCOL) = 0.0                                       UIBIN    1918
360         CONTINUE                                                    UIBIN    1919
            B(JCOL) = 0.0                                               UIBIN    1920
            C(JCOL) = 0.0                                               UIBIN    1921
380      CONTINUE                                                       UIBIN    1922
C                                                                       UIBIN    1923
C                                                                       UIBIN    1924
C        Define array A.                                                UIBIN    1925
C                                                                       UIBIN    1926
         DO 400 JCOL = 2, JORDER                                        UIBIN    1927
            JROW = JCOL - 1                                             UIBIN    1928
            A(JROW,JCOL) = 1.0                                          UIBIN    1929
400      CONTINUE                                                       UIBIN    1930
C                                                                       UIBIN    1931
         DO 420 JCOL = 1, JORDER                                        UIBIN    1932
            A(JORDER,JCOL) = -CC(JCOL) / CC(KORDER)                     UIBIN    1933
420      CONTINUE                                                       UIBIN    1934
C                                                                       UIBIN    1935
C        Define vector B.                                               UIBIN    1936
C                                                                       UIBIN    1937
         B(JORDER) = 1.0                                                UIBIN    1938
C                                                                       UIBIN    1939
C        Define vector C.                                               UIBIN    1940
C                                                                       UIBIN    1941
         DO 440 JCOL = 1, JORDER                                        UIBIN    1942
         C(JCOL)=(AA(JCOL)+AA(KORDER)*A(JORDER,JCOL))/CC(KORDER)        UIBIN    1943
440      CONTINUE                                                       UIBIN    1944
C                                                                       UIBIN    1945
C        Define value D.                                                UIBIN    1946
C                                                                       UIBIN    1947
         D = AA(KORDER) / CC(KORDER)                                    UIBIN    1948
C                                                                       UIBIN    1949
         LIMIT = .FALSE.                                                UIBIN    1950
         IF(IUDSUB(JBLK).EQ.LIMITS)THEN                                 UIBIN    1951
            IF(XLOW.EQ.0.0.AND.HIGH.EQ.0.0)THEN                         UIBIN    1952
               LIMIT = .FALSE.                                          UIBIN    1953
            ELSEIF(UDVAL(JBLK) .LT. XLOW)THEN                           UIBIN    1954
               LIMIT = .TRUE.                                           UIBIN    1955
               UDVAL(JBLK) = XLOW                                       UIBIN    1956
            ELSEIF(UDVAL(JBLK) .GT. HIGH)THEN                           UIBIN    1957
               LIMIT = .TRUE.                                           UIBIN    1958
               UDVAL(JBLK) = HIGH                                       UIBIN    1959
            END IF                                                      UIBIN    1960
         END IF                                                         UIBIN    1961
C                                                                       UIBIN    1962
C        Inititally, define the previous state vector.                  UIBIN    1963
C                                                                       UIBIN    1964
         NEXTS = IUDSPT(JBLK)                                           UIBIN    1965
         IF(NEXTS.EQ.0)THEN                                             UIBIN    1966
            NEXTS = IUDSFR                                              UIBIN    1967
            IUDSFR = IUDSNX(IUDSFR)                                     UIBIN    1968
            IUDSPT(JBLK) = NEXTS                                        UIBIN    1969
            IUDSNX(NEXTS) = 0                                           UIBIN    1970
            LASTS = NEXTS                                               UIBIN    1971
         END IF                                                         UIBIN    1972
C                                                                       UIBIN    1973
         IF(LIMIT)THEN                                                  UIBIN    1974
            TEMP = (UDVAL(JBLK) - AA(KORDER) * VALUE) /                 UIBIN    1975
     1                     (C(1) * CC(KORDER))                          UIBIN    1976
         ELSE                                                           UIBIN    1977
            TEMP = - VALUE / A(JORDER,1)                                UIBIN    1978
         END IF                                                         UIBIN    1979
C                                                                       UIBIN    1980
         KORDER = JORDER + 1                                            UIBIN    1981
         DO 460 N = 1, KORDER                                           UIBIN    1982
            IF(NEXTS.EQ.0)THEN                                          UIBIN    1983
               NEXTS = IUDSFR                                           UIBIN    1984
               IUDSFR = IUDSNX(IUDSFR)                                  UIBIN    1985
               IUDSNX(LASTS) = NEXTS                                    UIBIN    1986
               IUDSNX(NEXTS) = 0                                        UIBIN    1987
            END IF                                                      UIBIN    1988
            LASTS = NEXTS                                               UIBIN    1989
            IF(N.EQ.KORDER)THEN                                         UIBIN    1990
               UDOLD(NEXTS) = VALUE                                     UIBIN    1991
            ELSEIF(N.EQ.1)THEN                                          UIBIN    1992
               UDOLD(NEXTS) = TEMP                                      UIBIN    1993
            ELSE                                                        UIBIN    1994
               UDOLD(NEXTS) = 0.0                                       UIBIN    1995
            END IF                                                      UIBIN    1996
            NEXTS = IUDSNX(NEXTS)                                       UIBIN    1997
460      CONTINUE                                                       UIBIN    1998
C                                                                       UIBIN    1999
      END IF                                                            UIBIN    2000
C                                                                       UIBIN    2001
      RETURN                                                            UIBIN    2002
C                                                                       UIBIN    2003
C                                                                       UIBIN    2004
C---------------------------------------------------------------------  UIBIN    2005
C                                                                       UIBIN    2006
      ENTRY UISRCE (JBLK)                                               UIBIN    2007
CD -------------------------------------------------------------------  UIBIN    2008
CD                                                                      UIBIN    2009
CD              *****     UISRCE  ROUTINE   *****                       UIBIN    2010
CD                                                                      UIBIN    2011
CD -------------------------------------------------------------------  UIBIN    2012
CD                                                                      UIBIN    2013
CD       PURPOSE:  Performs the initialization of the udc type SOURCE.  UIBIN    2014
CD                                                                      UIBIN    2015
CD -------------------------------------------------------------------  UIBIN    2016
C                                                                       UIBIN    2017
      IF(SDBG)THEN                                                      UIBIN    2018
         SUBNAM = 'UISRCE ROUTINE.'                                     UIBIN    2019
      ELSE                                                              UIBIN    2020
         SUBNAM = ' '                                                   UIBIN    2021
      END IF                                                            UIBIN    2022
      TNAME = TPNAME(ISOURC)                                            UIBIN    2023
      BNAME = UDNAME(JBLK)                                              UIBIN    2024
      LEN = IUDLEN(JBLK)                                                UIBIN    2025
C                                                                       UIBIN    2026
C     Determine the UDVAL based on what subtype was stored.             UIBIN    2027
C                                                                       UIBIN    2028
C     Retrieve input values.                                            UIBIN    2029
C                                                                       UIBIN    2030
      NEXTI = IUNIPT(JBLK)                                              UIBIN    2031
      NEXTP = IUDPPT(JBLK)                                              UIBIN    2032
      NEXTR = IUDRPT(JBLK)                                              UIBIN    2033
C                                                                       UIBIN    2034
C     Fixed DC value.                                                   UIBIN    2035
C                                                                       UIBIN    2036
      IF(IUDSUB(JBLK).EQ.IDCS)THEN                                      UIBIN    2037
         IF(NEXTP.EQ.0)THEN                                             UIBIN    2038
C                                                                       UIBIN    2039
C           No amplitude was stored.                                    UIBIN    2040
C                                                                       UIBIN    2041
            MISS = 'AMPLITUDE'                                          UIBIN    2042
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    2043
         WRITE(MSG(2),9001) TNAME                                       UIBIN    2044
         WRITE(MSG(3),9002) MISS                                        UIBIN    2045
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    2046
         WRITE(MSG(5),9004)                                             UIBIN    2047
         CALL PRTMSG(5)                                                 UIBIN    2048
            IERCNT = IERCNT + 1                                         UIBIN    2049
         ELSE                                                           UIBIN    2050
            AMPLIT = UDPARM(NEXTP)                                      UIBIN    2051
            NEXTP = IUDPNX(NEXTP)                                       UIBIN    2052
         END IF                                                         UIBIN    2053
C                                                                       UIBIN    2054
         IF(NEXTP.EQ.0)THEN                                             UIBIN    2055
C                                                                       UIBIN    2056
C           No start time was stored.                                   UIBIN    2057
C                                                                       UIBIN    2058
            MISS = 'START TIME'                                         UIBIN    2059
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    2060
         WRITE(MSG(2),9001) TNAME                                       UIBIN    2061
         WRITE(MSG(3),9002) MISS                                        UIBIN    2062
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    2063
         WRITE(MSG(5),9004)                                             UIBIN    2064
         CALL PRTMSG(5)                                                 UIBIN    2065
            IERCNT = IERCNT + 1                                         UIBIN    2066
         ELSE                                                           UIBIN    2067
            SRTTIM = UDPARM(NEXTP)                                      UIBIN    2068
            NEXTP = IUDPNX(NEXTP)                                       UIBIN    2069
         END IF                                                         UIBIN    2070
C                                                                       UIBIN    2071
         IF(TIME .GE. SRTTIM)THEN                                       UIBIN    2072
            UDVAL(JBLK) = AMPLIT                                        UIBIN    2073
         ELSE                                                           UIBIN    2074
            UDVAL(JBLK) = 0.0                                           UIBIN    2075
         END IF                                                         UIBIN    2076
C                                                                       UIBIN    2077
C     Sinusoidal.                                                       UIBIN    2078
C                                                                       UIBIN    2079
      ELSEIF(IUDSUB(JBLK).EQ.ISINS)THEN                                 UIBIN    2080
C                                                                       UIBIN    2081
         IF(NEXTP.EQ.0)THEN                                             UIBIN    2082
C                                                                       UIBIN    2083
C           No amplitude was stored.                                    UIBIN    2084
C                                                                       UIBIN    2085
            MISS = 'AMPLITUDE'                                          UIBIN    2086
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    2087
         WRITE(MSG(2),9001) TNAME                                       UIBIN    2088
         WRITE(MSG(3),9002) MISS                                        UIBIN    2089
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    2090
         WRITE(MSG(5),9004)                                             UIBIN    2091
         CALL PRTMSG(5)                                                 UIBIN    2092
            IERCNT = IERCNT + 1                                         UIBIN    2093
         ELSE                                                           UIBIN    2094
            AMPLIT = UDPARM(NEXTP)                                      UIBIN    2095
            NEXTP = IUDPNX(NEXTP)                                       UIBIN    2096
         END IF                                                         UIBIN    2097
C                                                                       UIBIN    2098
         IF(NEXTP.EQ.0)THEN                                             UIBIN    2099
C                                                                       UIBIN    2100
C           No frequency was stored.                                    UIBIN    2101
C                                                                       UIBIN    2102
            MISS = 'FREQUENCY'                                          UIBIN    2103
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    2104
         WRITE(MSG(2),9001) TNAME                                       UIBIN    2105
         WRITE(MSG(3),9002) MISS                                        UIBIN    2106
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    2107
         WRITE(MSG(5),9004)                                             UIBIN    2108
         CALL PRTMSG(5)                                                 UIBIN    2109
            IERCNT = IERCNT + 1                                         UIBIN    2110
         ELSE                                                           UIBIN    2111
            FREQ = UDPARM(NEXTP)                                        UIBIN    2112
            NEXTP = IUDPNX(NEXTP)                                       UIBIN    2113
         END IF                                                         UIBIN    2114
C                                                                       UIBIN    2115
         IF(NEXTP.EQ.0)THEN                                             UIBIN    2116
C                                                                       UIBIN    2117
C           No phase was stored.                                        UIBIN    2118
C                                                                       UIBIN    2119
            MISS = 'PHASE'                                              UIBIN    2120
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    2121
         WRITE(MSG(2),9001) TNAME                                       UIBIN    2122
         WRITE(MSG(3),9002) MISS                                        UIBIN    2123
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    2124
         WRITE(MSG(5),9004)                                             UIBIN    2125
         CALL PRTMSG(5)                                                 UIBIN    2126
            IERCNT = IERCNT + 1                                         UIBIN    2127
         ELSE                                                           UIBIN    2128
            PHASE = UDPARM(NEXTP)                                       UIBIN    2129
            NEXTP = IUDPNX(NEXTP)                                       UIBIN    2130
         END IF                                                         UIBIN    2131
C                                                                       UIBIN    2132
         IF(NEXTP.EQ.0)THEN                                             UIBIN    2133
C                                                                       UIBIN    2134
C           No start time was stored.                                   UIBIN    2135
C                                                                       UIBIN    2136
            MISS = 'START TIME'                                         UIBIN    2137
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    2138
         WRITE(MSG(2),9001) TNAME                                       UIBIN    2139
         WRITE(MSG(3),9002) MISS                                        UIBIN    2140
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    2141
         WRITE(MSG(5),9004)                                             UIBIN    2142
         CALL PRTMSG(5)                                                 UIBIN    2143
            IERCNT = IERCNT + 1                                         UIBIN    2144
         ELSE                                                           UIBIN    2145
            SRTTIM = UDPARM(NEXTP)                                      UIBIN    2146
            NEXTP = IUDPNX(NEXTP)                                       UIBIN    2147
         END IF                                                         UIBIN    2148
C                                                                       UIBIN    2149
         IF(TIME .GE. SRTTIM)THEN                                       UIBIN    2150
            UDVAL(JBLK) = AMPLIT * SIN((FREQ * 2.0 * PII *              UIBIN    2151
     1                   (TIME - SRTTIM)) +  PHASE * PII/180.0)         UIBIN    2152
         ELSE                                                           UIBIN    2153
            UDVAL(JBLK) = 0.0                                           UIBIN    2154
         END IF                                                         UIBIN    2155
C                                                                       UIBIN    2156
C                                                                       UIBIN    2157
C     Ramp function.                                                    UIBIN    2158
C                                                                       UIBIN    2159
      ELSEIF(IUDSUB(JBLK).EQ.IRAMPS)THEN                                UIBIN    2160
C                                                                       UIBIN    2161
         IF(NEXTP.EQ.0)THEN                                             UIBIN    2162
C                                                                       UIBIN    2163
C           No ramp rate was stored.                                    UIBIN    2164
C                                                                       UIBIN    2165
            MISS = 'RAMP RATE'                                          UIBIN    2166
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    2167
         WRITE(MSG(2),9001) TNAME                                       UIBIN    2168
         WRITE(MSG(3),9002) MISS                                        UIBIN    2169
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    2170
         WRITE(MSG(5),9004)                                             UIBIN    2171
         CALL PRTMSG(5)                                                 UIBIN    2172
            IERCNT = IERCNT + 1                                         UIBIN    2173
         ELSE                                                           UIBIN    2174
            RAMP = UDPARM(NEXTP)                                        UIBIN    2175
            NEXTP = IUDPNX(NEXTP)                                       UIBIN    2176
         END IF                                                         UIBIN    2177
C                                                                       UIBIN    2178
         IF(NEXTP.EQ.0)THEN                                             UIBIN    2179
C                                                                       UIBIN    2180
C           No start time was stored.                                   UIBIN    2181
C                                                                       UIBIN    2182
            MISS = 'START TIME'                                         UIBIN    2183
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    2184
         WRITE(MSG(2),9001) TNAME                                       UIBIN    2185
         WRITE(MSG(3),9002) MISS                                        UIBIN    2186
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    2187
         WRITE(MSG(5),9004)                                             UIBIN    2188
         CALL PRTMSG(5)                                                 UIBIN    2189
            IERCNT = IERCNT + 1                                         UIBIN    2190
         ELSE                                                           UIBIN    2191
            SRTTIM = UDPARM(NEXTP)                                      UIBIN    2192
            NEXTP = IUDPNX(NEXTP)                                       UIBIN    2193
         END IF                                                         UIBIN    2194
C                                                                       UIBIN    2195
         IF(TIME .GE. SRTTIM)THEN                                       UIBIN    2196
            UDVAL(JBLK) = RAMP * (TIME - SRTTIM)                        UIBIN    2197
         ELSE                                                           UIBIN    2198
            UDVAL(JBLK) = 0.0                                           UIBIN    2199
         END IF                                                         UIBIN    2200
C                                                                       UIBIN    2201
C     Value of the simulation time clock.                               UIBIN    2202
C                                                                       UIBIN    2203
      ELSEIF(IUDSUB(JBLK).EQ.ITIMES)THEN                                UIBIN    2204
         UDVAL(JBLK) = TIME                                             UIBIN    2205
C                                                                       UIBIN    2206
C                                                                       UIBIN    2207
C     Value of the ac system solution time step delta(t).               UIBIN    2208
C                                                                       UIBIN    2209
      ELSEIF(IUDSUB(JBLK).EQ.IDTACS)THEN                                UIBIN    2210
         UDVAL(JBLK) = DTIME                                            UIBIN    2211
C                                                                       UIBIN    2212
C     Value of the dc system solution time step sigma(t).               UIBIN    2213
C                                                                       UIBIN    2214
      ELSEIF(IUDSUB(JBLK).EQ.IDTDCS)THEN                                UIBIN    2215
         UDVAL(JBLK) = STIME                                            UIBIN    2216
C                                                                       UIBIN    2217
C     Value of the dc control solution time step sigma(t).              UIBIN    2218
C                                                                       UIBIN    2219
      ELSEIF(IUDSUB(JBLK).EQ.IDTCCS)THEN                                UIBIN    2220
         UDVAL(JBLK) = CTIME                                            UIBIN    2221
C                                                                       UIBIN    2222
C                                                                       UIBIN    2223
C     Invalid subtype.                                                  UIBIN    2224
C                                                                       UIBIN    2225
      ELSE                                                              UIBIN    2226
         UDVAL(JBLK) = 0.0                                              UIBIN    2227
         WRITE(MSG(1),9000) SUBNAM                                      UIBIN    2228
         WRITE(MSG(2),9001) TNAME                                       UIBIN    2229
         WRITE(MSG(3),9006)                                             UIBIN    2230
         WRITE(MSG(4),9003) BNAME(1:LEN)                                UIBIN    2231
         WRITE(MSG(5),9004)                                             UIBIN    2232
         CALL PRTMSG(5)                                                 UIBIN    2233
         IERCNT = IERCNT + 1                                            UIBIN    2234
      END IF                                                            UIBIN    2235
C                                                                       UIBIN    2236
      RETURN                                                            UIBIN    2237
C                                                                       UIBIN    2238
9000  FORMAT(' *** MTDC ERROR', 5X, A)                                  UIBIN    2239
9001  FORMAT(10X,'DURING THE INITIALIZATION OF UDC "',A                 UIBIN    2240
     *,'" BLOCKS,')                                                     UIBIN    2241
9002  FORMAT(10X,'THE VALUE OF "',A,'" CANNOT BE FOUND FOR BLOCK,')     UIBIN    2242
9003  FORMAT(10X,'"',A,'".  THIS IS AN ERROR IN THE CODE,')             UIBIN    2243
9004  FORMAT(10X,'THE UDC INFORMATION IS NOT BEING STORED CORRECTLY.')  UIBIN    2244
9005  FORMAT(10X,'BLOCK "',A,'" HAS A DIVIDE BY ZERO.  THE RESULT OF')  UIBIN    2245
9900  FORMAT(10X,'THIS DIVISION IS SET TO NINETY-NINE.')                UIBIN    2246
9006  FORMAT(10X,'AN INVALID SUBTYPE WAS FOUND FOR BLOCK,')             UIBIN    2247
9104  FORMAT(10X                                                        UIBIN    2248
     *,'DURING THE INITIALIZATION OF UDC "FORTRAN" BLOCKS, THERE')      UIBIN    2249
9105  FORMAT(10X,'WERE NO INPUT PARAMETERS FOUND FOR BLOCK, "',A,'".')  UIBIN    2250
9106  FORMAT(10X,'WERE ',I3,' INPUT PARAMETERS FOUND FOR BLOCK, "',A    UIBIN    2251
     *,'".')                                                            UIBIN    2252
9107  FORMAT(10X,'THE MAXIMUM IS ', I3,'.')                             UIBIN    2253
9108  FORMAT(10X,'WERE ',I3,' OUTPUT PARAMETERS FOUND FOR BLOCK, "',A   UIBIN    2254
     *,'".')                                                            UIBIN    2255
9109  FORMAT(10X,'THE MAXIMUM IS ',I3,' THE MINIMUM IS 1.')             UIBIN    2256
9312  FORMAT(10X,'THE DC CONVERTER NUMBER CANNOT BE FOUND FOR BLOCK,')  UIBIN    2257
9304  FORMAT(10X,'BLOCK "',A,'" HAS AN INVALID RUN MODE.')              UIBIN    2258
9305  FORMAT(10X,'THIS IS AN ERROR IN THE CODE,')                       UIBIN    2259
9306  FORMAT(10X,'BLOCK "',A,'" HAS AN INVALID MODE OF "',A,'"')        UIBIN    2260
9307  FORMAT(10X,'FROM CONVERTER, "',A,'"')                             UIBIN    2261
9310  FORMAT(10X,'BLOCK "', A, '" REFERS TO THE BREAKER "',A            UIBIN    2262
     3,'" WHICH HAS BOTH NODES')                                        UIBIN    2263
9311  FORMAT(10X,'EQUAL TO GROUND.  THIS IS AN INVALID BREAKER.')       UIBIN    2264
9504  FORMAT(10X,'THE BLOCK "',A,'" HAS AN EQUATION OF ORDER '          UIBIN    2265
     *,I3,'.')                                                          UIBIN    2266
9505  FORMAT(10X,'THE PROGRAM CANNOT HANDLE ANY BLOCK WITH AN ORDER')   UIBIN    2267
9506  FORMAT(10X                                                        UIBIN    2268
     *,'GREATER THAN 10.  CHECK YOUR UDC INPUT FILE FOR ERRORS.')       UIBIN    2269
C                                                                       UIBIN    2270
C---------------------------------------------------------------------  UIBIN    2271
C                                                                       UIBIN    2272
      END                                                               UIBIN    2273
