Sunteți pe pagina 1din 110

The Pennsylvania State University

The Graduate School


Department of Energy and Mineral Engineering

DETERMINATION OF CRICONDENTHERM,
CRICONDENBAR AND CRITICAL POINTS OF NATURAL GASES
USING ARTIFICIAL NEURAL NETWORKS

A Thesis in
Petroleum and Mineral Engineering
by
Yunusa A Abass

Submitted in Partial Fulfillment


of the Requirements
for the Degree of

Master of Science

December 2009

ii
The thesis of Yunusa A. Abass was reviewed and approved* by the following:

Luis F. Ayala
Assistant Professor of Petroleum and Natural Gas Engineering
Thesis Advisor

Zuleima T. Karpyn
Assistant Professor of Petroleum and Natural Gas Engineering
Department of Energy and Mineral Engineering

Turgay Ertekin
Professor of Petroleum and Natural Gas Engineering
George E. Trimble Chair in Earth and Mineral Engineering
Program Chair in Petroleum and Mineral Engineering

Yaw D. Yeboah
Professor and Department Head of Energy and mineral Engineering

*Signatures are on file in the Graduate School

iii
ABSTRACT
A phase envelope is a diagram which characterizes fluid behavior at different pressures
and temperatures, and also shows the conditions at which liquid and vapor phases
coexist. To be able to fully characterize this behavior, it is of utmost importance that we
are able to trace the fluids critical point (location of the condition where liquid and vapor
phases become indistinguishable), cricondentherm (corresponding value of the highest
temperature of Liquid/Vapor coexistence) and cricondenbar (corresponding values of the
highest pressure of Liquid/Vapor coexistence) located within its phase envelope. These
three points are the most important ones in terms of defining the shape of the envelope.
Thus, in order to be able to determine the shape of phase envelope, we should be able to
accurately predict the location of the critical temperature and pressure along with the
cricondentherms and cricondenbars temperature and pressure. This, among others, will
aid our understanding of the production characteristics of the hydrocarbons present in the
reservoir. In this work, Artificial Neural Networks are used to aid in this prediction. This
study presents an expert system which is capable of understanding the complexities of the
relationship between the composition and the corresponding values of the key points on
the phase envelope. The expert system is able to predict the most relevant input among
the compositional data of the reservoir fluid. A four stage neural network was proposed
and it was found that, when compared with other constituents that make up the
hydrocarbon mixture, the most relevant and consistent of all the input compositional data
used in the neural network prediction of the phase envelope, was the C7+ for all the
stages examined.

iv

TABLE OF CONTENTS
LIST OF FIGURES ..................................................................................................... v
LIST OF TABLES ....................................................................................................... viii
NOMENCLATURE .................................................................................................... viiii
ACKNOWLEDGEMENTS ......................................................................................... x
Chapter 1. Introduction ............................................................................................... 1
Chapter 2. Background ............................................................................................... 3
2.1 Phase Envelope Calculations .......................................................................... 8
2.1.1 Phase Envelope Construction .............................................................. 9
2.2 Critical, Cricondenbar and Cricondentherm Calculations. ............................. 18
2.3 Artificial Neural Network ............................................................................... 26
2.3.1 Backpropagation Learning ................................................................... 29
Chapter 3. Problem Statement .................................................................................... 33
Chapter 4. ANN Model Development ........................................................................ 35
4.1 Phase Envelope Neural Network Data ......................................................... 38
4.1.1 Neural Network Model ......................................................................... 41

Chapter 5. Results ....................................................................................................... 48


5.1 Stage One-Cricondenbar, Cricondentherm and Critical Network Models ..... 49
5.1.1 Cricondenbar Neural Network ............................................................. 50
5.1.2 Cricondentherm Neural Network ......................................................... 55
5.1.3 Critical Neural Network ....................................................................... 60
5.2 Stage Two-3-Coordinate Neural Network ...................................................... 64
Chapter 6. Summary and Conclusion ......................................................................... 73
Bibliography ................................................................................................................ 76
Appendix A: Stage 1 ANN MATLAB Code Cricondenbar ....................................... 82
Appendix B: Phase Envelope Code for MATLAB Stage Two .................................. 88

v
LIST OF FIGURES
Figure 2-1: Typical phase envelope of a reservoir fluid ............................................. 5
Figure 2-2: Phase envelope of the various types of reservoir fluids (after Pedersen
and Christensen). .................................................................................................. 7
Figure 2-3: Phase envelope showing cricondentherm, cricondenbar and critical
point ............................................................................................................................. 9
Figure 2-4: Neural network with three layers ............................................................. 27
Figure 4-1: C1 Ranges for Training and Testing .......................................................... 38
Figure 4-2: Sample of various envelopes showing distribution of pressure and
temperature values ................................................................................................ 44
Figure 4-3: Testing and Training Data for Cricondenbar Network Model ................. 45
Figure 4-4: Testing and Training Data for Cricondentherm Network Model ............ 45
Figure 4-5: Testing and Training Data for Critical Network Model .......................... 45
Figure 4-6: Ranges for the Temperature-Pressure 3-Coordinate Network Model ...... 48
Figure 5-1: Neural Network Architect for Cricondenbars Training and Testing ....... 50
Figure 5-2: Training (left) and Testing (right) Result Plots for the Normalized
Pressure of Cricondenbar Points ........................................................................... 51
Figure 5-3: Training (left) and Testing (right) Result Plots for the Normalized
Temperature of Cricondenbar Points .................................................................... 52
Figure 5-4: Relevancy for each input for Cricondenbar .............................................. 54
Figure 5-5: Neural Network Architect for Cricondentherms Training and Testing .. 56
Figure 5-6: Training (left) and Testing (right) Result Plots for the Normalized
Pressure of Cricondentherm Points ..................................................................... 59
Figure 5-7: Training (left) and Testing (right) Result Plots for the Normalized
Temperature of Cricondentherm Points................................................................ 58
Figure 5-8: Relevancy percentage for the Cricondentherm neural network ............... 59
Figure 5-9: Architect for the Critical Neural Network ............................................... 60

vi
Figure 5-10: Training (left) and Testing (right) Result Plots for the Normalized
Pressure Points of Critical Points ........................................................................ 61
Figure 5-11: Training (left) and Testing (right) Result Plots for the Normalized
Temperature of Critical Points............................................................................. 62
Figure 5-12: Relevancy percentage for the critical neural network ............................. 63
Figure 5-13: Phase Envelope Neural Network Architect ............................................ 64
Figure 5-14: 3-Coordinate Cricondenbar Training (left) and Testing (right)
Pressure Results Plots ........................................................................................... 66
Figure 5-15: 3-Coordinate Cricondenbar Training (left) and Testing (right)
Temperature Results Plots .................................................................................... 67
Figure 5-16: 3-Coordinate Cricondentherm Training (left) and Testing (right)
Pressure Results Plots ........................................................................................... 68
Figure 5-17: 3-Coordinate Cricondentherm Training (left) and Testing (right)
Temperature Result Plot ....................................................................................... 69
Figure 5-18: 3-Coordinate Critical Training (left) and Testing (right) Pressure
Result Plot ............................................................................................................. 70
Figure 5-19: 3-Coordinate Critical Training (left) and Testing (right) Temperature
Result Plot ............................................................................................................. 71
Figure 5-20: Relevancy Plot for the Phase Envelope Input ......................................... 72

vii
LIST OF TABLES
Table 4-1: Phase envelope input data range ................................................................ 37
Table 4-2: Phase envelope possible actual values used for training ........................... 37
Table 4-3: PN and TN Range for Cricondenbar Neural Network ................................. 43
Table 4-4: PN and TN Range for Cricondentherm Neural Network ............................ 43
Table 4-5: PN and TN Range for Critical Neural Network........................................... 43

viii
NOMENCLATURE
P

pressure, psia

temperature, oR

PN

normalized pressure i.e. reduced pressure value

TN

normalized temperature i.e. reduced temperature value

Pb

bubble point pressure

Rs

solution gas to oil ratio SCF/STB

xi

liquid fraction

yi

vapor fraction

zi

mole fraction of component in mixture

Pc

critical pressure, psia

Tc

critical temperature, oR

MW

molecular weight, lb/lbmol

SG

specific gravity

C1

methane

C2

ethane

C3

propane

C4

butane

C5

pentane

C6

hexane

C7+

heptanes-plus

N2

nitrogen

ix
H2S

hydrogen sulfide

CO2

carbon dioxide

total number of component

Tt

cricondentherm temperature

Tp

cricondenbar temperature

Pt

cricondentherm pressure

Pp

cricondenbar pressure

Greek

specific gravity, at (60oF/60oF)

acentric factor

iv

fugacity coefficient of component i in vapor phase

il

fugacity coefficient of component i in liquid phase

Abbreviation
PVT

pressure-volume-temperature

VLE

vapor-liquid equilibrium

EOS

equation of state

PR

Peng-Robinson

SRK

Soave- Redlich-Kwong

ANN

artificial neural network

LMS

least mean square

x
ACKNOWLEDGEMENTS

First and foremost, to the Almighty Allah is the glory. This thesis could not have been
without the support and guidance of my thesis Advisor Dr Luis Ayala. I would like to
express my deepest regard and gratitude to him for his guidance and assistance
throughout the pursuant of my diploma and most especially this thesis work. I would also
like to express my deep appreciation to Dr Turgay Ertekin for his guidance and assistance
towards this work. My thanks also goes to Dr Zuleima Karpyn for her interest in serving
on my research committee.

I also owe a great deal of appreciation to my entire family, without them there would be
no me. Words cannot express how much I appreciate the encouragement and support
from everyone of them and most especially to my wonderful son Tahmid Abass.

To my colleagues, Shakirundeen Omofolarin Shakioye, Adewale Monsur Olatunji,


Olayanju Cole, Gurpreet Singh, Armstrong Lee Agbaji, Burak Kulga and Mohammed
Ojogbane, your friendship was a guiding grace for me.

And finally the entire staff of the College of Earth and Mineral Science, Department of
Energy and Mineral Engineering, I am forever grateful.

Chapter 1
Introduction
Petroleum reservoir fluids contain a variety of substances of diverse chemical nature that
include

hydrocarbons

and

non-hydrocarbons.

Hydrocarbons

(carbon-hydrogen

molecules) range from methane to asphalt. Non-hydrocarbons include substances such as


nitrogen, carbon dioxide, and sulfur compounds. Hydrocarbons are the main constituents
of petroleum reservoir fluids and they have a very complex chemistry. The behavior of
hydrocarbon mixtures primarily depends on their chemical composition and the
prevailing temperature and pressure at both the reservoir and the surface conditions.
These hydrocarbons in most cases exist naturally in more than one phase - liquid, vapor
and/or solid.

While a phase diagram is a pictorial representation of the distinction between these


phases, a phase envelope is a region on a phase diagram that is bounded by a line which
encompasses where two phases can coexist. These lines on the phase envelope are known
as the bubble point and the dew point lines. These two lines are joined together at a point
known as the critical point. The point corresponding to the highest pressure value on the
phase envelope is known as the cricondenbar while the point corresponding to the highest
temperature is known as the cricondentherm. These three points help in defining the
characteristics of the phase envelope of any particular reservoir fluid. Phase envelopes
are very critical in our understanding of the reservoir fluids, their initial thermodynamic

2
state at conditions of discovery, and our ability to predict reservoir fluid changes as
pressure and temperature conditions vary during the reservoirs productive life. This
knowledge is critical in properly and effectively designing best production practices for
every type of reservoir fluid. In general, prediction of reservoir depletion behavior
heavily relies on being able to account for the state at which the reservoir fluid is at any
conditions of pressure and temperature.

This study proposes a method for phase envelope prediction based on the estimation of
key points associated with the fluids envelope. In order to achieve this, neural network
technology is implemented in this study in order to understand the complexities of the
relationship between the input variables and output variables associated with typical
phase envelopes of natural gas reservoirs. These input variables are the compositions of
natural gas which are: methane C1, ethane C2, propane C3, butane C4, pentane C5, hexane
C6, heptanes C7+, hydrogen sulfide H2S, nitrogen N2, and carbon dioxide CO2. Other input
variable include molecular weight of the C7+ (MW C7+) and specific gravity of C7+ (SG
C7+). These would generate the corresponding temperature and pressure values of the
critical point, cricondenbar and the cricondentherm of the phase envelope. This study also
investigates which of the input variable is most relevant in determining the phase
envelope's characteristics by using a relevancy analysis of the proposed network.

3
Chapter 2
Background
Multicomponent mixture characterizations of reservoir fluids which exist as complex
hydrocarbons are important to petroleum processes in order to be able to provide accurate
fluid description, present solutions to improve compositional analysis and aid in system
design. It is also a basis for the economics of projects with accurate phase behavior
predictions as a major objective.
A phase is defined as a homogeneous and physically distinct part of a system which is
separated from the other parts. The different phases which occur either naturally or
induced is depicted by a phase diagram. A phase diagram is required to properly define
these multicomponent mixtures of hydrocarbon. Phase behavior studies the different
phase change (i.e. liquid, vapor and/or solid) which occur between these multicomponent
mixtures of hydrocarbon as a function of temperature, pressure and composition. Each
hydrocarbon system has its own phase diagram, which depends on the composition of the
system. Hydrocarbon systems are mostly found during petroleum production in liquid
phase as oil, distillate or condensate, as vapor or gas phase in form of natural gas. They
can also be found in the solid phase as paraffin or other forms of deposit which occur in
the tubing system or in the surface production facilities as gas hydrates due to the
freezing and distortion in gas flow through the lines and sand as sediments from the
reservoir rock particles.
The subject of phase behavior focuses on when these phases are in equilibrium, at which
no changes occur in the system with time (i.e. if the system is left at the same temperature

4
and pressure). At equilibrium, evaporation and condensation processes are exactly
balanced and there is no net change in the mass of either phase. This phase equilibrium
state must also be satisfied by thermal, mechanical and chemical equilibrium conditions.
In most petroleum engineering applications, the general assumption is that the fluids
which exist in the reservoir are in equilibrium. Essentially phase equilibrium calculation
is a very important aspect of the general difficulty of constructing a fluid behavior in
terms of pressure-composition, pressure-temperature, composition-composition (ternary),
temperature-composition and pressure-volume diagrams.

