﻿

# EXCEL basic tutorial with examples

Télécharger EXCEL basic tutorial with examples

#### Formation Excel en ligne par vidéo

205 leçons vidéos + 20 Livres PDF + 20 TP + Sous supervision + Certificat de réussite à la fin du cours

★★★★★★★★★★3.5 étoiles sur 5 basé sur 1 votes.
Votez ce document:

### Télécharger aussi :

User Guide for

Multiflash Excel Interface

Version 4.4

February 2014

Unit 4, The Flag Store

23 Queen Elizabeth Street

London SE1 2LP

Tel: +44 [0]20 7357 0800

Fax: +44 [0]20 7407 3927 e-mail:

This User Guide and the information contained within is the copyright of Infochem Computer Services Ltd.

Unit 4, The Flag Store

23 Queen Elizabeth Street

London SE1 2LP, UK

Tel:+44 [0]20 7357 0800

Fax:+44 [0]20 7407 3927

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

Contents       iii

Component name and feed functions 26 Component name (MF_COMP) ..26

Component feed composition (MF_FEED) 27

Component properties functions .27 Component properties function (MF_PDAT) ..27

Temperature-dependent Component properties function (MF_PDAT_T) .27

Dew point calculations .27 Dew point at fixed pressure (MF_PDEWF) ..27

Dew point at fixed temperature (MF_TDEWF) ..28

Fixed phase fraction flash calculations 28 Fixed phase fraction flash at fixed pressure (MF_PFRACF) 28 Fixed wax phase fraction flash at fixed pressure (MF_PWAT) ..28

Fixed phase fraction flash at fixed temperature (MF_TFRACF) 29

Flash calculations 29 Flash at fixed pressure and temperature (MF_PTF) ..29 Flash at fixed pressure and enthalpy (MF_PHF) .29 Flash at fixed temperature and enthalpy (MF_THF) .29 Flash at fixed pressure and entropy (MF_PSF) 29 Flash at fixed temperature and entropy (MF_TSF) 30 Flash at fixed pressure and volume or density (MF_PVF) .30 Flash at fixed temperature and volume or density (MF_TVF) .30 Flash at fixed pressure and internal energy (MF_PUF) 30 Flash at fixed temperature and internal energy (MF_TUF) 31 Flash at fixed internal energy and volume or density (MF_UVF) ..31 Flash at fixed entropy and volume or density (MF_SVF) ..31

Flash at fixed enthalpy and entropy (MF_HSF) ..31

Phase envelope calculations ..31 Phase envelope (MF_PHENV) .32

The column headings for phase envelope(MF_PHENV_COLS) 32

Fixed enthalpy line(MF_HPHENV) ..32 Fixed entropy line (MF_SPHENV) 32 Fixed volume line (MF_VPHENV) ..32

Fixed internal energy line (MF_UPHENV) ..33

Salt calculator ..33

Ion ratio calculator for defined salinity – ion concentrations as input

(MF_ION_IC) ..33 Multiflash ion names (MF_ION_INAM) 34 Ion ratio calculator for defined salinity - salt mass fractions as input

(MF_ION_MASS_FR) .34

Ion ratio calculator for defined salinity - salt molalities as input

(MF_ION_MOLAL) .34

Ion ratio calculator for defined salinity - salt mole fractions as input

(MF_ION_MOLE_FR) 34

Ion ratio calculator for defined salinity - total dissolved salt as input

(MF_ION_TDS) ..35

Salinity calculator – ion concentrations as input (MF_SAL_IC) 35 Salinity calculator – total dissolved salt as input (MF_SAL_TDS) 35

Salinity calculator – salt molalities as input (MF_SAL_MOLAL) 36 Salinity calculator – salt mole fractions as input (MF_SAL_MOLE_FR) .36

Salinity calculator – salt mass fractions as input (MF_SAL_MASS_FR) ..36

Sum of squares function .36

Sum of squares of N cells(MF_SUMSQN) 37

Tolerance calculation 37

Tolerance calculation for fixed phase fraction (MF_FRACT) .37

Units and conversion functions 37 Input units (MF_IU) ..37 Output units (MF_OU) .37 Unit conversion for density (MF_UND) .38 Unit conversion for enthalpy (MF_UNH) ..38

Unit conversion for pressure (MF_UNP) 38

iv       Contents

Unit conversion for entropy (MF_UNS) .38 Unit conversion for surface tension (MF_UNST) ..38 Unit conversion for temperature (MF_UNT) 38 Unit conversion for thermal conductivity (MF_UNTC) ..38

Unit conversion for viscosity (MF_UNVIS) .39

Multiflash version number .39

Multiflash version number (MF_VERS) .39

Initialisation argument for all the functions ..39 init_script .39

Arguments for BIP function .39 Comp_no_1 39

Comp_no_2 39 BIP_set .40 BIP_no ..40

Arguments for component properties function 40 Comp_prop .40 Offset .43

Temp_order 43

Arguments for flash functions .43 phase_wanted 43 prop_wanted ..44 comp_no ..45 pressure .45 temperature .45 enthalpy 45 entropy ..45 volume ..45 internalenergy 45 fixed_phase .45 basis 46 fraction .46 amounts 46 amounts(1) ..47 amounts(2) ..47 init_var .47 direction 47 no_points .47 skip_no .47 stream_type 47 starting_press .47 starting_temp .48

Arguments for Salt calculator ..48 ion_type 48 ion 48 ion_ids ..48 ion_concs .48 sp_gravity 49 TDS 49 salt_ids ..49 salt_molalities 49 salt_mole_fracs .49 salt_mass_fracs .49

Arguments for units and conversion functions 50 quantity .50 Convert_from 50 Convert_to ..50 Molecular_weight 50 Surface tension .50 Thermal conductivity .50

Viscosity ..51

Contents      v

Arguments for sum of squares function ..51 Range_To_Sum 51

Numbers_To_Sum ..51

Setting up flash functions as array functions 51 Defining input arrays .51 Defining a flash function as an array function in Excel 52

Defining starting values for array flash functions ..52

Setting up the phase envelope function ..53

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

Calculation of Physical properties                                                                     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

Examples provided 69 Pure component properties 69 Stored properties of a pure component 72 Phase envelope .74 Linked flashes ..76 Stream types .77 Matching .78 PVT Analysis 82

..83 Notes ..84 UNIFAC ..84

Activity model worksheets .84 85

Interfacial tension ..85

Index                                                                                                                           87

vi       Contents

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.

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.

To install Multiflash on your computer run the Setup program as described in the Installation Guide for Multiflash for Windows. Setup installs Multiflash itself, the HELP system, Infochem databanks, the standard model configuration files, sample problem setup files, the Excel interface and associated files.

A list of the files that are copied to your computer can be found in the file in the Multiflash directory.

