CFPRIME AUDB1                                                           AUDB1       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 AUDB1(LORD,LTYP)                                       AUDB1       3
CD                                                                      AUDB1       4
CD    TO FORMULATE THE ELEMENTARY LINEARIZED EQUATIONS OF USER DEFINED  AUDB1       5
CD    DEFINED BLOCK TYPES 1, 25 AND 29 (GAIN BLOCKS) IN ANY USER        AUDB1       6
CD    DEFINED MODEL FOR USE IN CONSTRUCTING THE JACOBIAN MATRICES.      AUDB1       7
CD                                                                      AUDB1       8
CD    EACH ENTRY POINT IN THIS SUBROUTINE HAS SIMILAR FUNCTION IS FOR   AUDB1       9
CD    A DIFFERENT TYPE OF GENERAL BLOCK APPLICABLE TO ANY USER DEFINED  AUDB1      10
CD    MODEL.                                                            AUDB1      11
CD                                                                      AUDB1      12
      INCLUDE 'PARX.INS'                                                AUDB1      13
      INCLUDE 'CNB4.INS'                                                AUDB1      14
      INCLUDE 'CNUNIT.INS'                                              AUDB1      15
      INCLUDE 'CNFLAG.INS'                                              AUDB1      16
      INCLUDE 'CNUDM.INS'                                               AUDB1      17
      INCLUDE 'CNUDMA.INS'                                              AUDB1      18
      INCLUDE 'CNMSG.INS'                                               AUDB1      19
      INCLUDE 'CNVOLT.INS'                                              AUDB1      20
      INCLUDE 'CNMON.INS'                                               AUDB1      21
C                                                                       AUDB1      22
      LDEB=(JDEB(264).NE.0)                                             AUDB1      23
C                                                                       AUDB1      24
      IUB=IUB+1                                                         AUDB1      25
      IORD=IUDAT(JE4+LORD)                                              AUDB1      26
      JEI=JEB+2                                                         AUDB1      27
      KINT=KINPU                                                        AUDB1      28
      KINPU=KINPU+IUDAT(JEI+13)                                         AUDB1      29
      IF(KINT.LT.KINPU) THEN                                            AUDB1      30
         DO 110 J=KINT+1,KINPU                                          AUDB1      31
         XDAT=GAINS(J)                                                  AUDB1      32
         IOUT=INPUTS(J)                                                 AUDB1      33
         CYB(IUB,IOUT)=CYB(IUB,IOUT)+XDAT                               AUDB1      34
  110    CONTINUE                                                       AUDB1      35
      ENDIF                                                             AUDB1      36
      KINP=KINPU                                                        AUDB1      37
      KINPU=KINPU+IUDAT(JEI+14)                                         AUDB1      38
      IF(KINP.LT.KINPU) THEN                                            AUDB1      39
         DO 120 J=KINP+1,KINPU                                          AUDB1      40
         XDAT=GAINS(J)                                                  AUDB1      41
         IIN=INPUTS(J)                                                  AUDB1      42
         IF(IIN.LE.20) THEN                                             AUDB1      43
            DU0(IUB,IIN)=DU0(IUB,IIN)+XDAT                              AUDB1      44
         ELSE                                                           AUDB1      45
            DUR0(IUB,IIN-20)=DUR0(IUB,IIN-20)+XDAT                      AUDB1      46
         ENDIF                                                          AUDB1      47
  120    CONTINUE                                                       AUDB1      48
      ENDIF                                                             AUDB1      49
      IF (LTYP.EQ.1) THEN                                               AUDB1      50
         LL=IUDAT(JEI+8)                                                AUDB1      51
         IWS1=JEI+1                                                     AUDB1      52
      ELSE IF (LTYP.EQ.25) THEN                                         AUDB1      53
         LL=1                                                           AUDB1      54
         SUMA=1.0                                                       AUDB1      55
         SUMB=UDAT(JEI+7)                                               AUDB1      56
         DO 760 I=1,5                                                   AUDB1      57
         SUMA=SUMA+UDAT(JEI+I+1)                                        AUDB1      58
         SUMB=SUMB+UDAT(JEI+I+7)                                        AUDB1      59
  760    CONTINUE                                                       AUDB1      60
         DUB(IORD,IUB)=SUMB/SUMA                                        AUDB1      61
      ELSE IF (LTYP.EQ.29) THEN                                         AUDB1      62
         LL=0                                                           AUDB1      63
         IWS1=JEI+6                                                     AUDB1      64
      ELSE                                                              AUDB1      65
         WRITE(MSG(1),1005)                                             AUDB1      66
         CALL PRTMSG(1)                                                 AUDB1      67
         MSG(1)='AUDB1: UNKNOWN BLOCK TYPE.'                            AUDB1      68
         CALL ASTOP(MSG(1),26)                                          AUDB1      69
      END IF                                                            AUDB1      70
      IF (LL.EQ.0) THEN                                                 AUDB1      71
         DUB(IORD,IUB)=UDAT(IWS1)                                       AUDB1      72
      END IF                                                            AUDB1      73
      IF(LDEB) WRITE(IUD6,1000) LORD,IORD                               AUDB1      74
C                                                                       AUDB1      75
      RETURN                                                            AUDB1      76
 1000 FORMAT(1X,'LORD,IORD: ',2I5)                                      AUDB1      77
 1005 FORMAT(1X,'AUDB1: UNKNOWN BLOCK TYPE.')                           AUDB1      78
C                                                                       AUDB1      79
C-----------------------------------------------------------------------AUDB1      80
C                                                                       AUDB1      81
      ENTRY AUDB2(LORD)                                                 AUDB1      82
CD                                                                      AUDB1      83
CD    FOR BLOCK TYPE 2 (INTEGRATION BLOCK)                              AUDB1      84
CD                                                                      AUDB1      85
      LDEB=(JDEB(264).NE.0)                                             AUDB1      86