A phase diagram of a multicomponent mixture has a region bounded by a line where two
phases exists in equilibrium. This bounded region is known as a phase envelope, a
saturation envelope or the two phase region. A phase envelope shows the boundaries
between a single and the two phase region for a multicomponent mixture at equilibrium
conditions. These lines are known as the bubble point line and the dew point line. They
meet at the critical point of the mixtures on pressure (P) and temperature (T) plot. Fig 2.1
shows a typical phase envelope for a reservoir fluid where the liquid is found to the left
of the bubble line and the vapor region is found to the right of the dew point line. At the
bubble point line where the mixture is found to be in liquid with incipient amount of gas,
this liquid at this point is said to be saturated. On the other hand, on the dew point line
where the mixture is found to be in vapor form with a slight amount of liquid, the gas at
this stage is said to be saturated.

Figure 2-1: Typical phase envelope of a reservoir fluid

Phase envelopes are instrumental in the classification of reservoirs, classifying the


naturally occurring hydrocarbon systems and also used to describe the characterizations
of phase diagrams of the reservoir fluid. A reservoir classification is based on the relative
location of the initial reservoir temperature (Ti) and pressure (Pi) with respect to the
reservoirs fluid phase envelope. This groups reservoirs into two types of hydrocarbon
reserves which are either a natural gas or oil reservoirs. A reservoir is classified as a
natural gas reservoir if its temperature is higher than the fluid critical temperature. While
it is classified as an oil reservoir if its temperature is lower than the fluid critical

6
temperature. Due to the wide range of the physical and chemical properties associated
with hydrocarbon reservoirs, oil reservoirs are further classified into three main types of
reservoirs. These are: undersaturated oil reservoir, saturated oil reservoir and the gas-cap
reservoir. Gas reservoirs on the other hand are grouped into four main classes namely,
retrograde gas-condensate reservoir, near-critical gas condensate, wet gas reservoir and
dry gas reservoir.

Phase envelopes are also essential for identifying the various types of reservoir fluids.
Reservoir fluids are classified into five main groups, namely: dry gas, wet gas, gas
condensate, volatile oil and black oil. These are the most commonly identified petroleum
reservoir fluids. A phase envelope comes as a very useful diagram when identifying
which class a reservoir fluid belongs. The various types of reservoir fluids are
distinguished by the relative location of the mixtures critical temperature point to the
reservoir initial temperature as shown in Fig 2.2. Reservoir fluids are also identified by
conditions and locations of the critical temperature and the cricondentherm (highest
temperature) on the phase envelope with the initial reservoir condition. The reservoir
depletion paths are very important in further understanding the characteristics of these
fluids i.e. when a reduction in the temperature and pressure conditions occurs due to
production. For a dry gas the reduction in pressure and temperature conditions has no
impact on the number of phases that will occur during the reservoir depletion path as well
as surface depletion path. A wet gas also does not produce two phases during its
depletion but is more likely to produce a liquid if the temperature and pressure conditions
are reduced further. A gas condensate on the other hand will form a two phase with

7
decreasing pressure, this happens on the dew point branch. The presence of heavy
hydrocarbons expands the phase envelope relative to a wet gas. The reservoir temperature
lies between the critical point and the cricondentherm. Gas condensate reservoirs are also
referred to as a retrograde condensate reservoir because of the anomalous behavior it
exhibits. A retrograde condensate is when a liquid is formed by an isothermal decrease in
pressure or isobaric increase in temperature which is used to characterize these types of
reservoir fluid. Both black and volatile oil will enter into a two phase at the bubble point
line and the new phase formed will be gas if there is a substantial reduction in
temperature and pressure. But the critical points differ in relative distance to the reservoir
temperature condition which is shown by Fig 2.2 of the five types of reservoir fluid.

Figure 2-2: Phase envelope of the various types of reservoir fluids (after Pedersen and
Christensen).

8
Nichita (2008) described the construction of a phase envelope as a very important
problem in phase equilibrium calculation. This is due to its many applications in chemical
thermodynamics and hydrocarbon reservoir thermodynamics. The different classes of the
reservoir fluid are essential information for the proper design of petroleum processes.
Phase envelopes are very useful in the design of surface facilities (e.g. separators),
primary production, gas injection processes, enhanced oil recovery and design of pipeline
networks for transportation of natural gas by pipeline or in liquefied natural gas (LNG). It
is also a very good foundation for further studies of the complex nature of hydrocarbon
reservoir fluids. It also has applications in ethane plus recovery, refrigeration processes
and operation near critical point or supercritical region. The amount of experimental and
theoretical work which has gone into the study of phase envelope construction indicates
its importance in trying to solve the phase equilibrium problems faced by petroleum and
refinery engineers in the petroleum industry and the general engineering field today.

2.1 Phase Envelope Calculations


Phase equilibrium calculations started as far back as the late 1800s and the early 1900s
with notable works by the likes of Gibbs and van der Waals who postulated the first
equation of state in 1873. These two were among the first researchers to formulate the
concepts and mathematical relationship in which a phase behavior of gases could be
understood better. This relationship was very applicable to the petroleum industry which
used traditional PVT correlations to analyze phase behavior of reservoir fluids.

9
In spite of the complexity of hydrocarbon fluids found in reservoir rocks, simple cubic
equations of state have shown surprising performance in the phase behavior calculations
for both the vapor-liquid and vapor-liquid-liquid equilibrium of these reservoir fluids.
Equation of state is a thermodynamic equation which defines the state at which a given
fluid or mixture is under given physical conditions, it also provides relationship between
two or more state functions associated with the fluid. Peng-Robinson EOS and Soave
RK EOS are the two most widely used equations of state in phase equilibrium
calculations. Their equations provide simplicity and also a reasonable amount of accuracy
for phase equilibrium calculations when compared with experimental data. Both
equations of state were making modifications to the Van der Waals earlier proposed
equation While SRK proposed a generalized empirical expression in terms of the
accentric factor which provided a better vapor-liquid equilibrium results, PengRobinsons modifications made a slightly improved description of the liquid densities.
However, Peng-Robinsons equation of state is more preferred in the oil and gas industry
because it generates results which are in good agreement with experimental data for
hydrocarbon mixtures.

2.1.1 Phase Envelope Construction

There are various ways in which a phase envelope is constructed. Phase envelopes are
essentially constructed by the determination of the bubble point and dew point line of a
given system that are plotted on a PT diagram. This could be on a constant composition
or constant temperature line. One method in which the points of a phase envelope could
be obtained, is to determine them through experimental methods in a laboratory. A

10
simple laboratory test that could be used to determine the bubble point and dew point of
multicomponent mixtures is through the use of PVT cells. These PVT cells could be
operated at the value of pressure and temperature which are of interest. The PVT cells
consist of a mechanism in which pressure and temperature can be varied. Pressure could
be varied by either mercury injection\withdrawal or by a mechanically driven piston.
Temperature can be varied with an instrument known as a climatic air bath. The
saturation points are being noted visually. The noting of the vapor phase or liquid phase
is done through a special window. Samples of a fixed composition are loaded from a
separate chamber or are prepared directly in the PVT cell. Once a homogeneous single
phase is achieved, pressure depletion is carried out by taking note of the phase changes
through the window. This phase changes could also be monitored by video recording
machine. The procedure is then repeated for a new isotherm. This method of determining
the bubble points and dew points is both time consuming and expensive. The
experimental method is not always the best way to achieve a phase envelope. In many
cases it is not always possible to obtain laboratory measurements.

Another method for phase envelope construction is by using empirical correlations.


Various empirical correlations have been generated from experimental results and field
data which could also be used for estimating properties of reservoir fluids. Phase
envelope could be constructed using correlations of the bubble points and dew points
pressure. For bubble point pressure, some of the major correlations that are used are by
Standing, Lasater, Vasquez-Beggs, Glaso and Maroun correlations. Standing (1947)
developed the first accurate correlation which was from California oil. He proposed a

11
graphical correlation for determining the bubble point pressure and later expressed the
graph by Eq. (2.1) shown below
(2.1)

Pb = 18.2[( Rs / g )0.83 (10)a 1.41]


where:
a = 0.00091T - 0.0125(API)
Pb = bubble point pressure, psia
Rs= solution gas to oil ratio SCF/STB
T =Temperature,oF

Lasater (1953) used a different approach in which the mole fraction of solution gas was
used as the main correlating parameter. In this approach the gas mole fraction is
dependent mainly on solution gas/oil ratio. Lasaters correlation is given by equation Eq.
(2.1) shown below

Pb = A

(2.2)

where the function A(yg) interpolated graphically and can be described by,
1.17664 y g

yg 0.57246 ; y g 0.6

(2.2a)

1.08000 y g

yg 0.31109 ; yg > 0.6

(2.2b)

A = 0.83918 10
A = 0.83918 10

133, 000( / M )0
y g = 1 +

Rs

and,

(2.2c)

12
Pb = bubble point pressure, psia
Rs= solution gas to oil ratio SCF/STB
T =Temperature, oR

Glaso (1980) used Standings approach for North Sea oils, where he made a correction
for the non-hydrocarbon content and stock tank paraffinity which at the time was not
widely used, due to the unavailability of data. His correlation is shown in by Eq. (2.1)
log pb = 1.7669 + 1.7447 log A 0.30218(log A) 2

(2.3)

where:
0.989
A = ( Rs / g )0.816 (T 0.172 / API
)

(2.3a)

Pb = bubble point pressure, psia


Rs= solution gas to oil ratio SCF/STB
T =Temperature, oF

There are fewer correlations for dew points compared to the bubble point. Amongst the
few notable dew points correlations are the Nemeth and Kennedy (1967) in which a dew
point pressure was proposed based on the composition of the C7+ and its properties. The
Nemeth and Kennedy correlations is given by Eq. (2.1) shown below

ln Pd = Z c2 + Z co2 + Z H 2 S + Z c6 + Z c3 + Z c4 + Z c5 + 0.4 Z c1 + 0.2 Z N 2 + A2 c7+

Z c1
2
3
+ A4T + A5 Z c7+ M c7+ + A6 Z c7+ M c7+ + A7 Z c7+ M c7+
+ A3
Z c7+ + 0.002

M c7+
+ A8
c7+ + 0.0001

M c7+
+ A9

c7+ + 0.0001

M c7+
+ A10

c7+ + 0.0001

+ A11 ,

(2.4)

13
where:
A1= -2.0623054, A2= 6.6259728, A3= -4.4670559 x 10-3, A4= 1.0448346 x 10-4, A5=
3.2673714 x 10-2, A6= -3.6453277 x 10-3, A7= 7.4299951 x 10-5, A8= -1.1381195 x 10-1,
A9= 6.2476497 x 10-4, A10= -1.0716866 x 10-6 and A11= 1.0746622 x 101.

This correlation is applicable to dew points pressure between 1,000 and 10,000 psia and
temperatures from 40 to 320oF with a wide range of reservoir compositions. The accuracy
of the dew points pressure is between +/- 10%. This is because the experimental accuracy
is determined with only +/- 5%. Other correlations used for dew points pressure are
Organick and Golding (1952) and Kurata and Katz (1942), both of which were presented
in graphical forms.

Empirical correlations are developed for specific petroleum reservoir fluids originating
from a specific geographical field. The correlations typically match the employed
experimental data with a reasonable error percentage. Due to the peculiarity of empirical
correlations, many of them have limited applicability and can produce large errors when
applied to reservoir fluid samples from other geographical fields. These correlations all
have various limitations in which their applications are successful.
Equation of state has found reasonable success in phase envelope and phase equilibrium
calculations. Asselineau, Bogdanic and Vidal (1979) proposed an algorithm for the
construction of a phase envelope in which they paid special attention to the applicability
of the method in critical and high-pressure regions because of the trivial solutions which
was attained with false unit of equilibrium constants. Their procedure was said to be

14
applicable to any analytical equation of state. Their method involves the simultaneous
solution of 2n+ 4 equations for each point of the phase envelope (where n is the number
of components in the system). The method proposed gives an initial guess of the
unknowns and ensures a successful iterative procedure.

The derivative used was

obtained as soon as equilibrium was attained since the Newton-Raphson is highly


sensitive to the initial guess. This was made to diagnose the retrograde condensation
process and provides a rapid stepwise calculation.

Michelsens (1980) proposition,

which was later corroborated by Yau-Kun and Long (1982) in their review of phase
envelope construction to be a very efficient algorithm for the phase envelope points
calculations. Michelsen formulated the simultaneous solution of n+2 equations for each
point calculations rather than the single solution of two simultaneous non linear equations
as earlier proposed by Asselineau et al. In order to enhance the convergence, this
algorithm selects internally the set of primary variables and the step size to the
subsequent point on the diagram. The initial guess is obtained by extrapolation. He also
suggests that Newton-Raphson scheme should be used in the critical region and the
retrograde regions as a solution for the non-linear equations. With this, an automatic
selection of the better convenient specification variable is obtained from the previous
calculation for the saturation points. Yau-Kun and Nghiem (1982) developed a general
phase envelope algorithm which was an extension of the work by Michelsen, in which
the bubble point and dew point are traced in one pass. The method was extended to the
generation of phase envelopes on pressure-composition, temperature-composition and
composition-composition diagrams. Yau-Kun et al. (1982) highlighted the major
difficulties which are associated with phase envelope generations as:

15

