CFPRIME ARRESD                                                          ARRESD      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 ARRESD(IUX,IUY,IPOS)                                   ARRESD      3
CD                                                                      ARRESD      4
CD    TO READ IN THE USER SPECIFIED OUTPUT ANALYSIS DATA FILE IN BUS    ARRESD      5
CD    NAME.                                                             ARRESD      6
CD                                                                      ARRESD      7
      INCLUDE 'PARX.INS'                                                ARRESD      8
      INCLUDE 'CNPT.INS'                                                ARRESD      9
      INCLUDE 'CNREC1.INS'                                              ARRESD     10
      INCLUDE 'CNIPTR.INS'                                              ARRESD     11
      INCLUDE 'CNFLAG.INS'                                              ARRESD     12
      INCLUDE 'CNPARX.INS'                                              ARRESD     13
      INCLUDE 'CNMNEW.INS'                                              ARRESD     14
      INCLUDE 'CNMDAT.INS'                                              ARRESD     15
      INCLUDE 'CNREN.INS'                                               ARRESD     16
      INCLUDE 'CNLFDA.INS'                                              ARRESD     17
      INCLUDE 'CNINTE.INS'                                              ARRESD     18
      INCLUDE 'CNRAN.INS'                                               ARRESD     19
      INCLUDE 'CNSTP.INS'                                               ARRESD     20
      INCLUDE 'CNUNIT.INS'                                              ARRESD     21
      INCLUDE 'CNMSG.INS'                                               ARRESD     22
      INCLUDE 'CNFRUN.INS'                                              ARRESD     23
C                                                                       ARRESD     24
      CHARACTER*12 BNAME1,BNAME2,BNAME3,IBLK12,BNAMES(6)                ARRESD     25
      CHARACTER*80 SIMBUF                                               ARRESD     26
      CHARACTER*4 ISEM,ISIDAT(36)                                       ARRESD     27
      CHARACTER*2 UID,UID1                                              ARRESD     28
      CHARACTER*5 EDATA                                                 ARRESD     29
      DIMENSION INVBS(16)                                               ARRESD     30
      CHARACTER*4  CNAME(8),UNAME(5),DCNAME(2)                          ARRESD     31
      INTEGER      KNAME(8)                                             ARRESD     32
      EQUIVALENCE (CNAME(1),KNAME(1),UNAME(1),DCNAME(1))                ARRESD     33
C                                                                       ARRESD     34
      DATA IBLK12/'            '/,EDATA/'EDATA'/                        ARRESD     35
      DATA ISIDAT/'AGEO','BGEO','CGEO','GCOS','GOVV','GENS'             ARRESD     36
     &,'GYVA','AMOT','BMOT','ASVO','CONV','UDCO'                        ARRESD     37
     &,'ALOA','LINE','SLIN','MVBS','DVOL'                               ARRESD     38
     &,'UEXC','UPSS','UEXL','UGOV','USVC','URAN','USTC','USPS'          ARRESD     39
     &,'USDB','AFBO','BFBO','CFBO','FFCO','PWRA','PWRB','CANA'          ARRESD     40
     &,'CANB','BWRA',' END'/                                            ARRESD     41
C                                                                       ARRESD     42
C                                                                       ARRESD     43
      LDEB=(JDEB(30).NE.0)                                              ARRESD     44
C                                                                       ARRESD     45
      IF (IUX .EQ. 0) THEN                                              ARRESD     46
        IREC = IFSPTR(IOUTPT)                                           ARRESD     47
      ELSE                                                              ARRESD     48
        JINTER = 0                                                      ARRESD     49
      ENDIF                                                             ARRESD     50
C                                                                       ARRESD     51
      IEBK=0                                                            ARRESD     52
      GOTO 100                                                          ARRESD     53
C                                                                       ARRESD     54
  50  NOPDAT(JPOS)=JITEM                                                ARRESD     55
C                                                                       ARRESD     56
 100  CONTINUE                                                          ARRESD     57
C                                                                       ARRESD     58
      IF (IUX .NE. 0) THEN                                              ARRESD     59
        CALL GETLIN (IUX, SIMBUF)                                       ARRESD     60
      ELSE                                                              ARRESD     61
        IF (IREC .EQ. 0) GOTO 1200                                      ARRESD     62
        READ (IU56, REC = IREC) SIMBUF                                  ARRESD     63
        IREC = INXPTR(IREC)                                             ARRESD     64
      ENDIF                                                             ARRESD     65
C                                                                       ARRESD     66
      READ(SIMBUF,3010) ISEM                                            ARRESD     67
C                                                                       ARRESD     68
      DO 120 JSEM=1,36                                                  ARRESD     69
      IF(ISEM.EQ.ISIDAT(JSEM))GOTO 150                                  ARRESD     70
 120  CONTINUE                                                          ARRESD     71
C                                                                       ARRESD     72
      WRITE(MSG(1),3000) ISEM                                           ARRESD     73
      WRITE(MSG(2),3001)                                                ARRESD     74
      MSG(3)='('//SIMBUF(1:78)//')'                                     ARRESD     75
      CALL PRTMSG(3)                                                    ARRESD     76
      GOTO 100                                                          ARRESD     77
C      SIMBUF='ARRESD DATA BLOCK OUT OF RANGE'                          ARRESD     78
C      CALL ASTOP(SIMBUF,30)                                            ARRESD     79
C                                                                       ARRESD     80
 150  IF(JSEM.EQ.36.AND.IUX.NE.0.AND.IFSPTR(IOUTPT).NE.0)RETURN         ARRESD     81
C                                                                       ARRESD     82
      IPOS=IPOS+2                                                       ARRESD     83
      JPOS=IPOS                                                         ARRESD     84
      NOPDAT(JPOS-1)=JSEM                                               ARRESD     85
      JITEM=0                                                           ARRESD     86