C                                                                       AUDB1      87
      IUB=IUB+1                                                         AUDB1      88
      IORD=IUDAT(JE4+LORD)                                              AUDB1      89
      JEI=JEB+2                                                         AUDB1      90
      KINT=KINPU                                                        AUDB1      91
      KINPU=KINPU+IUDAT(JEI+13)                                         AUDB1      92
      IF(KINT.LT.KINPU) THEN                                            AUDB1      93
         DO 130 J=KINT+1,KINPU                                          AUDB1      94
         XDAT=GAINS(J)                                                  AUDB1      95
         IOUT=INPUTS(J)                                                 AUDB1      96
         CYB(IUB,IOUT)=CYB(IUB,IOUT)+XDAT                               AUDB1      97
  130    CONTINUE                                                       AUDB1      98
      ENDIF                                                             AUDB1      99
      KINP=KINPU                                                        AUDB1     100
      KINPU=KINPU+IUDAT(JEI+14)                                         AUDB1     101
      IF(KINP.LT.KINPU) THEN                                            AUDB1     102
         DO 140 J=KINP+1,KINPU                                          AUDB1     103
         XDAT=GAINS(J)                                                  AUDB1     104
         IIN=INPUTS(J)                                                  AUDB1     105
         IF(IIN.LE.20) THEN                                             AUDB1     106
            DU0(IUB,IIN)=DU0(IUB,IIN)+XDAT                              AUDB1     107
         ELSE                                                           AUDB1     108
            DUR0(IUB,IIN-20)=DUR0(IUB,IIN-20)+XDAT                      AUDB1     109
         ENDIF                                                          AUDB1     110
  140    CONTINUE                                                       AUDB1     111
      ENDIF                                                             AUDB1     112
      KORD=KORD+1                                                       AUDB1     113
      LL=IUDAT(JEI+8)                                                   AUDB1     114
      BUB(KORD,IUB)=UDAT(JEI+1)                                         AUDB1     115
      IF(LL.EQ.0) THEN                                                  AUDB1     116
         CXB(IORD,KORD)=1.0                                             AUDB1     117
      ENDIF                                                             AUDB1     118
      IF(LDEB) WRITE(IUD6,1010) KORD,LORD,IORD                          AUDB1     119
C                                                                       AUDB1     120
      RETURN                                                            AUDB1     121
 1010 FORMAT(1X,'KORD,LORD,IORD: ',3I5)                                 AUDB1     122
C                                                                       AUDB1     123
C-----------------------------------------------------------------------AUDB1     124
C                                                                       AUDB1     125
      ENTRY AUDB3(LORD)                                                 AUDB1     126
CD                                                                      AUDB1     127
CD    FOR BLOCK TYPE 3 (PI BLOCK)                                       AUDB1     128
CD                                                                      AUDB1     129
      LDEB=(JDEB(264).NE.0)                                             AUDB1     130
C                                                                       AUDB1     131
      IUB=IUB+1                                                         AUDB1     132
      IORD=IUDAT(JE4+LORD)                                              AUDB1     133
      JEI=JEB+2                                                         AUDB1     134
      KINT=KINPU                                                        AUDB1     135
      KINPU=KINPU+IUDAT(JEI+13)                                         AUDB1     136
      IF(KINT.LT.KINPU) THEN                                            AUDB1     137
         DO 150 J=KINT+1,KINPU                                          AUDB1     138
         XDAT=GAINS(J)                                                  AUDB1     139
         IOUT=INPUTS(J)                                                 AUDB1     140
         CYB(IUB,IOUT)=CYB(IUB,IOUT)+XDAT                               AUDB1     141
  150    CONTINUE                                                       AUDB1     142
      ENDIF                                                             AUDB1     143
      KINP=KINPU                                                        AUDB1     144
      KINPU=KINPU+IUDAT(JEI+14)                                         AUDB1     145
      IF(KINP.LT.KINPU) THEN                                            AUDB1     146
         DO 160 J=KINP+1,KINPU                                          AUDB1     147
         XDAT=GAINS(J)                                                  AUDB1     148
         IIN=INPUTS(J)                                                  AUDB1     149
         IF(IIN.LE.20) THEN                                             AUDB1     150
            DU0(IUB,IIN)=DU0(IUB,IIN)+XDAT                              AUDB1     151
         ELSE                                                           AUDB1     152
            DUR0(IUB,IIN-20)=DUR0(IUB,IIN-20)+XDAT                      AUDB1     153
         ENDIF                                                          AUDB1     154
  160    CONTINUE                                                       AUDB1     155
      ENDIF                                                             AUDB1     156
      KORD=KORD+1                                                       AUDB1     157
      BUB(KORD,IUB)=UDAT(JEI+1)                                         AUDB1     158
      LL=IUDAT(JEI+8)                                                   AUDB1     159
      IF(LL.EQ.0)THEN                                                   AUDB1     160
         CXB(IORD,KORD)=1.0                                             AUDB1     161
      ENDIF                                                             AUDB1     162
      DUB(IORD,IUB)=UDAT(JEI+1)*UDAT(JEI+2)                             AUDB1     163
      IF(LDEB) WRITE(IUD6,1020) KORD,LORD,IORD                          AUDB1     164
C                                                                       AUDB1     165
      RETURN                                                            AUDB1     166
 1020 FORMAT(1X,'KORD,LORD,IORD: ',3I5)                                 AUDB1     167
C                                                                       AUDB1     168
C-----------------------------------------------------------------------AUDB1     169
C                                                                       AUDB1     170
      ENTRY AUDB4(LORD)                                                 AUDB1     171
CD                                                                      AUDB1     172
CD    FOR BLOCK TYPE 4 (WASHOUT BLOCK)                                  AUDB1     173
CD                                                                      AUDB1     174
      LDEB=(JDEB(264).NE.0)                                             AUDB1     175
C                                                                       AUDB1     176
      IUB=IUB+1                                                         AUDB1     177
      IORD=IUDAT(JE4+LORD)                                              AUDB1     178
      JEI=JEB+2                                                         AUDB1     179
      KINT=KINPU                                                        AUDB1     180
      KINPU=KINPU+IUDAT(JEI+13)                                         AUDB1     181
      IF(KINT.LT.KINPU) THEN                                            AUDB1     182
         DO 170 J=KINT+1,KINPU                                          AUDB1     183
         XDAT=GAINS(J)                                                  AUDB1     184
         IOUT=INPUTS(J)                                                 AUDB1     185
         CYB(IUB,IOUT)=CYB(IUB,IOUT)+XDAT                               AUDB1     186
  170    CONTINUE                                                       AUDB1     187
      ENDIF                                                             AUDB1     188
      KINP=KINPU                                                        AUDB1     189
      KINPU=KINPU+IUDAT(JEI+14)                                         AUDB1     190
      IF(LDEB)WRITE(IUD6,1040)KINT,KINP,KINPU                           AUDB1     191
      IF(KINP.LT.KINPU) THEN                                            AUDB1     192
         DO 180 J=KINP+1,KINPU                                          AUDB1     193
         XDAT=GAINS(J)                                                  AUDB1     194
         IIN=INPUTS(J)                                                  AUDB1     195
         IF(IIN.LE.20) THEN                                             AUDB1     196
            DU0(IUB,IIN)=DU0(IUB,IIN)+XDAT                              AUDB1     197
         ELSE                                                           AUDB1     198
            DUR0(IUB,IIN-20)=DUR0(IUB,IIN-20)+XDAT                      AUDB1     199
         ENDIF                                                          AUDB1     200
         IF(LDEB)WRITE(IUD6,1050)IIN,XDAT                               AUDB1     201
  180    CONTINUE                                                       AUDB1     202
      ENDIF                                                             AUDB1     203
      KORD=KORD+1                                                       AUDB1     204
      AXB(KORD,KORD)=-1.0/UDAT(JEI+2)                                   AUDB1     205
      BUB(KORD,IUB)=1.0/UDAT(JEI+2)                                     AUDB1     206
      CXB(IORD,KORD)=-UDAT(JEI+1)                                       AUDB1     207
      DUB(IORD,IUB)=UDAT(JEI+1)                                         AUDB1     208
      IF(LDEB) WRITE(IUD6,1030) KORD,LORD,IORD                          AUDB1     209
