CFPRIME STGEND                                                          STGEND      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 STGEND                                                 STGEND      3
C                                                                       STGEND      4
CD                                                                      STGEND      5
CD    THIS ROUTINE STORES THE CONVERTED GENERATOR AND THE ASSOCIATED    STGEND      6
CD    CONTROL DATA INTO THE TDDAT AND THE ALIAS ARRAYS                  STGEND      7
CD                                                                      STGEND      8
CD                                                                      STGEND      9
      INCLUDE 'PARX.INS'                                                STGEND     10
      INCLUDE 'CNPT.INS'                                                STGEND     11
      INCLUDE 'CNB19.INS'                                               STGEND     12
      INCLUDE 'CNFLAG.INS'                                              STGEND     13
      INCLUDE 'CNPARX.INS'                                              STGEND     14
      INCLUDE 'CNUNIT.INS'                                              STGEND     15
      INCLUDE 'CNMNEW.INS'                                              STGEND     16
      INCLUDE 'CNJPT.INS'                                               STGEND     17
      INCLUDE 'CNJDAT.INS'                                              STGEND     18
      INCLUDE 'CNTMDA.INS'                                              STGEND     19
      INCLUDE 'CNGSRC.INS'                                              STGEND     20
      INCLUDE 'CNCPT3.INS'                                              STGEND     21
      INCLUDE 'CNTGED.INS'                                              STGEND     22
      INCLUDE 'CNMSG.INS'                                               STGEND     23
C                                                                       STGEND     24
      CHARACTER*80 SIMBUF                                               STGEND     25
      CHARACTER*2 ICKT                                                  STGEND     26
C                                                                       STGEND     27
      LDEB=(JDEB(91).NE.0)                                              STGEND     28
C                                                                       STGEND     29
      IF(NGRI.EQ.' ')THEN                                               STGEND     30
        ICKT=' '//KCCT                                                  STGEND     31
        NGRI='  '//ICKT                                                 STGEND     32
      ENDIF                                                             STGEND     33
C                                                                       STGEND     34
      IEBK1=0                                                           STGEND     35
      JPQ=0                                                             STGEND     36
C                                                                       STGEND     37
      NPROG=MNEW(NLF)                                                   STGEND     38
      IF(NPROG.EQ.0)THEN                                                STGEND     39
        IEBK=2                                                          STGEND     40
        WRITE(MSG(1),1230) NLF,BUSNAM,NGRI                              STGEND     41
        WRITE(MSG(2),1231)                                              STGEND     42
        CALL PRTMSG(2)                                                  STGEND     43
        JDSTAT=5                                                        STGEND     44
        GOTO 110                                                        STGEND     45
      ENDIF                                                             STGEND     46
      IF(NGSREC.NE.0.AND.IGEN.LT.12)THEN                                STGEND     47
        ICKT=NGRI(3:4)                                                  STGEND     48
        CALL ADFGEN(1,JTHGSR,NGSREC,NLF,ICKT,LFGEN,XGEID,NSORDE)        STGEND     49
        IF(JTHGSR.LE.0)THEN                                             STGEND     50
          WRITE(MSG(1),1230) NLF,BUSNAM,NGRI                            STGEND     51
          WRITE(MSG(2),1231)                                            STGEND     52
          CALL PRTMSG(2)                                                STGEND     53
          JTHGSR=0                                                      STGEND     54
          JDSTAT=3                                                      STGEND     55
        ELSE                                                            STGEND     56
          JPQ=1                                                         STGEND     57
          JTHGSR=NSORDE(JTHGSR)                                         STGEND     58
          JDSTAT=IGENST(JTHGSR)                                         STGEND     59
          IF(JDSTAT.EQ.3)THEN                                           STGEND     60
            WRITE(MSG(1),1240) NLF,BUSNAM,NGRI                          STGEND     61
            WRITE(MSG(2),1241)                                          STGEND     62
            CALL PRTMSG(2)                                              STGEND     63
          ENDIF                                                         STGEND     64
        ENDIF                                                           STGEND     65
      ELSE                                                              STGEND     66
        JDSTAT=1                                                        STGEND     67
      ENDIF                                                             STGEND     68
 110  IF(JNT.GE.NDYG)THEN                                               STGEND     69
        WRITE(MSG(1),6000) NDYG                                         STGEND     70
        WRITE(MSG(2),6100) NLF,BUSNAM,NGRI                              STGEND     71
        CALL PRTMSG(2)                                                  STGEND     72
        MSG(1)='STGEND: TOO MANY GENERATORS'                            STGEND     73
        CALL ASTOP(MSG(1),27)                                           STGEND     74
      ENDIF                                                             STGEND     75
      JNT=JNT+1                                                         STGEND     76
      NTHGSR(JNT)=JTHGSR                                                STGEND     77
      IDSTAT(JNT)=JDSTAT                                                STGEND     78
      IF(NTHGEN(NPROG+1).EQ.0)THEN                                      STGEND     79
        NTHGEN(NPROG+1)=JNT                                             STGEND     80
        NEXGEN(JNT)=0                                                   STGEND     81
        IF(NPROG.GT.LJNT)LJNT=NPROG                                     STGEND     82
      ELSE                                                              STGEND     83
        K=NTHGEN(NPROG+1)                                               STGEND     84
 120    CONTINUE                                                        STGEND     85
        N=NEXGEN(K)                                                     STGEND     86
        IF(N.EQ.0)THEN                                                  STGEND     87
          NEXGEN(K)=JNT                                                 STGEND     88
          NEXGEN(JNT)=0                                                 STGEND     89
        ELSE                                                            STGEND     90
          K=N                                                           STGEND     91
          GOTO 120                                                      STGEND     92
        ENDIF                                                           STGEND     93
      ENDIF                                                             STGEND     94
      NGEBUS(JNT)=NLF                                                   STGEND     95
      GENID(JNT)=NGRI                                                   STGEND     96
      IF(JPQ.EQ.0)THEN                                                  STGEND     97
        IPQFA(1,JNT)=IPFA                                               STGEND     98
        IPQFA(2,JNT)=IQFA                                               STGEND     99
      ELSE                                                              STGEND    100
        PQGEN(1,JNT)=GSRCD(1,JTHGSR)                                    STGEND    101
        PQGEN(2,JNT)=GSRCD(2,JTHGSR)                                    STGEND    102
        IGENST(JTHGSR)=IGENST(JTHGSR)*I16B                              STGEND    103
      ENDIF                                                             STGEND    104