1. Tracing the dew point line is a tedious task. This is because of the presence of a
lower dew point and upper dew point of mixtures.
2. Near the critical region it is not clear which of the saturation line is to be iterated
i.e. whether it is the bubble point or the dew point line.
3. Also that the variable specification is done manually for example while
constructing a pressure-temperature diagram in terms of the pressure and
temperature values.

Ziervogel and Poling (1983) made another attempt to improve on the method of
calculation of phase envelopes points for multicomponent mixtures. In their work they
proposed a simple method in which an initial guess was to be iterated while drawing the
bubble point line and another guess for the dew point line. This method is easier than
previous methods because the bubble point and dew point are determined by iterating on
a single variable through the critical region. Their work used Soaves modification of the
Redlich-Kwong equation of state, which was used in the phase envelope points
calculation by Michelsen (1980) and Asselineau et al (1979). They used the same method
of calculating the dew and bubble points, which is by stepping around the phase envelope
in small increments of pressure or temperature values. To generate the complete phase
envelope the bubble points are first calculated. The calculation is started at low pressure
up-to the critical point, after this the dew point curve is then generated. Their methods
success is primarily guessing on which iteration variable is to be used during either the
dew point or the bubble point calculation. The method works because derivatives with

16
respect to only one variable are needed for convergence. And this depends on the success
of selecting the right variable as the iteration parameter. When comparing the complexity
of the calculations, it is an improvement to the earlier proposed methods. Although the
emphases on the iteration method being correct for calculation of phase envelopes in
choosing the iteration parameter was not tested for all cases of reservoir fluids. Also near
the critical region, it is not clear whether a bubble point or dew point should be computed
and the specifications of the variables to be iterated are done manually.

Michelsen (1994) later used a method in which the phase envelope was to be calculated
without the iterative determination of equilibrium phase compositions. The individual
points on the phase envelopes were solved by using two equations, irrespective of the
number of the components in the mixture. The requirement for the composition
derivatives of the fugacity coefficient was developed. His method is not based on a full
Newton-Rhapson procedure. The method is said to be simple because the rate of the
convergence is not adversely affected in the critical region. One of the limitations of this
method is that the solution at a given temperature and pressure cannot be obtained
directly. Instead, it should be calculated or interpolated.

Firoozabadi (2003) compared various calculations steps in characterizing the non linear
equations which define the two phase flash calculations. The methods investigated were
the successive substitution method, the Newtons method, the dominant eigenvalue
method and the global convergent Newton method. This work suggested the tangent
plane distance for the equilibrium calculations initialization. Either the Newtons method

17
or the successive substitution method combined with the tangent plane distance can
greatly make the two phase calculations relatively easier according to the authors. But
what was not investigated was how efficient the suggested algorithm was, compared to
other algorithm for the two phase flash calculation for phase envelope points. Nitichita
(2007) recently used a reduction method for phase equilibrium calculations in his work.
In the method he replaced the traditional variables such as mole numbers, mole fractions,
partition coefficient with some linear combinations of them. He took advantage of the
Jacobian matrix extrapolation from the previous step calculations. This work had the
robustness and efficiency for larger number natural hydrocarbons with as many as 24
components.

Another class of equation which could be used to calculate phase envelope points is
known as the non cubic equation of state. Alfradique (2007) compared the performance
of the one cubic equation to two other non cubic equations. In his work he stated that the
most widely accepted of the non cubic equation of states are the SAFT family and the
modifications like PC-SAFT and SAFT-VR. It was noted that the non cubic equation of
states error margin was much greater than the conventional cubic equation of state like
Peng-Robinson EOS comparing it with at least 29 multicomponent hydrocarbon
mixtures.

18
2.2 Critical, Cricondenbar and Cricondentherm Calculations.
Three distinct points define the shape and location of a phase envelope. These three
points are known as the critical point, cricondenbar and cricondentherm as illustrated in
Fig 2-2. The cricondentherm is defined as the highest temperature at which a mixture can
exist in both liquid and vapor phase together, while the cricondenbar is the highest
pressure at which a mixture can exist in the two phase regions. For a gas condensate
reservoir the cricondentherm and cricondenbar are important from production,
transportation and processing viewpoints. Lastly, the critical point is the point at which
there is no distinct difference between the vapor and liquid phase. At this point, the two
phases become indistinguishable. The critical point could also be defined as the point at
which the dew point line and the bubble point line meets. This critical point defines a
unique state for vapor and liquid coexistence in a reservoir fluid. All three points can be
determined experimentally. The cricondentherm and cricondenbar can both be
extrapolated from a complete phase envelope construction but the critical point has to be
determined either experimentally or through calculations which utilize either correlations
or equations of state equilibrium flash algorithm.

Due to the sensitivity related to the point for single and multicomponent hydrocarbons,
there have been several methods used for calculating the critical points of natural gas
mixtures.

19

Figure 2-3: Phase envelope showing cricondentherm, cricondenbar and critical point.

Attempts have been made at calculating the cricondentherm and cricondenbar of


hydrocarbon fluid. Etter (1961) came up with an empirical correlation for the calculation
of critical, cricondentherm and cricondenbars pressure and temperature value of phase
envelope for multicomponent mixtures of normal paraffins i.e. of hydrocarbon with
relatively low molecular weight and light hydrocarbons. A set of equations to calculate
the pressure and temperature value of the critical, cricondentherm and cricondenbar were
generated from plotting the critical pressure and the average molecular weight and also
from a plot of the temperature with the average molecular weight for binary mixtures.
The reason for this limitation to the empirical equation proposed was that most of the

20
data available at this time were for these classes of hydrocarbon. Hence, the critical
properties could be calculated with the equations below for the temperature and pressure:

( Pc )mix = xi Pci + ( Pcdi , xi )

(2.5)

(Tc) mix = WiTci + (Tcx Tcx )

(2.6)

i 0

for cricondentherm the pressure and temperature is given by:

( Pct )mix = xi Pci + ( Pctdi , xi )

(2.7)

(Tct ) mix = Wi Tci + (Tctd ) xL (Tctd )

(2.8)

andcricondenbarpressureandtemperatureiscalculatedwith:

( Pcb )mix = xi Pci + ( Pctdi )


For

ci

<0.5,

(Tcb )mix = WT
i ci + (Tcbci Tcbci1 )
While

ci

(2.9)

(2.10)

>0.5,

(Tcb )mix = WT
i ci + (Tcbd )i
where
x = mole fraction,
= function of,
W= weight fraction,
L= lighter component,
i= any component.

(2.11)

21
P and T denote pressure (psia) and temperature (oR) respectively. The subscript c, ct and
cb represent critical, cricondentherm and cricondenbar respectively. While the subscript
cd, ctd and cbd represent the excess critical, excess cricondentherm and excess
cricondenbar.

The excess pressure and temperature is the critical temperature and pressure calculated as
the product sum of the critical constant and the compositions of all the components, in
which the lowest molecular weight component produces the greatest effect in proportion
to the amount present. These empirical calculations are specific to individual paraffin
which requires constants which are not easily obtainable. Although it was shown that this
method gives reasonable result with the normal paraffin investigated, Thodos and
Silverman (1962) came up with an equation to solve for the temperature and pressure
value of cricondenbar and cricondentherm. They used statistical techniques to develop a
relationship between the characteristics of binary hydrocarbon and the temperature and
pressure of the two points on the phase envelope. The equation formulated was highly
inaccurate for methane systems Grieves and Thodos (1963). Grieves et al (1963) gave a
similar correlation for calculating the cricondentherm and the cricondenbar temperature.
He developed a correlation using graphical interpretation. His work was more general for
reservoir fluid with higher error percentage, which was as high as 2.41 and low as 0.26
for cricondentherm and was in the range of 0.12-4.27% for the cricondenbar temperature
when compared with experimental data. To calculate the temperature for the
cricondentherm and cricondenbar the information needed was the critical temperatures of
the pure components, normal boiling points and approximate vapor pressures. For the

22
calculation of the temperature of the cricondentherm and cricondenbar he gave the
equations below:

T '

Tt / Tc ' 1 = b 1 ( e5.40 xl 3.39 ) + 0.01;0 < xl 0.55


Tb

(2.12)

T '

Tt / Tc ' 1 = b 1 ( e6.38 xl 4.38 ) 0.418 xl + 0.256;0.55 < xl < 0.925


Tb

(2.13)

T '

Tp / Tc ' 1 = b 1 ( e4.33 xl 3.62 ) + 0.008;0 < xl < 0.7


Tb

(2.14)

T '

Tp / Tc ' 1 = b 1 ( e6.33 xl 5.14 ) 0.165 xl + 0.116;0.7 < xl 0.925


Tb

(2.15)

where,
Tt= cricondentherm temperature, oR
Tp= cricondenbar temperature, oR
Tb= atmospheric boiling point of mixture, oR
Tb= normal boiling point of ith component, oR
Tc= pseudocritical, pseudocricondentherm, or psuedocricondenbar temperature of
mixture (method of calculation depends on number of components), oR

xl = mole fraction of low-boiling component.

Grieves et al (1963) in a follow up work, made the same empirical correlations for the
cricondenbar and cricondentherm pressures. Comparing with experimental data they had
an error percentage as high as 13.98 and low as 0.88 for cricondentherm pressure. While
for the cricondenbar pressure they had percentage errors from the range of 0.84-9.52. The

23
pressure values were more directly related to the plot of Pt / Ppc versus T 'b / Tb . Which the
cricondentherm pressure can be directly solved from. Also the cricondenbar pressure was
extrapolated from the plot of Pp / Ppc versus T 'b / Tb .
Where:
Pp = cricondenbar pressure of mixture, psia

Pt = cricondentherm pressure of mixture, psia


Ppc = pseudocritical, pseudocricondentherm, or psuedocricondenbar pressure of mixture

(method of calculation depends on number of components), psia

Taraf, Behbahani and Moshfeghian (2008) generated a numerical algorithm for the direct
calculation of the cricondentherm and cricondenbar pressure and temperature of natural
gas of known composition which he based on Michelsens (1985) method. This method
was based on the fact that the derivatives of the pressure with respect to the temperature
at the cricondenbar are equal to zero and also the derivatives of the temperature with
respect to pressure at the cricondentherm are equal to zero. Their method also utilizes the
equality of fugacity for each component in both phases. They proposed that for the
cricondentherm and cricondenbar calculation should be done by:

First make an initial guess for temperature and pressure

Calculate initial liquid mole fractions (xi), n using Eq. (2.16) to solve
simultaneously with initial guesses of temperature and pressure

gn = ln (zi) - ln (xi) + ln (iv) - ln (il) = 0

(2.16)

24
where:
zi = mole fraction of component in mixture
xi = component liquid phase mole fraction
iv = fugacity coefficient of component i in vapor phase
il = fugacity coefficient of component i in liquid phase
Q = modified tangent plane distance

With the values of xi and temperature solve for dQ/dT=0 for a new
temperature for cricondenbar or dQ/dP for a new pressure for
cricondentherm.

Perform Newtons iteration using Eq. (2.16) and Eq. (2.17) with the new
pressure/temperature which was earlier calculated in the previous step

g n +1 = 1

xi = 0

(2.17)

If the temperature/pressure does not converge go back to the third step.

They also investigated the ranges for the initial guesses. This was said to be of a value in
the two phase region. The proposed algorithm was found to be in excellent agreement
with experimental results and values from common simulation software for the cases
tested.

For the critical point calculations various methods have been proposed for the direct
calculation. Due to the peculiarity of the critical point of multicomponent mixtures,

25
Firoozabadi (2006) explained that the composition changes which occur is so often in
some applications that there is a need to calculate the critical point as many as 108 times.
A major motivation of their work was that current methods lack robustness and
efficiency for the calculation of the critical point for multicomponent mixtures. Most of
the current methods were based on decreasing the pressure in some increments and
carrying out phase split calculations. These methods mostly require rigorous calculations
with as much iteration, which are very time consuming and predictions are not 100%
accurate because of errors associated with equilibrium calculations.

A major correlation can be derived from the cricondentherm, cricondenbar and the
critical point of a phase envelope with the composition of a reservoir fluid. If such a
relationship can be established, it will capture and represent the equilibrium calculations
for phase envelope construction which is associated with the complex nature of natural
gas reservoirs. The principal challenge if this research therefore, is to try and establish the
most effective neural network that can give the best results in making these predictions in
terms of the temperature and pressure values; and to also determine which of the input
parameter is most relevant in this relationship. It will be of paramount interest to be able
to estimate the critical points, the cricondentherm (highest temperature) and the
cricondenbar (highest pressure) through the help of an expert system. In doing this, a
faster and more convenient way of constructing the phase envelope through the
temperature and pressure of the key points will be presented.
The importance of phase envelope to the petroleum industry cannot be over emphasized.
The accuracy of being able to predict the location of the critical temperature and pressure

26
along with the cricondentherm and cricondenbar goes a long way in being able to get a
better phase envelope and enhance our understanding of the fluid/gas in the reservoir.
Artificial neural network (ANN) would eliminate the time for extensive phase
equilibrium calculations needed for the prediction of the phase envelope through the
generation of an expert system. This expert system is intended to understand the non
linear relationship between various natural gas reservoir compositions of C1-C7+, specific
gravity and the molecular weight of the C7+ with the critical points, the cricondentherm
and cricondenbar pressure and temperature values for faster estimation of the shape of the
phase envelope.

2.3 Artificial Neural Network


The complexity of how information is being analyzed by the brain has been the focus of
research for the past decade. It has been known that the human brain utilizes 1011 neurons
(biological) while trying to understand and facilitate reading, breathing, motion and
thinking. Each of these biological neurons is a rich assembly of tissues that has the
complexity, if not the speed, of a microprocessor. Part of this was formed at birth while
the others were formed by experience. In the quest for better and faster solutions to the
very complex engineering problems, the artificial neural network (ANN) was formed.
This neural network was aimed at trying to mimic the behavior of the biological neurons
Fausett (1994).
Neural network has been described as a network of simple processing elements
(neurons), which can exhibit complex global behavior, determined by the connections
between the processing elements and the element parameters. The efficiency of the