C              1      2      3      4      5      6      7      8      9ARRESD     87
C          'AGEO','BGEO','CGEO','GCOS','GOVV','GENS','GYVA','AMOT','BMOTARRESD     88
      GOTO(  200 ,  200 ,  200 ,  210 ,  210 ,  220 ,  220 ,  210 ,  210ARRESD     89
C         10     11     12     13     14     15     16     17           ARRESD     90
C      'ASVO','CONV','UDCO','ALOA','LINE','SLIN','MVBS','DVOL'          ARRESD     91
     &,  210 ,  400 ,  500 ,  300 ,  700 ,  600 ,  800 ,  900           ARRESD     92
C         18     19     20     21     22     23     24     25     26    ARRESD     93
C      'UEXC','UPSS','UEXL','UGOV','USVC','URAN','USTC','USPS','USDB'   ARRESD     94
     &,  220 ,  220 ,  220 ,  220 ,  355 ,  740 ,  740 ,  740 ,  350    ARRESD     95
C          27     28     29     30     31     32     33    34           ARRESD     96
C      ,'AFBO','BFBO','CFBO','FFCO',,'PWRA','PWRB','CANA','CANB',       ARRESD     97
     &,  210,   210,   210,   210,    210,   210,   210,   210 ,        ARRESD     98
C        35      36                                                     ARRESD     99
C      'BWRA', ' END'                                                   ARRESD    100
     &  210,    1200),JSEM                                              ARRESD    101
C                                                                       ARRESD    102
 200  CONTINUE                                                          ARRESD    103
C                                                                       ARRESD    104
C  READ IN GENERATORS NEED OUTPUTS                                      ARRESD    105
C                                                                       ARRESD    106
C                                                                       ARRESD    107
      IF (IUX .NE. 0) THEN                                              ARRESD    108
        CALL GETLIN (IUX, SIMBUF)                                       ARRESD    109
      ELSE                                                              ARRESD    110
        IF (IREC .EQ. 0) GOTO 1200                                      ARRESD    111
        READ (IU56, REC = IREC) SIMBUF                                  ARRESD    112
        IREC = INXPTR(IREC)                                             ARRESD    113
      ENDIF                                                             ARRESD    114
C                                                                       ARRESD    115
      IF(SIMBUF(1:5).EQ.EDATA) GOTO 50                                  ARRESD    116
      READ(SIMBUF,3020) BNAME1,UID                                      ARRESD    117
     &,BNAME2,BNAME3,IAF,IAT,IZF,IZT,IGMVAF,IGMVAT                      ARRESD    118
      CALL CHKBUS(BNAME1,NLF)                                           ARRESD    119
      NOPDAT(IPOS+1)=NLF                                                ARRESD    120
      CALL PACK(UID,0,ITFK)                                             ARRESD    121
      NOPDAT(IPOS+2)=ITFK                                               ARRESD    122
      IF(LDEB)WRITE(IUD6,3050) IPOS,NLF,BNAME1,UID                      ARRESD    123
     &,NOPDAT(IPOS+1),NOPDAT(IPOS+2)                                    ARRESD    124
      IF(BNAME1.EQ.IBLK12)THEN                                          ARRESD    125
         CALL CHKBUS(BNAME2,IBF)                                        ARRESD    126
         CALL CHKBUS(BNAME3,IBT)                                        ARRESD    127
         NOPDAT(IPOS+1)=-1                                              ARRESD    128
         NOPDAT(IPOS+3)=IAF                                             ARRESD    129
         NOPDAT(IPOS+4)=IAT                                             ARRESD    130
         NOPDAT(IPOS+5)=IZF                                             ARRESD    131
         NOPDAT(IPOS+6)=IZT                                             ARRESD    132
         NOPDAT(IPOS+7)=IBF                                             ARRESD    133
         NOPDAT(IPOS+8)=IBT                                             ARRESD    134
         NOPDAT(IPOS+9)=IGMVAF                                          ARRESD    135
         NOPDAT(IPOS+10)=IGMVAT                                         ARRESD    136
         IPOS=IPOS+10                                                   ARRESD    137
      ELSE                                                              ARRESD    138
         IF(NLF.EQ.0)THEN                                               ARRESD    139
            WRITE(MSG(1),3120) BNAME1,UID                               ARRESD    140
            WRITE(MSG(2),3130)                                          ARRESD    141
            CALL PRTMSG(2)                                              ARRESD    142
         ENDIF                                                          ARRESD    143
         IPOS=IPOS+2                                                    ARRESD    144
      ENDIF                                                             ARRESD    145
      JITEM=JITEM+1                                                     ARRESD    146
      GOTO 200                                                          ARRESD    147
C                                                                       ARRESD    148
C                                                                       ARRESD    149
 210  CONTINUE                                                          ARRESD    150
C                                                                       ARRESD    151
C  READ IN GENERATORS NEED THE CONTROL SIGNALS OR GOVERNOR OUTPUT       ARRESD    152
C  OR LONG TERM POWER PLANT OUTPUTS                                     ARRESD    153
C  READ IN INDUCTION MOTORS AND SVC'S                                   ARRESD    154
C                                                                       ARRESD    155
      IF (IUX .NE. 0) THEN                                              ARRESD    156
        CALL GETLIN (IUX, SIMBUF)                                       ARRESD    157
      ELSE                                                              ARRESD    158
        IF (IREC .EQ. 0) GOTO 1200                                      ARRESD    159
        READ (IU56, REC = IREC) SIMBUF                                  ARRESD    160
        IREC = INXPTR(IREC)                                             ARRESD    161
      ENDIF                                                             ARRESD    162