CD                                                                      STGEND    105
CD  IGEN = 0 GENERATOR DATA IN IMPEDANCE AND TIME CONSTANT FORM         STGEND    106
CD       = 1 GENERATOR DATA IN PARK'S FORM WITH NO CROSS MUTUAL         STGEND    107
CD       = 2 GENERATOR DATA IN PARK'S FORM WITH CROSS MUTUAL            STGEND    108
CD       = 3 GENERATOR IN CLASSICAL FORM                                STGEND    109
CD                                                                      STGEND    110
CD       = 4 H-L PRESSURE REPRESENTATION WITH HP GENERATOR DATA         STGEND    111
CD           IN IMPEDANCE AND TIME CONSTANT FORM                        STGEND    112
CD       = 5 H-L PRESSURE REPRESENTATION WITH HP GENERATOR DATA         STGEND    113
CD           IN PARK'S FORM WITH NO CROSS MUTUAL                        STGEND    114
CD       = 6 H-L PRESSURE REPRESENTATION WITH HP GENERATOR DATA         STGEND    115
CD           IN PARK'S FORM WTIH CROSS MUTUAL                           STGEND    116
CD       = 7 H-L PRESSURE REPERSENTATION WITH HP GENERATOR              STGEND    117
CD           IN CLASSICAL FORM                                          STGEND    118
CD       = 8 FREQUENCY CONVERTER REPRESENTATION WITH FIRST GENERATOR    STGEND    119
CD           DATA IN IMPEDANCE AND TIME CONSTANT FORM                   STGEND    120
CD       = 9 FREQUENCY CONVERTER REPRESENTATION WITH FIRST GENERATOR    STGEND    121
CD           DATA IN PARK'S FORM WITH NO CROSS MUTUAL                   STGEND    122
CD       =10 FREQUENCY CONVERTER REPRESENTATION WITH FIRST GENERATOR    STGEND    123
CD           DATA IN PARK'S FORM WTIH CROSS MUTUAL                      STGEND    124
CD       =11 FREQUENCY CONVERTER REPRESENTATION WIHT FIRST GENERATOR    STGEND    125
CD           DATA IN CLASSICAL FORM                                     STGEND    126
CD                                                                      STGEND    127
CD       =12 SYNCHRONOUS MOTOR DATA IN IMPEDANCE AND TIME CONSTANT FORM STGEND    128
CD       =13 SYNCHRONOUS MOTOR DATA IN PARK'S FORM WITH NO CROSS MUTUAL STGEND    129
CD       =14 SYNCHRONOUS MOTOR DATA IN PARK'S FORM WITH CROSS MUTUAL    STGEND    130
CD                                                                      STGEND    131
C                                                                       STGEND    132
      IF(IGEN.EQ.3.OR.IGEN.EQ.7.OR.IGEN.EQ.11)THEN                      STGEND    133