27
artificial neural network can still not be compared with the biological neural but still,
similarities exist that cannot be denied in their mode of achieving the task. These
similarities are:
1. The building blocks of both networks are through simple computational devices
which are extremely interconnected.
2. Also, the connections between them determine how efficient the network is.

Figure 2-4: Neural network with three layers

A typical example of an interconnected neural network architect is shown in Fig 2-4


where the network utilizes a three layer system with four inputs and three outputs that are
arranged in multiple layers. Every neural network possesses knowledge which is
contained in the values of the connections weights. Stergiou C and Siganos D (2007)

28
explained that changing the knowledge stored in the network as a function of experience
implies a learning rule for changing the values of the associated weights. For example
each input parameter in Fig 2-4 has its own weight with it. Demuth and Beale (2003)
stated that there are essentially two types of training which is utilized in training a neural
network. These are known as the supervised and the unsupervised training. The
supervised training applies an external boundary, so that each output unit is told what its
desired response to input signals ought to be. During the learning process global
information may be required. Examples of supervised learning include error-correction
learning, reinforcement learning and stochastic learning. An important issue concerning
supervised learning is the problem of error convergence, i.e. the minimization of error
between the desired and computed unit values. The aim is to determine a set of weights
which gives the least error. One well-known method, which is commonly used in many
learning paradigms, is the least mean square (LMS) convergence. But the unsupervised
learning uses no external boundary and is based upon only local information. This is also
known as self-organization, in the sense that it re-organizes data presented to the network
and detects their developing collective properties. An example of unsupervised learning
is competitive learning. From human neurons to artificial neurons other aspect of learning
concerns the distinction or otherwise of a separate phase, during which the network is
trained, and a following operation phase. A neural network is said to learn off-line if the
learning phase and the operation phase are distinct. A neural network learns on-line if it
learns and operates at the same time. Usually, supervised learning is performed off-line,
whereas unsupervised learning is performed on-line.

29
The performance of a neural network basically depends on the weight and the transfer
functions (which are the input and output functions). These functions are basically
categorized into three groups, namely: the sigmoid, linear and threshold. For the sigmoid
the output varies continuously but not linearly as the input changes. Sigmoid units bear a
greater resemblance to real neurons than do linear or threshold units, but all three must be
considered rough approximations. In the linear transfer function, the output activity is
proportional to the total weighted output. While for the threshold transfer function the
output is set at one of two levels, depending on whether the total input is greater than or
less than some threshold value (Neural Network Toolbox).
Hagan, Demuth and Beale (1996) gave the general order to train a neural network to
perform some task, in which the weights must be adjusted. This adjustment is such that
the error between the desired output and the actual output is reduced. This process
requires that the neural network compute the error derivative of the weights (EW). In
other words, it must calculate how the error changes as each weight is increased or
decreased slightly. The back propagation algorithm is the most widely used method for
determining the error derivative of the weights.

2.3.1 Backpropagation Learning

Backpropagation is said to be the simplest neural networks algorithm in which the


information flow is in one path (Neural Network Toolbox). This is an example of
supervised learning in which an input vector and the corresponding output (target) vector
are used to train the network until it can approximate a function, associate input vectors

30
with specific output vectors, or define input vectors in an appropriate way as defined in
the training algorithm. In a more complex problem, information can flow in more than
one direction. Conjugate gradient backpropagation uses traincgf as a network training
function. The traincgf updates weight and bias values according to conjugate gradient
backpropagation. The backpropagation learning type of learning algorithm was used in
this work. Training stops when either one of the following stipulated condition is meet.
The conditions are either:

The specified maximum number of epochs (repetitions) is reached

The maximum amount of time is exceeded( if specified)

The performance is minimized to the goal.

The total number of iterations is reached.

The artificial neural network finds its uses in a variety of industries such as medicine,
banking and finance, marketing, and also in the petroleum industry. Extensive research
has been done on how applicable ANN is, especially to the oil and gas industry. In
drilling engineering, artificial neural network as been useful to solve for optimum bit
selection Yilmaz, Demircioglu and Akin (2002) and applied to predicting the operating
conditions for optimum surface condensate recovery that yields the highest API gravity
an aspect of petroleum production engineering Al-Farhan and Ayala (2006), furthermore
in reservoir studies to understand the compositional behavior of gas cycling operations in
gas condensate reservoirs Ayala and Ertekin (2007). ANN proves to be a powerful and
viable tool in our industry today with further research being undertaken daily.

31
Mann (2007) used artificial neural network to generate an intelligent system for the
design of natural gas storage facility. In his study, he utilized artificial neural network in
two ways. First he used it to model the behavior of a gas storage facility, secondly he
then used ANN for actual design optimization of a storage facility. He proposed a
network of ten input neurons and four output neurons connected by two hidden layers.
These two hidden layers had fifty and twenty five neurons respectively.

Briones et al (1994) also found ANN to be applicable in the prediction of reservoir


hydrocarbon mixture composition using production data. They used input parameters
such as the GOR and API of two Venezuelan regions with marked differences in the fluid
properties. With their target (output parameter) being the composition of C1, C2-C6, C7+
and CO2. Their network showed another applicability of how useful ANN is in the
petroleum industry. With being able to predict accurately a system of fluid composition
based on earlier production parameters.

In utilizing ANN for equilibrium conditions predictions, Gonzalez, Barrufet and


Startzman (2003) proposed an expert system to predict dewpoint pressure of retrograde
gases which they achieved with an average error of 8.74% which is more reliable than the
multiple regression techniques. Using an experimental data of the dew point pressure to
train the network they were able to achieve their goal with one input layer with 13
neurons and one hidden layer with 6 neurons and one output layer with one neuron. In
comparing their results with the available correlations it was found that neural network is
much more in agreement with the experimental data than the equations of state which is

32
the best empirical correlation in estimating phase equilibrium. Birang et al (2007) also
used neural network model to predict the minimum miscibility pressure for hydro carbon
gas injection processes, in which both the condensing and vaporizing mechanism of the
gas flooding was going to be considered to produce a robust model which will be
applicable to any composition no matter which mechanism is dominant in achieving
miscibility. Moghadassi, Parvizian and Hosseini (2009) from experimental data, training
with back propagation used a new method which was based on artificial neural network
to solve for vapor-liquid equilibrium data for a binary system (nitrogen-n-pentane) for
improving oil recovery for nitrogen injection into reservoirs.

To estimate the pressure and temperature values for the construction of a phase envelope,
neuro simulation study is carried out. ANN seems very plausible for training an expert
system that would achieve these goals. Using FOTRAN for the thermodynamic
calculations coupled with soft computing tool MATLAB.

The network will

understand the relationship between the input parameter (natural gas compositions and
properties) and the output parameter (pressure and temperature corresponding to the
critical point, cricondentherm and cricondenbar) for this prediction to be possible. The
expert system ANN should be able to predict this temperature and pressure values which
would be used to predict the relative shape and position of a phase envelope.

Chapter 3
Problem Statement
A proper analysis of many petroleum problems requires knowledge of at least a portion
of the phase diagram. An accurate knowledge of natural gas phase behavior is of essential
value for both industrial processes and optimum operating conditions. Calculation
method for phase envelope points is classified into two main types. These are the
equilibrium flash calculations and the Gibbs energy minimizations. These points could
also be experimentally determined.

Three points can be used to define the characteristics and shape on the phase envelope of
natural gas. These points are known as critical point, the cricondentherm and the
cricondenbar. If these three points can be predicted with good accuracy the entire phase
envelope can be well approximated. Great importance is then attached to the
cricondentherm, cricondenbar and the point of criticality of pressure and temperature
values. These three points on the phase envelope will in great essence help in estimating
the shape of a phase diagram of a reservoir fluid or gas which shows the region which the
liquid and vapor will coexist.

In the past, general empirical correlations and relationships have been proposed for the
cricondentherm, cricondenbar and the critical point. This work considers the three points
which defines the phase envelope to be estimated with relations to just the compositions

34
of natural gas, specific gravity of C7+, with the molecular weight of the C7+ as the input
parameter. This research work with the aid of a neural network aims to help in points
calculation which is particular to phase envelope construction. It also aims at giving a
faster and reliable pressure and temperature values for the phase envelope estimation for
a robust range of natural gas composition.

This study presents an expert system that utilized the advantages of ANN in which speed,
simplicity is used to learn the relationship between the input parameters (compositions of
methane C1, ethane C2, propane C3, butane C4, pentane C5, hexane C6, heptanes C7+,
hydrogen sulfide H2S, nitrogen N2, and carbon dioxide CO2 and also molecular weight of
the C7+ (MW C7+) with the specific gravity of C7+ (SG C7+)) and the output parameters
(corresponding pressure and temperature value of critical, cricondentherm and
cricondenbar). The model will also be able to analyze which of the input parameter is
most relevant in relation to the corresponding output for the critical point, cricondenbar,
cricondentherm pressure and temperature. Lastly, the network proposed will enable us to
find the most relevant of the input to influence the entire phase envelope model
(combining all three points pressure and temperature value).

35
Chapter 4
ANN Model Development
The state/phase in which a natural gas mixture exists is greatly sensitive to temperature
and pressure conditions. Different factors account for these pressure and temperature
condition in which this multicomponent mixture of hydrocarbons exists as. This
sensitivity can be captured by a phase diagram which consists of an envelope. The phase
envelope shows the most complete, straightforward and visual representation of the
behavior of the fluid in different phases with the corresponding temperature and pressure
ranges. For this reason an improvement in the construction of the phase envelope is being
focused on using the artificial neural network.
This neural network utilizes the characteristics related to each natural gas compositions
phase envelope. These characteristics include the composition of the natural gas mixture
(H2S, CO2, N2, C1, C2, C3, C4, C5, C6, C7+.) as well as the specific gravity and the
molecular weight of the C7+. Characterization of the C7+ is an important aspect of the
pressure-volume-temperature (PVT) predictions and phase envelope calculations.
1840 different mixtures were generated for this work. Great deal of importance is placed
on the data which is being used to train and establish the nonlinear relationship between
the input and output variables. Thorough and careful selection process was utilized in the
creation of the data set which was used to train the neural network for the phase
envelope.
The data were generated through the use of FORTRAN compiler. A program was written
to generate different natural gas composition combination. So as to have wide range of

36
data set to train the network with. Hydrocarbons compositions used are methane C1,
ethane C2, propane C3, butane C4, pentane C5, hexane C6, and heptanes C7+. With non
hydrocarbon present as hydrogen sulfide H2S, nitrogen N2, and carbon dioxide CO2.
Lastly, the molecular weight of the C7+ (MW C7+) and specific gravity of C7+ (SG C7+)
accounting for the C7+ hydrocarbons. The sum of all the composition of in the mixture
must be equal to 1. Hence the equation total mixture composition is given as Eq. (4.1)

(Total Component in the Mixture compositions) = 1

(4.1)

To make sure that there was a good distinction of the data created. A plot showing the
variation of the input data set used comparing the networks training and testing. As
shown for C1 in Fig 4-1. This aimed at making sure that an even distribution of the
natural gas compositions was created for the phase envelope points for both the training
and the testing of the neural network model. C1 composition was generated using Eq. 4.2
given below and bounded by Eq. 4.1 for all the possible combination of natural gas
mixture which had a C1 composition of value greater than 0.403 or as specified.
C1= 1- [(CO2 + N2 + H2S + C2 + C3 + C4 + C5 + C6 + C7+ )]

(4.2)

The data selected for the artificial neural network was carefully selected to generate a
have a wide range of the phase envelope points pressure and temperature values for the
network proposed. The possible natural gas combination with the ranges of inputs data
given in Table 4-1 would obviously be infinite. The total mixture composition that was
selected for the study was a true representative range of composition that would give the

37
largest pressure and temperature values of the cricondentherm, cricondenbar and the
critical point from the entire data that was generated.
The range of the input data that was generated is shown in Table 4-1 where the minimum
and maximum values of the input data are highlighted. Table 4-2 displays the
intermediate values utilized during the creation of the data set.
Table 4-1: Phase envelope input data range
Inputs

Minimum

Maximum

Hydrogen Sulfide, H2 S

0.0000

0.1500

Nitrogen, N 2

0.0000

0.1500

Carbondioxide, CO2
Methane, C1
Ethane, C2
Propane, C3

0.0000
0.4030
0.0100
0.0040

0.1500
0.9400
0.2000
0.1300

Butane, C4

0.0050

0.1200

Pentane, C5

0.0050

0.1200

Hexane, C6
Hepatane-Plus, C7+
Molecular Weight MW C7+ ( lb/lbmol)

0.0050
0.0100
100

0.1200
0.2000
260

Specific Gravity, SG C7+

0.6000

0.8800

Table4-2:Phase envelope possible actual values used for training

H2 S
N2
CO2
C1
C2
C3
C4
C5
C6
C7+
MWC7+
SGC7+

Min
0
0
0
0.404
0.01
0.004
0.005
0.005
0.01
0.01
100
0.6

Max
0.15
0.15
0.15
0.94
0.2
0.13
0.12
0.12
0.1
0.16
260
0.88

