CFPRIME ASTA11                                                          ASTA11      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 ASTA11(ISTATE)                                         ASTA11      3
CD                                                                      ASTA11      4
CD    TO FORMULATE THE JACOBIAN MATRICES OF TYPE 11 STABILIZER.         ASTA11      5
CD                                                                      ASTA11      6
      INCLUDE 'PARX.INS'                                                ASTA11      7
      INCLUDE 'CNB8.INS'                                                ASTA11      8
      INCLUDE 'CNEXC.INS'                                               ASTA11      9
      INCLUDE 'CNSTAB.INS'                                              ASTA11     10
      INCLUDE 'CNPARX.INS'                                              ASTA11     11
      INCLUDE 'CNMDAT.INS'                                              ASTA11     12
      INCLUDE 'CNXSTA.INS'                                              ASTA11     13
      INCLUDE 'CNMSTA.INS'                                              ASTA11     14
      INCLUDE 'CNUDMB.INS'                                              ASTA11     15
C                                                                       ASTA11     16
      INCLUDE 'CNABAK.INS'                                              ASTA11     17
C                                                                       ASTA11     18
      IE=0                                                              ASTA11     19
      ICASE=IDDAT(JS+34)                                                ASTA11     20
C                                                                       ASTA11     21
C     EXIT IF OUTPUT SWITCH IS AT "OFF" POSITION                        ASTA11     22
C                                                                       ASTA11     23
      IF (ICASE.EQ.0) THEN                                              ASTA11     24
         IF (IDDAT(JS+4).NE.0) IE=IE+1                                  ASTA11     25
         IF (IDDAT(JS+6).EQ.0) IE=IE+1                                  ASTA11     26
         IF (IDDAT(JS+19).EQ.0) IE=IE+1                                 ASTA11     27
         IF (IDDAT(JS+20).EQ.0) IE=IE+1                                 ASTA11     28
         IF (IDDAT(JS+21).EQ.0) IE=IE+1                                 ASTA11     29
         IF (IDDAT(JS+22).EQ.0) IE=IE+1                                 ASTA11     30
         IF (IDDAT(JS+9).EQ.0) IE=IE+1                                  ASTA11     31
         IF (IDDAT(JS+11).EQ.0) IE=IE+1                                 ASTA11     32
         IF (IDDAT(JS+13).EQ.0) IE=IE+1                                 ASTA11     33
         IE=IE+1                                                        ASTA11     34
         IF (IFLTRN.NE.0) CALL ASTF1(ISTATE)                            ASTA11     35
         INSTA(1,1)=0                                                   ASTA11     36
         GOTO 110                                                       ASTA11     37
      END IF                                                            ASTA11     38
C                                                                       ASTA11     39
      INTYP1=IDDAT(JS+2)                                                ASTA11     40
      INTYP2=5                                                          ASTA11     41
C                                                                       ASTA11     42
C     KQS, TQS BLOCK (OPTIONAL)                                         ASTA11     43
C                                                                       ASTA11     44
      CQS=DDAT(JS+3)                                                    ASTA11     45
      IF (IDDAT(JS+4).EQ.0) THEN                                        ASTA11     46
         ISUB1=0                                                        ASTA11     47
      ELSE                                                              ASTA11     48
         IE=IE+1                                                        ASTA11     49
         ISUB1=ISTATE+IE                                                ASTA11     50
         TQS=1.0/DDAT(JS+4)                                             ASTA11     51
         A(ISUB1,ISUB1)=-TQS                                            ASTA11     52
         INSTA(IE,1)=ISUB1                                              ASTA11     53
         RINSTA(IE,1)=CQS*TQS                                           ASTA11     54
         RINSTA(IE,2)=0.0                                               ASTA11     55
      END IF                                                            ASTA11     56
C                                                                       ASTA11     57
C     KQV, TQV BLOCK (OPTIONAL)                                         ASTA11     58
C                                                                       ASTA11     59
      CQV=DDAT(JS+5)                                                    ASTA11     60
      IF (IDDAT(JS+6).EQ.0) THEN                                        ASTA11     61
         ISUB2=0                                                        ASTA11     62
      ELSE                                                              ASTA11     63
         IE=IE+1                                                        ASTA11     64
         ISUB2=ISTATE+IE                                                ASTA11     65
         TQV=1.0/DDAT(JS+6)                                             ASTA11     66
         A(ISUB2,ISUB2)=-TQV                                            ASTA11     67
         INSTA(IE,1)=ISUB2                                              ASTA11     68
         RINSTA(IE,1)=0.0                                               ASTA11     69
         RINSTA(IE,2)=CQV*TQV                                           ASTA11     70
      END IF                                                            ASTA11     71
