Application of the Fourier Transform to Improve the Accuracy of Gamma-Based Volume Percentage Detection System Independent of Scale Thickness

: With the passage of time, scale gradually forms inside the oil pipeline. The produced scale, which has a high density, strongly attenuates photons, which lowers the measurement accuracy of three-phase ﬂow meters based on gamma radiation. It is worth mentioning that the need for multiphase ﬂow metering arises when it is necessary or desirable to meter well stream(s) up-stream of inlet separation and/or commingling. In this investigation, a novel technique based on artiﬁcial intelligence is presented to overcome the issue mentioned earlier. Initially, a detection system was comprised of two NaI detectors and a dual-energy gamma source (241 Am and 133 Ba radioisotopes) using Monte Carlo N particle (MCNP) code. A stratiﬁed ﬂow regime with varying volume percentages of oil, water, and gas was modeled inside a pipe that included a scale layer with varying thicknesses. Two detectors record the attenuated photons that could travel through the pipe. Four characteristics with the names of the amplitude of the ﬁrst and second dominant signal frequencies were extracted from the received signals by both detectors. The aforementioned obtained characteristics were used to train two Radial Basis Function (RBF) neural networks to forecast the volumetric percentages of each component. The RMSE value of the gas and oil prediction neural networks are equal to 0.27 and 0.29, respectively. By measuring two phases of ﬂuids in the pipe, the volume of the third phase can be calculated by subtracting the volume of two phases from the total volume of the pipe. Extraction and introduction of suitable characteristics to determine the volume percentages, reducing the computational burden of the detection system, considering the scale value thickness the pipe, and increasing the accuracy in determining the volume percentages of oil pipes are some of the advantages of the current research, which has increased the usability of the proposed system as a reliable measuring system in the oil and petrochemical industry.


