CFPRIME AUDMB                                                           AUDMB       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 AUDMB(LCYO,LWIF,NBUSR1,NBUSS)                          AUDMB       3
CD                                                                      AUDMB       4
CD    TO FOMULATE THE A B C D MATRICES OF INDIVIDUAL BLOCKS OF AN USER  AUDMB       5
CD    DEFINED AC DYNAMIC MODEL FOR THE CONSTRUCTION OF THE JACOBIAN     AUDMB       6
CD    MATRICES.                                                         AUDMB       7
CD                                                                      AUDMB       8
      INCLUDE 'PARX.INS'                                                AUDMB       9
      INCLUDE 'CNPT.INS'                                                AUDMB      10
      INCLUDE 'CNB19.INS'                                               AUDMB      11
      INCLUDE 'CNUDM.INS'                                               AUDMB      12
      INCLUDE 'CNEXC.INS'                                               AUDMB      13
      INCLUDE 'CNMON.INS'                                               AUDMB      14
      INCLUDE 'CNVOLT.INS'                                              AUDMB      15
      INCLUDE 'CNYVAR.INS'                                              AUDMB      16
      INCLUDE 'CNUDMA.INS'                                              AUDMB      17
      INCLUDE 'CNFLAG.INS'                                              AUDMB      18
      INCLUDE 'CNUNIT.INS'                                              AUDMB      19
C                                                                       AUDMB      20
      CHARACTER*80 MSG                                                  AUDMB      21
      DIMENSION XUVR(60,140)                                            AUDMB      22
C                                                                       AUDMB      23
      LDEB=(JDEB(263).NE.0)                                             AUDMB      24
C                                                                       AUDMB      25
      DO 50 I=1,NXUDB2                                                  AUDMB      26
      DO 20 J=1,NXUDB2                                                  AUDMB      27
      AXB(I,J)=0.0                                                      AUDMB      28
      BUB(I,J)=0.0                                                      AUDMB      29
  20  CONTINUE                                                          AUDMB      30
      DO 30 J=1,NXUDB                                                   AUDMB      31
      CYB(I,J)=0.0                                                      AUDMB      32
      CXB(J,I)=0.0                                                      AUDMB      33
      DUB(J,I)=0.0                                                      AUDMB      34
  30  CONTINUE                                                          AUDMB      35
      DO 40 J=1,20                                                      AUDMB      36
      DU0(I,J)=0.0                                                      AUDMB      37
  40  CONTINUE                                                          AUDMB      38
      DO 50 J=1,60                                                      AUDMB      39
      DUR0(I,J)=0.0                                                     AUDMB      40
  50  CONTINUE                                                          AUDMB      41
C                                                                       AUDMB      42
      CALL FMOVE(0,XUREF,XUREF,20)                                      AUDMB      43
      DO 51 I=1,60                                                      AUDMB      44
      DO 51 J=1,140                                                     AUDMB      45
  51  XUVR(I,J)=0.0                                                     AUDMB      46
C                                                                       AUDMB      47
      DO 70 J=1,NXUDB                                                   AUDMB      48
      CYO(1,J)=0.0                                                      AUDMB      49
      CYO(2,J)=0.0                                                      AUDMB      50
  70  CONTINUE                                                          AUDMB      51
C                                                                       AUDMB      52
C     DISTURBANCE INPUT                                                 AUDMB      53
C                                                                       AUDMB      54
      XUREF(20)=1.0                                                     AUDMB      55
C                                                                       AUDMB      56
C     REMOTE INPUTS                                                     AUDMB      57
C                                                                       AUDMB      58
      NBUS1=NBUSR1+NBUSS                                                AUDMB      59
      NBUSR=0                                                           AUDMB      60
C                                                                       AUDMB      61
      IF(NRBUS.NE.0) THEN                                               AUDMB      62
         DO 130 I=1,NRBUS                                               AUDMB      63
         NI=3*I                                                         AUDMB      64
         IBUS=IUDAT(JE1+NI-2)                                           AUDMB      65
         VRE=REAL(VOLT(IBUS))                                           AUDMB      66
         VIM=AIMAG(VOLT(IBUS))                                          AUDMB      67
         VMG=SQRT(VRE**2+VIM**2)                                        AUDMB      68
         VRE=VRE/VMG                                                    AUDMB      69
         VIM=VIM/VMG                                                    AUDMB      70