C                                                                       ARRESD    163
      IF(SIMBUF(1:5).EQ.EDATA) GOTO 50                                  ARRESD    164
      READ(SIMBUF,3020) BNAME1,UID                                      ARRESD    165
      CALL CHKBUS(BNAME1,NLF)                                           ARRESD    166
      NOPDAT(IPOS+1)=NLF                                                ARRESD    167
      CALL PACK(UID,0,ITFK)                                             ARRESD    168
      NOPDAT(IPOS+2)=ITFK                                               ARRESD    169
      IF(LDEB)WRITE(IUD6,3050) IPOS,NLF,BNAME1,UID                      ARRESD    170
     &,NOPDAT(IPOS+1),NOPDAT(IPOS+2)                                    ARRESD    171
         IF(NLF.EQ.0)THEN                                               ARRESD    172
            WRITE(MSG(1),3120) BNAME1,UID                               ARRESD    173
            WRITE(MSG(2),3130)                                          ARRESD    174
            CALL PRTMSG(2)                                              ARRESD    175
         ENDIF                                                          ARRESD    176
      IPOS=IPOS+2                                                       ARRESD    177
      JITEM=JITEM+1                                                     ARRESD    178
      GOTO 210                                                          ARRESD    179
C                                                                       ARRESD    180
 220  CONTINUE                                                          ARRESD    181
C                                                                       ARRESD    182
C  READ IN GENERATORS NEED THE STATES OR GYVA OUTPUT                    ARRESD    183
C                                                                       ARRESD    184
C                                                                       ARRESD    185
      IF (IUX .NE. 0) THEN                                              ARRESD    186
        CALL GETLIN (IUX, SIMBUF)                                       ARRESD    187
      ELSE                                                              ARRESD    188
        IF (IREC .EQ. 0) GOTO 1200                                      ARRESD    189
        READ (IU56, REC = IREC) SIMBUF                                  ARRESD    190
        IREC = INXPTR(IREC)                                             ARRESD    191
      ENDIF                                                             ARRESD    192
C                                                                       ARRESD    193
      IF(SIMBUF(1:5).EQ.EDATA) GOTO 50                                  ARRESD    194
      READ(SIMBUF,3080) BNAME1,UID,(INVBS(N),N=1,5)                     ARRESD    195
      CALL CHKBUS(BNAME1,NLF)                                           ARRESD    196
      NOPDAT(IPOS+1)=NLF                                                ARRESD    197
      CALL PACK(UID,0,ITFK)                                             ARRESD    198
      NOPDAT(IPOS+2)=ITFK                                               ARRESD    199
         IF(NLF.EQ.0)THEN                                               ARRESD    200
            WRITE(MSG(1),3120) BNAME1,UID                               ARRESD    201
            WRITE(MSG(2),3130)                                          ARRESD    202
            CALL PRTMSG(2)                                              ARRESD    203
         ENDIF                                                          ARRESD    204
C                                                                       ARRESD    205
      KSTCOU=0                                                          ARRESD    206
      DO 230 LK=1,5                                                     ARRESD    207
         NSTNO=INVBS(LK)                                                ARRESD    208
         IF(NSTNO.EQ.0) GOTO 230                                        ARRESD    209
         KSTCOU=KSTCOU+1                                                ARRESD    210
         NOPDAT(IPOS+3+KSTCOU)=NSTNO                                    ARRESD    211
 230  CONTINUE                                                          ARRESD    212
C                                                                       ARRESD    213
      NOPDAT(IPOS+3)=KSTCOU                                             ARRESD    214
      IPOS=IPOS+3+KSTCOU                                                ARRESD    215
      JITEM=JITEM+1                                                     ARRESD    216
      GOTO 220                                                          ARRESD    217
C                                                                       ARRESD    218
 300  CONTINUE                                                          ARRESD    219
C                                                                       ARRESD    220
C   READ IN LOAD OUTPUT SPECIFICATIONS                                  ARRESD    221
C                                                                       ARRESD    222
C                                                                       ARRESD    223
      IF (IUX .NE. 0) THEN                                              ARRESD    224
        CALL GETLIN (IUX, SIMBUF)                                       ARRESD    225
      ELSE                                                              ARRESD    226
        IF (IREC .EQ. 0) GOTO 1200                                      ARRESD    227
        READ (IU56, REC = IREC) SIMBUF                                  ARRESD    228
        IREC = INXPTR(IREC)                                             ARRESD    229
      ENDIF                                                             ARRESD    230
C                                                                       ARRESD    231
      IF(SIMBUF(1:5).EQ.EDATA) GOTO 50                                  ARRESD    232
      READ (SIMBUF,3030) (BNAMES(N),N=1,6)                              ARRESD    233
      DO 320 N=1,6                                                      ARRESD    234
         IF(BNAMES(N).EQ.IBLK12) GOTO 320                               ARRESD    235
         BNAME1=BNAMES(N)                                               ARRESD    236
         CALL CHKBUS(BNAME1,NLF)                                        ARRESD    237
         IF(NLF.EQ.0)THEN                                               ARRESD    238
            WRITE(MSG(1),3300) 'LOAD',BNAME1                            ARRESD    239
            WRITE(MSG(2),3130)                                          ARRESD    240
            CALL PRTMSG(2)                                              ARRESD    241
         ENDIF                                                          ARRESD    242
         IPOS=IPOS+1                                                    ARRESD    243
         JITEM=JITEM+1                                                  ARRESD    244
         NOPDAT(IPOS)=NLF                                               ARRESD    245
 320  CONTINUE                                                          ARRESD    246
      GOTO 300                                                          ARRESD    247
C                                                                       ARRESD    248
 350  CONTINUE                                                          ARRESD    249