Units
Examplesofvaluesusedfortraining
fraction 0.00,0.01,0.02,0.05,0.037,0.15,0.112
fraction 0.00,0.01,0.02,0.05,0.037,0.15,0.112
fraction 0.00,0.01,0.02,0.05,0.037,0.15,0.112
fraction 0.404,0.454,0.51,0.62,0.74,0.83,0.94
fraction
0.055,0.15,0.01,0.02,0.067,0.03,
fraction 0.01,0.03,0.045,0.01,0.13,0.04,0.004
fraction
0.033,0.093,0.01,0.05,0.08,0.12
fraction 0.05,0.1,0.055,0.04,0.033,0.08,0.093
fraction
0.04,0.03,0.085,0.053,0.01,0.066
fraction
0.126,0.01,0.053,0.085,0.03,0.16
lb/lbmol
100,120,160,180,200,220,240,260
unitless
0.6,0.63.0.67,0.74,0.79,0.81,0.88

38

Fig 4-1 displays the frequency of C1 data employed for the creation of the testing and
training data set. This histogram shows the frequency of methane composition in the
natural gas mixture used for training and testing of the networks. The figure shows that
the variation of the methane (C1) which was used in the network training and testing data
was larger for natural gas composition within the range of 0.45-0.55 methane.

Figure 4-1: C1 Ranges for Training and Testing

4.1 Phase Envelope Neural Network Data


One of the most important factors in training an efficient neural network model is to
choose the content and source of the data which will be used for training and testing the
neural network carefully and accurately. This is why various methods in which we could
acquire data were investigated and carefully screened.

39
In order to generate the data needed for the network a phase envelope algorithm had to be
used. The algorithm which was used to generate the data for the phase envelope points is
based on Gibbs tangent plane criterion, which establishes the thermodynamic stability of
a phase. This method of phase calculation known as the Michelsens Stability or the
tangent plane method. Michelsen (1982) proposed this method which initial estimates for
the number of phases present at equilibrium or either for the equilibrium factors is not
specified at the beginning of the calculation. The method finds whether a given
composition has a lower energy remaining as a single phase which is also the stable
phase or whether the mixture Gibbs energy will reduce by splitting the mixture into two
or more phase which is the unstable region. Phase stability is whether a mixture at a
given temperature and pressure can attain a lower energy by splitting into two or more
phases. The Gibbs energy for a composition zi is given as Eq. (4.1)
N

Gz = ( ni i ) z

(4.1)

I =1

And if the mixture will split into two phase then Gz is greater than Gmix where Gmix is
given as Eq. (4.2)
N

Gmix = ( ni i )V + ( ni i ) L
i =1

where:
Gmix= Gibbs energy of mixture
ni
i

= no of components
= chemical potential of component i within a phase

(4.2)

40
The phase stability or the Michelsens Stability test allows us to predict the number of
phases of the fluid. The phase stability comprises of formation of two hypothetical vapor
and liquid like phases using the overall composition data provided. This data (phase
stability) when combined with the entire algorithm helps to predict the fluid behavior at a
higher level of intricacy thus increasing its precision. The tangent plane distance uses a
tangent to the Gibbs minimum energy curve (which is plotted assuming a single phase
exists) at the overall composition of the mixture (which is being tested for stability) for a
particular temperature and pressure. Then a trial phase is created such that the tangent to
the Gibbs minimum energy curve is parallel to the tangent drawn before. Now if the new
tangent lies below the previous one then the mixture being tested then it is unstable and
the phase split will occur otherwise single phase is stable. For our case single phase
stability is tested only against two phase to obtain a phase envelope representing vapor
liquid equilibrium. And once two phases is achieved a phase envelope data is extracted
for the mixture which corresponds to the temperature and pressure point of the
cricondentherm, cricondenbar and critical points. This then becomes the networks output
data.

In order for the networks data to be consistent with the degree of the input data and for
better understanding of the networks result, the outputs pressure and temperature were
normalized. The critical condition of methane was the reference point for normalizing the
pressure and temperature values of the cricondentherm, cricondenbar and critical point
which is calculated by the equations given below
TN = T / Tc

(4.5)

41
PN = P / Pc

(4.6)

where,
TN = normalized temperature (TN) for the cricondenbar, cricondentherm and critical point
PN = normalized pressure for the cricondenbar, cricondentherm and critical point
T= Temperature (K)
P= Pressure (Psia)
Tc= Critical temperature of methane (190.45K)
Pc= Critical pressure of methane (667.19 psia)

4.1.1 Neural Network Model


A neural network study is limited by how complex the relationship between the input and
the output are, how fast the network architects learns this relationship, the learning
algorithm being specified. Four neural networks was implemented study. The critical
point, the cricondentherm, the cricondenbar, and the three coordinate network was
proposed. This was used to first understand the ability of the neural network to
understand the non linear relationship which exists between the natural gas compositions,
specific gravity of the C7+ and its molecular weight with the output variable being each
individual points reduced temperature and reduced pressure of the cricondenbar,
cricondentherm and the critical. The three coordinate network was then proposed for the
phase envelope construction. The phase envelope points (critical point, cricondentherm
and cricondenbar) neural networks were also used to predict which of these points is
closely related to the phase envelope network architects in terms of complexity of

42
neurons. Pressure and temperature value of the cricondenbar, cricondentherm and critical
of a natural gas phase envelope is more in a scattered pattern within the ranges provided
for each points as shown in Table 4-3, 4-4, 4-5,. This range is further elaborated on in
Figs 4-3, 4-4, 4-5, which shows the testing and training data set for the cricondenbar,
cricondentherm and critical normalized pressure and temperature values respectively.
These plots were used to clarify that the networks proposed was being trained and giving
results based on the network simulation rather than solving for the same points which is
used for its training ( i.e. solving for the same points in both training and testing of the
neural network). Showing this diversity a plot of various natural gas phase envelopes
cricondentherm, critical point and cricondenbar is given in the figure below,
14

Cricondenbar
Cricondentherm
Critical

12

10

PN

0
1

1.5

TN

2.5

3.5

Figure 4-2: Sample of various envelopes showing distribution of pressure and


temperature values

43

The minimum and maximum value for the normalized temperature and pressure created
for the phase envelope points is shown Table 4-3, 4-4, 4-5 for the critical points,
cricondentherm and cricondenbar respectively,
Table4-3:PN and TN Range for Cricondenbar Neural Network
Cricondenbar

Minimum Maximum

Normalized Pressure (PN)

1.988

14.15

Normalized Temperature (TN)

1.389

2.529

Table4-4:PN and TN Range for Cricondentherm Neural Network


Cricondentherm

Minimum Maximum

Normalized Pressure (PN)

0.5775

2.595

Normalized Temperature (TN)

1.679

3.783

Table4-5:PN and TN Range for Critical Neural Network


CriticalPoints

Minimum Maximum

Normalized Pressure (PN)

0.898

11.32

Normalized Temperature (TN)

0.82

3.518

The total 1840 data that was used for this study was divided to 1440 was used for each
proposed networks training, while 400 was used for testing the networks simulation. So
for each individual point of interest on the phase envelope the output points were also
plotted so as to show the point distribution of the output values as shown in i.e.
corresponding values of the temperature and pressure of the cricondenbar,

44
cricondentherm and the critical point as shown in Figs 4-3, 4-4, 4-5. This was done in
order to validate the output (targets) of the network was actually learning the relationship
as opposed to memorizing. And also to show that there was a distinct difference between
the data that was used for training and testing of the network.
Finally comparing the all three points and the areas in which the network proposed was
applicable a plot showing this was used. This plots shows that the largest area was the
critical points data which is also an indication of the disparity in the values for the
network which closes relates to the complexity of the network which is being proposed as
shown in Fig 4-6.

Figure 4-3: Testing and Training Data for Cricondenbar Network Model

45

Figure 4-4: Testing and Training Targets Data for Cricondentherm Network Model

Figure 4-5: Testing and Training Targets Data for Critical Network Model

46

Figure 4-6: Ranges for the Temperature-Pressure 3-Coordinate Network Model


Thus the networks training and testing data set was created for inputs and output ranges.
The four neural networks used the same ranges of the phase envelope characteristics for
testing and training the respective neural networks. The networks proposed used the
backpropagation with the newcf command. This was found to give the best result in
building the network models. This created a cascade-forward network which consists of
the input layer, hidden layer and the output layer. This cascade-forward network uses the
weight function, input function, and the specified transfer function. The first hidden layer
has weights coming from the input. Following each subsequent layer has weights coming
from the input and all previous layers. All layers have biases. The last layer is which the
output layer is corresponding to the targets. Also the sigmoid transfer functions were used
in the training of the neural network. The two sigmoid functions used are tansig and
logsig which were used in the hidden layers. While the linear transfer function (purelin
transfer function) was used for the output layer.

47
With the data created, interchanging one of the following parameters,
The amount of neurons used
The number of hidden layers used
Transfer functions specific to each layer
Training algorithm used
The parameters set for training to be achieved (goals, time and maximum number
of epoch).
the most efficient neural network is proposed.

48
Chapter 5
Results
A neural network was trained to understand the non linear relationship between the input
parameters and output parameters of an expert system whose goal was to be able to
predict the pressure and temperature points of a phase envelope diagram. Composition of
H2S, N2, CO2, C1, C2, C3, C4, C5, C6 and C7+, with the molecular weight of the C7+ (MW
C7+) and specific gravity of C7+ (SG C7+) were the networks input parameters. The
outputs were the normalized pressure and normalized temperature of the cricondenbar,
cricondentherm and the critical point. The neural network architects were used in the
development of the phase envelope ANN Model for this study. Four different neural
networks were proposed in this work. This work was divided into two stages. In the first
stage, three different networks were modeled to predict the pressure and temperature
points corresponding to the cricondenbar, cricondentherm and the critical points. The
second stage was the three points neural network in which all points corresponding to
the phase envelope was utilized to be able to predict the corresponding envelope.
To evaluate the performance of each of the network the percentage of errors were
compared. This error was calculated by the comparing the predicted values of the ANN
Model to the actual values generated through simulation. The percentage error is
calculated as
error % =

AA t
*100
t

(5.1)

where AA is the value predicted by the network and t in the actual input value generated
by the simulation.

49
5.1 Stage One Cricondenbar, Cricondentherm and Critical Points Network Models

The first stage of the phase envelope neural network model study comprised of using
artificial neural network to predict the pressure and temperature points corresponding of
each of the points on the phase envelope which are the cricondenbar, cricondentherm and
the critical points.
Stage one was developed to account for the individual points that characterizes the phase
envelope which are the cricondenbar, cricondentherm and the critical points pressure and
temperature values. This stage compares the network proposed for the cricondenbar, the
cricondentherm and the critical points to each other in terms of complexity and which is
most related to the 3-coordinate network for the phase envelope. This stage is sub-divided
into three sections for each of the phase envelope points neural network models. Using
the composition of

H2S, N2, CO2, C1, C2, C3, C4, C5, C6 and C7+, with the molecular

weight of the C7+ (MW C7+) and specific gravity of C7+ (SG C7+) as the networks input
parameters. This was trained to understand each individual points normalized pressure
and temperature outputs for each respective phase envelope point. The same set of data
was used for both stage studies.
The analysis and results of the respective neural networks in this stage are given in
sections 5.1.1, 5.1.2and 5.1.3for the cricondendar, cricondentherm and critical point
neural network respectively.

50

5.1.1 Cricondenbar Neural Network


In training neural network for the cricondenbars pressure and temperature points,
network of four layers was created. The MATLAB code created is given in Appendix A.
The architect implemented 12 input neurons, and had two hidden layer with 15 neurons
in each layer as shown in neural network architect in Fig 5-1.

Figure 5-1: Neural Network Architect for Cricondenbars Training and Testing
Fig 5-1 shows the input parameter were the composition of H2S, N2, CO2, C1, C2, C3,
C4, C5, C6 and C7+, with the Molecular weight of the C7+ (MW C7+) and specific gravity
of C7+ (SG C7+). The normalized pressure and temperature of the cricondenbar was the

51
output layer for the network model. The total data used for this network was 1840 natural
gas compositions. As earlier stated 1440 was used to train the network and 400 was used
for testing the network model. The final result of the expert system is presented in Fig 5-2
andFig 5-3,

Figure 5-2: Training (left) and Testing (right) Result Plots for the Normalized Pressure of
Cricondenbar Points

52

Figure5-3: Training (left) and Testing (right) Result Plots for the Normalized Temperature of
Cricondenbar Points

53

It could be seen from Fig 5-2andFig 5-3 above that this network is capable of predicting
the corresponding values of pressure and temperature with the average error less than +/4%, which is a good indication that of the strength of this network. In analyzing this
expert system three different plots were used. An error percentage, a histogram error plot
and finally, a plot of the actual versus predicted whose values are supposed to be centered
on the unit slope line (which is the crossplot). The percentage error plot was used in
comparing the actual percentage of the error being calculated and which ranges the error
being calculated were. The histogram is particularly useful in depicting what ratio the
error percentage is being distributed. The histogram shows the frequency of the error
being calculated. Ideally, the highest frequency should be zero for an accurate expert
system. Verifying the results further a cross plot is used. This is a plot of the predicted
and the actual centered on a 45o slope line. This is used as a reference of the error
deviation. A +/-10 % line was introduced to the crossplot which acts as a boundary line
for the 45o slope line in comparing the errors of the final result. This was done in order to
get a better approximation of the error calculated for the result as it was seen to be
scattering above even the 10% for the some network prediction. For a perfect trained
network the points should be found on this line or as close as possible (45o slope line).
It could be seen that with this model presented that the error results were indeed moderate
for the normalized temperature and pressure corresponding to the cricondenbar. This
network thus is a good predictive tool for the highest point of pressure value on a phase
envelope plot i.e. cricondenbar points for pressure and temperature. This model is shown

54
to be applicable to the composition values within the ranges provided in Table 4-3. Also
the relevancy of the input which is used for the training of this network was investigated.
For this analysis the relevancy proposed by Belue and Bauer (1995) is used where the
relevancy input is calculated by Eq. (5.2) given below,
n

Si = |sij |,

(5.2)

j 1

