CFPRIME LRANDA                                                          LRANDA      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 LRANDA(IU16,IEBK)                                      LRANDA      3
CD                                                                      LRANDA      4
CD    TO LOAD RANI DATA FROM ARRAYS JJRDAT AND TDDAT TO ARRAYS JRDAT    LRANDA      5
CD    AND DDAT.                                                         LRANDA      6
CD                                                                      LRANDA      7
      INCLUDE 'PARX.INS'                                                LRANDA      8
      INCLUDE 'CNPT.INS'                                                LRANDA      9
      INCLUDE 'CNMDAT.INS'                                              LRANDA     10
      INCLUDE 'CNB19.INS'                                               LRANDA     11
      INCLUDE 'CNRAN.INS'                                               LRANDA     12
      INCLUDE 'CNFLAG.INS'                                              LRANDA     13
      INCLUDE 'CNPARX.INS'                                              LRANDA     14
      INCLUDE 'CNREN.INS'                                               LRANDA     15
      INCLUDE 'CNMNEW.INS'                                              LRANDA     16
      INCLUDE 'CNUDM.INS'                                               LRANDA     17
      INCLUDE 'CNJPT.INS'                                               LRANDA     18
      INCLUDE 'CNTMDA.INS'                                              LRANDA     19
      INCLUDE 'CNJDAT.INS'                                              LRANDA     20
      INCLUDE 'CNMSG.INS'                                               LRANDA     21
C                                                                       LRANDA     22
C                                                                       LRANDA     23
      CHARACTER*80 SIMBUF                                               LRANDA     24
      CHARACTER*12 RANIA1,RANIA2                                        LRANDA     25
      CHARACTER*2 ICKT                                                  LRANDA     26
      INTEGER IBUSN(3),JBUSN(3)                                         LRANDA     27
C                                                                       LRANDA     28
      EQUIVALENCE (IBUSN(1),RANIA1),(JBUSN(1),RANIA2)                   LRANDA     29
C                                                                       LRANDA     30
C     READING RANI DATA                                                 LRANDA     31
C                                                                       LRANDA     32
      LDEB=(JDEB(8).NE.0)                                               LRANDA     33
C                                                                       LRANDA     34
      DO 130 J=1,JRANI                                                  LRANDA     35
C                                                                       LRANDA     36
      IF(JSTRAN(J).GT.2)GOTO 130                                        LRANDA     37
      LTN=JJRDAT(J)                                                     LRANDA     38