Introduction
In various oil fields across the world, scale buildup in pipes carrying oil has resulted in several issues.The flow of petroleum products is complicated by scale development, which decreases the pipeline's effective cross-sectional area.This component makes it impossible for pumps and other machinery to function correctly.If scale builds up in the pipeline and is not detected in time, it may lead to catastrophic breakdowns, broken oil equipment, high maintenance expenses, and decreased efficiency.For this reason, employing a control system that has characteristics such as volume percentage detection is quite helpful in advancing things when scale is present.Gamma-ray attenuation systems are frequently referred to as the gold standard by researchers when calculating the different characteristics of a polyphase flow [1][2][3][4][5][6][7].A cesium source, two sodium iodide detectors, and a test pipe were utilized in the experiment described in [1].The RBF neural network was trained with data from two detectors to provide predictions about two-phase flow parameters in the bubbly, stratified, and annular regimes.These counts were used to determine the flow regimes and make volume estimates.Roshani and his coworkers [2] used GMDH-type networks trained on the unbalanced data to predict the volume percentages and flow regime.The huge computational strain they placed on the system was justified by its extraordinary precision.In 2020, researchers utilized the MLP neural network and a single pencil beam gamma-ray attenuation technique to determine the volumetric fraction of a three-phase flow [3].By using a cesium source, a test pipe, and a sodium iodide detector, Islami-Rad and his team were able to develop a method for precise volume percentage calculation [4].In a recent research paper [5], the authors looked into the viability of using GMDH neural networks to determine the presence of various flow regimes and make predictions for volume fractions.While the study's volume percentage calculations were mostly accurate, they did not account for the amount of scale present in the pipe, which was a significant restriction.The flow rates were experimented with using a two-phase automated test loop in [6], which may produce various flow patterns in a horizontal channel.The measurement package setup comprised of a Cs-137 radiation source with 662 keV photon energy and a NaI (Tl) scintillation detector to count transmissions.The preferred processing component was a multi-layer perceptron (MLP).The scale layer in the oil pipe was recently measured using a dual energy source of Am-241 and Ba-133.After the simulation of three-phase flow in stratified regimes, it was established that the amplitude of the first to fourth dominant frequency should feed into the MLP neural network.The RMSE for their estimate of scale thickness was less than 0.13 [7].Problems can arise with the use of radioisotopes as a constant power source, including those related to transportation and the requirement for personnel to wear protective gear.Therefore, X-ray tube research into measuring multiphase flow properties has gained traction of late [8][9][10][11][12].In the study [8], the researchers used an X-ray tube and a NaI detector so that they could identify the volumetric percentage and regime type of two-phase flows.The timing features of the detected signals were used to train two MLP neural networks.In [9], two-phase flows were studied by modeling them in various regimes at different volume fractions.In addition, artificial neural networks were educated by feeding them the statistical features of the incoming signals.The Monte Carlo N particle (MCNP) algorithm was used to simulate four petroleum products that combined two-by-two with various quantities and were centered on the X-ray tube [10].The signals were sent into three multilayer perceptron neural networks, which then predicted the volume ratio of the three products based on their inputs.Once the volume ratios of the first three products were established, calculating the volume ratio of the last product was a breeze.The presented method predicted the types and quantities, but was unable to reach a high degree of accuracy due to a lack of feature extraction techniques.Wavelet transformations were examined as a feature extraction approach by Balubaid et al. [11] in order to further the research [10].One outcome of this activity was the optimization of the computational burden and the improvement of accuracy.For the modeling of a volume percentage detection system using Monte Carlo N particle (MCNP), a NaI detector and dual-energy gamma generator simulations (241 Am and 133 Ba radioisotopes) were suggested.A stratified flow regime with varying volume percentages was used to transport oil, water, and gas via a conduit with varying wall thicknesses.A detector then collected the photons that travel down the pipe after gamma rays have been released from one end.The detector measured four temporal characteristics: kurtosis, mean square root (MSR), skewness, and waveform length (WL).Two GMDH neural networks were trained using the aforementioned data to provide very accurate predictions of future volumes [12].A 149.5 keV X-ray beam and two planar germanium detectors were used to forecast volume fractions in a three-phase system using X-ray transmission and scattering data, as described in [13].The MCNP6 algorithm has been used to estimate fluid volume fractions for an annular flow regime.The energy spectra from both detectors were correlated with the volume percentages of the fluids using a statistical approach based on an artificial neural network.The enhancement of the hysteretic behavior with a decrease in the microchannel diameter is investigated in [14] using current monitoring measurements and finite element numerical simulations.Microchannels with internal diameters of 5 µm and 100 µm were used for the investigation, and three solution pairings were chosen: KCl-NaCl (dissimilar ionic species with similar concentration), NaCl, and KCl (identical ionic species but different concentrations), and water.The coupling effect of the wider/tighter interfacial width and the minority pH-governing ion-driven hysteresis, which was previously established to be the genesis of EOF hysteresis, causes the EOF hysteresis to increase for the decreased channel diameter (i.e., the 5 µm microchannel).With the aid of earlier research in the sector, an effort has been made in this study to offer a volume percentages diagnosis method with excellent accuracy.A three-phase flow regime with varying volume percentages of water, gas, and oil was simulated for this purpose.Each simulation took a different scale thickness value into account.An attempt was made to forecast volume percentages with good accuracy by extracting the frequency features of amplitude of the first and second dominant signals frequency received by both detectors, and putting them to two RBF neural networks.The results of this study contributed in the following areas by: 1.
Enhancing the accuracy of the detecting mechanism.

2.
Conducting volumetric fraction measurements of a three-phase flow as it traveled through a scale-lined oil pipe.

3.
Analyzing the efficiency of the frequency characteristics in determining the volume percentages.

4.
Aggregating helpful characteristics to significantly reduce the computational load.

