CFPRIME FLODA1                                                          FLODA1      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 FLODA1 (LDUMP,LFILE,KDEB,IUX,IEBK)                     FLODA1      3
CD                                                                      FLODA1      4
CD THIS SUBROUTINE READS LOAD FLOW DATA IN PTI, IEEE AND SPECIAL OH     FLODA1      5
CD FORMATS.                                                             FLODA1      6
CD                                                                      FLODA1      7
CD THE LOAD FLOW DATA IS STORED IN THE PROGRAM IN THE FOLLOWING FORM:   FLODA1      8
CD                                                                      FLODA1      9
CD BUS DATA:                                                            FLODA1     10
CD --------                                                             FLODA1     11
CD                                                                      FLODA1     12
CD LET K BE THE LOADFLOW BUS NUMBER A BUS AND JJ=MNEW(K),THEN JJ        FLODA1     13
CD CAN BE USED TO RETRIEVE INFORMATION FROM THE FOLLOWING ARRAYS.       FLODA1     14
CD                                                                      FLODA1     15
CD GMWX(NB*2)  : ARRAY STORES THE GENERATOR REAL AND REACTIVE POWER.    FLODA1     16
CD               IT IS EQUIVALANCE TO ARRAYS GMW AND GMX.               FLODA1     17
CD                                                                      FLODA1     18
CD GMW(JJ+1)   : REAL POWER OF THE GENERATOR IN MW                      FLODA1     19
CD BMX(JJ+2)   : REACTIVE POWER OF THE GENERATOR IN MVAR                FLODA1     20
CD                                                                      FLODA1     21
CD BMWX(NB*4)  : ARRAY STORES THE LOAD BUS INFORMATION. IT IS           FLODA1     22
CD               EQUIVALENCE TO ARRAYS BMW ,BMX,IBAR AND XBASKV.        FLODA1     23
CD                                                                      FLODA1     24
CD BMW(JJ+1)   : REAL POWER IN MW                                       FLODA1     25
CD BMX(JJ+2)   : REACTIVE POWER IN MVAR                                 FLODA1     26
CD IBAR(JJ+3)  : AREA AND ZONE                                          FLODA1     27
CD XBASKV(JJ+4): BASE KV                                                FLODA1     28
CD                                                                      FLODA1     29
CD BUDAT(NB8)  : ARRAY STORES THE BUS INFORMATION. IT IS EQUIVALENCE    FLODA1     30
CD               TO ARRAYS ERBUS,EIBUS,BSTC,RYGR,RIYGR AND NAMES.       FLODA1     31
CD                                                                      FLODA1     32
CD ERBUS(JJ+1) : REAL PART OF BUS VOLTAGE                               FLODA1     33
CD EIBUS(JJ+2) : IMAGINARY PART OF BUS VOLTAGE                          FLODA1     34
CD BSTC(JJ+3)  : SWITCHING SHUNT                                        FLODA1     35
CD RYGR(JJ+4)  : REAL PART OF BUS SHUNT                                 FLODA1     36
CD RIYGR(JJ+5) : IMAGINARY PART OF BUS SHUNT                            FLODA1     37
CD NAMES(JJ+6) : FIRST 4 CHARACTERS OF THE BUS NAME                     FLODA1     38
CD NAMES(JJ+7) : SECOND 4 CHARACTERS OF THE BUS NAME                    FLODA1     39
CD NAMES(JJ+8) : LAST 4 CHARACTERS OF THE BUS NAME                      FLODA1     40
CD                                                                      FLODA1     41
CD                                                                      FLODA1     42
CD BRANCH DATA:                                                         FLODA1     43
CD -----------                                                          FLODA1     44
CD                                                                      FLODA1     45
CD LET N = THE N'TH BRANCH AND  JL = 5*N - 5 ,THEN                      FLODA1     46
CD                                                                      FLODA1     47
CD GBFT(NPL*5)   :  ARRAY STORES THE LINE INFORMATION. IT IS EQUIVALENCEFLODA1     48
CD                  TO ARRAYS LFTB,GA,BA AND BCHG.                      FLODA1     49
CD LFTB(JL+1)  : CIRCUIT ID, IN SERIVE STATUS                           FLODA1     50
CD LFTB(JL+2)  : FROM AND TO BUS NO.                                    FLODA1     51
CD GA(JL+3)    : LINE ADMITTANCE                                        FLODA1     52
CD BA(JL+4)    : LINE SUSCEPTANCE                                       FLODA1     53
CD BCHG(JL+5)  : LINE CHARGING                                          FLODA1     54
CD                                                                      FLODA1     55
CD ITRAN(NTR)    :  ARRAY STORES THE LOAD FLOW BUS NO. TRANSFORMER      FLODA1     56
CD ITRORD(NTR)   :  RESERVE FOR FUTURE USE                              FLODA1     57
CD TRANS(NTRX2)  :  ARRAY STORES THE TRANSFORMER INFORMATION.           FLODA1     58
CD                  IT IS EQUIVALENCE TO ARRAYS RANG AND RATIO          FLODA1     59
CD                                                                      FLODA1     60
CD LET N = THE N'TH TRANFORMER  AND JL = 2*N-2, THEN                    FLODA1     61
CD                                                                      FLODA1     62
CD RATIO(JL+1) : TRANSFORMER ONR                                        FLODA1     63
CD RANG(JL+2)  : PHASE SHIFTER ANGLE                                    FLODA1     64
CD                                                                      FLODA1     65
CD                                                                      FLODA1     66
CD ONRX(NB*9/6) :  ARRAY STORES THE ULTC INFORMATION. IT IS             FLODA1     67
CD                 EQUIVALENCE TO ARRAYS ISCFRM,ISCTO,ISCCID,           FLODA1     68
CD                 ISCCON, ONRMAX,ONRMIN,VOLMAX,VOLMIN AND STEP.        FLODA1     69
CD                                                                      FLODA1     70
CD LET N = THE N'TH ULTC AND  JL = 9*N-9, THEN                          FLODA1     71
CD                                                                      FLODA1     72
CD ISCFRM(JL+1) : FROM-BUS NO.                                          FLODA1     73
CD ISCTO(JL+2)  : TO-BUS NO.                                            FLODA1     74
CD ISCCID(JL+3) : CIRCUIT ID                                            FLODA1     75
CD ISCCON(JL+4) : CONTROL BUS NO.                                       FLODA1     76
CD ONRMAX(JL+5) : MAXIMUM ONR                                           FLODA1     77
CD ONRMIN(JL+6) : MINIMUM ONR                                           FLODA1     78
CD VOLMAX(JL+7) : MAXIMUM ULTC VOLTAGE                                  FLODA1     79
CD VOLMIN(JL+8) : MINUMUM ULTC VOLTAGE                                  FLODA1     80
CD STEP(JL+9)   : ULTC STEP SIZE                                        FLODA1     81
CD                                                                      FLODA1     82
CD CORTBL(220)   : ARRAY STORE THE IMPEDANCE CORRECTION TABLE           FLODA1     83
CD                                                                      FLODA1     84
CD                                                                      FLODA1     85
C                                                                       FLODA1     86
      INCLUDE 'PARX.INS'                                                FLODA1     87
      INCLUDE 'CNPARX.INS'                                              FLODA1     88
      INCLUDE 'CNB19.INS'                                               FLODA1     89
      INCLUDE 'CNMNEW.INS'                                              FLODA1     90
      INCLUDE 'CNIPTR.INS'                                              FLODA1     91
      INCLUDE 'CNLFDA.INS'                                              FLODA1     92
      INCLUDE 'CNSELI.INS'                                              FLODA1     93
      INCLUDE 'CNREC1.INS'                                              FLODA1     94
      INCLUDE 'CNPT.INS'                                                FLODA1     95
      INCLUDE 'CNFLAG.INS'                                              FLODA1     96
      INCLUDE 'CNUNIT.INS'                                              FLODA1     97
      INCLUDE 'GRDC01.INS'                                              FLODA1     98
      INCLUDE 'GRDC03.INS'                                              FLODA1     99
      INCLUDE 'GRPDCS.INS'                                              FLODA1    100
      INCLUDE 'UDCF.INS'                                                FLODA1    101
      INCLUDE 'EPBUS.INS'                                               FLODA1    102
      INCLUDE 'CNULTC.INS'                                              FLODA1    103
      INCLUDE 'CNMSG.INS'                                               FLODA1    104
      INCLUDE 'CNGSRC.INS'                                              FLODA1    105
C                                                                       FLODA1    106
      CHARACTER*50 LFILE                                                FLODA1    107
      CHARACTER*20 STRING                                               FLODA1    108
C                                                                       FLODA1    109
      DIMENSION DCBUF(45),IDCBUF(45)                                    FLODA1    110
      DIMENSION IBUF(20),BUF(20)                                        FLODA1    111
      EQUIVALENCE (IBUF(1),BUF(1)),(IDCBUF(1),DCBUF(1))                 FLODA1    112
      CHARACTER*132 KBUF                                                FLODA1    113
      CHARACTER*4 ICOM4                                                 FLODA1    114
      CHARACTER*3 ICOM3,JCOM3                                           FLODA1    115
      CHARACTER*2 ICOM2,ICKT                                            FLODA1    116
      CHARACTER*4 IBUSN,IBUS,IBUS1,ECHECK,IFNAME(4)                     FLODA1    117
      CHARACTER*12 IAZNAM                                               FLODA1    118
      INTEGER JFNAME(4),JAZNAM(3)                                       FLODA1    119
      EQUIVALENCE (IFNAME(1),JFNAME(1)),(IAZNAM,JAZNAM(1))              FLODA1    120
      INTEGER ISTN2(3)                                                  FLODA1    121
      INTEGER*4 JCKID                                                   FLODA1    122
C                                                                       FLODA1    123
      DIMENSION JDCC(NDCC)                                              FLODA1    124
      CHARACTER*8 NCONV(100),NSRL(100),NAMDC                            FLODA1    125
      LOGICAL FOUND,LDEB1                                               FLODA1    126
C                                                                       FLODA1    127
      DATA ICOM4/',,,,'/,ICOM3/',,,'/,ICOM2/',,'/                       FLODA1    128
      DATA IBUS/'BUS '/,IBUS1/'BRAN'/,ECHECK/'    '/                    FLODA1    129
      DATA IFNAME/'GEN ','INF ','BUS ','    '/                          FLODA1    130
C                                                                       FLODA1    131
      DATA (NCONV(I),I=1,52)/                                           FLODA1    132
     &           'REC01   ',  'INV01   ',  'REC02   ',  'INV02   ',     FLODA1    133
     &           'REC03   ',  'INV03   ',  'REC04   ',  'INV04   ',     FLODA1    134
     &           'REC05   ',  'INV05   ',  'REC06   ',  'INV06   ',     FLODA1    135
     &           'REC07   ',  'INV07   ',  'REC08   ',  'INV08   ',     FLODA1    136
     &           'REC09   ',  'INV09   ',  'REC10   ',  'INV10   ',     FLODA1    137
     &           'REC11   ',  'INV11   ',  'REC12   ',  'INV12   ',     FLODA1    138
     &           'REC13   ',  'INV13   ',  'REC14   ',  'INV14   ',     FLODA1    139
     &           'REC15   ',  'INV15   ',  'REC16   ',  'INV16   ',     FLODA1    140
     &           'REC17   ',  'INV17   ',  'REC18   ',  'INV18   ',     FLODA1    141
     &           'REC19   ',  'INV19   ',  'REC20   ',  'INV20   ',     FLODA1    142
     &           'REC21   ',  'INV21   ',  'REC22   ',  'INV22   ',     FLODA1    143
     &           'REC23   ',  'INV23   ',  'REC24   ',  'INV24   ',     FLODA1    144
     &           'REC25   ',  'INV25   ',  'REC26   ',  'INV26   '/     FLODA1    145
      DATA (NCONV(I),I=53,100)/                                         FLODA1    146
     &           'REC27   ',  'INV27   ',  'REC28   ',  'INV28   ',     FLODA1    147
     &           'REC29   ',  'INV29   ',  'REC30   ',  'INV30   ',     FLODA1    148
     &           'REC31   ',  'INV31   ',  'REC32   ',  'INV32   ',     FLODA1    149
     &           'REC33   ',  'INV33   ',  'REC34   ',  'INV34   ',     FLODA1    150
     &           'REC35   ',  'INV35   ',  'REC36   ',  'INV36   ',     FLODA1    151
     &           'REC37   ',  'INV37   ',  'REC38   ',  'INV38   ',     FLODA1    152
     &           'REC39   ',  'INV39   ',  'REC40   ',  'INV40   ',     FLODA1    153
     &           'REC41   ',  'INV41   ',  'REC42   ',  'INV42   ',     FLODA1    154
     &           'REC43   ',  'INV43   ',  'REC44   ',  'INV44   ',     FLODA1    155
     &           'REC45   ',  'INV45   ',  'REC46   ',  'INV46   ',     FLODA1    156
     &           'REC47   ',  'INV47   ',  'REC48   ',  'INV48   ',     FLODA1    157
     &           'REC49   ',  'INV49   ',  'REC50   ',  'INV50   '/     FLODA1    158
      DATA (NSRL(I),I=1,52)/                                            FLODA1    159
     &           'SRR01   ',  'SRI01   ',  'SRR02   ',  'SRI02   ',     FLODA1    160
     &           'SRR03   ',  'SRI03   ',  'SRR04   ',  'SRI04   ',     FLODA1    161
     &           'SRR05   ',  'SRI05   ',  'SRR06   ',  'SRI06   ',     FLODA1    162
     &           'SRR07   ',  'SRI07   ',  'SRR08   ',  'SRI08   ',     FLODA1    163
     &           'SRR09   ',  'SRI09   ',  'SRR10   ',  'SRI10   ',     FLODA1    164
     &           'SRR11   ',  'SRI11   ',  'SRR12   ',  'SRI12   ',     FLODA1    165
     &           'SRR13   ',  'SRI13   ',  'SRR14   ',  'SRI14   ',     FLODA1    166
     &           'SRR15   ',  'SRI15   ',  'SRR16   ',  'SRI16   ',     FLODA1    167
     &           'SRR17   ',  'SRI17   ',  'SRR18   ',  'SRI18   ',     FLODA1    168
     &           'SRR19   ',  'SRI19   ',  'SRR20   ',  'SRI20   ',     FLODA1    169
     &           'SRR21   ',  'SRI21   ',  'SRR22   ',  'SRI22   ',     FLODA1    170
     &           'SRR23   ',  'SRI23   ',  'SRR24   ',  'SRI24   ',     FLODA1    171
     &           'SRR25   ',  'SRI25   ',  'SRR26   ',  'SRI26   '/     FLODA1    172
      DATA (NSRL(I),I=53,100)/                                          FLODA1    173
     &           'SRR27   ',  'SRI27   ',  'SRR28   ',  'SRI28   ',     FLODA1    174
     &           'SRR29   ',  'SRI29   ',  'SRR30   ',  'SRI30   ',     FLODA1    175
     &           'SRR31   ',  'SRI31   ',  'SRR32   ',  'SRI32   ',     FLODA1    176
     &           'SRR33   ',  'SRI33   ',  'SRR34   ',  'SRI34   ',     FLODA1    177
     &           'SRR35   ',  'SRI35   ',  'SRR36   ',  'SRI36   ',     FLODA1    178
     &           'SRR37   ',  'SRI37   ',  'SRR38   ',  'SRI38   ',     FLODA1    179
     &           'SRR39   ',  'SRI39   ',  'SRR40   ',  'SRI40   ',     FLODA1    180
     &           'SRR41   ',  'SRI41   ',  'SRR42   ',  'SRI42   ',     FLODA1    181
     &           'SRR43   ',  'SRI43   ',  'SRR44   ',  'SRI44   ',     FLODA1    182
     &           'SRR45   ',  'SRI45   ',  'SRR46   ',  'SRI46   ',     FLODA1    183
     &           'SRR47   ',  'SRI47   ',  'SRR48   ',  'SRI48   ',     FLODA1    184
     &           'SRR49   ',  'SRI49   ',  'SRR50   ',  'SRI50   '/     FLODA1    185
C                                                                       FLODA1    186
      LDEB=(JDEB(2).NE.0)                                               FLODA1    187
      LDEB1=(JDEB(250).NE.0)                                            FLODA1    188
C                                                                       FLODA1    189
C     RETURN IF IS A DUMP PICK UP RUN                                   FLODA1    190
C                                                                       FLODA1    191
C      IF(IABS(NCASE).EQ.9999) RETURN                                   FLODA1    192
C                                                                       FLODA1    193
      PI32=3.0*SQRT(2.0)/PII                                            FLODA1    194
      RDC=0.0                                                           FLODA1    195
      SETVL=0.0                                                         FLODA1    196
      DELTI=0.0                                                         FLODA1    197
      MDC=0                                                             FLODA1    198
      VSCHD=0.0                                                         FLODA1    199
      NCONVE=0                                                          FLODA1    200
      NSEL=0                                                            FLODA1    201
      NGSREC=0                                                          FLODA1    202
      IEBK=0                                                            FLODA1    203
      LDUMPO=LDUMP                                                      FLODA1    204
      KCDC=0                                                            FLODA1    205
C                                                                       FLODA1    206
      CALL MOVE(0,MNEWA,MNEWA,JAR)                                      FLODA1    207
      CALL MOVE(0,MNEWZ,MNEWZ,JZN+1)                                    FLODA1    208
C                                                                       FLODA1    209
      REWIND IUX                                                        FLODA1    210
C                                                                       FLODA1    211
      IF(LDUMP.EQ.1) THEN                                               FLODA1    212
C     SINGLE MACHINE INFINITE BUS CASE                                  FLODA1    213
C!      STOP 'SINGLE MACHINE INFINITE BUS CASE NOT ALLOWED FOR ETMSP'   FLODA1    214
       MSG(1)='  *** WARNING NO SINGLE MACHINE INFINITE BUS CASE'       FLODA1    215
       CALL PRTMSG(1)                                                   FLODA1    216
      END IF                                                            FLODA1    217
