CFPRIME ISTA10                                                          ISTA10      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 ISTA10(ISMAX,ISMIN)                                    ISTA10      3
CD                                                                      ISTA10      4
CD    TO PERFORM INITIALIZATION AND DATA CHECK FOR STABILIZER TYPES     ISTA10      5
CD    10 AND 11                                                         ISTA10      6
CD                                                                      ISTA10      7
CD    THE DATA STRUCTURE AFTER THE INITIALIZATION IS GIVEN BELOW.       ISTA10      8
CD                                                                      ISTA10      9
CD   4.9 Stabilizer type 10                                             ISTA10     10
CD                                                                      ISTA10     11
CD     Stabilizer data                                                  ISTA10     12
CD                                                                      ISTA10     13
CD     IDDAT(JS+ 1)   = BUSR         : sensing bus number               ISTA10     14
CD     IDDAT(JS +2)   = TYPE         : type of input signal:            ISTA10     15
CD                                     = 1 rotor speed                  ISTA10     16
CD                                     = 2 acceleration power           ISTA10     17
CD                                     = 3 bus frequency                ISTA10     18
CD                                     = 4 electrical power             ISTA10     19
CD                                     = 5 bus voltage magnitude        ISTA10     20
CD                                     = 6 voltage deviation from steadyISTA10     21
CD                                        state value                   ISTA10     22
CD     DDAT(JS+ 3)    = KQS                                             ISTA10     23
CD     DDAT(JS+ 4)    = TQS                                             ISTA10     24
CD     DDAT(JS+ 5)    = KQV                                             ISTA10     25
CD     DDAT(JS+ 6)    = TQV                                             ISTA10     26
CD     DDAT(JS+ 7)    = TQ                                              ISTA10     27
CD     DDAT(JS+ 8)    = T'Q1                                            ISTA10     28
CD     DDAT(JS+ 9)    = TQ1                                             ISTA10     29
CD     DDAT(JS+10)    = T'Q2                                            ISTA10     30
CD     DDAT(JS+11)    = TQ2                                             ISTA10     31
CD     DDAT(JS+12)    = T'Q3                                            ISTA10     32
CD     DDAT(JS+13)    = TQ3                                             ISTA10     33
CD     DDAT(JS+14)    = VSMAX                                           ISTA10     34
CD     DDAT(JS+15)    = VSMIN                                           ISTA10     35
CD     DDAT(JS+16)    = VC                                              ISTA10     36
CD     DDAT(JS+17)    = TF                                              ISTA10     37
CD     DDAT(JS+18)    = RC                                              ISTA10     38
CD     DDAT(JS+19)    = XC                                              ISTA10     39
CD     DDAT(JS+20)    = PTHR                                            ISTA10     40
CD                                                                      ISTA10     41
CD     Stabilizer states                                                ISTA10     42
CD                                                                      ISTA10     43
CD     XSTATE(JSS+1)  = TF block if input is bus frequency              ISTA10     44
CD                                                  : optional          ISTA10     45
CD     XSTATE(JSS+2)  = TQS block                   : optional          ISTA10     46
CD     XSTATE(JSS+3)  = TQV block                   : optional          ISTA10     47
CD     XSTATE(JSS+4)  = TQ block                    : compulsory        ISTA10     48
CD     XSTATE(JSS+5)  = TQ1 block                   : optional          ISTA10     49
CD     XSTATE(JSS+6)  = TQ2 block                   : optional          ISTA10     50
CD     XSTATE(JSS+7)  = TQ3 block                   : optional          ISTA10     51
CD                                                                      ISTA10     52
CD     Stabilizer Y-variables                                           ISTA10     53
CD                                                                      ISTA10     54
CD     VSS(JYS+1)     = stabilizer output                               ISTA10     55
CD     VTOS(JYS+2)    = V0 (magnitude of initial bus voltage)           ISTA10     56
CD                                                                      ISTA10     57
CD   4.10 Stabilizer type 11                                            ISTA10     58
CD                                                                      ISTA10     59
CD     Stabilizer data                                                  ISTA10     60
CD                                                                      ISTA10     61
CD     IDDAT(JS+ 1)   = BUSR         : sensing bus number               ISTA10     62
CD     IDDAT(JS+ 2)   = TYPE         : type of input signal:            ISTA10     63
CD                                     = 1 rotor speed                  ISTA10     64
CD                                     = 2 acceleration power           ISTA10     65
CD                                     = 3 bus frequency                ISTA10     66
CD                                     = 4 electrical power             ISTA10     67
CD                                     = 5 bus voltage magnitude        ISTA10     68
CD                                     = 6 voltage deviation from steadyISTA10     69
CD                                        state value                   ISTA10     70
CD     DDAT(JS+ 3)    = KQS                                             ISTA10     71
CD     DDAT(JS+ 4)    = TQS                                             ISTA10     72
CD     DDAT(JS+ 5)    = KQV                                             ISTA10     73
CD     DDAT(JS+ 6)    = TQV                                             ISTA10     74
CD     DDAT(JS+ 7)    = TQ                                              ISTA10     75
CD     DDAT(JS+ 8)    = T'Q1                                            ISTA10     76
CD     DDAT(JS+ 9)    = TQ1                                             ISTA10     77
CD     DDAT(JS+10)    = T'Q2                                            ISTA10     78
CD     DDAT(JS+11)    = TQ2                                             ISTA10     79
CD     DDAT(JS+12)    = T'Q3                                            ISTA10     80
CD     DDAT(JS+13)    = TQ3                                             ISTA10     81
CD     DDAT(JS+14)    = VSMAX                                           ISTA10     82
CD     DDAT(JS+15)    = VSMIN                                           ISTA10     83
CD     DDAT(JS+16)    = VC                                              ISTA10     84
CD     DDAT(JS+17)    = K'QS                                            ISTA10     85
CD     DDAT(JS+18)    = K                                               ISTA10     86
CD     DDAT(JS+19)    = T1                                              ISTA10     87
CD     DDAT(JS+20)    = T2                                              ISTA10     88
CD     DDAT(JS+21)    = T3                                              ISTA10     89
CD     DDAT(JS+22)    = T4                                              ISTA10     90
CD     DDAT(JS+23)    = DW1                                             ISTA10     91
CD     DDAT(JS+24)    = DW2                                             ISTA10     92
CD     DDAT(JS+25)    = WDOT                                            ISTA10     93
CD     DDAT(JS+26)    = TF                                              ISTA10     94
CD     DDAT(JS+27)    = RC                                              ISTA10     95
CD     DDAT(JS+28)    = XC                                              ISTA10     96
CD     DDAT(JS+29)    = TDELAY                                          ISTA10     97
CD     DDAT(JS+30)    = PTHR                                            ISTA10     98
CD     DDAT(JS+31)    = for internal use, refer to block diagram and    ISTA10     99
CD                      phase-plane diagram for meaning                 ISTA10    100
CD     DDAT(JS+32)    = for internal use                                ISTA10    101
CD                      status of switch S1 = 0 opened                  ISTA10    102
CD                                        = 1 closed                    ISTA10    103
CD     DDAT(JS+33)    = for internal use                                ISTA10    104
CD                      time counter : for signal U continuously greaterISTA10    105
CD                                   than or equal to zero              ISTA10    106
CD                                                                      ISTA10    107
CD     Stabilizer states                                                ISTA10    108
CD                                                                      ISTA10    109
CD     XSTATE(JSS+1)  = TF block if input is bus frequency              ISTA10    110
CD                                                  : optional          ISTA10    111
CD     XSTATE(JSS+2)  = TQS block                   : optional          ISTA10    112
CD     XSTATE(JSS+3)  = TQV block                   : optional          ISTA10    113
CD     XSTATE(JSS+4)  = T1 block                    : optional          ISTA10    114
CD     XSTATE(JSS+5)  = T2 block                    : optional          ISTA10    115
CD     XSTATE(JSS+6)  = T3 block                    : optional          ISTA10    116
CD     XSTATE(JSS+7)  = T4 block                    : optional          ISTA10    117
CD     XSTATE(JSS+8)  = TQ block                    : compulsory        ISTA10    118
CD     XSTATE(JSS+9)  = TQ1 block                   : optional          ISTA10    119
CD     XSTATE(JSS+10) = TQ2 block                   : optional          ISTA10    120
CD     XSTATE(JSS+11) = TQ3 block                   : optional          ISTA10    121
CD                                                                      ISTA10    122
CD     Stabilizer Y-variables                                           ISTA10    123
CD                                                                      ISTA10    124
CD     VSS(JYS+1)     = stabilizer output                               ISTA10    125
CD                                                                      ISTA10    126
      INCLUDE 'PARX.INS'                                                ISTA10    127
      INCLUDE 'CNMDAT.INS'                                              ISTA10    128
      INCLUDE 'CNB1.INS'                                                ISTA10    129
      INCLUDE 'CNB4.INS'                                                ISTA10    130
      INCLUDE 'CNSTN.INS'                                               ISTA10    131
      INCLUDE 'CNEXC.INS'                                               ISTA10    132
      INCLUDE 'CNYVAR.INS'                                              ISTA10    133
      INCLUDE 'CNXSTA.INS'                                              ISTA10    134
      INCLUDE 'CNIMPR.INS'                                              ISTA10    135
      INCLUDE 'CNUNIT.INS'                                              ISTA10    136
      INCLUDE 'CNMSG.INS'                                               ISTA10    137