From Multiflash 3.9.13 onwards, Multiflash is issued with a software licensing system that uses license files. The software licensing system developed by Reprise Software is called RLM (Reprise License Manager).

Infochem has also developed a piece of software to make the licensing system easy to manage. This is the Multiflash license manager which can be used to configure RLM or to switch the license control to the USB dongle.

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.

Multiflash is still supplied with a hardware key. The key must be present in the parallel or USB port of your PC when the program is running. Simply insert the key into the parallel or USB port, making sure that a secure connection is made. The direction of connection to the computer is shown by the arrows on the key. 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.

Windows requires a port driver and server to enable the security device to function. The port driver and server software is supplied on CD-ROM under the directory Sentinel/Installer with its own installation instructions.

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.

Multiflash needs to use a number of data files which are listed below:

 Databank for fluid components Index for above Displays for Multiflash GUI Index for above Error message file Index for error file DIPPR databank ( optional ) Index for above BIP databank ( VLE ) BIP databank index (VLE) BIP databank ( LLE ) BIP databank index (LLE)

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.

Since Multiflash version 4.4, the Excel Interface shows a different menu in the Excel toolbar. Instead of MF, “Multiflash Add-in” will be shown.

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.

3.    Click on the Browse button.

4.    Select the directory in which you installed Multiflash (the default is \Program Files\Infochem\MF44 or \Program Files(x86)\Infchem\MF44 for Windows 7) and select the addin .

5.    Click on OK and Multiflash-Excel XLL should be added to the list of Add-ins available and should have a tick mark next to it.

To install the Multiflash add-in in Excel 2007 onwards:

1.    Start Excel

2.    Click “File” menu and “Options”

3.    On the Options dialogue box click “Add-ins” in the left hand side list.

4.    In the “Manage” drop down box select “Excel Add-ins” and click “Go”.

5.    Click “Browse”

6.    Select the directory in which you installed Multiflash (the default is \Program Files\Infochem\MF44 or \program Files(x86)\Infochem\MF44 for 64 bit Windows versions) and select the add-in .

7.    Click on OK and Multiflash-Excel XLL should be added to the list of Add-ins available and should have a tick mark next to it.

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.    Start Excel. The MF menu item will be present.

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.    Restart Excel. The MF menu item should not be present.

5.    Now follow the instructions above to install the new Multiflash Excel add-in.

Since Version 4.4 of Multiflash, 64bit versions of Excel are supported as well. To find which version of Excel is running follow this procedure: ? Launch Excel

•    Launch the task manager and click the “processes” tab.

•    Search for “” in the image name. If is shown with a “*32” next to it, the 32bit version is running, otherwise it is the 64bit

To install the Excel Add-in the 64bit versions of Excel, follow the procedure for 32bit versions listed above and replace “” with “”.

After installing the Excel add-in it is recommended that you test that it is operating correctly.

1.    Install the add-in as described above.

2.    Start Excel and open the sample file which is installed in the Multiflash directory under the subdirectory “MFL Files”. This is a simple example of a flash calculation at specified temperature and pressure.

3.    Select the MF menu item and click on Load. A message giving the version of the Multiflash Excel add-in should be displayed. Click on OK.

4.    A dialogue box with the message ‘Please enter the range containing the initialisation string’ will be displayed next. Drag in the spreadsheet to select the range \$A\$1:\$A\$6 or type in the range.

5.    A message box should confirm that Multiflash has been successfully initialised.

6.    If Multiflash is not successfully initialised a list of error/warning numbers and messages will be displayed. If only numbers are displayed without any explanation this means that the error message files and cannot be found. To look up error numbers you can use the Help/Multiflash Error Codes menu item.

7.    If the add-in has successfully loaded you should be able to change the input conditions (temperature, pressure, composition) and the outputs will be recalculated. If the results are not recalculated check the calculation tab on the Tools/Options menu. If manual recalculation is selected you need to press F9 to make the spreadsheet recalculate.

To uninstall Multiflash:

1.    If the Excel add-in is installed, remove it as described above (in the installation section which describes how to replace an old version).

2.    Follow the instructions in the User Guide for Multiflash for Windows.

4 The Flag Store

23 Queen Elizabeth Street

London SE1 2LP

UK

Telephone:            +44 (0)20 7357 0800 Fax: +44 (0)20 7407 3927

Email:

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.

The main change in the Excel interface is that it now runs in 64 bit versions of Excel as well as 32bit versions.

New features and changes in Version 4.4

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 , whereas the 64 bit version of the interface is called . This add-in, in turn, uses the Multiflash DLL ( or ) to perform the physical property calculations.

The files for the Multiflash-Excel interface are listed in the file supplied on the Multiflash for Windows CD-ROM.

The Multiflash Excel Add-In has been designed as far as possible to work with all language editions of Excel. However, there are minor differences in the way the Multiflash functions are specified you need to be aware of.

The function definitions given here use the conventions of the English language editions of Excel where the full stop or period denotes a decimal place and the comma denotes an argument separator when defining functions. In many other language editions of Excel, the comma denotes a decimal point and the semicolon (;) denotes an argument separator. In these editions, wherever you see a comma in the definition of a Multiflash function in the manual, you should actually use a semi-colon instead.

The screen shots used as illustrations in this manual have been taken from different versions of Excel. Different versions of Excel may appear slightly different visually; however, the functionality described in the manual should be the same. Also the “MF” menu was replaced with “Multiflash Add-In”.

General information

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\”;

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\”;

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.

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       text A5 AMOUNTS

A6                AMOUNTS

A7                AMOUNTS

A8                PHASE

A9                TEMPERATURE

A10               PRESSURE

A11               ENTHALPY

A12               STATUS

C5                1

C6                2

C7                3

F4                OVERALL

G4                GAS

H4                WATER

I4                LIQUID1

Get the names of the components by typing in cell D5:

=MF_COMP(\$C5,\$A\$1:\$A\$3)

where \$C5 refers to the number of the component and \$A\$1:\$A\$3 to the cells containing the initialisation script which defines the problem. The third argument

General information

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.

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  text L4     OVERALL

M4                GAS

N4                WATER

O4                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

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.

All Multiflash functions in Excel must refer to the relevant initialisation script to work properly, as this script defines the problem Multiflash is to solve. The initialisation script may be a complete set of commands written directly into the spreadsheet, it may include an .MFL file to define the model with other commands written in the spreadsheet or with a complete definition of the problem. A useful way of defining an .MFL file is to set up the problem using Multiflash for Windows and then save the problem set-up.

You could set up your problem using Multiflash for Windows and save the problem definition in a file, say , which we will assume has been placed in a directory of your choice, say C:\MF. You can then make this file into your initialisation script by writing following instruction include “c:\MF\”; in a cell on the spreadsheet.

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\”; components methane ethane propane;