C                                                                       AUDMB      71
         DO 100 J=1,70                                                  AUDMB      72
         IF(MBUSR(J).EQ.0) GO TO 110                                    AUDMB      73
         IF(IBUS.EQ.MBUSR(J)) GO TO 120                                 AUDMB      74
  100    CONTINUE                                                       AUDMB      75
         MSG='AUDMB: 1'                                                 AUDMB      76
         CALL ASTOP(MSG,8)                                              AUDMB      77
  110    NBUSR=NBUSR+1                                                  AUDMB      78
         J=NBUS1+NBUSR                                                  AUDMB      79
         MBUSR(J)=IBUS                                                  AUDMB      80
  120    K2=2*J                                                         AUDMB      81
C                                                                       AUDMB      82
         XUVR(I,K2-1)=VRE                                               AUDMB      83
         XUVR(I,K2)=VIM                                                 AUDMB      84
         XUVR(I+10,K2-1)=-VIM/VMG                                       AUDMB      85
         XUVR(I+10,K2)=VRE/VMG                                          AUDMB      86
  130    CONTINUE                                                       AUDMB      87
      ENDIF                                                             AUDMB      88
C                                                                       AUDMB      89
      IF(NRLIN.NE.0) THEN                                               AUDMB      90
         NR4=JE2-4                                                      AUDMB      91
         DO 200 I=1,NRLIN                                               AUDMB      92
         NR4=NR4+4                                                      AUDMB      93
         IBUS1=IUDAT(NR4+1)                                             AUDMB      94
         IBUS2=IUDAT(NR4+2)                                             AUDMB      95
C                                                                       AUDMB      96
         DO 140 J=1,70                                                  AUDMB      97
         IF(MBUSR(J).EQ.0) GO TO 150                                    AUDMB      98
         IF(IBUS1.EQ.MBUSR(J)) GO TO 160                                AUDMB      99
  140    CONTINUE                                                       AUDMB     100
         MSG='AUDMB: 2'                                                 AUDMB     101
         CALL ASTOP(MSG,8)                                              AUDMB     102
  150    NBUSR=NBUSR+1                                                  AUDMB     103
         J=NBUS1+NBUSR                                                  AUDMB     104
         MBUSR(J)=IBUS1                                                 AUDMB     105
  160    K21=2*J                                                        AUDMB     106
C                                                                       AUDMB     107
         DO 170 J=1,70                                                  AUDMB     108
         IF(MBUSR(J).EQ.0) GO TO 180                                    AUDMB     109
         IF(IBUS2.EQ.MBUSR(J)) GO TO 190                                AUDMB     110
  170    CONTINUE                                                       AUDMB     111
         MSG='AUDMB: 3'                                                 AUDMB     112
         CALL ASTOP(MSG,8)                                              AUDMB     113
  180    NBUSR=NBUSR+1                                                  AUDMB     114
         J=NBUS1+NBUSR                                                  AUDMB     115
         MBUSR(J)=IBUS2                                                 AUDMB     116
  190    K22=2*J                                                        AUDMB     117
C                                                                       AUDMB     118
         JLS=IUDAT(NR4+4)                                               AUDMB     119
C                                                                       AUDMB     120
C         G11=SSMAT(JLS+5)                                              AUDMB     121
C         B11=SSMAT(JLS+6)                                              AUDMB     122
C         G12=SSMAT(JLS+7)                                              AUDMB     123
C         B12=SSMAT(JLS+8)                                              AUDMB     124
C                                                                       AUDMB     125
         JLS12=JLS*12                                                   AUDMB     126
         G11=GLM(JLS12-6)                                               AUDMB     127
         B11=BLM(JLS12-5)                                               AUDMB     128
         G12=BLCF(JLS12-4)                                              AUDMB     129
         B12=BLT(JLS12-3)                                               AUDMB     130
C                                                                       AUDMB     131
         V1RE=REAL(VOLT(IBUS1))                                         AUDMB     132
         V1IM=AIMAG(VOLT(IBUS1))                                        AUDMB     133
         AV1=ATAN2(V1IM,V1RE)                                           AUDMB     134
         V2RE=REAL(VOLT(IBUS2))                                         AUDMB     135
         V2IM=AIMAG(VOLT(IBUS2))                                        AUDMB     136
         V1M=V1RE**2+V1IM**2                                            AUDMB     137
         C1RE=G11*V1RE-B11*V1IM+G12*V2RE-B12*V2IM                       AUDMB     138
         C1IM=B11*V1RE+G11*V1IM+B12*V2RE+G12*V2IM                       AUDMB     139
         AI1=ATAN2(C1IM,C1RE)                                           AUDMB     140
         C1M=SQRT(C1RE**2+C1IM**2)                                      AUDMB     141
         FACT1=-SIN(AV1-AI1)                                            AUDMB     142
         C1RE=C1RE/C1M                                                  AUDMB     143
         C1IM=C1IM/C1M                                                  AUDMB     144