where Sij represents the weight of relevance of input I on neuron j of the first hidden
layer and n is the number on neurons the relevancy of each input in the architect proposed
for the cricondenbar is given in Fig 5-4.

Figure 5-4: Relevancy for each input for Cricondenbar

55
It can be seen from the plots that the heavy fraction (C7+) composition and the properties
had a large influence on the cricondenbar neural networks prediction. Also the methane
(C1) and the nitrogen (N2) which is an impurity had a considerable large influence on the
neural network with approximately 11.3% and 11.7% respectively. The CO2 and H2S
which are the other impurity present in this reservoir fluid had an influence which was
less than 6%.
Concluding from the results of the cricondenbar expert system, it is capable of predicting
the temperature and pressure of natural gas composition.
5.1.2 Cricondentherm Neural Network
After analyzing the neural simulation study, a neural network which utilizes two hidden
layer was found to be the best for the cricondentherm expert system. This neural network
model for the cricondentherm pressure and temperature the network uses four layers. The
architect used 12 input neurons for the input layer, and had two hidden layer with 10
neurons in each layer followed by two output neurons. This architect used the logsig
transfer function for the first two layers. The outer layer transfer function was purelin.
This networks combination of neurons and the transfers functions were found to be the
best combinations for the temperature and pressure values prediction for the
cricondentherm points. The proposed expert systems architect is shown in Fig 5-5.
The same set of plots that were used for the analysis of the cricondenbar neural network
model was used here to analysis the proposed cricondentherms expert systems
performance. The error percentage plot, the histogram plots and the cross plot. The three

56
different plots showing the variation of the error being obtained by the network architect.
The results of the expert system are given in the subsequent Fig 5-6 and Fig 5-7.

Figure 5-5: Neural Network Architect for Cricondentherms Training and Testing

This neural network architects plot shown above produces error within an acceptable
range of less than 3% for testing and training data range which was used. It can be seen
that the expert systems histogram barely had error calculated other than zero which is a
good indication of the accuracy of the network model. The range of the cricondentherm
pressure and temperature value which this network is applicable is shown in Table4-4.

57
Also obtained was the relevancy of the input of data set on the networks model which is
given in Fig 5-8.

Figure5-6: Training (left) and Testing (right) Result Plots for the Normalized Pressure of
Cricondentherm Points

58

Figure5-7: Training (left) and Testing (right) Result Plots for the Normalized
Temperature of Cricondentherm Points

59

Figure 5-8: Relevancy percentage for the Cricondentherm neural network

It can be seen from the relevancy plot that the most predominant in the network model
prediction was the composition (C7+). The methane C1 composition and the molecular
weight of the (C7+) had a great influence on the models compared to other input
parameter. The nitrogen did not have as much influence on the cricondentherms model
as in the case of the cricondenbar neural network model. H2S had a similar influence
which was approximately 5% but comparing the total impurities influence the
cricondentherm neural network had a lesser influence on the model prediction than that
of the cricondenbar neural network.

60
This expert system can be seen to predict the pressure and temperature within a very
reasonable error percent ranges. The range for the error was well within [+2% -2%] for
both the pressure and temperature value for the range of the natural gas composition used
for this study.

5.1.3 Critical Neural Network

Figure 5-9: Architect for the Critical Neural Network


A three hidden layer network as shown in the network architect in Fig 5-9 was most
efficient for the critical point neural network. This gives the best results with the least of
the error calculation in prediction of the pressure and temperature value of the critical
points, this was achieved after a series of different types of transfer function and amount

61
of hidden layer to find which is most optimum combination. The network proposed
utilizes 15 neurons in the first hidden layer and 19 neurons each in the second and third
hidden layers. It was also found out that the tansig transfer function was best fit for the
training and testing of this network of all the layers in the network. The results plots of
the network model is given in Fig 5-10 and Fig5-11,

Figure 5-10: Training (left) and Testing (right) Result Plots for the Normalized Pressure
Points of Critical Points

62

Figure 5-11:
Training (left) and Testing (right) Result Plots for the Normalized
Temperature of Critical Points

63

The critical point was the most complex model comparing the three points of the neural
network model points developed individually. This network utilized a three hidden layer
network to understand this relationship. The tansig transfer function was used in the three
hidden layer with the purelin at the output layer. It could be seen from the plot that the
error predicted were still moderate even thou the results were not as good as the
cricondentherm or the cricondenbars model. Also the relevancy which is given below in
Fig5-12, shows that the highest still remain the heavies C7+ which is in the range of
15.5% followed by the nitrogen N2 with a percentage of approximately 11%. The
impurities had similar influence compared to the cricondenbar neural network.

Figure 5-12: Relevancy Percentage for the Critical Neural Network

64
5.2 Stage Two- 3-Coordinate Neural Network
The 3-coordinate points which define the phase envelope neural network model is
presented in the stage two of this ANN model study. Stage two consisted of finding a
neural network which integrates all the three main points of the diagram in one model.
This neural network should be able to predict the corresponding temperature and pressure
value of the cricondenbar, cricondentherm and the critical point. The proposed network
for this which gives the best results for the phase envelope points is given in Fig5-13,

Figure 5-13: Phase Envelope Neural Network Architect

65

As shown in Fig5-13the input parameter were the composition of H2S, N2, CO2, C1, C2,
C3, C4, C5, C6 and C7+, with the Molecular weight of the C7+ (MW C7+) and specific
gravity of C7+ (SG C7+). And the output parameters being the normalized pressure and
temperature of the cricondenbar, cricondentherm and critical point values were the
networks output layer for the 3-coordinate neural network model.
The phase envelope neural network utilizes a three hidden layer network. This network
uses 20 neurons in the first and second hidden layer. The final hidden layer has 15
neurons. This network used the tansig transfer function in the three hidden layer and a
purelin transfer function in the output layer. This was achieved using the ANN toolbox
developed by MATLAB. Details about the MATLAB code can be found in Appendix B.
The result analysis was similar to the set utilized in the stage one of this study. This uses
the error percentage plot, histogram plot and the crossplot of the actual versus the
predicted. The results analyzed each of the pressure and temperature points of the
cricondenbar, cricondentherm and the critical point individually. These results are
presented in Figs 5-14 to 5-19 below for each respective points of the three coordinate
neural network proposed.
A relevancy study was also used to determine the ratio of each of the input parameter to
the 3-coordinate network model (phase envelope ANN) which is presented in Fig 5-20.

66

Figure 5-14: 3-Coordinate Cricondenbar Training (left) and Testing (right) Pressure Results
Plots

67

Figure 5-15: 3-Coordinate Cricondenbar Training (left) and Testing (right) Temperature Results
Plots

68

Figure 5-16: 3-Coordinate Cricondentherm Training (left) and Testing (right) Pressure
Results Plots

69

Figure 5-17: 3-Coordinate Cricondentherm Training (left) and Testing (right)


Temperature Result Plots

70

Figure 5-18: 3-Coordinate Critical Training (left) and Testing (right) Pressure Result
Plots

71

Figure 5-19: 3-Coordinate Critical Training (left) and Testing (right) Temperature Result
Plots

72

Figure 5-20: Relevancy Plot for the Phase Envelope Input


It can be seen from the results in this stage that the 3-coordinate neural network produced
similar results to the ones in stage one. This network is able to predict the corresponding
temperature and pressure of the cricondenbar and the cricondentherm and the critical
point for the ranges of natural gas mixture which were used for this study. Also, all
inputs parameter had a relevancy in the phase envelope prediction. The highest relevancy
was the compositions of methane C1 and C7+ with 14%, while the specific gravity of the
C7+ was approximately 13.7%. The impurities had a total of 17% on the network
prediction.

Chapter 6
Summary and Conclusion
A powerful tool has been developed using artificial neural network which is capable of
predicting key phase envelope points which are the cricondenbar, cricondentherm and
critical point pressure and temperature of natural gas composition provided that the
composition analysis data is available. Also developed is a tool which estimates the
pressure and temperature value of the points which defines the phase envelope
individually. The study examined in two stages. The first three neural networks were
developed to investigate the ability of artificial neural network in prediction of these
individual points on the phase envelope. A total of 1840 different mixture composition
was used in training and testing each of the neural networks proposed. It can be seen
from the plots that the best results was the cricondentherm pressure and temperature
points and also the easiest which requires the least complex network architect. The
histogram plot shows error calculate was between the range of [-2% +2%] for the
cricondentherm pressure while cricondentherm temperature was between [-1% +1%] for
both the testing and training results. The cricondenbar pressure on the other hand
although needing a more complex network which utilized an extra layer of neuron more
than the cricondentherm network model to achieve the desired results had similar
network performance. The error range for the cricondenbar pressure training error was
within [-4% +4%] and testing was [-3% +4%]. Cricondenbar temperature also had the
same error range as the cricondentherm which was [-1% +1%] for both the testing and

74
training the network model. This shows that the neural network models for the natural
gas mixtures can effectively predict the cricondentherm and cricondenbar point.
For the critical point error results were slightly higher for both the temperature and
pressure values. The temperature point were predicted with errors within +/- 5% for both
testing and training, while the critical pressure prediction was in [-5% +10%] error
margin.
The second stage was developing a 3-coordinate neural network which represents the
three points defining the shape of the phase envelope. Using the histogram plot for result
analysis, the error calculated for the cricondenbar pressure training was in the range of [4% +4%] while the testing data was predicted with error calculated in the range of [-5%
+4%]. The cricondenbar temperature error for testing and training were calculated within
[-1% +1%]. The cricondentherm point had error less than the cricondenbar points
predicted for the neural network proposed. The cricondentherm pressure training was
calculated error was in the range of [-3 +3%] while the cricondentherm temperature
testing and training error was [-1% +1%]. The critical point value was predicted with a
higher percentage error when compared to the other two points of the 3-coordinates
network model. The critical points pressure training was in the range of [-10% +10%]
and the testing was calculated in the range of [-10% +10%]. The critical point
temperature values training was in the range [-4% +4] and testing error was [-2% +4%].
The 3-coordinate network model was able to match the training and testing error
percentage for the three points which defines the phase envelope when compared to the
individual neural network model developed in the first stage.

75
It was also noticed that the temperature values for each of this points were predicted with
lesser error than the pressure values of all points. The C7+ composition was consistent in
the relevancy of both stages model proposed.
The neural network proposed gives a fast and reliable way in which phase envelope could
be estimated with minimum error for the points defining the shape. These model
proposed network shows very promising result for further related work. The model could
be improved by introducing additional data in which the model is trained with (i.e.
experimental data). An infusion with experimental data in the data set would probably
improve the result quality of the envelope prediction. This could probably improve the
error percentage which is most synonymous with the critical point prediction.

76
Bibliography

Al-Farhan, F and Ayala L.: Optimization of Surface Separation Conditions for natural
Gases Using Artificial Using Artificial Intelligence, Journal of Petroleum
Science and Engineering, v.53, p. 135-147, August 2006.

Alfradique, M. F. and Castier, M.: "Calculation of Phase Equilibrium of Natural Gases


with the Peng-Robinson and PC-SAFT Equations of State," Oil and Gas Science
and Technology, v. 62, p. 62, p. 707-714, 2007.

Asselineau, L., Bogdanic, G., Vidal, J.: "A Versatile Algorithm for Calculating VaporLiquid Equilibria," Fluid Phase Equilibria, v. 3, p. 273-290, 1979.

Ayala, L. F. and Ertekin, T.: "Neuro-Simulation Analysis of Pressure Maintenance


Operations in Gas Condensate Reservoirs," Journal of Petroleum Science and
Engineering, v. 58, p. 207-226, 2007.

Mann III, Austin W.: Intelligent Design of Natural Gas Storage Facilities M.Sc.
Thesis, The Pennsylvania State University, University Park, 2007.

Belue, L. M., and Bauer, K. W.: "Determining Input Features for Multilayer
Preceptrons," Neurocomputing, v. 7, n.2, p. 111-121, 1995.

77

Briones, M. F., Corpoven, S. A. Rojas, G. A., Moreno, J. A. and Martinez E. R.:


Applications of Neural Networks in the Prediction of Reservoir Hydrocarbon
Mixture Composition from Production Data, paper SPE 38855, Presented at
the Annual Technical Conference and Exhibition held in New Orleans, LA, USA,
25-28 September 1994.

Danesh, A.: "PVT and Phase Behavior of Petroleum Reservoir Fluids," Elservier, Second
Edition p. 221-234, 2001.

Demuth, H. and Beale, M.: "Neural Network Toolbox for Use with Matlab," User's
Guide, v.4, The MathWorks, 2007.

Etter, D. O and Kay, W. B.: "Critical Properties of Mixture of Normal Paraffin


Hydrocarbons, "Journal of Chemical Engineering Data, v. 1, p 409-414, 1961

Fazlali, A., Modarress, H. and Monsoori, G. A.: "Phase Behavior of Complex Fluids,"
Fluid Phase Equilibria, v. 179, p. 297-317, 2001.

Firoozabadi, A., Hoteit, H. and Santiso, E.: "An Efficient and Robust Algorithm for the
Calculation of Gas-Liquid Critical Point of Multicomponent Petroleum Fluids,"
Fluid Phase Equilibria, v. 241, p. 186-195, 2006.

78
Gonzlez, A., Barrufet, M.A.and Startzman, R.: Improved neural-network model
predicts dew point pressure of retrograde gases, Journal of Petroleum Science
and Engineering, v. 37, p. 183-194, 2003.

Grieves, R. B. and Thodos, G.: "Cricondentherm and Cricondenbar Pressures of


Multicomponent Hydrocarbon Mixtures," SPE Journal, v. 4, p.240-246, 1964.
SPE 865.

Grieves, R. B. and Thodos, G.: " Cricondentherm and Cricondenbar Temperature of


Multicomponent Hydrocarbon Mixtures" SPE Journal, v. 3, p.287-292, 1963.
SPE 612.