C                                                                       AUDB1     210
      RETURN                                                            AUDB1     211
 1030 FORMAT(1X,'KORD,LORD,IORD ',3I5)                                  AUDB1     212
 1040 FORMAT(1X,'KINT,KINP,KINPU: ',3I5)                                AUDB1     213
 1050 FORMAT(1X,'IIN,XDAT: ',I5,F10.3)                                  AUDB1     214
C                                                                       AUDB1     215
C-----------------------------------------------------------------------AUDB1     216
C                                                                       AUDB1     217
      ENTRY AUDB5(LORD)                                                 AUDB1     218
CD                                                                      AUDB1     219
CD    FOR BLOCK TYPE 5 (LEAD/LAG BLOCK)                                 AUDB1     220
CD                                                                      AUDB1     221
      LDEB=(JDEB(264).NE.0)                                             AUDB1     222
C                                                                       AUDB1     223
      IUB=IUB+1                                                         AUDB1     224
      IORD=IUDAT(JE4+LORD)                                              AUDB1     225
      JEI=JEB+2                                                         AUDB1     226
      KINT=KINPU                                                        AUDB1     227
      KINPU=KINPU+IUDAT(JEI+13)                                         AUDB1     228
      IF(KINT.LT.KINPU) THEN                                            AUDB1     229
         DO 190 J=KINT+1,KINPU                                          AUDB1     230
         XDAT=GAINS(J)                                                  AUDB1     231
         IOUT=INPUTS(J)                                                 AUDB1     232
         CYB(IUB,IOUT)=CYB(IUB,IOUT)+XDAT                               AUDB1     233
  190    CONTINUE                                                       AUDB1     234
      ENDIF                                                             AUDB1     235
      KINP=KINPU                                                        AUDB1     236
      KINPU=KINPU+IUDAT(JEI+14)                                         AUDB1     237
      IF(KINP.LT.KINPU) THEN                                            AUDB1     238
         DO 200 J=KINP+1,KINPU                                          AUDB1     239
         XDAT=GAINS(J)                                                  AUDB1     240
         IIN=INPUTS(J)                                                  AUDB1     241
         IF(IIN.LE.20) THEN                                             AUDB1     242
            DU0(IUB,IIN)=DU0(IUB,IIN)+XDAT                              AUDB1     243
         ELSE                                                           AUDB1     244
            DUR0(IUB,IIN-20)=DUR0(IUB,IIN-20)+XDAT                      AUDB1     245
         ENDIF                                                          AUDB1     246
  200    CONTINUE                                                       AUDB1     247
      ENDIF                                                             AUDB1     248
      IF(IUDAT(JEI+3).NE.0.AND.IUDAT(JEI+3).NE.IUDAT(JEI+2)) THEN       AUDB1     249
         TRATIO=UDAT(JEI+2)/UDAT(JEI+3)                                 AUDB1     250
         KORD=KORD+1                                                    AUDB1     251
         T2INV=1.0/UDAT(JEI+3)                                          AUDB1     252
         AXB(KORD,KORD)=-T2INV                                          AUDB1     253
         BUB(KORD,IUB)=T2INV*UDAT(JEI+1)*(1.0-TRATIO)                   AUDB1     254
         LL=IUDAT(JEI+8)                                                AUDB1     255
         IF(LL.EQ.0)THEN                                                AUDB1     256
            CXB(IORD,KORD)=1.0                                          AUDB1     257
            DUB(IORD,IUB)=UDAT(JEI+1)*TRATIO                            AUDB1     258
         ENDIF                                                          AUDB1     259
      ELSE                                                              AUDB1     260
         DUB(IORD,IUB)=UDAT(JEI+1)                                      AUDB1     261
      ENDIF                                                             AUDB1     262
      IF(LDEB) WRITE(IUD6,1060) KORD,LORD,IORD                          AUDB1     263
C                                                                       AUDB1     264
      RETURN                                                            AUDB1     265
 1060 FORMAT(1X,'KORD,LORD,IORD: ',3I5)                                 AUDB1     266
C                                                                       AUDB1     267
C-----------------------------------------------------------------------AUDB1     268
C                                                                       AUDB1     269
      ENTRY AUDB6(LORD)                                                 AUDB1     270
CD                                                                      AUDB1     271
CD    FOR BLOCK TYPE 6 (SWITCH BLOCK)                                   AUDB1     272
CD                                                                      AUDB1     273
      LDEB=(JDEB(264).NE.0)                                             AUDB1     274
