You are on page 1of 4

SIMULATION TODAY

Simulation Councils, Inc. (The Society for Computer SImulation), P. O. Box 2228, La Jolla, Ca. 92037

lations, the professional programmer requires greater con-


trol over the structure of the program and often needs to
DYFLO: A DYNAMIC PROGRAM FOR adapt to unusual situations. For this reason, the best of
CHEMICAL ENGINEERING both worlds was achieved by developing a set of
FORTRAN subroutines that perform the more common
by Roger G. E. Franks mathematical procedures and programming the problem
strictly in FORTRAN, calling the subroutines at the appro-
INTRODUCTION priate place to perform the required mathematical
Use of computers as an aid in chemical process design, procedures.
optimization of plant operation, and solution of process The two primary advantages of this operating method are
control problems has expanded considerably during its 15- that it is compatible with other FORTRAN programs and
20 year history. Much of this usage is concerned with that only one set of rules (FORTRAN) is required. A typical
processing data dealing with the details of designing example of such a collection of subroutines is the I NT pro-
process equipment and piping, and another large area gram consisting of 16 subroutines with a total of about 180
deals with calculating material and energy flows in large FORTRAN statements. The title and function of each sub-
recycle process systems. A smaller but important area deals routine is shown in Table 1. A description of the theoreti-
with the simulation of process dynamics and equipment cal basis for these routines and the complete listings for
design requiring the solution of large sets of nonlinear each is provided in Reference 1, together with many
differential equations. Originally, these problems were examples of their use in a variety of situations.
solved by analog simulation but in the middle 60’s analog
Table 1 -

INT subroutine library


computers were phased out in favor of digital simulation,
which has since proved to be more powerful and certainly
more convenient. The availability of increasingly more

powerful computers is well known, but there has also been


a parallel development of sophisticated labor-saving soft-
ware that enables the engineer to rapidly assemble a com-

puter simulation, sometimes as large as 1000 differential


equations.
This paper will describe two digital simulation programs.
The first will be a FORTRAN subroutine library, INT, that
functions as an elementary version of CSMP or MIMIC.
The second program, DYFLO, is a higher-level library con-
taining subroutines that simulate the dynamic per-
formance of common process unit operations.

INT PROGRAM
The sixties saw the development of digital simulation pro-
grams designed to duplicate the function of the analog
computer. Many of these simulation programs have fallen
into disuse and only the best of them, such as MIMIC and
CSMP, have survived and enjoy current usage. For some
people actively engaged in chemical engineering compu-
tations, these simulation programs served to introduce
analog programmers to digital computation, but, for many, DYFLO PROGRAM
it became apparent that the principal advantage of the The general availability of programs such as INT and CSMP
simulation programs over the more basic FORTRAN was has provided a foundation for the development of the next
the availability of library routines that perform common level of sophistication: namely, dynamic simulation
mathematical procedures such as integrating differential programs. The concept here is to provide the pro-
equations, generating arbitrary functions, and solving grammer with a set of library routines that simulate the
algebraic loops. The other useful features such as equa- common &dquo;unit operations&dquo; in chemical processes, the unit

tion ordering, diagnostics, internal automatic step-


certain operation routines containing the entire mathematical
sizeoptimization, really intended for the neo-
etc. were model for that process unit. Simulating a large process
phyte or the occasional user. For large complex simu- then merely requires the assembly of a main calling

37

Downloaded from sim.sagepub.com at SIMON FRASER LIBRARY on May 29, 2015


program in which the calls on the library unit operation tion and an external heat flux; so for the reactor, the HLDP
routines are listed in the appropriate order. It also requires module is used, but a REACT subroutine is called prior to
supplying the physical property and other data and occa- HLDP where the specific rates for the reaction are cal-
sionally the construction of customized routines for non- culated and the resulting reaction &dquo;flows&dquo; for each com-
standard sections of the process. Programs calculating the ponent are entered into a COMMON array where they
steady-state relation between input and output of streams will be automatically transferred and accounted for in the
unit processes have been available for time, but
some the HLDP module.
development of programs that simulate the dynamic The next step for the programmer to follow is to assemble
response to input disturbances is relatively new, having the main calling program as shown in Figure 3.
been developed only in about the last three years.
CALL INIT
Presently there are four major process dynamic simu-
lation programs called DYN5IS,2 REMUS,3 PRODYC,4 and 5 CALL RECIPY (2.,10.,560.8,Q)
CALL SPLIT (3,4,6,.7)
DYFLO.’ Fortunately all these programs are non-
CALL REACT (3)
proprietary and a listing is available in the operations CALL HLDP (2,3,3,20.,Q)
manuals or text cited in the references. A comparison of CALL NRCT
these prograMS5 has shown DYFLO to be the most useful CALL HLDP (7,2,3,50.,0.)
system since it provides the largest library of unit opera- CALL SUM (1,5,7,3)
tions and also is the only program that can accommodate CALL LDL (YA,4,5,5,1)
multiphase situations such as vapor/liquid boiling, con- CALL PRL (1.,90.,NF,1,2,3,4,5,6,7,0,0,0,0,0)
densing, and equilibrium. IF (NF) STOP
CALL INTI (T,.1,4)
GO TO 5