C                                                                       STGEND    134
C     CLASSICAL GENERATOR                                               STGEND    135
C                                                                       STGEND    136
        IGENDA(1,JNT)=IGEN                                              STGEND    137
        IGENDA(3,JNT)=0                                                 STGEND    138
        IGENDA(4,JNT)=0                                                 STGEND    139
        IGENDA(5,JNT)=0                                                 STGEND    140
        IGENDA(6,JNT)=0                                                 STGEND    141
        IGENDA(7,JNT)=0                                                 STGEND    142
        IGENDA(8,JNT)=0                                                 STGEND    143
        IGENDA(9,JNT)=0                                                 STGEND    144
        IGENDA(10,JNT)=0                                                STGEND    145
        IGENDA(11,JNT)=0                                                STGEND    146
        IGENDA(12,JNT)=0                                                STGEND    147
        IGENDA(14,JNT)=0                                                STGEND    148
        IGENDA(15,JNT)=0                                                STGEND    149
        IGENDA(16,JNT)=0                                                STGEND    150
C                                                                       STGEND    151
        TDDAT(JTLN+1)=0.0                                               STGEND    152
        TDDAT(JTLN+2)=XPD                                               STGEND    153
        TDDAT(JTLN+3)=HM                                                STGEND    154
        TDDAT(JTLN+4)=DAMP                                              STGEND    155
        TDDAT(JTLN+5)=BASPR                                             STGEND    156
        TDDAT(JTLN+6)=BASVR                                             STGEND    157
        TDDAT(JTLN+7)=0.0                                               STGEND    158
C                                                                       STGEND    159
        JGENDA(1,JNT)=JTLN                                              STGEND    160
        JTLN=JTLN+7                                                     STGEND    161
C                                                                       STGEND    162
        CALL MCHECK(NLF,1,JTLN,'STGEND')                                STGEND    163
        GOTO 720                                                        STGEND    164
      ENDIF                                                             STGEND    165
C                                                                       STGEND    166
C     DETAILED GENERATORS                                               STGEND    167
C                                                                       STGEND    168
      IGENDA(1,JNT)=IGEN                                                STGEND    169
      IGENDA(3,JNT)=ISAT                                                STGEND    170
      IGENDA(4,JNT)=JEXC                                                STGEND    171
      IGENDA(5,JNT)=JSTAB                                               STGEND    172
      IGENDA(6,JNT)=JFLTN                                               STGEND    173
      IGENDA(7,JNT)=0                                                   STGEND    174
      IGENDA(8,JNT)=0                                                   STGEND    175
      IGENDA(9,JNT)=0                                                   STGEND    176
      IGENDA(10,JNT)=0                                                  STGEND    177
      IGENDA(11,JNT)=JTEB                                               STGEND    178
      IGENDA(12,JNT)=0                                                  STGEND    179
      IGENDA(14,JNT)=1                                                  STGEND    180
      IGENDA(15,JNT)=1                                                  STGEND    181
      IGENDA(16,JNT)=1                                                  STGEND    182
C                                                                       STGEND    183
      JGENDA(1,JNT)=JTLN                                                STGEND    184
      JTLN1=JTLN                                                        STGEND    185
C                                                                       STGEND    186
      IF(IGEN.EQ.0.OR.IGEN.EQ.4.OR.IGEN.EQ.8.OR.IGEN.EQ.12)THEN         STGEND    187
C                                                                       STGEND    188
      CALL CHKGXT(NLF,BUSNAM,NGRI                                       STGEND    189
     &,RA,XD,XQ,XL,XPD,XPQ,XPPD,XPPQ,TPDO,TPQO,TPPDO,TPPQO,IEBK1)       STGEND    190