The ‘include’ command can be used as part of an initialisation script to include any file you wish. ‘include’ commands can also be nested in files. The full path including the drive letter for the directory where the file is located should be put between double quotes after ‘include’ command. For example, the initialisation script above uses the standard configuration file supplied for the Peng-Robinson equation, , which we have assumed has been placed in the directory “C:\Program Files\Infochem\MF”.

When Multiflash functions call for the init_script argument, all cells containing the initialisation script should be highlighted or identified. The initialisation script should also be given an absolute reference, see “Cell references” on page 22.

GUI

Clicking on this item launches a sub window

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

Clicking on OK writes the script, concatenated for efficiency, in the spreadsheet.

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.

To obtain component or unit names or to carry out flash calculations you must define the appropriate Multiflash function in the chosen cell. A full list of Multiflash functions is given in the “Interface specification” on page 25. The functions may be entered into the spreadsheet cells either by typing them in, by calling the function wizard or by copying them from other cells.

The example given in “Getting started” on page 10, enters the functions in cells by typing in the function definitions. For instance, the isothermal flash was defined in cell F5

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

=MF_PTF( phase_wanted, prop_wanted, comp_n/phase_wanted, pressure, temperature, amounts, init_script, stream_type ) and for this example:

F\$4 refers to the cells defining the first phase wanted

\$A5 refers to the cell defining the first property wanted

\$C5 refers to the cell defining the first component number or second phase wanted

\$E\$10 refers to the cell defining the pressure

\$E\$9 refers to the cell defining the temperature

\$E\$5:\$E\$7 refers to the cells defining the mixture composition \$A\$1:\$A\$3 refers to the cells defining the initialisation script, the additional stream_type argument can be used to specify any specific stream type for the overall input stream if these have been defined, perhaps with each described by a different model. If only one stream is involved in the flash calculation, stream_type may be omitted.

The use of the \$ sign for defining cell references is discussed in “Cell references” on page 22.

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:

The list of Multiflash functions will then be displayed

Highlight the function required, in this case MF_PTF followed by clicking on OK. The function wizard for MF_PTF will be activated.

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

You can define a new function by using copy and paste, or by dragging functions from one cell to another. Which argument definitions remain the same and which vary when these procedures are used will depend on whether the cell references are absolute or relative. For further information on cell references and how these are applied to Multiflash functions see “Cell references” on page 22.

A quick way of altering absolute or relative references to a cell or group of cells is to use the F4 function button.

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.

A reference such as A1 tells Excel how to find another cell, starting from the cell containing the formula.

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.

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.

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.

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.    Force Multiflash to reinitialise by selecting the ‘MF’ menu option and clicking ‘Load’. You will be prompted to give the location of the initialisation script.

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.

Returns a binary parameter with a pair of given components. The arguments are described in details in section ”Arguments for BIP function” on page 39.

=MF_BDAT( comp_no_1, comp_no_2, bip_set, bip_no, temp_order, init_script )

Performs a bubble point calculation at constant pressure. Optional arguments are shown in italics.

=MF_PBUBF( phase_wanted, prop_wanted, comp_no/phase_wanted, basis, pressure, amounts, init_script, stream_type, starting_temp )

Performs a bubble point calculation at constant temperature. Optional arguments are shown in italics.

=MF_TBUBF(phase_wanted, prop_wanted, comp_no/phase_wanted, basis, temperature, amounts, init_script, stream_type, starting_press )

Component name and feed functions

#### Component name (MF_COMP)

Returns the name of a component corresponding to a given component with or without a stream type.

#### =MF_COMP( comp_no, init_script, stream_type ) Component feed composition (MF_FEED)

Returns for a given component with or without a stream type the amount that is defined in the initialisation script. The result is given in the current input units for amounts.

=MF_FEED(comp_no, init_script, stream_type )

Component properties functions

#### Component properties function (MF_PDAT)

Returns constant physical properties coefficients of a pure component or petroleum fraction to a given component number. The argument description for the properties returned by this function is given in section “Arguments for component properties function” on page 40.

=MF_PDAT( comp_no, comp_prop, offset, init_script )

#### Temperature-dependent Component properties function (MF_PDAT_T)

Returns temperature-dependent properties of a pure component or petroleum fraction to a given component number

=MF_PDAT_T(comp_no, comp_prop, temperature, init_script )

Dew point calculations

#### Dew point at fixed pressure (MF_PDEWF)

Performs a dew point calculation at constant pressure. Optional arguments are shown in italics.

=MF_PDEWF( phase_wanted, prop_wanted, comp_no/phase_wanted, basis, pressure, amounts, init_script, stream_type, starting_temp )

#### Dew point at fixed temperature (MF_TDEWF)

Performs a dew point calculation at constant temperature. Optional arguments are shown in italics.

=MF_TDEWF(phase_wanted, prop_wanted, comp_no/phase_wanted, basis, temperature, amounts, init_script, stream_type, starting_press)

Fixed phase fraction flash calculations

#### Fixed phase fraction flash at fixed pressure (MF_PFRACF)

Performs a fixed phase fraction flash at constant pressure. Optional arguments are shown in italics.

=MF_PFRACF( phase_wanted, prop_wanted, comp_no/phase_wanted, fixed_phase, basis, pressure, fraction, amounts, init_script, stream_type, starting_temp )

#### Fixed wax phase fraction flash at fixed pressure (MF_PWAT)

Performs a fixed wax phase fraction flash at constant pressure. Optional arguments are shown in italics. The basis in this function only accepts either normal for mole fraction or normal_massfraction for mass fraction in the input. The basis option is related to the first argument for the phase_wanted. If it is specified as “overall”, it means that the fraction for the wax phase required is related to the total fluid. If it is the name of the liquid phase, e.g. “liquid” or “liquid1” depending on the liquid phases specified in the Multiflash initialisation script, the fixed phase fraction of wax is related to the liquid+wax phase.

=MF_PWAT( phase_wanted, prop_wanted, comp_no/phase_wanted, basis, pressure, fraction, amounts, init_script, stream_type, starting_temp)

#### Fixed phase fraction flash at fixed temperature (MF_TFRACF)

Performs a fixed phase fraction flash at constant temperature. Optional arguments are shown in italics.

=MF_TFRACF( phase_wanted, prop_wanted,

comp_no/phase_wanted, fixed_phase, basis, temperature, fraction, amounts, init_script, stream_type, starting_press)

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 )

#### Flash at fixed pressure and enthalpy (MF_PHF)

Performs a flash at fixed pressure and enthalpy. Optional arguments are shown in italics.

=MF_PHF(phase_wanted, prop_wanted, comp_no/ phase_wanted, pressure, enthalpy, amounts, init_script, stream_type, starting_temp)

#### Flash at fixed temperature and enthalpy (MF_THF)