C                                                                       ASTA11     72
C     T1 BLOCK (OPTIONAL)                                               ASTA11     73
C                                                                       ASTA11     74
      IF (IDDAT(JS+19).EQ.0) THEN                                       ASTA11     75
         ISUB3=0                                                        ASTA11     76
      ELSE                                                              ASTA11     77
         IE=IE+1                                                        ASTA11     78
         ISUB3=ISTATE+IE                                                ASTA11     79
         T1I=1.0/DDAT(JS+19)                                            ASTA11     80
         A(ISUB3,ISUB3)=-T1I                                            ASTA11     81
         INSTA(IE,1)=ISUB3                                              ASTA11     82
         RINSTA(IE,1)=0.0                                               ASTA11     83
         RINSTA(IE,2)=0.0                                               ASTA11     84
      END IF                                                            ASTA11     85
C                                                                       ASTA11     86
C     T2 BLOCK (OPTIONAL)                                               ASTA11     87
C                                                                       ASTA11     88
      IF (IDDAT(JS+20).EQ.0) THEN                                       ASTA11     89
         ISUB4=0                                                        ASTA11     90
      ELSE                                                              ASTA11     91
         IE=IE+1                                                        ASTA11     92
         ISUB4=ISTATE+IE                                                ASTA11     93
         T2I=1.0/DDAT(JS+20)                                            ASTA11     94
         A(ISUB4,ISUB4)=-T2I                                            ASTA11     95
         IF (ISUB3.NE.0) A(ISUB4,ISUB3)=T2I                             ASTA11     96
         INSTA(IE,1)=ISUB4                                              ASTA11     97
         RINSTA(IE,1)=0.0                                               ASTA11     98
         RINSTA(IE,2)=0.0                                               ASTA11     99
      END IF                                                            ASTA11    100
C                                                                       ASTA11    101
C     SWITCH S1                                                         ASTA11    102
C                                                                       ASTA11    103
      S1=REAL(IDDAT(JS+32))                                             ASTA11    104
C                                                                       ASTA11    105
C     T3 BLOCK (OPTIONAL)                                               ASTA11    106
C                                                                       ASTA11    107
      IF (IDDAT(JS+21).EQ.0) THEN                                       ASTA11    108
         ISUB5=0                                                        ASTA11    109
      ELSE                                                              ASTA11    110
         IE=IE+1                                                        ASTA11    111
         ISUB5=ISTATE+IE                                                ASTA11    112
         T3I=1.0/DDAT(JS+21)                                            ASTA11    113
         A(ISUB5,ISUB5)=-T3I                                            ASTA11    114
         INSTA(IE,1)=ISUB5                                              ASTA11    115
         RINSTA(IE,1)=0.0                                               ASTA11    116
         RINSTA(IE,2)=0.0                                               ASTA11    117
         IF (ISUB1.NE.0) THEN                                           ASTA11    118
            A(ISUB5,ISUB1)=T3I*(1.0-S1)                                 ASTA11    119
         ELSE                                                           ASTA11    120
            RINSTA(IE,1)=CQS*T3I*(1.0-S1)                               ASTA11    121
         END IF                                                         ASTA11    122
      END IF                                                            ASTA11    123
C                                                                       ASTA11    124
C     T4 BLOCK (OPTIONAL)                                               ASTA11    125
C                                                                       ASTA11    126
      IF (IDDAT(JS+22).EQ.0) THEN                                       ASTA11    127
         ISUB6=0                                                        ASTA11    128
      ELSE                                                              ASTA11    129
         IE=IE+1                                                        ASTA11    130
         ISUB6=ISTATE+IE                                                ASTA11    131
         T4I=1.0/DDAT(JS+22)                                            ASTA11    132
         A(ISUB6,ISUB6)=-T4I                                            ASTA11    133
         IF (ISUB5.NE.0) A(ISUB6,ISUB5)=-T4I                            ASTA11    134
         INSTA(IE,1)=ISUB6                                              ASTA11    135
         RINSTA(IE,1)=0.0                                               ASTA11    136
         RINSTA(IE,2)=0.0                                               ASTA11    137
         IF (ISUB1.NE.0) THEN                                           ASTA11    138
            A(ISUB6,ISUB1)=T4I*(1.0-S1)                                 ASTA11    139
         ELSE                                                           ASTA11    140
            RINSTA(IE,1)=CQS*T4I*(1.0-S1)                               ASTA11    141
         END IF                                                         ASTA11    142
      END IF                                                            ASTA11    143
