CFPRIME UDCONV                                                          UDCONV      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  UDCONV                                                UDCONV      3
CD -------------------------------------------------------------------  UDCONV      4
CD                                                                      UDCONV      5
CD              *****     UDCONV  ROUTINE   *****                       UDCONV      6
CD                                                                      UDCONV      7
CD -------------------------------------------------------------------  UDCONV      8
CD                                                                      UDCONV      9
CD       PURPOSE:  Converts all blocks of udc type subsystem to         UDCONV     10
CD                 udc type setup, after the initialization is          UDCONV     11
CD                 complete.                                            UDCONV     12
CD                                                                      UDCONV     13
CD                                                                      UDCONV     14
CD       DEFINITION OF LOCAL VARIABLES:                                 UDCONV     15
CD                 JBLK    -  current udc block.                        UDCONV     16
CD                 LABEL  -  title for printing.                        UDCONV     17
CD                 LEN    -  length of current udc block name.          UDCONV     18
CD                 NAME   -  current udc block name.                    UDCONV     19
CD                 SUBNAM -  subroutine name.                           UDCONV     20
CD                 TNAME1 -  old type name.                             UDCONV     21
CD                 TNAME2 -  new type name.                             UDCONV     22
CD                                                                      UDCONV     23
CD -------------------------------------------------------------------  UDCONV     24
C                                                                       UDCONV     25
      CHARACTER*50  LABEL                                               UDCONV     26
      CHARACTER*20  SUBNAM                                              UDCONV     27
      CHARACTER*17  NAME                                                UDCONV     28
      CHARACTER*8   TNAME1, TNAME2                                      UDCONV     29
C                                                                       UDCONV     30
      INCLUDE 'PARX.INS'                                                UDCONV     31
      INCLUDE 'CNUNIT.INS'                                              UDCONV     32
      INCLUDE 'CNFLAG.INS'                                              UDCONV     33
      INCLUDE 'CNMSG.INS'                                               UDCONV     34
      INCLUDE 'UDCA.INS'                                                UDCONV     35
      INCLUDE 'UDCD.INS'                                                UDCONV     36
      INCLUDE 'UDCH.INS'                                                UDCONV     37
      INCLUDE 'GRSSSP.INS'                                              UDCONV     38
C---------------------------------------------------------------------  UDCONV     39
C                                                                       UDCONV     40
      LDEB=((JDEB(304).NE.0).AND.(JDEB(305).NE.0))                      UDCONV     41
C                                                                       UDCONV     42
      IF(SDBG)THEN                                                      UDCONV     43
         SUBNAM = 'UDCONV ROUTINE.'                                     UDCONV     44
      ELSE                                                              UDCONV     45
         SUBNAM = ' '                                                   UDCONV     46
      END IF                                                            UDCONV     47
C                                                                       UDCONV     48
      IF(LDEB)THEN                                                      UDCONV     49
         LABEL = '***  UDC BLOCK CHANGES REQUIRED FOR SOLUTION  ***'    UDCONV     50
         WRITE (IUD6,9002) LABEL                                        UDCONV     51
      END IF                                                            UDCONV     52
C                                                                       UDCONV     53
      TNAME1 = TPNAME(ISUBSY)                                           UDCONV     54
      TNAME2 = TPNAME(ISETUP)                                           UDCONV     55
C                                                                       UDCONV     56
      DO 20 JBLK = 1, IUDC                                              UDCONV     57
         NAME = UDNAME(JBLK)                                            UDCONV     58
         LEN = IUDLEN(JBLK)                                             UDCONV     59
         IF(IUDTYP(JBLK).EQ.ISUBSY)THEN                                 UDCONV     60
            IF(IUDSUB(JBLK).EQ.ISSVAL)THEN                              UDCONV     61
               IF(LDEB)THEN                                             UDCONV     62
                  WRITE (IUD6,9004) NAME(1:LEN), TNAME1, TNAME2,        UDCONV     63
     1                               SBSUBS(ISSVAL), SBSETP(ISPVAL)     UDCONV     64
               END IF                                                   UDCONV     65
               IUDTYP(JBLK) = ISETUP                                    UDCONV     66
               IUDSUB(JBLK) = ISPVAL                                    UDCONV     67
C                                                                       UDCONV     68
            ELSEIF(IUDSUB(JBLK).EQ.ISSOFS)THEN                          UDCONV     69
              IF(LDEB)THEN                                              UDCONV     70
                  WRITE (IUD6,9004) NAME(1:LEN), TNAME1, TNAME2,        UDCONV     71
     1                               SBSUBS(ISSOFS), SBSETP(ISPOFF)     UDCONV     72
               END IF                                                   UDCONV     73
               IUDTYP(JBLK) = ISETUP                                    UDCONV     74
               IUDSUB(JBLK) = ISPOFF                                    UDCONV     75
C                                                                       UDCONV     76
            ELSEIF(IUDSUB(JBLK).EQ.ISBRKS)THEN                          UDCONV     77
               IF(LDEB)THEN                                             UDCONV     78
                  WRITE (IUD6,9004) NAME(1:LEN), TNAME1, TNAME2,        UDCONV     79
     1                               SBSUBS(ISBRKS), ' '                UDCONV     80
               END IF                                                   UDCONV     81
               IUDTYP(JBLK) = ISETUP                                    UDCONV     82
               IUDSUB(JBLK) = 0                                         UDCONV     83
