CFPRIME PDATA                                                           PDATA       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 PDATA(LCARD,MCHTYP,NLF,IVTN,ILNN,IFVN,IUALN,IWS1,IWS2) PDATA       3
CD                                                                      PDATA       4
CD    THIS IS THE MAIN DRIVER TO PICK UP DYNAMIC DATA FROM DYNAMIC      PDATA       5
CD    MODEL DATABASE.                                                   PDATA       6
CD                                                                      PDATA       7
C      PARAMETER (MISTN=1500,MLENG=128,MAREA=101)                       PDATA       8
C                                                                       PDATA       9
C      INCLUDE 'DBBUF1.INS/LIST'                                        PDATA      10
      INCLUDE 'PARX.INS'                                                PDATA      11
      INCLUDE 'PTIP1.INS'                                               PDATA      12
      INCLUDE 'CNPT.INS'                                                PDATA      13
      INCLUDE 'CNB19.INS'                                               PDATA      14
      INCLUDE 'CNLFDA.INS'                                              PDATA      15
      INCLUDE 'CNFLAG.INS'                                              PDATA      16
      INCLUDE 'CNPARX.INS'                                              PDATA      17
      INCLUDE 'CNPBK.INS'                                               PDATA      18
      INCLUDE 'CNMNEW.INS'                                              PDATA      19
      INCLUDE 'CNNNEW.INS'                                              PDATA      20
      INCLUDE 'CNUNIT.INS'                                              PDATA      21
      INCLUDE 'CNTMDA.INS'                                              PDATA      22
      INCLUDE 'CNJPT.INS'                                               PDATA      23
      INCLUDE 'CNJDAT.INS'                                              PDATA      24
      INCLUDE 'CNTGED.INS'                                              PDATA      25
      INCLUDE 'CNMSG.INS'                                               PDATA      26
C                                                                       PDATA      27
      DIMENSION EXC(J9E1D)                                              PDATA      28
      DIMENSION EXS(J9S1D),EXF(J9S2D),EXU(J9S3D)                        PDATA      29
      DIMENSION CGV(J9V1D),CSC(J9V2D),GVN(J9V3D),CCV(J9V4D),            PDATA      30
     1CIV(J9V5D),GSTAB(J9V6D)                                           PDATA      31
C                                                                       PDATA      32
      CHARACTER*80 SIMBUF                                               PDATA      33
      CHARACTER*4 LNAME1(MISTN),LNAME2(MISTN),LNAME3(MISTN)             PDATA      34
      CHARACTER*40 LCARD(2)                                             PDATA      35
      CHARACTER*1 CD                                                    PDATA      36
C                                                                       PDATA      37
      LDEB=(JDEB(47).NE.0)                                              PDATA      38
                                                                        PDATA      39
C      IF(LDEB) THEN                                                    PDATA      40
C        WRITE(IUD6,2020)                                               PDATA      41
C        WRITE(IUD6,2010) NLF,NGRI,IPFAX,IQFAX,MUNIT,JNAME,             PDATA      42
C     1  JUNIT,VRATE                                                    PDATA      43
C        WRITE(IUD6,2000) IGEN,ISATX,IEXX,IVTN,ISTABX,                  PDATA      44
C     &  IGVN,ILNN,IFVN,IGSTAN,IFLTN,IUALN,MASSN,ICBRN                  PDATA      45
C      ENDIF                                                            PDATA      46
C                                                                       PDATA      47
C  STORING TYPE OF SATURATION REQUIRED                                  PDATA      48
C                                                                       PDATA      49
      KKSAT=ISATX                                                       PDATA      50
C    .................................................................. PDATA      51
C    :Retrieve model data from databank for model requested           : PDATA      52
      NTYPE=MCHTYP-1                                                    PDATA      53
      IF(NTYPE.EQ.10) NTYPE=1                                           PDATA      54
      IF(MCHTYP.EQ.1)THEN                                               PDATA      55
         CD='C'                                                         PDATA      56
      ELSE                                                              PDATA      57
         CD='D'                                                         PDATA      58
      ENDIF                                                             PDATA      59
      CALL REFILS(LCARD,NTYPE,CD,IMODE,IVTN,ILNN,IFVN,ICBRN)            PDATA      60
C    :................................................................: PDATA      61
      IF(NTYPE.GE.1.AND.IMODE.NE.0)THEN                                 PDATA      62
         MCHTYP=99                                                      PDATA      63
         RETURN                                                         PDATA      64
      ENDIF                                                             PDATA      65
C    .................................................................. PDATA      66
C    :Debug write model parameters as read in. (note: written in SIMU : PDATA      67
C    : format to facilitate debug)                                    : PDATA      68
      IF(LDEB) THEN                                                     PDATA      69
        WRITE(IUD6,2020)                                                PDATA      70
        WRITE(IUD6,2010) NLF,NGRI,IPFAX,IQFAX,MUNIT,JNAME,JUNIT,VRATE   PDATA      71
        WRITE(IUD6,2000) IGEN,ISATX,IEXX,IVTN,ISTABX,                   PDATA      72
     &  IGVN,ILNN,IFVN,IGSTAN,IFLTN,IUALN,MASSN,ICBRN                   PDATA      73
C        GENERATOR DATA IN IMPEDANCE AND TIME-CONSTANT FORM             PDATA      74
         WRITE (IUD6,2320) (GNBBB(L),L=52,59)                           PDATA      75
         WRITE (IUD6,2320) (GNBBB(L),L=61,64)                           PDATA      76
         IF (ISATX.NE.0) WRITE (IUD6,2320)(GNBBB(L),L=91,96)            PDATA      77
         IF (ISATX.EQ.3.OR.ISATX.EQ.30) WRITE (IUD6,2320) (GNBBB(L),    PDATA      78
     +     L=97,102)                                                    PDATA      79
         IF (ICBRN.GE.2) WRITE (IUD6,2320) GNBBB(29),(GNBBB(L),L=33,35) PDATA      80
         WRITE (IUD6,2320) (GNBBB(L),L=37,39),GNBBB(24),1.0             PDATA      81
         CALL DBEXC(IUD6,IEXX,EXC)                                      PDATA      82
         CALL DBSTAB(IUD6,ISTABX,IFLTN,IUALN,ISTBBB,EXS,EXF,EXU)        PDATA      83
         CALL DBGOV(IUD6,IGVN,IGSTAN,GVN,CCV,CIV,CSC,GSTAB)             PDATA      84
      ENDIF                                                             PDATA      85
C    :................................................................: PDATA      86
C                                                                       PDATA      87
C     STORE DATA TO THE TDDAT ARRAY                                     PDATA      88
C                                                                       PDATA      89
      IF(MCHTYP.EQ.1.OR.MCHTYP.EQ.11) THEN                              PDATA      90
C                                                                       PDATA      91
      TDDAT(JTLN+1)=XTRX                                                PDATA      92
      TDDAT(JTLN+2)=GNBBB(56)                                           PDATA      93
      TDDAT(JTLN+3)=GNBBB(37)                                           PDATA      94
      TDDAT(JTLN+4)=DAMPC*GNBBB(37)                                     PDATA      95
      TDDAT(JTLN+7)=REAL(IGNBBB(11))                                    PDATA      96
C                                                                       PDATA      97
C     NUMBER OF UNITS REQUIRED                                          PDATA      98
C                                                                       PDATA      99
      IF(MUNIT.EQ.0)THEN                                                PDATA     100
         K=MNEW(NLF)                                                    PDATA     101
         KK=(K-1)*2                                                     PDATA     102
         PW=GMW(KK+1)                                                   PDATA     103
         QW=GMX(KK+2)                                                   PDATA     104
         SW=SQRT(PW**2+QW**2)                                           PDATA     105
         XMUNIT=SW*100./GNBBB(24)                                       PDATA     106
         MUNIT=INT(XMUNIT)                                              PDATA     107
         JRD=MOD(MUNIT,100)                                             PDATA     108
         MUNIT=MUNIT/100                                                PDATA     109
         ITEN=10*MUNIT                                                  PDATA     110
         IF (JRD.GT.ITEN) MUNIT=MUNIT+1                                 PDATA     111
      ENDIF                                                             PDATA     112
      XMUNIT=REAL(MUNIT)                                                PDATA     113
      TDDAT(JTLN+5)=GNBBB(24)*XMUNIT                                    PDATA     114
      TDDAT(JTLN+6)=1.0                                                 PDATA     115
      IF(NTYPE.GE.1) VRATE=GNBBB(26)/VRATE                              PDATA     116
      IF(ABS(VRATE-1).GT.1.E-6.AND.VRATE.GT.1.E-6) TDDAT(JTLN+6)=VRATE  PDATA     117
C                                                                       PDATA     118
      IGENDA(1,JNT)=3                                                   PDATA     119
      JGENDA(1,JNT)=JTLN                                                PDATA     120
      JTLN=JTLN+7                                                       PDATA     121
      CALL MCHECK (NLF,12,JTLN,'PDATA ')                                PDATA     122
C                                                                       PDATA     123
      GOTO 380                                                          PDATA     124
      ENDIF                                                             PDATA     125
                                                                        PDATA     126
C    .*.*.*.*.*.*.*.*.*................................................ PDATA     127
C    :The following section of code is cut directly from DGEDAT.      : PDATA     128
C    : TDDAT and associated arrays are filled in here.                 :PDATA     129
C    :                                                                : PDATA     130
      IF(LDEB) WRITE(IUD6,2022)                                         PDATA     131
C                                                                       PDATA     132
      IF(NTYPE.NE.0)THEN                                                PDATA     133
         GOTO (110, 120, 140, 140, 140, 140, 140, 110, 380) NTYPE       PDATA     134
      ENDIF                                                             PDATA     135
C                                                                       PDATA     136
  110 CONTINUE                                                          PDATA     137
      IGENDA(1,JNT)=IGEN                                                PDATA     138
      JGENDA(1,JNT)=JTLN                                                PDATA     139
      JTLN1=JTLN                                                        PDATA     140
C                                                                       PDATA     141
      IF(IGEN.EQ.0)THEN                                                 PDATA     142
C                                                                       PDATA     143
C   DATA IN X'S AND TIME CONSTANT FORM                                  PDATA     144
C                                                                       PDATA     145
      TDDAT(JTLN+7)=GNBBB(52)                                           PDATA     146
      TDDAT(JTLN+8)=GNBBB(53)                                           PDATA     147
      TDDAT(JTLN+9)=GNBBB(54)                                           PDATA     148
      TDDAT(JTLN+10)=GNBBB(55)                                          PDATA     149
      TDDAT(JTLN+11)=GNBBB(56)                                          PDATA     150
      TDDAT(JTLN+12)=GNBBB(57)                                          PDATA     151
      TDDAT(JTLN+13)=GNBBB(58)                                          PDATA     152
      TDDAT(JTLN+14)=GNBBB(59)                                          PDATA     153
      TDDAT(JTLN+15)=GNBBB(61)                                          PDATA     154
      TDDAT(JTLN+16)=GNBBB(62)                                          PDATA     155
      TDDAT(JTLN+17)=GNBBB(63)                                          PDATA     156
      TDDAT(JTLN+18)=GNBBB(64)                                          PDATA     157
      JTLN=JTLN+18                                                      PDATA     158
C                                                                       PDATA     159
      ELSE                                                              PDATA     160
