logo资料库

aspen user model ASPEN 用户模型 ,外部通过FORTRAN, EXCEL ,CAPE OPEN.pdf

第1页 / 共330页
第2页 / 共330页
第3页 / 共330页
第4页 / 共330页
第5页 / 共330页
第6页 / 共330页
第7页 / 共330页
第8页 / 共330页
资料共330页,剩余部分请下载后查看
Who Should Read this Guide
Introducing Aspen Plus
Related Documentation
Technical Support
1 Writing and Using User Models
Fortran User Models
Moving to the Intel Fortran Compiler
Configuring Aspen Plus for Your Fortran Compiler
Writing Fortran User Models
Dynamic Linking Overview
Compiling Fortran User Models
Supplying Fortran User Models to Aspen Plus
Creating Fortran Shared Libraries Using Asplink
Writing DLOPT Files
Specifying DLOPT Files for Aspen Plus Runs
Modifying Asplink
2 Calling the Flash Utility
Flash Utility FLSH_FLASH
Flash Types
RETN
IRETN
Flash Results Stored in COMMON
3 Calling Physical Property Monitors
Calling Sequences for Thermodynamic Property Monitors
Calling Sequences for Transport Property Monitors
Calling Sequences for Nonconventional Property Monitors
Calling Sequences for Thermodynamic and Transport Property Monitors with Derivatives
Argument Descriptions for Physical Property Monitors
IDX
IDXNC
Y, X, X1, X2, Z, CS
CAT
KDIAG
Calculation Codes
Phases
CALPRP Results
Derivative Limit
Calling Sequences for PROP-SET Property Monitors
Argument Descriptions for PROP-SET Property Monitors
PROPS
PHASES
KWDBS
XPCLV
KULAB
CALUPP Results
4 Calling Utility Subroutines
Packing Utilities
Report Header Utility
ISECT
Aspen Plus Error Handler
Terminal File Writer Utility
Utilities to Determine Component Index
Component Index Example
Plex Offset Utility
Other Utility
The Fortran WRITE Statement
5 User Unit Operation Models
User and User2 Fortran Models
Stream Structure and Calculation Sequence
NBOPST
Size
Integer and Real Parameters
Local Work Arrays
Simulation Control Guidelines
History File
Terminal File
Report File
Control Panel
Incorporating Excel Worksheets into User2
Extending the User2 Concept
Excel File Name
Fortran Routine
The Excel Template
Tables
The Helper Functions
The Hook Functions
The Sample Workbook
Creating or Converting Your Own Excel Models
Converting an Existing Excel Model
Customizing the Fortran Code
Accessing User2 Parameters
Accessing parameters by position
Accessing parameters by name
Other Helper Functions
User3 Fortran Models
Stream Structure and Calculation Sequence
NBOPST
USER3 Data Classifications
Size
Variable Types and Mapping Concepts
Scaling and Units Conversion in USER3
K Codes
Sparsity Example
Creating a USER3 Model
Additional User3 Subroutines
Physical Property Call Primitives
Low-Level Physical Property Subroutines
Other Useful USER3 Utilities
Component Object Models (COM)
6 User Physical Property Models
User Models for Conventional Properties
Principal User Model Subroutines for Conventional Properties
IDX
Partial Component Index Vectors
X, Y, Z
Real and Integer Work Areas
KOP
KDIAG
Calculation Codes
Range of Applicability
Units of Measurement
Global Physical Property Constants
User K-Value
Electrolyte Calculations
Model-Specific Parameters for Conventional Properties
Universal Constant Names and Definitions
Naming Model-Specific Parameters
Multiple Data Sets
Parameter Retrieval
User Models for Nonconventional Properties
Using Component Attributes
Principal User Model Subroutines for Nonconventional Properties
IDXNC
Real and Integer Work Areas
KOP
KDIAG
Range of Applicability
Model-Specific Parameters for Nonconventional Properties
Naming Model-Specific Parameters
Accessing Component Attributes
7 User Properties for Property Sets
Subroutine to Define a User Property
IDX
NBOPST, KDIAG, and KPDIAG
Phase Codes
Passing Phase Fraction and Composition Information
Component Order Independence
8 User Stream Report
Stream Report Subroutine
Stream Classes
PRPVAL
NRPT
Component IDs
9 User Blending Subroutines for Petroleum Properties
Petroleum Blending Subroutine
IDX
10 User Subroutines for Sizing and Costing
Sizing Model Subroutine
Integer and Real Parameters
ICSIZ
IRSLT
Costing Model Subroutine
11 User Kinetics Subroutines
Kinetics Subroutine for USER Reaction Type
Integer and Real Parameters
NBOPST
Local Work Arrays
Calling Model Type
STOIC
Reaction Rates
Component Attributes and Substream PSD
Component Fluxes in RPlug
COMMON RPLG_RPLUGI
COMMON RPLG_RPLUGR
COMMON RBTC_RBATI
COMMON RBTC_RBATR
COMMON RCST_RCSTRI
COMMON RXN_RCSTRR
COMMON PRSR_PRESRI
COMMON PRSR_PRESRR
COMMON RXN_DISTI
COMMON RXN_DISTR
COMMON RXN_RPROPS
User Kinetics Subroutine for REAC-DIST Reaction Type
NBOPST
STOIC
12 User Pressure Drop Subroutine for RPlug
RPlug Pressure Drop Subroutine
NBOPST
Integer and Real Parameters
Pressure
Local Work Arrays
COMMON RPLG_RPLUGI
COMMON RPLG_RPLUGR
13 User Heat Transfer Subroutine for RPlug
RPlug Heat Transfer Subroutine
NBOPST
Integer and Real Parameters
Local Work Arrays
COMMON RPLG_RPLUGI
COMMON RPLG_RPLUGR
Heat Flux Terms
14 User Heat Transfer Subroutine for RBatch
RBatch Heat Transfer Subroutine
Stream Structure
NBOPST
Integer and Real Parameters
Local Work Arrays
15 User Subroutines for RYield
RYield User Subroutines
NBOPST
Integer and Real Parameters
Local Work Arrays
16 User KLL Subroutines
User KLL Subroutine
IDX
X1, X2
NBOPST, KDIAG
Component Sequence Number
Integer and Real Parameters
17 User Pressure Drop Subroutine for Pipes and HeatX
User Pressure Drop Subroutine
User Liquid Holdup Subroutine
Integer and Real Parameters
NBOPST
Local Work Arrays
KFLASH
18 User Heat Transfer Subroutine for HeatX
HeatX Heat Transfer Subroutine
NBOPST
Integer and Real Parameters
Local Work Arrays
Equipment Specification Arrays
19 User LMTD Correction Factor Subroutine for HeatX
HeatX LMTD Correction Factor Subroutine
NBOPST
Integer and Real Parameters
Local Work Arrays
Equipment Specification Arrays
20 User Subroutines for RateSep
RateSep Binary Mass Transfer Coefficient Subroutine
Integer and Real Parameters
RateSep Heat Transfer Coefficient Subroutine
Integer and Real Parameters
RateSep Interfacial Area Subroutine
Integer and Real Parameters
RateSep Holdup Subroutine
Integer and Real Parameters
Packing Parameters
Packing Type Specification
Packing Vendor Specification
Packing Material Specification
Packing Size Specification
21 User Tray and Packing Subroutines
User Tray Sizing/Rating Subroutine
RTPAR
RTRSLT
User Packing Sizing/Rating Subroutine
Integer and Real Parameters
22 User Performance Curves Subroutine for Compr/MCompr
Performance Curve Subroutine
Integer and Real Parameters
Local Work Arrays
23 User Solubility Subroutine for Crystallizer
Crystallizer Solubility Subroutine
IDX
Integer and Real Parameters
Local Work Arrays
24 User Performance Curves Subroutine for Pump
Pump Performance Curve Subroutine
Integer and Real Parameters
Local Work Arrays
25 User Subroutines for Petroleum Property Methods
26 COM Unit Operation Interfaces
Components and Interfaces
Unit Interfaces
ICapeUnit Interface Methods
ICapeUtilities Interface Method
Port Interfaces
ICapeUnitPort Interface Methods
Parameter Interfaces
ICapeParameter
ICapeParameterSpec
ICapeRealParameterSpec Interface Methods
ICapeIntegerParameterSpec Interface Methods
ICapeOptionParameterSpec Interface Methods
Collection Interfaces
ICapeCollection Interface Methods
ICapeIdentification Interface Methods
ComponentDescription
ComponentName
Aspen Plus Interfaces
IATCapeXDiagnostic Interface Methods
IATCapeXRealParameterSpec
Methods for Equation-Oriented Simulation
ICapeNumericESO
ICapeNumericUnstructuredMatrix
ICapeNumericMatrix
ICapeUnitPortVariables
Installation of COM Unit Operations
Distributing COM Models to Users
Adding Compiled COM Models to the Aspen Plus Model Library
Version Compatibility for Visual Basic COM Models
Uninstalling COM Models
27 CAPE-OPEN COM Thermodynamic Interfaces
Material Templates
Material Objects
ICapeThermoMaterialObject Interface Methods
Physical Property System
ICapeThermoSystem Interface Methods
Property Package
Importing and Exporting
ICapeThermoPropertyPackage Interface Methods
Registration of CAPE-OPEN Components
28 COM Interface for Updating Oil Characterizations and Petroleum Properties
IAssayUpdate Interface Methods
Modifying Petroleum Properties During a Simulation
Recalculate Characterization Parameters
Additional IAssayUpdate Interface Methods
A Common Blocks and Accessing Component Data
Aspen Plus Common Blocks
COMMON DMS_ERROUT
COMMON DMS_FLSCOM
COMMON DMS_NCOMP
COMMON DMS_PLEX
COMMON PPUTL_PPGLOB
COMMON DMS_RGLOB
COMMON DMS_RPTGLB
COMMON DMS_STWKWK
COMMON SHS_STWORK
COMMON PPEXEC_USER
Accessing Component Data Using the Plex
FRMULA
IDSCC
IDSNCC
IDXNCC
Paramname
Using IPOFF3
Accessing Component Data using PPUTL_GETPARAM
B User Subroutine Templates and Examples
C Stream Structure
Substream MIXED
Substream CISOLID
Substream NC
Aspen Plus User Models
Version Number: 2006 October 2006 Copyright (c) 2006 by Aspen Technology, Inc. All rights reserved. Aspen Plus, aspenONE, the aspen leaf logo and Plantelligence and Enterprise Optimization are trademarks or registered trademarks of Aspen Technology, Inc., Cambridge, MA. All other brand and product names are trademarks or registered trademarks of their respective companies. This document is intended as a guide to using AspenTech's software. This documentation contains AspenTech proprietary and confidential information and may not be disclosed, used, or copied without the prior consent of AspenTech or as set forth in the applicable license agreement. Users are solely responsible for the proper use of the software and the application of the results obtained. Although AspenTech has tested the software and reviewed the documentation, the sole warranty for the software may be found in the applicable license agreement between AspenTech and the user. ASPENTECH MAKES NO WARRANTY OR REPRESENTATION, EITHER EXPRESSED OR IMPLIED, WITH RESPECT TO THIS DOCUMENTATION, ITS QUALITY, PERFORMANCE, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. Aspen Technology, Inc. Ten Canal Park Cambridge, MA 02141-2201 USA Phone: (1) (617) 949-1000 Toll Free: (1) (888) 996-7001 Fax: (1) (617) 949-1030 URL: http://www.aspentech.com
Contents Who Should Read this Guide ...................................................................................1 Introducing Aspen Plus ...........................................................................................2 Related Documentation ................................................................................... 3 Technical Support .......................................................................................... 4 1 Writing and Using User Models............................................................................5 Fortran User Models ....................................................................................... 6 Moving to the Intel Fortran Compiler ....................................................... 7 Configuring Aspen Plus for Your Fortran Compiler ..................................... 7 Writing Fortran User Models................................................................... 8 Dynamic Linking Overview..................................................................... 9 Compiling Fortran User Models ..............................................................10 Supplying Fortran User Models to Aspen Plus ...........................................10 Creating Fortran Shared Libraries Using Asplink.......................................11 Writing DLOPT Files .............................................................................11 Specifying DLOPT Files for Aspen Plus Runs.............................................12 Modifying Asplink ................................................................................13 2 Calling the Flash Utility .....................................................................................14 Flash Utility FLSH_FLASH ...............................................................................14 Flash Types ........................................................................................16 RETN.................................................................................................17 IRETN................................................................................................17 Flash Results Stored in COMMON.....................................................................17 3 Calling Physical Property Monitors ....................................................................19 Calling Sequences for Thermodynamic Property Monitors ....................................20 Calling Sequences for Transport Property Monitors.............................................22 Calling Sequences for Nonconventional Property Monitors ...................................23 Calling Sequences for Thermodynamic and Transport Property Monitors with Derivatives...................................................................................................23 Argument Descriptions for Physical Property Monitors.........................................24 IDX ...................................................................................................26 IDXNC ...............................................................................................27 Y, X, X1, X2, Z, CS ..............................................................................27 CAT...................................................................................................27 KDIAG ...............................................................................................27 Calculation Codes................................................................................27 Phases...............................................................................................28 CALPRP Results...................................................................................28 Contents iii
Derivative Limit ..................................................................................28 Calling Sequences for PROP-SET Property Monitors ............................................29 Argument Descriptions for PROP-SET Property Monitors......................................30 PROPS ...............................................................................................31 PHASES .............................................................................................31 KWDBS..............................................................................................31 XPCLV ...............................................................................................31 KULAB ...............................................................................................32 CALUPP Results...................................................................................32 4 Calling Utility Subroutines.................................................................................33 Packing Utilities ............................................................................................33 Report Header Utility .....................................................................................34 ISECT................................................................................................35 Aspen Plus Error Handler................................................................................35 Terminal File Writer Utility ..............................................................................37 Utilities to Determine Component Index ...........................................................38 Component Index Example ...................................................................39 Plex Offset Utility ..........................................................................................39 Other Utility .................................................................................................40 The Fortran WRITE Statement.........................................................................41 5 User Unit Operation Models...............................................................................43 User and User2 Fortran Models .......................................................................43 Stream Structure and Calculation Sequence ............................................46 NBOPST .............................................................................................46 Size ..................................................................................................47 Integer and Real Parameters.................................................................47 Local Work Arrays ...............................................................................48 Simulation Control Guidelines ...............................................................48 History File.........................................................................................49 Terminal File.......................................................................................50 Report File .........................................................................................50 Control Panel ......................................................................................50 Incorporating Excel Worksheets into User2 .......................................................51 Extending the User2 Concept ................................................................51 Excel File Name ..................................................................................51 Fortran Routine...................................................................................51 The Excel Template .............................................................................52 Tables ...............................................................................................52 The Helper Functions ...........................................................................54 The Hook Functions .............................................................................56 The Sample Workbook .........................................................................57 Creating or Converting Your Own Excel Models ........................................58 Converting an Existing Excel Model ........................................................59 Customizing the Fortran Code ...............................................................60 Accessing User2 Parameters ...........................................................................64 Accessing parameters by position ..........................................................64 Accessing parameters by name .............................................................65 Other Helper Functions ........................................................................67 User3 Fortran Models.....................................................................................68 Stream Structure and Calculation Sequence ............................................72 iv Contents
NBOPST .............................................................................................72 USER3 Data Classifications ...................................................................72 Size ..................................................................................................74 Variable Types and Mapping Concepts ....................................................74 Scaling and Units Conversion in USER3 ..................................................76 K Codes .............................................................................................77 Sparsity Example ................................................................................79 Creating a USER3 Model.......................................................................80 Additional User3 Subroutines ................................................................82 Physical Property Call Primitives ............................................................89 Low-Level Physical Property Subroutines ................................................92 Other Useful USER3 Utilities..................................................................94 Component Object Models (COM) ....................................................................94 6 User Physical Property Models ..........................................................................95 User Models for Conventional Properties ...........................................................96 Principal User Model Subroutines for Conventional Properties ............................100 IDX .................................................................................................105 Partial Component Index Vectors.........................................................105 X, Y, Z.............................................................................................106 Real and Integer Work Areas ..............................................................106 KOP ................................................................................................106 KDIAG .............................................................................................107 Calculation Codes..............................................................................107 Range of Applicability.........................................................................107 Units of Measurement ........................................................................107 Global Physical Property Constants ......................................................107 User K-Value ....................................................................................108 Electrolyte Calculations ......................................................................108 Model-Specific Parameters for Conventional Properties .....................................108 Universal Constant Names and Definitions ............................................109 Naming Model-Specific Parameters ......................................................109 Multiple Data Sets .............................................................................109 Parameter Retrieval.....................................................................................111 User Models for Nonconventional Properties ....................................................112 Using Component Attributes .........................................................................112 Principal User Model Subroutines for Nonconventional Properties........................113 IDXNC .............................................................................................114 Real and Integer Work Areas ..............................................................114 KOP ................................................................................................114 KDIAG .............................................................................................115 Range of Applicability.........................................................................115 Model-Specific Parameters for Nonconventional Properties ................................116 Naming Model-Specific Parameters ......................................................116 Accessing Component Attributes ...................................................................116 7 User Properties for Property Sets....................................................................118 Subroutine to Define a User Property .............................................................118 IDX .................................................................................................120 NBOPST, KDIAG, and KPDIAG .............................................................120 Phase Codes.....................................................................................120 Passing Phase Fraction and Composition Information........................................121 Contents v
Component Order Independence ...................................................................121 8 User Stream Report.........................................................................................122 Stream Report Subroutine ............................................................................122 Stream Classes .................................................................................123 PRPVAL............................................................................................123 NRPT ...............................................................................................124 Component IDs.................................................................................124 9 User Blending Subroutines for Petroleum Properties ......................................125 Petroleum Blending Subroutine .....................................................................125 IDX .................................................................................................126 10 User Subroutines for Sizing and Costing........................................................127 Sizing Model Subroutine...............................................................................127 Integer and Real Parameters...............................................................128 ICSIZ ..............................................................................................128 IRSLT ..............................................................................................128 Costing Model Subroutine.............................................................................129 11 User Kinetics Subroutines .............................................................................130 Kinetics Subroutine for USER Reaction Type....................................................131 Integer and Real Parameters...............................................................134 NBOPST ...........................................................................................135 Local Work Arrays .............................................................................135 Calling Model Type ............................................................................135 STOIC .............................................................................................135 Reaction Rates..................................................................................136 Component Attributes and Substream PSD ...........................................136 Component Fluxes in RPlug.................................................................136 COMMON RPLG_RPLUGI .....................................................................137 COMMON RPLG_RPLUGR ....................................................................137 COMMON RBTC_RBATI.......................................................................138 COMMON RBTC_RBATR ......................................................................138 COMMON RCST_RCSTRI.....................................................................138 COMMON RXN_RCSTRR......................................................................139 COMMON PRSR_PRESRI .....................................................................139 COMMON PRSR_PRESRR ....................................................................139 COMMON RXN_DISTI.........................................................................140 COMMON RXN_DISTR ........................................................................140 COMMON RXN_RPROPS......................................................................141 User Kinetics Subroutine for REAC-DIST Reaction Type.....................................141 NBOPST ...........................................................................................143 STOIC .............................................................................................144 12 User Pressure Drop Subroutine for RPlug......................................................145 RPlug Pressure Drop Subroutine ....................................................................146 NBOPST ...........................................................................................147 Integer and Real Parameters...............................................................147 Pressure ..........................................................................................147 vi Contents
Local Work Arrays .............................................................................148 COMMON RPLG_RPLUGI .....................................................................149 COMMON RPLG_RPLUGR ....................................................................149 13 User Heat Transfer Subroutine for RPlug.......................................................150 RPlug Heat Transfer Subroutine.....................................................................151 NBOPST ...........................................................................................152 Integer and Real Parameters...............................................................152 Local Work Arrays .............................................................................153 COMMON RPLG_RPLUGI .....................................................................153 COMMON RPLG_RPLUGR ....................................................................154 Heat Flux Terms................................................................................154 14 User Heat Transfer Subroutine for RBatch.....................................................155 RBatch Heat Transfer Subroutine...................................................................156 Stream Structure ..............................................................................157 NBOPST ...........................................................................................157 Integer and Real Parameters...............................................................157 Local Work Arrays .............................................................................157 15 User Subroutines for RYield ..........................................................................158 RYield User Subroutines ...............................................................................159 NBOPST ...........................................................................................161 Integer and Real Parameters...............................................................161 Local Work Arrays .............................................................................161 16 User KLL Subroutines ....................................................................................162 User KLL Subroutine ....................................................................................163 IDX .................................................................................................164 X1, X2 .............................................................................................164 NBOPST, KDIAG................................................................................164 Component Sequence Number ............................................................164 Integer and Real Parameters...............................................................164 17 User Pressure Drop Subroutine for Pipes and HeatX .....................................165 User Pressure Drop Subroutine .....................................................................166 User Liquid Holdup Subroutine ......................................................................168 Integer and Real Parameters...............................................................169 NBOPST ...........................................................................................169 Local Work Arrays .............................................................................170 KFLASH ...........................................................................................170 18 User Heat Transfer Subroutine for HeatX ......................................................171 HeatX Heat Transfer Subroutine ....................................................................171 NBOPST ...........................................................................................173 Integer and Real Parameters...............................................................173 Local Work Arrays .............................................................................173 Equipment Specification Arrays ...........................................................173 Contents vii
19 User LMTD Correction Factor Subroutine for HeatX .......................................177 HeatX LMTD Correction Factor Subroutine.......................................................178 NBOPST ...........................................................................................179 Integer and Real Parameters...............................................................179 Local Work Arrays .............................................................................179 Equipment Specification Arrays ...........................................................180 20 User Subroutines for RateSep .......................................................................181 RateSep Binary Mass Transfer Coefficient Subroutine .......................................182 Integer and Real Parameters...............................................................184 RateSep Heat Transfer Coefficient Subroutine .................................................187 Integer and Real Parameters...............................................................188 RateSep Interfacial Area Subroutine ..............................................................190 Integer and Real Parameters...............................................................192 RateSep Holdup Subroutine ..........................................................................193 Integer and Real Parameters...............................................................195 Packing Parameters ...........................................................................198 Packing Type Specification..................................................................199 Packing Vendor Specification...............................................................199 Packing Material Specification .............................................................199 Packing Size Specification...................................................................200 21 User Tray and Packing Subroutines ...............................................................201 User Tray Sizing/Rating Subroutine ...............................................................202 RTPAR .............................................................................................204 RTRSLT............................................................................................204 User Packing Sizing/Rating Subroutine ...........................................................205 Integer and Real Parameters...............................................................206 22 User Performance Curves Subroutine for Compr/MCompr.............................207 Performance Curve Subroutine......................................................................208 Integer and Real Parameters...............................................................209 Local Work Arrays .............................................................................209 23 User Solubility Subroutine for Crystallizer.....................................................210 Crystallizer Solubility Subroutine ...................................................................210 IDX .................................................................................................212 Integer and Real Parameters...............................................................213 Local Work Arrays .............................................................................213 24 User Performance Curves Subroutine for Pump.............................................214 Pump Performance Curve Subroutine .............................................................214 Integer and Real Parameters...............................................................215 Local Work Arrays .............................................................................216 25 User Subroutines for Petroleum Property Methods........................................217 26 COM Unit Operation Interfaces......................................................................225 Components and Interfaces ..........................................................................227 viii Contents
分享到:
收藏