Simulation Setup
Many research papers have demonstrated that academics are interested in utilizing the MCNP algorithm to model X-ray or gamma radiation-using structures [15][16][17][18].The MCNP code simulation platform was used to mimic the framework suggested in this study [19].Radioisotopes 241 Am and 133 Ba are at the center of the study's suggested framework.The abovementioned dual energy source shoots photons toward a steel flow channel and gathers them at the other end using two detectors.Both of its photons have energy of 59 keV and 356 keV.Two sodium iodide detectors, each 2.54 cm × 2.54 cm, are set at an angle of 0 and 7 degrees with respect to the fictitious horizon line.In the test pipe, a three-phase flow is modeled in a stratified flow regime where it takes place.The aforementioned pipe has an internal diameter of 10 cm and a thickness of 0.5 cm.There is a scale constructed of BaSO 4 with various thicknesses inside this pipe.Scales with density of 4.5 g per cubic centimeter with thicknesses of 0, 0.5, 1, 1.5, 2, and 3 cm were installed in the pipe through which water, oil, and gas flow.Water has a density of 1, gas has a density of 0.00125, and oil has a density of 0.826 g per cubic cm in this model.This study used the MCNP code to implement the structure.In our earlier work, we conducted multiple trials to verify the simulated structure used in this research [1].Comparative analysis was undertaken between the detector responses obtained in the simulation and experiment.In order to compare the experimental and simulation data both were converted to units, as the Tally output in the MCNP algorithm is per source particle.The highest relative change for detector response data between real and simulated data is 2.2%.The outcomes indicate that the results of the experiment and the simulated outcomes correlate rather well.A total of 252 simulations were produced by using the 36 alternative volume percentages that are available for every 7 values of the scale thickness.In order to train the neural network, four features from each simulation-the amplitude of the first and second dominant signals frequency received by both detectors-were retrieved.There are four inputs and one output for each of the two neural networks.When combined, they provide the relative volumes of the gas and oil phases.It should be obvious that, by subtracting these two quantities from the initial total volume, the water volume percentage could be calculated.Figure 1 depicts the whole specified structure.Figure 2 presents an illustration of the recorded signals for both detectors in 1 cm scale thickness.
of 252 simulations were produced by using the 36 alternative volume percentages that are available for every 7 values of the scale thickness.In order to train the neural network, four features from each simulation-the amplitude of the first and second dominant signals frequency received by both detectors-were retrieved.There are four inputs and one output for each of the two neural networks.When combined, they provide the relative volumes of the gas and oil phases.It should be obvious that, by subtracting these two quantities from the initial total volume, the water volume percentage could be calculated.Figure 1 depicts the whole specified structure.Figure 2 presents an illustration of the recorded signals for both detectors in 1 cm scale thickness.  of 252 simulations were produced by using the 36 alternative volume percentages that are available for every 7 values of the scale thickness.In order to train the neural network, four features from each simulation-the amplitude of the first and second dominant signals frequency received by both detectors-were retrieved.There are four inputs and one output for each of the two neural networks.When combined, they provide the relative volumes of the gas and oil phases.It should be obvious that, by subtracting these two quantities from the initial total volume, the water volume percentage could be calculated.Figure 1 depicts the whole specified structure.Figure 2 presents an illustration of the recorded signals for both detectors in 1 cm scale thickness.

Feature Extraction
Feature extraction is a technique for transforming the existing data into a different domain, where machine learning-based algorithms can work more effectively.Additionally, the feature extraction method will decrease data dimensions, computation costs, and speed up machine learning methods.There are several ways to extract features.Feature extraction in the time domain, frequency domain, and time-frequency domain are several examples.The signals utilized in this study were transformed using fast Fourier transform (FFT) to make them more easily accessible for analysis in the frequency domain.Equation ( 1) is related to the FFT [20].Let x 0 , . . ., x N−1 be complex numbers.The DFT is defined by the formula where e i2π/N is one of the n roots of unity.Each output, X k , has to add up to N terms since there are N outputs.Amplitude of First Dominant Frequency (AFDF) and Amplitude of Second Dominant Frequency (ASDF) were identified after analyzing the signal characteristics that were converted to the frequency domain.The diagram of a frequency domain signal is shown in Figure 3.In this graph, the x-axis indicates the frequency in Hz, the y-axis the indicates the scale's thickness in cm, and the z-axis indicates the amplitude.The characteristics that were retrieved in this stage are used as inputs into neural networks to calculate the volumetric percentages independent of scale thickness.

Feature Extraction
Feature extraction is a technique for transforming the existing data into a differe domain, where machine learning-based algorithms can work more effectively.Additio ally, the feature extraction method will decrease data dimensions, computation costs, an speed up machine learning methods.There are several ways to extract features.Featu extraction in the time domain, frequency domain, and time-frequency domain are sever examples.The signals utilized in this study were transformed using fast Fourier transfor (FFT) to make them more easily accessible for analysis in the frequency domain.Equati (1) is related to the FFT [20].Let  0 , … ,  −1 be complex numbers.The DFT is defined the formula where  2/ is one of the n roots of unity.Each output, Xk, has to add up to N terms sin there are N outputs.Amplitude of First Dominant Frequency (AFDF) and Amplitude of Second Domina Frequency (ASDF) were identified after analyzing the signal characteristics that were co verted to the frequency domain.The diagram of a frequency domain signal is shown Figure 3.In this graph, the x-axis indicates the frequency in Hz, the y-axis the indicat the scale's thickness in cm, and the z-axis indicates the amplitude.The characteristics th were retrieved in this stage are used as inputs into neural networks to calculate the vol metric percentages independent of scale thickness.