C                                                                       ISTA10    138
      DATA BIG/99.9/                                                    ISTA10    139
C                                                                       ISTA10    140
C    ISTABN = 10                                                        ISTA10    141
C                                                                       ISTA10    142
      IF (IDDAT(JS+2).EQ.0) IDDAT(JS+2)=1                               ISTA10    143
C                                                                       ISTA10    144
C  INPUT TIME CONSTANTS CHECK AND RESET                                 ISTA10    145
C                                                                       ISTA10    146
      IF(DDAT(JS+4).LT.TMIN.AND.IDDAT(JS+4).NE.0)THEN                   ISTA10    147
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       ISTA10    148
     *                     ,NDGC(N)                                     ISTA10    149
         IF(ISTABN.EQ.11)THEN                                           ISTA10    150
            WRITE(MSG(2),9020) 'TQS',DDAT(JS+4),TMIN                    ISTA10    151
            IF(MTFLAG.EQ.0) THEN                                        ISTA10    152
               CALL PRTMSG(2)                                           ISTA10    153
            ELSE                                                        ISTA10    154
               WRITE(MSG(3),9030) 'TQS',0.0                             ISTA10    155
               CALL PRTMSG(3)                                           ISTA10    156
               DDAT(JS+4)=0.0                                           ISTA10    157
            ENDIF                                                       ISTA10    158
         ELSE                                                           ISTA10    159
            WRITE(MSG(2),9021) 'TQS',DDAT(JS+4)                         ISTA10    160
            IF(MTFLAG.EQ.0) THEN                                        ISTA10    161
               WRITE(MSG(3),9031) TMIN                                  ISTA10    162
            ELSE                                                        ISTA10    163
               WRITE(MSG(3),9031) TMIN,'TQS',0.0                        ISTA10    164
               DDAT(JS+4)=0.0                                           ISTA10    165
            ENDIF                                                       ISTA10    166
            CALL PRTMSG(3)                                              ISTA10    167
         ENDIF                                                          ISTA10    168
      ENDIF                                                             ISTA10    169
