CFPRIME DEUDM                                                           DEUDM       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 DEUDM(STEP1,KORD,NLF1,K13,LCKT)                        DEUDM       3
CD                                                                      DEUDM       4
CD    THIS IS THE MAIN DRIVER TO CALCULATE THE DERIVATIVES OF THE STATE DEUDM       5
CD    OF THE USER DEFINED MODELS FOR USE IN BOTH RUNGE-KUTTA AND        DEUDM       6
CD    TRAPEZOIDAL METHOD.                                               DEUDM       7
CD                                                                      DEUDM       8
      INCLUDE 'PARX.INS'                                                DEUDM       9
      INCLUDE 'CNPT.INS'                                                DEUDM      10
      INCLUDE 'CNVOLT.INS'                                              DEUDM      11
      INCLUDE 'CNIPTR.INS'                                              DEUDM      12
      INCLUDE 'CNNNEW.INS'                                              DEUDM      13
      INCLUDE 'CNMDAT.INS'                                              DEUDM      14
      INCLUDE 'CNB3.INS'                                                DEUDM      15
      INCLUDE 'CNB4.INS'                                                DEUDM      16
      INCLUDE 'CNB5.INS'                                                DEUDM      17
      INCLUDE 'CNB8.INS'                                                DEUDM      18
      INCLUDE 'CNB9.INS'                                                DEUDM      19
      INCLUDE 'CNB10.INS'                                               DEUDM      20
      INCLUDE 'CNB19.INS'                                               DEUDM      21
      INCLUDE 'CNEXC.INS'                                               DEUDM      22
      INCLUDE 'CNXSTA.INS'                                              DEUDM      23
      INCLUDE 'CNYVAR.INS'                                              DEUDM      24
      INCLUDE 'CNUDM.INS'                                               DEUDM      25
      INCLUDE 'CNFLAG.INS'                                              DEUDM      26
      INCLUDE 'CNUNIT.INS'                                              DEUDM      27
C                                                                       DEUDM      28
      CHARACTER*2 LCKT                                                  DEUDM      29
C                                                                       DEUDM      30
      LDEB=(JDEB(263).NE.0)                                             DEUDM      31