Performs a flash at fixed temperature and enthalpy. Optional arguments are shown in italics.

=MF_THF(phase_wanted, prop_wanted, comp_no/ phase_wanted, temperature, enthalpy, amounts, init_script, stream_type, starting_press)

#### Flash at fixed pressure and entropy (MF_PSF)

Performs a flash at fixed pressure and entropy. Optional arguments are shown in italics.

=MF_PSF(phase_wanted, prop_wanted, comp_no/ phase_wanted, pressure, entropy, amounts, init_script, stream_type, starting_temp)

#### Flash at fixed temperature and entropy (MF_TSF)

Performs a flash at fixed temperature and entropy. Optional arguments are shown in italics.

=MF_TSF(phase_wanted, prop_wanted, comp_no/ phase_wanted, temperature, entropy, amounts, init_script, stream_type, starting_press)

#### Flash at fixed pressure and volume or density (MF_PVF)

Performs a flash at fixed pressure and volume/density. Optional arguments are shown in italics.

=MF_PVF(phase_wanted, prop_wanted, comp_no/ phase_wanted, pressure, volume, amounts, init_script, stream_type, starting_temp)

#### Flash at fixed temperature and volume or density (MF_TVF)

Performs a flash at fixed temperature and volume/density. Optional arguments are shown in italics.

=MF_TVF(phase_wanted, prop_wanted, comp_no/ phase_wanted, temperature, volume, amounts, init_script, stream_type, starting_press)

#### Flash at fixed pressure and internal energy (MF_PUF)

Performs a flash at fixed pressure and internal energy. Optional arguments are shown in italics.

=MF_PUF(phase_wanted, prop_wanted, comp_no/ phase_wanted, pressure, internalenergy, amounts, init_script, stream_type, starting_temp)

#### Flash at fixed temperature and internal energy (MF_TUF)

Performs a flash at fixed temperature and internal energy. Optional arguments are shown in italics.

=MF_TUF(phase_wanted, prop_wanted, comp_no/ phase_wanted, temperature, internalenergy, amounts, init_script, stream_type, starting_press)

#### Flash at fixed internal energy and volume or density (MF_UVF)

Performs a flash at fixed internal energy and volume/density. Optional arguments are shown in italics.

=MF_UVF(phase_wanted, prop_wanted, comp_no/ phase_wanted, internalenergy,volume, amounts, init_script, stream_type, starting_press, starting_temp)

#### Flash at fixed entropy and volume or density (MF_SVF)

Performs a flash at fixed entropy and volume/density. Optional arguments are shown in italics.

=MF_SVF( phase_wanted, prop_wanted, comp_no/ phase_wanted, entropy, volume, amounts, init_script, stream_type, starting_press, starting_temp )

#### Flash at fixed enthalpy and entropy (MF_HSF)

Performs a flash at fixed enthalpy and entropy. Optional arguments are shown in italics.

=MF_HSF(phase_wanted, prop_wanted, comp_no/ phase_wanted,enthalpy, entropy, amounts, init_script, stream_type, starting_press, starting_temp)

Phase envelope calculations

#### Phase envelope (MF_PHENV)

Traces a phase line or boundary for fixed phase fraction. This is an array function. See “Setting up the phase envelope function” on page 53 for information about how to set up the phase envelope function as an array. Optional arguments are shown in italics.

=MF_PHENV( fixedphase, basis, init_var, direction, pressure, temperature, fraction, amounts, no_points, skip_no, init_script, stream_type )

#### The column headings for phase envelope(MF_PHENV_COLS)

Returns the column headings for phase envelope routines. This is an array function. See “Setting up the phase envelope function” on page 53 for information about how to set up the phase envelope function as an array. Optional arguments are shown in italics.

=MF_PHENV_COLS(init_script, stream_type)

#### Fixed enthalpy line(MF_HPHENV)

Traces a line of fixed enthalpy. This is an array function. See “Setting up the phase envelope function” on page 53 for information about how to set up MF_HPHEN function as an array. Optional arguments are shown in italics.

=MF_HPHENV( init_var, direction, pressure, temperature, enthalpy, amounts, no_points, skip_no, init_script, stream_type )

#### Fixed entropy line (MF_SPHENV)

Traces a line of fixed entropy. This is an array function. See “Setting up the phase envelope function” on page 53 for information about how to set up

MF_HPHEN function as an array. Optional arguments are shown in italics.

=MF_SPHENV(init_var, direction, pressure, temperature, entropy, amounts, no_points, skip_no, init_script, stream_type )

#### Fixed volume line (MF_VPHENV)

Traces a line of fixed volume. This is an array function. See “Setting up the phase envelope function” on page 53 for information about how to set up MF_HPHEN function as an array. Optional arguments are shown in italics.

=MF_VPHENV(init_var, direction, pressure, temperature, volume, amounts, no_points, skip_no, init_script, stream_type )

#### Fixed internal energy line (MF_UPHENV)

Traces a line of fixed internal energy. This is an array function. See “Setting up the phase envelope function” on page 53 for information about how to set up MF_HPHEN function as an array. Optional arguments are shown in italics.

=MF_UPHENV(init_var, direction, pressure, temperature, internalenergy, amounts, no_points, skip_no, init_script, stream_type )

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.

#### Ion ratio calculator for defined salinity – ion concentrations as input (MF_ION_IC)

Calculates the ion ratio to add to water that will give the same inhibition effect on gas hydrate or ice formation as a saline solution with ion concentrations as specified. Returns the ion ratio to be added per mole of water if the input units for amounts are currently set to molar units; returns the mass (weight) of ions to 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 )

#### Multiflash ion names (MF_ION_INAM)

Return array of names of cations or anions recognised by the electrolyte model.

=MF_ION_INAM( ion_type, init_script )

#### Ion ratio calculator for defined salinity - salt mass fractions as input (MF_ION_MASS_FR)

Calculates the ion ratio to add to water that will give the same inhibition effect on gas hydrate or ice formation as a saline solution with salt mass (weight) fractions as specified. Returns the ion ratio to be added per mole of water if the input units for amounts are currently set to molar units; returns the mass (weight) of ions to be added per unit mass (weight) of water if the input units for amounts are currently set to mass units.

=MF_ION_MASS_FR(ion, salt_ids, salt_mass_fracs, init_script )

#### Ion ratio calculator for defined salinity - salt molalities as input (MF_ION_MOLAL)

Calculates the ion ratio to add to water that will give the same inhibition effect on gas hydrate or ice formation as a saline solution with salt molalities as specified. Returns the ion ratio to be added per mole of water if the input units for amounts are currently set to molar units; returns the mass (weight) of ions to be added per unit mass (weight) of water if the input units for amounts are currently set to mass units.

=MF_ION_MOLAL(ion, salt_ids, salt_molalities, init_script)