C                                                                       ISTA10    170
      IF(DDAT(JS+6).LT.TMIN.AND.IDDAT(JS+6).NE.0)THEN                   ISTA10    171
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       ISTA10    172
     *                     ,NDGC(N)                                     ISTA10    173
         IF(ISTABN.EQ.11)THEN                                           ISTA10    174
            WRITE(MSG(2),9020) 'TQV',DDAT(JS+6),TMIN                    ISTA10    175
            IF(MTFLAG.EQ.0) THEN                                        ISTA10    176
               CALL PRTMSG(2)                                           ISTA10    177
            ELSE                                                        ISTA10    178
               WRITE(MSG(3),9030) 'TQV',0.0                             ISTA10    179
               CALL PRTMSG(3)                                           ISTA10    180
               DDAT(JS+6)=0.0                                           ISTA10    181
            ENDIF                                                       ISTA10    182
         ELSE                                                           ISTA10    183
            WRITE(MSG(2),9021) 'TQV',DDAT(JS+6)                         ISTA10    184
            IF(MTFLAG.EQ.0) THEN                                        ISTA10    185
               WRITE(MSG(3),9031) TMIN                                  ISTA10    186
            ELSE                                                        ISTA10    187
               WRITE(MSG(3),9031) TMIN,'TQV',0.0                        ISTA10    188
               DDAT(JS+6)=0.0                                           ISTA10    189
            ENDIF                                                       ISTA10    190
            CALL PRTMSG(3)                                              ISTA10    191
         ENDIF                                                          ISTA10    192
      ENDIF                                                             ISTA10    193