C                                                                       ARRESD    250
C  READ IN USDB THAT NEEDS THE BLOCK OUTPUT                             ARRESD    251
C                                                                       ARRESD    252
C                                                                       ARRESD    253
      IF (IUX .NE. 0) THEN                                              ARRESD    254
        CALL GETLIN (IUX, SIMBUF)                                       ARRESD    255
      ELSE                                                              ARRESD    256
        IF (IREC .EQ. 0) GOTO 1200                                      ARRESD    257
        READ (IU56, REC = IREC) SIMBUF                                  ARRESD    258
        IREC = INXPTR(IREC)                                             ARRESD    259
      ENDIF                                                             ARRESD    260
C                                                                       ARRESD    261
      IF(SIMBUF(1:5).EQ.EDATA) GOTO 50                                  ARRESD    262
      READ(SIMBUF,3100) BNAME1,(INVBS(N),N=1,5)                         ARRESD    263
      CALL CHKBUS(BNAME1,NLF)                                           ARRESD    264
      NOPDAT(IPOS+1)=NLF                                                ARRESD    265
C                                                                       ARRESD    266
      KSTCOU=0                                                          ARRESD    267
      DO 360 LK=1,5                                                     ARRESD    268
      NSTNO=INVBS(LK)                                                   ARRESD    269
      IF(NSTNO.EQ.0) GOTO 360                                           ARRESD    270
      KSTCOU=KSTCOU+1                                                   ARRESD    271
      NOPDAT(IPOS+2+KSTCOU)=NSTNO                                       ARRESD    272
 360  CONTINUE                                                          ARRESD    273
C                                                                       ARRESD    274
      NOPDAT(IPOS+2)=KSTCOU                                             ARRESD    275
      IPOS=IPOS+2+KSTCOU                                                ARRESD    276
      JITEM=JITEM+1                                                     ARRESD    277
      GOTO 350                                                          ARRESD    278
 355  CONTINUE                                                          ARRESD    279
C                                                                       ARRESD    280
C  READ IN USVC THAT NEEDS THE BLOCK OUTPUT                             ARRESD    281
C                                                                       ARRESD    282
C                                                                       ARRESD    283
      IF (IUX .NE. 0) THEN                                              ARRESD    284
        CALL GETLIN (IUX, SIMBUF)                                       ARRESD    285
      ELSE                                                              ARRESD    286
        IF (IREC .EQ. 0) GOTO 1200                                      ARRESD    287
        READ (IU56, REC = IREC) SIMBUF                                  ARRESD    288
        IREC = INXPTR(IREC)                                             ARRESD    289
      ENDIF                                                             ARRESD    290
C                                                                       ARRESD    291
      IF(SIMBUF(1:5).EQ.EDATA) GOTO 50                                  ARRESD    292
      READ(SIMBUF,3080) BNAME1,UID,(INVBS(N),N=1,5)                     ARRESD    293
      CALL CHKBUS(BNAME1,NLF)                                           ARRESD    294
      NOPDAT(IPOS+1)=NLF                                                ARRESD    295
C                                                                       ARRESD    296
      KSTCOU=0                                                          ARRESD    297
      DO 365 LK=1,5                                                     ARRESD    298
      NSTNO=INVBS(LK)                                                   ARRESD    299
      IF(NSTNO.EQ.0) GOTO 365                                           ARRESD    300
      KSTCOU=KSTCOU+1                                                   ARRESD    301
      NOPDAT(IPOS+2+KSTCOU)=NSTNO                                       ARRESD    302
 365  CONTINUE                                                          ARRESD    303
      CALL PACK(UID,KSTCOU,ITFK)                                        ARRESD    304
      NOPDAT(IPOS+2)=ITFK                                               ARRESD    305
      IPOS=IPOS+2+KSTCOU                                                ARRESD    306
      JITEM=JITEM+1                                                     ARRESD    307
      GOTO 355                                                          ARRESD    308
C                                                                       ARRESD    309
 400  CONTINUE                                                          ARRESD    310
C                                                                       ARRESD    311
C  READ IN CONVERTERS TO BE OUTPUT                                      ARRESD    312
C                                                                       ARRESD    313
C                                                                       ARRESD    314
      IF (IUX .NE. 0) THEN                                              ARRESD    315
        CALL GETLIN (IUX, SIMBUF)                                       ARRESD    316
      ELSE                                                              ARRESD    317
        IF (IREC .EQ. 0) GOTO 1200                                      ARRESD    318
        READ (IU56, REC = IREC) SIMBUF                                  ARRESD    319
        IREC = INXPTR(IREC)                                             ARRESD    320
      ENDIF                                                             ARRESD    321
C                                                                       ARRESD    322
      IF(SIMBUF(1:5).EQ.EDATA) GOTO 50                                  ARRESD    323
      READ(SIMBUF,4100) CNAME                                           ARRESD    324
      NOPDAT(IPOS+1)=KNAME(1)                                           ARRESD    325
      NOPDAT(IPOS+2)=KNAME(2)                                           ARRESD    326
      NOPDAT(IPOS+3)=KNAME(3)                                           ARRESD    327
      NOPDAT(IPOS+4)=KNAME(4)                                           ARRESD    328
      NOPDAT(IPOS+5)=KNAME(5)                                           ARRESD    329
      NOPDAT(IPOS+6)=KNAME(6)                                           ARRESD    330
      NOPDAT(IPOS+7)=KNAME(7)                                           ARRESD    331
      NOPDAT(IPOS+8)=KNAME(8)                                           ARRESD    332
      IF(LDEB)WRITE(IUD6,4110) IPOS,CNAME                               ARRESD    333
     &,(NOPDAT(IPOS+KK),KK=1,8)                                         ARRESD    334
      IPOS=IPOS+8                                                       ARRESD    335
      JITEM=JITEM+1                                                     ARRESD    336
      GOTO 400                                                          ARRESD    337
