0% found this document useful (0 votes)
10 views237 pages

PDTS Uas55

The PDTS UAS User's Guide provides detailed information on the PRO/II Data Transfer System and User-Added Subroutines, including installation, usage, and technical support. It covers various chapters detailing the system's introduction, build procedures, subroutines, example problems, and coding standards. The document is intended for users to effectively utilize the software while adhering to licensing agreements and copyright regulations.

Uploaded by

sjy19790213
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views237 pages

PDTS Uas55

The PDTS UAS User's Guide provides detailed information on the PRO/II Data Transfer System and User-Added Subroutines, including installation, usage, and technical support. It covers various chapters detailing the system's introduction, build procedures, subroutines, example problems, and coding standards. The document is intended for users to effectively utilize the software while adhering to licensing agreements and copyright regulations.

Uploaded by

sjy19790213
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 237

PDTS UAS USER’S GUIDE

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.

Printed in the United States of America, April 2001.


Contents

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

PRO/II Data Transfer System and User-Added Subroutines User’s Guide v


Retrieving Flowsheet Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
Floating Point Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
Integer Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7
Character Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8
Retrieving Unit of Measure String . . . . . . . . . . . . . . . . . . . . . . . . 3-9
Closing Database Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10

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

PRO/II Data Transfer System and User-Added Subroutines User’s Guide ix


UPSEUC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-2
USTHER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-3
USTPRP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-5
USTRIP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-6
UDIST. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-7
URATE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-9
UCURVE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-11
UPETMD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-15
UBULK. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-16
Common Block /XPROPY/ . . . . . . . . . . . . . . . . . . . . . . . . 17-19
Sample User-added Reactor Module . . . . . . . . . . . . . . . . . 17-20
Example Input File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17-21
Example of PRO/II User-Added Subroutine . . . . . . . . . . . . . . . 17-24
Introduction

About This Manual


This manual provides instructions on using the PRO/II Data Trans-
fer System (PDTS) and User-Added Subroutine (UAS) utilities for
PRO/II. An outline of the manual is provided below.

The PDTS utility is covered in Chapters 1-8:

Chapter 1 PDTS Introduction Describes PDTS utility features, explains the


Class, Attribute, and Item concepts underlying
the PDTS utility, and describes how to handle
simulations with multiple case studies.
Chapter 2 Build Procedure Describes compiling and linking PDTS programs
for PRO/II PDTS using Compaq Visual FORTRAN.
Chapter 3 PDTS Subroutines Explains the function of each PDTS subroutine,
and Functions describes the argument list for each subroutine,
and shows how to use each subroutine through
brief example problems.
Chapter 4 PDTS Example Provides three example PDTS problems used to
Problems learn the general procedures to successfully
building a PDTS program.
Chapter 5 Attribute Lists Provides Class and Attribute lists for PDTS.
Chapter 6 PDTS Example Provides the FORTRAN listings of the example
Listings problems of Chapter 4.
Chapter 7 User-Addressable Describes a utility that guarantees that the
Utility Functions FORTRAN unit number passed to your FORTRAN
OPEN statement will not conflict with files
opened by the PDTS system.
Chapter 8 Guide for Pre-v5.1 Outlines rules for users of PDTS/UAS
PDTS-UAS Users subroutines written for PRO/II versions prior to
v5.1.

PRO/II Data Transfer System and User-Added Subroutines User’s Guide xi


The UAS utility is covered in Chapters 9-17:

Chapter 9 UAS Introduction Describes UAS utility features and limitations,


requirements for installing UAS, and how to
link UAS to PRO/II.
Chapter 10 Build Procedure for Describes how to compile and link UAS
PRO/II UAS programs using Compaq Visual FORTRAN.
Chapter 11 FORTRAN Coding Outlines ANSI FORTRAN coding standards to
Standards and follow to ensure compatibility with PRO/II.
Requirements
Chapter 12 Interfacing Details the linking routines and common
Software, Common blocks for communicating with PRO/II.
Blocks, and Data
Files
Chapter 13 User-Added Describes routines for linking user-added
Thermodynamic K-Value, enthalpy, entropy, and density
Property Methods property calculation methods into PRO/II.
Chapter 14 Transport Property Describes routines for linking user-added
Subroutines viscosity, thermal conductivity, and surface
tension calculation methods into PRO/II.
Chapter 15 Unit Operation Describes routines for linking user-added
Subroutines process unit operations (e.g., flash drums)
into PRO/II.
Chapter 16 Reaction Kinetic Describes routines for integrating user-added
Subroutines reaction kinetic data into the PRO/II CSTR or
PFR models.
Chapter 17 Refinery Reactor Describes routines for integrating user-added
UAS refinery reactor models into PRO/II.

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.

The User-Added Subroutine (UAS) feature of PRO/II allows you to


incorporate your own calculation methods into the standard PRO/II
program via subroutines written in FORTRAN.

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.

SIMSCI is a member of Invensys Process Automation, an Invensys


company. Invensys plc is a world class automation and controls
company with its head office in London, England. The Software
Systems Division focuses on delivering software solutions to busi-
nesses including everything from rail to chemical, oil, gas, pulp,
paper, utilities, petrochemical, food, beverage, dairy and pharma-
ceutical. It is a global leader in software and information systems,
through its ability to provide advanced performance-based contract-
ing, turn-key solutions and complete lifetime services. The Auto-
mation Systems division provides factory automation products and
engineered equipment for general industrial applications. It makes
motors, motor controllers, electronic drives, compressors and a full
range of power transmission and mechanical automation compo-
nents for the worlds' factories. The Power Systems division is a glo-
bal leader for power control and energy storage products for
telecoms, factory automation, computers and office equipment. The
Control Systems Division is a world leader in Control Systems and
controls systems for home appliances, HVAC systems, commercial
applications, building systems, appliance automation, aerospace
and manufacturing systems.

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:

■ Have the installation CD and printed documentation available.

■ Determine the type of computer you are using.

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.

■ Note the exact error messages that appear on your screen, as


well as any other symptoms.

xiv Introduction
Chapter 1
PDTS Introduction

This chapter introduces the PDTS utility for PRO/II. In this chapter
you will:

■ Determine what PRO/II files you need when using PDTS.

■ Learn the Class, Attribute, and Item concept underlying the


PDTS utility.

■ Find out how to handle units of measure (UOM).

■ Learn how to handle simulations with multiple case studies.

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.

PRO/II Results Files


In normal use, the results of a PRO/II simulation are either sent to
an output file or viewed through the PRO/II user interface. You may
wish to capture these results in a form that can be used to interface
with other programs such as spreadsheets, costing and sizing pro-
grams, customized reports, and so on.

PRO/II generates three temporary database files that contain all


PRO/II input and calculation results. On most operating systems,
these files have the extensions .PRO1, .PRO2 , and .PRO3; on the PC,
the file extensions are .PR1, .PR2, and .PR3. When PRO/II is exe-
cuted from a keyword file in batch mode, these database files are
normally deleted after the output report is generated.
By default, PRO/II saves the temporary .PR1, .PR2, and .PR3 data-
base files in the form of a zipped permanent .PRZ file unless you
specify otherwise. PDTS cannot read a .PRZ file. Therefore you
must either use PKUNZIP.EXE to unzip the .PRZ file or use the Save
as .PR1 option in PRO/II.

For PRO/II runs, it is not necessary to generate an output report for


complete PDTS data access. If the flowsheet has solved, you may
alternatively select Output/Perform Output Calculations and save
the flowsheet. This will perform all the necessary additional calcu-
lations needed for PDTS applications.

1-2 PDTS Introduction


To retain the database files:

➤ Change the TITLE statement in the PRO/II keyword input file by


adding the keyword NEWFILE= as illustrated below:
TITLE ..... , NEWFILE=xxxx, CASEID=yyyy
where:
xxxx = Primary file name
yyyy = Case ID name

Note: The Case ID name is optional if the PRO/II simulation has


only a base case. (The default Case ID name is BASECASE.) If the
simulation entails multiple cases, the Case ID is required.

The changes to the keyword file described above are identical to


those used in case study and restart operations.

Note: Refer to the PRO/II Keyword Manual, Chapters 141 and


142, for further information on restart and case study options.

Generating the PDTS Application


The PDTS application is a new independent program written by the
user in FORTRAN. Input to this new program are the PRO/II data-
base files discussed above. The application will call the PDTS sub-
routines to access the specific simulation results desired and can
then write out information in whatever format is required. Access to
specific simulation results is based on a “Class, Attribute and Item”
scheme.

Data Retrieval using Class, Attribute and Item


The Class, Attribute and Item data retrieval scheme is a greatly
improved method of accessing the PRO/II simulation results. In the
past, the user had to be familiar with dozens of separate subroutines
to retrieve data. That concept has been dramatically simplified. The
user need call one of only three subroutines to retrieve the data
required depending on the data type. The subroutine PADATR
retrieves floating point data, PADATI retrieves integer data, and
PADATC retrieves character data.

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.

The concept can be illustrated in the following example in which


one obtains the actual calculated work required for compressor unit,
C-1. In this case, the Class of data requested is ‘Compressor’. The
Attribute is ‘WorkActualCalc’, and the Item is the unit ID ‘C-1’. The
Class and Attribute names are obtained from Chapter 5, where the
work is described as a floating point scalar value. To retrieve the
floating point result and store it as variable WCALC, the user would
call subroutine PADATR in the following manner:
CALL PADATR(‘Compressor’,‘WorkActualCalc’,‘C-1’,*
WCALC,KC,KU,IU,IERR)

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:

■ Determine the number of items returned.

■ Specify the Unit of Measure Group.

■ Return the Unit of Measure Class.

■ Test whether an error occurred.

All subroutine and function calls are described in detail in


Chapter 3, PDTS Subroutines and Functions.

1-4 PDTS Introduction


Specifying Units of Measure (UOM) of the Retrieved Data
In past versions of PDTS, you could not control the UOM of the
returned data items. The current version of PDTS offers limited
UOM control. You can return data in the input units specified for
the simulation in the keyword input on the DIMENSION statement or
one of seven different UOM groups given in Table 1-2.
Table 1-2: Unit of Measure Groups for KU
Value for KU Description
0 Default input units as specified on the DIMENSION
statement
1 SIMSCI Internal Units (SI)
2 Standard English Units (Table 4.1, PRO/II Keyword
Manual)
3 Standard Metric Units (Table 4.1, PRO/II Keyword
Manual)
4 Standard SI Units (Table 4.1, PRO/II Keyword Manual)
5 Input units (the default)
6 Primary output units as specified on the OUTDIME
statement
7 Alternative output units as specified on the OUTDIME
statement with keyword ADD

Example:
KU = 0
CALL PADATR(‘Compressor’,‘WorkActualCalc’,‘C-1’,WCALC,KC,*
KU,IU,IERR)

The UOM group is illustrated in the compressor example above, as


the variable KU in the call to routine PADATR. In this example, by
setting the value of KU equal to zero, you specify that variable
WCALC will contain the actual work in user input units correspond-
ing to the DIMENSION statement in the original PRO/II keyword
input file.

Returning the UOM of the Retrieved Data


In the example given above, variable IU will contain a UOM class
flag for the retrieved data. This class flag can then be passed to the
character function PAUOMS and used to print a string with the cor-
rect UOM as shown below.

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)

In the example, variable CBUF contains a character stream with the


default input duty units. Thus, if the PRO/II flowsheet uses
BTU/H for duty units, and the results yield a duty of 5.0 for unit F-1,
the output of this PDTS application would read:
The Duty of Flash F-1 = 5.0000 MMBTU/HR

Handling Simulations with Multiple Cases


If the Case Study option has been used in the PRO/II simulation,
data will be stored in the database files under separate Case IDs. It
is possible to set up individual cases and retrieve selected data for
each case using the following subroutines that are described in
detail in Chapter 3:

■ Subroutine PACASL will retrieve an array of 8-character strings


corresponding to the CASE IDs.

■ Subroutine PACASE will set up an individual case.

Note: These routines are not required if the BASECASE is the only
case of interest.

1-6 PDTS Introduction


Chapter 2
Build Procedures for PDTS

A PDTS program is a FORTRAN program that calls PDTS func-


tions to retrieve results from a PRO/II run. The PDTS program must
be compiled and linked using Compaq Visual Fortran 6.1 or 6.5.

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.

Build Procedure for PRO/II PDTS


You can compile and link your PDTS program using Compaq
Visual Fortran 6.1 or 6.5. PDTS programs built with this compiler
can run under Windows 98, Windows NT, or Windows 2000 at the
command prompt.
In the sample build procedure outlined below, we will run the sam-
ple problem EXAM1.INP, compile and link the sample PDTS pro-
gram EXAM1.FOR, and then run the PDTS executable file to
generate a custom output report.

Note: These instructions assume that you have installed PRO/II


PDTS/UAS in the default directory structure, C:\SIMSCI\PROII55.
Modify the paths indicated in the example if you have installed
the program in a directory structure other than the default.

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 a flowsheet problem successfully to generate the necessary


database files.
➤ Compile, link, and run your PDTS program.

Generating PRO/II Database Files


To locate and run the EXAM1.INP input file:

➤ 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).

➤ Compile and link EXAM1.FOR to create the PDTS program.

Building a PDTS Executable File Using Compaq FORTRAN


To build a PDTS executable file using Compaq Visual Fortran:

➤ 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.

Note: All sample files are located in C:\SIMSCI\PROII55\


USER\PDTS\EXAMPLES.

➤ Locate the PRO/II error and support files, PROII.ERR and


PROII.SP1. By default, they should be in C:\SIMSCI\PROII55\
SYSTEM. However, they may be in a different directory if you
modified the PRO/II directory structure during installation.

Note: If PROII.ERR and PROII.SP1 are in a directory other than the


one specified above, you must edit the directory path in
EXAM1.FOR as shown below.

2-2 Build Procedures for PDTS


To edit the EXAM1.FOR file:

➤ Select the File/Open from the menu bar.


➤ Select EXAM1.FOR as the file to edit.
➤ Search for the string PAOPEN in the file EXAM1.FOR. Replace
SIMSCI\PROII55\SYSTEM\ in the argument list of the function
call PAOPEN with the correct directory path to the files
PROII.ERR and PROII.SP1, for example, D:\SIMSCI\ PROII55\
SYSTEM\.

Note: See Chapter 3 for function call PAOPEN arguments.


➤ Save your changes to EXAM1.FOR.
Next, you must add the file EXAM1.FOR into the project file:
➤ Select File/Add to project/files from the menu bar.
➤ Add the file \SIMSCI\PROII55\USER\PDTS\EXAMPLES\
EXAM1.FOR. (If this file is already in the project, a message will
be displayed.)
➤ Click Close to exit the window and update the project file.
Now, you can build the new executable file:
➤ Select the Build EXAM1.EXE option from the File menu.
The PDTS program EXAM1.EXE will be built in the directory
\SIMSCI\PROII55\USER\PDTS\EXAMPLES. This program can be run
under Windows 98, Windows NT, or Windows 2000 at the com-
mand prompt.

You can now run the program either from the command line or from
within Compaq FORTRAN.

To run from within Compaq Fortran:

➤ Select Execute EXAM1.EXE from the File menu.


You will be prompted for the name of the database files.
➤ Type EXAM1. The EXAM1.EXE file extracts data from a train of
compressors and generates an output report (in EXAM1.PDS).

Note: If the EXAM1.PR* database files are located in the direc-


tory directly above the directory containing the make file, type
..\EXAM1 instead.

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.

2-4 Build Procedures for PDTS


Chapter 3
PDTS Subroutines and Functions

This chapter describes the ten user-callable subroutines of the


PRO/II Data Transfer System shown in Table 3-1. This chapter:

■ Describes what each PDTS subroutine can do.

■ Explains the argument list for each subroutine.

■ Illustrates each subroutine through a brief sample problem.


Table 3-1: Standard PDTS Subroutines
Routine Purpose
PAOPEN Opens the database files (required)
PACASL Lists available case IDs
PACASE Sets up an individual case (required for Case Study)
PAMISC Retrieves miscellaneous flowsheet parameters (required)
PADATR Retrieves single precision floating point data
PADATI Retrieves integer data
PADATC Retrieves character type data
PAUOMS Retrieves unit of measure string
PACLOS Closes database files (required)
FIGETU Returns unique FORTRAN file unit number

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/.

3-2 PDTS Subroutines and Functions


If you have installed the PRO/II error and support files on the C:
drive but are executing the PDTS application on the D: drive, then
the full path to the PRO/II error and support files must be entered as
the SPATH argument. In the above example, the subroutine call will
be changed to read:
CALL PAOPEN (NAME, ‘C:\PSIMSCI\PROII_W\SYSTEM\ ’,NFOUT,IRCODE)

Note: Normally PAOPEN is used to open the PRO/II database files


and a single file for output. However, you may wish to open addi-
tional files for input or output. This can be accomplished using the
FIGETU subroutine (see Chapter 7).

Obtaining a List of Case Study IDs


SUBROUTINE PACASL (MXN, KNX, CASEN, IRCODE)

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.

Note: This routine is required only when the user wishes to


retrieve data from cases other than BASECASE.

Arguments:

MXN Number of elements in the CASEN array in the


calling routine.
KNX Number of case IDs actually found in file.
CASEN Array of CHARACTER*12 strings containing the
available case IDs.
IRCODE Return code (non-zero indicates error
condition).

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

Setting Up an Individual Case Study


SUBROUTINE PACASE( CASEX, IRCODE)

Purpose:
To set up an individual simulation case.

Note: Subroutine PAOPEN must be called prior to opening the


PRO/II database.

If the desired case ID is not known, you should call subroutine


PACASL to obtain a list of case IDs. If the required case is
BASECASE, a call to this routine is not required.

Arguments:

CASEX Character*12 case ID.


IRCODE Return code (non-zero indicates error condition).

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

3-4 PDTS Subroutines and Functions


C Set Up Desired Case
C
WRITE (*, 1005)
READ (*, 1002) CASEX
CALL PACASE (CASEX, IRCODE)

Retrieving Miscellaneous Flowsheet Data


SUBROUTINE PAMISC(NCOMP, NSTRM, NUNIT, IRCODE)

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:

NCOMP Number of components.


NSTRM Number of streams.
NUNIT Number of unit operations.
IRCODE Return code (non-zero indicates error condition).

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

CALL PAMISC (NCOMP, NSTRM, NUNIT, IRCODE)


C
C Check Return Code
C

IF ( IRCODE .EQ. 0) THEN


WRITE (NFOUT, 1001) NCOMP, NSTRM, NUNIT
ELSE
WRITE (*, 1002)
STOP
ENDIF

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:

CLASS Class character string identifying the class of data


requested.
ATTRIB Attribute character string identifying individual data
attribute requested within the class selected.
ITEM Item character string identifying the particular data
item for which data are requested.
RBUF REAL*4 variable sufficiently sized to hold the
retrieved data. Either scalar variable or array
depending on the Attribute requested.
KC Integer count of data items retrieved in RBUF.
KU Integer UOM group flag (0 - 7). Controls conversion
of the data in RBUF. Refer to Table 1-2.
IU Integer UOM class flag. Zero value indicates that
RBUF is dimensionless. This flag may be used to
retrieve a UOM string from function PAUOMS.
IRCODE Return code (non-zero indicates error condition).

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)

3-6 PDTS Subroutines and Functions


In the above example, the normal boiling points for all components
are retrieved into the array XNBP. By referring to Chapter 5, the
user will find that component data require a Class of ‘COMP’ and
that the Attribute for normal boiling point is ‘NormBoilPt’. The
Attribute is also reported to be an array of values, one for each com-
ponent in the flowsheet case. Therefore, the Item is ‘ALL’. The user
must insure that XNBP is dimensioned large enough to hold all the
data.

The example also illustrates the use of character function PAUOMS


to get a string to be used in printout. By setting the Unit of Measure
group flag to 7 prior to calling PADATR, the user has specified that
the array XNBP will contain the retrieved data in Alternate Output
units as specified on the OUTDIME statement when the PRO/II run
was executed.

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:

CLASS Class character string identifying the class of data


requested.
ATTRIB Attribute character string identifying individual data
attribute requested within the class selected.
ITEM Item character string identifying the particular data
item for which data are requested.
IBUF INTEGER*4 variable sufficiently sized to hold the
retrieved data. Either scalar variable or array
depending on the Attribute requested.
KC Integer count of data items retrieved in IBUF.
IRCODE Return code (non-zero indicates error
condition).

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:

CLASS Class character string identifying the class of data


requested.
ATTRIB Attribute character string identifying individual data
attribute requested within the class selected.
ITEM Item character string identifying the particular data
item for which data are requested.
CBUF Character type variable sufficiently sized to hold the
retrieved data. Either single string or array depending
on the Attribute requested.
KS Size in bytes of each string retrieved.
KC Integer count of the number of data items retrieved in
CBUF.
IRCODE Return code (non-zero indicates error condition).

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

3-8 PDTS Subroutines and Functions


will have the number of items retrieved, and KS will be the size of
each individual item in bytes. In this case, KS will equal 12 because
unit and stream IDs are 12 characters in length.

Retrieving Unit of Measure String


The calling sequence is:
CHARACTER*(*) FUNCTION PAUOMS ( IU, KU, IRCODE)

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:

IU Unit of measure class flag. This flag should be set by


a previous call to subroutine PADATR. If IU equals
zero, the quantity is dimensionless.
KU Unit of measure group flag.
IRCODE Return code (non-zero indicates error condition).

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.

If the velocity units on the DIME statement in the original PRO/II


keyword input file is FT/S and the velocity is 5.0, then the output to
the default output file will read:
MAXIMUM VELOCITY IN PIPE = 5.0000 FT/SEC

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.

There are no arguments.

3-10 PDTS Subroutines and Functions


Chapter 4
PDTS Example Problems

This chapter contains three PDTS example problems. In the first,


the PDTS application is used to create a custom output report for
the compressor train in a plant. The second example illustrates the
use of PDTS in retrieving column condenser and reboiler duties. In
the third example, PDTS is used to generate a tray-by-tray report of
column flowrates, densities, temperatures, pressures, and
compositions.
This chapter provides:

■ General procedures needed to build a PDTS program,


■ Step-by-step instructions for writing three complete PDTS
programs.

General Instructions for Running a PDTS Problem


You must first successfully run your simulation program by follow-
ing these steps:

1. Create your simulation input file directly by keyword input or


by using the PRO/II GUI.
2. Run your problem to obtain the three database files, i.e., run the
flowsheet with the TITLE statement keyword NEWFILE=xxxx,
where xxxx is the primary name of the PRO/II database files to
be retained.
3. For PRO/II GUI, solve the flowsheet, and then either generate
an output report or select Output/Perform Output Calculations.
Save the file with the extension .PR1.

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:

1. Create a PDTS FORTRAN main routine that will retrieve the


data required by Class, Attribute and Item, and that will print
the data to the output file in the tabular format desired.
2. Compile the PDTS FORTRAN routine and link with the
supplied PRO/II libraries.
3. Execute the PDTS application program.

Example Problem 4-1: Compressor Train


Task Description
The user is simulating a compressor train consisting of three stages
of compression. It is desired to create a table consolidating the out-
put results of all three stages.

Creating the PDTS Application Program


The key lines in the FORTRAN PDTS program are detailed in the
steps below:
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 # 1 ***’,/,
+ ‘ ENTER FILE NAME: ’)
102 FORMAT(A)
.
.
.
C ENTER FILE NAME
C
WRITE (*,101)
READ (*,102) FNAME

2. Call subroutine PAOPEN with this name to open the database


files. It is assumed that these files are located in the current
working directory. In the call to PAOPEN, supply a blank string
as argument SFPATH (i.e., it is assumed that the PRO/II support
and error files have been installed in the default directory loca-
tion). If this is not the case, supply the appropriate path string to
this routine.
C INITIALIZE RETRIEVAL SYSTEM & OPEN SELECTED FILE
C
CALL PAOPEN(FNAME,‘ ’,NFOUT,IRCODE)

4-2 PDTS Example Problems


IF (IRCODE .NE. 0) THEN
WRITE(*,205)
STOP
ENDIF
PAOPEN will return a FORTRAN unit number as variable NFOUT.
The default output has a file extension of .PDS. Check the returned
error code (IRCODE) to see if there was a problem opening the files.

Note: Because there was only a single PRO/II simulation case


run, there is no need to set up a case (i.e., routines PACASE and
PACASEL are not necessary).

3. The next subroutine call is to PAMISC. This initializes data


retrieval and returns the key flowsheet parameters. Check the
returned error code from this routine. A value of 1 indicates
that the PRO/II simulation solution was not reached.
C GET MISCELLANEOUS FLOWSHEET DATA
C
CALL PAMISC(NCOMP,NSTRM,NUNIT,IRCODE)
IF (IRCODE .NE. 0) THEN
WRITE (*,203)
STOP
ENDIF

4. The next subroutine call is to PADATC which will return an array


of 12 character strings containing the unit IDs. By referring to
Chapter 5, you can see that the Class and Attribute for this
retrieval are ‘UNIT’ and ‘IDS’ respectively. Because these data are
required for all units, the Item is ‘All’.
C GET UNIT IDS
C
CALL PADATC(‘UNIT’,‘IDS’,‘ALL’,UID,KS,KC,IER)

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

6. Then, an iterative loop is set up to cycle through all units to


select the compressor unit operations for data retrieval. To
check the unit type, keep in mind that the first four characters

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

7. Subroutine PADATR returns a unit of measure class flag (KUOM)


which is used after the loop to get the required unit of measure
strings from function PAUOMS.
C GET UNIT OF MEASURE STRINGS
C
DNTEMP = PAUOMS(ITEMP, KUOM, IERR)

4-4 PDTS Example Problems


DNPRES = PAUOMS(IPRES, KUOM, IERR)
DNWORK = PAUOMS(IWORK, KUOM, IERR)
DNDUTY = PAUOMS(IDUTY, KUOM, IERR)

8. Finally, a formatted table is printed.


C WRITE OUT TABLE
C
WRITE(NFOUT,112) (XID(I), I = 1, 3), (XNAME(I), I =1,3)
WRITE(NFOUT,114) DNPRES, (PIN(I), I = 1, 3)
WRITE(NFOUT,115) DNTEMP, (TIN(I), I = 1, 3)
WRITE(NFOUT,116) DNPRES, (POUT(I), I = 1, 3)
WRITE(NFOUT,117) DNTEMP, (TOUT(I), I = 1, 3)
WRITE(NFOUT,118) (PRAT(I), I = 1, 3)
WRITE(NFOUT,119) DNWORK, (WORK(I), I = 1, 3)
WRITE(NFOUT,120) (EFF(I), I = 1, 3)
WRITE(NFOUT,121) DNDUTY, (DUTY(I), I = 1, 3)
C
END
The complete code listing of Example 4-1 is given in Chapter 6.

The resulting output file is shown below:


DATA RETRIEVAL FROM FILE: G4
NUMBER OF COMPONENTS = 13
NUMBER OF STREAMS = 11
NUMBER OF UNITS = 6
UNITS
1 :F1 FLASH FEED FLASH
2 :C1 COMPRESSOR STAGE 1
3 :F2 FLASH STAGE 1 SEP
4 :C2 COMPRESSOR STAGE 2
5 :F3 FLASH STAGE 2 SEP
6 :C3 COMPRESSOR STAGE 3
COMPRESSOR TRAIN SUMMARY TABLE
UNIT ID C1 C2 C3
STAGE 1 STAGE 2 STAGE 3
INLET PRESSURE KPA 450.0000 1100.0000 2600.0000
INLET TEMPERATURE DEG C 45.0005 55.2281 56.8686
OUTLET PRESSURE KPA 1100.0000 2600.0000 6200.0000
OUTLET TEMPERATURE DEG C 102.6523 114.0621 121.7587
PRESSURE RATIO (OUT/IN) 2.4444 2.3636 2.3846
ACTUAL WORK KW 28051.49 28281.59 28049.77
ADIABATIC EFFICIENCY 78.0000 75.0000 72.0000
AFTERCOOLER DUTY M*KJ/HR -82.6188 -120.8522 -167.6049

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.

Creating the PDTS Application Program


The key lines in the FORTRAN PDTS program are detailed in the
steps below:

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

2. Call subroutine PAOPEN with this name to open the database


files. It is assumed that these files are located in the current
working directory. In the call to PAOPEN, supply a blank string
as argument SFPATH (i.e., it is assumed that the user has
installed the PRO/II support and error files in the default direc-
tory location). If this is not true, you must supply the appropri-
ate path string to this routine.
C INITIALIZE RETRIEVAL SYSTEM & OPEN SELECTED FILE
C
CALL PAOPEN(FNAME,‘ ’,NFOUT,IRCODE)
IF (IRCODE .NE. 0) THEN
WRITE(*,205)
STOP
ENDIF
PAOPEN will return a FORTRAN unit number as variable
NFOUT. The default output has a file extension of .PDS. You
should check the returned error code (IRCODE) to see if there
was a problem opening the files.

3. Next, call PACASL to get an array containing the case study


IDs.

4-6 PDTS Example Problems


C GET ARRAY OF CASE IDS
C
CALL PACASL(MXN,KXN,CASE,IRCODE)
NXN = MIN(MXN,KXN)
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 and the
target stream to be stream 1.
C SET UNIT OF MEASURE AS DEFAULT INPUT UNITS
C
UOM = 0
C
C TARGET CASE ID IS D101
C FEED STREAM IS ‘1’
C
UID = ‘D101’
SID = ‘1’

4. Set up each case study by calling PACASE in an iterative loop.


C SET UP EACH CASE
C
DO 3001 KX = 1, NXN
WRITE(*,105) CASE(KX)
CALL PACASE(CASE(KX),IRCODE)

5. The next subroutine call is to PAMISC. This will initialize the