C                                                                       STGEND    191
C     STORE DATA INTO TDDAT ARRAY                                       STGEND    192
C                                                                       STGEND    193
      TDDAT(JTLN+7)=RA                                                  STGEND    194
      TDDAT(JTLN+8)=XD                                                  STGEND    195
      TDDAT(JTLN+9)=XQ                                                  STGEND    196
      TDDAT(JTLN+10)=XL                                                 STGEND    197
      TDDAT(JTLN+11)=XPD                                                STGEND    198
      TDDAT(JTLN+12)=XPQ                                                STGEND    199
      TDDAT(JTLN+13)=XPPD                                               STGEND    200
      TDDAT(JTLN+14)=XPPQ                                               STGEND    201
      TDDAT(JTLN+15)=TPDO                                               STGEND    202
      TDDAT(JTLN+16)=TPQO                                               STGEND    203
      TDDAT(JTLN+17)=TPPDO                                              STGEND    204
      TDDAT(JTLN+18)=TPPQO                                              STGEND    205
      JTLN=JTLN+18                                                      STGEND    206
C                                                                       STGEND    207
C                                                                       STGEND    208
      ENDIF                                                             STGEND    209
C                                                                       STGEND    210
C                                                                       STGEND    211
      IF(ISAT.NE.0)THEN                                                 STGEND    212
        TDDAT(JTLN+1)=ASAT                                              STGEND    213
        TDDAT(JTLN+2)=BSAT                                              STGEND    214
        TDDAT(JTLN+3)=UL                                                STGEND    215
        TDDAT(JTLN+4)=UH                                                STGEND    216
        TDDAT(JTLN+5)=0.0                                               STGEND    217
        TDDAT(JTLN+6)=0.0                                               STGEND    218
        JTLN=JTLN+6                                                     STGEND    219
      ENDIF                                                             STGEND    220
C                                                                       STGEND    221
      TDDAT(JTLN1+1)=HM                                                 STGEND    222
      TDDAT(JTLN1+2)=DAMP                                               STGEND    223
      TDDAT(JTLN1+3)=0.0                                                STGEND    224
      TDDAT(JTLN1+4)=BASPR                                              STGEND    225
      TDDAT(JTLN1+5)=BASVR                                              STGEND    226
      TDDAT(JTLN1+6)=0.0                                                STGEND    227
C                                                                       STGEND    228
      CALL MCHECK (NLF,2,JTLN,'STGEND')                                 STGEND    229
      JGENDA(7,JNT)=0                                                   STGEND    230
      IF(LDEB)WRITE (IUD6,1130) JEXC,JTLN,JGENDA(3,JNT),JNT             STGEND    231
C                                                                       STGEND    232
      JGENDA(8,JNT)=0                                                   STGEND    233
C                                                                       STGEND    234
      IF(JEXC.EQ.0) GOTO 720                                            STGEND    235
      JTLN=JTLN+1                                                       STGEND    236
      JGENDA(3,JNT)=JTLN                                                STGEND    237
      ITDDAT(JTLN+1)=IVTN                                               STGEND    238
C                                                                       STGEND    239
      DO 215 LJ=2,25                                                    STGEND    240
        TDDAT(JTLN+LJ)=EXC(LJ-1)                                        STGEND    241
 215  CONTINUE                                                          STGEND    242
C                                                                       STGEND    243
      IF(JEXC.EQ.4.OR.JEXC.EQ.6.OR.JEXC.EQ.8)THEN                       STGEND    244
        TDDAT(JTLN+26)=EXC(25)                                          STGEND    245
        TDDAT(JTLN+27)=EXC(26)                                          STGEND    246
        IF(JEXC.EQ.4)THEN                                               STGEND    247
          TDDAT(JTLN+28)=EXC(27)                                        STGEND    248
          JTLN=JTLN+28                                                  STGEND    249
        ELSE                                                            STGEND    250
          JTLN=JTLN+27                                                  STGEND    251
        ENDIF                                                           STGEND    252
      ELSEIF(JEXC.EQ.5.OR.JEXC.EQ.3.OR.JEXC.EQ.14)THEN                  STGEND    253
        TDDAT(JTLN+26)=EXC(25)                                          STGEND    254
        TDDAT(JTLN+27)=EXC(26)                                          STGEND    255
        TDDAT(JTLN+28)=EXC(27)                                          STGEND    256
        TDDAT(JTLN+29)=EXC(28)                                          STGEND    257
        TDDAT(JTLN+30)=EXC(29)                                          STGEND    258
        TDDAT(JTLN+31)=EXC(30)                                          STGEND    259
        TDDAT(JTLN+32)=EXC(31)                                          STGEND    260
        TDDAT(JTLN+33)=EXC(32)                                          STGEND    261
        JTLN=JTLN+33                                                    STGEND    262
      ELSEIF(JEXC.EQ.30)THEN                                            STGEND    263
        TDDAT(JTLN+26)=EXC(25)                                          STGEND    264
        TDDAT(JTLN+27)=EXC(26)                                          STGEND    265
        TDDAT(JTLN+28)=EXC(27)                                          STGEND    266
        TDDAT(JTLN+29)=EXC(28)                                          STGEND    267
        JTLN=JTLN+29                                                    STGEND    268
      ELSEIF(JEXC.EQ.32)THEN                                            STGEND    269
        TDDAT(JTLN+26)=EXC(25)                                          STGEND    270
        TDDAT(JTLN+27)=EXC(26)                                          STGEND    271
        TDDAT(JTLN+28)=EXC(27)                                          STGEND    272
        TDDAT(JTLN+29)=EXC(28)                                          STGEND    273
        TDDAT(JTLN+30)=EXC(29)                                          STGEND    274
        TDDAT(JTLN+31)=EXC(30)                                          STGEND    275
        TDDAT(JTLN+32)=EXC(31)                                          STGEND    276
        TDDAT(JTLN+33)=EXC(32)                                          STGEND    277
        TDDAT(JTLN+34)=EXC(33)                                          STGEND    278
        TDDAT(JTLN+35)=EXC(34)                                          STGEND    279
        JTLN=JTLN+35                                                    STGEND    280
      ELSE                                                              STGEND    281
        JTLN=JTLN+25                                                    STGEND    282
      ENDIF                                                             STGEND    283