C                                                                       ARRESD    338
 500  CONTINUE                                                          ARRESD    339
C                                                                       ARRESD    340
C  READ IN UDC BLOCKS TO BE OUTPUT                                      ARRESD    341
C                                                                       ARRESD    342
C                                                                       ARRESD    343
      IF (IUX .NE. 0) THEN                                              ARRESD    344
        CALL GETLIN (IUX, SIMBUF)                                       ARRESD    345
      ELSE                                                              ARRESD    346
        IF (IREC .EQ. 0) GOTO 1200                                      ARRESD    347
        READ (IU56, REC = IREC) SIMBUF                                  ARRESD    348
        IREC = INXPTR(IREC)                                             ARRESD    349
      ENDIF                                                             ARRESD    350
C                                                                       ARRESD    351
      IF(SIMBUF(1:5).EQ.EDATA) GOTO 50                                  ARRESD    352
      READ(SIMBUF,4120) UNAME                                           ARRESD    353
      NOPDAT(IPOS+1)=KNAME(1)                                           ARRESD    354
      NOPDAT(IPOS+2)=KNAME(2)                                           ARRESD    355
      NOPDAT(IPOS+3)=KNAME(3)                                           ARRESD    356
      NOPDAT(IPOS+4)=KNAME(4)                                           ARRESD    357
      NOPDAT(IPOS+5)=KNAME(5)                                           ARRESD    358
      IF(LDEB)WRITE(IUD6,4130) IPOS,UNAME                               ARRESD    359
     &,(NOPDAT(IPOS+KK),KK=1,5)                                         ARRESD    360
      IPOS=IPOS+5                                                       ARRESD    361
      JITEM=JITEM+1                                                     ARRESD    362
      GOTO 500                                                          ARRESD    363
C                                                                       ARRESD    364
C  INTERFACE LINE FLOW                                                  ARRESD    365
C                                                                       ARRESD    366
 600  CONTINUE                                                          ARRESD    367
      KITERM=0                                                          ARRESD    368
C                                                                       ARRESD    369
C  READ MONITERED LINE DATA                                             ARRESD    370
C                                                                       ARRESD    371
 610  CONTINUE                                                          ARRESD    372
      NPFLX=NPFL                                                        ARRESD    373
      CALL MLNDAT(IUX,IREC,IEBK)                                        ARRESD    374
      NITEM=NPFL-NPFLX                                                  ARRESD    375
      IF(NITEM.EQ.0)THEN                                                ARRESD    376
         NOPDAT(JPOS)=KITERM                                            ARRESD    377
         GOTO 100                                                       ARRESD    378
      ENDIF                                                             ARRESD    379
      KITERM=KITERM+1                                                   ARRESD    380
      JINTER=JINTER+1                                                   ARRESD    381
      NOPDAT(IPOS+1)=JINTER                                             ARRESD    382
      NOPDAT(IPOS+2)=NITEM                                              ARRESD    383
      IPOS=IPOS+2                                                       ARRESD    384
C                                                                       ARRESD    385
      IF (IUX .NE. 0) THEN                                              ARRESD    386
        CALL GETLIN (IUX, SIMBUF)                                       ARRESD    387
      ELSE                                                              ARRESD    388
        IF (IREC .EQ. 0) GOTO 1200                                      ARRESD    389
        READ (IU56, REC = IREC) SIMBUF                                  ARRESD    390
        IREC = INXPTR(IREC)                                             ARRESD    391
      ENDIF                                                             ARRESD    392
C                                                                       ARRESD    393
      READ(SIMBUF,3070) (KNTERF(LL,JINTER),LL=1,6)                      ARRESD    394
      DO 620 I=NPFLX+1,NPFL                                             ARRESD    395
      IPOS=IPOS+1                                                       ARRESD    396
      NOPDAT(IPOS)=I                                                    ARRESD    397
 620  CONTINUE                                                          ARRESD    398
      GOTO 610                                                          ARRESD    399
C                                                                       ARRESD    400
 700  CONTINUE                                                          ARRESD    401
C                                                                       ARRESD    402
C  READ MONITERED LINE DATA                                             ARRESD    403
C                                                                       ARRESD    404
      NPFLX=NPFL                                                        ARRESD    405
      CALL MLNDAT(IUX,IREC,IEBK)                                        ARRESD    406
      NITEM=NPFL-NPFLX                                                  ARRESD    407
      NOPDAT(JPOS)=NITEM                                                ARRESD    408
      DO 710 I=NPFLX+1,NPFL                                             ARRESD    409
         IPOS=IPOS+1                                                    ARRESD    410
         NOPDAT(IPOS)=I                                                 ARRESD    411
 710  CONTINUE                                                          ARRESD    412
      GOTO 100                                                          ARRESD    413
C                                                                       ARRESD    414
 740  CONTINUE                                                          ARRESD    415
C                                                                       ARRESD    416
C  READ RANI AND USTC AND SPS MONITERING DATA                           ARRESD    417
C                                                                       ARRESD    418
C                                                                       ARRESD    419
      IF (IUX .NE. 0) THEN                                              ARRESD    420
        CALL GETLIN (IUX, SIMBUF)                                       ARRESD    421
      ELSE                                                              ARRESD    422
        IF (IREC .EQ. 0) GOTO 1200                                      ARRESD    423
        READ (IU56, REC = IREC) SIMBUF                                  ARRESD    424
        IREC = INXPTR(IREC)                                             ARRESD    425
      ENDIF                                                             ARRESD    426