data retrieval process and return the key flowsheet parameters.
You should check the returned error code from this routine. A
value of 1 indicates that the PRO/II simulation solution was not
reached.
C GET MISCELLANEOUS FLOWSHEET DATA
C
CALL PAMISC(NCOMP,NSTRM,NUNIT,IRCODE)
IF (IRCODE .NE. 0) THEN
WRITE (*,203)
STOP
ENDIF

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

9. Subroutine PADATR returns a unit of measure class flag (KUOM)


which is used after the loop to get the required unit of measure
strings from function PAUOMS.
C GET UNIT OF MEASURE STRINGS
C
DNFLOW = PAUOMS(IFLOW, KUOM, IERR)
DNDUTY = PAUOMS(IDUTY, KUOM, IERR)

10. Finally, a formatted table of stream flowrates and column con-


denser and reboiler duties is printed.
C WRITE OUT TABLE
C
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
The complete listing of Example 4-2 is given in Chapter 6.

The resulting output file is shown below:


DATA RETRIEVAL FROM FILE: G2TEST
COLUMN CASE STUDY SUMMARY TABLE

UNIT ID D101 DEETHANIZER

CASE ID BASE CASE1 CASE2 CASE3


FEED FLOW RATE LB-MOL/HR 900.0 950.0 1000.0 1050.0
CONDENSER DUTY MM BTU/HR -1.4724 -1.5542 -1.6360 -1.7179
REBOILER DUTY MM BTU/HR 5.4934 5.7982 6.1031 6.4085

4-8 PDTS Example Problems


Example Problem 4-3: Trayed Column
Task Description
You have used the PRO/II program to rate a trayed column. Your
objective is to obtain tray-by-tray results for the column.

Creating the PDTS Application Program


The key lines in the FORTRAN PDTS program are detailed in the
steps below:

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

2. Call subroutine PAOPEN with this name to open the database


files. It is assumed that these files are located in the current
working directory. In the call to PAOPEN, supply a blank string
as argument SFPATH (i.e., it is assumed that the user has
installed the PRO/II support and error files in the default direc-
tory location). If this is not true, you must supply the appropri-
ate path string to this routine.
C INITIALIZE RETRIEVAL SYSTEM & OPEN SELECTED FILE
C
CALL PAOPEN(FNAME,‘ ’,NFOUT,IRCODE)
IF (IRCODE .NE. 0) THEN
WRITE(*,205)
STOP
ENDIF
PAOPEN will return a FORTRAN unit number as variable
NFOUT. The default output has a file extension of .PDS . Check
the returned error code (IRCODE) to see if there was a problem
opening the files.

3. The next subroutine call is to PAMISC. This initializes the data


retrieval process and returns the key flowsheet parameters.
Check the returned error code from this routine. A value of 1
indicates that the PRO/II simulation solution was not reached.

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)

5. The next step is to obtain the total number of trays in column


D101 by calling routine PADATI. In this call, the Class and
Attribute are ‘Colu’ and ‘NumberOfTrays’. Because these data are
required for this unit only, the Item is the UID.
C GET NUMBER OF TRAYS
C
CALL PADATI(‘Colu’,‘NumberOfTrays’,UID,NTRAY,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.

4-10 PDTS Example Problems


C GET COLUMN TRAY BY TRAY TEMPERATURE & PRESSURE
C
CALL PADATR(‘Colu’,‘TrayPressures’,UID,PRES,KC,KUOM,
+ IPRES,IER)
C
CALL PADATR(‘Colu’,‘TrayTemperatures’,UID,TEMP,
+ KC,KUOM,ITEMP,IER)
Similar calls are made to PADATR for tray liquid and vapor net
rates, densities and compositions.
C GET COLUMN TRAY BY TRAY NET LIQUID & NET VAPOR RATES
C
CALL PADATR(‘Colu’,‘TrayNetVapRates’,UID,XVNET,KC,
+ KUOM,IFLOW,IER)
C
CALL PADATR(‘Colu’,‘TrayNetLiqRates’,UID,XLNET,KC,
+ KUOM,IUOM,IER)
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)

7. Subroutine PADATR returns a unit of measure class flag (KUOM)


which is used to get the required unit of measure strings from
function PAUOMS.
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)

8. Finally, a formatted table of column pressures, temperatures,


vapor and liquid net flows, densities, and compositions is
printed for each tray.
C WRITE OUT TABLE
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)

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.

The resulting output file is shown below:


DATA
COLUMN REPORT TABLE - UID: D101 - DEETHANIZER
RETRIEVAL FROM FILE: G2
TRAY NUMBER: 1 2 3 4 5
PRESSURE: PSIG 425.00 430.00 430.56 431.11 431.67
TEMPERATURE: F -36.17 -7.76 1.48 8.68 16.03
NET VAPOR RATE: LB-MOL/HR 577.51 895.93 893.19 873.23 849.74
NET LIQUID RATE: LB-MOL/HR 318.42 315.68 295.72 272.23 252.93
VAPOR DENSITY: LB/FT3 2.5736 2.7621 2.7713 2.7321 2.6887
LIQUID DENSITY: LB/GAL 3.5009 3.4764 3.5251 3.5979 3.6651
VAPOR PHASE COMPOSITION
N2 0.0005 0.0003 0.0003 0.0003 0.0003
C1 0.6949 0.5418 0.5137 0.5149 0.5220
C2 0.3017 0.4462 0.4604 0.4391 0.4076
C3 0.0030 0.0117 0.0256 0.0456 0.0700
IC4 0.0000 0.0000 0.0000 0.0000 0.0001
NC4 0.0000 0.0000 0.0000 0.0000 0.0000
IC5 0.0000 0.0000 0.0000 0.0000 0.0000
NC5 0.0000 0.0000 0.0000 0.0000 0.0000
NC6 0.0000 0.0000 0.0000 0.0000 0.0000
NC7 0.0000 0.0000 0.0000 0.0000 0.0000
LIQUID PHASE COMPOSITION
N2 0.0001 0.0000 0.0000 0.0000 0.0000
C1 0.2641 0.1822 0.1635 0.1551 0.1491
C2 0.7082 0.7508 0.7075 0.6325 0.5504
C3 0.0276 0.0669 0.1290 0.2122 0.2997
IC4 0.0000 0.0000 0.0000 0.0002 0.0006
NC4 0.0000 0.0000 0.0000 0.0001 0.0002
IC5 0.0000 0.0000 0.0000 0.0000 0.0000
NC5 0.0000 0.0000 0.0000 0.0000 0.0000
NC6 0.0000 0.0000 0.0000 0.0000 0.0000
NC7 0.0000 0.0000 0.0000 0.0000 0.0000
TRAY NUMBER: 6 7 8 9 10
PRESSURE: PSIG 432.22 432.78 433.33 433.89 434.44
TEMPERATURE: F 22.56 27.54 31.27 35.16 71.79

4-12 PDTS Example Problems


NET VAPOR RATE: LB-MOL/HR 830.44 817.35 808.30 798.65 511.33
NET LIQUID RATE: LB-MOL/HR 239.84 230.80 221.14 206.42 1060.44
VAPOR DENSITY: LB/FT3 2.6572 2.6381 2.6232 2.5967 2.8172
LIQUID DENSITY: LB/GAL 3.7128 3.7444 3.7732 3.8300 3.9247

VAPOR PHASE COMPOSITION


N2 0.0003 0.0003 0.0003 0.0003 0.0001
C1 0.5287 0.5335 0.5370 0.5412 0.3733
C2 0.3774 0.3544 0.3393 0.3295 0.4417
C3 0.0933 0.1110 0.1212 0.1233 0.1638
IC4 0.0002 0.0005 0.0014 0.0033 0.0099
NC4 0.0001 0.0002 0.0007 0.0022 0.0083
IC5 0.0000 0.0000 0.0000 0.0002 0.0013
NC5 0.0000 0.0000 0.0000 0.0001 0.0008
NC6 0.0000 0.0000 0.0000 0.0000 0.0006
NC7 0.0000 0.0000 0.0000 0.0000 0.0002
LIQUID PHASE COMPOSITION
N2 0.0000 0.0000 0.0000 0.0000 0.0000
C1 0.1448 0.1419 0.1397 0.1368 0.0838
C2 0.4815 0.4334 0.4020 0.3779 0.3789
C3 0.3711 0.4172 0.4377 0.4284 0.3711
IC4 0.0018 0.0048 0.0118 0.0268 0.0473
NC4 0.0008 0.0026 0.0079 0.0223 0.0494
IC5 0.0000 0.0001 0.0005 0.0035 0.0160
NC5 0.0000 0.0000 0.0003 0.0021 0.0110
NC6 0.0000 0.0000 0.0001 0.0016 0.0262
NC7 0.0000 0.0000 0.0000 0.0004 0.0165

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

4-14 PDTS Example Problems


TRAY NUMBER: 16 17 18 19 20
PRESSURE: PSIG 437.78 438.33 438.89 439.44 440.00
TEMPERATURE: F 180.58 187.85 196.02 208.51 234.90
NET VAPOR RATE: LB-MOL/HR 1184.31 1220.84 1237.29 1212.62 1093.70
NET LIQUID RATE: LB-MOL/HR 1543.34 1559.78 1535.11 1416.19 322.49
VAPOR DENSITY: LB/FT3 4.6057 4.7222 4.8072 4.8398 4.7735
LIQUID DENSITY: LB/GAL 3.4050 3.3862 3.3854 3.4237 3.5374
VAPOR PHASE COMPOSITION
N2 0.0000 0.0000 0.0000 0.0000 0.0000
C1 0.0004 0.0001 0.0000 0.0000 0.0000
C2 0.1576 0.1084 0.0723 0.0464 0.0276
C3 0.7441 0.7736 0.7790 0.7548 0.6856
IC4 0.0447 0.0540 0.0669 0.0841 0.1041
NC4 0.0372 0.0452 0.0575 0.0764 0.1026
IC5 0.0063 0.0074 0.0098 0.0150 0.0262
NC5 0.0040 0.0047 0.0061 0.0095 0.0170
NC6 0.0043 0.0049 0.0062 0.0103 0.0260
NC7 0.0016 0.0018 0.0022 0.0035 0.0110
LIQUID PHASE COMPOSITION
N2 0.0000 0.0000 0.0000 0.0000 0.0000
C1 0.0001 0.0000 0.0000 0.0000 0.0000
C2 0.0885 0.0601 0.0394 0.0243 0.0132
C3 0.7221 0.7270 0.7070 0.6496 0.5274
IC4 0.0670 0.0771 0.0908 0.1068 0.1161
NC4 0.0625 0.0722 0.0873 0.1085 0.1284
IC5 0.0157 0.0175 0.0217 0.0309 0.0469
NC5 0.0105 0.0116 0.0143 0.0205 0.0324
NC6 0.0211 0.0220 0.0255 0.0389 0.0826
NC7 0.0125 0.0127 0.0139 0.0205 0.0530

PRO/II Data Transfer System and User-Added Subroutines User’s Guide 4-15
Chapter 5
Attribute Lists

Class and Attribute names must be entered exactly as shown. As


strings, they must be enclosed in single quotes. Observe rules of
case sensitivity.

Attribute Class See page...


Calculator Calc 5-21
Column/Side Colu or Side 5-16
Component Data COMPS 5-2
Compressor Compressor 5-6
Conversion Reactor ConReactor 5-22
CSTR Cstr 5-23
Equilibrium Reactor EquReactor 5-21
Expander Expander 5-6
Flash Flash 5-5
Gibbs Reactor Gibbs 5-25
HCURVE HCurve 5-19
HX Hx 5-9
HXRIG HxRig 5-10
LLEX Llex or Colu 5-18
LNGHX LngHx 5-14
Phase Envelope Phase 5-20
Pipe Pipe 5-7
Plug Flow Reactor Plug 5-24
Pump Pump 5-7
Shortcut Short 5-15
Stream Data STREAM 5-3
Unit Data UNIT 5-4
User-Added Unit Operations User 5-25
Valve Valve 5-5

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)

Item Description Variable Array/ Units Notes


Type Scalar
‘AcenFactor’ Acentric factor Real Array
‘ApiGravity’ API gravity Real Array
‘CritCompress’ Critical compressibility Real Array
‘CritPres’ Critical pressure Real Array Pressure
‘CritTemp’ Critical temperature Real Array Temperature
‘CritVol’ Critical volume Real Array Spec. Volume
‘IDS’ IDs of components Character Array 16 Chars
‘LibraryNumber’ Component library number Integer Array
‘MolWeight’ Molecular weight Real Array
‘NormBoilPt’ Normal boiling point Real Array Temperature
‘SpecGravity’ Specific gravity Real Array
‘StdFreEnForm’ Standard free energy of formation Real Array Energy
‘StdHeatForm’ Standard heat of formation Real Array Energy
‘StdLiqDens’ Standard liquid density Real Array Liq. Density

5-2 Attribute Lists


Stream Data
Class: ‘STREAM’

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.

5-4 Attribute Lists


Flash
Class: ‘Flash’

Item Description Variable Array/ Units Notes


Type Scalar
‘DutyCalc’ Calculated flash duty Real Scalar Duty 1
‘KValues’ K-values Real Array 2
‘PresCalc’ Calculated flash pressure Real Scalar Pressure
‘TempCalc’ Calculated flash temperature Real Scalar Temperature
Notes:
1) Duty has units 106 Energy/Time
2) Count = number of components

Valve
Class: ‘Valve’

Item Description Variable Array/ Units Notes


Type Scalar
‘KValues’ K-values Real Array 1
‘PresCalc’ Calculated valve pressure Real Scalar Pressure
‘TempCalc’ Calculated valve temperature Real Scalar Temperature
Notes:
1) Count = number of components

PRO/II Data Transfer System and User-Added Subroutines User’s Guide 5-5
Compressor
Class: ‘Compressor’

Item Description Variable Array/ Units Notes


Type Scalar
‘AcDutyCalc’ Calculated aftercooler duty Real Scalar Duty 1
‘AcPresDropCalc’ Calculated aftercooler pressure drop Real Scalar Pres Diff.
‘AcTempCalc’ Calculated aftercooler temperature Real Scalar Temperature
‘EffAdiaCalc’ Calculated adiabatic efficiency Real Scalar Percent
‘EffPolyCalc’ Calculated polytropic efficiency Real Scalar Percent
‘IsenCoeffCalc’ Calculated isentropic coefficient Real Scalar
‘PolyCoeffCalc’ Calculated polytropic coefficient Real Scalar
‘PRatio’ Pressure ratio (outlet/inlet) Real Scalar
‘PresCalc’ Calculated compressor pressure Real Scalar Pressure
‘PresInletCalc’ Calculated inlet pressure Real Scalar Pressure
‘PresIsenCalc’ Calculated isentropic pressure Real Scalar Pressure
‘RPMCalc’ Calculated compressor RPM Real Scalar RPM
‘TempCalc’ Calculated compressor temperature Real Scalar Temperature
‘TempInletCalc’ Calculated inlet temperature Real Scalar Temperature
‘TempIsenCalc’ Calculated isentropic temperature Real Scalar Temperature
‘WorkActualCalc’ Calculated actual compressor work Real Scalar Work
‘WorkPolyCalc’ Calculated polytropic compressor work Real Scalar Work
‘WorkTheoCalc’ Calculated theoretical compressor work Real Scalar Work
Notes:
1) Duty has units 106 Energy/Time

Expander
Class: ‘Expander’

Item Description Variable Array/ Units Notes


Type Scalar
‘EffAdiaCalc’ Calculated expander adiabatic efficiency Real Scalar Percent
‘IsenCoeffCalc’ Calculated expander isentropic coefficient Real Scalar RPM
‘PresCalc’ Calculated expander pressure Real Scalar Pressure
‘PresInletCalc’ Calculated expander inlet pressure Real Scalar Pressure
‘PresIsenCalc’ Calculated isentropic pressure Real Scalar Pressure
‘RPMCalc’ Calculated expander RPM Real Scalar
‘TempCalc’ Calculated expander temperature Real Scalar Temperature
‘TempInletCalc’ Calculated expander inlet temperature Real Scalar Temperature
‘TempIsenCalc’ Calculated isentropic temperature Real Scalar Temperature
‘WorkActualCalc’ Calculated actual expander work Real Scalar Work
‘WorkTheoCalc’ Calculated theoretical expander work Real Scalar Work

5-6 Attribute Lists


Pump
Class: ‘Pump’

Item Description Variable Array/ Units Notes


Type Scalar
‘EffCalc’ Calculated pump efficiency Real Scalar Percent
‘PresCalc’ Calculated pump pressure Real Scalar Pressure
‘TempCalc’ Calculated pump temperature Real Scalar Temperature
‘WorkCalc’ Calculated pump work Real Scalar Work

Pipe
Class: ‘Pipe’

Item Description Variable Array/ Units Notes


Type Scalar
‘AbsRoughness’ Absolute pipe roughness Real Scalar Fine Length
‘AvgFricFactor’ Average pipe friction factor Real Scalar
‘AvgReynoldsNumb’ Average Reynolds number Real Scalar
‘AvgVelocityInlet’ Average velocity of inlet fluid Real Scalar Velocity
‘AvgVelocityOutlet’ Average velocity of outlet fluid Real Scalar Velocity
‘CalcDeltaPres’ Calculated pipe pressure drop Real Scalar Pres. Diff.
‘CalcMaxVelocity’ Calculated pipe maximum velocity Real Scalar Velocity
‘DeltaPresAccel’ Pipe pressure drop due to acceleration Real Scalar Pres. Diff
‘DeltaPresElevn’ Pipe pressure drop due to elevation Real Scalar Pres. Diff
‘DeltaPresFric’ Pipe pressure drop due to friction Real Scalar Pres. Diff
‘FittingDeltaPres’ Pressure drop across pipe fittings Real Scalar Pres. Diff.
‘FittingKFactor’ K-factor of pipe fittings Real Scalar
‘FlowRegimeInlet’ Flow regime at inlet conditions Integer Scalar 2
‘FlowRegimeOutlet’ Flow regime at outlet conditions Integer Scalar 2
‘FricFactorInlet’ Friction factor at pipe inlet Real Scalar
‘FricFactorOutlet’ Friction factor at pipe outlet Real Scalar
‘HeatDuty’ Pipe heat duty Real Scalar Duty 4
‘HeatTransCoeff’ Heat transfer coefficient Real Scalar Heat Tr. Coeff.
‘InsideDiameter’ Pipe inside diameter Real Scalar Fine Length
‘LineDeltaPres’ Pressure drop across pipeline segment Real Scalar Pres. Diff.
‘LineFlowEffic’ Flow efficiency of pipeline segment Real Scalar Percent
‘LineFricFactor’ Friction factor of pipeline segment Real Scalar
‘LineLength’ Length of pipeline segment Real Scalar Length
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-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

5-8 Attribute Lists


HX
Class: ‘Hx’

Item Description Variable Array/ Units Notes


Type Scalar
‘AreaCalc’ Heat exchanger area Real Scalar Area
‘ColdDeltaP’ Pres. drop across exchanger coldside Real Scalar Pres. Diff.
‘ColdFeedTempCalc’ Temperature of feed to coldside Real Scalar Temperature
‘ColdKValues’ K-values on coldside Real Scalar 6
‘ColdProdTempCalc’ Temperature of product from coldside Real Scalar Temperature
‘DutyCalc’ Heat exchanger duty Real Scalar Duty 7
‘ExchAttachColu’ Col. ID for attached exchanger Character Scalar 12 Characters
‘ExchAttachFlag’ Attached exchanger flag Integer Scalar 4
‘ExchSideFlag’ Flag indicating side with utility Integer Scalar 2
‘ExchTypeFlag’ Type of heat exchanger Integer Scalar 1
‘ExchUtilComp’ Component name for utility Character Scalar 16 Characters
‘ExchUtilFlag’ Type of utility Integer Scalar
‘ExhcAttachTray’ Col. tray number for attached exchanger Integer Scalar 5
‘HotDeltaP’ Pres. drop across exchanger hotside Real Scalar Pres. Diff.
‘HotFeedTempCalc’ Temperature of feed to hotside Real Scalar Temperature
‘HotKValues’ K-values on hotside Real Scalar 6
‘HotProdTempCalc’ Temperature of product from hotside Real Scalar Temperature
‘LMTDFactorCalc’ Calculated LMTD correction factor (FT) Real Scalar
‘MTDCalc’ Mean temperature difference Real Scalar Temp. Diff.
‘NumberColdFeeds’ Number of feed streams to coldside Integer Scalar
‘NumberColdProds’ Number of product streams from coldside Integer Scalar
‘NumberHotFeeds’ Number of feed streams to hotside Integer Scalar
‘NumberHotProds’ Number of product streams from hotside Integer Scalar
‘NumberShellPasses’ Number of shell passes Real Scalar
‘NumberTubePasses’ Number of tube passes Real Scalar
‘UACalc’ Heat exchanger U*A Real Scalar U*A
‘UValueCalc’ Heat exchanger U-value Real Scalar Ht. Trans. Coeff.
Notes:
1) Exchanger type flag
0 - Simple HX 1 - Utility on one side (See Note 3) 2 - Attached exchanger
2) Exchanger side flag - Indicates which side is attached
1 - hot side 2 - cold side
3) Exchanger utility flag - Use to determine what type utility is present
1 - Water 2 - Air 3 - Steam
4 - Heating medium - Use ‘ExchUtilComp’ to get component ID
5 - Refrigerant - Use ‘ExchUtilComp’ to get component ID
4) Attached exchanger flag - Indicates type of attachment
1 - Condenser 2 - Reboiler 3 - Pumparound 4 - Side Heater or Cooler
5) Tray number in column where attached - Use ‘ExchAttachColu’ to get column unit ID
6) Count = number of components
7) Duty has units 106 Energy/Time

PRO/II Data Transfer System and User-Added Subroutines User’s Guide 5-9
HXRIG
Class: ‘HxRig’

Item Description Variable Array/ Units Notes


Type Scalar
‘AreaCalc’ Calculated area of exchanger Real Scalar Area
‘AreaRequired’ Heat exchanger area required Real Scalar Area
‘AttachSideFlag’ Flag indicating exchanger side attachedInteger Scalar 5
‘AttachTrayFlag’ Flag indicating column tray attached Integer Scalar 7
‘AttachTypeFlag’ Flag indicating type of attachment Integer Scalar 6
‘AttachUnit’ ID of unit attached to exchanger Character Scalar
‘BaffleCutFrac’ Baffle cut ratio Real Scalar
‘BaffleSpc’ Baffle spacing Real Scalar Fine Length
‘BaffleThck’ Baffle thickness Real Scalar Fine Length
‘ExchHtDuty’ Duty of rigorous heat exchanger Real Scalar Duty *
‘FinEffcyCalc’ Calculated fin efficiency Real Scalar Percent
‘FinHgt’ Height of fin Real Scalar Fine Length
‘FinMatCode’ Fin material code Integer Scalar 4
‘FinRootDia’ Root diameter of fin Real Scalar Fine Length
‘FinsPerInch’ Number of fins per inch Real Scalar
‘FinThck’ Thickness of fin Real Scalar Fine Length
‘FinThermCond’ Thermal conductivity of fin Real Scalar Thermal Cond.
‘FlowTypeFlag’ Shell-tube flow direction flag Integer Scalar 2
‘FtFactor’ LMTD correction factor Real Scalar
‘InletBaffleSpc’ Inlet baffle spacing Real Scalar Fine Length
‘MaxAreaPerShell’ Maximum area per shell Real Scalar Area
‘MeanTempDiff’ Mean temperature difference Real Scalar Temp. Diff.
‘NumberShellFeeds’ Number of feeds to shellside Integer Scalar
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

5-10 Attribute Lists


Item Description Variable Array/ Units Notes
Type Scalar
‘NumberShellProds’ Number of products from shellside Integer Scalar
‘NumberTubeFeeds’ Number of feeds to tubeside Integer Scalar
‘NumberTubeProds’ Number of products from tubeside Integer Scalar
‘NumOfParShells’ Number of shells in parallel Integer Scalar
‘NumOfSerShells’ Number of shells in series Integer Scalar
‘NumOfTubePasses’ Number of tube passes per shell er Scalar
‘NumOfTubes’ Number of tubes Integer Scalar
‘OutletBaffleSpc’ Outlet baffle spacing Real Scalar Fine Length
‘PositionFlag’ Orientation of exchanger Integer Scalar 1
‘ShellFilmCoeff’ Film coefficient of shellside Real Scalar Heat Trans. Coeff.
‘ShellFilmCoeffSclFct’ Shellside film coefficient scaling factor Real Scalar
‘ShellFoulFct’ Fouling factor of shellside Real Scalar Foul Factor
‘ShellFoulLayerThck’ Thickness of shellside fouling layer Real Scalar Fine Length
‘ShellFoulRqrd’ Shellside required fouling resistance Real Scalar Foul Factor
‘ShellID’ Inside diameter of shell Real Scalar Fine Length
‘ShellMatCode’ Shell material code Integer Scalar 4
‘ShellMatDens’ Density of shell material Real Scalar Density
‘ShellNozzleInletID’ Inside diameter of shell nozzle inlet Real Scalar Fine Length
‘ShellNozzleOutletID’ Inside diameter of shell nozzle outlet Real Scalar Fine Length
‘ShellOrigFoul’ Shellside specified fouling resistance Real Scalar Foul Factor
‘ShellPresDropCalc’ Calculated pressure drop across shell Real Scalar Pres. Diff.
‘ShellPrnNum’ Prandlt number on shellside Real Scalar
‘ShellReyNum’ Reynolds number on shellside Real Scalar
‘ShellTempIn’ Inlet temperature of shellside fluid Real Scalar Temperature
‘ShellTempOut’ Outlet temperature on shellside Real Scalar Temperature
‘ShellVel’ Fluid velocity in shellside Real Scalar Velocity
‘TEMAType’ TEMA shell type Character Scalar 3 Characters
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-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

5-12 Attribute Lists


Item Description Variable Array/ Units Notes
Type Scalar
‘UAVal’ U*A value Real Scalar U*A
‘UnitAreaPerShell’ Unit area per shell Real Scalar
‘UValCalc’ Calculated U-value Real Scalar Ht. Trans. Coeff.
‘UValFoul’ U-value with fouling factor Real Scalar Ht. Trans. Coeff.
‘UValNoFoul’ U-value without fouling Real Scalar Ht. Trans. Coeff.
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’

Item Description Variable Array/ Units Notes


Type Scalar
‘CellDutyCalc’ Calculated cell duty Real Scalar Duty 1, 3
‘CellInletPresCalc’ Calculated inlet cell pressures Real Array Pressure 1
‘CellInletTempCalc’ Calculated inlet cell temperatures Real Array Temperature 1
‘CellOutletPresCalc’ Calculated outlet cell pressures Real Array Pressure 1
‘CellOutletTempCalc’ Calculated outlet cell temperatures Real Array Temperature 1
‘CellType’ Cell type Integer Array 1, 2
‘NumberColdFeeds’ Number of feeds on coldside Integer Scalar
‘NumberHotFeeds’ Number of feeds on hotside Integer Scalar
‘NumberOfCells’ Number of cells Integer Scalar
‘OverallDuty’ Overall calculated duty Real Scalar Duty *
‘ZoneLMTD’ Calculated LMTD for zones Real Scalar Temp. Diff.
‘ZoneMITA’ MITA for zones Real Scalar Temp. Diff.
‘ZoneUA’ Calculated U*A for zones Real Scalar U*A
Notes:
1) Count = number of cells
2) Array of integer flags for each cell (1 = hot cell, 2 = cold cell)
3) Duty has units 106 Energy/Time

5-14 Attribute Lists


Shortcut
Class: ‘Short’

Item Description Variable Array/ Units Notes


Type Scalar
‘CondDuty’ Condenser duty Real Array 4
‘CondenserType’ Condenser type flag Integer Scalar 1
‘FeedQuality’ Slope (Q) of feed quality line Real Scalar
‘FeedTrays’ Number of feed trays Real Array 4
‘FenskeIndex’ Calculated Fenske index Real Array 3
‘HvyKeyComponent’ Heavy key component ID Character Scalar
‘LtKeyComponent’ Light key component ID Character Scalar
‘MinimumReflux’ Minimum reflux ratio Real Scalar
‘MinimumTrays’ Minimum trays for total reflux Real Scalar
‘MMMin’ Ratio of number of trays to minimum Real Array 4
‘NumberOfSections’ Number of column sections Integer Scalar
‘ReboilDuty’ Reboiler duty Real Array 4
‘RefluxRatio’ Calculated reflux ratio Real Array 4
‘RRMin’ Minimum reflux ratio Real Array 4
‘TotalTrays’ Total number of trays Real Array 4
‘UnderwoodCalcFlag’ Underwood calculation flag Integer Scalar 2
Notes:
1) Flag indicating condenser type (see Fig. 78.2 in the PRO/II Keyword Manual)
0 - None 1 - Partial 2 - Mixed
3 - Bubble point 4 - Temperature fixed 5 - Delta T below bubble point
2 Indicator flag for availability of Underwood/Fenske/Gilliland table data
0 - No 1 - Yes
3 Count = number of sections
4 Underwood/Fenske/Gilliland data table (count = 5 points for each item)

PRO/II Data Transfer System and User-Added Subroutines User’s Guide 5-15
Column/Side
Class: ‘Colu’ or ‘Side’

Item Description Variable Type Units Notes