C                                                                       ASTA11    144
      GAIN1=DDAT(JS+17)                                                 ASTA11    145
      GAIN2=0.0                                                         ASTA11    146
      GAIN3=0.0                                                         ASTA11    147
      GAIN4=0.0                                                         ASTA11    148
      GAIN5=1.0                                                         ASTA11    149
C                                                                       ASTA11    150
C     TQ BLOCK                                                          ASTA11    151
C                                                                       ASTA11    152
      IE=IE+1                                                           ASTA11    153
      ISUB7=ISTATE+IE                                                   ASTA11    154
      TQI=1.0/DDAT(JS+7)                                                ASTA11    155
      WS1=GAIN1*TQI                                                     ASTA11    156
      A(ISUB7,ISUB7)=-TQI                                               ASTA11    157
      IF (ISUB4.NE.0) A(ISUB7,ISUB4)=WS1                                ASTA11    158
      IF (ISUB3.NE.0) A(ISUB7,ISUB3)=-WS1                               ASTA11    159
      INSTA(IE,1)=ISUB7                                                 ASTA11    160
      RINSTA(IE,1)=0.0                                                  ASTA11    161
      RINSTA(IE,2)=0.0                                                  ASTA11    162
      IF (ISUB2.NE.0) THEN                                              ASTA11    163
         A(ISUB7,ISUB2)=-TQI                                            ASTA11    164
      ELSE                                                              ASTA11    165
         RINSTA(IE,2)=-CQV*TQI                                          ASTA11    166
      END IF                                                            ASTA11    167
      IF (ISUB1.NE.0) THEN                                              ASTA11    168
         A(ISUB7,ISUB1)=WS1                                             ASTA11    169
      ELSE                                                              ASTA11    170
         RINSTA(IE,1)=CQS*WS1                                           ASTA11    171
      END IF                                                            ASTA11    172
C                                                                       ASTA11    173
C     T'Q1, TQ1 BLOCK (OPTIONAL)                                        ASTA11    174
C                                                                       ASTA11    175
      IF (IDDAT(JS+9).EQ.0) THEN                                        ASTA11    176
         ISUB8=0                                                        ASTA11    177
      ELSE                                                              ASTA11    178
         IE=IE+1                                                        ASTA11    179
         ISUB8=ISTATE+IE                                                ASTA11    180
         TQ1I=1.0/DDAT(JS+9)                                            ASTA11    181
         TPQ1=DDAT(JS+8)                                                ASTA11    182
         GAIN1=GAIN1*TQ1I                                               ASTA11    183
         A(ISUB8,ISUB8)=-TQ1I                                           ASTA11    184
         IF (ISUB7.NE.0) A(ISUB8,ISUB7)=-TQ1I                           ASTA11    185
         IF (ISUB4.NE.0) A(ISUB8,ISUB4)=GAIN1                           ASTA11    186
         IF (ISUB3.NE.0) A(ISUB8,ISUB3)=-GAIN1                          ASTA11    187
         INSTA(IE,1)=ISUB8                                              ASTA11    188
         RINSTA(IE,1)=0.0                                               ASTA11    189
         RINSTA(IE,2)=0.0                                               ASTA11    190
         IF (ISUB2.NE.0) THEN                                           ASTA11    191
            A(ISUB8,ISUB2)=-TQ1I                                        ASTA11    192
         ELSE                                                           ASTA11    193
            RINSTA(IE,2)=-CQV*TQ1I                                      ASTA11    194
         END IF                                                         ASTA11    195
         IF (ISUB1.NE.0) THEN                                           ASTA11    196
            A(ISUB8,ISUB1)=GAIN1                                        ASTA11    197
         ELSE                                                           ASTA11    198
            RINSTA(IE,1)=CQS*GAIN1                                      ASTA11    199
         END IF                                                         ASTA11    200
         GAIN1=GAIN1*TPQ1                                               ASTA11    201
         GAIN2=1.0-TPQ1*TQ1I                                            ASTA11    202
         GAIN5=TPQ1*TQ1I                                                ASTA11    203
      END IF                                                            ASTA11    204
