CFPRIME ASGNAL                                                          ASGNAL      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 ASGNAL(ISTATE,INTYP1,INTYP2)                           ASGNAL      3
CD                                                                      ASGNAL      4
CD    TO PRE-PROCESS THE INPUT SIGNAL(S) OF STABILIZER (ALL TYPES) FOR  ASGNAL      5
CD    FORMULATING THE JACOBIAN MATRICES.                                ASGNAL      6
CD                                                                      ASGNAL      7
CD    NOTE THAT THE TF BLOCK IS INCLUDED IF THE INPUT IS FROM BUS       ASGNAL      8
CD    FREQUENCY.                                                        ASGNAL      9
CD                                                                      ASGNAL     10
      INCLUDE 'PARX.INS'                                                ASGNAL     11
      INCLUDE 'CNB4.INS'                                                ASGNAL     12
      INCLUDE 'CNB5.INS'                                                ASGNAL     13
      INCLUDE 'CNB9.INS'                                                ASGNAL     14
      INCLUDE 'CNB19.INS'                                               ASGNAL     15
      INCLUDE 'CNEXC.INS'                                               ASGNAL     16
      INCLUDE 'CNGDAT.INS'                                              ASGNAL     17
      INCLUDE 'CNSTAB.INS'                                              ASGNAL     18
      INCLUDE 'CNXSTA.INS'                                              ASGNAL     19
      INCLUDE 'CNMDAT.INS'                                              ASGNAL     20
      INCLUDE 'CNVOLT.INS'                                              ASGNAL     21
      INCLUDE 'CNUNIT.INS'                                              ASGNAL     22
      INCLUDE 'CNFLAG.INS'                                              ASGNAL     23
      INCLUDE 'CNPARX.INS'                                              ASGNAL     24
      INCLUDE 'CNYVAR.INS'                                              ASGNAL     25
      INCLUDE 'EQYVAR.INS'                                              ASGNAL     26
      INCLUDE 'CNSGAL.INS'                                              ASGNAL     27
C                                                                       ASGNAL     28
      INCLUDE 'CNABAK.INS'                                              ASGNAL     29
C                                                                       ASGNAL     30
C     FIRST INPUT                                                       ASGNAL     31
C                                                                       ASGNAL     32
      LDEB=.FALSE.                                                      ASGNAL     33
C                                                                       ASGNAL     34
C     TYPE  DOM PAC DF   P   V  DV                                      ASGNAL     35
      GOTO (100,200,300,400,500,500), INTYP1                            ASGNAL     36
C                                                                       ASGNAL     37
 100  DO 10 I=1,20                                                      ASGNAL     38
         IF (INSTA(I,1).EQ.0) GOTO 600                                  ASGNAL     39
         IWS1=INSTA(I,1)                                                ASGNAL     40
         A(IWS1,1)=A(IWS1,1)+RINSTA(I,1)                                ASGNAL     41
  10  CONTINUE                                                          ASGNAL     42
      GOTO 600                                                          ASGNAL     43
C                                                                       ASGNAL     44
 200  DO 30 I=1,20                                                      ASGNAL     45
         IF (INSTA(I,1).EQ.0) GOTO 600                                  ASGNAL     46
         IWS1=INSTA(I,1)                                                ASGNAL     47
         WS1=RINSTA(I,1)                                                ASGNAL     48
         A(IWS1,1)=A(IWS1,1)-DAMPK                                      ASGNAL     49
         BC(IWS1,1)=BC(IWS1,1)-WS1*ALP1                                 ASGNAL     50
         BC(IWS1,2)=BC(IWS1,2)-WS1*ALP2                                 ASGNAL     51
         B(IWS1,1)=B(IWS1,1)-WS1*ALP3                                   ASGNAL     52
         B(IWS1,2)=B(IWS1,2)-WS1*ALP4                                   ASGNAL     53
  30  CONTINUE                                                          ASGNAL     54
      GOTO 600                                                          ASGNAL     55