C                                                                       FLODA1    218
C IF LDUMP=0 . . . . . LOAD FLOW DATA FROM PTI-RAWD FORM,VERSION 17     FLODA1    219
C IF LDUMP=16 . . . . . LOAD FLOW DATA FROM PTI-RAWD FORM,VERSION 16    FLODA1    220
C IF LDUMP=2 . . . . . LOAD FLOW DATA FROM CARDS                        FLODA1    221
C IF LDUMP=3 . . . . . LOAD FLOW DATA FROM IEEE COMMON FORMAT (BUS NUMBEFLODA1    222
C IF LDUMP=4 . . . . . LOAD FLOW DATA FROM IEEE COMMON FORMAT (ALFA NUMEFLODA1    223
C                                                                       FLODA1    224
      ASSIGN 1391 TO I1390                                              FLODA1    225
      ASSIGN 1411 TO I1410                                              FLODA1    226
      ASSIGN 1421 TO I1420                                              FLODA1    227
      IF (LDUMP.EQ.16) THEN                                             FLODA1    228
         ASSIGN 1390 TO I1390                                           FLODA1    229
         ASSIGN 1410 TO I1410                                           FLODA1    230
         ASSIGN 1420 TO I1420                                           FLODA1    231
         LDUMP=0                                                        FLODA1    232
      END IF                                                            FLODA1    233
C                                                                       FLODA1    234
C                                                                       FLODA1    235
CQI      IF(LDUMP.NE.0)GOTO 300                                         FLODA1    236
      IF(LDUMP.NE.0.AND.LDUMP.NE.19)GOTO 300                            FLODA1    237
C                                                                       FLODA1    238
C     READING LOADFLOW IN PTI-RAWD FORM                                 FLODA1    239
C                                                                       FLODA1    240
      READ(IUX,1050) (TEXT(K),K=1,20)                                   FLODA1    241
      READ(IUX,1050) (TEXT(K),K=21,40)                                  FLODA1    242
      READ(IUX,1050) (TEXT(K),K=41,60)                                  FLODA1    243
      STRING=TEXT(1)//TEXT(2)//TEXT(3)//TEXT(4)//TEXT(5)                FLODA1    244
      READ(STRING,*)ICC,BMVA                                            FLODA1    245
C                                                                       FLODA1    246
      LBUSNO=0                                                          FLODA1    247
      NL=0                                                              FLODA1    248
      IPOS=0                                                            FLODA1    249
      NSEL=0                                                            FLODA1    250
      K=0                                                               FLODA1    251
      ITRF=0                                                            FLODA1    252
      MDCLK=0                                                           FLODA1    253
C                                                                       FLODA1    254
C     BUS DATA                                                          FLODA1    255
C                                                                       FLODA1    256
 100  READ(IUX,1060) J,JBSTAJ,BMWK,BMXK,RYGRK,RIYGRK,IBARK,EM           FLODA1    257
     &,ANG,ISTN2(1),ISTN2(2),BASKVX,IZONE,ISTN2(3)                      FLODA1    258
      IF(J.EQ.0) GOTO 130                                               FLODA1    259
      IF(J.GT.N99999)THEN                                               FLODA1    260
      WRITE(MSG(1),1920) J                                              FLODA1    261
      WRITE(MSG(2),1930) N99999                                         FLODA1    262
      CALL PRTMSG(2)                                                    FLODA1    263
      IEBK=1                                                            FLODA1    264
      GOTO 100                                                          FLODA1    265
      ENDIF                                                             FLODA1    266
C      IF(JBSTAJ.EQ.4)GOTO 100                                          FLODA1    267
      IF(MNEW(J).EQ.0) GOTO 110                                         FLODA1    268
      WRITE (MSG(1),1070) J                                             FLODA1    269
      CALL PRTMSG(1)                                                    FLODA1    270
      IEBK=1                                                            FLODA1    271
      GOTO 100                                                          FLODA1    272
  110 CONTINUE                                                          FLODA1    273
      K=K+1                                                             FLODA1    274
      IF(K.LT.NXB) GOTO 120                                             FLODA1    275
      WRITE (MSG(1),1080) NXB                                           FLODA1    276
      WRITE(MSG(2),1081) J                                              FLODA1    277
      CALL PRTMSG(2)                                                    FLODA1    278
      IEBK=1                                                            FLODA1    279
      GOTO 100                                                          FLODA1    280
  120 CONTINUE                                                          FLODA1    281
      IF(JBSTAJ.EQ.3)JBSTAJ=2                                           FLODA1    282
      JBSTAT(K)=JBSTAJ                                                  FLODA1    283
      MNEW(J)=K                                                         FLODA1    284
      NOLD(K)=J                                                         FLODA1    285
      IF(LDEB.AND.K.LT.50)WRITE(IUD6,1060) J,JBSTAJ,BMWK,BMXK,RYGRK     FLODA1    286
     &,RIYGRK,IBARK,EM,ANG,ISTN2(1),ISTN2(2),BASKVX,IZONE,ISTN2(3)      FLODA1    287
      KK=(K-1)*4                                                        FLODA1    288
      XBASKV(KK+4)=BASKVX                                               FLODA1    289
      IF(IBARK.LE.0)IBARK=1                                             FLODA1    290
      IF(IZONE.LE.0)IZONE=1                                             FLODA1    291
      CALL PACKII(IZONE,IBARK,ITFK)                                     FLODA1    292
      IBAR(KK+3)=ITFK                                                   FLODA1    293
      BMW(KK+1)=BMWK                                                    FLODA1    294
      BMX(KK+2)=BMXK                                                    FLODA1    295
      KK=(K-1)*8                                                        FLODA1    296
      NAMES(KK+6)=ISTN2(1)                                              FLODA1    297
      NAMES(KK+7)=ISTN2(2)                                              FLODA1    298
      NAMES(KK+8)=ISTN2(3)                                              FLODA1    299
      ANG=ANG/57.2957                                                   FLODA1    300
      ERBUS(KK+1)=EM*COS(ANG)                                           FLODA1    301
      EIBUS(KK+2)=EM*SIN(ANG)                                           FLODA1    302
      RYGR(KK+4)=RYGRK/BMVA                                             FLODA1    303
      RIYGR(KK+5)=-RIYGRK/BMVA                                          FLODA1    304
      BSTC(KK+3)=0.0                                                    FLODA1    305
      IF(J.GT.LBUSNO)LBUSNO=J                                           FLODA1    306
      GOTO 100                                                          FLODA1    307
C                                                                       FLODA1    308
C     GENERATION DATA                                                   FLODA1    309
C                                                                       FLODA1    310
  130 CONTINUE                                                          FLODA1    311
      NLFBUS=K                                                          FLODA1    312
      CALL FMOVE(0,GMWX,GMWX,NLFBUS*2)                                  FLODA1    313
      CALL MOVE(0,LFGEN,LFGEN,NB/3)                                     FLODA1    314
      CALL MOVE(0,IGENST,IGENST,NB/3)                                   FLODA1    315
      CALL MOVE(0,NSORDE,NSORDE,NB/3)                                   FLODA1    316
C                                                                       FLODA1    317
  140 READ(IUX,1090) J,ICKT,GMWK,GMXK,(BUF(LK),LK=4,6),IBUF(7)          FLODA1    318
     +,(BUF(LK),LK=8,13),ISTAT                                          FLODA1    319
      IF(J.NE.0)THEN                                                    FLODA1    320
      IF(LDEB.AND.K.LT.50)WRITE(IUD6,1090) K,ICKT,GMWK,GMXK             FLODA1    321
     +,(BUF(LK),LK=4,6),IBUF(7),(BUF(LK),LK=8,13),ISTAT                 FLODA1    322
       IF(MNEW(J).NE.0)THEN                                             FLODA1    323
         K=MNEW(J)                                                      FLODA1    324
         IF(JBSTAT(K).NE.4.AND.JBSTAT(K).NE.1.AND.ISTAT.NE.0)THEN       FLODA1    325
           KK=K+K                                                       FLODA1    326
           GMW(KK-1)=GMW(KK-1)+GMWK                                     FLODA1    327
           GMX(KK)=GMX(KK)+GMXK                                         FLODA1    328
         ENDIF                                                          FLODA1    329
         IF(JBSTAT(K).EQ.1)ISTAT=3                                      FLODA1    330
         IF(JBSTAT(K).EQ.4)ISTAT=4                                      FLODA1    331
         CALL ADFGEN(0,KFOUND,NGSREC,J,ICKT,LFGEN,XGEID,NSORDE)         FLODA1    332
         IGENST(NGSREC)=ISTAT                                           FLODA1    333
         GSRCD(1,NGSREC)=GMWK                                           FLODA1    334
         GSRCD(2,NGSREC)=GMXK                                           FLODA1    335
         GSRCD(3,NGSREC)=BUF(8)                                         FLODA1    336
         GSRCD(4,NGSREC)=BUF(9)                                         FLODA1    337
         GSRCD(5,NGSREC)=BUF(10)                                        FLODA1    338
         GSRCD(6,NGSREC)=BUF(11)                                        FLODA1    339
         GSRCD(7,NGSREC)=BUF(12)                                        FLODA1    340
         GSRCD(8,NGSREC)=BUF(13)                                        FLODA1    341
       ELSE                                                             FLODA1    342
       WRITE(MSG(1),1100) J                                             FLODA1    343
       WRITE(MSG(2),1101)                                               FLODA1    344
       CALL PRTMSG(2)                                                   FLODA1    345
       IEBK=1                                                           FLODA1    346
       ENDIF                                                            FLODA1    347
      GOTO 140                                                          FLODA1    348
      ENDIF                                                             FLODA1    349
C                                                                       FLODA1    350
      IF(IBGSTA.NE.0)THEN                                               FLODA1    351
        IBGSTA=-NGSREC                                                  FLODA1    352
        NGSREC=0                                                        FLODA1    353
      ENDIF                                                             FLODA1    354
C                                                                       FLODA1    355
      NL=0                                                              FLODA1    356
      NLINES=0                                                          FLODA1    357
      ITRF=0                                                            FLODA1    358
      ITRF2=0                                                           FLODA1    359
  150 READ(IUX,1370) KBUF                                               FLODA1    360
      IF(LDEB)WRITE(IUD6,1380) KBUF                                     FLODA1    361
      READ(KBUF,I1390)K,J,ICKT,RX,XI,CHG,RAT,RAT2,RAT3,JCOM3            FLODA1    362
      IF(LDEB)WRITE(IUD6,1400) K,JCOM3,ICOM3                            FLODA1    363
      IF(K.NE.0)THEN                                                    FLODA1    364
      IF(JCOM3.EQ.ICOM3)THEN                                            FLODA1    365
      READ(KBUF,I1410)GI,BI,GJ,BJ,ISTAT                                 FLODA1    366
      BUF(1)=0.0                                                        FLODA1    367
      BUF(2)=0.0                                                        FLODA1    368
      ELSE                                                              FLODA1    369
      READ(KBUF,I1420)BUF(1),BUF(2),GI,BI,GJ,BJ,ISTAT                   FLODA1    370
      ENDIF                                                             FLODA1    371
      IF(LDEB.AND.NL.LT.50)WRITE(IUD6,1110) K,J,ICKT,RX,XI,CHG,         FLODA1    372
     +RAT,RAT2,RAT3,BUF(1),BUF(2),GI,BI,GJ,BJ,ISTAT                     FLODA1    373
C                                                                       FLODA1    374
C     DROP OUT OF SERVICE LINE                                          FLODA1    375
C                                                                       FLODA1    376
      IF(ISTAT.EQ.0)GOTO 150                                            FLODA1    377
      J=IABS(J)                                                         FLODA1    378
      NEWJ=MNEW(J)                                                      FLODA1    379
      NEWK=MNEW(K)                                                      FLODA1    380
      IF(NEWJ.EQ.0.OR.NEWK.EQ.0)THEN                                    FLODA1    381
      WRITE(MSG(1),1130) K,J,ICKT                                       FLODA1    382
      CALL PRTMSG(1)                                                    FLODA1    383
      IEBK=1                                                            FLODA1    384
      GOTO 150                                                          FLODA1    385
      ENDIF                                                             FLODA1    386
C                                                                       FLODA1    387
C     DROP:                                                             FLODA1    388
C     LINE CONNECTED BETWEEN OUT OF SERVICE BUS                         FLODA1    389
C                                                                       FLODA1    390
C                                                                       FLODA1    391
      IF(JBSTAT(NEWJ).EQ.4.OR.JBSTAT(NEWK).EQ.4)GOTO 150                FLODA1    392
      NL=NL+1                                                           FLODA1    393
      IF(NL.GT.NXPL)THEN                                                FLODA1    394
      WRITE(MSG(1),1160) K,J,ICKT                                       FLODA1    395
      WRITE(MSG(2),1151) NXPL                                           FLODA1    396
      CALL PRTMSG(2)                                                    FLODA1    397
      IEBK=1                                                            FLODA1    398
      GOTO 150                                                          FLODA1    399
      ENDIF                                                             FLODA1    400
      NLINES=NLINES+5                                                   FLODA1    401
      XSUM=RX**2+XI**2                                                  FLODA1    402
      GAZN=RX/XSUM                                                      FLODA1    403
      BAZN=XI/XSUM                                                      FLODA1    404
      IK=MNEW(K)                                                        FLODA1    405
      IJ=MNEW(J)                                                        FLODA1    406
      CALL PACKII(IK,IJ,ITFK)                                           FLODA1    407
      LFTB(NLINES-3)=ITFK                                               FLODA1    408
      GA(NLINES-2)=GAZN                                                 FLODA1    409
      BA(NLINES-1)=BAZN                                                 FLODA1    410
C                                                                       FLODA1    411
C     ACCOUNTING THE COMPENSATION COMPONENT                             FLODA1    412
C                                                                       FLODA1    413
        IF(GI.NE.0.0.OR.BI.NE.0.0.OR.GJ.NE.0.0.OR.BJ.NE.0.0)THEN        FLODA1    414
C                                                                       FLODA1    415
        NSEL=NSEL+1                                                     FLODA1    416
        JSEL=NSEL                                                       FLODA1    417
        IF(LDEB)WRITE(IUD6,1630) NSEL,K,J,ICKT,GI,BI,GJ,BJ,CHG          FLODA1    418
        IPOS=IPOS+1                                                     FLODA1    419
        LCONE(1,JSEL)=IK                                                FLODA1    420
        LCONE(2,JSEL)=IJ                                                FLODA1    421
        LCONE(3,JSEL)=1                                                 FLODA1    422
        CCONE(4,JSEL)=ICKT                                              FLODA1    423
        LCONE(5,JSEL)=IPOS                                              FLODA1    424
        LCONE(6,JSEL)=1                                                 FLODA1    425
        NEXTSL(1,IPOS)=0                                                FLODA1    426
        CNEXTS(2,IPOS)=ICKT                                             FLODA1    427
        NEXTSL(3,IPOS)=0                                                FLODA1    428
        PSELIN(1,IPOS)=GAZN                                             FLODA1    429
        PSELIN(2,IPOS)=BAZN                                             FLODA1    430
        PSELIN(3,IPOS)=GI                                               FLODA1    431
        PSELIN(4,IPOS)=BI+0.5*CHG                                       FLODA1    432
        PSELIN(5,IPOS)=GJ                                               FLODA1    433
        PSELIN(6,IPOS)=BJ+0.5*CHG                                       FLODA1    434
        EQPI(1,JSEL)=GAZN                                               FLODA1    435
        EQPI(2,JSEL)=BAZN                                               FLODA1    436
        EQPI(3,JSEL)=GI                                                 FLODA1    437
        EQPI(4,JSEL)=BI+0.5*CHG                                         FLODA1    438
        EQPI(5,JSEL)=GJ                                                 FLODA1    439
        EQPI(6,JSEL)=BJ+0.5*CHG                                         FLODA1    440
        EQPI(7,JSEL)=0                                                  FLODA1    441
        EQPI(8,JSEL)=0                                                  FLODA1    442
        EQPI(9,JSEL)=0                                                  FLODA1    443
        EQPI(10,JSEL)=0                                                 FLODA1    444
        EQPI(11,JSEL)=0                                                 FLODA1    445
        EQPI(12,JSEL)=0                                                 FLODA1    446
        CALL PACK(ICKT,JSEL,JCKID)                                      FLODA1    447
        LFTB(NLINES-4)=JCKID                                            FLODA1    448
        BCHG(NLINES)=0.0                                                FLODA1    449
C                                                                       FLODA1    450
        ELSE                                                            FLODA1    451
C                                                                       FLODA1    452
        CALL PACK(ICKT,0,JCKID)                                         FLODA1    453
        LFTB(NLINES-4)=JCKID                                            FLODA1    454
        BCHG(NLINES)=CHG                                                FLODA1    455
C                                                                       FLODA1    456
        ENDIF                                                           FLODA1    457
C                                                                       FLODA1    458
      IF(IBUF(1).NE.0)THEN                                              FLODA1    459
      ITRF=ITRF+1                                                       FLODA1    460
      ITRF2=ITRF2+2                                                     FLODA1    461
      ITRAN(ITRF)=NL                                                    FLODA1    462
      RATIO(ITRF2-1)=BUF(1)                                             FLODA1    463
      RANG(ITRF2)=BUF(2)                                                FLODA1    464
      ENDIF                                                             FLODA1    465
      GOTO 150                                                          FLODA1    466
C                                                                       FLODA1    467
      ENDIF                                                             FLODA1    468
C                                                                       FLODA1    469
C     READING TRANSFORMER ADJUSTMENT DATA                               FLODA1    470
C                                                                       FLODA1    471
      NSC=0                                                             FLODA1    472
      IPSC=0                                                            FLODA1    473
  160 READ(IUX,1370) KBUF                                               FLODA1    474
      IF(LDEB1) WRITE(IUD6,1380) KBUF                                   FLODA1    475
      READ(KBUF,1910) K,J,ICKT,ICONT,RMA,RMI,VMA,VMI,STEPI,NTABLE,ILOCK FLODA1    476
      IF (K.EQ.0) GOTO 161                                              FLODA1    477
         NSC=NSC+1                                                      FLODA1    478
         IPSC=IPSC+9                                                    FLODA1    479
         ISCFRM(IPSC-8)=K                                               FLODA1    480
         ISCTO(IPSC-7)=J                                                FLODA1    481
         IF(ABS(RMA).GE.2.0.OR.ABS(RMI).GE.2.0) THEN                    FLODA1    482
           NTABLE = NTABLE+1000                                         FLODA1    483
         END IF                                                         FLODA1    484
         CALL PACK(ICKT,NTABLE,JCKID)                                   FLODA1    485
         ISCCID(IPSC-6)=JCKID                                           FLODA1    486
         ISCCON(IPSC-5)=ICONT                                           FLODA1    487
         ONRMAX(IPSC-4)=RMA                                             FLODA1    488
         ONRMIN(IPSC-3)=RMI                                             FLODA1    489
         VOLMAX(IPSC-2)=VMA                                             FLODA1    490
         VOLMIN(IPSC-1)=VMI                                             FLODA1    491
         STEP(IPSC) = STEPI                                             FLODA1    492
      GOTO 160                                                          FLODA1    493
C                                                                       FLODA1    494
C     SKIPPING AREA INTERCHANGE DATA                                    FLODA1    495
C                                                                       FLODA1    496
  161 IAZNAM='            '                                             FLODA1    497
      DO 162 K=1,JAR                                                    FLODA1    498
      IARE(K,1)=JAZNAM(1)                                               FLODA1    499
      IARE(K,2)=JAZNAM(2)                                               FLODA1    500
  162 IARE(K,3)=JAZNAM(3)                                               FLODA1    501
      NMAREA=0                                                          FLODA1    502
C                                                                       FLODA1    503
  170 READ(IUX,'(A)') KBUF                                              FLODA1    504
      IF(LDEB)WRITE(IUD6,1440) KBUF                                     FLODA1    505
      READ(KBUF,*) K                                                    FLODA1    506
      IF(K.NE.0)THEN                                                    FLODA1    507
         IF(K.GT.JAR) GOTO 170                                          FLODA1    508
         READ(KBUF,*,IOSTAT=IOS) K,J,F1,F2,IAZNAM                       FLODA1    509
         IF(IOS.NE.0) IAZNAM='            '                             FLODA1    510
C                                                                       FLODA1    511
         NMAREA=NMAREA+1                                                FLODA1    512
         IARE(NMAREA,1)=JAZNAM(1)                                       FLODA1    513
         IARE(NMAREA,2)=JAZNAM(2)                                       FLODA1    514
         IARE(NMAREA,3)=JAZNAM(3)                                       FLODA1    515
         INTARA(NMAREA)=K                                               FLODA1    516
         MNEWA(K)=NMAREA                                                FLODA1    517
C                                                                       FLODA1    518
         GOTO 170                                                       FLODA1    519
      ENDIF                                                             FLODA1    520
C                                                                       FLODA1    521
      IF(NMAREA.EQ.0)THEN                                               FLODA1    522
        NMAREA=1                                                        FLODA1    523
        INTARA(1)=1                                                     FLODA1    524
        MNEWA(1)=1                                                      FLODA1    525
      ENDIF                                                             FLODA1    526
C                                                                       FLODA1    527
C     READ LOAD FLOW DATA-PTI FORMAT FOR 2-TERMINAL DC LINKS            FLODA1    528
C                                                                       FLODA1    529
C     INITIALIZATION                                                    FLODA1    530
C                                                                       FLODA1    531
      NACBUS=0                                                          FLODA1    532
      NUMGRP=0                                                          FLODA1    533
      PABASE=BASPC                                                      FLODA1    534
      PDBASE=BASPC                                                      FLODA1    535
      VDBASE=100.0                                                      FLODA1    536
C                                                                       FLODA1    537
      DO 180 I = 1, NDCC                                                FLODA1    538
      IDC(I) = 0                                                        FLODA1    539
      IDCFRE(I) = 0                                                     FLODA1    540
      IDCNOD(I) = ' '                                                   FLODA1    541
      NODIDX(I) = I                                                     FLODA1    542
      DCCNAM(I) = ' '                                                   FLODA1    543
      DCCNA2(I) = ' '                                                   FLODA1    544
      DCCNMR(I) = ' '                                                   FLODA1    545
      BDIND(I) = .FALSE.                                                FLODA1    546
      BZIND(I) = .FALSE.                                                FLODA1    547
  180 CONTINUE                                                          FLODA1    548
C                                                                       FLODA1    549
      DO 190 I = 1, NDCL                                                FLODA1    550
      IDCL(I) = 0                                                       FLODA1    551
      IDCFRL(I) = 0                                                     FLODA1    552
      DCLNAM(I) = ' '                                                   FLODA1    553
      DCLNMR(I) = ' '                                                   FLODA1    554
  190 CONTINUE                                                          FLODA1    555
C                                                                       FLODA1    556
      DO 200 I = 1, NDCB                                                FLODA1    557
      IDCFRB(I) = 0                                                     FLODA1    558
      IDCB(I) = 0                                                       FLODA1    559
      DCBNAM(I) = ' '                                                   FLODA1    560
      DCBNMR(I) = ' '                                                   FLODA1    561
  200 CONTINUE                                                          FLODA1    562
C                                                                       FLODA1    563
  210 READ(IUX,1370) KBUF                                               FLODA1    564
      IF(LDEB)WRITE(IUD6,1370) KBUF                                     FLODA1    565
      READ(KBUF,1450) K                                                 FLODA1    566
      IF(K.NE.0)THEN                                                    FLODA1    567
         MDCLK=MDCLK+1                                                  FLODA1    568
         MCON1=2*MDCLK-1                                                FLODA1    569
         MCON2=2*MDCLK                                                  FLODA1    570
         ICPT=INDEX(KBUF, ICOM4)                                        FLODA1    571
         IF(LDEB) WRITE(IUD6,1460) ICPT                                 FLODA1    572
         IF(ICPT.NE.0) THEN                                             FLODA1    573
            READ(KBUF,1470) K,MDC,RDC,SETVL,VSCHD,DELTI                 FLODA1    574
            IF(LDEB)WRITE(IUD6,1470) K,MDC,RDC,SETVL,VSCHD,DELTI        FLODA1    575
            VCMOD=0.0                                                   FLODA1    576
            RCOMP=0.0                                                   FLODA1    577
         ELSE                                                           FLODA1    578
            ICPT=INDEX(KBUF, ICOM2)                                     FLODA1    579
            IF(LDEB)WRITE(IUD6,1460) ICPT                               FLODA1    580
            IF(ICPT.EQ.0) THEN                                          FLODA1    581
               READ(KBUF,1480) K,MDC,RDC,SETVL,VSCHD,VCMOD,RCOMP,DELTI  FLODA1    582
               IF(LDEB)WRITE(IUD6,1480) K,MDC,RDC,SETVL,VSCHD           FLODA1    583
     +         ,VCMOD,RCOMP,DELTI                                       FLODA1    584
            ELSE                                                        FLODA1    585
               RCOMP=0.0                                                FLODA1    586
               VCMOD=0.0                                                FLODA1    587
               IF(ICPT.EQ.39)READ(KBUF,1490) K,MDC,RDC,SETVL,VSCHD,RCOMPFLODA1    588
     +         ,DELTI                                                   FLODA1    589
               IF(LDEB)WRITE(IUD6,1490) K,MDC,RDC,SETVL,VSCHD,RCOMP     FLODA1    590
     +         ,DELTI                                                   FLODA1    591
               IF(ICPT.EQ.50)READ(KBUF,1500) K,MDC,RDC,SETVL,VSCHD,VCMODFLODA1    592
     +         ,DELTI                                                   FLODA1    593
               IF(LDEB)WRITE(IUD6,1500) K,MDC,RDC,SETVL,VSCHD,VCMOD     FLODA1    594
     +         ,DELTI                                                   FLODA1    595
            END IF                                                      FLODA1    596
         END IF                                                         FLODA1    597
C                                                                       FLODA1    598
C     READ SECOND LINE(RECTIFIER DATA)                                  FLODA1    599
C                                                                       FLODA1    600
         READ(IUX,1370) KBUF                                            FLODA1    601
         IF(LDEB)WRITE(IUD6,1370) KBUF                                  FLODA1    602
         READ(KBUF,1360) IPR,NBR,AMX,AMN,RCR,XCR,SBASR,TRR,TAPR         FLODA1    603
         IF(LDEB)WRITE(IUD6,1360) IPR,NBR,AMX,AMN,RCR,XCR,SBASR,TRR,TAPRFLODA1    604
         IF(IPR.EQ.0)THEN                                               FLODA1    605
            WRITE(MSG(1),1510)                                          FLODA1    606
            CALL PRTMSG(1)                                              FLODA1    607
         ENDIF                                                          FLODA1    608
C                                                                       FLODA1    609
         IF(MNEW(IPR).EQ.0) THEN                                        FLODA1    610
            WRITE(MSG(1),1600)                                          FLODA1    611
            CALL PRTMSG(1)                                              FLODA1    612
            IF(LDEB)WRITE(IUD6,1140) IPR                                FLODA1    613
            IEBK=1                                                      FLODA1    614
         END IF                                                         FLODA1    615
         JDCC(MCON1)=IPR                                                FLODA1    616
         IF(LDEB)WRITE(IUD6,1520) MDCLK,JDCC(MCON1)                     FLODA1    617
C                                                                       FLODA1    618
C     READ THIRD LINE(INVERTER DATA)                                    FLODA1    619
C                                                                       FLODA1    620
         READ(IUX,1370) KBUF                                            FLODA1    621
         IF(LDEB)WRITE(IUD6,1370) KBUF                                  FLODA1    622
         READ(KBUF,1360) IPI,NBI,GAMX,GMN,RCI,XCI,SBASI,TRI,TAPI        FLODA1    623
         IF(IPI.EQ.0)THEN                                               FLODA1    624
            WRITE(MSG(1),1530)                                          FLODA1    625
            CALL PRTMSG(1)                                              FLODA1    626
         ENDIF                                                          FLODA1    627
         IF(MNEW(IPI).EQ.0)THEN                                         FLODA1    628
            WRITE(MSG(1),1610)                                          FLODA1    629
            CALL PRTMSG(1)                                              FLODA1    630
            IEBK=1                                                      FLODA1    631
         END IF                                                         FLODA1    632
         JDCC(MCON2)=IPI                                                FLODA1    633
         IF(LDEB)WRITE(IUD6,1520) MDCLK,JDCC(MCON2)                     FLODA1    634
C                                                                       FLODA1    635
         IDC(MCON1)=MCON1                                               FLODA1    636
         IDC(MCON2)=MCON2                                               FLODA1    637
         DCCNMR(MCON1)(1:8)=NCONV(MCON1)                                FLODA1    638
         DCCNMR(MCON1)(9:16)='GROUND  '                                 FLODA1    639
         WRITE(KBUF,1690) IPR                                           FLODA1    640
         KBUF(6:10)='     '                                             FLODA1    641
         DO 220 I=1,5                                                   FLODA1    642
         IF(KBUF(I:I).NE.' ') THEN                                      FLODA1    643
            KBUF(6:11-I)=KBUF(I:5)                                      FLODA1    644
            GO TO 225                                                   FLODA1    645
         END IF                                                         FLODA1    646
  220    CONTINUE                                                       FLODA1    647
  225    CONTINUE                                                       FLODA1    648
         DCCNMR(MCON1)(17:24)=KBUF(6:10)                                FLODA1    649
         DCCNMR(MCON1)(25:28)='0.  '                                    FLODA1    650
         DCCNMR(MCON1)(29:29)='1'                                       FLODA1    651
         DCCNMR(MCON2)(1:8)=NCONV(MCON2)                                FLODA1    652
         DCCNMR(MCON2)(9:16)='GROUND  '                                 FLODA1    653
         WRITE(KBUF,1690) IPI                                           FLODA1    654
         KBUF(6:10)='     '                                             FLODA1    655
         DO 230 I=1,5                                                   FLODA1    656
         IF(KBUF(I:I).NE.' ') THEN                                      FLODA1    657
            KBUF(6:11-I)=KBUF(I:5)                                      FLODA1    658
            GO TO 235                                                   FLODA1    659
         END IF                                                         FLODA1    660
  230    CONTINUE                                                       FLODA1    661
  235    CONTINUE                                                       FLODA1    662
         DCCNMR(MCON2)(17:24)=KBUF(6:10)                                FLODA1    663
         DCCNMR(MCON2)(25:28)='0.  '                                    FLODA1    664
         DCCNMR(MCON2)(29:29)='1'                                       FLODA1    665
         IF(LDEB) WRITE(IUD6,1680) DCCNMR(MCON1),DCCNMR(MCON2)          FLODA1    666
C                                                                       FLODA1    667
         BDIND(MCON1)=.TRUE.                                            FLODA1    668
         BDIND(MCON2)=.TRUE.                                            FLODA1    669
         BZIND(MCON1)=.TRUE.                                            FLODA1    670
         BZIND(MCON2)=.TRUE.                                            FLODA1    671
         QINV(MCON1)=.FALSE.                                            FLODA1    672
         QINV(MCON2)=.TRUE.                                             FLODA1    673
C                                                                       FLODA1    674
         VABASE(MCON1)=SBASR                                            FLODA1    675
         VABASE(MCON2)=SBASI                                            FLODA1    676
         IPR=MNEW(IPR)                                                  FLODA1    677
         IPR=IPR*4                                                      FLODA1    678
         IF(ABS(VABASE(MCON1)-XBASKV(IPR)).GT.0.001.AND.LDEB)THEN       FLODA1    679
            WRITE(IUD6,1640) MDCLK,VABASE(MCON1),XBASKV(IPR)            FLODA1    680
         ENDIF                                                          FLODA1    681
         IPI=MNEW(IPI)                                                  FLODA1    682
         IPI=IPI*4                                                      FLODA1    683
         IF(ABS(VABASE(MCON2)-XBASKV(IPI)).GT.0.001.AND.LDEB)           FLODA1    684
     &   WRITE(IUD6,1840) MDCLK,VABASE(MCON2),XBASKV(IPI)               FLODA1    685
         IF(LDEB)WRITE(IUD6,1000) MDCLK,VABASE(MCON1),VABASE(MCON2)     FLODA1    686
C                                                                       FLODA1    687
         TAPNOM(MCON1)=TRR                                              FLODA1    688
         TAPNOM(MCON2)=TRI                                              FLODA1    689
         TAPPOS(MCON1)=1.0/TAPR                                         FLODA1    690
         TAPPOS(MCON2)=1.0/TAPI                                         FLODA1    691
C                                                                       FLODA1    692
         IDCL(5*MDCLK-4)=5*MDCLK-4                                      FLODA1    693
         IDCL(5*MDCLK-3)=5*MDCLK-3                                      FLODA1    694
         IDCL(5*MDCLK-2)=5*MDCLK-2                                      FLODA1    695
         IDCL(5*MDCLK-1)=5*MDCLK-1                                      FLODA1    696
         IDCL(5*MDCLK)=5*MDCLK                                          FLODA1    697
         DCLNMR(5*MDCLK-4)(1:8)=NCONV(MCON1)                            FLODA1    698
         DCLNMR(5*MDCLK-4)(9:16)=NSRL(MCON1)                            FLODA1    699
         DCLNMR(5*MDCLK-4)(17:17)='1'                                   FLODA1    700
         DCLNMR(5*MDCLK-3)(1:8)=NSRL(MCON1)                             FLODA1    701
         DCLNMR(5*MDCLK-3)(9:16)=NSRL(MCON2)                            FLODA1    702
         DCLNMR(5*MDCLK-3)(17:17)='1'                                   FLODA1    703
         DCLNMR(5*MDCLK-2)(1:8)=NSRL(MCON2)                             FLODA1    704
         DCLNMR(5*MDCLK-2)(9:16)=NCONV(MCON2)                           FLODA1    705
         DCLNMR(5*MDCLK-2)(17:17)='1'                                   FLODA1    706
         DCLNMR(5*MDCLK-1)(1:8)=NSRL(MCON1)                             FLODA1    707
         DCLNMR(5*MDCLK-1)(9:16)='GROUND  '                             FLODA1    708
         DCLNMR(5*MDCLK-1)(17:17)='1'                                   FLODA1    709
         DCLNMR(5*MDCLK)(1:8)=NSRL(MCON2)                               FLODA1    710
         DCLNMR(5*MDCLK)(9:16)='GROUND  '                               FLODA1    711
         DCLNMR(5*MDCLK)(17:17)='1'                                     FLODA1    712
         RDCOHM(5*MDCLK-4)=0.01*RDC                                     FLODA1    713
         RDCOHM(5*MDCLK-3)=0.98*RDC                                     FLODA1    714
         RDCOHM(5*MDCLK-2)=0.01*RDC                                     FLODA1    715
         RDCOHM(5*MDCLK-1)=1.0E+7                                       FLODA1    716
         RDCOHM(5*MDCLK)=1.0E+7                                         FLODA1    717
         DO 240 MLIN=1,5                                                FLODA1    718
         XLDC(5*MDCLK-5+MLIN)=0.0                                       FLODA1    719
         CDCA(5*MDCLK-5+MLIN)=0.0                                       FLODA1    720
         CDCB(5*MDCLK-5+MLIN)=0.0                                       FLODA1    721
  240    CONTINUE                                                       FLODA1    722
         IF(LDEB) WRITE(IUD6,1650) (RDCOHM(5*MDCLK-5+I),I=1,5)          FLODA1    723
C                                                                       FLODA1    724
         IDCNOD(2*MCON1-1)=NCONV(MCON1)                                 FLODA1    725
         IDCNOD(2*MCON1)=NSRL(MCON1)                                    FLODA1    726
         IDCNOD(2*MCON2-1)=NSRL(MCON2)                                  FLODA1    727
         IDCNOD(2*MCON2)=NCONV(MCON2)                                   FLODA1    728
C                                                                       FLODA1    729
         CNVMVA(MCON1)=0.0                                              FLODA1    730
         CNVMVA(MCON2)=0.0                                              FLODA1    731
         XCOHMS(MCON1)=XCR                                              FLODA1    732
         XCOHMS(MCON2)=XCI                                              FLODA1    733
         NSBRDG(MCON1)=NBR                                              FLODA1    734
         NSBRDG(MCON2)=NBI                                              FLODA1    735
         XNBR=REAL(NBR)                                                 FLODA1    736
         XNBI=REAL(NBI)                                                 FLODA1    737
         IF(LDEB) WRITE(IUD6,1660) NBR,NBI,XCR,XCI                      FLODA1    738
C                                                                       FLODA1    739
C     COMPUTE HT CONVERTER BUS VOLTAGES                                 FLODA1    740
C                                                                       FLODA1    741
         KRH=JDCC(MCON1)                                                FLODA1    742
         KIH=JDCC(MCON2)                                                FLODA1    743
         JRH=MNEW(KRH)                                                  FLODA1    744
         JIH=MNEW(KIH)                                                  FLODA1    745
         IF(LDEB)WRITE(IUD6,1020) KRH,KIH,JRH,JIH                       FLODA1    746
C                                                                       FLODA1    747
         KK=(JRH-1)*8                                                   FLODA1    748
         ERRH=ERBUS(KK+1)*SBASR*TRR/TAPR                                FLODA1    749
         ERIH=EIBUS(KK+2)*SBASR*TRR/TAPR                                FLODA1    750
         EMR=ERRH**2+ERIH**2                                            FLODA1    751
         ANGR=ATAN(ERIH/ERRH)                                           FLODA1    752
C                                                                       FLODA1    753
         KK=(JIH-1)*8                                                   FLODA1    754
         EIRH=ERBUS(KK+1)*SBASI*TRI/TAPI                                FLODA1    755
         EIIH=EIBUS(KK+2)*SBASI*TRI/TAPI                                FLODA1    756
         EMI=EIRH**2+EIIH**2                                            FLODA1    757
         ANGI=ATAN(EIIH/EIRH)                                           FLODA1    758
C                                                                       FLODA1    759
         IF(LDEB)WRITE(IUD6,1030) ERRH,ERIH,ANGR,EIRH,EIIH,ANGI         FLODA1    760
C                                                                       FLODA1    761
         VDCR0=PI32*XNBR*SQRT(EMR)                                      FLODA1    762
         VDCI0=PI32*XNBI*SQRT(EMI)                                      FLODA1    763
C                                                                       FLODA1    764
         IF(MDC.EQ.1) THEN                                              FLODA1    765
            IF(SETVL.LT.0.0) THEN                                       FLODA1    766
               PAHVDC(MCON2)=-SETVL                                     FLODA1    767
               VDCONV(MCON2)=0.5*VSCHD+0.5*SQRT(VSCHD**2+4.0*           FLODA1    768
     &         SETVL*RCOMP)                                             FLODA1    769
               DCCURR=-SETVL/VDCONV(MCON2)                              FLODA1    770
               VDCONV(MCON1)=VDCONV(MCON2)+DCCURR*RDC                   FLODA1    771
               PAHVDC(MCON1)=-VDCONV(MCON1)*DCCURR                      FLODA1    772
C                                                                       FLODA1    773
               COSGAM=(VDCONV(MCON2)+3.0/PII*XNBI*XCI*DCCURR)/VDCI0     FLODA1    774
               IF(COSGAM.GT.1.0) THEN                                   FLODA1    775
                  GAMA=GMN                                              FLODA1    776
                  COSGAM=COS(GAMA*PII/180.0)                            FLODA1    777
                  VDCONV(MCON2)=0.5*VDCI0*COSGAM+0.5*SQRT(              FLODA1    778
     &            (VDCI0*COSGAM)**2+12.0/PII*XNBI*XCI*SETVL)            FLODA1    779
                  DCCURR=-SETVL/VDCONV(MCON2)                           FLODA1    780
                  VDCONV(MCON1)=VDCONV(MCON2)+RDC*DCCURR                FLODA1    781
                  PAHVDC(MCON1)=-VDCONV(MCON1)*DCCURR                   FLODA1    782
               ELSE                                                     FLODA1    783
                  GAMA=180.0/PII*ACOS(COSGAM)                           FLODA1    784
                  IF(GAMA.LT.GMN) THEN                                  FLODA1    785
                     GAMA=GMN                                           FLODA1    786
                     COSGAM=COS(GAMA*PII/180.0)                         FLODA1    787
                     VDCONV(MCON2)=0.5*VDCI0*COSGAM+0.5*SQRT(           FLODA1    788
     &               (VDCI0*COSGAM)**2+12.0/PII*XNBI*XCI*SETVL)         FLODA1    789
                     DCCURR=-SETVL/VDCONV(MCON2)                        FLODA1    790
                     VDCONV(MCON1)=VDCONV(MCON2)+RDC*DCCURR             FLODA1    791
                     PAHVDC(MCON1)=-VDCONV(MCON1)*DCCURR                FLODA1    792
                  END IF                                                FLODA1    793
               END IF                                                   FLODA1    794
C                                                                       FLODA1    795
               COSALF=(VDCONV(MCON1)+3.0/PII*XNBR*XCR*DCCURR)/VDCR0     FLODA1    796
               IF(COSALF.GT.1.0) THEN                                   FLODA1    797
                  ALFA=AMN                                              FLODA1    798
                  COSALF=COS(ALFA*PII/180.0)                            FLODA1    799
                  DCCURR=DCCURR*(1.0-DELTI)                             FLODA1    800
                  VDCONV(MCON1)=VDCR0*COSALF-3.0/PII*XNBR*XCR*DCCURR    FLODA1    801
                  VDCONV(MCON2)=VDCONV(MCON1)-RDC*DCCURR                FLODA1    802
                  PAHVDC(MCON2)=VDCONV(MCON2)*DCCURR                    FLODA1    803
                  PAHVDC(MCON1)=-VDCONV(MCON1)*DCCURR                   FLODA1    804
               ELSE                                                     FLODA1    805
                  ALFA=180.0/PII*ACOS(COSALF)                           FLODA1    806
                  IF(ALFA.LT.AMN) THEN                                  FLODA1    807
                     ALFA=AMN                                           FLODA1    808
                     COSALF=COS(ALFA*PII/180.0)                         FLODA1    809
                     DCCURR=DCCURR*(1.0-DELTI)                          FLODA1    810
                     VDCONV(MCON1)=VDCR0*COSALF-3.0/PII*XNBR*XCR        FLODA1    811
     &               *DCCURR                                            FLODA1    812
                     VDCONV(MCON2)=VDCONV(MCON1)-RDC*DCCURR             FLODA1    813
                     PAHVDC(MCON2)=VDCONV(MCON2)*DCCURR                 FLODA1    814
                     PAHVDC(MCON1)=-VDCONV(MCON1)*DCCURR                FLODA1    815
                  END IF                                                FLODA1    816
               END IF                                                   FLODA1    817
C                                                                       FLODA1    818
               COSGAM=(VDCONV(MCON2)+3.0/PII*XNBI*XCI*DCCURR)/VDCI0     FLODA1    819
               GAMA=180.0/PII*ACOS(COSGAM)                              FLODA1    820
               IF((GAMA-GAMX).GT.0.01)THEN                              FLODA1    821
                  WRITE(MSG(1),1010) MDCLK,GAMA                         FLODA1    822
                  WRITE(MSG(2),1011) GAMX                               FLODA1    823
                  CALL PRTMSG(2)                                        FLODA1    824
               ENDIF                                                    FLODA1    825
C                                                                       FLODA1    826
            ELSE                                                        FLODA1    827
               PAHVDC(MCON1)=-SETVL                                     FLODA1    828
               VDCONV(MCON1)=0.5*VSCHD+0.5*SQRT(VSCHD**2+4.0*           FLODA1    829
     &         SETVL*(RDC-RCOMP))                                       FLODA1    830
               DCCURR=SETVL/VDCONV(MCON1)                               FLODA1    831
               VDCONV(MCON2)=VDCONV(MCON1)-DCCURR*RDC                   FLODA1    832
               PAHVDC(MCON2)=VDCONV(MCON2)*DCCURR                       FLODA1    833
C                                                                       FLODA1    834
               COSGAM=(VDCONV(MCON2)+3.0/PII*XNBI*XCI*DCCURR)/VDCI0     FLODA1    835
               IF(COSGAM.GT.1.0) THEN                                   FLODA1    836
                  GAMA=GMN                                              FLODA1    837
                  COSGAM=COS(GAMA*PII/180.0)                            FLODA1    838
                  VDCONV(MCON1)=0.5*VDCI0*COSGAM+0.5*SQRT(              FLODA1    839
     &            (VDCI0*COSGAM)**2-4.0*(3.0/PII*XNBI*XCI-RDC)*SETVL)   FLODA1    840
                  DCCURR=SETVL/VDCONV(MCON1)                            FLODA1    841
                  VDCONV(MCON2)=VDCONV(MCON1)-RDC*DCCURR                FLODA1    842
                  PAHVDC(MCON2)=VDCONV(MCON2)*DCCURR                    FLODA1    843
               ELSE                                                     FLODA1    844
                  GAMA=180.0/PII*ACOS(COSGAM)                           FLODA1    845
                  IF(GAMA.LT.GMN) THEN                                  FLODA1    846
                     GAMA=GMN                                           FLODA1    847
                     COSGAM=COS(GAMA*PII/180.0)                         FLODA1    848
                     VDCONV(MCON1)=0.5*VDCI0*COSGAM+0.5*SQRT(           FLODA1    849
     &               (VDCI0*COSGAM)**2-4.0*(3.0/PII*XNBI*XCI-RDC)*SETVL)FLODA1    850
                     DCCURR=SETVL/VDCONV(MCON1)                         FLODA1    851
                     VDCONV(MCON2)=VDCONV(MCON1)-RDC*DCCURR             FLODA1    852
                     PAHVDC(MCON2)=VDCONV(MCON2)*DCCURR                 FLODA1    853
                  END IF                                                FLODA1    854
               END IF                                                   FLODA1    855
C                                                                       FLODA1    856
               COSALF=(VDCONV(MCON1)+3.0/PII*XNBR*XCR*DCCURR)/VDCR0     FLODA1    857
               IF(COSALF.GT.1.0) THEN                                   FLODA1    858
                  ALFA=AMN                                              FLODA1    859
                  COSALF=COS(ALFA*PII/180.0)                            FLODA1    860
                  DCCURR=DCCURR*(1.0-DELTI)                             FLODA1    861
                  VDCONV(MCON1)=VDCR0*COSALF-3.0/PII*XNBR*XCR*DCCURR    FLODA1    862
                  VDCONV(MCON2)=VDCONV(MCON1)-RDC*DCCURR                FLODA1    863
                  PAHVDC(MCON2)=VDCONV(MCON2)*DCCURR                    FLODA1    864
                  PAHVDC(MCON1)=-VDCONV(MCON1)*DCCURR                   FLODA1    865
               ELSE                                                     FLODA1    866
                  ALFA=180.0/PII*ACOS(COSALF)                           FLODA1    867
                  IF(ALFA.LT.AMN) THEN                                  FLODA1    868
                     ALFA=AMN                                           FLODA1    869
                     COSALF=COS(ALFA*PII/180.0)                         FLODA1    870
                     DCCURR=DCCURR*(1.0-DELTI)                          FLODA1    871
                     VDCONV(MCON1)=VDCR0*COSALF-3.0/PII*XNBR*XCR        FLODA1    872
     &               *DCCURR                                            FLODA1    873
                     VDCONV(MCON2)=VDCONV(MCON1)-RDC*DCCURR             FLODA1    874
                     PAHVDC(MCON2)=VDCONV(MCON2)*DCCURR                 FLODA1    875
                     PAHVDC(MCON1)=-VDCONV(MCON1)*DCCURR                FLODA1    876
                  END IF                                                FLODA1    877
               END IF                                                   FLODA1    878
               COSGAM=(VDCONV(MCON2)+3.0/PII*XNBI*XCI*DCCURR)/VDCI0     FLODA1    879
               GAMA=180.0/PII*ACOS(COSGAM)                              FLODA1    880
               IF((GAMA-GAMX).GT.0.01)THEN                              FLODA1    881
                  WRITE(MSG(1),1010) MDCLK,GAMA                         FLODA1    882
                  WRITE(MSG(2),1011) GAMX                               FLODA1    883
                  CALL PRTMSG(2)                                        FLODA1    884
               ENDIF                                                    FLODA1    885
C                                                                       FLODA1    886
            END IF                                                      FLODA1    887
         END IF                                                         FLODA1    888
C                                                                       FLODA1    889
         IF(MDC.EQ.2) THEN                                              FLODA1    890
            DCCURR=SETVL/1000.0                                         FLODA1    891
            VDCONV(MCON1)=VSCHD+(RDC-RCOMP)*DCCURR                      FLODA1    892
            VDCONV(MCON2)=VSCHD-RCOMP*DCCURR                            FLODA1    893
            PAHVDC(MCON1)=-VDCONV(MCON1)*DCCURR                         FLODA1    894
            PAHVDC(MCON2)=VDCONV(MCON2)*DCCURR                          FLODA1    895
C                                                                       FLODA1    896
            COSGAM=(VDCONV(MCON2)+3.0/PII*XNBI*XCI*DCCURR)/VDCI0        FLODA1    897
            IF(COSGAM.GT.1.0) THEN                                      FLODA1    898
               GAMA=GMN                                                 FLODA1    899
               COSGAM=COS(GAMA*PII/180.0)                               FLODA1    900
               VDCONV(MCON2)=VDCI0*COSGAM-3.0/PII*XNBI*XCI*DCCURR       FLODA1    901
               VDCONV(MCON1)=VDCONV(MCON2)+RDC*DCCURR                   FLODA1    902
               PAHVDC(MCON2)=VDCONV(MCON2)*DCCURR                       FLODA1    903
               PAHVDC(MCON1)=-VDCONV(MCON1)*DCCURR                      FLODA1    904
            ELSE                                                        FLODA1    905
               GAMA=180.0/PII*ACOS(COSGAM)                              FLODA1    906
               IF(GAMA.LT.GMN) THEN                                     FLODA1    907
                  GAMA=GMN                                              FLODA1    908
                  COSGAM=COS(GAMA*PII/180.0)                            FLODA1    909
                  VDCONV(MCON2)=VDCI0*COSGAM-3.0/PII*XNBI*XCI*DCCURR    FLODA1    910
                  VDCONV(MCON1)=VDCONV(MCON2)+RDC*DCCURR                FLODA1    911
                  PAHVDC(MCON2)=VDCONV(MCON2)*DCCURR                    FLODA1    912
                  PAHVDC(MCON1)=-VDCONV(MCON1)*DCCURR                   FLODA1    913
               END IF                                                   FLODA1    914
            END IF                                                      FLODA1    915
C                                                                       FLODA1    916
            COSALF=(VDCONV(MCON1)+3.0/PII*XNBR*XCR*DCCURR)/VDCR0        FLODA1    917
            IF(COSALF.GT.1.0) THEN                                      FLODA1    918
               ALFA=AMN                                                 FLODA1    919
               COSALF=COS(ALFA*PII/180.0)                               FLODA1    920
               DCCURR=DCCURR*(1.0-DELTI)                                FLODA1    921
               VDCONV(MCON1)=VDCR0*COSALF-3.0/PII*XNBR*XCR*DCCURR       FLODA1    922
               VDCONV(MCON2)=VDCONV(MCON1)-RDC*DCCURR                   FLODA1    923
               PAHVDC(MCON2)=VDCONV(MCON2)*DCCURR                       FLODA1    924
               PAHVDC(MCON1)=-VDCONV(MCON1)*DCCURR                      FLODA1    925
            ELSE                                                        FLODA1    926
               ALFA=180.0/PII*ACOS(COSALF)                              FLODA1    927
               IF(ALFA.LT.AMN) THEN                                     FLODA1    928
                  ALFA=AMN                                              FLODA1    929
                  COSALF=COS(ALFA*PII/180.0)                            FLODA1    930
                  DCCURR=DCCURR*(1.0-DELTI)                             FLODA1    931
                  VDCONV(MCON1)=VDCR0*COSALF-3.0/PII*XNBR*XCR*DCCURR    FLODA1    932
                  VDCONV(MCON2)=VDCONV(MCON1)-RDC*DCCURR                FLODA1    933
                  PAHVDC(MCON2)=VDCONV(MCON2)*DCCURR                    FLODA1    934
                  PAHVDC(MCON1)=-VDCONV(MCON1)*DCCURR                   FLODA1    935
               END IF                                                   FLODA1    936
            END IF                                                      FLODA1    937
            COSGAM=(VDCONV(MCON2)+3.0/PII*XNBI*XCI*DCCURR)/VDCI0        FLODA1    938
            GAMA=180.0/PII*ACOS(COSGAM)                                 FLODA1    939
            IF((GAMA-GAMX).GT.0.01)THEN                                 FLODA1    940
               WRITE(MSG(1),1010) MDCLK,GAMA                            FLODA1    941
               WRITE(MSG(2),1011) GAMX                                  FLODA1    942
               CALL PRTMSG(2)                                           FLODA1    943
            ENDIF                                                       FLODA1    944
C                                                                       FLODA1    945
         END IF                                                         FLODA1    946
C                                                                       FLODA1    947
         IF(SETVL.EQ.0.0)THEN                                           FLODA1    948
            MSG(1)=' *** ERROR-CHECK LF DC DATA-P OR I DEMAND IS 0'     FLODA1    949
            CALL PRTMSG(1)                                              FLODA1    950
         ENDIF                                                          FLODA1    951
         IF(MDC.EQ.0) THEN                                              FLODA1    952
            MSG(1)=' *** DC LINK CONTROL IS BLOCKED'                    FLODA1    953
            CALL PRTMSG(1)                                              FLODA1    954
            COSALF=0.0                                                  FLODA1    955
            COSGAM=0.0                                                  FLODA1    956
            DCCURR=0.0                                                  FLODA1    957
            VDCONV(MCON1)=0.0                                           FLODA1    958
            VDCONV(MCON2)=0.0                                           FLODA1    959
            PAHVDC(MCON1)=0.0                                           FLODA1    960
            PAHVDC(MCON2)=0.0                                           FLODA1    961
         END IF                                                         FLODA1    962
C                                                                       FLODA1    963
C     CALCULATE COS OF ALPHA AND GAMMA                                  FLODA1    964
C                                                                       FLODA1    965
         CALPHA(MCON1)=COSALF                                           FLODA1    966
         COSALF=(-VDCONV(MCON2)+3.0/PII*XNBI*XCI*DCCURR)/VDCI0          FLODA1    967
         CALPHA(MCON2)=COSALF                                           FLODA1    968
         CGAMMA(MCON2)=COSGAM                                           FLODA1    969
         COSGAM=(-VDCONV(MCON1)+3.0/PII*XNBR*XCR*DCCURR)/VDCR0          FLODA1    970
         CGAMMA(MCON1)=COSGAM                                           FLODA1    971
         IF(LDEB)WRITE(IUD6,1620) CALPHA(MCON1),CALPHA(MCON2)           FLODA1    972
     &   ,CGAMMA(MCON1),CGAMMA(MCON2)                                   FLODA1    973
C                                                                       FLODA1    974
C     CALCULATE ALPHAMIN, ALPHAMAX, AND GAMMAMIN                        FLODA1    975
C                                                                       FLODA1    976
         ALPMIN(MCON1)=AMN                                              FLODA1    977
         COSAMN=6.0/PII*XNBI*XCI*DCCURR/VDCI0-COS(GAMX*PII/180.0)       FLODA1    978
         IF(COSAMN.GT.1.0) COSAMN=1.0                                   FLODA1    979
         ALPMIN(MCON2)=180.0/PII*ACOS(COSAMN)                           FLODA1    980
         ALPMAX(MCON1)=AMX                                              FLODA1    981
         COSAMX=6.0/PII*XNBI*XCI*DCCURR/VDCI0-COS(GMN*PII/180.0)        FLODA1    982
         ALPMAX(MCON2)=180.0/PII*ACOS(COSAMX)                           FLODA1    983
         COSGMN=6.0/PII*XNBR*XCR*DCCURR/VDCR0-COS(AMX*PII/180.0)        FLODA1    984
         IF(COSGMN.GT.1.0) COSGMN=1.0                                   FLODA1    985
         GAMMIN(MCON1)=180.0/PII*ACOS(COSGMN)                           FLODA1    986
         GAMMIN(MCON2)=GMN                                              FLODA1    987
         IF(LDEB)WRITE(IUD6,1590) ALPMIN(MCON1),ALPMIN(MCON2)           FLODA1    988
     &   ,ALPMAX(MCON1),ALPMAX(MCON2),GAMMIN(MCON1),GAMMIN(MCON2)       FLODA1    989
C                                                                       FLODA1    990
C     CALCULATE POWER FACTORS IN RAD.                                   FLODA1    991
C                                                                       FLODA1    992
C     CALCULATE REACTIVE POWERS                                         FLODA1    993
C                                                                       FLODA1    994
         ALPHA = ACOS(CALPHA(MCON1))                                    FLODA1    995
         GAMMA = ACOS(CGAMMA(MCON1))                                    FLODA1    996
         AMU = PII-ALPHA-GAMMA                                          FLODA1    997
         TWOALP = 2.0*ALPHA                                             FLODA1    998
         TWOAMU = 2.0*(ALPHA+AMU)                                       FLODA1    999
         DCOS=COS(TWOALP)-COS(TWOAMU)                                   FLODA1   1000
         IF(ABS(DCOS).GT.0.0001) THEN                                   FLODA1   1001
            TANPHI = 2.0*AMU+SIN(TWOALP)-SIN(TWOAMU)                    FLODA1   1002
            TANPHI = TANPHI/DCOS                                        FLODA1   1003
            TANPHR = ABS(TANPHI)                                        FLODA1   1004
            PHIDC(MCON1)=ATAN(TANPHR)                                   FLODA1   1005
            QAHVDC(MCON1)=-ABS(PAHVDC(MCON1))*TANPHR                    FLODA1   1006
         ELSE                                                           FLODA1   1007
            PHIDC(MCON1)=ACOS(ABS(VDCONV(MCON1)/VDCR0))                 FLODA1   1008
            QAHVDC(MCON1)=-SQRT((VDCR0*DCCURR)**2                       FLODA1   1009
     &      -PAHVDC(MCON1)**2)                                          FLODA1   1010
         ENDIF                                                          FLODA1   1011
         ALPHA = ACOS(CALPHA(MCON2))                                    FLODA1   1012
         GAMMA = ACOS(CGAMMA(MCON2))                                    FLODA1   1013
         AMU = PII-ALPHA-GAMMA                                          FLODA1   1014
         TWOALP = 2.0*ALPHA                                             FLODA1   1015
         TWOAMU = 2.0*(ALPHA+AMU)                                       FLODA1   1016
         DCOS=COS(TWOALP)-COS(TWOAMU)                                   FLODA1   1017
         IF(ABS(DCOS).GT.0.0001) THEN                                   FLODA1   1018
            TANPHI = 2.0*AMU+SIN(TWOALP)-SIN(TWOAMU)                    FLODA1   1019
            TANPHI = TANPHI/DCOS                                        FLODA1   1020
            TANPHI = ABS(TANPHI)                                        FLODA1   1021
            PHIDC(MCON2)=ATAN(TANPHI)                                   FLODA1   1022
            QAHVDC(MCON2)=-ABS(PAHVDC(MCON2))*TANPHI                    FLODA1   1023
         ELSE                                                           FLODA1   1024
            PHIDC(MCON2)=ACOS(ABS(VDCONV(MCON2)/VDCI0))                 FLODA1   1025
            QAHVDC(MCON2)=-SQRT((VDCI0*DCCURR)**2                       FLODA1   1026
     &      -PAHVDC(MCON2)**2)                                          FLODA1   1027
         ENDIF                                                          FLODA1   1028
         IF(LDEB)WRITE(IUD6,1580) PHIDC(MCON1),PHIDC(MCON2)             FLODA1   1029
C                                                                       FLODA1   1030
C     CALCULATE AC CURRENTS                                             FLODA1   1031
C                                                                       FLODA1   1032
         CIRR=(PAHVDC(MCON1)*ERRH+QAHVDC(MCON1)*ERIH)/EMR               FLODA1   1033
         CIRI=(PAHVDC(MCON1)*ERIH-QAHVDC(MCON1)*ERRH)/EMR               FLODA1   1034
         CIIR=(PAHVDC(MCON2)*ERRH+QAHVDC(MCON2)*ERIH)/EMI               FLODA1   1035
         CIII=(PAHVDC(MCON2)*ERIH-QAHVDC(MCON2)*ERRH)/EMI               FLODA1   1036
         XACURR(MCON1)=-SQRT(CIRR**2+CIRI**2)*VABASE(MCON1)/PABASE      FLODA1   1037
         XACURR(MCON2)=SQRT(CIIR**2+CIII**2)*VABASE(MCON1)/PABASE       FLODA1   1038
         IF(LDEB)WRITE(IUD6,1040) XACURR(MCON1),XACURR(MCON2)           FLODA1   1039
C                                                                       FLODA1   1040
C     DC REAL AND REACTIVE POWERS IN PU                                 FLODA1   1041
C                                                                       FLODA1   1042
         PAHVDC(MCON1)=PAHVDC(MCON1)/PABASE                             FLODA1   1043
         PAHVDC(MCON2)=PAHVDC(MCON2)/PABASE                             FLODA1   1044
         QAHVDC(MCON1)=QAHVDC(MCON1)/PABASE                             FLODA1   1045
         QAHVDC(MCON2)=QAHVDC(MCON2)/PABASE                             FLODA1   1046
         IF(LDEB) WRITE(IUD6,1570) PAHVDC(MCON1),PAHVDC(MCON2)          FLODA1   1047
     &   ,QAHVDC(MCON1),QAHVDC(MCON2)                                   FLODA1   1048
C                                                                       FLODA1   1049
C     DC CONVERTER AND NODE VOLTAGES                                    FLODA1   1050
C                                                                       FLODA1   1051
         VDCONV(MCON1)=VDCONV(MCON1)/VDBASE                             FLODA1   1052
         VDCONV(MCON2)=VDCONV(MCON2)/VDBASE                             FLODA1   1053
         VDCNOD(2*MCON1-1)=VDCONV(MCON1)                                FLODA1   1054
         VDCNOD(2*MCON1)=VDCONV(MCON1)-.01*(VDCONV(MCON1)-VDCONV(MCON2))FLODA1   1055
         VDCNOD(2*MCON2-1)=VDCONV(MCON2)+.01*(VDCONV(MCON1)             FLODA1   1056
     &   -VDCONV(MCON2))                                                FLODA1   1057
         VDCNOD(2*MCON2)=VDCONV(MCON2)                                  FLODA1   1058
         IF(LDEB) WRITE(IUD6,1560) (VDCNOD(4*MDCLK-4+I),I=1,4)          FLODA1   1059
C                                                                       FLODA1   1060
C     DC CONVERTER AND NODE CURRENTS (NET CURRENT LEAVING THE NODE ?)   FLODA1   1061
C                                                                       FLODA1   1062
         XDCONV(MCON1)=DCCURR*VDBASE/PDBASE                             FLODA1   1063
         XDCONV(MCON2)=-DCCURR*VDBASE/PDBASE                            FLODA1   1064
         XDNODE(2*MCON1-1)=XDCONV(MCON1)                                FLODA1   1065
         XDNODE(2*MCON1)=0.0                                            FLODA1   1066
         XDNODE(2*MCON2-1)=0.0                                          FLODA1   1067
         XDNODE(2*MCON2)=XDCONV(MCON2)                                  FLODA1   1068
         IF(LDEB) WRITE(IUD6,1550) (XDNODE(4*MDCLK-4+I),I=1,4)          FLODA1   1069
C                                                                       FLODA1   1070
C     Initialize udc arrays, structure arrays and fixed arrays.         FLODA1   1071
C                                                                       FLODA1   1072
         DO 270 KI=1,2                                                  FLODA1   1073
         NLF=JDCC(MCON1+KI-1)                                           FLODA1   1074
         FOUND = .FALSE.                                                FLODA1   1075
         I = 1                                                          FLODA1   1076
  250    IF(FOUND .OR. I .GT. NACBUS) GOTO 260                          FLODA1   1077
         IF(NLF.EQ.IUQABU(I))THEN                                       FLODA1   1078
            FOUND = .TRUE.                                              FLODA1   1079
         ELSE                                                           FLODA1   1080
            I = I + 1                                                   FLODA1   1081
         ENDIF                                                          FLODA1   1082
         GOTO 250                                                       FLODA1   1083
  260    CONTINUE                                                       FLODA1   1084
         IF(.NOT. FOUND)THEN                                            FLODA1   1085
            NACBUS = NACBUS+1                                           FLODA1   1086
            IUQABU(NACBUS) = NLF                                        FLODA1   1087
         ENDIF                                                          FLODA1   1088
         IF(LDEB) WRITE(IUD6,1670) IUQABU(NACBUS)                       FLODA1   1089
C                                                                       FLODA1   1090
  270    CONTINUE                                                       FLODA1   1091
         SPTYPE(MCON1)= 'ALAT'                                          FLODA1   1092
         SPTYPE(MCON2)= 'ALAT'                                          FLODA1   1093
         SPTYP3(MCON1)= 'NO'                                            FLODA1   1094
         SPTYP3(MCON2)= 'NO'                                            FLODA1   1095
         ICTYPE(MCON1)= 1                                               FLODA1   1096
         ICTYPE(MCON2)= 1                                               FLODA1   1097
         GOTO 210                                                       FLODA1   1098
      ENDIF                                                             FLODA1   1099
C                                                                       FLODA1   1100
      ICDC=2*MDCLK                                                      FLODA1   1101
      ILDC=5*MDCLK                                                      FLODA1   1102
      IBDC = 0                                                          FLODA1   1103
      NONODR=4*MDCLK                                                    FLODA1   1104
C                                                                       FLODA1   1105
C     READ SWITCHING SHUNT DATA                                         FLODA1   1106
C                                                                       FLODA1   1107
  280 READ (IUX,1180) K,J,RIYGRK                                        FLODA1   1108
      IF(K.NE.0) THEN                                                   FLODA1   1109
         IF(MNEW(K).EQ.0)GOTO 280                                       FLODA1   1110
         K=MNEW(K)                                                      FLODA1   1111
         KK=(K-1)*8                                                     FLODA1   1112
         RIYGR(KK+5)=RIYGR(KK+5)-RIYGRK/100.0                           FLODA1   1113
         GOTO 280                                                       FLODA1   1114
      ENDIF                                                             FLODA1   1115
      GOTO 430                                                          FLODA1   1116
C                                                                       FLODA1   1117
C     READ LOAD FLOW DATA IN IEEE(1971) COMMON FORMAT                   FLODA1   1118
C                                                                       FLODA1   1119
  300 IF(LDUMP.NE.3.AND.LDUMP.NE.4) GOTO 330                            FLODA1   1120
C                                                                       FLODA1   1121
      CALL FMOVE(0,SCALE,SCALE,5)                                       FLODA1   1122
      DG=0.0                                                            FLODA1   1123
C                                                                       FLODA1   1124
C     READ INFO: DATE, SENDER, YEAR, CHAR. CASE IDENT'N                 FLODA1   1125
C                                                                       FLODA1   1126
      READ(IUX,1190) (IDATE(K),K=1,3),(IDENT(K),K=1,5),NAME(1),NAME(2)  FLODA1   1127
     &,(TEXT(K),K=1,8)                                                  FLODA1   1128
C                                                                       FLODA1   1129
C     READ HEADER INFO FOR BUS DATA                                     FLODA1   1130
C                                                                       FLODA1   1131
      READ(IUX,1200) IBUSN,INUM                                         FLODA1   1132
      IF(IBUSN.EQ.IBUS) GOTO 310                                        FLODA1   1133
      WRITE(MSG(1),1210)                                                FLODA1   1134
      CALL PRTMSG(1)                                                    FLODA1   1135
C!      STOP 'ROUTINE FLODA1 IEEE COMMON FORMAT LF BUS HEADER ERROR'    FLODA1   1136
      RETURN                                                            FLODA1   1137
C                                                                       FLODA1   1138
C     READ BUS RECORD                                                   FLODA1   1139
C                                                                       FLODA1   1140
  310 LBUSNO=0                                                          FLODA1   1141
      NBUST=0                                                           FLODA1   1142
      K=0                                                               FLODA1   1143
  320 READ(IUX,1220) J,INAMEK,NAME2K,NAME3K,IBARK,EM,ANG,BMWK,BMXK      FLODA1   1144
     &,GMWK,GMXK,GX,BX                                                  FLODA1   1145
      IF(J.GT.0)THEN                                                    FLODA1   1146
      IF(MNEW(J).NE.0)THEN                                              FLODA1   1147
      IEBK=1                                                            FLODA1   1148
      WRITE(MSG(1),1070) J                                              FLODA1   1149
      CALL PRTMSG(1)                                                    FLODA1   1150
      NBUST=NBUST+1                                                     FLODA1   1151
      GOTO 320                                                          FLODA1   1152
      ENDIF                                                             FLODA1   1153
      K=K+1                                                             FLODA1   1154
      IF(K.GT.NXB)THEN                                                  FLODA1   1155
      WRITE (MSG(1),1080) NXB                                           FLODA1   1156
      WRITE(MSG(2),1081) J                                              FLODA1   1157
      CALL PRTMSG(2)                                                    FLODA1   1158
      IEBK=1                                                            FLODA1   1159
      GOTO 320                                                          FLODA1   1160
      ENDIF                                                             FLODA1   1161
      MNEW(J)=K                                                         FLODA1   1162
      NOLD(K)=J                                                         FLODA1   1163
      IF(IBARK.EQ.0) IBARK=1                                            FLODA1   1164
      KK=K*4                                                            FLODA1   1165
      XBASKV(KK)=0.0                                                    FLODA1   1166
      IBAR(KK-1)=IBARK                                                  FLODA1   1167
      BMW(KK-3)=BMWK                                                    FLODA1   1168
      BMX(KK-2)=BMXK                                                    FLODA1   1169
      KK=K*2                                                            FLODA1   1170
      GMW(KK-1)=GMWK                                                    FLODA1   1171
      GMX(KK)=GMXK                                                      FLODA1   1172
      KK=K*8                                                            FLODA1   1173
      BSTC(KK-5)=0.0                                                    FLODA1   1174
      RYGR(KK-4)=GX                                                     FLODA1   1175
      RIYGR(KK-3)=-BX                                                   FLODA1   1176
      NAMES(KK-2)=INAMEK                                                FLODA1   1177
      NAMES(KK-1)=NAME2K                                                FLODA1   1178
      NAMES(KK)=NAME3K                                                  FLODA1   1179
C                                                                       FLODA1   1180
      IF(LDUMP.EQ.4)THEN                                                FLODA1   1181
      INAMES(1,K)=INAMEK                                                FLODA1   1182
      INAMES(2,K)=NAME2K                                                FLODA1   1183
      INAMES(3,K)=NAME3K                                                FLODA1   1184
      INTNUM(K)=J                                                       FLODA1   1185
      ENDIF                                                             FLODA1   1186
C                                                                       FLODA1   1187
      NBUST=NBUST+1                                                     FLODA1   1188
      IF(J.GT.LBUSNO) LBUSNO=J                                          FLODA1   1189
      ANGR=ANG/57.2957                                                  FLODA1   1190
      ERBUS(KK-7)=EM*COS(ANGR)                                          FLODA1   1191
      EIBUS(KK-6)=EM*SIN(ANGR)                                          FLODA1   1192
      GOTO 320                                                          FLODA1   1193
      ENDIF                                                             FLODA1   1194
      NLFBUS=K                                                          FLODA1   1195
      NOBUS=K                                                           FLODA1   1196
      IF(NBUST.NE.INUM)THEN                                             FLODA1   1197
      WRITE(MSG(1),1230) NBUST                                          FLODA1   1198
      WRITE(MSG(2),1240) INUM                                           FLODA1   1199
      CALL PRTMSG(2)                                                    FLODA1   1200
      IEBK=1                                                            FLODA1   1201
      ENDIF                                                             FLODA1   1202
C                                                                       FLODA1   1203
C    SETUP STATION NAME IN ALPHATICAL ORDER FOR LDUMP=4                 FLODA1   1204
C                                                                       FLODA1   1205
      IF(LDUMP.EQ.4)CALL BSORT2                                         FLODA1   1206
C                                                                       FLODA1   1207
      GOTO 370                                                          FLODA1   1208
C                                                                       FLODA1   1209
C     READ IN THE LOAD FLOW IN CARD FORMAT                              FLODA1   1210
C                                                                       FLODA1   1211
  330 READ(IUX,1240) (NAME(K),K=1,14)                                   FLODA1   1212
      READ(IUX,1250) (IDATE(K),K=1,3)                                   FLODA1   1213
      READ(IUX,1260) (IDENT(K),K=1,6)                                   FLODA1   1214
      I=1                                                               FLODA1   1215
  340 II=I+17                                                           FLODA1   1216
      READ(IUX,1270) (TEXT(K),K=I,II)                                   FLODA1   1217
      IF(TEXT(I).EQ.ECHECK) GOTO 350                                    FLODA1   1218
      I=I+18                                                            FLODA1   1219
      IF(I.LT.145) GOTO 340                                             FLODA1   1220
  350 CONTINUE                                                          FLODA1   1221
C                                                                       FLODA1   1222
C     READING LF DATA                                                   FLODA1   1223
C                                                                       FLODA1   1224
      READ(IUX,1280) NBUST,LBUSNO,NL,ITRF,MDCLK                         FLODA1   1225
C                                                                       FLODA1   1226
C     READING BUST DATA                                                 FLODA1   1227
C                                                                       FLODA1   1228
      K=0                                                               FLODA1   1229
      DO 360 I=1,NBUST                                                  FLODA1   1230
C                                                                       FLODA1   1231
C     READING BUS NUMBER,VOLTAGE,ANGLE,PGEN,QGEN                        FLODA1   1232
C                                                                       FLODA1   1233
      READ(IUX,1290) J,INAMEK,NAME2K,NAME3K,EM,ANG,GMWK,GMXK            FLODA1   1234
      READ(IUX,1300) BMWK,BMXK,BSTCK,RYGRK,RIYGRK                       FLODA1   1235
C                                                                       FLODA1   1236
C     READING BUS LOAD IN THE ORDER OF                                  FLODA1   1237
C     MW,MX,MVACAP,MWREAC,MXREAC                                        FLODA1   1238
C                                                                       FLODA1   1239
      K=K+1                                                             FLODA1   1240
      MNEW(J)=K                                                         FLODA1   1241
      NOLD(K)=J                                                         FLODA1   1242
      KK=K*2                                                            FLODA1   1243
      GMW(KK-1)=GMWK                                                    FLODA1   1244
      GMX(KK)=GMXK                                                      FLODA1   1245
      KK=K*4                                                            FLODA1   1246
      BMW(KK-3)=BMWK                                                    FLODA1   1247
      BMX(KK-2)=BMXK                                                    FLODA1   1248
      IBAR(KK-1)=1                                                      FLODA1   1249
      KK=K*8                                                            FLODA1   1250
      NAMES(KK-2)=INAMEK                                                FLODA1   1251
      NAMES(KK-1)=NAME2K                                                FLODA1   1252
      NAMES(KK)=NAME3K                                                  FLODA1   1253
      BSTC(KK-5)=BSTCK                                                  FLODA1   1254
      RYGR(KK-4)=RYGRK                                                  FLODA1   1255
      RIYGR(KK-3)=RIYGRK                                                FLODA1   1256
      ANGR=ANG/57.2957                                                  FLODA1   1257
      ERBUS(KK-7)=EM*COS(ANGR)                                          FLODA1   1258
      EIBUS(KK-6)=EM*SIN(ANGR)                                          FLODA1   1259
  360 CONTINUE                                                          FLODA1   1260
      NLFBUS=K                                                          FLODA1   1261
C                                                                       FLODA1   1262
  370 CONTINUE                                                          FLODA1   1263
C                                                                       FLODA1   1264
C     READING LINE DATA                                                 FLODA1   1265
C                                                                       FLODA1   1266
      IF(LDUMP.NE.3.AND.LDUMP.NE.4) GOTO 390                            FLODA1   1267
      NL=0                                                              FLODA1   1268
      NLINES=0                                                          FLODA1   1269
      ITRF=0                                                            FLODA1   1270
      ITRF2=0                                                           FLODA1   1271
C                                                                       FLODA1   1272
C     READ HEADER INFO FOR BRANCH DATA                                  FLODA1   1273
C                                                                       FLODA1   1274
      READ(IUX,1310) IBUSN,INUM                                         FLODA1   1275
      IF(IBUSN.EQ.IBUS1) GOTO 380                                       FLODA1   1276
      WRITE(MSG(1),1320)                                                FLODA1   1277
      CALL PRTMSG(1)                                                    FLODA1   1278
C!      STOP 'ROUTINE FLODA1 IEEE COMMON FORMAT LF BRANCH HEADER ERROR' FLODA1   1279
      RETURN                                                            FLODA1   1280
C                                                                       FLODA1   1281
C     READ AND STORE BRANCH DATA                                        FLODA1   1282
C                                                                       FLODA1   1283
  380 READ(IUX,1330) K,J,I4,ICKT,ITYPE,RX,XI,CHG,RATIOK,RANGK           FLODA1   1284
      IF(K.GT.0)THEN                                                    FLODA1   1285
      NEWK=MNEW(K)                                                      FLODA1   1286
      NEWJ=MNEW(J)                                                      FLODA1   1287
      IF(NEWJ.EQ.0.OR.NEWK.EQ.0)THEN                                    FLODA1   1288
      WRITE(MSG(1),1120) K,J,I4                                         FLODA1   1289
      CALL PRTMSG(1)                                                    FLODA1   1290
      IEBK=1                                                            FLODA1   1291
      GOTO 380                                                          FLODA1   1292
      ENDIF                                                             FLODA1   1293
      NL=NL+1                                                           FLODA1   1294
      IF(NL.GT.NXPL)THEN                                                FLODA1   1295
      IEBK=1                                                            FLODA1   1296
      WRITE(MSG(1),1150) K,J                                            FLODA1   1297
      WRITE(MSG(2),1151) I4                                             FLODA1   1298
      CALL PRTMSG(2)                                                    FLODA1   1299
      GOTO 380                                                          FLODA1   1300
      ENDIF                                                             FLODA1   1301
      NLINES=NLINES+5                                                   FLODA1   1302
      XSUM=RX**2+XI**2                                                  FLODA1   1303
      GAZN=RX/XSUM                                                      FLODA1   1304
      BAZN=XI/XSUM                                                      FLODA1   1305
      IK=MNEW(K)                                                        FLODA1   1306
      IJ=MNEW(J)                                                        FLODA1   1307
      CALL PACK(ICKT,0,JCKID)                                           FLODA1   1308
      LFTB(NLINES-4)=JCKID                                              FLODA1   1309
      CALL PACKII(IK,IJ,JCKID)                                          FLODA1   1310
      LFTB(NLINES-3)=JCKID                                              FLODA1   1311
      GA(NLINES-2)=GAZN                                                 FLODA1   1312
      BA(NLINES-1)=BAZN                                                 FLODA1   1313
      BCHG(NLINES)=CHG                                                  FLODA1   1314
      IF(ITYPE.NE.0)THEN                                                FLODA1   1315
      ITRF=ITRF+1                                                       FLODA1   1316
      ITRF2=ITRF2+2                                                     FLODA1   1317
      ITRAN(ITRF)=NL                                                    FLODA1   1318
      IF (RATIOK.LT.0.1) RATIOK=1.0                                     FLODA1   1319
      RATIO(ITRF2-1)=RATIOK                                             FLODA1   1320
      RANG(ITRF2)=RANGK                                                 FLODA1   1321
      ENDIF                                                             FLODA1   1322
      GOTO 380                                                          FLODA1   1323
      ENDIF                                                             FLODA1   1324
C                                                                       FLODA1   1325
C     CHECK IF TOTAL NO OF BRANCH DATA ENTERED EQUALS THE               FLODA1   1326
C     AMOUNT SPECIFIED                                                  FLODA1   1327
C                                                                       FLODA1   1328
      IF(INUM.NE.NL)THEN                                                FLODA1   1329
      WRITE(MSG(1),1340) NL                                             FLODA1   1330
      WRITE(MSG(2),1341) INUM                                           FLODA1   1331
      CALL PRTMSG(2)                                                    FLODA1   1332
      IEBK=1                                                            FLODA1   1333
      ENDIF                                                             FLODA1   1334
      GOTO 600                                                          FLODA1   1335
  390 CONTINUE                                                          FLODA1   1336
      NL=0                                                              FLODA1   1337
      NLINES=0                                                          FLODA1   1338
      ITRF=0                                                            FLODA1   1339
      ITRF2=0                                                           FLODA1   1340
  400 READ(IUX,1350) K,J,ICKT,RX,XI,CHG,RATIOK,RANGK                    FLODA1   1341
      IF(K.NE.0)THEN                                                    FLODA1   1342
      NL=NL+1                                                           FLODA1   1343
      NLINES=NLINES+5                                                   FLODA1   1344
      XSUM=RX**2+XI**2                                                  FLODA1   1345
      GAZN=RX/XSUM                                                      FLODA1   1346
      BAZN=XI/XSUM                                                      FLODA1   1347
      IK=MNEW(K)                                                        FLODA1   1348
      IJ=MNEW(J)                                                        FLODA1   1349
      CALL PACK(ICKT,0,JCKID)                                           FLODA1   1350
      LFTB(NLINES-4)=JCKID                                              FLODA1   1351
      CALL PACKII(IK,IJ,JCKID)                                          FLODA1   1352
      LFTB(NLINES-3)=JCKID                                              FLODA1   1353
      GA(NLINES-2)=GAZN                                                 FLODA1   1354
      BA(NLINES-1)=BAZN                                                 FLODA1   1355
      BCHG(NLINES)=CHG                                                  FLODA1   1356
      IF(ABS(RATIOK).GT.1.E-5)THEN                                      FLODA1   1357
      ITRF=ITRF+1                                                       FLODA1   1358
      ITRF2=ITRF2+2                                                     FLODA1   1359
      ITRAN(ITRF)=NL                                                    FLODA1   1360
      RATIO(ITRF2-1)=RATIOK                                             FLODA1   1361
      RANG(ITRF2)=RANGK                                                 FLODA1   1362
      ENDIF                                                             FLODA1   1363
      GOTO 400                                                          FLODA1   1364
      ENDIF                                                             FLODA1   1365
      IF(MDCLK.EQ.0) GOTO 430                                           FLODA1   1366
      K=0                                                               FLODA1   1367
  420 CONTINUE                                                          FLODA1   1368
      K=K+1                                                             FLODA1   1369
      READ(IUX,1280) IDCRK,IDCIK                                        FLODA1   1370
      READ(IUX,1300) (DCBUF(KK),KK=1,30)                                FLODA1   1371
      IF(K.LT.MDCLK) GOTO 420                                           FLODA1   1372
  430 CONTINUE                                                          FLODA1   1373
C                                                                       FLODA1   1374
C     READ TRANSFORMER IMPEDANCE CORRECTION TABLES                      FLODA1   1375
C                                                                       FLODA1   1376
      CALL FMOVE(0,CORTBL,CORTBL,110)                                   FLODA1   1377
  440 READ (IUX,1370) KBUF                                              FLODA1   1378
      IF (LDEB1) WRITE(IUD6,1380) KBUF                                  FLODA1   1379
      READ (KBUF,*) K                                                   FLODA1   1380
      IF (K.NE.0) THEN                                                  FLODA1   1381
         KBUF(132:132)='/'                                              FLODA1   1382
         IK=22*(K-1)                                                    FLODA1   1383
         READ (KBUF,*,END=440) J,(CORTBL(IK+KK),KK=1,22)                FLODA1   1384
         IF(LDEB1) WRITE(IUD6,2000)K,J,IK,(CORTBL(IK+KK),KK=1,22)       FLODA1   1385
         GOTO 440                                                       FLODA1   1386
      ENDIF                                                             FLODA1   1387
C                                                                       FLODA1   1388
C     READ LF DATA OF MULTITERMINAL DC LINKS                            FLODA1   1389
C                                                                       FLODA1   1390
      MTDCLK=0                                                          FLODA1   1391
  450 READ(IUX,1370) KBUF                                               FLODA1   1392
      IF(LDEB)WRITE(IUD6,1370) KBUF                                     FLODA1   1393
      READ(KBUF,1450) K                                                 FLODA1   1394
      IF(K.NE.0)THEN                                                    FLODA1   1395
         MTDCLK=MTDCLK+1                                                FLODA1   1396
         READ(KBUF,1700) K,NCONVE,NDCBS,NDCLN,MDC,IVCON,VCMOD           FLODA1   1397
         IF(LDEB)WRITE(IUD6,1700) K,NCONVE,NDCBS,NDCLN,MDC,IVCON,VCMOD  FLODA1   1398
C                                                                       FLODA1   1399
         DO 470 I=1,NCONVE                                              FLODA1   1400
         ICDC=ICDC+1                                                    FLODA1   1401
         READ(IUX,1370) KBUF                                            FLODA1   1402
         IF(LDEB)WRITE(IUD6,1370) KBUF                                  FLODA1   1403
         READ(KBUF,1760) IBC,NBC,AMX,AMN,RCC,XCC,EBASC,TRC,TAPC         FLODA1   1404
     &   ,TPMX,TPMN,TSTP,SETVL,DCPF,XMARG                               FLODA1   1405
         IF(LDEB)WRITE(IUD6,1760)                                       FLODA1   1406
     &   IBC,NBC,AMX,AMN,RCC,XCC,EBASC,TRC,TAPC                         FLODA1   1407
     &   ,TPMX,TPMN,TSTP,SETVL,DCPF,XMARG                               FLODA1   1408
         IF(IBC.EQ.0)THEN                                               FLODA1   1409
            WRITE(MSG(1),1710)                                          FLODA1   1410
            CALL PRTMSG(1)                                              FLODA1   1411
         ENDIF                                                          FLODA1   1412
C                                                                       FLODA1   1413
         IF(MNEW(IBC).EQ.0) THEN                                        FLODA1   1414
            WRITE(MSG(1),1720)                                          FLODA1   1415
            CALL PRTMSG(1)                                              FLODA1   1416
            IF(LDEB)WRITE(IUD6,1140) IBC                                FLODA1   1417
            IEBK=1                                                      FLODA1   1418
         END IF                                                         FLODA1   1419
         JDCC(ICDC)=IBC                                                 FLODA1   1420
         IF(LDEB)WRITE(IUD6,1730) ICDC,JDCC(ICDC)                       FLODA1   1421
         IDC(ICDC)=ICDC                                                 FLODA1   1422
         DCCNMR(ICDC)(9:16)='GROUND  '                                  FLODA1   1423
         WRITE(KBUF,1690) IBC                                           FLODA1   1424
         KBUF(6:10)='     '                                             FLODA1   1425
         DO 460 J=1,5                                                   FLODA1   1426
         IF(KBUF(J:J).NE.' ') THEN                                      FLODA1   1427
            KBUF(6:11-J)=KBUF(J:5)                                      FLODA1   1428
            GO TO 465                                                   FLODA1   1429
         END IF                                                         FLODA1   1430
  460    CONTINUE                                                       FLODA1   1431
  465    CONTINUE                                                       FLODA1   1432
         DCCNMR(ICDC)(17:24)=KBUF(6:10)                                 FLODA1   1433
         DCCNMR(ICDC)(25:28)='0.  '                                     FLODA1   1434
         DCCNMR(ICDC)(29:29)='1'                                        FLODA1   1435
         IF(LDEB) WRITE(IUD6,1680) DCCNMR(ICDC)                         FLODA1   1436
C                                                                       FLODA1   1437
         BDIND(ICDC)=.TRUE.                                             FLODA1   1438
         BZIND(ICDC)=.TRUE.                                             FLODA1   1439
         QINV(ICDC)=.FALSE.                                             FLODA1   1440
         IF(SETVL.LT.0.0.OR.IBC.EQ.IVCON) QINV(ICDC)=.TRUE.             FLODA1   1441
C                                                                       FLODA1   1442
         VABASE(ICDC)=EBASC                                             FLODA1   1443
         IBC=MNEW(IBC)                                                  FLODA1   1444
         IBC=IBC*4                                                      FLODA1   1445
         IF(ABS(VABASE(ICDC)-XBASKV(IBC)).GT.0.001.AND.LDEB)            FLODA1   1446
     &   WRITE(IUD6,1820) K,VABASE(ICDC),XBASKV(IBC),I                  FLODA1   1447
         IF(LDEB)WRITE(IUD6,1000) K,VABASE(ICDC)                        FLODA1   1448
C                                                                       FLODA1   1449
         TAPNOM(ICDC)=TRC                                               FLODA1   1450
         TAPPOS(ICDC)=1.0/TAPC                                          FLODA1   1451
C                                                                       FLODA1   1452
         CNVMVA(ICDC)=0.0                                               FLODA1   1453
         XCOHMS(ICDC)=XCC                                               FLODA1   1454
         NSBRDG(ICDC)=NBC                                               FLODA1   1455
         IF(LDEB) WRITE(IUD6,1740) NBC,XCC                              FLODA1   1456
         IF(SETVL.EQ.0.0)THEN                                           FLODA1   1457
            MSG(1)=' *** ERROR CHECK LF DC DATA-P OR I DEMAND IS 0'     FLODA1   1458
            CALL PRTMSG(1)                                              FLODA1   1459
         ENDIF                                                          FLODA1   1460
C                                                                       FLODA1   1461
         IF(MDC.EQ.0)THEN                                               FLODA1   1462
            MSG(1)=' *** CONVERTER IS BLOCKED'                          FLODA1   1463
            CALL PRTMSG(1)                                              FLODA1   1464
         ENDIF                                                          FLODA1   1465
C                                                                       FLODA1   1466
C     CALCULATE ALPHAMIN, ALPHAMAX, AND GAMMAMIN                        FLODA1   1467
C                                                                       FLODA1   1468
         IF(QINV(ICDC)) THEN                                            FLODA1   1469
            GAMMIN(ICDC)=AMN                                            FLODA1   1470
            ALPMAX(ICDC)=AMX                                            FLODA1   1471
         ELSE                                                           FLODA1   1472
            ALPMIN(ICDC)=AMN                                            FLODA1   1473
            ALPMAX(ICDC)=AMX                                            FLODA1   1474
         END IF                                                         FLODA1   1475
  470    CONTINUE                                                       FLODA1   1476
C                                                                       FLODA1   1477
         DO 490 I=1,NDCBS                                               FLODA1   1478
         READ(IUX,1370) KBUF                                            FLODA1   1479
         IF(LDEB)WRITE(IUD6,1370) KBUF                                  FLODA1   1480
         READ(KBUF,1770) IDC1,IBC,IADC,IZDC,NAMDC                       FLODA1   1481
         IF(LDEB)WRITE(IUD6,1770) IDC1,IBC,IADC,IZDC,NAMDC              FLODA1   1482
         IF(IBC.NE.0.AND.MNEW(IBC).EQ.0) THEN                           FLODA1   1483
            WRITE(MSG(1),1720)                                          FLODA1   1484
            CALL PRTMSG(1)                                              FLODA1   1485
            IF(LDEB)WRITE(IUD6,1140) IBC                                FLODA1   1486
            IEBK=1                                                      FLODA1   1487
         END IF                                                         FLODA1   1488
         IDCNOD(NONODR+IDC1)=NAMDC                                      FLODA1   1489
         IF(IBC.NE.0) THEN                                              FLODA1   1490
            DO 480 J=ICDC-NCONVE+1,ICDC                                 FLODA1   1491
            IF(JDCC(J).EQ.IBC) DCCNMR(J)(1:8)=NAMDC                     FLODA1   1492
  480       CONTINUE                                                    FLODA1   1493
         ELSE                                                           FLODA1   1494
            XDNODE(NONODR+IDC1)=0.0                                     FLODA1   1495
            ILDC=ILDC+1                                                 FLODA1   1496
            DCLNMR(ILDC)(1:8)=NAMDC                                     FLODA1   1497
            DCLNMR(ILDC)(9:16)='GROUND  '                               FLODA1   1498
            DCLNMR(ILDC)(17:17)='1'                                     FLODA1   1499
            IDCL(ILDC)=ILDC                                             FLODA1   1500
            RDCOHM(ILDC)=1.0E+7                                         FLODA1   1501
            XLDC(ILDC)=0.0                                              FLODA1   1502
            CDCA(ILDC)=0.0                                              FLODA1   1503
            CDCB(ILDC)=0.0                                              FLODA1   1504
         END IF                                                         FLODA1   1505
  490    CONTINUE                                                       FLODA1   1506
         NONODR=NONODR+NDCBS                                            FLODA1   1507
C                                                                       FLODA1   1508
         DO 500 I=1,NDCLN                                               FLODA1   1509
         ILDC=ILDC+1                                                    FLODA1   1510
         READ(IUX,1370) KBUF                                            FLODA1   1511
         IF(LDEB)WRITE(IUD6,1370) KBUF                                  FLODA1   1512
         READ(KBUF,1780) IDC1,JDC,DCLNMR(ILDC)(17:17),RDC               FLODA1   1513
         IF(LDEB)WRITE(IUD6,1780) IDC1,JDC,DCLNMR(ILDC)(17:17),RDC      FLODA1   1514
         DCLNMR(ILDC)(1:8)=IDCNOD(NONODR-NDCBS+IABS(IDC1))              FLODA1   1515
         DCLNMR(ILDC)(9:16)=IDCNOD(NONODR-NDCBS+IABS(JDC))              FLODA1   1516
         IDCL(ILDC)=ILDC                                                FLODA1   1517
         RDCOHM(ILDC)=RDC                                               FLODA1   1518
         XLDC(ILDC)=0.0                                                 FLODA1   1519
         CDCA(ILDC)=0.0                                                 FLODA1   1520
         CDCB(ILDC)=0.0                                                 FLODA1   1521
  500    CONTINUE                                                       FLODA1   1522
C                                                                       FLODA1   1523
C     Initialize udc arrays, structure arrays and fixed arrays.         FLODA1   1524
C                                                                       FLODA1   1525
         DO 530 KI=1,NCONVE                                             FLODA1   1526
         NLF=JDCC(ICDC-NCONVE+KI)                                       FLODA1   1527
         FOUND = .FALSE.                                                FLODA1   1528
         I = 1                                                          FLODA1   1529
  510    IF(FOUND .OR. I .GT. NACBUS) GOTO 520                          FLODA1   1530
         IF(NLF.EQ.IUQABU(I))THEN                                       FLODA1   1531
            FOUND = .TRUE.                                              FLODA1   1532
         ELSE                                                           FLODA1   1533
            I = I + 1                                                   FLODA1   1534
         ENDIF                                                          FLODA1   1535
         GOTO 510                                                       FLODA1   1536
  520    CONTINUE                                                       FLODA1   1537
         IF(.NOT. FOUND)THEN                                            FLODA1   1538
            NACBUS = NACBUS+1                                           FLODA1   1539
            IUQABU(NACBUS) = NLF                                        FLODA1   1540
         ENDIF                                                          FLODA1   1541
         IF(LDEB) WRITE(IUD6,1670) IUQABU(NACBUS)                       FLODA1   1542
C                                                                       FLODA1   1543
  530    CONTINUE                                                       FLODA1   1544
C                                                                       FLODA1   1545
         SPTYPE(ICDC)= 'ALAT'                                           FLODA1   1546
         SPTYP3(ICDC)= 'NO'                                             FLODA1   1547
         ICTYPE(ICDC)= 1                                                FLODA1   1548
         GO TO 450                                                      FLODA1   1549
      END IF                                                            FLODA1   1550
C                                                                       FLODA1   1551
C  READ MULTI-SECTION LINE GROUPING DATA                                FLODA1   1552
C                                                                       FLODA1   1553
  531 READ(IUX,1370) KBUF                                               FLODA1   1554
      IF(LDEB)WRITE(IUD6,1370) KBUF                                     FLODA1   1555
      READ(KBUF,1450) K                                                 FLODA1   1556
      IF(K.NE.0) GOTO 531                                               FLODA1   1557
C                                                                       FLODA1   1558
C     ZONE NAME                                                         FLODA1   1559
C                                                                       FLODA1   1560
  590 CONTINUE                                                          FLODA1   1561
      IAZNAM='            '                                             FLODA1   1562
      DO 591 K=1,JZN                                                    FLODA1   1563
      NAMZN(K,1)=JAZNAM(1)                                              FLODA1   1564
      NAMZN(K,2)=JAZNAM(2)                                              FLODA1   1565
      NAMZN(K,3)=JAZNAM(3)                                              FLODA1   1566
 591  CONTINUE                                                          FLODA1   1567
      NUMZON=0                                                          FLODA1   1568
C                                                                       FLODA1   1569
  592 READ(IUX,'(A)',IOSTAT=IOS) KBUF                                   FLODA1   1570
      IF(IOS.NE.0) GOTO 600                                             FLODA1   1571
      IF(LDEB)WRITE(IUD6,1440) KBUF                                     FLODA1   1572
      READ(KBUF,*) K                                                    FLODA1   1573
      IF(K.NE.0)THEN                                                    FLODA1   1574
         IF(K.GT.JZN) GOTO 592                                          FLODA1   1575
         READ(KBUF,*,IOSTAT=IOS) K,IAZNAM                               FLODA1   1576
         IF(IOS.NE.0) IAZNAM='            '                             FLODA1   1577
C                                                                       FLODA1   1578
         NUMZON=NUMZON+1                                                FLODA1   1579
         NAMZN(NUMZON,1)=JAZNAM(1)                                      FLODA1   1580
         NAMZN(NUMZON,2)=JAZNAM(2)                                      FLODA1   1581
         NAMZN(NUMZON,3)=JAZNAM(3)                                      FLODA1   1582
         INTZON(NUMZON)=K                                               FLODA1   1583
         MNEWZ(K+1)=NUMZON                                              FLODA1   1584
C                                                                       FLODA1   1585
         GOTO 592                                                       FLODA1   1586
      ENDIF                                                             FLODA1   1587
C                                                                       FLODA1   1588
      IF(NUMZON.EQ.0)THEN                                               FLODA1   1589
        INTZON(1)=1                                                     FLODA1   1590
        MNEWZ(1+1)=1                                                    FLODA1   1591
        NUMZON=1                                                        FLODA1   1592
      ENDIF                                                             FLODA1   1593
C                                                                       FLODA1   1594
      IAZNAM='            '                                             FLODA1   1595
      DO 593 K=1,NLFBUS                                                 FLODA1   1596
        KK=(K-1)*4                                                      FLODA1   1597
        ITFK=IBAR(KK+3)                                                 FLODA1   1598
        CALL UPACKI(IZONE,IAREA,ITFK)                                   FLODA1   1599
        IA=MNEWA(IAREA)                                                 FLODA1   1600
        IF(IA.EQ.0)THEN                                                 FLODA1   1601
          NMAREA=NMAREA+1                                               FLODA1   1602
          IARE(NMAREA,1)=JAZNAM(1)                                      FLODA1   1603
          IARE(NMAREA,2)=JAZNAM(2)                                      FLODA1   1604
          IARE(NMAREA,3)=JAZNAM(3)                                      FLODA1   1605
          INTARA(NMAREA)=IAREA                                          FLODA1   1606
          MNEWA(IAREA)=NMAREA                                           FLODA1   1607
        ENDIF                                                           FLODA1   1608
        IZ=MNEWZ(IZONE+1)                                               FLODA1   1609
        IF(IZ.EQ.0)THEN                                                 FLODA1   1610
          NUMZON=NUMZON+1                                               FLODA1   1611
          NAMZN(NUMZON,1)=JAZNAM(1)                                     FLODA1   1612
          NAMZN(NUMZON,2)=JAZNAM(2)                                     FLODA1   1613
          NAMZN(NUMZON,3)=JAZNAM(3)                                     FLODA1   1614
          INTZON(NUMZON)=IZONE                                          FLODA1   1615
          MNEWZ(IZONE+1)=NUMZON                                         FLODA1   1616
        ENDIF                                                           FLODA1   1617
593   CONTINUE                                                          FLODA1   1618
C                                                                       FLODA1   1619
      CONTINUE                                                          FLODA1   1620
      NACBU2=NACBUS                                                     FLODA1   1621
      NACTOT=NACBUS                                                     FLODA1   1622
      LCDC=ICDC                                                         FLODA1   1623
      KCDC=ICDC                                                         FLODA1   1624
      ISIZEC=ICDC+1                                                     FLODA1   1625
      ISIZEL=ILDC+1                                                     FLODA1   1626
      ISIZEB = 0                                                        FLODA1   1627
      NUMNOD = NONODR                                                   FLODA1   1628
C                                                                       FLODA1   1629
      DO 540 I = 1, NDCC                                                FLODA1   1630
      DCCNAM(I) = DCCNMR(I)                                             FLODA1   1631
  540 CONTINUE                                                          FLODA1   1632
C                                                                       FLODA1   1633
      DO 550 I = 1, NDCL                                                FLODA1   1634
      DCLNAM(I) = DCLNMR(I)                                             FLODA1   1635
  550 CONTINUE                                                          FLODA1   1636
C                                                                       FLODA1   1637
      DO 560 I = 1, NDCB                                                FLODA1   1638
      DCBNAM(I) = DCBNMR(I)                                             FLODA1   1639
  560 CONTINUE                                                          FLODA1   1640
C                                                                       FLODA1   1641
C     READ MTDC SOLUTION (CREATED BY ACTIVITY: MTDC)                    FLODA1   1642
C                                                                       FLODA1   1643
      IUX1=IUX                                                          FLODA1   1644
      K=4*MDCLK                                                         FLODA1   1645
      MTDCN=NUMNOD-K                                                    FLODA1   1646
C                                                                       FLODA1   1647
      IF(MTDCN.GT.0) THEN                                               FLODA1   1648
  570    READ(IUX1,1370) KBUF                                           FLODA1   1649
         IF(LDEB)WRITE(IUD6,1370) KBUF                                  FLODA1   1650
         IF(KBUF(1:5).EQ.' FROM'.AND.KBUF(21:24).EQ.'(DC)') THEN        FLODA1   1651
            K=K+1                                                       FLODA1   1652
            READ(KBUF,1790) VDCN                                        FLODA1   1653
            READ(IUX1,1370) KBUF                                        FLODA1   1654
            IF(KBUF(21:24).NE.'(DC)') THEN                              FLODA1   1655
               READ(KBUF,1800) IBC,DCMW                                 FLODA1   1656
               DO 580 J=ICDC-NCONVE+1,ICDC                              FLODA1   1657
               IF(JDCC(J).EQ.IBC) GO TO 585                             FLODA1   1658
  580          CONTINUE                                                 FLODA1   1659
  585          CONTINUE                                                 FLODA1   1660
C                                                                       FLODA1   1661
C     CONVETER DC VOLTAGE, CURRENT, AND AC POWER                        FLODA1   1662
C                                                                       FLODA1   1663
               VDCONV(J)=VDCN                                           FLODA1   1664
               PAHVDC(J)=DCMW                                           FLODA1   1665
               XDCONV(J)=-PAHVDC(J)/VDCONV(J)                           FLODA1   1666
C                                                                       FLODA1   1667
C     COMPUTE HT CONVERTER BUS VOLTAGES                                 FLODA1   1668
C                                                                       FLODA1   1669
               KCH=JDCC(J)                                              FLODA1   1670
               JCH=MNEW(KCH)                                            FLODA1   1671
               IF(LDEB)WRITE(IUD6,1020) KCH,JCH                         FLODA1   1672
C                                                                       FLODA1   1673
               KK=(JCH-1)*8                                             FLODA1   1674
               TRC=TAPNOM(J)                                            FLODA1   1675
               TAPC=TAPPOS(J)                                           FLODA1   1676
               EBASC=VABASE(J)                                          FLODA1   1677
               ECRH=ERBUS(KK+1)*EBASC*TRC*TAPC                          FLODA1   1678
               ECIH=EIBUS(KK+2)*EBASC*TRC*TAPC                          FLODA1   1679
               EMC=ECRH**2+ECIH**2                                      FLODA1   1680
               ANGC=ATAN(ECIH/ECRH)                                     FLODA1   1681
C                                                                       FLODA1   1682
               IF(LDEB)WRITE(IUD6,1750) ECRH,ECIH,ANGC                  FLODA1   1683
C                                                                       FLODA1   1684
               XCC=XCOHMS(J)                                            FLODA1   1685
               XNBC=REAL(NSBRDG(J))                                     FLODA1   1686
               VDCC0=PI32*XNBC*SQRT(EMC)                                FLODA1   1687
C                                                                       FLODA1   1688
C     CALCULATE COS OF ALPHA AND GAMMA                                  FLODA1   1689
C                                                                       FLODA1   1690
               IF(QINV(J)) THEN                                         FLODA1   1691
                  CALPHA(J)=(-VDCONV(J)-3.0/PII*XNBC*XCC                FLODA1   1692
     &            *XDCONV(J))/VDCC0                                     FLODA1   1693
                  CGAMMA(J)=(VDCONV(J)-3.0/PII*XNBC*XCC                 FLODA1   1694
     &            *XDCONV(J))/VDCC0                                     FLODA1   1695
                  AMX=ALPMAX(J)                                         FLODA1   1696
                  AMN=GAMMIN(J)                                         FLODA1   1697
                  COSAMN=-6.0/PII*XNBC*XCC*XDCONV(J)/VDCC0              FLODA1   1698
     &            -COS(AMX*PII/180.0)                                   FLODA1   1699
                  IF(COSAMN.GT.1.0) COSAMN=1.0                          FLODA1   1700
                  ALPMIN(J)=180.0/PII*ACOS(COSAMN)                      FLODA1   1701
                  COSAMX=-6.0/PII*XNBC*XCC*XDCONV(J)/VDCC0              FLODA1   1702
     &            -COS(AMN*PII/180.0)                                   FLODA1   1703
                  ALPMAX(J)=180.0/PII*ACOS(COSAMX)                      FLODA1   1704
               ELSE                                                     FLODA1   1705
                  CALPHA(J)=(VDCONV(J)+3.0/PII*XNBC*XCC                 FLODA1   1706
     &            *XDCONV(J))/VDCC0                                     FLODA1   1707
                  CGAMMA(J)=(-VDCONV(J)+3.0/PII*XNBC*XCC                FLODA1   1708
     &            *XDCONV(J))/VDCC0                                     FLODA1   1709
                  AMX=ALPMAX(J)                                         FLODA1   1710
                  COSGMN=6.0/PII*XNBC*XCC*XDCONV(J)/VDCC0               FLODA1   1711
     &            -COS(AMX*PII/180.0)                                   FLODA1   1712
                  IF(COSGMN.GT.1.0) COSGMN=1.0                          FLODA1   1713
                  GAMMIN(J)=180.0/PII*ACOS(COSGMN)                      FLODA1   1714
               END IF                                                   FLODA1   1715
               IF(LDEB)WRITE(IUD6,1620) CALPHA(J),CGAMMA(J)             FLODA1   1716
               IF(LDEB)WRITE(IUD6,1590) ALPMIN(J)                       FLODA1   1717
     &         ,ALPMAX(J),GAMMIN(J)                                     FLODA1   1718
C                                                                       FLODA1   1719
C     CALCULATE POWER FACTOR IN RAD.                                    FLODA1   1720
C                                                                       FLODA1   1721
C     CALCULATE REACTIVE POWER                                          FLODA1   1722
C                                                                       FLODA1   1723
               ALPHA = ACOS(CALPHA(J))                                  FLODA1   1724
               GAMMA = ACOS(CGAMMA(J))                                  FLODA1   1725
               AMU = PII-ALPHA-GAMMA                                    FLODA1   1726
               TWOALP = 2.0*ALPHA                                       FLODA1   1727
               TWOAMU = 2.0*(ALPHA+AMU)                                 FLODA1   1728
               DCOS=COS(TWOALP)-COS(TWOAMU)                             FLODA1   1729
               IF(ABS(DCOS).GT.0.0001) THEN                             FLODA1   1730
                  TANPHI = 2.0*AMU+SIN(TWOALP)-SIN(TWOAMU)              FLODA1   1731
                  TANPHI = TANPHI/DCOS                                  FLODA1   1732
                  TANPHI = ABS(TANPHI)                                  FLODA1   1733
                  PHIDC(J)=ATAN(TANPHI)                                 FLODA1   1734
                  QAHVDC(J)=-ABS(PAHVDC(J))*TANPHI                      FLODA1   1735
               ELSE                                                     FLODA1   1736
                  PHIDC(J)=ACOS(ABS(VDCONV(J)/VDCC0))                   FLODA1   1737
                  QAHVDC(J)=-SQRT((VDCC0*XDCONV(J))**2                  FLODA1   1738
     &            -PAHVDC(J)**2)                                        FLODA1   1739
               ENDIF                                                    FLODA1   1740
               IF(LDEB)WRITE(IUD6,1580) PHIDC(J)                        FLODA1   1741
C                                                                       FLODA1   1742
C     CALCULATE AC CURRENTS                                             FLODA1   1743
C                                                                       FLODA1   1744
               CICR=(PAHVDC(J)*ECRH+QAHVDC(J)*ECIH)/EMC                 FLODA1   1745
               CICI=(PAHVDC(J)*ECIH-QAHVDC(J)*ECRH)/EMC                 FLODA1   1746
               XACURR(J)=-SQRT(CICR**2+CICI**2)*VABASE(J)/PABASE        FLODA1   1747
               IF(LDEB)WRITE(IUD6,1040) XACURR(J)                       FLODA1   1748
C                                                                       FLODA1   1749
C     DC REAL AND REACTIVE POWERS IN PU                                 FLODA1   1750
C                                                                       FLODA1   1751
               PAHVDC(J)=PAHVDC(J)/PABASE                               FLODA1   1752
               QAHVDC(J)=QAHVDC(J)/PABASE                               FLODA1   1753
               IF(LDEB) WRITE(IUD6,1570) PAHVDC(J),QAHVDC(J)            FLODA1   1754
C                                                                       FLODA1   1755
C     DC CONVERTER  VOLTAGE IN PU                                       FLODA1   1756
C                                                                       FLODA1   1757
               VDCONV(J)=VDCONV(J)/VDBASE                               FLODA1   1758
C                                                                       FLODA1   1759
C     DC CONVERTER AND NODE CURRENTS IN PU (LEAVING THE CONVERTER)      FLODA1   1760
C                                                                       FLODA1   1761
               XDCONV(J)=XDCONV(J)*VDBASE/PDBASE                        FLODA1   1762
               XDNODE(K)=XDCONV(J)                                      FLODA1   1763
            END IF                                                      FLODA1   1764
C                                                                       FLODA1   1765
C                                                                       FLODA1   1766
C     DC NODE VOLTAGE IN PU                                             FLODA1   1767
C                                                                       FLODA1   1768
C                                                                       FLODA1   1769
            VDCNOD(K)=VDCN/VDBASE                                       FLODA1   1770
            IF(LDEB) WRITE(IUD6,1560) VDCNOD(K)                         FLODA1   1771
            IF(LDEB) WRITE(IUD6,1550) XDNODE(K)                         FLODA1   1772
         END IF                                                         FLODA1   1773
         IF(K.LT.NUMNOD) GO TO 570                                      FLODA1   1774
      END IF                                                            FLODA1   1775
      DCEXST = .FALSE.                                                  FLODA1   1776
      IF(ICDC.GT.0) DCEXST = .TRUE.                                     FLODA1   1777
C                                                                       FLODA1   1778
C     DEBUG PRINTING OF ALL DC LINKS DATA                               FLODA1   1779
C                                                                       FLODA1   1780
      IF(LDEB.AND.ICDC.NE.0)THEN                                        FLODA1   1781
         WRITE(IUD6,1540) MDCLK,MTDCLK,ICDC,ILDC,NUMNOD                 FLODA1   1782
      END IF                                                            FLODA1   1783
C                                                                       FLODA1   1784
 600  LDUMP=0                                                           FLODA1   1785
C                                                                       FLODA1   1786
      IF(IEBK.NE.0)THEN                                                 FLODA1   1787
C!        STOP 'ROUTINE FLODA1 LOADFLOW DATA FILE ERROR'                FLODA1   1788
C!                                                                      FLODA1   1789
       MSG(1)='  *** WARNING LOADFLOW DATA FILE ERROR'                  FLODA1   1790
       CALL PRTMSG(1)                                                   FLODA1   1791
      ENDIF                                                             FLODA1   1792
C                                                                       FLODA1   1793
      RETURN                                                            FLODA1   1794
C                                                                       FLODA1   1795
 1000 FORMAT(2X,'DCLINK #=',I3,1X,'AC BASE KV; ',2F10.4)                FLODA1   1796
 1010 FORMAT(' *** WARNING AT DC LINK# ',I3,' GAMMA=',F7.2)             FLODA1   1797
 1011 FORMAT(5X,'IT EXCEEDS THE MAXIMUM LIMIT OF ',F7.2)                FLODA1   1798
 1020 FORMAT(2X,4(I5,2X))                                               FLODA1   1799
 1030 FORMAT(2X,'ERRH=',F10.5,'ERIH=',F10.5,'ANGR=',F10.6,              FLODA1   1800
     +'EIIH=',F10.5,'EIRH=',F10.5,'ANGI=',F10.5)                        FLODA1   1801
 1040 FORMAT(2X,'AC CURRENT OF DC CONVERTERS:',2F10.3)                  FLODA1   1802
C                                                                       FLODA1   1803
 1050 FORMAT(20A4)                                                      FLODA1   1804
 1060 FORMAT(I5,1X,I1,4F9.3,I4,F8.5,F10.4,2X,2A4,1X,F7.2,I4,A4)         FLODA1   1805
 1070 FORMAT(' *** ERROR BUS: ',I5                                      FLODA1   1806
     *,' HAS DUPLICATED DATA, CHECK YOUR LOADFLOW FILE.')               FLODA1   1807
 1080 FORMAT(' *** ERROR THE PROGRAM TOTAL BUS NUMBER LIMIT OF ',I5)    FLODA1   1808
 1081 FORMAT(5X,'IS EXCEEDED AT BUS: ',I5)                              FLODA1   1809
 1090 FORMAT(I5,A2,4F09.3,F8.5,I6,F8.3,5F8.5,I2)                        FLODA1   1810
 1100 FORMAT(' *** ERROR GENERATOR AT BUS: ',I5                         FLODA1   1811
     *,' IS NOT IN THE LOADFLOW')                                       FLODA1   1812
 1101 FORMAT(5X,'CHECK YOUR LOADFLOW FILE.')                            FLODA1   1813
 1110 FORMAT(2I5,A2,12E8.2,I2)                                          FLODA1   1814
 1120 FORMAT(' *** ERROR LINE ID ',3I6,' BUS NOT IN LOADFLOW')          FLODA1   1815
 1130 FORMAT(' *** ERROR LINE ID ',2I6,A2,' BUS NOT IN LOADFLOW')       FLODA1   1816
 1140 FORMAT(' *** ERROR DC BUS #',I6,'NOT IN LOAD FLOW')               FLODA1   1817
 1150 FORMAT(' *** ERROR LINE ID ',3I6,' EXCEEDS THE PROGRAM')          FLODA1   1818
 1151 FORMAT(5X,'LIMIT OF ',I10,' LINES')                               FLODA1   1819
 1160 FORMAT(' *** ERROR LINE ID ',2I6,A2,' EXCEEDS THE PROGRAM')       FLODA1   1820
 1170 FORMAT(I4)                                                        FLODA1   1821
 1180 FORMAT(I6,I2,22X,F8.2)                                            FLODA1   1822
 1190 FORMAT(1X,A4,A4,A1,1X,5A4,8X,A4,A2,1X,8A4)                        FLODA1   1823
 1200 FORMAT(A3,31X,I5)                                                 FLODA1   1824
 1210 FORMAT(' **** ERROR INFO WAS NOT SPECIFIED AS BUS DATA')          FLODA1   1825
 1220 FORMAT(I4,1X,3A4,1X,I2,7X,F6.4,F7.2,2F9.2,F9.2,F8.2               FLODA1   1826
     &,31X,F8.4,F8.4)                                                   FLODA1   1827
 1230 FORMAT(' *** WARNING YOU HAVE ENTERED A TOTAL OF',I4,' BUS DATA') FLODA1   1828
C 1231 FORMAT(5X,'BUT YOU HAD SPECIFIED,',I4,'BUS DATA TO BE ENTERED')  FLODA1   1829
 1240 FORMAT(14A4)                                                      FLODA1   1830
 1250 FORMAT(3A4)                                                       FLODA1   1831
 1260 FORMAT(6A4)                                                       FLODA1   1832
 1270 FORMAT(18A4)                                                      FLODA1   1833
 1280 FORMAT(16I5)                                                      FLODA1   1834
 1290 FORMAT(I5,3A4,4F10.5)                                             FLODA1   1835
 1300 FORMAT(8F10.5)                                                    FLODA1   1836
 1310 FORMAT(A4,30X,I5)                                                 FLODA1   1837
 1320 FORMAT(' *** ERROR INFO WAS NOT SPECIFIED AS BRANCH DATA')        FLODA1   1838
 1330 FORMAT (I4,1X,I4,1X,I2,4X,A1,1X,I1,2F10.6,F10.5,26X,F7.4,F8.2)    FLODA1   1839
 1340 FORMAT(' *** WARNING YOU HAVE A TOTAL OF',I4,'BRANCH DATA')       FLODA1   1840
 1341 FORMAT(5X,'BUT YOU HAD SPECIFIED',I4                              FLODA1   1841
     *,'BRANCH DATA TO BE ENTERED')                                     FLODA1   1842
 1350 FORMAT (2I5,3X,A2,5F10.5)                                         FLODA1   1843
 1360 FORMAT(I6,I3,F6.2,F6.2,F8.4,F8.4,F7.1,F8.5,F8.5)                  FLODA1   1844
 1370 FORMAT(A)                                                         FLODA1   1845
 1380 FORMAT(1X,'KBUF',/,1X,A)                                          FLODA1   1846
 1390 FORMAT(I5,I7,1X,A2,3F10.5,3F9.2,A3)                               FLODA1   1847
 1391 FORMAT(I5,I7,1X,A2,2F9.0,4F8.0,A3)                                FLODA1   1848
 1400 FORMAT(1X,'1400 K ',I5,'JCOM3=',A3,' ICOM3=',A3)                  FLODA1   1849
 1410 FORMAT(T76,4F9.4,I2)                                              FLODA1   1850
 1411 FORMAT(T69,4F10.0,I2)                                             FLODA1   1851
 1420 FORMAT(T73,F8.5,F9.3,4F9.4,I2)                                    FLODA1   1852
 1421 FORMAT(T66,F8.0,F9.0,4F10.0,I2)                                   FLODA1   1853
C 1430 FORMAT(1X,'1430 K=',I5)                                          FLODA1   1854
 1440 FORMAT(1X,'1440 K=',I5)                                           FLODA1   1855
 1450 FORMAT(I3)                                                        FLODA1   1856
 1460 FORMAT(1X,'ICPT=',I3)                                             FLODA1   1857
 1470 FORMAT(1X,I2,I2,F11.4,F11.2,F11.2,T43,F11.5)                      FLODA1   1858
 1480 FORMAT(1X,I2,I2,F11.4,F11.2,F11.2,F11.2,F11.4,F11.5)              FLODA1   1859
 1490 FORMAT(1X,I2,I2,F11.4,F11.2,F11.2,T41,F11.4,F11.5)                FLODA1   1860
 1500 FORMAT(1X,I2,I2,F11.4,F11.2,F11.2,F11.2,T52,F11.5)                FLODA1   1861
 1510 FORMAT(' *** ERROR CHECK DC REC BUS -IS 0')                       FLODA1   1862
 1520 FORMAT(2X,'MDCLK=',I2,2X,I5)                                      FLODA1   1863
 1530 FORMAT(' *** ERROR CHECK DC INV BUS -IS 0')                       FLODA1   1864
 1540 FORMAT(1X,'END READ DC LINKS. #OF 2-T LINKS=',I3,' #OF MT LINKS'  FLODA1   1865
     &,I3,' #OF CONVERTERS=',I3,' #OF LINES=',I3,' #OF NODES=',I3)      FLODA1   1866
 1550 FORMAT(1X,'DC NODE CURRENTS:',4F10.3)                             FLODA1   1867
 1560 FORMAT(1X,'DC NODE VOLTAGES:',4F10.3)                             FLODA1   1868
 1570 FORMAT(1X,'DC CONVERTERS REAL AND REACTIVE POWERS(PU):',4F10.3)   FLODA1   1869
 1580 FORMAT(1X,'DC CONVERTERS POWER FACTOR ANGLES(RAD):',2F10.3)       FLODA1   1870
 1590 FORMAT(1X,'DC CONVERTERS AMIN,AMAX,GMIN(DEG):',6F10.3)            FLODA1   1871
 1600 FORMAT(1X,'*** ERROR-RECTIFIER HT BUS NOT IN LF BUS DATA')        FLODA1   1872
 1610 FORMAT(1X,'*** ERROR-INVERTER HT BUS NOT IN LF BUS DATA')         FLODA1   1873
 1620 FORMAT(1X,'DC CONVERTERS COSA,COSG:',4F10.3)                      FLODA1   1874
 1630 FORMAT(1X,'FLODA1 NSEL ETC.',3I5,1X,A2,5G12.5)                    FLODA1   1875
 1640 FORMAT(' *** 2TDC LINK # ',I2,'  VABASE=',F10.2,                  FLODA1   1876
     &'  XBASKV=',F10.2,' AT RECTIFIER')                                FLODA1   1877
 1650 FORMAT(1X,'RDCOHMS:',5E10.4)                                      FLODA1   1878
 1660 FORMAT(1X,'NBR,NBI,XCR,XCI:',2I5,2F10.4)                          FLODA1   1879
 1670 FORMAT(1X,'CONVERTER BUS#:',I6)                                   FLODA1   1880
 1680 FORMAT(1X,'CONVERTER:',2A30)                                      FLODA1   1881
 1690 FORMAT(I5)                                                        FLODA1   1882
 1700 FORMAT(5I3,I6,F11.2)                                              FLODA1   1883
 1710 FORMAT(' *** ERROR CHECK DC CONV. BUS -IS 0')                     FLODA1   1884
 1720 FORMAT(' *** ERROR CONVERTER HT BUS NOT IN LF BUS DATA')          FLODA1   1885
 1730 FORMAT(2X,'MCON=',I2,2X,I5)                                       FLODA1   1886
 1740 FORMAT(1X,'NBC,XCC:',I5,F10.4)                                    FLODA1   1887
 1750 FORMAT(2X,'ECRH=',F10.5,' ECIH=',F10.5,' ANGC=',F10.6)            FLODA1   1888
 1760 FORMAT(I6,I3,F6.2,F6.2,F8.4,F8.4,F7.1,5F8.5,F10.2,F8.4,F10.5 )    FLODA1   1889
 1770 FORMAT(I3,I6,2I4,2X,A8)                                           FLODA1   1890
 1780 FORMAT(I3,I4,1X,A1,F11.4)                                         FLODA1   1891
 1790 FORMAT(46X,F8.2)                                                  FLODA1   1892
 1800 FORMAT(6X,I5,26X,F9.1)                                            FLODA1   1893
C 1810 FORMAT(I2)                                                       FLODA1   1894
 1820 FORMAT(1X,'MTDC LINK # ',I2,'  VABASE=',F10.2,                    FLODA1   1895
     &'  XBASKV=',F10.2,' AT CONVERTER#',I2)                            FLODA1   1896
C 1830 FORMAT(30X,3F10.2)                                               FLODA1   1897
 1840 FORMAT(1X,'2TDC LINK # ',I2,'  VABASE=',F10.2,                    FLODA1   1898
     &'  XBASKV=',F10.2,' AT INVERTER')                                 FLODA1   1899
 1910 FORMAT(I5,1X,I5,1X,A2,2X,I5,5F9.5,2I2)                            FLODA1   1900
 1920 FORMAT(' *** ERROR LOADFLOW BUS NUMBER OF ',I6)                   FLODA1   1901
 1930 FORMAT(1X,'EXCEEDED THE LIMIT OF ',I5)                            FLODA1   1902
 2000  FORMAT(1X,'DB-FLODA1_NEW:K,J,IK,CORTBL1-22 ',I5,I5,I5,4G12.5,/,  FLODA1   1903
     +1X,10G12.5,/,1X,10G12.5)                                          FLODA1   1904
C 7110 FORMAT(1X,'DB-FLODA1_NEW:NSC,K,J,ICKT,NTBL ',I5,I7,I5,3X,A2,I5)  FLODA1   1905
C 7120 FORMAT(1X,'DB-FLODA1_NEW:IPSC,ISCFRM,ISCTO,ISCCID,ISCTBN ',I5,I7,FLODA1   1906
C     +I5,3X,A2,I5)                                                     FLODA1   1907
C 7310 FORMAT(1X,'DB-FLODA1_NEW:CORTBL1-110 ',/,(1X,11G12.5))           FLODA1   1908
C 7320 FORMAT(1X,'DB-FLODA1_NEW:ISC,IPSC,ISCFRM,ISCTO,ISCCID,ISCTBN ',  FLODA1   1909
C     +I5,I5,I7,I5,3X,A2,I5)                                            FLODA1   1910
        END                                                             FLODA1   1911
C                                                                       FLODA1   1912