Figure 3 - Main calling program


The stream numbers are entered as arguments to the sub-
routines called, which with three exceptions are library
routines. The first is INIT in which the initial conditions for
the two holdups and the physical properties of the compo-
nents are stated. The next is RECIPY, which produces the

Figure 1 - Process input disturbances to the system and also calculates the
heat flux Q from the reactor, and the third is the REACT
EXAMPLE
module in which the reaction rates and reaction heat are
For a brief example of how such a program is used, con- calculated, based on the composition in stream #3.
sider the process shown in Figure 1. It consists of a mixing
tank where a feed stream consisting of two chemical com- The PRL subroutine controls the printing of the output
ponents (A and B) is mixed with a recycle stream con- information; namely, the state of lines 1 to 7 at one-minute
sisting of three components (A, B, and C). The flow from intervals (first argument) and also detects the end of the
the mixing tank passes to a reactor, where the reaction run (second argument). The last subroutine is from the INT
A+B-C takes place. The exit flow from the reactor is split, library and controls the integration procedure for all the
part of it being recycled to the mixing tank. This recycle integrations contained within the unit operation modules,
imposes a time lag for the fluid temperature and compo- in this case HLDP, and also controls the information stream
sitions between the split and mixing tank. The first step for in the line delay LDL.
the programmer to accomplish is to assign stream num-
bers to the various streams in the system and to indicate The output from such a program is displayed either as
the appropriate equivalent subroutine module for each numerical values of temperature composition, etc. or,
part of the process as shown in Figure 2. more conveniently, as line plots obtained from routines
that automatically specify the range of the plot and iden-
tify the variable being plotted.
Table 2 - DYFLO service routines

Figure 2 - DYLFO block diagram