‘AlgorithmType’ Column algorithm type Integer Scalar 1
‘CondenserDuty’ Condenser duty Real Scalar Duty *
‘CondenserType’ Condenser type Integer Scalar 2
‘DecantDrawRate’ Flowrate of decant draw Real Array 8
‘DecantTrays’ Decant tray locations Integer Array 8
‘DrawPhase’ Phase of stream from draw tray Integer Array 7
‘DrawTrays’ Draw tray locations Integer Array 6
‘FeedTrays’ Feed tray locations Integer Array 5
‘HeaterDuties’ Duties of side heaters/coolers Real Array Duty * 9
‘HeaterTrays’ Heater/Cooler tray locations Integer Array 9
‘HvyKeyComponents’ Heavy key components Integer Array 4
‘LtKeyComponents’ Light key components Integer Array 4
‘NumberDecantTrays’ Number of decant trays Integer Scalar
‘NumberDrawTrays’ Number of draw trays Integer Scalar
‘NumberFeedTrays’ Number of feed trays Integer Scalar
‘NumberOfHeaters’ Number of side heaters/coolers Integer Scalar
‘NumberOfPumpArounds’ Number of pumparounds Integer Scalar
‘NumberOfTrays’ Total number of trays Integer Scalar
‘PumpAroundPhase’ Phase of pumparound stream Integer Array 11
‘PumpAroundRate’ Flowrate of pumparound stream Real Array 10
‘PumpAroundTrayFrom’ Pumparound tray location (from) Integer Array 10
‘PumpAroundTrayTo’ Pumparound tray location (to) Integer Array 10
‘QLossData’ Heat loss per tray Real Array Duty * 12
‘QLossTotal’ Total heat loss Real Scalar Duty *
‘ReboilerDuty’ Reboiler duty Real Scalar Duty *
‘ReboilerType’ Reboiler type Integer Scalar 3
‘TrayLiqDensityAct’ Actual density of liquid on each tray Real Array Density 13
Notes:
1) Algorithm type flag:
1 - I/O 2 - SURE 3 - CHEMDIST
4 - LLEX 5 - REACTIVE DISTILLATION 6 - ELECTROLYTIC DISTILLATION
2) Flag indicating condenser type (see Fig. 71.2 in Keyword Manual)
0 - None 1 - Partial 2 - Mixed
3 - Bubble point 4 - Temperature fixed 5 - Delta T below bubble point
3) Flag indicating reboiler type
0 - None 1 - Both feed & heater on bottom tray
2 - Conventional reboiler 3 - Thermosiphon reboiler without baffles
4 - Thermosiphon reboiler with baffles
4) Key components are arrays of 2 key component numbers
5) Array of tray locations for each feed tray (count = number of feed trays)
6) Array of tray locations for each prod. draw including ovhd & btms products, but not including water draws (count = no. of draw trays)
7) Array of flags for each product draw (1 = liquid, 2 = vapor)
8) Array of tray locations for each water decant draw tray (count = number of decant trays)
9) Array of duties for all heaters/coolers (count = number of heaters)
10) Array of pumparound tray locations (count = Number of Pumparounds)
11) Array of flags for each pumparound indicating phase drawn from tray (1 = liquid, 2 = vapor)
12) Array of duties indicating heat leak (count = number of heat leaks)
13) Array with count = number of trays
14) Array equivalent to a two-dimensional array - (number of components) x (number of trays)
15) Duty has units 106 Energy/Time

5-16 Attribute Lists


Item Description Variable Type Units Notes
‘TrayLiqEnthalpy’ Molar enthalpy of liquid on each tray Real Array Molar Enthalpy 13
‘TrayLiqEntropy’ Molar entropy of liquid on each tray Real Array Molar Entropy 13
‘TrayLiqMolecWeight’ MW of liquid on each tray Real Array 13
‘TrayLiqSpecGravity’ Specific gravity of liquid on each tray Real Array 13
‘TrayLiqSurfTens’ Surface tension of liquid on each tray Real Array Surface Tension 13
‘TrayLiqThermalCond’ Thermal cond. of liquid on each tray Real Array Thermal Cond. 13
‘TrayLiquidMoleFracs’ Liquid mole fract. of fluid on each tray Real Array 14
‘TrayLiqViscosity’ Viscosity of liquid on each tray Real Array Viscosity 13
‘TrayLiqVolumeRateAct’ Actual vol. liq. flowrate on each tray Real Array Liq. Vol. Rate 13
‘TrayLiqVolumeRateStd’ STD vol flowrate of liquid on each tray Real Array Liq. Vol. Rate 13
‘TrayLiqWeightRate’ Flowrate (WT) of liquid on each tray Real Array Weight Rate 13
‘TrayNetLiqRates’ Flowrate of net liquid from each tray Real Array Mole Rate 13
‘TrayNetVapRates’ Flowrate of net vapor from each tray Real Array Mole Rate 13
‘TrayPressures’ Tray pressures Real Array Pressure 13
‘TrayTemperatures’ Tray temperatures Real Array Temperature 13
‘TrayTotalLiqRates’ Flowrate of total liquid on each tray Real Array Mole Rate 13
‘TrayTotalVapRates’ Flowrate of total vapor on each tray Real Array Mole Rate 13
‘TrayVapDensityAct’ Actual density of vapor on a tray Real Array Density 13
‘TrayVapEnthalpy’ Molar enthalpy of vapor on each tray Real Array Molar Enthalpy 13
‘TrayVapEntropy’ Molar entropy of vapor on each tray Real Array Molar Entropy 13
‘TrayVapMolecWeight’ MW of vapor on each tray Real Array 13
‘TrayVaporMoleFracs’ Vapor mole fract. of fluid on each tray Real Array 14
‘TrayVapThermalCond’ Thermal cond. of vapor on each tray Real Array Thermal Cond. 13
‘TrayVapViscosity’ Viscosity of vapor on each tray Real Array Viscosity 13
‘TrayVapVolumeRateAct’ Actual vol. vapor flowrate on each tray Real Array Vap. Vol. Rate 13
‘TrayVapVolumeRateStd’ STD vol. vapor flowrate r on each tray Real Array Vap. Vol. Rate 13
‘TrayVapWeightRate’ Flowrate (WT) of vapor on each tray Real Array Weight Rate 13
‘TrayVleKValues’ Vapor-liquid tray K-values Real Array 14
Notes:
1) Algorithm type flag:
1 - I/O 2 - SURE 3 - CHEMDIST
4 - LLEX 5 - REACTIVE DISTILLATION 6 - ELECTROLYTIC DISTILLATION
2) Flag indicating condenser type (see Fig. 71.2 in Keyword Manual)
0 - None 1 - Partial 2 - Mixed
3 - Bubble point 4 - Temperature fixed 5 - Delta T below bubble point
3) Flag indicating reboiler type
0 - None 1 - Both feed & heater on bottom tray
2 - Conventional reboiler 3 - Thermosiphon reboiler without baffles
4 - Thermosiphon reboiler with baffles
4) Key components are arrays of 2 key component numbers
5) Array of tray locations for each feed tray (count = number of feed trays)
6) Array of tray locations for each prod. draw including ovhd & btms products, but not including water draws (count = no. of draw trays)
7) Array of flags for each product draw (1 = liquid, 2 = vapor)
8) Array of tray locations for each water decant draw tray (count = number of decant trays)
9) Array of duties for all heaters/coolers (count = number of heaters)
10) Array of pumparound tray locations (count = Number of Pumparounds)
11) Array of flags for each pumparound indicating phase drawn from tray (1 = liquid, 2 = vapor)
12) Array of duties indicating heat leak (count = number of heat leaks)
13) Array with count = number of trays
14) Array equivalent to a two-dimensional array - (number of components) x (number of trays)
15) Duty has units 106 Energy/Time

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

5-18 Attribute Lists


HCurve
Class: ‘HCurve’

Item Description Variable Array/ Units Notes


Type Scalar
‘ActDensLiquid’ Actual density of liquid phase Real Array Density 5
‘ActDensVapor’ Actual density of vapor phase Real Array Density 5
‘BubblePointindices’ Indices of Bubble Points Integer Array
‘CpLiquid’ CP of liquid Real Array Sp. Heat (Wt.)
‘CpVapor’ CP of vapor Real Array Sp. Heat (Wt.)
‘DewPointindices’ Indices of Dew Points Integer Array
‘EnthalpyDecant’ Enthalpy of decanted phase Real Array Duty 5, 6
‘EnthalpyLiquid’ Enthalpy of liquid phase Real Array Duty 5, 6
‘EnthalpyTotal’ Total enthalpy Real Array Duty 5, 6
‘EnthalpyVapor’ Enthalpy of vapor phase Real Array Duty 5, 6
‘EntropyLiquid’ Entropy of liquid phase Real Array Entropy (Wt.) 5
‘EntropyVapor’ Entropy of vapor phase Real Array Entropy (Wt.) 5
‘HcurveType’ Type of HCURVE Integer Array 1
‘MoleFracDecant’ Decant phase fraction (molar basis) Real Array 5
‘MoleFracLiquid’ Liquid fraction (molar basis) Real Array 5
‘MoleFracVapor’ Vapor fraction (molar basis) Real Array 5
‘MoleRateDecant’ Molar flowrate of decant phase Real Array 5
‘MoleRateLiquid’ Molar flowrate of liquid phase Real Array Molar Rate 5
‘MoleRateVapor’ Molar flowrate of vapor phase Real Array Molar Rate 5
‘MolWeightLiquid’ Molecular weight of liquid phase Real Array 5
‘MolWeightVapor’ Molecular weight of vapor phase Real Array 5
‘NumberOfHCurves’ Number of HCURVES Integer Scalar
‘NumberOfPoints’ Number of points per curve Integer Array
‘Pressures’ HCURVE pressures Real Array Pressure 5
‘SideNumber’ Side number Integer Array 3
‘SourceID’ ID of source Character Array 4
‘SourceType’ Source type Character Array 2
‘SpecGravLiquid’ Specific gravity of liquid phase Real Array 5
‘StdVolRateVapor’ STD vol. flowrate of vapor phase Real Array Vap. Vol. 5
‘SurfTensLiquid’ Surface tension of liquid phase Real Array Surface Tension 5
‘Temperatures’ HCURVE temperatures Real Array Temperature 5
‘ThermalCondLiquid’ Thermal conductivity of liquid phase Real Array Thermal Cond. 5
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

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’

Item Description Variable Array/ Units Notes


Type Scalar
‘CriconBarPressure’ Cricondenbar pressure Real Array Pressure 1
‘CriconBarTemperature’ Cricondenbar temperature Real Array Temperature 1
‘CriconThermPressure’ Cricondentherm pressure Real Array Pressure 1
‘CriconThermPressure’ Cricondentherm temperature Real Array Temperature 1
‘CriticalPressure’ Critical pressure Real Array Pressure 1
‘CriticalTemperature’ Critical temperature Real Array Temperature 1
‘NumberOfPCurves’ Number of pressure envelope curves Integer Scalar
‘NumberOfPoints’ Number of points per curve Integer Array 1
‘Pressures’ Pressures Real Array Pressure 2
‘Temperatures’ Temperatures Real Array Temperature 2
Notes:
1) Array count = number of curves
2) Array equivalent to two-dimensional array (number of points) x (number of curves)

5-20 Attribute Lists


Calculator
Class: ‘Calc’

Item Description Variable Array/ Units Notes


Type Scalar
‘ConstVector’ Value of constants Real Array 1
‘NumberOfConstants’ Total number of constants Integer Scalar
‘NumberOfParameters’ Total number of parameters Integer Scalar
‘NumberOfResults’ Total number of results Integer Scalar
‘ParamVector’ Value of parameters Real Array 2
‘ResultNames’ Names of results Character Array 3
‘ResultVector’ Value of results Real Array 3
Notes:
1) Count = number of constants
2) Count = number of parameters
3) Count = number of results

Equilibrium Reactor
Class: ‘EquReactor’

Item Description Variable Array/ Units Notes


Type Scalar
‘BaseComponentID’ ID of base component Character Array 4
‘ChangeMoles’ Molar change in composition Real Array 8
‘ConversionBaseComp’ Total conversion of base component Real Array 4
‘FeedMoles’ Molar composition reactor feed Real Array Mole Rate 5
‘FractionConv’ Fraction conversion Real Array 7
‘InletPressure’ Pressure at reactor inlet Real Scalar Pressure
‘InletTemperature’ Temperature at reactor inlet Real Scalar Temperature
‘NumberOfReactions’ Number of reactions Integer Scalar
‘OutletPressure’ Pressure at reactor outlet Real Scalar Pressure
‘OutletTemperature’ Temperature at reactor outlet Real Scalar Temperature
‘ProdMoles’ Molar composition reactor effluent Real Array Mole Rate 5
‘ReacModeFlag’ Reactor mode of operation Flag Integer Scalar 2
‘ReactorPhase’ Reactor phase Integer Scalar 3
‘ReactorTypeFlag’ Reactor type Integer Scalar 1
‘TotalDuty’ Total reactor duty Real Scalar Duty 8
‘TotalHeatOfReaction’ Total heat of reaction Real Scalar Duty 8
Notes:
1) Reactor Type
0 - General 1 - Shift 2 - Methanator
2) Reactor Mode Flag
1 - Outlet Temp. Specified 2 - Adiabatic operation 3 - Isothermal at mixed feed temperature
3) Reactor Phase
1 = Vapor 2 = Liquid
4) Count = number of reactions
5) Count = number of components
6) Change in Moles (Product - Feed); Count = number of components
7) Fraction converted for reactants consumed; If any component is generated, fraction converted is reported as zero;
Count = number of components
8) Duty has units 106 Energy/Time

PRO/II Data Transfer System and User-Added Subroutines User’s Guide 5-21
Conversion Reactor
Class: ‘ConReactor’

Item Description Variable Array/ Units Notes


Type Scalar
‘BaseComponentID’ ID of base component Character Scalar 3
‘ChangeMoles’ Molar change in composition Real Array 6
‘ConversionBaseComp’ Total conversion of base component Real Array 4
‘FeedMoles’ Molar composition reactor feed Real Array 5
‘FractionConv’ Fraction conversion Real Array 7
‘InletPressure’ Pressure at reactor inlet Real Scalar Pressure
‘InletTemperature’ Temperature at reactor inlet Real Scalar Temperature 4
‘NumberOfReactions’ Number of reactions Integer Scalar
‘OutletPressure’ Pressure at reactor outlet Real Scalar Pressure
‘OutletTemperature’ Temperature at reactor outlet Real Scalar Temperature
‘ProdMoles’ Molar composition reactor effluent Real Array 5
‘ReacModeFlag’ Reactor mode of operation Flag Integer Scalar 2
‘ReactorPhase’ Reactor phase Integer Scalar
‘ReactorTypeFlag’ Reactor type Integer Scalar 1
‘TotalDuty’ Total reactor duty Real Scalar Duty 8
‘TotalHeatOfReaction’ Total heat of reaction Real Scalar Duty 8
Notes:
1) Reactor Type
0 - General 1 - Shift 2 - Methanator
2) Reactor Mode Flag
1 - Outlet temp. specified 2 - Adiabatic 3 - Isothermal at mixed feed temperature
3) Reactor Phase
1 - Vapor 2 - Liquid
4) Count = number of reactions
5) Count = number of components
6) Change in moles (product - feed)- count = number of components
7) Fraction converted for reactants consumed; If any component is generated, fraction converted is reported as zero;
Count = number of components
8) Duty has units 106 Energy/Time

5-22 Attribute Lists


CSTR
Class: ‘Cstr’

Item Description Variable Array/ Units Notes


Type Scalar
‘BaseComponentID’ ID of base component Character Scalar 3
‘ChangeMoles’ Molar change in composition Real Array 5
‘ConversionBaseComp’ Total conversion of base component Real Array 3
‘FeedMoles’ Molar composition reactor feed Real Array 4
‘FractionConv’ Fraction conversion composition Real Array 6
‘InletPressure’ Pressure at reactor inlet Real Scalar Pressure
‘InletTemperature’ Temperature at reactor inlet Real Scalar Temperature
‘NumberOfReactions’ Number of reactions Integer Scalar
‘ProdMoles’ Molar composition reactor effluent Real Array 4
‘ReactorPhase’ Reactor phase Integer Scalar 2
‘ReactorPressure’ Pressure inside reactor Real Scalar Pressure
‘ReactorSpaceTime’ Space time in reactor Real Scalar Time
‘ReactorSpaceVelocity’ Reactor space velocity Real Scalar 1/Time
‘ReactorTemperature’ Temperature inside reactor Real Scalar Temperature
‘ReactorTypeFlag’ Reactor type Integer Scalar 1
‘ReactorVolumeCalc’ Calculated reactor volume Real Scalar Liq. Volume
‘TotalDuty’ Total reactor duty Real Scalar Duty 7
‘TotalHeatOfReaction’ Total heat of reaction Real Scalar Duty 7
Notes:
1) Reactor type
1 - Outlet temperature specified 2 - Adiabatic
3 - Isothermal at mixed feed temperature 4 - Boiling pot
2) Reactor phase
1 - Vapor 2 - Liquid
3) Count = number of reactions
4) Count = number of components
5) Change in Moles (Product - Feed); count = number of components
6) Fraction Converted for reactants consumed; If any component is generated, fraction converted is reported as zero;
Count = number of components
7) Duty has units 106 Energy/Time

PRO/II Data Transfer System and User-Added Subroutines User’s Guide 5-23
Plug Flow Reactor
Class: ‘Plug’

Item Description Variable Type Units Notes


‘AnnulFluidFlag’ Flag on jacket fluid Integer Scalar 3
‘AnnulPresProfile’ Jacket pressure profile Real Array Pressure 5
‘AnnulPressIn’ Jacket pressure at the inlet Real Scalar Pressure
‘AnnulPressOut’ Jacket pressure at the outlet Real Scalar Pressure
‘AnnulTempIn’ Jacket temperature at inlet Real Scalar Temperature
‘AnnulTempOut’ Jacket temperature at outlet Real Scalar Temperature
‘AnnulTempProfile’ Jacket temperature profile Real Array Temperature 5
‘BaseComponentID’ ID of base component Character Scalar 4
‘ChangeMoles’ Molar change in composition Real Array Mole Rate 7
‘ConversionBaseComp’ Total conversion of base component Real Array 4
‘FeedMoles’ Molar composition reactor feed Real Array Mole Rate 6
‘FractionConv’ Fraction conversion Real Array 8
‘HeatTransCoeff’ Heat transfer coeff. of reactor tubes Real Scalar Heat Transfer Coeff.
‘InletPressure’ Pressure at reactor inlet Real Scalar Pressure
‘InletTemperature’ Temperature at reactor inlet Real Scalar Temperature
‘MaxVelocityDist’ Dist. from inlet where vel. is max Real Scalar Length
‘NumberOfReactions’ Number of reactions Integer Scalar
‘NumberOfTubes’ Number of reactor tubes Real Scalar
‘NumberProfPoints’ Number of profile points Integer Scalar
‘OutletPressure’ Pressure at reactor outlet Real Scalar Pressure
‘OutletTemperature’ Temperature at reactor outlet Real Scalar Temperatur
‘ProdMoles’ Molar composition reactor effluent Real Array Mole Rate 6
‘ProfileDistance’ Profile distance along reactor length Real Array 5
‘ReacPresProfile’ Pressure profile along reactor length Real Array 5
‘ReacTempProfile’ Temp. profile along reactor length Real Array 5
‘ReactorPhase’ Reactor phase Integer Scalar 2
‘ReactorTypeFlag’ Reactor type Integer Scalar 1
‘ResidenceTime’ Reactor residence time Real Scalar Time
‘TotalDuty’ Total reactor duty of reaction Real Scalar Duty 9
‘TotalHeatOfReaction’ Total heat Real Scalar Duty 9
‘TotalVolume’ Total reactor volume Real Scalar Liq. Volume
‘TubeDiameter’ Diameter of reactor tubes Real Scalar Fine Length
‘TubeLength’ Length of reactor tubes Real Scalar Length
‘VelocityMaximum’ Maximum velocity inside reactor Real Scalar Velocity
Notes:
1) Reactor type
1 - Thermal 2 - Adiabatic
3 - Cocurrent Coolant 4 - Countercurrent Coolant
2) Reactor phase: 1 - Vapor 2 - Liquid
3) Jacket fluid: 1 - Cold 2 - Hot
4) Count = number of reactions
5) Count = number of profile points
6) Count = number of components
7) Change in Moles (Product - Feed); Count = number of components
8) Fraction converted for reactants consumed; If any component is generated, fraction converted is reported as zero;
Count = number of components
9) Duty has units 106 Energy/Time

5-24 Attribute Lists


Gibbs Reactor
Class: ‘Gibbs’

Item Description Variable Array/ Units Notes


Type Scalar
‘ChangeMoles’ Molar change in composition Real Array Mole Rate 6
‘FeedMoles’ Molar composition reactor feed Real Array Mole Rate 6
‘FractionConv’ Fraction conversion Real Array 8
‘GibbsMinFreeEnergy’ Gibbs free energy Real Scalar 3
‘InletPressure’ Pressure at reactor inlet Real Scalar Pressure
‘InletTemperature’ Temperature at reactor inlet Real Scalar Temperature
‘ProdMoles’ Molar composition reactor effluent Real Array Mole Rate 6
‘ReactorPhase’ Reactor phase Integer Scalar 2
‘ReactorPressure’ Pressure inside reactor Real Scalar Pressure
‘ReactorTemperature’ Temperature inside reactor Real Scalar Temperature
‘ReactorTypeFlag’ Reactor type Integer Scalar 1
‘TotalDuty’ Total reactor duty Real Scalar Duty 7
‘TotalHeatOfReaction’ Total heat of reaction Real Scalar Duty 7
Notes:
1) Reactor Type Flag
1 - Outlet temperature specified 2 - Adiabatic
3 - Isothermal at mixed feed temperature
2) Reactor Phase
1 - Vapor 2 - Liquid 3 - Mixed
3) G / (R*T)
4) Count = number of components
5) Change in moles (Product - Feed); Count = number of components
6) Fraction converted for reactants consumed; If any component is generated, fraction converted is reported as zero;
Count = number of components
7) Duty has units 106 Energy/Time

User-Added Unit Operations


Class: ‘User’

Item Description Variable Array/ Units Count


Type Scalar
‘HeatVector’ Heat vector Real Array 500
‘IntegerVector’ IPARM vector Integer Array 250
‘RealVector’ RPARM vector Real Array 500
‘SupplVector’ Supplemental vector Real Array 10,000

PRO/II Data Transfer System and User-Added Subroutines User’s Guide 5-25
Chapter 6
PDTS Example Listings

Example 6-1 — FORTRAN Listing


C
C FILE: EXAM1.FOR
C
C PDTS SAMPLE APPLICATION
C
C
C SIMULATION SCIENCES
C
PROGRAM EXAM1
C
C *********************************************************
C
C LOCAL DECLARATIONS
C
PARAMETER (MAXUOP = 500)

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

6-2 PDTS Example Listings


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
C
C GET UNIT OF MEASURE STRINGS
C
DNTEMP = PAUOMS(ITEMP, KUOM, IERR)
DNPRES = PAUOMS(IPRES, KUOM, IERR)
DNWORK = PAUOMS(IWORK, KUOM, IERR)
DNDUTY = PAUOMS(IDUTY, KUOM, IERR)
C
C WRITE OUT TABLE
C
WRITE(NFOUT,112) (XID(I), I = 1, 3), (XNAME(I), I =1, 3)
WRITE(NFOUT,114) DNPRES, (PIN(I), I = 1, 3)
WRITE(NFOUT,115) DNTEMP, (TIN(I), I = 1, 3)
WRITE(NFOUT,116) DNPRES, (POUT(I), I = 1, 3)
WRITE(NFOUT,117) DNTEMP, (TOUT(I), I = 1, 3)
WRITE(NFOUT,118) (PRAT(I), I = 1, 3)
WRITE(NFOUT,119) DNWORK, (WORK(I), I = 1, 3)
WRITE(NFOUT,120) (EFF(I), I = 1, 3)
WRITE(NFOUT,121) DNDUTY, (DUTY(I), I = 1, 3)
C
END

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

6-4 PDTS Example Listings


C
CALL PACASL(MXN,KXN,CASE,IRCODE)
NXN = MIN(MXN,KXN)
C
C SET UNIT OF MEASURE AS DEFAULT INPUT UNITS
C
KUOM = 0
C
C TARGET CASE ID IS D101
C FEED STREAM IS ‘1’
C
UID = ‘D101’
SID = ‘1’
C
C SET UP EACH CASE
C
DO 3001 KX = 1, NXN
WRITE(*,105) CASE(KX)
CALL PACASE(CASE(KX),IRCODE)
IF (IRCODE .NE. 0) THEN
WRITE(*,206)
STOP
ENDIF
C
C GET MISCELLANEOUS FLOWSHEET DATA
C
CALL PAMISC(NCOMP,NSTRM,NUNIT,IRCODE)
IF (IRCODE .NE. 0) THEN
WRITE (*,203)
STOP
ENDIF
C
C GET UNIT NAME
C
CALL PADATC(‘UNIT’,’NAME’,UID,UNAME,KS,KC,IER)
C
C GET FEED STREAM RATE
C
CALL PADATR(‘STREAM’,’TotalMolarRate’,SID,FLOW(KX),
+ KC,KUOM,IFLOW,IER)
C
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
C
C GET UNIT OF MEASURE STRINGS
C
DNFLOW = PAUOMS(IFLOW, KUOM, IERR)
DNDUTY = PAUOMS(IDUTY, KUOM, IERR)
C
C WRITE OUT TABLE
C

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

Example 6-3 — FORTRAN Listing


C
C FILE: EXAM3.FOR
C
C PDTS SAMPLE APPLICATION
C
C
C SIMULATION SCIENCES
C
PROGRAM EXAM3
C
C *********************************************************
C
C LOCAL DECLARATIONS
C
PARAMETER (MAXNOC = 50, MAXTRA= 100)
C
CHARACTER*8 FNAME
CHARACTER*12 UID
CHARACTER*16 COMPID(MAXNOC)
CHARACTER*40 UNAME
CHARACTER*10 DNPRES, DNTEMP, DNFLOW, DNVDEN, DNLDEN, PAUOMS
DIMENSION XCOMP(MAXNOC*MAXTRA), YCOMP(MAXNOC*MAXTRA),
+ TEMP(MAXTRA), PRES(MAXTRA), XVNET(MAXTRA),
+ XLNET(MAXTRA), DENVAP(MAXTRA), DENLIQ(MAXTRA)
*********************************************************
100 FORMAT(/)
101 FORMAT(‘ *** PDTS EXAMPLE PROBLEM # 3 ***’,/,
+ ‘ ENTER FILE NAME: ‘)
102 FORMAT(A)
103 FORMAT(/,’ DATA RETRIEVAL FROM FILE: ‘,A15,/)
112 FORMAT(‘ COLUMN REPORT TABLE - UID: ‘,A12,’ - ‘,A40)
114 FORMAT(/,’ TRAY NUMBER: ‘,10X,5I10)
115 FORMAT(‘ PRESSURE: ‘,A10,5F10.2)
116 FORMAT(‘ TEMPERATURE: ‘,A10,5F10.2)
117 FORMAT(‘ NET VAPOR RATE: ‘,A10,5F10.2)
118 FORMAT(‘ NET LIQUID RATE: ‘,A10,5F10.2)
119 FORMAT(‘ VAPOR DENSITY: ‘,A10,5F10.4)
120 FORMAT(‘ LIQUID DENSITY: ‘,A10,5F10.4)
121 FORMAT(/,’ VAPOR PHASE COMPOSITION ‘)
122 FORMAT(1X,A16,13X,5F10.4)
123 FORMAT(/,’ LIQUID PHASE COMPOSITION ‘)
203 FORMAT(‘ SOLUTION NOT REACHED !!!’)
205 FORMAT(‘ ERROR IN FILE INITIALIZATION !!!’)
206 FORMAT(‘ ERROR IN CASE SET-UP !!!’)
C
C ENTER FILE NAME
C

6-6 PDTS Example Listings


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 MISCELLANEOUS FLOWSHEET DATA
C
CALL PAMISC(NCOMP,NSTRM,NUNIT,IRCODE)
IF (IRCODE .NE. 0) THEN
WRITE (*,203)
STOP
ENDIF
C
C SET UNIT OF MEASURE AS DEFAULT INPUT UNITS
C
KUOM = 0
C
C TARGET CASE ID IS D101
C
UID = ‘D101’
C
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)
C
C GET NUMBER OF TRAYS
C
CALL PADATI(‘Colu’,’NumberOfTrays’,UID,NTRAY,KC,IER)
C
C GET COLUMN TRAY BY TRAY TEMPERATURE & PRESSURE
C
CALL PADATR(‘Colu’,’TrayPressures’,UID,PRES,
+ KC,KUOM,IPRES,IER)
C
CALL PADATR(‘Colu’,’TrayTemperatures’,UID,TEMP,
+ KC,KUOM,ITEMP,IER)
C
C GET COLUMN TRAY BY TRAY NET LIQUID & NET VAPOR RATES
C
CALL PADATR(‘Colu’,’TrayNetVapRates’,UID,XVNET,
+ KC,KUOM,IFLOW,IER)
C
CALL PADATR(‘Colu’,’TrayNetLiqRates’,UID,XLNET,
+ KC,KUOM,IUOM,IER)

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

6-8 PDTS Example Listings


Chapter 7
User-Addressable Utility Functions

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.

Note: PRO/II database files are not compatible across versions or


hardware platforms.

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).

Prior versions were limited to 10 feed and 10 product streams, and


the IDATA array was used for stream identification:
➤ IDATA(11)-(20) Stream IDs for feeds in same order as FEED
statement
➤ IDATA(21)-(30) Stream IDs for products in same order as
PRODUCT statement
Although this method is still valid in version 5.5 for the first 10 feed
and product streams, it is no longer recommended.

To ensure compatibility with future versions, users are encouraged


to revise their UAS code to account for this change.

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 User-Added Subroutines


The user-added subroutine (UAS) feature of PRO/II allows incorpo-
ration of custom calculation methods into the standard PRO/II pro-
gram via subroutines written in FORTRAN. The calculation
methods that may be incorporated with this interface are as follows:

■ User-Added Thermodynamic Methods

■ User-Added Transport Property Methods

