PDTS Uas55
PDTS Uas55
5.5
BATCH MODULE
352,, 5.5
Data Transfer System and User-Added
Subroutines User’s Guide
PRO/II Data Transfer System The software described in this guide is furnished under a license
and User-Added Subroutines agreement and may be used only in accordance with the terms of
User’s Guide that agreement. Information in this document is subject to
change without notice. Simulation Sciences, Inc. assumes no
liability for any damage to any hardware or software component
or any loss of data that may occur as a result of the use of the
information contained in this manual.
Copyright Notice Copyright © 2001 Simulation Sciences, Inc. All rights reserved.
No part of this publication may be copied and/or distributed
without the express written permission of Simulation Sciences,
Inc., 601 Valencia Ave., Brea, CA 92823-6346.
Trademarks PRO/II and SIMSCI are registered marks of Simulation Sciences,
Inc.
Windows, Windows 98, Windows NT, Windows 2000, Windows
ME, and MS-DOS are registered trademarks and/or trademarks
of Microsoft Corporation.
Compaq and Compaq Visual Fortran are trademarks of Compaq
Computer Corporation.
All other products are trademarks or registered marks of their
respective companies.
Introduction
About This Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
About PRO/II . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii
About SIMSCI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xiii
Technical Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xiii
Chapter 1
PDTS Introduction
What is PDTS?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-1
Program Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-1
PRO/II Results Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-2
Generating the PDTS Application . . . . . . . . . . . . . . . . . . . . . . . . .1-3
Data Retrieval using Class, Attribute and Item . . . . . . . . . . . .1-3
Specifying Units of Measure (UOM) of the Retrieved Data. .1-5
Returning the UOM of the Retrieved Data . . . . . . . . . . . . . . .1-5
Handling Simulations with Multiple Cases. . . . . . . . . . . . . . .1-6
Chapter 2
Build Procedures for PDTS
Build Procedure for PRO/II PDTS. . . . . . . . . . . . . . . . . . . . . . . . .2-1
Using PDTS with PRO/II. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-2
Generating PRO/II Database Files . . . . . . . . . . . . . . . . . . . . . . . . .2-2
Building a PDTS Executable File Using Compaq FORTRAN . . .2-2
Chapter 3
PDTS Subroutines and Functions
Opening Database Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-2
Obtaining a List of Case Study IDs . . . . . . . . . . . . . . . . . . . . . . . .3-3
Setting Up an Individual Case Study . . . . . . . . . . . . . . . . . . . . . . .3-4
Retrieving Miscellaneous Flowsheet Data. . . . . . . . . . . . . . . . . . .3-5
Chapter 4
PDTS Example Problems
General Instructions for Running a PDTS Problem . . . . . . . . . . . 4-1
Example Problem 4-1: Compressor Train . . . . . . . . . . . . . . . . . . . 4-2
Task Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Creating the PDTS Application Program . . . . . . . . . . . . . . . . 4-2
Example Problem 4-2: Single Column . . . . . . . . . . . . . . . . . . . . . 4-6
Task Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
Creating the PDTS Application Program . . . . . . . . . . . . . . . . 4-6
Example Problem 4-3: Trayed Column . . . . . . . . . . . . . . . . . . . . . 4-9
Task Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-9
Creating the PDTS Application Program . . . . . . . . . . . . . . . . 4-9
Chapter 5
Attribute Lists
Component Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
Stream Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
Unit Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-4
Flash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-5
Valve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-5
Compressor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6
Expander . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-6
Pump . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-7
Pipe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-7
HX. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-9
HXRIG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-10
LNGHX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-14
Shortcut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-15
Column/Side . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-16
LLEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-18
HCurve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-19
Phase Envelope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-20
vi Contents
Calculator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-21
Equilibrium Reactor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-21
Conversion Reactor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-22
CSTR. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-23
Plug Flow Reactor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-24
Gibbs Reactor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-25
User-Added Unit Operations. . . . . . . . . . . . . . . . . . . . . . . . .5-25
Chapter 6
PDTS Example Listings
Example 6-1 — FORTRAN Listing . . . . . . . . . . . . . . . . . . . . . . .6-1
Example 6-2 — FORTRAN Listing . . . . . . . . . . . . . . . . . . . . . . .6-4
Example 6-3 — FORTRAN Listing . . . . . . . . . . . . . . . . . . . . . . .6-6
Chapter 7
User-Addressable Utility Functions
Subroutine FIGETU. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-1
Chapter 8
Guide for Pre-v5.5 PDTS-UAS Users
PDTS Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-1
UAS Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8-1
Guide for PDTS and UAS v4.0 Users . . . . . . . . . . . . . . . . . . . . . .8-2
Chapter 9
UAS Introduction
PRO/II User-Added Subroutines . . . . . . . . . . . . . . . . . . . . . . . . . .9-1
Hardware and Software Requirements for PRO/II UAS . . . . . . . .9-1
Program Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9-2
Chapter 10
Build Procedure for PRO/II UAS
Required Source Code Modifications for the PC Version . . . . . .10-1
Build Procedure for PRO/II UAS . . . . . . . . . . . . . . . . . . . . . . . .10-2
Integrating UAS Using Compaq Visual FORTRAN . . . . . . . . . .10-2
Customizing a UAS Data Entry Window . . . . . . . . . . . . . . . . . .10-3
Chapter 11
FORTRAN Coding Standards
and Requirements
FORTRAN Programming Guidelines . . . . . . . . . . . . . . . . . . . . .11-2
PRO/II Data Transfer System and User-Added Subroutines User’s Guide vii
Chapter 12
Interfacing Software, Common Blocks, and Data Files
Interface Subroutines. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-3
HEAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-3
URXINF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-3
URXSTR. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-4
TTPROP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-5
UFLSH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-6
U3FLSH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-9
UHS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-10
UH2OP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-11
UDENS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-12
KCOMPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-13
HCOMPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-14
Common Storage Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-14
/FACTOR/ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-14
/UTHERX/ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-16
/XPROPX/. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-18
/OUTFAC/. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-19
/CUDATA/. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-22
/CUSPEC/ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-23
User-Defined Data Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-23
FIGETU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-23
Chapter 13
User-Added Thermodynamic
Property Methods
Communicating with PRO/II . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-2
UTHERX Common Block . . . . . . . . . . . . . . . . . . . . . . . . . . 13-2
CUDATA Common Block . . . . . . . . . . . . . . . . . . . . . . . . . . 13-6
K-Value Calculations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-7
Handling Water Decant. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-7
Example 13-1: Water Decant . . . . . . . . . . . . . . . . . . . . . . . . 13-9
Internal UAS Component Order vs. Print Order . . . . . . . . . . . . 13-10
What Is Internal Component Order?. . . . . . . . . . . . . . . . . . 13-10
How Order Affects User-Added Subroutines . . . . . . . . . . . 13-12
Component Order Subroutines COPNUM and COINUM . 13-12
Example 13-2: Regular Solution Theory K-Value Method 13-13
Enthalpy and Entropy Calculations . . . . . . . . . . . . . . . . . . . . . . 13-19
viii Contents
Example 13-3: Petroleum Liquid and Vapor Enthalpy Calculations
13-20
Density Calculations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13-30
Example 13-4: Gunn-Yamada Liquid Density Calculations . .13-
30
Chapter 14
Transport Property Subroutines
Communicating with PRO/II . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-1
FORTRAN Subroutine. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-2
Example Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14-3
Chapter 15
Unit Operation Subroutines
Communicating with PRO/II . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-1
Unit Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-2
Feeds and Products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-2
Thermal Conditions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-2
Product Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-2
Results Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-3
User-Added Unit Operations and Controllers. . . . . . . . . . . .15-3
User-Added Unit Operations and Recycle Loops . . . . . . . . .15-5
User-Added Pressure Drop Calculations for the Pipe Unit. .15-5
Output Subroutines for User-Added Units . . . . . . . . . . . . . .15-8
FORTRAN Coding Convention—Unit Operations . . . . . . . . . . .15-8
FORTRAN Coding Conventions—Output Subroutines . . . . . .15-10
Example Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15-11
Chapter 16
Reaction Kinetic Subroutines
Communication with PRO/II . . . . . . . . . . . . . . . . . . . . . . . . . . . .16-1
Unit Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16-1
Results Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16-2
User-Added Kinetics and Controllers . . . . . . . . . . . . . . . . . . . . .16-2
FORTRAN Coding Conventions . . . . . . . . . . . . . . . . . . . . . . . . .16-2
Example Problem—Allyl Chloride Production in a PFR . . . . . .16-7
Chapter 17
Refinery Reactor Simulation UAS
User Utility Subroutines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17-1
UDEFNC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17-1
About PRO/II
PRO/II is a comprehensive process simulation program, running as
a Windows compliant application under Windows 98, NT, or 2000.
PRO/II combines the powerful SIMSCI simulation features familiar
to process engineers world wide with the ease of a graphical user
interface. Process flowsheets, which include such process units as
rigorous distillation columns, compressors, reactors, heat exchang-
ers, mixers, etc., can be built and simulated using PRO/II.
The PRO/II Data Transfer System (PDTS) is a post-processing util-
ity that enables you to electronically access a wide range of flow-
sheet data from any completed PRO/II simulation. The data
retrieved may then be used in any other application.
xii Introduction
About SIMSCI
PRO/II is backed by the full resources of Simulation Sciences Inc.,
a leader in process simulation since 1967. SIMSCI provides the
most thorough service capabilities and advanced process modeling
technologies available to the process industries. SIMSCI’s compre-
hensive support around the world, allied with its training seminars
for every user level, is aimed at making your use of these products
as efficient, effective and profitable as possible.
Technical Support
SIMSCI and its agents around the world provide technical support
and service for PRO/II. If you have any questions regarding pro-
gram use or the interpretation of program output, contact your local
SIMSCI representative for advice or consultation.
When calling a Technical Support Center, be prepared to describe
your problem or the type of assistance you feel you require. Also, to
expedite your request, please observe the following before calling:
PRO/II Data Transfer System and User-Added Subroutines User’s Guide xiii
■ Determine the amount of free disk space available on the disk
where PRO/II is installed.
■ Note the exact actions you were taking when the problem
occurred, as well as the steps you took leading up to that point.
xiv Introduction
Chapter 1
PDTS Introduction
This chapter introduces the PDTS utility for PRO/II. In this chapter
you will:
What is PDTS?
The PRO/II Data Transfer System (PDTS) is a post-processing util-
ity that provides electronic access to a wide range of flowsheet data
from any completed PRO/II simulation. The data retrieved may then
be used in any other application. This manual describes how to use
this tool effectively.
Program Limits
Although a PRO/II simulation has no explicit limits on the size of
its parameters, PDTS is constrained due to the nature of the retrieval
process which uses the FORTRAN language. The standard limits
for this release are listed in Table 1-1. If the PRO/II simulation
exceeds any of these limits, a warning will be sent to the standard
output and execution will terminate. If your requirements exceed
these limits, contact your SIMSCI representative to request an
enlarged version of PDTS.
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 1-1
Table 1-1: Limits of Standard PDTS
Category Limit (max)
Components 300
Streams 984
Unit operations 500
Trays in a column or LLEX 500
Feed streams to a column 20
Product draws from a column 10
Separate curves in any HCURVE unit 50
Points in any individual HCURVE 100
Separate curves in any Phase Envelope 20
Points in any Phase Envelope curve* 120
* This limit cannot be extended by using an enlarged version of PDTS.
To specify the PRO/II data, the user will refer to the data as an
Attribute belonging to a particular Class and for a specified Item.
The data will then be returned to a data buffer. Class and Attribute
lists can be found in Chapter 5. The Item is the ID of the stream or
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 1-3
unit. The attribute ALL is used in retrieving component data and lists
of available unit and stream IDs.
Note: In the above subroutine call, the Class, Attribute and Item
are supplied as character strings (i.e., enclosed in single quotes).
Class and Attribute strings are case sensitive. It is essential that
these strings be entered exactly as given in Chapter 5.
The fourth argument in the call above is the return Variable for the
Attribute. In the example above, data are returned in WCALC. Since
Attributes are either scalar or vectors, it is the user’s responsibility
to provide a return Variable sufficiently sized to hold the returned
value.
Note: For the subroutines PADATR, PADATI, and PADATC, the first
four arguments are identical: Class, Attribute, Item and the return
Variable.
The last four arguments in the subroutine above are integer argu-
ments KC, KU, IU, and IERR. In the order shown above, these argu-
ments are used to:
Example:
KU = 0
CALL PADATR(‘Compressor’,‘WorkActualCalc’,‘C-1’,WCALC,KC,*
KU,IU,IERR)
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 1-5
Example:
CHARACTER*30 CBUF, PAUOMS
.
.
.
KU = 0
CALL PADATR(‘Flash’,‘DutyCalc’,‘F-1’,QCALC,KC,
KU,IU,IERR)
CBUF = PAUOMS(IU, KU, IERR)
.
.
WRITE (NF,1001) QCALC, CBUF
1001 FORMAT(‘The Duty of Flash F-1 = ’, F10.4, A30)
Note: These routines are not required if the BASECASE is the only
case of interest.
The build procedures outlined in this chapter assume that you are
familiar with Compaq Visual Fortran 6.1 or 6.5 for Windows 98,
Windows NT, or Windows 2000.
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 2-1
Using PDTS with PRO/II
To use the PDTS utility with PRO/II:
➤ Run PRO/II.
➤ Import the EXAM1.INP file, located in the
C:\SIMSCI\PROII55\USER\PDTS\EXAMPLES directory.
➤ Save the simulation as a .PR1 file. (By default, PRO/II saves
simulations as .PRZ files.)
PRO/II runs the problem EXAM1 and generates database files
EXAM1.PR1, EXAM1.PR2, and EXAM1.PR3 (by default, located in
C:\SIMSCI\PROII55\USER\PDTS\EXAMPLES).
➤ Start Compaq Visual Fortran 6.1 or 6.5 for Windows 98, Win-
dows NT, or Windows 2000.
➤ Select File/Open Workspace from the menu bar.
➤ Select the file \SIMSCI\PROII55\USER\PDTS\EXAMPLES\
EXAM1.DSW and click OK.
You can now run the program either from the command line or from
within Compaq FORTRAN.
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 2-3
➤ Compare the results in EXAM1.PDS with the test results in the
file EXAM1.CKP (these will be in the same directory as your
EXAM1.PR* files). If your PDTS example ran successfully, there
should be no difference between the files.
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 3-1
Opening Database Files
SUBROUTINE PAOPEN(NAME, SPATH, NFOUT, IRCODE)
Purpose:
To open PRO/II database files for access and to create a user-acces-
sible output file.
Note: This routine must be called before any other PDTS routine
in this system.
Arguments:
NAME Character string corresponding to the primary file
name (name) on the TITLE statement specified by
the keyword NEWFILE=name. The PRO/II database
files name.PR1, etc. must be in the current directory
when the application is executed.
SPATH Character string consisting of path to error and
support files. If these files were installed in default
location on the (same disk drive as the PDTS
application was run from), then user may enter a
blank string - ’ ’ (’<space>’) for this argument
NFOUT The FORTRAN output file unit number for the default
PDTS output file. The default file name will be
name.PDS.
IRCODE Return code (non-zero indicates error
condition).
Example:
CHARACTER*8 NAME
.
.
1001 FORMAT(‘Enter File Name ’)
1002 FORMAT(A)
1003 FORMAT(‘Data Retrieved Reported for File = ’,A10)
WRITE(*, 1001)
READ(*, 1002) NAME
.
CALL PAOPEN (NAME, ‘ ’, NFOUT, IRCODE)
WRITE (NFOUT, 1003) NAME
In the above example, you are prompted to supply, through the stan-
dard input, the file name for database retrieval. Subsequent output is
written to FORTRAN unit NFOUT. System support and error files
are assumed in their default location. On the PC the default is the
directory: \SIMSCI\PROII_W\SYSTEM\. On UNIX systems the default
is the directory: /usr/local/lib/simsci/ssilib/.
Purpose:
To return an array of CHARACTER*12 strings with the case IDs
which are available in the current PRO/II database files opened by a
previous call to PAOPEN.
Arguments:
Example:
PARAMETER (MXN = 25)
.
CHARACTER*12 NAME, CASEN (MXN)
.
.
1001 FORMAT (‘Enter File Name ’)
1002 FORMAT (A)
1003 FORMAT (‘Number Case IDs Found = ’,I5, /)
1004 FORMAT (I5, 1X,A14)
WRITE (*, 1001)
READ (*, 1002) NAME
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 3-3
.
CALL PAOPEN (NAME, ‘ ’, NFOUT, IRCODE)
C
C Retrieve Available Case IDs and Display on Screen
C
CALL PACSL (MXN, KXN, CASEN, IRCODE)
WRITE (*, 1003) KXN
NXN = MIN (MXN, KXN)
DO 2001 IX = 1, NXN
WRITE (*, 1004) IX, CASEN (IX)
2001 CONTINUE
Purpose:
To set up an individual simulation case.
Arguments:
Example:
PARAMETER (MXN = 25)
.
CHARACTER*12 NAME, CASEN (MXN), CASEX
.
.
1001 FORMAT (‘Enter File Name: ’)
1002 FORMAT (A)
1003 FORMAT (‘ Number Case IDs Found = ’,I5, /)
1004 FORMAT (I5, 1X,A14)
1005 FORMAT (‘ Enter Case ID : ’)
WRITE (*, 1001)
READ (*, 1002) NAME
.
CALL PAOPEN (NAME, ‘ ’, NFOUT, IRCODE)
CALL PACASL (MXN, KXN, CASEN, IRCODE)
WRITE (*, 1003) KXN
NXN = MIN (MXN, KXN)
DO 2001 IX = 1, NXN
WRITE (*, 1004) IX, CASEN (IX)
2001 CONTINUE
C
Purpose:
To retrieve basic flowsheet parameters and initialize the system.
This subroutine must be called before any call to retrieve other
flowsheet data items. If a case other than BASECASE is to be set up,
then this routine should be called after a call to PACASE. If the flow-
sheet case is not a converged solution, IRCODE will be equal to 1,
and an error message will be displayed to the standard output.
Arguments:
Example:
1001 FORMAT (‘Number of Components = ’, I5, /,
+ ‘Number of Streams = ’, I5, / ,
+ ‘Number of Unit Ops = ’, I5)
1002 FORMAT(‘ Solution Not Reached !! ’)
.
CALL PAOPEN ( NAME, ‘ ’, NFOUT, IRCODE)
.
CALL PACASE ( CASEX, IRCODE)
C
C Get Miscellaneous Flowsheet Data
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 3-5
Retrieving Flowsheet Data
Floating Point Data
SUBROUTINE PADATR (CLASS, ATTRIB, ITEM, RBUF,
KC, KU, IU,IRCODE)
Purpose:
To retrieve single precision floating point data from the PRO/II
flowsheet described by Class, Attribute and Item to store the
retrieved data in variable RBUF. The retrieved data item may be
either a single number or an array of values.
Arguments:
Example:
DIMENSION XNBP (MAXNOC)
CHARACTER*20 CTEMP, PAUOMS
.
.
1001 FORMAT (‘Normal Boiling Point - DEG’, A5)
1002 FORMAT (5E15.6)
.
.
KU = 7
CALL PADATR (‘COMP’, ‘NormBoilPt’, ‘ALL’, XNBP, KC, KU,
IU, IER)
CTEMP = PAUOMS ( IU, KU, IRCODE)
WRITE (NFOUT, 1001) CTEMP(1:5)
WRITE (NFOUT, 1002) (XNBP(I), I = 1, KC)
Integer Data
SUBROUTINE PADATI (CLASS, ATTRIB, ITEM, IBUF, KC, IRCODE)
Purpose:
To retrieve integer data from the PRO/II flowsheet described by
Class, Attribute and Item and to store the retrieved data in variable
IBUF. The retrieved data item may be either a single number or an
array of values.
Arguments:
Example:
1001 FORMAT (‘Number of Trays in Column T-1 = ’, I5)
CALL PADATI (‘Colu’,‘NumberOfTrays’,‘T-1’,NTRAY,KC,IER)
WRITE (NFOUT, 1001) NTRAY
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 3-7
In the above example, the number of trays for column ‘T-1’ is
retrieved into variable NTRAY. By referring to Chapter 5, the user
can determine that the Class for column data is ‘Colu’ and that the
Attribute to get the number of trays is ‘NumberOfTrays’. This is a sin-
gle integer value. In this case, the Item requested was the unit with
unit ID ‘T-1’.
Character Data
SUBROUTINE PADATC (CLASS, ATTRIB, ITEM, CBUF, KS, KC,
IRCODE)
Purpose:
To retrieve character type data from the PRO/II flowsheet described
by Class, Attribute and Item and store the retrieved data in variable
CBUF. The retrieved data item may be either a single character
string or an array of strings.
Arguments:
Example:
CHARACTER*12 UNID (MAXUOP)
.
.
CALL PADATC (‘UNIT’, ‘IDS’, ‘ALL’, UNID, KS, KC, IERR)
In this example, the unit IDs for all unit operations in the flowsheet
are retrieved into the array of character strings UNID. By reference
to Chapter 5, the user has determined that the Class for generic unit
data is ‘UNIT’ and that the Attribute to get the unit IDs is ‘IDS’. This is
an array of character strings with one member of the array for each
unit operation. Therefore, the Item requested was ‘ALL’. Variable KC
Purpose:
To retrieve a character string description for the units of measure
defined by the flags IU and KU. If the value of IU passed to the func-
tion is zero indicating a dimensionless quantity, PAUOMS will return
a blank string and the IRCODE will be equal to 1. The size of the
string retrieved by PAUOMS will not exceed 30 characters.
Arguments:
Example:
CHARACTER*30 PAUOMS, CVEL
1001 FORMAT (‘Maximum Velocity in Pipe = ’, F10.4, A30)
.
KU = 0
.
CALL PADATR (‘Pipe’, ‘CalcMaxVelocity’, ‘P-1’, VMAX, KC,
KU, IU, IERR)
CVEL = PAUOMS (IU, KU, IERR)
WRITE (NFOUT, 1001) VMAX, CVEL
In this example, the user retrieves the maximum velocity in pipe
unit P-1 by a call to PADATR. Upon return from PADATR, the value of
IU will be an integer flag corresponding to velocity units. Because
the user has set KU = 0 before the call to PADATR, the value of VMAX
is in Input units. Thus, function PAUOMS will retrieve a character
string constant with the value of VMAX.
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 3-9
Closing Database Files
SUBROUTINE PACLOS( )
Purpose:
This subroutine closes all database files and the default output file
opened by PAOPEN. It is recommended that this routine be called at
the end of your PDTS application.
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 4-1
For each PDTS example problem, you must then complete the fol-
lowing steps:
5. Next, obtain arrays of unit type and unit description for each
individual unit. In these retrievals, the individual unit ID string
is the Item passed to PADATC. As each unit type and description
string is retrieved, it is echoed to the output file.
C GET UNIT TYPE & NAME
C
DO 1004 IX = 1, NUNIT
CALL PADATC(‘UNIT’,‘TYPE’,UID(IX),UTYPE(IX,KS,KC,IER)
C
CALL PADATC(‘UNIT’,‘NAME’,UID(IX),UNAME(IX,KS,KC,IER)
C
WRITE (NFOUT,111) IX,UID(IX),UTYPE(IX),UNAME(IX)\
1004 CONTINUE
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 4-3
of the type string will match those of the unit operation key-
word for that unit type. Note that the user-selected default input
units are specified on the DIMENSION statement in the PRO/II
input file before calling subroutine PADATR. A series of floating
point data retrievals are set up inside the loop. In each case, the
Class is ‘Compressor’ and the call to subroutine PADATR is made
with the appropriate Attribute string as given in Chapter 5 for
Compressor data.
C SELECT COMPRESSOR UNIT OPS
C RETRIEVE DATA FOR EACH STAGE
C
KX = 1
DO 1010 IX = 1, NUNIT
CUTYPE = UTYPE(IX)
IF (CUTYPE(1:4) .EQ. ‘COMP’) THEN
C
XID(KX) = UID(IX)
XNAME(KX) = UNAME(IX)
C
CALL PADATR(‘Compressor’,‘PresInletCalc’,UID(IX),
+ PIN(KX),KC,KUOM,IPRES,IER)
C
CALL PADATR(‘Compressor’,‘TempInletCalc’, UID(IX),
+ TIN(KX),KC,KUOM,ITEMP,IER)
C
CALL PADATR(‘Compressor’,‘PresCalc’, UID(IX),
+ POUT(KX), KC,KUOM,IUOM,IER)
C
CALL PADATR(‘Compressor’,‘TempCalc’,UID(IX),
+ TOUT(KX,KC,KUOM,IUOM,IER)
C
CALL PADATR(’Compressor’,‘PRatio’,UID(IX),
+ PRAT(KX),KC,KUOM,IUOM,IER)
C
CALL PADATR(‘Compressor’,‘WorkActualCalc’,UID(IX),
+ WORK(KX, KC,KUOM,IWORK,IER)
C
CALL PADATR(‘Compressor’,‘EffAdiaCalc’,UID(IX),
+ EFF(KX) KC,KUOM,IUOM,IER)
C
CALL PADATR(‘Compressor’,‘AcDutyCalc’,UID(IX),
+ DUTY(KX), KC,KUOM,IDUTY,IER)
C
KX = KX + 1
C
ENDIF
1010 CONTINUE
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 4-5
Example Problem 4-2: Single Column
Task Description
You are simulating a single column. The objective is to do a case
study and generate a table of the effects of increasing feed flowrate
on condenser and reboiler duty for each case study.
1. Prompt the user of the PDTS application for the file name.
This is the same file name that was entered as keyword
NEWFILE= xxxx.
101 FORMAT(‘ *** PDTS EXAMPLE PROBLEM # 2 ***’,/,
+ ‘ ENTER FILE NAME: ’)
102 FORMAT(A)
.
.
.
C ENTER FILE NAME
C
WRITE (*,101)
READ (*,102) FNAME
6. The next subroutine call is to PADATC which will return the col-
umn unit name. By referring to Chapter 5, you can see that the
Class and Attribute for this retrieval are ‘UNIT’ and ‘NAME’
respectively. Because these data are required for one unit only,
the Item is UID.
C GET UNIT NAME
C
C CALL PADATC(‘UNIT’,‘NAME’,UID,UNAME,KS,KC,IER)
7. The next step is to obtain the total molar flowrate of the feed
stream 1. In these retrievals, the individual stream ID string
(defined above as stream “1”) is the Item passed to PADATC.
C GET FEED STREAM RATE
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 4-7
C
C CALL PADATR(‘STREAM’,‘TotalMolarate’,SID,FLOW(KX),
C + KC,KUOM,IFLOW,IER)
8. Then, two separate calls are made to PADATR to retrieve the col-
umn condenser and reboiler duties. To check the unit type, keep
in mind that the first four characters of the type string will
match those of the unit operation keyword for that unit type. In
each case, the Class is ‘Colu’ and the calls to subroutine PADATR
are made with the appropriate Attribute strings as given in
Chapter 5 for Column data.
C GET COLUMN CONDENSER & REBOILER DUTIES
C
CALL PADATR(‘Colu’,‘CondenserDuty’,UID,QCON(KX),KC,
+ KUOM,IDUTY,IER)
C
CALL PADATR(‘Colu’,‘ReboilerDuty’,UID,QREB(KX),KC,
+ KUOM,IUOM,IER)
C
3001 CONTINUE
1. Prompt the user of the PDTS application for the file name.
This is the same file name that was entered as keyword
NEWFILE= xxxx.
101 FORMAT(‘ *** PDTS EXAMPLE PROBLEM # 3 ***’,/,
+ ‘ ENTER FILE NAME: ’)
102 FORMAT(A)
.
.
.
C ENTER FILE NAME
C
WRITE (*,101)
READ (*,102) FNAME
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 4-9
C GET MISCELLANEOUS FLOWSHEET DATA
C
CALL PAMISC(NCOMP,NSTRM,NUNIT,IRCODE)
IF (IRCODE .NE. 0) THEN
WRITE (*,203)
STOP
ENDIF
Then, set the default input units as the units of measure for the
PDTS routine, and set up the target unit to be unit D101.
C SET UNIT OF MEASURE AS DEFAULT INPUT UNITS
C
C KUOM = 0
C
C TARGET CASE ID IS D101
C FEED STREAM IS ‘1’
C
UID = ‘D101’
4. The next two subroutine calls are to PADATC, which returns the
component IDs and column unit name. By referring to Chapter
5, you can see that the Class and Attribute for the first call are
‘COMPS’ and ‘IDS’. Because these data are required for all com-
ponents, the Item is ‘ALL’. For the second call, the Class and
Attribute are ‘UNIT’ and ‘NAME’ respectively. Because these data
are required for one unit only, the Item is UID.
C GET COMPONENT IDS
C
CALL PADATC(‘COMPS’,‘IDS’,‘ALL’,COMPID,KS,KC,IER)
C
C GET UNIT NAME
C
CALL PADATC(‘UNIT’,‘NAME’,UID,UNAME,KS,KC,IER)
6. Then, two separate calls are made to PADATR to retrieve the col-
umn tray temperature and pressure. To check the unit type,
keep in mind that the first four characters of the type string will
match those of the unit operations keyword for that unit type. In
each case the Class is ‘Colu’ and the calls to subroutine PADATR
are made with the appropriate Attribute strings as given in
Chapter 5 for Column data.
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 4-11
WRITE (NFOUT,117) DNFLOW, (XVNET(I), I = KX, KX+4)
WRITE (NFOUT,118) DNFLOW, (XLNET(I), I = KX, KX+4)
WRITE (NFOUT,119) DNVDEN, (DENVAP(I), I = KX, KX+4)
WRITE (NFOUT,120) DNLDEN, (DENLIQ(I), I = KX, KX+4)
C
WRITE (NFOUT,121)
DO 2501 JX = 1, NCOMP
WRITE (NFOUT,122) COMPID(JX),
+ (YCOMP(JX+NCOMP*(I-1)), I = KX, KX+4)
2501 CONTINUE
C
WRITE (NFOUT,123)
DO 2502 JX = 1, NCOMP
WRITE (NFOUT,122) COMPID(JX),
+ (XCOMP(JX+NCOMP*(I-1)), I = KX, KX+4)
2502 CONTINUE
3001 CONTINUE
END
The complete listing of Example 4-3 is given in Chapter 6.
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 4-13
TRAY NUMBER: 11 12 13 14 15
PRESSURE: PSIG 435.00 435.56 436.11 436.67 437.22
TEMPERATURE: F 114.07 136.24 151.44 163.22 172.68
NET VAPOR RATE: LB-MOL/HR 737.95 913.54 1011.16 1078.69 1135.58
NET LIQUID RATE: LB-MOL/HR 1236.03 1333.65 1401.18 1458.07 1506.80
VAPOR DENSITY: LB/FT3 3.4647 3.8354 4.0850 4.2876 4.4607
LIQUID DENSITY: LB/GAL 3.6939 3.5893 3.5251 3.4755 3.4354
VAPOR PHASE COMPOSITION
N2 0.0000 0.0000 0.0000 0.0000 0.0000
C1 0.1204 0.0377 0.0119 0.0038 0.0012
C2 0.5387 0.4896 0.3984 0.3044 0.2227
C3 0.3028 0.4220 0.5281 0.6196 0.6924
IC4 0.0172 0.0226 0.0274 0.0323 0.0378
NC4 0.0148 0.0195 0.0235 0.0274 0.0317
IC5 0.0026 0.0035 0.0042 0.0049 0.0055
NC5 0.0016 0.0022 0.0027 0.0031 0.0035
NC6 0.0015 0.0022 0.0028 0.0033 0.0038
NC7 0.0005 0.0008 0.0010 0.0012 0.0014
LIQUID PHASE COMPOSITION
N2 0.0000 0.0000 0.0000 0.0000 0.0000
C1 0.0279 0.0091 0.0029 0.0010 0.0003
C2 0.3653 0.3053 0.2374 0.1763 0.1267
C3 0.4495 0.5279 0.5984 0.6559 0.6977
IC4 0.0470 0.0489 0.0516 0.0551 0.0600
NC4 0.0479 0.0488 0.0506 0.0531 0.0567
IC5 0.0148 0.0145 0.0145 0.0147 0.0149
NC5 0.0101 0.0098 0.0098 0.0099 0.0100
NC6 0.0232 0.0221 0.0216 0.0212 0.0210
NC7 0.0144 0.0136 0.0131 0.0128 0.0126
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 4-15
Chapter 5
Attribute Lists
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 5-1
Component Data
Class: ‘COMPS’
Use Item: ‘ALL’ for all component attributes (count = number of components)
Use Item: ‘ALL’ for attribute ‘IDS’ only (count = number of streams)
Item Description Variable Array/ Units Notes
Type Scalar
‘BulkMolecularWeight’ Molecular weight of bulk stream Real Scalar
‘BulkUopK’ Watson K (UOP) of bulk stream Real Scalar
‘CetanIndex’ Cetane index Real Scalar
‘CloudPt’ Cloud point Real Scalar Temperature
‘D1160Curve’ D1160 curve Real Array Temperature 1
‘D86Curve’ D86 curve Real Array Temperature 1
‘FlashPt’ Flash point Real Scalar Temperature
‘GrosHeatValue’ Gross heating value Real Scalar Energy/Vap.Vol.
‘IDS’ IDs of streams Character Array 12 Characters
‘L1Fraction’ Fraction of L1 liquid phase Real Scalar
‘L2Fraction’ Fraction of L2 liquid phase Real Scalar
‘MotOctaneNumb’ Motor octane number Real Scalar
‘NAME’ Stream name Character Scalar 40 Characters
‘NetHeatValue’ Lower or net heating value Real Scalar Energy/Vap.Vol.
‘PourPt’ Pour point Real Scalar Temperature
‘Pressure’ Stream pressure Real Scalar Pressure
‘ReidVapPres’ Reid vapor pressure Real Scalar PSI (always)
‘ResOctaneNumb’ Research octane number Real Scalar
‘SolidFraction’ Stream solid fraction Real Scalar
‘SulfurWtPerc’ Sulfur weight percent Real Scalar
‘TBPCurve’ TBP curve Real Array Temperature 1
‘Temperature’ Stream temperature Real Scalar Temperature
‘TotalComposition’ Total composition of bulk stream Real Array 2
‘TotalMolarEnthalpy’ Total molar enthalpy Real Scalar Energy/Mole
‘TotalMolarEntropy’ Total molar entropy Real Scalar Entropy/Mole
‘TotalMolarRate’ Total molar flowrate Real Scalar Mole Rate
‘TrueVapPres’ True vapor pressure Real Scalar Pressure
‘WaterFraction’ Fraction of aqueous phase Real Scalar
Liquid Phase
‘LiqApiGravity’ API gravity of liquid phase Real Scalar
‘LiqCP’ CP of liquid phase Real Scalar Molar Heat Capacity
‘LiqDensityAct’ Actual density of liquid phase Real Scalar Density
‘LiqKineVisc’ Kinematic viscosity of liquid phase Real Scalar Kinematic Viscosity
‘LiqMolarEnthalpy’ Molar enthalpy of liquid phase Real Scalar Energy/Mole
‘LiqMolarEntropy’ Molar entropy of liquid phase Real Scalar
‘LiqMolarRate’ Molar rate of liquid phase Real Scalar Mole Rate
‘LiqMolecularWeight’ Molecular weight of liquid phase Real Scalar
‘LiqSpecGravity’ Specific gravity of liquid phase Real Scalar
Notes:
1) Distillation curves of 13 points at percent distilled points: 0, 5, 10, 20, 30, 40, 50, 60,70, 80, 90, 95, 100
2) Compositions in mole fraction; Count = number of components
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 5-3
Item Description Variable Array/ Units Notes
Type Scalar
‘LiqSurfTension’ Surface tension of liquid phase Real Scalar Tension
‘LiqThermalCond’ Thermal conductivity of liquid phase Real Scalar Thermal Cond.
‘LiquidComposition’ Composition of liquid phase Real Array 2
‘LiquidFraction’ Stream liquid fraction Real Scalar
‘LiqViscosity’ Viscosity of liquid phase Real Scalar
‘LiqVolumeRateStd’ STD vol. flowrate of liquid phase Real Scalar Std. Liq. Vol.
‘LiqZDensity’ Z-density of liquid phase Real Scalar
Vapor Phase
‘VapCP’ CP of vapor phase Real Scalar Molar Heat Capacity
‘VapCV’ CV of vapor phase Real Scalar Molar Heat Capacity
‘VapDensityAct’ Actual density of vapor phase Real Scalar Density
‘VapMolarEnthalpy’ Molar enthalpy of vapor phase Real Scalar Energy/Mole
‘VapMolarEntropy’ Molar entropy of vapor phase Real Scalar Entropy/Mole
‘VapMolarRate’ Molar rate of vapor phase Real Scalar Mole Rate
‘VapMolecularWeight’ Molecular weight of vapor phase Real Scalar
‘VaporComposition’ Composition of vapor phase Real Array 2
‘VaporFraction’ Stream vapor fraction Real Scalar
‘VapThermalCond’ Thermal conductivity of vapor phase Real Scalar Thermal Cond.
‘VapViscosity’ Viscosity of vapor phase Real Scalar Viscosity
‘VapVolumeRateStd’ STD vol. flowrate of vapor phase Real Scalar Vapor Volume
‘VapZDensity’ Z-density of vapor phase Real Scalar
Notes:
1) Distillation curves of 13 points at percent distilled points: 0, 5, 10, 20, 30, 40, 50, 60,70, 80, 90, 95, 100
2) Compositions in mole fraction; Count = number of components
Unit Data
Class: ‘UNIT’
Use Item: ‘ALL’ for attribute ‘IDS’ only (count = number of unit operations)
Item Description Variable Array/ Units Notes
Type Scalar
‘FeedData’ Stream IDs for unit feeds Character Array 2
‘IDS’ IDs of units Character Array 12 Characters
‘NAME’ Name of unit Character Scalar 40 Characters
‘NumberFeeds’ Number of feed streams to unit Integer Scalar
‘NumberProducts’ Number of product streams from unit Integer Scalar
‘NumberSides’ Number of sides in unit Integer Scalar 1
‘ProdData’ Stream IDs for unit products Character Array 2
‘TYPE’ Type of unit Character Scalar 16 Characters
Notes:
1) Most unit operations are single-sided. Exchanger unit operations may be multi-sided.
2) The feed and product data variables are arrays of 12 character stream IDs.
For exchanger units of more than one side, the stream IDs will be in this order:
HX Hot Side/Cold Side
HXRIG Shell Side/Tube Side
LNGHX Hot Cells/Cold Cells
The number of feeds and products for each respective side can be obtained using the appropriate exchanger class.
Valve
Class: ‘Valve’
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 5-5
Compressor
Class: ‘Compressor’
Expander
Class: ‘Expander’
Pipe
Class: ‘Pipe’
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 5-7
Item Description Variable Array/ Units Notes
Type Scalar
‘LiqFracInlet’ Liquid fraction of inlet fluid Real Scalar
‘LiqFracOutlet’ Liquid fraction of outlet fluid Real Scalar
‘LiqHoldupInlet’ Liquid holdup of inlet fluid Real Scalar (Vol/Vol)
‘LiqHoldupOutlet’ Liquid holdup of outlet fluid Real Scalar (Vol/Vol)
‘NetChangeInElevn’ Change in pipe elevation from horizontal Real Scalar
‘NumSegments’ Number of pipeline segments Integer Scalar
‘OutletPres’ Outlet pressure of pipe Real Scalar Pressure
‘OutletTemp’ Outlet temperature of pipe Scalar Temperature
‘PresFluidInlet’ Pressure of inlet fluid Real Scalar Pressure
‘PresFluidOutlet’ Pressure of outlet fluid Real Scalar Pressure
‘PresDropCorrelation’ Pressure drop correlation method Integer Scalar 1
‘RelRoughness’ Relative pipe roughness Real Scalar
‘SegAccelPresDrop’ Pres. drop across seg. due to acceleration Real Array Pres. Diff. 3
‘SegChangeElevn’ Change in segment elev. from horizontal Real Array Length 3
‘SegDistanceInlet’ Distance of segment from inlet Real Array 3
‘SegElevnPresDrop’ Pres. drop across seg. due to elevation Real Array Pres. Diff. 3
‘SegFlowRegime’ Flow regime in segment Integer Array 2, 3
‘SegFluidVelocity’ Velocity of bulk fluid in segment Real Array Velocity 3
‘SegFricPresDrop’ Pres. drop across seg. due to friction Real Array Pres. Diff. 3
‘SegLiquidFrac’ Liquid fraction in segment Real Array 3
‘SegLiquidVelocity’ Velocity of liquid phase in segment Real Array Velocity 3
‘SegPressure’ Pressure at inlet of pipeline segment Real Array Pressure 3
‘SegTemperature’ Temperature at inlet of pipeline segment Real Array Temperature 3
‘SegTotalPresDrop’ Total pressure drop across segment Real Array Pres. Diff. 3
‘SegVaporVelocity’ Velocity of vapor phase in segment Real Array Velocity 3
‘SizingDeltaP’ Pressure drop for sizing calculations Real Scalar Pres. Diff.
‘SizingMaxVelocity’ Maximum velocity for sizing calculations Real Scalar
‘SlipDensInlet’ Slip density of inlet fluid Real Scalar Density
‘SlipDensOutlet’ Slip density of outlet fluid Real Scalar Density
‘TempFluidInlet’ Temperature of inlet fluid Real Scalar Temperature
‘TempFluidOutlet’ Temperature of outlet fluid Real Scalar Temperature
Notes:
1) Pressure Drop Correlations:
1 - Beggs-Brill-Moody 2 - Olimens 3 - Dukler-Eaton-Flanigan
4 - Gray 5 - Hagedorn-Brown 6 - Mukherjee-Bril
7 - Beggs-Brill-Moody-Palmer
2) Taitel-Dunkler-Barnea Flow Regime
1 - Stratified Smooth 2 - Stratified Wavy 3 - Intermittent
4 - Dispersed Bubble 5 - Annular 6 - Bubble
7 - Churn 8 - Single Phase 9 - Stratified Dispersed
10 - Annular Dispersed 11 - Intermittent Slug Flow
3) Array of values along pipe in direction of flow; Count = number of segments; Maximum = 50 segments
4) Duty has units 106 Energy/Time
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 5-9
HXRIG
Class: ‘HxRig’
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 5-11
Item Description Variable Array/ Units Notes
Type Scalar
‘TubeBundleDiam’ Diameter of tubeside bundle Real Scalar Fine Length
‘TubeBundleWt’ Weight of tubeside bundle Real Scalar Weight
‘TubeBWG’ Birmingham Wire Gauge of tube Integer Scalar
‘TubeDens’ Density of tubeside fluid Real Scalar Density
‘TubeFilmCoeff’ Film coefficient of tubeside Real Scalar Ht. Trans. Coeff.
‘TubeFilmCoeffSclFct’ Tubeside film coefficient scaling factor Real Scalar
‘TubeFoulFct’ Fouling factor for tubeside Real Scalar Foul Factor
‘TubeFoulLayerThck’ Thickness of tubeside fouling layer Real Scalar Fine Length
‘TubeID’ Inside diameter of tube Real Scalar Fine Length
‘TubeLen’ Length of tube Real Scalar Length
‘TubeMatCode’ Tube material code Integer Scalar 4
‘TubeNozzleInletID’ Inside diameter of tube nozzle inlet Real Scalar Fine Length
‘TubeNozzleOutletID’ Inside diameter of tube nozzle outlet Real Scalar Fine Length
‘TubeOD’ Outside diameter of tube Real Scalar Fine Length
‘TubePipeSched’ Pipe schedule of tubeside Real Scalar
‘TubePitch’ Center-center distance between tubes Real Scalar Fine Length
‘TubePitchFlag’ Tube pitch flag Integer Scalar 3
‘TubePresDropCalc’ Calculated pressure drop across tube Real Scalar Pres. Diff.
‘TubePrnNum’ Prandtl number in tubeside Real Scalar
‘TubeReyNum’ Reynolds number in tubeside Real Scalar
‘TubeSheetThck’ Thickness of tubeside sheet Real Scalar Fine Length
‘TubeTempIn’ Inlet temperature of tubeside fluid Real Scalar Fine Length
‘TubeTempOut’ Outlet temperature of tubeside fluid Real Scalar
‘TubeThck’ Thickness of tube Real Scalar Fine Length
‘TubeThermCond’ Thermal conductivity of tube Real Scalar Thermal Cond.
‘TubeVel’ Velocity of fluid in tubeside Real Scalar Velocity
‘TubeWallRes’ Resistance of tubeside wall Real Scalar Foul Factor
Notes:
1) Position Flag
1 - Horizontal orientation 2 - Vertical orientation
2) Flow Type Flag
0 - Countercurrent 1 - Cocurrent
3) Tube Pitch Flag
0 - Not defined 1 - 30 Degrees 2 - 90 Degrees
3 - 60 Degrees 4 - 45 Degrees
4) Material Code Flag
1 - Carbon Steel 2 - Carbon-moly Steel 3 - Chrome-moly Steel
4 - Low Chrome Steel 5 - Med Chrome Steel 6 - Straight Chrome Steel
7 - 304 SS 8 - 310 SS 9 - 316 SS
10- 321 SS 20- Al 1060 H14 21- Al 1100 Annealed
22- Al 3003 H14 Annealed 23- Al 3003 H25 Annealed 24- Al 6061 T4 Annealed
25- Al 6061 T6 Annealed 30- Copper 31- Arsenical Copper
32- Cu/Ni 90/10 33- Cu/Ni 80/20 34- Cu/Ni 70/30
35- Cu/Ni 60/40 40- Red Brass 85Cr/15Zn 41- Admiralty Brass 71Cu/28Zn/1Sn
42- Com Brass 55Cu/34Zn 43- Muntz Metal 60Cu/40Zn 44- Al Brass 93Cu/5Al
45- Al Brass 78Cu/2Al 50- Nickel Annealed 51- Low Carbon Nickel Annealed
52- Monel 70Ni/30Cu 53- Inconel 600 76Ni/16Cr/8Fe 60- Titanium Grade 2
5) Attach Side Flag
0 - None 1 - Shell 2 - Tube
6) Attached Type Flag - Indicates type of Attachment
1 - Condenser 2 - Reboiler 3 - Pumparound
4 - Side Heater or Cooler
7) Tray number in column where attached - Use ‘AttachUnit’ to get column unit ID
8) Duty has units 106 Energy/Time
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 5-13
LNGHX
Class: ‘LngHx’
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 5-15
Column/Side
Class: ‘Colu’ or ‘Side’
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 5-17
LLEX
Class: ‘Llex’ or ‘Colu’
Item Description Variable Array/ Units Notes
Type Scalar
‘AlgorithmType’ Type of calculation algorithm Integer Scalar 1
‘DrawTrays’ Draw tray location Integer Array 3
‘FeedTrays’ Feed tray location Integer Array 2
‘HeaterDuties’ Duties of side heaters/coolers Real Array Duty 5, 8
‘HeaterTrays’ Side heater/cooler tray location Integer Array 4
‘NumberDrawTrays’ Number of draw trays Integer Scalar
‘NumberFeedTrays’ Number of feed trays Integer Scalar
‘NumberOfHeaters’ Number of heaters/coolers Integer Scalar
‘NumberOfTrays’ Total number of trays Integer Scalar
‘QLossData’ Heat loss per tray Real Array Duty 6, 8
‘QLossTotal’ Total heat loss Real Array Duty 8
‘TrayNetLiq1Rates’ Flowrate of net liquid L1 from a tray Real Array Mole Rate 7
‘TrayNetLiq2Rates Flowrate of net liquid L2 from a tray Real Array Mole Rate 7
‘TrayPressures’ Tray pressures Real Array Pressure 7
‘TrayTemperatures’ Tray temperatures Real Array Temperature 7
Notes:
1) Algorithm type flag. Only valid value: 4 - LLEX
2) Array of tray locations for for each feed tray (count = number of feed trays)
3) Array of tray locations for each product draw (count = number of draw trays)
4) Array of tray locations for each heater / cooler (count = number of heaters)
5) Array of duties for all heaters/coolers (count = number of heaters)
6) Array of duties indicating heat leak (count = number of heat leaks)
7) Array with count = number of trays
8) Duty has units 106 Energy/Time
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 5-19
Item Description Variable Array/ Units Notes
Type Scalar
‘ThermalCondVapor’ Thermal conductivity of vapor phase Real Array Thermal Cond. 5
‘ViscosityLiquid’ Viscosity of liquid phase Real Array Viscosity 5
‘ViscosityVapor’ Viscosity of vapor phase Real Array Viscosity 5
‘WaterPointindices’ Indices of Water Points Integer Array
‘ZFactor’ Compressibility of vapor phase Real Array
Notes:
1) Flag for HCURVE type (count = number of curves)
1 - Isothermal 2 - Adiabatic 3 - Bubble point temperature
4 - Bubble point pressure 5 - Dew point temperature 6 - Dew point pressure
2) Flag for feed source to HCURVE (count = number of curves)
"Stream" - Stream feed "Unit" - Feed stream is derived from UNIT
3) Flag for side of unit providing feed if above flag is = 1 (count = number of curves)
Unit Type Flag Value
HX 1 = hot side, 2 = cold side
HXRIG 1 = shell side, 2 = tube side
LNGHX Cell number
COLUMN Heater/cooler number
4) 12 Character unit ID of source unit (count = number of curves)
5) Array equivalent to two-dimensional array (number of points) x (number of curves)
6) Duty has units 106 Energy/Time
Phase Envelope
Class: ‘Phase’
Equilibrium Reactor
Class: ‘EquReactor’
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 5-21
Conversion Reactor
Class: ‘ConReactor’
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 5-23
Plug Flow Reactor
Class: ‘Plug’
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 5-25
Chapter 6
PDTS Example Listings
CHARACTER*8 FNAME
CHARACTER*12 UID(MAXUOP), UTYPE(MAXUOP), CUTYPE, XID(3)
CHARACTER*40 UNAME(MAXUOP), XNAME(3)
CHARACTER*10 DNTEMP, DNPRES, DNWORK, DNDUTY, PAUOMS
DIMENSION PIN(3), TIN(3), POUT(3), TOUT(3), PRAT(3),
+ WORK(3), EFF(3), DUTY(3)
*********************************************************
100 FORMAT(/)
101 FORMAT(‘ *** PDTS EXAMPLE PROBLEM # 1 ***’,/,
+ ‘ ENTER FILE NAME: ‘)
102 FORMAT(A)
103 FORMAT(/,’ DATA RETRIEVAL FROM FILE: ‘,A15,/)
107 FORMAT(‘ NUMBER OF COMPONENTS = ‘,I5,/
+ ‘ NUMBER OF STREAMS = ‘,I5,/
+ ‘ NUMBER OF UNITS = ‘,I5,/)
110 FORMAT(/,’UNITS’,/)
111 FORMAT(I3,’ :’,A12,1X,A20,1X,A40)
112 FORMAT(/,’ COMPRESSOR TRAIN SUMMARY TABLE ‘,//,
+ ‘ UNIT ID ‘,15X,3A12,/,
+ 40X,3A12,/)
114 FORMAT(‘ INLET PRESSURE ‘,A10,3F12.4)
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 6-1
115 FORMAT(‘ INLET TEMPERATURE DEG ‘,A10,3F12.4)
116 FORMAT(‘ OUTLET PRESSURE ‘,A10,3F12.4)
117 FORMAT(‘ OUTLET TEMPERATURE DEG ‘,A10,3F12.4)
118 FORMAT(‘ PRESSURE RATIO (OUT/IN) ‘,10X,3F12.4)
119 FORMAT(‘ ACTUAL WORK ‘,A10,3F12.2)
120 FORMAT(‘ ADIABATIC EFFICIENCY ‘,10X,3F12.4)
121 FORMAT(‘ AFTERCOOLER DUTY ‘,A10,3F12.4)
203 FORMAT(‘ SOLUTION NOT REACHED !!!’)
205 FORMAT(‘ ERROR IN FILE INITIALIZATION !!!’)
C
C ENTER FILE NAME
C
WRITE (*,101)
READ (*,102) FNAME
C
C INITIALIZE RETRIEVAL SYSTEM & OPEN SELECTED FILE
C
CALL PAOPEN(FNAME,’ ‘,NFOUT,IRCODE)
IF (IRCODE .NE. 0) THEN
WRITE(*,205)
STOP
ENDIF
C
C WRITE THE FILE NAME
C
WRITE (NFOUT,103) FNAME
WRITE (*,103) FNAME
C
C GET MISCELLANEOUS FLOWSHEET DATA
C
CALL PAMISC(NCOMP,NSTRM,NUNIT,IRCODE)
IF (IRCODE .NE. 0) THEN
WRITE (*,203)
STOP
ENDIF
WRITE (*,107) NCOMP, NSTRM, NUNIT
WRITE (NFOUT,107) NCOMP, NSTRM, NUNIT
C
C SET UNIT OF MEASURE AS DEFAULT INPUT UNITS
C
KUOM = 0
C
C GET UNIT IDS
C
CALL PADATC(‘UNIT’,’IDS’,’ALL’,UID,KS,KC,IER)
WRITE (NFOUT,110)
C
C GET UNIT TYPE & NAME
C
DO 1004 IX = 1, NUNIT
CALL PADATC(‘UNIT’,’TYPE’,UID(IX),UTYPE(IX),KS,KC,IER)
C
CALL PADATC(‘UNIT’,’NAME’,UID(IX),UNAME(IX),KS,KC,IER)
C
WRITE (NFOUT,111) IX, UID(IX),UTYPE(IX),UNAME(IX)
1004 CONTINUE
C SELECT COMPRESSOR UNIT OPS
C RETRIEVE DATA FOR EACH STAGE
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 6-3
Example 6-2 — FORTRAN Listing
C
C FILE: EXAM2.FOR
C
C PDTS SAMPLE APPLICATION
C
C
C SIMULATION SCIENCES
C
PROGRAM EXAM2
C
C *********************************************************
C
C LOCAL DECLARATIONS
C
PARAMETER (MAXUOP = 500,MXN = 5)
C
CHARACTER*8 FNAME,CASE(MXN)
CHARACTER*12 SID, UID
CHARACTER*40 UNAME
CHARACTER*10 DNFLOW, DNDUTY, PAUOMS
DIMENSION FLOW(MXN), QCON(MXN), QREB(MXN)
*********************************************************
100 FORMAT(/)
101 FORMAT(‘ *** PDTS EXAMPLE PROBLEM # 2 ***’,/,
+ ‘ ENTER FILE NAME: ‘)
102 FORMAT(A)
103 FORMAT(/,’ DATA RETRIEVAL FROM FILE: ‘,A15,/)
105 FORMAT(‘ SETTING UP CASE: ‘,A10)
112 FORMAT(/,’ COLUMN CASE STUDY SUMMARY TABLE ‘,//,
+ ‘ UNIT ID ‘,A12,1X,A40,/)
114 FORMAT(‘ CASE ID ‘,13X,5A12,/)
115 FORMAT(‘ FEED FLOW RATE ‘,A10,5F12.1)
116 FORMAT(‘ CONDENSER DUTY ‘,A10,5F12.4)
117 FORMAT(‘ REBOILER DUTY ‘,A10,5F12.4)
203 FORMAT(‘ SOLUTION NOT REACHED !!!’)
205 FORMAT(‘ ERROR IN FILE INITIALIZATION !!!’)
206 FORMAT(‘ ERROR IN CASE SET-UP !!!’)
C
C ENTER FILE NAME
C
WRITE (*,101)
READ (*,102) FNAME
C
C INITIALIZE RETRIEVAL SYSTEM & OPEN SELECTED FILE
C
CALL PAOPEN(FNAME,’ ‘,NFOUT,IRCODE)
IF (IRCODE .NE. 0) THEN
WRITE(*,205)
STOP
ENDIF
C
C WRITE THE FILE NAME
C
WRITE (NFOUT,103) FNAME
C
C GET ARRAY OF CASE IDS
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 6-5
WRITE(NFOUT,112) UID, UNAME
WRITE(NFOUT,114) (CASE(I), I = 1, NXN)
WRITE(NFOUT,115) DNFLOW, (FLOW(I), I = 1, NXN)
WRITE(NFOUT,116) DNDUTY, (QCON(I), I = 1, NXN)
WRITE(NFOUT,117) DNDUTY, (QREB(I), I = 1, NXN)
C
END
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 6-7
C
C GET COLUMN TRAY BY TRAY LIQUID & VAPOR DENSITIES
C
CALL PADATR(‘Colu’,’TrayVapDensityAct’,UID,DENVAP,
+ KC,KUOM,IVDEN,IER)
C
CALL PADATR(‘Colu’,’TrayLiqDensityAct’,UID,DENLIQ,
+ KC,KUOM,ILDEN,IER)
C
C GET COLUMN TRAY BY TRAY LIQUID & VAPOR COMPOSITIONS
C
CALL PADATR(‘Colu’,’TrayVaporMoleFracs’,UID,YCOMP,
+ KC,KUOM,IUOM,IER)
C
CALL PADATR(‘Colu’,’TrayLiquidMoleFracs’,UID,XCOMP,
+ KC,KUOM,IUOM,IER)
C
C GET UNIT OF MEASURE STRINGS
C
DNPRES = PAUOMS(IPRES, KUOM, IERR)
DNTEMP = PAUOMS(ITEMP, KUOM, IERR)
DNFLOW = PAUOMS(IFLOW, KUOM, IERR)
DNLDEN = PAUOMS(ILDEN, KUOM, IERR)
DNVDEN = PAUOMS(IVDEN, KUOM, IERR)
C
C WRITE OUT TABLE
C
C
WRITE (NFOUT,112) UID, UNAME
DO 3001 KX = 1, NTRAY, 5
WRITE (NFOUT,114) KX, KX+1, KX+2, KX+3, KX+4
WRITE (NFOUT,115) DNPRES, (PRES(I), I = KX, KX+4)
WRITE (NFOUT,116) DNTEMP, (TEMP(I), I = KX, KX+4)
WRITE (NFOUT,117) DNFLOW, (XVNET(I), I = KX, KX+4)
WRITE (NFOUT,118) DNFLOW, (XLNET(I), I = KX, KX+4)
WRITE (NFOUT,119) DNVDEN, (DENVAP(I), I = KX, KX+4)
WRITE (NFOUT,120) DNLDEN, (DENLIQ(I), I = KX, KX+4)
C
WRITE (NFOUT,121)
DO 2501 JX = 1, NCOMP
WRITE (NFOUT,122) COMPID(JX),
+ (YCOMP(JX+NCOMP*(I-1)), I = KX, KX+4)
2501 CONTINUE
C
WRITE (NFOUT,123)
DO 2502 JX = 1, NCOMP
WRITE (NFOUT,122) COMPID(JX),
+ (XCOMP(JX+NCOMP*(I-1)), I = KX, KX+4)
2502 CONTINUE
3001 CONTINUE
END
Subroutine FIGETU
The calling sequence is:
CALL FIGETU ( 1, LOUT)
This is a PRO/II utility that guarantees that the FORTRAN unit
number passed to your FORTRAN OPEN statement will not conflict
with files opened by the PDTS system. The FIGETU subroutine call
returns the next available FORTRAN unit number for input or out-
put as integer variable LOUT. An example code extract is shown
below:
CHARACTER*8 FNAME
CHARACTER*12 FEXTRA
1001 FORMAT(‘ ENTER FILE NAME: ‘)
1002 FORMAT(A)
.
C
C GET NAME OF PRO/II DATA BASE
WRITE (*, 1001)
READ (*, 1002) FNAME
C
C USE PAOPEN TO OPEN DATABASE FILES AND FILE ‘FNAME.PDS’
CALL PAOPEN(FNAME ‘ ‘, NFOUT, IERR)
C
C GET ANOTHER FILE UNIT FOR OUTPUT
CALL FIGETU(1, LOUT)
C
C OPEN FILE ‘FNAME.PXX’ AS NEW FORMATTED SEQUENTIAL FILE
FEXTRA = FNAME // ‘PXX’
OPEN (UNIT=LOUT, FILE=FEXTRA, STATUS=’NEW’,
+ FORM=’FORMATTED’, ACCESS=’SEQUENTIAL’)
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 7-1
Chapter 8
Guide for Pre-v5.5 PDTS-UAS Users
PDTS Applications
Applications which have been developed in the past using older ver-
sions of the PDTS functions will continue to work with this version
of PRO/II with minor modifications.
Users must recompile the FORTRAN source code and relink their
PDTS application with this version of the PRO/II libraries in order
to make them compatible with PRO/II databases generated with
PRO/II v5.5.
UAS Applications
PRO/II UAS v5.5 allows up to 25 feed and 25 product streams. The
URXINF subroutine is used to identify these streams (see page 12-
3).
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 8-1
Guide for PDTS and UAS v4.0 Users
For applications that were developed using versions 4.0 to 4.17, the
PDTS functions will work with these versions without modifica-
tion. However, you must recompile and relink your application with
the latest version of the PRO/II libraries in order to be compatible
with PRO/II v5.5.
Chapter 9
UAS Introduction
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 9-1
Program Limits
Although PRO/II has no fixed limits on the number of components,
the standard user-added interface for PRO/II observes certain
restrictions to be consistent with previous versions. The restrictions
shown in Table 9-1 apply.
Table 9-1: PRO/II UAS Limitations
Calculation/Model Component/Variable Maximum
All User-Added Calculations1 300 Components in Flowsheet
User-Added Unit Operations IPARM (250)
RPARM (500)
HEAT (10)
SUPPLE (10000)
User-Added Kinetic Models 50 Components in Flowsheet
IPARM (10)
RPARM (70)
SUPPLE (200)
1) Except user-added kinetics
The build procedures outlined in this chapter assume that you are
familiar with Windows and Compaq Visual FORTRAN 6.1 or 6.5
for Windows 98, Windows NT, or Windows 2000.
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 10-1
In order to maintain compatibility with the supplied INCLUDE files,
you should ensure that the original common variable names con-
tained in these common blocks have not been modified.
These INCLUDE files are supplied as part of the UAS/PDTS product
in the \SIMSCI\PROII55\USER\CMNS directory.
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 10-3
Chapter 11
FORTRAN Coding Standards
and Requirements
■ Interface subroutines.
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 11-1
In addition, a special common storage area has been included in the
PRO/II program for user-added thermodynamic subroutines.
Note: Allowance for free form input data for user-added methods
is provided in the PRO/II standard input procedures.
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 12-1
Table 12-1: Interface Subroutines for PRO/II
Name Description See page...
HEAD Heads and numbers output page 12-3
URXINF Retrieves 12-character stream and 12-3
unit IDs and 40-character names
URXSTR Retrieves and stores stream data 12-4
TTPROP Transport and thermo properties 12-5
for streams
UFLSH Perform flash calculations 12-6
for streams
U3FLSH Perform 3-phase flash calculations 12-9
UHS Compute density, enthalpy, heat 12-10
capacity, or entropy for stream
UH2OP Provides water properties 12-11
UDENS Provides wet and dry flowing 12-12
volumes for streams
KCOMPU Returns K-values for 12-13
use in user flash
HCOMPU Returns enthalpies for 12-14
use in user flash
Calling sequence:
CALL HEAD
URXINF
This subroutine allows the user to access a 12-character unit ID, a
40-character unit name for user-added subroutine, a 12-character
stream ID, and a 40-character name for feed and product streams.
Calling sequence:
CALL URXINF(CTYPE,INDX, CID, CNAME, IERR)
where:
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 12-3
URXSTR
Streams may be retrieved and stored with this subroutine. Storage
of streams is limited to those streams declared as products from the
user-written subroutine. Stream data are transmitted and/or received
through a variably dimensioned stream vector as follows:
The dimensional units for the stream vector will correspond to those
chosen for problem input. The compressibility factor is only defined
for single-phase streams and is calculated from the K-value or
enthalpy method, not from the density method. Subroutine UHS is
used for the calculation of Z from the density method(s). For den-
sity calculations, use subroutine UDENS.
Calling sequence:
CALL URXSTR(CID,STREAM,IOTYPE,IERR)
where:
TTPROP
This subroutine may be used to calculate the following properties
for streams:
The stream for which properties are desired is loaded into a stan-
dard stream vector (see the section on URXSTR) for transmission to
TTPROP.
Calling sequence:
CALL TTPROP(ITYPE,IPHASE,PROPS,STREAM,IERR)
where:
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 12-5
PROPS Calculated stream properties, a variably dimensioned real
array. For ITYPE = 1 or 2, PROPS will contain the pure
component vapor pressures or ideal gas enthalpies in the
order specified for components in the problem input data.
For ITYPE = 3-6, only the first five positions of PROPS
will be used where:
PROP(1) Liquid surface tension
PROP(2) Liquid viscosity
PROP(3) Liquid thermal conductivity
PROP(4) Vapor viscosity
PROP(5) Vapor thermal conductivity
STREAM Standard stream vector containing the stream for which
computations are to be based, a variably dimensioned
real array. All stream values must be given in problem
input dimensional units.
IERR Error flag:
0 No errors
1 IPHASE not equal to 1 or 2
2 ITYPE not in the range 1-6
3 Flowrate of stream is zero
4 Property requested is not available
The error flag should be tested after each call to TTPROP.
UFLSH
Subroutine UFLSH may be used to perform the following flash cal-
culations for process streams. This flash is a vapor/liquid flash with
an optional pure water second liquid phase.
■ Isothermal flash
where:
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 12-7
ITYPE The calculation type:
1 Isothermal flash (T defined, P defined)
2 Adiabatic flash (T defined, P calculated)
3 Adiabatic flash (P defined, T calculated)
4 Dew point (T defined, P calculated)
5 Dew point (P defined, T calculated)
6 Bubble point (T defined, P calculated)
7 Bubble point (P defined, T calculated)
8 Isentropic (T defined, P calculated)
9 Isentropic (P defined, T calculated)
10 Water dew point (T defined, P calculated)
11 Water dew point (P defined, T calculated)
IERR The error flag:
0 No errors
1 Flash convergence failure
2 ITYPE is not in range 1-11
3 The flowrate of STREAM is zero
For IERR = 2 or 3, no calculations will be
performed.
For example:
CALL UHS(2,1,STREAM,SV,X,IERR)
CALL UHS(2,2,STREAM,SL,X,IERR)
SISENV=STREAM(5)*SL + (1.0D0-STREAM(5))*SV
CALL UFLSH(STREAM,VAPOUT,XL1OUT,XL2OUT,XKVALU,ITYPE,IERR)
Calling sequence:
CALL U3FLSH(STREAM,VAPOUT,XL1OUT,XL2OUT,XK1VAL XK2VAL,
ITYPE,IERR)
Note: Except for the XK1OUT and XK2OUT arrays, the call is very
similar to the call to UFLSH described previously,
The error flag IERR, the flash type ITYPE and the vectors STREAM,
VAPOUT, XL1OUT, and XL2OUT are as described previously, except
that ITYPE cannot be greater than 7.
XL1OUT represents the light liquid phase and XL2OUT represents the
heavy liquid phase.
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 12-9
UHS
The enthalpy, entropy, molar heat capacity, or compressibility for a
stream of specified phase may be determined with this subroutine.
The stream is loaded into a standard stream vector as previously
described for URXSTR. All stream input values must be in problem
input dimensional units.
Calling sequence:
CALL UHS(ITYPE,IPHASE,STREAM,VALUE,STRMCP,IERR)
where:
ITYPE Property requested:
1 Enthalpy and/or heat capacity
2 Entropy
3 Compressibility factor on a dry basis calculated
from the density method(s) declared on the
METHODS statement.
IPHASE Stream phase:
1 Vapor
2 Liquid
STREAM Standard stream vector in which stream of interest is
located, variably dimensioned real array.
VALUE The property requested. Enthalpies are reported in
103 energy units per time. Entropies are reported in
energy units per time per temperature unit.
STRMCP Stream molar heat capacity (when ITYPE = 1).
Specific heat is reported in energy units per mole per
temperature unit.
IERR Error flag:
0 No errors
1 IPHASE not specified as 1 or 2
2 ITYPE not in range 1-3
3 Enthalpy/entropy calculation failed
4 Compressibility factor calculation failed
5 At least one of the following has been detected:
negative stream flowrate, temperature or pressure
out of bounds, or a negative component molar
flowrate.
UH2OP
This subroutine may be used to determine properties for water,
either as liquid or vapor. Properties which may be retrieved
include:
Calling sequence:
CALL UH2OP(ITYPE,IPHASE,TEMPER,PRESSR,TDELTA,VALUE, TDERIV)
where:
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 12-11
UDENS
This subroutine returns the wet and dry actual (at T/P) volume of a
single phase stream as calculated using the density method(s)
defined in the user’s PRO/II input data. If no density methods were
defined, the K/H method is used, if applicable. The subroutine finds
application in calculating the density of a stream if the user divides
the weight rate of the stream by the returned value(s).
Calling sequence:
CALL UDENS (IPHASE,STREAM,DRYVOL,WETVOL,IERR)
where:
IPHASE Phase:
1 Vapor
2 Liquid (input by user)
STREAM Standard stream vector as described for URXSTR.
Variably dimensioned real array, input by the user.
DRYVOL Actual volumetric flowrate of the stream-returned value.
WETVOL Units:
IPHASE
1 Vapor volume units per time
2 Liquid volume units per time
IERR 0 No error
1 IPHASE is not 1 or 2
Calling sequence:
CALL KCOMPU (TEMP,PRES,VAPIN,XL1IN,XL2IN,XK1VAL,
XK2VAL,DK1DT,DK2DT,IXFLAG,KFLAG,KDFLAG)
where:
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 12-13
HCOMPU
This subroutine is provided to return enthalpies for use with a user-
added flash method.
Calling sequence:
CALL HCOMPU(TEMP,PRES,VAPIN,XL1IN,XL2IN)
where:
where:
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 12-15
/UTHERX/
The common block /UTHERX/ is used to interface user-added ther-
modynamic subroutines to PRO/II. See Chapter 13, User-Added
Thermodynamic Property Methods, for more information.
INCLUDE ‘UTHERX.CMN’
where:
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 12-17
ZXX2* Compressibility factor for liquid.
IFLGX* These switches are initialized to zero by the PRO/II executive
program and may be used as counters, etc. by the user.
KDECNT Position of water in the component list if water decant is on;
otherwise equals 0.
KVTYPE Set equal to:
1 if PRO/II requires vapor-liquid K-values,
2 if liquid-liquid K-values are required,
0 for all other cases.
KDCALL* Always to be set equal to 1.
* Denotes values that must be returned by the user.
/XPROPX/
/XPROPX/ contains the pure component properties for those com-
ponents selected in the problem input data.
Note: These values must not be altered in any way by the user-
added subroutines.
INCLUDE ‘XPROPX.CMN’
where:
/OUTFAC/
Common block /OUTFAC/ contains factors for scaling and conver-
sion of problem output to alternate dimensional units when the
OUTDIMENSION feature of PRO/II is used. Also included are the
alphanumeric representations for the output dimensional units and
the component names.
INCLUDE ‘OUTFAC.CMN’
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 12-19
Liquid volume = (liquid volume)p · TXXX(4)
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 12-21
Table 12-3: Hollerith Array (cont.)
IHOL Description
34 103 bbMb
35 106 bMMb
3
36 per 10 /Mbb
37 per 106 /MMb
Note: When the unit dimension does not require all non-blank
positions as shown above, it is spaced accordingly. For example, a
pressure unit of pascals would be represented bPab.
/CUDATA/
Common block /CUDATA/ is a single-vector storage area for various
groups of stream, unit, and component data.
INCLUDE ‘CUDATA.CMN’
INCLUDE ‘CUSPEC.CMN’
where:
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 12-23
Chapter 13
User-Added Thermodynamic
Property Methods
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 13-1
Communicating with PRO/II
Many subroutines communicate with the main body of a program
via argument lists. There is no argument list for any of the 15 ther-
modynamic property subroutines UKHS1.FOR through UKHS15.FOR.
For all of these routines, access to PRO/II is via two common stor-
age blocks of data UTHERX.CMN and CUDATA.CMN.
LTEMPX, PRESX and TDELTX are all in input units, i.e., their temper-
ature and pressure units correspond to the choices made on the
DIMENSION statement in the General Data Category of input. If con-
version to another system of units is required by the user-added
methods, then this can be accomplished using values available in
the common block FACTOR (see Chapter 12, Interfacing Software,
Common Blocks, and Data Files).
The output variables passed from the user-added subroutine into
PRO/II also depend on what thermodynamic property is being cal-
culated by that routine and are shown in Table 13-2.
Table 13-2: Output Variables Passed From UKHSxx. (xx = 1-15)
Category Description K-Value H S ρ
YXSAT Saturated vapor mole fraction valid n/a n/a n/a
for water at TEMPX and
PRESX. Required if water
decant is ON (KDECNT ≠ 0).
n/a Not applicable
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 13-3
Table 13-2: Output Variables Passed From UKHSxx. (xx = 1-15) (cont.)
Category Description K-Value H S ρ
XXSOL Solubility of water in the non- valid n/a n/a n/a
aqueous liquid phase
expressed as molal fraction of
water at saturation. Required
if water decant is ON. May be
set equal to 1.0 if decant is
OFF.
XKV Array of the calculated valid n/a n/a n/a
component K-values
DRVX Array of derivatives of valid valid valid valid
property values, Y, with
temperature, T (dY/ dT).
(If property value derivatives
are needed, TDELTX will be
greater than zero. If so, the
user-added routine must
place the derivatives in the
DRVX array.)
HSX1 Enthalpy and entropy values n/a valid valid n/a
at TEMPX and PRESX
HSX2 Enthalpy and entropy values n/a valid valid n/a
at TEMPX + TDELTX and
PRESX
ZXX1 Vapor compressibility factor valid valid valid valid
ZXX2 Liquid compressibility factor valid valid valid valid
IFLGX Array of 15 Integer valid valid valid valid
parameters initialized to zero
and available to the user as
counters, flags, etc.
KDECNT Position of water in the valid n/a n/a n/a
component list, if water
decant is on. Otherwise = 0.
KVTYPE Set to 1 if PRO/II requires VL valid n/a n/a n/a
K-values, 2 for LL K-values, 0
for all other cases.
KDCALL Always set equal to 1. This valid valid valid valid
variable differentiates the
UTHERX common from the
old UTHERM common.
n/a Not applicable
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 13-5
Table 13-3: Valid Values of IXXFLG, JXXFLG for each Thermodynamic Property Method
Property Value of Description Value of Description
IXXFLG JXXFLG
99 Calculation error occurred.
1 - K-values are needed and are available
in arrays XVV, XLL, and XLL2. Use for
all subsequent calls to the user-added
routine.
Enthalpy 2 Enthalpy values are 0 Enthalpy values are being returned in
needed. the form, i.e., H-H*/RT.
1 Enthalpy values are being returned in
the form H/RT.
99 Calculation error occurred.
Entropy 3 0 Entropy values are being returned in
the form, i.e., S-S*/RT.
1 Entropy values are being returned in
the form S/RT.
99 Calculation error occurred.
Density 4 Density values are needed. 99 Calculation error occurred.
After JXXFLG is set, the user-added routine should return to the call-
ing routine as illustrated below for a routine UKHS1 calculating
K-values using an equation of state method:
SUBROUTINE UKHS1
.
INCLUDE ‘PMXUSR.CMN’
INCLUDE ‘UTHERX.CMN’
K-Value Calculations
Handling Water Decant
In PRO/II, water can be treated as a separate system or as a regular
component. This selection is by use of the keyword input statement
WATER as shown below:
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 13-7
in PRO/II is DECANT=ON, it is recommended that the user place an
explicit WATER statement in the input when using user-added ther-
modynamic methods.
Π = system pressure
When water decant is ON, the user must return the following:
XKV(KDECNT) K-value of water.
DRVX(KDECNT) Derivative for water (as required).
YXSAT Saturation vapor mole fraction for water at
TEMPX and PRESX.
XXSOL Solubility of water in non-aqueous liquid phase
expressed as molar fraction of water at saturation
at TEMPX and PRESX.
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 13-9
C
C BYPASS THIS CALCULATION IF DECANT IS OFF
C
IF (KDECNT .EQ. 0) GO TO 4001
C
C USE SUBROUTINE UH2OP TO GET VAPOR PRESSURE OF
C WATER
C
CALL UH2OP(4, 1, TEMPX, PRESX, TDELTX, VPW, TDERIV)
C
C USE TCONVT AND TFAC FROM COMMON FACTOR TO
C CONVERT TEMPX TO DEGREES F
C
TDEGF = (TEMPX + TCONVT)*TFAC - 459.6
IF (TDEGF .LE. 0.0) TDEGF = 0.01
C
C CALCULATE XXSOL
C
XXSOL = 10. ** (-9.0306 + 3.072 * ALOG10( TDEGF))
C
C CALCULATE YXSAT
C
YXSAT = VPW / PRESR
C
C CALCULATE K-VALUE WATER AND DERIVATIVE
C
XKV(KDECNT) = YXSAT / XXSOL
DRVX(KDECNT) = XKV(KDECNT)*TDERIV
.
.
4001 CONTINUE
For example, if we compare the print order and internal order which
are based on the following keyword input file extract:
COMPONENT DATA
LIBID 1, N2 / 3, CH4 / 4, C2 / 5, C3 /6, IC4 / 7, NC4, *
BANK=PROCESS
LIBID 2, CO2, BANK=SIMSCI
Although CO2 is the 2nd component as far as the input file and
printed reports are concerned (i.e., Print Order), it is the 7th compo-
nent in Internal Order because the SIMSCI bank designation indi-
cates that it is a VLS component while the other components from
the PROCESS databank have VL phase availability. For ease of
internal calculation, the VL components are grouped ahead of VLS
components.
You can see the phase availability from the component PRO/II out-
put report by using the keywords INPUT=ALL on the PRINT statement
in the General Data category of input. You can also force the phase
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 13-11
designation to be uniform by using a PHASE statement in the Com-
ponent Data category of input (see Chapter 1.2, Component Data,
in the SIMSCI Component and Thermodynamic Manual). Thus, in
the above illustration, the user could force the internal order to
match the input order by using the PHASE statement:
PHASE VL=1,7 or PHASE VL=2
where:
COINUM
This subroutine returns component internal order numbers given the
print order numbers.
Calling sequence:
CALL COINUM( IP, IS, IC)
where:
P = system pressure
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 13-13
where:
R = gas constant
T = temperature
and:
L
ΣX i V i δ i
δ m = -------------------- (13-4)
L
ΣX i V i
FORTRAN Listing
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 13-15
ITYPE = 1
IFAZE = 1
CALL TTPROP(ITYPE,IFAZE,VPS,STREAM,IERR)
C
C - COMPUTE MIXTURE PROPERTIES
SOLM = 0.
VOLM = 0.
DO 60 I=1,NOCZ
VOLI = XLL(I)*VMOLE(I)
VOLM = VOLM + VOLI
SOLM = SOLM + VOLI*SOLU(I)
60 CONTINUE
IF (VOLM .GT. 0.0) SOLM = SOLM / VOLM
PPHC = PRESX
C
C - IF WATER IS BEING DECANTED, SUBTRACT ITS PARTIAL PRESSURE
IF (KDECNT .GT. 0) THEN
CALL H2OP(4,1,TEMPX,PRESX,TDELTX,VPS(KDECNT),TDERIV)
PPHC = PRESX * (1.0 - XVV(KDECNT))
ENDIF
C
C - COMPUTE KVALUES
TDEGK = (TEMPX+TCONVT)*TFAC /XKTOR
C
DO 70 I=1,NOCZ
GAMMA = EXP(VMOLE(I)*(SOLU(I)-SOLM)**2 /(RCONST*TDEGK))
XKV(I) = GAMMA * VPS(I) /PPHC
70 CONTINUE
C
C - HANDLING OF DECANTED WATER, IF APPLICABLE
IF (KDECNT .GT. 0) THEN
DEGF = (TEMPX + TCONVT) * TFAC - FTOR
DEGF = AMAX1(DEGF, 0.01)
XXSOL = 10.0**(-9.0306+3.072*LOG10(DEGF))
YXSAT = VPS(KDECNT) / PRESX
XKV(KDECNT) = YXSAT/XXSOL
ENDIF
C
C - COMPUTE TEMP. DERIVATIVES FROM ANALYTICAL EXPRESSION
IF(TDELTX.NE.0.) THEN
DO 110 I=1,NOCZ
DRVX(I)=-XKV(I)*VMOLE(I)*(SOLU(I)-SOLM)**2/
(RCONST*TDEGK**2)
110 CONTINUE
IF (KDECNT .GT. 0) THEN
DRVX(KDECNT) = XKV(KDECNT)*TDERIV
ENDIF
ENDIF
C
999 CONTINUE
RETURN
END
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 13-17
Partial PRO/II Output File
SIMULATION SCIENCES INC. R PAGE P-3
PROJECT UKHS4 PRO/II 5.0 UAS 386/EM
PROBLEM UKHS4 OUTPUT SIMSCI
FLASH DRUM SUMMARY JUN99
=================================================================================
FLASH ID F1 F2 F3
NAME USER DRY USER DECANT REGULAR DRY
FEEDS 1 1 1A
20
PRODUCTS VAPOR 3 5 8
LIQUID 2 4 7
WATER 6
TEMPERATURE, F 150.000 150.000 150.000
PRESSURE, PSIA 100.000 100.000 100.000
PRESSURE DROP, PSI 50.000 50.000 50.000
MOLE FRAC VAPOR 0.93136 0.30654 0.93132
MOLE FRAC LIQUID 0.06864 0.69346 0.06868
MOLE FRAC MW SOLID 0.00000 0.00000 0.00000
DUTY, MM BTU/HR -0.70081 -4.00258 -0.70084
FLASH TYPE ISOTHERMAL ISOTHERMAL ISOTHERMAL
T = temperature
∆ H-
------- (13-6)
RT
where:
No. Comps.
∑
* *
H = x i Hi (13-7)
i=1
and
xi = mole fraction for component
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 13-19
mandatory that dimensionless partial derivatives of enthalpy with
respect to composition be computed for each component:
∆H ⁄ ∆x i
-------------------
RT
Entropies may also be computed for streams based on temperature,
pressure, and composition. Calculated values are returned on a per
mole basis in dimensionless form, that is, divided by the gas con-
stant, R.
or
S/R (13-9)
When equation (13-8) is used, PRO/II computes the ideal gas
entropy:
No. Comps.
∑
* *
S = xiS i (13-10)
i=1
where:
T = temperature, °F
ABP = average boiling point, R
The latent heat at the normal boiling point is calculated using the
following:
λb= NBP (8.75 + 4.571 log (NBP) ) (13-12)
where:
Tc – T .38
λ
----- = ----------------- (13-13)
λb T c – T b
where:
Tc = critical temperature, R
T = temperature, R
The mixture critical temperature and normal boiling point are calcu-
lated as mole average properties.
The Watson K factor is computed based on the average normal boil-
ing point for the mixture.
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 13-21
PRO/II will furnish (∆H/∆xi) terms based on the calculated enthalpy
and the component ideal gas enthalpies as supplied from the library
(for defined components) or generated by PRO/II’s petroleum char-
acterization methods. Allowance has been made to calculate water
as a separate system.
FORTRAN Listing
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 13-23
C - CONVERT WATER ENTHALPY TO DIMENSIONLESS FORM
HW1 = HW1 * HSFAC / (RCONST * T1)
HW2 = HW2 * HSFAC / (RCONST * T2)
HSX1 = HSX1*TOT + HW1*WATERX
HSX2 = HSX2*TOT + HW2*WATERX
99 CONTINUE
RETURN
END
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 13-25
STREAM SUMMARY
=================================================================================
STREAM ID 1 2 3 4
NAME
PHASE MIXED WATER DRY LIQUID DRY VAPOR
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 13-27
STREAM SUMMARY
=================================================================================
STREAM ID 5 6
NAME
PHASE WET LIQUID WET VAPOR
——- TOTAL STREAM ——-
RATE, LB-MOL/HR 12.848 5.033
M LB/HR 0.740 0.233
TEMPERATURE, F 219.166 219.166
PRESSURE, PSIA 25.000 25.000
MOLECULAR WEIGHT 57.586 46.198
ENTHALPY, MM BTU/HR 8.311E-02 0.110
BTU/LB 112.335 473.109
MOLE FRACTION LIQUID 1.00000 0.00000
MOLE FRACTION FREE WATER 0.59752 0.00000
——- TOTAL VAPOR ———
RATE, LB-MOL/HR N/A 5.033
M LB/HR N/A 0.233
M FT3/HR N/A 1.439
STD VAP RATE(1), M FT3/HR N/A 1.910
MOLECULAR WEIGHT N/A 46.198
ENTHALPY, BTU/LB N/A 473.109
CP, BTU/LB-F N/A 0.440
DENSITY, LB/M FT3 N/A 161.601
Z (FROM DENSITY) N/A 0.9810
——- TOTAL LIQUID ——-
RATE, LB-MOL/HR 12.848 N/A
M LB/HR 0.740 N/A
FT3/HR 16.039 N/A
GAL/MIN 2.000 N/A
STD LIQ RATE, FT3/HR 14.621 N/A
MOLECULAR WEIGHT 57.586 N/A
ENTHALPY, BTU/LB 112.335 N/A
CP, BTU/LB-F 0.645 N/A
DENSITY, LB/FT3 46.129 N/A
Z (FROM DENSITY) 4.2840E-03 N/A
(1) STANDARD VAPOR VOLUME IS 379.49 FT3/LB-MOLE (60 F AND 14.696 PSIA)
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 13-29
Density Calculations
Example 13-4: Gunn-Yamada Liquid Density Calculations
For this example, the Gunn-Yamada method is used to calculate
actual liquid densities. Vapor densities correspond to those com-
puted by the enthalpy or K-value subroutine (based on the correla-
tions used).
V C
----- = ------ (13-14)
Vr Cr
where:
and
( 0)
C = V T r ( 1 – ωΓT r ) (13-15)
where:
2
Γ = 0.29607 – 0.09045T r – 0.04842T r (13-16)
Tr = reduced temperature
ω = acentric factor
and (for 0.2 ≤ Tr ≤ 0.8)
(0) 2
V = 0.33593 – 0.33953T r + 1.51941T r
3 4 (13-17)
– 2.02512T r + 1.11422T r
Mixture critical temperatures are evaluated with Kay’s rule, and the
method is limited to a range: 0.2 ≤ Tr ≤ .99. Reference densities are
computed using the pure component specific gravities at 60°F, as
provided in the component data.
Reference: Gunn, R. D. and Yamada, T., 1971, AIChE J., 17:1341
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 13-31
TCRM = TCRM + XLL(I) * TC(I)
DENM = DENM + XLL(I) * XMW(I) / DENS(I)
WTM = WTM + XLL(I) * XMW(I)
2001 CONTINUE
C
DENM = WTM / DENM
C
C - CONVERT MIXTURE DENSITY TO SPGR AT 60 F
C
SPGM = DENM /SPGFAC
C -
C -
C - CONVERT TCRM TO DEG R (NOTE THAT TCS ARE IN ABSOLUTE TEMP ALREADY)
C
TCRM = TCRM * TFAC
C
C - EVALUATE TR AND COMPUTE DENSITY FACTOR AT FLOWING CONDITIONS
C
TRF = TDEGR / TCRM
C
C - RESET TR IF .GE. 1.
C
IF (TRF .GE. 1.0) TRF = 0.99
IF (TRF .LE. 0.8) VZERO = XXXZOL(TRF)
IF (TRF .GT. 0.8) VZERO = XXXZOH(TRF)
CFLOW = VZERO * TRF * (1.0 - (ACEN * TRF * XXXGAM(TRF)))
C
C -
C - NOW COMPUTE TR AND CORRECTION FACTOR AT 60 DEG F (REFERENCE
TEMP)
C
TRR = (60. + FTOR) / TCRM
C
C - RESET TR IF .GE. 1.
C
IF (TRR .GE. 1.0) TRR = 0.99
IF (TRR .LE. 0.8) VZERO = XXXZOL(TRR)
IF (TRR .GT. 0.8) VZERO = XXXZOH(TRR)
CREF = VZERO * TRR * (1.0 - (ACEN * TRR * XXXGAM(TRR)))
C
C -
C - COMPUTE THE FLOWING DENSITY IN LB /FT3
C
DENSE = CFLOW * SPGM * 62.2997 / CREF
C
C - CONVERT FLOWING DENSITY TO FT3 / LB MOLE
C
VOLU = WTM / DENSE
C
C - CONVERT FLOWING DENSITY TO A Z FACTOR
C
ZXX2 = PSIA * VOLU / 10.731 / TDEGR
C
9999 CONTINUE
C
RETURN
END
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 13-33
Partial PRO/II Output File
SIMULATION SCIENCES INC. R PAGE P-5
PROJECT UKHS1 PRO/II UAS 386/EM
PROBLEM USERADD OUTPUT SIMSCI
STREAM SUMMARY JUN99
=================================================================================
STREAM ID 1 2 3 5
NAME
PHASE MIXED LIQUID VAPOR VAPOR
——- TOTAL STREAM ——-
RATE, LB-MOL/HR 100.000 54.570 45.430 100.000
M LB/HR 5.111 3.134 1.977 5.111
STD LIQ RATE, FT3/HR 154.342 88.242 66.100 154.342
TEMPERATURE, F 150.000 150.000 150.000 200.000
PRESSURE, PSIA 150.000 200.000 200.000 150.000
MOLECULAR WEIGHT 51.111 57.437 43.511 51.111
ENTHALPY, MM BTU/HR 0.778 0.221 0.398 1.164
BTU/LB 152.246 70.536 201.417 227.785
MOLE FRACTION LIQUID 0.3247 1.0000 0.0000 0.0000
REDUCED TEMP (KAYS RULE) 0.8629 0.8116 0.9338 0.9337
PRES (KAYS RULE) 0.2538 0.3582 0.3172 0.2538
ACENTRIC FACTOR 0.1759 0.1986 0.1485 0.1759
WATSON K (UOPK 14.467 13.816 15.501 14.467
STD LIQ DENSITY, LB/FT3 33.115 35.520 29.905 33.115
SPECIFIC GRAVITY 0.5310 0.5695 0.4795 0.5310
API GRAVITY 134.991 116.949 163.598 134.991
(1) STANDARD VAPOR VOLUME IS 379.49 FT3/LB-MOLE (60 F AND 14.696 PSIA)
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 14-1
Each user-added transport method input via the U1, U2, U3, U4, or
U5 entries corresponds to a particular transport property routine.
Table 14-2 shows the transport property subroutine that corresponds
to each keyword entry.
Table 14-2: Subroutine to Keyword Input Correspondence
Method Subroutine
U1 UTRAN1
U2 UTRAN2
U3 UTRAN3
U4 UTRAN4
U5 UTRAN5
FORTRAN Subroutine
SUBROUTINE UTRANn (IPHASE, ICODE, STRM, VALUE)
INTEGER IPHASE,ICODE
REAL STRM(*),VALUE
Note: You should convert your values to input units using the
/FACTOR/ common block values. However, you must first convert
o
them to centipoise (for viscosity), Btu/hr/ F/ft (for conductivity),
and dynes/cm (for surface tension) as documented in Chapter 13,
User-Added Thermodynamic Property Methods.
Example Problems
Example 14-1: Calculating Transport Properties Using User-Sup-
plied Transport Data Points
Sometimes it might be desirable to directly input the value of a
transport property to be used in a PRO/II calculation rather than
have it be predicted by the simulator. An example might arise in
modeling rigorous heat exchangers in a refinery preheat train. If you
know the viscosity of your crude oil as a function of temperature
(and if you know that none of it vaporizes in the exchangers), you
might want to put in those viscosities directly for use in the rigorous
HX calculations. This can be easily accomplished with a user-added
subroutine.
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 14-3
FORTRAN Listing
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 14-5
C NOW INTERPOLATE BASED ON INTERPOLATION FLAG. 1 IS LINEAR
C
IF (INFLG .LE. 1) THEN
SLOPE = (VHI-VLO) / (THI-TLO)
VALUE = VLO + SLOPE*(TEMPK-TLO)
C
C FLAG OF 2 MEANS LOG PROP VS 1/T
C
ELSE IF (INFLG .EQ. 2) THEN
VHILN = LOG(VHI)
VLOLN = LOG(VLO)
THIINV = 1.D0 / THI
TLOINV = 1.D0 / TLO
TINV = 1.D0 / TEMPK
SLOPE = (VHILN-VLOLN) / (THIINV-TLOINV)
VALUE = VLOLN + SLOPE*(TINV-TLOINV)
VALUE = EXP(VALUE)
ENDIF
C
999 CONTINUE
RETURN
END
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 14-7
Partial PRO/II Output
SIMULATION SCIENCES INC. R PAGE P-7
PROJECT UKHS1 PRO/II UAS 386/EM
PROBLEM USERADD OUTPUT SIMSCI
HEATING/COOLING CURVE JUN99
=================================================================================
UNIT 1, ‘HC1’, ‘HEATING CRV’ (CONT)
TRANSPORT PROPERTIES FOR STREAM 1 - DRY
VISCOSITY THERMAL CONDUCTIVITY SURFACE
NO. TEMP PRES VAPOR LIQUID VAPOR LIQUID TENSION
F PSIA CP BTU/HR-FT-F DYNE/CM
--------------------------------------------------------------------------------
1 375.00 300.00 N/A 3.2500E+00 N/A 4.6893E-02 1.0539E+01
2 386.25 300.00 N/A 3.1375E+00 N/A 4.6085E-02 1.0042E+01
3 397.50 300.00 N/A 3.0250E+00 N/A 4.5276E-02 9.5479E+00
4 408.75 300.00 N/A 2.9125E+00 N/A 4.4468E-02 9.0585E+00
5 420.00 300.00 N/A 2.8000E+00 N/A 4.3660E-02 8.5735E+00
6 431.25 300.00 N/A 2.6875E+00 N/A 4.2855E-02 8.0932E+00
7 442.50 300.00 N/A 2.5750E+00 N/A 4.2053E-02 7.6176E+00
8 453.75 300.00 N/A 2.4625E+00 N/A 4.1255E-02 7.1470E+00
9 465.00 300.00 N/A 2.3500E+00 N/A 4.0464E-02 6.6815E+00
10 476.25 300.00 N/A 2.2375E+00 N/A 3.9682E-02 6.2215E+00
11 487.50 300.00 N/A 2.1250E+00 N/A 3.8912E-02 5.7672E+00
12 498.75 300.00 N/A 2.0125E+00 N/A 3.8157E-02 5.3188E+00
13 510.00 300.00 N/A 1.9000E+00 N/A 3.7420E-02 4.8768E+00
14 521.25 300.00 N/A 1.7875E+00 N/A 3.6705E-02 4.4414E+00
15 532.50 300.00 N/A 1.6750E+00 N/A 3.6018E-02 4.0132E+00
16 541.17 300.00 N/A 1.5883E+00 N/A 3.5509E-02 3.6882E+00
17 543.75 300.00 1.3555E-02 1.5625E+00 2.7197E-02 3.5409E-02 3.6450E+00
18 555.00 300.00 1.3584E-02 1.4500E+00 2.7614E-02 3.4984E-02 3.4626E+00
19 566.25 300.00 1.3612E-02 1.3375E+00 2.8023E-02 3.4575E-02 3.2885E+00
20 577.50 300.00 1.3641E-02 1.2250E+00 2.8427E-02 3.4181E-02 3.1220E+00
21 588.75 300.00 1.3671E-02 1.1125E+00 2.8826E-02 3.3801E-02 2.9623E+00
22 600.00 300.00 1.3701E-02 1.0000E+00 2.9220E-02 3.3434E-02 2.8089E+00
Chapter 15
Unit Operation Subroutines
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 15-1
Unit Operations
In the PRO/II keyword input file, you must indicate in the Unit
Operation Category of input what user-added models are being
used, i.e.:
where:
n = 1-20, 41-120
Thermal Conditions
The thermal conditions for feed streams will be defined by PRO/II
for user-added unit operations, whether they are external feeds or
streams generated by other unit operations. Conditions defined
include phase, enthalpy, and compressibility factor. The interface
subroutine URXSTR is used to retrieve feed streams from stream
storage.
Product Streams
Product streams may be created by the user-added routine and
placed into stream storage for subsequent use by other user-added
Results Arrays
Information is provided to the user-added unit operations via HEAT,
IPARM, RPARM , and SUPPLEMENTAL arrays. These correspond to
heat duty, integer and real numbers, and supplemental real data.
Heaters/Coolers
HEAT duty x 10-6,.... (Up to 10 values)
Integer Inputs
IPARM integer,.... (Up to 250 values)
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 15-3
Example 15-1: Feedback Controller
Any of the RPARM parameters of the user-written unit operation
may be used as control variables or as a specification. The syntax
for these cases is as follows:
Control variable
CONTROLLER UID=C1
SPEC ...
VARY unit=unit identifier, PARA(index)
where:
Specification
CONTROLLER UID=C1
SPEC unit=unit identifier, PARA(index), VALUE=rval
VARY ...
where:
In this case the 4th and 5th real parameters are calculated by the user
subroutine and passed to the flash unit operation.
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 15-5
routine, you must replace the subroutine supplied by SIMSCI with
one that contains your own code. The following table clearly pre-
sents the relationship between the input keywords and the corre-
sponding routine.
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 15-7
Note: Be sure to include the SIMSCI-provided INCLUDE file
PRECIS.CMN as the first non-COMMENT statement after the
SUBROUTINE statement. This will ensure that all floating point
arguments will be assigned the type DOUBLE PRECISION.
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 15-9
The following coding practices are highly recommended:
■ Product streams.
Example Problems
These examples illustrate many of the features available for user-
written unit operations. Each example has a corresponding printout
subroutine; however, this is not a necessity unless printout in addi-
tion to the standard PRO/II output is desired. (If special printout is
not desired for a user-written unit operation, the dummy printout
subroutine supplied by PRO/II will satisfy the system require-
ments.)
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 15-11
■ FORTRAN listing for the subroutine.
where:
f = 64 ⁄ N Re (15-2)
where:
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 15-13
IPARM(3) Inlet phase:
1 Vapor
2 Liquid
RPARM(1) Inside diameter, inches
RPARM(2) Pipe length, feet
RPARM(3) Inlet temperature, °F
RPARM(4) Inlet pressure, psia
RPARM(5) Inlet Z factor
RPARM(6) Outlet temperature, °F
RPARM(7 Outlet pressure, psia
RPARM(8) Outlet Z factor
RPARM(9) Velocity, ft/sec
RPARM(10) Reynolds number
RPARM(11) Pressure drop, psi
RPARM(12) Friction factor
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 15-15
WRITE(IOUT,1001) CID
ISOLVE = 1
ISTOP = 1
GO TO 9999
ENDIF
C
C SET PHASE FLAG - CHECK FOR MIXED PHASE FEED
C
IF (ABS(STREAM(5) - 1.0) .LT. 0.01) THEN
IFAZE = 2
ELSE IF (STREAM(5) .LT. 0.01) THEN
IFAZE = 1
ELSE
IPARM(2) = 2
WRITE(IOUT,1002) CID
ISOLVE = 1
ISTOP = 1
GO TO 9999
ENDIF
C
C CALCULATE COMPRESSIBILITY FACTOR
C
CALL UHS(3,IFAZE,STREAM,ZF,DZ,IERR)
C
IF (IERR .NE. 0) THEN
IPARM(2) = 3
WRITE(IOUT,1003)
ISOLVE = 1
ISTOP = 1
GO TO 9999
ENDIF
C
C CALCULATE FEED STREAM MOLECULAR WEIGHT
C
WT = 0.0
DO 2002 I = 1,NOCX
WT = WT + STREAM(I+10) * XMW(I)
2002 CONTINUE
WT = WT / STREAM(1)
C
C GET INLET TEMPERATURE(R), PRESSURE(PSIA), & DENSITY(LB/FT3)
C
DEGR = (STREAM(2) + TCONVT) * TFAC
PSIA = (STREAM(3) + PCONVT) * PFAC
RHO = PSIA * WT / ZF / DEGR / 10.731
C
C CHECK PIPE DIAMETER AND LENGTH
C
DIA = RPARM(1)
XLEN = RPARM(2)
C
IF (DIA .LE. 0.0 .OR. XLEN .LE. 0.0) THEN
IPARM(2) = 4
WRITE(IOUT,1004) DIA, XLEN
ISOLVE = 1
ISTOP = 1
GO TO 9999
ENDIF
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 15-17
WRITE(IOUT,1005)
ISOLVE = 1
ISTOP = 1
GO TO 9999
ELSE IF (DELTP .GT. 0.1*PSIA) THEN
C
C DELTA P BETWEEN 10 & 40% OF INLET PRESSURE
C USE AVERAGE DENSITY & VELOCITY
STREAM(3) = POUT
CALL UHS(3,IFAZE,STREAM,ZF2,DZ,IERR)
C
IF (IERR .NE. 0) THEN
IPARM(2) = 3
WRITE(IOUT,1003)
ISOLVE = 1
ISTOP = 1
GO TO 9999
ENDIF
C
DEGR = (STREAM(2) + TCONVT) * TFAC
PSIA = (STREAM(3) + PCONVT) * PFAC
RHO2 = PSIA * WT / ZF2 / DEGR / 10.731
RHOA = (RHO + RHO2) / 2.
CUFTSE = STREAM(1) * WT * WTFAC / TIMFAC / RHOA
VELO2 = CUFTSE / AREA
VELOA = (VELOC + VELO2) / 2.
DELTP = 0.001294 *RHOA* FFACT * XLEN * VELOA * VELOA / DIA
POUT = RPARM(4) - DELTP
VELOC = VELOA
RHO = RHOA
IPARM(2) = 6
ENDIF
ENDIF
C
C SAVE RESULTS
IPARM(3) = IFAZE
RPARM(9) = VELOC
RPARM(10) = REY
RPARM(11) = DELTP
RPARM(12) = FFACT
C
C FLASH STREAM AT OUTLET PRESSURE
STREAM(3) = POUT
CALL UFLSH(STREAM,VAP,XLIQ,XLQ2,XKAY,3,IERR)
C
C CHECK FOR FLASH FAILURE
C
IF(IERR .NE. 0) THEN
IPARM(2) = 7
WRITE(IOUT,1007)
ISOLVE = 1
ISTOP = 1
GO TO 9999
ENDIF
C
C STORE RESULTS FROM OUTLET FLASH
TCALC = VAP(2)
STREAM(2) = TCALC
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 15-19
U42OUT.FOR—User-Added Output Routine
SUBROUTINE U42OUT(IPARM, RPARM, SUPPLE, HEAT, IDATA)
C
C OUTPUT SUBROUTINE FOR PRESSURE DROP UNIT OPERATION
C
DIMENSION IPARM(*),RPARM(*),SUPPLE(*),HEAT(*),IDATA(*)
CHARACTER*10 CPHASE
CHARACTER*12 CID
CHARACTER*40 CNAME
C
1001 FORMAT(‘ UNIT ID - ‘,A12,’ NAME - ‘,A40,//,
+ ‘ **** PRESSURE DROP CORRELATIONS - STEEL PIPE *** ‘,/)
1002 FORMAT(10X,’ PIPE DIAMETER = ‘,F15.2,2X,’INCHES’,/,
+ 10X,’ PIPE LENGTH = ‘,F15.1,2X,’FEET’,/,
+ 10X,’ PRESSURE DROP = ‘,F15.2,2X,’PSI’,//,
+ 10X,’ INLET PRESSURE = ‘,F15.2,2X,’PSIA’,/,
+ 10X,’ INLET TEMPERATURE = ‘,F15.2,2X,’DEG F’,/,
+ 10X,’ INLET COMPRESSIBILITY = ‘,F15.4,//,
+ 10X,’ OUTLET PRESSURE = ‘,F15.2,2X,’PSIA’,/,
+ 10X,’ OUTLET TEMPERATURE = ‘,F15.2,2X,’DEG F’,/,
+ 10X,’ OUTLET COMPRESSIBILITY = ‘,F15.4,//,
+ 10X,’ PHASE = ‘,5X,A10,//,
+ 10X,’ VELOCITY = ‘,F15.4,2X,’FT/SEC’,/,
+ 10X,’ REYNOLDS NUMBER = ‘,F15.1,/,
+ 10X,’ FRICTION FACTOR = ‘,F15.6,//)
C
1003 FORMAT(10X,’ FEED STREAM - ‘,A12,/)
1004 FORMAT(10X,’ PRODUCT STREAM - ‘,A12,/)
C
1010 FORMAT(‘** FEED STREAM MISSING **’)
1020 FORMAT(‘** MIXED PHASE FEED ***’)
1030 FORMAT(‘** COMPRESSIBILITY FACTOR CALCULATION FAILED **’)
1040 FORMAT(‘** PIPE DIMENSIONS NOT AVAILABLE **’)
1050 FORMAT(‘** CALC DELTA P EXCEEDS 40 % OF INLET FOR VAPOR **’)
1060 FORMAT(‘** AVERAGE PROPERTIES USED FOR ABOVE CALCULATIONS **’)
1070 FORMAT(‘** PRODUCT FLASH FAILED **’)
1080 FORMAT(‘** PHASE CHANGE AT OUTLET INVALIDATES CALCULATIONS**’)
1090 FORMAT(‘** ERROR SETTING UP PRODUCT STREAM **’)
C
C
C RETRIEVE DATA FROM ARRAYS
C
NOP = IDATA(2)
IOUT = IDATA(6)
ISW = IPARM(2)
C
C OUTPUT REPORT
C
CALL HEAD
C
C WRITE UNIT TITLE
C
CALL URXINF(‘UNIT’,0,CID,CNAME,IERR)
WRITE(IOUT,1001) CID, CNAME
C
C SKIP OUTPUT REPORT IF ERROR CODE 1 - 5 APPLIES
C
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 15-21
PRO/II Keyword Input File
TITLE PROB=USERADD , PROJ=U42 , USER=SIMSCI , DATE=JUN99
$
$ TESTS USER42 AND U42OUT
$
DIME LIQV=BBL
COMPONENT DATA
LIBID 1,C1/2,C2/3,C3
TBPCUTS 100,1500,10
THERMO
METHODS KVALUE=SRK, ENTHALPY=SRK, ENTROPY=SRK, TRANSPORT=PETRO,NAME=DEFAULT, *
DENS(L)=API, DENS(V)=SRK
METHODS KVALUE=GS, ENTHALPY=CP, ENTROPY=SRK, TRANSPORT=PETRO,NAME=M2, *
DENS(L)=API,DENS(V)=SRK
STREAM DATA
PROP STRM=1, TEMP=40, PRES=1300,PHASE=V,RATE(G)=4.3E6,COMP=75/21/4
PROP STRM=2,TEMP=60,PRES=150,RATE(V)=1900,ASSAY=LV
API STRM=2,AVG=30.6
TBP STRM=2,DATA=0,100/10,275/30,475/50,620/70,840/100,1500
NAME 1,NATL GAS/2,CRUDE OIL
UNIT OPERATIONS
$ NATURAL GAS FLOWING THROUGH 10 MILE PIPELINE
US2 NAME=NATL GAS DP,UID=P2
FEED 1
PROD P2V
RPARM 13.376,52800
$ NATURAL GAS FLOWING THROUGH 100 MILE PIPELINE
US2 NAME=NATL GAS,UID=P3
FEED 1
RPARM 13.376,528000
$ CRUDE OIL FLOWING THROUGH 5 MILE LINE
US2 NAME=CRUDE DP ,UID=P1
FEED 2
RPARM 12.09,26400
METHODS ID=M2
END
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 15-23
UNIT 3, ‘P1’, ‘CRUDE DP’
UNIT ID - P1 NAME - CRUDE DP
**** PRESSURE DROP CORRELATIONS - STEEL PIPE ***
PIPE DIAMETER = 12.09 INCHES
PIPE LENGTH = 26400.0 FEET
PRESSURE DROP = 28.08 PSI
INLET PRESSURE = 50.00 PSIA
INLET TEMPERATURE = 60.00 DEG F
INLET COMPRESSIBILITY = 0.1229
OUTLET PRESSURE = 121.92 PSIA
OUTLET TEMPERATURE = 59.94 DEG F
OUTLET COMPRESSIBILITY = 0.0999
PHASE = LIQUID
VELOCITY = 3.7112 FT/SEC
REYNOLDS NUMBER = 101227.2
FRICTION FACTOR = 0.013232
FEED STREAM - 2
Unit Operations
In the PRO/II keyword input file, you must indicate in the Unit
Operation Category of input what reactor type is being used, i.e.:
CSTR or PLUGFLOW UID = uid, {NAME=text}
On the CALCULATION statement, you need to select one of the five
user-added kinetic models being used.
RXCALCULATION ...,KINETICS(SUBROUTINE) = U1 or U2 or U3 or
U4 or U5
U1, U2, etc. Designates user-written kinetics to be used for the rate
expression. Corresponds to routines USKIN1, USKIN2,
etc. as shown in Table 16-1.
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 16-1
Table 16-1: Naming Conventions for User-Added Kinetics
FORTRAN Input Name User-Added Unit Kinetic Routine
U1 USKIN1
U2 USKIN2
U3 USKIN3
U4 USKIN4
U5 USKIN5
Results Arrays
Information is provided to the user-added kinetic routines via
IPARM, RPARM, and SUPPLEMENTAL arrays. These correspond
to integer and real numbers, and supplemental real data.
Integer Inputs
IPARM integer,.... (Up to 10)
n = 1-5
The data shown in Table 16-2 are supplied by PRO/II through the
argument list and should not be altered in subroutine USKINn. Many
of the variables in the argument list for routines USKINn are accessi-
ble through in-line kinetic procedure variables (see Chapter 47,
Procedure Data, in the PRO/II Keyword Manual). These are also
given in Table 16-2.
Table 16-2: USKINn Required Input Arguments and Procedure Variables
Required Description In-Line
Input Procedure
Argument Variable
RSDAT1(1) Temperature of reacting fluid RTEMP
RSDAT1(2) Pressure of reacting fluid RPRES
RSDAT1(3) Molecular weight of reacting fluid RMW
RSDAT1(4) Specific gravity (60/60) of reacting fluid RSPGR
RSDAT1(5) Molar flowrate of reacting fluid RMRATE
RSDAT1(6) Weight flowrate of reacting fluid RWRATE
RSDAT1(7) Standard volumetric flowrate of reacting RSVRAT
fluid (LIQVOL units if OPERATION
PHASE=L, else VAPVOL units)
RSDAT1(8) Actual volumetric flowrate of reacting RAVRAT
fluid (LIQVOL units if OPERATION
PHASE=L else VAPVOL units)
RSDAT1(9) Liquid mole fraction of reacting fluid RLFRAC
RSDAT1(10) Vapor viscosity RVVISC
RSDAT1(11) Liquid viscosity RLVISC
RSDAT1(12) Vapor conductivity RVCOND
RSDAT1(13) Liquid conductivity RLCOND
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 16-3
Table 16-2: USKINn Required Input Arguments and Procedure Variables
Required Description In-Line
Input Procedure
Argument Variable
RSDAT1(14) Vapor specific heat (wt. basis) RVCP
RSDAT1(15) Liquid specific heat (wt. basis) RLCP
RSDAT1(16) Surface tension RSURF
RSDAT1(17) Temperature in absolute input units RTABS
RSDAT1(18-50) Not used
RSDAT1(51-67) Same as RSDAT1(1-17) for PFR
heating/cooling stream—use variable
names as above with U replacing R to
indicate utility side, i.e., UTABS
RSDAT1(68-100) Not used
RSDAT2(1-50) Total stream fractions for components XTOTAL
1-50 of reacting fluid
RSDAT2(51-100) Concentrations for components 1-50 of XCONC
reacting fluid (weight-moles/liquid
volume for OPERATION PHASE=L
else weight moles/vapor volume)
RSDAT2(101-150) Vapor fugacities for components XVFUG
1-50 of reacting fluid
RSDAT2(151-200) Liquid phase activities XLACT
RSDAT2(201-250) Vapor sub phase mole fractions XVAP
RSDAT2(251-300) Liquid sub phase mole fractions XLIQ
RRDAT1(1) Tube diameter, in. (English) or mm TDIAM
(metric, SI). (PLUGFLOW only)
RRDAT1(2) Total tube length, ft. (English) or m TLEN
(metric, SI). (PLUGFLOW only)
RRDAT1(3) Cumulative tube length (position of CUMLEN
finite element from reactor front end), ft.
(English) or m (metric, SI).
(PLUGFLOW only)
RRDAT1(4) Current stepsize (delta X), in. (English) DELX
or mm (metric, SI). (PLUGFLOW
only)
RRDAT1(5) Current finite element volume (∆V), DELV
LIQVOL units for OPERATION
PHASE=L, else VAPVOL units.
(PLUGFLOW only)
Total reactor volume, LIQVOL units for VOLUME
OPERATION PHASE=L, else
VAPVOL units. (CSTR only)
RRDAT1(6-9) Not used
RRDAT1(10) Gas constant, R RGAS
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 16-5
The data shown in Table 16-3 are optionally supplied by the user
through the PRO/II input file. They may be altered in the user-
kinetics routine if desired.
Table 16-3: USKINn Optional Input Arguments & Procedure Variables
Optional Input Description In-Line
Argument Procedure
Variable
RPARM(1-70) Real parameters from RPARM input RDATA
entries
IPARM(1-10) Integer parameters from IPARM input IDATA
entries
SUPPLE(1-200) Real data storage from SUPPLEMENTAL -
input entries
The data shown in Table 16-4 must be calculated in the user kinetics
routine.
FORTRAN Listing
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 16-7
C
C SKIP REACTION IF MOL. FR’N OF ANY REACTANT = 0.0
IF (RSDAT2(I) .LE. 0.0) GO TO 500
C
C USE PARTIAL PRESSURES FOR RATES
IF (IRDAT1(4) .EQ. 1) THEN
C
C RATES CALCULATED USING PARTIAL PRESSURES.
RJ = RJ * (RSDAT2(I)*RSDAT1(2))**ORDER(I,J)
C
C ELSE CHECK RATE CALCUL’N USING VAPOR FUGACITIES
ELSEIF (IRDAT1(4) .EQ. 2) THEN
C
C RATES CALCULATED USING VAPOR FUGACITIES.
RJ = RJ * (RSDAT2(I+100)) ** ORDER(I,J)
C
C ELSE CHECK RATE CALCUL’N USING LIQUID ACTIVITIES
ELSEIF (IRDAT1(4) .EQ. 3) THEN
C
C RATES CALCULATED USING LIQUID ACTIVITIES
RJ = RJ * (RSDAT2(I+150)) ** ORDER(I,J)
C
ELSE
C
C RATES CALCULATED USING CONCENTRATIONS.
RJ = RJ * (RSDAT2(I+50)) ** ORDER(I,J)
ENDIF
C ENDIF (STOICH) CHECK
ENDIF
400 CONTINUE
IB = IDBASE(J)
RATES(J) = RJ * STOICH(IB,J)
500 CONTINUE
C
RETURN
END
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 16-9
Partial PRO/II Output
SIMULATION SCIENCES INC. R PAGE P-3
PROJECT USER-ADD PRO/II UAS 386/EM
PROBLEM USPLUG OUTPUT RJP
PLUG SUMMARY JUN99
=============================================================================
UNIT 1, ‘RX’
OPERATING CONDITIONS
REACTOR TYPE COUNTER-CURRENT
DUTY, MM BTU/HR -0.4509
TOTAL HEAT OF REACTION AT 179.00 F, MM BTU/HR -0.9923
TUBES 4
DIAMETER, IN 1.9400
LENGTH, FT 20.0000
VOLUME/TUBE, FT3 15.5512
TOTAL VOLUME, FT3 62.2050
U, BTU/HR-FT2-F 3.720
RESIDENCE TIME, SEC 5.24
MAXIMUM VELOCITY AT 20.00 FT FROM INLET, FT/SEC 4.6778
LB-MOL/HR FRACTION
BASE COMPONENT REACTION CONVERTED CONVERTED
—————————————— ———————— ————————— —————————
1 CL2 1 11.3309 0.6665
1 CL2 2 5.6621 0.3331
PLUG SUMMARY
UNIT 1, ‘RX’ (CONT)
REACTOR PROFILES
REACTING SIDE COLD
DISTANCE TEMP PRES TEMP
FT F PSIA F
— ————-—— —————— ——————- ——————
0 0.0000 450.00 29.4000 400.00
1 2.0000 565.36 28.4000 394.18
2 4.0000 702.75 27.4000 380.24
3 6.0000 822.69 26.4000 357.25
4 8.0000 868.58 25.4000 327.03
5 10.0000 863.37 24.4000 292.96
6 12.0000 843.11 23.4000 256.46
7 14.0000 818.64 22.4000 217.68
8 16.0000 792.37 21.4000 176.34
9 18.0000 764.78 20.4000 132.02
10 20.0000 735.93 19.4000 84.09
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 16-11
Chapter 17
Refinery Reactor Simulation UAS
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 17-1
Table 17-1: Arguments for Utility Subroutine UDEFNC() (cont.)
Variable I/O Data Type Description
ITYPE I INTEGER Basis of component order. Since
most of the vectors in UAS system
are based on PRO/II internal order,
PRO/II order is the default.
1 PRO/II internal order (default)
2 User input order
JPLACE O INTEGER Position of the specified component
in input order or PRO/II internal
order. If the component is not found,
a zero value will be returned.
Example:
...
CHARACTER*16 CNAME
...
CNAME = ‘H2’
CALL UDEFNC( CNAME, LIBNUM, 1, JPLACE)
...
UPSEUC
This routine gets the range of components in the specified blend set.
The returned range is based on PRO/II’s internal component order.
The initial and end boiling points of each petro narrow cut in the
blend are also retrieved. Only after this component range is known,
the reactor product stream data can then be stored in the compo-
nents of the specified blend set. The name of the blend set is speci-
fied at the NAME of the user-added unit in the flowsheet.
Example:
INCLUDE ‘…\PMXUSR.CMN’
INCLUDE ‘…\XPROPY.CMN’
...
REAL BPTIP(MAXCN), BPTEP(MAXCN)
...
CALL UPSEUC( IDATA, BP, IBEGIN, IEND, BPTIP,
BPTEP, IERR)
...
USTHER
Multiple thermodynamic sets with different component properties
can be specified in the same PRO/II flowsheet. This feature is very
important to refinery reactors because the component properties of
the product can be very different from those of the feed. This rou-
tine sets up the thermodynamic data for the selected stream so that
the component properties corresponding to the selected stream can
be retrieved or stored properly. The component data stored in the
common block XPROPY can also be also updated after the setup.
Note that to have this feature available it is required to declare
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 17-3
CDATA = VARY in the flowsheet (see General Data section in the
PRO/II Keyword Manual).
Example:
...
CHARACTER*12 CID
CHARACTER*40 CNAME
...
CALL URXINF(‘FEED’, 1, CID, CNAME, IERR)
...
ISETUP = 1
CALL USTHER(CID,ISETUP, JMETHD, IERR)...
Example:
CHARACTER*12 CID, ATEXT, BTEXT
CHARACTER*40 CNAME
...
CALL URXINF(‘FEED’, 1, CID, CNAME, IERR)
...
ATEXT = ‘TOTAL’
BTEXT = ‘MW’
CALL USTRIP( CID, ATEXT, ISPROP, VALUE, IERR)...
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 17-5
USTRIP
In the refinery reactor simulation, refinery inspection properties are
frequently used to characterize the feed. This routine retrieves the
selected refinery property from the specified stream. The retrieved
refinery property must be declared in the thermo data section. The
property data can be estimated by PRO/II or supplied by the user in
the component, thermo and stream data sections. Note that not all
the refinery special properties can be estimated by PRO/II.
Example:
...
CHARACTER*12 CID, ATEXT
CHARACTER*40 CNAME
...
CALL URXINF(‘FEED’, 1, CID, CNAME, IERR)
...
ATEXT = ‘SULF’
ISPROP = 0
CALL USTRIP( CID, ATEXT, ISPROP, VALUE, IERR)
...
UDIST
The distillation data is probably the most important data for feed
characterization. This routine retrieves the distillation data for the
specified stream. The distillation type, range and basis can all be
specified.
The calling sequence for UDIST is:
CALL UDIST( STREAM, XMW, BP, DENS, ITYPE,
ICONV, IBASIS, WVIP, WVEP, NUMCOP,
TDIST, IERR)
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 17-7
Table 17-6: Arguments for Utility Subroutine UDIST() (cont.)
Variable I/O Data Type Description
DENS I REAL(MAXCN) Array of component standard
density. See XPROPY common block
for definition.
ITYPE I INTEGER Distillation type:
1 TBP (default)
2 D86
3 D86 with cracking
4 D86 at 10 mmHg
5 D1160 at 10 mmHg
6 D1160
7 D2887
ICONV I INTEGER Conversion method:
1 API63
2 API87
3 Edmister-Okamoto
6 API94
IBASIS I INTEGER Conversion basis:
0 LV basis
1 WT basis
WVIP I REAL The wt% or vol% based on which
the initial boiling point (IP) is to be
determined.
WVEP I REAL The wt% or vol% based on which
the end boiling point is to be
determined.
NUMCOP I INTEGER Total component number. This
number can be obtained from
IDATA(4) in the USERXX routine.
Note that this number can not be
greater than MAXCN.
TDIST O REAL(21) Array of the distillation data. The 21
points correspond to boiling points
at IP, 5%, 10%, 15%, 20%, …
85%, 90%, 95% and EP of the
distillation curve.
IERR O INTEGER Error flag:
0 Successful
≠0 Failed
URATE
The pseudocomponents used in the refinery reactor simulation may
not be the same as that in the flowsheet simulation. In the reactor
simulation, the pseudocomponents are determined by the reaction
network that describes the reaction behavior. In the flowsheet simu-
lation, the pseudocomponents are determined by the assay data and
the blend cut points specified in the flowsheet (see ASSAY and
CUTPOINTS in the component data and stream data sections of the
PRO/II Keyword Manual). Due to the lack of one-to-one relation-
ship between the pseudocomponents in reactor and flowsheet simu-
lations, it is necessary to map the reactor product composition via
the product distillation data. This routine uses the TBP distillation
data of the reactor product stream predicted by the reactor simula-
tion to determine the flowrate of each pseudocomponent in the
product stream of the flowsheet. Note that the flowrates of defined
components such as H 2, H2S, CH4, C2H6, etc. should not be
included here. The flowrates of those defined components should be
assigned to the STREAM array directly without the need of compo-
nent mapping.
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 17-9
The calling sequence for URATE is:
CALL URATE( TVEC, YVEC, NCPSEU, ICUMUL, FOUT,
IBEGIN, IEND, BPTIP, BPTEP, IMETHD,
IMAPED, FRATE, IERR)
Example:
...
INCLUDE ‘…\PMXUSR.CMN’
PARAMETER (NCPSEU=7)
INTEGER IMAPED(MAXCN)
REAL TVEC(NCPSEU), YVEC(NCPSEU)
REAL FRATE(MAXCN), BPTIP(MAXCN), BPTEP(MAXCN)
REAL FOUT, FRATE(MAXCN)
...
TVEC(1) = 15
TVEC(2) = 100
TVEC(3) = 350
…
TVEC(7) = 680
…
YVEC(1) = 0.0
YVEC(2) = 10.0
YVEC(3) = 30.0
…
YVEC(7) = 100.0
ICUMUL = 0
FOUT = 100.0
IMETHD = 3
CALL URATE( TVEC, YVEC, NCPSEU, ICUMUL, FOUT,
IBEGIN, IEND, BPTIP, BPTEP, IMETHD,
IMAPED, FRATE, IERR)
UCURVE
The refinery special properties are likely to be changed by the refin-
ery reactions. The property values in the same boiling range can be
very different between the feed and product. For instance, the sulfur
content is largely reduced in the hydrotreating reactions, the aro-
matics content is increased in the catalytic cracking reactions and
the molecular weight is changed by most refinery reactions. There-
fore, different thermodynamic METHOD sets (see Thermodynamic
Data section in the PRO/II Keyword Manual) should be used to
store the feed and product component properties separately.
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 17-11
CDATA=VARY (see General Data Section in the PRO/II Keyword
Manual) should also be declared in the flowsheet to support this
feature. This UCURVE routine can be used to determine the new com-
ponent properties for the pseudocomponents in the thermodynamic
set specified for the product stream. Note that this routine should
only be called when more than one data point is available from the
reactor simulation for the property to be mapped.
CALL UCURVE( ATEXT, ISPROP, TVEC, CPROP, NCPSEU,
BP, FRATE, IBEGIN, IEND, TMINI,
TMAXI, YLOW, YHIGH, IFILL, ITREND,
IMETHD, IUPDAT, SSCALE, IMAPED, STGYV,
SUMPRP, IERR)
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 17-13
Table 17-8: Arguments for Utility Subroutine UCURVE() (cont.)
Variable I/O Data Type Description
IMAPED O INTEGER(MAXCN) Array of component mapping flag:
0 Get zero flowrate from the
mapping
1 Get positive flowrate from the
mapping
STGYV 0 REAL(MAXCN) Result of mapped component
property table.
SUMPRP 0 REAL Sum of FRATE(I)*STGYV(I), I is
the component in the
[IBEGIN,IEND] range.
IERR O INTEGER Error flag:
0 Successful
≠0 Failed
Example:
INCLUDE '…\PMXUSR.CMN'
INCLUDE '…\XPROPY.CMN'
PARAMETER (NCPSEU=7)
CHARACTER*(*) ATEXT
REAL TVEC(NCPSEU), CPROP(NCPSEU)
REAL FRATE(MAXCN), STGYV(MAXCN), IMAPED(MAXCN)
…
C variables TVEC, CPROP, NCPSEU are from reactor module
C BP is from XPROPY common block BEGIN and IEND are from
C UPSEUC()FRATE is from URATE()
…
ATEXT = 'MW'
ISPROP = 0
TMINI = 350.0
TMAXI = 575.0
YLOW = 0.0
YHIGH = 1000.0
IFILL = 0
ITREND = 0
IMETHD = 3
IUPDAT = 1
SSCALE = 1.0
…
CALL UCURVE( ATEXT, ISPROP, TVEC, CPROP, NCPSEU,
BP, FRATE, IBEGIN, IEND, TMINI,
TMAXI, YLOW, YHIGH, IFILL, ITREND,
IMETHD, IUPDAT, SSCALE, IMAPED, STGYV,
SUMPRP, IERR)
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 17-15
Example:
...
CHARACTER*12 PPTEXT(3)
...
PPTEXT(1) = ‘NBP’
PPTEXT(2) = ‘MW’
PPTEXT(3) = ‘SPGR’
NPTEXT = 3
CALL UPETMD( PPTEXT, NPTEXT, IERR)
...
UBULK
The purpose of this routine is similar to that of UCURVE, but it is used
when there is only a single property data point available from the
reactor simulation. For example, the research octane number is usu-
ally of interest only for naphtha. Thus, the reactor module may only
predict a single RON for the entire naphtha boiling range
[TMINI,TMAXI]. The UBULK routine is used to handle the compo-
nent mapping for this situation. If the thermodynamic METHOD of the
product stream already has some information about the component
property, the property profile will be adjusted proportionally to
match the given bulk property value. Otherwise, due to lack of
information, the same bulk property value will be assigned to all
pseudocomponents within the [TMINI,TMAXI] range.
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 17-17
Table 17-10: Arguments for Utility Subroutine UBULK() (cont.)
Variable I/O Data Type Description
IFILL I INTEGER Mapping option for components
whose BP values are outside the
given [TMINI,TMAXI] range.
0 Assign the same property value
of the nearest neighboring
component inside the
[TMINI,TMAXI] range. (default)
1 Ignore; do not assign a new
value.
2 Assign SVALSP*SSCALE.
3 Assign a zero value.
4 Assign SVALSP
SSCALE I REAL Scaling factor for IFILL = 2.
IMAPED O INTEGER(MAXC Array of component mapping flag.
N)
0 Get zero flowrate from the
mapping
1 Get positive flowrate from the
mapping
STGYV 0 REAL(MAXCN) Result of mapped component
property table.
IERR O INTEGER Error flag.
0 Successful
≠0 Failed
INCLUDE '…\PMXUSR.CMN'
INCLUDE '…\XPROPY.CMN'
CHARACTER*(*) ATEXT
REAL STGYV(MAXCN), IMAPED(MAXCN)
…
C CID is from the URXINF function call
C SVALSP is from the reactor module
C BP is from XPROPY common block
C IBEGIN and IEND are from UPSEUC()
…
ATEXT = 'RON'
ISPROP = 0
TMINI = 5.0
TMAXI = 220.0
IFILL = 0
SSCALE = 1.0
…
CALL UBULK( CID, ATEXT, ISPROP, SVALSP, BP,
IBEGIN, IEND, TMINI, TMAXI, IFILL,
SSCALE, IMAPED, STGYV, IERR)
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 17-19
Sample User-added Reactor Module
In the example shown in Figure 17-1, the refinery reactor has two
feed streams. The first is a hydrocarbon stream represented by assay
pseudocomponents created from the assay data. Refinery inspection
properties such as sulfur, nitrogen, bromine number, refractive
index and CCR are defined in the stream so the reactor interface can
retrieve and send these data to the reactor module. The second feed
is a recycle stream containing only hydrogen and light components
C1 to C4. The recycle stream is handled and converged by PRO/II.
Figure 17-1: Process Flow Diagram of User-added Reactor Module
Except for the fact that the input data are entered through the IPARM,
RPARM and SUPPLE vectors in accordance with the UAS structure,
the interfaced reactor unit in every sense behaves like a regular
PRO/II unit.
Note that the reactor feed stream need not be an external source
stream. It can be the product stream of a distillation column. Simi-
larly, the reactor product stream can be a final product or a feed to
other units in the flowsheet. Once the refinery inspection properties
are assigned to a stream at input time or generated by the reactor
simulation at the calculation time, they can be carried with the
stream to other units.
COMPONENT DATA
LIBID 1,H2/2,H2S/3,NH3/4,H2O/5,C1/ *
6,C2/7,C3/8,IC4/9,NC4/10,IC5/ *
11,ETLN/12,PRLN/13,1BUTENE/14,1PENTENE/ *
15,BENZENE
CUTPOINT TBPCUTS=0,1600,80, BLEND=BLEND1
$ Paraffin
PARA(LV) DATA= *
1,0/2,0/3,0/4,0/5,100/ *
6,100/7,100/8,100/9,100/10,100/ *
11,0/12,0/13,0/14,0/15,0
$ Olefin
SPROP(50,LV) DATA= *
1,0/2,0/3,0/4,0/5,100/ *
6,0/7,0/8,0/9,0/10,0/ *
11,100/12,100/13,100/14,100/15,0
$ Naphthene
NAPH(LV) DATA= *
1,0/2,0/3,0/4,0/5,0/ *
6,0/7,0/8,0/9,0/10,0/ *
11,0/12,0/13,0/14,0/15,0
$ Aromatics
AROM(LV) DATA= *
1,0/2,0/3,0/4,0/5,0/ *
6,0/7,0/8,0/9,0/10,0/ *
11,0/12,0/13,0/14,0/15,100
THERMODYNAMIC DATA
METHODS SYSTEM= GS,COND=PETR, VISC(V)=PETR, VISC(L)=API,
SET=GS-1, DEFAULT, *
SULFUR(WT)= SUM, *
NITR(TOTA,WT)= SUM, *
BROM(WT)= SUM, *
REFR(WT)= SUM, *
CCR(WT)= SUM, *
NICK(WT)= SUM, *
VANA(WT)= SUM
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 17-21
VANA(WT)= SUM, *
AROM(TOTAL,LV)= SUM, *
NAPH(LV)= SUM, *
PARA(LV)= SUM, *
H2(WT)= SUM, *
RON(LV)= SUM, *
MON(LV)= SUM, *
CETN(WT)= SUM, *
ANIL(LV)= SUM, *
FREZ(LV)= INDEX, *
CLOU(LV)= SIMSCI, *
POUR(LV)= INDEX, *
SMOK(LV)= SUM
POUR(LV) NCFILL=NOFILL
REFR(WT) NCFILL=NOFILL
H2(WT) NCFILL=NOFILL
SMOK(LV) NCFILL=NOFILL
FREZ(LV) GAMMA=1.0, REFINDEX=1.0, REFVALUE=1.0
STREAM DATA
$ Crude feed
PROP STREAM=1,TEMP=450,PRES=14,PHASE=L,RATE(V)=12075, *
ASSAY=LV, BLEND=BLEND1, SET=GS-1
TBP STREAM=1,PRES(MMHG)=760,&
DATA=3,97/5,149/10,208/20,330/30,459/40,590/&
50,690/60,770/70,865/80,980/100,1600
API STREAM=1,AVG=29.2
LIGHT STREAM=1,PERCENT(V)=3,&
COMP(V)=6,0.1/7,0.2/8,0.3/9,0.7/10,1.7,NORMALIZE
SULF STREAM=1, DATA= 10,0.1/50,1.4/90,3.3
NITR STREAM=1, DATA= 10,0.005/50,0.03/90,0.09
BROM STREAM=1, DATA= 10,1.5/50,2.8/90,4.5
REFR STREAM=1, DATA= 10,1.41/50,1.47/90,1.58
CCR STREAM=1, DATA= 10,0.01/50,0.05/90,0.24
$
PROP STREAM=2,TEMP=600,PRES=60,PHASE=V,RATE(W)=24151,&
COMP=4,100
PROP STREAM=3,TEMP=600,PRES=60,PHASE=V,RATE(W)=3623,&
COMP=4,100
PROP STREAM=4,TEMP=600,PRES=60,PHASE=V,RATE(W)=10868,&
COMP=4,100
PROP STREAM=5,TEMP=600,PRES=60,PHASE=V,RATE(W)=9660,&
COMP=4,100
$ Vacuum tower
PROP STREAM=R1B,TEMP=330,PRES=8000,RATE(V)=138.4, *
COMP=6,75/7,25
PROP STREAM=R1C,TEMP=330,PRES=8000,RATE(W)=5154,COMP=4,100
PROP STREAM=W1,TEMP=355,PRES=8500,RATE(W)=14718,COMP=4,100
$ Recycle gas initial guess
PROP STRM=RECYCLE, TEMP=100.0000, PRES=244.6959, *
COMP= 1,25000/2,2000/3,2000/4,2000/5,500/6,500/7,500/8,500
UNIT OPERATIONS
$
$ Crude process
$
.....
$
FLASH UID=FLA1
FEED REACT
PROD V=VAPPRD, L=LIQPRD
ISOTHERMAL TEMP=100, PRES=244.696
METHOD SET= GS-2
SPLITTER UID=SPL1
FEED VAPPRD
PRODUCT V=V_SPL1, V=H2OUT
SPEC STREAM= V_SPL1, RATE(GV,FT3/D), RATIO, STREAM=F1, *
RATE(TS/D), VALUE=56294
METHOD SET= GS-2
COMPRESSOR UID=CMP1
FEED V_SPL1
PROD V=RECYCLE
OPER PRES=315, EFF=92
METHOD SET= GS-2
$
$ Purification
COLUMN UID=COL1
PARAM TRAY=21
FEED LIQPRD,17
PROD OVHD=OVERHEAD, BTMS= BOTTOM,80000
COND TYPE=PART, PRESS=65
HEAT 1,1/2,21
PRESS 1,65/2,70/21,75
ESTI MODEL=CONVENTION
SPEC STREAM= OVERHEAD,RATE,COMP=10, OVER, *
STREAM=LIQPRD, RATE,COMP=10, VALUE=0.1
SPEC STREAM= BOTTOM,RATE,COMP=6, OVER, *
STREAM=LIQPRD, RATE,COMP=6, VALUE=0.1
VARY HEAT=1,2
METHOD SET= GS-2
$
$ Print component properties in each thermo method
CREPORT UID=CREP1
$
$ Recycle algorithm
$
RECYCLE DATA
ACCELERATION TYPE=BROYDEN
END
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 17-23
Example of PRO/II User-Added Subroutine
C *** EXAMPLE OF REACTOR INTERFACE PROGRAM ***
C
SUBROUTINE USER50(IPARM, RPARM, SUPPLE, HEAT, IDATA,
1 ISOLVE, ISTOP)
C
C----------------------------------------------------------------
C -
C - INCLUDE and DIMENSION blocks
C -
INCLUDE ’...\PMXUSR.CMN’
INCLUDE ’...\XPROPY.CMN’
C Common block XPROPY has the following variables
C COMMON /XPROPY/XMW(MAXCN), BP(MAXCN), DENS(MAXCN),
C 1 TC(MAXCN), PC(MAXCN), VC(MAXCN),
C 2 ZC(MAXCN), OMEGA(MAXCN), HFORM(MAXCN),
C 3 GFORM(MAXCN), LIBNO(MAXCN), KOCMOL,
C 4 KOCTOT, KOCVL, KOCVLS,
C 5 KOCLS, KOCV, KOCL,
C 6 KOCS
C
C User’s parameters
PARAMETER (LIXIN=100, LRXIN=100, LRXOUT=100,
1 LFDDAI=10, LFDDAJ=100, LPDDA=100,
2 ZERO=0.0, MAXPSU=100, MAXPRP=20,
3 IMISS=-2111111111,
4 RMISS=-1.5E35, RTEST=-1.0E35)
C
C PRO/II vectors
DIMENSION IPARM(*), RPARM(*), SUPPLE(*), HEAT(*)
1 IDATA(*)
DIMENSION STREAM(MAXCN+10), VAPOUT(MAXCN+10),
1 XL1OUT(MAXCN+10), XL2OUT(MAXCN+10),
2 XKVALU(MAXCN+10)
CHARACTER*12 CID
CHARACTER*40 CNAME
C
C User’s reactor interface vectors
DIMENSION IXIN(LIXIN), RXIN(LRXIN), RXOUT(LRXOUT),
1 FDDATA(LFDDAI,LFDDAJ), PDDATA(LPDDA),
2 PDCURV(MAXPSU,MAXPRP),
3 BPTIP(MAXCN), BPTEP(MAXCN)
C
C Local vectors
DIMENSION IONUMB(10), CRC(10), REFRAC(10), IDCOMP(20),
1 IMAPED(MAXCN)
DIMENSION TDIST(21), FRATE(MAXCN), RXMW(MAXCN),
1 RXSPGR(MAXCN), RXSULF(MAXCN), RXNAPH(MAXCN),
2 RXRON(MAXCN)
DIMENSION CTMID(MXPSEU), CWTPCT(MXPSEU),
1 CMWT(MXPSEU), CSPGR(MXPSEU), CSULF(MXPSEU),
2 CNITR(MXPSEU), CNAPH(MXPSEU), CAROM(MXPSEU),
3 CTMIN(MXPSEU), CTMAX(MXPSEU)
DIMENSION TVEC(MXPSEU), YVEC(MXPSEU)
CHARACTER*12 ATEXT
CHARACTER*12 PPTEXT(10)
CHARACTER*16 CPNAME
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 17-25
.....
C Refractive index data
REFRAC(1) = RPARM(21)
.....
C
C----------------------------------------------------------------
C Note that many of the following data can be saved at unused
C IPARM, RPARM or SUPPLE after the processing and retrieved for
C use during the recycle iterations to avoid repeated calculation the
C first time.
C
C -
C - Get component position orders for all defined components
C - involved in the reactor simulation
C -
ITYPE = 1
C Find ’H2’
LIBH2 = 16020090
CALL UDEFNC(CPNAME, LIBH2, ITYPE, JPLACE)
IF (JPLACE .GT. 0) THEN
IDCOMP(1) = JPLACE
ELSE
C (error message)
ENDIF
C Find ’C1’
LIBC1 = 9010090
CALL UDEFNC(CPNAME, LIBC1, ITYPE, JPLACE)
IF (JPLACE .GT. 0) THEN
IDCOMP(2) = JPLACE
ELSE
C (error message)
ENDIF
.....
C----------------------------------------------------------------
C -
C - Determine the index range and initial and end boiling points
C - of PRO/II’s assay pseudocomponents. These data will be used
C - when saving the reactor product result to PRO/II’s product
C - stream. The range is determined by the "BLEND" specified by
C - the user under the "NAME" of the reactor unit. The blend has
C - to be declared in the "COMPONENT" section
C -
CALL UPSEUC(IDATA, BP, IBEGIN, IEND, BPTIP,
1 BPTEP, IERR)
C Check error flag IERR
.....
C
C----------------------------------------------------------------
C -
C - Get file open numbers for user’s own file I/O purpose
C -
DO 100 I= 1, 5
CALL FIGETU(1,LUN)
IONUMB(I) = LUN
100 CONTINUE
.....
C
C Open user’s own data file
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 17-27
C FDDATA(*,2)= stream density
C FDDATA(*,3)= stream sulfur content
C FDDATA(*,4)= stream nitrogen content
C FDDATA(*,5)= stream naphthene carbon content
C FDDATA(*,6)= stream aromatics carbon content
C FDDATA(*,7)= stream CRC content
C FDDATA(*,8)= stream refractive index
C .....
C FDDATA(*,11-17)= distillation data at IP,10%,30%,50%,70%,
C 90%,EP (7 points)
C FDDATA(*,21)= H2 flowrate
C FDDATA(*,22)= C1 flowrate
C
FDDATA(I,1) = STREAM(1) * STMW
FDDATA(I,2) = STDENS
FDDATA(I,3) = STSULF
FDDATA(I,4) = STNITR
FDDATA(I,5) = STNAPH
FDDATA(I,6) = STAROM
FDDATA(I,7) = CRC(I)
FDDATA(I,8) = REFRAC(I)
.....
C Distillation curve data at IP,10%,30%,50%,70%,90%,EP points
FDDATA(I,11) = TDIST(1)
FDDATA(I,12) = TDIST(3)
FDDATA(I,13) = TDIST(7)
FDDATA(I,14) = TDIST(11)
FDDATA(I,15) = TDIST(15)
FDDATA(I,16) = TDIST(19)
FDDATA(I,17) = TDIST(21)
.....
C H2, C1 and other light component flowrates
FDDATA(I,21) = STREAM(10+IDCOMP(1))
FDDATA(I,22) = STREAM(10+IDCOMP(2))
.....
C Any required error checks for feed stream properties
.....
300 CONTINUE
.....
C
C
C----------------------------------------------------------------
C -
C - Assign all other desired data to the interface variables
C - The data can be reactor operating condition, catalyst
C - activity, etc.
C -
IXIN(1) = IH2IN
.....
C
RXIN(1) = TIN
RXIN(2) = PIN
RXIN(3) = CATWT
RXIN(4) = CATACT
RXIN(5) = TCUT1
RXIN(6) = TCUT2
RXIN(7) = TCUT3
.....
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 17-29
320 CONTINUE
C
C Get reactor data such as reactor temperature, pressure, ...
TOUT = RXOUT(2)
POUT = RXOUT(3)
FWOUT = RXOUT(4)
.....
ICUMUL = 1
IMETHD = 4
C
C Match the weight flowrate of pseudocomponent
CALL URATE(TMAX, CWTPCT, NCPSEU, ICUMUL,
1 FWOUT, IBEGIN, IEND, BPTIP,
2 BPTEP, IMETHD, IMAPED, FRATE,
3 IERR)
C Check error flag IERR
C
C Match the component properties based on curve data
C
C Use the molecular weight curve determined by the reactor
C simulation to determine the molecular weight of all assay
C pseudocomponents that were selected to store the reactor
C product data.
ATEXT = ’MW’
ISPROP = 0
TMINI = CTMIN(1)
TMAXI = CTMAX(NCPSEU)
YLOW = 2.0
YHIGH = 1000.0
IFILL = 2
ITREND = 0
IMETHD = 3
IUPDAT = 0
SSCALE = 1.0
CALL UCURVE(ATEXT, ISPROP, CTMID, CMW, NCPSEU,
1 BP, FRATE, IBEGIN, IEND, TMINI,
2 TMAXI, YLOW, YHIGH, IFILL, ITREND,
3 IMETHD, IUPDAT, SSCALE, IMAPED, RXMW,
4 SUMMW, IERR)
C Check error flag IERR
C
C Use the specific gravity curve determined from the reactor
C simulation to determine the specific gravity of all assay
C pseudocomponents that were selected to store the reactor
C product data.
ATEXT = ’SPGR’
ISPROP = 0
TMINI = CTMIN(1)
TMAXI = CTMAX(NCPSEU)
YLOW = 0.5
YHIGH = 1.5
IFILL = 2
ITREND = 0
IMETHD = 3
IUPDAT = 0
SSCALE = 1.0
CALL UCURVE(ATEXT, ISPROP, CTMID, CSPGR, NCPSEU,
1 BP, FRATE, IBEGIN, IEND, TMINI,
ATEXT = ’’
ISPROP = NSNAPH
TMINI = CTMIN(2)
TMAXI = CTMAX(5)
YLOW = 0.0
YHIGH = 100.0
IFILL = 2
ITREND = 0
IMETHD = 0
IUPDAT = 0
SSCALE = 1.0
CALL UCURVE(ATEXT, ISPROP, CTMID, CNAPH, NCPSEU,
1 BP, FRATE, IBEGIN, IEND, TMINI,
2 TMAXI, YLOW, YHIGH, IFILL, ITREND,
3 IMETHD, IUPDAT, SSCALE, IMAPED, RXNAPH,
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 17-31
4 SUMNAP, IERR)
C
C Similarly for AROMATICS mapping here
C
C Map the component product rate
C
DO 330 J= 1, MAXCN
STREAM(10+J) = ZERO
330 CONTINUE
C
C Match flowrate of defined component
C Assume PDDATA(30-31) store the weight flowrates of H2 and C1
STREAM(10+IDCOMP(1)) = PDDATA(30)
STREAM(10+IDCOMP(2)) = PDDATA(31)
.....
C
C Match the weight flowrate of pseudocomponent
DO 340 J= IBEGIN, IEND
STREAM(10+J) = FRATE(J)
340 CONTINUE
C
C CONVERT WT TO MOLAR FLOWRATE
DO 340 J= IBEGIN, IEND
STREAM(10+J) = STREAM(10+J) / XMW(J)
340 CONTINUE
C
C SUM up stream molar rate
FTOTAL = ZERO
DO 380 J= 1, MAXCN
FTOTAL = FTOTAL + STREAM(10+J)
380 CONTINUE
C
C Assign product stream rate, temperature and pressure
STREAM(1) = FTOTAL
STREAM(2) = TOUT
STREAM(3) = POUT
C
CALL UFLSH(STREAM, VAPOUT, XL1OUT, XL2OUT, XKVALU, 1, IERR)
C ERROR CHECK:
C
STTH = VAPOUT(4) + XL1OUT(4) + XL2OUT(4)
STREAM(4) = STTH
C
C Save the product stream data
CALL URXSTR(CID, STREAM, 2, IERR)
C
C Match the bulk stream property for a defined boiling range of
C the reactor effluent stream.
C
C RON NUMBER
C
ATEXT = ’RON’
ISPROP = 0
BRON = RXOUT(11)
TMINI = RXOUT(12)
TMAXI = RXOUT(13)
IFILL = 4
SSCALE = 1.0
C
C *** EXAMPLE OF USER’S REACTOR MAIN SUBROUTINE ***
C
C The main interface routine on the user’s side for the reactor
C interface with PRO/II
C
SUBROUTINE USER_REACTOR(IXIN, RXIN, RXOUT, FDDATA, PDDATA,
1 PDCURV, IERR)
C -
C - Block of INCLUDE and DIMENSION
C -
PARAMETER (LIXIN=100, LRXIN=100, LRXOUT=100,
1 LFDDAI=10, LFDDAJ=100, LPDDA=100,
2 ZERO=0.0, TCUT0=32.0, MAXPSU=100,
3 MAXPRP=20)
C
C Interface variables
DIMENSION IXIN(LIXIN), RXIN(LRXIN), RXOUT(LRXOUT),
1 FDDATA(LFDDAI,LFDDAJ), PDDATA(LPDDA),
2 PDCURV(MAXPSU,MAXPRP)
C
C Reactor module variables
DIMENSION COPRXN(100,20)
C -
C - Create reaction pseudocomponents
C -
C The reaction pseudocomponents are created based on TBP
C data, and bulk properties such as gravity, molecular wt,
C sulfur content, nitrogen content, and refractive index.
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 17-33
C These data are available in the FDDATA().
C COPRXN(I,J) stores the pseudocomponent data created from these data,
C where I= pseudocomponent index;
C J=1 for molar flowrate;
C J=2 for initial boiling point;
C J=3 for end boiling point;
C J=4 for molecular wt;
C J=5 for SPGR;
C J=6 for paraffin carbon fraction;
C J=7 for naphthene carbon fraction;
C J=8 for aromatics carbon fraction;
C J=9 for sulfur wt%;
C J=10 for nitrogen wt%
C
CALL USER_PSEUDOCOMPONENT(FDDATA, NCPSEU, COPRXN)
C
C NCPSEU IS DECIDED BY THE REACTION MECHANISM
RXOUT(1) = NCPSEU
C -
C - Calculate the reaction result
C -
C Calculate the reaction result based on the given reactor inlet
C temperature and pressure, catalyst amount and activity, and the
C pseudocomponent data. In this example the reaction mechanism
C and kinetic data are all defined in the USER_RXN subroutine.
C The result of reactor effluent is also stored at COPRXN().
C
TIN = RXIN(1)
PIN = RXIN(2)
CATWT = RXIN(3)
CATACT = RXIN(4)
.....
CALL USER_RXNCALCULATION(NCPSEU, COPRXN, TIN, PIN, CATWT,
1 CATACT, TOUT, POUT, RATE ...)
C -
C - Write reaction results to the interface variables RXOUT,
C - PDDATA, and PDCURV
C -
RXOUT(2) = TOUT
RXOUT(3) = POUT
RXOUT(4) = RATE
.....
C
DO 100 J= 1, NUMCOP
PDCURV(J,1) = COPRXN(J,1)
PDCURV(J,2) = (COPRXN(J,2)+COPRXN(J,3))/2
PDCURV(J,3) = COPRXN(J,1) * COPRXN(J,4)
PDCURV(J,4) = COPRXN(J,4)
PDCURV(J,5) = COPRXN(J,5)
PDCURV(J,6) = COPRXN(J,9)
PDCURV(J,7) = COPRXN(J,10)
PDCURV(J,8) = COPRXN(J,7)
PDCURV(J,9) = COPRXN(J,8)
PDCURV(J,10) = COPRXN(J,2)
PDCURV(J,11) = COPRXN(J,3)
.....
100 CONTINUE
C -
C - Determine the bulk refinery inspection properties
C -
C Generate bulk properties
C
TCUT1 = RXIN(5)
TCUT2 = RXIN(6)
TCUT3 = RXIN(7)
C
CALL USER_BULKPROPERTY(NUMCOP, COPRXN, TOUT, POUT, TCUT1,
1 TCUT2, TCUT3, STBRON, ...)
C
RXOUT(11) = STBRON
RXOUT(12) = TCUT0
RXOUT(13) = TCUT1
C
C Write similar code for other bulk properties
.....
RETURN
END
PRO/II Data Transfer System and User-Added Subroutines User’s Guide 17-35
Index
A C
Attribute Case ID , 1-3
See Data retrieval Case sensitivity
Attribute lists of strings , 1-4
complete listing of , 5-1 Case study ID list subroutine
Calculator , 5-21 PACAS() , 3-3
Column/Side , 5-16
Case study option
Component data , 5-2
multiple cases , 1-6
Compressor , 5-6
Case study setup subroutine
Conversion Reactor , 5-22
PACASE() , 3-4
CSTR , 5-23
Class
Equilibrium Reactor , 5-21
See Data retrieval
Expander , 5-6
Common storage block
Flash , 5-5
XPROPY, 17-4
Gibbs Reactor , 5-25
HCURVE (heating curve) , 5-19 Common storage blocks
altering , 11-2
HX (simple) , 5-9
complete listing of , 12-2
HXRIG (rigorous) , 5-10
LLEX (liq.-liq. extraction) , 5-18 CUDATA , 12-22
LNGHX (liq. nat. gas HX) , 5-14 CUSPEC , 12-23
FACTOR, 12-14
Phase Envelope , 5-20
OUTFAC, 12-19
Pipe , 5-7
UTHERX, 12-16
Plug Flow Reactor , 5-24
XPROPX, 12-18
Pump , 5-7
Shortcut (column) , 5-15 XPROPY, 17-19
Stream Data , 5-3 Compatibility with earlier versions
Unit Data , 5-4 accessing common storage blocks, 10-1
Valve , 5-5 Component order
internal, 17-1
internal vs. print, 13-10
B Component order subroutine
COINUM , 13-13
COPNUM() , 13-12
Building executables
for PDTS , 2-2 COMPS , 12-18
for UAS , 10-1 CUDATA, CUSPEC
See Common storage blocks
Customizing data entry windows
for UAS, 10-3
PRO/II Data Transfer System and User-Added Subroutines User’s Guide I-37
D I
Data file Interface subroutines
See FIGETU() HCOMPU , 12-14
Data retrieval HEAD , 12-3
class, attribute, item scheme, 1-3 KCOMPU , 12-13
Data retrieval subroutine TTPROP , 12-5
PADATC() - character , 1-3, 3-8 U3FLSH , 12-9
PADATI() - integer , 1-3, 3-7 UDENS , 12-12
PADATR() - floating point , 1-3, 1-4, 3-6 UFLSH , 12-6
Database close subroutine UH2OP , 12-11
PACLOS() , 3-10 UHS , 12-10
Database open subroutine URXINF , 12-3
PAOPEN , 2-3, 3-2 URXSTR , 12-4
DataPrep Invensys , xiii
finding library numbers with ... , 17-1 Item
Input Manual , 12-18 See Data retrieval
IU - UOM class flag , 1-5
F
K
FACTOR
See Common storage blocks KCOMPU
FIGETU() , 11-2, 12-23 See Interface subroutines
for getting FORTRAN file unit number
Example of implementation , 7-1
Flowsheet parameter retrieval subroutine L
PMISC() , 3-5
FORTRAN Limits of standard PDTS
recommended coding practices , 11-2 column feeds, draws, etc. , 1-2
FORTRAN compilers components, streams, unit ops. , 1-2
DEC Visual FORTRAN , 2-1, 10-1, 10-2 phase envelope curves, points, etc , 1-2
Lahey , 9-1 Limits of standard UAS
Microsoft PowerStation , 9-1 IPARM, RPARM, SUPPLE, etc. , 9-2
G O
Gunn-Yamada method , 13-30 OUTDIME statement , 1-5
OUTFAC
See Common storage blocks
H
HCOMPU P
See Interface subroutines
HEAD PACAS()
See Interface subroutines See Case study ID
PACASE()
See Case study setup
PRO/II Data Transfer System and User-Added Subroutines User’s Guide I-38
PACLOS See Interface subroutines
See Database close UHS, UH2OP
PAUMOS() See Interface subroutines
See UOM string UOM Class flag - IU , 1-5
PDTS UOM group specifier - KU , 1-5
described , xii
UOM groups (KU) , 1-5
PDTS applications
UOM string retrieval subroutine
compatibility with earlier versions , 8-1
PAUOMS(), 3-9
PMISC()
UPETMD, UPSEUC, URATE
See Flowsheet parameter retrieval
See User utility subroutines
PRO/II database files
URATE
*.prz and *.pr1 , 1-2, 2-2
See User utility subroutines
PRO/II PC/LAN Installation Guide, 9-2
URXINF, URXSTR
PROCESS See Interface subroutines
different treatment of water in ... , 13-8 User utility subroutines
UBULK, 17-17
UCURVE, 17-12
S UDEFNC , 17-1
UDIST , 17-7
SIMSCI Internal Units , 1-5 UPETMD, 17-15
UPSEUC, 17-2
URATE , 17-10
T USTHER, 17-4
USTPRP, 17-5
USTRIP, 17-6
Technical support centers , xiv
UTHERX
TTPROP See Common storage blocks
See Interface subroutines
W
U
Water decant , 13-8, 13-9
UAS
described , xii
UBULK, UCURVE, UDEFNC
See User utility subroutines
X
UDENS
See Interface subroutines XPROPX
See Common storage blocks
UDIST
See User utility subroutines XPROPY
See Common storage blocks
UFLSH, U3FLSH
I-39 Index