C                                                                       AUDMB     145
         XUVR(I+20,K21-1)=G11*C1RE+B11*C1IM                             AUDMB     146
         XUVR(I+20,K21)=-B11*C1RE+G11*C1IM                              AUDMB     147
         XUVR(I+20,K22-1)=G12*C1RE+B12*C1IM                             AUDMB     148
         XUVR(I+20,K22)=-B12*C1RE+G12*C1IM                              AUDMB     149
         XUVR(I+30,K21-1)=2.0*G11*V1RE+G12*V2RE-B12*V2IM                AUDMB     150
         XUVR(I+30,K21)=2.0*G11*V1IM+G12*V2IM+B12*V2RE                  AUDMB     151
         XUVR(I+30,K22-1)=G12*V1RE+B12*V1IM                             AUDMB     152
         XUVR(I+30,K22)=G12*V1IM-B12*V1RE                               AUDMB     153
         XUVR(I+40,K21-1)=-2.0*B11*V1RE-B12*V2RE-G12*V2IM               AUDMB     154
         XUVR(I+40,K21)=-2.0*B11*V1IM-B12*V2IM+G12*V2RE                 AUDMB     155
         XUVR(I+40,K22-1)=-B12*V1RE+G12*V1IM                            AUDMB     156
         XUVR(I+40,K22)=-B12*V1IM-G12*V1RE                              AUDMB     157
         V1RE=V1RE/V1M                                                  AUDMB     158
         V1IM=V1IM/V1M                                                  AUDMB     159
         C1RE=C1RE/C1M                                                  AUDMB     160
         C1IM=C1IM/C1M                                                  AUDMB     161
         XUVR(I+50,K21-1)=FACT1*(-V1IM-B11*C1RE+G11*C1IM)               AUDMB     162
         XUVR(I+50,K21)=FACT1*(V1RE-G11*C1RE-B11*C1IM)                  AUDMB     163
         XUVR(I+50,K22-1)=FACT1*(-B12*C1RE+G12*C1IM)                    AUDMB     164
         XUVR(I+50,K22)=FACT1*(-G12*C1RE-B12*C1IM)                      AUDMB     165
  200    CONTINUE                                                       AUDMB     166
      ENDIF                                                             AUDMB     167
      NBUSR1=NBUSR1+NBUSR                                               AUDMB     168
C                                                                       AUDMB     169
      IBEND=IUDAT(JE7+1)                                                AUDMB     170
      KORD=0                                                            AUDMB     171
      IUB=0                                                             AUDMB     172
      IYB=NUDB                                                          AUDMB     173
      KINPU=IUDAT(JE4)                                                  AUDMB     174
C                                                                       AUDMB     175
      LOUT=2*NBUSS                                                      AUDMB     176
      LREM=2*NBUSR1                                                     AUDMB     177
      DO 579 I=1,LOUT                                                   AUDMB     178
      DO 579 J=1,NXUDB2                                                 AUDMB     179
      DUV(J,I)=0.0                                                      AUDMB     180
  579 CONTINUE                                                          AUDMB     181
      IF(LREM.NE.0) THEN                                                AUDMB     182
         DO 619 I=1,LREM                                                AUDMB     183
         DO 619 J=1,NXUDB2                                              AUDMB     184
         DUVR(J,I)=0.0                                                  AUDMB     185
  619    CONTINUE                                                       AUDMB     186
      ENDIF                                                             AUDMB     187
C                                                                       AUDMB     188
      DO 560 LORD=1,NUDB                                                AUDMB     189
         K=IUDAT(JE4+LORD)                                              AUDMB     190
         JEB=JE3+17*K-17                                                AUDMB     191
         NBINT1=IUDAT(JEB+1)                                            AUDMB     192
         NBINT2=IUDAT(JEB+17)                                           AUDMB     193
         LTYP=IUDAT(JEB+2)                                              AUDMB     194