C                                                                       PDATA     161
C     DATA IN PARK'S FORM                                               PDATA     162
C                                                                       PDATA     163
      TDDAT(JTLN+7)=GNBBB(68)                                           PDATA     164
      TDDAT(JTLN+8)=GNBBB(69)                                           PDATA     165
      TDDAT(JTLN+9)=GNBBB(70)                                           PDATA     166
      TDDAT(JTLN+10)=GNBBB(71)                                          PDATA     167
      TDDAT(JTLN+11)=GNBBB(72)                                          PDATA     168
      TDDAT(JTLN+12)=GNBBB(73)                                          PDATA     169
      TDDAT(JTLN+13)=GNBBB(74)                                          PDATA     170
      TDDAT(JTLN+14)=GNBBB(75)                                          PDATA     171
      TDDAT(JTLN+15)=GNBBB(76)                                          PDATA     172
      TDDAT(JTLN+16)=GNBBB(77)                                          PDATA     173
      TDDAT(JTLN+17)=GNBBB(78)                                          PDATA     174
      TDDAT(JTLN+18)=GNBBB(79)                                          PDATA     175
      TDDAT(JTLN+19)=GNBBB(80)                                          PDATA     176
      TDDAT(JTLN+20)=GNBBB(81)                                          PDATA     177
      TDDAT(JTLN+21)=GNBBB(82)                                          PDATA     178
      TDDAT(JTLN+22)=GNBBB(83)                                          PDATA     179
      JTLN=JTLN+22                                                      PDATA     180
C                                                                       PDATA     181
      IF(IGEN.EQ.2)THEN                                                 PDATA     182
      TDDAT(JTLN+1)=GNBBB(84)                                           PDATA     183
      TDDAT(JTLN+2)=GNBBB(85)                                           PDATA     184
      JTLN=JTLN+2                                                       PDATA     185
      ENDIF                                                             PDATA     186
C                                                                       PDATA     187
C   ENDIF IGEN.EQ.0                                                     PDATA     188
C                                                                       PDATA     189
      ENDIF                                                             PDATA     190
C                                                                       PDATA     191
c      IPQFA(1,JNT)=IPFAX                                               PDATA     192
c      IPQFA(2,JNT)=IQFAX                                               PDATA     193
C                                                                       PDATA     194
      IF(KKSAT.EQ.0)THEN                                                PDATA     195
         IGENDA(3,JNT)=0                                                PDATA     196
      ELSE                                                              PDATA     197
         IGENDA(3,JNT)=ISATX                                            PDATA     198
         IF(ISATX.NE.0)THEN                                             PDATA     199
         TDDAT(JTLN+1)=GNBBB(91)                                        PDATA     200
         TDDAT(JTLN+2)=GNBBB(92)                                        PDATA     201
         TDDAT(JTLN+3)=GNBBB(93)                                        PDATA     202
         TDDAT(JTLN+4)=GNBBB(94)                                        PDATA     203
         TDDAT(JTLN+5)=GNBBB(95)                                        PDATA     204
         TDDAT(JTLN+6)=GNBBB(96)                                        PDATA     205
         JTLN=JTLN+6                                                    PDATA     206
         ENDIF                                                          PDATA     207
         IF(ISATX.EQ.3.OR.ISATX.EQ.30) THEN                             PDATA     208
         TDDAT(JTLN+1)=GNBBB(97)                                        PDATA     209
         TDDAT(JTLN+2)=GNBBB(98)                                        PDATA     210
         TDDAT(JTLN+3)=GNBBB(99)                                        PDATA     211
         TDDAT(JTLN+4)=GNBBB(100)                                       PDATA     212
         TDDAT(JTLN+5)=GNBBB(101)                                       PDATA     213
         TDDAT(JTLN+6)=GNBBB(102)                                       PDATA     214
         JTLN=JTLN+6                                                    PDATA     215
         ENDIF                                                          PDATA     216
      ENDIF                                                             PDATA     217
C                                                                       PDATA     218
      TDDAT(JTLN1+1)= GNBBB(37)                                         PDATA     219
      TDDAT(JTLN1+2)= GNBBB(38)                                         PDATA     220
      TDDAT(JTLN1+3)=GNBBB(39)                                          PDATA     221
      TDDAT(JTLN1+5)= 1.0                                               PDATA     222
      TDDAT(JTLN1+6)=REAL(IGNBBB(11))                                   PDATA     223
C                                                                       PDATA     224
C     NUMBER OF UNITS REQUIRED                                          PDATA     225
C                                                                       PDATA     226
      IF (MUNIT.EQ.0) THEN                                              PDATA     227
         PFAX=IPFAX                                                     PDATA     228
         QFAX=IQFAX                                                     PDATA     229
         K=MNEW(NLF)                                                    PDATA     230
         KK=(K-1)*2                                                     PDATA     231
         PW=GMW(KK+1)                                                   PDATA     232
         QW=GMX(KK+2)                                                   PDATA     233
         SW=SQRT(PW**2+QW**2)                                           PDATA     234
         XMUNIT=SW*100./GNBBB(24)                                       PDATA     235
         MUNIT=INT(XMUNIT)                                              PDATA     236
         JRD=MOD(MUNIT,100)                                             PDATA     237
         MUNIT=MUNIT/100                                                PDATA     238
         ITEN=10*MUNIT                                                  PDATA     239
         IF (JRD.GT.ITEN) MUNIT=MUNIT+1                                 PDATA     240
         PW=PW*PFAX                                                     PDATA     241
         QW=QW*QFAX                                                     PDATA     242
         SW=SQRT(PW**2+QW**2)                                           PDATA     243
         XMUNIT=SW*100./GNBBB(24)                                       PDATA     244
         MUNIT=INT(XMUNIT)                                              PDATA     245
         JRD=MOD(MUNIT,100)                                             PDATA     246
         MUNIT=MUNIT/100                                                PDATA     247
         ITEN=10*MUNIT                                                  PDATA     248
         IF (JRD.GT.ITEN) MUNIT=MUNIT+1                                 PDATA     249
      ENDIF                                                             PDATA     250
      XMUNIT=REAL(MUNIT)                                                PDATA     251
      TDDAT(JTLN1+4)=GNBBB(24)*XMUNIT                                   PDATA     252
      IF(NTYPE.GE.1) VRATE=GNBBB(26)/VRATE                              PDATA     253
      IF(ABS(VRATE-1).GT.1.E-6.AND.VRATE.GT.1.E-6) TDDAT(JTLN1+5)=VRATE PDATA     254
C                                                                       PDATA     255
      CALL MCHECK (NLF,1,JTLN,'DGEDAT')                                 PDATA     256
C                                                                       PDATA     257
      JGENDA(7,JNT)=0                                                   PDATA     258
C                                                                       PDATA     259
C! CHECK !!                                                             PDATA     260
      IF (MASSN.NE.0)THEN                                               PDATA     261
      MSG(2)=LCARD(1)//LCARD(2)                                         PDATA     262
      MSG(1)=' *** ERROR MULTI-MASS NOT SUPPORTED BY DATABANK ROUTE'    PDATA     263
      CALL PRTMSG(2)                                                    PDATA     264
          MASSN=0                                                       PDATA     265
      ENDIF                                                             PDATA     266
C                                                                       PDATA     267
      IF (LDEB)WRITE (IUD6,2120) IEXX,JTLN,JGENDA(3,JNT),JNT            PDATA     268
C                                                                       PDATA     269
      JGENDA(8,JNT)=0                                                   PDATA     270
      IGENDA(9,JNT)=ICBRN                                               PDATA     271
C                                                                       PDATA     272
      IF(ICBRN.GT.1)THEN                                                PDATA     273
         TDDAT(JTLN+1)=GNBBB(29)                                        PDATA     274
         TDDAT(JTLN+2)=GNBBB(33)                                        PDATA     275
         TDDAT(JTLN+3)=GNBBB(34)                                        PDATA     276
         TDDAT(JTLN+4)=GNBBB(35)                                        PDATA     277
         JGENDA(8,JNT)=JTLN                                             PDATA     278
         JTLN=JTLN+4                                                    PDATA     279
      ENDIF                                                             PDATA     280
C                                                                       PDATA     281
      IF(NTYPE.EQ.1) RETURN                                             PDATA     282
C                                                                       PDATA     283
  120 CONTINUE                                                          PDATA     284
      IGENDA(4,JNT)=IEXX                                                PDATA     285
      IF (IEXX.EQ.0) GO TO 380                                          PDATA     286
      JTLN=JTLN+1                                                       PDATA     287
      JGENDA(3,JNT)=JTLN                                                PDATA     288
      ITDDAT(JTLN+1)=IVTN                                               PDATA     289
C                                                                       PDATA     290
      J=25                                                              PDATA     291
      IF(IEXX.EQ.4) J=28                                                PDATA     292
      IF(IEXX.EQ.5.OR.IEXX.EQ.3.OR.IEXX.EQ.14) J=33                     PDATA     293
      IF(IEXX.EQ.6.OR.IEXX.EQ.8) J=27                                   PDATA     294
      IF(IEXX.EQ.30) J=29                                               PDATA     295
      IF(IEXX.EQ.32) J=35                                               PDATA     296
C                                                                       PDATA     297
      IGENDA(14,JNT)=IEXBBB(11)                                         PDATA     298
      IGENDA(15,JNT)=IEXBBB(12)                                         PDATA     299
      IGENDA(16,JNT)=IEXBBB(13)                                         PDATA     300
      IF(IGENDA(14,JNT).EQ.0) IGENDA(14,JNT)=1                          PDATA     301
      IF(IGENDA(15,JNT).EQ.0) IGENDA(15,JNT)=1                          PDATA     302
      IF(IGENDA(16,JNT).EQ.0) IGENDA(16,JNT)=1                          PDATA     303
C                                                                       PDATA     304
      DO 600 I=2,J                                                      PDATA     305
         TDDAT(JTLN+I)=EXBBB(J9E1P+I-2)                                 PDATA     306
  600 CONTINUE                                                          PDATA     307
C                                                                       PDATA     308
      IF(LDEB)WRITE (IUD6,2030) (TDDAT(JTLN+LJ),LJ=2,J)                 PDATA     309
      JTLN=JTLN+J                                                       PDATA     310
C                                                                       PDATA     311
      CALL MCHECK (NLF,3,JTLN,'DGEDAT')                                 PDATA     312
C                                                                       PDATA     313
      IF(NTYPE.EQ.2) RETURN                                             PDATA     314
  140 CONTINUE                                                          PDATA     315
      IGENDA(5,JNT)=ISTABX                                              PDATA     316
      JGENDA(4,JNT)=JTLN                                                PDATA     317
C                                                                       PDATA     318
C     READ IN THE STABILIZER DATA                                       PDATA     319
C                                                                       PDATA     320
C            1   2   3   4   5   6   7   8   9  10  11  12              PDATA     321
      GOTO(230,240,240,230,240,240,270,280,280,300,310,330),ISTABX      PDATA     322
C                                                                       PDATA     323
 230  CONTINUE                                                          PDATA     324
C                                                                       PDATA     325
C   TYPE 1 AND 4 STABILIZER                                             PDATA     326
C                                                                       PDATA     327
      J=14                                                              PDATA     328
      ASSIGN 250 TO I340                                                PDATA     329
      GOTO 340                                                          PDATA     330