#### Ion ratio calculator for defined salinity - salt mole fractions as input (MF_ION_MOLE_FR)

Calculates the ion ratio to add to water that will give the same inhibition effect on gas hydrate or ice formation as a saline solution with salt mole fractions as specified. Returns the ion ratio to be added per mole of water if the input units for amounts are currently set to molar units; returns the mass (weight) of ions to be added per unit mass (weight) of water if the input units for amounts are currently set to mass units.

=MF_ION_MOLE_FR(ion, salt_ids, salt_mole_fracs init_script )

#### Ion ratio calculator for defined salinity - total dissolved salt as input (MF_ION_TDS)

Calculates the ion ratio to add to water that will give the same inhibition effect on gas hydrate or ice formation as a saline solution with total dissolved salt as specified. Returns the ion ratio to be added per mole of water if the input units for amounts are currently set to molar units; returns the mass (weight) of ions to 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 )

#### Salinity calculator – ion concentrations as input (MF_SAL_IC)

Calculates the amount of ‘salt component’ to add to water that will give the same inhibition effect on gas hydrate or ice formation as a saline solution with ion concentrations as specified. Returns the number of moles of ‘salt component’ to be added per mole of water if the input units for amounts are currently set to molar units; returns the mass (weight) of ‘salt component’ to be added per unit mass (weight) of water if the input units for amounts are currently set to mass units.

=MF_SAL_IC( ion_ids, ion_concs, sp_gravity, init_script )

#### Salinity calculator – total dissolved salt as input (MF_SAL_TDS)

Calculates the amount of ‘salt component’ to add to water that will give the same inhibition effect on gas hydrate or ice formation as a saline solution with total dissolved salt as specified. Returns the number of moles of ‘salt component’ to be added per mole of water if the input units for amounts are currently set to molar units; returns the mass (weight) of ‘salt component’ to be added per unit mass (weight) of water if the input units for amounts are currently set to mass units.

=MF_SAL_TDS(TDS, sp_gravity, init_script )

#### Salinity calculator – salt molalities as input (MF_SAL_MOLAL)

Calculates the amount of ‘salt component’ to add to water that will give the same inhibition effect on gas hydrate or ice formation as a saline solution with salt molalities as specified. Returns the number of moles of ‘salt component’ to be added per mole of water if the input units for amounts are currently set to molar units; returns the mass (weight) of ‘salt component’ to be added per unit mass (weight) of water if the input units for amounts are currently set to mass units.

=MF_SAL_MOLAL(salt_ids, salt_molalities, init_script )

#### Salinity calculator – salt mole fractions as input (MF_SAL_MOLE_FR)

Calculates the amount of ‘salt component’ to add to water that will give the same inhibition effect on gas hydrate or ice formation as a saline solution with salt mole fractions as specified. Returns the number of moles of ‘salt component’ to be added per mole of water if the input units for amounts are currently set to molar units; returns the mass (weight) of ‘salt component’ to be added per unit mass (weight) of water if the input units for amounts are currently set to mass units.

=MF_SAL_MOLE_FR( salt_ids, salt_mole_fracs, init_script )

#### Salinity calculator – salt mass fractions as input (MF_SAL_MASS_FR)

Calculates the amount of ‘salt component’ to add to water that will give the same inhibition effect on gas hydrate or ice formation as a saline solution with salt mass (weight) fractions as specified. Returns the number of moles of ‘salt component’ to be added per mole of water if the input units for amounts are currently set to molar units; returns the mass (weight) of ‘salt component’ to be added per unit mass (weight) of water if the input units for amounts are currently set to mass units.

=MF_SAL_MASS_FR( salt_ids, salt_mass_fracs, init_script )

Sum of squares function

#### Sum of squares of N cells(MF_SUMSQN)

Returns the value of the sum of squares for given N cells in range.

=MF_SUMSQN( Range_To_Sum, Numbers_To_Sum, init_script )

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 )

Units and conversion functions

#### Input units (MF_IU)

Returns the name of the current input units for a given quantity.

=MF_IU( quantity, init_script )

Output units (MF_OU)

Returns the name of the current output units for a given quantity.

#### =MF_OU( quantity, init_script ) Unit conversion for density (MF_UND)

Returns the value of the converted density for given units.

=MF_UND(density, convert_from, convert_to, molecular_weight, init_script)

#### Unit conversion for enthalpy (MF_UNH)

Returns the value of the converted enthalpy for given units.

=MF_UNH(enthalpy, convert_from, convert_to, molecular_weight, init_script)

#### Unit conversion for pressure (MF_UNP)

Returns the value of the converted pressure for given units.

=MF_UNP( pressure, convert_from, convert_to, init_script )

#### Unit conversion for entropy (MF_UNS)

Returns the value of the converted entropy for given units.

=MF_UNS( entropy, convert_from, convert_to, molecular_weight, init_script )

#### Unit conversion for surface tension (MF_UNST)

Returns the value of the converted pressure for given units.

=MF_UNST( surface_tension, convert_from, convert_to, init_script )

#### Unit conversion for temperature (MF_UNT)

Returns the value of the converted temperature for given units.

=MF_UNT( temperature, convert_from, convert_to, init_script )

#### Unit conversion for thermal conductivity (MF_UNTC)

Returns the value of the converted thermal conductivity for given units.

=MF_UNTC( therm_conductivity, convert_from, convert_to, init_script )

#### Unit conversion for viscosity (MF_UNVIS)

Returns the value of the converted thermal conductivity for given units.

=MF_UNVIS( viscosity, convert_from, convert_to, init_script )

Multiflash version number

#### Multiflash version number (MF_VERS)

Returns the version number of Multiflash being accessed by Excel.

=MF_VERS( init_script )

Initialisation argument for all the functions

#### init_script

Array of strings up to 255 characters. The initialisation script is written in

Multiflash command language and defines the problem Multiflash will solve. All Multiflash functions must include the appropriate initialisation script as one of their arguments.

Arguments for BIP function

Comp_no_1

Integer. First component number for BIP set.

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.

Arguments for component properties function

#### Comp_prop