C                                                                       STGEND    284
      CALL MCHECK (NLF,3,JTLN,'STGEND')                                 STGEND    285
C                                                                       STGEND    286
C--  STORE STABILIZER DATA IF THERE IS ANY                              STGEND    287
C                                                                       STGEND    288
      IF(JSTAB.EQ.0) GOTO 540                                           STGEND    289
C                                                                       STGEND    290
      JGENDA(4,JNT)=JTLN                                                STGEND    291
C                                                                       STGEND    292
C     STORE THE STABILIZER DATA                                         STGEND    293
C                                                                       STGEND    294
C            1   2   3   4   5   6   7   8   9  10  11  12              STGEND    295
      GOTO(230,250,250,230,250,250,350,530,390,410,430,450),JSTAB       STGEND    296
C                                                                       STGEND    297
C                                                                       STGEND    298
C   TYPE 1 AND 4 STABILIZER                                             STGEND    299
C                                                                       STGEND    300
 230  CONTINUE                                                          STGEND    301
      ASSIGN 240 TO I470                                                STGEND    302
      GOTO 470                                                          STGEND    303
 240  CONTINUE                                                          STGEND    304
      DO 245 LJ=3,14                                                    STGEND    305
 245  TDDAT(JTLN+LJ)=EXS(LJ-2)                                          STGEND    306
      JTLN=JTLN+14                                                      STGEND    307
      GOTO 530                                                          STGEND    308
C                                                                       STGEND    309
C   TYPE 2,3,5 AND 6 STABILIZER                                         STGEND    310
C                                                                       STGEND    311
 250  CONTINUE                                                          STGEND    312
      ASSIGN 260 TO I470                                                STGEND    313
      GOTO 470                                                          STGEND    314
 260  CONTINUE                                                          STGEND    315
      DO 265 LJ=3,22                                                    STGEND    316
 265  TDDAT(JTLN+LJ)=EXS(LJ-2)                                          STGEND    317
      JTLN=JTLN+22                                                      STGEND    318
      GOTO 530                                                          STGEND    319
C                                                                       STGEND    320
C   TYPE 7 STABILIZER                                                   STGEND    321
C                                                                       STGEND    322
 350  CONTINUE                                                          STGEND    323
      ITDDAT(JTLN+1)=0                                                  STGEND    324
      DO 355 LJ=2,8                                                     STGEND    325
 355  TDDAT(JTLN+LJ)=EXS(LJ-2)                                          STGEND    326
      JTLN=JTLN+8                                                       STGEND    327
      GOTO 530                                                          STGEND    328
C                                                                       STGEND    329
C                                                                       STGEND    330
C     TYPES 9 STABILIZER                                                STGEND    331
C                                                                       STGEND    332
 390  CONTINUE                                                          STGEND    333
      IF(IRMBU1.EQ.0)IRMBU1=NLF                                         STGEND    334
      ITDDAT(JTLN+1)=IRMBU1                                             STGEND    335
      ITDDAT(JTLN+2)=IOHTYP                                             STGEND    336
      ITDDAT(JTLN+3)=IN                                                 STGEND    337
      ITDDAT(JTLN+4)=IM                                                 STGEND    338
      ITDDAT(JTLN+5)=0                                                  STGEND    339
      ITDDAT(JTLN+6)=0                                                  STGEND    340