C                                                                       PDATA     331
C   TYPE 2,3,5 AND 6 STABILIZER                                         PDATA     332
C                                                                       PDATA     333
 240  CONTINUE                                                          PDATA     334
      ASSIGN 245 TO I340                                                PDATA     335
      GOTO 340                                                          PDATA     336
 245  TDDAT(JTLN+3)=EXS(1)                                              PDATA     337
      TDDAT(JTLN+4)=EXS(2)                                              PDATA     338
      TDDAT(JTLN+5)=EXS(3)                                              PDATA     339
      TDDAT(JTLN+6)=EXS(4)                                              PDATA     340
      TDDAT(JTLN+7)=EXS(5)                                              PDATA     341
      TDDAT(JTLN+8)=EXS(6)                                              PDATA     342
      TDDAT(JTLN+9)=EXS(7)                                              PDATA     343
      TDDAT(JTLN+10)=EXS(8)                                             PDATA     344
      TDDAT(JTLN+11)=EXS(9)                                             PDATA     345
      TDDAT(JTLN+12)=EXS(10)                                            PDATA     346
      TDDAT(JTLN+13)=EXS(11)                                            PDATA     347
      TDDAT(JTLN+14)=EXS(12)                                            PDATA     348
      TDDAT(JTLN+15)=EXS(17)                                            PDATA     349
      TDDAT(JTLN+16)=EXS(18)                                            PDATA     350
      TDDAT(JTLN+17)=EXS(19)                                            PDATA     351
      TDDAT(JTLN+18)=EXS(20)                                            PDATA     352
      TDDAT(JTLN+19)=EXS(21)                                            PDATA     353
      TDDAT(JTLN+20)=EXS(22)                                            PDATA     354
      TDDAT(JTLN+21)=EXS(23)                                            PDATA     355
      TDDAT(JTLN+22)=EXS(24)                                            PDATA     356
      JTLN=JTLN+22                                                      PDATA     357
      GOTO 350                                                          PDATA     358
C                                                                       PDATA     359
 250  CONTINUE                                                          PDATA     360
      DO 260 I=3,J                                                      PDATA     361
      TDDAT(JTLN+I)=EXS(I-2)                                            PDATA     362
 260  CONTINUE                                                          PDATA     363
      JTLN=JTLN+J                                                       PDATA     364
      GOTO 350                                                          PDATA     365
C                                                                       PDATA     366
 270  CONTINUE                                                          PDATA     367
C                                                                       PDATA     368
C   TYPE 7 STABILIZER                                                   PDATA     369
C                                                                       PDATA     370
      ITDDAT(JTLN+1)=0                                                  PDATA     371
      TDDAT(JTLN+2)=EXS(1)                                              PDATA     372
      TDDAT(JTLN+3)=EXS(2)                                              PDATA     373
      TDDAT(JTLN+4)=EXS(3)                                              PDATA     374
      TDDAT(JTLN+5)=EXS(4)                                              PDATA     375
      TDDAT(JTLN+6)=EXS(5)                                              PDATA     376
      TDDAT(JTLN+7)=EXS(6)                                              PDATA     377
      TDDAT(JTLN+8)=EXS(7)                                              PDATA     378
      TDDAT(JTLN+9)=EXS(8)                                              PDATA     379
      JTLN=JTLN+9                                                       PDATA     380
      GOTO 350                                                          PDATA     381
C                                                                       PDATA     382
 280  CONTINUE                                                          PDATA     383
C                                                                       PDATA     384
C     TYPES 8 AND 9 STABILIZER                                          PDATA     385
C                                                                       PDATA     386
      ITDDAT(JTLN+1)=IWS1                                               PDATA     387
      ITDDAT(JTLN+2)=ISTBBB(20)                                         PDATA     388
      ITDDAT(JTLN+3)=0                                                  PDATA     389
      ITDDAT(JTLN+4)=4                                                  PDATA     390
      ITDDAT(JTLN+5)=ISTBBB(11)                                         PDATA     391
      ITDDAT(JTLN+6)=ISTBBB(12)                                         PDATA     392
      TDDAT(JTLN+7)=EXS(1)                                              PDATA     393
      TDDAT(JTLN+8)=EXS(2)                                              PDATA     394
      TDDAT(JTLN+9)=EXS(3)                                              PDATA     395
      TDDAT(JTLN+10)=EXS(4)                                             PDATA     396
      TDDAT(JTLN+11)=EXS(5)                                             PDATA     397
      TDDAT(JTLN+12)=EXS(6)                                             PDATA     398
      TDDAT(JTLN+13)=EXS(7)                                             PDATA     399
      TDDAT(JTLN+14)=EXS(8)                                             PDATA     400
      TDDAT(JTLN+15)=EXS(9)                                             PDATA     401
      TDDAT(JTLN+16)=EXS(10)                                            PDATA     402
      TDDAT(JTLN+17)=EXS(11)                                            PDATA     403
      TDDAT(JTLN+18)=EXS(12)                                            PDATA     404
      TDDAT(JTLN+19)=EXS(13)                                            PDATA     405
      TDDAT(JTLN+20)=EXS(14)                                            PDATA     406
      TDDAT(JTLN+21)=EXS(15)                                            PDATA     407
      TDDAT(JTLN+22)=EXS(16)                                            PDATA     408
      TDDAT(JTLN+23)=EXS(19)                                            PDATA     409
      TDDAT(JTLN+24)=EXS(20)                                            PDATA     410
      TDDAT(JTLN+25)=EXS(21)                                            PDATA     411
      TDDAT(JTLN+26)=EXS(22)                                            PDATA     412
      TDDAT(JTLN+27)=EXS(23)                                            PDATA     413
      TDDAT(JTLN+28)=EXS(24)                                            PDATA     414
      TDDAT(JTLN+29)=EXS(25)                                            PDATA     415
      JTLN=JTLN+29                                                      PDATA     416
      GOTO 350                                                          PDATA     417
C                                                                       PDATA     418
 300  CONTINUE                                                          PDATA     419
C                                                                       PDATA     420
C   TYPE 10 STABILIZER                                                  PDATA     421
C                                                                       PDATA     422
      J=20                                                              PDATA     423
      ASSIGN 305 TO I340                                                PDATA     424
      GOTO 340                                                          PDATA     425
 305  TDDAT(JTLN+3)=EXS(1)                                              PDATA     426
      TDDAT(JTLN+4)=EXS(2)                                              PDATA     427
      TDDAT(JTLN+5)=EXS(3)                                              PDATA     428
      TDDAT(JTLN+6)=EXS(4)                                              PDATA     429
      TDDAT(JTLN+7)=EXS(5)                                              PDATA     430
      TDDAT(JTLN+8)=EXS(6)                                              PDATA     431
      TDDAT(JTLN+9)=EXS(7)                                              PDATA     432
      TDDAT(JTLN+10)=EXS(9)                                             PDATA     433
      TDDAT(JTLN+11)=EXS(10)                                            PDATA     434
      TDDAT(JTLN+12)=EXS(11)                                            PDATA     435
      TDDAT(JTLN+13)=EXS(12)                                            PDATA     436
      TDDAT(JTLN+14)=EXS(13)                                            PDATA     437
      TDDAT(JTLN+15)=EXS(14)                                            PDATA     438
      TDDAT(JTLN+16)=EXS(15)                                            PDATA     439
      TDDAT(JTLN+17)=EXS(17)                                            PDATA     440
      TDDAT(JTLN+18)=EXS(18)                                            PDATA     441
      TDDAT(JTLN+19)=EXS(19)                                            PDATA     442
      TDDAT(JTLN+20)=EXS(20)                                            PDATA     443
      JTLN=JTLN+20                                                      PDATA     444
      GOTO 350                                                          PDATA     445
C                                                                       PDATA     446
 310  CONTINUE                                                          PDATA     447
C                                                                       PDATA     448
C   TYPE 11 STABILIZER                                                  PDATA     449
C                                                                       PDATA     450
      ASSIGN 320 TO I340                                                PDATA     451
      GOTO 340                                                          PDATA     452
 320  TDDAT(JTLN+3)=EXS(1)                                              PDATA     453
      TDDAT(JTLN+4)=EXS(2)                                              PDATA     454
      TDDAT(JTLN+5)=EXS(3)                                              PDATA     455
      TDDAT(JTLN+6)=EXS(4)                                              PDATA     456
      TDDAT(JTLN+7)=EXS(5)                                              PDATA     457
      TDDAT(JTLN+8)=EXS(6)                                              PDATA     458
      TDDAT(JTLN+9)=EXS(7)                                              PDATA     459
      TDDAT(JTLN+10)=EXS(9)                                             PDATA     460
      TDDAT(JTLN+11)=EXS(10)                                            PDATA     461
      TDDAT(JTLN+12)=EXS(11)                                            PDATA     462
      TDDAT(JTLN+13)=EXS(12)                                            PDATA     463
      TDDAT(JTLN+14)=EXS(13)                                            PDATA     464
      TDDAT(JTLN+15)=EXS(14)                                            PDATA     465
      TDDAT(JTLN+16)=EXS(15)                                            PDATA     466
      TDDAT(JTLN+17)=EXS(16)                                            PDATA     467
      TDDAT(JTLN+18)=EXS(17)                                            PDATA     468
      TDDAT(JTLN+19)=EXS(18)                                            PDATA     469
      TDDAT(JTLN+20)=EXS(19)                                            PDATA     470
      TDDAT(JTLN+21)=EXS(20)                                            PDATA     471
      TDDAT(JTLN+22)=EXS(21)                                            PDATA     472
      TDDAT(JTLN+23)=EXS(22)                                            PDATA     473
      TDDAT(JTLN+24)=EXS(23)                                            PDATA     474
      TDDAT(JTLN+25)=EXS(24)                                            PDATA     475
      TDDAT(JTLN+26)=EXS(25)                                            PDATA     476
      TDDAT(JTLN+27)=EXS(26)                                            PDATA     477
      TDDAT(JTLN+28)=EXS(27)                                            PDATA     478
      TDDAT(JTLN+29)=EXS(28)                                            PDATA     479
      TDDAT(JTLN+30)=EXS(29)                                            PDATA     480
      JTLN=JTLN+30                                                      PDATA     481
      GOTO 350                                                          PDATA     482
 330  CONTINUE                                                          PDATA     483
C                                                                       PDATA     484
C   TYPE 12 STABILIZER                                                  PDATA     485
C                                                                       PDATA     486
      ITDDAT(JTLN+1)=IWS1                                               PDATA     487
      ITDDAT(JTLN+2)=ISTBBB(20)                                         PDATA     488
      ITDDAT(JTLN+3)=IWS2                                               PDATA     489
      ITDDAT(JTLN+4)=ISTBBB(12)                                         PDATA     490
      TDDAT(JTLN+5)=EXS(1)                                              PDATA     491
      TDDAT(JTLN+6)=EXS(2)                                              PDATA     492
      TDDAT(JTLN+7)=EXS(3)                                              PDATA     493
      TDDAT(JTLN+8)=EXS(4)                                              PDATA     494
      TDDAT(JTLN+9)=EXS(5)                                              PDATA     495
      TDDAT(JTLN+10)=EXS(6)                                             PDATA     496
      TDDAT(JTLN+11)=EXS(7)                                             PDATA     497
      TDDAT(JTLN+12)=EXS(8)                                             PDATA     498
      TDDAT(JTLN+13)=EXS(9)                                             PDATA     499
      TDDAT(JTLN+14)=EXS(10)                                            PDATA     500
      TDDAT(JTLN+15)=EXS(11)                                            PDATA     501
      TDDAT(JTLN+16)=EXS(12)                                            PDATA     502
      TDDAT(JTLN+17)=EXS(13)                                            PDATA     503
      TDDAT(JTLN+18)=EXS(14)                                            PDATA     504
      TDDAT(JTLN+19)=EXS(17)                                            PDATA     505
      TDDAT(JTLN+20)=EXS(18)                                            PDATA     506
      TDDAT(JTLN+21)=EXS(19)                                            PDATA     507
      TDDAT(JTLN+22)=EXS(20)                                            PDATA     508
      TDDAT(JTLN+23)=EXS(21)                                            PDATA     509
      TDDAT(JTLN+24)=EXS(22)                                            PDATA     510
      JTLN=JTLN+24                                                      PDATA     511
      GOTO 350                                                          PDATA     512