This refers to the physical properties of an individual pure component. String up to 40 characters. The constant physical properties of a component required as follows. The property units are given in parentheses where applicable. Units for other properties may be set by the UNITS or INPUTUNITS commands. It is important that the full name, as listed below, is used. Abbreviations are not accepted except for those given and MW (molecularweight)

 Molecularweight relative molar mass (molecular weight in g/mol) Tcrit critical temperature Pcrit critical pressure Vcrit critical volume Acentricfactor Pitzer acentric factor defined as Tboil normal boiling point Hformation standard enthalpy change on formation in the perfect gas state at 298.15K Sformation Entropy of formation Sstandard standard entropy in the perfect gas state at 298.15K and 1bar

 Tmelt normal melting point Hmelt enthalpy change on fusion at the melting point Smelt entropy change on fusion at the melting point Cpmelt solid/liquid difference in Cp at the melting point Vmelt solid/liquid difference in molar volume at the melting point Runiquac UNIQUAC r parameter Quniquac UNIQUAC q parameter Thlwater characteristic temperature for Henry’s Law correlation for component in water Vhlwater characteristic volume for Henry’s Law correlation for component in water Dipolemoment dipole moment (debye) Parachor parachor ( (dyne/cm)¼ cm3/mol ) Radgyr radius of gyration (m) Hocass Hayden O’Connell self association parameter Gformation Gibbs energy of formation in the perfect gas state at 298.15K and 1 bar Ttriple triple point temperature Ptriple triple point pressure Hcombustion enthalpy of combustion v25 molar volume at 298.15K for use with solubility parameters Solupar liquid phase solubility parameter Solidsolupar solid solution phase solubility parameter Zcrit critical compressibility factor Refractindex refractive index Tflash flash temperature Tauto autoignition temperature Flamlower lower flammability limit (volume % in air) Flamupper upper flammability limit (volume % in air) SG Specific gravity Expansivity Thermal expansivity of liquid at 1 atm and 60 F( K-1) OMARKS Scaling factor to give conventional value of ?a specific to RKS model. OMBRKS Scaling factor to give conventional value of ?b specific to RKS model. OMAPR Scaling factor to give conventional value of ?a specific to PR model. OMBPR Scaling factor to give conventional value of ?b specific to PR model. CNUMBER Carbon number for petroleum fractions. REFVISCOSITY Liquid viscosity at reference temperature and 1 atm ( Pa s). REFVISST reference viscosity for liquid at the boiling point for SUPERTRAPP viscosity model REFVISPD reference viscosity for liquid at the boiling point for Pedersen viscosity model REFVISTW reference viscosity for liquid at the boiling point for Two model REFVISLB reference viscosity for liquid at the boiling point for LBC model LJEVISC Lennard-Jones ?/k parameter for viscosity ( K)

 LJBVISC Lennard-Jones ? parameter ( m ) EOSC Corresponding states reference equation code TYPE Type of component HDATUM Options for calculating enthalpy 1  for compound 2  for elements 3  for standard enthalpy ( 298.15K ) SDATUM Options for calculating entropy 1  for compound 2  for elements 3  for standard entropy ( 298.15K, 1 bar ) MCRKS1 First Mathias Copeman parameter with eos RKSA MCRKS2 Second Mathias Copeman parameter with eos RKSA MCRKS3 Third Mathias Copeman parameter with eos RKSA MCPR1 First Mathias Copeman parameter with eos PRA MCPR2 Second Mathias Copeman parameter with eos PRA MCPR3 Third Mathias Copeman parameter with eos PRA HYDOC Hydrate cavity occupation codes HYD1 Hydrate parameter 1 HYD2 Hydrate parameter 2 HYD3 Hydrate parameter 3 ASSBETA CPA ? parameter ASSEPSILON CPA ?AB parameter ( J mol-1 ) ASSGAMMA CPA ?AB parameter ASSDELTA CPA ?AB parameter ( K-1 ) ASSFF Number of association sites ( CPA ) ASSAC CPA ac parameter ( J m3mol-2 ) ASSBC CPA b parameter ( m3 mol -1 ) ASSKAPPA CPA ?parameter SAFTKAPPA PC-SAFT ?parameter SAFTEPSILON PC-SAFT ? parameter SAFTGAMMA PC-SAFT ? parameter SAFTFF Number of association sites ( PC-SAFT ) SAFTEK PC-SAFT ?/k parameter SAFTSIGMA PC-SAFT ? parameter SAFTLAMBDA PC-SAFT ?parameter SAFTM PC-SAFT m parameter SAFTQ Charge of per segment SAFTFRQ Fraction of charge per segment VSRKS1 The first volume shift parameter with eos RKSA VSRKS2 The second volume shift parameter with eos RKSA VSRKS3 The third volume shift parameter with eos RKSA VSPR1 The first volume shift parameter with eos PRA VSPR2 The second volume shift parameter with eos PRA VSPR3 The third volume shift parameter with eos PRA CPIDLIQ Set to 1 to use the pure liquid enthalpy as reference for

excess energy models, set to 2 if you intend to use the gas activity coefficient model.

VCLBC               Critical volume for LBC viscosity model

The coefficients for the correlations of pure component temperature-dependent properties also can be obtained using MF_PDAT function. A new function MF_PDAT_T for directly obtaining the temperature-dependent properties of a pure component is available. The list of properties that are a function of temperature is given as follows. Coefficients are the numeric values of the correlation coefficients which depends on which EOS model is used.

 Cpideal Ideal gas Cp correlation ( J/mol K ) Psat Saturated vapour pressure (Pa) Hvap Enthalpy of vaporisation correlation (j/mol) Ldens Saturated liquid density correlation (mol/m3) Lvisc Liquid viscosity correlation ( Pa s) Vvisc Vapour viscosity correlation (Pa s) Lthcond Liquid thermal conductivity correlation (W/m K) Vthcond Vapour thermal conductivity correlation (W/m K) Stension Surface tension correlation ( N/m ) Cpliquid Liquid Cp correlation (J/mol K) Sdens Solid density correlation (mol/m3) Cpsolid Solid Cp correlation (J/mol K) Virialcoeff Second virial coefficient correlation (m3/mol)

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

Arguments for flash functions

The arguments for the Multiflash functions are as follows. All character strings are case-insensitive.

#### 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 gas/vapour phase LIQUID1 first hydrocarbon liquid phase LIQUID2 second hydrocarbon liquid phase WATER aqueous liquid phase ICE ice phase HYDRATE1 hydrate structure I phase HYDRATE2 hydrate structure II phase HYDRATEH hydrate structure H phase ASPHALTENE asphaltene phase WAX 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 Activity coefficient of a component in a phase. FUGCO Fugacity coefficient of a component in a phase. AMOUNTS concentration of a component in the phase requested as total amount FRACTIONS concentration of a component in the phase requested as mass/mole fraction PHASE total amount of that phase TEMPERATURE Temperature PRESSURE Pressure VOLUME (or DENSITY) volume/density ENTHALPY Enthalpy ENTROPY Entropy INTERNALENERGY internal energy GIBBS Gibbs energy ZFACTOR compressibility factor ENTHALPY_ELEM enthalpy relative to elements ENTROPY_ELEM entropy relative to elements INTERNALENERGY_ELEM internal energy relative to elements GIBBS_ELEM Gibbs energy relative to elements AVMOLWT average molecular weight CP Cp. CV Cv. SSOUND speed of sound VISCOSITY Viscosity THCOND thermal conductivity SURTEN surface tension COMPRESSIBILITY isothermal compressibility EXPANSIVITY isobaric expansivity JTCOEFF Get the value of the Joule-Thompson coefficient. STATUS success/error status of flash calculation