C                                                                       DEUDM      32
C     CALL ROUTINES ACCORDING TO BLOCK TYPE TO                          DEUDM      33
C     DEFINE THE OUTPUTS AND DERIVATIVE OF STATES OF THE BLOCK          DEUDM      34
C                                                                       DEUDM      35
      KINPU=IDDAT(JE4)                                                  DEUDM      36
      DO 900 LORD=1,NUDB                                                DEUDM      37
         K=IDDAT(JE4+LORD)                                              DEUDM      38
         JEB=JE3+17*K-17                                                DEUDM      39
         NBINT1=IDDAT(JEB+1)                                            DEUDM      40
         NBINT2=IDDAT(JEB+17)                                           DEUDM      41
         LTYP=IDDAT(JEB+2)                                              DEUDM      42
         GO TO ( 120, 130, 140, 150, 160, 170, 180, 190, 200, 210       DEUDM      43
     &         , 220, 230, 240, 250, 260, 270, 280, 290, 300, 310       DEUDM      44
     &         , 320, 330, 340, 350, 360, 370, 380, 390, 400, 410       DEUDM      45
     &         , 420, 420, 430, 440, 450, 460, 470, 480, 490, 500       DEUDM      46
     &         , 510, 520, 530, 540, 550, 560, 570, 580, 590, 600       DEUDM      47
     &         , 610, 620, 630, 640, 650, 650, 660, 670, 670, 900       DEUDM      48
     &         , 900, 900, 900, 900, 900, 900, 900, 900, 690, 700       DEUDM      49
     &         , 710), LTYP                                             DEUDM      50
  120    CALL DUDB1(LORD,NLF1,K13,LCKT)                                 DEUDM      51
         GO TO 900                                                      DEUDM      52
  130    CALL DUDB2(LORD,KORD,NLF1,K13,LCKT)                            DEUDM      53
         GO TO 900                                                      DEUDM      54
  140    CALL DUDB3(LORD,KORD,NLF1,K13,LCKT)                            DEUDM      55
         GO TO 900                                                      DEUDM      56
  150    CALL DUDB4(LORD,KORD,NLF1,K13,LCKT)                            DEUDM      57
         GO TO 900                                                      DEUDM      58
  160    CALL DUDB5(LORD,KORD,NLF1,K13,LCKT)                            DEUDM      59
         GO TO 900                                                      DEUDM      60
  170    CALL DUDB6(LORD,NLF1,K13,LCKT)                                 DEUDM      61
         GO TO 900                                                      DEUDM      62
  180    CALL DUDB7(LORD,NLF1,K13,LCKT)                                 DEUDM      63
         GO TO 900                                                      DEUDM      64
  190    CALL DUDB8(LORD,NLF1,K13,LCKT)                                 DEUDM      65
         GO TO 900                                                      DEUDM      66
  200    CALL DUDB9(LORD,NLF1,K13,LCKT)                                 DEUDM      67
         GO TO 900                                                      DEUDM      68
  210    CALL DUDB10(LORD,NLF1,K13,LCKT)                                DEUDM      69
         GO TO 900                                                      DEUDM      70
  220    CALL DUDB11(LORD,NLF1,K13,LCKT)                                DEUDM      71
         GO TO 900                                                      DEUDM      72
  230    CALL DUDB12(LORD,KORD,NLF1,K13,LCKT)                           DEUDM      73
         GO TO 900                                                      DEUDM      74
  240    CALL DUDB13(LORD,NLF1,K13,LCKT)                                DEUDM      75
         GO TO 900                                                      DEUDM      76
  250    CALL DUDB14(LORD,NLF1,K13,LCKT)                                DEUDM      77
         GO TO 900                                                      DEUDM      78
  260    CALL DUDB15(LORD,NLF1,K13,LCKT)                                DEUDM      79
         GO TO 900                                                      DEUDM      80
  270    CALL DUDB16(LORD,NLF1,K13,LCKT)                                DEUDM      81
         GO TO 900                                                      DEUDM      82
  280    CALL DUDB17(LORD,NLF1,K13,LCKT)                                DEUDM      83
         GO TO 900                                                      DEUDM      84
  290    CALL DUDB18(LORD,NLF1,K13,LCKT)                                DEUDM      85
         GO TO 900                                                      DEUDM      86
  300    CALL DUDB19(LORD,NLF1,K13,LCKT)                                DEUDM      87
         GO TO 900                                                      DEUDM      88
  310    CALL DUDB20(LORD,NLF1,K13,LCKT)                                DEUDM      89
         GO TO 900                                                      DEUDM      90
  320    CALL DUDB21(LORD,NLF1,K13,LCKT)                                DEUDM      91
         GO TO 900                                                      DEUDM      92
  330    CALL DUDB22(LORD,KORD)                                         DEUDM      93
         GO TO 900                                                      DEUDM      94
  340    CALL DUDB23(LORD)                                              DEUDM      95
         GO TO 900                                                      DEUDM      96
  350    CALL DUDB24(LORD,KORD)                                         DEUDM      97
         GO TO 900                                                      DEUDM      98
  360    CALL DUDB25(LORD,STEP1)                                        DEUDM      99
         GO TO 900                                                      DEUDM     100
  370    CALL DUDB26(LORD)                                              DEUDM     101
         GO TO 900                                                      DEUDM     102
  380    CALL DUDB27(LORD,NLF1,K13,LCKT)                                DEUDM     103
         GO TO 900                                                      DEUDM     104
  390    CALL DUDB28(LORD,NLF1,K13,LCKT)                                DEUDM     105
         GO TO 900                                                      DEUDM     106
  400    CALL DUDB29(LORD)                                              DEUDM     107
         GO TO 900                                                      DEUDM     108
  410    CALL DUDB30(LORD,NLF1,K13,LCKT)                                DEUDM     109
         GO TO 900                                                      DEUDM     110
  420    CALL DUDB31(LORD,KORD,NLF1,K13,LCKT)                           DEUDM     111
         GO TO 900                                                      DEUDM     112
  430    CALL DUDB33(LORD,KORD,NLF1,K13,LCKT)                           DEUDM     113
         GO TO 900                                                      DEUDM     114
  440    CALL DUDB34(LORD,KORD,NLF1,K13,LCKT)                           DEUDM     115
         GO TO 900                                                      DEUDM     116
  450    CALL DUDB35(LORD,KORD,NLF1,K13,LCKT)                           DEUDM     117
         GO TO 900                                                      DEUDM     118
  460    CALL DUDB36(LORD,KORD,NLF1,K13,LCKT)                           DEUDM     119
         GO TO 900                                                      DEUDM     120
  470    CALL DUDB37(LORD,KORD,NLF1,K13,LCKT)                           DEUDM     121
         GO TO 900                                                      DEUDM     122
  480    CALL DUDB38(LORD,NLF1,K13,LCKT)                                DEUDM     123
         GO TO 900                                                      DEUDM     124
  490    CALL DUDB39(LORD,NLF1,K13,LCKT)                                DEUDM     125
         GO TO 900                                                      DEUDM     126
  500    CALL DUDB40(LORD,KORD,NLF1,K13,LCKT)                           DEUDM     127
         GO TO 900                                                      DEUDM     128
  510    CALL DUDB41(LORD,NLF1,K13,LCKT)                                DEUDM     129
         GO TO 900                                                      DEUDM     130
  520    CALL DUDB42(LORD,NLF1,K13,LCKT)                                DEUDM     131
         GO TO 900                                                      DEUDM     132
  530    CALL DUDB43(LORD,NLF1,K13,LCKT)                                DEUDM     133
         GO TO 900                                                      DEUDM     134
  540    CALL DUDB44(LORD,KORD)                                         DEUDM     135
         GO TO 900                                                      DEUDM     136
  550    CALL DUDB45(LORD,KORD)                                         DEUDM     137
         GO TO 900                                                      DEUDM     138
  560    CALL DUDB46(LORD,KORD)                                         DEUDM     139
         GO TO 900                                                      DEUDM     140
  570    CALL DUDB47(LORD,KORD)                                         DEUDM     141
         GO TO 900                                                      DEUDM     142
  580    CALL DUDB48(LORD,KORD,NLF1,K13,LCKT)                           DEUDM     143
         GO TO 900                                                      DEUDM     144
  590    CALL DUDB49(LORD,NLF1,K13,LCKT)                                DEUDM     145
         GO TO 900                                                      DEUDM     146
  600    CALL DUDB50(LORD,NLF1,K13,LCKT)                                DEUDM     147
         GO TO 900                                                      DEUDM     148
  610    CALL DUDB51(LORD,NLF1,K13,LCKT)                                DEUDM     149
         GO TO 900                                                      DEUDM     150
  620    CALL DUDB52(LORD,KORD,NLF1,K13,LCKT)                           DEUDM     151
         GO TO 900                                                      DEUDM     152
  630    CALL DUDB53(LORD,KORD,STEP1,NLF1,K13,LCKT)                     DEUDM     153
         GO TO 900                                                      DEUDM     154
  640    CALL DUDB54(LORD,KORD,NLF1,K13,LCKT)                           DEUDM     155
         GO TO 900                                                      DEUDM     156
  650    CALL DUDB55(LORD,KORD,NLF1,K13,LCKT)                           DEUDM     157
         GO TO 900                                                      DEUDM     158
  660    CALL DUDB57(LORD,KORD,NLF1,K13,LCKT)                           DEUDM     159
         GO TO 900                                                      DEUDM     160
  670    CALL DUDB58(LORD,KORD,NLF1,K13,LCKT)                           DEUDM     161
         GO TO 900                                                      DEUDM     162
  690    CALL DUDB69(LORD,NLF1,K13,LCKT)                                DEUDM     163
         GO TO 900                                                      DEUDM     164
  700    CALL DUDB70(LORD,NLF1,K13,LCKT)                                DEUDM     165
         GO TO 900                                                      DEUDM     166
  710    CALL DUDB71(LORD,KORD,NLF1,K13,LCKT)                           DEUDM     167
  900 CONTINUE                                                          DEUDM     168
C                                                                       DEUDM     169
      IF(LDEB) WRITE(IUD6,1000) TS,(VALIN(I),I=1,80)                    DEUDM     170
C                                                                       DEUDM     171
      RETURN                                                            DEUDM     172
 1000 FORMAT(1X,'INPUT VALUES AT: ',F10.3,'SECONDS',8(/,10F8.3))        DEUDM     173
      END                                                               DEUDM     174