C                                                                       ARRESD    427
      IF(SIMBUF(1:5).EQ.EDATA) GOTO 50                                  ARRESD    428
      READ (SIMBUF,3110) BNAME1,BNAME2,UID1,(INVBS(N),N=1,5)            ARRESD    429
      CALL CHKBUS(BNAME1,NLF1)                                          ARRESD    430
      CALL CHKBUS(BNAME2,NLF2)                                          ARRESD    431
C                                                                       ARRESD    432
      IF(JSEM.EQ.23)THEN                                                ARRESD    433
C                                                                       ARRESD    434
C   MATCHING THE RANI                                                   ARRESD    435
C                                                                       ARRESD    436
         DO 2210 ITHDEV=1,NRANI                                         ARRESD    437
            JR=JRDAT(ITHDEV)                                            ARRESD    438
            NJ=IDDAT(JR+1)                                              ARRESD    439
            ITFK=IDDAT(JR+3)                                            ARRESD    440
            CALL UNPACK(UID,JJJ,ITFK)                                   ARRESD    441
            IF(IDDAT(JR+1).EQ.NLF1.AND.IDDAT(JR+2).EQ.NLF2              ARRESD    442
     *                            .AND.UID.EQ.UID1) GOTO 750            ARRESD    443
 2210    CONTINUE                                                       ARRESD    444
      ELSE                                                              ARRESD    445
C                                                                       ARRESD    446
C   MATCHING THE USTC AND USPS                                          ARRESD    447
C                                                                       ARRESD    448
         DO 2230 ITHDEV=1,NTCPS                                         ARRESD    449
            JR=JTPDAT(ITHDEV)                                           ARRESD    450
            ITFK=IDDAT(JR+3)                                            ARRESD    451
            CALL UNPACK(UID,JJJ,ITFK)                                   ARRESD    452
            IF(IDDAT(JR+1).EQ.NLF1.AND.IDDAT(JR+2).EQ.NLF2              ARRESD    453
     *                            .AND.UID.EQ.UID1) GOTO 750            ARRESD    454
 2230    CONTINUE                                                       ARRESD    455
      ENDIF                                                             ARRESD    456
      ITHDEV=0                                                          ARRESD    457
C                                                                       ARRESD    458
 750  NOPDAT(IPOS+1)=ITHDEV                                             ARRESD    459
C                                                                       ARRESD    460
      KSTCOU=0                                                          ARRESD    461
      DO 760 LK=1,5                                                     ARRESD    462
      NSTNO=INVBS(LK)                                                   ARRESD    463
      IF(NSTNO.EQ.0) GOTO 760                                           ARRESD    464
      KSTCOU=KSTCOU+1                                                   ARRESD    465
      NOPDAT(IPOS+2+KSTCOU)=NSTNO                                       ARRESD    466
 760  CONTINUE                                                          ARRESD    467
C                                                                       ARRESD    468
      NOPDAT(IPOS+2)=KSTCOU                                             ARRESD    469
      IPOS=IPOS+2+KSTCOU                                                ARRESD    470
      JITEM=JITEM+1                                                     ARRESD    471
      GOTO 740                                                          ARRESD    472
C                                                                       ARRESD    473
 800  CONTINUE                                                          ARRESD    474
C                                                                       ARRESD    475
C  READ MONITERED BUS DATA                                              ARRESD    476
C                                                                       ARRESD    477
      CALL LMOVE(0,JREBUS,NLFBUS)                                       ARRESD    478
      NITEM=0                                                           ARRESD    479
 810  CONTINUE                                                          ARRESD    480
C                                                                       ARRESD    481
      IF (IUX .NE. 0) THEN                                              ARRESD    482
        CALL GETLIN (IUX, SIMBUF)                                       ARRESD    483
      ELSE                                                              ARRESD    484
        IF (IREC .EQ. 0) GOTO 1200                                      ARRESD    485
        READ (IU56, REC = IREC) SIMBUF                                  ARRESD    486
        IREC = INXPTR(IREC)                                             ARRESD    487
      ENDIF                                                             ARRESD    488
C                                                                       ARRESD    489
      IF(SIMBUF(1:5).EQ.EDATA) GOTO 840                                 ARRESD    490
C                                                                       ARRESD    491
      IF(SIMBUF(1:12).EQ.IBLK12)THEN                                    ARRESD    492
         READ(SIMBUF,3090) BNAME1,BNAME2,BNAME3                         ARRESD    493
     &          ,IAF,IAT,IZF,IZT,IKVF,IKVT                              ARRESD    494
C                                                                       ARRESD    495
C   READ IN RANGED BUS                                                  ARRESD    496
C                                                                       ARRESD    497
      CALL CHKBUS(BNAME2,ILFBF)                                         ARRESD    498
      CALL CHKBUS(BNAME3,ILFBT)                                         ARRESD    499
C                                                                       ARRESD    500
C  PROCESS THE RANGED BUS OPTION                                        ARRESD    501
C                                                                       ARRESD    502
C   SET BUS NUMBER RANGE                                                ARRESD    503
C                                                                       ARRESD    504
      IF(ILFBT.LT.ILFBF)THEN                                            ARRESD    505
         I=ILFBF                                                        ARRESD    506
         ILFBF=ILFBT                                                    ARRESD    507
         ILFBT=I                                                        ARRESD    508
      ENDIF                                                             ARRESD    509
      IF(ILFBF.EQ.0)THEN                                                ARRESD    510
         ILFBF=1                                                        ARRESD    511
         ILFBT=LBUSNO                                                   ARRESD    512
      ENDIF                                                             ARRESD    513