C                                                                       LRANDA     39
      IF(KLFO.EQ.0)THEN                                                 LRANDA     40
      NLF1=ITDDAT(LTN+1)                                                LRANDA     41
      NLF2=ITDDAT(LTN+2)                                                LRANDA     42
      JCKID=ITDDAT(LTN+3)                                               LRANDA     43
      CALL UNPACK(ICKT,JJJ,JCKID)                                       LRANDA     44
      NRTYPX=ITDDAT(LTN+4)                                              LRANDA     45
      IBFARX=ITDDAT(LTN+5)                                              LRANDA     46
      IDIVX=ITDDAT(LTN+7)                                               LRANDA     47
      LTN=LTN+7                                                         LRANDA     48
         IF(MNEW(NLF1).EQ.0)THEN                                        LRANDA     49
            WRITE(MSG(1),1060) NLF1,NLF2,ICKT                           LRANDA     50
            CALL PRTMSG(1)                                              LRANDA     51
            SIMBUF='LRANDA: RANI BUS1 NUMBER ERROR'                     LRANDA     52
            CALL ASTOP(SIMBUF,40)                                       LRANDA     53
         ENDIF                                                          LRANDA     54
         IF(MNEW(NLF2).EQ.0)THEN                                        LRANDA     55
            WRITE(MSG(1),1060) NLF1,NLF2,ICKT                           LRANDA     56
            CALL PRTMSG(1)                                              LRANDA     57
            SIMBUF='LRANDA: RANI BUS2 NUMBER ERROR'                     LRANDA     58
            CALL ASTOP(SIMBUF,40)                                       LRANDA     59
         ENDIF                                                          LRANDA     60
      ELSE                                                              LRANDA     61
      IBUSN(1)=ITDDAT(LTN+1)                                            LRANDA     62
      IBUSN(2)=ITDDAT(LTN+2)                                            LRANDA     63
      IBUSN(3)=ITDDAT(LTN+3)                                            LRANDA     64
      JBUSN(1)=ITDDAT(LTN+4)                                            LRANDA     65
      JBUSN(2)=ITDDAT(LTN+5)                                            LRANDA     66
      JBUSN(3)=ITDDAT(LTN+6)                                            LRANDA     67
      JCKID=ITDDAT(LTN+7)                                               LRANDA     68
      CALL UNPACK(ICKT,JJJ,JCKID)                                       LRANDA     69
      NRTYPX=ITDDAT(LTN+8)                                              LRANDA     70
      IBFARX=ITDDAT(LTN+9)                                              LRANDA     71
      IDIVX=ITDDAT(LTN+11)                                              LRANDA     72
      LTN=LTN+11                                                        LRANDA     73
      CALL CHKBUS(RANIA1,NLF1)                                          LRANDA     74
      CALL CHKBUS(RANIA2,NLF2)                                          LRANDA     75
         IF (NLF1.LE.0) THEN                                            LRANDA     76
            WRITE(MSG(1),1020)                                          LRANDA     77
            WRITE(MSG(2),1021) RANIA1,RANIA2,ICKT                       LRANDA     78
            CALL PRTMSG(2)                                              LRANDA     79
            SIMBUF='LRANDA: RANI BUS1 NAME ERROR'                       LRANDA     80
            CALL ASTOP(SIMBUF,28)                                       LRANDA     81
         ENDIF                                                          LRANDA     82
         IF (NLF2.LE.0) THEN                                            LRANDA     83
            WRITE(MSG(1),1020)                                          LRANDA     84
            WRITE(MSG(2),1021) RANIA1,RANIA2,ICKT                       LRANDA     85
            CALL PRTMSG(2)                                              LRANDA     86
            SIMBUF='LRANDA: RANI BUS2 NAME ERROR'                       LRANDA     87
            CALL ASTOP(SIMBUF,28)                                       LRANDA     88
         ENDIF                                                          LRANDA     89
      ENDIF                                                             LRANDA     90
C                                                                       LRANDA     91
      NRANI=NRANI+1                                                     LRANDA     92
      IF(NRANI.GT.NXRAN)GOTO 120                                        LRANDA     93
      JRDAT(NRANI)=JLN                                                  LRANDA     94
      IDDAT(JLN+1)=NLF1                                                 LRANDA     95
      IDDAT(JLN+2)=NLF2                                                 LRANDA     96
      IDDAT(JLN+3)=JCKID                                                LRANDA     97
      IDDAT(JLN+4)=NRTYPX                                               LRANDA     98
      IDDAT(JLN+5)=IBFARX                                               LRANDA     99
      IDDAT(JLN+7)=IDIVX                                                LRANDA    100
      JLN=JLN+7                                                         LRANDA    101
C                                                                       LRANDA    102
      IF (NRTYPX.NE.50) GO TO 110                                       LRANDA    103
C                                                                       LRANDA    104
C     USER DEFINED RANI DATA                                            LRANDA    105
C                                                                       LRANDA    106
      JLN1=JLN-1                                                        LRANDA    107
      JLN=JLN+4                                                         LRANDA    108
      NUF=6                                                             LRANDA    109
      CALL LUDMDA(NUF,JLN1,LTN)                                         LRANDA    110
      IF(NUF.EQ.900) GO TO 900                                          LRANDA    111
      CALL MCHECK (NLF1,14,JLN,'LRANDA')                                LRANDA    112
      GO TO 130                                                         LRANDA    113