C                                                                       STGEND    341
      DO 395 LJ=7,27                                                    STGEND    342
 395  TDDAT(JTLN+LJ)=EXS(LJ-6)                                          STGEND    343
      JTLN=JTLN+27                                                      STGEND    344
      GOTO 530                                                          STGEND    345
C                                                                       STGEND    346
C   TYPE 10 STABILIZER                                                  STGEND    347
C                                                                       STGEND    348
 410  CONTINUE                                                          STGEND    349
      ASSIGN 420 TO I470                                                STGEND    350
      GOTO 470                                                          STGEND    351
 420  CONTINUE                                                          STGEND    352
      DO 425 LJ=3,20                                                    STGEND    353
 425  TDDAT(JTLN+LJ)=EXS(LJ-2)                                          STGEND    354
      JTLN=JTLN+20                                                      STGEND    355
      GOTO 530                                                          STGEND    356
C                                                                       STGEND    357
C   TYPE 11 STABILIZER                                                  STGEND    358
C                                                                       STGEND    359
 430  CONTINUE                                                          STGEND    360
      ASSIGN 440 TO I470                                                STGEND    361
      GOTO 470                                                          STGEND    362
 440  CONTINUE                                                          STGEND    363
      DO 445 LJ=3,30                                                    STGEND    364
 445  TDDAT(JTLN+LJ)=EXS(LJ-2)                                          STGEND    365
      JTLN=JTLN+30                                                      STGEND    366
      GOTO 530                                                          STGEND    367
C                                                                       STGEND    368
C   TYPE 12 STABILIZER                                                  STGEND    369
C                                                                       STGEND    370
 450  CONTINUE                                                          STGEND    371
      IF(IRMBUS.EQ.0)IRMBUS=NLF                                         STGEND    372
      IF(IRMBU1.EQ.0)IRMBU1=NLF                                         STGEND    373
      ITDDAT(JTLN+1)=IRMBUS                                             STGEND    374
      ITDDAT(JTLN+2)=IOHTYP                                             STGEND    375
      ITDDAT(JTLN+3)=IRMBU1                                             STGEND    376
      ITDDAT(JTLN+4)=IOHTY1                                             STGEND    377
      DO 455 LJ=5,24                                                    STGEND    378
 455  TDDAT(JTLN+LJ)=EXS(LJ-4)                                          STGEND    379
      JTLN=JTLN+24                                                      STGEND    380
      GOTO 530                                                          STGEND    381
C                                                                       STGEND    382
C   COMMON PART OF DATA FOR STABILIZER                                  STGEND    383
C   TYPES 1,2,3,4,5,6,10 AND 11                                         STGEND    384
C                                                                       STGEND    385
 470  CONTINUE                                                          STGEND    386
      IF(IRMBUS.EQ.0)IRMBUS=NLF                                         STGEND    387
      ITDDAT(JTLN+1)=IRMBUS                                             STGEND    388
      ITDDAT(JTLN+2)=IOHTYP                                             STGEND    389
      GOTO I470                                                         STGEND    390
C                                                                       STGEND    391
  530 CONTINUE                                                          STGEND    392
      CALL MCHECK (NLF,4,JTLN,'STGEND')                                 STGEND    393
C                                                                       STGEND    394
C--  STORE TORSIONAL FILTER DATA IF THERE IS ANY                        STGEND    395
C                                                                       STGEND    396
      IF(JFLTN.EQ.0) GOTO 540                                           STGEND    397
      JGENDA(5,JNT)=JTLN                                                STGEND    398
      DO 535 LJ=1,8                                                     STGEND    399
 535  TDDAT(JTLN+LJ)=EXF(LJ)                                            STGEND    400
      JTLN=JTLN+8                                                       STGEND    401
      CALL MCHECK (NLF,5,JTLN,'STGEND')                                 STGEND    402
C                                                                       STGEND    403
C--  STORE TRANSIENT EXCITATION BOOSTER DATA IF THERE IS ANY            STGEND    404
C                                                                       STGEND    405
  540 IF(JTEB.EQ.0)GOTO 720                                             STGEND    406
C                                                                       STGEND    407
      JGENDA(10,JNT)=JTLN                                               STGEND    408
      DO 545 LJ=2,5                                                     STGEND    409
        TDDAT(JTLN+LJ)=EXB(LJ-1)                                        STGEND    410
 545  CONTINUE                                                          STGEND    411
      JTLN=JTLN+5                                                       STGEND    412