C                                                                       ISTA10    194
      IF(DDAT(JS+7).LT.TMIN)THEN                                        ISTA10    195
         WRITE(MSG(1),9040) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       ISTA10    196
     *                     ,NDGC(N)                                     ISTA10    197
         IF(ISTABN.EQ.11)THEN                                           ISTA10    198
            WRITE(MSG(2),9020) 'TQ',DDAT(JS+7),TMIN                     ISTA10    199
            CALL PRTMSG(2)                                              ISTA10    200
         ELSE                                                           ISTA10    201
            WRITE(MSG(2),9021) 'TQ',DDAT(JS+7)                          ISTA10    202
            WRITE(MSG(3),9031) TMIN                                     ISTA10    203
            CALL PRTMSG(3)                                              ISTA10    204
         ENDIF                                                          ISTA10    205
         MSG(1)='STABILIZER DATA ERROR'                                 ISTA10    206
         CALL ASTOP(MSG(1),21)                                          ISTA10    207
      ENDIF                                                             ISTA10    208
C                                                                       ISTA10    209
      IF(DDAT(JS+9).LT.TMIN.AND.IDDAT(JS+9).NE.0)THEN                   ISTA10    210
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       ISTA10    211
     *                     ,NDGC(N)                                     ISTA10    212
         IF(ISTABN.EQ.11)THEN                                           ISTA10    213
            WRITE(MSG(2),9020) 'TQ1',DDAT(JS+9),TMIN                    ISTA10    214
            IF(MTFLAG.EQ.0) THEN                                        ISTA10    215
               CALL PRTMSG(2)                                           ISTA10    216
            ELSE                                                        ISTA10    217
               WRITE(MSG(3),9030) 'TQ1',0.0                             ISTA10    218
               CALL PRTMSG(3)                                           ISTA10    219
               DDAT(JS+9)=0.0                                           ISTA10    220
            ENDIF                                                       ISTA10    221
         ELSE                                                           ISTA10    222
            WRITE(MSG(2),9021) 'TQ1',DDAT(JS+9)                         ISTA10    223
            IF(MTFLAG.EQ.0) THEN                                        ISTA10    224
               WRITE(MSG(3),9031) TMIN                                  ISTA10    225
            ELSE                                                        ISTA10    226
               WRITE(MSG(3),9031) TMIN,'TQ1',0.0                        ISTA10    227
               DDAT(JS+9)=0.0                                           ISTA10    228
            ENDIF                                                       ISTA10    229
            CALL PRTMSG(3)                                              ISTA10    230
         ENDIF                                                          ISTA10    231
      ENDIF                                                             ISTA10    232
C                                                                       ISTA10    233
      IF(DDAT(JS+11).LT.TMIN.AND.IDDAT(JS+11).NE.0)THEN                 ISTA10    234
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       ISTA10    235
     *                     ,NDGC(N)                                     ISTA10    236
         IF(ISTABN.EQ.11)THEN                                           ISTA10    237
            WRITE(MSG(2),9020) 'TQ2',DDAT(JS+11),TMIN                   ISTA10    238
            IF(MTFLAG.EQ.0) THEN                                        ISTA10    239
               CALL PRTMSG(2)                                           ISTA10    240
            ELSE                                                        ISTA10    241
               WRITE(MSG(3),9030) 'TQ2',0.0                             ISTA10    242
               CALL PRTMSG(3)                                           ISTA10    243
               DDAT(JS+11)=0.0                                          ISTA10    244
            ENDIF                                                       ISTA10    245
         ELSE                                                           ISTA10    246
            WRITE(MSG(2),9021) 'TQ2',DDAT(JS+11)                        ISTA10    247
            IF(MTFLAG.EQ.0) THEN                                        ISTA10    248
               WRITE(MSG(3),9031) TMIN                                  ISTA10    249
            ELSE                                                        ISTA10    250
               WRITE(MSG(3),9031) TMIN,'TQ2',0.0                        ISTA10    251
               DDAT(JS+11)=0.0                                          ISTA10    252
            ENDIF                                                       ISTA10    253
            CALL PRTMSG(3)                                              ISTA10    254
         ENDIF                                                          ISTA10    255
      ENDIF                                                             ISTA10    256