Manafi, H., Mansoori G. A. and Ghotbi, S.: " Phase Behavior Prediction of Petroleum
Fluids with Minimum Characterizations Data," Journal of Petroleum of Science
and Engineering, v. 22, p. 67-93, 1999.

Michelsen, M. L.: "Calculation of Phase Envelopes and Critical Points for


Multicomponent Mixtures", Fluid Phase Equilibria, v. 4, p. 1-10, 1980.

Michelsen, M. L.: "The Isothermal Flash Problem. Part I. Stability", Fluid Phase
Equilibria, v. 9, p. 1-19, 1982.

79
Michelsen, M. L.: "The Isothermal Flash Problem. Part II. Phase-Split Calculation," Fluid
Phase Equilibria, v. 9, p. 21-40, 1982.

Michelsen, M. L.: "Calculation of Critical Points and Phase Boundaries in the Critical
Region", Fluid Phase Equilibria, v. 16, p. 57-76, 1984.

Michelsen, M. L.: "Saturation point Calculations", Fluid Phase Equilibria, v. 23, p. 181192, 1985.

Ming-Jer L., and Jui-Tang, C.: "fluid Property Predictions with the Aid of Neural
Networks" Industrial and Engineering Chemistry Research, v. 32, p. 995-997,
1993.

Nichita, D. V.: "Calculations of Critical Points Using a Reduction Method," Fluid Phase
Equilibria, v. 1228, p. 223-231, 2005.

Nichita, D. V.: "Phase Envelope Construction for Mixtures with Many Components,"
Energy and Fuels, v. 22, p. 488-495, 2008.

Pedersen, Karen Schou and Christensen Peter, L.: "Phase Behavior of Petroleum
Reservoir Fluids ", v. 1, p. 1-11.

80
Peng, D.Y. and Robinson, D.B.: "A New Two-Constant Equation of State," Industrial
and Engineering Chemistry Fundamentals,, v.15, p.59-64, 1976.

Poling B.E. and Ziervogel R.G.: "A Simple Method for Constructing Phase Envelopes
for Multicomponent Mixtures," Fluid Phase Equilibria, v. 11, p. 127-135, 1983.

Silver, E. D and Thodos George.: "Cricondentherms and Cricondenbars. Their


Prediction for Binary hydrocarbon Systems", Industrial and Engineering
Chemistry Fundamentals, v. 1, p. 299-303, 1962

Spencer, F. C. and Daubert, T. E.: "A Critical Evaluation of Methods for the Prediction of
Critical Properties of Hydrocarbon," AIChE Journal, v. 19, p.482-485, 1973.

Stergiou, C. and Dimitrios, S.: "Neural Networks www.doc.ic.ac.uk.

Taraf, R., Behbahani, R., and Moshfeghian, M.: "Direct Prediction of Cricondentherm
and Cricondenbar Coordinates of Natural Gas Mixtures Using Cubic Equation of
State", International Journal of Thermophysics, v. 28, p. 1954-1967, 2008.

Yau-Kan, Li., and Nghiem L. X.: "The Development of a General Phase Envelope
Construction Algorithm for Reservoir Fluid Studies," SPE 11198, Presented at
the Annual Fall Technical Conference and Exhibition held in New Orleans, LA,
USA, 26-29 September 1982.

81

Yilmaz, S., Demircioglu C., and Akin S.: "Application of Neural Networks to Optimum
Bit Selection", Computers and Geosciences, v. 28, p. 261-269, 2002.

Appendix A
Stage 1 ANN MATLAB Code Cricondenbar
close all;
clear all;
format long;
%%
%%%Load the Input files for the testing and training of the network for
%%% and the Output data set....
load INP.txt;
load CriBar.txt;
load TestnIn.txt;
load CribTestOut.txt;
%%
%% Transpose the matrix into the appropriate format..
P= INP;
P = P';
T= CriBar;
T= T';
p1 = TestnIn;
p1 = p1';
t1 = CribTestOut;
t1 = t1';
%%
%%%Determine the size of the matrix in each data set......
[m1,n1] = size (p1);
[m,n] = size (P);
[mo,no] = size (T);
%%
%%
%%% Normalizing the matrix in the proper intervals [-1, 1]
[Pn,ps] = mapminmax(P,-1,1);
[Tn,ts] = mapminmax(T,-1,1);
pn=mapminmax('apply',p1,ps);
tn=mapminmax('apply',t1,ts);
%%
%%% defining the into the format of the code
trainP=Pn;
trainT=Tn;
testP=pn;
testT=tn;
%%

83
%% training the neural network for the phase envelope values
net = newcf (minmax(Pn), [15 15 mo], {'tansig' 'tansig' 'purelin'},
'traincgf','learngdm','mse') ;
%%
%%
%%% Seting the Network parameters and goals
%%% as best suited for each individual network
net.trainParam.shows=5;
%%Epochs between displays
net.trainParam.goal=0.00001; %%Performance goal
net.trainParam.epochs=6500; %%Number of iterations for training
net.trainParam.max_fail=100000;%%Maximum validation failures
net.trainParam.mem_reduc=5;
%%Factor to use for memory/speed
tradeoff
net=init(net);
%%
% Start training network for both input trainP and output trainT
[net,tr]= train(net,trainP,trainT);
% simulating the input using the matrix pn
AAA = sim (net,trainP);
% denomalizing the input
AA = mapminmax('reverse', AAA,ts);
% denomalizing the targets
BBB =sim(net,testP);
BB = mapminmax('reverse',BBB,ts);
t=T;
%%
%%% plots which is given by the \
%%% the network prediction and training
% Error calculation
errortrainingA=((AA(1,:)-(t(1,:)))./t(1,:)).*100;
Cricondenbar Reduced Pressure
errortrainingB=((AA(2,:)-(t(2,:)))./t(2,:)).*100;
Cricondenbar Reduced temperature
errortestingA=((BB(1,:)-(t1(1,:)))./t1(1,:)).*100;
Cricondenbar Reduced Pressure
errortestingB=((BB(2,:)-(t1(2,:)))./t1(2,:)).*100;
Cricondenbar Reduced temperature

%Training error for


%Training error for

%Testing error for


%Testing error for

X=[1:1:n];
XX=[1:1:n1];
binmax=10;
nbins=-binmax:binmax/10:binmax;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%
%Plots of training datas
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%
figure (2)
filename = 'CriBar Pr training';
subplot (2,2,1, 'align');

84
plot (X,t(1,:),'ko');
xlim ([0 n]);
hold on
grid on
plot (X,AA(1,:),'-r*');
ylabel('Pr for Cricondenbar');
xlabel('Data set');
h =legend ('Actual', 'Ann values','location','NorthEast');
title (filename);
xlim ([0 n]);
ylim ([0 20]);
subplot (2,2,2, 'align');
plot (XX,t1(1,:),'ro-');
grid on
hold on
plot (XX,BB(1,:),'b*--');
xlim([0 n1]);
ylabel ('Pr testing for cricondenbar');
xlabel('data set');
h =legend ('Actual', 'Ann values','location','NorthEast');
xlim([0 n1]);
ylim([0 20]);
subplot (2,2,3, 'align');
plot (X,t(2,:),'ko');
hold on
grid on
plot (X,AA(2,:),'-r*');
ylabel('Tr for Cricondenbar');
xlabel('Data set');
legend ('Actual', 'Ann values','location','NorthEast');
% title (filename);
xlim ([0 n]);
ylim ([0 20]);
subplot (2,2,4, 'align');
plot (XX,t1(2,:),'ro-');
grid on
hold on
plot (XX,BB(2,:),'b*--');
xlim([0 n1]);
ylabel ('Tr testing for cricondenbar');
xlabel('data set');
h =legend ('Actual', 'Ann values','location','NorthEast');
xlim([0 n1]);
ylim([0 20]);
figure(3)
subplot (2,2,1, 'align');
plot (X,errortrainingA,'k+');
grid on
hold on
ylabel('error % TrainingPr for Cricondenbar');

85
xlabel('Data set');
xlim ([0 n]);
ylim ([0 20]);
subplot (2,2,2, 'align');
plot (XX,errortestingA,'k+');
grid on
hold on
ylabel('error % TestingPr for Cricondenbar');
xlabel('Data set');
xlim ([0 n1]);
ylim ([0 20]);

subplot (2,2,3, 'align');


plot (X,errortrainingB,'k+');
grid on
hold on
ylabel('error % traingTr for Cricondenbar');
xlabel('Data set');
xlim ([0 n]);
ylim ([0 20]);
subplot (2,2,4, 'align');
plot (XX,errortestingB,'k+');
grid on
hold on
ylabel('error% testingTr for Cricondenbar');
xlabel('Data set');
xlim ([0 n1]);
ylim ([0 20]);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Plots of histogram and cross plots
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %binmax=5;
% nbins=-binmax:binmax/10:binmax;
% errortestingA
% % %plots
figure (4)
subplot(2,2,1)
hist(errortrainingA,nbins)
h = findobj(gca,'Type','patch');
set(h,'FaceColor','r','EdgeColor','w')
xlim([-binmax binmax]);
title('Training Pr for CriB* Histogram')
subplot(2,2,2)
hist(errortestingA,nbins)
h = findobj(gca,'Type','patch');
set(h,'FaceColor','r','EdgeColor','w')
xlim([-binmax binmax]);

86
title('Testing Pr for CriB* Histogram')
%%%%%%%%%%%%%%%%%
subplot(2,2,3)
hist(errortrainingB,nbins)
h = findobj(gca,'Type','patch');
set(h,'FaceColor','r','EdgeColor','w')
xlim([-binmax binmax]);
title('Training Tr for CriB* Histogram')
subplot(2,2,4)
hist(errortestingB,nbins)
h = findobj(gca,'Type','patch');
set(h,'FaceColor','r','EdgeColor','w')
xlim([-binmax binmax]);
title('Testing Tr for CriB* Histogram')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure (5)
subplot(2,2,1)
plot(t(1,:),AA(1,:),'bo')
grid on
hold on
x = 0.55:1:14.0;
y = x;
plot(x,y,'-k')
xlim([1.2 2.6]);
ylim([1.2 2.6]);
xlabel('Actual')
ylabel('Predicted')
title('Training CriconB Pr* Crossplot')
subplot(2,2,2)
plot(t1(1,:),BB(1,:),'bo')
grid on
hold on
x = -5.18:1:11.1;
y = x;
plot(x,y,'-k')
xlim([1.4 2.4]);
ylim([1.4 2.4]);
xlabel('Actual')
ylabel('Predicted')
title('Testing CriconB Pr* Crossplot')

subplot(2,2,3)
plot(t(2,:),AA(2,:),'bo')
grid on
hold on

87
x = 0.55:1:14.0;
y = x;
plot(x,y,'-k')
xlim([2.0 10.0]);
ylim([2.0 10.0]);
xlabel('Actual')
ylabel('Predicted')
title('Training CriconB Tr* Crossplot')
subplot(2,2,4)
plot(t1(2,:),BB(2,:),'bo')
grid on
hold on
x = -5.18:1:11.1;
y = x;
plot(x,y,'-k')
xlim([2.0 10.0]);
ylim([2.0 10.0]);
xlabel('Actual')
ylabel('Predicted')
title('Testing CriconB Tr* Crossplot')
figure (6)
plot (CribTestOut(:,1),CribTestOut(:,2),'ob');
hold on
plot (CriBar(:,1),CriBar(:,2),'or');

N:B Same program was used for the Cricondentherm and Critical Calculations only
difference is the files which was loaded.

88
Appendix B
Phase Envelope Code for MATLAB Stage Two
%%
close all;
clear all;
%%
%%%Load the Input files for the testing and training of the network for
%%% and the Output data set....
load TrainIn.txt;
load TrainOut.txt;
load TestIn.txt;
load TestOut.txt;
%%
%% Transpose the matrix into the appropriate format..
P= TrainIn;
P = P';
T= TrainOut;
T= T';
p=TestIn;
p=p';
t1=TestOut;
t1=t1';
%%
%%%Determine the size of the matrix in each data set......
[m,n] = size (P);
[mo,no] = size (T);
[m1,n1] = size (p);
%%
%%% Normalizing the matrix in the proper intervals [-1, 1]
[Pn,ps] = mapminmax(P,-1,1);
[Tn,ts] = mapminmax(T,-1,1);
pn=mapminmax('apply',p,ps);
trainP=Pn;
trainT=Tn;
testP=pn;
testT=t1;
%% training the neural network for the phase envelope values
net = newcf (minmax(Pn), [20 15 15 mo], {'tansig' 'tansig' 'tansig'
'purelin'}, 'traincgf','learngdm','mse') ;
%%
%%
%%% Seting the Network parameters and goals
%%% as best suited for each individual iterations
net.trainParam.shows=5;
%%Epochs between displays
net.trainParam.goal=0.0001; %%Performance goal
net.trainParam.epochs=10000; %%Number of iterations for training
net.trainParam.max_fail=1000;%%Maximum validation failures

89
net.trainParam.mem_reduc=5;
tradeoff
net=init(net);

%%Factor to use for memory/speed

%% training network Starts.


%% Training actual network with Just Input trainP and Output trainT
[net,tr]= train(net,trainP,trainT);

% plotperf(TR,goal,name,epoch)
plotperform(tr);
AAA = sim (net,trainP);
% denomalizing the input
AA = mapminmax('reverse', AAA,ts);
% mapminmax
BBB =sim(net,testP);
BB = mapminmax('reverse',BBB,ts);