C                                                                       AUDB1     275
      IUB=IUB+1                                                         AUDB1     276
      IORD=IUDAT(JE4+LORD)                                              AUDB1     277
      JEI=JEB+2                                                         AUDB1     278
      KINT=KINPU                                                        AUDB1     279
      KINPU=KINPU+IUDAT(JEI+13)                                         AUDB1     280
      IF(KINT.LT.KINPU) THEN                                            AUDB1     281
         DO 210 J=KINT+1,KINPU                                          AUDB1     282
         XDAT=GAINS(J)                                                  AUDB1     283
         IOUT=INPUTS(J)                                                 AUDB1     284
         CYB(IUB,IOUT)=CYB(IUB,IOUT)+XDAT                               AUDB1     285
  210    CONTINUE                                                       AUDB1     286
      ENDIF                                                             AUDB1     287
      KINP=KINPU                                                        AUDB1     288
      KINPU=KINPU+IUDAT(JEI+14)                                         AUDB1     289
      IF(KINP.LT.KINPU) THEN                                            AUDB1     290
         DO 220 J=KINP+1,KINPU                                          AUDB1     291
         XDAT=GAINS(J)                                                  AUDB1     292
         IIN=INPUTS(J)                                                  AUDB1     293
         IF(IIN.LE.20) THEN                                             AUDB1     294
            DU0(IUB,IIN)=DU0(IUB,IIN)+XDAT                              AUDB1     295
         ELSE                                                           AUDB1     296
            DUR0(IUB,IIN-20)=DUR0(IUB,IIN-20)+XDAT                      AUDB1     297
         ENDIF                                                          AUDB1     298
  220    CONTINUE                                                       AUDB1     299
      ENDIF                                                             AUDB1     300
      IF (TS.GE.UDAT(JEI+1)) DUB(IORD,IUB)=1.0                          AUDB1     301
      IF(LDEB) WRITE(IUD6,1070) LORD,IORD                               AUDB1     302
C                                                                       AUDB1     303
      RETURN                                                            AUDB1     304
 1070 FORMAT(1X,'LORD,IORD: ',2I5)                                      AUDB1     305
C                                                                       AUDB1     306
C-----------------------------------------------------------------------AUDB1     307
C                                                                       AUDB1     308
      ENTRY AUDB7(LORD,LTYP)                                            AUDB1     309
CD                                                                      AUDB1     310
CD    FOR BLOCK TYPES 7, 8 AND 27 (HIGH, LOW VALUE AND LOGICAL          AUDB1     311
CD    SWITCH BLOCKS)                                                    AUDB1     312
CD                                                                      AUDB1     313
      LDEB=(JDEB(264).NE.0)                                             AUDB1     314
C                                                                       AUDB1     315
      II=0                                                              AUDB1     316
      IORD=IUDAT(JE4+LORD)                                              AUDB1     317
      JEI=JEB+2                                                         AUDB1     318
      KINT=KINPU                                                        AUDB1     319
      KINPU=KINPU+IUDAT(JEI+13)                                         AUDB1     320
      IF(KINT.LT.KINPU) THEN                                            AUDB1     321
         DO 230 J=KINT+1,KINPU                                          AUDB1     322
         XDAT=GAINS(J)                                                  AUDB1     323
         IOUT=INPUTS(J)                                                 AUDB1     324
         II=II+1                                                        AUDB1     325
         IF(II.EQ.1.OR.II.EQ.2) THEN                                    AUDB1     326
            CYB(IUB+II,IOUT)=XDAT                                       AUDB1     327
         ENDIF                                                          AUDB1     328
  230    CONTINUE                                                       AUDB1     329
      ENDIF                                                             AUDB1     330
      KINP=KINPU                                                        AUDB1     331
      KINPU=KINPU+IUDAT(JEI+14)                                         AUDB1     332
      IF(KINP.LT.KINPU) THEN                                            AUDB1     333
         DO 240 J=KINP+1,KINPU                                          AUDB1     334
         XDAT=GAINS(J)                                                  AUDB1     335
         IIN=INPUTS(J)                                                  AUDB1     336
         II=II+1                                                        AUDB1     337
         IF(II.EQ.1.OR.II.EQ.2) THEN                                    AUDB1     338
            IF(IIN.LE.20) THEN                                          AUDB1     339
               DU0(IUB+II,IIN)=XDAT                                     AUDB1     340
            ELSE                                                        AUDB1     341
               DUR0(IUB+II,IIN-20)=XDAT                                 AUDB1     342
            ENDIF                                                       AUDB1     343
         ENDIF                                                          AUDB1     344
  240    CONTINUE                                                       AUDB1     345
      ENDIF                                                             AUDB1     346
      IF (LTYP.EQ.7.OR.LTYP.EQ.8) THEN                                  AUDB1     347
         IWS1=JEI+1                                                     AUDB1     348
      ELSE IF (LTYP.EQ.27) THEN                                         AUDB1     349
         IWS1=JEI+2                                                     AUDB1     350
      ELSE                                                              AUDB1     351
         WRITE(MSG(1),1085)                                             AUDB1     352
         CALL PRTMSG(1)                                                 AUDB1     353
         MSG(1)='AUDB7: UNKNOWN BLOCK TYPE.'                            AUDB1     354
         CALL ASTOP(MSG(1),26)                                          AUDB1     355
      END IF                                                            AUDB1     356
      IF (IUDAT(IWS1).EQ.1) THEN                                        AUDB1     357
         DUB(IORD,IUB+1)=1.0                                            AUDB1     358
      ELSE                                                              AUDB1     359
         DUB(IORD,IUB+2)=1.0                                            AUDB1     360
      END IF                                                            AUDB1     361
      IUB=IUB+2                                                         AUDB1     362
      IF(LDEB) WRITE(IUD6,1080) LORD,IORD                               AUDB1     363
C                                                                       AUDB1     364
      RETURN                                                            AUDB1     365
 1080 FORMAT(1X,'LORD,IORD: ',2I5)                                      AUDB1     366
 1085 FORMAT(1X,'AUDB7: UNKNOWN BLOCK TYPE.')                           AUDB1     367
C                                                                       AUDB1     368
C-----------------------------------------------------------------------AUDB1     369
C                                                                       AUDB1     370
      ENTRY AUDB9(LORD)                                                 AUDB1     371
CD                                                                      AUDB1     372
CD    FOR BLOCK TYPES 9 AND 10 (MULTIPLICATION AND DIVISION BLOCKS)     AUDB1     373
CD                                                                      AUDB1     374
      LDEB=(JDEB(264).NE.0)                                             AUDB1     375
