Professional Documents
Culture Documents
Multiflash Excel Interface
Multiflash Excel Interface
Version 4.4
February 2014
This User Guide and the information contained within is the copyright of Infochem Computer Services Ltd.
Disclaimer
While every effort has been made to ensure that the information contained in this document is correct and that the
software and data to which it relates are free from errors, no guarantee is given or implied as to their correctness or
accuracy. Neither Infochem Computer Services Ltd nor any of its employees, contractors or agents shall be liable for
direct, indirect or consequential losses, damages, costs, expenses, claims or fee of any kind resulting from any
deficiency, defect or error in this document, the software or the data.
Contents
Installation
Introduction ............................................................................................................................... 1
Hardware requirements.............................................................................................................. 1
Installing the Multiflash program .............................................................................................. 1
Installing the RLM software security system ............................................................................ 1
Installing the software protection device ................................................................................... 2
Environment variables ............................................................................................................... 2
Databank path ............................................................................................................................ 2
Installing the Multiflash Excel interface.................................................................................... 3
64 bit versions of Excel ............................................................................................... 4
Testing the Multiflash Excel Interface....................................................................................... 4
Removing Multiflash from your computer ................................................................................ 5
Getting technical support ........................................................................................................... 6
Introduction ............................................................................................................................... 7
New features .............................................................................................................................. 7
64 bit Excel.................................................................................................................. 7
General information
15
Interface specification
25
Contents iii
iv Contents
Contents v
Troubleshooting
55
Evidence of errors.................................................................................................................... 55
Dealing with Multiflash errors................................................................................................. 55
Error #N/A................................................................................................................. 56
Error #NUM!............................................................................................................. 56
Error #VALUE!......................................................................................................... 58
Error #NULL!............................................................................................................ 59
Other problems .......................................................................................................... 59
The command include............................................................................................. 60
61
Introduction ............................................................................................................................. 61
Pure component properties in a mixture .................................................................................. 61
Constant physical properties of a pure component or petroleum fraction................................ 62
Temperature-dependent correlation coefficients of a pure component or petroleum
fraction..................................................................................................................................... 62
Temperature-dependent property of a pure component or petroleum fraction ........................ 63
Help
65
Introduction ............................................................................................................................. 65
On-line help ............................................................................................................................. 65
Technical support..................................................................................................................... 67
Examples
69
Index
vi Contents
87
Installation
Introduction
This chapter contains information that will help you install and run Multiflash
with Excel on a Windows system. The 32 bit version of Multiflash will run
under Windows XP (or more recent versions) with Excel 97, Excel 2000, Excel
2003, Excel 2007 & Excel 2010. To run Multiflash under Windows you must
install a Multiflash license server with a valid Multiflash license or a Sentinel
Software Protection driver and server for the security device. For further details,
see the Multiflash installation guide.
Hardware requirements
The minimum requirement to run Multiflash is a PC capable of running
Windows XP (or more recent versions). A parallel or USB port is required if the
Multiflash license is controlled by a security key.
The program itself and associated files require about 28 Mb of disk storage. Up
to 6 Mb of shared system files may be installed depending on which files are
already present on your computer.
Installation 1
The RLM server is installed by default but can be de-selected when the custom
installation option is selected during the installation. The Multiflash license
manager is always installed with Multiflash. More information on how to run
and use the program is described in the section RLM license system installation
and management on page 17 of the Multiflash Installation guide.
Environment variables
The variables NSP_HOST and NSP_TIMEOUT can be used to control the
operation of the USB licensing system. They are described in the sections
Network license server location and the Timeout of licenses on the Installation
Guide for Multiflash for Windows 4.4.
Databank path
Multiflash needs to use a number of data files which are listed below:
Infodata.bin
Infodata.idx
Mflash.msg
Mflash.mix
Mflash.err
Mflash.eix
Dippr.bin
Dippr.idx
Infobips.bin
infobips.idx
Infollbips.bin
infollbips.idx
These files are normally installed in the same directory as the Multiflash
program. The Tools/Preferences/Folders menu option in the Multiflash GUI can
be used to change to contain location if you move these files.
2 Installation
Excel 2003
Excel 2010
The Multiflash version 4.4 32 bit Excel add-in is compatible with versions of
Excel from Excel 97 onwards. The Excel interface files are copied to the
Multiflash installation directory by the setup program if a Typical installation
is selected or if the Excel option is selected in the Custom installation. Note
that although you may copy the Excel interface files from the distribution CDROM the interface will only operate if you have licensed the Excel interface
option.
To install the Multiflash add-in in Excel prior to 2007:
1.
Start Excel.
2.
3.
4.
5.
6.
1.
Start Excel
2.
3.
4.
5.
Click Browse
6.
7.
8.
Installation 3
If you have a previous version of the Multiflash add-in already installed you will
first need to remove it from Excel. This can be done as follows:
1.
2.
3.
Click on the check box next to the Multiflash-Excel XLL addin to remove the tick mark. Click on OK to close the Add-ins
dialog.
4.
5.
Launch Excel
To install the Excel Add-in the 64bit versions of Excel, follow the procedure for
32bit versions listed above and replace mfxl4432.xll with mfxl4464.xll.
4 Installation
1.
2.
3.
4.
5.
6.
7.
1.
2.
Installation 5
Fax:
Email: software@kbcat.com
6 Installation
Introduction
A number of small improvements have been made to the Excel interface. Other
minor changes in the interface concerned the overall behaviour of the Excel addin. For the new features of Multiflash 4.4, please refer to the Multiflash Users
Guide for Windows.
New features
64 bit Excel
The main change in the Excel interface is that it now runs in 64 bit versions of
Excel as well as 32bit versions.
General information
Interfaces provided
The Multiflash Excel interface provides spreadsheet functions that can be used to
configure Multiflash and carry out calculations. The 32bit interface is supported
by an Excel add-in called MFXL4432.XLL, whereas the 64 bit version of the
interface is called MFXL4464.XLL. This add-in, in turn, uses the Multiflash
DLL (MFL4432.DLL or MFL4464.DLL) to perform the physical property
calculations.
Files supplied
The files for the Multiflash-Excel interface are listed in the file FILELIST.TXT
supplied on the Multiflash for Windows CD-ROM.
General information 9
Getting started
To illustrate how to use Multiflash with Excel, a simple example is described.
Prior to MF3.7 the problem to be solved in Excel had to be defined by defining
an initialisation script in a worksheet by calling pre-defined files and/or entering
a series of commands. From MF3.7 the Multiflash for Windows GUI can be
launched directly from the spreadsheet, adding another means of defining the
problem in Excel. This section concentrates on using pre-defined files and
commands, using the GUI is described later, see Defining the problem by
launching the GUI on page 17.
We will assume that the Multiflash files have been placed in the directory
C:\Program Files\Infochem\MF, but if the default directory (C:\Program
Files\Infochem\MF44) is used you need to substitute the actual directory used
for C:\Program Files\Infochem\MF in what follows.
You should have inserted your Multiflash software protection key into the
parallel or USB port of your computer, making sure that a secure connection is
made. You can still use a printer or other device that is usually connected to the
parallel port by plugging it into the back of the key.
You can now create a spreadsheet that uses Multiflash. Open a worksheet and
start by writing a Multiflash initialisation script for your problem. Here is a
simple example to perform flash calculations for a ternary mixture of ethane,
butane and water using the RKS equation of state. Use cells A1-A3 for the
initialisation script. Into cell A1 copy the following:
include c:\Program Files\Infochem\MF\rks.mfl;
This refers to the configuration file provided with the software for setting
Multiflash to use the RKS equation with the Infochem data bank. Note that in
Windows it is important to give a full path name when you refer to a file, as a
Windows program does not recognise the DOS default directory. To use a long
pathname that includes blank characters it should be enclosed in (straight)
quotation marks, e.g.
include c:\Program Files\Infochem\MF\rks.mfl;
Next define the components by copying the standard Multiflash command into
cell A2:
components ethane butane water;
Each component should be referred to by one of its names in the Infochem data
bank. A complete list of names is given in Multiflash for Windows. Each cell
can accept up to 255 characters, so if that is insufficient, you may carry on
adding component names in the next cell in the initialisation script. You must
show which is the last component by following its name with a semi-colon. This
version of Multiflash can accept up to 200 components. Finally you need to
define the units by copying another standard Multiflash command into cell A3:
units amounts kg temperature degC pressure bar
density m3/kg enthalpy kj/kg;
The full range of options can be seen by selecting the units command in
Multiflash for Windows. You can omit the units commands in which case
Multiflash uses its default units for all quantities which are SI.
10 General information
You are now ready to start writing your spreadsheet. As a first example, do a
simple flash at constant pressure and temperature. First put the following text in
the following cells:
cell
A5
A6
A7
A8
A9
A10
A11
A12
C5
C6
C7
F4
G4
H4
I4
text
AMOUNTS
AMOUNTS
AMOUNTS
PHASE
TEMPERATURE
PRESSURE
ENTHALPY
STATUS
1
2
3
OVERALL
GAS
WATER
LIQUID1
General information 11
is used for specifying a stream type and is optional. If the name of a stream type
is given, the returned components belong the stream type specified.
Next copy cell D5 and paste it into cells D6 and D7. You should now have a
column with the names of the three components, ethane, butane and water.
Get the name of the output units for the physical properties by typing in cell C8:
=MF_OU($A8,$A$1:$A$3)
Next copy cell C8 and paste it into cells C9, C10 and C11. You should now have
a column with the names of the units being used, i.e. kg, degC, bar and kJ/kg.
Now set up the feed composition in cells E5, E6 and E7 by entering in 0.5, 0.4
and 0.1 respectively. Set the temperature by typing 30 into cell E9 and the
pressure by typing 20 into cell E10. Now make Excel call a flash at constant
pressure and temperature. Initially type in cell F5:
=MF_PTF(F$4,$A5,$C5,$E$10,$E$9,$E$5:$E$7,$A$1:$A$3)
As with any Excel calculation the use of the $ sign controls how dragging the
function from cell to cell changes the cell reference. A double $ sign, e.g. $E$10,
indicates that the reference will always remain in the cell even if the function is
dragged to other cells. A $ before the row number, F$4, means dragging the
function along a row will change the column letter but not the row number,
whereas the opposite is true if the $ sign makes the column absolute.
Multiflash will immediately do a flash calculation and put the answer into cell
F5. An easy way to write the function into cell F5 is to click on F5 and then start
the Excel function wizard which prompts you for each argument in turn to help
you avoid mistakes. For details on how to use the function wizards see Function
Wizards on page 20.
To get the other physical properties out, click on cell F5, then simply drag the
function definition down and across from F5 to I12.
The values for all the phases and properties requested should now appear on the
spreadsheet. The cells on the STATUS line should be filled the text OK to
indicate that the flash function has worked correctly. If anything else appears, an
error has occurred: see Dealing with Multiflash errors on page 55 if this
happens.
12 General information
Now do an isenthalpic flash to simulate the effect of reducing the pressure of this
fluid through a choke. First copy the following text into the following cells:
cell
L4
M4
N4
O4
text
OVERALL
GAS
WATER
LIQUID1
Also, define a new pressure by typing 1 into cell K10. To make Excel call an
isenthalpic flash, type in cell L5:
=MF_PHF(L$4:O$4,$A5:$A12,$C5:$C7,$K$10,$F$11,
$E$5:$E$7,$A$1:$A$3)
Multiflash will immediately do an isenthalpic flash calculation and put the
answer into cell L5. Again to avoid mistakes you can use the function wizard to
help you define this function.
To get the other physical properties out, click on cell L5 and drag across the
array of cells. Again, the values for all the phases and properties requested
should now appear on the spreadsheet.
You can vary any of the conditions by altering any of the cells E5, E6, E7, E9,
E10 or K10. Whenever you change these, Excel will automatically call
Multiflash to update all the cells provided you have automatic recalculate
switched on. If you have manual recalculate switched on, it will only recalculate
the cells when you press key F9.
You can also request other physical properties by putting the appropriate name
of the physical property in column 1 and then copying a row of the spreadsheet
General information 13
and pasting it onto the new row with the new property name. You can also do
other flashes by setting up other areas with different flash functions etc. A
complete list of the flash functions and their arguments is given in the interface
specification, see Interface specification on page 25.
14 General information
This is the simplest way to transfer the problem definition, but if you wish to
transfer the individual commands, perhaps so that you can change them in the
worksheet, this can be done either by:
Using Open from the Excel File menu and selecting the .mfl file required using
the Text Import Wizard to load the commands.
If you use the Fixed Width option in the Text Import Wizard make sure that all
break lines are deleted by double clicking on them. The contents of the file will
then be written into cells in the worksheet.
Another way of transferring the detailed problem set-up from Multiflash for
Windows is to use the Tools/Show/Problem menu option to write the problem
definition in the Multiflash results window. You can then highlight the definition
and use the Edit copy and paste options to transfer the information from
Multiflash for Windows to Excel. You should choose the Paste special and
Text options in Excel to ensure that each line of the problem definition
occupies one cell.
Alternatively you can write the Multiflash commands directly in the spreadsheet.
To write initialisation scripts, it helps if the user is familiar with the Multiflash
command language which is described in the Multiflash Command Reference
Manual. However, to take a simple example, to flash a mixture of methane,
ethane and propane using the Peng-Robinson equation for gas and liquid phases,
the following commands could be copied onto the spreadsheet:
include c:\Program Files\Infochem\MF\PR.mfl;
components methane ethane propane;
requesting blank cells for a new problem or the cells containing the initialisation
script for an existing script you wish to use as a starting point. You can just enter
a single cell or block several cells in a column. If more cells are needed for the
initialisation script than you have specified these will be allocated automatically.
If you choose to block multiple cells in a row then the initialisation script will be
pasted to the first cell in each column covered, giving multiple copies of the
script.
Clicking on OK will launch the Multiflash GUI
Use of the GUI is described in detail in the User Guide for Multiflash for
Windows. However, as the Multiflash Excel interface is an add-on to the
Multiflash licence most users should already be familiar with the GUI.
The problem is set up in the GUI by defining the model, components and units.
Rather than then saving the problem by writing an mfl file you should then go to
File/Exit, which will trigger the following message.
When you click on Yes you are returned to the spreadsheet and asked to confirm
the cells for the script
This only defines the initialisation script, the calculations require the phase
names, properties etc. to be completed as before but this time the cell reference
for the initialisation script would be cells A1:A5 rather than cells A1:A3.
Which route you use to set up the problem will probably depend on your
familiarity with Multiflash commands and the nature of the problem. For the
simple problem described in Getting started writing the script directly in the
worksheet has many advantages. The script is simple, each section can be
defined in a single cell (the model, the components, the units), it can be easily
read and modified, e.g. the model changed. For more complex problems, such as
those involving PVT Analysis or property matching the GUI has to be used.
by typing in
=MF_PTF(F$4,$A5,$C5,$E$10,$E$9,$E$5:$E$7,$A$1:$A$3)
The MF_PTF function is defined by
Function Wizards
An easier way to define the function is to use function wizards, which prompt
you for each argument in turn.
On activating Excel use the function wizard icon or select Insert/Function from
the Excel menu, or by clicking the
button in the input bar. Select the
Multiflash Function Category by scrolling to the Multiflash Add-In and
highlighting it:
You may either type in the cell references for each prompt as before or, with the
cursor in the appropriate box, simply click in the cell (or highlight the range of
cells) to which this argument refers. This will transfer the identification of the
cell or group of cells to the function wizard but you will then have to complete
the reference, if you need to, by adding in the $ signs. This can be done using
key F4 or else by adding the $ signs manually.
Be sure to scroll down the argument list to provide all the information required
for the function definition.
The appearance of the function wizard in Excel is slightly different from version
to version but work in exactly the same way. The HELP button is marked may
be marked as ? as HELP or as Help with this function.
Cell references
References tell Excel which cells to look in to find the values to be used in a
formula. There are three types of reference: relative references, absolute
references and mixed references.
Relative references
A reference such as A1 tells Excel how to find another cell, starting from the cell
containing the formula.
Absolute references
A quick way of altering
absolute or relative
references to a cell or group
of cells is to use the F4
function button.
A reference such as $A$1 tells Excel how to find a cell based on the exact
location of that cell in the worksheet. An absolute reference is designated by
adding a dollar sign ($) before the column letter and row number.
A typical example of a cell or group of cells which should be given an absolute
reference is the initialisation script.
Mixed references
A reference such as A$1 or $A1 tells Excel how to find another cell by
combining a reference of an exact column or row with a relative row or column.
A mixed reference is designated by adding a $ before either the column letter or
row number. For example, in the mixed reference $A2, the column reference
($A) is absolute and the row reference (2) is relative.
An example of using a mixed reference in a Multiflash spreadsheet is to obtain
component names. In the Getting started on page 10 example we had three
components, ethane, butane and water. The function call to obtain the name of
the first component was
=MF_COMP($C5,$A$1:$A$3)
where the cell reference for the component number ($C5) is mixed and for the
initialisation script ($A$1:$A$3) is absolute.
This means that if the function is copied and pasted (or dragged) from cell D5 to
D6 the function changes to
=MF_COMP($C6,$A$1:$A$3)
so that the name of the second component, (butane), is picked up. If the
reference to the component number had been made absolute, e.g. ($C$5) the
copying or dragging to cell D6 would have resulted in the name of the first
component being place in D6, i.e. ethane.
Mixed references should also be used for functions identifying input and output
units.
Array functions
Although there can sometimes be advantages in defining functions as arrays we
no longer recommend this. The array function can be defined whenever the
results from a flash calculation are required in a rectangular block of cells on the
spreadsheet. To do this, first define the function in a single cell in the block
using the function wizard if desired. The input arguments should be set up as
arrays in order to define the flash function as an array function over the block in
question. Click on the cell where you have defined the function, highlight the
entire block of cells for which you want the array function to return values, click
on the formula bar and press Ctrl Shift Enter. Excel now defines the function as
an array function over the highlighted block. If you click on another cell the
highlighting disappears.
If you define a flash function as an array that is too large, the superfluous cells
will be filled with an Excel error value; if you define a flash function as an array
that is too small, the output is truncated to fill the defined cells only. Note that
Excel does not allow you to alter a single cell within the array; you have to
delete the whole array and start again. This can be limiting, particularly if the
phase label for any phase changes within the array or if you wish to investigate
individual calculations.
The phase envelope functions have to be an array function. For details of how to
set up this function, see Setting up the phase envelope function on page 53.
From MF39 onwards the available PVT characterisation is the revised method,
infoanal2. For PVT characterisation and any matching such as bubblepoints,
dewpoints, asphaltenes and waxes etc, it can be done by launching the Multiflash
GUI from Excel, carrying out characterisation and matching in Multiflash GUI
and then save the Multiflash initialisation script in Excel after closing Multiflash
GUI. Alternatively, the Multiflash command language can be used to configure
and drive the Multiflash software for various tasks interactively in spreadsheets.
For the Multiflash command language, refer to the Multiflash command
references manual.
Interface specification
Initialisation script
All Multiflash functions in Excel must refer to the relevant initialisation script to
work properly. Note that if any file included in the initialisation script is altered,
it is essential to update the spreadsheet as follows:
1.
2.
Force all the Multiflash functions that use the initialisation script to
recalculate. This is easily done by clicking on one of the cells
containing the initialisation script, placing the cursor in the formula
bar and pressing Enter.
Once Multiflash has been initialised, the functions in the following sections are
available to be connected to the spreadsheet cells. They may be entered into the
spreadsheet cells either by typing in their names, by calling the function wizard
or by copying them from other cells. To use any function you must have set up
an initialisation script to define the problem that Multiflash is required to solve.
Optional arguments, e.g. stream_type, are shown in italics. You need not enter
these unless they are required for your problem. Some other arguments, such as
comp_no, can be omitted under certain circumstances. For example, when
carrying out a P,H flash you do not need a reference to the component number if
you just wish to calculate the temperature. However, you must enter a reference
if the property wanted directly relates to a component, e.g. amounts.
Interface specification 25
26 Interface specification
Interface specification 27
Flash calculations
Flash at fixed pressure and temperature
(MF_PTF)
Performs a flash at constant pressure and temperature. Optional arguments are
shown in italics.
=MF_PTF( phase_wanted, prop_wanted, comp_no/
phase_wanted, pressure, temperature, amounts,
init_script, stream_type )
28 Interface specification
Interface specification 29
30 Interface specification
Salt calculator
For the original salt component model one of the components in the INFODATA
databank is called salt component. This is used to represent a salt pseudo
component, based on a sodium chloride equivalence, for use in calculating
freezing point depression or hydrate inhibition.
For the electrolyte model, which is based on defining ions and not a salt pseudo
component, the ions Na+, K+, Ca++, Cl- and Br- can be defined from
INFODATA databank.
To determine the inhibition effect of salt using either the salt component model
or the electrolyte model you need to provide a description of the salt content of
the aqueous stream but often the data for the salt, brine or formation/production
water ion analysis will not be available to you in the appropriate units.
To help generate the data in the form required by Multiflash you can either use
the following functions to calculate the equivalent amount of salt component
or the ions or use the extended Tools/Inhibitor Calculator menu option in
Multiflash GUI by calling from Excel.
The water component and its amount have to be defined before any calculations
of the salt or ions. It is much more straightforward to use the Tools/Inhibitor
Calculator menu option in Multiflash GUI to define the salt component or the
ions and generate the data for the salt component or the ions for the salt
component model or electrolyte model and then save the initialisation script in
Excel.
Interface specification 31
be added per unit mass (weight) of water if the input units for amounts are
currently set to mass units.
=MF_ION_IC( ion, ion_ids, ion_concs, sp_gravity,
init_script )
32 Interface specification
be added per unit mass (weight) of water if the input units for amounts are
currently set to mass units.
=MF_ION_TDS(ion, TDS, sp_gravity, init_script )
Interface specification 33
Tolerance calculation
Tolerance calculation for fixed phase fraction
(MF_FRACT)
Performs a tolerance calculation for fixed phase fraction at constant pressure and
temperature. The tolerance calculation takes a (first) fluid mixture and adds a
second fluid until the fixed phase fraction is satisfied at the defined pressure and
temperature. Optional arguments are shown in italics.
=MF_FRACF( phase_wanted, prop_wanted, comp_no,
fixed_phase, basis, pressure, temperature, fraction,
amounts(1) , amounts(2) , init_script, stream_type )
34 Interface specification
Interface specification 35
=MF_VERS( init_script )
Comp_no_2
Integer. Second component number for BIP set.
BIP_set
String characters. BIP set name.
BIP_no
Integer. BIP number, e.g. 1=Aij, 2=Aij, 3=alpha.
36 Interface specification
Molecularweight
Tcrit
critical temperature
Pcrit
critical pressure
Vcrit
critical volume
Acentricfactor
Tboil
Hformation
Sformation
Entropy of formation
Sstandard
Tmelt
Hmelt
Smelt
Cpmelt
Vmelt
Runiquac
UNIQUAC r parameter
Quniquac
UNIQUAC q parameter
Thlwater
Vhlwater
Dipolemoment
Parachor
Radgyr
Hocass
Gformation
Ttriple
Ptriple
Hcombustion
enthalpy of combustion
v25
Solupar
Solidsolupar
Zcrit
Refractindex
refractive index
Tflash
flash temperature
Tauto
autoignition temperature
Flamlower
Flamupper
SG
Specific gravity
Expansivity
OMARKS
OMBRKS
OMAPR
OMBPR
CNUMBER
REFVISCOSITY
REFVISST
REFVISPD
REFVISTW
REFVISLB
LJEVISC
Lennard-Jones
Interface specification 37
Lennard-Jones
EOSC
TYPE
Type of component
HDATUM
SDATUM
MCRKS1
MCRKS2
MCRKS3
MCPR1
MCPR2
MCPR3
HYDOC
HYD1
Hydrate parameter 1
HYD2
Hydrate parameter 2
HYD3
Hydrate parameter 3
ASSBETA
CPA
ASSEPSILON
CPA
AB parameter ( J mol-1 )
ASSGAMMA
CPA
AB parameter
ASSDELTA
CPA
AB parameter ( K-1 )
ASSFF
ASSAC
CPA
ASSBC
ASSKAPPA
CPA
parameter ( m )
parameter
ac parameter ( J m3mol-2 )
SAFTEPSILON
parameter
PC-SAFT parameter
PC-SAFT parameter
SAFTGAMMA
PC-SAFT
SAFTFF
SAFTEK
PC-SAFT
SAFTSIGMA
PC-SAFT
SAFTKAPPA
38 Interface specification
LJBVISC
parameter
SAFTLAMBDA
/ k parameter
parameter
PC-SAFT parameter
SAFTM
PC-SAFT m parameter
SAFTQ
SAFTFRQ
VSRKS1
VSRKS2
VSRKS3
VSPR1
VSPR2
VSPR3
CPIDLIQ
Psat
Hvap
Ldens
Lvisc
Vvisc
Lthcond
Vthcond
Stension
Cpliquid
Sdens
Cpsolid
Virialcoeff
Offset
Property Offset for viewing the coefficients of a temperature-dependent property
correlation. For the constant physical properties, this option may be omitted.
Temp_order
Integer. Temperature order of coefficient, 0 = constant, 1 = T term, 2 = T2 term.
phase_wanted
String up to 40 characters. The name of the phases for which the calculated
property is required. These names must correspond to those used to define the
phases in the Multiflash initialisation script. Infochem normally uses the
following convention:
GAS
LIQUID1
LIQUID2
WATER
gas/vapour phase
first hydrocarbon liquid phase
second hydrocarbon liquid phase
aqueous liquid phase
Interface specification 39
ICE
HYDRATE1
HYDRATE2
HYDRATEH
ASPHALTENE
WAX
ice phase
hydrate structure I phase
hydrate structure II phase
hydrate structure H phase
asphaltene phase
wax phase
In addition, if phase_wanted is set to OVERALL, then the total values for all
phases added together are reported.
prop_wanted
This argument refers to the property of a stream. String up to 40 characters. The
property required as follows:
ACTCO
FUGCO
AMOUNTS
FRACTIONS
PHASE
TEMPERATURE
Temperature
PRESSURE
Pressure
volume/density
ENTHALPY
Enthalpy
ENTROPY
Entropy
INTERNALENERGY
internal energy
GIBBS
Gibbs energy
ZFACTOR
compressibility factor
ENTHALPY_ELEM
ENTROPY_ELEM
INTERNALENERGY_ELEM
GIBBS_ELEM
AVMOLWT
CP
Cp.
CV
Cv.
SSOUND
speed of sound
VISCOSITY
Viscosity
THCOND
thermal conductivity
SURTEN
surface tension
COMPRESSIBILITY
isothermal compressibility
EXPANSIVITY
isobaric expansivity
JTCOEFF
STATUS
40 Interface specification
For property STATUS, text is returned showing if the flash calculation has
converged successfully. If it has, the cell displays the text OK, otherwise it
displays the Multiflash error numbers (with the limitation that Excel can only
display up to 255 characters in any one cell). Positive numbers are Multiflash
errors and negative numbers are Multiflash warnings. The meaning of each error
code can be looked by selecting the HELP item from the Excel menu bar and
selecting Multiflash Error Codes.
For properties such as ACTCO, FUGCO, CP, CV etc., the physical property
output level has to be set in the Multiflash initialisation.
FRACTIONS, ZFACTOR and AVMOLWT are dimensionless quantities,
so if the units are requested for these, the cell is set blank. The same applies to
STATUS as it is not a physical quantity.
Input and output units to all the functions above, may be set in the Multiflash
initialisation script using the units, inputunits and outputunits commands
which are described in the Multiflash for Windows Manual. If they are not
specified, the default settings are used. These may be the absolute SI default
values, or else the users default settings which are defined in file
MFCONFIG.DAT. Again, this is described in the Multiflash for Windows
Manual.
comp_no
Integer. Component number
pressure
Real (double). Pressure specified in current input units.
temperature
Real (double). Temperature specified in current input units.
enthalpy
Real (double). Enthalpy specified in current input units.
entropy
Real (double). Entropy specified in current input units.
volume
Real (double). Volume/density specified in current input units.
internalenergy
Real (double). Internal energy specified in current input units.
fixed_phase
String up to 40 characters. The phase with the fixed fraction. The phase must be
identified by the name in the Multiflash initialisation script just as for
phase_wanted except that OVERALL is not a permitted specification.
Interface specification 41
basis
String up to 40 characters. Type of calculation as follows:
NORMAL
LOWER_NORMAL
Lower normal
UPPER_NORMAL
Upper normal
LOWER_RETROGRADE
Lower retrograde
UPPER_RETROGRADE
Upper retrograde
UNSPECIFIED
Unspecified
NORMAL_MASSFRACTION
LOWER_NORMAL_MASSFRACTION
UPPER_NORMAL_MASSFRACTION
LOWER_RETROGRADE_MASSFRACTION
UPPER_RETROGRADE_MASSFRACTION
UNSPECIFIED_MASSFRACTION
NORMAL_VOLUMEFRACTION
LOWER_NORMAL_VOLUMEFRACTION
UPPER_NORMAL_VOLUMEFRACTION
LOWER_RETROGRADE_VOLUMEFRACTION
UPPER_RETROGRADE_VOLUMEFRACTION
UNSPECIFIED_VOLUMEFRACTION
NORMAL_NUCLEATION
LOWER_NORMAL_NUCLEATION
UPPER_NORMAL_NUCLEATION
LOWER_RETROGRADE_NUCLEATION
UPPER_RETROGRADE_NUCLEATION
UNSPECIFIED_NUCLEATION
fraction
Real (double). Phase fraction (molar) specified
amounts
Real (double) array. Array of quantities of all components in the feed specified
in current input units.
amounts(1)
Real (double) array. Array of quantities of all components in the first fluid for a
tolerance calculation specified in current input units.
42 Interface specification
amounts(2)
Real (double) array. Array of quantities of all components in the second fluid for
a tolerance calculation specified in current input units.
init_var
String up to 40 characters. Defines which quantity to fix to define the starting
point of the phase envelope trace. Can be set to either TEMPERATURE or
PRESSURE.
direction
String up to four characters. Defines the initial direction of the temperature or
pressure along the phase envelope. Can be set to UP or DOWN.
no_points
Integer. The maximum number of points that the phase envelope function is to
return.
skip_no
Integer. The number of calculated phase envelope points that should be skipped
between points that are returned by the function. This number is designed to
reduce the number of points plotted if less detail is required. If skip_no is set to
zero, all calculated points are returned.
stream_type
String up to 40 characters. This argument is provided for specifying the type of
streams used by Multiflash. If only one stream is involved in flash calculations,
this argument may be omitted.
starting_press
Real (double). Starting value of the pressure specified in current input units for a
calculation that involves a pressure search. This is an optional argument that may
be omitted.
starting_temp
Real (double). Starting value of the temperature specified in current input units
for a calculation that involves a temperature search. This is an optional argument
that may be omitted.
Interface specification 43
ion
Character string. This argument is for returning the ion ratio calculated by
Multiflash functions. Only Na+ and Cl- ions are calculated and the rest of them
are returned as zero in this latest version of Multiflash Excel interface.
ion_ids
Array of strings. Each string identifies a particular ion. The complete list of
possible ion identifiers is as follows:
Na+
sodium ion
Ca++
calcium ion
Mg++
magnesium ion
K+
Potassium ion
Sr++
Strontium ion
Ba++
barium ion
Fe++
ferrous ion
Cl-
chloride ion
SO4--
sulphate ion
HCO3-
bicarbonate ion
Br-
Bromine ion
ion_concs
Real (double) array. Gives each ion concentration in mg/litre. The list of
concentrations must correspond to and be the same length as the list of ion
identifiers passed in ion_ids
sp_gravity
Real (double). The specific gravity or density in g/cm3 of the solution. This
argument can be left undefined in which case the value is estimated on the basis
of the solutions composition.
TDS
Real (double). Total dissolved salt in mg/litre.
salt_ids
Array of strings. Each string identifies a particular salt. The complete list of
possible salt identifiers is as follows:
44 Interface specification
NaCl
sodium chloride
CaCl2
calcium chloride
MgCl2
magnesium chloride
KCl
Potassium chloride
SrCl2
Strontium chloride
BaCl2
barium chloride
FeCl2
ferrous chloride
Na2SO4
sodium sulphate
NaHCO3
sodium bicarbonate
NaBr
Sodium bromide
salt_molalities
Real (double) array. Gives each salt molality. The list of salt molalities must
correspond to and be the same length as the list of salt identifiers passed in
salt_ids
salt_mole_fracs
Real (double) array. Gives each salt mole fraction. The list of salt mole fractions
must correspond to and be the same length as the list of salt identifiers passed in
salt_ids
salt_mass_fracs
Real (double) array. Gives each salt mass (weight) fraction. The list of salt mass
fractions must correspond to and be the same length as the list of salt identifiers
passed in salt_ids.
phase/component amounts
TEMPERATURE
Temperature
PRESSURE
Pressure
volume/density
ENTHALPY(or INTERNALENERGY)
(or GIBBS)
entropy/Cp/Cv
SSOUND
speed of sound
VISCOSITY
Viscosity
THCOND
thermal conductivity
SURTEN
surface tension
Convert_from
Character string. This argument defines the unit of density, pressure, enthalpy,
entropy, temperature, surface tension, thermal conductivity and viscosity from
which the unit is converted.
Convert_to
Character string. This argument defines the unit of density, pressure, enthalpy,
entropy, temperature, surface tension, thermal conductivity and viscosity to
which the unit is converted.
Interface specification 45
Molecular_weight
Real(double). This argument defines the molecular weight used in the unit
conversion of density, enthalpy and entropy.
Surface tension
Real(double). This argument defines the surface tension used in the unit
conversion.
Thermal conductivity
Real(double). This argument defines the thermal conductivity used in the unit
conversion.
Viscosity
Real(double). This argument defines the viscosity used in the unit conversion.
Numbers_To_Sum
Integer. This argument defines the number of cells which will be used in the
summation of squares function.
46 Interface specification
If any one of the above-mentioned arguments is an one-dimensional or twodimensional array, then the flash function will also return an array of values with
the same number of rows and columns as in the input array argument.
It is also possible to make any two of the above-mentioned arguments into onedimensional arrays. One must be a horizontal array and the other must be vertical
array. The flash function will then be a two-dimensional array with the same
number of rows as the vertical input array and the same number of columns the
horizontal input array.
Note that comp_no does not count as a separate input argument when
determining whether the flash function is an array function; comp_no should
have the same number of rows and columns as prop_wanted. If comp_no is too
large, the excess entries are ignored and if comp_no is too small, the missing
entries are taken to be zeros.
Interface specification 47
It is also possible to make any two of the above-mentioned constraints (for flash
functions that have two constraints) into one-dimensional arrays. One must be a
horizontal array and the other must be vertical array. The starting values should
then be two-dimensional arrays with the same number of rows as the vertical
constraint array and the same number of columns as in the horizontal constraint
array.
If you define a starting value array that is too large, the superfluous cells will be
ignored; if you define a starting value array that is too small, the missing values
will be taken as the last value to be defined in the row and/or column in question.
48 Interface specification
Troubleshooting
Evidence of errors
When an error occurs in an interactive version of Multiflash an error or warning
message is given which briefly describes the cause. From this it is usually
possible to trace the source of the problem. In Excel the procedure is not as
straightforward. The immediate evidence of a potential problem will probably be
the display of one of the four following texts in a cell, #N/A, #VALUE!, #NUM!
or #NULL!.
#N/A (not available) indicates that the phase wanted does not exist under the
conditions specified. This is not necessarily an error. For example, if you are
using the isothermal flash function (MF_PTF) then, depending on the conditions
chosen, your stream may be all gas or all liquid and calculation of amounts or
properties of the other phase will not be possible.
#NUM! indicates that the flash or other calculation has failed.
#VALUE! indicates that there is an error in the function definition.
#NULL! indicates that an unrecognised property or phase name has been
entered.
There may be other, more subtle errors, where the calculated values are not what
you expect or don't appear to change when you expect them to. Dealing with
Multiflash errors on page 55 describes some of the ways in which you can
investigate errors at different levels.
Error #N/A
As previously stated, this is not necessarily an error. #N/A (not available)
indicates that the phase wanted does not exist under the conditions specified.
This is quite possible when using any of the flash functions. Depending on the
conditions chosen your stream may be all gas or all liquid and calculation of
amounts or properties of the other phase will not be possible. An example is
shown in Pure component properties on page 69.
One way of investigating this is to add a further calculation of the total phase
amounts (property PHASE). For the phase which does not exist this should be
zero.
Troubleshooting 49
Error #NUM!
This indicates that a calculation has failed. If it occurs for one temperature or
pressure in a series, perhaps when investigating a phase envelope, then this is
likely to be because of a convergence failure. For this reason it is strongly
recommended that with each flash function you specify the STATUS property
to check whether the calculation has succeeded. If a converged solution has been
obtained, the text OK is returned. If there has been an error or a warning
issued, the Multiflash error numbers will be displayed. It is important that when
checking STATUS that the function and function arguments (other than the
property wanted) match those of the original calculation, including the basis.
An example is given below for the calculation of a dew point at fixed pressure.
Dew point at fixed pressure
PRESSURE
TEMPERATURE
STATUS
bar
358.8548
OK
399.6134
OK
10
419.6399
OK
20
440.0694
OK
40
457.8773
OK
60
463.853
OK
80
463.252
OK
100
457.227
OK
120
444.9374
OK
135
#NUM!
You can look up the meaning of the error code by selecting the "Multiflash Error
Codes" option from the HELP menu. For the case shown the initial error is
reported as a failure to converge the temperature or pressure search.
It may be that there is no solution, but it may also be worth investigating further
by changing the basis or type of solution or by providing a starting guess in the
function definition. If you have defined the model in the initialisation script
using a model definition file (.mfl) or created the script using Multiflash for
Windows then, by default, there will be four phase descriptors allocated: GAS,
LIQUID1, LIQUID2 and WATER. There are no key components defined for
LIQUID1 and LIQUID2 ( only "not water"); defining a key component for one
of these liquid phases can sometimes help find a converged solution. To do this
make LIQUID1 and LIQUID2 heavier and lighter liquids by adding additional
cells to your initialisation script, as follows:
50 Troubleshooting
2.
If you have spelt one of the commands in the initialisation script incorrectly the
reload will generate a message:
201 Unrecognised command.
It is also possible to have #NUM! reported where you have failed to complete
the function definition, e.g. you have not scrolled down in the function wizard
and entered arguments for the initialisation script or feed composition. Again use
of STATUS will identify errors to help trace the source of the problem.
Troubleshooting 51
Error #VALUE!
Whereas #NUM! is generated by Multiflash, #VALUE! is generated by Excel
and is an indication that there is an error in the function definition. For example,
the following error
Dew point at fixed pressure
PRESSURE
TEMPERATURE
bar
STATUS
#VALUE!
OK
399.6134
OK
10
419.6399
OK
20
440.0694
OK
40
457.8773
OK
60
463.853
OK
80
463.252
OK
100
457.227
OK
120
444.9374
OK
If you get the #VALUE! error code then check your function definition,
preferably with the function wizard, so that you can see (in the right-hand set of
text boxes) the values that are being picked up for the arguments.
Error #NULL!
This error is returned by a flash or chemical equilibrium function if the property
or phase requested is not recognised. #NULL! can be returned even if the flash
calculation has converged. If it occurs, you need to check that the property you
have requested in prop_wanted is correct and not mis-spelt. You also need to
check that the phase you have requested in phase_wanted corresponds to one of
the phases defined in the initialisation script, e.g. GAS, LIQUID1 or whatever.
Other problems
Other problems may occur which do not give rise to specific error messages. For
instance, you may make a small change to your initialisation script and not be
52 Troubleshooting
sure if this has taken effect as there appears to be no change to the calculated
values. As a certain number of previous calculations are "remembered" until you
change the initialisation or use the Clear facility, it is worth using Clear and
forcing the spreadsheet to recalculate by clicking on the initialisation script,
placing the cursor on the formula bar and pressing Enter. If the values obtained
still appear incorrect you should run the same problem in an interactive version
of Multiflash.
One of the simplest of problems is to reference arguments incorrectly. This
usually manifests itself by obtaining the same calculated values for a series of
different inputs, e.g. calculating the same bubble point temperatures for a series
of pressures because the pressure argument has been given an absolute
reference or a mixed reference where the row or column has been fixed instead
of the column or row.
The inclusion of the PVT and Matching functions may also lead to problems as
they generate a new initialisation script for use with the other calculation
functions. If this second initialisation script is incorrect this will result in errors.
A common source of problems may be that an insufficient array was specified to
contain the second script. Unfortunately it is not possible to simply extend the
existing array. If you think this may be the source of a problem the delete the
array and call the function again.
Troubleshooting 53
Calculation of Physical
properties
Introduction
The Multiflash Excel interface is a very useful tool for generating tables of data.
The constant or temperature dependent physical properties of a pure component,
petroleum fraction or properties of a mixture can be calculated using functions,
MF_PDAT, MF_PDAT_T or flash functions such as MF_PTF, MF_TBUBF etc
in Multiflash Excel Interface.
For a full description of the equations used for each property and a description of
the coefficient see the Multiflash Command Reference manual or the Models
and Physical properties manual, both of which can be found on the CD-ROM of
standard Multiflash software.
Help
Introduction
Help is provided in three ways:
On-line Help
Technical support
On-line help
The on-line help will be familiar to regular users of Windows applications. It is
accessed through the HELP menu
Selecting Multiflash Help will display a list of the main topic headings. Those
in black text are equivalent to the chapter headings in the printed User Guide and
are 'inactive'. Those in underlined green text are the secondary headings within
each chapter of the User Guide and are 'active'.
Selecting any active topic will bring up the related help text.
Help 59
Related topics are further sub-headings and more help is displayed by selecting
any of these.
Some of the help text may be displayed in green. If this is underlined with a solid
line, clicking on the text will allow you to jump to another help screen related to
the text. If the text is underlined with a dotted line, clicking on it will result in a
pop-up box containing a glossary definition or a margin note.
Selecting Search using the Search button in the on-line help window allows
you to specify a particular topic you are interested in, either by typing in a
description or selecting from the list displayed.
Clicking on the Display button or double clicking on the topic allows you to
move to the related help text.
60 Help
If an error code is returned in the Excel interface there is no text associated with
it. You can look up the meaning of the error code by selecting the "Multiflash
Error Codes" option. from the HELP menu.
Technical support
If you need further assistance contact us at:
Infochem/KBC Advanced Technologies plc
4 The Flag Store
23 Queen Elizabeth Street
London SE1 2LP
UK
Telephone: +44 (0)20 7357 0800
Fax:+44 (0)20 7407 3927
e-mail: software@kbcat.com
Help 61
Examples
Examples provided
We have provided five examples of using Multiflash interfaced to Excel. These
are
Phase envelope
Linked flashes
Matching
PVT Analysis
Solids Prediction
Interfacial Tension
Examples 63
The initialisation script is provided by an .mfl file called ideal.mfl located in the
"C:\Program Files\Infochem\MF" directory and a command to define the
component of interest. The text of the .mfl file, defines Infodata as the source of
the pure component data, the ideal model for gas and liquid phases, the units and
the requirement for both thermodynamic and transport property data.
remove all;
units temperature K pressure Pa enthalpy J/mol entropy J/mol/K volume m3/mol
amounts mol viscosity Pas thcond W/m/K;
datum enthalpy compound entropy compound; set fractions;
puredata INFODATA ; chardata INFOCHAR TBSOEREIDE ;
model MIDG IDG;
model MIDLMIDG IDL MIDG;
model MVVS1 VVS1;
model MLVS1 LVS1;
model MVTC1 VTC1;
model MLTC1 LTC1;
model MST1 ST1;
pd GAS gas MIDG MIDG MIDG MVVS1 MVTC1;
pd LIQUID1 liquid MIDLMIDG MIDLMIDG MIDLMIDG MLVS1 MLTC1
MST1;
units temperature K pressure Pa enthalpy J/mol entropy J/mol/K volume
m3/mol;
amounts mole viscosity Pas thcond W/m/K;
The physical property level setting in the .mfl file is physprops1, which doesnt
include transport properties or heat capacity. However, the Excel interface
automatically includes a physical property level encompassing heat capacity and
transport properties, but not activity and fugacity coefficients unless the
appropriate command is given
The initialisation script comprises the model definition
include C:\Program Files\Infochem\MF\ideal.mfl;"
placed in cell A1 and the component definition
Components octane;
Placed in Cell A2.
The table of temperatures is fixed in cells H8 to H17 and the feed composition in
cell D8. The properties in cells I8 to O17 were calculated at the bubble point (for
the given temperature) from an array function initially set up with a function
wizard in cell I9:
64 Examples
The amount of each phase, given in cells E8 to G17 is based on another array
with the function initially defined in cell E8; again a bubble point calculation at
fixed temperature but this time the property sought is "Amounts" for a range of
phases.
Examples 65
The same information can be obtained for the petroleum fraction if the Comp_no
is designated as 2.
The error number #NUM! in the example sheet means that the properties are not
available for the component. For the temperature-dependent coefficients, the
offset option has to be used to specify which coefficient is required. The second
worksheet picks up the property correlation coefficients for octane, now the only
66 Examples
To see the remaining coefficients drag the function from cell B7 to cell M7. To
see the correlation coefficients for other properties enter the property name in
column A and drag the function calls down. A #NULL message indicates that no
value is stored for that equation.
For a full description of the equations used for each property and a description of
the coefficient see the Multiflash Command Reference manual or the User Guide
for Models and Physical Properties.
For the physical properties of a petroleum fraction such as C10, replace
Component insert 1 octane;
in cell A2 with
Petrofracs 1 C10 normal data cnumber 10;;
Cnumber is the key word for specifying carbon number. With a given carbon
number of a petroleum fraction, the molecular weight, specific gravity etc. are
calculated using the Riazi, M.R. and Al-Sahhaf, T.A., correlation. More input
information for a petroleum fraction with relevant key words can be used to
obtain the rest of properties.
The final worksheet shows the use of the MF_BDAT function to show the values
of BIPs for a particular model and mixture.
Examples 67
The example show the BIPs for a methanol water example for the
RKSA(Infochem) model
Phase envelope
The spreadsheet phenv.xls is an example of investigating a phase envelope. The
initialisation script is entered on the spreadsheet on cells A1:A3. It is very simple
and defines only the PRA model, the components and the units:
include c:\Program Files\Infochem\MF\pra.mfl";
components co2 n2 methane ethane propane isobutane
butane isopentane pentane hexane heptane;
units temp degF press psig;
The function itself is defined in the block of cells K8:M34. The phase line is
defined initially as a normal dew point, i.e. where the liquid phase, cell G9,
(argument 1) is present with a zero phase fraction, cell I8, (argument 7) and the
type of solution is normal, cell G10, (argument 2). The trace of the phase
envelope is started at a pressure, cell G7, (argument 3) of 10psig, cell I7,
(argument 5) and sent in the direction of increasing pressure, cell G11,
(argument 4). No starting value is provided for the temperature, cell I6,
(argument 6). The gas composition is defined in cells C7:C17 (argument 8). The
total number of points (argument 9) and the number of points to skip between
each returned point (argument 10) are set in cells I12 and I13 respectively. By
putting the input specifications into cells, the function can be made recalculate
simply by altering one of the cells. If these parameters had been written directly
into the function definition, the function would have to be deleted and redefined
to obtain a new calculation.
68 Examples
Note cell M8 which gives the STATUS calculation. This indicates whether the
phase envelope has terminated in an error state or not. If the cell displays "OK"
termination is error free, otherwise the Multiflash error numbers are displayed.
Positive numbers are Multiflash errors and negative numbers are Multiflash
warnings.
It is particularly useful to be able to plot the phase envelope as you investigate its
characteristics as you can see when you may be approaching a cricondenbar,
cricondentherm or critical point, etc. In this example, the phase line passes
through a critical point, temperature as shown in cell K19 and pressure as shown
in cell L19. It is marked by a C in cell M19. Also, the line crosses another
phase boundary showing a resultant discontinuity in gradient. This occurs at the
point given in cells K26:L26 marked by a D in cell M26.
Linked flashes
The Multiflash Excel interface can be used to investigate simple flowsheets,
including linked flashes and recycles. The example shown, flash.xls, is one of
the simplest, consisting of two linked flashes.
Examples 69
This time the initialisation script is defined in the spreadsheet. This has the
advantage of allowing you to change the model from PRA (defined by pra.mfl)
to RKSA (defined by rksa.mfl) and see the effect on the calculation without
leaving the spreadsheet to edit an .mfl file. Similarly you can change the units
from mol to kg by adding "amounts kg" to the cell containing the unit
definition, e.g.
units temp degC press bar amounts kg;
You can also change some of the characteristics of the C7+ fraction and see the
effect.
If you don't feel you know the commands well enough to write the script from
scratch remember you can prepare it in Windows, using the menus and dialogue
boxes. If the GUI is launched from the Excel spreadsheet the script will be
automatically entered into the worksheet. Alternatively the text of the problem
file can be copied from the results window (text generated from
Tools\Show\Problem) to the spreadsheet for editing later. See "How to create an
initialisation script to define a new problem" on page 15 of the Multiflash User
Guide for Windows 4.4, for more information on the best ways to do this.
You could also investigate changing the temperatures and pressures of the two
separators or changing the feed composition.
The feed into the low pressure separator is calculated by adding together
LIQUID1 and WATER from the first flash. If you wished to take the water off
after the HP separator, then the feed to the LP separator could be defined in the
function as LIQUID1 compositions only ($D$22:$D$27) instead of summed
LIQUID1 and WATER compositions $G$22:$G$27.
Stream types
One feature of Multiflash is the ability to designate stream types. This allows
you to take all, or a selection of, components from your overall stream and
assign a different model to this sub-stream. This feature is most useful when
using Multiflash in connection with a third part application such as a simulator.
However, we have extended the example of linked flashes shown above to
indicate how the concept works.
70 Examples
In the input specification we have assigned a hydrocarbon stream type, used for
the high and low pressure separator flashes, to all the components. The model
used for this stream is the advanced Peng-Robinson. We have also assigned
another stream type, TEG, to components water and TEG. This allows us to use
a different model, in this case UNIFAC, when looking at the regeneration of
TEG by boiling off water. An activity model is more appropriate for this polar
aqueous stream.
The initialisation script is shown below:
remove all;
puredata infodata;
bipdata infobips oilandgas;
model meos pra psat lden vdw;
pd gas_hc gas meos;
pd liquid_hc liquid meos;
pd water liquid meos;
key liquid_hc not water;
key water water;
components methane ethane propane hexane water teg;
petrofracs 7 C7+ data tboil 623 molecularweight 340
spgravity .8;;
streamtype hydrocarbon pds gas_hc liquid_hc water
;;
model mgas idg;
model mteg unifac vle mgas;
pd gas_teg gas mgas;
pd teg liquid mteg;
streamtype teg pds gas_teg teg; component water
teg;;
units temp degC press bar;
If you use commands to write the initialisation script in the worksheet then for
each stream type you should assign a name, list the phase descriptors (pds)
relevant to that stream and the components assigned to that stream. If you do not
list the components the default is that all components are included. When
Examples 71
specifying a second model it is most important that a different model name and
different phase descriptor names are used. Of course, you can also prepare the
initialisation script using Multiflash for Windows and use this file in Excel.
Matching
Some of the predicted properties of condensates and oils may not agree with
measured values as the predictions will depend on the properties of the
components in the plus fraction which can vary from oil to oil. The predicted
properties of the oil can be matched by altering a physical property of each of the
petroleum fractions in the plus fraction. The matching is to be carried out by
calling the Multiflash GUI from Excel, and saving the generated initialisation
script in the spreadsheet.
The Multiflash GUI can be launched using MF/Call GUI and Cell A1 designated
to receive the designated initialisation script as described in Defining the
problem by launching the GUI on page 17. Details on how to use the Multiflash
GUI may be found in the User Guide for Multiflash for Windows but a brief
overview for this particular example is given here.
Once the GUI is launched
go the PVT Analysis and enter the laboratory composition, any ancillary data
and your choice of how the plus fraction should be grouped or split. Using this
approach allows you to use the Revised analysis method (Infoanal2) to fit the
distribution.
In the current version of Multiflash, the fluids with or without n-paraffin
distribution are separated and characterised by launching the PVT analysis
dialog box from two different icons on the main window of Multiflash.
72 Examples
Once the characterisation has been carried out you are returned to the main
window. Using the Tools/Matching/Bubble point option
Examples 73
you can enter up to twenty bubble points. If you have the information you can
also simultaneously match the GOR and a liquid density at the GOR conditions,
as well as a water phase fraction (water cut).
After matching a plot is generated showing a comparison of the pre and post
matched phase envelope and the experimental values.
The amended properties and the predicted bubble points, after matching, are also
reported in the GUI window in tabular fashion.
74 Examples
If you are happy with the results, exit the GUI using File/Exit and reply Yes to
saving the Multiflash configuration file. On returning to the Excel spreadsheet
you will be asked to specify the cells for the initialisation script. The cell
references will reflect those chosen when the GUI was launched, if these are
acceptable then click on OK. However, you can change the cell reference if you
wish.
The script saved in the cells A1:A23 of the active spreadsheet is effectively a
copy of the mfl file that would be generated by the File/Saving Problem Setup
option in the GUI.
The feed composition can be generated from this new initialisation script and the
bubble point values calculated using the MF_TBUBF function.
Examples 75
If you wish to refit to different bubblepoint values then you should call the GUI
again using the existing script as a starting point.
Alternatively the Multiflash command language can be used to configure and
drive the Multiflash software for the PVT characterisation and matching the
experimental bubblepoints interactively. For the detailed Multiflash commands,
refer to the Multiflash command references manual.
PVT Analysis
As in the Matching example the PVT Analysis is to be carried out by calling the
Multiflash GUI from Excel. The first script in the spreadsheet analpvt.xls is used
to provide the input PVT analysis. The resulting script written to the worksheet
in the same way as described for the Matching problem above.
76 Examples
The experimental data of SCN distribution has been fitted using the revised
method (Infoanal2) in Multiflash GUI and the plot is given as follows.
After characterising the fluid, any flash calculations can be carried out using the
saved initialisation script.
UNIFACFIT.xls
UNIFAC is a very useful model as the binary interaction parameters are
generated from the group structures of the pure components and so reasonable
predictions of phase equilibria can be obtained for polar systems without the
need for stored BIPs.
However, there may be times when you wish to use an alternative model such as
NRTL. Although we are continually expanding our BIP databank there may be
some binary pairs in your mixture for which we do not have stored NRTL
parameters. If you do not have the time to search for experimental data for the
missing pairs, or are unable to find any, then this spreadsheet allows you to
generate the phase equilibria data from UNIFAC, providing group structures are
Examples 77
available for your chosen components, and then fit this data using another
activity model.
The spreadsheet has several worksheets.
Notes
The first spreadsheet consists of notes on how to use UNIFICAFIT.xls and how
to enter the fitted BIPs in Multiflash.
UNIFAC
This is the worksheet where you generate the phase equilibria data (liquid and
gas phase compositions and temperature or pressure) that you are going to fit.
You specify, by entering information in the appropriate cell:
The required data is then generated, including column headings and plots. The
composition range is fixed and the units are SI. There is no need to change these
although it is possible.
An Error box reports the status of the data generation. This should be OK if the
UNIFAC group structures are available for your chosen components. An error
status of 13201 would indicate that the structures are missing for one or both
compounds.
Once the data has been generated you can move to the worksheet for the model
you wish to use, WilsonE, UNIQUAC VLE or NRTL VLE.
78 Examples
Once acceptable BIPs have been generated they can be entered and stored in
Multiflash as described in the spreadsheet notes or Supplementing or
overwriting BIPs on page 78 of the Multiflash User Guide for Windows.
Although NRTL has three parameters we have chosen not to fit all three but to
default the third parameter, alpha, to 0.3. You can over-ride this if you wish but
we would suggest that values for alpha should never be negative and should
rarely be larger than 0.6.
Currently the fitting is limited to constant values for the BIPs although this could
be expanded if necessary.
VLEFIT.xls
This is substantially the same as UNIFACFIT.xls but the starting point is
experimental data rather than data generated from the UNIFAC model.
Instead of the first UNIFAC worksheet there is an Experimental worksheet to
enter the data. Again you can choose the data source for your pure component
data and indicate whether your chosen data is along an isotherm or isobar. In
order to minimise effort this spreadsheet does allow you to choose the units for
temperature and pressure to match those measured. The temperature or pressure
for the isotherm or isobar should be entered as should the values for x, y and
associated T or P.
We have chosen a limited array for data entry. If you have more data and are
familiar with Excel you can extend the range although you will need to
remember to change the cell references in the dependent worksheets. Otherwise
you should limit the data by choosing suitable sets from the data available.
If you have less data then you should enter #N/A in the cells which would
otherwise be empty or retain values for earlier entries. This is necessary for the
Excel Solver to operate correctly. For some data sets you may have P,x or T,x
but no data for gas composition, y. In this case it is better to enter #N/A for the y
compositions. If you fail to do this the Solver will still function provided the
minimisation criteria is based on difference in temperature or pressure the
default. However, the plots for x,y will not be relevant and should be ignored.
As with UNIFACFIT.xls you can fit the experimental data to generate BIPs for
WilsonE, UNIQUAC VLE or NRTL VLE by choosing the appropriate
worksheet.
Interfacial tension
The Excel interface to Mutiflash allows calculations of interfacial tension with
the new surface tension model to be performed. The only change that has to be
made, comparing to other properties, is that a second phase name has to be
provided.
An example of a flash calculation at constant temperature and pressure would
look like:
Examples 79
The output of this function would be the interfacial tension between the water
phase and some hydrocarbon phase liquid1.
The following picture is how the file SurTen.xls looks like for an example of
interfacial tension between water and a reservoir fuild.
80 Examples
Index
6
64 bit Excel 7
64 bit versions of Excel 4
A
Absolute references 22
Activity model worksheets 78
amounts 42
amounts(1) 42
amounts(2) 43
Arguments 36
Arguments for BIP function 36
Arguments for component properties function 36
Arguments for flash functions 39
Arguments for Salt calculator 43
Arguments for setting up flash functions as array
functions 46
Arguments for sum of squares function 46
Arguments for units and conversion functions 45
For flash functions 14, 23
init_script 36
Arguments for BIP function 36
Arguments for component properties function 36
Arguments for flash functions 39
Arguments for Salt calculator 43
Arguments for sum of squares function 46
Arguments for units and conversion functions 45
Array functions 23, 46
B
basis 42
Binary interaction function 25
BIP function (MF_BDAT) 25
BIP_no 36
BIP_set 36
Bubble point 26
Bubble point at fixed pressure (MF_PBUBF) 26
Bubble point at fixed temperature (MF_TBUBF) 26
Bubble point calculations 26
D
Databank path 2
Dealing with Multiflash errors 49
Defining a flash function as an array function in
Excel 47
Defining input arrays 46
Defining Multiflash functions 19
Defining starting values for array flash functions 47
Defining the problem by launching the GUI 17
Dew point 27
Dew point at fixed pressure (MF_PDEWF) 27
Dew point at fixed temperature (MF_TDEWF) 27
Dew point calculations 27
Different editions of Excel 9
Different versions of Excel 9
direction 43
Dongle 2
E
enthalpy 41
entropy 41
Environment variables 2
Error
#N/A 49
#NULL! 52
#NUM! 50
#VALUE! 52
Error #N/A 49
Error #NULL! 52
Error #NUM! 50
Error #VALUE! 52
Errors
Evidence of errors 49
Types of error 49
Evidence of errors 49
Examples 63
Calculating interfacial tension 79
Linked flashes 69
Matching 72
Index 81
Phase envelope 68
Pure component properties 63
PVT Analysis 76
Simple tutorial 10
Stored properties of a pure component 65
Stream types 70
UNIFAC fitting 77
VLE fitting 79
Examples provided 63
Excel
Array functions 47
Different editions of 9
Different versions of 9
Testing the interface 4
F
Feed composition 26
Files supplied 9
Fixed enthalpy line(MF_HPHENV) 30
Fixed entropy line (MF_SPHENV) 30
Fixed internal energy line (MF_UPHENV) 31
Fixed phase fraction flash at fixed pressure
(MF_PFRACF) 27
Fixed phase fraction flash at fixed temperature
(MF_TFRACF) 28
Fixed phase fraction flash calculations 27
Fixed volume line (MF_VPHENV) 31
Fixed wax phase fraction flash at fixed pressure
(MF_PWAT) 27
fixed_phase 41
Flash at fixed enthalpy and entropy (MF_HSF) 30
Flash at fixed entropy and volume or density
(MF_SVF) 30
Flash at fixed internal energy and volume or density
(MF_UVF) 29
Flash at fixed pressure and enthalpy (MF_PHF) 28
Flash at fixed pressure and entropy (MF_PSF) 28
Flash at fixed pressure and internal energy
(MF_PUF) 29
Flash at fixed pressure and temperature (MF_PTF) 28
Flash at fixed pressure and volume or density
(MF_PVF) 29
Flash at fixed temperature and enthalpy (MF_THF)
28
Flash at fixed temperature and entropy (MF_TSF) 28
Flash at fixed temperature and internal energy
(MF_TUF) 29
Flash at fixed temperature and volume or density
(MF_TVF) 29
Flash calculations 28
Flash functions 28, 46
At constant enthalpy and entropy 30
At constant entropy and volume 30
At constant internal enery and volume 29
At constant pressure and internal energy 29
At constant temperature and internal energy 29
At constant temperature and enthalpy flash 28
At constant temperature and entropy flash 28
At constant volume flash 29
82 Index
Bubble point 26
Dew point 27
Fixed phase fraction flashes 27
Isenthalpic flash 28
Isentropic flash 28
Isochoric flash 29
Isothermal flash 28
fraction 42
Function wizard 20
Function Wizards 20
G
General information 9
Getting started 10
Getting technical support 6
H
Hardware requirements 1
Help 59
Technical support 61
How to create an initialisation script to define a new
problem 15
I
init_script 36
init_var 43
Initialisation argument for all the functions 36
Initialisation script 10, 15, 25, 70
Input units 34
Input units (MF_IU) 34
Installation 1
Excel interface 3
Installing the RLM software scurity system 1
Installing the software protection device 2
Multiflash program 1
Software protection device 2
Installing the Multiflash Excel interface 3
Installing the Multiflash program 1
Installing the RLM software security system 1
Installing the software protection device 2
Interface specification 25
Interfaces 9
Interfaces provided 9
Interfacial tension 79
internalenergy 41
Introduction 1, 7, 55, 59
ion 44
Ion ratio calculator
defined salinity ion concentrations as input 31
defined salinity salt mass fractions as input 32
defined salinity salt molalities as input 32
defined salinity salt mole fractions as input 32
defined salinity total dissolved salt as input 32
Multiflash ion names 32
Ion ratio calculator for defined salinity - salt mass
fractions as input (MF_ION_MASS_FR) 32
L
Linked flashes 69
M
Matching 72
Mixed references 22
Molecular_weight 46
Multiflash functions 25, 26, 27, 28, 30, 31, 34, 35, 43,
45, 46
Arguments 39
BIPs 25
Component name 26
Component properties 26
Component temperature-dependent properties 26
Defining Multiflash functions 19
Feed composition 26
Flash calculations 25, 26, 27, 28, 30, 31, 34, 35, 43,
45, 46
Input units 34
Output units 34
Phase envelope 30, 31
Salinity calculator 33, 34
Setting up phase envelope function 48
summation 34
Tolerance calculation 34
unit conversion 34, 35
Version number 35
Multiflash ion names (MF_ION_INAM) 32
Multiflash version number 35
Multiflash version number (MF_VERS) 35
N
New features 7
New features and changes in Version 4.4 7
no_points 43
Notes 78
Numbers_To_Sum 46
O
Offset 39
On-line help 59
Other problems 52
Output units 34
Output units (MF_OU) 34
P
Phase envelope 30, 68
Example 68
Function 48
Phase envelope (MF_PHENV) 30
Phase envelope calculations 30
phase_wanted 39
Phases
Names of phases 39
pressure 41
prop_wanted 40
Properties 63
Calculation of Physical Properties 55
Constant physical properties 56
Properties list for a mixture 40
Pure component properties in a mixture 55
Pure component properties list 36
Temperature-dependent coefficients calculation 56
Temperature-dependent coefficients list 39
Temperature-dependent properties calculation 56
Pure component properties 63
Pure component properties in a mixture 55
PVT Analysis 76
Q
quantity 45
R
Range_To_Sum 46
Relative references 22
Removing Multiflash from your computer 5
S
Salinity calculator
ion concentrations as input 33
salt mass fractions as input 34
salt molalities as input 33
salt mole fractions as input 33
total dissolved salt as input 33
Salinity calculator - ion concentrations as input
(MF_SAL_IC) 33
Salinity calculator - salt mass fractions as input
(MF_SAL_MASS_FR) 34
Salinity calculator - salt molalities as input
(MF_SAL_MOLAL) 33
Salinity calculator - salt mole fractions as input
(MF_SAL_MOLE_FR) 33
Salinity calculator - total dissolved salt as input
(MF_SAL_TDS) 33
Salt calculator 31
salt_ids 44
salt_mass_fracs 45
salt_molalities 45
salt_mole_fracs 45
Setting up flash functions as array functions 46
Setting up the phase envelope function 48
skip_no 43
Index 83
VLEFIT.xls 79
volume 41
T
TDS 44
Technical support 6, 61
Temp_order 39
temperature 41
Temperature-dependent Component properties
function (MF_PDAT_T) 26
Temperature-dependent correlation coefficients of a
pure component or petroleum fraction 56
Temperature-dependent property of a pure
component or petroleum fraction 56
Testing the Multiflash Excel Interface 4
The column headings for phase
envelope(MF_PHENV_COLS) 30
The command `include' 53
Thermal conductivity 46
Tolerance calculation 34
Tolerance calculation for fixed phase fraction
(MF_FRACT) 34
Troubleshooting 49
Dealing with Multiflash errors 49
Evidence of errors 49
Typing in Multiflash functions 19
U
UNIFAC 78
UNIFACFIT.xls 77
Unit conversion for density (MF_UND) 34
Unit conversion for enthalpy (MF_UNH) 35
Unit conversion for entropy (MF_UNS) 35
Unit conversion for pressure (MF_UNP) 35
Unit conversion for surface tension (MF_UNST) 35
Unit conversion for temperature (MF_UNT) 35
Unit conversion for thermal conductivity
(MF_UNTC) 35
Unit conversion for viscosity (MF_UNVIS) 35
Units and conversion functions 34
Using the Multiflash Excel interface 15
V
Viscosity 46
84 Index