C                                                                       ARRESD    514
C   SET AREA GRID                                                       ARRESD    515
C                                                                       ARRESD    516
      IF(IAT.LT.IAF)THEN                                                ARRESD    517
         I=IAF                                                          ARRESD    518
         IAF=IAT                                                        ARRESD    519
         IAT=I                                                          ARRESD    520
      ENDIF                                                             ARRESD    521
      IF(IAF.EQ.0)THEN                                                  ARRESD    522
         IAF=1                                                          ARRESD    523
         IAT=100                                                        ARRESD    524
      ENDIF                                                             ARRESD    525
C                                                                       ARRESD    526
      CALL LMOVE(0,IRAREA,100)                                          ARRESD    527
C                                                                       ARRESD    528
C MULTI AREA                                                            ARRESD    529
C                                                                       ARRESD    530
      DO 816 I=IAF,IAT                                                  ARRESD    531
         IRAREA(I)=.TRUE.                                               ARRESD    532
 816  CONTINUE                                                          ARRESD    533
C                                                                       ARRESD    534
C SET ZONE GRID                                                         ARRESD    535
C                                                                       ARRESD    536
      IF(IZT.LT.IZF)THEN                                                ARRESD    537
         I=IZF                                                          ARRESD    538
         IZF=IZT                                                        ARRESD    539
         IZT=I                                                          ARRESD    540
      ENDIF                                                             ARRESD    541
      IZF=IZF+1                                                         ARRESD    542
      IZT=IZT+1                                                         ARRESD    543
C                                                                       ARRESD    544
      CALL LMOVE(0,IRZONE,100)                                          ARRESD    545
C                                                                       ARRESD    546
      DO 817 I=IZF,IZT                                                  ARRESD    547
         IRZONE(I)=.TRUE.                                               ARRESD    548
 817  CONTINUE                                                          ARRESD    549
C                                                                       ARRESD    550
C   SET KV BASE RANGE                                                   ARRESD    551
C                                                                       ARRESD    552
      IF(IKVT.LT.IKVF)THEN                                              ARRESD    553
         I=IKVF                                                         ARRESD    554
         IKVF=IKVT                                                      ARRESD    555
         IKVT=I                                                         ARRESD    556
      ENDIF                                                             ARRESD    557
      IF(IKVT.EQ.0)THEN                                                 ARRESD    558
         IKVF=-1                                                        ARRESD    559
         IKVT=900                                                       ARRESD    560
      ENDIF                                                             ARRESD    561
C                                                                       ARRESD    562
      DO 818 JJ=1,LBUSNO                                                ARRESD    563
      J=MNEW(JJ)                                                        ARRESD    564
      IF(J.LE.0) GOTO 818                                               ARRESD    565
      JL=J*4                                                            ARRESD    566
      IL=IBAR(JL-1)                                                     ARRESD    567
      CALL UPACKI(IZONE,IBARK,IL)                                       ARRESD    568
      IZONE1=IZONE+1                                                    ARRESD    569
      BASKVX=XBASKV(JL)                                                 ARRESD    570
      IBASKV=INT(BASKVX)                                                ARRESD    571
C                                                                       ARRESD    572
C   WITHIN AREA ZONE AND KV RANGE                                       ARRESD    573
C                                                                       ARRESD    574
      IF(IRZONE(IZONE1).AND.IRAREA(IBARK).AND.                          ARRESD    575
     *   IKVF.LT.IBASKV.AND.IBASKV.LT.IKVT.AND.                         ARRESD    576
     *   ILFBF.LE.JJ.AND.JJ.LE.ILFBT) JREBUS(J)=.TRUE.                  ARRESD    577
 818  CONTINUE                                                          ARRESD    578
C                                                                       ARRESD    579
C   READ IN INDIVIDUAL BUSES                                            ARRESD    580
C                                                                       ARRESD    581
      ELSE                                                              ARRESD    582
C                                                                       ARRESD    583
      READ (SIMBUF,3030) (BNAMES(N),N=1,6)                              ARRESD    584
      DO 830 N=1,6                                                      ARRESD    585
      IF(BNAMES(N).EQ.IBLK12) GOTO 830                                  ARRESD    586
      BNAME1=BNAMES(N)                                                  ARRESD    587
      CALL CHKBUS(BNAME1,NLF)                                           ARRESD    588
      IF(NLF.EQ.0)THEN                                                  ARRESD    589
         WRITE(MSG(1),3200) BNAME1                                      ARRESD    590
         MSG(2)=SIMBUF                                                  ARRESD    591
         CALL PRTMSG(2)                                                 ARRESD    592
         NPBNO=0                                                        ARRESD    593
      ELSE                                                              ARRESD    594
         NPBNO=MNEW(NLF)                                                ARRESD    595
      ENDIF                                                             ARRESD    596
      IF(NPBNO.NE.0)THEN                                                ARRESD    597
         JREBUS(NPBNO)=.TRUE.                                           ARRESD    598
      ELSE                                                              ARRESD    599
         NVBS=NVBS+1                                                    ARRESD    600
         MVBUS(NVBS)=NLF                                                ARRESD    601
         NITEM=NITEM+1                                                  ARRESD    602
         IPOS=IPOS+1                                                    ARRESD    603
         NOPDAT(IPOS)=NLF                                               ARRESD    604
      ENDIF                                                             ARRESD    605
 830  CONTINUE                                                          ARRESD    606
C                                                                       ARRESD    607
      ENDIF                                                             ARRESD    608
      GOTO 810                                                          ARRESD    609