C                                                                       AUDB1     376
      II=0                                                              AUDB1     377
      IUB=IUB+2                                                         AUDB1     378
      IORD=IUDAT(JE4+LORD)                                              AUDB1     379
      JEI=JEB+2                                                         AUDB1     380
      KINT=KINPU                                                        AUDB1     381
      KINPU=KINPU+IUDAT(JEI+13)                                         AUDB1     382
      IF(KINT.LT.KINPU) THEN                                            AUDB1     383
         DO 250 J=KINT+1,KINPU                                          AUDB1     384
         XDAT=GAINS(J)                                                  AUDB1     385
         IOUT=INPUTS(J)                                                 AUDB1     386
         II=II+1                                                        AUDB1     387
         IF(II.EQ.1) THEN                                               AUDB1     388
            CYB(IUB-1,IOUT)=XDAT                                        AUDB1     389
         ELSE                                                           AUDB1     390
            CYB(IUB,IOUT)=XDAT                                          AUDB1     391
         ENDIF                                                          AUDB1     392
  250    CONTINUE                                                       AUDB1     393
      ENDIF                                                             AUDB1     394
      KINP=KINPU                                                        AUDB1     395
      KINPU=KINPU+IUDAT(JEI+14)                                         AUDB1     396
      IF(KINP.LT.KINPU) THEN                                            AUDB1     397
         DO 260 J=KINP+1,KINPU                                          AUDB1     398
         XDAT=GAINS(J)                                                  AUDB1     399
         IIN=INPUTS(J)                                                  AUDB1     400
         II=II+1                                                        AUDB1     401
         IF(II.EQ.1) THEN                                               AUDB1     402
            IF(IIN.LE.20) THEN                                          AUDB1     403
               DU0(IUB-1,IIN)=XDAT                                      AUDB1     404
            ELSE                                                        AUDB1     405
               DUR0(IUB-1,IIN-20)=XDAT                                  AUDB1     406
            ENDIF                                                       AUDB1     407
         ELSE                                                           AUDB1     408
            IF(IIN.LE.20) THEN                                          AUDB1     409
               DU0(IUB,IIN)=XDAT                                        AUDB1     410
            ELSE                                                        AUDB1     411
               DUR0(IUB,IIN-20)=XDAT                                    AUDB1     412
            ENDIF                                                       AUDB1     413
         ENDIF                                                          AUDB1     414
  260    CONTINUE                                                       AUDB1     415
      ENDIF                                                             AUDB1     416
      IF(LDEB) WRITE(IUD6,1090) LORD,IORD                               AUDB1     417
      DUB(IORD,IUB-1)=UDAT(JEI+2)                                       AUDB1     418
      DUB(IORD,IUB)=UDAT(JEI+1)                                         AUDB1     419
C                                                                       AUDB1     420
      RETURN                                                            AUDB1     421
 1090 FORMAT(1X,'LORD,IORD: ',2I5)                                      AUDB1     422
C                                                                       AUDB1     423
C-----------------------------------------------------------------------AUDB1     424
C                                                                       AUDB1     425
      ENTRY AUDB12(LORD)                                                AUDB1     426
CD                                                                      AUDB1     427
CD    FOR BLOCK TYPE 12 (DELAY BLOCK)                                   AUDB1     428
CD                                                                      AUDB1     429
      LDEB=(JDEB(264).NE.0)                                             AUDB1     430
C                                                                       AUDB1     431
      IUB=IUB+1                                                         AUDB1     432
      IORD=IUDAT(JE4+LORD)                                              AUDB1     433
      JEI=JEB+2                                                         AUDB1     434
      KINT=KINPU                                                        AUDB1     435
      KINPU=KINPU+IUDAT(JEI+13)                                         AUDB1     436
      IF(KINT.LT.KINPU) THEN                                            AUDB1     437
         DO 270 J=KINT+1,KINPU                                          AUDB1     438
         XDAT=GAINS(J)                                                  AUDB1     439
         IOUT=INPUTS(J)                                                 AUDB1     440
         CYB(IUB,IOUT)=CYB(IUB,IOUT)+XDAT                               AUDB1     441
  270    CONTINUE                                                       AUDB1     442
      ENDIF                                                             AUDB1     443
      KINP=KINPU                                                        AUDB1     444
      KINPU=KINPU+IUDAT(JEI+14)                                         AUDB1     445
      IF(KINP.LT.KINPU) THEN                                            AUDB1     446
         DO 280 J=KINP+1,KINPU                                          AUDB1     447
         XDAT=GAINS(J)                                                  AUDB1     448
         IIN=INPUTS(J)                                                  AUDB1     449
         IF(IIN.LE.20) THEN                                             AUDB1     450
            DU0(IUB,IIN)=DU0(IUB,IIN)+XDAT                              AUDB1     451
         ELSE                                                           AUDB1     452
            DUR0(IUB,IIN-20)=DUR0(IUB,IIN-20)+XDAT                      AUDB1     453
         ENDIF                                                          AUDB1     454
  280    CONTINUE                                                       AUDB1     455
      ENDIF                                                             AUDB1     456
      IF (IUDAT(JEI+2).NE.0) THEN                                       AUDB1     457
         KORD=KORD+1                                                    AUDB1     458
         TDEL=UDAT(JEI+2)                                               AUDB1     459
         AXB(KORD,KORD)=-1.0/TDEL                                       AUDB1     460
         BUB(KORD,IUB)=UDAT(JEI+1)/TDEL                                 AUDB1     461
         CXB(IORD,KORD)=1.0                                             AUDB1     462
      ELSE                                                              AUDB1     463
         DUB(IORD,IUB)=UDAT(JEI+1)                                      AUDB1     464
      ENDIF                                                             AUDB1     465
      IF(LDEB) WRITE(IUD6,1100) LORD,IORD                               AUDB1     466
C                                                                       AUDB1     467
      RETURN                                                            AUDB1     468
 1100 FORMAT(1X,'LORD,IORD: ',2I5)                                      AUDB1     469
C                                                                       AUDB1     470
C-----------------------------------------------------------------------AUDB1     471
C                                                                       AUDB1     472
      ENTRY AUDB13(LORD)                                                AUDB1     473
CD                                                                      AUDB1     474
CD    FOR BLOCK TYPES 13 TO 21 (MATHEMATICAL FUNCTION BLOCKS)           AUDB1     475
CD                                                                      AUDB1     476
      LDEB=(JDEB(264).NE.0)                                             AUDB1     477