C                                                                       AUDMB     195
         GO TO ( 220, 230, 240, 250, 260, 270, 280, 280, 290, 290       AUDMB     196
     &         , 560, 310, 320, 320, 320, 320, 320, 320, 320, 320       AUDMB     197
     &         , 320, 330, 335, 340, 220, 270, 280, 270, 220, 270       AUDMB     198
     &         , 350, 350, 360, 370, 380, 380, 390, 400, 410, 420       AUDMB     199
     &         , 430, 440, 450, 460, 470, 480, 490, 500, 500, 500       AUDMB     200
     &         , 510, 520, 530, 540, 550, 550, 555, 550, 550, 560       AUDMB     201
     &         , 560, 560, 560, 560, 560, 560, 560, 560, 557, 558       AUDMB     202
     &         , 270), LTYP                                             AUDMB     203
C                                                                       AUDMB     204
  220    CALL AUDB1(LORD,LTYP)                                          AUDMB     205
         GO TO 560                                                      AUDMB     206
  230    CALL AUDB2(LORD)                                               AUDMB     207
         GO TO 560                                                      AUDMB     208
  240    CALL AUDB3(LORD)                                               AUDMB     209
         GO TO 560                                                      AUDMB     210
  250    CALL AUDB4(LORD)                                               AUDMB     211
         GO TO 560                                                      AUDMB     212
  260    CALL AUDB5(LORD)                                               AUDMB     213
         GO TO 560                                                      AUDMB     214
  270    KINPU=KINPU+IUDAT(JEB+15)+IUDAT(JEB+16)                        AUDMB     215
         GO TO 560                                                      AUDMB     216
  280    CALL AUDB7(LORD,LTYP)                                          AUDMB     217
         GO TO 560                                                      AUDMB     218
  290    CALL AUDB9(LORD)                                               AUDMB     219
         GO TO 560                                                      AUDMB     220
  310    CALL AUDB12(LORD)                                              AUDMB     221
         GO TO 560                                                      AUDMB     222
  320    CALL AUDB13(LORD)                                              AUDMB     223
         GO TO 560                                                      AUDMB     224
  330    CALL AUDB22(LORD)                                              AUDMB     225
         GO TO 560                                                      AUDMB     226
  335    CALL AUDB23(LORD)                                              AUDMB     227
         GO TO 560                                                      AUDMB     228
  340    CALL AUDB24(LORD)                                              AUDMB     229
         GO TO 560                                                      AUDMB     230
  350    CALL AUDB31(LORD)                                              AUDMB     231
         GO TO 560                                                      AUDMB     232
  360    CALL AUDB33(LORD)                                              AUDMB     233
         GO TO 560                                                      AUDMB     234
  370    CALL AUDB34(LORD)                                              AUDMB     235
         GO TO 560                                                      AUDMB     236
  380    CALL AUDB35(LORD)                                              AUDMB     237
         GO TO 560                                                      AUDMB     238
  390    CALL AUDB37(LORD)                                              AUDMB     239
         GO TO 560                                                      AUDMB     240
  400    CALL AUDB38(LORD)                                              AUDMB     241
         GO TO 560                                                      AUDMB     242
  410    CALL AUDB39(LORD)                                              AUDMB     243
         GO TO 560                                                      AUDMB     244
  420    CALL AUDB40(LORD)                                              AUDMB     245
         GO TO 560                                                      AUDMB     246
  430    CALL AUDB41(LORD)                                              AUDMB     247
         GO TO 560                                                      AUDMB     248
  440    CALL AUDB42(LORD)                                              AUDMB     249
         GO TO 560                                                      AUDMB     250
  450    CALL AUDB43(LORD)                                              AUDMB     251
         GO TO 560                                                      AUDMB     252
  460    CALL AUDB44(LORD)                                              AUDMB     253
         CYO(2,IYB+1)=BASERT                                            AUDMB     254
         CYO(3,IYB+2)=BASERT                                            AUDMB     255
         IYB=IYB+2                                                      AUDMB     256
         LCYO=3                                                         AUDMB     257
         GO TO 560                                                      AUDMB     258
  470    CALL AUDB45(LORD)                                              AUDMB     259
         CYO(2,IYB+1)=BASERT                                            AUDMB     260
         CYO(3,IYB+2)=BASERT                                            AUDMB     261
         CYO(4,IYB+3)=BASERT                                            AUDMB     262
         IYB=IYB+3                                                      AUDMB     263
         LCYO=4                                                         AUDMB     264
         GO TO 560                                                      AUDMB     265
  480    CALL AUDB46(LORD)                                              AUDMB     266
         GO TO 560                                                      AUDMB     267
  490    CALL AUDB47(LORD)                                              AUDMB     268
         GO TO 560                                                      AUDMB     269
  500    CALL AUDB48(LORD,LTYP)                                         AUDMB     270
         GO TO 560                                                      AUDMB     271
  510    CALL AUDB51(LORD)                                              AUDMB     272
         GO TO 560                                                      AUDMB     273
  520    CALL AUDB52(LORD)                                              AUDMB     274
         GO TO 560                                                      AUDMB     275
  530    CALL AUDB53(LORD)                                              AUDMB     276
         GO TO 560                                                      AUDMB     277
  540    CALL AUDB54(LORD)                                              AUDMB     278
         GO TO 560                                                      AUDMB     279
  550    CALL AUDB56(LORD)                                              AUDMB     280
         GO TO 560                                                      AUDMB     281
  555    CALL AUDB57(LORD)                                              AUDMB     282
         GO TO 560                                                      AUDMB     283
  557    CALL AUDB69(LORD)                                              AUDMB     284
         GO TO 560                                                      AUDMB     285
  558    CALL AUDB70(LORD,LOUT)                                         AUDMB     286