C                                                                       PDATA     513
C   COMMON PART OF DATA FOR STABILIZER                                  PDATA     514
C   TYPES 1,2,3,4,5,6,10 AND 11                                         PDATA     515
C                                                                       PDATA     516
 340  CONTINUE                                                          PDATA     517
      ITDDAT(JTLN+1)=IWS1                                               PDATA     518
      ITDDAT(JTLN+2)=ISTBBB(20)                                         PDATA     519
      GOTO I340                                                         PDATA     520
C                                                                       PDATA     521
  350 CONTINUE                                                          PDATA     522
C                                                                       PDATA     523
C--  READ TORSIONAL FILTER DATA IF THERE IS ANY                         PDATA     524
C                                                                       PDATA     525
      IGENDA(6,JNT)=IFLTN                                               PDATA     526
      IF (IFLTN.EQ.0) GO TO 370                                         PDATA     527
      JGENDA(5,JNT)=JTLN                                                PDATA     528
                                                                        PDATA     529
C!      READ (SIMBUF,2030) (TDDAT(JTLN+LJ),LJ=1,8)                      PDATA     530
                                                                        PDATA     531
      TDDAT(JTLN+1)=EXF(1)                                              PDATA     532
      TDDAT(JTLN+2)=EXF(2)                                              PDATA     533
      TDDAT(JTLN+3)=EXF(3)                                              PDATA     534
      TDDAT(JTLN+4)=EXF(4)                                              PDATA     535
      TDDAT(JTLN+5)=EXF(5)                                              PDATA     536
      TDDAT(JTLN+6)=EXF(6)                                              PDATA     537
      TDDAT(JTLN+7)=EXF(7)                                              PDATA     538
      TDDAT(JTLN+8)=EXF(8)                                              PDATA     539
      JTLN=JTLN+8                                                       PDATA     540
C                                                                       PDATA     541
      CALL MCHECK (NLF,5,JTLN,'DGEDAT')                                 PDATA     542
C                                                                       PDATA     543
C--  READ UNDER EXCITATION LIMITER DATA IF THERE IS ANY                 PDATA     544
C                                                                       PDATA     545
      IGENDA(7,JNT)=IUALN                                               PDATA     546
  370 IF (IUALN.EQ.0) GO TO 380                                         PDATA     547
      JGENDA(6,JNT)=JTLN                                                PDATA     548
      TDDAT(JTLN+1)=EXU(1)                                              PDATA     549
      TDDAT(JTLN+2)=EXU(2)                                              PDATA     550
      TDDAT(JTLN+3)=EXU(3)                                              PDATA     551
      TDDAT(JTLN+4)=EXU(4)                                              PDATA     552
      TDDAT(JTLN+5)=EXU(5)                                              PDATA     553
      TDDAT(JTLN+6)=EXU(6)                                              PDATA     554
      TDDAT(JTLN+7)=EXU(7)                                              PDATA     555
      TDDAT(JTLN+8)=EXU(8)                                              PDATA     556
      TDDAT(JTLN+9)=EXU(9)                                              PDATA     557
      TDDAT(JTLN+10)=EXU(10)                                            PDATA     558
      TDDAT(JTLN+11)=EXU(11)                                            PDATA     559
      TDDAT(JTLN+12)=EXU(12)                                            PDATA     560
      TDDAT(JTLN+13)=EXU(13)                                            PDATA     561
      TDDAT(JTLN+14)=EXU(14)                                            PDATA     562
      TDDAT(JTLN+15)=EXU(15)                                            PDATA     563
      TDDAT(JTLN+16)=EXU(16)                                            PDATA     564
      JTLN=JTLN+16                                                      PDATA     565
      CALL MCHECK (NLF,6,JTLN,'DGEDAT')                                 PDATA     566
  380 CONTINUE                                                          PDATA     567
      IF(NTYPE.EQ.3) RETURN                                             PDATA     568
      IGENDA(2,JNT)=IGVN                                                PDATA     569
      JGENDA(2,JNT)=0                                                   PDATA     570
      IF (IGVN.EQ.0) GO TO 500                                          PDATA     571
      JNTTL=JNT                                                         PDATA     572
      JTLN=JTLN+1                                                       PDATA     573
      JGENDA(2,JNT)=JTLN                                                PDATA     574
C   TYPE :    1   2   3   4   5   6   7   8   9  10  11  12  13  14  15 PDATA     575
      GOTO (390,390,480,400,410,420,430,440,480,480,480,480,480,480,480 PDATA     576
C            16  17  18  19  20  21  22                                 PDATA     577
     +     ,480,480,480,480,450,460,460), IGVN                          PDATA     578
C                                                                       PDATA     579
C  TYPE 1, 2                                                            PDATA     580
C                                                                       PDATA     581
 390  CONTINUE                                                          PDATA     582
                                                                        PDATA     583
C!      READ (SIMBUF,2030) (TDDAT(JTLN+LK),LK=17,23)                    PDATA     584
                                                                        PDATA     585
       TDDAT(JTLN+17)=GVN(1)                                            PDATA     586
       TDDAT(JTLN+18)=GVN(2)                                            PDATA     587
       TDDAT(JTLN+19)=GVN(3)                                            PDATA     588
       TDDAT(JTLN+20)=GVN(4)                                            PDATA     589
       TDDAT(JTLN+21)=GVN(5)                                            PDATA     590
       TDDAT(JTLN+22)=GVN(6)                                            PDATA     591
       TDDAT(JTLN+23)=GVN(7)                                            PDATA     592
                                                                        PDATA     593
C!      READ (SIMBUF,2030) (TDDAT(JTLN+LK),LK=24,28)                    PDATA     594
                                                                        PDATA     595
       TDDAT(JTLN+24)=GVN(8)                                            PDATA     596
       TDDAT(JTLN+25)=GVN(9)                                            PDATA     597
       TDDAT(JTLN+26)=GVN(10)                                           PDATA     598
       TDDAT(JTLN+27)=GVN(11)                                           PDATA     599
       TDDAT(JTLN+28)=GVN(12)                                           PDATA     600
                                                                        PDATA     601
C!      READ (SIMBUF,2030) (TDDAT(JTLN+LK),LK=47,54)                    PDATA     602
                                                                        PDATA     603
       TDDAT(JTLN+47)=CCV(1)                                            PDATA     604
       TDDAT(JTLN+48)=CCV(2)                                            PDATA     605
       TDDAT(JTLN+49)=CCV(3)                                            PDATA     606
       TDDAT(JTLN+50)=CCV(4)                                            PDATA     607
       TDDAT(JTLN+51)=CCV(5)                                            PDATA     608
       TDDAT(JTLN+52)=CCV(6)                                            PDATA     609
       TDDAT(JTLN+53)=CCV(7)                                            PDATA     610
       TDDAT(JTLN+54)=CCV(8)                                            PDATA     611
C                                                                       PDATA     612
       TDDAT(JTLN+55)=CCV(9)                                            PDATA     613
       TDDAT(JTLN+56)=CCV(10)                                           PDATA     614
       TDDAT(JTLN+57)=CCV(11)                                           PDATA     615
       TDDAT(JTLN+58)=CCV(12)                                           PDATA     616
       TDDAT(JTLN+59)=CCV(13)                                           PDATA     617
       TDDAT(JTLN+60)=CCV(14)                                           PDATA     618
       TDDAT(JTLN+61)=CCV(15)                                           PDATA     619
       TDDAT(JTLN+62)=CCV(16)                                           PDATA     620
       TDDAT(JTLN+63)=CCV(17)                                           PDATA     621
       TDDAT(JTLN+64)=CCV(18)                                           PDATA     622
C                                                                       PDATA     623
       TDDAT(JTLN+29)=CIV(1)                                            PDATA     624
       TDDAT(JTLN+30)=CIV(2)                                            PDATA     625
       TDDAT(JTLN+31)=CIV(3)                                            PDATA     626
       TDDAT(JTLN+32)=CIV(4)                                            PDATA     627
       TDDAT(JTLN+33)=CIV(5)                                            PDATA     628
       TDDAT(JTLN+34)=CIV(6)                                            PDATA     629
       TDDAT(JTLN+35)=CIV(7)                                            PDATA     630
       TDDAT(JTLN+36)=CIV(8)                                            PDATA     631
C                                                                       PDATA     632
       TDDAT(JTLN+37)=CIV(9)                                            PDATA     633
       TDDAT(JTLN+38)=CIV(10)                                           PDATA     634
       TDDAT(JTLN+39)=CIV(11)                                           PDATA     635
       TDDAT(JTLN+40)=CIV(12)                                           PDATA     636
       TDDAT(JTLN+41)=CIV(13)                                           PDATA     637
       TDDAT(JTLN+42)=CIV(14)                                           PDATA     638
       TDDAT(JTLN+43)=CIV(15)                                           PDATA     639
       TDDAT(JTLN+44)=CIV(16)                                           PDATA     640
C                                                                       PDATA     641
       TDDAT(JTLN+45)=CIV(17)                                           PDATA     642
       TDDAT(JTLN+46)=CIV(18)                                           PDATA     643
C                                                                       PDATA     644
       TDDAT(JTLN+1)=CSC(1)                                             PDATA     645
       TDDAT(JTLN+2)=CSC(2)                                             PDATA     646
       TDDAT(JTLN+3)=CSC(3)                                             PDATA     647
       TDDAT(JTLN+4)=CSC(4)                                             PDATA     648
       TDDAT(JTLN+5)=CSC(5)                                             PDATA     649
       TDDAT(JTLN+6)=CSC(6)                                             PDATA     650
       TDDAT(JTLN+7)=CSC(7)                                             PDATA     651
       TDDAT(JTLN+8)=CSC(8)                                             PDATA     652
C                                                                       PDATA     653
       TDDAT(JTLN+9)=CSC(9)                                             PDATA     654
       TDDAT(JTLN+10)=CSC(10)                                           PDATA     655
       TDDAT(JTLN+11)=CSC(11)                                           PDATA     656
       TDDAT(JTLN+12)=CSC(12)                                           PDATA     657
       TDDAT(JTLN+13)=CSC(13)                                           PDATA     658
       TDDAT(JTLN+14)=CSC(14)                                           PDATA     659
       TDDAT(JTLN+15)=CSC(15)                                           PDATA     660
       TDDAT(JTLN+16)=CSC(16)                                           PDATA     661
                                                                        PDATA     662
                                                                        PDATA     663
       ITDDAT(JTLN+65)=ILNN                                             PDATA     664
       ITDDAT(JTLN+66)=IFVN                                             PDATA     665
C-- RESERVE 12 STORAGES FOR DEADBAND 1 & 2 OF C.V. AND I.V.             PDATA     666
C   EACH ARRAY NEEDS 3 ELEMENTS, TOTAL 4 ARRAYS.                        PDATA     667
C   THE ORDER OF THESE ARRAYS IS C.V. DB1,DB2, I.V. DB1,DB2.            PDATA     668
       TDDAT(JTLN+67)=0.0                                               PDATA     669
       TDDAT(JTLN+68)=0.0                                               PDATA     670
       TDDAT(JTLN+69)=0.0                                               PDATA     671
       ITDDAT(JTLN)=78                                                  PDATA     672
       JTLN=JTLN+78                                                     PDATA     673
      CALL MCHECK (NLF,7,JTLN,'DGEDAT')                                 PDATA     674
      GO TO 500                                                         PDATA     675
