profit toolkit functions reference - honeywell process · 2011. 11. 14. · profit controller...
TRANSCRIPT
Process Functions – Add-In Functions- Utility Functions
Profit ToolkitFunctions Reference
5/01Rev 2.0
AP11-410
ii Profit Toolkit Functions Reference 5/01
Honeywell Inc.
.
Process Functions – Add-In Functions- Utility Functions
Profit ToolkitFunctions Reference
5/01Rev 2.0
AP11-410
iv Profit Toolkit Functions Reference 5/01
Honeywell Inc.
Copyright, Notices, and Trademarks
Copyright 2001 by Honeywell International Inc.
While this information is presented in good faith and believed to be accurate, Honeywelldisclaims the implied warranties of merchantability and fitness for a particular purpose andmakes no express warranties except as may be stated in its written agreement with and for
its customer.In no event is Honeywell liable to anyone for any indirect, special or consequential damages.
The information and specifications in this document are subject to change without notice.
Profit, TDC 3000, and TotalPlant are registered trademarks of Honeywell International Inc.
Other product names are trademarks of their respective owners.
HoneywellIndustrial Automation and Control
16404 N. Black Canyon HwyPhoenix, AZ 85053
5/01 Profit Toolkit Functions Reference v
Honeywell Inc.
Table of Contents
TABLE OF CONTENTS............................................................................................................VABOUT THIS PUBLICATION ..................................................................................................XI
Statement of Work.......................................................................................... xiRelease Information ....................................................................................... xiRMPCT Course Information ........................................................................... xiWriting Conventions Used in This Book .........................................................xii
REFERENCES .......................................................................................................................XIIIDocumentation...............................................................................................xiiiOpen................................................................................................................xiiiTPS System ......................................................................................................xiiiEmbedded Uniformance .......................................................................................xiii
FOR TECHNICAL ASSISTANCE ......................................................................................... XIVIf You Need Assistance .................................................................................xivInternational Customers ................................................................................xivCustomers Inside the United States ..............................................................xivArizona Customers ........................................................................................xivServices Provided..........................................................................................xivTime Saving Tip.............................................................................................xiv
SECTION 1 – PROCESS FUNCTIONS................................................................................... 11.1 Overview.............................................................................................................. 1
In this Guide..................................................................................................... 1HSTool_Process.DLL ...................................................................................... 1General Description of Functions .................................................................... 1Input Values..................................................................................................... 1Arrays .............................................................................................................. 2Filtering ............................................................................................................ 2Last Good Value Holding................................................................................. 2Engineering Unit Conversion........................................................................... 2Function Order................................................................................................. 4Using Outputs from Functions as Input to Other Functions ............................ 5Input Dependencies......................................................................................... 7Error Status...................................................................................................... 7Utility Function Error Status............................................................................. 8
1.2 Enthalpy Process (Enth_Proc) ............................................................................. 9In this Section .................................................................................................. 9Important Note Relating to Calculating Enthalpy for a Liquid.......................... 9Important Note Relating to Calculating Enthalpy for a Vapor.......................... 9Detailed Description ...................................................................................... 10Associated Functions .................................................................................... 10Input Table..................................................................................................... 11Output Table .................................................................................................. 13Return Status Table....................................................................................... 14
1.3 Flow Process (Flow_Proc)................................................................................ 16In this Section ................................................................................................ 16Detailed Description ...................................................................................... 16
Table of Contents
vi Profit Toolkit Functions Reference 5/01
Honeywell Inc.
Inputs..............................................................................................................16A Note of Caution about Conversion Factors ................................................17Calculation of Conversion Factor for liquids ..................................................17Calculation of Conversion Factor for gases ...................................................17Calculation of Conversion Factor...................................................................18Output Table ..................................................................................................20Return Status Table .......................................................................................21
1.4 Gravity Process (Gravity_Proc) ............................................................................23In this Section.................................................................................................23Detailed Description .......................................................................................23Input Table .....................................................................................................23Output Table ..................................................................................................24Return Status Table .......................................................................................24
1.5 Molecular Weight Process (Molwt_Proc) ...........................................................25In this Section.................................................................................................25Detailed Description .......................................................................................25Associated Functions .....................................................................................25Input Table .....................................................................................................25Output Table ..................................................................................................26Return Status Table .......................................................................................27
1.6 Pressure Process (Pressure_Proc) ...................................................................28In this Section.................................................................................................28Detailed Description .......................................................................................28Input Table .....................................................................................................28Output Table ..................................................................................................29Return Status Table .......................................................................................29
1.7 Temperature Process (Temperature_Proc) .......................................................30In this Section.................................................................................................30Detailed Description .......................................................................................30Input Table .....................................................................................................30Output Table ..................................................................................................31Return Status Table .......................................................................................31
1.8 Watson K Factor Process (WatsonK_Proc)......................................................32In this Section.................................................................................................32Using Viscosity Method to Calculate Watson K.............................................32Detailed Description .......................................................................................32Associated Functions .....................................................................................32Input Table .....................................................................................................33Output Table ....................................................................................................34Return Status Table .......................................................................................35
SECTION 2 – ADD-IN FUNCTIONS.......................................................................................372.1 Overview ............................................................................................................37
In this Guide ...................................................................................................37HSTool_AddIn.DLL ........................................................................................37
2.2 Dynamic Compensation (Dynamic_Comp).........................................................38In This Section ...............................................................................................38Usage of Dynamic_Comp ..............................................................................38Detail Description ...........................................................................................38
Table of Contents
5/01 Profit Toolkit Functions Reference vii
Honeywell Inc.
Input table ...................................................................................................... 39Output table ................................................................................................... 40Return Status Table....................................................................................... 40
2.3 Polynomial Calculation (Polynomial) ................................................................... 41In This Section ............................................................................................... 41Usage of Polynomial...................................................................................... 41Detail Description........................................................................................... 41Input table ...................................................................................................... 41Output table ................................................................................................... 42Return Status Table....................................................................................... 42
SECTION 3 - UTILITY FUNCTIONS...................................................................................... 433.1 Overview............................................................................................................ 43
In this Guide................................................................................................... 433.2 Convert API Gravity to Specific Gravity (ConvertAPItoSpgr)...................... 44
In this Section ................................................................................................ 44Detailed Description ...................................................................................... 44Input Table..................................................................................................... 44Output Table .................................................................................................. 44
3.3 Convert Specific Gravity to API Gravity (ConvertSpgrtoAPI)...................... 45In this Section ................................................................................................ 45Detailed Description ...................................................................................... 45Input Table..................................................................................................... 45Output Table .................................................................................................. 45
3.4 Convert Temperature in Degree Celsius to Degree Fahrenheit(ConvertTempCtoF) ............................................................................................. 46
In this Section ................................................................................................ 46Detailed Description ...................................................................................... 46Input Table..................................................................................................... 46Output Table .................................................................................................. 46
3.5 Convert Temperature in Degree Fahrenheit to Degree Celsius(ConvertTempFtoC).................................................................................................... 47
In this Section ................................................................................................ 47Detailed Description ...................................................................................... 47Input Table..................................................................................................... 47Output Table .................................................................................................. 47
3.6 Convert Temperature in Degree Rankine to Degree Fahrenheit(ConvertTempRtoF).................................................................................................... 48
In this Section ................................................................................................ 48Detailed Description ...................................................................................... 48Input Table..................................................................................................... 48Output Table .................................................................................................. 48
3.7 Convert Temperature in Degree Fahrenheit to Degree Rankine(ConvertTempFtoR).................................................................................................... 49
In this Section ................................................................................................ 49Detailed Description ...................................................................................... 49Input Table..................................................................................................... 49Output Table .................................................................................................. 49
Table of Contents
viii Profit Toolkit Functions Reference 5/01
Honeywell Inc.
3.8 Corrected Gravity (Corr_Grav)...........................................................................50In this Section.................................................................................................50Detailed Description .......................................................................................50Input Table .....................................................................................................50Output Table ..................................................................................................50Return Status Table .......................................................................................50
3.9 Equilibrium Flash Vaporization Point (EFV_Temp) ...........................................51In this Section.................................................................................................51Detailed Description .......................................................................................51Input Table .....................................................................................................51Output Table ..................................................................................................51Return Status Table .......................................................................................51
3.10 Equilibrium Flash Vaporization Point to ASTM D86 point (EFV_To_D86) ........52In this Section.................................................................................................52Detailed Description .......................................................................................52Input Table .....................................................................................................52Output Table ..................................................................................................52Return Status Table .......................................................................................53
3.11 Enthalpy of a Gas (Enth_Gas) .........................................................................54In this Section.................................................................................................54Detailed Description .......................................................................................54Input Table .....................................................................................................54Output Table ..................................................................................................54Return Status Table .......................................................................................55
3.12 Enthalpy of a Petroleum Fraction/Hydrocarbon (Enth_HC).............................56In this Section.................................................................................................56Important Note Relating to Calculating Enthalpy for a Liquid ........................56Important Note Relating to Calculating Enthalpy for a Vapor ........................56Detailed Description .......................................................................................56Input Table .....................................................................................................57Output Table ..................................................................................................57Return Status Table .......................................................................................58
3.13 Enthalpy of Steam (Enth_Stm) ........................................................................59In this Section.................................................................................................59Detailed Description .......................................................................................59Input Table .....................................................................................................59Output Table ..................................................................................................60Return Status Table .......................................................................................60
3.14 Flow Correction/Compensation (Flow_Corr) ...................................................61In this Section.................................................................................................61Detailed Description .......................................................................................61I Engineering Units.........................................................................................61Correction Type of 1 (Mass volumetric-flow compensation of liquids) ..........61Correction Type of 2 (Mass-flow compensation of gas or vapor) ..................62Correction Type of 3 (mass-flow compensation of gas or vapor) ..................62Correction Type of 4 (Volumetric-flow compensation of gas or vapor)..........62Correction Type of 5 (Mass-flow compensation of steams)...........................62Input Table .....................................................................................................63
Table of Contents
5/01 Profit Toolkit Functions Reference ix
Honeywell Inc.
Output Table .................................................................................................. 64Return Status Table....................................................................................... 65
3.15 Filter - First Order Lag (Filter_First_Ord_Lag)................................................. 66In this Section ................................................................................................ 66Detailed Description ...................................................................................... 66Input Table..................................................................................................... 66Output Table .................................................................................................. 66Return Status Table....................................................................................... 67
3.16 Filter - First Order Lag with Deadtime (Filter_First_Ord_Lag_Deadtime) ....... 68In this Section ................................................................................................ 68Detailed Description ...................................................................................... 68Input Table..................................................................................................... 68Output Table .................................................................................................. 69Return Status Table....................................................................................... 69
3.17 Filter – General Purpose (Filter) ..................................................................... 70In this Section ................................................................................................ 70Detailed Description ...................................................................................... 70Filter Type of 1 (First Order Lag Filter) .......................................................... 70Input Table..................................................................................................... 71Output Table .................................................................................................. 72Return Status Table....................................................................................... 72
3.18 Last Good Value Holding (Last_Good_Value) ................................................ 73In this Section ................................................................................................ 73Example:........................................................................................................ 73Input Table..................................................................................................... 74Output Table .................................................................................................. 74Return Status Table....................................................................................... 74
3.19 Molecular Weight (Mol_WT)............................................................................ 75In this Section ................................................................................................ 75Detailed Description ...................................................................................... 75Input Table..................................................................................................... 75Output Table .................................................................................................. 75Return Status Table....................................................................................... 75
3.20 Pseudo Critical Pressure (Press_PC) ............................................................. 76In this Section ................................................................................................ 76Detailed Description ...................................................................................... 76Input Table..................................................................................................... 76Output Table .................................................................................................. 76Return Status Table....................................................................................... 76
3.21 Pseudo Critical Temperature (Temp_PC) ........................................................ 77In this Section ................................................................................................ 77Detailed Description ...................................................................................... 77Input Table..................................................................................................... 77Output Table .................................................................................................. 77Return Status Table....................................................................................... 77
3.22 Watson K Calculation Based on Mean Average Boiling Point (WatK_MABP) 78In this Section ................................................................................................ 78Detailed Description ...................................................................................... 78
Table of Contents
x Profit Toolkit Functions Reference 5/01
Honeywell Inc.
Input Table .....................................................................................................78Output Table ..................................................................................................78Return Status Table .......................................................................................79
3.23 Watson K Calculation Based on Viscosity (WatK_Visc) ...................................80In this Section.................................................................................................80Detailed Description .......................................................................................80Input Table .....................................................................................................80Output Table ..................................................................................................80Return Status Table .......................................................................................81
xi Profit Toolkit Functions Reference 5/01
Honeywell Inc.
About This PublicationStatement of Work The following table describes the audience, purpose, and scope of this book:
Purpose This book explains how to use the Toolkit Process Functions. TheProcess Functions are used to process general-purpose inputs. Theoutput values of these functions are filtered, bias and converted totoolkit units and are ready to use in other Toolkits such as theFractionator and FCCU toolkits.
Audience Process and control engineers
ReleaseInformation
This is document version 1.0 for Fractionator Toolkit Release 160.00.
RMPCT CourseInformation
Honeywell offers several courses that explain the math and conceptualunderpinnings of RMPCT as well as application implementation of the AdvancedProcess Control suite of products.
Engineers wanting a more technical exposure to RMPCT can contact:
Honeywell Automation College
2500 W. Union Hills Drive
Phoenix, AZ 85027
602-313-5669
About This Publication
xii Profit Toolkit Functions Reference 5/01
Honeywell Inc.
WritingConventions Usedin This Book
The following writing conventions have been used throughout this book andother books in the Profit Suite library.
• Words in double quotation marks “ “ name sections or subsections in thispublication.
• Words in italics name book titles, add grammatical emphasis, introducewords that are being referenced or defined, or represent mathematical variables.The context makes the meaning and use clear.
• Words in bold type indicate paragraph topics or bring important phrases toyour attention.
• Shading brings paragraphs and table entries to your attention.
• Windows pull down menus and their options are separated by an anglebracket >. For example, Under Settings> Communications, set the baud rate.
• Messages and information that you type appear in Courier font.
• Acronyms, Scan parameters, point names, file names, and paths appear inUPPERCASE. The context makes the meaning and use clear.
• Command keys appear in UPPERCASE within angle brackets. For example,press <ENTER>.
• TPS user station touch-screen targets appear in rounded boxes. For example,touch MODIFY NODE .
• Graphic buttons appear in UPPERCASE within brackets [ ]. For example,touch [TAG].
• Point-dot-parameter means a point name and one of its parameters. Forexample, point-dot-SP means the SP parameter for the point.
• Zero as a value and when there is a chance for confusion with the letter O isgiven as Ø. In all other cases, zero as a numerical place holder is given as 0. Forexample, 1.0, 10, 101, CVØ1, parameter PØ.
• The terms screen and display are used inter changeably in discussing thegraphical interfaces. The verbs display a screen and call a screen are also usedinter changeably.
• These names, and may be used interchangeably.
Former Name Product Name
RMPCT Profit Controller
DQP Profit Optimizer
APC Development Environment or APCDE Profit Design Studio
RPID Profit PID
xiii Profit Toolkit Functions Reference 5/01
Honeywell Inc.
References
The following comprise the Profit Suite library.Documentation Title Number
General
Profit Controller (RMPCT) Concepts Reference RM09-400Profit Controller (RMPCT) Designer’s Guide (Off-Line Design) RM11-410Profit Optimizer Designer’s Guide (Off-Line Design) PR11-400Profit Toolkit Designer’s Guide AP11-400APC Identifier User’s Guide AP09-200Profit-PID (RPID) RM11-100Profit Sensor User’s Guide PS09-100
Open
Profit Suite Installation Guide for Open Systems Viewer - Controller - Optimizer - Toolkit
RM20-501
Profit Controller (RMPCT) User’s Guide for Open Systems RM11-401Profit Optimizer User’s Guide for Open Systems PR11-421Profit Trender User’s Guide RM11 431Profit Toolkit User’s Guide for Open Systems AP11-401Profit Toolkit Function Reference AP11-410FCCU Toolkit User’s Guide for Open Systems AP13-201Fractionator Toolkit User’s Guide for Open Systems AP13-101Lab Update User’s Guide AP13-111Wrapper Builder User’s Guide AP11-411Profit Bridge User’s Guide AP20-401
TPS System
Profit Controller (RMPCT) Installation Reference for AM, AxM and Open LCN-Side RM20-400Profit Controller (RMPCT) Commissioning RM20-410Profit Controller (RMPCT) User’s Guide for AM, AxM and Open LCN-Side RM11-400Profit Optimizer Installation Reference for AM and Open LCN-Side PR20-400Profit Optimizer User’s Guide for AM and Open LCN-Side PR11-420Profit Suite Toolkit AP09-300TDC Data ConverterData CollectorStep Test Builder
Performance MonitorRMPCT CascadePV Validation
Simulation BackBuilderGain Scheduler
Fractionator Toolkit (LCN) AP13-100FCCU Toolkit (LCN) AP13-200Furnace Pass Balance Temperature Control User’s Guide AP13-600Non-Linear Level Control User’s Guide AP09-700
Embedded Uniformance
Excel Companion User’s Guide (Profit Embedded PHD) AP20-510Power Point Companion User’s Guide (Profit Embedded PHD) AP20-520Process Trend User’s Guide (Profit Embedded PHD) AP20-530
xiv Profit Toolkit Functions Reference 5/01
Honeywell Inc.
For Technical Assistance
If You NeedAssistance
If you need technical assistance, contact your local Honeywell ServiceOrganization, as explained in the following paragraphs.
InternationalCustomers
Outside of the United States, contact your local Honeywell Service Organization.If you are not sure of the location or telephone number, call your Honeywellrepresentative for information.
Customers Insidethe United States
Within the United States, call the Technical Assistance Center (TAC) at the tollfree number 1-800-822-7673.
ArizonaCustomers
Within Arizona, the local number for TAC is 602-313-5558.
Services Provided Calls to TAC are answered by a dispatcher from 7:00 A.M. to 5:00 P.M.,Mountain Standard Time (6:00 A.M. to 4:00 P.M. when daylight savings time isin effect).
Outside of these hours, emergency calls—those which affect your ability tocontrol or view a process—will be received by an answering service, andreturned within one hour. TAC maintains its own TPS network, and frequentlycan duplicate problems on this equipment.
Time Saving Tip It is a good idea to make specific notes about the problem before making the call.This helps to reduce delays and expedite answers.
For Technical Assistance1.1 Overview
5/01 Profit Toolkit Functions Reference xv
Honeywell Inc.
5/01 Profit Toolkit Functions Reference 1
Honeywell Inc.
Section 1 – Process Functions1.1 OverviewIn this Guide The Process Toolkit functions are general-purpose functions that are used with a
wide range of utilities including the Fractionator toolkit, the FCCU toolkit,RMPCT and DQP.
The Process Toolkit functions allows a user to process a raw field value oralternately calculate a process value based on other raw or user provided inputs.The resultant value is then filtered, biased and converted to units required byother functions (called toolkit units). Last good value processing is alsoavailable.
This guide describes the Process Toolkit functions, how to use them, and thepossible error codes associated with their execution. The functions are asfollows:
HSTool_Process.DLL
The following functions are located in HSTool_Process DLL
Function Description
Enth_Proc Enthalpy processing from raw or calculated input to toolkit use
Flow_Proc Flow processing from raw input to toolkit use
Gravity_Proc Gravity processing from raw input to toolkit use
Molwt_Proc Molecular weight processing from raw or calculated input to toolkit use
Pressure_Proc Pressure processing from raw input to toolkit use
Temperature_Proc Temperature processing from raw input to toolkit use
WatsonK_Proc Watson K processing from raw or calculated input to toolkit use
GeneralDescription ofFunctions
The raw process value toolkit functions are set up so that a user can selectivelyenter either a raw value, or alternately have the function calculate a value basedon user supplied inputs. The resultant entered or calculated value is filtered toreduce noise, biased and converted to toolkit units. Last good value holding isavailable for every function.
The raw process value toolkit functions are general-purpose functions. Use themwith a wide range of utilities including the Fractionator Toolkit, FCCU Toolkit,RMPCT and DQP.
Input Values The user has to supply several inputs to ensure a function works properly. Theinputs may come from a variety of places.
• User entered value
• Input from a DCS or other external source via the DSS server
• Output from another functionDepending on the usage of the function, some input parameters may not be
Section 1 – Process Functions1.1 Overview
2 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
required. The user can ignore these inputs.
Arrays There are two types of array parameters. Fixed size array parameters anddynamically sized array parameters.
The size of a dynamic array is configured during offline configuration. The sizeof the array is dependent on the size of the associated input parameter.
Important Note: The array size for a dynamically sized array can bechanged only in the Profit Design Studio. Changing the size of an arrayduring runtime will have no effect on the array size.
Filtering Filtering is applied to reduce noise and to ramp a value from its previous value toits current value as smoothly as possible. Currently the filter types available are afirst order lag filter and a first order lag filter with deadtime. These filters areinvoked by selecting a filter type of 1 or 2 (several additional parameters alsohave to be filled in). Other filter types will be available in the future. If filteringis not required for a specific function, then a filter type of 0 should be selected.Biasing and conversion are sequenced immediately after the filtering.
For the first order lag filter types, in order to filter from a previous value to thecurrent value, it is required to store the previous values. When the user sets up afunction, a storage parameter for the previous value is automatically created. Theuser does not need to manipulate this parameter, but should be aware of itsexistence. This parameter is an array named Filter_Shift.
For several functions, when an intermediate calculated value is being biased, thebias itself is filtered. This prevents a bumping the output value, when the userenters a new bias.
Last Good ValueHolding
Last good value holding is available for each function. This is invoked byentering a positive value in the number of intervals to hold the value(LGV_Num). Last good value is the last function to be invoked. Thus if a badvalue is processed or calculated by the function it will hold the value for thenumber of intervals specified by the user. The user can turn off last good valueholding by setting LGV_Num to 0, or alternately if the user requires the lastgood value held for an infinite period the user can set LGV_Num to a negativevalue.
When the user sets up a function, storage parameters for last good value holdingare automatically created. The user does not need to manipulate theseparameters, but should be aware of their existence. This parameter is usually anarray named LGV_Values.
Engineering UnitConversion
The process functions conversion factors are usually required to convert outputparameters from toolkit units to user units. When the conversion factor is amultiplier, the equation takes on the following form:
TK units = User units * Conv_Fact
Other times the conversion factor is a flag. For example depending on the flag
Section 1 – Process Functions1.1 Overview
5/01 Profit Toolkit Functions Reference 3
Honeywell Inc.
setting the TK temperature units will either be in Degrees C or Degrees F.
For the main output parameters the function will calculate the output in both userand toolkit units. For example, Gravity_Proc requires a conversion factor todetermine whether to output as specific or API gravity.
Some process functions also require conversion factors to convert inputparameters to toolkit units. For example, Flow_Proc requires a temperatureconversion factor in order to do flow correction.
The following table defines the engineering units handled by the functions:
Engineering Units in Functions
Value
ToolkitUnits
User SuppliedConversion
Factor or Flag
Comment Example ConversionFactor orFlag
Pressure Psig Multiplier toconvert to Psig
Pounds per square inch – gauge
Gauge Pressure – Most functionsrequire input in these units
User requiresoutput in Kpa
0.14503774
Pressure Psi Multiplier toconvert to Psia
Pounds per square inch.
Local pressure (usually around 14.696psi) should be provided in these units.This allows functions to convert an inputpressure in psig to psia.
Temperature
Deg F Flag indicatingwhether uservalue is in Deg For Deg C
0 indicates Deg F
1 indicates Deg C
Does not support any other temperatureunits.
User requiresoutput inDegC
1 (Flag)
Gravity TK units
Spgr@60DegF/60DegF
Flag indicatingwhether uservalue is inspecific gravityor API
0 indicates Specific Gravity
1 indicates API Gravity
User requiresoutput in APIgravity
1 (Flag)
MassFlow
Mlb/hr Multiplier toconvert to Mlb/hr
If user must convert from volumetric flowto mass flow, then the user mustconsider specific gravity in theconversion.
See examplein Flow_Procroutine.
Volumetric Flow
Mbbl/day Multiplier toconvert toMbbl/day
If user must convert from mass flow tovolumetric flow, then the user mustconsider specific gravity in theconversion.
See examplein Flow_Procroutine.
Watson K N/a N/a
Section 1 – Process Functions1.1 Overview
4 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
Engineering Units in Functions
Value
ToolkitUnits
User SuppliedConversion
Factor or Flag
Comment Example ConversionFactor orFlag
Viscosity Centistokes No conversionfactor provided.
User must supply viscosity inCentistokes
Enthalpy MBTU/lb Multiplier toconvert toMBTU/lb
Thousands of BTU per pound.
Heat MMBTU/hr Multiplier toconvert toMMBTU/hr
Millions of BTU per hour.
MoleFraction
N/a N/a
Function Order Function calling order is extremely important in the Process toolkit. Thefunctions are to be ordered/called according to the number shown to the right ofthe function boxes (see next page). When functions are grouped together in thesame row in the diagram, this means that the order relative to other functions inthe same row is not important.
As an example, Gravity_Proc must be called prior to the Flow_Proc andEnth_Proc routines, but can be called before or after the Temperature_Proc orPressure_Proc routines.
The data flow between the routines can be summarized as follows:
1. Use the Temperature, Pressure and Gravity Process routines to filter andconvert the process inputs to the desired toolkit units.
2. Calculate Watson K for required streams.
3. Calculate enthalpy by inputting temperature, pressure gravity and Watson Kin toolkit units. Similarly molecular weight is calculated by inputting gravityand Watson K in toolkit units.
4. Do flow processing. If flow correction is required, then inputs will berequired from all the other “process” routines except for enthalpy.
Section 1 – Process Functions1.1 Overview
5/01 Profit Toolkit Functions Reference 5
Honeywell Inc.
The boxes G for gravity, P for pressure, T for temperature, W for Watson K andM for molecular weight show the interconnectivity between functions. Theseinputs also give a clearer picture of why it is important to schedule somefunctions ahead of others.
Using Outputsfrom Functions asInput to OtherFunctions
The functions are designed to connect together. As an example, a user enteringthe input parameters for the Flash_pt function should use the output ofWatsonK_Proc function as the input for the Flash_pt function. This ensures thatthe input is conditioned properly and in the correct units.
The non-Proc functions (Proc functions are the functions named with “_Proc”)are generally designed requiring inputs in toolkit units. So all the user has to do isset up one Proc function for say each temperature, the temperature will then beprocessed (filtered, biased and converted to toolkit units), and ready to use by thenon-Proc functions. Remember to use the Proc output that is in toolkit units asinput to the non-Proc function, as both user and toolkit units are usuallyavailable.
Enth_Proc Molwt_Proc
Flow_Proc(Liquid)
1
3
4
2WatsonK_Proc
Pressure_Proc Temperature_Proc Gravity_Proc
G
P T G W G W
P T G W
Flow_Proc(Vapor)
P T M W
Section 1 – Process Functions1.1 Overview
6 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
The output from a Proc function may be used as input to several other functions.For example, the output gravity (in toolkit units) from the Gravity_Proc functioncan be used as input to the Top_LandV and also the Int_LandV functions.
The Input Tables below list the function outputs that are recommended for use asinput to another function.
Fractionator Functions(Non-Proc functions)
Temperature_Proc
Pressure_Proc
Molwt_Proc
WatsonK_Proc
Gravity_Proc
Flash_pt
Process Functions(Proc functions)
Mole_Frac
Flow_Proc
Section 1 – Process Functions1.1 Overview
5/01 Profit Toolkit Functions Reference 7
Honeywell Inc.
InputDependencies
Input entry may not be required for some of the input parameters. The entryrequirements are determined based on the user entry of some key inputs. Forexample, in the Enth_Proc function, the user is not required to enter parametersrelating to the calculation of enthalpy, if the user provides a raw enthalpy andsets Calc_Type equal to calculate.The Input Tables below list the key input parameter dependencies.
Error Status All functions set an array of error statuses indicating whether error(s) haveoccurred in a function. Message(s) corresponding to the error(s) are raised andshown in two places:
• The function array parameter – RetMessage – that can be viewed on theProfit® Viewer Input/Output display.
• On the Profit® Viewer Status Messages display.
The errors can also be looked up in this user’s guide.
Errors are positive values. A status of zero indicates that no error has occurred. Anegative status is a warning. The most common warning is a last good valuewarning. This indicates that last good value holding is active (i.e. the output fromthe function is bad and the last good value is being used). There are several otherwarnings, which can be looked up in the Return Status Tables below.
Section 1 – Process Functions1.1 Overview
8 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
Utility FunctionError Status
Errors can also be raised by Utility functions that are used by the Fractionatorfunctions. In this case, an error message preceded with the Utility function nameis displayed. For example
Filter - The filter type specified is out of range. Filter Type must be 0 or 1, 2, 3, 4or 5.
In the example shown above, the error was raised by the Filter function.
Utility errors can be looked up in the Profit Toolkit Functions Reference. The listof Utility functions are shown below.
Utility Function Error Status
(The status value returned for Toolkit functions is the Status Value plus 100)
Error Utility Function1 - 4 Press_PC5 - 8 Temp_PC
9 - 15 Corr_Grav16 - 40 Flow_Corr41 - 46 Filter_First_Ord_Lag47 - 54 Filter_First_Ord_Lag_Deadtime55 - 60 Filter61 - 62 Last_Good_Value63 - 70 WatK_MABP71 - 78 WatK_Visc79 - 82 Mol_WT83 - 92 Enth_HC93 - 97 Enth_Stm98 - 105 Enth_Gas106 - 111 EFV_Temp112 - 121 EFV_To_D86
Section 1 – Process Functions1.2 Enthalpy Process (Enth_Proc)
5/01 Profit Toolkit Functions Reference 9
Honeywell Inc.
1.2 Enthalpy Process (Enth_Proc)In this Section This function processes a raw enthalpy input by filtering it, biasing it, and converting it to
toolkit units. Additionally, this function can calculate either the enthalpy of a liquid orvapor petroleum fraction, the enthalpy of a gas mixture, or the enthalpy of a steam. Thisfunction is used once for each enthalpy value required by an application.
Important NoteRelating toCalculatingEnthalpy for aLiquid
By setting Calc_Type equal to one (1) liquid enthalpy is calculated according toAPI standards. By using this method a significant spike may result in theenthalpy value. This occurs when the API routine - determines based on thereduced temperature and reduced pressure – that the liquid has transitioned to avapor.
In some situations it may be desirable to avoid this spike, and this may beaccomplished by setting Calc_Type equal to five (5). When Calc_Type is setequal to five, the calculation will bypass the liquid to vapor transition logic andalways calculate the enthalpy for a liquid.
Important NoteRelating toCalculatingEnthalpy for aVapor
For vapors and liquids that API considers transitioned to vapor, there is apossibility that the iterative routine that is used to correct the enthalpy may fail toconverge, or converge to the wrong node. In these cases the enthalpy routinereturns a bad value.
Because the iterative routine can return a bad value, it is strongly recommendedthat last good value holding be used. In addition to this, the user is advised to usefiltering to smooth out some of the inherent noise in the iterative calculation.
Section 1 – Process Functions1.2 Enthalpy Process (Enth_Proc)
10 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
DetailedDescription
The following table shows the algorithm used by Enth_Proc to process enthalpy:
Step # Description1 Based on the Calc_Type determine whether to calculate the enthalpy or to use the raw
enthalpy. Go to step 7 if user provides the enthalpy.2 If Stream_Type is liquid call utility function ENTH_HC to calculate liquid enthalpy in toolkit
units.Enthalpy = Enth_HC(Temperature, Pressure, Gravity, WatK, 0,Local_Pressure)
3 If Stream_Type is vapor call utility function ENTH_HC to calculate vapor enthalpy in toolkitunits.
Enthalpy = Enth_HC(Temperature, Pressure, Gravity, WatK, 1, Local_Pressure)
4 If Stream_Type is gas call utility function ENTH_GAS to calculate gas enthalpy in toolkitunits.
Enthalpy = Enth_Gas(Temperature, Gas_CoeffA, Gas_CoeffB, Gas_CoeffC, Gas_CoeffD,Gas_CoeffE, Gas_CoeffF)
5 If Stream_Type is steam call utility function ENTH_STM to calculate steam enthalpy intoolkit units.Enthalpy = Enth_Stm(Temperature, Pressure, Local_Pressure, Sat_Temp, Sat_Enth)
6 Convert enthalpy to user units by dividing by Conv_Fact provided.8 Filter the enthalpy based on the supplied Filter_Type.7 Bias the filtered enthalpy by adding the Bias.8 Convert to toolkit units by multiplying by the Conv_Fact provided.9 Call Last_Good_Value utility function to provide last good value processing. Following
which the flow is stored in Value_User_Units and Value_TK_Units. Value_TK_Units canbe used as input to other functions.
AssociatedFunctions
This function requires inputs from the following functions:
• Temperature_Proc
• Pressure_Proc
• Gravity_Proc
• WatsonK_Proc
Section 1 – Process Functions1.2 Enthalpy Process (Enth_Proc)
5/01 Profit Toolkit Functions Reference 11
Honeywell Inc.
Input Table
Input TableInput Input
ProviderEntry onlyReq’d if
Eng. Units Description
Calc_Type Flag indicating whetherenthalpy is user supplied or tobe calculated (0=usersupplied, 1=calculate liquidenthalpy according to APIstandards, 2= calculate vaporenthalpy, 3= calculate gasenthalpy,4= calculate steamenthalpy, 5= calculate liquidenthalpy but don’t allow atransition to vapor phase)
Raw_Value Calc_Type =0
User Units Enthalpy process input
Temperature Temperature_Proc
Calc_Type =1, 2, 3 or 4
TK units DegF
Stream temperature
Pressure Pressure_Proc
Calc_Type =1, 2 or 4
TK units psig Stream pressure
Local_Pressure
Calc_Type =1, 2 or 4
Psi Local atmospheric pressure
Gravity Gravity_Proc
Calc_Type =1 or 2
TK unitsSpgr@60DegG/60DegF
Specific gravity.
WatK WatsonK_Proc
Calc_Type =1 or 2
Watson K factor
CoeffA Calc_Type =3
Gas enthalpy A coefficient.Entered as listed in API
CoeffB Calc_Type =3
Gas enthalpy B coefficient.Entered as listed in API
CoeffC Calc_Type =3
Gas enthalpy C coefficient.Entered as listed in API
CoeffD Calc_Type =3
Gas enthalpy D coefficient.Entered as listed in API
CoeffE Calc_Type =3
Gas enthalpy E coefficient.Entered as listed in API
CoeffF Calc_Type =3
Gas enthalpy F coefficient.Entered as listed in API
Filter_Type Filter to be used (0 = none, 1 =First order lag filter, 2 to 5 notyet supported). Details of howto use the filter functions canbe found in Section3.
Filter_Coeff_Num
Filter Type > 0 Number of filter coefficientsbeing passed. Not required ifFilter Type = 0. Details of howto use the filter functions canbe found in Section 3.
Section 1 – Process Functions1.2 Enthalpy Process (Enth_Proc)
12 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
Input TableInput Input
ProviderEntry onlyReq’d if
Eng. Units Description
Filter_Coeff[ ] Filter Type > 0 Filter coefficients being passedin. Not required if Filter Type =0. Details of how to use thefilter functions can be found inSection 3.
Filter_Shift_Num
Filter Type > 0 Number of past valuesnecessary for filter. Notrequired if Filter Type = 0.Details of how to use the filterfunctions can be found inSection 3.
Etime Application \Etime
Minutes Application execution time.
Bias User units Bias applied to the filteredenthalpy value
Conv_Fact Multiplier to convert from userunits to toolkit units (MBTU/lb).Used to output enthalpy inuser units.
HcHold Saved hydrocarbon correctionvalue (unit-less). This value isonly relevant when calculatingenthalpy for either a vapor or aliquid that has transitioned to avapor phase. User is notrequired to set this value.
LGV_Num The number of intervals tohold the last good value.If LGV_Num > 0, this indicatesthe number of intervals the lastgood value will be held.If LGV_Num = 0, then lastgood value processing isturned off.If LGV_Num < 0, then the lastgood value will be heldindefinitely.For more details see TheUtility Functions section.
RetNum The maximum number ofsimultaneous error messagesthat can be raised for thisfunction.
Section 1 – Process Functions1.2 Enthalpy Process (Enth_Proc)
5/01 Profit Toolkit Functions Reference 13
Honeywell Inc.
Output Table
Output TableOutput Eng. Units Description
Ret_Status Number of errors/warnings. Ret_Status is positive when the highestpriority message is an error. Ret_Status is negative when the highestpriority message is a warning. Ret_Status is zero, when there are nowarnings or errors.
RetStatus[ ] Array of current function return statuses. See Return Status Table belowfor details.
RetMessage[ ] Array of current Error/Warning Messages.
RetFloat[ ] Array of float arguments for error messages. For internal use only.
RetString[ ] Array of string arguments for error messages. For internal use only.
Sat_Temp TK units DegF
Saturated steam temperature. This parameter is only output ifcalculating enthalpy of steam (i.e. Calc_Type = 4).
Sat_Enth TK unitsMBTU/lb
Saturated steam enthalpy. This parameter is only output if calculatingenthalpy of steam (i.e. Calc_Type = 4).
Value_User_Units User units Calculated enthalpy valueValue_TK_Units
TK unitsMBTU/lb
Calculated enthalpy value
LGV_Count Counter of number of intervals last good value heldLGV_Values[2] Last good value storage array for key output variablesFilter_Shift[ ] Previous filtered value storageHcHold Saved hydrocarbon correction value (unit-less). This value is only
relevant when calculating enthalpy for either a vapor or a liquid that hastransitioned to a vapor phase. User is not required to set this value.
Section 1 – Process Functions1.2 Enthalpy Process (Enth_Proc)
14 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
Return StatusTable
Return Status TableStatusvalue
Description
0 No error occurred1 Calculation Type must be either 0, 1, 2, 3, 4 or 5.2 Enthalpy Conversion Factor input is a bad value3 Enthalpy Conversion Factor input is less than or equal to zero.4 Raw enthalpy input is a bad value5 Bias input is a bad value6 Errors calculating liquid enthalpy . See associated message from Enth_Hc function7 Errors calculating liquid enthalpy. See associated message from Enth_Hc function8 Errors calculating vapor enthalpy. See associated message from Enth_Hc function9 Errors calculating gas enthalpy. See associated message from Enth_Gas function10 Errors calculating steam enthalpy. See associated message from Enth_Gas function11 Errors filtering enthalpy. See associated message from Filter function
141 - 146 An error occurred in the Filter_First_Ord_Lag function. Details of the error can befound by looking up the resulting status value in the Utility Functions section.
155 - 160 An error occurred in the Filter function. Details of the error can be found by lookingup the resulting status value in the Utility Functions section.
105 - 108 An error occurred in the Temp_PC function. Details of the error can be found bylooking up the resulting status value in the Utility Functions section.
101 - 104 An error occurred in the Press_PC function. Details of the error can be found bylooking up the resulting status value in the Utility Functions section.
183 - 192 An error occurred in the Enth_HC function. Details of the error can be found bylooking up the resulting status value in the Utility Functions section.
193 - 197 An error occurred in the Enth_Stm function. Details of the error can be found bylooking up the resulting status value in the Utility Functions section.
198 - 205 An error occurred in the Enth_Gas function. Details of the error can be found bylooking up the resulting status value in the Utility Functions section.
OtherNegative
errors
Last good value holding is active. The error that is causing the bad value can bedetermined by looking up the positive of the error value
Section 1 – Process Functions1.2 Enthalpy Process (Enth_Proc)
5/01 Profit Toolkit Functions Reference 15
Honeywell Inc.
Parameter Input/Output Example 1 –UserSuppliedEnthalpy
Example 1 –Calculateenthalpy ofa liquid
Example 2 –Calculateenthalpy of avapor
Example 3 –Calculateenthalpy ofa gas
Example 4 –Calculateenthalpy ofsteam
Raw_Value I 2Calc_Type I 0 1 2 3 4Temperature I 200 Deg F 600.00 Deg F 200 Deg F 400 Deg FPressure I 50.000 psia 20 psigLocal_Pressure I 0 14.696 psiGravity I 0.6 0.8086 0.345974WatK I 12 11.800CoeffA I 7.228140CoeffB I 0.099687CoeffC I 0.266548CoeffD I 0.054073CoeffE I -0.429269CoeffF I 0.669580Filter_Type I 0 0 0 0 0Bias IConv_Fact I 1 1 1 1 1Ret_Status O 0 0 0 0 0Sat_Temp O -------- -------- -------- -------- 258.71 Deg
FSat_Enth O -------- -------- -------- -------- 1.1670
MBTU/lbValue_User_Units O 2.0000 0.364485979 0.5151 0.1972 1.2371
MBTU/lbValue_TK_Units O 2.0000 0.364485979 0.5151 0.1972 1.2371
MBTU/lb
Section 1 – Process Functions1.3 Flow Process (Flow_Proc)
16 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
1.3 Flow Process (Flow_Proc)In this Section This function processes a raw flow input by, selectively correcting it, selectively
clamping negative values to zero, filtering it, biasing it and converting it to toolkitunits.Additionally, last good value holding is available. This function is used once foreach flow value required by an application.
DetailedDescription
The following table shows the algorithm used by Flow_Proc to process flows:
Step#
Description
1. Based on the Correction_Type determine whether to correct the flow or to use the raw flow.Ignore the next step if the flow is not being corrected.
2. Correct the flow as follows:
Call Flow_Corr utility function. This outputs the corrected flow in parameter Value_Corrected.3. If Clamp_Type is set to clamp, then clamp a negative flow value to zero, also increment the
Clamp_Cnt.4. At this point the flow is in user units. Filter the flow (raw or corrected) based on the supplied
Filter_Type.5. Determine whether to use gravity or molecular weight to calculate mass flow in toolkit units.
if (Stream_Type is liquid)grav_or_molwt = Gravity
if (Stream_Type is a gas, vapor or steam)grav_or_molwt = Molwt
6. If input flow is a volumetric flow, then bias the filtered flow to calculate volumetric flow in userunits, then convert to mass flow units in toolkit unitsVol_Flow_User_Units = filter + BiasMass_Flow_TK_Units = Vol_Flow_User_Units * grav_or_molwt * Conv_Factor
7. If input flow is a mass flow, then bias the filtered flow to calculate mass flow in user units thenconvert to mass flow units in toolkit unitsMass_Flow_User_Units = filter + BiasMass_Flow_TK_Units = Mass_Flow_User_Units * Conv_Factor
8. Calculate volumetric flow in toolkit units. The following calculation is only done for liquidstreams.Vol_Flow_TK_Units = Mass_Flow_TK_Units / (Gravity * 14.59146)
9. Call Last_Good_Value utility function to provide last good value processing. Following which theflow is stored in Mass_Flow_User_Units, Mass_Flow_TK_Units, Vol_Flow_User_Units andVol_Flow_TK_Units.
Inputs This function requires inputs from the following functions:
• Temperature_Proc
• Pressure_Proc
• Gravity_Proc
• WatsonK_Proc
The flow value is provided in meter units.
Section 1 – Process Functions1.3 Flow Process (Flow_Proc)
5/01 Profit Toolkit Functions Reference 17
Honeywell Inc.
A Note ofCaution aboutConversionFactors
The reference values - Ref_Temperature, Ref_Pressure and Ref_Grav_or_Molwtare to be provided in User Units. The Temperature, Pressure, Gravity and Molwtare to be provided in Toolkit Units. The toolkit units can be furnished by theProcess routines listed above.
Calculation ofConversionFactor for liquids
Volumetric Flow to Mass Flow - The objective of this calculation is to provide anexample to show the user how to calculate a conversion factor for a liquid - to gofrom a volumetric flow in Mbbl/day to mass flow in toolkit units Mlb/hr.
δ@60F is density of liquid at 60DegF
δH20@60F is density of water at 60DegF = 62.42lb/ft3
Remember that specific gravity = spgr@60F = δ@60F / δH20@60F
So, the equation to calculate mass flow in toolkit units is:
Mass_Flow_TK_Units = Vol_Flow_User_Units * spgr * [δH20@60F* Factor]
Or, put another way, Conv_Factor = [δH20@60F* Factor]
Mass_Flow_TK_Units = Vol_Flow_User_Units * spgr * [Conv_Factor]
Solving for the units in order to get mass flow in Mlb/hr:
Mlb/hr = Mbbl/day * 1 * [62.42lb/ft3 * day/24hr * 0.1337 ft3/gal * 42gal/bbl]
Mlb/hr = Mbbl/day * [14.60472 (day * ft3) / (hr * bbl)]
So, the Conv_Factor = 14.60472
Calculation ofConversionFactor for gases
Volumetric Flow to Mass Flow - The objective of this calculation is to provide anexample to show the user how to calculate a conversion factor for gases - to gofrom a volumetric flow in Mft3(STP)/hr to mass flow in toolkit units Mlb/hr.
Mwt = Molecular weight of vapor or gas
F is molal flow at standard temperature (492Deg R) and pressure (1 atm) =359ft3(STP)/lb-mole
So, the equation to calculate mass flow in toolkit units is:
Mass_Flow_TK_Units = Vol_Flow_User_Units * mwt * [F * Factor]
Or, put another way, Conv_Factor = [F * Factor]
Mass_Flow_TK_Units = Vol_Flow_User_Units * mwt * [Conv_Factor]
Solving for the units in order to get mass flow in Mlb/hr:
Mlb/hr = Mft3(STP)/hr * 1 * [lb-mole/359ft3(STP) * lb / lb-mole]
Mlb/hr = Mft3(STP)/hr * [1 / (359lb/ft3(STP)]
So, the Conv_Factor = 0.002786 lb/(ft3(STP))
Section 1 – Process Functions1.3 Flow Process (Flow_Proc)
18 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
Calculation ofConversionFactor
Mass Flow to Mass Flow - The objective of this calculation is to provide anexample to show the user how to calculate a conversion factor for a liquid orsteam - to go from a mass flow in kg/hr to mass flow in toolkit units Mlb/hr.
So, the equation to the function uses to calculate mass flow in toolkit units is:
Mass_Flow_TK_Units = Mass_Flow_User_Units * (Conv_Factor)
Solving for the units in order to get mass flow in Mlb/hr:
Mlb/hr = kg/hr * Conv_Factor
Mlb/hr = kg/hr * (2.201lb/kg) * M/103
Mlb/hr = kg/hr * (2.201*10-3 Mlb/kg)
So, the Conv_Fact = 2.201*10-3
Input InputProvider
Entry only Req’d if Eng.Units
Description
Raw_Value UserUnits
User provided flow input
Stream_Type Type of Stream (1=Liquid,2=Vapor,3=Gas,4=Steam)Clamp_Type Flag indicating whether to clamp negative flow values
to zero (0 = none, 1 = clamp)Clamp_Cnt Clamp_Type = 1 Number of executions the flow value has been
clamped.Stream_V_or_M Flag indicated whether the flow measurement is
volumetric or mass flow (0 = volumetric, 1 = mass)Gravity Gravity_Proc Correction Type =
1, 3 4 orStream_Type = 1 or4
TK unitsSpgr @60DegG/60DegF
Specific Gravity.Do not forget to supply Gravity when the stream is aliquid or steam, as gravity is required to convert fromvolumetric flow units to mass flow units.
Molwt Correction Type = 4or Stream_Type = 2or 3
Molecular weight of stream.Do not forget to supply Molwt when the stream is avapor or gas, as molecular weight is required toconvert from volumetric flow units to mass flow units.
Correction_Type Indicates the correction type required:0 = No correction1 = For Liquid streams2 = For Gas or Vapor streams (without gravity ormolecular weight compensation)3 = For Gas or Vapor streams (includes a gravitycompensation term)4 = For Gas or Vapor streams (includes a molecularweight compensation term)5 = For Steam streams
Temperature Temperature_Proc
TK unitsDeg F
Temperature measured.
Pressure Pressure_Proc
Correction Type =2, 3, 4 or 5
TK unitspsig
Stream pressure
Section 1 – Process Functions1.3 Flow Process (Flow_Proc)
5/01 Profit Toolkit Functions Reference 19
Honeywell Inc.
Input InputProvider
Entry only Req’d if Eng.Units
Description
WatK WatsonK_Proc
Correction Type = 1 Watson K factor of stream.
F_Fact Correction_Type > 0 F_Fact is the uncompensated flow term; or the squarerooted differential pressure. If a bad value is input forF_Fact then it defaults to 1.0.
Ref_Grav_or_Molwt
if Correction Type =1, 3 or 4
Userunits
Reference gravity or molecular weight
Grav_Conv_Fact Correction Type =1, 3 or 4
Flag indicating the User units (0 = specific gravity; 1 =API). Used to convert Ref_Grav_or_Molwt from userto toolkit units.
Abs_Temp Correction Type =2, 3, 4, or 5
TK units Abs_Temp is the absolute zero temperature (459.67for DegF)
Ref_Temperature Correction Type =2, 3, 4, or 5
Userunits
Reference temperature.
Temp_Conv_Fact Correction Type =2, 3, 4, or 5
Flag indicating user temperature units (0 = Deg F, 1 =Deg C). Used to convert Ref_Temperature from userto toolkit units.
Abs_Press Correction Type =2, 3, 4 or 5
TK unitspsi
Abs_Press is the ambient pressureAt sea level Abs_Press = 14.696 psi
Ref_Pressure Correction Type =2, 3, 4 or 5
Userunits.
Reference pressure.
Press_Conv_Fact Correction Type =2, 3, 4 or 5
Multiplier to convert from user pressure units to psig.Used to convert Ref_Pressure from user to toolkitunits.
Steam_Compress Correction_Type = 5 Steam compressibility factorRef_Steam_Compress
Correction Type = 5 Flow meter reference steam compressibility
Steam_Quality Correction_Type = 5 Steam qualityRef_Steam_Quality Correction Type = 5 Reference steam qualityFilter_Type Filter to be used (0 = none, 1 = First order lag filter, 2
to 5 not yet supported). Details of how to use the filterfunctions can be found in Section 3.
Filter_Coeff_Num Filter Type > 0 Number of filter coefficients being passed. Notrequired if Filter Type = 0. Details of how to use thefilter functions can be found in Section 3.
Filter_Coeff[ ] Filter Type > 0 Filter coefficients being passed in. Not required if FilterType = 0. Details of how to use the filter functions canbe found in Section 3.
Filter_Shift_Num Filter Type > 0 Number of past values necessary for filter. Notrequired if Filter Type = 0. Details of how to use thefilter functions can be found in Section 3.
Etime Application\ETime
Minutes Application execution time
Bias UserUnits
Bias applied to the filtered flow value
Conv_Fact Multiplier used to convert flow from user units to toolkitunits Mlb/hr.
LGV_Num The number of intervals to hold the last good value.
Section 1 – Process Functions1.3 Flow Process (Flow_Proc)
20 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
Input InputProvider
Entry only Req’d if Eng.Units
Description
If LGV_Num > 0, this indicates the number of intervalsthe last good value will be held.If LGV_Num = 0, then last good value processing isturned off.If LGV_Num < 0, then the last good value will be heldindefinitely.For more details see The Utility Functions section.
Output Table Output TableOutput Eng. Units Description
Ret_Status Number of errors/warnings. Ret_Status is positive whenthe highest priority message is an error. Ret_Status isnegative when the highest priority message is awarning. Ret_Status is zero, when there are nowarnings or errors.
RetStatus[ ] Array of current function return statuses. See ReturnStatus Table below for details.
RetMessage[ ] Array of current Error/Warning Messages.
RetFloat[ ] Array of float arguments for error messages. Forinternal use only.
RetString[ ] Array of string arguments for error messages. Forinternal use only.
Comp_Fact Flow compensation factor only calculated ifCorrection_Flag = 1
Value_Corrected User units Corrected flow value.If the function returns with status > 0, thenValue_Corrected is set equal to the input Flow.If the input Flow is bad, then Value_Corrected is setbad.
Mass_Flow_User_Units User units Calculated mass flowMass_Flow_TK_Units TK units
Mlb/hrCalculated mass flow
Vol_Flow_User_Units User units Calculated volumetric flowVol_Flow_TK_Units TK units
Mbbl/hrCalculated volumetric flow
LGV_Count Counter of number of intervals last good value heldLGV_Values[4] Last good value storage array for key output variablesFilter_Shift[ ] Previous filtered value storage
Section 1 – Process Functions1.3 Flow Process (Flow_Proc)
5/01 Profit Toolkit Functions Reference 21
Honeywell Inc.
Return StatusTable
Return Status TableStatusvalue
Description
0 No error occurred1 Raw flow input is a bad value2 Bias input is a bad value3 Conversion Factor input is a bad value4 Conversion Factor input is less than or equal to zero.5 Stream_V_or_M must be either 0 or 1.6 Stream Type is a bad value7 Stream Type must be 1, 2, 3 or 48 Gravity input is a bad value9 Gravity is negligible or less than zero10 Molecular weight is a bad value11 Molecular weight is negligible or less than zero12 Errors correcting flow. See associated message from Flow_Corr function13 Errors filtering flow. See associated message from Filter function
141 - 146 An error occurred in the Filter_First_Ord_Lag function. Details of the error can befound by looking up the resulting status value in the Utility Functions section.
155 - 160 An error occurred in the Filter function. Details of the error can be found by lookingup the resulting status value in the Utility Functions section.
109 - 115 An error occurred in the Corr_Grav function. Details of the error can be found bylooking up the resulting status value in the Utility Functions section.
116 - 140 An error occurred in the Flow_Corr function. Details of the error can be found bylooking up the resulting status value in the Utility Functions section.
OtherNegative
errors
Last good value holding is active. The error that is causing the bad value can bedetermined by looking up the positive of the error value
Input Example 1 –Steam stream.Mass flow input inkg/day.No flow correction.
Example 2 –Liquid stream.Volumetric flow input inkl/hr.No flow correction.
Example 3 –Gas stream.Volumetric flow input inft3/hr @ STP.No flow correction.
Comments
Raw_Value 20000.0 kg/day 50000 bbl/day 50000 Mft3/hr @ STP Example 2 and 3are input involumetric flowunits
Stream_Type 4 1 2 Example 3 is agas flow
Clamp_Type 0 0 0Clamp_Cnt 0 0 0Correction_Type 0 0 0F_Fact 1 1 1
Section 1 – Process Functions1.3 Flow Process (Flow_Proc)
22 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
Input Example 1 –Steam stream.Mass flow input inkg/day.No flow correction.
Example 2 –Liquid stream.Volumetric flow input inkl/hr.No flow correction.
Example 3 –Gas stream.Volumetric flow input inft3/hr @ STP.No flow correction.
Comments
TemperatureGravity 0.7 spgr 0.7 spgr Gravity must be
specified inspecific gravityunits
Molwt 60 Molecular weightis provided forvapor or gas flows
Ref_Grav_or_MolwtGrav_Conv_FactWatKAbs_TempRef_TemperatureTemp_Conv_FactPressureAbs_PressRef_PressurePress_Conv_FactSteam_CompressRef_Steam_CompressSteam_QualityRef_Steam_QualityFilter_Type 0 0 0Bias 0 0 0Conv_Fact 9.17083E-05 0.014591 0.002786Stream_V_or_M 1 0 0Ret_Status 0 0 0Comp_Fact ------- ------- -------Value_Corrected ------- ------- -------Mass_Flow_User_Units
20000.0 kg/day ------- -------
Mass_Flow_TK_Units
1.8342 Mlb/hr 510.70 Mlb/hr 6963.8 Mlb/hr Always output inMlb/hr
Vol_Flow_User_Units
-------- 50000.0 bbl/day 50000.0 ft3/hr @ STP
Vol_Flow_TK_Units
0.1796 Mbbl/day 50.0 Mbbl/day 477.25 Mbbl/day Always output inMbbl/day
Section 1 – Process Functions1.4 Gravity Process (Gravity_Proc)
5/01 Profit Toolkit Functions Reference 23
Honeywell Inc.
1.4 Gravity Process (Gravity_Proc)In this Section This function processes a raw gravity input by filtering it, biasing it and
converting it to toolkit units, last good value holding is also available. Thisfunction is used once for each gravity value required by an application.
DetailedDescription
The following table shows the algorithm used by Gravity_Proc to processgravity:Step # Description
1 Filter the raw gravity based on the supplied Filter_Type .2 Bias the filtered gravity by adding the Bias. Value is in user units.3 Based on the Conv_Fact provided convert to toolkit units. If Conv_Fact = 0 then user
provided specific gravity and no conversion is required. If Conv_Fact = 1 then convertfrom API gravity to specific gravity.
4 Call Last_Good_Value utility function to provide last good value processing. Followingwhich the gravity is stored in Value_User_Units and Value_TK_Units. Value_TK_Unitscan be used as input to other functions.
Input Table
Input TableInput Input
ProviderEntry onlyReq’d if
Eng. Units Description
Raw_Value User units Raw process gravity inputFilter_Type Filter to be used (0 = none, 1 = First order lag filter, 2 to 5
not yet supported). Details of how to use the filter functionscan be found in Section 3.
Filter_Coeff_Num
Filter Type > 0 Number of filter coefficients being passed. Not required ifFilter Type = 0. Details of how to use the filter functions canbe found in Section 3.
Filter_Coeff[ ] Filter Type > 0 Filter coefficients being passed in. Not required if FilterType = 0. Details of how to use the filter functions can befound in Section 3.
Filter_Shift_Num
Filter Type > 0 Number of past values necessary for filter. Not required ifFilter Type = 0. Details of how to use the filter functions canbe found in Section 3.
Etime Application\ETime
Minutes Application execution time
Bias User units Bias applied to the filtered gravity valueConv_Fact Flag indicating gravity user units (0 = specific gravity, 1 =
API).LGV_Num The number of intervals to hold the last good value.
If LGV_Num > 0, this indicates the number of intervals thelast good value will be held.If LGV_Num = 0, then last good value processing is turnedoff.If LGV_Num < 0, then the last good value will be heldindefinitely.For more details see The Utility Functions section.
Section 1 – Process Functions1.4 Gravity Process (Gravity_Proc)
24 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
Output Table Output Table
Output Eng. Units DescriptionRet_Status Function return status. See Return Status Table
below for details.RetStatus[ ] Array of current function return statuses. See
Return Status Table below for details.
RetMessage[ ] Array of current Error/Warning Messages.
RetFloat[ ] Array of float arguments for error messages. Forinternal use only.
RetString[ ] Array of string arguments for error messages. Forinternal use only.
Value_User_Units User units Calculated gravity valueValue_TK_Units TK units
Spgr@60DegG/60DegFCalculated specific gravity value
LGV_Count Counter of number of intervals last good valueheld
LGV_Values[2] Last good value storage array for key outputvariables
Filter_Shift[ ] Previous filtered value storage
RetNum The maximum number of simultaneous errormessages that can be raised for this function.
Return StatusTable
Return Status Table
Statusvalue
Description
0 No error occurred1 Bias input is a bad value2 Raw pressure input is a bad value3 Conversion Factor input is a bad value4 Errors filtering gravity. See associated message from Filter function
141 - 146 An error occurred in the Filter_First_Ord_Lag function. Details of the error can befound by looking up the resulting status value in the Utility Functions section.
155 - 160 An error occurred in the Filter function. Details of the error can be found by lookingup the resulting error code in the Utility Functions section.
NegativeValues
Last good value holding is active. The error that is causing the bad value can bedetermined by looking up the positive of the error value
Section 1 – Process Functions1.5 Molecular Weight Process (Molwt_Proc)
5/01 Profit Toolkit Functions Reference 25
Honeywell Inc.
1.5 Molecular Weight Process (Molwt_Proc)In this Section This function processes a raw molecular weight input by filtering it and biasing
it, last good value holding is also available. Additionally, this function cancalculate the molecular weight of a petroleum fraction based on the specificgravity and Watson K factor. This function is used once for each molecularweight value required by an application.
DetailedDescription
The following table shows the algorithm used by Molwt_Proc to processenthalpyStep # Description
1 Based on the Calc_Type determine whether to calculate the molecular weight or to usethe raw enthalpy. Ignore the next step if user provides the molecular weight.
2 Call utility function Mol_WT to calculate molecular weight.
Molwt = Mol_WT(Gravity, WatK)
3 Filter the calculated or user provided molecular weight based on the suppliedFilter_Type.
4 Bias the filtered molecular weight by adding the Bias.5 Call Last_Good_Value utility function to provide last good value processing. Following
which the molecular weight is stored in Value_TK_Units. Value_TK_Units can be usedas input to other functions.
AssociatedFunctions
This function requires inputs from the following functions:• Gravity_Proc• WatsonK_Proc
Input Table
Input Input Provider Entry onlyReq’d if
Eng. Units Description
Calc_Type Flag indicating whether to calculate molecularweight (0 = Don’t calculate – user providedmolecular weight, 1 = Calculate)
Raw_Value User provided molecular weight inputGravity Gravity_Proc Calc_Type = 1 TK units
Spgr@60DegG/60DegF
Specific gravity.
WatK WatsonK_Proc Calc_Type = 1 WatK is the Watson K factor.
Filter_Type Filter to be used (0 = none, 1 = First order lagfilter, 2 to 5 not yet supported). Details of howto use the filter functions can be found inSection 3.
Filter_Coeff_Num
Filter Type > 0 Number of filter coefficients being passed. Notrequired if Filter Type = 0. Details of how to usethe filter functions can be found in Section 3.
Filter_Coeff[ ] Filter Type > 0 Filter coefficients being passed in. Not requiredif Filter Type = 0. Details of how to use the filterfunctions can be found in Section 3.
Section 1 – Process Functions1.5 Molecular Weight Process (Molwt_Proc)
26 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
Input Table
Input Input Provider Entry onlyReq’d if
Eng. Units Description
Filter_Shift_Num
Filter Type > 0 Number of past values necessary for filter. Notrequired if Filter Type = 0. Details of how to usethe filter functions can be found in Section 3.
Etime Application\ETime
Minutes Application execution time
Bias Bias applied to the filtered molecular weightvalue
LGV_Num The number of intervals to hold the last goodvalue.If LGV_Num > 0, this indicates the number ofintervals the last good value will be held.If LGV_Num = 0, then last good valueprocessing is turned off.If LGV_Num < 0, then the last good value willbe held indefinitely.For more details see The Utility Functionssection.
RetNum The maximum number of simultaneous errormessages that can be raised for this function.
Output Table Output Table
Output Eng. Units DescriptionRet_Status Function return status. See Return Status Table
below for details.RetStatus[ ] Array of current function return statuses. See
Return Status Table below for details.
RetMessage[ ] Array of current Error/Warning Messages.
RetFloat[ ] Array of float arguments for error messages. Forinternal use only.
RetString[ ] Array of string arguments for error messages. Forinternal use only.
Value_TK_Units Calculated molecular weight valueLGV_Count Counter of number of intervals last good value
heldLGV_Values[1] Last good value storage array for key output
variablesFilter_Shift[ ] Previous filtered value storage
Section 1 – Process Functions1.5 Molecular Weight Process (Molwt_Proc)
5/01 Profit Toolkit Functions Reference 27
Honeywell Inc.
Return StatusTable
Return Status Table
Statusvalue
Description
0 No error occurred1 Calculation Type must be either 0 or 1.2 Raw molecular weight input is a bad value. This error is only applicable if Calculation
Type is 0.3 Bias input is a bad value4 Errors calculating molecular weight. See associated message from Mol_WT function5 Errors filtering molecular weight. See associated message from Filter function
141 - 146 An error occurred in the Filter_First_Ord_Lag function. Details of the error can befound by looking up the resulting status value in the Utility Functions section.
155 - 160 An error occurred in the Filter function. Details of the error can be found by lookingup the resulting error code in the Utility Functions section.
179 - 182 An error occurred in the Mol_WT function. Details of the error can be found bylooking up the resulting error code in the Utility Functions section
NegativeValues
Last good value holding is active. The error that is causing the bad value can bedetermined by looking up the positive of the error value
Section 1 – Process Functions1.6 Pressure Process (Pressure_Proc)
28 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
1.6 Pressure Process (Pressure_Proc)In this Section This function processes a raw pressure input by filtering it, biasing it and
converting it to toolkit units. Last good value holding is also available. Thisfunction is used once for each pressure value required by an application.
DetailedDescription
The following table shows the algorithm used by Pressure_Proc to process flows:
Step # Description1 Filter the raw pressure based on the supplied Filter_Type.2 Bias the filtered pressure by adding the Bias. Value is in user units.3 Convert to toolkit units by multiplying by the Conv_Fact provided.4 Call Last_Good_Value utility function to provide last good value processing. Following
which the pressure is stored in Value_User_Units and Value_TK_Units. Value_TK_Unitscan be used as input to other functions.
Input TableInput Input Provider Entry only
Req’d ifEng. Units Description
Raw_Value User units Raw process pressure inputFilter_Type Filter to be used (0 = none, 1 = First order lag filter,
2 to 5 not yet supported). Details of how to use thefilter functions can be found in Section 3.
Filter_Coeff_Num
Filter Type > 0 Number of filter coefficients being passed. Notrequired if Filter Type = 0. Details of how to use thefilter functions can be found in Section 3.
Filter_Coeff[ ] Filter Type > 0 Filter coefficients being passed in. Not required ifFilter Type = 0. Details of how to use the filterfunctions can be found in Section 3.
Filter_Shift_Num Filter Type > 0 Number of past values necessary for filter. Notrequired if Filter Type = 0. Details of how to use thefilter functions can be found in Section 3.
Etime Application\ETime
Minutes Application execution time.
Bias User units Bias applied to the filtered pressure value.Conv_Fact Multiplier to convert pressure from user units to
toolkit units (psi)LGV_Num The number of intervals to hold the last good value.
If LGV_Num > 0, this indicates the number ofintervals the last good value will be held.If LGV_Num = 0, then last good value processing isturned off.If LGV_Num < 0, then the last good value will beheld indefinitely.For more details see The Utility Functions section.
RetNum The maximum number of simultaneous errormessages that can be raised for this function.
Section 1 – Process Functions1.6 Pressure Process (Pressure_Proc)
5/01 Profit Toolkit Functions Reference 29
Honeywell Inc.
Output Table Output TableOutput Eng. Units Description
Ret_Status Function return status. See ReturnStatus Table below for details.
Value_User_Units
User units Calculated pressure value
Value_TK_Units
TK units psig Calculated pressure value
LGV_Count Counter of number of intervals lastgood value held
LGV_Values[2]
Last good value storage array for keyoutput variables
Filter_Shift[]
Previous filtered value storage
Return StatusTable
Return Status Table
Statusvalue
Description
0 No error occurred1 Raw pressure input is a bad value2 Bias input is a bad value3 Conversion Factor input is a bad value4 Conversion Factor input is less than or equal to zero.5 Errors filtering pressure. See associated message from Filter function
141 - 146 An error occurred in the Filter_First_Ord_Lag function. Details of the error can befound by looking up the resulting status value in the Utility Functions section
155 - 160 An error occurred in the Filter function. Details of the error can be found by looking upthe resulting error code in the Utility Functions section
NegativeValues
Last good value holding is active. The error that is causing the bad value can bedetermined by looking up the positive of the error value
Section 1 – Process Functions1.7 Temperature Process (Temperature_Proc)
30 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
1.7 Temperature Process (Temperature_Proc)In this Section This function processes raw temperature input by filtering it, biasing it and
converting it to toolkit units, last good value holding is also available. Thisfunction is used once for each temperature value required by an application.
DetailedDescription
The following table shows the algorithm used by Temperature_Proc to processflows:Step # Description
1 Filter the raw temperature based on the supplied Filter_Type.2 Bias the filtered temperature by adding the Bias. Value is in user units.3 Based on the Conv_Fact provided convert to toolkit units. If Conv_Fact = 0 then the user
provided temperature in Deg F and no conversion is required. If Conv_Fact = 1 thenconvert from Deg F to Deg C.
4 Call Last_Good_Value utility function to provide last good value processing. Followingwhich the temperature is stored in Value_User_Units and Value_TK_Units.Value_TK_Units can be used as input to other functions.
Input TableInput Input
ProviderEntry onlyReq’d if
Eng. Units Description
Raw_Value User Units Raw process temperature inputFilter_Type Filter to be used (0 = none, 1 = First order lag filter, 2
to 5 not yet supported). Details of how to use the filterfunctions can be found in Section 3.
Filter_Coeff_Num Filter Type > 0 Number of filter coefficients being passed. Notrequired if Filter Type = 0. Details of how to use thefilter functions can be found in Section 3.
Filter_Coeff[ ] Filter Type > 0 Filter coefficients being passed in. Not required if FilterType = 0. Details of how to use the filter functions canbe found in Section 3.
Filter_Shift_Num Filter Type > 0 Number of past values necessary for filter. Notrequired if Filter Type = 0. Details of how to use thefilter functions can be found in Section 3.
Etime Application\ETime
Minutes Application execution time
Bias User Units Bias applied to the filtered temperature valueConv_Fact Flag indicating temperature user units (0 = Deg F; 1 =
Deg C)LGV_Num The number of intervals to hold the last good value.
If LGV_Num > 0, this indicates the number of intervalsthe last good value will be held.If LGV_Num = 0, then last good value processing isturned off.If LGV_Num < 0, then the last good value will be heldindefinitely.For more details see The Utility Functions section.
RetNum The maximum number of simultaneous errormessages that can be raised for this function.
Section 1 – Process Functions1.7 Temperature Process (Temperature_Proc)
5/01 Profit Toolkit Functions Reference 31
Honeywell Inc.
Output Table Output TableOutput Eng. Units DescriptionRet_Status Function return status. See Return Status Table below for
details.RetStatus[ ] Array of current function return statuses. See Return
Status Table below for details.
RetMessage[ ] Array of current Error/Warning Messages.
RetFloat[ ] Array of float arguments for error messages. For internaluse only.
RetString[ ] Array of string arguments for error messages. For internaluse only.
Value_User_Units User units Calculated temperature valueValue_TK_Units TK units Deg F Calculated temperature valueLGV_Count Counter of number of intervals last good value heldLGV_Values[2] Last good value storage array for key output variablesFilter_Shift[ ] Previous filtered value storage
Return StatusTable
Return Status Table
Statusvalue
Description
0 No error occurred1 Raw temperature input is a bad value2 Bias input is a bad value3 Conversion Factor input is a bad value4 Errors filtering temperature. See associated message from Filter function
141 - 146 An error occurred in the Filter_First_Ord_Lag function. Details of the error can befound by looking up the resulting status value in the Utility Functions section
155 - 160 An error occurred in the Filter function. Details of the error can be found by looking upthe resulting error code in the Utility Functions section
NegativeValues
Last good value holding is active. The error that is causing the bad value can bedetermined by looking up the positive of the error value
Section 1 – Process Functions1.8 Watson K Factor Process (WatsonK_Proc)
32 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
1.8 Watson K Factor Process (WatsonK_Proc)In this Section This function processes a raw Watson K input by filtering it and biasing it, last good
value holding is also available. Additionally, this function can calculate the Watson Kvalue based on the specific gravity and mean average boiling point or alternately thespecific gravity and the viscosity. This function is used once for each Watson K valuerequired by an application.
Using ViscosityMethod toCalculate WatsonK
The Watson K calculation based on viscosity is calculated using an iterativetechnique that may fail to converge hence his calculation should be used withcaution. It is recommended that last good value holding be configured whenselecting this algorithm so that the last good value is available when theiteration fails to converge.
DetailedDescription
The following table shows the algorithm used by WatsonK_Proc to process aWatson K factor:
Step # Description1 Based on the Calc_Type determine whether to calculate the Watson K factor or to use
the raw enthalpy. Go to step 4 if user provides the Watson K factor.2 If the user chooses to calculate the Watson K factor based on D86 values (i.e.
Calc_Type = 1) then call utility function WatK_MABP.
WatsonK = WatK_MABP(D86_10, D86_50, D86_90, Gravity, MABP_Bias)
3 If the user chooses to calculate the Watson K factor based on viscosity values (i.e.Calc_Type = 2) then call utility function WatK_Visc.
WatsonK = WatK_Visc(Gravity, Viscosity, Iterations, Tolerance, Fn_WatK)
4 Filter the Watson K factor based on the supplied Filter_Type.5 Bias the filtered Watson K factor by adding the Bias.6 Call Last_Good_Value utility function to provide last good value processing. Following
which the Watson K factor is stored in Value_User_Units and Value_TK_Units.Value_TK_Units can be used as input to other functions.
AssociatedFunctions
This function requires inputs from the following functions:• Gravity_Proc
Section 1 – Process Functions1.8 Watson K Factor Process (WatsonK_Proc)
5/01 Profit Toolkit Functions Reference 33
Honeywell Inc.
Input TableInput Input Provider Entry only Req’d if Eng. Units DescriptionRaw_Value User provided Watson K inputCalc_Type Flag indicating whether to calculate
Watson K (0 = Don’t Calculate, UserProvided Watson K, 1 = D86, 2 =viscosity)
Gravity Gravity_Proc Calc_Type = 1 or 2 TK unitsSpgr@60DegG/60DegF
Specific gravity
D86_10 D86_EFV_PT Calc_Type = 1 TK units Deg F ASTM D86 10% pointD86_50 D86_EFV_PT Calc_Type = 1 TK units Deg F ASTM D86 50% point.D86_90 D86_EFV_PT Calc_Type = 1 TK units Deg F ASTM D86 90% pointMABP_Bias Calc_Type = 1 TK units Deg F Bias applied to the mean average
boiling point biasViscosity Calc_Type = 2 centistokes Viscosity in centistokes at 210 Deg FInit_WatK Calc_Type = 2 Initial Watson K value used in iterative
calculationIterations Calc_Type = 2 Maximum number of iterations to
converge Newton Raphson calculation.Tolerance Calc_Type = 2 Convergence tolerance for Newton
Raphson. If a bad value is input forTolerance then it defaults to 0.05.
Filter_Type Filter to be used (0 = none, 1 = Firstorder lag filter, 2 to 5 not yet supported).Details of how to use the filter functionscan be found in Section 3.
Filter_Coeff_Num
Filter Type > 0 Number of filter coefficients beingpassed. Not required if Filter Type = 0.Details of how to use the filter functionscan be found in Section 3.
Filter_Coeff[ ] Filter Type > 0 Filter coefficients being passed in. Notrequired if Filter Type = 0. Details of howto use the filter functions can be found inSection 3.
Filter_Shift_Num
Filter Type > 0 Number of past values necessary forfilter. Not required if Filter Type = 0.Details of how to use the filter functionscan be found in Section 3.
Etime Application\ETime Minutes Application execution timeBias User units Bias applied to the filtered Watson K
value.LGV_Num The number of intervals to hold the last
good value.If LGV_Num > 0, this indicates thenumber of intervals the last good valuewill be held.If LGV_Num = 0, then last good valueprocessing is turned off.If LGV_Num < 0, then the last good
Section 1 – Process Functions1.8 Watson K Factor Process (WatsonK_Proc)
34 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
Input TableInput Input Provider Entry only Req’d if Eng. Units Description
value will be held indefinitely.For more details see The UtilityFunctions section.
RetNum The maximum number of simultaneouserror messages that can be raised forthis function.
Output Table Output Table
Output Eng.Units
Description
Ret_Status Function return status. See Return Status Table below for details.
RetStatus[ ] Array of current function return statuses. See Return Status Tablebelow for details.
RetMessage[ ] Array of current Error/Warning Messages.
RetFloat[ ] Array of float arguments for error messages. For internal use only.
RetString[ ] Array of string arguments for error messages. For internal use only.
Value_TK_Units . Calculated Watson K value
LGV_Count Counter of number of intervals last good value held
LGV_Values[1] Last good value storage array for key output variables
Filter_Shift[ ] Previous filtered value storage
Section 1 – Process Functions1.8 Watson K Factor Process (WatsonK_Proc)
5/01 Profit Toolkit Functions Reference 35
Honeywell Inc.
Return StatusTable
Return Status Table
Statusvalue
Description
0 No error occurred
1 Calculation Type must be 0, 1 or 2.
2 Raw Watson K input is a bad value. This error is only applicable if Calculation Type is0.
3 Bias input is a bad value
4 Errors calculating Watson K. See associated message from WatK_Mabp function
5 Errors calculating Watson K. See associated message from WatK_Visc function
6 Errors filtering Watson K. See associated message from Filter function
141 -146
An error occurred in the Filter_First_Ord_Lag function. Details of the error can befound by looking up the resulting status value in the Utility Functions section
155 -160
An error occurred in the Filter function. Details of the error can be found by looking upthe resulting error code in the Utility Functions section
163 -170
An error occurred in the WatK_MABP function. Details of the error can be found bylooking up the resulting error code in the Utility Functions section
171 -178
An error occurred in the WatK_Visc function. Details of the error can be found bylooking up the resulting error code in the Utility Functions section
NegativeValues
Last good value holding is active. The error that is causing the bad value can bedetermined by looking up the positive of the error value
Section 1 – Process Functions1.8 Watson K Factor Process (WatsonK_Proc)
36 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
5/01 Profit Toolkit Functions Reference 37
Honeywell Inc.
Section 2 – Add-In Functions2.1 OverviewIn this Guide The Add-In Toolkit functions are general-purpose functions that are used with a
wide range of utilities including the Fractionator toolkit, the FCCU toolkit,RMPCT and DQP.
HSTool_AddIn.DLL The following functions are located in HSTool_AddIn DLL
Function Description
Dynamic_Comp Provides a transfer function for dynamically lagging a variable.
Polynomial This function calculates an nth order polynomial. This provides auser with flexibility to perform a wide-range of mathematicalmanipulations on input variables.
Section 2 – Add-In Functions2.2 Dynamic Compensation (Dynamic_Comp)
38 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
2.2 Dynamic Compensation (Dynamic_Comp)In This Section This function provides a transfer function for dynamically lagging a variable.
Usage ofDynamic_Comp
The Dynamic_Comp function can be used by the FCCU toolkit.
A single instance of Dynamic_Comp needs to be configured to lag the predictedseverity. In addition to this, an instance of Dynamic_Comp is required for eachpredicted product.
The output of the Dynamic_Comp function is used by Calculation_Comp tocalculate the bias between the dynamically lagged predicted values and themeasured values.
Detail Description The following table shows the Calculation Algorithm used by Dynamic_Comp tocalculate the reactor properties:
Calculation Algorithm
Step # Description
1. When application is initialized then
Set Dyn_Comp_Initialized = NOT_INITIALIZED
Set Deadtime_Counter = 0
2. Perform dynamic compensation using either a first order lag filter or a first order lag filterwith deadtime.
Filter the Input value based on the supplied Filter_Type.
3. Increment the Deadtime_Counter
4. Determine if filter has completed initialization:
If Deadtime_Counter > (Filter_Deadtime / Etime) + (4 * Filter_Time / Etime) then
Set Dyn_Comp_Initialized = INITIALIZED
Else
Set Dyn_Comp_Initialized = NOT_INITIALIZED
Section 2 – Add-In Functions2.2 Dynamic Compensation (Dynamic_Comp)
5/01 Profit Toolkit Functions Reference 39
Honeywell Inc.
Input table The input table provides a description of the function inputs.
Input Table
Input[ ] denotes array
Source OnlyReq’d if
Eng. Units Description
Input_Value Severity_PredorProduct_PredorOctane_Pred
Value to be dynamically compensated.
This value should be the raw value. It should beunbiased and uncorrected.
For example, if dynamically compensating severity,then input the output parameter Severity_Raw fromthe Severity_Pred function.
Similarly if dynamically compensating product yield,then input Product_Raw from the Product_Predfunction.
Filter_Type Filter to be used (0 = none, 1 = First order lag filter, 2=First order lag plus deadtime, 3 to 5 not yetsupported).
Details of how to use the filter functions can be foundin Section 3
Filter_Time Minutes Filter time
Filter_Deadtime Minutes Filter deadtime.
Note that Filter_Deadtime must not exceed(Filter_Shift_Num – 1) / Etime
Filter_Shift_Num Number of values to save for filter.
Set this equal to maximum dead time of processdivided by the execution time – then add one. e.g.
If Maximum deadtime = 30 Minutes and executiontime(Etime) = 0.5 minutes then
Filter_Shift_Num = 30/0.5+1 = 61.
Important Note: The user should ensure thatFilter_Shift_Num is set large enough to accommodatethe longest anticipated deadtime. If Filter_Shift_Numis set too small the user may have to reconfigure theDynamic Compensation function.
Filter_Shift[ ] Array of saved values
Deadtime_Counter Number of executions since the application initialized.
Etime Minutes Applications execution timeRetNum The maximum number of simultaneous error
messages that can be raised for this function.
Section 2 – Add-In Functions2.2 Dynamic Compensation (Dynamic_Comp)
40 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
Output table The output table provides a description of the function outputs.
Output Table
Output[ ] denotes array
Eng. Units Description
Ret_Status Function return status. See Return Status Table below for details.
RetStatus[ ] Array of current function return statuses. See Return Status Table below fordetails.
RetMessage[ ] Array of current Error/Warning Messages.
RetFloat[ ] Array of float arguments for error messages. For internal use only.
RetString[ ] Array of string arguments for error messages. For internal use only.
Dyn_Comp_Value Dynamically compensated value
Deadtime_Counter Number of executions since the application initialized.
Dyn_Comp_Initialized Flag indicating whether filter is initialized (0 = Not initialized, 1 = Initialized)
Filter is considered initialized following deadtime and four time constants.
i.e. time to initialize = (Filter_Deadtime + 4 * Filter_Time) minutes.
Filter_Shift[ ] Array of saved values
Return StatusTable
Shows the error and warning messages associated with the function.
Return Status
Statusvalue
Description
0 No error occurred.
1 Errors filtering input. See associated message from Filter function
141 - 146 An error occurred in the Filter_First_Ord_Lag function. Details of the error can be foundby looking up the resulting status value in the Utility Functions section
147 - 154 An error occurred in the Filter_First_Ord_Lag_Deadtime function. Details of the errorcan be found by looking up the resulting status value in the Utility Functions section
155 - 160 An error occurred in the Filter function. Details of the error can be found by looking upthe resulting status value in the Utility Functions section
Section 2 – Add-In Functions2.3 Polynomial Calculation (Polynomial)
5/01 Profit Toolkit Functions Reference 41
Honeywell Inc.
2.3 Polynomial Calculation (Polynomial)In This Section This function calculates an nth order polynomial. The polynomial coefficients
are configurable.Usage ofPolynomial
Polynomial can be used to perform mathematical operations on a given input. Asa simple example, polynomial can be configured so that a user-configuredcoefficient can be subtracted from the input. E.g. Output = Input – Coefficient.
Detail Description The following table shows the Calculation Algorithm used by Polynomial tocalculate the reactor properties:
Calculation Algorithm
Step # Description
1. The polynomial is calculated as follows:
Output = PolyCoeff\1 + (PolyCoeff\2 * Input) + (PolyCoeff\3 * Input2) + .. +(PolyCoeff\n+1 * Inputn)
Input table The input table provides a description of the function inputs.
Input Table
Input[ ] denotes array
Source Only Req’d if Eng. Units Description
Input Input (x value) to polynomial
PolyOrder Order of polynomial. Enter order plus 1. e.g. 3rdorder enter 4.
Note: During configuration the user shouldconfigure a high order for the polynomial. Thisallows the order of the polynomial to beincremented during runtime.
PolyCoeff[ ] PolyOrder>1 Polynomial Coefficients are used in the calculationas follows:
Output = PolyCoeff\1 + (PolyCoeff\2 * Input) +(PolyCoeff\3 * Input2) + .. + (PolyCoeff\n+1 * Inputn)
RetNum The maximum number of simultaneous errormessages that can be raised for this function.
Section 2 – Add-In Functions2.3 Polynomial Calculation (Polynomial)
42 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
Output table The output table provides a description of the function outputs.
Output Table
Output[ ] denotes array
Eng.Units
Description
Ret_Status Function return status. See Return Status Table below for details.
RetStatus[ ] Array of current function return statuses. See Return Status Tablebelow for details.
RetMessage[ ] Array of current Error/Warning Messages.
RetFloat[ ] Array of float arguments for error messages. For internal use only.
RetString[ ] Array of string arguments for error messages. For internal useonly.
Output Output (y value) of polynomial
Return StatusTable
Shows the error and warning messages associated with the function.
Return Status
Statusvalue
Description
0 No error occurred.
1 Polynomial input is bad. Polynomial output has been set bad
2 Polynomial order is less than 1. Polynomial output has been set bad
3 Polynomial coefficient – PolyCoeff\n - is a bad value. Polynomial output has been setbad
5/01 Profit Toolkit Functions Reference 43
Honeywell Inc.
Section 3 - Utility Functions3.1 OverviewIn this Guide The Fractionator, FCCU and Process toolkits all make use of the Utility Functions to
do some basic calculations, conversion and processing required in APC applications.
This guide describes the utility functions, how to use them, and the possible errorcodes associated with the utility functions. Errors generated by the utility functionsare reported to the toolkit functions and displayed accordingly. The utility functionsare as follows:
Utility Functions
Function DescriptionConvertAPItoSpgr Converts API gravity in to Specific Gravity (60 Deg F/60 Deg F).
ConvertSpgrtoAPI Converts Specific Gravity (60 Deg F/60 Deg F) to API gravity.
ConvertTempCtoF Converts temperature in Degree Celsius (Deg C) to Degree Fahrenheit (Deg F).
ConvertTempFtoC Converts temperature in Degree Fahrenheit (Deg F) to Degree Celsius (Deg C).
ConvertTempFtoR Converts temperature in Degree Fahrenheit (Deg F) to Degree Rankine (Deg R).
ConvertTempRtoF Converts temperature in Degree Rankine (Deg R) to Degree Fahrenheit (Deg F).
Corr_Grav Calculates the corrected gravity for a petroleum fraction.
EFV_Temp Calculates the equilibrium flash vaporization point of a petroleum fraction.
EFV_To_D86 Calculates the ASTM D86 point of a petroleum fraction.
Enth_Gas Calculates the enthalpy of Gas.
Enth_HC Calculates the enthalpy of a petroleum fraction.
Enth_Stm Calculates the enthalpy of steam.
Filter Processes all necessary filtering.
Filter_First_Ord_Lag Calculates a first order lag filter.
Flow_Corr Calculates the corrected flow for a liquid, gas, vapor or steam.
Last_Good_Value This function processes last good value logic. The function allows the user to holdon to the last good calculated value for a specified number of executions.
Mol_WT Calculates the molecular weight of a petroleum fraction.
Press_PC Calculates the pseudo critical pressure of a light petroleum fraction.
Temp_PC Calculates the pseudo critical temperature of a light petroleum fraction.
WatK_MABP Calculates the Watson K factor based on the mean average boiling point and thespecific gravity.
WatK_Visc Calculates the Watson K factor based on the viscosity and the specific gravity.
Section 3 - Utility Functions3.2 Convert API Gravity to Specific Gravity (ConvertAPItoSpgr)
44 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
3.2 Convert API Gravity to Specific Gravity (ConvertAPItoSpgr)
In this Section This function converts API gravity to Specific Gravity (60 Deg F/60 Deg F).
The Function is:
GravSpgr = ConvertAPItoSpgr(GravAPI)
DetailedDescription
The following table shows the algorithm in calculating Specific Gravity:
Step # Description1. Calculate the Specific Gravity.
GravSpgr = 141.5f/ (GravAPI + 131.5)
Input Table Input Table
Input Entry only Req’d if Eng. Units DescriptionGravAPI API gravity The API gravity
Output Table Output Table
Output Eng. Units DescriptionGravSpgr Toolkit units 60 Deg F/60 Deg F The Specific Gravity
Section 3 - Utility Functions3.3 Convert Specific Gravity to API Gravity (ConvertSpgrtoAPI)
5/01 Profit Toolkit Functions Reference 45
Honeywell Inc.
3.3 Convert Specific Gravity to API Gravity (ConvertSpgrtoAPI)
In this Section This function converts Specific Gravity (60 Deg F/60 Deg F) to API gravity.
The Function is:
GravAPI = ConvertSpgrtoAPI(GravSpgr)
DetailedDescription
The following table shows the algorithm in calculating API Gravity:
Step # Description1. Calculate the API Gravity.
GravAPI = (141.5 / GravSpgr) – 131.5
Input Table Input TableInput Entry only Req’d if Eng. Units DescriptionGravSpgr Toolkit Units 60 Deg
F/60 Deg FSpecific Gravity
Output Table Output Table
Output Eng. Units DescriptionGravAPI API gravity API gravity
Section 3 - Utility Functions3.4 Convert Temperature in Degree Celsius to Degree Fahrenheit (ConvertTempCtoF)
46 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
3.4 Convert Temperature in Degree Celsius to DegreeFahrenheit (ConvertTempCtoF)
In this Section This function converts temperature in Degree Celsius (Deg C) to DegreeFahrenheit (Deg F).
TempDegC = ConvertTempFtoC(TempDegF)
DetailedDescription
The following table shows the algorithm in calculating temperature in Deg F:
Step # Description1. Calculate the Temperature in Deg F.
TempDegF = (TempDegC * 1.8) + 32.0
Input Table Input Table
Input Entry only Req’d if Eng. Units DescriptionTempDegC Deg C Temperature
Output Table Output Table
Output Eng. Units DescriptionTempDegF Toolkit units Deg F Temperature
Section 3 - Utility Functions3.5 Convert Temperature in Degree Fahrenheit to Degree Celsius (ConvertTempFtoC)
5/01 Profit Toolkit Functions Reference 47
Honeywell Inc.
3.5 Convert Temperature in Degree Fahrenheit to DegreeCelsius (ConvertTempFtoC)In this Section This function converts temperature in Degree Fahrenheit (Deg F) to Degree Celsius (Deg
C).
TempDegC = ConvertTempFtoC(TempDegF)
DetailedDescription
The following table shows the algorithm in calculating temperature in Deg C:
Step # Description1. Calculate the Temperature in Deg C.
TempDegC = (TempDegF - 32.0) / 1.8
Input Table Input TableInput Entry only Req’d if Eng. Units DescriptionTempDegF Toolkit Units -Deg F Temperature
Output Table Output TableOutput Eng. Units DescriptionTempDegC Deg C Temperature
Section 3 - Utility Functions3.6 Convert Temperature in Degree Rankine to Degree Fahrenheit (ConvertTempRtoF)
48 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
3.6 Convert Temperature in Degree Rankine to DegreeFahrenheit (ConvertTempRtoF)In this Section This function converts temperature in Degree Rankine (Deg R) to Degree
Fahrenheit (Deg F).DetailedDescription
The following table shows the algorithm in calculating temperature in Deg F:TempDegF = ConvertTempRtoF(TempDegR)
Step # Description1. Calculate the Temperature in Deg F.
TempDegF = TempDegR - 459.67
Input Table Input TableInput Entry only Req’d if Eng. Units DescriptionTempDegR Deg R Temperature
Output Table Output Table
Output Eng. Units DescriptionTempDegF Toolkit units Deg F Temperature
Section 3 - Utility Functions3.7 Convert Temperature in Degree Fahrenheit to Degree Rankine (ConvertTempFtoR)
5/01 Profit Toolkit Functions Reference 49
Honeywell Inc.
3.7 Convert Temperature in Degree Fahrenheit to DegreeRankine (ConvertTempFtoR)In this Section This function converts temperature in Degree Fahrenheit (Deg F) to Degree
Rankine (Deg R).
TempDegR = ConvertTempFtoR(TempDegF)
DetailedDescription
The following table shows the algorithm in calculating temperature in Deg R:
Step # Description1. Calculate the Temperature in Deg R.
TempDegR = TempDegF + 459.67
Input Table Input TableInput Entry only Req’d if Eng. Units DescriptionTempDegF Toolkit Units -Deg F Temperature
Output Table Output TableOutput Eng. Units DescriptionTempDegR Deg R Temperature
Section 3 - Utility Functions3.8 Corrected Gravity (Corr_Grav)
50 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
3.8 Corrected Gravity (Corr_Grav)In this Section This function calculates the corrected gravity for a petroleum fraction. The function takes
the process temperature, specific gravity at 60 Deg F, and the Watson K factor as inputsand returns the specific gravity results in 60 Deg F / 60 Deg F units.
DetailedDescription
The following table shows the algorithm in calculating the corrected gravity
Step # Description1. The calculation is based on the following input parameters:
Corr_grav = ƒ (Temperature, Gravity, Watson K)
Input Table Input TableInput Entry only Req’d if Eng. Units DescriptionTemperature Toolkit Units -Deg F TemperatureGravity Toolkit Units - 60
Deg F/60 Deg FSpecific Gravity
Watson K Watson K is thecharacterization factor
Output Table Output TableOutput Eng. Units DescriptionRet_Status Function return status. See Return
Status Table below for details.corr_grav Toolkit units
60 Deg F/60 Deg F.The corrected gravity value atIf the function returns with a status >0, then corr_grav is set bad.
Return StatusTable
Return Status Table
Statusvalue
Description
0 No error occurred9 The process temperature input is a bad value10 The process temperature is out of range (less than zero Deg F)11 The specific gravity input is a bad value12 The specific gravity is out of range (less than 0.495 or greater than 1.2)13 The Watson K input is a bad value14 The Watson K factor is out of range (less than zero)15 The Watson K factor is equal to (or with 1.0E-06) of 8.5.
Section 3 - Utility Functions3.9 Equilibrium Flash Vaporization Point (EFV_Temp)
5/01 Profit Toolkit Functions Reference 51
Honeywell Inc.
3.9 Equilibrium Flash Vaporization Point (EFV_Temp)In this Section This function calculates the equilibrium flash vaporization point of a petroleum fraction.
The calculation is based on the temperature, the partial pressure and the Watson K factor.The function uses the temperature, partial pressure, and the Watson K to calculate theEFV point.
Ret_Status = EFV_Temp(Temperature, Part_Press, WatK, efv_temp)
DetailedDescription
The following table shows the algorithm in calculating the equilibrium flashvaporization point:
Step # Description1. The pressure is converted to mm Hg2. The corrected boiling point temperature is calculated3. The temperature difference between the normal and corrected boiling point
temperatures is calculated.4. The equilibrium flash vaporization point is calculated as a function of corrected boiling
point temperature and the temperature difference.
Input Table Input TableInput Entry only Req’d if Eng. Units DescriptionTemperature Toolkit Units -Deg F TemperaturePart_Press psia Partial pressureWatK Watson K is the
characterization factor
Output Table Output TableOutput Eng. Units DescriptionRet_Status Function return status. See Return Status Table below for
details.Efv_temp Toolkit units Deg F The equilibrium flash vaporization temperature
If the function returns with a status > 0, then efv_temp is setbad.
Return StatusTable
Return Status Table
Statusvalue
Description
0 No error occurred106 The Temperature input is a bad value107 The Partial Pressure input is a bad value108 The Watson K input is a bad value109 The Temperature input is out of range (less than or equal to zero)110 The Partial Pressure input is out of range (less than or equal to zero)111 The Watson K input is out of range (less than or equal to zero)
Section 3 - Utility Functions3.10 Equilibrium Flash Vaporization Point to ASTM D86 point (EFV_To_D86)
52 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
3.10 Equilibrium Flash Vaporization Point to ASTM D86 point(EFV_To_D86)In this Section This function calculates the ASTM D86 point of a petroleum fraction. The calculation is
based on the EFV temperature, the specific gravity and conversion coefficients. Thefunction uses the EFV temperature, specific gravity, and conversion coefficients tocalculate the ASTM D86 point.
Ret_Status = EFV_To_D86(EFV_Temp, Gravity, Vol_Pct, Coeff_A, Coeff_B,Coeff_C, efv_to_d86)
DetailedDescription
The following table shows the algorithm in calculating the ASTM D86 point:
Step # Description1. The coefficients A, B and C are loaded based on the Cutpoint selected.
If Vol_Pct = 1 to 7 then use API coefficients A, B and CIf Vol_Pct = 8 then use user provided coefficients A, B and C
2. The ASTM D86 point (in Deg F) is calculated based on the following input parameters.efv_to_d86 = ƒ (Temperature, Gravity, Coeff_A, Coeff_B, Coeff_C)
Input Table Input TableInput Entry only
Req’d ifEng. Units Description
EFV_Temp Toolkit Units -Deg F The EFV temperature measured inGravity Toolkit Units - 60 Deg
F/60 Deg FThe specific gravity measured at
Vol_Pct The desired Cutpoint in percent.1 = 0%2= 10%3= 30%4= 50%5 = 70%6 = 90%7 = 100%8 = use user coefficients
Coeff_A Vol_Pct = 8 The user supplied A coefficientCoeff_B Vol_Pct = 8 The user supplied B coefficientCoeff_C Vol_Pct = 8 The user supplied C coefficient
Output Table Output TableOutput Eng. Units DescriptionRet_Status Function return status. See Return Status Table below for
details.efv_to_d86 Toolkit units Deg F The ASTM D86 point
If the function returns with a status > 0, then efv_to_d86 isset bad.
Section 3 - Utility Functions3.10 Equilibrium Flash Vaporization Point to ASTM D86 point (EFV_To_D86)
5/01 Profit Toolkit Functions Reference 53
Honeywell Inc.
Return StatusTable
Return Status Table
Statusvalue
Description
0 No error occurred112 The EFV Temperature input is a bad value
113 The Gravity input is a bad value
114 The Volume percent flag input is a bad value
115 The EFV Temperature input is out of range (less than or equal to zero)116 The Gravity input is out of range (less than or equal to zero)117 The Volume percent input is out of range (less than 1 or greater than 8)118 The user supplied A coefficient input is a bad value119 The user supplied B coefficient input is a bad value120 The user supplied C coefficient input is a bad value121 The user supplied B coefficient input is out of range (less than or equal to zero)
Section 3 - Utility Functions3.11 Enthalpy of a Gas (Enth_Gas)
54 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
3.11 Enthalpy of a Gas (Enth_Gas)In this Section This function calculates the enthalpy of Gas. The calculation is based on the temperature
and coefficients specific to the gas. The function uses the temperature and gas coefficientsto calculate the enthalpy.
Ret_Status = Enth_Gas(Temperature, Coeff_A, Coeff_B, Coeff_C, Coeff_D,Coeff_E, Coeff_F, enth_gas)
DetailedDescription
The following table shows the algorithm in calculating the enthalpy of Gas:
Step # Description1 The user provides coefficients A, B, C, D, E and F based on API Technical Data Book
Table 7A1.2.2 The enthalpy (in MBTU/lb:) is calculated based on API Technical Data Book Procedure
7A1.1-1. The equation is:
enth_gas = A + BT + CT2 + DT3 + ET4 + FT5
Where A = Coeff_A, B = Coeff_B, C = Coeff_C, D = Coeff_D, E = Coeff_E F= Coeff_F and T = Temperature
Since coefficients C, D, E and F are very small fractions, the user should supplythem as C*103, D*106, E*1010 andF*1014. This is consistent with what is entered in the API table.
Input Table Input TableInput Entry only
Req’d ifEng. Units Description
Temperature Toolkit Units -Deg F TemperatureCoeff_A Coefficient A entered as listed in API.Coeff_B Coefficient B entered as listed in API.Coeff_C Coefficient C entered as listed in API. Enter C*103
Coeff_D Coefficient D entered as listed in API. Enter D*106
Coeff_E Coefficient E entered as listed in API. Enter E*1010
Coeff_F Coefficient F entered as listed in API. Enter F*1014
Output Table Output TableOutput Eng. Units DescriptionRet_Status Function return status. See Return Status Table below
for details.enth_gas Toolkit units MBTU/lb. The calculated gas enthalpy
If the function returns with a status > 0, then Sat_Temp isset bad.
Section 3 - Utility Functions3.11 Enthalpy of a Gas (Enth_Gas)
5/01 Profit Toolkit Functions Reference 55
Honeywell Inc.
Return StatusTable
Return Status Table
StatusValue
Description
0 No error occurred98 The Temperature input is a bad value99 The A Coefficient input is a bad value100 The B Coefficient input is a bad value101 The C Coefficient input is a bad value102 The D Coefficient input is a bad value103 The E Coefficient input is a bad value104 The F Coefficient input is a bad value105 The Temperature input is out of range (less than or equal to zero)
Section 3 - Utility Functions3.12 Enthalpy of a Petroleum Fraction/Hydrocarbon (Enth_HC)
56 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
3.12 Enthalpy of a Petroleum Fraction/Hydrocarbon(Enth_HC)In this Section This function calculates the enthalpy of a petroleum fraction. The calculation is
based on the temperature, pressure, gravity and Watson K.
Ret_Status = Enth_HC(Temperature, Pressure, Gravity, WatK, L_or_V,Local_Press, enth_hc)
Important NoteRelating toCalculatingEnthalpy for aLiquid
By setting L_or_V equal to zero (0) liquid enthalpy is calculated according toAPI standards. By using this method a significant spike may result in theenthalpy value. This occurs when the API routine - determines based on thereduced temperature and reduced pressure – that the liquid has transitioned to avapor.
In some situations it may be desirable to avoid this spike, and this may beaccomplished by setting L_or_V equal to two (2). When L_or_V is set equal totwo, the calculation will bypass the liquid to vapor transition logic and alwayscalculate the enthalpy for a liquid.
Important NoteRelating toCalculatingEnthalpy for aVapor
For vapors and liquids that API considers transitioned to vapor, there is apossibility that the iterative routine that is used to correct the enthalpy may fail toconverge, or converge to the wrong node. In these cases the enthalpy routinereturns a bad value.
DetailedDescription
The following table shows the algorithm in calculating the enthalpy of apetroleum fraction:
Step # Description
1. The pseudo critical pressure and temperature are calculated using the Press_PC andTemp_PC utility functions.
2. The reduced temperature (Tr) and pressure (Pr) are calculated.3. The enthalpy is calculated using API Technical Data Book Procedure 7B4.7-1 Region I
equations in the following conditions:
• User forces calculation for liquid in Region I (L_or_V == 2)
• or when, enthalpy is calculated for a liquid with Tr<=0.8 and Pr<=1.0
Otherwise the enthalpy is calculated by adding API Technical Data Book Procedure7B4.7-1 Region I and 7B4.7-2 Region II calculations.
This happens in the following conditions:
• For vapors (L_or_V == 2)
• And for liquids (L_or_V == 0) that have transitioned to a vapor (Tr>0.8 and Pr<1.0)
Note: Region II contains an iterative calculation that may fail due to non-convergence orconvergence to the wrong node. In these cases the enthalpy is set to a bad value.
Section 3 - Utility Functions3.12 Enthalpy of a Petroleum Fraction/Hydrocarbon (Enth_HC)
5/01 Profit Toolkit Functions Reference 57
Honeywell Inc.
Input Table Input TableInput Entry only
Req’d ifEng. Units Description
Temperature Toolkit Units -Deg F TemperaturePressure Toolkit Units -psig. PressureGravity Toolkit Units - 60 Deg F
/60 Deg FMeasured specific gravity
WatK Watson K is the characterization factorL_or_V The material type (0=Liquid according to
API, 1=Vapor, 2=Liquid bypass vaportransition)
Local_Press psi The local atmospheric pressure.HcHold Saved hydrocarbon correction value
(unit-less). This value is only relevantwhen calculating enthalpy for either avapor or a liquid that has transition tothe vapor phase. User is not required toset this value.
Output Table Output TableOutput Eng. Units DescriptionRet_Status Function return status. See Return Status Table below
for details.HcHold Saved hydrocarbon correction value (unit-less). This
value is only relevant when calculating enthalpy foreither a vapor or a liquid that has transition to thevapor phase. User is not required to set this value.
enth_hc Toolkit units MBTU/lb. The enthalpy of the petroleum fraction.If the function returns with a status > 0, then enth_hcis set bad.
Section 3 - Utility Functions3.12 Enthalpy of a Petroleum Fraction/Hydrocarbon (Enth_HC)
58 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
Return StatusTable
Return Status Table
Statusvalue
Description
0 No error occurred83 The Temperature input is a bad value84 The Pressure input is a bad value85 The Gravity input is a bad value86 The Watson K input is a bad value87 The liquid or vapor type input is a bad value88 The Local Pressure input is a bad value89 The Temperature input is out of range (less than or equal to zero or greater than 1200)90 The flag indicating Liquid or Vapour is not equal to zero, one or two.91 The enthalpy correction iteration converged to the wrong root in the hydrocarbon
enthalpy calculation, enthalpy set bad.92 The enthalpy correction iteration failed to converge in the hydrocarbon enthalpy
calculation, enthalpy set bad1 - 4 An error occurred in the Press_PC function. Details of the error can be found by looking
up the resulting error code in the function.5 - 8 An error occurred in the Temp_PC function. Details of the error can be found by looking
up the resulting error code in the function.79 - 82 An error occurred in the Mol_WT function. Details of the error can be found by looking
up the resulting error code in the function.
Section 3 - Utility Functions3.13 Enthalpy of Steam (Enth_Stm)
5/01 Profit Toolkit Functions Reference 59
Honeywell Inc.
3.13 Enthalpy of Steam (Enth_Stm)In this Section This function calculates the enthalpy of steam. The calculation is based on the
temperature and pressure. The function uses the temperature and pressure tocalculate the enthalpy.
Enth_Stm(Temperature, Pressure, Local_Press, Sat_Temp, Sat_Enth,enth_stm)
DetailedDescription
Step # Description1. Convert gauge pressure in psi to absolute pressure in atmospheres
Psia = Pressure + Local_Press
Also calculate pressure in atmospheres:
patm = psia / 14.6962. Calculate the saturated steam temperature and the saturated steam enthalpy
Sat_Temp = ƒ (psia)
Sat_Enth = ƒ (psia)3. ‘ Check if the temperature is greater than the saturation temperature.
If so, calculate the super heated steam enthalpy.
Otherwise the enthalpy equals the saturated enthalpy.
if (Temperature > Sat_Temp)
enth_stm = ƒ(Temperature, patm)
else
enth_stm = Sat_Enth
Input Table Input TableInput Entry only Req’d if Eng. Units DescriptionTemperature Toolkit Units -Deg F TemperaturePressure Toolkit Units -psig. Pressure.Local_Press psi The local atmospheric
pressure
Section 3 - Utility Functions3.13 Enthalpy of Steam (Enth_Stm)
60 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
Output Table Output Table
Output Eng. Units DescriptionRet_Status Function return status. See Return Status Table below for
details.Sat_Temp Toolkit units Deg F The returned saturated temperature
If the function returns with a status > 0, then Sat_Temp isset bad.
Sat_Enth Toolkit units MBTU/lb The returned saturated enthalpyIf the function returns with a status > 0, then Sat_Enth is setbad.
enth_stm Toolkit units MBTU/lb The true steam enthalpyEnth_stm equals Sat_Enth unless the steam issuperheated.If the function returns with a status > 0, then enth_stm is setbad.
Return StatusTable
Return Status Table
Statusvalue
Description
0 No error occurred93 The Temperature input is a bad value94 The Pressure input is a bad value95 The Local Pressure input is a bad value96 The absolute pressure (Pressure + Local pressure) is out of range (less than 1)97 The temperature is out of range (less than or equal to zero Kelvin)
Section 3 - Utility Functions3.14 Flow Correction/Compensation (Flow_Corr)
5/01 Profit Toolkit Functions Reference 61
Honeywell Inc.
3.14 Flow Correction/Compensation (Flow_Corr)In this Section This function compensates a flow measurement for variations in temperature,
absolute pressure, specific gravity, or molecular weight. The measured flow canbe that of a liquid, gas, vapor or steam.
The function takes the process flow, process temperature, process pressure,process specific gravity, the Watson K factor and reference values as inputs andreturns the corrected flow in user specified units. For steam, steam quality inputsare also required.
Ret_Status = Flow_Corr(int Correction_Type, Flow, Temperature,Ref_Temperature, Abs_Temp, Temp_Conv_Fact, Pressure, Ref_Pressure,Abs_Press, Grav_or_Molwt, Ref_Grav_or_Molwt, Grav_Conv_Fact,Steam_Compress,Ref_Steam_Compress, Steam_Quality, Ref_Steam_Quality,WatK, F_Fact, comp_fact, flow_corr)
DetailedDescription
The following table shows the algorithm in correcting a flow measurement:
Step # Description1. The input Gravity is corrected using Corr_Grav utility function if the Correction_Type is
set to 1.2. The compensation factor is calculated based on the Correction_Type entered. The
equations are listed below.3. The compensated flow is calculated based on the following equation:
flow_corr = Flow * F_Fact* comp_fact
I EngineeringUnits
The flow value is provided in meter units.
The reference values - Ref_Temperature, Ref_Pressure, Ref_Grav_or_Molwt beprovided in Meter Units. The Temperature, Pressure, Grav_or_Molwt are to beprovided in Toolkit Units. The toolkit units can be furnished by the appropriateProcess routine.
Correction Typeof 1 (Massvolumetric-flowcompensation ofliquids)
Primarily used for mass-flow or volumetric-flow compensation of liquids.
The compensation term is calculated as:
Comp_fact = r_MolwtRef_Grav_o
lwt Grav_or_Mo
User should supply Gravity and Reference Gravity for this correction type. Priorto calculating the compensation factor, the gravity itself is corrected via theCorr_Grav utility function that requires temperature and Watson K as inputs.
The reference gravity or molecular weight should be in the same units as thegravity or molecular weight.
Section 3 - Utility Functions3.14 Flow Correction/Compensation (Flow_Corr)
62 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
Correction Typeof 2 (Mass-flowcompensation ofgas or vapor)
Primarily used for mass-flow compensation of gas or vapor flows. Use thisequation when gravity and reference gravity are unavailable.
The compensation term is calculated as:
Comp_fact =
+
+Abs_Temp eTemperatur
atureRef_Temper
reRef_Pressu
Abs_Press Pressure
Correction Typeof 3 (mass-flowcompensation ofgas or vapor)
Primarily used for mass-flow compensation of gas or vapor flows.
The compensation term is calculated as: Comp_fact =
+
+r_MolwtRef_Grav_o
lwt Grav_or_MoAbs_Temp eTemperatur
atureRef_TemperreRef_Pressu
Abs_Press Pressure
The reference pressure should be in the same units as the pressure.
The reference temperature should be in the same units as the temperature.
User should supply Gravity and Reference Gravity (not molecular weight) forthis correction type.
Correction Typeof 4 (Volumetric-flowcompensation ofgas or vapor)
Primarily used for volumetric-flow compensation of gas or vapor flows.
The compensation term is calculated as: comp_fact =
+
+r_MolwtRef_Grav_o
lwt Grav_or_MoAbs_Temp eTemperatur
atureRef_TemperreRef_Pressu
Abs_Press Pressure
The reference pressure should be in the same units as the pressure.
The reference temperature should be in the same units as the temperature.
User should supply Molecular Weight and Reference Molecular Weight (notgravity) for this correction type.
Correction Typeof 5 (Mass-flowcompensation ofsteams)
Primarily used for mass-flow compensation of steams.
The compensation term is calculated as: comp_fact =
+
+itySteam_Qual
QualityRef_Steam_
CompressRef_Steam_
ressSteam_Comp
Abs_Temp eTemperatur
atureRef_Temper
reRef_Pressu
Abs_Press Pressure
Section 3 - Utility Functions3.14 Flow Correction/Compensation (Flow_Corr)
5/01 Profit Toolkit Functions Reference 63
Honeywell Inc.
Input Table Input TableInput Entry only Req’d if Eng. Units DescriptionCorrection_Type
Indicates the correction type required:1 = For Liquid streams2 = For Gas or Vapor streams (withoutgravity compensation)3 = For Gas or Vapor streams (includesa gravity compensation term)4 = For Gas or Vapor streams (includesa molecular weight compensation term)5 = For Steam streams
Flow Meter units Process flowTemperature Toolkit units
Deg FTemperature (required for all CorrectionTypes)
Ref_Temperature
Correction Type =2, 3, 4 or 5
Meter units Reference temperature
Abs_Temp Correction Type =2, 3, 4 or 5
User units Abs_Temp is the absolute zerotemperature (459.67 for DegF or 273.15for Deg C)
Temp_Conv_Fact
Correction Type =2, 3, 4 or 5
Meter temperature units (0 = Deg F, 1 =Deg C)
Pressure Correction Type =2, 3, 4 or 5
Toolkit unitsPsig
Pressure (only required Correction Type= 2, 3, 4 or 5).
Ref_Pressure Correction Type =2, 3, 4 or 5
Meter units Reference pressure
Abs_Press Correction Type =2, 3, 4 or 5
Meter units Abs_Press is the ambient pressure insame units as pressure.• if input pressure is measured as
absolute (eg. psiA) then setAbs_Press = 0.
• if input pressure is measured asrelative (eg. psiG) then setAbs_Press based on the elevationof the pressure sensor.
At sea level Abs_Press = 14.696 psia or101.325kPa.
Press_Conv_Fact
Correction Type =2, 3, 4 or 5
Conversion factor to convert from Meterpressure units to toolkit units.
Grav_or_Molwt Correction Type =1, 3 or 4
Toolkit unitsSpgr@60DegF/60DegF (ifGravity)
Gravity or molecular weight (supplygravity for Correction Type = 1 or 3,supply molecular weight for CorrectionType = 4, not required for CorrectionType = 5)
Ref_Grav_or_Molwt
Correction Type =1, 3 or 4
Meter units Reference gravity or molecular weight.Note that this should coincide withGrav_or_Molwt input (supply referencegravity for Correction Type = 1 or 3,supply meter units reference molecularweight for Correction Type = 4, notrequired for Correction Type = 5)
Section 3 - Utility Functions3.14 Flow Correction/Compensation (Flow_Corr)
64 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
Input TableInput Entry only Req’d if Eng. Units DescriptionGrav_Conv_Fact
Correction Type = 1 Flag indicating the gravity meter units (0= specific gravity; 1 = API)
Steam_Compress
Correction Type = 5 Steam compressibility factor.
Ref_Steam_Compress
Correction Type = 5 Reference steam compressibility.
Steam_Quality Correction Type = 5 Steam quality.Ref_Steam_Quality
Correction Type = 5 Reference steam quality.
WatK Correction Type = 1 Watson K is the characterization factor.
F_Fact F_Fact is the uncompensated flow term;or the square rooted differentialpressure. If a bad value is input forF_Fact then it defaults to 1.0.
Output Table Output TableOutput Eng. Units DescriptionRet_Status Function return status. See Return Status Table below for details.comp_fact Flow compensation factor.
This is the calculated multiplier that corrects the flow.If any input (except the flow input) are bad then a compensationfactor of 1.0 is used.
flow_corr User units Corrected flow value
The only time this function returns with a bad value is when theinput flow value is bad.
When other inputs are bad, then a compensation factor of 1.0 isused, and the corrected flow equals the input flow and a warningmessage is issued.
Section 3 - Utility Functions3.14 Flow Correction/Compensation (Flow_Corr)
5/01 Profit Toolkit Functions Reference 65
Honeywell Inc.
Return StatusTable
Return Status Table
StatusValue
Description
0 No error occurred16 The process flow input is a bad value17 The correction type is a bad value18 The correction type is out of range (below 1 or above 5)19 The process gravity or molecular weight is a bad value20 The process gravity or molecular weight is out of range (less than or equal to zero)21 The reference gravity or molecular weight is a bad value22 The reference gravity or molecular weight is out of range (less than or equal to zero)23 The process Temperature input is a bad value24 The reference temperature input is a bad value25 The absolute temperature input is a bad value26 The process pressure input is a bad value27 The reference pressure input is a bad value28 The absolute pressure input is a bad value29 The reference pressure is out of range (less than or equal to zero)30 The pressure conversion factor is out of range (negligible or less than or equal to
zero)31 The absolute temperature is out of range (less than or equal to zero)32 The steam quality input is a bad value33 The steam compressibility input is a bad value34 The reference steam quality input is a bad value35 The reference steam compressibility input is a bad value36 The steam quality input is out of range (less that or equal to zero)37 The reference steam compressibility input is out of range (less than or equal to zero)38 The calculated compensation factor is less than zero39 The F_Fact is a bad value40 The F_Fact is zero
9 - 15 An error occurred in the Corr_Grav function. Details of the error can be found bylooking up the resulting status value in the Utility Functions section.
Section 3 - Utility Functions3.15 Filter - First Order Lag (Filter_First_Ord_Lag)
66 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
3.15 Filter - First Order Lag (Filter_First_Ord_Lag)In this Section This function calculates a first order lag filter. The calculation is based on a
forward shifted first order digital filter. The function takes the input value, filtersit and returns it in original units.
Ret_Status = Filter_First_Ord_Lag(int Application_Init, Current, Old, Etime,Ftime, filter_first_ord_lag)
DetailedDescription
The following table shows the algorithm in filtering a value using a first order lagfilter:
Step # Description1 If the filter function is in initialization then:
Filter_first_ord_lag = Current2 If the filter function is not in initialization then the filtered value is calculated based on the
following equation:Filter_first_ord_lag = Current * (1.0 – e (-Etime / Ftime)) + Old * e (-Etime / Ftime))
3 The current filtered value is saved in parameter Old for the next pass:Old = Filter_first_ord_lag
Input Table Input TableInput Entry only
Req’d ifEng.Units
Description
Application_Init Initialization flag.0=don’t initialize, filtering in effect.1=initialize, initializing forces the old value to beset to the current value.
Current The current value to be filtered.Old Old is the pervious filtered value.
Etime minutes The execution timeFtime minutes The filter time
Output Table Output Table
Output Eng. Units DescriptionRet_Status Function return status. See Return Status Table below for
details.filter_first_ord_lag
The calculated filtered value.
If the function returns with a status > 0, then filter_first_ord_lagis set bad.If First is set, then filter_first_ord_lag is set equal to the Currentvalue.
Section 3 - Utility Functions3.15 Filter - First Order Lag (Filter_First_Ord_Lag)
5/01 Profit Toolkit Functions Reference 67
Honeywell Inc.
Return StatusTable
Return Status Table
Statusvalue
Description
0 No error occurred41 The input value is a bad value42 The execution time is a bad value43 The filter time is a bad value44 The application initialization flag is a bad value45 The execution time is less than zero46 The filter time is less than zero
Section 3 - Utility Functions3.16 Filter - First Order Lag with Deadtime (Filter_First_Ord_Lag_Deadtime)
68 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
3.16 Filter - First Order Lag with Deadtime(Filter_First_Ord_Lag_Deadtime)In this Section This function calculates a first order lag filter with deadtime. The calculation is
based on a forward shifted first order digital filter. The function takes the inputvalue, filters it and returns it in original units.
Ret_Status = Filter_First_Ord_Lag_Deadtime(int Application_Init, Current,Old, Etime, Ftime, filter_first_ord_lag)
DetailedDescription
The following table shows the algorithm in filtering a value using a first order lagfilter:
Step # Description1 If the filter function is in initialization then initialize the array of saved values
Old[j] = Current2 The filtered value is determined based on the deadtime
idx = Deadtime / Etimefilter_first_ord_lag_deadtime = old[idx]
3 Call the filter_first_ord_lag function4 Update the old array
Input Table Input TableInput[ ] denotes array
Entry onlyReq’d if
Eng.Units
Description
Application_Init Initialization flag.0=don’t initialize, filtering in effect.1=initialize, initializing forces the old value to beset to the current value.
Current The current value to be filtered.Max_Deadtime Maximum deadtime – number of values to save
for filter.Set this equal to maximum dead time of processdivided by execution time – then add one.e.g.If Maximum deadtime = 30 Minutes and executiontime(Etime) = 0.5 minutes thenFilter_Shift_Num = 30/0.5+1 = 61.
Old[ ] Array of saved values.Etime minutes The execution timeFtime minutes The filter time
Section 3 - Utility Functions3.16 Filter - First Order Lag with Deadtime (Filter_First_Ord_Lag_Deadtime)
5/01 Profit Toolkit Functions Reference 69
Honeywell Inc.
Output Table Output TableOutput Eng. Units DescriptionRet_Status Function return status. See Return Status Table below for
details.filter_first_ord_lag
The calculated filtered value.
If the function returns with a status > 0, then filter_first_ord_lagis set bad.If First is set, then filter_first_ord_lag is set equal to the Currentvalue.
Return StatusTable
Return Status Table
Statusvalue
Description
0 No error occurred47 The execution time is a bad value48 The filter time is a bad value49 The application initialization flag is a bad value50 The execution time is less than or equal to zero51 The filter time is less than zero52 The maximum deadtime is less than or equal to zero53 The deadtime is less than zero54 The maximum deadtime is must be greater than deadtime
This means that there was not enough storage allocated (Filter_Shift_Num) to store forthe deadtime specified.
Section 3 - Utility Functions3.17 Filter – General Purpose (Filter)
70 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
3.17 Filter – General Purpose (Filter)In this Section This function processes all necessary filtering. The function calls the desired
filter type based on the specified filter type. The function returns the filteredvalue in original units. The filtered value is also saved for subsequent executionswhere it will be used as the previous value.
Filtering is applied to reduce noise and to ramp a value from its previous value toits current value as smoothly as possible. Currently the filter types available are afirst order lag filter and a first order lag filter with deadtime. This is invoked byselecting a filter type of 1 or 2 (several additional parameters also have to befilled in).
Other filter types will be available in the future. If filtering is not required for aspecific function, then a filter type of 0 should be selected.
Ret_Status = Filter(int Application_Init, Input_Value, Filter_Type,Filter_Coeff_Num, Filter_Coeff[ ], Filter_Shift_Num, Filter_Shift[ ], Etime,filter)
DetailedDescription
The following table shows the algorithm in filtering a value using the generalpurpose filter function:
Step # Description1 If filter type is zero then just exit:2 Return an error message if the filter type out of range.3 Return an error message if the filter type is not supported yet.4 Call the appropriate Filter function based on the filter type. Setup the input arguments to
the function based on the tables below:
If Filter_Type = 1 then Filter = Filter_First_Ord_Lag(Application_Init, Input_ValueFilter_Shift[0], Etime, Filter_Coeff[0])
Filter Type of 1(First Order LagFilter)
A first order lag filter is set up as follows:
For the first order lag filter, in order to filter from a previous value to the currentvalue, it is required to store the previous value. When the user sets up a function,a storage parameter for the previous value is automatically created. The user doesnot need to manipulate this parameter, but should be aware of its existence. Thisparameter is an array named Filter_Shift.
Section 3 - Utility Functions3.17 Filter – General Purpose (Filter)
5/01 Profit Toolkit Functions Reference 71
Honeywell Inc.
Input Table Input TableInput[ ] denotes array
EntryonlyReq’d if
Eng. Units Description
Application_Init Initialization flag. (0=don’t initialize, 1=initialize)Filter_Type The type of filter to be applied.
0= None
1 = First order lag
2 = First order lag with deadtime
Input_Value The value to be filtered
Filter_Coeff_Num The number of Filter Coefficients (size ofFilter_Coeff array)
Filter_Coeff[ ] An array of coefficients for the filter
If Filter Type = 1,
Filter_Coeff[1] = Filter Time
If Filter Type = 2,
Filter_Coeff[1] = Filter Time
Filter_Coeff[2] = Filter DeadTime
Filter_Shift_Num Number of values to save for filter.
For filter type = 1, set this value equal to 1.
For filter type = 2,Set this equal to maximum dead time of processdivided by the execution time – then add one.
e.g.If Maximum deadtime = 30 Minutes andexecution time(Etime) = 0.5 minutes thenFilter_Shift_Num = 30/0.5+1 = 61.
Important Note: The user should ensure thatFilter_Shift_Num is set large enough toaccommodate the longest anticipated deadtime.If Filter_Shift_Num is set too small the user willhave to reconfigure the Dynamic Compensationfunction.
Filter_Shift[ ] A storage array for previous filtered values
Etime Minutes The applications execution time
Section 3 - Utility Functions3.17 Filter – General Purpose (Filter)
72 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
Output Table Output TableOutput[ ] denotes array
Eng.Units
Description
Ret_Status Function return status. See Return Status Table below for details.
Filter_Shift[ ] A storage array for previous filtered valuesFilter The calculated filtered value.
Return StatusTable
Return Status Table
Statusvalue
Description
0 No error occurred
55 A warning that the filter type specified is out of range. Filter Type must be 0 or 1, 2, 3, 4or 5.
56 For Filter type 1, Filter_Coeff_Num must be greater than or equal to 1.
57 For Filter type 1, Filter_Shift_Num must be greater than or equal to 1.
58 For Filter type 2, Filter_Coeff_Num must be greater than or equal to 2.
59 For Filter type 2, Filter_Shift_Num must be greater than 1.
60 Filter type 3 through 5 is specified and not supported at this time.
Section 3 - Utility Functions3.18 Last Good Value Holding (Last_Good_Value)
5/01 Profit Toolkit Functions Reference 73
Honeywell Inc.
3.18 Last Good Value Holding (Last_Good_Value)In this Section This function processes last good value logic. The function allows the user to
hold on to the last good calculated value for a specified number of executions.Based on the input value and the current value status, the function determines ifthe value is bad, and whether the last good value count has been exceeded. Ifexceeded a bad value is returned, otherwise the last good value is returned.
Last_Good_Value(int Application_Init, Input_Value_Num, float* Input_Value,Status, LGV_Num, int& LGV_Count, float* last_good_value)
To invoke last good value holding enter a positive value in the number ofintervals to hold the value (LGV_Num). The user can turn off last good valueholding by setting LGV_Num to 0, or alternately if the user requires the lastgood value held for an infinite period the user can set LGV_Num to a negativevalue.
Storage parameters for last good value holding are required. This storage is in theparameter named LGV_Values.
When an array of input values is passed into the routine, the status of the firstvalue in the array is checked. If last good value holding is in effect, the last goodvalue of the whole array are returned, even though only the first element failedthe last good value check.
Example: Input:Application_Init = 0Input_Value_Num = 2Input_Value[0] = temp.pvInput_Value[1] = press.pvLGV_Values[0] = 200.0LGV_Values[1] = 40.0Temp.pv = NaNPress.pv = 50.0
Output:In this case temp.pv is bad, thus last good valueholding is in effect. The returnedlast_good_value(s) are taken fromLGV_Values which is where the last goodvalues are stored.
last_good_value[0] = 200.0last_good_value[1] = 40.0
Input:Application_Init = 0Input_Value_Num = 2Input_Value[0] = temp.pvInput_Value[1] = press.pvLGV_Values[0] = 200.0LGV_Values[1] = 50.0Temp.pv = 300.0Press.pv = NaN
Output:In this case temp.pv is good and press.pv isbad, so last good value holding does not takeeffect (last good value holding is based on thestatus of the first array element –Input_Value[0]). The returnedlast_good_value(s) are taken from Input_Valuearray.
last_good_value[0] = 300.0last_good_value[1] = NaN
Section 3 - Utility Functions3.18 Last Good Value Holding (Last_Good_Value)
74 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
Input Table Input TableInput Entry only
Req’d ifEng.Units
Description
Application_Init Flag that indicates the initialization requirements.0 = don’t initialize,1=initialize.
Input_Value_Num The number of Input Values to be processed.Input_Value[ ] An array of values to be processed.
Important Note: The status of the first element in thearray determines the fate of the rest of the elements. Ifit is bad, then all the elements in the array are treatedas bad.
Status The status value from the previous function.LGV_Num The number of intervals to hold the last good value.
If LGV_Num is set to a positive value, this indicates thenumber of intervals the last good value will be held.If LGV_Num is set to zero, then last good valueprocessing is turned off.If LGV_Num is set to a negative value, then the lastgood value will be held indefinitely.
Output Table Output TableOutput [ ] denotes array
Eng.Units
Description
Ret_Status Function return status. See Return Status Table below for details.LGV_Count Counter indicating the number of intervals the last good value has
been held. This value is incremented when the last good value isbeing held.
LGV_Values[ ] Last good value storage array.last_good_value An array of last good values corresponding to the Input Values array.
• If Input_Value(0) is bad and LGV_Count has not exceeded themaximum number of intervals to hold the last good value, thenthe output last good value is set to the last good value.
• If Input_Value(0) is bad and LGV_Count has exceeded themaximum number of intervals to hold the last good value, thenthe output last good value is set to bad.
• If initializing, then the output last good value is set to the inputlast good value.
Return StatusTable
Return Status Table
StatusValue
Description
61 The Number of Input Values is less than or equal to zero.62 Holding the last good value
-ve Status If the input Status is negated, this is a warning that the last good value is being used.Status If the input Status is unchanged, no error occurred.
Section 3 - Utility Functions3.19 Molecular Weight (Mol_WT)
5/01 Profit Toolkit Functions Reference 75
Honeywell Inc.
3.19 Molecular Weight (Mol_WT)In this Section This function calculates the molecular weight of a petroleum fraction. The
calculation is based on the gravity and the Watson K factor. The function usesthe specific gravity and the Watson K to calculate the molecular weight.
Ret_Status = Mol_WT(Gravity, WatK, mol_wt)
DetailedDescription
The following table shows the algorithm in calculating the molecular weight:
Step # Description1. The molecular weight is calculated by first calculating the Mean Average Boiling Point
(MeABP).
MeABP = ƒ(Gravity, WatK)2. The molecular weight is calculated based on API Technical Data Book Procedure
2B2.1:
Mol_WT = ƒ(MeAPB, Gravity)
Input Table Input TableInput Entry only
Req’d ifEng. Units Description
Gravity Toolkit Units - 60 DegF/60 Deg F
Specific Gravity
WatK Watson K is the characterizationfactor
Output Table Output TableOutput Eng. Units DescriptionRet_Status Function return status. See Return Status Table below for details.Mol_wt Calculated molecular weight.
If the function returns with a status > 0, then mol_wt is set bad.
Return StatusTable
Return Status Table
Statusvalue
Description
0 No error occurred79 The Gravity input is a bad value80 The Watson K input is a bad value81 The Gravity input is out of range (less than or equal to zero)82 The Watson K input is out of range (less than or equal to zero)
Section 3 - Utility Functions3.20 Pseudo Critical Pressure (Press_PC)
76 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
3.20 Pseudo Critical Pressure (Press_PC)In this Section This function calculates the pseudo critical pressure of a light petroleum fraction.
The function takes the specific gravity at 60 Deg F and the Watson K factor asinputs and returns the results in psia units.
Ret_Status = Press_PC(Gravity, WatK, press_pc)
DetailedDescription
The following table shows the algorithm in calculating the pseudo criticalpressure
Step # Description1. The pseudo critical pressure is calculated by first calculating the Mean Average
Boiling Point (MeABP).
MeABP = ƒ(Gravity, WatK)
2. The pseudo critical pressure is calculated based on API Technical Data BookProcedure 4D4.1.
Press_PC = ƒ(MeAPB, Gravity)
Input Table Input TableInput Entry only
Req’d ifEng. Units Description
Gravity Toolkit Units - 60 DegF/60 Deg F
Specific Gravity
Watson K Watson K is the characterizationfactor
Output Table Output TableOutput Eng. Units DescriptionRet_Status Function return status. See Return Status Table below.press_pc psia Pseudo critical pressure.
If the function returns with a status > 0, then press_pc is set bad.
Return StatusTable
Return Status Table
Statusvalue
Description
0 No error occurred1 The specific gravity input is a bad value2 The specific gravity is out of range (less than 0.5 or greater than 1.2)3 The Watson K input is a bad value4 The Watson K factor is out of range (less than 5 or greater than 18)
Section 3 - Utility Functions3.21 Pseudo Critical Temperature (Temp_PC)
5/01 Profit Toolkit Functions Reference 77
Honeywell Inc.
3.21 Pseudo Critical Temperature (Temp_PC)In this Section This function calculates the pseudo critical temperature of a light petroleum
fraction. The function takes the specific gravity at 60 Deg F and the Watson Kfactor as inputs and returns the results in Deg F units.
Ret_Status = Temp_PC(Gravity, WatK, temp_pc)
DetailedDescription
The following table shows the algorithm in calculating the pseudo criticaltemperature:
Step # Description1. The pseudo critical temperature is calculated by first calculating the Mean Average
Boiling Point (MeABP).MeABP = ƒ(Gravity, WatK)
2. The pseudo critical temperature is calculated based on API Technical Data BookProcedure 4D4.1.Temp_PC = ƒ(MeAPB, Gravity)
Input Table Input TableInput Entry only
Req’d ifEng. Units Description
Gravity Toolkit Units - 60 DegF/60 Deg F
Specific Gravity
Watson K Watson K is the characterization factor
Output Table Output TableOutput Eng. Units DescriptionRet_Status Function return status. See Return Status Table below.temp_pc Toolkit units
Deg FPseudo critical temperature.If the function returns with a status > 0, then temp_pc is set bad.
Return StatusTable
Return Status Table
Statusvalue
Description
0 No error occurred5 The specific gravity input is a bad value6 The specific gravity is out of range (less than 0.5 or greater than 1.2)7 The Watson K input is a bad value8 The Watson K factor is out of range (less than 5 or greater than 18)
Section 3 - Utility Functions3.22 Watson K Calculation Based on Mean Average Boiling Point (WatK_MABP)
78 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
3.22 Watson K Calculation Based on Mean Average BoilingPoint (WatK_MABP)In this Section This function calculates the Watson K factor. The calculation is based on the
mean average boiling point and the specific gravity. The function takes theASTM D86 10% point, the ASTM D86 50% point, the ASTM D86 90% point,calculates the mean average boiling point, and then uses the mean averageboiling point in conjunction with the specific gravity to calculate the Watson Kfactor.
Ret_Status = WatK_MABP(D86_10, D86_50, D86_90, Gravity, MABP_Bias,watk_mabp)
DetailedDescription
The following table shows the algorithm in calculating the Watson K via themean average boiling point:
Step # Description1. The Watson K factor is calculated by first calculating the Volumetric Average Boiling
Point (VABP).VABP = ƒ(D86_10, D86_50, D86_90)
2. Then the slope is calculated as:SLOPE = (D86_90 - D86_10) / (90 – 10)
3. Then the mean average boiling point (MeABP) is calculated based on API TechnicalData Book Procedure 2B2.1-4 and 2B2.1-8. Following this the MeABP is biased.MeABP = ƒ(VABP, SLOPE) + MABP_Bias
4. Then the Watson K factor is calculated:watk_mabp = ƒ (MeABP, Gravity)
Input Table Input TableInput Entry only
Req’d ifEng. Units Description
D86_10 Toolkit Units -Deg F The ASTM D86 10% point
D86_50 Toolkit Units -Deg F The ASTM D86 50% point
D86_90 Toolkit Units -Deg F The ASTM D86 90% point
Gravity Toolkit Units - 60 Deg F/60Deg F
The specific gravity 60 F/60 F
MABP_Bias Toolkit Units -Deg F The mean average boiling point bias
Output Table Output TableOutput Eng. Units DescriptionRet_Status Function return status. See Return Status Table below for details.watk_mabp The calculated Watson K characterization factor.
If the function returns with a status > 0, then watk_mabp is setbad.
Section 3 - Utility Functions3.22 Watson K Calculation Based on Mean Average Boiling Point (WatK_MABP)
5/01 Profit Toolkit Functions Reference 79
Honeywell Inc.
Return StatusTable
Return Status Table
Statusvalue
Description
0 No error occurred63 The ASTM D86 10% point input is a bad value
64 The ASTM D86 50% point input is a bad value
65 The ASTM D86 90% point input is a bad value66 The Gravity input is a bad value
67 The mean average boiling point bias input is a bad value
68 The Gravity input is out of range (less than 0.5 or greater than 1.2)
69 The ASTM D86 10% point input is less than the ASTM D86 50% point input.70 The ASTM D86 50% point input is less than the ASTM D86 90% point input.
Section 3 - Utility Functions3.23 Watson K Calculation Based on Viscosity (WatK_Visc)
80 Profit Toolkit Functions Reference 5/01
Honeywell Inc.
3.23 Watson K Calculation Based on Viscosity (WatK_Visc)In this Section This function calculates the Watson K factor. The calculation is based on the
viscosity and the specific gravity. The function uses the viscosity and the specificgravity to calculate the Watson K factor.
Ret_Status = WatK_Visc(Gravity, Viscosity, Iterations, Tolerance, fn_watk, watk_visc)
DetailedDescription
The following table shows the algorithm in calculating the Watson K via theviscosity
Step # Description1. The Newton-Raphson technique is utilized to back-calculate the Watson K factor. This
technique is required since the API function provided shows viscosity calculated as afunction of Gravity and the Watson K factor:
Viscosity = ƒ(Gravity, Watson K)
Input Table Input TableInput Entry only
Req’d ifEng. Units Description
Gravity Toolkit Units - 60 Deg F/60 Deg F
Specific Gravity
Viscosity centistokes Viscosity in centistokes at 210 Deg FIterations The maximum iterations allowed.
If a bad value is input for Iterations then itdefaults to 150
Tolerance The Newton Raphson conversion tolerance.If a bad value is input for Tolerance then itdefaults to 0.05
Output Table Output TableOutput Eng. Units DescriptionRet_Status Function return status. See Return Status Table below for details.fn_watk input - the Watson K factor used as a starting point for the iteration
calculation.If bad value is input for fn_watk then a Watson K factor of 11 is usedas a starting point for the iteration calculationoutput – the value of the Watson K factor when the iteration stopped.• If the Watson K factor converged before the iteration limit then
this value is the calculated Watson K factor.• If the Watson K factor did not converge then this value is the
calculated Watson K factor after the final iteration.watk_visc The calculated Watson K factor.
If the function returns with a status > 0, then watk_visc is set bad.This includes the case where the Watson K calculation does notconverge.
Section 3 - Utility Functions3.23 Watson K Calculation Based on Viscosity (WatK_Visc)
5/01 Profit Toolkit Functions Reference 81
Honeywell Inc.
Return StatusTable
Return Status Table
Statusvalue
Description
0 No error occurred71 The Gravity input is a bad value72 The Viscosity input is a bad value73 The Gravity input is out of range (less than 0.5 or greater than 1.2)74 The Viscosity input is out of range (less than zero or greater than 1.0E06)75 The Iterations input is out of range (less than or equal to zero)76 The Tolerance input is out of range (less than zero)77 The Iterations input is greater than 10000, the calculation proceeds normally with the
calculation using 10000 as the maximum number of iterations.78 The calculated Watson K factor did not converge within the specified maximum number
of iterations.
Section 3 - Utility Functions3.23 Watson K Calculation Based on Viscosity (WatK_Visc)
82 Profit Toolkit Functions Reference 5/01
Honeywell Inc.