C                                                                       AUDMB     287
  560 CONTINUE                                                          AUDMB     288
C                                                                       AUDMB     289
      IF(LDEB) WRITE(IUD6,1210) KORD,IUB,IYB,LOUT,LCYO,LWIF,LREM        AUDMB     290
      IF(LDEB) WRITE(IUD6,1000) ((XUY(I,J),I=1,20),J=1,IYB)             AUDMB     291
      IF(LDEB) WRITE(IUD6,1010) ((XUI(I,J),I=1,20),J=1,LOUT)            AUDMB     292
      IF(LDEB) WRITE(IUD6,1020) ((XUV(I,J),I=1,20),J=1,LOUT)            AUDMB     293
      IF(LDEB) WRITE(IUD6,1030) ((XUVR(I,J),I=1,60),J=1,LOUT+LREM)      AUDMB     294
      IF(LDEB) WRITE(IUD6,1040) (XUREF(J),J=1,20)                       AUDMB     295
      IF(LDEB) WRITE(IUD6,1050) ((DU0(I,J),J=1,20),I=1,IUB)             AUDMB     296
      IF(LDEB) WRITE(IUD6,1060) ((DUR0(I,J),J=1,60),I=1,IUB)            AUDMB     297
C                                                                       AUDMB     298
      CYO(1,IBEND)=BASERT                                               AUDMB     299
      IF(LCYO.EQ.2) THEN                                                AUDMB     300
         IBEND2=IUDAT(JE7+2)                                            AUDMB     301
         IF(IBEND2.NE.0) CYO(2,IBEND2)=1.0                              AUDMB     302
      ENDIF                                                             AUDMB     303
      IF(LDEB) WRITE(IUD6,1070) ((CYO(I,J),I=1,LCYO),J=1,IYB)           AUDMB     304
C                                                                       AUDMB     305
      DO 570 I=1,IYB                                                    AUDMB     306
      DO 570 J=1,IUB                                                    AUDMB     307
      DO 570 K=1,20                                                     AUDMB     308
      CYB(J,I)=CYB(J,I)+DU0(J,K)*XUY(K,I)                               AUDMB     309
  570 CONTINUE                                                          AUDMB     310
      IF(LDEB) WRITE(IUD6,1080) ((CYB(I,J),J=1,IYB),I=1,IUB)            AUDMB     311