C                                                                       ISTA10    257
      IF(DDAT(JS+13).LT.TMIN.AND.IDDAT(JS+13).NE.0)THEN                 ISTA10    258
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       ISTA10    259
     *                     ,NDGC(N)                                     ISTA10    260
         IF(ISTABN.EQ.11)THEN                                           ISTA10    261
            WRITE(MSG(2),9020) 'TQ3',DDAT(JS+13),TMIN                   ISTA10    262
            IF(MTFLAG.EQ.0) THEN                                        ISTA10    263
               CALL PRTMSG(2)                                           ISTA10    264
            ELSE                                                        ISTA10    265
               WRITE(MSG(3),9030) 'TQ3',0.0                             ISTA10    266
               CALL PRTMSG(3)                                           ISTA10    267
               DDAT(JS+13)=0.0                                          ISTA10    268
            ENDIF                                                       ISTA10    269
         ELSE                                                           ISTA10    270
            WRITE(MSG(2),9021) 'TQ3',DDAT(JS+13)                        ISTA10    271
            IF(MTFLAG.EQ.0) THEN                                        ISTA10    272
               WRITE(MSG(3),9031) TMIN                                  ISTA10    273
            ELSE                                                        ISTA10    274
               WRITE(MSG(3),9031) TMIN,'TQ3',0.0                        ISTA10    275
               DDAT(JS+13)=0.0                                          ISTA10    276
            ENDIF                                                       ISTA10    277
            CALL PRTMSG(3)                                              ISTA10    278
         ENDIF                                                          ISTA10    279
      ENDIF                                                             ISTA10    280
C                                                                       ISTA10    281
      IF(ISTABN.EQ.11)THEN                                              ISTA10    282
         IF(DDAT(JS+19).LT.TMIN.AND.IDDAT(JS+19).NE.0)THEN              ISTA10    283
            WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)    ISTA10    284
     *                        ,NDGC(N)                                  ISTA10    285
            WRITE(MSG(2),9020) 'T1',DDAT(JS+19),TMIN                    ISTA10    286
            IF(MTFLAG.EQ.0) THEN                                        ISTA10    287
               CALL PRTMSG(2)                                           ISTA10    288
            ELSE                                                        ISTA10    289
               WRITE(MSG(3),9030) 'T1',0.0                              ISTA10    290
               CALL PRTMSG(3)                                           ISTA10    291
               DDAT(JS+19)=0.0                                          ISTA10    292
            ENDIF                                                       ISTA10    293
         ENDIF                                                          ISTA10    294
C                                                                       ISTA10    295
         IF(DDAT(JS+20).LT.TMIN)THEN                                    ISTA10    296
            WRITE(MSG(1),9040) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)    ISTA10    297
     *                        ,NDGC(N)                                  ISTA10    298
            WRITE(MSG(2),9020) 'T2',DDAT(JS+20),TMIN                    ISTA10    299
            CALL PRTMSG(2)                                              ISTA10    300
            MSG(1)='STABILIZER DATA ERROR'                              ISTA10    301
            CALL ASTOP(MSG(1),21)                                       ISTA10    302
         ENDIF                                                          ISTA10    303
C                                                                       ISTA10    304
         IF(DDAT(JS+21).LT.TMIN)THEN                                    ISTA10    305
            WRITE(MSG(1),9040) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)    ISTA10    306
     *                        ,NDGC(N)                                  ISTA10    307
            WRITE(MSG(2),9020) 'T3',DDAT(JS+21),TMIN                    ISTA10    308
            CALL PRTMSG(2)                                              ISTA10    309
            MSG(1)='STABILIZER DATA ERROR'                              ISTA10    310
            CALL ASTOP(MSG(1),21)                                       ISTA10    311
         ENDIF                                                          ISTA10    312