C                                                                       STGEND    413
  720 CONTINUE                                                          STGEND    414
      IGENDA(2,JNT)=JGOV                                                STGEND    415
      JGENDA(2,JNT)=0                                                   STGEND    416
      IF(JGOV.EQ.0) GOTO 900                                            STGEND    417
      JNTTL=JNT                                                         STGEND    418
      JTLN=JTLN+1                                                       STGEND    419
      JGENDA(2,JNT)=JTLN                                                STGEND    420
C                                                                       STGEND    421
C   TYPE :    1   2   3   4   5   6   7   8   9  10  11  12  13  14  15 STGEND    422
C                                                                       STGEND    423
      GOTO (830,830,810,740,750,760,770,780,810,810,810,810,810,810,810 STGEND    424
C            16  17  18  19  20  21  22                                 STGEND    425
     +     ,810,810,810,810,790,800,800), JGOV                          STGEND    426
C                                                                       STGEND    427
C  TYPE 4                                                               STGEND    428
C                                                                       STGEND    429
 740  CONTINUE                                                          STGEND    430
      DO 745 LK=1,16                                                    STGEND    431
 745  TDDAT(JTLN+LK)=EXG(LK)                                            STGEND    432
      IF(IGEN.GE.4.AND.IGEN.LE.7)THEN                                   STGEND    433
        ITDDAT(JTLN+17)=IEXG(1)                                         STGEND    434
        ITDDAT(JTLN+18)=IEXG(2)                                         STGEND    435
        ITDDAT(JTLN)=18                                                 STGEND    436
        JTLN=JTLN+18                                                    STGEND    437
      ELSE                                                              STGEND    438
        ITDDAT(JTLN)=16                                                 STGEND    439
        JTLN=JTLN+16                                                    STGEND    440
      ENDIF                                                             STGEND    441
      CALL MCHECK (NLF,6,JTLN,'STGEND')                                 STGEND    442
      GOTO 830                                                          STGEND    443
C                                                                       STGEND    444
C  TYPE 5                                                               STGEND    445
C                                                                       STGEND    446
 750  DO 755 LK=1,3                                                     STGEND    447
 755  TDDAT(JTLN+LK)=EXG(LK+16)                                         STGEND    448
      ITDDAT(JTLN)=4                                                    STGEND    449
      JTLN=JTLN+4                                                       STGEND    450
      CALL MCHECK (NLF,7,JTLN,'STGEND')                                 STGEND    451
      GOTO 830                                                          STGEND    452
C                                                                       STGEND    453
C  TYPE 6                                                               STGEND    454
C                                                                       STGEND    455
 760  CONTINUE                                                          STGEND    456
      DO 765 LK=1,7                                                     STGEND    457
 765  TDDAT(JTLN+LK)=EXG(LK)                                            STGEND    458
      ITDDAT(JTLN)=7                                                    STGEND    459
      JTLN=JTLN+7                                                       STGEND    460
      CALL MCHECK (NLF,8,JTLN,'STGEND')                                 STGEND    461
      GOTO 830                                                          STGEND    462
C                                                                       STGEND    463
C  TYPE 7                                                               STGEND    464
C                                                                       STGEND    465
 770  CONTINUE                                                          STGEND    466
      DO 775 LK=1,10                                                    STGEND    467
 775  TDDAT(JTLN+LK)=EXG(LK)                                            STGEND    468
      ITDDAT(JTLN)=10                                                   STGEND    469
      JTLN=JTLN+10                                                      STGEND    470
      CALL MCHECK (NLF,9,JTLN,'STGEND')                                 STGEND    471
      GOTO 830                                                          STGEND    472
C                                                                       STGEND    473
C  TYPE 8                                                               STGEND    474
C                                                                       STGEND    475
 780  CONTINUE                                                          STGEND    476
      DO 785 LK=1,9                                                     STGEND    477
 785  TDDAT(JTLN+LK)=EXG(LK)                                            STGEND    478
      ITDDAT(JTLN)=9                                                    STGEND    479
      JTLN=JTLN+9                                                       STGEND    480
      CALL MCHECK (NLF,10,JTLN,'STGEND')                                STGEND    481
      GOTO 830                                                          STGEND    482