C                                                                       PDATA     676
C  TYPE 4                                                               PDATA     677
C                                                                       PDATA     678
 400  CONTINUE                                                          PDATA     679
C!      READ (SIMBUF,2030) (TDDAT(JTLN+LK),LK=1,8)                      PDATA     680
C!      READ (SIMBUF,2030) (TDDAT(JTLN+LK),LK=9,16)                     PDATA     681
                                                                        PDATA     682
      DO 401 J1=1,16                                                    PDATA     683
      TDDAT(JTLN+J1)=CSC(J1)                                            PDATA     684
 401  CONTINUE                                                          PDATA     685
      JTLN=JTLN+16                                                      PDATA     686
      CALL MCHECK (NLF,8,JTLN,'DGEDAT')                                 PDATA     687
      GO TO 500                                                         PDATA     688
C                                                                       PDATA     689
C  TYPE 5                                                               PDATA     690
C                                                                       PDATA     691
 410  IGVNM1=IGENDA(2,JNT-1)                                            PDATA     692
      IF (IGVNM1.NE.4) GO TO 490                                        PDATA     693
C                                                                       PDATA     694
      TDDAT(JTLN+1)=CSC(1)                                              PDATA     695
      TDDAT(JTLN+2)=CSC(2)                                              PDATA     696
      TDDAT(JTLN+3)=CSC(3)                                              PDATA     697
      TDDAT(JTLN+4)=CSC(4)                                              PDATA     698
      ITDDAT(JTLN)=4                                                    PDATA     699
      JTLN=JTLN+4                                                       PDATA     700
      CALL MCHECK (NLF,9,JTLN,'DGEDAT')                                 PDATA     701
      GO TO 500                                                         PDATA     702
C                                                                       PDATA     703
C  TYPE 6                                                               PDATA     704
C                                                                       PDATA     705
 420  CONTINUE                                                          PDATA     706
C                                                                       PDATA     707
      TDDAT(JTLN+1)=CSC(1)                                              PDATA     708
      TDDAT(JTLN+2)=CSC(2)                                              PDATA     709
      TDDAT(JTLN+3)=CSC(3)                                              PDATA     710
      TDDAT(JTLN+4)=CSC(4)                                              PDATA     711
      TDDAT(JTLN+5)=CSC(5)                                              PDATA     712
      TDDAT(JTLN+6)=CSC(6)                                              PDATA     713
      TDDAT(JTLN+7)=CSC(7)                                              PDATA     714
C                                                                       PDATA     715
      ITDDAT(JTLN)=7                                                    PDATA     716
      JTLN=JTLN+7                                                       PDATA     717
      CALL MCHECK (NLF,10,JTLN,'DGEDAT')                                PDATA     718
      GOTO 500                                                          PDATA     719
C                                                                       PDATA     720
C  TYPE 7                                                               PDATA     721
C                                                                       PDATA     722
 430  CONTINUE                                                          PDATA     723
C                                                                       PDATA     724
      DO 431 J1=1,10                                                    PDATA     725
      TDDAT(JTLN+J1)=CSC(J1)                                            PDATA     726
 431  CONTINUE                                                          PDATA     727
C                                                                       PDATA     728
      ITDDAT(JTLN)=10                                                   PDATA     729
      JTLN=JTLN+10                                                      PDATA     730
      CALL MCHECK (NLF,11,JTLN,'DGEDAT')                                PDATA     731
      GOTO 500                                                          PDATA     732
C                                                                       PDATA     733
C  TYPE 8                                                               PDATA     734
C                                                                       PDATA     735
 440  CONTINUE                                                          PDATA     736
C                                                                       PDATA     737
      DO 441 J1=1,9                                                     PDATA     738
      TDDAT(JTLN+J1)=CSC(J1)                                            PDATA     739
 441  CONTINUE                                                          PDATA     740
C                                                                       PDATA     741
      ITDDAT(JTLN)=9                                                    PDATA     742
      JTLN=JTLN+9                                                       PDATA     743
      CALL MCHECK (NLF,11,JTLN,'DGEDAT')                                PDATA     744
      GOTO 500                                                          PDATA     745
C                                                                       PDATA     746
C  TYPE 20                                                              PDATA     747
C                                                                       PDATA     748
 450  CONTINUE                                                          PDATA     749
C                                                                       PDATA     750
      DO 451 J1=1,14                                                    PDATA     751
      TDDAT(JTLN+J1)=CSC(J1)                                            PDATA     752
 451  CONTINUE                                                          PDATA     753
      DTYP1=CSC(15)                                                     PDATA     754
      TDDAT(JTLN+15)=CSC(16)                                            PDATA     755
C                                                                       PDATA     756
C     IF (DTYP1.GT.1.0) TDDAT(JTLN+15)=-TDDAT(JTLN+15)                  PDATA     757
C= RESERVE STORAGE FOR "DBin","DBout","At","Unl","G0"                   PDATA     758
C= AT POSITIONS OF       16     17     18    19   20                    PDATA     759
      ITDDAT(JTLN)=20                                                   PDATA     760
      JTLN=JTLN+20                                                      PDATA     761
      CALL MCHECK (NLF,12,JTLN,'DGEDAT')                                PDATA     762
      GO TO 500                                                         PDATA     763
C                                                                       PDATA     764
C  TYPE 21, 22                                                          PDATA     765
C                                                                       PDATA     766
 460  CONTINUE                                                          PDATA     767
C                                                                       PDATA     768
      DO 461 J1=1,11                                                    PDATA     769
      TDDAT(JTLN+J1)=CSC(J1)                                            PDATA     770
 461  CONTINUE                                                          PDATA     771
C                                                                       PDATA     772
      ITDDAT(JTLN)=11                                                   PDATA     773
      JTLN=JTLN+11                                                      PDATA     774
      CALL MCHECK (NLF,13,JTLN,'DGEDAT')                                PDATA     775
      GOTO 500                                                          PDATA     776
C                                                                       PDATA     777
C  TYPES WHICH HAVE NOT BE DEFINED                                      PDATA     778
C                                                                       PDATA     779
  480 CONTINUE                                                          PDATA     780
      WRITE (MSG(1),2090) IGVN                                          PDATA     781
               MSG(2)=LCARD(1)//LCARD(2)                                PDATA     782
      CALL PRTMSG(2)                                                    PDATA     783
      SIMBUF='PDATA GOVERNOR TYPE ERROR'                                PDATA     784
      CALL ASTOP(SIMBUF,25)                                             PDATA     785
C                                                                       PDATA     786
C  TYPE 4 AND TYPE 5 ARE NOT MATCHED                                    PDATA     787
C                                                                       PDATA     788
  490 CONTINUE                                                          PDATA     789
      WRITE (MSG(1),2100)                                               PDATA     790
               MSG(2)=LCARD(1)//LCARD(2)                                PDATA     791
      WRITE(MSG(3),2101) IGVN                                           PDATA     792
      WRITE(MSG(4),2102)                                                PDATA     793
      CALL PRTMSG(4)                                                    PDATA     794
      SIMBUF='PDATA:  HP/LP GOVERNOR REPRESENTATION ERROR'              PDATA     795
      CALL ASTOP(SIMBUF,43)                                             PDATA     796
  500 CONTINUE                                                          PDATA     797
C                                                                       PDATA     798
C-- READ THE GOVERNOR STABILIZER DATA IF THERE IS ANY                   PDATA     799
C                                                                       PDATA     800
      IGENDA(10,JNT)=IGSTAN                                             PDATA     801
      IGENDA(11,JNT)=0                                                  PDATA     802
      IGENDA(12,JNT)=0                                                  PDATA     803
      IF (IGSTAN.GT.0) THEN                                             PDATA     804
        JGENDA(9,JNT)=JTLN                                              PDATA     805
C!        READ(SIMBUF,2030) (TDDAT(JTLN+LK),LK=1,6)                     PDATA     806
      DO 501 J1=1,6                                                     PDATA     807
      TDDAT(JTLN+J1)=GSTAB(J1)                                          PDATA     808
 501  CONTINUE                                                          PDATA     809
C                                                                       PDATA     810
      JTLN=JTLN+6                                                       PDATA     811
      END IF                                                            PDATA     812
  550 CONTINUE                                                          PDATA     813
C                                                                       PDATA     814
      RETURN                                                            PDATA     815
C                                                                       PDATA     816
C 900  CONTINUE                                                         PDATA     817
C                                                                       PDATA     818
C      WRITE(MSG(1),2340)                                               PDATA     819
C      MSG(4)=LCARD(1)//LCARD(2)                                        PDATA     820
C      MSG(2)=SIMBUF                                                    PDATA     821
C      WRITE(MSG(3),2341)                                               PDATA     822
C      CALL PRTMSG(4)                                                   PDATA     823
C      SIMBUF='PDATA: DETAILED GENERATOR DATA ERROR'                    PDATA     824
C      CALL ASTOP(SIMBUF,36)                                            PDATA     825
C                                                                       PDATA     826
C    :*.*.*.*.*.*.*.*.*...............................................: PDATA     827
C                                                                       PDATA     828
 1030 FORMAT (/1X,' DEBUG (DBHEAD) RECORD 1 CONTENTS : ',/,             PDATA     829
     1' NST   = ',I5,' NAREA = ',I5,' LDATE = ',3A4,' LVERS = ',I6,/,   PDATA     830
     1' NGENT = ',I5,' NGENXT= ',I5,' MXSTN = ',I5,' LFLAST= ',I5/)     PDATA     831
 1040 FORMAT (/1X,'DEBUG (DBHEAD) STATION NAME, REC ',I3,/,             PDATA     832
     +(7('[',3A4,']')))                                                 PDATA     833
 2000 FORMAT (16I5)                                                     PDATA     834
 2010 FORMAT (I5,1X,A4,3I5,3A4,A4,F10.5)                                PDATA     835
 2020 FORMAT(1X,'[DEBUG PDATA-Read from data bank] ')                   PDATA     836
 2022 FORMAT(1X,'[DEBUG PDATA-Filling TDDAT] ')                         PDATA     837
 2030 FORMAT (8F10.5)                                                   PDATA     838
 2060 FORMAT (1X,'* * * *ERROR IN SATURATION DATA GEN=',I4,1X,' ID=',A4,PDATA     839
     +1X,'ISATX=',I4,' * * *')                                          PDATA     840
 2080 FORMAT (1X,'* * * ERROR IN MULTI-MASS SYSTEM FOR GEN. NO.=',I5    PDATA     841
     &,1X,'CKID=',A4,' CHECK MASSN',I4)                                 PDATA     842
 2090 FORMAT(' *** ERROR IN PRIME MOVER'' DATA, GOVERNOR TYPE ',I2      PDATA     843
     *,' NOT RECOGNIZED FOR GEN.')                                      PDATA     844
 2100 FORMAT(' *** ERROR IN PRIME MOVER'' DATA FOR GEN. ')              PDATA     845
 2101 FORMAT(11X,'GOVERNOR TYPE=',I2                                    PDATA     846
     *,'LP TURBINE REPRESENTATION WITH NO HP TURBINE')                  PDATA     847
 2102 FORMAT(11X,'REPRESENTED IS NOT ALLOWED')                          PDATA     848
 2120 FORMAT (1X,'IN DGEDAT',1X,'IEXX',I5                               PDATA     849
     &,'JTLN',I5,'JEX(JNT)',I5,'NT',I5)                                 PDATA     850
 2180 FORMAT(1X,'* * * DATA ERROR GENERTOR BUS#',I5,' GID',A4,          PDATA     851
     &' HAS EQUAL X''D AND X"D OF',G12.4                                PDATA     852
     &,' AND NON ZERO T"DO OF',G12.4)                                   PDATA     853
 2190 FORMAT(1X,'* * * DATA ERROR GENERTOR BUS#',I5,' GID',A4,          PDATA     854
     &' HAS EQUAL X''Q AND X"Q OF',G12.4                                PDATA     855
     &,' AND NON ZERO T"QO OF',G12.4)                                   PDATA     856
 2240 FORMAT(1X,'DB-DGEDAT_NEW:JTLN,TDDAT+5,WOBASE ',I5,2G12.5)         PDATA     857
 2250 FORMAT(1X,'* * * DATA ERROR GENERTOR BUS',A12,' GID',A4,          PDATA     858
     &' HAS EQUAL X''D AND X"D OF',G12.4                                PDATA     859
     &,' AND NON ZERO T"DO OF',G12.4)                                   PDATA     860
 2260 FORMAT(1X,'* * * DATA ERROR GENERTOR BUS',A12,' GID',A4,          PDATA     861
     &' HAS EQUAL X''Q AND X"Q OF',G12.4                                PDATA     862
     &,' AND NON ZERO T"QO OF',G12.4)                                   PDATA     863
 2270 FORMAT (1X,'* * * *ERROR IN SATURATION DATA GEN=',A12             PDATA     864
     &,1X,' ID=',A4,1X,'ISATX=',I4,' * * *')                            PDATA     865
 2280 FORMAT (1X,'* * * ERROR IN MULTI-MASS SYSTEM FOR GEN.=',A12       PDATA     866
     &,1X,'CKID=',A4,' CHECK MASSN',I4)                                 PDATA     867
 2320 FORMAT (8F10.5)                                                   PDATA     868
 2330 FORMAT(' *** DATA ERROR FOR GENERATOR')                           PDATA     869
 2331 FORMAT(11X                                                        PDATA     870
     *,'STABILIZER REMOTE SENSING BUS IS NOT IN THE BASED LOADFLOW')    PDATA     871
 2340 FORMAT(' *** READ ERROR AT THE CARD:')                            PDATA     872
 2341 FORMAT(10X                                                        PDATA     873
     *,'THIS IS THE FIRST CARD OF THE DETAIL MACHINE LAST READ:')       PDATA     874
      END                                                               PDATA     875