C                                                                       AUDMB     312
      DO 580 I=1,LOUT                                                   AUDMB     313
      DO 580 J=1,IUB                                                    AUDMB     314
      DUI(J,I)=0.0                                                      AUDMB     315
      DO 580 K=1,20                                                     AUDMB     316
      DUI(J,I)=DUI(J,I)+DU0(J,K)*XUI(K,I)                               AUDMB     317
      DUV(J,I)=DUV(J,I)+DU0(J,K)*XUV(K,I)                               AUDMB     318
  580 CONTINUE                                                          AUDMB     319
      DO 590 I=1,LOUT                                                   AUDMB     320
      DO 590 J=1,IUB                                                    AUDMB     321
      DO 590 K=1,60                                                     AUDMB     322
      DUV(J,I)=DUV(J,I)+DUR0(J,K)*XUVR(K,I)                             AUDMB     323
  590 CONTINUE                                                          AUDMB     324
      IF(LDEB) WRITE(IUD6,1090) ((DUI(I,J),J=1,LOUT),I=1,IUB)           AUDMB     325
      IF(LDEB) WRITE(IUD6,1100) ((DUV(I,J),J=1,LOUT),I=1,IUB)           AUDMB     326
C                                                                       AUDMB     327
      DO 600 I=1,IUB                                                    AUDMB     328
      DUREF(I)=0.0                                                      AUDMB     329
      DO 600 J=1,20                                                     AUDMB     330
      DUREF(I)=DUREF(I)+DU0(I,J)*XUREF(J)                               AUDMB     331
  600 CONTINUE                                                          AUDMB     332
      IF(LDEB) WRITE(IUD6,1110) (DUREF(I),I=1,IUB)                      AUDMB     333
C                                                                       AUDMB     334
      IF(LWIF.NE.0) THEN                                                AUDMB     335
         DO 610 I=1,IUB                                                 AUDMB     336
         DUW(I)=0.0                                                     AUDMB     337
         DUIF(I)=0.0                                                    AUDMB     338
         DUVS(I)=0.0                                                    AUDMB     339
         DUVU(I)=0.0                                                    AUDMB     340
         DUTM(I)=0.0                                                    AUDMB     341
         DO 610 J=1,20                                                  AUDMB     342
         DUW(I)=DUW(I)+DU0(I,J)*XUW(J)                                  AUDMB     343
         DUIF(I)=DUIF(I)+DU0(I,J)*XUIF(J)                               AUDMB     344
         DUVS(I)=DUVS(I)+DU0(I,J)*XUVS(J)                               AUDMB     345
         DUVU(I)=DUVU(I)+DU0(I,J)*XUVU(J)                               AUDMB     346
         DUTM(I)=DUTM(I)+DU0(I,J)*XUTM(J)                               AUDMB     347
  610    CONTINUE                                                       AUDMB     348
         IF(LDEB) WRITE(IUD6,1120) (XUW(J),J=1,20)                      AUDMB     349
         IF(LDEB) WRITE(IUD6,1130) (XUIF(J),J=1,20)                     AUDMB     350
         IF(LDEB) WRITE(IUD6,1140) (XUVS(J),J=1,20)                     AUDMB     351
         IF(LDEB) WRITE(IUD6,1150) (XUVU(J),J=1,20)                     AUDMB     352
         IF(LDEB) WRITE(IUD6,1160) (DUW(J),J=1,IUB)                     AUDMB     353
         IF(LDEB) WRITE(IUD6,1170) (DUIF(J),J=1,IUB)                    AUDMB     354
         IF(LDEB) WRITE(IUD6,1180) (DUVS(J),J=1,IUB)                    AUDMB     355
         IF(LDEB) WRITE(IUD6,1190) (DUVU(J),J=1,IUB)                    AUDMB     356
         IF(LDEB) WRITE(IUD6,1270) (DUTM(J),J=1,IUB)                    AUDMB     357
      ENDIF                                                             AUDMB     358
C                                                                       AUDMB     359
      IF(LREM.NE.0) THEN                                                AUDMB     360
         DO 620 I=1,LREM                                                AUDMB     361
         DO 620 J=1,IUB                                                 AUDMB     362
         DO 620 K=1,60                                                  AUDMB     363
         DUVR(J,I)=DUVR(J,I)+DUR0(J,K)*XUVR(K,I+LOUT)                   AUDMB     364
  620    CONTINUE                                                       AUDMB     365
         IF(LDEB) WRITE(IUD6,1200) ((DUVR(I,J),J=1,LREM),I=1,IUB)       AUDMB     366
      ENDIF                                                             AUDMB     367
      IF(LDEB) WRITE(IUD6,1220) ((AXB(I,J),J=1,KORD),I=1,KORD)          AUDMB     368
      IF(LDEB) WRITE(IUD6,1230) ((BUB(I,J),J=1,IUB),I=1,KORD)           AUDMB     369
      IF(LDEB) WRITE(IUD6,1240) ((CXB(I,J),J=1,KORD),I=1,IYB)           AUDMB     370
      IF(LDEB) WRITE(IUD6,1250) ((DUB(I,J),J=1,IUB),I=1,IYB)            AUDMB     371
      IF(LDEB) WRITE(IUD6,1260)                                         AUDMB     372