The HLDP module simulates a back-mix vessel with one
input and one output flow. Since there are two feeds
(streams ~1 and #5) to the first mix tank, they must be
summed, producing stream #7, which is then fed to the
HLDP module. The module can also accommodate a reac-

38

Downloaded from sim.sagepub.com at SIMON FRASER LIBRARY on May 29, 2015


DYFLO LIBRARY Table 4 - Dynamic unit operations
The routines available in the DYFLO library can be divided
into three groups. In the first group are the service rou-
tines that calculate the state of properties of a stream. They
are listed in Table 2.

These service routines are nested in the unit operations


modules; for example, when two streams join to form a
single stream, as calculated by the SUM module, the heat
balance calculates the enthalpy of the exit stream. The
TEMP routine is then called within the SUM module to cal-
culate the temperature of this exit stream. EQUIL is a
routine frequently used in all unit operations that involve
vapor-liquid separations such as distillation columns,
boilers, and condensers. It finds the boiling temperature of
a specified liquid stream or node with a Newton-Raphson

iteration by converging the sum of the vapor compo-


sitions to unity.
The next group of DYFLO modules is operations that do
not involve any holdup. This means that there is an instan-
taneous balance between input and output streams and
there are no internal integrations to be performed. These
modules are listed in Table 3. simulation.6 The DYFLO modules listed in Table 4 offer an
Table 3 - Steady-state unit-operations modules optimum combination of flexibility and ease of use. A
column can be readily constructed from the STAGE
modules by numbering the vapor and liquid flows from
stage to stage sequentially and then using the DO-loop
index to number the streams in the arguments of the sub-
routine CALL. For example, Figure 4 shows a distillation
I

As shown in the example, the arguments to these routines


generally consist of line or node numbers plus pertinent
operating data. The most frequently used model in this set
is the FLASH routine whose generality covers the entire
range of a superheater which has only an exit for super-
heated vapor flow and will permit no liquid flow to a total
condenser with subcooling which permits no vapor flow to
leave it.
The last group of DYFLO modules is the unit operations
that includes a holdup volume. These modules contain a
differential equation for each chemical component in the
system, one for the total mass, and one for the accumu-
lation of heat. These modules are listed in Table 4.

One of the most difficult problems in process control is


that associated with distillation-column operation. There
are so many different types of separations and associated
control schemes that it is impractical to extend generali-
zations to unusual situations. Consequently, difficult dis-
tillation control problems are best solved by computer Figure 4 - Column block diagram

39

Downloaded from sim.sagepub.com at SIMON FRASER LIBRARY on May 29, 2015


column with 90 stages with the feed stage located on stage for this is that process models almost never contain open
No. 35. The vapor streams are numbered from 1 to 91, and integration (typified by navigation or trajectory equa-
the liquid reflux streams are numbered 190 to 100 starting tions), but are generally self-corrective due to internal
from the top. feedback.
A second important feature of the DYFLO program also
Without going into too much detail, the arguments to the addresses itself to the stiffness difficulty. It is known from
STAGE subroutine specify the input and output stream the literature that efforts to simulate complex distillation-
numbers, the liquid holdup (HL), and the hydraulic time column dynamics have been constantly frustrated by in-
constant (HTC). Figure 5 shows two DO loops separated by
stability problems. This can be traced to a high stiffness
the feed stage wherein the DO-loop counter N is used to
developing in the hot base of the column, because of the
specify the stream numbers entering and leaving the stage. small time constant in the differential equation for the
If, for example, this column is handling five components, highly volatile components. The STAGE routines in the
the calling program shown in Figure 5 represents the effort DYFLO program circumvent this problem by continually
required to program 550 nonlinear differential equations, monitoring the volatility of all the components in the
together with a considerably greater amount of algebra. column and those components that have volatilities
There are several more subroutines in the system that
beyond a prescribed level are automatically diverted to a
control the printing of results and the end of the run.
special section where the compositions are solved by alge-
braic methods, thus bypassing the differential equations.
These, together with the COMMON statement, con- This technique reduces the stiffness problem to man-
stitute the executive for the system. The COMMON state-
ment contains the stream array dimensioned to 300
ageable proportions, without significantly influencing the
resu Its.
streams and 24 properties. These properties are 20 compo-
sitions, the flow rate or mass, temperature, enthalpy, and CALL BOT (100,99,1,Q,HLB)
DO 5 N 1,34
=

pressure. The second array contains the physical prop-


5 CALL STAGE (N,100 + N, 99 + N, N + 1, HL, HTC)
erties for each component in the system. This array is
dimensioned 20 X 9, to accommodate 20 components and CALL STGF (35,135,200,134,36,HL,HTC)
nine properties for each. These properties specify the DO 6 N 36, 90
=

vapor pressure (three Antoine coefficients), two enthalpy 6 CALL STAGE (N,100 + N, 99 + N, N + 1, HL, HTC)
coefficients for both vapor and liquid, the latent heat of 5 - Main program for column
Figure
the vapor, and the activity.
It should be recognized that the dynamic programs avail-
There are several features of both the INT and DYFLO able today will inevitably be superseded by improved ver-
routines that have made the simulations of very large sions making better use of available hardware. Already,
problems a practical reality by digital simulation. The most several versions of DYFLO for use on an interactive
important of these is that where a large number of dif- terminal have been developed. One of the objectives of
ferential equations are automatically coded by gener- the program as published in the text was to stimulate the
alized calling statements, the net result is invariably a stiff
development of better programs for the future.
system; i.e., the ratio between the major and minor time
constants is very high. It can be shown that for these situa-
ABOUT THE AUTHOR
tions, the most efficient methods of solution in terms of
execution time is to use a simple Euler integration method ROGER G. E. FRANKS is a Senior Consultant, Engineering
with a fixed or externally varied step size. The INT system Computations, E. I. du Pont de Nemours & Co., Inc., and
offers three choices of integration methods, ranging from Past Chairman of Eastern Simulation Council. Mr. Franks is
simple Euler to fourth-order Runge-Kutta, which is used also the author of Mathematical modeling in chemical
for nonstiff systems. Experiments comparing execution engineering (Wiley, 1967) and numerous technical papers
times for large systems using simple Euler with fixed step on computer simulation of chemical processes. The
size vs. fourth-order RK with internally optimized step size author’s academic background includes an MS in Mechan-
show that solutions from both methods are practically the ical Engineering from the University of Pennsylvania (1957)
same, but execution times are as high as 20 times greater and a BS in the same field from Kings College of the Uni-
for the sophisticated integration method. The basic reason versity of London.
REFERENCES 4 INGELS D M MOTARD RL ADDITIONAL READING
PRODYC, asimulation program for chemical
1 FRANKS R GE FRANKS R G E
process dynamics and control
Modeling and simulation in chemical engineering Mathematical modeling in chemical engineering
University of Houston RE 4-70 Houston August New York 1967
Wiley New York 1972 1970 Wiley
2 BOBROW S JOHNSON AI PONTON J W 5 CULVER D A CARNAHAN B LUTHER H A WILKES J O
DYNSIS manual and application studies Distillation column dynamics simulation via DYFLO Applied numerical methods
McMaster University Hamilton, Ontario August Proceedings Summer Computer Simulation Con- Wiley New York 1970
1970 ference
AFIPS Press Montvale, New Jersey 1972 HURLEY EJ ROSEN E M
3 HAM P G Material and energy balance computation
Users manual — REMUS. Routine for executive 6 FRANKS R GE Wiley New York 1969
multiunit simulations Dynamic systems program for chemical engi-
University of Pennsylvania Philadelphia June 1970 neering HIMMELBLAU D M BOSCHEFF K B
Presented at the AlChE national meeting Novem- Process analysis and simulation—deterministic systems
Not copynghted Reprints available 25 for $ I. 100 for $3. ber 1971 Wiley New York 1966

40

Downloaded from sim.sagepub.com at SIMON FRASER LIBRARY on May 29, 2015

You might also like