■ User-Added Unit Operations

■ User-Added Reaction Kinetics.

For each user-added calculation method, there is a fixed method for


interfacing the custom routines with the standard PRO/II simulator.
This will be explained in detail in separate chapters of this manual.

Note: See Chapter 9 of the PRO/II User’s Guide for information


on using and customizing User-Added Unit Operations with the
PRO/II interface.

Hardware and Software Requirements for PRO/II UAS


The Compaq Visual FORTRAN compiler is required to compile
and link user-added subroutines into the current PC version of PRO/
II. The Lahey FORTRAN and Microsoft PowerStation FORTRAN
compilers are no longer compatible with PC versions 4.0 and later
of PRO/II UAS.

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

Note: If your flowsheet contains more than 300 components,


contact your SIMSCI representative to obtain a version of PRO/II
User-Added Subroutines with an increased component maximum.

Note: For user-added thermodynamic and transport properties,


the TDATA array (and corresponding UDATA statement) is limited to
2600 entries.

9-2 UAS Introduction


Chapter 10
Build Procedure for PRO/II UAS

You can integrate user-added subroutines written in FORTRAN into


PRO/II by creating a custom version of the dynamic link library,
UASLB.DLL. This manual does not contain instructions on writing
the FORTRAN subroutines or using Compaq Visual FORTRAN 6.1
or 6.5.

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.

Required Source Code Modifications for the PC Version


If your previous installation of UAS was PRO/II 4.13 with
PROVISION 2.03 or later, skip to the next section.
If your previous installation of UAS was prior to PRO/II 4.13 with
PROVISION 2.03, there is a new method for accessing common
blocks in user-added subroutines. The available common blocks,
/FACTOR/, /UTHERX/, /XPROPX/, /OUTFACT/, /PMXUSER/, /CUDATA/,
and /CUSPEC/ are described in Chapters 10 and 11 of this guide.

In versions prior to PRO/II 4.13 with PROVISION 2.03, common


block definitions were specified directly in the source code. For
example:
COMMON /FACTOR/ TCONVT, TFAC, ....
Now you need only specify the name of the INCLUDE file (with its
proper path) that contains the common block of interest. For the
common block /FACTOR/, it suffices to specify:
INCLUDE ‘FACTOR.CMN’

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.

These changes facilitate the creation of .DLL versions of PRO/II.


These source code modifications are required only on the PC
version. User-added subroutines on other platforms need not be
modified.

Build Procedure for PRO/II UAS


You can integrate your FORTRAN routines into the dynamic link
library UASLB.DLL using Compaq Visual FORTRAN 6.1 or 6.5 for
Windows NT or Windows 2000. The procedures described below
illustrate the method using the example subroutines USER42.FOR
and U42OUT.FOR.

Integrating UAS Using Compaq Visual FORTRAN


Note: These instructions assume that you have installed the
UAS/PDTS module in the default directory structure,
C:\SIMSCI\PROII55\. Modify the paths indicated in the procedure
below if you have installed the program in a directory structure
other than the default.
➤ Start Compaq Visual FORTRAN 6.1 or 6.5 for Windows NT or
Windows 2000.
➤ Select File/Open Workspace from the menu bar.
➤ Select the file, \SIMSCI\PROII55\USER\UAS\
EXAMPLES\UASLB.DSW and click OK.

Next, you must add the user-added FORTRAN files USER42.FOR


and U42OUT.FOR into the project file:

➤ Select Project/Add to project/files from the menu bar.


➤ Add the files \SIMSCI\PROII55\USER\UAS\EXAMPLES\EXAM1\
USER42.FOR and \SIMSCI\PROII55\USER\UAS\ EXAMPLES\
EXAM1\U42OUT.FOR. (If the files are already in the project, a
message will be displayed.)
➤ Click Close to exit the window and update the project file.
Now, you can build the new dynamic link library:

10-2 Build Procedure for PRO/II UAS


➤ Select the Build UASLB.DLL option from the Build menu.
Compaq Visual FORTRAN will build the dynamic link library
UASLB.DLL in ..\USER\EXAMPLES\UASLB-DEBUG\ or ..\USER\EXAM-
PLES\UASLB-RELEASE\ depending on the UASLB project settings. To
make this new .DLL available to PRO/II, you must copy it to the exe-
cutable directory where you installed the product (\SIM-
SCI\PROII_W\BIN).

Note: Before copying the file, you must close PRO/II.

➤ Make a backup copy of the original .DLL by typing:


COPY \SIMSCI\PROII55\BIN\UASLB.DLL \SIMSCI\PROII_W\BIN\
UASLB.SAV
➤ Copy the new .DLL to the \SIMSCI\PROII55\BIN directory by
typing:
COPY UASLB.DLL \SIMSCI\PROII55\BIN
This new .DLL will be usable by PRO/II.

Customizing a UAS Data Entry Window


To create a customized PRO/II data entry window to be used for a
specific user-added calculation subroutine, two ASCII files must be
created in the directory specified by the UserConfigDir= entry in the
PROII.INI file. These two files are called UASLIST.INI and USERXX.INI
and are described in Chapter 9 of the PRO/II User’s Guide.

PRO/II Data Transfer System and User-Added Subroutines User’s Guide 10-3
Chapter 11
FORTRAN Coding Standards
and Requirements

All user-added subroutines must be written in ANSI standard


FORTRAN IV or FORTRAN 77 to insure compatibility with
PRO/II.

Information flow between user-added subroutines and PRO/II is


accomplished through:

■ Subroutine argument lists.

■ Interface subroutines.

■ Common storage blocks.

Chapters 12 through 16 give specific details regarding user-added


subroutines for various functions. In each case, addition of a user-
added calculation subroutine involves replacement of a dummy sub-
routine already present in PRO/II. Thus, the user-written subroutine
must be given a name and an argument list identical to those of the
dummy subroutine.

Interface subroutines which perform various functions are described


in Chapter 12, Interfacing Software, Common Blocks, and Data
Files. These subroutines may be called by the user-added subrou-
tines to transfer information to and from the PRO/II storage areas.

User-written subroutines may also communicate through certain


common storage locations (also described in Chapter 12). Retrieval
of information from the common storage blocks for component
properties, thermodynamic data, and conversion factors is allowed.

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: There are no specific size limitations regarding user-added


subroutines.

FORTRAN Programming Guidelines


The following guidelines should be followed when writing user-
added subroutines:

1. Storage variables should always be initialized since many oper-


ating systems do not perform this function.
2. As appropriate, user-added subroutines should test for calcula-
tional error conditions such as zero divides, exponent over-
flows, etc.
3. The PRO/II interface subroutines all return error flags which
should be tested by the user-added subroutines before any
appropriate action is taken.
4. Common storage information in the PRO/II common blocks
/XPROPX/, /CUDATA/, /OUTFAC/, and /FACTOR/ must not be
altered.
5. Care must be exercised to not alter any variables in the user-
added common block, /UTHERX/, except those allowed items
described in Chapter 12.
6. Use the FIGETU routine to obtain correct FORTRAN unit num-
bers for special sequential input or output files (see Chapter 12,
Interfacing Software, Common Blocks, and Data Files).
7. Dimensional units must be considered when performing
calculations. (All stored data in the PRO/II system are in input
dimensional units except critical properties as noted in the
discussion of /XPROPX/.)
8. Good FORTRAN coding practices should be observed,
particularly for user-added subroutines to be used repetitively
such as thermodynamic functions or unit operations to be used
in calculational loops.
9. All loops within user-added subroutines should have predefined
limits.

11-2 FORTRAN Coding Standards and Requirements


Chapter 12
Interfacing Software, Common Blocks,
and Data Files

This chapter discusses the facilities available for communication of


data between the PRO/II program and user-added subroutines.
Linkage is accomplished through:

■ Subroutine argument lists.

■ Interface subroutines, provided in the PRO/II program.

■ Common storage blocks in PRO/II made available to


user-added subroutines.

Table 12-1 describes the interface subroutines in PRO/II. These


subroutines may be called as needed and are fully described later in
this chapter. Likewise, Table 12-2 highlights the common storage
blocks available to user-added subroutines. Complete details are
given later in this chapter. User-defined data files are also discussed
in this chapter.

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

Table 12-2: Common Storage Blocks for PRO/II


Name Description See page...
/FACTOR/ Conversion factors for 12-14
dimensional units
/UTHERX/ Link user thermodynamic 12-16
functions with PRO/II
/XPROPX/ Pure component data 12-18
/OUTFAC/ Output conversion factors and 12-19
dimensions, component names
/CUDATA/ Storage of data for user 12-22
thermodynamic functions
/CSPEC/ Storage of isentropic flash 12-23
specification

Note: Storage of user-calculated data is permissible only in


/UTHERX/.

12-2 Interfacing Software, Common Blocks, and Data


Interface Subroutines
HEAD
This subroutine may be called by user-added output subroutines.
Action includes page ejection, automatic numbering, and heading
of page with information given on the problem TITLE statement.

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:

CTYPE Input character string indicating request.


Valid entries are:
‘UNIT’ Return unit ID and name
‘FEED’ Return feed stream ID and name for feed
INDX
‘PROD’ Return product stream ID and name for
product INDX
INDX Input integer index of feed or product for which ID and
NAME needed. No significance if unit ID and name
requested.
CID Output, 12-character unit/stream ID.
CNAME Output, up to 40-character unit/stream name.
IERR Output integer flag. Non-zero value indicates error has
occurred.

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:

Vector Position Description


1 Total molar flow in input units
2 Temperature in input units
3 Pressure in input units
4 Total enthalpy in 103 energy units per time
5 Total liquid mole fraction including liquid water
6 Liquid water mole fraction
7 Compressibility factor (Z) computed from the K-value or
enthalpy method, enthalpy having preference
8-10 Reserved for PRO/II
11-NOC Individual component molar flows in input units
(NOC = number of components)

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:

CID Stream label as described in the problem input (up to 12


alphanumeric characters, designated as a character
variable).
STREAM The stream vector into which stream CID is to be stored
or retrieved. STREAM must be a variably dimensioned
real array.
IOTYPE Function to perform:
1 Retrieve stream data.
2 Store stream data (only allowed for streams defined as
products).

12-4 Interfacing Software, Common Blocks, and Data


IERR Error flag:
0 No errors
1 IOTYPE is not 1 or 2.
2 Stream CID is not found.
3 Stream CID is not a declared product and storage has
been requested.
4 Attempt to store a stream with either a negative flowrate,
a temperature or pressure out of bounds, or a negative
component molar flowrate.
5 Attempt to retrieve data for a stream not yet calculated
by PRO/II.

The error flag should always be checked after retrieval or storage of


streams.

TTPROP
This subroutine may be used to calculate the following properties
for streams:

■ Component vapor pressures in input units.

■ Component molar ideal gas enthalpies (H*i ) (10 3 energy units


per mole).

■ Transport properties for the total stream in input units.

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:

ITYPE Properties desired:


1 Vapor pressures
2 Ideal gas enthalpies
3 Transport properties
4 Thermal conductivity
5 Viscosity
6 Surface tension
IPHASE Stream phase:
1 Vapor phase
2 Liquid phase

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.

Note: All results will be returned in problem input dimensional


units. Also note that transport properties must be requested on the
METHODS statement in the Thermodynamic Data category of
input to be available for TTPROP. If vapor pressures are to be
requested, and fractions are present, a KTYPE of LIBRARY (need
not be used) is necessary to insure setup of vapor pressure data for
the PETROLEUM components.

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

■ Adiabatic flash (pressure calculated)


■ Adiabatic flash (temperature calculated)

■ Dew point (pressure calculated)

■ Dew point (temperature calculated)

12-6 Interfacing Software, Common Blocks, and Data


■ Bubble point (pressure calculated)

■ Bubble point (temperature calculated)

■ Isentropic flash (pressure calculated)

■ Isentropic flash (temperature calculated)

■ Water dew point (pressure calculated)

■ Water dew point (temperature calculated).

The stream for which calculations are to be performed is loaded into


a standard stream vector as previously described in the section on
URXSTR. The liquid and/or vapor portions corresponding to the
desired calculations are returned in standard stream vectors.
Calling sequence:
CALL UFLSH(STREAM,VAPOUT,XL1OUT,XL2OUT,XKVALU,ITYPE,IERR)

where:

STREAM Standard stream vector containing the stream for


which calculations are to be performed, a variably
dimensioned real array.
VAPOUT Standard stream vector containing the vapor product
moles from the calculations, a variably dimensioned
real array.
XL1OUT Standard stream vector containing the primary liquid
product moles from the calculations, a variably
dimensioned real array.
XL2OUT Standard stream vector containing the second liquid
phase moles (when water is treated as a separate
system, this vector contains the decanted water), a
variably dimensioned real array.
XKVALU The equilibrium K-values from the calculations, a
variably dimensioned real array.

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.

Note: IERR should be checked after each calculation and


appropriate action taken.
For isentropic flashes (types 8 and 9), the user must first calculate
the entropy of STREAM by calling subroutine UHS. The entropy so
obtained should be set directly into the variable SISENV in common
block /CUSPEC/. Once this has been done, the user then calls sub-
routine UFLSH.

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)

STREAM, VAPOUT, XL1OUT, and XL2OUT are in dimensional units as


defined for problem input. These vectors have the standard stream
format previously described in this chapter for URXSTR.

12-8 Interfacing Software, Common Blocks, and Data


U3FLSH
Subroutine U3FLSH may be used to perform the following flash cal-
culations for PRO/II streams. This flash is able to produce one
vapor and two liquid products. Note that for dew point flashes
(types 4 and 5), this flash method is the same as UFLSH since, by
definition, no liquids can exist.

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,

ITYPE Property requested:


1 Isothermal flash
2 Adiabatic flash (temperature specified)
3 Adiabatic flash (pressure specified)
4 Dew point (temperature specified)
5 Dew point (pressure specified)
6 Bubble point (temperature specified)
7 Bubble point (pressure specified)
XK1OUT The equilibrium K-values representing the vapor and light
liquid phases (variably dimensioned).
XK2OUT The equilibrium K-values representing the vapor and heavy
liquid phases (variably dimensioned).

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.

VALUE and STRMCP will be in units corresponding to the dimen-


sional units for problem input as qualified above. Compressibility
factors are always returned on a dry basis. An alternative method
for calculating densities is to use subroutine UDENS which calcu-
lates both the wet and dry actual volume of a stream.

12-10 Interfacing Software, Common Blocks, and Data


The error flag should be examined and appropriate action taken
after each call to UHS.

UH2OP
This subroutine may be used to determine properties for water,
either as liquid or vapor. Properties which may be retrieved
include:

■ Vapor molar volume in vapor volume units per mole.

■ Molar enthalpy in thousands of energy units per mole.

■ Molar entropy in energy units per mole per temperature.


■ Saturation pressure in input units.

■ Saturation temperature in input units.

■ Liquid molar volume in liquid volume units per mole.

Calling sequence:
CALL UH2OP(ITYPE,IPHASE,TEMPER,PRESSR,TDELTA,VALUE, TDERIV)
where:

ITYPE Property requested:


1 Vapor volume
2 Enthalpy
3 Entropy
4 Saturation pressure
5 Saturation temperature
6 Liquid volume
All properties are on a molar basis in dimensional units
corresponding to those selected for problem input.
IPHASE Phase:
1 Vapor
2 Liquid
TEMPER Temperature in problem input units.
PRESSR Pressure in problem input units.
TDELTA No longer used.
VALUE The value of the requested property at TEMPER and
PRESSR.
TDERIV Temperature derivative for the requested property.

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

Note: STREAM(7) is also set to the dry compressibility factor as


calculated using the density method declared in the PRO/II input
data.

12-12 Interfacing Software, Common Blocks, and Data


KCOMPU
This subroutine is provided to return K-values and temperature
derivative of K-values for use with a user-added flash subroutine.

Calling sequence:
CALL KCOMPU (TEMP,PRES,VAPIN,XL1IN,XL2IN,XK1VAL,
XK2VAL,DK1DT,DK2DT,IXFLAG,KFLAG,KDFLAG)

where:

TEMP Temperature at which K-values are required in input units.


PRES Pressure at which K-values are required in input units.
VAPIN Standard stream vector (variably dimensioned) of the
vapor phase.
XL1IN Standard stream vector (variably dimensioned) of the
light liquid phase.
XL2IN Standard stream vector (variably dimensioned) of the
heavy liquid phase.
XK1VAL K-values for light liquid phase.
XK2VAL K-values for heavy liquid phase.
DK1DT Temperature derivatives for light liquid phase.
DK2DT Temperature derivatives for heavy liquid phase.
IXFLAG Composition flag:
0 No comp
1 Yes
KFLAG 1 Consider light phase only for K-value calculations.
2 Consider both phases for K-values calculations.
KDFLAG 1 Consider light phase only for derivative calculations.
2 Consider both phases for derivative calculations.

Note: XK1VAL, XK2VAL, DK1DT, and DK2DT must be variably


dimensioned.

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:

TEMP Temperature at which enthalpies are required in input units.


PRES Pressure at which enthalpies are required in input units.
VAPIN Standard stream vector for the vapor phase (variably
dimensioned).
XL1IN Standard stream vector for the light liquid phase (variably
dimensioned).
XL2IN Standard stream vector for the heavy liquid phase (variably
dimensioned).

The enthalpies are returned in position (4) of the stream vectors.


Position (7) retains the compressibility factors as calculated from
the K/H method and position (8), the derivative of enthalpy with
respect to temperature.

Note: Enthalpies have units of 103 energy units per time.

Common Storage Blocks


/FACTOR/
The common block /FACTOR/ contains dimensional unit conversion
factors and certain physical constants. These conversion factors can
be used to convert input dimensional units to the base units as
shown below.
INCLUDE ‘FACTOR.CMN’

This include file contains the following common block:


COMMON/FACTOR/TCONVT,TFAC,PCONVT,PFAC,TIMFAC,
+ WTFAC,VVFAC,ARFAC,XLVFAC,SPGFAC,HSFAC,WKFAC,
+ VISFAC,TCFAC,VVFACA,STFAC,FACA,FACB,EXPFAC,
+ XM3FAC,FTOR,CTOK,XKTOR,ATM,VVTOML,RCONST,
+ DUMMY(14)

where:

12-14 Interfacing Software, Common Blocks, and Data


TR = [(temp)p + TCONVT] · TFAC

Psia = [(pres)p + PCONVT] · PFAC

Sec = (time)p · TIMFAC


Lb = (wt)p · WTFAC

(Standard vapor volume)p · 106 = (moles)p * VVFAC

Ft2 = (area)p · ARFAC

Ft3 = (liquid volume)p · XLVFAC

(60°F density)p = SpGr · SPGFAC


Btu/(time)p = (enthalpy/time)p · HSFAC
Horsepower = [(∆H · 103)/time]p · WKFAC

Centipoise = (viscosity)p · VISFAC

Btu/hr-°F-Ft = (thermal conductivity)p · TCFAC


Ft3 = (vapor volume)p · VVFACA

Dynes/cm = (surface tension)p · STFAC


FACA , FACB = not used

EXPFAC = 2.3026 (lnX = EXPFAC log10X)

XM3FAC = 35.314667 ft3/m3


FTOR = 459.67 (Fahrenheit to Rankine)

CTOK = 273.15 (Celsius to Kelvin)


XKTOR = 1.8 (Kelvin to Rankine)

ATM = 14.6959 (Atmospheres to psia)

VVTOML = Not used

RCONST = 1.9872 (Gas constant)

Note: Subscript p denotes problem input dimensional units.

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’

This INCLUDE file contains the following common block:


PARAMETER (MAXCN=300)
COMMON / UTHERX / IXXFLG, JXXFLG, NOCZ, IFPHZ, KUOUT,
+ TEMPX,TDELTX, PRESX, XVV, XLL, XLL2, YXSAT,
+ XXSOL, XKV, DRVX, HSX1, HSX2, ZXX1,
+ ZXX2, IFLGX, KDECNT, KVTYPE, KDCALL

where:

IXXFLG Type of data requested:


-1 Inquiry by PRO/II about composition-dependency of
K-values
0 K-values, compositions not yet available
1 K-values, compositions available in XVV, XLL, and XLL2
2 Enthalpy
3 Entropy
4 Compressibility factors (Zs)
JXXFLG Return code for K-value (K) or enthalpy (H) calculations:
IXXFLG JXXFLG
0 0 Initial K-values to be supplied by PRO/II using
correlations based on reduced properties.
(Tc, Pc, and acentric factors are required.)
0 1 Initial K-values supplied by user subroutine.
2 0 User-computed enthalpies are returned in form
(H - H*)/RT where H* = ideal gas enthalpy.
Values for ∆H/∆xi will be computed by PRO/II
using component ideal gas enthalpies.
2 1 User-computed enthalpies are in dimensionless
form H/RT. Values for ∆H/∆xi will be calculated
by PRO/II using component ideal gas enthalpies.
2 2 User-computed enthalpies are in dimensionless
form H/RT. Values for ∆H/∆xi are returned in the
DRVX array for all components.
3 0 Entropy is returned in dimensionless form
(S - S*)/R where S* = ideal gas entropy.
3 1 Entropy is returned in dimensionless form S/R.
* Denotes values that must be returned by the user.

12-16 Interfacing Software, Common Blocks, and Data


IXXFLG JXXFLG
-1 Type of user K-values is requested by input
processing:
-1 1 Non-composition dependent.
-1 2 Composition dependent; e.g., equation of state.
-1 3 Strongly composition dependent; e.g., liquid
activity coefficient method.
0-4 99 Calculation failure in user-added subroutine.
NOCZ Number of components in problem.
IFPHZ Phase for enthalpy, entropy, or Z:
1 Vapor
2 Liquid
KUOUT Standard output file.
TEMPX Temperature for calculations in problem input units.
TDELTX Temperature delta for enthalpies and derivatives in problem
input units.
PRESX Pressure for calculations in problem input units.
XVV Vapor molar fractions.
XLL Primary liquid molar fractions.
XLL2 Liquid molar fractions for second liquid phase. (Decanted
water when KDECNT is not equal to 0.)
YXSAT* Saturation vapor mole fraction for water (when KDECNT is
not equal to 0.)
XXSOL* Solubility of water in primary liquid phase (when KDECNT is
not equal to 0.)
XKV* The user computed K-values.
DRVX* The derivatives for K-values or enthalpies. K-values are ∆K/∆Ti
enthalpies are ∆H/∆xi .
HSX1* The calculated value for enthalpy or entropy at TEMPX in
dimensionless form.
HSX1* The calculated value for enthalpy or entropy at TEMPX in
dimensionless form.
HSX2* The calculated value for enthalpy at (TEMPX + TDELTX) in
dimensionless form. This is required for enthalpies since
HSX1 and HSX2 are used to calculate heat capacity.
ZXX1* Compressibility factor for vapor.
* Denotes values that must be returned by the user.

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.

Note: Temperature derivatives for K-values and composition


derivatives for enthalpies are required when rigorous distillation
calculations are to be performed.

/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’

This INCLUDE file contains the following common block:


PARAMETER (MAXCN=300)
COMMON/XPROPX/XMW(MAXCN),BP(MAXCN),DENS(MAXCN),
+ TC(MAXCN), PC(MAXCN),VC(MAXCN),ZC(MAXCN),
+ OMEGA(MAXCN), HFORM(MAXCN), GFORM(MAXCN),
+ LIBNO(MAXCN),KOCMOL,KOCTOT,KOCVL,KOCVLS,KOCLS,
+ KOCV,KOCL,KOCS

where:

XMW Molecular weights.


BP Normal boiling points in problem input units.
DENS Component liquid densities at 60ºF (15.55ºC) and one
atmosphere in problem input units.
TC Critical temperatures, absolute input temperature units.
PC Critical pressures, absolute input pressure units.
1) PETROLEUM and NONLIB components are given a LIBID of ‘0’. Library ID numbers for all
other components may be found in the DataPrep Input Manual or by using the COMPS
utility.

12-18 Interfacing Software, Common Blocks, and Data


VC Critical volumes, cc/gm mole.
ZC Critical compressibilities (Zs).
OMEGA Acentric factors.
HFORM Heat of formation in energy units/mole.
GFORM Energy of formation in energy units/mole.
LIBNO Library ID numbers for components.1
KOCMOL Number of molar weight-based components.
KOCTOT Total number of normal components.
KOCVL Number of components that can
exist in vapor and liquid phases.
KOCVLS Number of components that can
exist in vapor, liquid, and solid phases.
KOCLS Number of components that can
exist in liquid and solid phases.
KOCV Number of components that can exist in the vapor phase.
KOCL Number of components that can exist in the liquid phase.
KOCS Number of components that can exist in the solid phase.
1) PETROLEUM and NONLIB components are given a LIBID of ‘0’. Library ID numbers for all
other components may be found in the DataPrep Input Manual or by using the COMPS
utility.

/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’

This INCLUDE file contains the following common block:


COMMON/OUTFAC/TXXX(20),IHOL(37),IXNAME(4,MAXCN)

Output items may be multiplied by the TXXX array to accomplish


any needed conversions to output dimensions when multiple output
dimensions are used.

Weight/time = (weight/time)p · TXXX(1)

Liquid volume/time = (liquid volume)p · TXXX(2)

Weight = weightp · TXXX(3)

PRO/II Data Transfer System and User-Added Subroutines User’s Guide 12-19
Liquid volume = (liquid volume)p · TXXX(4)

Liquid density = (liquid density)p · TXXX(5)

Enthalpy = enthalpyp · TXXX(8)


Enthalpy/time = (enthalpy/time)p · TXXX(9)

Temperature base = TXXX(10)

Pressure base = TXXX(11)

Enthalpy/weight = (enthalpy/weight)p · TXXX(12)

Scale factor1 = TXXX(13)


Actual vapor vol./time = (actual vapor vol./time)p · TXXX(14)
Vapor density = (Vapor density)p · TXXX(15)

Thermal Conductivity = (Thermal conductivity)p · TXXX(16)

Viscosity = (Viscosity)p · TXXX(17)


Surface Tension = (Surface tension)p · TXXX(18)

Standard vapor volume = (Standard vapor volume)p · TXXX(20)


For temperature and pressure conversions, factors from /FACTOR/
must also be used.
Temp = (tempp + TCONVT) · TXXX(6) - TXXX(10)

Pres = (presp + PCONVT) · TXXX(7) - TXXX(11)


where TCONVT and PCONVT are from /FACTOR/.

For the above conversions, the subscript p is used to represent prob-


lem input dimensional units.

The IHOL array shown in Table 12-3 contains Hollerith information


corresponding to the output dimensions. All entries are A4 except
temperature which is A3. Blanks are denoted with b.

12-20 Interfacing Software, Common Blocks, and Data


Table 12-3: Hollerith Array
IHOL Description
1 per time unit /XXX
2 weight unit XXb
3 multiple weight units bXXS
4 per weight /XXb
5 degree bDEG
6 temperature unit b Xb
7 pressure unit XXXX
8 energy unit XXXX
9 liquid volume unit XXXX
10 per liquid volume /XXX
11 vapor volume unit XXXX
12 per vapor volume /XXX
13 length unit XXbb
14 work unit bXXb
15,16 viscosity unit XXXX XXXX
17,19 thermal conductivity unit XXXX XXXX XXXX
20,21 surface tension unit XXXX XXXX
22 liquid bLIQ
23 UIDb
24 vapor bVAP
25 ORbb
26 mixed bMIX
27 EDbb
28 mole MOLE
29 mols MOLS
30 wet WET
31 dry bDRY
32 blank bbbb
33 zero bbb 0

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.

Note: The IHOL array is appropriately modified from input dimen-


sions when alternate output dimensions are requested. The
IXNAME array contains the component names in the format XXXX
XXXX XXXX XXXX (4A4).

/CUDATA/
Common block /CUDATA/ is a single-vector storage area for various
groups of stream, unit, and component data.
INCLUDE ‘CUDATA.CMN’

This INCLUDE file contains the following common block:


COMMON/CUDATA/ TDATA(2600)
where:

TDATA Real constants, entered in the Thermodynamic Data


category of input (see Chapter 13, User-Added
Thermodynamic Property Methods).

12-22 Interfacing Software, Common Blocks, and Data


/CUSPEC/
Common block /CUSPEC/ is required only in any subroutine calling
UFLSH to perform an isentropic flash.

INCLUDE ‘CUSPEC.CMN’

This INCLUDE file contains the following common block:


COMMON/CUSPEC/IX1(10),SISENV,RX1(7)

where:

SISENV Entropy of the stream to be used as the target entropy for


the call to UFLSH. The value should be obtained by calling
subroutine UHS and transferred to SISENV without any
dimensional or other conversion.

User-Defined Data Files


FIGETU
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 UAS system. The declaration is:
FIGETU ( 1, LOUT)

The FIGETU subroutine call returns the next available FORTRAN


unit number for input or output as integer variable LOUT. An exam-
ple code extract is shown below:
CHARACTER*8 FNAME
CHARACTER*12 FEXTRA
1001 FORMAT(‘ ENTER FILE NAME: ‘)
1002 FORMAT(A)
.
.
C
C
C GET ANOTHER FILE UNIT FOR OUTPUT
C
CALL FIGETU(1, LOUT)
C
C OPEN FILE ‘FNAME.OXX’ AS NEW FORMATTED
C SEQUENTIAL FILE
C
FEXTRA = FNAME // ‘OXX’
OPEN (UNIT=LOUT, FILE=FEXTRA, STATUS=‘NEW’,
+ FORM=‘FORMATTED’, ACCESS=‘SEQUENTIAL’)

PRO/II Data Transfer System and User-Added Subroutines User’s Guide 12-23
Chapter 13
User-Added Thermodynamic
Property Methods

The PRO/II user-added subroutines utility may be used to link your