C                                                                       AUDMB     373
      RETURN                                                            AUDMB     374
C                                                                       AUDMB     375
 1000 FORMAT(' ((XUY(I,J),I=1,20),J=1,IYB):      ',(/,1X,10E12.4))      AUDMB     376
 1010 FORMAT(' ((XUI(I,J),I=1,20),J=1,LOUT):      ',(/,1X,10E12.4))     AUDMB     377
 1020 FORMAT(' ((XUV(I,J),I=1,20),J=1,LOUT):      ',(/,1X,10E12.4))     AUDMB     378
 1030 FORMAT(' ((XUVR(I,J),I=1,60),J=1,LOUT+LREM):',(/,1X,10E12.4))     AUDMB     379
 1040 FORMAT(' (XUREF(J),J=1,20):             ',(/,1X,10E12.4))         AUDMB     380
 1050 FORMAT(' ((DU0(I,J),J=1,20),I=1,IUB):   ',(/,1X,10E12.4))         AUDMB     381
 1060 FORMAT(' ((DUR0(I,J),J=1,60),I=1,IUB):  ',(/,1X,10E12.4))         AUDMB     382
 1070 FORMAT(' ((CYO(I,J),I=1,LCYO),J=1,IYB):',(/,1X,10E12.4))          AUDMB     383
 1080 FORMAT(' ((CYB(I,J),J=1,IYB),I=1,IUB): ',(/,1X,10E12.4))          AUDMB     384
 1090 FORMAT(' ((DUI(I,J),J=1,LOUT),I=1,IUB): ',(/,1X,10E12.4))         AUDMB     385
 1100 FORMAT(' ((DUV(I,J),J=1,LOUT),I=1,IUB): ',(/,1X,10E12.4))         AUDMB     386
 1110 FORMAT(' (DUREF(I),I=1,IUB):            ',(/,1X,10E12.4))         AUDMB     387
 1120 FORMAT(' (XUW(J),J=1,20):               ',(/,1X,10E12.4))         AUDMB     388
 1130 FORMAT(' (XUIF(J),J=1,20):              ',(/,1X,10E12.4))         AUDMB     389
 1140 FORMAT(' (XUVS(J),J=1,20):              ',(/,1X,10E12.4))         AUDMB     390
 1150 FORMAT(' (XUVU(J),J=1,20):              ',(/,1X,10E12.4))         AUDMB     391
 1160 FORMAT(' (DUW(J),J=1,IUB):              ',(/,1X,10E12.4))         AUDMB     392
 1170 FORMAT(' (DUIF(J),J=1,IUB):             ',(/,1X,10E12.4))         AUDMB     393
 1180 FORMAT(' (DUVS(J),J=1,IUB):             ',(/,1X,10E12.4))         AUDMB     394
 1190 FORMAT(' (DUVU(J),J=1,IUB):             ',(/,1X,10E12.4))         AUDMB     395
 1200 FORMAT(' ((DUVR(I,J),J=1,LREM),I=1,IUB):',(/,1X,10E12.4))         AUDMB     396
 1210 FORMAT(/,' AUDMB STARTS:',/                                       AUDMB     397
     &              ,' KORD,IUB,IYB,LOUT,LCYO,LWIF,LREM:',7I5)          AUDMB     398
 1220 FORMAT(' ((AXB(I,J),J=1,KORD),I=1,KORD):',(/,1X,10E12.4))         AUDMB     399
 1230 FORMAT(' ((BUB(I,J),J=1,IUB),I=1,KORD): ',(/,1X,10E12.4))         AUDMB     400
 1240 FORMAT(' ((CXB(I,J),J=1,KORD),I=1,IYB):',(/,1X,10E12.4))          AUDMB     401
 1250 FORMAT(' ((DUB(I,J),J=1,IUB),I=1,IYB): ',(/,1X,10E12.4))          AUDMB     402
 1260 FORMAT(' AUDMB ENDS',/)                                           AUDMB     403
 1270 FORMAT(' (DUTM(J),J=1,IUB):             ',(/,1X,10E12.4))         AUDMB     404
      END                                                               AUDMB     405
