multiflash excel interface

90
User Guide for Multiflash Excel Interface Infochem/KBC Advanced Technologies plc Version 4.4 February 2014 Infochem/KBC Advanced Technologies plc 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: [email protected]

Upload: raghib83

Post on 04-Oct-2015

577 views

Category:

Documents


47 download

DESCRIPTION

Multiflash for Excel

TRANSCRIPT

  • User Guide for

    Multiflash Excel Interface

    Infochem/KBC Advanced Technologies plc

    Version 4.4

    February 2014

    Infochem/KBC Advanced Technologies plcUnit 4, The Flag Store

    23 Queen Elizabeth StreetLondon SE1 2LP

    Tel: +44 [0]20 7357 0800Fax: +44 [0]20 7407 3927

    e-mail: [email protected]

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

    Infochem/KBC Advanced Technologies plcUnit 4, The Flag Store

    23 Queen Elizabeth StreetLondon SE1 2LP, UK

    Tel:+44 [0]20 7357 0800Fax:+44 [0]20 7407 3927

    e-mail:[email protected]

    Disclaimer

    While every effort has been made to ensure that the information contained in this document is correct and that thesoftware and data to which it relates are free from errors, no guarantee is given or implied as to their correctness oraccuracy. Neither Infochem Computer Services Ltd nor any of its employees, contractors or agents shall be liable fordirect, indirect or consequential losses, damages, costs, expenses, claims or fee of any kind resulting from anydeficiency, defect or error in this document, the software or the data.

  • User Guide for Multiflash Excel Interface Contents iii

    Contents

    Installation 1

    Introduction ...............................................................................................................................1Hardware requirements..............................................................................................................1Installing the Multiflash program ..............................................................................................1Installing the RLM software security system ............................................................................1Installing the software protection device ...................................................................................2Environment variables ...............................................................................................................2Databank path ............................................................................................................................2Installing the Multiflash Excel interface....................................................................................3

    64 bit versions of Excel ...............................................................................................4Testing the Multiflash Excel Interface.......................................................................................4Removing Multiflash from your computer ................................................................................5Getting technical support ...........................................................................................................6

    New features and changes in Version 4.4 7

    Introduction ...............................................................................................................................7New features ..............................................................................................................................7

    64 bit Excel..................................................................................................................7

    General information 9

    Interfaces provided ....................................................................................................................9Files supplied .............................................................................................................................9Different editions of Excel.........................................................................................................9Different versions of Excel ........................................................................................................9Getting started..........................................................................................................................10

    Using the Multiflash Excel interface 15

    How to create an initialisation script to define a new problem................................................15Defining the problem by launching the GUI .............................................................17

    Defining Multiflash functions..................................................................................................19Typing in Multiflash functions ..................................................................................19Function Wizards ......................................................................................................20Copying, dragging and pasting in functions ..............................................................22

    Cell references .........................................................................................................................22Relative references ....................................................................................................22Absolute references ...................................................................................................22Mixed references .......................................................................................................22

    Array functions ........................................................................................................................23

    Interface specification 25

    Initialisation script ...................................................................................................................25Binary interaction function ......................................................................................................25

    BIP function (MF_BDAT) ........................................................................................26Bubble point calculations.........................................................................................................26

    Bubble point at fixed pressure (MF_PBUBF) ...........................................................26Bubble point at fixed temperature (MF_TBUBF) .....................................................26

  • iv Contents User Guide for Multiflash Excel Interface

    Component name and feed functions.......................................................................................26Component name (MF_COMP) ................................................................................26Component feed composition (MF_FEED)...............................................................27

    Component properties functions ..............................................................................................27Component properties function (MF_PDAT) ...........................................................27Temperature-dependent Component properties function (MF_PDAT_T) ................27

    Dew point calculations.............................................................................................................27Dew point at fixed pressure (MF_PDEWF) ..............................................................27Dew point at fixed temperature (MF_TDEWF) ........................................................28

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

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

    Phase envelope calculations.....................................................................................................31Phase envelope (MF_PHENV)..................................................................................32The column headings for phase envelope(MF_PHENV_COLS) ..............................32Fixed enthalpy line(MF_HPHENV)..........................................................................32Fixed entropy line (MF_SPHENV)...........................................................................32Fixed volume line (MF_VPHENV) ..........................................................................32Fixed internal energy line (MF_UPHENV) ..............................................................33

    Salt calculator ..........................................................................................................................33Ion ratio calculator for defined salinity ion concentrations as input(MF_ION_IC) ...........................................................................................................33Multiflash ion names (MF_ION_INAM) ..................................................................34Ion ratio calculator for defined salinity - salt mass fractions as input(MF_ION_MASS_FR)..............................................................................................34Ion ratio calculator for defined salinity - salt molalities as input(MF_ION_MOLAL) .................................................................................................34Ion ratio calculator for defined salinity - salt mole fractions as input(MF_ION_MOLE_FR) .............................................................................................34Ion ratio calculator for defined salinity - total dissolved salt as input(MF_ION_TDS)........................................................................................................35Salinity calculator ion concentrations as input (MF_SAL_IC) ..............................35Salinity calculator total dissolved salt as input (MF_SAL_TDS)...........................35Salinity calculator salt molalities as input (MF_SAL_MOLAL) ...........................36Salinity calculator salt mole fractions as input (MF_SAL_MOLE_FR) ................36Salinity calculator salt mass fractions as input (MF_SAL_MASS_FR).................36

    Sum of squares function ..........................................................................................................36Sum of squares of N cells(MF_SUMSQN) ...............................................................37

    Tolerance calculation...............................................................................................................37Tolerance calculation for fixed phase fraction (MF_FRACT) ..................................37

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

  • User Guide for Multiflash Excel Interface Contents v

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

    Multiflash version number.......................................................................................................39Multiflash version number (MF_VERS) ...................................................................39

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

    Arguments for BIP function ....................................................................................................39Comp_no_1 ...............................................................................................................39Comp_no_2 ...............................................................................................................39BIP_set ......................................................................................................................40BIP_no.......................................................................................................................40

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

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

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

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

  • vi Contents User Guide for Multiflash Excel Interface

    Arguments for sum of squares function...................................................................................51Range_To_Sum.........................................................................................................51Numbers_To_Sum.....................................................................................................51

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

    Setting up the phase envelope function ...................................................................................53

    Troubleshooting 55

    Evidence of errors....................................................................................................................55Dealing with Multiflash errors.................................................................................................55

    Error #N/A.................................................................................................................56Error #NUM!.............................................................................................................56Error #VALUE!.........................................................................................................58Error #NULL!............................................................................................................59Other problems ..........................................................................................................59The command include.............................................................................................60

    Calculation of Physical properties 61

    Introduction .............................................................................................................................61Pure component properties in a mixture ..................................................................................61Constant physical properties of a pure component or petroleum fraction................................62Temperature-dependent correlation coefficients of a pure component or petroleumfraction.....................................................................................................................................62Temperature-dependent property of a pure component or petroleum fraction ........................63

    Help 65

    Introduction .............................................................................................................................65On-line help .............................................................................................................................65Technical support.....................................................................................................................67

    Examples 69

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

    Notes..........................................................................................................................84UNIFAC ....................................................................................................................84Activity model worksheets ........................................................................................84

    VLEFIT.xls..............................................................................................................................85Interfacial tension ....................................................................................................................85

    Index 87

  • User Guide for Multiflash Excel Interface Installation 1

    Installation

    IntroductionThis chapter contains information that will help you install and run Multiflashwith Excel on a Windows system. The 32 bit version of Multiflash will rununder Windows XP (or more recent versions) with Excel 97, Excel 2000, Excel2003, Excel 2007 & Excel 2010. To run Multiflash under Windows you mustinstall a Multiflash license server with a valid Multiflash license or a SentinelSoftware Protection driver and server for the security device. For further details,see the Multiflash installation guide.

    Hardware requirementsThe minimum requirement to run Multiflash is a PC capable of runningWindows XP (or more recent versions). A parallel or USB port is required if theMultiflash license is controlled by a security key.

    The program itself and associated files require about 28 Mb of disk storage. Upto 6 Mb of shared system files may be installed depending on which files arealready present on your computer.

    Installing the Multiflash programTo install Multiflash on your computer run the Setup program as described in theInstallation 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 fileFILELIST.TXT in the Multiflash directory.

    Installing the RLM software security systemFrom Multiflash 3.9.13 onwards, Multiflash is issued with a software licensingsystem that uses license files. The software licensing system developed byReprise Software is called RLM (Reprise License Manager).

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

  • 2 Installation User Guide for Multiflash Excel Interface

    The RLM server is installed by default but can be de-selected when the custominstallation option is selected during the installation. The Multiflash licensemanager is always installed with Multiflash. More information on how to runand use the program is described in the section RLM license system installationand management on page 17 of the Multiflash Installation guide.

    Installing the software protection deviceMultiflash is still supplied with a hardware key. The key must be present in theparallel or USB port of your PC when the program is running. Simply insert thekey 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 parallelport by plugging it into the back of the key.

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

    Environment variablesThe variables NSP_HOST and NSP_TIMEOUT can be used to control theoperation of the USB licensing system. They are described in the sectionsNetwork license server location and the Timeout of licenses on the InstallationGuide for Multiflash for Windows 4.4.

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

    Infodata.bin Databank for fluid components

    Infodata.idx Index for above

    Mflash.msg Displays for Multiflash GUI

    Mflash.mix Index for above

    Mflash.err Error message file

    Mflash.eix Index for error file

    Dippr.bin DIPPR databank ( optional )

    Dippr.idx Index for above

    Infobips.bin BIP databank ( VLE )

    infobips.idx BIP databank index (VLE)

    Infollbips.bin BIP databank ( LLE )

    infollbips.idx BIP databank index (LLE)

    These files are normally installed in the same directory as the Multiflashprogram. The Tools/Preferences/Folders menu option in the Multiflash GUI canbe used to change to contain location if you move these files.

  • User Guide for Multiflash Excel Interface Installation 3

    Installing the Multiflash Excel interfaceSince Multiflash version 4.4, the Excel Interface shows a different menu in theExcel 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 ofExcel from Excel 97 onwards. The Excel interface files are copied to theMultiflash installation directory by the setup program if a Typical installationis selected or if the Excel option is selected in the Custom installation. Notethat although you may copy the Excel interface files from the distribution CD-ROM the interface will only operate if you have licensed the Excel interfaceoption.

    To install the Multiflash add-in in Excel prior to 2007:

    1. Start Excel.

    2. Choose the Add-Ins from the Tools menu.

    3. Click on the Browse button.

    4. Select the directory in which you installed Multiflash (thedefault is \Program Files\Infochem\MF44 or \ProgramFiles(x86)\Infchem\MF44 for Windows 7) and select the add-in MFXL4432.xll.

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

    6. Click on OK to return to Excel. There should be a MF menuitem added to the Excel menu bar. This allows you to clear orload/reload the Multiflash add-in.

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

    4. In the Manage drop down box select Excel Add-ins andclick Go.

    5. Click Browse

    6. Select the directory in which you installed Multiflash (thedefault is \Program Files\Infochem\MF44 or \programFiles(x86)\Infochem\MF44 for 64 bit Windows versions) andselect the add-in MFXL4432.xll.

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

    8. You now have a Add-ins menu in Excel, inside which theMultiflash Add-In menu appears.

  • 4 Installation User Guide for Multiflash Excel Interface

    If you have a previous version of the Multiflash add-in already installed you willfirst need to remove it from Excel. This can be done as follows:

    1. Start Excel. The MF menu item will be present.

    2. Choose the Add-Ins from the Tools menu.

    3. Click on the check box next to the Multiflash-Excel XLL add-in to remove the tick mark. Click on OK to close the Add-insdialog.

    4. Restart Excel. The MF menu item should not be present.

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

    64 bit versions of Excel

    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 Excel.exe in the image name. If EXCEL.EXE is shownwith a *32 next to it, the 32bit version is running, otherwise it is the64bit

    To install the Excel Add-in the 64bit versions of Excel, follow the procedure for32bit versions listed above and replace mfxl4432.xll with mfxl4464.xll.

    Testing the Multiflash Excel InterfaceAfter installing the Excel add-in it is recommended that you test that it isoperating correctly.

    1. Install the add-in as described above.

    2. Start Excel and open the sample file TEST.XLS which isinstalled in the Multiflash directory under the subdirectoryMFL Files. This is a simple example of a flash calculation atspecified temperature and pressure.

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

    4. A dialogue box with the message Please enter the rangecontaining the initialisation string will be displayed next.Drag in the spreadsheet to select the range $A$1:$A$6 or typein the range.

    5. A message box should confirm that Multiflash has beensuccessfully initialised.

  • User Guide for Multiflash Excel Interface Installation 5

    6. If Multiflash is not successfully initialised a list oferror/warning numbers and messages will be displayed. If onlynumbers are displayed without any explanation this means thatthe error message files MFLASH.err and MFLASH.eix cannotbe found. To look up error numbers you can use theHelp/Multiflash Error Codes menu item.

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

    Removing Multiflash from your computerTo uninstall Multiflash:

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

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

  • 6 Installation User Guide for Multiflash Excel Interface

    Getting technical supportMultiflash includes online help via the Windows Help system. If you needfurther help you can contact us by email, fax or telephone. The contact detailsare listed below.

    Infochem/KBC Advanced Technologies plc4 The Flag Store23 Queen Elizabeth StreetLondon SE1 2LPUK

    Telephone: +44 (0)20 7357 0800

    Fax: +44 (0)20 7407 3927

    Email: [email protected]

  • User Guide for Multiflash Excel Interface New features and changes in Version 4.4 7

    New features and changes inVersion 4.4

    IntroductionA number of small improvements have been made to the Excel interface. Otherminor changes in the interface concerned the overall behaviour of the Excel add-in. For the new features of Multiflash 4.4, please refer to the Multiflash UsersGuide for Windows.

    New features

    64 bit Excel

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

  • User Guide for Multiflash Excel Interface General information 9

    General information

    Interfaces providedThe Multiflash Excel interface provides spreadsheet functions that can be used toconfigure Multiflash and carry out calculations. The 32bit interface is supportedby an Excel add-in called MFXL4432.XLL, whereas the 64 bit version of theinterface is called MFXL4464.XLL. This add-in, in turn, uses the MultiflashDLL (MFL4432.DLL or MFL4464.DLL) to perform the physical propertycalculations.

    Files suppliedThe files for the Multiflash-Excel interface are listed in the file FILELIST.TXTsupplied on the Multiflash for Windows CD-ROM.

    Different editions of ExcelThe Multiflash Excel Add-In has been designed as far as possible to work withall language editions of Excel. However, there are minor differences in the waythe Multiflash functions are specified you need to be aware of.

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

    Different versions of ExcelThe screen shots used as illustrations in this manual have been taken fromdifferent versions of Excel. Different versions of Excel may appear slightlydifferent visually; however, the functionality described in the manual should bethe same. Also the MF menu was replaced with Multiflash Add-In.

  • 10 General information User Guide for Multiflash Excel Interface

    Getting startedTo 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 definingan initialisation script in a worksheet by calling pre-defined files and/or enteringa series of commands. From MF3.7 the Multiflash for Windows GUI can belaunched directly from the spreadsheet, adding another means of defining theproblem in Excel. This section concentrates on using pre-defined files andcommands, using the GUI is described later, see Defining the problem bylaunching the GUI on page 17.

    We will assume that the Multiflash files have been placed in the directoryC:\Program Files\Infochem\MF, but if the default directory (C:\ProgramFiles\Infochem\MF44) is used you need to substitute the actual directory usedfor C:\Program Files\Infochem\MF in what follows.

    You should have inserted your Multiflash software protection key into theparallel or USB port of your computer, making sure that a secure connection ismade. You can still use a printer or other device that is usually connected to theparallel port by plugging it into the back of the key.

    You can now create a spreadsheet that uses Multiflash. Open a worksheet andstart by writing a Multiflash initialisation script for your problem. Here is asimple 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 theinitialisation script. Into cell A1 copy the following:

    include c:\Program Files\Infochem\MF\rks.mfl;

    This refers to the configuration file provided with the software for settingMultiflash to use the RKS equation with the Infochem data bank. Note that inWindows it is important to give a full path name when you refer to a file, as aWindows program does not recognise the DOS default directory. To use a longpathname that includes blank characters it should be enclosed in (straight)quotation marks, e.g.

    include c:\Program Files\Infochem\MF\rks.mfl;

    Next define the components by copying the standard Multiflash command intocell A2:

    components ethane butane water;

    Each component should be referred to by one of its names in the Infochem databank. A complete list of names is given in Multiflash for Windows. Each cellcan accept up to 255 characters, so if that is insufficient, you may carry onadding component names in the next cell in the initialisation script. You mustshow which is the last component by following its name with a semi-colon. Thisversion of Multiflash can accept up to 200 components. Finally you need todefine the units by copying another standard Multiflash command into cell A3:

    units amounts kg temperature degC pressure bardensity m3/kg enthalpy kj/kg;

    The full range of options can be seen by selecting the units command inMultiflash for Windows. You can omit the units commands in which caseMultiflash uses its default units for all quantities which are SI.

  • User Guide for Multiflash Excel Interface General information 11

    You are now ready to start writing your spreadsheet. As a first example, do asimple flash at constant pressure and temperature. First put the following text inthe following cells:

    cell textA5 AMOUNTSA6 AMOUNTSA7 AMOUNTSA8 PHASEA9 TEMPERATUREA10 PRESSUREA11 ENTHALPYA12 STATUSC5 1C6 2C7 3F4 OVERALLG4 GASH4 WATERI4 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 cellscontaining the initialisation script which defines the problem. The third argument

  • 12 General information User Guide for Multiflash Excel Interface

    is used for specifying a stream type and is optional. If the name of a stream typeis 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 acolumn 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 havea 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.4and 0.1 respectively. Set the temperature by typing 30 into cell E9 and thepressure by typing 20 into cell E10. Now make Excel call a flash at constantpressure 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 thefunction 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 isdragged to other cells. A $ before the row number, F$4, means dragging thefunction 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 cellF5. An easy way to write the function into cell F5 is to click on F5 and then startthe Excel function wizard which prompts you for each argument in turn to helpyou avoid mistakes. For details on how to use the function wizards see FunctionWizards on page 20.

    To get the other physical properties out, click on cell F5, then simply drag thefunction definition down and across from F5 to I12.

    The values for all the phases and properties requested should now appear on thespreadsheet. The cells on the STATUS line should be filled the text OK toindicate that the flash function has worked correctly. If anything else appears, anerror has occurred: see Dealing with Multiflash errors on page 55 if thishappens.

  • User Guide for Multiflash Excel Interface General information 13

    Now do an isenthalpic flash to simulate the effect of reducing the pressure of thisfluid through a choke. First copy the following text into the following cells:

    cell textL4 OVERALLM4 GASN4 WATERO4 LIQUID1

    Also, define a new pressure by typing 1 into cell K10. To make Excel call anisenthalpic 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 theanswer into cell L5. Again to avoid mistakes you can use the function wizard tohelp you define this function.

    To get the other physical properties out, click on cell L5 and drag across thearray of cells. Again, the values for all the phases and properties requestedshould 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 callMultiflash to update all the cells provided you have automatic recalculateswitched on. If you have manual recalculate switched on, it will only recalculatethe cells when you press key F9.

    You can also request other physical properties by putting the appropriate nameof the physical property in column 1 and then copying a row of the spreadsheet

  • 14 General information User Guide for Multiflash Excel Interface

    and pasting it onto the new row with the new property name. You can also doother flashes by setting up other areas with different flash functions etc. Acomplete list of the flash functions and their arguments is given in the interfacespecification, see Interface specification on page 25.

  • User Guide for Multiflash Excel Interface Using the Multiflash Excel interface 15

    Using the Multiflash Excelinterface

    How to create an initialisation script to define a newproblem

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

    You could set up your problem using Multiflash for Windows and save theproblem definition in a file, say EXAMPLE.MFL, which we will assume hasbeen placed in a directory of your choice, say C:\MF. You can then make thisfile into your initialisation script by writing following instruction

    include c:\MF\example.mfl;

    in a cell on the spreadsheet.

    This is the simplest way to transfer the problem definition, but if you wish totransfer the individual commands, perhaps so that you can change them in theworksheet, this can be done either by:

  • 16 Using the Multiflash Excel interface User Guide for Multiflash Excel Interface

    Using Open from the Excel File menu and selecting the .mfl file required usingthe Text Import Wizard to load the commands.

    If you use the Fixed Width option in the Text Import Wizard make sure that allbreak lines are deleted by double clicking on them. The contents of the file willthen be written into cells in the worksheet.

    Another way of transferring the detailed problem set-up from Multiflash forWindows is to use the Tools/Show/Problem menu option to write the problemdefinition in the Multiflash results window. You can then highlight the definitionand use the Edit copy and paste options to transfer the information fromMultiflash for Windows to Excel. You should choose the Paste special andText options in Excel to ensure that each line of the problem definitionoccupies 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 Multiflashcommand language which is described in the Multiflash Command ReferenceManual. However, to take a simple example, to flash a mixture of methane,ethane and propane using the Peng-Robinson equation for gas and liquid phases,the following commands could be copied onto the spreadsheet:

    include c:\Program Files\Infochem\MF\PR.mfl;components methane ethane propane;

  • User Guide for Multiflash Excel Interface Using the Multiflash Excel interface 17

    The include command can be used as part of an initialisation script to includeany file you wish. include commands can also be nested in files. The full pathincluding the drive letter for the directory where the file is located should be putbetween double quotes after include command. For example, the initialisationscript above uses the standard configuration file supplied for the Peng-Robinsonequation, PR.MFL, which we have assumed has been placed in the directoryC:\Program Files\Infochem\MF.

    When Multiflash functions call for the init_script argument, all cells containingthe initialisation script should be highlighted or identified. The initialisationscript should also be given an absolute reference, see Cell references on page22.

    Defining the problem by launching the GUI

    In the main menu click on Multiflash Add-In. The sub menu has an item, CallGUI

    Clicking on this item launches a sub window

    requesting blank cells for a new problem or the cells containing the initialisationscript for an existing script you wish to use as a starting point. You can just entera single cell or block several cells in a column. If more cells are needed for theinitialisation 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 bepasted to the first cell in each column covered, giving multiple copies of thescript.

    Clicking on OK will launch the Multiflash GUI

  • 18 Using the Multiflash Excel interface User Guide for Multiflash Excel Interface

    Use of the GUI is described in detail in the User Guide for Multiflash forWindows. However, as the Multiflash Excel interface is an add-on to theMultiflash 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 toFile/Exit, which will trigger the following message.

    When you click on Yes you are returned to the spreadsheet and asked to confirmthe cells for the script

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

  • User Guide for Multiflash Excel Interface Using the Multiflash Excel interface 19

    This only defines the initialisation script, the calculations require the phasenames, properties etc. to be completed as before but this time the cell referencefor 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 yourfamiliarity with Multiflash commands and the nature of the problem. For thesimple problem described in Getting started writing the script directly in theworksheet has many advantages. The script is simple, each section can bedefined in a single cell (the model, the components, the units), it can be easilyread and modified, e.g. the model changed. For more complex problems, such asthose involving PVT Analysis or property matching the GUI has to be used.

    Defining Multiflash functionsTo obtain component or unit names or to carry out flash calculations you mustdefine the appropriate Multiflash function in the chosen cell. A full list ofMultiflash functions is given in the Interface specification on page 25. Thefunctions may be entered into the spreadsheet cells either by typing them in, bycalling the function wizard or by copying them from other cells.

    Typing in Multiflash functions

    The example given in Getting started on page 10, enters the functions in cellsby typing in the function definitions. For instance, the isothermal flash wasdefined 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

  • 20 Using the Multiflash Excel interface User Guide for Multiflash Excel Interface

    =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 phasewanted$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 streamtype for the overall input stream if these have been defined, perhaps with eachdescribed by a different model. If only one stream is involved in the flashcalculation, stream_type may be omitted.

    The use of the $ sign for defining cell references is discussed in Cellreferences on page 22.

    Function Wizards

    An easier way to define the function is to use function wizards, which promptyou 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 theMultiflash Function Category by scrolling to the Multiflash Add-In andhighlighting it:

    The list of Multiflash functions will then be displayed

  • User Guide for Multiflash Excel Interface Using the Multiflash Excel interface 21

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

    You may either type in the cell references for each prompt as before or, with thecursor in the appropriate box, simply click in the cell (or highlight the range ofcells) to which this argument refers. This will transfer the identification of thecell or group of cells to the function wizard but you will then have to completethe reference, if you need to, by adding in the $ signs. This can be done usingkey F4 or else by adding the $ signs manually.

    Be sure to scroll down the argument list to provide all the information requiredfor the function definition.

  • 22 Using the Multiflash Excel interface User Guide for Multiflash Excel Interface

    The appearance of the function wizard in Excel is slightly different from versionto version but work in exactly the same way. The HELP button is marked maybe marked as ? as HELP or as Help with this function.

    Copying, dragging and pasting in functions

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

    Cell referencesReferences tell Excel which cells to look in to find the values to be used in aformula. There are three types of reference: relative references, absolutereferences and mixed references.

    Relative references

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

    Absolute references

    A quick way of alteringabsolute or relativereferences to a cell or groupof cells is to use the F4function button.

    A reference such as $A$1 tells Excel how to find a cell based on the exactlocation of that cell in the worksheet. An absolute reference is designated byadding 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 absolutereference is the initialisation script.

    Mixed references

    A reference such as A$1 or $A1 tells Excel how to find another cell bycombining 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 orrow 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 obtaincomponent names. In the Getting started on page 10 example we had threecomponents, ethane, butane and water. The function call to obtain the name ofthe first component was

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

    where the cell reference for the component number ($C5) is mixed and for theinitialisation script ($A$1:$A$3) is absolute.

  • User Guide for Multiflash Excel Interface Using the Multiflash Excel interface 23

    This means that if the function is copied and pasted (or dragged) from cell D5 toD6 the function changes to

    =MF_COMP($C6,$A$1:$A$3)

    so that the name of the second component, (butane), is picked up. If thereference to the component number had been made absolute, e.g. ($C$5) thecopying or dragging to cell D6 would have resulted in the name of the firstcomponent being place in D6, i.e. ethane.

    Mixed references should also be used for functions identifying input and outputunits.

    Array functionsAlthough there can sometimes be advantages in defining functions as arrays weno longer recommend this. The array function can be defined whenever theresults from a flash calculation are required in a rectangular block of cells on thespreadsheet. To do this, first define the function in a single cell in the blockusing the function wizard if desired. The input arguments should be set up asarrays in order to define the flash function as an array function over the block inquestion. Click on the cell where you have defined the function, highlight theentire block of cells for which you want the array function to return values, clickon the formula bar and press Ctrl Shift Enter. Excel now defines the function as

  • 24 Using the Multiflash Excel interface User Guide for Multiflash Excel Interface

    an array function over the highlighted block. If you click on another cell thehighlighting disappears.

    If you define a flash function as an array that is too large, the superfluous cellswill be filled with an Excel error value; if you define a flash function as an arraythat is too small, the output is truncated to fill the defined cells only. Note thatExcel does not allow you to alter a single cell within the array; you have todelete the whole array and start again. This can be limiting, particularly if thephase label for any phase changes within the array or if you wish to investigateindividual calculations.

    The phase envelope functions have to be an array function. For details of how toset 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 MultiflashGUI from Excel, carrying out characterisation and matching in Multiflash GUIand then save the Multiflash initialisation script in Excel after closing MultiflashGUI. Alternatively, the Multiflash command language can be used to configureand drive the Multiflash software for various tasks interactively in spreadsheets.For the Multiflash command language, refer to the Multiflash commandreferences manual.

  • User Guide for Multiflash Excel Interface Interface specification 25

    Interface specification

    Initialisation scriptAll Multiflash functions in Excel must refer to the relevant initialisation script towork 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 optionand clicking Load. You will be prompted to give the location ofthe initialisation script.

    2. Force all the Multiflash functions that use the initialisation script torecalculate. This is easily done by clicking on one of the cellscontaining the initialisation script, placing the cursor in the formulabar and pressing Enter.

    Once Multiflash has been initialised, the functions in the following sections areavailable to be connected to the spreadsheet cells. They may be entered into thespreadsheet cells either by typing in their names, by calling the function wizardor by copying them from other cells. To use any function you must have set upan 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 enterthese unless they are required for your problem. Some other arguments, such ascomp_no, can be omitted under certain circumstances. For example, whencarrying out a P,H flash you do not need a reference to the component number ifyou just wish to calculate the temperature. However, you must enter a referenceif the property wanted directly relates to a component, e.g. amounts.

    Binary interaction function

    BIP function (MF_BDAT)

    Returns a binary parameter with a pair of given components. The arguments aredescribed 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 )

  • 26 Interface specification User Guide for Multiflash Excel Interface

    Bubble point calculations

    Bubble point at fixed pressure (MF_PBUBF)

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

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

    Bubble point at fixed temperature (MF_TBUBF)

    Performs a bubble point calculation at constant temperature. Optional argumentsare 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 orwithout 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 isdefined in the initialisation script. The result is given in the current input unitsfor 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 orpetroleum fraction to a given component number. The argument description forthe properties returned by this function is given in section Arguments forcomponent properties function on page 40.

    =MF_PDAT( comp_no, comp_prop, offset, init_script )

    Temperature-dependent Component propertiesfunction (MF_PDAT_T)

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

    =MF_PDAT_T(comp_no, comp_prop, temperature,init_script )

  • User Guide for Multiflash Excel Interface Interface specification 27

    Dew point calculations

    Dew point at fixed pressure (MF_PDEWF)

    Performs a dew point calculation at constant pressure. Optional arguments areshown 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 argumentsare 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 argumentsare 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. Optionalarguments are shown in italics. The basis in this function only accepts eithernormal 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 isspecified as overall, it means that the fraction for the wax phase required isrelated to the total fluid. If it is the name of the liquid phase, e.g. liquid orliquid1 depending on the liquid phases specified in the Multiflashinitialisation script, the fixed phase fraction of wax is related to the liquid+waxphase.

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

  • 28 Interface specification User Guide for Multiflash Excel Interface

    Fixed phase fraction flash at fixed temperature(MF_TFRACF)

    Performs a fixed phase fraction flash at constant temperature. Optionalarguments 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 areshown 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 shownin 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 areshown 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 initalics.

    =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 areshown in italics.

  • User Guide for Multiflash Excel Interface Interface specification 29

    =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 areshown 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 ordensity (MF_TVF)

    Performs a flash at fixed temperature and volume/density. Optional argumentsare 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 areshown 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 argumentsare 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 ordensity (MF_UVF)

    Performs a flash at fixed internal energy and volume/density. Optionalarguments 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)

  • 30 Interface specification User Guide for Multiflash Excel Interface

    Flash at fixed entropy and volume or density(MF_SVF)

    Performs a flash at fixed entropy and volume/density. Optional arguments areshown 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 initalics.

    =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 arrayfunction. See Setting up the phase envelope function on page 53 forinformation 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 phaseenvelope(MF_PHENV_COLS)

    Returns the column headings for phase envelope routines. This is an arrayfunction. See Setting up the phase envelope function on page 53 forinformation 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 thephase envelope function on page 53 for information about how to set upMF_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 thephase envelope function on page 53 for information about how to set upMF_HPHEN function as an array. Optional arguments are shown in italics.

  • User Guide for Multiflash Excel Interface Interface specification 31

    =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 thephase envelope function on page 53 for information about how to set upMF_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 upthe phase envelope function on page 53 for information about how to set upMF_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 calculatorFor the original salt component model one of the components in the INFODATAdatabank is called salt component. This is used to represent a salt pseudocomponent, based on a sodium chloride equivalence, for use in calculatingfreezing point depression or hydrate inhibition.

    For the electrolyte model, which is based on defining ions and not a salt pseudocomponent, the ions Na+, K+, Ca++, Cl- and Br- can be defined fromINFODATA databank.

    To determine the inhibition effect of salt using either the salt component modelor the electrolyte model you need to provide a description of the salt content ofthe aqueous stream but often the data for the salt, brine or formation/productionwater 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 usethe following functions to calculate the equivalent amount of salt componentor the ions or use the extended Tools/Inhibitor Calculator menu option inMultiflash GUI by calling from Excel.

    The water component and its amount have to be defined before any calculationsof the salt or ions. It is much more straightforward to use the Tools/InhibitorCalculator menu option in Multiflash GUI to define the salt component or theions and generate the data for the salt component or the ions for the saltcomponent model or electrolyte model and then save the initialisation script inExcel.

    Ion ratio calculator for defined salinity ionconcentrations as input (MF_ION_IC)

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

  • 32 Interface specification User Guide for Multiflash Excel Interface

    be added per unit mass (weight) of water if the input units for amounts arecurrently 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 - saltmass fractions as input (MF_ION_MASS_FR)

    Calculates the ion ratio to add to water that will give the same inhibition effecton 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 theinput 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 amountsare currently set to mass units.

    =MF_ION_MASS_FR(ion, salt_ids, salt_mass_fracs,init_script )

    Ion ratio calculator for defined salinity - saltmolalities as input (MF_ION_MOLAL)

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

    =MF_ION_MOLAL(ion, salt_ids, salt_molalities,init_script)

    Ion ratio calculator for defined salinity - saltmole fractions as input (MF_ION_MOLE_FR)

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

    =MF_ION_MOLE_FR(ion, salt_ids, salt_mole_fracsinit_script )

    Ion ratio calculator for defined salinity - totaldissolved salt as input (MF_ION_TDS)

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

  • User Guide for Multiflash Excel Interface Interface specification 33

    be added per unit mass (weight) of water if the input units for amounts arecurrently 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 sameinhibition effect on gas hydrate or ice formation as a saline solution with ionconcentrations as specified. Returns the number of moles of salt component tobe added per mole of water if the input units for amounts are currently set tomolar units; returns the mass (weight) of salt component to be added per unitmass (weight) of water if the input units for amounts are currently set to massunits.

    =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 sameinhibition effect on gas hydrate or ice formation as a saline solution with totaldissolved salt as specified. Returns the number of moles of salt component tobe added per mole of water if the input units for amounts are currently set tomolar units; returns the mass (weight) of salt component to be added per unitmass (weight) of water if the input units for amounts are currently set to massunits.

    =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 sameinhibition effect on gas hydrate or ice formation as a saline solution with saltmolalities as specified. Returns the number of moles of salt component to beadded per mole of water if the input units for amounts are currently set to molarunits; 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 sameinhibition effect on gas hydrate or ice formation as a saline solution with saltmole fractions as specified. Returns the number of moles of salt component tobe added per mole of water if the input units for amounts are currently set tomolar units; returns the mass (weight) of salt component to be added per unitmass (weight) of water if the input units for amounts are currently set to massunits.

    =MF_SAL_MOLE_FR( salt_ids, salt_mole_fracs,init_script )

  • 34 Interface specification User Guide for Multiflash Excel Interface

    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 sameinhibition effect on gas hydrate or ice formation as a saline solution with saltmass (weight) fractions as specified. Returns the number of moles of saltcomponent to be added per mole of water if the input units for amounts arecurrently set to molar units; returns the mass (weight) of salt component to beadded per unit mass (weight) of water if the input units for amounts are currentlyset 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 andtemperature. The tolerance calculation takes a (first) fluid mixture and adds asecond fluid until the fixed phase fraction is satisfied at the defined pressure andtemperature. 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.

  • User Guide for Multiflash Excel Interface Interface specification 35

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

  • 36 Interface specification User Guide for Multiflash Excel Interface

    =MF_VERS( init_script )

    Initialisation argument for all the functions

    init_script

    Array of strings up to 255 characters. The initialisation script is written inMultiflash command language and defines the problem Multiflash will solve. AllMultiflash functions must include the appropriate initialisation script as one oftheir 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 upto 40 characters. The constant physical properties of a component required asfollows. The property units are given in parentheses where applicable. Units forother properties may be set by the UNITS or INPUTUNITS commands. It isimportant that the full name, as listed below, is used. Abbreviations are notaccepted 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 gasstate at 298.15K

    Sformation Entropy of formation

    Sstandard standard entropy in the perfect gas state at 298.15K and 1bar

  • User Guide for Multiflash Excel Interface Interface specification 37

    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 Henrys Law correlation forcomponent in water

    Vhlwater characteristic volume for Henrys Law correlation forcomponent in water

    Dipolemoment dipole moment (debye)

    Parachor parachor ( (dyne/cm) cm3/mol )

    Radgyr radius of gyration (m)

    Hocass Hayden OConnell self association parameter

    Gformation Gibbs energy of formation in the perfect gas state at 298.15Kand 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 forSUPERTRAPP viscosity model

    REFVISPD reference viscosity for liquid at the boiling point forPedersen viscosity model

    REFVISTW reference viscosity for liquid at the boiling point for Twomodel

    REFVISLB reference viscosity for liquid at the boiling point for LBCmodel

    LJEVISC Lennard-Jones k/ parameter for viscosity ( K)

  • 38 Interface specification User Guide for Multiflash Excel Interface

    LJBVISC Lennard-Jones parameter ( m )

    EOSC Corresponding states reference equation code

    TYPE Type of component

    HDATUM Options for calculating enthalpy1 for compound2 for elements3 for standard enthalpy ( 298.15K )

    SDATUM Options for calculating entropy1 for compound2 for elements3 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 ca parameter ( J m3mol-2 )

    ASSBC CPA b parameter ( m3 mol -1 )

    ASSKAPPA CPA parameterSAFTKAPPA PC-SAFT parameterSAFTEPSILON 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

  • User Guide for Multiflash Excel Interface Interface specification 39

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

    VCLBC Critical volume for LBC viscosity model

    The coefficients for the correlations of pure component temperature-dependentproperties also can be obtained using MF_PDAT function. A new functionMF_PDAT_T for directly obtaining the temperature-dependent properties of apure component is available. The list of properties that are a function oftemperature is given as follows. Coefficients are the numeric values of thecorrelation 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 Sol