C                                                                       AUDB1     478
      IUB=IUB+1                                                         AUDB1     479
      IORD=IUDAT(JE4+LORD)                                              AUDB1     480
      JEI=JEB+2                                                         AUDB1     481
      KINT=KINPU                                                        AUDB1     482
      KINPU=KINPU+IUDAT(JEI+13)                                         AUDB1     483
      IF(KINT.LT.KINPU) THEN                                            AUDB1     484
         DO 290 J=KINT+1,KINPU                                          AUDB1     485
         XDAT=GAINS(J)                                                  AUDB1     486
         IOUT=INPUTS(J)                                                 AUDB1     487
         CYB(IUB,IOUT)=CYB(IUB,IOUT)+XDAT                               AUDB1     488
  290    CONTINUE                                                       AUDB1     489
      ENDIF                                                             AUDB1     490
      KINP=KINPU                                                        AUDB1     491
      KINPU=KINPU+IUDAT(JEI+14)                                         AUDB1     492
      IF(KINP.LT.KINPU) THEN                                            AUDB1     493
         DO 300 J=KINP+1,KINPU                                          AUDB1     494
         XDAT=GAINS(J)                                                  AUDB1     495
         IIN=INPUTS(J)                                                  AUDB1     496
         IF(IIN.LE.20) THEN                                             AUDB1     497
            DU0(IUB,IIN)=DU0(IUB,IIN)+XDAT                              AUDB1     498
         ELSE                                                           AUDB1     499
            DUR0(IUB,IIN-20)=DUR0(IUB,IIN-20)+XDAT                      AUDB1     500
         ENDIF                                                          AUDB1     501
  300    CONTINUE                                                       AUDB1     502
      ENDIF                                                             AUDB1     503
      DUB(IORD,IUB)=UDAT(JEI+1)                                         AUDB1     504
      IF(LDEB) WRITE(IUD6,1110) LORD,IORD                               AUDB1     505
C                                                                       AUDB1     506
      RETURN                                                            AUDB1     507
 1110 FORMAT(1X,'LORD,IORD: ',2I5)                                      AUDB1     508
C                                                                       AUDB1     509
C-----------------------------------------------------------------------AUDB1     510
C                                                                       AUDB1     511
      ENTRY AUDB69(LORD)                                                AUDB1     512
CD                                                                      AUDB1     513
CD    FOR BLOCK TYPE 69 (POWER BLOCK)                                   AUDB1     514
CD                                                                      AUDB1     515
      LDEB=(JDEB(264).NE.0)                                             AUDB1     516
C                                                                       AUDB1     517
      IUB=IUB+1                                                         AUDB1     518
      IORD=IUDAT(JE4+LORD)                                              AUDB1     519
      JEI=JEB+2                                                         AUDB1     520
      AX=UDAT(JEI+1)                                                    AUDB1     521
      AX1=AX-1.0                                                        AUDB1     522
      BX=UDAT(JEI+2)                                                    AUDB1     523
      BX1=BX-1.0                                                        AUDB1     524
      KINT=KINPU                                                        AUDB1     525
      KINPU=KINPU+IUDAT(JEI+13)                                         AUDB1     526
      IF(KINT.LT.KINPU) THEN                                            AUDB1     527
         DO 310 J=KINT+1,KINPU                                          AUDB1     528
         XDAT=GAINS(J)                                                  AUDB1     529
         IOUT=INPUTS(J)                                                 AUDB1     530
         UX=XDAT*VALOUT(IOUT)                                           AUDB1     531
         UX1=ABS(UX)                                                    AUDB1     532
         IF(UX.GE.0.0) THEN                                             AUDB1     533
            XDAT=UX1**AX1                                               AUDB1     534
         ELSE                                                           AUDB1     535
            XDAT=-UX1**AX1                                              AUDB1     536
         ENDIF                                                          AUDB1     537
         CYB(IUB,IOUT)=CYB(IUB,IOUT)+XDAT                               AUDB1     538
  310    CONTINUE                                                       AUDB1     539
      ENDIF                                                             AUDB1     540
      KINP=KINPU                                                        AUDB1     541
      KINPU=KINPU+IUDAT(JEI+14)                                         AUDB1     542
      IF(KINP.LT.KINPU) THEN                                            AUDB1     543
         DO 320 J=KINP+1,KINPU                                          AUDB1     544
         XDAT=GAINS(J)                                                  AUDB1     545
         IIN=INPUTS(J)                                                  AUDB1     546
         UX=XDAT*VALIN(IIN)                                             AUDB1     547
         UX1=ABS(UX)                                                    AUDB1     548
         IF(UX.GE.0.0) THEN                                             AUDB1     549
            XDAT=UX1**AX1                                               AUDB1     550
         ELSE                                                           AUDB1     551
            XDAT=-UX1**AX1                                              AUDB1     552
         ENDIF                                                          AUDB1     553
         IF(IIN.LE.20) THEN                                             AUDB1     554
            DU0(IUB,IIN)=DU0(IUB,IIN)+XDAT                              AUDB1     555
         ELSE                                                           AUDB1     556
            DUR0(IUB,IIN-20)=DUR0(IUB,IIN-20)+XDAT                      AUDB1     557
         ENDIF                                                          AUDB1     558
  320    CONTINUE                                                       AUDB1     559
      ENDIF                                                             AUDB1     560
      DUB(IORD,IUB)=UDAT(JEI+3)                                         AUDB1     561
      IF(LDEB) WRITE(IUD6,1000) LORD,IORD                               AUDB1     562
C                                                                       AUDB1     563
      RETURN                                                            AUDB1     564
C                                                                       AUDB1     565
C-----------------------------------------------------------------------AUDB1     566
C                                                                       AUDB1     567
      ENTRY AUDB70(LORD,LOUT)                                           AUDB1     568
CD                                                                      AUDB1     569
CD    FOR BLOCK TYPE 70 (COMPENSATION BLOCK)                            AUDB1     570
CD                                                                      AUDB1     571
      LDEB=(JDEB(264).NE.0)                                             AUDB1     572