C                                                                       ISTA10    313
         IF(DDAT(JS+22).LT.TMIN.AND.IDDAT(JS+22).NE.0)THEN              ISTA10    314
            WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)    ISTA10    315
     *                        ,NDGC(N)                                  ISTA10    316
            WRITE(MSG(2),9020) 'T4',DDAT(JS+22),TMIN                    ISTA10    317
            IF(MTFLAG.EQ.0) THEN                                        ISTA10    318
               CALL PRTMSG(2)                                           ISTA10    319
            ELSE                                                        ISTA10    320
               WRITE(MSG(3),9030) 'T4',0.0                              ISTA10    321
               CALL PRTMSG(3)                                           ISTA10    322
               DDAT(JS+22)=0.0                                          ISTA10    323
            ENDIF                                                       ISTA10    324
         ENDIF                                                          ISTA10    325
C                                                                       ISTA10    326
      ENDIF                                                             ISTA10    327
C                                                                       ISTA10    328
C                                                                       ISTA10    329
C     DDAT(JS+21) THROUGH DDAT(JS+26) ARE USED TO STORE THE             ISTA10    330
C     SUBSCRIPTS OF OPTIONAL BLOCKS. IF ZERO, THE CORRESPONDING         ISTA10    331
C     BLOCK IS NOT PRESENT.                                             ISTA10    332
C                                                                       ISTA10    333
      IF (ISTABN.EQ.10) THEN                                            ISTA10    334
         IDDAT(JS+21)=0                                                 ISTA10    335
         IDDAT(JS+22)=0                                                 ISTA10    336
         IDDAT(JS+23)=0                                                 ISTA10    337
         IDDAT(JS+24)=0                                                 ISTA10    338
         IDDAT(JS+25)=0                                                 ISTA10    339
         IDDAT(JS+26)=0                                                 ISTA10    340
C                                                                       ISTA10    341
         VTOS(JYS+2)=ET                                                 ISTA10    342
C                                                                       ISTA10    343
         IF (IDDAT(JS+14).EQ.0.AND.IDDAT(JS+15).EQ.0) THEN              ISTA10    344
            DDAT(JS+14)=BIG                                             ISTA10    345
            DDAT(JS+15)=-BIG                                            ISTA10    346
         END IF                                                         ISTA10    347
         ISMAX=JS+14                                                    ISTA10    348
         ISMIN=JS+15                                                    ISTA10    349
C                                                                       ISTA10    350
         VSUM1=VSI1*DDAT(JS+3)                                          ISTA10    351
         VSUM2=0.0                                                      ISTA10    352
         VSUM=VSUM1-VSUM2                                               ISTA10    353
         IF (IDDAT(JS+4).NE.0) THEN                                     ISTA10    354
            KSTATE=KSTATE+1                                             ISTA10    355
            XSTATE(JSTATE+KSTATE)=VSUM1                                 ISTA10    356
            IDDAT(JS+21)=JSTATE+KSTATE-NSTATE                           ISTA10    357
         END IF                                                         ISTA10    358
         IF (IDDAT(JS+6).NE.0) THEN                                     ISTA10    359
            KSTATE=KSTATE+1                                             ISTA10    360
            XSTATE(JSTATE+KSTATE)=VSUM2                                 ISTA10    361
            IDDAT(JS+22)=JSTATE+KSTATE-NSTATE                           ISTA10    362
         END IF                                                         ISTA10    363
         IF (IDDAT(JS+7).NE.0) THEN                                     ISTA10    364
            KSTATE=KSTATE+1                                             ISTA10    365
            XSTATE(JSTATE+KSTATE)=VSUM                                  ISTA10    366
            IDDAT(JS+23)=JSTATE+KSTATE-NSTATE                           ISTA10    367
         END IF                                                         ISTA10    368
         IF (IDDAT(JS+9).NE.0) THEN                                     ISTA10    369
            KSTATE=KSTATE+1                                             ISTA10    370
            XSTATE(JSTATE+KSTATE)=0.0                                   ISTA10    371
            IDDAT(JS+24)=JSTATE+KSTATE-NSTATE                           ISTA10    372
         END IF                                                         ISTA10    373
         IF (IDDAT(JS+11).NE.0) THEN                                    ISTA10    374
            KSTATE=KSTATE+1                                             ISTA10    375
            XSTATE(JSTATE+KSTATE)=0.0                                   ISTA10    376
            IDDAT(JS+25)=JSTATE+KSTATE-NSTATE                           ISTA10    377
         END IF                                                         ISTA10    378
         IF (IDDAT(JS+13).NE.0) THEN                                    ISTA10    379
            KSTATE=KSTATE+1                                             ISTA10    380
            XSTATE(JSTATE+KSTATE)=0.0                                   ISTA10    381
            IDDAT(JS+26)=JSTATE+KSTATE-NSTATE                           ISTA10    382
         END IF                                                         ISTA10    383