C                                                                       UDCONV     84
            ELSEIF(IUDSUB(JBLK).EQ.ISINTS)THEN                          UDCONV     85
               IF(LDEB)THEN                                             UDCONV     86
                  WRITE (IUD6,9004) NAME(1:LEN), TNAME1, TNAME2,        UDCONV     87
     1                               SBSUBS(ISINTS), SBSETP(ISPINT)     UDCONV     88
               END IF                                                   UDCONV     89
               NEXTI = IUNIPT(JBLK)                                     UDCONV     90
               NEXTI = IUDINX(NEXTI)                                    UDCONV     91
               VALUE = UDVAL(IUDINT(NEXTI))                             UDCONV     92
               NEXTP=IUDPPT(JBLK)                                       UDCONV     93
               NEXTP=IUDPNX(NEXTP)                                      UDCONV     94
               GAIN=UDPARM(NEXTP)                                       UDCONV     95
               OUT1S=ABS(VALUE*GAIN)                                    UDCONV     96
               IF(OUT1S .GT. ABS(UDVAL(JBLK)))THEN                      UDCONV     97
                  WRITE (MSG(1),9006) SUBNAM                            UDCONV     98
                  WRITE(MSG(2),9007) TNAME2                             UDCONV     99
                  WRITE(MSG(3),9008) NAME(1:LEN)                        UDCONV    100
                  WRITE(MSG(4),9009) UDVAL(JBLK), VALUE                 UDCONV    101
                  CALL PRTMSG(4)                                        UDCONV    102
               END IF                                                   UDCONV    103
               IUDTYP(JBLK) = ISETUP                                    UDCONV    104
               IUDSUB(JBLK) = ISPINT                                    UDCONV    105
C                                                                       UDCONV    106
            ELSEIF(IUDSUB(JBLK).EQ.ISLINS)THEN                          UDCONV    107
               IF(LDEB)THEN                                             UDCONV    108
                  WRITE (IUD6,9004) NAME(1:LEN), TNAME1, TNAME2,        UDCONV    109
     1                               SBSUBS(ISLINS), SBSETP(ISPLIN)     UDCONV    110
               END IF                                                   UDCONV    111
               NEXTI = IUNIPT(JBLK)                                     UDCONV    112
               NEXTI = IUDINX(NEXTI)                                    UDCONV    113
               VALUE = UDVAL(IUDINT(NEXTI))                             UDCONV    114
               NEXTP=IUDPPT(JBLK)                                       UDCONV    115
               NEXTP=IUDPNX(NEXTP)                                      UDCONV    116
               GAIN=UDPARM(NEXTP)                                       UDCONV    117
               OUT1S=ABS(VALUE*GAIN)                                    UDCONV    118
               IF(OUT1S .GT. ABS(UDVAL(JBLK)))THEN                      UDCONV    119
                  WRITE (MSG(1),9006) SUBNAM                            UDCONV    120
                  WRITE(MSG(2),9007) TNAME2                             UDCONV    121
                  WRITE(MSG(3),9008) NAME(1:LEN)                        UDCONV    122
                  WRITE(MSG(4),9009) UDVAL(JBLK), VALUE                 UDCONV    123
                  CALL PRTMSG(4)                                        UDCONV    124
               END IF                                                   UDCONV    125
               IUDTYP(JBLK) = ISETUP                                    UDCONV    126
               IUDSUB(JBLK) = ISPLIN                                    UDCONV    127
            END IF                                                      UDCONV    128
         END IF                                                         UDCONV    129
20    CONTINUE                                                          UDCONV    130
C                                                                       UDCONV    131
C---------------------------------------------------------------------  UDCONV    132
C                                                                       UDCONV    133
      RETURN                                                            UDCONV    134
C                                                                       UDCONV    135
C---------------------------------------------------------------------  UDCONV    136
C                                                                       UDCONV    137
9002  FORMAT (///, '1', 20X, A, /)                                      UDCONV    138
9004  FORMAT (//, 5X, 'BLOCK: ', A, /,                                  UDCONV    139
     1        10X, 'TYPE CHANGE', 8X, 'FROM:  "', A, '"', 2X,           UDCONV    140
     2                      'TO:  "', A, '"', /,                        UDCONV    141
     3        10X, 'SUBTYPE CHANGE', 5X, 'FROM:  "', A, '"', 2X,        UDCONV    142
     4                      'TO:  "', A, '"')                           UDCONV    143
9006  FORMAT(' *** WARNING', 5X, A)                                     UDCONV    144
9007  FORMAT(14X,'AFTER THE INITIALIZATION OF UDC "',A,'" BLOCKS, THE') UDCONV    145
9008  FORMAT(14X,'INTEGRATOR BLOCK "',A,'" HAS AN INITIAL VALUE')       UDCONV    146
9009  FORMAT(14X,'OF ',F15.6,' AND AN INPUT OF ',F15.6)                 UDCONV    147
C                                                                       UDCONV    148
C---------------------------------------------------------------------  UDCONV    149
C                                                                       UDCONV    150
      END                                                               UDCONV    151