C                                                                       PDATA     876
C  ===================================================================  PDATA     877
      SUBROUTINE DBEXC(IUD6,IEXX,EXC)                                   PDATA     878
CD                                                                      PDATA     879
CD    TO WRITE (FOR DEBUGGING PURPOSE) EXCITER DATA FROM DATA BASE.     PDATA     880
CD                                                                      PDATA     881
      INTEGER ISTBBB(*)                                                 PDATA     882
      REAL EXS(*),EXF(*),EXU(*),EXC(*)                                  PDATA     883
      REAL GVN(*),CCV(*),CIV(*),CSC(*),GSTAB(*)                         PDATA     884
C                                                                       PDATA     885
      IF (IEXX.EQ.0) RETURN                                             PDATA     886
C                                                                       PDATA     887
      K=24                                                              PDATA     888
      IF ((IEXX.EQ.4).OR.(IEXX.EQ.6).OR.(IEXX.EQ.30).OR.                PDATA     889
     1       (IEXX.EQ.8)) K=26                                          PDATA     890
      IF (IEXX.EQ.5) K=25                                               PDATA     891
      IF (IEXX.EQ.12) K=31                                              PDATA     892
      WRITE (IUD6,3300) (EXC(L),L=1,K)                                  PDATA     893
C                                                                       PDATA     894
      RETURN                                                            PDATA     895
C                                                                       PDATA     896
      ENTRY DBSTAB(IUD6,ISTABX,IFLTN,IUALN,ISTBBB,EXS,EXF,EXU)          PDATA     897
CD                                                                      PDATA     898
CD    TO WRITE (FOR DEBUGGING PURPOSE) STABILIZER DATA FROM DATA BASE.  PDATA     899
CD                                                                      PDATA     900
      IF (ISTABX.EQ.0) RETURN                                           PDATA     901
C                                                                       PDATA     902
      K=18                                                              PDATA     903
      KK=2                                                              PDATA     904
C         ................................................              PDATA     905
C         :ISTAB=1,4                                       :            PDATA     906
      IF((ISTABX.EQ.1).OR.(ISTABX.EQ.4)) K=11                           PDATA     907
C         :..............................................:              PDATA     908
C         ................................................              PDATA     909
C         :ISTAB=10                                        :            PDATA     910
      IF(ISTABX.EQ.10) K=15                                             PDATA     911
C         :..............................................:              PDATA     912
C         ................................................              PDATA     913
C         :ISTAB=11                                        :            PDATA     914
      IF(ISTABX.EQ.11) K=25                                             PDATA     915
C         :..............................................:              PDATA     916
C                                                                       PDATA     917
      IF(ISTABX.EQ.7.OR.ISTABX.EQ.8.OR.ISTABX.GT.11) GOTO 10            PDATA     918
C                                                                       PDATA     919
      IF (ISTABX.EQ.9) THEN                                             PDATA     920
C         ................................................              PDATA     921
C         :ISTAB=9                                         :            PDATA     922
         WRITE(IUD6,'(5I5)') ISTBBB(19),ISTBBB(20),                     PDATA     923
     1         ISTBBB(11),ISTBBB(12),ISTBBB(13)                         PDATA     924
C         :..............................................:              PDATA     925
      ELSE                                                              PDATA     926
         WRITE(IUD6,'(2I5)') ISTBBB(19),ISTBBB(20)                      PDATA     927
      ENDIF                                                             PDATA     928
C                                                                       PDATA     929
      WRITE (IUD6,3300) (EXS(LJ),LJ=1,K)                                PDATA     930
C         ................................................              PDATA     931
C         :FILTER                                        :              PDATA     932
  10  IF (IFLTN.NE.0) WRITE (IUD6,3300) (EXF(L),L=1,9)                  PDATA     933
C         :..............................................:              PDATA     934
C         ................................................              PDATA     935
C         :IUALN                                         :              PDATA     936
      IF (IUALN.NE.0) WRITE (IUD6,3300) (EXU(L),L=1,16)                 PDATA     937
C         :..............................................:              PDATA     938
C                                                                       PDATA     939
      RETURN                                                            PDATA     940
C                                                                       PDATA     941
      ENTRY DBGOV(IUD6,IGVN,IGSTAN,GVN,CCV,CIV,CSC,GSTAB)               PDATA     942
CD                                                                      PDATA     943
CD    TO WRITE (FOR DEBUGGING PURPOSE) PRIME MOVER DATA FROM DATA BASE. PDATA     944
CD                                                                      PDATA     945
         IF ((IGVN.EQ.1).OR.(IGVN.EQ.2).OR.(IGVN.EQ.3)) THEN            PDATA     946
            WRITE (IUD6,3300) (GVN(L),L=1,12)                           PDATA     947
            WRITE (IUD6,3300) (CCV(L),L=1,16)                           PDATA     948
            WRITE (IUD6,3300) 0.0,0.0,0.0,0.0                           PDATA     949
            WRITE (IUD6,3300) (CIV(L),L=1,16)                           PDATA     950
            WRITE (IUD6,3300) 0.0,0.0,0.0,0.0                           PDATA     951
            WRITE (IUD6,3300) (CSC(L),L=1,16)                           PDATA     952
         ENDIF                                                          PDATA     953
C       :...............................................:               PDATA     954
                                                                        PDATA     955
C       .................................................               PDATA     956
C       :GOV 4                                          :               PDATA     957
         IF (IGVN.EQ.4)THEN                                             PDATA     958
            WRITE (IUD6,3300) (CSC(L),L=1,16)                           PDATA     959
         ENDIF                                                          PDATA     960
C       :...............................................:               PDATA     961
                                                                        PDATA     962
C       .................................................               PDATA     963
C       :GOV 5                                          :               PDATA     964
         IF (IGVN.EQ.5)THEN                                             PDATA     965
            WRITE (IUD6,3300) (CSC(L),L=1,4)                            PDATA     966
         ENDIF                                                          PDATA     967
C       :...............................................:               PDATA     968
C       .................................................               PDATA     969
C       :GOV 6                                          :               PDATA     970
         IF (IGVN.EQ.6)THEN                                             PDATA     971
            WRITE (IUD6,3300) (CSC(L),L=1,7)                            PDATA     972
         ENDIF                                                          PDATA     973
C       :...............................................:               PDATA     974
C       .................................................               PDATA     975
C       :GOV 7                                          :               PDATA     976
         IF (IGVN.EQ.7)THEN                                             PDATA     977
            WRITE (IUD6,3300) (CSC(L),L=1,10)                           PDATA     978
         ENDIF                                                          PDATA     979
C       :...............................................:               PDATA     980
C       .................................................               PDATA     981
C       :GOV 8                                          :               PDATA     982
         IF (IGVN.EQ.8)THEN                                             PDATA     983
            WRITE (IUD6,3300) (CSC(L),L=1,16)                           PDATA     984
         ENDIF                                                          PDATA     985
C       :...............................................:               PDATA     986
C       ................................................                PDATA     987
C       :GOV 10                                        :                PDATA     988
         IF (IGVN.EQ.10) THEN                                           PDATA     989
            WRITE (IUD6,3300) (CSC(L),L=1,8)                            PDATA     990
            WRITE (IUD6,3300) (CSC(L),L=9,14),0.0,0.0                   PDATA     991
            WRITE (IUD6,3300) (CSC(L),L=17,21)                          PDATA     992
         ENDIF                                                          PDATA     993
C       :...............................................:               PDATA     994
C       ................................................                PDATA     995
C       :GOV 20                                        :                PDATA     996
         IF (IGVN.EQ.20) THEN                                           PDATA     997
            WRITE (IUD6,3300) (CSC(L),L=1,16)                           PDATA     998
         ENDIF                                                          PDATA     999
C       :...............................................:               PDATA    1000
C       ................................................                PDATA    1001
C       :GOV 22                                        :                PDATA    1002
      IF (IGVN.EQ.21.OR.IGVN.EQ.22)                                     PDATA    1003
     *   WRITE (IUD6,3300) (CSC(L),L=1,11)                              PDATA    1004
C       :...............................................:               PDATA    1005
C       .................................................               PDATA    1006
C       :GSTAB                                          :               PDATA    1007
      IF (IGSTAN.NE.0) WRITE (IUD6,3300) (GSTAB(L),L=1,6)               PDATA    1008
C       :...............................................:               PDATA    1009
      RETURN                                                            PDATA    1010
C                                                                       PDATA    1011
 3300 FORMAT (8F10.5)                                                   PDATA    1012
C                                                                       PDATA    1013
      END                                                               PDATA    1014
C                                                                       PDATA    1015
C  ==================================================================== PDATA    1016
      SUBROUTINE REFILS                                                 PDATA    1017
     *(LCARD,NTYPE,MCMOD,IMODE,IVTN,ILNN,IFVN,ICBRN)                    PDATA    1018