C                                                                       ISTA10    384
C     IDDAT(JS+27) = 1 -- NORMAL CASE WITH OUTPUT SWITCH                ISTA10    385
C                         AT "ON" POSITION                              ISTA10    386
C     IDDAT(JS+27) = 0 -- CASE WITH OUTPUT SWITCH AT "OFF" POSITION     ISTA10    387
C                                                                       ISTA10    388
C     THIS FLAG IS USED ONLY IN IMPLICIT INTEGRATION METHOD             ISTA10    389
C                                                                       ISTA10    390
         IDDAT(JS+27)=1                                                 ISTA10    391
C                                                                       ISTA10    392
C    ISTABN = 11                                                        ISTA10    393
C                                                                       ISTA10    394
      ELSE IF(ISTABN.EQ.11) THEN                                        ISTA10    395
         IF (IDDAT(JS+14).EQ.0.AND.IDDAT(JS+15).EQ.0) THEN              ISTA10    396
            DDAT(JS+14)=BIG                                             ISTA10    397
            DDAT(JS+15)=-BIG                                            ISTA10    398
         END IF                                                         ISTA10    399
         ISMAX=JS+14                                                    ISTA10    400
         ISMIN=JS+15                                                    ISTA10    401
C                                                                       ISTA10    402
         DDAT(JS+31)=DDAT(JS+25)/(DDAT(JS+23)-DDAT(JS+24))              ISTA10    403
         IF (IDDAT(JS+18).NE.0) THEN                                    ISTA10    404
            IDDAT(JS+32)=0                                              ISTA10    405
            DDAT(JS+33)=0.0                                             ISTA10    406
         END IF                                                         ISTA10    407
C                                                                       ISTA10    408
         VSI1=VSI1*DDAT(JS+3)                                           ISTA10    409
         IF (IDDAT(JS+4).NE.0) THEN                                     ISTA10    410
            KSTATE=KSTATE+1                                             ISTA10    411
            XSTATE(JSTATE+KSTATE)=VSI1                                  ISTA10    412
         END IF                                                         ISTA10    413
         IF (IDDAT(JS+6).NE.0) THEN                                     ISTA10    414
            KSTATE=KSTATE+1                                             ISTA10    415
            XSTATE(JSTATE+KSTATE)=0.0                                   ISTA10    416
         END IF                                                         ISTA10    417
         IF (IDDAT(JS+19).NE.0) THEN                                    ISTA10    418
            KSTATE=KSTATE+1                                             ISTA10    419
            XSTATE(JSTATE+KSTATE)=0.0                                   ISTA10    420
         END IF                                                         ISTA10    421
         IF (IDDAT(JS+20).NE.0) THEN                                    ISTA10    422
            KSTATE=KSTATE+1                                             ISTA10    423
            XSTATE(JSTATE+KSTATE)=0.0                                   ISTA10    424
         END IF                                                         ISTA10    425
         IF (IDDAT(JS+21).NE.0) THEN                                    ISTA10    426
            KSTATE=KSTATE+1                                             ISTA10    427
            XSTATE(JSTATE+KSTATE)=VSI1                                  ISTA10    428
         END IF                                                         ISTA10    429
         IF (IDDAT(JS+22).NE.0) THEN                                    ISTA10    430
            KSTATE=KSTATE+1                                             ISTA10    431
            XSTATE(JSTATE+KSTATE)=0.0                                   ISTA10    432
         END IF                                                         ISTA10    433
         IF (IDDAT(JS+7).NE.0) THEN                                     ISTA10    434
            KSTATE=KSTATE+1                                             ISTA10    435
            XSTATE(JSTATE+KSTATE)=VSI1*DDAT(JS+17)                      ISTA10    436
         END IF                                                         ISTA10    437
         IF (IDDAT(JS+9).NE.0) THEN                                     ISTA10    438
            KSTATE=KSTATE+1                                             ISTA10    439
            XSTATE(JSTATE+KSTATE)=0.0                                   ISTA10    440
         END IF                                                         ISTA10    441
         IF (IDDAT(JS+11).NE.0) THEN                                    ISTA10    442
            KSTATE=KSTATE+1                                             ISTA10    443
            XSTATE(JSTATE+KSTATE)=0.0                                   ISTA10    444
         END IF                                                         ISTA10    445
         IF (IDDAT(JS+13).NE.0) THEN                                    ISTA10    446
            KSTATE=KSTATE+1                                             ISTA10    447
            XSTATE(JSTATE+KSTATE)=0.0                                   ISTA10    448
         END IF                                                         ISTA10    449