C                                                                       ASTA11    205
C     T'Q2, TQ2 BLOCK (OPTIONAL)                                        ASTA11    206
C                                                                       ASTA11    207
      IF (IDDAT(JS+11).EQ.0) THEN                                       ASTA11    208
         ISUB9=0                                                        ASTA11    209
      ELSE                                                              ASTA11    210
         IE=IE+1                                                        ASTA11    211
         ISUB9=ISTATE+IE                                                ASTA11    212
         TQ2I=1.0/DDAT(JS+11)                                           ASTA11    213
         TPQ2=DDAT(JS+10)                                               ASTA11    214
         GAIN1=GAIN1*TQ2I                                               ASTA11    215
         GAIN2=GAIN2*TQ2I                                               ASTA11    216
         GAIN5=GAIN5*TQ2I                                               ASTA11    217
         A(ISUB9,ISUB9)=-TQ2I                                           ASTA11    218
         IF (ISUB8.NE.0) A(ISUB9,ISUB8)=GAIN2                           ASTA11    219
         IF (ISUB7.NE.0) A(ISUB9,ISUB7)=-GAIN5                          ASTA11    220
         IF (ISUB4.NE.0) A(ISUB9,ISUB4)=GAIN1                           ASTA11    221
         IF (ISUB3.NE.0) A(ISUB9,ISUB3)=-GAIN1                          ASTA11    222
         INSTA(IE,1)=ISUB9                                              ASTA11    223
         RINSTA(IE,1)=0.0                                               ASTA11    224
         RINSTA(IE,2)=0.0                                               ASTA11    225
         IF (ISUB2.NE.0) THEN                                           ASTA11    226
            A(ISUB9,ISUB2)=-GAIN5                                       ASTA11    227
         ELSE                                                           ASTA11    228
            RINSTA(IE,2)=-CQV*GAIN5                                     ASTA11    229
         END IF                                                         ASTA11    230
         IF (ISUB1.NE.0) THEN                                           ASTA11    231
            A(ISUB9,ISUB1)=GAIN1                                        ASTA11    232
         ELSE                                                           ASTA11    233
            RINSTA(IE,1)=CQS*GAIN1                                      ASTA11    234
         END IF                                                         ASTA11    235
         GAIN1=GAIN1*TPQ2                                               ASTA11    236
         GAIN2=GAIN2*TPQ2                                               ASTA11    237
         GAIN3=1.0-TPQ2*TQ2I                                            ASTA11    238
         GAIN5=GAIN5*TPQ2                                               ASTA11    239
      END IF                                                            ASTA11    240