C                                                                       STGEND    483
C  TYPE 20                                                              STGEND    484
C                                                                       STGEND    485
 790  CONTINUE                                                          STGEND    486
      DO 795 LK=1,14                                                    STGEND    487
 795  TDDAT(JTLN+LK)=EXG(LK)                                            STGEND    488
      TDDAT(JTLN+15)=EXG(16)                                            STGEND    489
      ITDDAT(JTLN)=15                                                   STGEND    490
      JTLN=JTLN+15                                                      STGEND    491
      CALL MCHECK (NLF,11,JTLN,'TSOCVD')                                STGEND    492
      GOTO 830                                                          STGEND    493
C                                                                       STGEND    494
C  TYPE 21, 22                                                          STGEND    495
C                                                                       STGEND    496
 800  CONTINUE                                                          STGEND    497
      DO 805 LK=1,11                                                    STGEND    498
 805  TDDAT(JTLN+LK)=EXG(LK)                                            STGEND    499
      ITDDAT(JTLN)=11                                                   STGEND    500
      JTLN=JTLN+11                                                      STGEND    501
      CALL MCHECK (NLF,12,JTLN,'STGEND')                                STGEND    502
      GOTO 830                                                          STGEND    503
C                                                                       STGEND    504
C  TYPES WHICH HAVE NOT BEEN DEFINED                                    STGEND    505
C                                                                       STGEND    506
  810 CONTINUE                                                          STGEND    507
C                                                                       STGEND    508
      WRITE (MSG(1),1100) NLF,BUSNAM,NGRI                               STGEND    509
      WRITE(MSG(2),1101) JGOV                                           STGEND    510
      CALL PRTMSG(2)                                                    STGEND    511
      SIMBUF='STGEND: GOVERNOR TYPE ERROR'                              STGEND    512
      CALL ASTOP(SIMBUF,27)                                             STGEND    513
  830 CONTINUE                                                          STGEND    514
C                                                                       STGEND    515
C     NOTE: IEBK=2 FOR GENERATOR NOT FOUND IN BASE LOADFLOW.            STGEND    516
C           AN INTERACTIVE LOGIC CAN BE IMPLEMENTED HERE TO             STGEND    517
C           PROMPT USER HOW TO HANDLE THE SITUATION.                    STGEND    518
C           CURRENTLY, THE GENERATOR IS IGNORED.                        STGEND    519
C                                                                       STGEND    520
 900  IF(IEBK.EQ.2) IEBK=0                                              STGEND    521
C                                                                       STGEND    522
      IF(IEBK1.NE.0)THEN                                                STGEND    523
        MSG(1)='  ERRORS ENCOUNTERED WHILE READING GENERATOR DATA.'     STGEND    524
        MSG(2)='  PLEASE RECTIFY THE ERRORS USING ACTIVITY MODIFY.'     STGEND    525
        MSG(3)='  OTHERWISE, LOADING OF GENERATOR DATA WILL FAIL.'      STGEND    526
        CALL PRTMSG(3)                                                  STGEND    527
      ENDIF                                                             STGEND    528
C                                                                       STGEND    529
      RETURN                                                            STGEND    530
C                                                                       STGEND    531
C                                                                       STGEND    532
 1100 FORMAT(' *** ERROR IN PRIME MOVER DATA FOR GEN AT BUS: ',I5       STGEND    533
     &,1X,A12,' GID: ',A4)                                              STGEND    534
 1101 FORMAT(11X,'GOVERNOR TYPE=',I2,2X,'NOT RECOGNIZED')               STGEND    535
 1130 FORMAT (1X,'IN       ',1X,'JEXC',I5                               STGEND    536
     &,'JTLN',I5,'JEX(JNT)',I5,'JNT',I5)                                STGEND    537
 1230 FORMAT(' *** WARNING GENERATOR BUS',I6,1X,A12,                    STGEND    538
     &' (GID',A4,')')                                                   STGEND    539
 1231 FORMAT(5X,'IS NOT IN THE BASE LOADFLOW. THE GENERATOR IS'         STGEND    540
     *,' IGNORED.')                                                     STGEND    541
 1240 FORMAT(' *** WARNING FOR GENERATOR',I6,1X,A12,' (GID',A4,')')     STGEND    542
 1241 FORMAT(5X,'BUS TYPE = 1 IN THE BASE LOADFLOW. ',                  STGEND    543
     +          'THE GENERATOR IS IGNORED.')                            STGEND    544
 6000 FORMAT (' *** ERROR - NUMBER OF GENERATORS EXCEEDS ',I5)          STGEND    545
 6100 FORMAT ('     AT GENERATOR ON BUS ',I6,1X,A12, 'GID: ',A4)        STGEND    546
      END                                                               STGEND    547
