CFPRIME LSDBDA                                                          LSDBDA      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 LSDBDA(IU16,IEBK)                                      LSDBDA      3
CD                                                                      LSDBDA      4
CD    TO LOAD SDB DATA FROM ARRAYS JJDAT AND TDDAT TO ARRAYS JDDAT      LSDBDA      5
CD    AND DDAT.                                                         LSDBDA      6
CD                                                                      LSDBDA      7
      INCLUDE 'PARX.INS'                                                LSDBDA      8
      INCLUDE 'CNPT.INS'                                                LSDBDA      9
      INCLUDE 'CNMDAT.INS'                                              LSDBDA     10
      INCLUDE 'CNB19.INS'                                               LSDBDA     11
      INCLUDE 'CNSDB.INS'                                               LSDBDA     12
      INCLUDE 'CNFLAG.INS'                                              LSDBDA     13
      INCLUDE 'CNPARX.INS'                                              LSDBDA     14
      INCLUDE 'CNREN.INS'                                               LSDBDA     15
      INCLUDE 'CNMNEW.INS'                                              LSDBDA     16
      INCLUDE 'CNUDM.INS'                                               LSDBDA     17
      INCLUDE 'CNJPT.INS'                                               LSDBDA     18
      INCLUDE 'CNJDAT.INS'                                              LSDBDA     19
      INCLUDE 'CNTMDA.INS'                                              LSDBDA     20
      INCLUDE 'CNMSG.INS'                                               LSDBDA     21
C                                                                       LSDBDA     22
      CHARACTER*12 SDBA1                                                LSDBDA     23
      INTEGER  IBUSN(3)                                                 LSDBDA     24
      EQUIVALENCE (IBUSN(1),SDBA1)                                      LSDBDA     25
C                                                                       LSDBDA     26
      LDEB=(JDEB(8).NE.0)                                               LSDBDA     27
C                                                                       LSDBDA     28
C     READING SDB DATA                                                  LSDBDA     29
C                                                                       LSDBDA     30
      DO 100 J=1,JSDB                                                   LSDBDA     31
C                                                                       LSDBDA     32
      LTN=JSDBDA(J)                                                     LSDBDA     33
C                                                                       LSDBDA     34
      IF(KLFO.EQ.0)THEN                                                 LSDBDA     35
      NLF1=ITDDAT(LTN+1)                                                LSDBDA     36
      NDTYPX=ITDDAT(LTN+2)                                              LSDBDA     37
      IDIVX=ITDDAT(LTN+3)                                               LSDBDA     38
      LTN=LTN+3                                                         LSDBDA     39
      NPROG=MNEW(NLF1)                                                  LSDBDA     40
         IF(NPROG.EQ.0)THEN                                             LSDBDA     41
            WRITE(MSG(1),1040) NLF1                                     LSDBDA     42
            CALL PRTMSG(1)                                              LSDBDA     43
            MSG(1)='LSDBDA: SDB BUS NUMBER ERROR'                       LSDBDA     44
            CALL ASTOP(MSG(1),28)                                       LSDBDA     45
         ENDIF                                                          LSDBDA     46
      ELSE                                                              LSDBDA     47
      IBUSN(1)=ITDDAT(LTN+1)                                            LSDBDA     48
      IBUSN(2)=ITDDAT(LTN+2)                                            LSDBDA     49
      IBUSN(3)=ITDDAT(LTN+3)                                            LSDBDA     50
      NDTYPX=ITDDAT(LTN+4)                                              LSDBDA     51
      IDIVX=ITDDAT(LTN+5)                                               LSDBDA     52
      LTN=LTN+5                                                         LSDBDA     53
      CALL CHKBUS(SDBA1,NLF1)                                           LSDBDA     54
         IF(NLF1.LE.0)THEN                                              LSDBDA     55
         WRITE(MSG(1),1090) SDBA1                                       LSDBDA     56
         CALL PRTMSG(1)                                                 LSDBDA     57
         MSG(1)='LSDBDA: SDB BUS NAME ERROR'                            LSDBDA     58
         CALL ASTOP(MSG(1),26)                                          LSDBDA     59
         ENDIF                                                          LSDBDA     60
      NPROG=MNEW(NLF1)                                                  LSDBDA     61
      ENDIF                                                             LSDBDA     62