Radial Basis Function Neural Network
Radial Basis Function Neural Networks (RBF NNs) are a special kind of artificial ne ral network that uses distance to provide estimates of data similarity.An RBF network a kind of artificial neural network that uses the feed-forward architecture and consists an input layer, a hidden layer, and an output layer.Radial basis functions trigger the a tivation of hidden layer neurons.The radial base function's most typical form is as follow [21]:

Radial Basis Function Neural Network
Radial Basis Function Neural Networks (RBF NNs) are a special kind of artificial neural network that uses distance to provide estimates of data similarity.An RBF network is a kind of artificial neural network that uses the feed-forward architecture and consists of an input layer, a hidden layer, and an output layer.Radial basis functions trigger the activation of hidden layer neurons.The radial base function's most typical form is as follows [21]: The distance from the cluster's center is measured in terms of a number called r.A typical bell-shaped curve is seen in Equation ( 2).An assortment of computational elements known as hidden nodes make up a hidden layer.A central vector c, a parametric vector with length comparable to the input vector x, is present in each concealed node.The following formula is used to determine the Euclidean distance between the network's input vector x and center vector [22]: As a result, the following is the hidden layer's jth neuron output: σ is a description of the bell curve's breadth or radius.The weighted units in the hidden layer of an RBF network correspond to the vector that represents the cluster center.Traditional approaches such as the K-Mean algorithm or Kohonen algorithm-based methods can be used to determine weights.In either instance, the algorithms find the best match for the number of predicted clusters (k) when the training is performed unsupervised.The provided data are often split into training and testing data types for neural network creation.More data is present in training data-typically 70% more.The properties indicated in the preceding part were extracted using MATLAB Version: 9.13.0 (R2022b) Update 2, which was also utilized to create RBF neural networks.In this study, neural networks were not made with pre-made toolboxes.Instead, the training and testing processes were carefully coded manually to give the researchers as much freedom as possible.This MATLAB package includes a number of toolboxes for creating neural networks.It should be mentioned that the neural network was trained using the "newrb" function.The neural network design procedure started after providing the necessary inputs.In this study there are 176 training data and 76 test data.Many scholars [23][24][25] have been interested in the use of sophisticated mathematical techniques and artificial neural networks in a variety of scientific domains.

Results and Discussion
Two RBF neural networks, each taking in a 4 × 252 matrix, were trained using four features acquired from the preceding sections.Each neural network produced a 1 × 252 matrix representing the volume percentage of gas or oil.The best architectures for calculating gas and oil volumes are shown in Figures 4 and 5, respectively.Different neural networks were constructed with varying numbers of hidden layer neurons.Two RBF neural networks have been trained to determine gas and oil volume percentages.Both have four neurons in the input layer, one in the output layer, and 38 neurons and 27 in their hidden layer, respectively.Technical characteristics for these networks are shown in Table 1.Two criteria, MRE and RMSE, are proposed for determining the error value of the current networks.For these requirements the following equations are used:     6 and 7 demonstrate how neural networks respond to these two groups.In one graph, the fitting diagram displays both the network output and desired output.To show how accurate the network is, the error diagram illustrates the discrepancy between the two target outputs and the network output.6 and 7 demonstrate how neural networks respond to these two groups.In one graph, the fitting diagram displays both the network output and desired output.To show how accurate the network is, the error diagram illustrates the discrepancy between the two target outputs and the network output.The experimental and predicted values of the ANN are denoted by "X(Exp)" and "X(Pred)", respectively, where N is the total number of observations.The obtained error is significantly lower than the previous presented method in [26], which was not equipped with the feature extraction method.In fact, in this paper a better answer than previous papers was achieved with the usage of the feature extraction method in the frequency domain, powerful artificial neural networks, and novel mathematical techniques-which is the main novelty of this work.
Training data and test data are the two categories into which the accessible data are separated.The fit diagram and error diagram in Figures 6 and 7 demonstrate how neural networks respond to these two groups.In one graph, the fitting diagram displays both the network output and desired output.To show how accurate the network is, the error diagram illustrates the discrepancy between the two target outputs and the network output.The comparison table of the output values of the neural networks and the target for two categories of training and testing data can be seen in Table 2.The comparison of the accuracy of the current research with previous research can be seen in Table 3.
Separations 2023, 10, x FOR PEER REVIEW 8 of 16 The comparison table of the output values of the neural networks and the target for two categories of training and testing data can be seen in Table 2.The comparison of the accuracy of the current research with previous research can be seen in Table 3.    incorporation of radiation sources into the structural layout of the detecting equipment.
Because of the dangers posed by radiation, special protective gear is required whenever this machinery is used.Since the source cannot be switched off, however, transporting such devices presents significant logistical challenges and necessitates the use of specialist radiation-limiting gear.In order to solve this problem, in future researchers can work on the use of X-ray-based flowmeters, capacitance-based and even resistance-based flowmeters so that they can avoid the harmful effects of using radioisotopes.The low error rate attained in this study is a consequence of correctly processing the signals that were acquired and training the neural network using the signal's useful properties that can mask flaws.This tiny inaccuracy allowed for highly accurate volume percentage predictions when scale was present.Researchers in the oil field should pay close attention to investigating additional features of the received signals and studying the extracted features with optimization-based feature selection techniques, in light of the importance of feature extraction in identifying the parameters of the oil field.

