Case studies – Excel spreadsheets
Introduction............................................................................................................................................... 1
UNFACFIT.xls........................................................................................................................................... 1
Notes.......................................................................................................................................... 2
UNIFAC..................................................................................................................................... 2
Activity model
worksheets..................................................................................................... 2
VLEFIT.xls.................................................................................................................................................. 3
SolidsA.xls and
SolidsB.xls..................................................................................................................... 3
PVT Analysis............................................................................................................................ 4
Match bubble point.................................................................................................................. 5
Wax............................................................................................................................................. 6
Asphaltenes.............................................................................................................................. 7
Asphaltene with gas
injection................................................................................................ 7
Hydrates..................................................................................................................................... 8
Although only accessible if you have licensed the Excel add-in option there are some problems which are best approached using Excel. Some of these are discussed in the Multiflash Excel manual, such as generating tables of pure component data or using linked flashes or recycles for simple flowsheet calculations.
Those presented here were set up following user requests and include generating binary interaction parameters for activity coefficient models and linking predictions of solid formation to a common fluid analysis.
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.
The spreadsheet has several worksheets.
The first spreadsheet consists of notes on how to use UNFICAFIT.xls and how to enter the fitted BIPs in Multiflash.
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.
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.
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 UNIFACFIT.xls but the starting point is experimental data rather than data generated from the UNIFAC model.
Instead of the first UNIFAC worksheet there is an Experimental worksheet to enter the data. Again you can choose the data source for your pure component data and indicate whether your chosen data is along an isotherm or isobar. In order to minimise effort this spreadsheet does allow you to choose the units for temperature and pressure to match those measured. The temperature or pressure for the isotherm or isobar should be entered as should the values for x, y and associated T or P.
We have chosen a limited array for data entry. If you have more data and are familiar with Excel you can extend the range although you will need to remember to change the cell references in the dependent worksheets. Otherwise you should limit the data by choosing suitable sets from the data available.
If you have less data then you should enter #N/A in the cells which would otherwise be empty or retain values for earlier entries. This is necessary for the Excel Solver to operate correctly. For some data sets you may have P,x or T,x but no data for gas composition, y. In this case it is better to enter #N/A for the y compositions. If you fail to do this the Solver will still function provided the minimisation criteria is based on difference in temperature or pressure – the default. However, the plots for x,y will not be relevant and should be ignored.
As with UNIFACFIT.xls you can fit the experimental data to generate BIPs for WilsonE, UNIQUAC VLE or NRTL VLE by choosing the appropriate worksheet.
Several of the engineers using Multiflash for Windows have found it fairly complex to obtain results for solid formation particularly for asphaltenes. Improvements to allow users to fit bubble point and asphaltene model parameters at the same time go some way to alleviating this problem. However, we had set up a spreadsheet, SolidsA.xls, which many engineers find useful and which we have decided to issue as part of the implementation. Of course you will only be able to use any worksheet if you have licensed the appropriate model.
This spreadsheet takes a common PVT fluid analysis and uses this as the input composition to match and/or predict bubble point and hydrate, wax and asphaltene formation.
Again the spreadsheet consists of several worksheets and each worksheet has the relevant models built-in in hidden rows or columns. The default model for hydrate formation and inhibition in SolidsA.xls is based on CPA as the fluid model with the Electrolyte model for salt. The PVT Analysis is complex and the SolidA.xls, which allows the PVT Analysis to be carried out in the spreadsheet is limited to our original Analysis1 characterisation. This limits the wax model to the Multisolid option.
With the issue of the Revised PVT characterisation method, a new spreadsheet, SolidsB is provided. As the revised PVT Analysis2 is more complex, in this spreadsheet the PVT must be carried out using Multiflash for Windows, and mfl file written and referenced in the first worksheet. The hydrate model is CPA with electrolyte, but the wax model is now the Coutinho model.
There is only one asphaltene model and this is common to both spreadsheets.
The Excel calculations are set to manual using the Excel Tools/Options facility. This is to prevent automatic calculation of the whole spreadsheet as new compositions are entered. To update any individual worksheet use Shift F9, to update the whole spreadsheet use F9.
This work sheet is only fully active in SolidsA.xls and characterises the fluid according to the fluid composition provided. In common with our other spreadsheets input data are marked in red.
The list of possible components is based on the default component list used in our PVT Analysis utility. The user enters the compositions and any other information available such as the molecular weight and specific gravity. The SARA analysis can be entered; the resin and asphaltene amounts are needed for the asphaltene model although they can be estimated if required. The user can specify the starting point and the number of fractions for the characterisation although we would recommend staying with C6 and 15 fractions. The units for calculation are also set in this worksheet.
Once the characterisation has been carried out a bubble point is predicted using this characterisation at a temperature or pressure set by the user. This allows the user to decide whether to tune the petroleum fraction properties to match a known bubble point or if this is unnecessary.