C                                                                       ASTA11    241
C     T'Q3, TQ3 BLOCK (OPTIONAL)                                        ASTA11    242
C                                                                       ASTA11    243
      IF (IDDAT(JS+13).EQ.0) THEN                                       ASTA11    244
         ISUB10=0                                                       ASTA11    245
      ELSE                                                              ASTA11    246
         IE=IE+1                                                        ASTA11    247
         ISUB10=ISTATE+IE                                               ASTA11    248
         TQ3I=1.0/DDAT(JS+13)                                           ASTA11    249
         TPQ3=DDAT(JS+12)                                               ASTA11    250
         GAIN1=GAIN1*TQ3I                                               ASTA11    251
         GAIN2=GAIN2*TQ3I                                               ASTA11    252
         GAIN3=GAIN3*TQ3I                                               ASTA11    253
         GAIN5=GAIN5*TQ3I                                               ASTA11    254
         A(ISUB10,ISUB10)=-TQ3I                                         ASTA11    255
         IF (ISUB9.NE.0) A(ISUB10,ISUB9)=GAIN3                          ASTA11    256
         IF (ISUB8.NE.0) A(ISUB10,ISUB8)=GAIN2                          ASTA11    257
         IF (ISUB7.NE.0) A(ISUB10,ISUB7)=-GAIN5                         ASTA11    258
         IF (ISUB4.NE.0) A(ISUB10,ISUB4)=GAIN1                          ASTA11    259
         IF (ISUB3.NE.0) A(ISUB10,ISUB3)=-GAIN1                         ASTA11    260
         INSTA(IE,1)=ISUB10                                             ASTA11    261
         RINSTA(IE,1)=0.0                                               ASTA11    262
         RINSTA(IE,2)=0.0                                               ASTA11    263
         IF (ISUB2.NE.0) THEN                                           ASTA11    264
            A(ISUB10,ISUB2)=-GAIN5                                      ASTA11    265
         ELSE                                                           ASTA11    266
            RINSTA(IE,2)=-CQV*GAIN5                                     ASTA11    267
         END IF                                                         ASTA11    268
         IF (ISUB1.NE.0) THEN                                           ASTA11    269
            A(ISUB10,ISUB1)=GAIN1                                       ASTA11    270
         ELSE                                                           ASTA11    271
            RINSTA(IE,1)=CQS*GAIN1                                      ASTA11    272
         END IF                                                         ASTA11    273
         GAIN1=GAIN1*TPQ3                                               ASTA11    274
         GAIN2=GAIN2*TPQ3                                               ASTA11    275
         GAIN3=GAIN3*TPQ3                                               ASTA11    276
         GAIN4=1.0-TPQ3*TQ3I                                            ASTA11    277
         GAIN5=GAIN5*TPQ3                                               ASTA11    278
      END IF                                                            ASTA11    279
C                                                                       ASTA11    280
C     OUTPUT EQUATION                                                   ASTA11    281
C                                                                       ASTA11    282
      IE1=0                                                             ASTA11    283
      DSTB1=0.0                                                         ASTA11    284
      DSTB2=0.0                                                         ASTA11    285
      IF (ISUB1.EQ.0) THEN                                              ASTA11    286
         DSTB1=CQS*GAIN1                                                ASTA11    287
      ELSE                                                              ASTA11    288
         IE1=IE1+1                                                      ASTA11    289
         IOUTS(IE1)=ISUB1                                               ASTA11    290
         ROUTS(IE1)=GAIN1                                               ASTA11    291
      END IF                                                            ASTA11    292
      IF (ISUB2.EQ.0) THEN                                              ASTA11    293
         DSTB2=-CQV*GAIN5                                               ASTA11    294
      ELSE                                                              ASTA11    295
         IE1=IE1+1                                                      ASTA11    296
         IOUTS(IE1)=ISUB2                                               ASTA11    297
         ROUTS(IE1)=-GAIN5                                              ASTA11    298
      END IF                                                            ASTA11    299
      IF (ISUB3.NE.0) THEN                                              ASTA11    300
         IE1=IE1+1                                                      ASTA11    301
         IOUTS(IE1)=ISUB3                                               ASTA11    302
         ROUTS(IE1)=-GAIN1                                              ASTA11    303
      END IF                                                            ASTA11    304
      IF (ISUB4.NE.0) THEN                                              ASTA11    305
         IE1=IE1+1                                                      ASTA11    306
         IOUTS(IE1)=ISUB4                                               ASTA11    307
         ROUTS(IE1)=GAIN1                                               ASTA11    308
      END IF                                                            ASTA11    309
      IF (ISUB5.NE.0) THEN                                              ASTA11    310
         IE1=IE1+1                                                      ASTA11    311
         IOUTS(IE1)=ISUB5                                               ASTA11    312
         ROUTS(IE1)=0.0                                                 ASTA11    313
      END IF                                                            ASTA11    314
      IF (ISUB6.NE.0) THEN                                              ASTA11    315
         IE1=IE1+1                                                      ASTA11    316
         IOUTS(IE1)=ISUB6                                               ASTA11    317
         ROUTS(IE1)=0.0                                                 ASTA11    318
      END IF                                                            ASTA11    319
      IF (ISUB7.NE.0) THEN                                              ASTA11    320
         IE1=IE1+1                                                      ASTA11    321
         IOUTS(IE1)=ISUB7                                               ASTA11    322
         ROUTS(IE1)=-GAIN5                                              ASTA11    323
      END IF                                                            ASTA11    324
      IF (ISUB8.NE.0) THEN                                              ASTA11    325
         IE1=IE1+1                                                      ASTA11    326
         IOUTS(IE1)=ISUB8                                               ASTA11    327
         ROUTS(IE1)=GAIN2                                               ASTA11    328
      END IF                                                            ASTA11    329
      IF (ISUB9.NE.0) THEN                                              ASTA11    330
         IE1=IE1+1                                                      ASTA11    331
         IOUTS(IE1)=ISUB9                                               ASTA11    332
         ROUTS(IE1)=GAIN3                                               ASTA11    333
      END IF                                                            ASTA11    334
      IF (ISUB10.NE.0) THEN                                             ASTA11    335
         IE1=IE1+1                                                      ASTA11    336
         IOUTS(IE1)=ISUB10                                              ASTA11    337
         ROUTS(IE1)=GAIN4                                               ASTA11    338
      END IF                                                            ASTA11    339