own K-value, enthalpy, entropy, or density calculation module into
PRO/II. To indicate to PRO/II that a user-added thermodynamic
property method is being used instead of a built-in method in a
keyword file, you must specifically point to your module using the
METHOD statement. For example, to use a user-added K-value
method:
METH KVALUE=U1,ENTH=CP,ENTR=CP,DENS(V)=SRK, &
DENS(L)=,API,TRANS=PETRO, SET=1
This example indicates that the previously linked user-added
K-value method, U1 is to be used in thermodynamic method set “1.”
The valid entries for the KVALUE keyword are U1, U2, U3, ..., U15.
Each entry corresponds to a specific user-added subroutine. Key-
word entry U1 corresponds to the FORTRAN subroutine named
UKHS1.FOR, U2 to UKHS2.FOR, and so on.

Note: These subroutines may be used to calculate K-values,


enthalpies, entropies, or densities and may call all other
subroutines.

To use this K-value method in a unit operation calculation, you


would use a similar keyword construct. For example, to perform an
isothermal flash at 30°F:
FLASH UID=FL1
FEED 1
PROD V=2, L=3
ISOT TEMP=30, DP=0
METHOD SET=1

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.

UTHERX Common Block


The UTHERX common block passes variables to and from the PRO/
II calculation engine. These variables include temperature, pressure,
vapor and liquid composition, entropy, enthalpy, and density values.
Each UKHSxx.FOR routine must include the following lines of code:
INCLUDE ‘PMXUSR.CMN’
INCLUDE ‘UTHERX.CMN’

Note: The size of the arrays dimensioned above (by way of


PMXUSR.CMN) correspond to the 300 component maximum limit
discussed in Chapter 9, UAS Introduction.
The input variables passed into the user-added subroutine routine
from PRO/II depend on what thermodynamic property is being cal-
culated by that routine and are shown in Table 13-1.
Table 13-1: Input Variables Passed Into UKHSxx. (xx = 1-15)
Category Description K-Value H S ρ
IXXFLG Flag indicating what valid valid valid valid
data is requested by
PRO/II (see below)
JXXFLG Returned flag valid valid valid valid
conveying information
back to PRO/II based
on IXXFLG request.
IXXFLG and JXXFLG are
discussed below.
NOCZ Number of components valid valid valid valid
in problem—must not
exceed MAXCN
IFPHZ Phase Flag n/a valid valid valid
KUOUT FORTRAN file unit valid valid valid valid
number for writing to
default output file
n/a Not applicable

13-2 User-Added Thermodynamic Property Methods


Table 13-1: Input Variables Passed Into UKHSxx. (xx = 1-15) (cont.)
Category Description K-Value H S ρ
TEMPX Temp. at which valid valid valid valid
property values are to
be generated (Input
Units)
TDELTX Temp. increment in valid valid valid n/a
Input units for
calculating derivatives
PRESX Pres. at which property valid valid valid n/a
values are to be
generated (Input Units)
XVV Array of vapor phase valid valid valid valid
composition in mole
fractions.
XLL Array of liq. phase valid valid valid valid
composition in mole
fractions.
XLL2 Array of 2nd liq. phase valid valid valid valid
composition in mole
fractions (if water
decant is ON, this is
decanted water only).
n/a Not applicable

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

13-4 User-Added Thermodynamic Property Methods


Rigorous VLLE Calculations
For enthalpy, entropy, and density calculations, the user-added sub-
routine will be called for the two liquid phases individually. You do
not have to worry about dealing with two liquid compositions at
once, and later combining the results into a single bulk value.
PRO/II does this combination for you at a higher level. You must,
however, make sure that your user-added subroutine for VLE K-val-
ues works with a single-liquid phase composition via the XLL vec-
tor. If you use a user-added subroutine for VLLE K-values, PRO/II
will pass to it the composition of the light and heavy liquid phases
in the XLL and XLL2 arrays, respectively.

Variables IXXFLG and JXXFLG


These UTHERX common flags are used to communicate information
on the calculation status between the user-added subroutine and the
PRO/II program. IXXFLG is used by PRO/II to indicate to the user-
added subroutine what type of calculation is needed (e.g., K-values,
enthalpies, etc.). JXXFLG is used to indicate to PRO/II what property
values are being returned from the user-added subroutine, or
whether a calculation error occurred. For example, if PRO/II passes
a value of -1 for IXXFLG to the user-added subroutine, that indicates
that it needs information on the type of K-value method that will be
used by the routine. If the user-added routine is calculating the
K-values using the NRTL method, it should return a value of 3 to
PRO/II via JXXFLG, indicating that a compositionally dependent
K-value method is being used.
Table 13-3: Valid Values of IXXFLG, JXXFLG for each Thermodynamic Property Method
Property Value of Description Value of Description
IXXFLG JXXFLG
K-Value -1 Indicates type of K-value 1 K-value method is not compositionally
method being supplied dependent (i.e., not an equation of state
or liquid activity coefficient method.)
2 K-value method is based on an
equation of state method.
3 K-value method is based on an activity
coefficient method.
0 Init. estimates of K-values 0 Initial K-value estimates calculated
needed by PRO/II, i.e., using SIMSCI initial estimate methods.
values not yet available in Note: Critical properties (Tc, Pc, ω
arrays XVV, XLL, or XLL2 must be available for all components).
1 The user-added K-value method will
return initial K-value estimates via the
XKV array.

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’

IF ( IXXFLG .LT. 0) THEN


JXXFLG = 2
GO TO 9999
ENDIF
.
9999 CONTINUE
RETURN
END

In this example, IXXFLG is equal to -1, indicating a request for the


user-added subroutine to specify the degree of compositional
dependency. In this case, JXXFLG is set equal to 2, indicating a com-
position-dependent equation of state method, and then returns.

CUDATA Common Block


The CUDATA common block is used to pass user-supplied data to the
user-added property routine via the UDATA keyword in the PRO/II

13-6 User-Added Thermodynamic Property Methods


keyword input file. The CUDATA common block contains one vari-
able, TDATA. TDATA is an array that may contain up to 2600 floating
point items.
COMMON / CUDATA / TDATA(2600)

For example, the user-added enthalpy method UKHS1.FOR (desig-


nated by the keyword entry ENTH=U1 on the METHOD statement)
may require input data that may change from one run to another
(e.g., constants from regressed data). The UDATA statement may be
used to pass these values to the user-added routine.
METHOD KVAL=SRK,ENTH=U1,ENTR=SRK,DENS(V)=SRK, &
DENS(L)=API, TRANS=PETRO, SET=A
ENTH
UDATA 1, 0.5/ 2, 1.0/ 3, 1.5.....

In the user-added subroutine, these values are passed to the program


through the CUDATA common block and the TDATA array:
SUBROUTINE UKHS1
.
INCLUDE ‘PMXUSR.CMN’
INCLUDE ‘UTHERX.CMN’
INCLUDE ‘CUDATA.CMN’

If we added two lines of code to echo the values input through


CUDATA:

1001 FORMAT(‘ TDATA = ‘, 5F10.4)


.
.
WRITE(IOUT, 1001) (TDATA(I), I = 1,5)

The following results would be written to the output file:


TDATA = 0.5000 1.0000 1.5000 ....

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:

METH KVAL=U1,ENTH=CP,ENTR=CP,DENS(V)=SRK, &


DENS(L)=API, TRANS=PETRO, SET=1
WATER DECANT=OFF
In the above input example, water decant is declared OFF. Thus,
water will be treated as a regular component. Although the default

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.

When water is treated as a separate system, the system pressure is


reduced by the corresponding water partial pressure and all compu-
tations are carried out on a water-free basis. The water vapor is
assumed to form an ideal vapor mixture with the hydrocarbon and
light gas vapor. When water partial pressure reaches the saturation
pressure, an ideal liquid phase consisting of pure water will be
formed. Water will be dissolved in the hydrocarbon liquid phase up
to the saturation limit.

The expression for water K-values is as follows:


0
Pw
K w = -------------
- (13-1)
∏ Xs
where:
0
Pw = vapor pressure of water

Π = system pressure

XS = solubility of the water in the hydrocarbon liquid

Use of KDECNT Flag


You can use the integer flag KDECNT in common UTHERX to deter-
mine if water decant is on and to locate the position of water in the
component list. Table 13-4 shows the significance of the KDECNT
value.
Table 13-4: Significance of KDECNT Value
Value of KDECNT Significance
Zero Water decant is OFF
Non-Zero Water decant is ON and water is located in
position KDECNT in the component list.

Note: Water decant does not require water to be in component


position number 1. This is different than PROCESS. Therefore,
you must know the position of water in the component list.

13-8 User-Added Thermodynamic Property Methods


Water Decant and User-Added K-Value Methods
Vapor and liquid compositions passed to user-added K-value meth-
ods through arrays XVV and XLL in common UTHERX will be on a
dry basis when decant is ON.

Note: Compositions will be normalized to be on a water-free


basis when water decant is ON.

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.

Water Decant and Other User-Added Thermodynamic Properties


Other thermodynamic properties such as enthalpy, entropy, etc. of
the free water decant phase (including streams with single compo-
nent H2O) will be calculated by SIMSCI water property methods
when water decant is ON. Vapor and liquid compositions of vapor
and non-aqueous liquid phases will be on a wet basis. Compositions
will include water.

Therefore, if water is present in the vapor or liquid, the user should


calculate the property values for the water component using subrou-
tine UH2OP. The position of water when decant is ON is KDECNT.

Example 13-1: Water Decant


In the following example, water decant is ON and water will be han-
dled as a separate system. This example serves also to illustrate the
use of the FACTOR common for unit conversion, the XPROPX com-
mon for access to component library numbers, and the subroutine
UH2OP to calculate pure water properties. These are discussed more
fully in Chapter 12, Interfacing Software, Common Blocks, and
Data Files.
SUBROUTINE UKHS1
.
PARAMETER (MAXCN = 300)
INCLUDE ‘UTHERX.CMN’
INCLUDE ‘XPROPX.CMN’
INCLUDE ‘FACTOR.CMN’

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

Internal UAS Component Order vs. Print Order


What Is Internal Component Order?
PRO/II will reorder components internally based on phase availabil-
ity. This is done so that calculations can be performed efficiently on
contiguous groups of components. Phase availability refers to the
phases (vapor, liquid, solid) in which a component is allowed to
exist. This is usually determined by the availability of data; for
example, some components may have complete data for all three
phases and be designated as VLS while others might be lacking data
for the solid phase and be designated as VL.

This reordering is referred to as SIMSCI Internal Component Order.


By contrast, the sequence order for the components selected by the
user at input and in the output reports is referred to as Print Order.
This reordering will impact user-added subroutines which assumes
that components are ordered in Print Order. The user must take
steps as described below to handle the internal component order.

13-10 User-Added Thermodynamic Property Methods


The grouping of components by phase designation for internal use
is as shown in Table 13-5.
Table 13-5: Component Phase Versus Internal Order
Phase Availability Internal Order
VL 1st group
VLS 2nd group
LS 3rd group
S 4th group

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

The default PRO/II phase designations, print order, and internal


order for components nitrogen through n-butane are given in
Table 13-6 below.
Table 13-6: Phase Designation, Print and Internal Order for N2-NC4
Component Phase Designation Print Order Internal Order
N2 VL 1 1
CO2 VLS 2 7
CH4 VL 3 2
C2 VL 4 3
C3 VL 5 4
IC4 VL 6 5
NC4 VL 7 6

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

How Order Affects User-Added Subroutines


In user-added subroutines, compositional arrays are in Internal
Order.

Note: An important exception is user-added kinetics which con-


verts all compositional data to Print Order in the arrays passed to
USKIN1-5.

Thus, all compositional arrays in the UTHERX and XPROPX com-


mons, the stream compositions in the standard STREAM array used
by TTPROP, UHS, UDENS, URXSTR, etc. are all in Internal Order. If
you are assuming that components are in Print Order, then you must
use the COPNUM and COINUM subroutines described below to
access the Internal Order.

Component Order Subroutines COPNUM and COINUM


COPNUM
This subroutine returns component print order numbers given the
internal order numbers.
Calling sequence:
CALL COPNUM( IC, IS, IP)

where:

IC Input integer Internal component number


IS Input integer Value = 1 always
IP Output integer Print component number

Example: Retrieving Component Print Order Numbers


C
C RETRIEVE PRINT ORDER
C
1001 FORMAT(‘ INTERNAL NUMBER = ‘,I5,’ PRINT NUMBER = ‘, I5)
C

13-12 User-Added Thermodynamic Property Methods


DO 2001 IC = 1, NOCX
CALL COPNUM(IC, 1, IP)
WRITE (IOUT, 1001) IC, IP
2001 CONTINUE

COINUM
This subroutine returns component internal order numbers given the
print order numbers.

Calling sequence:
CALL COINUM( IP, IS, IC)

where:

IP Input integer Print component number


IS Input integer Value not significant for user
IC Output integer Internal component number

Example: Retrieving Component Internal Order Numbers


C
C Process Data in Print Order
C Assume that TDATA contains K-Value Vector
C In print order
C
DO 2001 IP = 1, NOCX
CALL COINUM (IP, IS, IC)
XKV(IC) = TDATA(IP)
2001 CONTINUE

Example 13-2: Regular Solution Theory K-Value Method


This subroutine calculates equilibrium K-values with the
expression:
o
γi P i
K i = ---------
- (13-2)
P
where:
γi = liquid phase activity coefficient for component i

Pio = vapor pressure for component i

P = system pressure

Activity coefficients are calculated with the Hildebrand equation:


L 2
V i ( δi – δ m )
ln γi = ------------------------------
- (13-3)
RT

PRO/II Data Transfer System and User-Added Subroutines User’s Guide 13-13
where:

ViL = liquid molal volume for component i

δi = solubility parameter for component i

R = gas constant

T = temperature

and:
L
ΣX i V i δ i
δ m = -------------------- (13-4)
L
ΣX i V i

Liquid molal volumes and solubility parameters for each compo-


nent are entered as constants through the PRO/II keyword input file
with liquid molal volumes entered as TDATA(1) - (300) and solubility
parameters as TDATA(301) - (600).

Allowance has been made to treat water as a separate system.

FORTRAN Listing

UKHS4.FOR—User-Added K-Value Method Using Regular Solution


Theory
SUBROUTINE UKHS4
C
INCLUDE ‘PMXUSR.CMN’
C - THIS SUBROUTINE CALCULATES KVALUES USING REG.SOLUTION
C THEORY. WATER MAY BE HANDLED AS A SEPARATE SYSTEM IF
C - DESIRED. CONVERSION FACTORS COMMON
C
INCLUDE ‘FACTOR.CMN’
INCLUDE ‘UTHERX.CMN’’
C
C - COMMON FOR USER SUPPLIED THERMO CONSTANTS
C
INCLUDE ‘CUDATA.CMN’
C
DIMENSION STREAM(MAXCN+10),VPS(MAXCN),VMOLE(MAXCN),&
SOLU(MAXCN)
C
SET KDCALL = 1 (INDICATES USING NEW UTHERX)
C
KDCALL = 1
C
JXXFLG = 0
C
ZXX1 = 0.
ZXX2 = 0.
IF(IXXFLG.NE.-1) GO TO 10

13-14 User-Added Thermodynamic Property Methods


C
C - CALL WAS FROM INPUT PROCESSING
C - INDICATE ACTIVity COEFFICIENTS
C
JXXFLG = 3
GO TO 999
C
C - INITIALIZE LOCAL VARIABLES
C
10 CONTINUE
TDERIV = 0.0
DO 11 I=1,MAXCN+10
STREAM(I)=0.0
11 CONTINUE
DO 12 I=1,MAXCN
VPS(I) = 0.0
VMOLE(I) = 0.0
SOLU(I) = 0.0
12 CONTINUE
C
C - SET UP COMPONENT SOLUBILITY PARMS AND MOLAL VOLUME
C
DO 20 I=1,NOCZ
C
C - LIQ MOLAL VOLS ARE IN TDATA(1)-(300),
C - SOL PARAMS IN TDATA(301)
C - BUT THAT WAS PRINT ORDER,SO MUST CONVERT TO INPUT ORDER
C
CALL COINUM(I, IS, IC)
VMOLE(IC) = TDATA(I)
SOLU(IC) = TDATA(I+300)
20 CONTINUE
C
C
C - LET PRO/II FURNISH INITIAL KVALUES
C
IF(IXXFLG.EQ.0) THEN
GO TO 999
ELSE IF(IXXFLG.NE.1) THEN
C
C - IF CALLED FOR PROPERTY OTHER THAN K-VALUES, SET ABORT
C - FLAG AND RETURN
C
JXXFLG = 99
GO TO 999
ENDIF
C -
C - FETCH COMPONENT VAPOR PRESSURES
C
STREAM(1) = 1.
STREAM(2) = TEMPX
DO 50 I=1,NOCZ
STREAM(I+10) = 1.
50 CONTINUE
STREAM(3) = PRESX
DO 54 I=4,10
STREAM(I)=0.0
54 CONTINUE

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

13-16 User-Added Thermodynamic Property Methods