For SolidsB.xls the fluid is first characterised with Multiflash for Windows using the Infoanal2 characterisation and providing either the wax content or an estimate so that the n-paraffin distribution required for the Coutinho wax model is generated. There is no need to specify models, this is done internally in SolidsB.xls, all that is required is to save the PVT Analysis as an .mfl file.
The input to the first worksheet is this .mfl file, but it is important that it is specified with the correct directory path.
This is not the most elegant solution and will be improved in future.

After the PVT worksheet, SolidsA.xls and SolidsB.xls are similar in operation.
If the predicted bubble point is sufficiently different from a known value then this worksheet allows the user to match a known bubble point. The fluid composition is taken from the characterised fluid in the PVT Analysis worksheet. The user specifies the bubble point to be matched and the bubble point is recalculated after the match to confirm that this has been carried out. A new problem input specification is written into this worksheet as a result of the match but it is in hidden rows or column.

The next worksheet is dedicated to prediction of wax formation, although the worksheets for wax, asphaltene and hydrates are not inter-dependent and can be used in any order.
The user can choose to use the fluid characterisation direct from the PVT Analysis or with petroleum fraction properties tuned to match a bubble point.
The first set of calculations predict the wax appearance temperature (WAT) without any further tuning plus the amount of wax formed at a user specified T,P. The WAT is plotted automatically as a function of pressure. The starting pressure and step can set by the user to obtain the pressure range of choice.
These calculations are repeated based on matching to a known WAT.

The asphaltene worksheet again offers the choice of using the PVT Analysis characterisation direct or the characterisation after matching to a known bubble point. For asphaltene modelling we would recommend the latter.
The options for producing the asphaltene model parameters are not as flexible in Excel as in the Windows front end. You are limited to two options, the flocculation or reservoir conditions and you must supply both temperature and pressure.
After matching the user can set either temperature or pressure and calculate the corresponding P or T for the upper and lower boundaries of the flocculation envelope. There is also an option for entering a set of T,P and calculating the amount of asphaltene formed at those conditions.
Every effort has been made to plot the asphaltene flocculation envelope automatically with starting points derived from the flocculation or reservoir conditions. However, as the engineers using our Windows phase envelope facility will appreciate it is difficult to make this absolutely foolproof.

The effect of gas injection on asphaltene flocculation is most easily calculated in Excel. The asphaltene model parameters for any fluid should be retained when studying the effect of added gas and the gas injection worksheet is therefore dependent on the asphaltene worksheet for the problem input specification and the matching function is disabled. It serves only to report the conditions chosen for matching.
The composition of the gas is entered and the ratio of gas to oil is based on a simple molar ratio.
You can still change conditions of temperature and/or pressure to determine the boundaries for flocculation and the amount of asphaltene flocculated. The boundaries for asphaltene flocculation, with and without gas injection are plotted but it cannot be guaranteed that this will be available for all fluids and gas injection rates.

The hydrate functionality is well served in our Windows software and easily used. We have only added a hydrate worksheet here for completeness and to allow the engineer to carry out quick checks for possible hydrate formation. It encapsulates the main features of our hydrate model but does not have the flexibility of the Windows program.
The model used in solids.xls is based on RKSA (
The user needs to add an amount of water to the fluid and this can either be pure water or produced water with the salt content defined by ion analysis or total dissolved solid. The hydrate dissociation temperature can be calculated at a single pressure or plotted as a function of pressure. The hydrate is defined as hydrate2 only, which is the usual hydrate formed especially as the spreadsheet is designed to work with oils rather than natural gases.
There is also a section in the worksheet for looking at the use of inhibitors. These are limited to the two most common, methanol or MEG. They can be added in fixed amount or the concentration required for hydrate inhibition at set conditions can be predicted.

Users who want to investigate hydrate behaviour only may find the hydrateinfo.xls and hydratecpa.xls spreadsheets useful. These have a restricted component list (gases and gas condensates) but offer a choice of fluid and salt model and a wider choice of calculations.