C                                                                       AUDB1     573
      IUB=IUB+1                                                         AUDB1     574
      IORD=IUDAT(JE4+LORD)                                              AUDB1     575
      JEI=JEB+2                                                         AUDB1     576
      RBL=UDAT(JEI+1)                                                   AUDB1     577
      XBL=UDAT(JEI+2)                                                   AUDB1     578
      NBX=IUDAT(JEI+3)                                                  AUDB1     579
      IF(NBX.GT.0.AND.NBX.LE.NRBUS) THEN                                AUDB1     580
         IBUS1=IUDAT(JE1+3*NBX-2)                                       AUDB1     581
         DO 330 J=1,70                                                  AUDB1     582
         IF(IBUS1.EQ.MBUSR(J)) GO TO 340                                AUDB1     583
  330    CONTINUE                                                       AUDB1     584
  340    K2=2*J                                                         AUDB1     585
         VNBR=REAL(VOLT(IBUS1))                                         AUDB1     586
         VNBI=AIMAG(VOLT(IBUS1))                                        AUDB1     587
      ELSE                                                              AUDB1     588
         K2=0                                                           AUDB1     589
         VNBR=0.0                                                       AUDB1     590
         VNBI=0.0                                                       AUDB1     591
      ENDIF                                                             AUDB1     592
      NLX=IUDAT(JEI+4)                                                  AUDB1     593
      IF(NLX.GT.0.AND.NLX.LE.NRLIN) THEN                                AUDB1     594
         NR4=JE2+4*(NLX-1)                                              AUDB1     595
         IBUS1=IUDAT(NR4+1)                                             AUDB1     596
         IBUS2=IUDAT(NR4+2)                                             AUDB1     597
         DO 350 J=1,70                                                  AUDB1     598
         IF(IBUS1.EQ.MBUSR(J)) GO TO 360                                AUDB1     599
  350    CONTINUE                                                       AUDB1     600
  360    K12=2*J                                                        AUDB1     601
         DO 370 J=1,70                                                  AUDB1     602
         IF(IBUS2.EQ.MBUSR(J)) GO TO 380                                AUDB1     603
  370    CONTINUE                                                       AUDB1     604
  380    K22=2*J                                                        AUDB1     605
         JLS=IUDAT(NR4+4)                                               AUDB1     606
         JLS12=JLS*12                                                   AUDB1     607
         G11=GLM(JLS12-6)                                               AUDB1     608
         B11=BLM(JLS12-5)                                               AUDB1     609
         G12=BLCF(JLS12-4)                                              AUDB1     610
         B12=BLT(JLS12-3)                                               AUDB1     611