C                                                                       ISTA10    450
      END IF                                                            ISTA10    451
C                                                                       ISTA10    452
        IF (DDAT(JS+14).LT.0.0.OR.DDAT(JS+15).GT.0.0) THEN              ISTA10    453
         WRITE(MSG(1),9000) NLF,INAME(KN-2),INAME(KN-1),INAME(KN)       ISTA10    454
     *                     ,NDGC(N)                                     ISTA10    455
         IF(ISTABN.EQ.10)THEN                                           ISTA10    456
            WRITE(MSG(2),9050) ISTABN                                   ISTA10    457
            WRITE(MSG(2),9060) DDAT(JS+14),DDAT(JS+15)                  ISTA10    458
            CALL PRTMSG(3)                                              ISTA10    459
         ELSE                                                           ISTA10    460
            WRITE(MSG(2),9070) ISTABN,DDAT(JS+14),DDAT(JS+15)           ISTA10    461
            CALL PRTMSG(2)                                              ISTA10    462
         ENDIF                                                          ISTA10    463
        END IF                                                          ISTA10    464
C                                                                       ISTA10    465
      JSTATE=JSTATE+KSTATE                                              ISTA10    466
C                                                                       ISTA10    467
      RETURN                                                            ISTA10    468
C                                                                       ISTA10    469
 9000 FORMAT(' *** WARNING GENERATOR AT BUS: ',I5,' STATION: ',3A4      ISTA10    470
     *,' GID:',A4)                                                      ISTA10    471
 9020 FORMAT(5X,'TYPE 11 STABILIZER ',A,'=',F8.6                        ISTA10    472
     *,' IS BELOW THE LIMIT VALUE OF ',F4.2)                            ISTA10    473
 9030 FORMAT(5X,A,' HAS BEEN SET TO ',F4.2)                             ISTA10    474
 9021 FORMAT(5X,'TYPE 10 (WSCC TYPE SS, SP OR SF) STABILIZER ',A,'='    ISTA10    475
     *,F8.6,' IS BELOW')                                                ISTA10    476
 9031 FORMAT(5X,'THE LIMIT VALUE OF ',F4.2,:,'. ',A,' HAS BEEN SET TO ' ISTA10    477
     *,F4.2)                                                            ISTA10    478
 9040 FORMAT(' *** DATA ERROR GENERATOR AT BUS: ',I5,' STATION: ',3A4   ISTA10    479
     *,' GID:',A4)                                                      ISTA10    480
 9050 FORMAT(5X,'TYPE 10 (WSCC TYPE SS, SP OR SF) STABILIZER DATA'      ISTA10    481
     *,' ERROR.')                                                       ISTA10    482
 9060 FORMAT(5X,'VSMAX=',F10.5,' VSMIN=',F10.5)                         ISTA10    483
 9070 FORMAT(5X,'TYPE 11 STABILIZER DATA ERROR. VSMAX=',F10.5,' VSMIN=' ISTA10    484
     *,F10.5)                                                           ISTA10    485
      END                                                               ISTA10    486