C                                                                       LRANDA    114
  110 CONTINUE                                                          LRANDA    115
      IF(KLFO.EQ.0)THEN                                                 LRANDA    116
      WRITE(MSG(1),1050) NLF1,NLF2,ICKT,NRTYPX                          LRANDA    117
      ELSE                                                              LRANDA    118
      WRITE(MSG(1),1070) RANIA1,RANIA2,ICKT,NRTYPX                      LRANDA    119
      ENDIF                                                             LRANDA    120
      CALL PRTMSG(1)                                                    LRANDA    121
      SIMBUF='LRANDA: RANI TYPE ERROR'                                  LRANDA    122
      CALL ASTOP(SIMBUF,23)                                             LRANDA    123
C                                                                       LRANDA    124
  120 CONTINUE                                                          LRANDA    125
      IF(KLFO.EQ.0)THEN                                                 LRANDA    126
      WRITE(MSG(1),1010) NLF1,NLF2,ICKT                                 LRANDA    127
      ELSE                                                              LRANDA    128
      WRITE(MSG(1),1080) RANIA1,RANIA2,ICKT                             LRANDA    129
      ENDIF                                                             LRANDA    130
      WRITE(MSG(2),1011) NXRAN                                          LRANDA    131
      CALL PRTMSG(2)                                                    LRANDA    132
      IEBK=1                                                            LRANDA    133
  130 CONTINUE                                                          LRANDA    134
C                                                                       LRANDA    135
      RETURN                                                            LRANDA    136
C                                                                       LRANDA    137
  900 CONTINUE                                                          LRANDA    138
      IF(KLFO.EQ.0)THEN                                                 LRANDA    139
      WRITE(MSG(1),1040) NLF1,NLF2,ICKT                                 LRANDA    140
      CALL PRTMSG(1)                                                    LRANDA    141
      ELSE                                                              LRANDA    142
      WRITE(MSG(1),1090)                                                LRANDA    143
      WRITE(MSG(2),1100) RANIA1,RANIA2,ICKT                             LRANDA    144
      CALL PRTMSG(2)                                                    LRANDA    145
      ENDIF                                                             LRANDA    146
      SIMBUF='LRANDA: CONTROL DATA ERROR'                               LRANDA    147
      CALL ASTOP(SIMBUF,26)                                             LRANDA    148
C                                                                       LRANDA    149
 1010 FORMAT(' *** ERROR RANI BETWEEN BUSES',2I6,' CCT#',1X,A2,         LRANDA    150
     &' EXCEEDS')                                                       LRANDA    151
 1080 FORMAT(' *** ERROR RANI BETWEEN BUSES ',A12,1X,A12,' CCT#',1X,A2  LRANDA    152
     &,' EXCEEDS')                                                      LRANDA    153
 1011 FORMAT(11X,'THE LIMIT OF ',I4,' INCREASE NXRAN IN PARX.INS')      LRANDA    154
 1060 FORMAT(' *** RANI BUS NUMBER ERROR CHECK THE FOLLOWING CARD',2I6  LRANDA    155
     &,' CCT#',1X,A2)                                                   LRANDA    156
 1020 FORMAT(' *** RANI BUS NAME ERROR CHECK THE FOLLOWING CARD')       LRANDA    157
 1021 FORMAT(10X,2(1X,A12),1X,A2)                                       LRANDA    158
 1040 FORMAT(' *** ERROR CHECK THE CONTROL DATA OF RANI BETWEEN BUSES'  LRANDA    159
     *,2I6,' CCT#',1X,A2)                                               LRANDA    160
 1090 FORMAT(' *** ERROR CHECK THE CONTROL DATA OF RANI BETWEEN BUSES') LRANDA    161
 1100 FORMAT(11X,A12,1X,A12,1X,'CCT#',1X,A2)                            LRANDA    162
 1050 FORMAT(' *** ERROR RANI BETWEEN BUSES',2I6,' CCT3',1X,A2          LRANDA    163
     &,' HAS UNKOWN TYPE',I3)                                           LRANDA    164
 1070 FORMAT(' *** ERROR RANI BETWEEN BUSES',2(1X,A12),1X,'CCT#',1X,A2  LRANDA    165
     *,'HAS UNKOWN TYPE',I3)                                            LRANDA    166
      END                                                               LRANDA    167