Conclusions
The system will be optimized, and the oil industry's performance will increase, by knowing the volume percentage of each condensate phase that passes within the oil pipe.Consequently, developing and putting in place a system to identify volume percentage can be a useful aid in resolving problems in the oil industry.In this work, the most precise approach in order to determine the volume percentage of three-phase condensates flowing in a stratified flow pattern was developed using the gamma-ray attenuation method.A dual energy gamma source and two NaI detectors positioned on either side of the pipe make up the detection system, which measures the volume percentage of each phase.MCNP code is used to mimic every step of this process.While examining various scale values, a three-phase flow was simulated at various volume percentages.Four characteristics were retrieved from the signals from all simulations and employed in the building of neural networks.These features were the amplitude of the first and second dominant frequency of signals received by both detectors.The above-mentioned characteristics were taken into account as inputs for two RBF neural networks, and each network's output was the volume percentage of gas and oil.By deducting the amount of oil and gas from the overall volume of the pipe, the volume percentage of the water phase may be easily calculated.In comparison to other studies, this neural network's prediction of the volume percentage has an RMSE of less than 0.29, which is a small error.Oil, gas, and petrochemical industries that deal with multi-phase flows and the need to accurately and in real-time determine the volume of each phase can use the methodology presented in this research to determine the desired parameters.

Figure 3 .
Figure 3. Extracted features for signals recorded in scale thickness of 1 cm.

Figure 3 .
Figure 3. Extracted features for signals recorded in scale thickness of 1 cm.

Separations 2023, 10 , 534 7 of 17 Separations
2023, 10, x FOR PEER REVIEW 7 of 16 domain, powerful artificial neural networks, and novel mathematical techniques-which is the main novelty of this work.

Figure 4 .
Figure 4. RBF Neural network for forecasting the proportion of gas volume.

Figure 5 .
Figure 5. RBF Neural network for forecasting the proportion of oil volume.

Figure 4 .
Figure 4. RBF Neural network for forecasting the proportion of gas volume.

Figure 4 .
Figure 4. RBF Neural network for forecasting the proportion of gas volume.

Figure 5 .
Figure 5. RBF Neural network for forecasting the proportion of oil volume.

Figure 5 .
Figure 5. RBF Neural network for forecasting the proportion of oil volume.

Figure 6 .
Figure 6.Fit and error graph for the gas volume percentage prediction neural network's (a) training and (b) testing data.

Figure 6 .Figure 7 .
Figure 6.Fit and error graph for the gas volume percentage prediction neural network's (a) training and (b) testing data.

Figure 7 .
Figure 7. Fit and error graph for the oil volume percentage prediction neural network's (a) training and (b) testing data.

Table 1 .
The RBF neural network specifications.Training data and test data are the two categories into which the accessible data are separated.The fit diagram and error diagram in Figures

Table 1 .
The RBF neural network specifications.Training data and test data are the two categories into which the accessible data are separated.The fit diagram and error diagram in Figures

Table 1 .
The RBF neural network specifications.

Table 2 .
The comparison table of the output values of the neural networks and the target.