CD                                                                      PDATA    1019
CD    TO READ DATA FROM DYNAMIC MODEL DATA BASE.                        PDATA    1020
CD                                                                      PDATA    1021
      INCLUDE 'PARX.INS'                                                PDATA    1022
      INCLUDE 'CNPBK.INS'                                               PDATA    1023
      INCLUDE 'CNUNIT.INS'                                              PDATA    1024
      INCLUDE 'CNLUN.INS'                                               PDATA    1025
      INCLUDE 'CNMSG.INS'                                               PDATA    1026
      INCLUDE 'PTIP1.INS'                                               PDATA    1027
C                                                                       PDATA    1028
      DIMENSION IBUFR(125),BUFR(125),INDEX(5,25),INDEXC(5,25),          PDATA    1029
     1ITBUF(128),TBUF(128)                                              PDATA    1030
      EQUIVALENCE (IBUFR,BUFR),(INDEX(1,1),IBUFR(1))                    PDATA    1031
      EQUIVALENCE (TBUF,ITBUF)                                          PDATA    1032
      EQUIVALENCE (INDEX(1,1),INDEXC(1,1))                              PDATA    1033
C                                                                       PDATA    1034
      CHARACTER*40 LCARD(2)                                             PDATA    1035
      CHARACTER*4 LDATE(3)                                              PDATA    1036
      CHARACTER*4 INDEXC                                                PDATA    1037
      CHARACTER*1 C,MCMOD                                               PDATA    1038
C                                                                       PDATA    1039
C STATION NAME ARRAYS FROM HEAER RECORDS                                PDATA    1040
      CHARACTER*32 FN                                                   PDATA    1041
      CHARACTER*4 LNAME1(MISTN),LNAME2(MISTN),LNAME3(MISTN)             PDATA    1042
C DB-BUFFERS                                                            PDATA    1043
      DIMENSION EXC(J9E1D)                                              PDATA    1044
      DIMENSION EXS(J9S1D),EXF(J9S2D),EXU(J9S3D)                        PDATA    1045
      DIMENSION CGV(J9V1D),CSC(J9V2D),GVN(J9V3D),CCV(J9V4D),            PDATA    1046
     1CIV(J9V5D),GSTAB(J9V6D)                                           PDATA    1047
C                                                                       PDATA    1048
      DATA C/'C'/                                                       PDATA    1049
C                                                                       PDATA    1050
C    .................................................................. PDATA    1051
C    :Read header (only once at start of run)                         : PDATA    1052
      IMODE=0                                                           PDATA    1053
      IF(.NOT.LUNITS(IU21))THEN                                         PDATA    1054
C                                                                       PDATA    1055
C    1.0 OPEN DATABASE FILE                                             PDATA    1056
C                                                                       PDATA    1057
      IKEY=3                                                            PDATA    1058
      FN='SP031:[DYW.STABCONVX]NPCC.DBX'                                PDATA    1059
      LFN=29                                                            PDATA    1060
      JLENG=MLENG                                                       PDATA    1061
      CALL OPENRE(IU21,FN,JLENG,IKEY,ISTAT,LFN)                         PDATA    1062
C                                                                       PDATA    1063
      IF(IKEY.GE.0) GOTO 60                                             PDATA    1064
      WRITE(MSG(1),1020)                                                PDATA    1065
  50  WRITE(MSG(2),2040)                                                PDATA    1066
      CALL PRTMSG(2)                                                    PDATA    1067
      MSG(1)='PDATA: PROBLEM WITH DYNAMIC MODEL DATABANK FILE'          PDATA    1068
      CALL ASTOP(MSG(1),47)                                             PDATA    1069
C                                                                       PDATA    1070
C   ESTABLISH THE FILE ACCESS DIRECTORY ARRAYS                          PDATA    1071
C                                                                       PDATA    1072
  60  CONTINUE                                                          PDATA    1073
      READ (IU21,REC=1,IOSTAT=IOS) NST,NAREA,LDATE,LVERS,NGENT,         PDATA    1074
     1       NGENXT,MXSTN,LFLAST                                        PDATA    1075
      IF(IOS.NE.0) GOTO 50                                              PDATA    1076
C                                                                       PDATA    1077
      LFNO1=1+(LFLAST+63)/64                                            PDATA    1078
      LFPT1=LFNO1+(LFLAST+MLENG-1)/MLENG                                PDATA    1079
      IANA1=LFPT1+(LFLAST+MLENG-1)/MLENG                                PDATA    1080
      IAREC1=IANA1+(MAREA+39)/40                                        PDATA    1081
      IPREC1=IAREC1+(MXSTN+MLENG-1)/MLENG                               PDATA    1082
      IPREC2=IPREC1+1                                                   PDATA    1083
      NAMERC=IPREC1+(MXSTN+39)/40                                       PDATA    1084
C                                                                       PDATA    1085
      LL1=-39                                                           PDATA    1086
      DO 110 K=IPREC2,NAMERC                                            PDATA    1087
        LL1=LL1+40                                                      PDATA    1088
        LL2=MIN((LL1+39),MXSTN)                                         PDATA    1089
        READ(IU21,REC=K,IOSTAT=IOS) (LNAME1(LL),LNAME2(LL),LNAME3(LL),  PDATA    1090
     1  LL=LL1,LL2)                                                     PDATA    1091
        IF(IOS.NE.0) GOTO 50                                            PDATA    1092
C        IF (KDUB.EQ.1) WRITE (IUD6,1040) K,(LNAME1(LL),LNAME2(LL),     PDATA    1093
C     +  LNAME3(LL),LL=LL1,LL2)                                         PDATA    1094
  110 CONTINUE                                                          PDATA    1095
C                                                                       PDATA    1096
         LUNITS(IU21)=.TRUE.                                            PDATA    1097
      ENDIF                                                             PDATA    1098
C    :................................................................: PDATA    1099
C     --------------------                                              PDATA    1100
C     INITIALIZE CONSTANTS                                              PDATA    1101
C     --------------------                                              PDATA    1102
      DO 1 I=1,4                                                        PDATA    1103
         MYES(I)=0                                                      PDATA    1104
 1    CONTINUE                                                          PDATA    1105
                                                                        PDATA    1106
      NWIDX=125                                                         PDATA    1107
      NWGEN=128                                                         PDATA    1108
      NWEXC=128                                                         PDATA    1109
      NWSTAB=128                                                        PDATA    1110
      NWGOV=128                                                         PDATA    1111
C     ------------                                                      PDATA    1112
C     FIND STATION                                                      PDATA    1113
C     ------------                                                      PDATA    1114
      J=0                                                               PDATA    1115
      ILARGE=NST+1                                                      PDATA    1116
C                                                                       PDATA    1117
70    ISMALL=J                                                          PDATA    1118
      GOTO 100                                                          PDATA    1119
80    ILARGE=J                                                          PDATA    1120
C                                                                       PDATA    1121
100   IF (ILARGE.EQ.(ISMALL+1))THEN                                     PDATA    1122
         WRITE (MSG(1),1200)                                            PDATA    1123
         MSG(2)=LCARD(1)//LCARD(2)                                      PDATA    1124
         CALL PRTMSG(2)                                                 PDATA    1125
         IMODE=1                                                        PDATA    1126
         RETURN                                                         PDATA    1127
      ENDIF                                                             PDATA    1128
C                                                                       PDATA    1129
      J=(ILARGE+ISMALL)/2                                               PDATA    1130
      IF (LNAME1(J).LT.JNAME(1)) GOTO 70                                PDATA    1131
      IF (LNAME1(J).GT.JNAME(1)) GOTO 80                                PDATA    1132
      IF (LNAME2(J).LT.JNAME(2)) GOTO 70                                PDATA    1133
      IF (LNAME2(J).GT.JNAME(2)) GOTO 80                                PDATA    1134
      IF (LNAME3(J).LT.JNAME(3)) GOTO 70                                PDATA    1135
      IF (LNAME3(J).GT.JNAME(3)) GOTO 80                                PDATA    1136
C                                                                       PDATA    1137
      LSREC=J+NAMERC                                                    PDATA    1138
C       LSREC IS THE LOCATION OF THE STATION-INDEX RECORD               PDATA    1139
      CALL FMOVE (0,BUFR,BUFR,NWIDX)                                    PDATA    1140
      READ (IU21,REC=LSREC) (IBUFR(L),L=1,NWIDX)                        PDATA    1141
C     ---------                                                         PDATA    1142
C     FIND UNIT                                                         PDATA    1143
C     ---------                                                         PDATA    1144
      LGENR=0                                                           PDATA    1145
      DO 310 J=1,25                                                     PDATA    1146
C       MATCH NAME WITH UNIT NAMES IN THE STATION-INDEX                 PDATA    1147
        IF (INDEXC(1,J).NE.JUNIT) GO TO 310                             PDATA    1148
        LGENR=J                                                         PDATA    1149
        GO TO 320                                                       PDATA    1150
310   CONTINUE                                                          PDATA    1151
      WRITE (MSG(1),1210) JUNIT                                         PDATA    1152
      MSG(2)=LCARD(1)//LCARD(2)                                         PDATA    1153
      CALL PRTMSG(2)                                                    PDATA    1154
      GO TO 610                                                         PDATA    1155
C                                                                       PDATA    1156
 320  CONTINUE                                                          PDATA    1157
      LCODE=INDEX(2,LGENR)                                              PDATA    1158
      IF (LCODE.GT.10000) LCODE=LCODE-10000                             PDATA    1159
      LGN=LCODE/1000                                                    PDATA    1160
      LCODE=LCODE-LGN*1000                                              PDATA    1161
      LEX=LCODE/100                                                     PDATA    1162
      LCODE=LCODE-LEX*100                                               PDATA    1163
      LST=LCODE/10                                                      PDATA    1164
      LGV=LCODE-LST*10                                                  PDATA    1165
C     ----------------------------------                                PDATA    1166
C     ESTABLISH NUMBER OF MODELS ON FILE                                PDATA    1167
C     ----------------------------------                                PDATA    1168
      LREC=INDEX(3,LGENR)-1                                             PDATA    1169
C     LREC IS THE POSITION OF THE RECORD JUST BEFORE THE                PDATA    1170
C              FIRST GENERATOR MODEL RECORD                             PDATA    1171
      IF (IGEN.EQ.0) IGEN=1                                             PDATA    1172
      IF (IGEN.LE.LGN) GO TO 330                                        PDATA    1173
      WRITE (MSG(1),1220) IGEN                                          PDATA    1174
      MSG(2)=LCARD(1)//LCARD(2)                                         PDATA    1175
      CALL PRTMSG(2)                                                    PDATA    1176
      GO TO 610                                                         PDATA    1177
C     -------------------                                               PDATA    1178
C     READ GENERATOR DATA                                               PDATA    1179
C     -------------------                                               PDATA    1180
330   CONTINUE                                                          PDATA    1181
      IF(NTYPE.LE.1)THEN                                                PDATA    1182
         IF(NTYPE.EQ.1)THEN                                             PDATA    1183
            IF(IGEN.LE.0.OR.IGEN.GT.LGN)THEN                            PDATA    1184
C                                                                       PDATA    1185
C   PRINT ERROR MESSAGE                                                 PDATA    1186
C                                                                       PDATA    1187
            ENDIF                                                       PDATA    1188
         ENDIF                                                          PDATA    1189
         JPOS=LREC+IGEN                                                 PDATA    1190
C        JPOS IS THE POSITION OF THE REQUESTED GENERATOR MODEL RECORD   PDATA    1191
         READ (IU21,REC=JPOS) (GNBBB(L),L=1,NWGEN)                      PDATA    1192