For flash calculations where ‘AMOUNTS’ or ‘FRACTIONS’ are specified, the argument comp_no is used to define which component is required. For all other properties, comp_no is ignored and can be left blank in either the cell or calling argument list.

If the requested property is SURTEN, and the selected model is the Linear Gradient Theory (LGST), the other phase name has to be provided in the comp_no/phase_wanted field.

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 user’s default settings which are defined in file . 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.

#### basis

String up to 40 characters. Type of calculation as follows:

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.

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

Arguments for Salt calculator

#### ion_type

String up to 40 characters. Specifies which kind of ion to return, can be set to either ‘CATIONS’ or ‘ANIONS’.

#### 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 solution’s 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:

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

Arguments for units and conversion functions

#### quantity

String up to 40 characters. Quantities are used as inputs to the input and output units functions. They may be one of the following:

AMOUNTS                                                     phase/component amounts

TEMPERATURE                                            Temperature

PRESSURE                                                     Pressure

VOLUME (or DENSITY)                              volume/density

ENTHALPY(or INTERNALENERGY)              enthalpy/internal energy/Gibbs energy (or GIBBS)

ENTROPY (or Cp or Cv)                               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.

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

Arguments for sum of squares function

#### Range_To_Sum

The range of cells. This argument defines the range of cells which will be used in the summation of squares function.

#### Numbers_To_Sum

Integer. This argument defines the number of cells which will be used in the summation of squares function.

Setting up flash functions as array functions

All the flash functions can be made to return results as one or two dimensional arrays. To do this the user must define one or two of the following input arguments as arrays:

phase_wanted prop_wanted and comp_no

pressure temperature enthalpy entropy volume internalenergy fraction

and then the user must signify to Excel that the flash function is to be treated as an array function.

#### Defining input arrays

If all the above-mentioned input arguments are scalars, i.e. not arrays, the flash function will be scalar also, i.e. it can be treated as a normal Excel function that is placed in a single cell.

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.

#### Defining a flash function as an array function in Excel

To achieve computational efficiency, it may be advantageous to define functions as arrays when possible, but recent evidence does not indicate any major benefit. This can be done 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.

#### Defining starting values for array flash functions

Some of the flash functions can optionally be given a starting value for the calculated pressure or temperature (starting_press or starting_temp). The flash functions MF_UVF and MF_HSF can optionally be given starting values for both pressure and temperature. In general, if the flash function in question is defined as an array, the starting values, if supplied, should also be defined as an array. The starting values should match the flash constraints which are:

pressure temperature enthalpy entropy volume internalenergy fraction

If all the above-mentioned constraints are scalars, i.e. not arrays, the starting values should be scalar also.

If any one of the above-mentioned constraints is a one-dimensional or twodimensional array, then starting values should also be an array of values with the same number of rows and columns.

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.

Setting up the phase envelope function

The phase envelope function always returns results as an array. The array always has three columns and as many rows as given by the value of the argument

‘no_points’. To perform a phase envelope calculation, first define the function in a single cell in the block using the function wizard if desired. Then click on the cell where you have defined the function, highlight the entire block of cells for which you want the phase envelope function to return values, click on the formula bar and press Ctrl Shift Enter. Excel now displays the results of the phase envelope calculation as an array function over the highlighted block. If you click on another cell the highlighting disappears.

The results are displayed in three columns as follows: the first column contains the calculated temperatures in the currently set output units, the second column contains the calculated pressures in the currently set output units and the third column contains the status codes for the calculation in the top row and identifiers for any special points in subsequent rows. There are currently two identifiers, C for a critical point and D for a discontinuity, i.e. a point where the gradient of the line changes discontinuously. Each row contains a separate point on the phase envelope.

If you define an array that is too large, the phase envelope will fill the superfluous cells with Excel error values; if you define an array that is too small, the output is truncated to fill the defined cells only.

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.

Dealing with Multiflash errors

The three errors you are likely to see immediately in Excel are described and some methods of investigating the source of the problem suggested.

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

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 K 1 358.8548 OK 5 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! 20332 20028 344

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:

Troubleshooting

key liquid1 heaviest; key liquid2 lightest;

Remember to include these additional cells in the init_script argument in your function definition. You need to be aware that if compositions change markedly in a spreadsheet, labelling of liquid phases may also change. An example of a warning message is given in “Phase envelope” on page 74.

However, if #NUM! is reported for a complete series of calculations there could be several causes.

It is worth making sure that they are genuine errors for the current calculation by:

1.    Selecting MF/Clear to remove all existing calculations. For computational efficiency all calculations are "remembered" until you change the initialisation or use the Clear facility. This will ensure that no errors have been inadvertently retained from previous function definitions.

2.    Recalculate the spreadsheet by clicking on the initialisation script, placing the cursor on the formula bar and pressing enter.

If difficulties persist, it is also worth forcing Multiflash to reinitialise in order to check if there is some error in the initialisation script. To do this select the ‘MF’ menu item and click on ‘Load’. You will then be prompted to define the initialisation script you want to test. The ‘Load’ option displays a list of any error or warning codes and messages that Multiflash generates on loading the initialisation script.

For example, if the pathname for your .mfl file is incorrect then #NUM! will be displayed in the calculation cells and a reload will result in the display of a Multiflash error/warning box.

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.

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 STATUS bar K 1 #VALUE! OK 5 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

is generated because the ‘amounts’ argument is incorrectly defined as the component names not the component amounts.

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

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.

#### The command ‘include’

Sometimes Excel may not access the initialisation script correctly if the 'include' command is used but the full path for specifying the location of the file is not put between double quotes or does not include the drive letter. It is always preferable to use double quotes and the drive letter to specify the full path of the initialisation script when 'include' command is used.

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.

Pure component properties in a mixture

Generating properties of a pure component such as thermodynamic and transport properties at a given temperature and pressure, the Multiflash flash functions in Excel interface, e.g. MF_TBUBF, MF_PTF, MF_PBUBF etc have to be used. A typical Excel example is in which liquid properties on the saturation line and vapour properties of pure octane are calculated by using bubble point calculation function MF_TBUBF and isothermal flash MF_PTF. Part of the function wizard for MF_TBUBF is given below. The remaining arguments are the Amounts (to provide the composition, in this case 1) and the Initialisation script. The Stream type and starting pressure (used as an initial guess) are optional. The list of properties available with Multiflash are given in the section of “prop_wanted” on page 44.

Calculation of Physical properties

Constant physical properties of a pure component or petroleum fraction

