CFPRIME PREINT                                                          PREINT      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 PREINT                                                 PREINT      3
CD                                                                      PREINT      4
CD    PERFORM NECESSARY INITIALIZATION FOR THE TRAPEZOIDAL METHOD.      PREINT      5
CD    THIS SUBROUTINE MUST BE CALLED AFTER EACH SWITCHING AND/OR WHEN   PREINT      6
CD    THE SIMULATION METHOD IS SWITCHED TO THE TRAPEZOIDAL METHOD.      PREINT      7
CD                                                                      PREINT      8
      INCLUDE 'PARX.INS'                                                PREINT      9
      INCLUDE 'CNPT.INS'                                                PREINT     10
      INCLUDE 'CNB3.INS'                                                PREINT     11
      INCLUDE 'CNB4.INS'                                                PREINT     12
      INCLUDE 'CNB5.INS'                                                PREINT     13
      INCLUDE 'CNB6.INS'                                                PREINT     14
      INCLUDE 'CNB8.INS'                                                PREINT     15
      INCLUDE 'CNMDAT.INS'                                              PREINT     16
      INCLUDE 'CNIPTR.INS'                                              PREINT     17
      INCLUDE 'CNMSTA.INS'                                              PREINT     18
      INCLUDE 'CNMYVA.INS'                                              PREINT     19
      INCLUDE 'CNYVAR.INS'                                              PREINT     20
      INCLUDE 'CNVOLT.INS'                                              PREINT     21
      INCLUDE 'CNXSTA.INS'                                              PREINT     22
      INCLUDE 'CNPREV.INS'                                              PREINT     23
      INCLUDE 'CNXDOT.INS'                                              PREINT     24
      INCLUDE 'CNJCOB.INS'                                              PREINT     25
      INCLUDE 'CNGEAR.INS'                                              PREINT     26
      INCLUDE 'CNIMPR.INS'                                              PREINT     27
      INCLUDE 'CNFLAG.INS'                                              PREINT     28
C                                                                       PREINT     29
C     INITIALIZATION AFTER EACH SWITCHING                               PREINT     30
C                                                                       PREINT     31
C     STORE THE POST-FAULT VOLTAGE IN VPREV ARRAY                       PREINT     32
C                                                                       PREINT     33
C     NOTE : THE FOLLOWING LASTV2 SHOULD BW REPLACED BY                 PREINT     34
C            LASTV1 WHEN IT IS AVAILABLE                                PREINT     35
C                                                                       PREINT     36
      LDEB=.FALSE.                                                      PREINT     37
C                                                                       PREINT     38
      DO 110 I=1,LASTV2                                                 PREINT     39
         VPREV(I)=VOLT(I)                                               PREINT     40
 110  CONTINUE                                                          PREINT     41
C                                                                       PREINT     42
C     CALCULATE XDOT                                                    PREINT     43
C                                                                       PREINT     44
      JMUPDT=.FALSE.                                                    PREINT     45
      NITER=1                                                           PREINT     46
      IF(JTHDC.NE.2) THEN                                               PREINT     47
         CALL GXDOT                                                     PREINT     48
         IF(NMOTL.NE.0) CALL MXDOT                                      PREINT     49
      ELSE                                                              PREINT     50
         IAIDEX=0                                                       PREINT     51
         IBIDEX=0                                                       PREINT     52
         ICIDEX=0                                                       PREINT     53
      ENDIF                                                             PREINT     54
      IF (NTSCL.NE.0) CALL TCXDOT                                       PREINT     55
      IF (NSVC.NE.0) CALL SXDOT                                         PREINT     56
      IF (NRANI.NE.0) CALL RXDOT                                        PREINT     57
      IF (NTCPS.NE.0) CALL TPXDOT                                       PREINT     58
      IF (NSDB.NE.0) CALL DBXDOT                                        PREINT     59
C                                                                       PREINT     60
C     CALCULATE XDDOT FOR GEARS METHOD                                  PREINT     61
C                                                                       PREINT     62
      IF (IGEARS) THEN                                                  PREINT     63
         CALL GXDDOT                                                    PREINT     64
C                                                                       PREINT     65
C     CODES TO NUMERICALLY CALCULATE THE SECOND ORDER DERIVATIVE        PREINT     66
C                                                                       PREINT     67
C         DO 115 I=1,NSTATE                                             PREINT     68
C            XDDOT(I)=0.0                                               PREINT     69
C 115     CONTINUE                                                      PREINT     70
      END IF                                                            PREINT     71
C                                                                       PREINT     72
C     SET SOME CONTROL FLAGS                                            PREINT     73
C                                                                       PREINT     74
C     LITTER = 0   NO NETWORK ITERATION                                 PREINT     75
C     LITTER = 1   WITH NETWORK ITERATION                               PREINT     76
C                                                                       PREINT     77
      IAJCOB(1,1)=0                                                     PREINT     78
      JMUPDT=.TRUE.                                                     PREINT     79
      LITTER=0                                                          PREINT     80
      NITER=0                                                           PREINT     81
C                                                                       PREINT     82
C     ADJUST CURTOL IN TERMS OF STEP SIZE                               PREINT     83
C                                                                       PREINT     84
      CURTOL=RESTOL                                                     PREINT     85
C      CTOLUB=10.0*CURTOL                                               PREINT     86
C      IF (H.GT.0.01) THEN                                              PREINT     87
C         WS1=H/RESTOL                                                  PREINT     88
C         IF (WS1.GT.5.0) WS1=5.0                                       PREINT     89
C         CURTOL=WS1*CURTOL                                             PREINT     90
C      END IF                                                           PREINT     91
C                                                                       PREINT     92
      RETURN                                                            PREINT     93
      END                                                               PREINT     94