PRO/II Keyword Input File
TITLE PROB=UKHS4 , PROJ=UKHS4 , USER=SIMSCI , DATE=JUN99
$ TESTS UKHS4
DESC TEST USER METHOD AGAINST REGULAR SOLUTION METHOD
DESC THE FIRST AND THIRD FLASHES SHOULD GIVE THE SAME
DESC RESULTS WHILE THE SECOND FLASH SHOULD DECANT WATER
COMPONENT DATA
LIBID 1,H2O/2,C1/3,C2/4,IC4/5,NC4/6,IC5/7,NC5/8,NC8,,&
C6 PLUS,BANK=SIMSCI
THERMO DATA
METHODS KVALUE=U4,ENTHALPY=LK,DENSITY=LK, SET=U4REG
WATER DECANT=OFF
KVALUE
$ LIQUID VOLUMES IN 1-300, SOLUBILITY PARAMETERS IN 301-600
UDATA 1,18.069/37.97/59.23/105.24/96.48/117.1/116.05/ *
163.01,23.37/5.67/6.06/6.145/6.697/6.775/7.04/7.53
$
METHOD SYSTEM=U4, ENTH=LK, DENS=LK, ENTR=NONE,*
SET=U4DEC
WATER DECANT=ON
KVALUE
$ LIQUID VOLUMES IN 1-300, SOLUBILITY PARAMETERS IN 301-600
UDATA 1,18.069/37.97/59.23/105.24/96.48/117.1/116.05/ *
163.4/301,23.37/5.67/6.06/6.145/6.697/6.775/7.04/7.53
$
METHODS SYSTEM=REGULAR, ENTH=LK,DENS=LK,ENTR=NONE,*
NAME=REGU
STREAM DATA
$ FEEDS FOR USER THERMO METHOD
PROP STRM=1,TEMP=200,PRES=150,COMP=2,100/3,100/4,75/5,75/*
6,54/7,45/8,10
PROP STRM=20,TEMP=350,PRES=150,COMP=1,1000
$ FEEDS FOR REGULAR THERMO METHOD
PROP STRM=1A,TEMP=200,PRES=150,COMP=2,100/3,100/4,75/&
5,75/6,54/7,45/8,10
PROP STRM=20A,TEMP=350,PRES=150,COMP=1,1000
UNIT OPERATIONS
FLASH KPRINT,NAME=USER DRY,UID=F1
FEED 1
PROD L=2,V=3
ISO TEMP=150,PRES=100
METHOD SET=U4REG
FLASH KPRINT,NAME=USER DECANT,UID=F2
FEED 1,20
PROD L=4,V=5,W=6
ISO TEMP=150,PRES=100
METHOD SET=U4DEC
FLASH KPRINT,NAME=REGULAR DRY,UID=F3
FEED 1A
PROD L=7,V=8
ISO TEMP=150,PRES=100
METHOD SET=REGU
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

VAPOR-LIQUID COMPOSITIONS AND K-VALUES FOR UNIT 1, ‘F1’


COMPONENT VAPOR LIQUID K-VALUE
--------- -------- ------- ----------
1 H2O 0.00000 0.00000 4.9000E+01
2 C1 0.23373 0.00255 9.1770E+01
3 C2 0.23270 0.01663 1.3992E+01
4 IC4 0.16776 0.10422 1.6097E+00
5 NC4 0.16418 0.15278 1.0746E+00
6 IC5 0.10901 0.23485 4.6417E-01
7 NC5 0.08754 0.24053 3.6393E-01
8 C6 PLUS 0.00508 0.24844 2.0454E-02

VAPOR-LIQUID COMPOSITIONS AND K-VALUES FOR UNIT 2, ‘F2’


COMPONENT VAPOR LIQUID K-VALUE
----------- -------- -------- ----------
1 H2O 0.03697 0.00451 8.1945E+00
2 C1 0.22344 0.00243 9.2033E+01
3 C2 0.22258 0.01586 1.4036E+01
4 IC4 0.16136 0.09973 1.6180E+00
5 NC4 0.15835 0.14710 1.0765E+00
6 IC5 0.10622 0.22847 4.6492E-01
7 NC5 0.08566 0.23540 3.6389E-01
8 C6 PLUS 0.00543 0.26651 2.0360E-02

VAPOR-LIQUID COMPOSITIONS AND K-VALUES FOR UNIT 3, ‘F3’


COMPONENT VAPOR LIQUID K-VALUE
--------- --------- ------- ----------
1 H2O 0.00000 0.00000 4.9053E+01
2 C1 0.23374 0.00255 9.1757E+01
3 C2 0.23270 0.01673 1.3912E+01
4 IC4 0.16776 0.10422 1.6097E+00
5 NC4 0.16418 0.15279 1.0746E+00
6 IC5 0.10900 0.23485 4.6415E-01
7 NC5 0.08753 0.24052 3.6393E-01
8 C6 PLUS 0.00508 0.24835 2.0446E-02

13-18 User-Added Thermodynamic Property Methods


Enthalpy and Entropy Calculations
Enthalpies and entropies may be calculated for streams based on
temperature, pressure, and composition (either liquid or vapor).

Calculated enthalpies must be returned to PRO/II in dimensionless


form, that is, divided by the quantity RT where:

R = gas constant in units consistent with the problem input


dimensional units for enthalpy and those units used
for temperature.

T = temperature

Calculated enthalpies may be given in either of two forms, namely:


*
H–H ∆H
----------------- = -------- (13-5)
RT RT
or

∆ H-
------- (13-6)
RT
where:

H* = ideal gas enthalpy

When form (13-5) is used, PRO/II will always compute H*:

No. Comps.


* *
H = x i Hi (13-7)
i=1

and
xi = mole fraction for component

Hi* = ideal gas enthalpy for component

Two enthalpy values must be computed, with one at a temperature


increment above the stated temperature, where the increment is
passed through a common block. These two values are used by
PRO/II to calculate the heat capacity for the stream at the stated
temperature.
User-computed enthalpies may be used for any unit operation cal-
culation, either user- or PRO/II defined. When rigorous distillation
is to be used in conjunction with user-computed enthalpies, it is

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.

Entropies may be computed in two forms (similar to enthalpies):


*
∆S ⁄ ∆x i Si – S
------------------ = -------------
- (13-8)
RT RT
where:

S* = ideal gas entropy

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:

xi = mole fraction for component i

Si* = ideal gas entropy for component i

Note: S* is computed from the ideal gas enthalpy equation. Ideal


gas enthalpy equations must be available for all components
when S* is to be computed.

Example 13-3: Petroleum Liquid and Vapor Enthalpy Calcula-


tions
Enthalpies for saturated liquids and vapors are to be generated using
the following relationships:

Liquid heat capacities are calculated using equation (13-11):

13-20 User-Added Thermodynamic Property Methods


C p = [ ( 0.6811 – 0.308SG ) + 0.000815T – 0.000306SG ] . (13-11)
( 0.055K + 0.35 )
where:

Cp = heat capacity, Btu/lb °F

SG = specific gravity at 60°F

K = Watson K factor = 3 ( ABP ) ⁄ ( SG )

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:

λb = latent heat, cal/g-mole

NBP = normal boiling point, K

Finally, the latent heat at any temperature T is calculated using the


following:

Tc – T .38
λ
----- =  ----------------- (13-13)
λb  T c – T b

where:

Tc = critical temperature, R

T = temperature, R

Tb = normal boiling point, R

Liquid enthalpies are calculated by integration of equation (13-11)


from 32°F to the desired temperature. Vapor enthalpies are derived
by adding the latent heat to the liquid enthalpies.

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

UKHS3.FOR — User-Added Enthalpy Method


SUBROUTINE UKHS3
C -
C - CONVERSION FACTORS COMMON
COMMON/FACTOR/TCONVT,TFAC,PCONVT,PFAC,TIMFAC,WTFAC,VVFAC,
1 ARFAC,XLVFAC,SPGFAC,HSFAC,WKFAC,VISFAC,TCFAC,VVFACA,STFAC,FACA,
2 FACB,EXPFAC,XM3FAC,FTOR,CTOK,XKTOR,ATM,VVTOML,RCONST,
3 FARESV(14)
C
INLCUDE ‘PMXUSR.CMN’
C
C USE NEW XPROPX COMPONENT DATA COMMON
C
INCLUDE ‘XPROPX.CMN’
C
C USE NEW UTHERX - USER ADDED INTERFACE
C
INCLUDE ‘UTHERX.CMN’
C - STATEMENT FUNCTION TO CALCULATE ENTHALPY FROM CP EQUATION
XXXH(T,XK,SG) = (0.055*XK + 0.35) * ((0.6811 - 0.308*SG)
1 *(T-32)+0.5*(0.000815-0.000306*SG)*(T*T-1024.))
C -
C
C - SET JXXFLG TO INDICATE THAT H/RT IS RETURNED
JXXFLG = 1
KDCALL = 1
C - TEST FOR CORRECT USE OF THIS SUBROUTINE
IF ( IXXFLG .EQ. 2 ) GO TO 10
C - ERROR
WRITE ( KUOUT, 1000 ) IXXFLG
1000 FORMAT(‘***ERROR-USER METHOD U3 IS ENTHALPIES - IXXFLG, * = ’,I5,//)
JXXFLG = 99
RETURN
C - COMPUTE LIQUID ENTHALPY
10 SGL = 0.0
BPL = 0.0
WTL = 0.0
TCL = 0.0
WATERX = 0.0
TOT = 0.0
DO 20 I = 1, NOCZ
C - USE LIQUID OR VAPOR COMPOSITION, DEPENDING ON IFPHZ
C - ASSUME LIQUID
IF (I .EQ. KDECNT) GO TO 20
FLO = XLL(I)
C - REPLACE WITH VAPOR IF APPROPRIATE
IF ( IFPHZ .EQ. 1 ) FLO = XVV(I)

13-22 User-Added Thermodynamic Property Methods


SGL = SGL + XMW(I) * FLO / DENS(I)
WTL = WTL + XMW(I) * FLO
BPL = BPL + BP(I) * FLO
TCL = TCL + TC(I) * FLO
TOT = TOT + FLO
20 CONTINUE
SGL = ( WTL / SGL ) / SPGFAC
IF ( KDECNT .EQ. 0 ) GO TO 30
C - NORMALIZE THE MOLE WT,NBP,AND TC WHEN WATER IS A SEPARATE
C SYSTEM
BPL = BPL / TOT
WTL = WTL / TOT
TCL = TCL / TOT
C - WATER MOLE FRACTION
WATERX = XLL(KDECNT)
IF ( IFPHZ .EQ. 1 ) WATERX = XVV(KDECNT)
C - CONVERT TC AND BP TO DEG R
C - NOTE THAT TC IS ALREADY IN ABSOLUTE TEMPERATURE UNITS
30 TCL = TCL * TFAC
BPL = ( BPL + TCONVT ) * TFAC
C - COMPUTE WATSON K FOR MIXTURE
WK = BPL ** 0.33333 / SGL
C - CONVERT TEMPS TO DGR F FOR CP EQUATION
T1 = ( TEMPX + TCONVT ) * TFAC - FTOR
T2 = ( TEMPX + TDELTX + TCONVT ) * TFAC - FTOR
C - COMPUTE ENTHALPY BY INTEGRATION OF CP EQUATION-BASIS IS
C 32 F LIQ
C - ENTHALPY IS BTU/LB FROM INTEGRAL
HSX1 = XXXH ( T1, WK, SGL )
HSX2 = XXXH ( T2, WK, SGL )
C - NOW CONVERT TEMPS TO DEG R FOR LATENT HEAT CALCS
T1 = T1 + FTOR
T2 = T2 + FTOR
C - CONVERT ENTHALPY TO DIMENSIONLESS FORM (H/RT)
HSX1 = HSX1 * WTL / ( RCONST * T1 )
HSX2 = HSX2 * WTL / ( RCONST * T2 )
IF ( IFPHZ .EQ. 1 ) GO TO 40
C - LIQUID -ADD WATER ENTHALPY IF APPROPRIATE
IF ( KDECNT .EQ. 0 ) GO TO 99
GO TO 50
C -
C - VAPOR
C - COMPUTE LATENT HEAT AT NBP IN BTU/LBMOLE FROM KISTIAKOWSKY
C EQN
40 XLAMBP = BPL * ( 8.75 + 4.571*LOG10( BPL / XKTOR ) )
C - USE WATSON RELATIONSHIP TO DETERMINE LATENT HEAT AT T1 AND C T2
DH1 = XLAMBP * ( (1.0 - T1/TCL)/(1.0 - BPL/TCL) ) ** 0.38
DH2 = XLAMBP * ( (1.0 - T2/TCL)/(1.0 - BPL/TCL) ) ** 0.38
C - ADD LATENT HEAT TO LIQUID TO GENERATE VAPOR ENTHALPIES
HSX1 = HSX1 + DH1 / ( RCONST * T1 )
HSX2 = HSX2 + DH2 / ( RCONST * T2 )
C -
C - WHEN WATER IS A SEPARATE SYSTEM ADD ON WATER ENTHALPY
IF ( KDECNT .EQ. 0 ) GO TO 99
50 CONTINUE
DELTA = 0.0
CALL UH2OP( 2, IFPHZ, TEMPX, PRESX, DELTA, HW1, T3 )
CALL UH2OP( 2, IFPHZ, TEMPX+TDELTX, PRESX, DELTA, HW2,T3)

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 Keyword Input File


TITLE PROB=USERADD , PROJ=UKHS3 , USER=SIMSCI , DATE=JUN99
$ TESTS UKHS3
COMPONENT DATA
LIBID 1,H2O
THERMO DATA
METHODS KVALUE=GS,ENTHALPY=U3,ENTR=NONE,&
DENS(L)=IDEAL, DENS(V)=SRK
STREAM DATA
PROP STREAM=1,RATE(V)=16,TEMP=300,PRES=25
D86 STREAM=1,DATA=0,150/10,230/50,273/90,320/100,395
API STREAM=1,AVG=51.3
$
PROP STREAM=2,TEMP=300,PRES=150,COMP=1,100,RATE(W)=200
UNIT OP DATA
FLASH UID=F-1 $ DRY FLASH
FEED 1
PROD L=3,V=4
ADIA
FLASH UID=F-2 $ WET FLASH
FEED 1,2
PROD L=5,V=6
ADIA
END

Partial PRO/II Output


SIMULATION SCIENCES INC. R PAGE P-4
PROJECT UKHS3 PRO/II UAS 386/EM
PROBLEM USERADD OUTPUT SIMSCI
STREAM MOLAR COMPONENT RATES JUN99
=================================================================================
FLASH ID F-1 F-2
NAME
FEEDS 1 1
2
PRODUCTS VAPOR 4 6
LIQUID 3 5
TEMPERATURE, F 300.000 219.166
PRESSURE, PSIA 25.000 25.000
PRESSURE DROP, PSI 0.000 0.000
MOLE FRAC VAPOR 0.32590 0.28149
MOLE FRAC TOTAL LIQUID 0.67410 0.71851
MOLE FRAC H/C LIQUID 0.67410 0.28919
MOLE FRAC FREE WATER 0.00000 0.42933
DUTY, MM BTU/HR 0.00000 0.00000
FLASH TYPE ADIABATIC-P ADIABATIC-P

13-24 User-Added Thermodynamic Property Methods


PROJECT UKHS3 PRO/II UAS 386/EM
PROBLEM USERADD OUTPUT SIMSCI
STREAM MOLAR COMPONENT RATES
=================================================================================
STREAM ID 1 2 3 4
NAME
PHASE MIXED WATER DRY LIQUID DRY VAPOR
FLUID RATES, LB-MOL/HR
1 H2O 0.0000 11.1019 0.0000 0.0000
2 NBP 116 0.2066 0.0000 0.0566 0.1501
3 NBP 140 0.2544 0.0000 0.0839 0.1705
4 NBP 166 0.2384 0.0000 0.0949 0.1435
5 NBP 189 0.2362 0.0000 0.1100 0.1261
6 NBP 213 0.3354 0.0000 0.1807 0.1547
7 NBP 239 0.5490 0.0000 0.3391 0.2100
8 NBP 266 2.1353 0.0000 1.4901 0.6452
9 NBP 281 1.7531 0.0000 1.2936 0.4596
10 NBP 311 0.4020 0.0000 0.3248 0.0771
11 NBP 337 0.2575 0.0000 0.2208 0.0367
12 NBP 362 0.2016 0.0000 0.1807 0.0209
13 NBP 387 0.1810 0.0000 0.1676 0.0134
14 NBP 402 0.0295 0.0000 0.0277 1.7748E-03
TOTAL RATE, LB-MOL/HR 6.7800 11.1019 4.5704 2.2096
TEMPERATURE, F 300.0000 300.0000 300.0000 300.0000
PRESSURE, PSIA 25.0000 150.0000 25.0000 25.0000
ENTHALPY, MM BTU/HR 0.1393 0.0538 0.0763 0.0630
MOLECULAR WEIGHT 113.9263 18.0150 117.5334 106.4653
MOLE FRAC VAPOR 0.3259 0.0000 0.0000 1.0000
MOLE FRAC TOTAL LIQUID 0.6741 1.0000 1.0000 0.0000
MOLE FRAC H/C LIQUID 0.6741 0.0000 1.0000 0.0000
MOLE FRAC FREE WATER 0.0000 1.0000 0.0000 0.0000
STREAM ID 5 6
NAME
PHASE WET LIQUID WET VAPOR
FLUID RATES, LB-MOL/HR
1 H2O 7.7220 3.3799
2 NBP 116 0.0620 0.1446
3 NBP 140 0.0948 0.1596
4 NBP 166 0.1095 0.1289
5 NBP 189 0.1282 0.1080
6 NBP 213 0.2105 0.1249
7 NBP 239 0.3915 0.1576
8 NBP 266 1.6908 0.4446
9 NBP 281 1.4514 0.3018
10 NBP 311 0.3560 0.0460
11 NBP 337 0.2374 0.0202
12 NBP 362 0.1910 0.0106
13 NBP 387 0.1747 6.2863E-03
14 NBP 402 0.0287 7.9667E-04
TOTAL RATE, LB-MOL/HR 12.8483 5.0335
TEMPERATURE, F219.1656219.1656
PRESSURE, PSIA 25.0000 25.0000
ENTHALPY, MM BTU/HR 0.0831 0.1100
MOLECULAR WEIGHT 57.5859 46.1978
MOLE FRAC VAPOR 0.0000 1.0000
MOLE FRAC TOTAL LIQUID 1.0000 0.0000
MOLE FRAC H/C LIQUID 0.4025 0.0000
MOLE FRAC FREE WATER 0.5975 0.0000

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

——- TOTAL STREAM ——-


RATE, LB-MOL/HR 6.780 11.102 4.570 2.210
M LB/HR 0.772 0.200 0.537 0.235
TEMPERATURE, F 300.000 300.000 300.000 300.000
PRESSURE, PSIA 25.000 150.000 25.000 25.000
MOLECULAR WEIGHT 113.926 18.015 117.533 106.465
ENTHALPY, MM BTU/HR 0.139 5.38E-02 7.63E-02 6.29E-02
BTU/LB 180.359 269.082 142.126 267.665
MOLE FRACTION LIQUID 0.67410 1.000 1.000 0.000
MOLE FRAC FREE WATER 0.000 1.000 0.000 0.000

——- TOTAL VAPOR ———


RATE, LB-MOL/HR 2.210 N/A N/A 2.210
M LB/HR 0.235 N/A N/A 0.235
M FT3/HR 0.681 N/A N/A 0.681
STD VAP RATE(1), M FT3/HR 0.839 N/A N/A 0.839
MOLECULAR WEIGHT 106.465 N/A N/A 106.465
ENTHALPY, BTU/LB 267.665 N/A N/A 267.665
CP, BTU/LB-F 0.440 N/A N/A 0.440
DENSITY, LB/M FT3 345.276 N/A N/A 345.276
Z (FROM DENSITY) 0.9456 N/A N/A 0.9456

——- TOTAL LIQUID ——-


RATE, LB-MOL/HR 4.570 11.102 4.570 N/A
M LB/HR 0.537 0.200 0.537 N/A
FT3/HR 13.058 3.490 13.058 N/A
GAL/MIN 1.628 0.435 1.628 N/A
STD LIQ RATE, FT3/HR 11.072 3.208 11.072 N/A
MOLECULAR WEIGHT 117.533 18.015 117.533 N/A
ENTHALPY, BTU/LB 142.126 269.082 142.126 N/A
CP, BTU/LB-F 0.607 1.013 0.607 N/A
DENSITY, LB/FT3 41.137 57.305 41.137 N/A
Z (FROM DENSITY) 8.7614E-0 5.7842E-03 8.7614E-03 N/A
(1) STANDARD VAPOR VOLUME IS 379.49 FT3/LB-MOLE (60 F AND 14.696 PSIA)

13-26 User-Added Thermodynamic Property Methods


STREAM SUMMARY
=================================================================================
STREAM ID 1 2 3 4
NAME
PHASE MIXED WATER DRY LIQUID DRY VAPOR
——— DRY STREAM ———
RATE, LB-MOL/HR 6.780 N/A 4.570 2.210
M LB/HR 0.772 N/A 0.537 0.235
STD LIQ RATE, FT3/HR 16.000 N/A 11.072 4.928
MOLECULAR WEIGHT 113.926 N/A 117.533 106.465
MOLE FRACTION LIQUID 0.6741 N/A 1.0000 0.0000
REDUCED TEMP (KAYS RULE) 0.7150 N/A 0.7062 0.7339
PRES (KAYS RULE) 0.0588 N/A 0.0602 0.0561
ACENTRIC FACTOR 0.3182 N/A 0.3284 0.2973
WATSON K (UOPK) 11.618 N/A 11.618 11.618
STD LIQ DENSITY, LB/FT3 48.276 N/A 48.517 47.734
SPECIFIC GRAVITY 0.7741 N/A 0.7779 0.7654
API GRAVITY 51.300 N/A 50.392 53.374

——— DRY VAPOR ———-


RATE, LB-MOL/HR 2.210 N/A N/A 2.210
M LB/HR 0.235 N/A N/A 0.235
M FT3/HR 0.681 N/A N/A 0.681
STD VAP RATE(1), M FT3/HR 0.839 N/A N/A 0.839
SPECIFIC GRAVITY (AIR=1.0) 3.676 N/A N/A 3.676
MOLECULAR WEIGHT 106.465 N/A N/A 106.465
CP, BTU/LB-F 0.440 N/A N/A 0.440
DENSITY, LB/M FT3 345.276 N/A N/A 345.276

——— DRY LIQUID ———


RATE, LB-MOL/HR 4.570 N/A 4.570 N/A
M LB/HR 0.53 N/A 0.537 N/A
FT3/HR 13.058 N/A 13.058 N/A
GAL/MIN 1.628 N/A 1.628 N/A
STD LIQ RATE, FT3/HR 11.072 N/A 11.072 N/A
SPECIFIC GRAVITY (H2O=1.0) 0.7779 N/A 0.7779 N/A
MOLECULAR WEIGHT 117.533 N/A 117.533 N/A
CP, BTU/LB-F 0.607 N/A 0.607 N/A
DENSITY, LB/FT3 41.137 N/A 41.137 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-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)

13-28 User-Added Thermodynamic Property Methods


STREAM SUMMARY
=================================================================================
STREAM ID 5 6
NAME
PHASE WET LIQUID WET VAPOR
——— DRY STREAM ———
RATE, LB-MOL/HR 5.126 1.654
M LB/HR 0.601 0.172
STD LIQ RATE, FT3/HR 12.389 3.611
MOLECULAR WEIGHT 117.193 103.801
MOLE FRACTION LIQUID 1.0000 0.0000
REDUCED TEMP (KAYS RULE) 0.6317 0.6623
PRES (KAYS RULE) 0.0601 0.0551
ACENTRIC FACTOR 0.3274 0.2897
WATSON K (UOPK) 11.618 11.618
STD LIQ DENSITY, LB/FT3 48.492 47.535
SPECIFIC GRAVITY 0.7775 0.7622
API GRAVITY 50.485 54.151
——— DRY VAPOR ———-
RATE, LB-MOL/HR N/A 1.654
M LB/HR N/A 0.172
M FT3/HR N/A 0.471
STD VAP RATE(1), M FT3/HR N/A 0.628
SPECIFIC GRAVITY (AIR=1.0) N/A 3.584
MOLECULAR WEIGHT N/A 103.801
CP, BTU/LB-F N/A 0.596
DENSITY, LB/M FT3 N/A 364.571
——— DRY LIQUID ———
RATE, LB-MOL/HR 5.126 N/A
M LB/HR 0.601 N/A
FT3/HR 13.707 N/A
GAL/MIN 1.709 N/A
STD LIQ RATE, FT3/HR 12.389 N/A
SPECIFIC GRAVITY (H2O=1.0) 0.7775 N/A
MOLECULAR WEIGHT 117.193 N/A
CP, BTU/LB-F 0.561 N/A
DENSITY, LB/FT3 43.829 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).

For the Gunn-Yamada method:

V C
----- = ------ (13-14)
Vr Cr

where:

V, Vr = volume at desired and reference temperatures


C, Cr = density factors at desired and reference
temperatures

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

and (for 0.8 < Tr ≤ 0.99)


(0)
V = 1 + 1.3 1 – T r log ( 1 – T r ) – 0.50879 ( 1 – T r )
2 (13-18)
– 0.91534 ( 1 – T 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

13-30 User-Added Thermodynamic Property Methods


FORTRAN Listing
UKHS1.FOR — User-Added Liquid Density Method
SUBROUTINE UKHS1
C
C - COMPUTES LIQUID DENSITIES AT FLOWING CONDITIONS USING GUNN AND YAMADA METHOD
C -
INCLUDE ‘PMXUSR.CMN’
C -
C - CONVERSION FACTORS COMMON
INCLUDE FACTOR.CMN’
C
C COMPONENT PROPERTY COMMON
INCLUDE ‘XPROPX.CMN’
C
C - USER THERMO COMMON
INCLUDE ‘UTHERX.CMN’C
DIMENSION XVV(MAXCN), XLL(MAXCN), XLL2(MAXCN), XKV(MAXCN),
1 DRVX(MAXCN), IFLGX(15)
C
C STATEMENT FUNCTIONS TO EVALUATE GAMMA AND V0 TERMS AT GIVEN TRS
C
XXXGAM(TR) = .29607 -.09045*TR - .04842*TR*TR
C
C TR FROM 0.2 TO 0.8
C
XXXZOL(TR) =.33593-.33953*TR+1.51941*TR*TR-2.02512*TR*TR*TR
1 +1.11422*TR*TR*TR*TR
C
C - TR FROM 0.8 TO .99
C
XXXZOH(TR) = 1.0+1.3*(1.-TR)**.5*LOG10(1.-TR) -.50879*(1.-TR)
1 -.91534*(1.-TR)*(1.-TR)
C
C - TEST THAT LIQUID DENSITY WAS REQUESTED
C
IF (IXXFLG .NE. 4 .OR. IFPHZ .NE. 2) THEN
JXXFLG = 99
GO TO 9999
ENDIF
C
C SET KDCALL = 1 (NEW UTHERX IS USED)
KDCALL =1
C -
C - CONVERT PRESSURE TO PSIA
PSIA = (PRESX + PCONVT) * PFAC
C
C - CONVERT FLOWING TEMPERATURE TO DEG R
TDEGR = (TEMPX + TCONVT) * TFAC
C
C - COMPUTE MIXTURE MOL WT,TC, ACENTRIC FACTOR, AND SPGR AT 60F
WTM = 0.
ACEN = 0.
TCRM = 0.
DENM = 0.
DO 2001 I = 1, NOCZ
ACEN = ACEN + XLL(I) * OMEGA(I)

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

13-32 User-Added Thermodynamic Property Methods


PRO/II Keyword Input File
TITLE PROB=USERADD , PROJ=UKHS1 , USER=SIMSCI , DATE=JUN99
$
$ TESTS UKHS1
$
COMP DATA
LIBID 1,C2/2,C3/3,NC4/4,NC5
THERMO DATA
METHODS KVALUE=GS,ENTHALPY=SRK,DENSITY(L)=U1,&
DENS(V)=SRK
STREAM DATA
PROP STRM=1,TEMP=150,PRES=150,COMP=25/25/25/25
UNIT OPERATIONS
FLASH
FEED 1
PROD L=2,V=3
ISO TEMP=150,PRES=200
FLASH
FEED 1
PROD L=4,V=5
ISO TEMP=200,PRES=150
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

———— VAPOR ————-


RATE, LB-MOL/HR 67.530 N/A 45.430 100.000
M LB/HR 3.142 N/A 1.977 5.111
M FT3/HR 2.554 N/A 1.250 4.133
STD VAP RATE(1), M FT3/HR 25.627 N/A 17.240 37.948
SPECIFIC GRAVITY (AIR=1.0) 1.606 N/A 1.502 1.765
MOLECULAR WEIGHT 46.52 N/A 43.511 51.111
ENTHALPY, BTU/LB 204.446 N/A 201.417 227.785
CP, BTU/LB-F 0.486 N/A 0.501 0.509
DENSITY, LB/M FT3 1230.509 N/A 1581.297 1236.654
Z (FROM DENSITY) 0.8669 N/A 0.8411 0.8757
———— LIQUID ————
RATE, LB-MOL/HR 32.470 54.570 N/A N/A
M LB/HR 1.969 3.134 N/A N/A
FT3/HR 41.561 67.341 N/A N/A
GAL/MIN 5.182 8.396 N/A N/A
STD LIQ RATE, FT3/HR 53.889 88.242 N/A N/A
SPECIFIC GRAVITY (H2O=1.0) 0.5858 0.5695 N/A N/A
MOLECULAR WEIGHT 60.638 57.437 N/A N/A
ENTHALPY, BTU/LB 68.941 70.536 N/A N/A
CP, BTU/LB-F 0.665 0.686 N/A N/A
DENSITY, LB/FT3 47.373 46.544 N/A N/A
Z (FROM DENSITY) 0.0293 0.0377 N/A N/A

(1) STANDARD VAPOR VOLUME IS 379.49 FT3/LB-MOLE (60 F AND 14.696 PSIA)

THE FOLLOWING ZERO-RATE STREAMS WERE NOT PRINTED


4

13-34 User-Added Thermodynamic Property Methods


Chapter 14
Transport Property Subroutines

Each transport property subroutine has the capability of calculating


viscosity, thermal conductivity, and surface tension for a given
stream. Viscosity and thermal conductivity may be for liquid and/or
vapor streams. Surface tension applies to liquid streams only.

Note: Liquid diffusivities cannot be calculated by a user-added


transport subroutine.

Communicating with PRO/II


It is your responsibility to ensure that there is a correspondence
between the method selected in the input data and the code added to
the custom subroutine. Any properties not coded should be set to
zero. Table 14-1 shows the PRO/II keyword input requirements for
user-added transport properties.
Table 14-1: PRO/II Keyword Requirements for User-Added Transport
Statement Keyword Entry
METHODS TRANSPORT = U1, U2, U3, U4, or U5
or
VISCOSITY = U1, U2, U3, U4, or U5
CONDUCTIVITY = U1, U2, U3, U4, or U5
SURFACE = U1, U2, U3, U4, or U5

Note: The keywords VISCOSITY and CONDUCTIVITY may have


qualifiers (V) or (L) associated with them, where (V) and (L) refer
to the vapor and liquid phases respectively.

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

n The number of the transport property routine.


IPHASE 1 Vapor property requested
2 Liquid property requested
ICODE 1 Thermal conductivity requested
2 Viscosity requested
3 Surface tension requested
STRM 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.
VALUE The value of the requested property in input units.

Note: You may use all the user-added capabilities documented in


this manual when coding your UTRANn subroutine except you
must not call subroutine TTPROP with ITYPE=3 or greater from
within UTRANn.
Pure component data may be retrieved from the /XPROPX/ common
block as described in Chapter 13, User-Added Thermodynamic
Property Methods.

14-2 Transport Property Subroutines


Property methods not coded should set VALUE=0.0 so that it is not
undefined if a user incorrectly enters the input data method.

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.

The subroutine in this example calculates any transport property by


interpolating or extrapolating tabular property data (up to 10 points)
supplied by the user. Interpolation and extrapolation may be linear
or may be specified to be ln(prop) vs. 1/T. The required information
is passed in as UDATA, where the data slots (which become the
TDATA array inside the subroutine) are as follows:

TDATA(1) NPTS = number of tabular data points


TDATA(2) Interpolation/extrapolation flag
1 = linear
2 = ln(prop) vs. 1/T
TDATA(11 to 10+NPTS) Temperatures in input units,
in ascending order
TDATA(21 to 20+NPTS) Corresponding property values
in input units

PRO/II Data Transfer System and User-Added Subroutines User’s Guide 14-3
FORTRAN Listing

UTRAN2.FOR — User-Added Calculation Routine


SUBROUTINE UTRAN2(IPHASE, ICODE, STREAM, VALUE)
C
INCLUDE ‘PMXUSR.CMN’
C
C CONVERSION FACTORS COMMON
C
INCLUDE ‘FACTOR.CMN’
C
C COMPONENT PROPERTY COMMON
C
INCLUDE ‘XPROPX.CMN’
C
C - USER THERMO COMMON
C
INCLUDE ‘UTHERX.CMN’
C
DIMENSION STREAM(*)
DIMENSION TK(10)
C
1001 FORMAT(‘ ERROR !! - NUMBER OF DATA POINTS MUST BE FROM 2 TO 10’)
1002 FORMAT(‘ ERROR !! - INVALID EXTRAPOLATION FLAG SET ‘,I5)
1003 FORMAT(‘ ERROR !! - INCORRECT ENTRY OF TABULAR DATA’)
1004 FORMAT(‘ ERROR !! - TEMPERATURES MUST BE IN INCREASING ORDER’)
C
C FIRST, CHECK TO SEE IF PROPERTY ASKED FOR IS LIQUID VISCOSITY.
C IF NOT, SEND BACK ABORT FLAG
C
IF ((IPHASE.NE.2) .OR. (ICODE.NE.2)) THEN
JXXFLG = 99
GO TO 999
ENDIF
C
C CHECK NUMBER OF POINTS WHICH MUST BE BETWEEN 2 AND 10
C
IF (TDATA(1) .LT. 0.5) THEN
WRITE(KUOUT,1001)
VALUE = 0.0
GO TO 999
ENDIF
NPTS = ANINT(TDATA(1))
IF ((NPTS.LT.2) .OR. (NPTS.GT.10)) THEN
WRITE(KUOUT,1001)
VALUE = 0.0
GO TO 999
ENDIF
C
C CHECK INTERP/EXTRAP FLAG, WHICH MUST BE 1 OR 2 IF GIVEN
C
IF (TDATA(2) .LT. 0.5) THEN
INFLG = 1
ELSE
INFLG = ANINT(TDATA(2))
ENDIF
IF (INFLG .GT. 2) THEN

14-4 Transport Property Subroutines


WRITE(KUOUT,1002) INFLG
VALUE = 0.0
GO TO 999
ENDIF
C
C CHECK THAT USER SUPPLIED CORRECT NUMBER OF POINTS AND THAT THEY ARE
C REASONABLE. ALSO TRANSFER TEMP INTO ABSOLUTE ARRAY AND CHECK FOR
C TEMPERATURES IN ASCENDING ORDER
C
DO 50 I = 1, NPTS
TK(I) = (TDATA(10+I)+TCONVT)*TFAC/XKTOR
IF (TK(I) .LE. 0.0D0) THEN
WRITE(KUOUT,1003)
VALUE = 0.0
GO TO 999
ELSE IF (TDATA(20+I) .LE. 0.0D0) THEN
WRITE(KUOUT,1003)
VALUE = 0.0
GO TO 999
ELSE IF (I .GT. 1) THEN
IF (TK(I) .LE. TK(I-1)) THEN
WRITE(KUOUT,1004)
VALUE = 0.0
GO TO 999
ENDIF
ENDIF
50 CONTINUE
C
C CONVERT STREAM TEMPERATURE TO K
C
TEMPK = (STREAM(2)+TCONVT)*TFAC/XKTOR
C
C CHECK FOR TEMPERATURE BELOW T1 OR ABOVE TOP T
C
IF (TEMPK .LE. TK(1)) THEN
THI = TK(2)
TLO = TK(1)
VHI = TDATA(22)
VLO = TDATA(21)
ELSE IF (TEMPK .GE. TK(NPTS)) THEN
THI = TK(NPTS)
TLO = TK(NPTS-1)
VHI = TDATA(20+NPTS)
VLO = TDATA(19+NPTS)
ELSE
C
C BOUND TEMPERATURE ABOVE AND BELOW
C
DO 100 I = 2, NPTS
IF (TK(I) .GE. TEMPK) THEN
THI = TK(I)
TLO = TK(I-1)
VHI = TDATA(20+I)
VLO = TDATA(19+I)
ENDIF
100 CONTINUE
ENDIF
C

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

14-6 Transport Property Subroutines


PRO/II Keyword Input File
TITLE PROJECT=USERADD,PROBLEM=UTRAN2, &
USER=SIMSCI,DATE=06/01/99
PRINT RATE=M,STREAM=ALL,INPUT=ALL
DIME ENGLISH
COMPONENT DATA
LIBID 1,ETHANE/2,PROPANE/3,IBUTANE/4,BUTANE/ 5,PENTANE
TBPCUTS 115,300,6/400,10/650,8/800,4/1500,6
THERMODYNAMIC DATA
METHOD SYSTEM=BK10,TRAN=PETRO,VISC(L)=U2
VISC(L)
UDATA 1,2 / 2,1 / 11, 200 / 12, 400 / 21, 5.0 / 22, 3.0
STREAM DATA
PROP STREAM=1,TEMP=375,PRES=300,PHASE=M,&
RATE(V)=3125, ASSAY=WT
D2887 STREAM=1, &
DATA=5.74,135/19.55,210/35.89,370/ &
60.04,565/69.82,665/78.38,800/87.94,990
API STREAM=1,AVG=45.37, &
DATA=8.33,80.01/16.89,62.9/34.8,50.6/55.47,38.2/80.10,27.5
MW STREAM=1,AVG=162.9, &
DATA=18.92,99.5/33.4,135/48.4,184.7/ 9.8,334.8/100,789
LIGHT STREAM=1,PERCENT(W)=10.4, &
COMP(M)=1,0.1/2,1.4/3,0.65/4,3.15/5,5.1,NORMALIZE
NAME 1,CRUDE FEED
UNIT OPERATIONS
HCURVE UID=HC1,NAME=HEATING CRV
ISO STREAM=1,TEMP=375,600,PRES=300,POINTS=21
PROP TRANS
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

The PRO/II User-Added Subroutines feature allows you to supple-


ment the PRO/II-supplied unit operations by linking your own unit
operation subroutines with the standard PRO/II program. These unit
operations support up to ten feed and ten product streams and can
model a variety of processes or generate printed results and create
files of information for subsequent processing by programs external
to PRO/II. These output product streams and operating conditions
may then be used in subsequent operations. For example, it is possi-
ble to integrate a custom heat exchanger or solids dryer into a
PRO/II flowsheet. A user-added unit operation may be executed
during flowsheet calculations or at output time only. User-added
units to be calculated during flowsheet calculations must have at
least one feed stream.

Calculated results from user-supplied unit operations may be stored


in IPARM, RPARM, and SUPPLEMENTAL arrays, which are passed to
corresponding user-added output subroutines. These arrays are all
initialized during input processing.

Communicating with PRO/II


Input data are transmitted to user-added unit operations using
PRO/II keyword formats. The operating parameters for these user-
added units may be input by the user or derived from previous unit
operations via the DEFINE feature of PRO/II (see the PRO/II Key-
word Manual, or the PRO/II User’s Guide for more information).
Input processing facilities have been included in PRO/II for user-
written unit operations. However, routines for optional output
reports must always be written by the user.

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.:

USn UID=uid, {NAME=text}, {BYPASS=1}

where:
n = 1-20, 41-120

BYPASS = 1 indicates user output subroutine to be


executed only at printout time.

Note: n = 21-40 are reserved for SimSci internal units.

Feeds and Products


The FEED and PRODUCT statements are:
FEED sid, {sid, sid,....}
PRODUCT sid, {sid, sid,....}

Note: Up to 25 feed and product streams are allowed for each


user-added unit operation.
All non-BYPASS unit operations must have at least one feed stream.
Unit operations with BYPASS = 1 may or may not have feeds and
products. For BYPASS unit operations, the product streams may not
be stored with URXSTR.

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.

Note: It is never permissible for a user-added unit operation to


replace its feed stream(s) in 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

15-2 Unit Operation Subroutines


unit operations or by standard PRO/II unit operations. It is the
responsibility of the user to ensure that all necessary properties are
set for product streams. Table 15-1 describes the subroutines that
may be used for this purpose.
Table 15-1: Built-In Subroutines for Product Stream Properties
Subroutine Description
UFLSH Performs flash calculations
UHS Generates enthalpy, entropy and density data
URSTRM Places streams into stream storage
TTPROP Calculates transport properties
UH2OP Calculates water properties
HEAD For output purposes

Common blocks containing component properties and conversion


factors for output are also available to the user-written unit opera-
tion (see Chapter 12, Interfacing Software, Common Blocks, and
Data Files, for complete details on interfacing methods).

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)

Real Number Inputs


RPARM real no,.... (Up to 500 values)
SUPPLEMENTAL i,Ri/Ri+1/.../j,Rj/Rj+1... (Up to 10000 values)

User-Added Unit Operations and Controllers


Parameters stored in the RPARM array for a user-added unit opera-
tion may be used by a feedback controller as control parameters.
They may also be used in the specification of either a feedforward
controller (DEFINE) or a feedback controller (CONTROLLER).

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:

unit The name of the user added unit operation


(US1, US2, etc).
unit identifier The unit’s UID.
index The index of the real parameter (RPARM) to
vary.

Thus to control RPARM(5) for unit C11, defined by user-added sub-


routine US2, the following VARY statement would be used:
VARY US2=C11, PARA(5)

Specification
CONTROLLER UID=C1
SPEC unit=unit identifier, PARA(index), VALUE=rval
VARY ...

where:

unit The name of the user added unit operation


(US1, US2, etc).
unit identifier The unit’s UID.
index The index of the real parameter (RPARM) to
specify.
rval The required value of the real parameter.

Thus to specify RPARM(3) to be 4.812 for unit H45, defined by user


subroutine US4, the following SPEC statement would be used:
SPEC US4=H45, PARA(3), VALUE=4.812

Example 15-2: Feedforward Controller (DEFINE)


Real parameters may be externally defined as either input or output
from the user subroutine. The following examples illustrate the use
of such DEFINEs.

Parameter Input from another unit operation:

15-4 Unit Operation Subroutines


CALCULATOR UID=C1
PROCEDURE
R(1) = 13.376
R(2) = 52800
RETURN
US2 UID=USER2
FEED ...
PROD ...
DEFINE RPARM(1) AS CALC=C1, RESULT(1)
DEFINE RPARM(2) AS CALC=C1, RESULT(2)
Parameter Output into another unit operation:
US4 UID=USER4
FEED ...
PROD ...
RPARM 13.376,52800,0,0,0
FLASH UID=F1
FEED ...
PROD ...
ISO
DEFINE PRES AS US4=USER4, PARA(4)
DEFINE TEMP AS US4=USER4, PARA(3)

In this case the 4th and 5th real parameters are calculated by the user
subroutine and passed to the flash unit operation.

User-Added Unit Operations and Recycle Loops


User unit operations may be used in recycle loops similar to
PRO/II-supplied operations. Convergence or nonconvergence may
be signaled for user modules. Fatal errors may also be signaled and
calculations aborted. If desired, the user may test input parameters
and print intermediate calculated results.

Note: For user-added units in recycle loops, it is important that


the calculations be performed as efficiently as possible to mini-
mize computing costs.

User-Added Pressure Drop Calculations for the Pipe Unit


The PIPE unit supports up to two user-added subroutines at a time
that compute the pressure drop through the pipe. You access either
one of these two routines by specifying either DP1 or DP2 as the
argument to the DPCORR keyword on the LINE statement. SIMSCI
has provided example calculation routines, so these two routines
may be executed in the version of PRO/II that was delivered.

Of course, the intended purpose is to allow you to implement and


use your own pressure drop correlation(s) instead of using those
provided by SIMSCI. To create your own pressure-drop correlation

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.

DPCORR = Subroutine to be Written and Built


in the User-Added Library
DP1 PIPUS1.FOR
DP2 PIPUS2.FOR

Custom routines must include the following argument list:

SUBROUTINE PIPUS2( HLNS, AINCL, DIAM, AREA, RUFF,


1 RNUMB, FRICT, FROUDE, NOACCL, PRES,
2 RLVELN, VELSL, VELSG, QLI, QGI,
3 RLDENS, VISL, RLSTEN, RVDENS, VISV,
4 HL, IREG, FRGR, ELGR, ACCGR,
5 DPINCR, NFOUT, IDG, NUIDD, NSAVE,
6 INTAB )

The 31 arguments are defined as follows:

Table 15-2: Subroutine PIPUSs() Arguments


Name Type Brief Description UOM
HLNS Dbl FP No slip holdup
≤ 0.0 = Single-phase vapor
0.0<HLNS<1.0 = Mixed phase (vap+liq)
≥1.0 = Single-phase liquid
AINCL Dbl FP Pipe inclination angle radians
DIAM Dbl FP Pipe inside diameter feet
AREA Dbl FP Pipe inside area square feet
RUFF Dbl FP Pipe roughness/diameter ratio
RNUMB Dbl FP Reynolds number
FROUDE Dbl FP Froude number
NOACCL Integer NOACCELERATION keyword flag
0= acceleration APPLIED
1= acceleration OMITTED
PRES Dbl FP Absolute pressure psia
RLVELN Dbl FP Pipe liquid VELOCITY number
VELSL Dbl FP Pipe liquid SUPERFICIAL VELOCITY ft/sec
1) Dbl FP indicates the argument is a double-precision floating point value.
2) Chr*(*) indicates the argument is an inherited-length character string.
3) All Integer variables are type INTEGER*4

15-6 Unit Operation Subroutines


Table 15-2: Subroutine PIPUSs() Arguments (cont.)
Name Type Brief Description UOM
VELSG Dbl FP Pipe vapor SUPERFICIAL VELOCITY ft/sec
QLI Dbl FP Pipe liquid FLOWRATE cu.ft/sec
QGI Dbl FP Pipe vapor FLOWRATE cu.ft/sec
RLDENS Dbl FP Pipe liquid (oil+water) DENSITY lb/cu.ft
VISL Dbl FP Pipe liquid (oil+water) VISCOSITY cP
RLSTEN Dbl FP Pipe liquid (oil+water) SURFACE dyne/cm
TENSION
RVDENS Dbl FP Pipe vapor DENSITY lb/cu.ft
VISV Dbl FP Pipe vapor VISCOSITY cP
NFOUT Integer Fortran File Unit for printing
diagnostic messages
IDG Integer Diagnostic printout flag (DUMP value)
0= Suppress diagnostics
1= Generate diagnostic
NUIDD Chr*(*) Character string containing ID of
(calling) unit op
NSAVE Integer Not used here.
INTAB Integer Not used here.
OUTPUT Variables
FRICT Dbl FP Pipe friction factor (Calculated and
returned even when no input value is
supplied)
HL Dbl FP Pipe slip holdup
IREG Integer PD method flow regime flag
1= Liquid
2= Vapor
3= Distributed
4= Intermittent
5= Segregated
6= Transition
FRGR Dbl FP Friction gradient psi/ft
ELGR Dbl FP Elevation gradient psi/ft
ACCGR Dbl FP Acceleration gradient psi/ft
DPINCR Dbl FP Total gradient FRGR+ELGR+ACCGR psi/ft
1) Dbl FP indicates the argument is a double-precision floating point value.
2) Chr*(*) indicates the argument is an inherited-length character string.
3) All Integer variables are type INTEGER*4

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.

Output Subroutines for User-Added Units


Output subroutines for user-added units must be programmed to
give results in multiple dimensional units of measure, similar to the
PRO/II-supplied output routines, e.g., U42OUT.FOR subroutines.
This can be accomplished by using the /OUTFAC/ and /FACTOR/
common blocks as described in Chapter 12, Interfacing Software,
Common Blocks, and Data Files.

FORTRAN Coding Convention—Unit Operations


User-supplied unit operations use the following naming convention:
Table 15-3: FORTRAN Naming Conventions for User-Added Units
Input Name 1 User Unit Operation1 User Output Subroutine1,2
US1 USER41 U41OUT
. . .
. . .
US20 USER60 U60OUT
US41 USER81 U81OUT
. . .
. . .
US100 USER160 U160OUT
1) User-Added Units 21 through 40 are reserved for SimSci internal units.
2) Output subroutines are optional. However, if supplied, they must follow the
correspondence shown above.

15-8 Unit Operation Subroutines


Information is communicated to the user subroutine through the
subroutine’s argument list and the common blocks described in
Chapter 12, Interfacing Software, Common Blocks, and Data Files.
The PRO/II calling sequence for a user-added unit routine is:
CALL USERnn(IPARM,RPARM,SUPPLE,HEAT,IDATA,ISOLVE,ISTOP)
where:
nn 41-60, 81-160
IPARM1 Integer parameters (250)
RPARM1 Real parameters (500)
SUPPLE1 Real data storage (10000)
HEAT1 Heat duties x 10-6 (10)
IDATA(1) Number of feeds
IDATA(2) Number of products
IDATA(3) Number of heaters
IDATA(4) Number of components
IDATA(5) Water switch:
1 = water is regular component
2 = water is decanted
IDATA(6) Standard output file
IDATA(7) Integer representation of first 4 characters of the unit
identifier for unit (A4).
IDATA(8)-(10) Integer representation of first 12 characters of the name
for unit (3A4).
See Coding Practice 3, below.
(IDATA(8)-(10) are available to output subroutines at
printout time only.
ISOLVE2 Solution flag:
0-9 No solution
10 Solution reached
ISTOP2 Fatal error switch:
0 None
1 Yes, halt calculations
1) IPARM, RPARM, SUPPLE, and HEAT may be input and/or assigned values by user
subroutines.
2) ISOLVE and ISTOP are initialized to zero by PRO/II.

PRO/II Data Transfer System and User-Added Subroutines User’s Guide 15-9
The following coding practices are highly recommended:

1. Retrieve feed streams and take appropriate action if any are


absent.
2. Perform calculations, saving results in IPARM, RPARM, SUPPLE,
and HEAT.
3. Use URXINF to retrieve 12-character stream and unit ids if
required.
4. Intermediate results may be printed to file IDATA(6) if desired.
These can be made user-selectable for debugging purposes by
using one of the IPARM values for a print switch.
5. Set properties for product streams using interfacing routines
described in Chapter 12, Interfacing Software, Common
Blocks, and Data Files.
6. Store product streams in data stream storage with URXSTR.
7. Set ISOLVE appropriately. ISOLVE will be preserved for each
execution of a user module and may be used as a counter for
nonconvergence for recycle problems. When a value of 9 or
less (depending on the user’s preference) is reached, a noncon-
vergible situation may be signaled by setting ISTOP to 1.
8. Set ISTOP to 1 if a fatal error was encountered in calculations.
This will abort all calculations.

FORTRAN Coding Conventions—Output Subroutines


Output subroutines for the user-written unit operations are optional.
PRO/II contains several output routines for user-added unit opera-
tions. If user-written routines are present, they must follow the nam-
ing convention given in Table 15-3. For example, U59OUT would
correspond to unit operation subroutine USER59.

The calculated results from a user unit operation are transmitted to


the corresponding output subroutines in two ways:

■ IPARM, RPARM , SUPPLE, and HEAT arrays (described


previously)

■ Product streams.

The corresponding output subroutine (user-written or PRO/II-


supplied) for each user unit operation is called at printout time.

15-10 Unit Operation Subroutines


All output values must be multiplied by the appropriate output con-
version factors given in common block /OUTFAC/ (see Chapter 12,
Interfacing Software, Common Blocks, and Data Files) to ensure
that the multiple output dimension and scaling features of PRO/II
will execute properly for user-written output subroutines.

Note: The Hollerith representations for the output dimensions and


component names are also furnished in /OUTFAC/.

The calling sequence for user output subroutines is:


CALL UnnOUT(IPARM,RPARM,SUPPLE,HEAT,IDATA)
where:
nn 41-60, 81-160
IPARM, RPARM, SUPPLE, HEAT, and IDATA are as described earlier
in this chapter.

User output subroutines should follow the margin convention used


by PRO/II. Under this convention, column one is used for print con-
trol with columns 2-11 left blank on each line of printout. Using this
convention, 83 columns may be used for printout when a report size
of 8½ by 11 inches is desired.

Note: FACTOR/ may be used as needed to convert results to


desired output units. If desired, additional calculations may be
performed in the output subroutine. All interface resources (sub-
routines and common storage blocks) are available for output sub-
routines.

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.)

All subroutines have been written in a general manner, with calcula-


tions independent of the input dimensions selected by the user.
The following details are given for each example:

■ Description of the subroutine.

PRO/II Data Transfer System and User-Added Subroutines User’s Guide 15-11
■ FORTRAN listing for the subroutine.

■ Problem keyword input file.

■ Excerpts from the problem output.

Example 15-3: Pipe Pressure Drop Model


This unit operation may be used to compute pressure drops for liq-
uid or vapors flowing in commercial steel or wrought-iron pipe-
lines. The Darcy formula for pressure drop is used:
2
ρfLv
∆P = ---------------------- (15-1)
12d ⋅ 2g c

where:

∆P = pressure drop, psi


ρ = density, lb/ft3
v = mean velocity, ft/sec
L = length, ft
d = inside diameter, in.
gc = gravitational constant, 32.2 ft/sec2
f = friction factor

Friction factors are calculated using mathematical equivalents for


the charts presented by L. F. Moody.

For laminar flow,

f = 64 ⁄ N Re (15-2)

where:

NRe = Reynolds number


For turbulent flow,

log f = – 1.666 – 0.1962 log d (15-3)

Equation (15-1) is used for both liquid and vapor calculations.

For vapor calculations in which ∆P is less than 10% of the entering


pressure, inlet conditions are used for density. For vapors in which
is greater than 10% but less than 40% of the entering pressure, the
average density is used. The equation is not valid for vapors when
pressure drops exceed 40% of the entering pressure.

A flash calculation at outlet conditions is performed to test for


phase change.

15-12 Unit Operation Subroutines


No provision has been included in the user-added unit operation for
mixed-phase streams. Therefore, invalid use of the module will be
signaled when calculations are requested for mixed-phase streams.
One feed stream is allowed for this unit calculation; optionally, one
product stream may be requested.

The following conditions cause termination of calculations:

■ Zero or invalid feed.

■ Mixed phase feed.

■ Compressibility calculation failure.


■ Vapor which violates maximum pressure drop.

■ Incorrect product description.


■ Generation failure of product with flash or storage of product.

■ Phase change caused by pressure drop.


■ Inability to set product stream (when present).

Any of the above failures that prevent generation of a requested


product stream from the unit will result in termination of all other
PRO/II calculations as well.
Data to this subroutine are supplied in the RPARM array as follows:

RPARM(1) Pipe inside diameter, inches


RPARM(2) Pipe length, feet

Note: The above dimensions cannot be changed; however, all


other input dimensions may be selected as desired by the user.

Data for printout are passed to an output subroutine with corre-


sponding name as follows:

IPARM(2) Print switch:


1 Missing feed
2 Mixed phase feed
3 Z calculation failure
4 Missing diameter/length data
5 Vapor too large for method
6 Average properties used
7 Flash failure for product generation
8 Phase change occurs
9 Unable to set product stream

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

Note: Viscosity calculations must be requested when this module


is to be used; otherwise, viscosity data are not available for the
Reynolds’ number determination.

Reference: Crane Technical Paper 410, 1976.

15-14 Unit Operation Subroutines


FORTRAN Listing

USER42.FOR—User-Added Pressure Drop Routine


C
SUBROUTINE USER42(IPARM,RPARM,SUPPLE,HEAT,IDATA, SOLVE,ISTOP)
C
C COMPUTES PRESSURE DROPS IN STEEL PIPE FOR LIQUIDS AND VAPORS
C MIXED FEEDS ARE NOT ALLOWED
C
C CONVERSION FACTOR COMMON
C
INCLUDE ‘FACTOR.CMN’
C
C COMPONENT PROPERY COMMON
c
INCLUDE ‘PMXUSR.CMN’
c
INCLUDE ‘XPROPX.CMN’
c
DIMENSION IPARM(*),RPARM(*),SUPPLE(*),HEAT(*),IDATA(*)
c
DIMENSION STREAM(MAXCN+10),PROP(MAXCN), XKAY(MAXCN),
+ VAP(MAXCN+10), XLIQ(MAXCN+10), XLQ2(MAXCN+10)
CHARACTER*12 CID
CHARACTER*40 CNAME
C
1001 FORMAT(‘ERROR !! FEED STREAM ‘,A12,’ IS MISSING’)
1002 FORMAT(‘ERROR !! FEED STREAM ‘,A12, ‘ IS MIXED PHASE’)
1003 FORMAT(‘ERROR !! COMPRESSIBILTY CALCULATION FAILURE’)
1004 FORMAT(‘ERROR !! PIPE DIMENSIONS INVALID ‘,/,
+ ‘DIAMETER = ‘,E15.6,/,
+ ‘LENGTH = ‘,E15.6)
1005 FORMAT(‘ERROR!! DELTA P FOR VAPOR EXCEEEDS 40% INLET PRESSURE’)
1007 FORMAT(‘ERROR !! FLASH FAILURE AT OUTLET CONDITION’)
1008 FORMAT(‘ERROR!! PHASE CHANGE AT OUTLET - CALCULATION INVALID’)
1009 FORMAT(‘ERROR !! UNABLE TO STORE PRODUCT STREAM ‘,A12)
C
IERR = 0
NOP = IDATA(2)
NOCX = IDATA(4)
IOUT = IDATA(6)
DO 2001 I = 1, MAXCN+10
STREAM(I) = 0.0
2001 CONTINUE
C
C USE IPARM(2) AS OUTPUT SWITCH
C
IPARM(2) = 0
C
C RETRIEVE FEED STREAM
C
CALL URXINF(‘FEED’,1,CID,CNAME,IERR)
IF (IERR .EQ. 0) THEN
CALL URXSTR(CID,STREAM,1,IERR)
ENDIF
IF (IERR. NE. 0 .OR. STREAM(1) .LE. 0.0) THEN
IPARM(2) = 1

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

15-16 Unit Operation Subroutines


C
C CROSS-SECTIONAL AREA (FT2)
C
AREA = 3.14159 * DIA * DIA / 576.0
C
C VELOCITY (FT/SEC)
C
CUFTSE = STREAM(1) * WT * WTFAC / TIMFAC / RHO
VELOC = CUFTSE / AREA
C
C CALCULATE VISCOSITY(CP)
C
CALL TTPROP(5,IFAZE,PROP,STREAM,IERR)
C
IF (IFAZE .EQ. 1) THEN
CP = PROP(4) * VISFAC
ELSE
CP = PROP(2) * VISFAC
ENDIF
C
C REYNOLDS NUMBER
C
REY = 123.9 * RHO * DIA * VELOC / CP
C
C DARCY FRICTION FACTOR
C
IF (REY .LE. 2100.) THEN
FFACT = 64. / REY
ELSE
XLOGF = -1.666 - 0.1962 * ALOG10(DIA)
FFACT = 10.**XLOGF
ENDIF
C
C PRESSURE DROP (PSI)
C
DELTP = 0.001294 * RHO * FFACT * XLEN * VELOC * VELOC / DIA
C
C CORECT DELTAP TO INPUT UNITS
C CALCULATE OUTLET PRESSURE
C
DELP = (DELTP / PFAC) - PCONVT
POUT = STREAM(3) - DELP
C
C SAVE INLET CONDITIONS
C
RPARM(3) = DEGR - FTOR
RPARM(4) = PSIA
RPARM(5) = ZF
C
C CHECK ASSUMPTIONS FOR VAPOR
C
IF (IFAZE .EQ. 1) THEN
C
C DELTA P EXCEEDS 40% OF INLET PRESSURE
C ERROR CONDITION
C
IF (DELTP .GT. 0.4*PSIA) THEN
IPARM(2) = 5

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

15-18 Unit Operation Subroutines


STREAM(5) = (XLIQ(1) + XLQ2(1)) / STREAM(1)
STREAM(6) = XLQ2(1) / STREAM(1)
RPARM(6) = ((STREAM(2) + TCONVT) * TFAC) - FTOR
RPARM(7) = (STREAM(3) + PCONVT) * PFAC
IF (ABS(STREAM(5) - 1.0) .LT. 0.01) THEN
IFAZE = 2
ELSE IF (STREAM(5) .LT. 0.01) THEN
IFAZE = 1
ELSE
IFAZE = 0
ENDIF
C
C CHECK IF PHASE CHANGE
C
IF (IFAZE .NE. IPARM(3)) THEN
IPARM(2) = 8
WRITE(IOUT,1008)
ISOLVE = 1
ISTOP = 1
GO TO 9999
ENDIF
C
C GET COMPRESSIBILITY AT OUTLET
C
CALL UHS(3,IFAZE,STREAM,ZF2,DZ,IERR)
IF (IERR .NE. 0) THEN
IPARM(2) = 3
WRITE(IOUT,1003)
ISOLVE = 1
ISTOP = 1
GO TO 9999
ENDIF
STREAM(7) = ZF2
RPARM(8) = ZF2
C
C SET PRODUCT STREAM
C
IF (NOP .NE. 0) THEN
CALL URXINF(‘PROD’,1,CID,CNAME,IERR)
IF (IERR .EQ. 0) THEN
CALL URXSTR(CID,STREAM,2,IERR)
ENDIF
IF (IERR. NE. 0) THEN
IPARM(2) = 9
WRITE(IOUT,1009) CID
ISOLVE = 1
ISTOP = 1
GO TO 9999
ENDIF
ENDIF
C
C SET SOLVE FLAG
C
ISOLVE = 10
C
9999 CONTINUE
RETURN
END

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

15-20 Unit Operation Subroutines


IF (ISW .EQ. 0 .OR. ISW .GT. 5) THEN
IF (IPARM(3) .EQ. 1) THEN
CPHASE = ‘VAPOR’
ELSE
CPHASE = ‘LIQUID’
ENDIF
WRITE(IOUT,1002) RPARM(1), RPARM(2), RPARM(11),
+ RPARM(4), RPARM(3), RPARM(5),
+ RPARM(7), RPARM(6), RPARM(8), CPHASE,
+ RPARM(9), RPARM(10), RPARM(12)
ENDIF
CALL URXINF(‘FEED’,1,CID,CNAME,IERR)
WRITE(IOUT,1003) CID
IF (NOP .NE. 0) THEN
CALL URXINF(‘PROD’,1,CID,CNAME,IERR)
WRITE(IOUT,1004) CID
ENDIF
ISW = ISW + 1
GO TO (9999, 110, 120, 130, 140, 150, 160, 170, 180, 190), ISW
110 WRITE(IOUT,1010)
GO TO 9999
120 WRITE(IOUT,1020)
GO TO 9999
130 WRITE(IOUT,1030)
GO TO 9999
140 WRITE(IOUT,1040)
GO TO 9999
150 WRITE(IOUT,1050)
GO TO 9999
160 WRITE(IOUT,1060)
GO TO 9999
170 WRITE(IOUT,1070)
GO TO 9999
180 WRITE(IOUT,1080)
GO TO 9999
190 WRITE(IOUT,1090)
C
9999 CONTINUE
RETURN
END

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

15-22 Unit Operation Subroutines


Partial PRO/II Output
SIMULATION SCIENCES INC. R PAGE P-2
PROJECT U42 PRO/II UAS 386/EM
PROBLEM USERADD OUTPUT SIMSCI
CALCULATION SEQUENCE AND RECYCLES JUN 99
==============================================================================
CALCULATION SEQUENCE
SEQ UNIT ID UNIT TYPE
——— ——————— —————————
1 P2 USER-ADDED
2 P3 USER-ADDED
3 P1 USER-ADDED
==============================================================================
UNIT 1, ‘P2’, ‘NATL GAS DP’
UNIT ID - P2 NAME - NATL GAS DP
**** PRESSURE DROP CORRERATIONS - STEEL PIPE ***
PIPE DIAMETER = 13.38 INCHES
PIPE LENGTH = 52800.0 FEET
PRESSURE DROP = 37.41 PSI
INLET PRESSURE = 1300.00 PSIA
INLET TEMPERATURE = 40.00 DEG F
INLET COMPRESSIBILITY = 0.6543
OUTLET PRESSURE = 1262.59 PSIA
OUTLET TEMPERATURE = 37.61 DEG F
OUTLET COMPRESSIBILITY = 0.6540
PHASE = VAPOR
VELOCITY = 8.7047 FT/SEC
REYNOLDS NUMBER = 7157016.5
FRICTION FACTOR = 0.012972
FEED STREAM - 1
PRODUCT STREAM - P2V

UNIT 2, ‘P3’, ‘NATL GAS’


UNIT ID - P3 NAME - NATL GAS
**** PRESSURE DROP CORRELATIONS - STEEL PIPE ***
PIPE DIAMETER = 13.38 INCHES
PIPE LENGTH = 528000.0 FEET
PRESSURE DROP = 378.16 PSI
INLET PRESSURE = 1300.00 PSIA
INLET TEMPERATURE = 40.00 DEG F
INLET COMPRESSIBILITY = 0.6543
OUTLET PRESSURE = 921.84 PSIA
OUTLET TEMPERATURE = 11.09 DEG F
OUTLET COMPRESSIBILITY = 0.6642
PHASE = VAPOR
VELOCITY = 9.7048 FT/SEC
REYNOLDS NUMBER = 7157016.5
FRICTION FACTOR = 0.012972
FEED STREAM - 1
** AVERAGE PROPERTIES USED FOR ABOVE CALCULATIONS **

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

15-24 Unit Operation Subroutines


Chapter 16
Reaction Kinetic Subroutines

User-added reaction kinetic subroutines offer the capability of writ-


ing reactor rate equation subroutines for use with the CSTR and
PLUGFLOW unit operations. The user may write up to five such rou-
tines, any of which may be referred to by CSTR or PLUGFLOW reac-
tors throughout the flowsheet.

Note: Shorter reaction kinetic models are more easily integrated


into PRO/II using the In-Line FORTRAN feature (see the PRO/II
Keyword Manual).

Communication with PRO/II


Input data are transmitted to user-written rate equation subroutines
using the keyword formats shown below. See Chapters 94 and 95 of
the PRO/II Keyword Manual for further information on CSTR/
PLUGFLOW input.

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)

Note: These values may be altered by user-written subroutines.


Real Number Inputs
RPARM real no,.... (Up to 70 values)
SUPPLEMENTAL i,Ri/Ri+1/.../j,Rj/Rj+1... (Up to 200 values)

Note: Both RPARMs and SUPPLEMENTALs may be altered by the


user-written subroutine. RPARMs may be accessed by the
CONTROLLER, MVC, OPTIMIZER, and CALCULATOR units and may
be changed via CASESTUDYs.

User-Added Kinetics and Controllers


Parameters stored in the RPARM array for a user-written kinetic
module may be used by a feedback controller as control parameters.
They may also be used in the specification of either a feedforward
controller (DEFINE) or a feedback controller (CONTROLLER, MVC).

See Chapters 45 and 46 of the PRO/II Keyword Manual for more


details on the CONTROLLER unit and DEFINE feature.

FORTRAN Coding Conventions


Information is communicated to the user subroutine USKINn
through the argument list. Additional data may be accessed via all
the common blocks and subroutines previously described in
Chapter 12, with the exception of URXSTR. The user will most
likely wish to retrieve pure component data from common block /

16-2 Reaction Kinetic Subroutines


XPROPX/, dimensional unit conversion factors from /FACTOR/, and
possibly stream properties via subroutine TTPROP (see Chapter 12,
Interfacing Software, Common Blocks, and Data Files).

The PRO/II calling sequence is:


CALL USKINn(RSDAT1,RSDAT2,RRDAT1,IRDAT1,RPARM,IPARM,
1 SUPPLE,STOICH,ORDER,IDBASE,ACTIVE,PREEXP,
2 RATES,IERR)
C
DIMENSION RSDAT1(100),RSDAT2(300),RRDAT1(10),IRDAT1(10),
1 RPARM(70),IPARM(10),SUPPLE(200),STOICH(50,15),
2 ORDER(50,15),IDBASE(15),ACTIVE(15),PREEXP(15),
3 RATES(15)
where:

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

16-4 Reaction Kinetic Subroutines


Table 16-2: USKINn Required Input Arguments and Procedure Variables
Required Description In-Line
Input Procedure
Argument Variable
IRDAT1(1) Number of components NOC
IRDAT1(2) Number of reactions (stoichiometric NOR
equations)
IRDAT1(3) OPERATION PHASE flag: IRPHAS
0 No errors
1 V
2 L
IRDAT1(4) CALCULATION flag: ICPF
0 CONCENTRATION
1 PARTIAL PRESSURE,
2 Fugacity,
3 Activity
IRDAT1(5) Current integration step nUmber ISTEP
IRDAT1(6) Standard output file FORTRAN unit IOUT
number
IRDAT1(7) Index file FORTRAN unit number INDX
IRDAT1(8-10) Not used
STOICH(50,15) Stoichiometry of each component in -
each reaction
ORDER(50,15) Order of reaction for each component in -
each reaction
IDBASE(1-15) Base component for each reaction -
ACTIVE(1-15) Activation energy for each reaction -
PREEXP(1-15) Pre-exponential factor for each reaction -

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.

Note: If the program is unable to calculate RATES for each


component, set the IERR flag accordingly.

Table 16-4: USKINn Output Arguments & In-Line Procedure Variables


Argument Description In-line
Procedure
Variable
RATES(1-15) Reaction rates for each defined reaction RRATES
(Wt-moles/time)
IERR Error flag -
0 No errors
1 Error found, reactor fails

16-6 Reaction Kinetic Subroutines


Example Problem—Allyl Chloride Production in a PFR
The following example illustrates the use of user kinetics rate expressions for a simple
power law model. The program allows the user to choose between expressions based on
partial pressures, concentrations, vapor phase fugacities, or liquid phase activities.

FORTRAN Listing

USKIN1—User-Added Power Law Kinetic Routine


SUBROUTINE USKIN1 (RSDAT1, RSDAT2, RRDAT1,
1 IRDAT1, RPARM, IPARM,
2 SUPPLE, STOICH, ORDER,
3 IDBASE, ACTIVE, PREEXP,
4 RATES, IERR)
C
DIMENSION RSDAT1(100), RSDAT2(200), RRDAT1(10),
1 IRDAT1(10), RPARM(70), IPARM(10),
2 SUPPLE(200), STOICH(50,15), ORDER(50,15),
3 IDBASE(15), ACTIVE(15), PREEXP(15),
4 RATES(15)
C
C POWER LAW KINETICS - CONCENTRATIONS (DEFAULT)
C - PARTIAL PRESSURES (USE CALC PARTPRES)
C - VAPOR FUGACITIES (USE IPARM 1, i.e.,IRDAT1(4))
C
DOUBLE PRECISION RJ
C
C CODE BEGINS HERE
C
C GET NUMBER OF REACTIONS AND NUMBER OF COMPONENTS PARTICIPATING
C IN THE REACTIONS; ALSO, TEMPERATURE AND GAS CONSTANT
C
NC = IRDAT1(1)
NRX = IRDAT1(2)
ATEMP = RSDAT1(1)
RTABS = RSDAT1(17)
RGAS = RRDAT1(10)
C
C INITIALIZE RATES TO ZERO. DETERMINE DIMENSIONLESS
C ACTIVATION ENERGY, CALCULATE TEMPERATURE DEPENDENT TERM
C
DO 500 J = 1,NRX
RATES(J) = 0.0
ACTENG = ACTIVE(J)
C
C CONVERT ACTIVATION ENERGY FROM THOUSANDS TO UNIT VALUES
C
ACTENG = ACTENG * 1000.0
ERT = -ACTENG / (RGAS * RTABS)
RJ = PREEXP(J) * EXP( ERT )
DO 400 I = 1, NC
C
C SKIP NON-REACTANTS (I.E., SKIP ALL PRODUCTS)
C AND SKIP COMPONENTS NOT IN THIS RE
IF ((STOICH(I,J) .LT. 0.0) .AND.
1 (ABS(ORDER(I,J)) .GE. 1.0E-20)) THEN

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

16-8 Reaction Kinetic Subroutines


PRO/II Keyword Input File
TITLE PROB=USPLUG, PROJ=USER-ADD, USER=RJP, DATE=JUN99
COMP DATA
LIBI 1,CL2/2,PRLN/3,ACL/4,12PR/5,HCL/6,H2O
THERMO DATA
METH SYST=PR, TRANS=LIBR
STREAM DATA
PROP STRM=1, TEMP=450, PRES=29.4,RATE=85,COMP=0.2/0.8
PROP STRM=1A, TEMP=80,PRES=29.4,RATE=85,COMP=0.2/0.8
RXDATA
RXSET ID=RS1
REACTION ID=1
$ - GLOBAL DATA -
STOIC 1,-1/2,-1/3,1/5,1
HORX HEAT=-48,REFC=1,REFP=V,REFT=179
$ - KINETIC DATA -
KPARAMETER PEXP=2.1E11 , ACTIV=27.0096
KPHASE DEFAULT=VAPOR
KBASIS VAPOR=MOLAR
REACTION ID=2
$ - GLOBAL DATA -
STOIC 1,-1/2,-1/4,1
HORX HEAT=-79.2,REFC=1,REFP=V,REFT=179
$ - KINETIC DATA -
KPARAMETER PEXP=1.19E7 , ACTIV=6.81198
KPHASE DEFAULT=VAPOR
KBASIS VAPOR=MOLAR
UNIT OPS
PLUGFLOW UID=RX
FEED 1
PROD V=2
COLD FEED=1A, V=1B, TOUT=400
RXCA KINETICS(SUBR)=U1, NSTEPS=50
OPER
LENG=20.0,DIAM=11.94,PHASE=V,DP=10,TUBE=4,U=3.72,COUNTER
RXSTOIC RXSET=RS1
REACTION 1
BASE COMP=1
REACTION 2
BASE COMP=1
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

REACTING SIDE INLET OUTLET


————— ——————
FEED 1
VAPOR PRODUCT 2
TEMPERATURE, F 450.00 735.93
PRESSURE, PSIA 29.4000 19.4000

COLD SIDE INLET OUTLET


————— ——————
FEED 1A
VAPOR PRODUCT 1B
TEMPERATURE, F 84.09 400.00
PRESSURE, PSIA 29.4000 29.4000
REACTION DATA
——-——- RATES, LB-MOL/HR ———— FRACTION
COMPONENT FEED CHANGE PRODUCT CONVERTED
————————— ———— —————— ——————— —————————
1 CL2 17.0000 -16.9930 6.997E-03 0.9996
2 PRLN 68.0000 -16.9930 51.0070 0.2499
3 ACL 0.0000 11.3309 11.3309
4 12PR 0.0000 5.6621 5.6621
5 HCL 0.0000 11.3309 11.3309

TOTAL 85.0000 -5.6621 79.3379

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)

16-10 Reaction Kinetic Subroutines


REACTOR MASS BALANCE
———- RATES, LB-MOL/HR ————— FRACTION
COMPONENT FEED CHANGE PRODUCT CONVERTED
————————— ———— —————— ——————— —————————
1 CL2 17.0000 -16.9930 6.997E-03 0.9996
1 CL2 1205.4020 -1204.9059 0.4961 0.9996
2 PRLN 2861.5081 -715.0825 2146.4255 0.2499
3 ACL 0.0000 867.1063 867.1063
4 12PR 0.0000 639.7474 639.7474
5 HCL 0.0000 413.1349 413.1349

TOTAL 4066.9102 0.0000 4066.9102

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

— COMPONENT MOLE FRACTIONS VS. DISTANCE FROM INLET


DISTANCE 1 2 3 4 5
FT CL2 PRLN ACL 12PR HCL
—————— ————-————— ————-————- ————-————- —————————— ————-———--
0 0.0000 0.20000000 0.80000001 0.00000000 0.00000000 0.00000000
1 2.0000 0.16381569 0.78100312 0.01326768 0.02864578 0.01326768
2 4.0000 0.10720868 0.73883224 0.05062661 0.05270591 0.05062661
3 6.0000 0.04395751 0.68345618 0.10337750 0.06583122 0.10337750
4 8.0000 0.01198451 0.65395558 0.13205414 0.06995172 0.13205414
5 10.0000 0.00328569 0.64585465 0.13995561 0.07094836 0.13995561
6 12.0000 0.00109867 0.64382821 0.14192866 0.07121586 0.14192866
7 14.0000 0.00045489 0.64323765 0.14250149 0.07130452 0.14250149
8 16.0000 0.00022724 0.64303148 0.14270036 0.07134048 0.14270036
9 18.0000 0.00013280 0.64294744 0.14278097 0.07135778 0.14278097
10 20.0000 0.00008819 0.64290863 0.14281794 0.07136733 0.14281794

PRO/II Data Transfer System and User-Added Subroutines User’s Guide 16-11
Chapter 17
Refinery Reactor Simulation UAS

User Utility Subroutines


UDEFNC
This routine gets the position of a specified component based on
user input or, alternatively, the PRO/II internal order. This compo-
nent must be declared in the component section of the flowsheet.
Based on this information, the feed and product data of the compo-
nent can be correctly retrieved and stored regardless of its input
order declared in the input file.
The calling sequence for UDEFNC is:
CALL UDEFNC( CNAME, LIBNUM, ITYPE, JPLACE)

Table 17-1: Arguments for Utility Subroutine UDEFNC()


Variable I/O Data Type Description
CNAME I CHARACTER*16 Component ID of the specified
component. The ID should be the
same as that declared in the
component section.
LIBNUM I INTEGER PRO/II library number uniquely
designated for the specified
component. This number can be
found from DATAPREP. This number
will be used only if CNAME is not
provided, i.e. a blank string.

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.

17-2 Refinery Reactor Simulation UAS


The calling sequence for UPSEUC is:
CALL UPSEUC( IDATA, BP, IBEGIN, IEND, BPTIP,
BPTEP, IERR)

Table 17-2: Arguments for Utility Subroutine UPSEUC()


Variable I/O Data Type Description
IDATA I INTEGER(*) This is the IDATA array in the user-
added subroutine USERXX. If the
blend set name is not available in the
IDATA(8-10), the default set will be
used.
BP I REAL(MAXCN) The vector of normal boiling point.
IBEGIN O INTEGER The PRO/II internal order of the first
component in the blend.
IEND O INTEGER The PRO/II internal order of the last
component in the blend.
BPTIP O REAL(MAXCN) The vector of initial boiling point of
pseudocomponents in the blend.
BPTEP O REAL(MAXCN) The vector of end boiling point of
pseudocomponents in the blend.
IERR O INTEGER Error flag:
0 Successful
≠0 Failed

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).

The calling sequence for USTHER is:


CALL USTHER( CID, ISETUP, JMETHD, IERR)

Table 17-3: Arguments for Utility Subroutine USTHER()


Variable I/O Data Type Description
CID I CHARACTER*12 The stream ID of the specified
stream
ISETUP I INTEGER Property copy flag:
0 Do not copy the new
component properties to the
XPROPY common block
(default)
1 Copy the new component
properties to the XPROPY
common block
JMETHD O INTEGER PRO/II internal thermo set
number; -1 returned if thermo not
set up successfully
IERR O INTEGER Error flag:
0 Successful
≠0 Failed

Example:
...
CHARACTER*12 CID
CHARACTER*40 CNAME
...
CALL URXINF(‘FEED’, 1, CID, CNAME, IERR)
...
ISETUP = 1
CALL USTHER(CID,ISETUP, JMETHD, IERR)...

17-4 Refinery Reactor Simulation UAS


USTPRP
This routine retrieves a selected stream property from the specified
stream. Typical stream properties are allowed to be retrieved.

The calling sequence for USTPRP is:


CALL USTPRP( CID, ATEXT, BTEXT, VALUE, IERR)

Table 17-4: Arguments for Utility Subroutine USTPRP()


Variable I/O Data Type Description
CID I CHARACTER*12 Selected stream ID.
ATEXT I CHARACTER*12 Phase of the property to be
retrieved:
‘TOTAL’ Total stream
‘VAPOR’ Vapor phase
‘LIQUID’ Liquid phase
BTEXT I CHARACTER*12 The property to be retrieved:
‘TC’ Critical temperature
‘PC’ Critical pressure
‘VC’ Critical volume
‘ZC’ Critical compressibility
factor
‘OMEG’ Acentric factor
‘MW’ Molecular weight
‘SDEN’ Standard density
‘DENS’ Actual density
‘TCON’ Thermal conductivity
‘VISC’ Viscosity
‘SURF’ Surface tension
‘RVP’ Reid vapor pressure
‘TVP’ True vapor pressure
‘ENTR’ Entropy
‘GIBB’ Gibbs free energy
VALUE O REAL Stream property value
IERR O INTEGER Error flag:
0 Successful
≠0 Failed

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.

The calling sequence for USTRIP is:


CALL USTRIP( CID, ATEXT, ISPROP, VALUE, IERR)

Table 17-5: Arguments for Utility Subroutine USTRIP()


Variable I/O Data Type Description
CID I CHARACTER*12 The stream ID of the selected
stream.
ATEXT I CHARACTER*12 The property ID (listed in Table 17.3
of PRO/II Keyword Manual) of the
selected refinery property. Examples
are:
‘KVIS’ Kinematic viscosity
‘POUR’ Pour point
‘SULF’ Sulfur content
‘NICK’ Nickel content
For properties with more than one
data type, add a hyphen sign
followed by the first two letters of
the data type to the property ID.
Examples are:
‘REFR-C2’ Refractive index at 20C
‘REFR-C7’ Refractive index at 70C
‘AROM-TO’ Total aromatics content
‘AROM-RI’ Content of aromatics with
ring structure
For user’s special properties, i.e.
SPROP(I), assign a blank string to
this variable.
ISPROP I INTEGER The property number of user special
property SPROP(i):
0 PRO/II predefined special
property
1-9999 User special property
VALUE O REAL Property value.

17-6 Refinery Reactor Simulation UAS


Table 17-5: Arguments for Utility Subroutine USTRIP() (cont.)
Variable I/O Data Type Description
IERR O INTEGER Error flag:
0 Successful
1 Property was not declared in the
thermo section
≠0,1 Failed

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)

Table 17-6: Arguments for Utility Subroutine UDIST()


Variable I/O Data Type Description
STREAM I REAL The STREAM data array.
(10+MAXCN)
See URXSTR routine for definition.
XMW I REAL(MAXCN) Array of component MW.
See XPROPY common block for
definition.
BP I REAL(MAXCN) Array of component NBP.
See XPROPY common block for
definition.

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

17-8 Refinery Reactor Simulation UAS


Example:
...
INCLUDE ‘…\PMXUSR.CMN’
INCLUDE ‘…\XPROPY.CMN’
...
REAL STREAM(10+MAXCN), TDIST(21)
CHARACTER*12 CID, ATEXT
CHARACTER*40 CNAME
...
NUMCOP = IDATA(4)
CALL URXINF(‘FEED’, 1, CID, CNAME, IERR)
CALL URXSTR(CID, STREAM, 1, IERR)
...
ITYPE = 1
ICONV = 2
IBASIS = 1
WVIP = 0.2
WVEP = 99.0

CALL UDIST( STREAM, XMW, BP, DENS, ITYPE,


ICONV, IBASIS, WVIP, WVEP, NUMCOP,
TDIST, IERR)
...

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)

Table 17-7: Arguments for Utility Subroutine URATE()


Variable I/O Data Type Description
TVEC I REAL(NCPSEU) Array of boiling points of reactor
pseudocomponents
YVEC I REAL(NCPSEU) Array of either liquid volume or
weight distribution data
corresponding to the temperatures
in TVEC. See option of ICUMUL.
NCPSEU I INTEGER Dimension of reactor
pseudocomponents. This is also
the size of TVEC and YVEC arrays.
ICUMUL I INTEGER Cumulative curve data flag.
0 YVEC is a cumulative data
array (default)
1 YVEC is a distribution data
array
FOUT I REAL Total liquid volume or weight
flowrate of the reactor
pseudocomponents included in
temperature range of TVEC
IBEGIN I INTEGER The PRO/II internal order of the
first component in the blend.
IEND I INTEGER The PRO/II internal order of the
last component in the blend.
BPTIP I REAL(MAXCN) The vector of initial boiling point of
pseudocomponents in the blend.
BPTEP I REAL(MAXCN) The vector of end boiling point of
pseudocomponents in the blend.
IMETHD I INTEGER Interpolation option:
1 Linear
2 Quadratic
3 Cubic spline
IMAPED O INTEGER(MAXCN) Array of component mapping flag:
0 Get zero flowrate from the
mapping
1 Get positive flowrate from the
mapping

17-10 Refinery Reactor Simulation UAS


Table 17-7: Arguments for Utility Subroutine URATE() (cont.)
Variable I/O Data Type Description
FRATE O REAL(MAXCN) Array of mapped component
flowrates.
IERR O INTEGER Error flag:
0 Successful
≠0 Failed

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)

Table 17-8: Arguments for Utility Subroutine UCURVE()


Variable I/O Data Type Description
ATEXT I CHARACTER*12 The property ID.
‘MW’ Molecular weight
‘SG60’ Specific gravity at 60F
(15.5C)
‘OMEG’ Acentric factor
‘TC’ Critical temperature
‘PC’ Critical pressure
‘VC’ Critical volume
‘ZC’ Critical compressibility
‘RAKT’ Rackett parameter
‘CNUM’ Carbon number
‘ZNUM’ Hydrogen deficiency number
‘WATK’ Watson K value
For refinery special properties, see
ATEXT explained in USTRIP routine.

ISPROP I INTEGER See ISPROP explained in USTRIP


routine.
TVEC I REAL(NCPSEU) Array of end boiling points of
reactor pseudocomponents
CPROP I REAL(NCPSEU) Array of property distribution data
of reactor pseudocomponents.
NCPSEU I INTEGER Dimension of reactor
pseudocomponents. This is also the
size of TVEC and CPROP arrays.
BP I REAL(MAXCN) Array of component NBP.
See XPROPY common block for
definition
FRATE O REAL(MAXCN) Array of mapped component
flowrates.

17-12 Refinery Reactor Simulation UAS


Table 17-8: Arguments for Utility Subroutine UCURVE() (cont.)
Variable I/O Data Type Description
IBEGIN I INTEGER The PRO/II internal order of the first
component in the blend.
IEND I INTEGER The PRO/II internal order of the last
component in the blend.
TMINI I REAL The initial temperature of the
temperature range based on which
CPROP is determined.

TMAXI I REAL The end temperature of the


temperature range based on which
CPROP is determined.

YLOW I REAL Lower bound value of the mapped


property.
YHIGH I REAL Upper bound value of the mapped
property.
IFILL I INTEGER Mapping option for components
with BP outside the given
[TMINI,TMAXI] range:
0 Assign the same property value
as the nearest neighboring
component which is inside the
[TMINI,TMAXI] range
(default)
1 Ignore; do not assign a new
value
2 Linear extrapolation (see
SSCALE also)
3 Assign a zero value
ITREND I INTEGER Trend of the CPROP data:
0 Monotonically increase or
decrease (default)
1 Random or unknown.
IMETHD I INTEGER Interpolation option:
0 To be determined by program.
1 Linear (Use if CPROP=2)
2 Quadratic (Use if CPROP=3)
3 Cubic spline (Use if
CPROP>3)
IUPDAT I INTEGER Option to update the XPROPY
common block:
0 Do not update (default)
1 Update
SSCALE I REAL Scaling factor for linear
interpolation.

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)

17-14 Refinery Reactor Simulation UAS


UPETMD
Update all the component properties in the current thermo set based
on a subset of the component properties which are determined to be
fixed.
The reactor module normally will predict only a few component or
stream properties. Many of the component properties, such as Tc, Pc
and acentric factor required by the thermodynamic calculations, are
usually not covered by the reactor simulation. Fortunately, these
component properties can be estimated from the three primary com-
ponent properties, NBP, specific gravity and molecular weight. In
this refinery reactor interface, the NBP is treated as a fixed compo-
nent property since its value is usually near the middle of the cut
and won’t be significantly changed by the refinery reactions. The
other two primary component properties, specific gravity and
molecular weight, are allowed to change. The UPETMD routine
should be called to update all the secondary thermodynamic proper-
ties after the specific gravity and molecular weight component
properties are updated with the reactor simulation result.
The calling sequence for UPETMD is:

CALL UPETMD( PPTEXT, NPTEXT, IERR)

Table 17-9: Arguments for Utility Subroutine UPETMD()


Variable I/O Data Type Description
PPTEXT I CHARACTER*12 Fixed component properties that are
Vector of size 3. used as the basis to determine the
other component properties. The
component properties allowed to be
fixed are:
‘MW’ Molecular weight
‘SPGR’ Specific gravity
‘NBP’ Normal boiling point
NPTEXT I Integer=3 Input variable; integer;
It is the number of component
properties specified in the PPTEXT.
IERR O Integer Output variable; Integer scalar. It is
the error flag.
0= Successful
≠0 Failed

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.

17-16 Refinery Reactor Simulation UAS


The calling sequence for UBULK is:
CALL UBULK( CID, ATEXT, ISPROP, SVALSP, BP,
IBEGIN, IEND, TMINI, TMAXI, IFILL,
SSCALE, IMAPED, STGYV, IERR)

Table 17-10: Arguments for Utility Subroutine UBULK()


Variable I/O Data Type Description
CID I CHARACTER*12 Stream ID of the processed stream.
ATEXT I CHARACTER*12 The property ID.
‘MW’ Molecular weight
‘SG60’ Specific gravity at 60F
(15.5C)
‘OMEG’ Acentric factor
‘TC’ Critical temperaure
‘PC’ Critical pressure
‘VC’ Critical volume
‘ZC’ Critical compressibility
‘RAKT’ Rackett parameter
‘CNUM’ Carbon number
‘ZNUM’ Hydrogen deficiency number
‘WATK’ Watson K value
For refinery special properties, see
ATEXT explained in USTRIP routine.

ISPROP I INTEGER See ISPROP explained in USTRIP


routine.
SVALSP I REAL The bulk property value.
BP I REAL(MAXCN) Array of component NBP.
See XPROPY common block for
definition
IBEGIN I INTEGER The PRO/II internal order of the first
component in the blend.
IEND I INTEGER The PRO/II internal order of the last
component in the blend.
TMINI I REAL The initial temperature of the
temperature range based on which
SVALSP is determined.

TMAXI I REAL The end temperature of the


temperature range based on which
SVALSP is determined.

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)

17-18 Refinery Reactor Simulation UAS


Common Block /XPROPY/
This common block is very similar to the /XPROPX/ common block
previously mentioned in Chapter 12 of this manual. The only differ-
ence is that the component property variables in this common block
can be dynamically updated with the reactor simulation. Property
data stored here are automatically refreshed whenever the USTHER or
UPETMD function is called. The data can be refreshed again when
UCURVE function is called.

This common block can be accessed by including XPROPY.CMN in


the program. The explanation of each variable in this block can be
found from /XPROPX/ in Chapter 12.
COMMON/XPROPY/XMW(MAXCN), BP(MAXCN), DENS(MAXCN),
TC(MAXCN), PC(MAXCN), VC(MAXCN),
ZC(MAXCN), OMEGA(MAXCN), HFORM(MAXCN),
GFORM(MAXCN), LIBNO(MAXCN), KOCMOL,
KOCTOT, KOCVL, KOCVLS,
KOCLS, KOCV, KOCL,
KOCS

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.

17-20 Refinery Reactor Simulation UAS


Example Input File
TITLE
DESCRIPTION DEMO CASE - PRO/II WITH USERis REACTOR MODULE
DIMENSION ENGLISH, PRESS=PSIG, LIQVOL=BBL
OUTDIMENSION REPLACE, TIME=DAY, WT=LB, LIQVOL=BBL
CALC CDATA=VARY

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

METHODS SYSTEM= GS,COND=PETR, VISC(V)=PETR, VISC(L)=API,


SET=GS-2, *
SULFUR(WT)= SUM, *
NITR(TOTA,WT)= SUM, *
BROM(WT)= SUM, *
REFR(WT)= SUM, *
CCR(WT)= SUM, *
SPROP(50,WT)= SUM, *
SPROP(51,WT)= SUM, *
SPROP(52,WT)= SUM, *
NICK(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
$
.....
$

17-22 Refinery Reactor Simulation UAS


$ Refinery Reactor
$
US10 UID=RX1, NAME=BLEND1
FEED F1,RECYCLE
PROD REACT
$ Description of input data is shown in the reactor program
IPARM 1, , , , , *
, , , , , *
51, 52, 50
RPARM 940.0, 30.0, 12000.0, 0.952, , *
, , 85.5, 120.5, 210.8, *
1.4E-4, , , , , *
, , , , , *
1.452
DEFINE RPARM(2) AS COMPRESSOR=CMP1, PRES(PSIG)
METHOD SET= GS-2

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

17-24 Refinery Reactor Simulation UAS


C----------------------------------------------------------------
C -
C - Initialization of variables
C -
DO 40 I= 1, LIXIN
IXIN(I) = IMISS
40 CONTINUE
DO 42 I= 1, LRXIN
RXIN(I) = RMISS
42 CONTINUE
.....
DO 50 I= 1, MXPSEU
CTMID(I) = ZERO
CTMWT(I) = ZERO
.....
50 CONTINUE
.....
C
NFEDIN = IDATA(1)
NUMCOP = IDATA(4)
.....
C----------------------------------------------------------------
C -
C - Assign IPARM, RPARM, SUPPLE to local variables
C -
C The data can be:
C 1. User’s reactor configuration data
C 2. User’s reactor operating condition data such as reactor
C temperature and pressure
C 3. User’s reaction data such as kinetic parameters, update
C factors and catalyst data
C 4. If the refinery inspection property data, such as sulfur,
C nitrogen, refractive index, were not defined in the
C stream, they can be input here locally.
C
C Hydrogen recycle position flag
IH2IN = IPARM(1)
C Position of SPROP() for naphthene carbon fraction
NSNAPH = IPARM(11)
C Position of SPROP() for aromatics carbon fraction
NSAROM = IPARM(12)
C Position of SPROP() for olefin wt%
NSOLEF = IPARM(13)
.....
C Reactor inlet temperature
TIN = RPARM(1)
C Reactor inlet pressure
PIN = RPARM(2)
C Reactor catalyst amount
CATWT = RPARM(3)
C Catalyst activity
CATACT = RPARM(4)
C Product cut points
TCUT1 = RPARM(8)
TCUT2 = RPARM(9)
TCUT3 = RPARM(10)
C Conradson carbon data
CRC(1) = RPARM(11)

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

17-26 Refinery Reactor Simulation UAS


OPEN(UNIT=IONUMB(1), FILE=’C:\REACTOR\FCC\INPUT.DAT’,
1 STATUS=’OLD’, ERR=5000)
C
C Read data from user’s own data file
.....
C
C
C----------------------------------------------------------------
C -
C - Get feed stream data from PRO/II
C -
DO 300 I= 1, NFEDIN
CALL URXINF(’FEED’, I, CID, CNAME, IERR)
C Check error flag IERR
CALL URXSTR(CID, STREAM, 1, IERR)
C Check error flag IERR
C
C Set up the component properties XPROPY for this feed stream
C This is required only if CDATA=VARY is applied
ISETUP = 1
CALL USTHER(CID, ISETUP, JMETHD, IERR)
C
C Get molecular wt
CALL USTPRP(CID, ’TOTAL’, ’MW’, STMW, IERR)
C Check error flag IERR
C Get spgr
CALL USTPRP(CID, ’TOTAL’, ’SDEN’, STDENS, IERR)
C Check error flag IERR
C Get sulfur wt%
CALL USTRIP(CID, ’SULF’, 0, STSULF, IERR)
C Check error flag IERR
C Get nitrogen wt%
CALL USTRIP(CID, ’NITR’, 0, STNITR, IERR)
C Check error flag IERR
C Get naphthene carbon fraction from SPROP(NSNAPH)
CALL USTRIP(CID, ’’, NSNAPH, STNAPH, IERR)
C Check error flag IERR
C Get aromatics carbon fraction from SPROP(NSAROM)
CALL USTRIP(CID, ’’, NSAROM, STAROM, IERR)
C Check error flag IERR
.....
C
C Get distillation curve data
C TBP curve from 0.1% to 99.9%
ITYPE = 2
ICONV = 2
IBASIS = 0
WVIP = 0.1
WVEP = 99.9
CALL UDIST(STREAM, XMW, BP, DENS, ITYPE,
1 ICONV, IBASIS, WVIP, WVEP, NUMCOP,
2 TDIST, IERR)
C Check error flag IERR
C
C Assign feed data to interface variables which can be accessed
C by the reactor simulation program
C Assume:
C FDDATA(*,1)= total flowrate

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
.....

17-28 Refinery Reactor Simulation UAS


C
C----------------------------------------------------------------
C -
C - Execute user’s reactor simulation
C -
C =====================================================
CALL USER_REACTOR(IXIN, RXIN, RXOUT, FDDATA, PDDATA,
1 PDCURV, IERR)
C =====================================================
C Check error flag IERR
C
C----------------------------------------------------------------
C -
C - Store reactor effluent data to PRO/II product stream
C -
CALL URXINF(’PROD’, 1, CID, CNAME, IERR)
C Check error flag IERR
CALL URXSTR(CID, STREAM, 1, IERR)
C Check error flag IERR
C
C Set up the component properties XPROPY for the product stream
C This is required only if CDATA=VARY is applied in the .inp file
ISETUP = 1
CALL USTHER(CID, ISETUP, JMETHD, IERR)
C Check error flag IERR
C
C Get reactor pseudocomponent data
C Assume:
C PDCURV(*,1)= (reserved)
C PDCURV(*,2)= mid boiling point of the pseudocomponent
C PDCURV(*,3)= wt% of the pseudocomponent
C PDCURV(*,4)= MW of the pseudocomponent
C PDCURV(*,5)= SPGR of the pseudocomponent
C PDCURV(*,6)= sulfur wt% of the pseudocomponent
C PDCURV(*,7)= nitrogen wt% of the pseudocomponent
C PDCURV(*,8)= naphthene carbon fraction of the pseudo
C component
C PDCURV(*,9)= aromatics carbon fraction of the pseudo
C component
C PDCURV(*,10) = initial boiling point of the data point
C PDCURV(*,11) = end boiling point of the data point
C .....
C
C Get number of reactor pseudocomponents
NCPSEU = INT(RXOUT(1))
C
DO 320 J= 1, NCPSEU
CTMID(J) = PDCURV(J,2)
CWTPCT(J) = PDCURV(J,3)
CMWT(J) = PDCURV(J,4)
CSPGR(J) = PDCURV(J,5)
CSULF(J) = PDCURV(J,6)
CNITR(J) = PDCURV(J,7)
CNAPH(J) = PDCURV(J,8)
CAROM(J) = PDCURV(J,9)
CTMIN(J) = PDCURV(J,10)
CTMAX(J) = PDCURV(J,11)
.....

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,

17-30 Refinery Reactor Simulation UAS


2 TMAXI, YLOW, YHIGH, IFILL, ITREND,
3 IMETHD, IUPDAT, SSCALE, IMAPED, RXSPGR,
4 SUMSPG, IERR)
C
C Update all required secondary component properties, such as Tc,
C Pc, and Zc, based on the NBP, MW, and SPGR
PPTEXT(1) = ’NBP’
PPTEXT(2) = ’MW’
PPTEXT(3) = ’SPGR’
NPTEXT = 3
CALL UPETMD(PPTEXT, NPTEXT, IERR)
C
C Use the sulfur wt% curve determined from the reactor
C simulation to determine the sulfur wt% of all assay
C pseudocomponents that were selected to store the reactor
C product data.
ATEXT = ’SULF’
ISPROP = 0
TMINI = CTMIN(1)
TMAXI = CTMAX(NCPSEU)
YLOW = 0.0
YHIGH = 100.0
IFILL = 2
ITREND = 0
IMETHD = 3
IUPDAT = 0
SSCALE = 1.0
CALL UCURVE(ATEXT, ISPROP, CTMID, CSULF, NCPSEU,
1 BP, FRATE, IBEGIN, IEND, TMINI,
2 TMAXI, YLOW, YHIGH, IFILL, ITREND,
3 IMETHD, IUPDAT, SSCALE, IMAPED, RXSULF,
4 SUMSUL, IERR)
C
C Similarly for NITROGEN mapping here
...

C Use the naphthene fraction curve determined from the reactor


C simulation to determine the naphthene fraction of all assay
C pseudocomponents that were selected to store the reactor
C product data.
C Assuming that the reactor predicts this property for only
C four points and they are located at index 2 to 5 of NCPSEU:

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

17-32 Refinery Reactor Simulation UAS


CALL UBULK(CID, ATEXT, ISPROP, BRON,
1 BP, IBEGIN, IEND, TMINI,
2 TMAXI, IFILL, SSCALE, IMAPED,
3 RXRON, IERR)
C
C Similarly for other bulk properties
.....
C----------------------------------------------------------------
C -
C - Determine the solution flag value
C -
9000 CONTINUE
C CLOSE USER’S I/O FILES
CLOSE(IONUMB(1))
CLOSE(IONUMB(2))
.....
C
IF (IERR .EQ. 0) THEN
ISOLV = 10
ISTOP = 0
GO TO 9999
ELSEIF .....
.....
ISTOP = 1
ENDIF
C
9999 RETURN
END

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

You might also like