C!FLF                                                                   PDATA    1193
         IF(IGNBBB(15).EQ.2) THEN                                       PDATA    1194
C           it's PTI                                                    PDATA    1195
            MYES(1)=1                                                   PDATA    1196
         ENDIF                                                          PDATA    1197
C!                                                                      PDATA    1198
         IGEN=IGNBBB(16)                                                PDATA    1199
         ISATX=IGNBBB(20)                                               PDATA    1200
         IF(IGEN.LT.0)IGEN=IABS(IGEN)                                   PDATA    1201
         IF(ISATX.LT.0)ISATX=IABS(ISATX)                                PDATA    1202
C!                                                                      PDATA    1203
         IF(NTYPE.EQ.1) RETURN                                          PDATA    1204
      ENDIF                                                             PDATA    1205
      LREC=LREC+LGN                                                     PDATA    1206
      IF (MCMOD.EQ.C) GO TO 350                                         PDATA    1207
C     -----------------                                                 PDATA    1208
C     READ EXCITER DATA                                                 PDATA    1209
C     -----------------                                                 PDATA    1210
      IF(IEXX.EQ.0.AND.LEX.EQ.0) GO TO 350                              PDATA    1211
      IF(IEXX.GT.LEX) THEN                                              PDATA    1212
      WRITE (MSG(1),1230) IEXX                                          PDATA    1213
      MSG(2)=LCARD(1)//LCARD(2)                                         PDATA    1214
      CALL PRTMSG(2)                                                    PDATA    1215
        IEXX=0                                                          PDATA    1216
        GO TO 350                                                       PDATA    1217
      END IF                                                            PDATA    1218
      IF(IEXX.EQ.0) IEXX=1                                              PDATA    1219
      IF(NTYPE.LE.0.OR.NTYPE.EQ.2)THEN                                  PDATA    1220
         IF(NTYPE.EQ.2)THEN                                             PDATA    1221
            IF(IEXX.LE.0.OR.IEXX.GT.LEX)THEN                            PDATA    1222
C                                                                       PDATA    1223
C   PRINT ERROR MESSAGE                                                 PDATA    1224
C                                                                       PDATA    1225
            ENDIF                                                       PDATA    1226
         ENDIF                                                          PDATA    1227
         JPOS=LREC+IEXX                                                 PDATA    1228
C!FLF                                                                   PDATA    1229
         READ (IU21,REC=JPOS) (EXBBB(L),L=1,NWEXC)                      PDATA    1230
         MYES(2)=1                                                      PDATA    1231
C!                                                                      PDATA    1232
         IEXX=IEXBBB(16)                                                PDATA    1233
         IF(IEXX.EQ.0)THEN                                              PDATA    1234
            IF(NTYPE.LE.0) GOTO 350                                     PDATA    1235
C  PRINT MESSAGE                                                        PDATA    1236
            RETURN                                                      PDATA    1237
         ENDIF                                                          PDATA    1238
C!                                                                      PDATA    1239
         IF (IEXX.LT.0)IEXX=IABS(IEXX)                                  PDATA    1240
         JOFSET=J9E1P-1                                                 PDATA    1241
         DO 340 I=1,J9E1D                                               PDATA    1242
340      EXC(I)=EXBBB(JOFSET+I)                                         PDATA    1243
         IF(NTYPE.EQ.2) RETURN                                          PDATA    1244
      ENDIF                                                             PDATA    1245
      LREC=LREC+LEX                                                     PDATA    1246
C     --------------------                                              PDATA    1247
C     READ STABILIZER DATA                                              PDATA    1248
C     --------------------                                              PDATA    1249
      IF (ISTABX.EQ.0.AND.LST.EQ.0) GO TO 430                           PDATA    1250
      IF (ISTABX.GT.LST) THEN                                           PDATA    1251
      WRITE (MSG(1),1240) ISTABX                                        PDATA    1252
      MSG(2)=LCARD(1)//LCARD(2)                                         PDATA    1253
      CALL PRTMSG(2)                                                    PDATA    1254
        ISTABX=0                                                        PDATA    1255
        GO TO 430                                                       PDATA    1256
      END IF                                                            PDATA    1257
                                                                        PDATA    1258
      IF (ISTABX.EQ.0) ISTABX=1                                         PDATA    1259
      JPOS=LREC+ISTABX                                                  PDATA    1260
C!FLF                                                                   PDATA    1261
      CALL FMOVE (0,STBBB,STBBB,NWSTAB)                                 PDATA    1262
      READ (IU21,REC=JPOS) (STBBB(L),L=1,NWSTAB)                        PDATA    1263
      MYES(3)=1                                                         PDATA    1264
C!      IF(ISTBBB(15).EQ.2) GOTO 430                                    PDATA    1265
C!                                                                      PDATA    1266
      ISTABX=ISTBBB(16)                                                 PDATA    1267
      IUALN=ISTBBB(18)                                                  PDATA    1268
      IFLTN=ISTBBB(17)                                                  PDATA    1269
C!                                                                      PDATA    1270
      IF(ISTABX.LT.0)ISTABX=IABS(ISTABX)                                PDATA    1271
      IF(IUALN.LT.0)IUALN=IABS(IUALN)                                   PDATA    1272
      IF(IFLTN.LT.0)IFLTN=IABS(IFLTN)                                   PDATA    1273
                                                                        PDATA    1274
      JOFSET=J9S1P-1                                                    PDATA    1275
      DO 400 I=1,J9S1D                                                  PDATA    1276
        EXS(I)=STBBB(JOFSET+I)                                          PDATA    1277
400   CONTINUE                                                          PDATA    1278
                                                                        PDATA    1279
      JOFSET=J9S2P-1                                                    PDATA    1280
      DO 410 I=1,J9S2D                                                  PDATA    1281
        EXF(I)=STBBB(JOFSET+I)                                          PDATA    1282
410   CONTINUE                                                          PDATA    1283
                                                                        PDATA    1284
      JOFSET=J9S3P-1                                                    PDATA    1285
      DO 420 I=1,J9S3D                                                  PDATA    1286
        EXU(I)=STBBB(JOFSET+I)                                          PDATA    1287
420   CONTINUE                                                          PDATA    1288
                                                                        PDATA    1289
430   LREC=LREC+LST                                                     PDATA    1290
C     ------------------                                                PDATA    1291
C     READ GOVERNOR DATA                                                PDATA    1292
C     ------------------                                                PDATA    1293
      GO TO 440                                                         PDATA    1294
350   LREC=LREC+LEX+LST                                                 PDATA    1295
440   CONTINUE                                                          PDATA    1296
        IF (IGVN.GT.LGV) THEN                                           PDATA    1297
      WRITE (MSG(1),1250) IGVN                                          PDATA    1298
      MSG(2)=LCARD(1)//LCARD(2)                                         PDATA    1299
      CALL PRTMSG(2)                                                    PDATA    1300
          IGVN=0                                                        PDATA    1301
          GO TO 610                                                     PDATA    1302
        END IF                                                          PDATA    1303
C                                                                       PDATA    1304
        IF (IGVN.EQ.0) THEN                                             PDATA    1305
           IF (LGV.EQ.0) RETURN                                         PDATA    1306
           IGVN=1                                                       PDATA    1307
        ENDIF                                                           PDATA    1308
        JPOS=LREC+IGVN                                                  PDATA    1309
C!FLF                                                                   PDATA    1310
        CALL FMOVE (0,GVBBB,GVBBB,NWGOV)                                PDATA    1311
        READ (IU21,REC=JPOS) (GVBBB(L),L=1,NWGOV)                       PDATA    1312
        MYES(4)=1                                                       PDATA    1313
C!        IF(IGVBBB(15).EQ.2) GOTO 610                                  PDATA    1314
C!                                                                      PDATA    1315
        IGVN=IGVBBB(16)                                                 PDATA    1316
        IF (IGVN.EQ.0) GO TO 610                                        PDATA    1317
C!                                                                      PDATA    1318
        ILNN=IGVBBB(17)                                                 PDATA    1319
        IFNN=IGVBBB(18)                                                 PDATA    1320
        IGSTAN=IGVBBB(19)                                               PDATA    1321
C!                                                                      PDATA    1322
        IF (IGVN.LT.0)IGVN=IABS(IGVN)                                   PDATA    1323
        IF (IFNN.LT.0)IFNN=IABS(IFNN)                                   PDATA    1324
        IF (IGSTAN.LT.0)IGSTAN=IABS(IGSTAN)                             PDATA    1325
        IF (IGSTAN.LT.0)IGSTAN=ABS(IGSTAN)                              PDATA    1326
        JOFSET=J9V1P-1                                                  PDATA    1327
        DO 450 I=1,J9V1D                                                PDATA    1328
           CGV(I)=GVBBB(JOFSET+I)                                       PDATA    1329
 450    CONTINUE                                                        PDATA    1330
        JOFSET=J9V2P-1                                                  PDATA    1331
        DO 451 I=1,J9V2D                                                PDATA    1332
          CSC(I)=GVBBB(JOFSET+I)                                        PDATA    1333
 451    CONTINUE                                                        PDATA    1334
        JOFSET=J9V4P-1                                                  PDATA    1335
        DO 460 I=1,J9V4D                                                PDATA    1336
           CCV(I)=GVBBB(JOFSET+I)                                       PDATA    1337
 460    CONTINUE                                                        PDATA    1338
        JOFSET=J9V5P-1                                                  PDATA    1339
        DO 461 I=1,J9V5D                                                PDATA    1340
           CIV(I)=GVBBB(JOFSET+I)                                       PDATA    1341
 461    CONTINUE                                                        PDATA    1342
        JOFSET=J9V6P-1                                                  PDATA    1343
        DO 470 I=1,J9V6D                                                PDATA    1344
           GSTAB(I)=GVBBB(JOFSET+I)                                     PDATA    1345
 470    CONTINUE                                                        PDATA    1346
        JOFSET=J9V3P-1                                                  PDATA    1347
        DO 480 I=1,J9V3D                                                PDATA    1348
           GVN(I)=GVBBB(JOFSET+I)                                       PDATA    1349
 480    CONTINUE                                                        PDATA    1350
        GO TO 610                                                       PDATA    1351
C                                                                       PDATA    1352
C     ------                                                            PDATA    1353
610   RETURN                                                            PDATA    1354
C     ------                                                            PDATA    1355
 1020 FORMAT(' *** File open error reported by OS. '                    PDATA    1356
     1,'Check the file name and try again.')                            PDATA    1357
 1200 FORMAT(' *** GENERATOR IS NOT IN THE DATABASE')                   PDATA    1358
 1210 FORMAT(' *** GENERATOR ',A4,' UNIT NOT FOUND IN THE DATA BASE')   PDATA    1359
 1220 FORMAT(' *** GENERATOR MODEL',I3,' NOT IN THE DATA BASE')         PDATA    1360
 1230 FORMAT(' *** GENERATOR EXCITER MODEL',I3,' NOT IN THE DATA BASE') PDATA    1361
 1240 FORMAT(' *** GENERATOR STABILIZER MODEL',I3                       PDATA    1362
     *,' NOT IN THE DATA BASE')                                         PDATA    1363
 1250 FORMAT(' *** GENERATOR GOVERNOR MODEL',I3                         PDATA    1364
     *,' NOT IN THE DATA BASE')                                         PDATA    1365
 2040 FORMAT(' *** ERROR READING HEADER INFORMATION FROM DATABANK.')    PDATA    1366
C                                                                       PDATA    1367
      END                                                               PDATA    1368