C                                                                       ASGNAL     56
C     USE KN TO INCLUDE REMOTE SENSING                                  ASGNAL     57
C                                                                       ASGNAL     58
 300  DO 40 I=1,20                                                      ASGNAL     59
         IF (INSTA(I,1).EQ.0) GOTO 600                                  ASGNAL     60
         IWS1=INSTA(I,1)                                                ASGNAL     61
         WS1=RINSTA(I,1)                                                ASGNAL     62
         A(IWS1,ISTATE)=-WS1*TFIOM0                                     ASGNAL     63
         BC(IWS1,1)=BC(IWS1,1)+WS1*ALP1                                 ASGNAL     64
         BC(IWS1,2)=BC(IWS1,2)+WS1*ALP2                                 ASGNAL     65
         B(IWS1,KN-1)=B(IWS1,KN-1)+WS1*ALP3                             ASGNAL     66
         B(IWS1,KN)=B(IWS1,KN)+WS1*ALP4                                 ASGNAL     67
  40  CONTINUE                                                          ASGNAL     68
      GOTO 600                                                          ASGNAL     69
C                                                                       ASGNAL     70
 400  DO 60 I=1,20                                                      ASGNAL     71
         IF (INSTA(I,1).EQ.0) GOTO 600                                  ASGNAL     72
         IWS1=INSTA(I,1)                                                ASGNAL     73
         WS1=RINSTA(I,1)                                                ASGNAL     74
         BC(IWS1,1)=BC(IWS1,1)+WS1*ALP1                                 ASGNAL     75
         BC(IWS1,2)=BC(IWS1,2)+WS1*ALP2                                 ASGNAL     76
         B(IWS1,1)=B(IWS1,1)+WS1*ALP3                                   ASGNAL     77
         B(IWS1,2)=B(IWS1,2)+WS1*ALP4                                   ASGNAL     78
  60  CONTINUE                                                          ASGNAL     79
      GOTO 600                                                          ASGNAL     80
C                                                                       ASGNAL     81
C     USE KN TO INCLUDE REMOTE SENSING                                  ASGNAL     82
C                                                                       ASGNAL     83
 500  DO 80 I=1,20                                                      ASGNAL     84
         IF (INSTA(I,1).EQ.0) GOTO 600                                  ASGNAL     85
         IWS1=INSTA(I,1)                                                ASGNAL     86
         WS1=RINSTA(I,1)                                                ASGNAL     87
         B(IWS1,KN-1)=B(IWS1,KN-1)+WS1*ALP3                             ASGNAL     88
         B(IWS1,KN)=B(IWS1,KN)+WS1*ALP4                                 ASGNAL     89
  80  CONTINUE                                                          ASGNAL     90
C                                                                       ASGNAL     91
 600  CONTINUE                                                          ASGNAL     92
C                                                                       ASGNAL     93
      IF (INTYP2.EQ.0) GOTO 1600                                        ASGNAL     94
C                                                                       ASGNAL     95
C     SECOND INPUT                                                      ASGNAL     96
C                                                                       ASGNAL     97
C     TYPE   DOM  PAC   DF    P    V   DV                               ASGNAL     98
      GOTO (1100,1200,1300,1400,1500,1500), INTYP2                      ASGNAL     99
C                                                                       ASGNAL    100
1100  DO 910 I=1,20                                                     ASGNAL    101
         IF (INSTA(I,1).EQ.0) GOTO 1600                                 ASGNAL    102
         IWS1=INSTA(I,1)                                                ASGNAL    103
         A(IWS1,1)=A(IWS1,1)+RINSTA(I,2)                                ASGNAL    104
 910  CONTINUE                                                          ASGNAL    105
      GOTO 1600                                                         ASGNAL    106