C                                                                       AUDB1     612
         V1RE=REAL(VOLT(IBUS1))                                         AUDB1     613
         V1IM=AIMAG(VOLT(IBUS1))                                        AUDB1     614
         V2RE=REAL(VOLT(IBUS2))                                         AUDB1     615
         V2IM=AIMAG(VOLT(IBUS2))                                        AUDB1     616
         CURR=G11*V1RE-B11*V1IM+G12*V2RE-B12*V2IM                       AUDB1     617
         CURI=B11*V1RE+G11*V1IM+B12*V2RE+G12*V2IM                       AUDB1     618
      ELSE                                                              AUDB1     619
         K12=0                                                          AUDB1     620
         K22=0                                                          AUDB1     621
         CURR=0.0                                                       AUDB1     622
         CURI=0.0                                                       AUDB1     623
      ENDIF                                                             AUDB1     624
      VALOR=VNBR+RBL*CURR-XBL*CURI                                      AUDB1     625
      VALOI=VNBI+RBL*CURI+XBL*CURR                                      AUDB1     626
      VALO2=VALOR**2+VALOI**2                                           AUDB1     627
      VALOM=SQRT(VALO2)                                                 AUDB1     628
      FACT1=RBL*G11-XBL*B11                                             AUDB1     629
      FACT2=RBL*B11+XBL*G11                                             AUDB1     630
      FACT3=RBL*G12-XBL*B12                                             AUDB1     631
      FACT4=RBL*B12+XBL*G12                                             AUDB1     632
      MODE=IUDAT(JEI+5)                                                 AUDB1     633
      IF(MODE.EQ.0) THEN                                                AUDB1     634
         VALOR=VALOR/VALOM                                              AUDB1     635
         VALOI=VALOI/VALOM                                              AUDB1     636
         IF(K2.NE.0) THEN                                               AUDB1     637
            IF(K2.LE.LOUT) THEN                                         AUDB1     638
               DUV(IUB,K2-1)=VALOR                                      AUDB1     639
               DUV(IUB,K2  )=VALOI                                      AUDB1     640
            ELSE                                                        AUDB1     641
               DUVR(IUB,K2-1-LOUT)=VALOR                                AUDB1     642
               DUVR(IUB,K2  -LOUT)=VALOI                                AUDB1     643
            ENDIF                                                       AUDB1     644
         ENDIF                                                          AUDB1     645
         IF(K12.NE.0) THEN                                              AUDB1     646
            IF(K12.LE.LOUT) THEN                                        AUDB1     647
               DUV(IUB,K12-1)=DUV(IUB,K12-1)                            AUDB1     648
     &         +VALOR*FACT1+VALOI*FACT2                                 AUDB1     649
               DUV(IUB,K12  )=DUV(IUB,K12  )                            AUDB1     650
     &         -VALOR*FACT2+VALOI*FACT1                                 AUDB1     651
            ELSE                                                        AUDB1     652
               DUVR(IUB,K12-1-LOUT)=DUVR(IUB,K12-1-LOUT)                AUDB1     653
     &         +VALOR*FACT1+VALOI*FACT2                                 AUDB1     654
               DUVR(IUB,K12  -LOUT)=DUVR(IUB,K12  -LOUT)                AUDB1     655
     &         -VALOR*FACT2+VALOI*FACT1                                 AUDB1     656
            ENDIF                                                       AUDB1     657
         ENDIF                                                          AUDB1     658
         IF(K22.NE.0) THEN                                              AUDB1     659
            IF(K22.LE.LOUT) THEN                                        AUDB1     660
               DUV(IUB,K22-1)=DUV(IUB,K22-1)                            AUDB1     661
     &         +VALOR*FACT3+VALOI*FACT4                                 AUDB1     662
               DUV(IUB,K22  )=DUV(IUB,K22  )                            AUDB1     663
     &         -VALOR*FACT4+VALOI*FACT3                                 AUDB1     664
            ELSE                                                        AUDB1     665
               DUVR(IUB,K22-1-LOUT)=DUVR(IUB,K22-1-LOUT)                AUDB1     666
     &         +VALOR*FACT3+VALOI*FACT4                                 AUDB1     667
               DUVR(IUB,K22  -LOUT)=DUVR(IUB,K22  -LOUT)                AUDB1     668
     &         -VALOR*FACT4+VALOI*FACT3                                 AUDB1     669
            ENDIF                                                       AUDB1     670
         ENDIF                                                          AUDB1     671
      ELSEIF(MODE.EQ.1) THEN                                            AUDB1     672
         VALOR=VALOR/VALO2                                              AUDB1     673
         VALOI=VALOI/VALO2                                              AUDB1     674
         IF(K2.NE.0) THEN                                               AUDB1     675
            IF(K2.LE.LOUT) THEN                                         AUDB1     676
               DUV(IUB,K2-1)=-VALOI                                     AUDB1     677
               DUV(IUB,K2  )= VALOR                                     AUDB1     678
            ELSE                                                        AUDB1     679
               DUVR(IUB,K2-1-LOUT)=-VALOI                               AUDB1     680
               DUVR(IUB,K2  -LOUT)= VALOR                               AUDB1     681
            ENDIF                                                       AUDB1     682
         ENDIF                                                          AUDB1     683
         IF(K12.NE.0) THEN                                              AUDB1     684
            IF(K12.LE.LOUT) THEN                                        AUDB1     685
               DUV(IUB,K12-1)=DUV(IUB,K12-1)                            AUDB1     686
     &         -VALOI*FACT1+VALOR*FACT2                                 AUDB1     687
               DUV(IUB,K12  )=DUV(IUB,K12  )                            AUDB1     688
     &         +VALOI*FACT2+VALOR*FACT1                                 AUDB1     689
            ELSE                                                        AUDB1     690
               DUVR(IUB,K12-1-LOUT)=DUVR(IUB,K12-1-LOUT)                AUDB1     691
     &         -VALOI*FACT1+VALOR*FACT2                                 AUDB1     692
               DUVR(IUB,K12  -LOUT)=DUVR(IUB,K12  -LOUT)                AUDB1     693
     &         +VALOI*FACT2+VALOR*FACT1                                 AUDB1     694
            ENDIF                                                       AUDB1     695
         ENDIF                                                          AUDB1     696
         IF(K22.NE.0) THEN                                              AUDB1     697
            IF(K22.LE.LOUT) THEN                                        AUDB1     698
               DUV(IUB,K22-1)=DUV(IUB,K22-1)                            AUDB1     699
     &         -VALOI*FACT3+VALOR*FACT4                                 AUDB1     700
               DUV(IUB,K22  )=DUV(IUB,K22  )                            AUDB1     701
     &         +VALOI*FACT4+VALOR*FACT3                                 AUDB1     702
            ELSE                                                        AUDB1     703
               DUVR(IUB,K22-1-LOUT)=DUVR(IUB,K22-1-LOUT)                AUDB1     704
     &         -VALOI*FACT3+VALOR*FACT4                                 AUDB1     705
               DUVR(IUB,K22  -LOUT)=DUVR(IUB,K22  -LOUT)                AUDB1     706
     &         +VALOI*FACT4+VALOR*FACT3                                 AUDB1     707
            ENDIF                                                       AUDB1     708
         ENDIF                                                          AUDB1     709
      ELSEIF(MODE.EQ.2) THEN                                            AUDB1     710
         IF(K2.NE.0) THEN                                               AUDB1     711
            IF(K2.LE.LOUT) THEN                                         AUDB1     712
               DUV(IUB,K2-1)=1.0                                        AUDB1     713
            ELSE                                                        AUDB1     714
               DUVR(IUB,K2-1-LOUT)=1.0                                  AUDB1     715
            ENDIF                                                       AUDB1     716
         ENDIF                                                          AUDB1     717
         IF(K12.NE.0) THEN                                              AUDB1     718
            IF(K12.LE.LOUT) THEN                                        AUDB1     719
               DUV(IUB,K12-1)=DUV(IUB,K12-1)+FACT1                      AUDB1     720
               DUV(IUB,K12  )=DUV(IUB,K12  )-FACT2                      AUDB1     721
            ELSE                                                        AUDB1     722
               DUVR(IUB,K12-1-LOUT)=DUVR(IUB,K12-1-LOUT)+FACT1          AUDB1     723
               DUVR(IUB,K12  -LOUT)=DUVR(IUB,K12  -LOUT)-FACT2          AUDB1     724
            ENDIF                                                       AUDB1     725
         ENDIF                                                          AUDB1     726
         IF(K22.NE.0) THEN                                              AUDB1     727
            IF(K22.LE.LOUT) THEN                                        AUDB1     728
               DUV(IUB,K22-1)=DUV(IUB,K22-1)+FACT3                      AUDB1     729
               DUV(IUB,K22  )=DUV(IUB,K22  )-FACT4                      AUDB1     730
            ELSE                                                        AUDB1     731
               DUVR(IUB,K22-1-LOUT)=DUVR(IUB,K22-1-LOUT)+FACT3          AUDB1     732
               DUVR(IUB,K22  -LOUT)=DUVR(IUB,K22  -LOUT)-FACT4          AUDB1     733
            ENDIF                                                       AUDB1     734
         ENDIF                                                          AUDB1     735
      ELSEIF(MODE.EQ.3) THEN                                            AUDB1     736
         IF(K2.NE.0) THEN                                               AUDB1     737
            IF(K2.LE.LOUT) THEN                                         AUDB1     738
               DUV(IUB,K2)=1.0                                          AUDB1     739
            ELSE                                                        AUDB1     740
               DUVR(IUB,K2-LOUT)=1.0                                    AUDB1     741
            ENDIF                                                       AUDB1     742
         ENDIF                                                          AUDB1     743
         IF(K12.NE.0) THEN                                              AUDB1     744
            IF(K12.LE.LOUT) THEN                                        AUDB1     745
               DUV(IUB,K12-1)=DUV(IUB,K12-1)+FACT2                      AUDB1     746
               DUV(IUB,K12  )=DUV(IUB,K12  )+FACT1                      AUDB1     747
            ELSE                                                        AUDB1     748
               DUVR(IUB,K12-1-LOUT)=DUVR(IUB,K12-1-LOUT)+FACT2          AUDB1     749
               DUVR(IUB,K12  -LOUT)=DUVR(IUB,K12  -LOUT)+FACT1          AUDB1     750
            ENDIF                                                       AUDB1     751
         ENDIF                                                          AUDB1     752
         IF(K22.NE.0) THEN                                              AUDB1     753
            IF(K22.LE.LOUT) THEN                                        AUDB1     754
               DUV(IUB,K22-1)=DUV(IUB,K22-1)+FACT4                      AUDB1     755
               DUV(IUB,K22  )=DUV(IUB,K22  )+FACT3                      AUDB1     756
            ELSE                                                        AUDB1     757
               DUVR(IUB,K22-1-LOUT)=DUVR(IUB,K22-1-LOUT)+FACT4          AUDB1     758
               DUVR(IUB,K22  -LOUT)=DUVR(IUB,K22  -LOUT)+FACT3          AUDB1     759
            ENDIF                                                       AUDB1     760
         ENDIF                                                          AUDB1     761
      ENDIF                                                             AUDB1     762
C                                                                       AUDB1     763
      IF(LDEB) WRITE(IUD6,1000) LORD,IORD                               AUDB1     764
C                                                                       AUDB1     765
      RETURN                                                            AUDB1     766
C                                                                       AUDB1     767
C-----------------------------------------------------------------------AUDB1     768
C                                                                       AUDB1     769
      END                                                               AUDB1     770