C                                                                       ARRESD    610
C   SET UP MVBUS ARRAY                                                  ARRESD    611
C                                                                       ARRESD    612
 840  DO 850 I=1,NLFBUS                                                 ARRESD    613
      IF(.NOT.JREBUS(I)) GOTO 850                                       ARRESD    614
      NLF=NOLD(I)                                                       ARRESD    615
      NVBS=NVBS+1                                                       ARRESD    616
      MVBUS(NVBS)=NLF                                                   ARRESD    617
      NITEM=NITEM+1                                                     ARRESD    618
      IPOS=IPOS+1                                                       ARRESD    619
      NOPDAT(IPOS)=NLF                                                  ARRESD    620
 850  CONTINUE                                                          ARRESD    621
C                                                                       ARRESD    622
      NOPDAT(JPOS)=NITEM                                                ARRESD    623
      GOTO 100                                                          ARRESD    624
C                                                                       ARRESD    625
 900  CONTINUE                                                          ARRESD    626
C                                                                       ARRESD    627
C  READ IN DC BUS TO BE OUTPUT                                          ARRESD    628
C                                                                       ARRESD    629
C                                                                       ARRESD    630
      IF (IUX .NE. 0) THEN                                              ARRESD    631
        CALL GETLIN (IUX, SIMBUF)                                       ARRESD    632
      ELSE                                                              ARRESD    633
        IF (IREC .EQ. 0) GOTO 1200                                      ARRESD    634
        READ (IU56, REC = IREC) SIMBUF                                  ARRESD    635
        IREC = INXPTR(IREC)                                             ARRESD    636
      ENDIF                                                             ARRESD    637
C                                                                       ARRESD    638
      IF(SIMBUF(1:5).EQ.EDATA) GOTO 50                                  ARRESD    639
      READ(SIMBUF,4140) DCNAME                                          ARRESD    640
      NOPDAT(IPOS+1)=KNAME(1)                                           ARRESD    641
      NOPDAT(IPOS+2)=KNAME(2)                                           ARRESD    642
      IF(LDEB)WRITE(IUD6,4150) IPOS,DCNAME                              ARRESD    643
     &,(NOPDAT(IPOS+KK),KK=1,2)                                         ARRESD    644
      IPOS=IPOS+2                                                       ARRESD    645
      JITEM=JITEM+1                                                     ARRESD    646
      GOTO 900                                                          ARRESD    647
C                                                                       ARRESD    648
 1200 CONTINUE                                                          ARRESD    649
      NOPDAT(JPOS)=0                                                    ARRESD    650
      NOPDAT(JPOS-1)=0                                                  ARRESD    651
      IF(LDEB)WRITE(IUD6,3060) (NOPDAT(KK),KK=1,100)                    ARRESD    652
      IF(IEBK.EQ.0)RETURN                                               ARRESD    653
C                                                                       ARRESD    654
      SIMBUF='ARRESD OUTPUT ANALYSIS DATA ERROR'                        ARRESD    655
      CALL ASTOP(SIMBUF,33)                                             ARRESD    656
C                                                                       ARRESD    657
 3000 FORMAT(' *** WARNING BLOCK DATA GROUP ',A4                        ARRESD    658
     *,' OUT OF RANGE, THE FOLLOWING CARD')                             ARRESD    659
 3001 FORMAT(5X,'HAS BEEN IGNORED, CHECK YOUR DATA KEY WORD.')          ARRESD    660
 3010 FORMAT(1X,A4)                                                     ARRESD    661
 3020 FORMAT(A12,A2,2A12,6I5)                                           ARRESD    662
 3030 FORMAT (6A12)                                                     ARRESD    663
 3050 FORMAT(1X,'ARRESD IPOS=',I4,' NLF=',I4,1X,A12,' UID=',A2          ARRESD    664
     &,' NOPDAT(IPOS+1&2)=',I4,A2)                                      ARRESD    665
 3060 FORMAT(1X,'ROUTINE ARRESD ARRAY NOPDAT',/,(25I4))                 ARRESD    666
 3070 FORMAT(6A4)                                                       ARRESD    667
 3080 FORMAT(A12,A2,5I5)                                                ARRESD    668
 3090 FORMAT(A12,2A12,6I5)                                              ARRESD    669
 3100 FORMAT(A12,5I5)                                                   ARRESD    670
 3110 FORMAT(A12,1X,A12,A2,5I5)                                         ARRESD    671
 3120 FORMAT(' *** WARNING  GENERATOR AT BUS: ',A12,1X,A2,1X,           ARRESD    672
     *' TO BE MONITORED')                                               ARRESD    673
 3130 FORMAT(5X,'CAN NOT BE FOUND.')                                    ARRESD    674
 3200 FORMAT(' *** WARNING MONITERED BUS ',A12                          ARRESD    675
     *,' IS NOT FOUND IN BASE LOAD FLOW')                               ARRESD    676
 3300 FORMAT(' *** WARNING ',A,' AT BUS: ',A12,' TO BE MONITORED')      ARRESD    677
 4100 FORMAT(8A4)                                                       ARRESD    678
 4110 FORMAT(1X,'IPOS=',I5,2('.',8A4,'.'))                              ARRESD    679
 4120 FORMAT(5A4)                                                       ARRESD    680
 4130 FORMAT(1X,'IPOS=',I5,2('.',5A4,'.'))                              ARRESD    681
 4140 FORMAT(2A4)                                                       ARRESD    682
 4150 FORMAT(1X,'IPOS=',I5,2('.',2A4,'.'))                              ARRESD    683
 4160 FORMAT(' *** WARNING  INDUCTION MOTOR: ',A12,' ID: ',A2           ARRESD    684
     *,' TO BE MONITORED')                                              ARRESD    685
 4170 FORMAT(' *** WARNING  SVC: ',A12,' ID: ',A2                       ARRESD    686
     *,' TO BE MONITORED')                                              ARRESD    687
C                                                                       ARRESD    688
      END                                                               ARRESD    689