C                                                                       ASGNAL    107
1200  DO 930 I=1,20                                                     ASGNAL    108
         IF (INSTA(I,1).EQ.0) GOTO 1600                                 ASGNAL    109
         IWS1=INSTA(I,1)                                                ASGNAL    110
         WS1=RINSTA(I,2)                                                ASGNAL    111
         A(IWS1,1)=A(IWS1,1)-DAMPK                                      ASGNAL    112
         BC(IWS1,1)=BC(IWS1,1)-WS1*ALPS1                                ASGNAL    113
         BC(IWS1,2)=BC(IWS1,2)-WS1*ALPS2                                ASGNAL    114
         B(IWS1,1)=B(IWS1,1)-WS1*ALPS3                                  ASGNAL    115
         B(IWS1,2)=B(IWS1,2)-WS1*ALPS4                                  ASGNAL    116
 930  CONTINUE                                                          ASGNAL    117
      GOTO 1600                                                         ASGNAL    118
C                                                                       ASGNAL    119
C     USE KN2 TO INCLUDE REMOTE SENSING                                 ASGNAL    120
C                                                                       ASGNAL    121
1300  DO 940 I=1,20                                                     ASGNAL    122
         IF (INSTA(I,1).EQ.0) GOTO 1600                                 ASGNAL    123
         IWS1=INSTA(I,1)                                                ASGNAL    124
         WS1=RINSTA(I,2)                                                ASGNAL    125
         A(IWS1,ISTATE)=-WS1*TFIOM0                                     ASGNAL    126
         BC(IWS1,1)=BC(IWS1,1)+WS1*ALPS1                                ASGNAL    127
         BC(IWS1,2)=BC(IWS1,2)+WS1*ALPS2                                ASGNAL    128
         B(IWS1,KN2-1)=B(IWS1,KN2-1)+WS1*ALPS3                          ASGNAL    129
         B(IWS1,KN2)=B(IWS1,KN2)+WS1*ALPS4                              ASGNAL    130
 940  CONTINUE                                                          ASGNAL    131
      GOTO 1600                                                         ASGNAL    132
C                                                                       ASGNAL    133
1400  DO 960 I=1,20                                                     ASGNAL    134
         IF (INSTA(I,1).EQ.0) GOTO 1600                                 ASGNAL    135
         IWS1=INSTA(I,1)                                                ASGNAL    136
         WS1=RINSTA(I,2)                                                ASGNAL    137
         BC(IWS1,1)=BC(IWS1,1)+WS1*ALPS1                                ASGNAL    138
         BC(IWS1,2)=BC(IWS1,2)+WS1*ALPS2                                ASGNAL    139
         B(IWS1,1)=B(IWS1,1)+WS1*ALPS3                                  ASGNAL    140
         B(IWS1,2)=B(IWS1,2)+WS1*ALPS4                                  ASGNAL    141
 960  CONTINUE                                                          ASGNAL    142
      GOTO 1600                                                         ASGNAL    143
C                                                                       ASGNAL    144
C     USE KN2 TO INCLUDE REMOTE SENSING                                 ASGNAL    145
C                                                                       ASGNAL    146
1500  DO 980 I=1,20                                                     ASGNAL    147
         IF (INSTA(I,1).EQ.0) GOTO 1600                                 ASGNAL    148
         IWS1=INSTA(I,1)                                                ASGNAL    149
         WS1=RINSTA(I,2)                                                ASGNAL    150
         B(IWS1,KN2-1)=B(IWS1,KN2-1)+WS1*ALPS3                          ASGNAL    151
         B(IWS1,KN2)=B(IWS1,KN2)+WS1*ALPS4                              ASGNAL    152
 980  CONTINUE                                                          ASGNAL    153
C                                                                       ASGNAL    154
1600  CONTINUE                                                          ASGNAL    155
      IF (INTYP1.NE.2.AND.INTYP2.NE.2) INSTA(1,1)=0                     ASGNAL    156
C                                                                       ASGNAL    157
      RETURN                                                            ASGNAL    158
      END                                                               ASGNAL    159