C                                                                       ASTA11    340
C     TORSIONAL FILTER                                                  ASTA11    341
C                                                                       ASTA11    342
      IF (IFLTRN.NE.0) CALL ASTF1(ISTATE)                               ASTA11    343
C                                                                       ASTA11    344
C     INTERCONNECTION WITH EXCITER                                      ASTA11    345
C                                                                       ASTA11    346
      IE1=IE                                                            ASTA11    347
      IF (IEXN.NE.50) THEN                                              ASTA11    348
C                                                                       ASTA11    349
      DO 10 I=1,4                                                       ASTA11    350
         IF (IUST(I).EQ.0) GOTO 100                                     ASTA11    351
         IWS1=IUST(I)                                                   ASTA11    352
         WS1=GUST(I)                                                    ASTA11    353
         DO 20 J=1,IE                                                   ASTA11    354
            IWS2=IOUTS(J)                                               ASTA11    355
            A(IWS1,IWS2)=ROUTS(J)*WS1                                   ASTA11    356
  20     CONTINUE                                                       ASTA11    357
         IE1=IE1+1                                                      ASTA11    358
         INSTA(IE1,1)=IWS1                                              ASTA11    359
         RINSTA(IE1,1)=DSTB1*WS1                                        ASTA11    360
         RINSTA(IE1,2)=DSTB2*WS1                                        ASTA11    361
  10  CONTINUE                                                          ASTA11    362
C                                                                       ASTA11    363
      ELSE                                                              ASTA11    364
C                                                                       ASTA11    365
C     CONNECTION WITH A USER DEFIEND EXCITER                            ASTA11    366
C                                                                       ASTA11    367
      MSEXC=MSUDM(1,1)                                                  ASTA11    368
      IWS1=ISTATE-MSEXC                                                 ASTA11    369
      DO 30 I=1,MSEXC+1                                                 ASTA11    370
         IWS2=IWS1+I                                                    ASTA11    371
         IF (I.GT.MSEXC) IWS2=3                                         ASTA11    372
         DO 40 J=1,IE                                                   ASTA11    373
            IWS3=IOUTS(J)                                               ASTA11    374
            A(IWS2,IWS3)=ROUTS(J)*BXVS(I)                               ASTA11    375
  40     CONTINUE                                                       ASTA11    376
         IE1=IE1+1                                                      ASTA11    377
         INSTA(IE1,1)=IWS2                                              ASTA11    378
         RINSTA(IE1,1)=DSTB1*BXVS(I)                                    ASTA11    379
         RINSTA(IE1,2)=DSTB2*BXVS(I)                                    ASTA11    380
  30  CONTINUE                                                          ASTA11    381
C                                                                       ASTA11    382
      END IF                                                            ASTA11    383
C                                                                       ASTA11    384
 100  CONTINUE                                                          ASTA11    385
      INSTA(IE1+1,1)=0                                                  ASTA11    386
C                                                                       ASTA11    387
C     INCOPORATE WITH INPUT SIGNALS                                     ASTA11    388
C                                                                       ASTA11    389
      CALL ASGNAL(ISTATE,INTYP1,INTYP2)                                 ASTA11    390
C                                                                       ASTA11    391
 110  CONTINUE                                                          ASTA11    392
C                                                                       ASTA11    393
      ISTATE=ISTATE+IE                                                  ASTA11    394
C                                                                       ASTA11    395
      RETURN                                                            ASTA11    396
      END                                                               ASTA11    397
