CFPRIME SDBINT                                                          SDBINT      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 SDBINT(*)                                              SDBINT      3
CD                                                                      SDBINT      4
CD    THIS ROUTINE PERFORMS THE INITIALIZATION OF ALL SDB.              SDBINT      5
CD                                                                      SDBINT      6
      INCLUDE 'PARX.INS'                                                SDBINT      7
      INCLUDE 'CNPT.INS'                                                SDBINT      8
      INCLUDE 'CNIPTR.INS'                                              SDBINT      9
      INCLUDE 'CNSDB.INS'                                               SDBINT     10
      INCLUDE 'CNUDM.INS'                                               SDBINT     11
      INCLUDE 'CNXSTA.INS'                                              SDBINT     12
      INCLUDE 'CNMDAT.INS'                                              SDBINT     13
      INCLUDE 'CNVOLT.INS'                                              SDBINT     14
      INCLUDE 'CNYVAR.INS'                                              SDBINT     15
      INCLUDE 'CNFLAG.INS'                                              SDBINT     16
C                                                                       SDBINT     17
      CHARACTER*2 LCKT                                                  SDBINT     18
      DATA LCKT/'  '/                                                   SDBINT     19
C                                                                       SDBINT     20
      LDEB=.FALSE.                                                      SDBINT     21
C                                                                       SDBINT     22
      DO 100 N=1,NSDB                                                   SDBINT     23
      IF(JY+4+NXUDB.GT.NSI) RETURN 1                                    SDBINT     24
      JD=JDDAT(N)                                                       SDBINT     25
      JXSDB(N)=JSTATE                                                   SDBINT     26
      JVSDB(N)=JY                                                       SDBINT     27
      K1=IDDAT(JD+1)                                                    SDBINT     28
      VR1=REAL(VOLT(K1))                                                SDBINT     29
      VI1=AIMAG(VOLT(K1))                                               SDBINT     30
      VM1=SQRT(VR1**2+VI1**2)                                           SDBINT     31
      NDTYPN=IDDAT(JD+2)                                                SDBINT     32
      YSDB(JY+1)=0.0                                                    SDBINT     33
C                                                                       SDBINT     34
      IF(NDTYPN.EQ.50) THEN                                             SDBINT     35
         JE0=JD+3                                                       SDBINT     36
         CALL FMOVE(0,VALIN,VALIN,80)                                   SDBINT     37
         VALIN(7)=VM1                                                   SDBINT     38
         IF(VM1.GT.0.05)VALIN(9)=ATAN2(VI1,VR1)                         SDBINT     39
         IDDAT(JE0+1)=0                                                 SDBINT     40
         DDAT(JE0+2)=VALIN(9)                                           SDBINT     41
C                                                                       SDBINT     42
         JE1=JE0+3                                                      SDBINT     43
         NUF=9                                                          SDBINT     44
         CALL UDMINT(NUF,VM1,NLF1,K13,LCKT)                             SDBINT     45
C                                                                       SDBINT     46
C         IF(LDEB) WRITE(IUD6,1030) (I,VALIN(I),I=1,80)                 SDBINT     47
C                                                                       SDBINT     48
C     STORE THE REQUIRED INPUTS AND OUTPUTS                             SDBINT     49
C                                                                       SDBINT     50
         YDEV(JY+2)=0.0                                                 SDBINT     51
         SSDB(JY+3)=0.0                                                 SDBINT     52
         JY=JY+4                                                        SDBINT     53
         DO 140 J=1,NXUDB                                               SDBINT     54
         YVAR(JY+J)=VALOUT(J)                                           SDBINT     55
  140    CONTINUE                                                       SDBINT     56
         JY=JY+NXUDB                                                    SDBINT     57
         GO TO 100                                                      SDBINT     58
      ENDIF                                                             SDBINT     59
  100 CONTINUE                                                          SDBINT     60
      JXSDB(NSDB+1)=JSTATE                                              SDBINT     61
      RETURN                                                            SDBINT     62
C                                                                       SDBINT     63
 1030 FORMAT(1X,'INPUT VALUES: ',/,I5,F10.3)                            SDBINT     64
      END                                                               SDBINT     65