The constant physical properties and temperature-dependent coefficients of a pure component or petroleum fraction can be obtained by using Multiflash function MF_PDAT. A spreadsheet used as an example is . The list of constant physical properties is given in the section of “Arguments for component properties function” on page 40. For the display of constant properties the Offset argument is optional and can be omitted or given a zero value.

Temperature-dependent correlation coefficients of a pure component or petroleum fraction

For the temperature-dependent correlations, the offset option has to be used to specify which coefficient is required. The coefficients available in Multiflash are listed in the section of “Arguments for component properties function” on page 40. The error number #NULL! or #NUM! may be returned if the properties or coefficients are not available for the component.

Temperature-dependent property of a pure component or petroleum fraction

56 ? Calculation of Physical properties                                                                 User Guide for Multiflash Excel Interface

The function MF_PDAT_T can be used to calculate the temperature–dependent property of a pure component or a petroleum fraction for any component in a mixture, for example calculating the saturated vapour pressure of component 1 at a given temperature. For more information about how to specify the argument Comp_prop, see the section of “Arguments for component properties function” on page 40.

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.

Calculation of Physical properties

Help

Introduction

Help is provided in three ways:

•    The printed User Guide

•    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

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                                                                                                                         User Guide for Multiflash Excel Interface

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

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:

Help

Examples

Examples provided

We have provided five examples of using Multiflash interfaced to Excel. These are

•    Generation of pure component physical properties

•    Phase envelope

•    Matching

•    PVT Analysis

•    VLE Data Fitting

•    Solids Prediction ? Interfacial Tension

Pure component properties

The Multiflash Excel interface is a very useful tool for generating tables of data. A simple example is to generate thermodynamic and transport properties of a pure component. The Excel spreadsheet used as an example is .

The initialisation script is provided by an .mfl file called 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 doesn’t 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\;"

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:

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.

The vapour properties were calculated similarly, based on isothermal flashes at low pressure. The amounts of gas and liquid phases are also calculated as a check that the component remains in the gas phase. As no liquid phase is formed at any of the conditions the amount is reported as not available (#N/A) i.e. it does not exist. This is different from a dew or bubble point calculation where the amount of liquid or gas is set to zero.

To look at any of the function definitions just click in a cell; to see the associated function wizard, click on the function wizard icon with the cell highlighted.

You can replace octane in the component definition with methanol and watch the spreadsheet calculate the properties of methanol.

Stored properties of a pure component

The constant physical properties and temperature-dependent coefficients of a pure component or petroleum fraction correlation can be obtained by using Multiflash function MF_PDAT. The spreadsheet used as an example is .

The initialisation script defines the model, in this case

Include "c:\program Files\Infochem\MF\;

and the component, in this case octane and a petroleum fraction defined using the Infochem petroleum fraction correlations.

Component 1 octane; petrofracs 2 C10 normal data cnumber 10.0 ;;

The script is in cells A1:A3. The constant properties are obtained by using function MF_PDAT as follows.

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 component defined. An Offset of 0 picks up the equation number of the correlation. An Offset of 1 picks up the first coefficient of the correlation, finishing with the temperature limits.

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.

The example show the BIPs for a methanol water example for the RKSA(Infochem) model

Phase envelope

The spreadsheet 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\"; 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.

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.

The Multiflash Excel interface can be used to investigate simple flowsheets, including linked flashes and recycles. The example shown, , is one of the simplest, consisting of two linked flashes.

Note that when the

initialisation script is written over several cells they must all be included when loading the script or identifying it in a function wizard.

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 ) to RKSA (defined by ) 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.

Note that when combining streams for linking flashes or recycles it is easier to define them in terms of total amounts rather than fractions.

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.

In a second worksheet in the spreadsheet we have added triethylene glycol (TEG) to the stream. We have also amended our simple flowsheet so that the water from the high pressure separator is removed, rather than recombined with the condensate, and this time recombined with the water stream from the low pressure separator.

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

Once the characterisation has been carried out you are returned to the main window. Using the Tools/Matching/Bubble point option

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.

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.

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.

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

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.

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 available for your chosen components, and then fit this data using another activity model.

#### Notes

The first spreadsheet consists of notes on how to use 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 databank to act as the source of pure component data, either

Infodata or DIPPR

•    The names of the two components for your binary pair

•    Whether you wish to generate data for an isotherm or isobar and your chosen temperature or pressure

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.

#### Activity model worksheets

All the model worksheets function in a similar manner. The component names, conditions, temperature or pressure are copied from the UNIFAC worksheet as are the phase equilibria data. The user enters initial guesses for the BIPs, a useful default is to start with 0.0 for both, and using the Excel Tools/Solver to start the fitting procedure. Once the best solution has been reached the new BIPs will be reflected in the cells used for starting guesses and in the cells reporting the fitted BIPs. One of the useful benefits of using Excel is that the results are plotted for comparison with the UNIFAC generated data allowing the user to decide easily whether the solution is acceptable. If the solution is not acceptable then you can try

•    starting with a different initial estimate for the BIPs

•    using a different criteria for minimisation. The default setting is to minimise on the sum of squares of the differences between given and predicted temperature or pressure. It is possible to minimise on differences in gas composition by changing the target cell in the Solver.

•    Change the constraints on the values for BIPs when fitting. We have set limits on the values the BIPs can take as part of the Tools/Solver utility. It is again possible to change this constraint using the Change button on the Solver text box.

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.

This is substantially the same as 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 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:

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 “” looks like for an example of interfacial tension between water and a reservoir fuild.

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

C

Calculation of Physical properties 55 Cell references 22 comp_no 41 Comp_no_1 36

Comp_no_2 36

Comp_prop 36

Component feed composition (MF_FEED) 26

Component name 26

Component name (MF_COMP) 26

Component name and feed functions 26

Component properties function (MF_PDAT) 26

Component properties functions 26

Constant physical properties of a pure component or petroleum fraction 56

Convert_from 45

Convert_to 45

Copying, dragging and pasting in functions 22

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

Matching 72

Index

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

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

Ion ratio calculator for defined salinity - salt molalities as input (MF_ION_MOLAL) 32

Ion ratio calculator for defined salinity - salt mole fractions as input (MF_ION_MOLE_FR) 32

Ion ratio calculator for defined salinity - total dissolved salt as input (MF_ION_TDS) 32

Ion ratio calculator for defined salinity - ion concentrations as input (MF_ION_IC) 31

ion_concs 44 ion_ids 44 ion_type 43

L

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

 Software protection device 2 sp_gravity 44 Starting values Array functions 47 Pressure 43 Temperature 43 starting_press 43 starting_temp 43 Stored properties of a pure component 65 Stream types 20, 43, 70 Example 70 stream_type 43 Sum of squares function 34 Sum of squares of N cells(MF_SUMSQN) 34 Surface tension 46 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

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

Index

9