C                                                                       LSDBDA     63
      IF(JBSTAT(NPROG).GT.2)GOTO 100                                    LSDBDA     64
      NSDB=NSDB+1                                                       LSDBDA     65
      IF(NSDB.GT.NXSDB)GOTO 120                                         LSDBDA     66
      JDDAT(NSDB)=JLN                                                   LSDBDA     67
      IDDAT(JLN+1)=NLF1                                                 LSDBDA     68
      IDDAT(JLN+2)=NDTYPX                                               LSDBDA     69
      IDDAT(JLN+3)=IDIVX                                                LSDBDA     70
      JLN=JLN+3                                                         LSDBDA     71
C                                                                       LSDBDA     72
      IF (NDTYPX.NE.50) GO TO 110                                       LSDBDA     73
C                                                                       LSDBDA     74
C     USER DEFINED SDB DATA                                             LSDBDA     75
C                                                                       LSDBDA     76
      LTN1=0                                                            LSDBDA     77
      JLN1=0                                                            LSDBDA     78
      LTN=LTN+2                                                         LSDBDA     79
      JLN=JLN+2                                                         LSDBDA     80
      NUF=9                                                             LSDBDA     81
      CALL LUDMDA(NUF,JLN1,LTN)                                         LSDBDA     82
      IF(NUF.EQ.900) GO TO 900                                          LSDBDA     83
      CALL MCHECK (NLF1,14,JLN,'LSDBDA')                                LSDBDA     84
  100 CONTINUE                                                          LSDBDA     85
      GOTO 130                                                          LSDBDA     86
C                                                                       LSDBDA     87
  110 CONTINUE                                                          LSDBDA     88
      IF(KLFO.EQ.0)THEN                                                 LSDBDA     89
      WRITE(MSG(1),1010) NLF1,NDTYPX                                    LSDBDA     90
      ELSE                                                              LSDBDA     91
      WRITE(MSG(1),1070) SDBA1,NDTYPX                                   LSDBDA     92
      ENDIF                                                             LSDBDA     93
      CALL PRTMSG(1)                                                    LSDBDA     94
      MSG(1)='LSDBDA: SDB TYPE ERROR'                                   LSDBDA     95
      CALL ASTOP(MSG(1),22)                                             LSDBDA     96
C                                                                       LSDBDA     97
  120 CONTINUE                                                          LSDBDA     98
      IF(KLFO.EQ.0)THEN                                                 LSDBDA     99
      WRITE (MSG(1),1030) NLF1,NXSDB                                    LSDBDA    100
      ELSE                                                              LSDBDA    101
      WRITE(MSG(1),1080) SDBA1,NXSDB                                    LSDBDA    102
      ENDIF                                                             LSDBDA    103
      CALL PRTMSG(1)                                                    LSDBDA    104
C                                                                       LSDBDA    105
      IEBK=1                                                            LSDBDA    106
C                                                                       LSDBDA    107
  130 CONTINUE                                                          LSDBDA    108
C                                                                       LSDBDA    109
      RETURN                                                            LSDBDA    110
C                                                                       LSDBDA    111
  900 CONTINUE                                                          LSDBDA    112
      IF(KLFO.EQ.0)THEN                                                 LSDBDA    113
      WRITE(MSG(1),1000) NLF1                                           LSDBDA    114
      ELSE                                                              LSDBDA    115
      WRITE(MSG(1),1060) SDBA1                                          LSDBDA    116
      ENDIF                                                             LSDBDA    117
      CALL PRTMSG(1)                                                    LSDBDA    118
      MSG(1)='LSDBDA CONTROL DATA ERROR'                                LSDBDA    119
      CALL ASTOP(MSG(1),25)                                             LSDBDA    120
C                                                                       LSDBDA    121
 1000 FORMAT(' *** ERROR CHECK THE CONTROL DATA OF SDB AT BUS:',I5)     LSDBDA    122
 1060 FORMAT(' *** ERROR CHECK THE CONTROL DATA OF SDB AT BUS:',A12)    LSDBDA    123
 1010 FORMAT(' *** ERROR SDB AT BUS:',I5,' HAS UNKOWN TYPE',I5)         LSDBDA    124
 1070 FORMAT(' *** ERROR SDB AT BUS:',A12,' HAS UNKOWN TYPE',I5)        LSDBDA    125
 1030 FORMAT(' *** ERROR SDB AT BUS:',I5,' EXCEEDS THE LIMIT OF ',I4)   LSDBDA    126
 1080 FORMAT(' *** ERROR SDB AT BUS:',A12,' EXCEEDS THE LIMIT OF ',I4)  LSDBDA    127
 1040 FORMAT(' *** ERROR SDB BUS NUMBER ERROR',I6)                      LSDBDA    128
 1090 FORMAT(' *** ERROR SDB BUS NUMBER ERROR ',A12)                    LSDBDA    129
      END                                                               LSDBDA    130