t=T;
%%
% Error calculation
errortrainingA=((AA(1,:)-(t(1,:)))./t(1,:)).*100;
Cricondenbar Normalized temperaturebuknow sa
errortrainingB=((AA(2,:)-(t(2,:)))./t(2,:)).*100;
Cricondenbar Normalized Pressure
errortrainingC=((AA(3,:)-(t(3,:)))./t(3,:)).*100;
Cricondentherm Normalized temperature
errortrainingD=((AA(4,:)-(t(4,:)))./t(4,:)).*100;
Cricondentherm Normalized Pressure
errortrainingE=((AA(5,:)-(t(5,:)))./t(5,:)).*100;
critical Point Normalized temperature
errortrainingF=((AA(6,:)-(t(6,:)))./t(6,:)).*100;
critical Point Normalized Pressure
errortestingA=((BB(1,:)-(t1(1,:)))./t1(1,:)).*100;
Cricondenbar Normalized temperature
errortestingB=((BB(2,:)-(t1(2,:)))./t1(2,:)).*100;
Cricondenbar Normalized Pressure
errortestingC=((BB(3,:)-(t1(3,:)))./t1(3,:)).*100;
Cricondentherm Normalized temperature
errortestingD=((BB(4,:)-(t1(4,:)))./t1(4,:)).*100;
Cricondentherm Normalized Pressure
errortestingE=((BB(5,:)-(t1(5,:)))./t1(5,:)).*100;
Critical Point Normalized temperature
errortestingF=((BB(6,:)-(t1(6,:)))./t1(6,:)).*100;
Critical Point Normalized Pressure
X=[1:1:n];
XX=[1:1:n1];

%Training error for


%Training error for
%Training error for
%Training error for
%Training error for
%Training error for
%Testing error for
%Testing error for
%Testing error for
%Testing error for
%Testing error for
%Testing error for

90
binmax=10;
nbins=-binmax:binmax/10:binmax;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%
%Plots of training datas
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%
figure (2)
subplot (3,2,1, 'align');
plot (X,errortrainingA,'k+');
grid on
hold on
ylabel('error % T for Cricondenbar');
xlabel('Data set');
xlim ([0 n]);
ylim ([-10 20]);
subplot (3,2,2, 'align');
plot (XX,errortestingA,'k+');
grid on
hold on
ylabel('error % TestingT for Cricondenbar');
xlabel('Data set');
xlim ([0 n1]);
ylim ([-10 20]);
subplot(3,2,3)
hist(errortrainingA,nbins)
h = findobj(gca,'Type','patch');
set(h,'FaceColor','r','EdgeColor','w')
xlim([-binmax binmax]);
title('Training T for CriB* Histogram')
subplot(3,2,4)
hist(errortestingA,nbins)
h = findobj(gca,'Type','patch');
set(h,'FaceColor','r','EdgeColor','w')
xlim([-binmax binmax]);
title('Testing T for CriB* Histogram')
%%%%%%%%%%%%%%%%%
subplot(3,2,5)
plot(t(1,:),AA(1,:),'bo')
grid on
hold on
x = 0.55:1:14.0;
y = x;
plot(x,y,'-k')
xlim([1.2 2.6]);
ylim([1.2 2.6]);
xlabel('Actual')
ylabel('Predicted')
title('Training CriconB T* Crossplot')
subplot(3,2,6)

91
plot(t1(1,:),BB(1,:),'bo')
grid on
hold on
x = -5.18:1:11.1;
y = x;
plot(x,y,'-k')
xlim([1.4 2.4]);
ylim([1.4 2.4]);
xlabel('Actual')
ylabel('Predicted')
title('Testing CriconB T* Crossplot')
%%
%%
figure(3)
subplot (3,2,1, 'align');
plot (X,errortrainingB,'k+');
grid on
hold on
ylabel('error % P for Cricondenbar');
xlabel('Data set');
xlim ([0 n]);
ylim ([-10 20]);
subplot (3,2,2, 'align');
plot (XX,errortestingB,'k+');
grid on
hold on
ylabel('error% testingP for Cricondenbar');
xlabel('Data set');
xlim ([0 n1]);
ylim ([-10 20]);
subplot(3,2,3)
hist(errortrainingB,nbins)
h = findobj(gca,'Type','patch');
set(h,'FaceColor','r','EdgeColor','w')
xlim([-binmax binmax]);
title('Training P for CriB* Histogram')
subplot(3,2,4)
hist(errortestingB,nbins)
h = findobj(gca,'Type','patch');
set(h,'FaceColor','r','EdgeColor','w')
xlim([-binmax binmax]);
title('Testing Pr for CriB* Histogram')
subplot(3,2,5)
plot(t(2,:),AA(2,:),'bo')
grid on
hold on
x = 0.55:1:14.0;
y = x;
plot(x,y,'-k')

92
xlim([2.0 10.0]);
ylim([2.0 10.0]);
xlabel('Actual')
ylabel('Predicted')
title('Training CriconB P* Crossplot')
subplot(3,2,6)
plot(t1(2,:),BB(2,:),'bo')
grid on
hold on
x = -5.18:1:11.1;
y = x;
plot(x,y,'-k')
xlim([2.0 10.0]);
ylim([2.0 10.0]);
xlabel('Actual')
ylabel('Predicted')
title('Testing CriconB P* Crossplot')

figure(4)
subplot (3,2,1, 'align');
plot (X,errortrainingC,'k+');
grid on
hold on
ylabel('error % T for Critherm');
xlabel('Data set');
xlim ([0 n]);
ylim ([-10 20]);
subplot (3,2,2, 'align');
plot (XX,errortestingC,'k+');
grid on
hold on
ylabel('error % TestingT for Critherm');
xlabel('Data set');
xlim ([0 n1]);
ylim ([-10 20]);
subplot(3,2,3)
hist(errortrainingC,nbins)
h = findobj(gca,'Type','patch');
set(h,'FaceColor','r','EdgeColor','w')
xlim([-binmax binmax]);
title('Training T for CriConTherm* Histogram')
subplot(3,2,4)
hist(errortestingC,nbins)
h = findobj(gca,'Type','patch');
set(h,'FaceColor','r','EdgeColor','w')
xlim([-binmax binmax]);
title('Testing T for CriTherm* Histogram')
subplot(3,2,5)

93
plot(t(3,:),AA(3,:),'bo')
grid on
hold on
x = 0.55:1:14.0;
y = x;
plot(x,y,'-k')
xlim([1.50 3.0]);
ylim([1.50 3.0]);
xlabel('Actual')
ylabel('Predicted')
title('Training CriConTherm T* Crossplot')
subplot(3,2,6)
plot(t1(3,:),BB(3,:),'bo')
grid on
hold on
x = -5.18:1:11.1;
y = x;
plot(x,y,'-k')
xlim([1.50 3.0]);
ylim([1.50 3.0]);
xlabel('Actual')
ylabel('Predicted')
title('Testing CriConTherm T* Crossplot')
figure (5)
subplot (3,2,1, 'align');
plot (X,errortrainingD,'k+');
grid on
hold on
ylabel('error % P for Critherm');
xlabel('Data set');
xlim ([0 n]);
ylim ([-10 20]);
subplot (3,2,2, 'align');
plot (XX,errortestingD,'k+');
grid on
hold on
ylabel('error% testingP for Critherm');
xlabel('Data set');
xlim ([0 n1]);
ylim ([-10 20]);

subplot(3,2,3)
hist(errortrainingD,nbins)
h = findobj(gca,'Type','patch');
set(h,'FaceColor','r','EdgeColor','w')
xlim([-binmax binmax]);
title('Training P for CriTherm* Histogram')
subplot(3,2,4)
hist(errortestingD,nbins)

94
h = findobj(gca,'Type','patch');
set(h,'FaceColor','r','EdgeColor','w')
xlim([-binmax binmax]);
title('Testing P for CriTherm* Histogram')
subplot(3,2,5)
plot(t(4,:),AA(4,:),'bo')
grid on
hold on
x = 0.55:1:14.0;
y = x;
plot(x,y,'-k')
xlim([0.55 3.0]);
ylim([0.55 3.0]);
xlabel('Actual')
ylabel('Predicted')
title('Training CriConTherm P* Crossplot')
subplot(3,2,6)
plot(t1(4,:),BB(4,:),'bo')
grid on
hold on
x = -5.18:1:11.1;
y = x;
plot(x,y,'-k')
xlim([0.55 3.0]);
ylim([0.55 3.0]);
xlabel('Actual')
ylabel('Predicted')
title('Testing CriConTherm P* Crossplot')

figure (6)
subplot (3,2,1, 'align');
plot (X,errortrainingE,'k+');
grid on
hold on
ylabel('error % T for Critical');
xlabel('Data set');
xlim ([0 n]);
ylim ([-10 20]);
subplot (3,2,2, 'align');
plot (XX,errortestingE,'k+');
grid on
hold on
ylabel('error % TestingT for Critical');
xlabel('Data set');
xlim ([0 n1]);
ylim ([-10 10]);
subplot(3,2,3)
hist(errortrainingE,nbins)
h = findobj(gca,'Type','patch');

95
set(h,'FaceColor','r','EdgeColor','w')
xlim([-binmax binmax]);
title('Training T for Cri* Histogram')
subplot(3,2,4)
hist(errortestingE,nbins)
h = findobj(gca,'Type','patch');
set(h,'FaceColor','r','EdgeColor','w')
xlim([-binmax binmax]);
title('Testing T for Cri* Histogram')
subplot(3,2,5)
plot(t(5,:),AA(5,:),'bo')
grid on
hold on
x = 0.55:1:14.0;
y = x;
plot(x,y,'-k')
xlim([0.55 3.0]);
ylim([0.55 3.0]);
xlabel('Actual')
ylabel('Predicted')
title('Training Critical T_N* Crossplot')
subplot(3,2,6)
plot(t1(5,:),BB(5,:),'bo')
grid on
hold on
x = -5.18:1:15.1;
y = x;
plot(x,y,'-k')
xlim([0.55 3.0]);
ylim([0.55 3.0]);
xlabel('Actual')
ylabel('Predicted')
title('Testing Critical T_N* Crossplot')
%%%%%%%%%%%%%%%%%
figure (7)
subplot (3,2,1, 'align');
plot (X,errortrainingF,'k+');
grid on
hold on
ylabel('error % P for Critical');
xlabel('Data set');
xlim ([0 n]);
ylim ([-10 20]);
subplot (3,2,2, 'align');
plot (XX,errortestingF,'k+');
grid on
hold on
ylabel('error% testingP for Critical');
xlabel('Data set');

96
xlim ([0 n1]);
ylim ([-10 10]);
%%%%%%%%%%%%%%%%%
subplot(3,2,3)
hist(errortrainingF,nbins)
h = findobj(gca,'Type','patch');
set(h,'FaceColor','r','EdgeColor','w')
xlim([-binmax binmax]);
title('Training P for Cri* Histogram')
subplot(3,2,4)
hist(errortestingF,nbins)
h = findobj(gca,'Type','patch');
set(h,'FaceColor','r','EdgeColor','w')
xlim([-binmax binmax]);
title('Testing P for Cri* Histogram')
subplot(3,2,5)
plot(t(6,:),AA(6,:),'bo')
grid on
hold on
x = 0.55:1:12.0;
y = x;
plot(x,y,'-k')
xlim([0.55 12.0]);
ylim([0.55 12.0]);
xlabel('Actual')
ylabel('Predicted')
title('Training Critical P_N* Crossplot')
subplot(3,2,6)
plot(t1(6,:),BB(6,:),'bo')
grid on
hold on
x = -5.18:1:12.0;
y = x;
plot(x,y,'-k')
xlim([0.55 12.0]);
ylim([0.55 12.0]);
xlabel('Actual')
ylabel('Predicted')
title('Testing Critical P_N* Crossplot')

%======================================================================
=======
%======================================================================
=======
%%
%

Get relevancies
num. of neurons in 1st (input) layer

97
ni = net.layers{1}.size;
%

num. of input elements


nj = net.inputs{1}.size;

input weights MATRIX for

ith layer, jth input source

ANN.IW{i,j}

assign absolute values of input weights

for 1st (input) layer and 1st (this case only) input source

s = abs(net.IW{1,1});

for j = 1:nj
%

outer loop: over input elements


CS(j) = 0;
for i = 1:ni

inner loop: over 1st (input) layer neuron weights


CS(j) = CS(j) + s(i,j);
end
end

sum = 0;
for k = 1:nj
sum = sum + CS(k);
end

98
percentCS = CS./sum * 100;

save%('')

%======================================================================
====
%%

FIGURE: Relevancies

%======================================================================
====
figure(8);

name = ('Relevancies');

barh(CS,0.2,'k');
title('Input Relevancies');
xlabel('Relevancy');

set(gca,'YTickLabel',{...
'Hydrogen Sulfide H2S';...
'Carbondioxide CO2';...
'Nitrogen N2';...
'Methane C1';...
'Ethane C2';...
'Propane C3';...
'Butane C4';...
'Pentane C5';...
'Hexane C6';...

99
'Heptanes C7+';...
'Molecular Weight C7+';...
'Specific Gravity C7+';...
})

print ('-f','-dmeta',filename);

%
%
%
%
%

print ('-f','-depsc','-tiff',filename);
print ('-f','-r300','-djpeg100',filename);
clf('reset')

figure (9)

filename = ('Relevancies(percent)');

barh(percentCS,0.2,'k')
title('Input Relevancies (%)');
xlabel('Relevancy (%)');

set(gca,'YTickLabel',{...
'Hydrogen Sulfide H2S';...
'Carbondioxide CO2';...
'Nitrogen N2';...
'Methane C1';...
'Ethane C2';...
'Propane C3';...
'Butane C4';...
'Pentane C5';...

100
'Hexane C6';...
'Heptanes C7+';...
'Molecular Weight C7+';...
'Specific Gravity C7+';...
})

print ('-f','-dmeta',filename);

print ('-f','-depsc','-tiff',filename);

%
%
%

print ('-f','-r300','-djpeg100',filename);
clf('reset')

S-ar putea să vă placă și