CFPRIME SWITDA                                                          SWITDA      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 SWITDA(FILENA,LENPAR,IUX,IUY,IEBK)                     SWITDA      3
CD                                                                      SWITDA      4
CD    THIS IS THE MAIN DRIVER FOR READING THE USER SIMULATION           SWITDA      5
CD    SPECIFICATION DATA.                                               SWITDA      6
CD                                                                      SWITDA      7
      INCLUDE 'CNFLAG.INS'                                              SWITDA      8
      INCLUDE 'CNUNIT.INS'                                              SWITDA      9
      INCLUDE 'CNLSTA.INS'                                              SWITDA     10
C                                                                       SWITDA     11
      CHARACTER*80 STRING,MSG,EMSG                                      SWITDA     12
      CHARACTER*50 FILENA                                               SWITDA     13
      CHARACTER*7 SUBPMT                                                SWITDA     14
C                                                                       SWITDA     15
      LDEB=(JDEB(24).NE.0)                                              SWITDA     16
C                                                                       SWITDA     17
      SUBPMT='SWITCH '                                                  SWITDA     18
      JLENG=0                                                           SWITDA     19
      IEBK=0                                                            SWITDA     20
C                                                                       SWITDA     21
   10 CONTINUE                                                          SWITDA     22
       MSG='DO YOU HAVE AN EXISTING SWITCHING FILE ? (Y/N)'             SWITDA     23
       WRITE(LOUT,*)                                                    SWITDA     24
      CALL REDLIN(LOUT,LIN,IOERR,46,MSG,SUBPMT,'SWI',STRING,            SWITDA     25
     &RECORD,IREC,KLAYER,KEND,KREAD,PLAYBA)                             SWITDA     26
      IF(IOERR.LT.0) GOTO 10                                            SWITDA     27
      IF(STRING(1:1).EQ.'Y'.OR.STRING(1:1).EQ.'y') THEN                 SWITDA     28
       IYES=1                                                           SWITDA     29
       IKEY=8                                                           SWITDA     30
       MSG='ENTER THE SWITCHING FILE NAME:'                             SWITDA     31
       EMSG='ERROR IN OPENING SWITCHING FILE'                           SWITDA     32
       LMSG=30                                                          SWITDA     33
       LEMSG=31                                                         SWITDA     34
       ELSEIF(STRING(1:1).EQ.'N'.OR.STRING(1:1).EQ.'n') THEN            SWITDA     35
C                                                                       SWITDA     36
       WRITE(LOUT,*)                                                    SWITDA     37
       WRITE(LOUT,*) ' SWITCHING DATA MAY BE ENTERED FROM KEYBOARD.'//  SWITDA     38
     *               ' THE PROGRAM WILL CREATE'                         SWITDA     39
       WRITE(LOUT,*) ' A NEW SWITCHING FILE IN TERMS OF YOUR INPUT.'    SWITDA     40
       WRITE(LOUT,*)                                                    SWITDA     41
       IYES=0                                                           SWITDA     42
       IKEY=6                                                           SWITDA     43
       MSG='ENTER THE NEW SWITCHING FILE NAME:'                         SWITDA     44
       EMSG='ERROR IN OPENING THE NEW SWITCHING FILE'                   SWITDA     45
       LMSG=34                                                          SWITDA     46
       LEMSG=39                                                         SWITDA     47
       ELSE                                                             SWITDA     48
       KREAD=.TRUE.                                                     SWITDA     49
       IF(PLAYBA)CALL PSTOP                                             SWITDA     50
       GOTO 10                                                          SWITDA     51
      ENDIF                                                             SWITDA     52
C                                                                       SWITDA     53
      WRITE(LOUT,*)                                                     SWITDA     54
      CALL FILEMG(IU52,LMSG,MSG,LEMSG,EMSG,SUBPMT,IKEY,JLENG,IEBK)      SWITDA     55
C                                                                       SWITDA     56
      IF(IEBK.NE.0)THEN                                                 SWITDA     57
      IF(PLAYBA)CALL PSTOP                                              SWITDA     58
      RETURN                                                            SWITDA     59
      ENDIF                                                             SWITDA     60
C                                                                       SWITDA     61
      IF(IYES.EQ.1) RETURN                                              SWITDA     62
C                                                                       SWITDA     63
C     PREPARE NEW SIMULATION SIMULATION SPECIFICATION FILE              SWITDA     64
C                                                                       SWITDA     65
      REWIND IU52                                                       SWITDA     66
 107  CONTINUE                                                          SWITDA     67
      MSG=                                                              SWITDA     68
     *'ENTER SWITCHING OPERATION, TYPE NOMORE WHEN COMPLETED.'          SWITDA     69
      CALL PMTRED(LOUT,LIN,JERR,54,MSG,'SWI',STRING,KREAD,PLAYBA)       SWITDA     70
      IF(JERR.LT.0)THEN                                                 SWITDA     71
      WRITE(LOUT,'(A)') ' *** ERROR DURING READING, TRY AGAIN.'         SWITDA     72
      IF(PLAYBA)CALL PSTOP                                              SWITDA     73
      GOTO 107                                                          SWITDA     74
      ENDIF                                                             SWITDA     75
      WRITE(IU52,'(A)') STRING(1:77)//'/'                               SWITDA     76
      IF(STRING(1:6).NE.'NOMORE') GOTO 107                              SWITDA     77
C                                                                       SWITDA     78
      REWIND IU52                                                       SWITDA     79
      RETURN                                                            SWITDA     80
C                                                                       SWITDA     81
      END                                                               SWITDA     82
