Embedded System-Based Fast Fourier Transform Method for Measuring Water Content in Crude Oil

Shuqi Jia , Xiaolei Wang and Zhe Kan

Abstract

Abstract: The moisture content of crude oil notably affects various aspects of oil production, storage, transportation, and exploration. However, accurately measuring this moisture content is challenging because of numerous influencing factors, leading to a lack of precision in existing detection methods. This inadequacy hinders the progress of China's petroleum industry. To overcome these challenges, this paper proposes a conductivity-based method for measuring crude oil moisture content. By employing an embedded system, we designed a sensor comprising five electrodes. Additionally, we developed signal excitation and signal processing circuits. Moreover, a software program was designed to analyze and compute the output signal using fast Fourier transform operations. This facilitated the identification of flow patterns, computation of relevant flow rates, and establishment of correlation rates based on frequency spectral characteristics. Based on experimental results, we established a functional relationship between measurement parameters and crude oil moisture content. This study enhanced the precision of moisture content measurement, thereby addressing existing limitations and fostering the advancement of China's petroleum industry.

Keywords: Crude Oil Water Content , Electric Conductivity Method , Signal Processing , Two-Phase Flow

1. Introduction

With the continuous industrial upgrading of China's petrochemical industry, coupled with the advanced exploitation stages of most of China's oil fields, the moisture content of crude oil is progressively increasing. The precise measurement of crude oil moisture content is crucial for the development, transportation, and storage processes within the oil field sector. The moisture content of oil is an intricate parameter influenced by numerous factors, posing challenges in its characterization through a singular mathematical model. Therefore, the measurement of oil-water two-phase flow is a complex and demanding research focus. Both domestic and international researchers have dedicated considerable efforts to this domain, yielding noteworthy research outcomes. Upon reviewing previous methods for measuring crude oil moisture content, three key aspects emerge. First, traditional single-phase flow meters, such as turbine and differential flow meters, have been adapted for use in two-phase flow systems, offering partial solutions to the challenge of oil-water two-phase flow measurement. Second, novel signal processing systems, including artificial neural networks and wavelet transforms through computer-based analysis and computation, have been deployed to analyze and compute two-phase flow characteristics.

Dong et al. [1] proposed a method for correcting errors in crude oil water content using a back propagation (BP) neural network. Their study investigated the impact of salinity in high-water-content crude oil on the detection accuracy of microwave phase-shift-based water-content sensors. Through the establishment of an error correction model based on the BP neural network, they effectively reduced the detection error from 13.912% to 1.821%, thereby enhancing the accuracy of crude oil water content measurement. Jia et al. [2] introduced a real-time monitoring system for crude oil water content based on Wi-Fi technology. This system comprises wellhead instruments, remote data terminal units (RTUs), and a water content monitoring backend. It enables the real-time monitoring of water content in oil wells and the display of real-time water content data to users through remote terminals. Similarly, Liu et al. [3] introduced near-infrared spectroscopy measurement technology as a solution for the real-time analysis and detection of crude oil components. They successfully addressed the challenge of water content detection in crude oil and provided technical support for on-site real-time crude oil detection and analysis equipment. Guo et al. [4] designed a capacitance-based measurement system for crude oil water volume fraction. By employing specific sensors and electrode structures, they achieved real-time measurement of water volume fraction in crude oil. Moreover, the system possesses the capability to suppress noise and interference. These research achievements furnish reliable data support for the real-time monitoring of oil production and the optimization of oil extraction processes, holding significant application value for the development of the petroleum industry.

This paper presents a novel method for measuring the moisture content in crude oil using an embedded system. The proposed approach entails designing both a signal excitation circuit and a signal processing circuit to transmit signals to the microcontroller unit (MCU). Through performing fast Fourier transform (FFT) operations on the output signal, valuable insights into flow patterns and signal amplitude can be garnered. Consequently, the corresponding frequency point is determined, facilitating the identification of flow patterns and measurement of phase inclusion. Subsequently, a normalization process is applied, and the data is fitted to establish a functional relationship. Following this, the moisture content is calculated, and the results are displayed on an OLED screen. The method employs an innovative signal processing technique for analyzing multiphase flow signals. It can effectively be employed in scenarios characterized by complex flow patterns for measuring phase content. Moreover, it offers a fresh perspective on signal processing, closely mirroring real-world engineering applications.

2. Measurement Principle and Theoretical Model of Crude Oil Water Content

2.1 Measuring Principle

The determination of moisture content in crude oil entails treating it as a composite of pure water and pure crude oil. Crude oil is a complex mixture comprising alkanes, naphthenes, aromatic hydrocarbons, olefins, and other liquid hydrocarbons, each contributing to its dielectric constant, which typically ranges from approximately 2.6 F/m to 3.0 F/m. By contrast, the dielectric constant of water is 78.36 F/m, substantially higher than that of the constituents of crude oil, indicating a pronounced disparity in dielectric characteristics between these substances.

As illustrated in Fig. 1, the experimental setup entails a vertical pipe containing an oil-water mixture. Notably, water exhibits markedly higher conductivity than crude oil. For precise measurements, the system incorporates three sets of electrodes: two functioning as excitation electrodes and one as the measurement electrode for phase content determination.

When an electric current flows through the excitation electrodes, it induces equivalent resistances, denoted as R1 and R2, in both the excitation and measurement electrodes. Consequently, the measurement electrode generates a response signal encapsulating vital information pertinent to the mixture's moisture content. Subsequent processing circuits and mathematical algorithms are then deployed to extract and analyze this data.

This methodology effectively captures and processes the response signal, facilitating accurate determination of the moisture content.

Fig. 1.
Schematic diagram of the measuring principle.
Fig. 2.
Schematic diagram of a conductivity longitudinal sensor for crude oil moisture content measurement.
2.2 Theoretical Models

As depicted in Fig. 2, the excitation signal is channeled to the sensor's excitation electrode through a reference resistor Ref. Subsequently, the voltage across the upstream and downstream correlation electrodes, the phase content electrode, and the reference resistor ref undergo conversion through a conversion module. Under the edge effect of the electrode, the resulting electric field, after the current traverses the fluid through the excitation electrode and reference resistance, is partially distributed in the [TeX:] $$U_{12}^{D C}, U_{34}^{D C}, U_h^{D C}, U_{R e f}^{D C}$$ area outside the excitation electrode. However, the current loss in this region is negligible. Thus, the net current flow through the reference resistor and the fluid constitutes a closed loop, defined as follows:

(1)
[TeX:] $$I=\frac{U_{R e f}^{D C}}{R_{r e f}} .$$

The equivalent resistance of the fluid between the phase inclusion measurement electrodes is determined as

(2)
[TeX:] $$R_m=\frac{U_h^{D C}}{I}=\frac{U_h^{D C}}{U_{R e f}^{D C}} * R_{Ref } .$$

Using the aforementioned equation, the fluid's equivalent conductivity can be computed as follows:

(3)
[TeX:] $$\sigma_m=\frac{U_{R e f}^{D C}}{U_h^{D C} * R_{R e f}}.$$

A relevant mathematical model must be established to determine the phase content of the two-phase flow, given its direct correlation with the fluid flow pattern within the pipeline. Empirical investigations conducted by Lucas et al. [5,6], Hardy and Hylton [7], and Lamarre and Melville [8] have substantiated the efficacy of Maxwell's model in predicting accuracy, particularly in scenarios characterized by dispersed bubble flow, where both the aqueous conductivity [TeX:] $$\sigma_w$$ and miscible conductivity [TeX:] $$\sigma_m$$ are considered.

(4)
[TeX:] $$\text { Maxwell's formula: } \sigma_m=\frac{2 \beta}{3-\beta} * \sigma_w \text {. }$$

Combining Eqs. (3) and (4) yields the localized phase content.

(5)
[TeX:] $$\beta=\frac{2 \sigma_w * U_h^{D C} * R_{Ref }-2 c * U_{R e f}^{D C}}{2 \sigma_w * U_h^{D C} * R_{Ref }+U_{R e f}^{D C}} .$$

3. Sensor Structure Design

This section presents the design of five detection electrodes crafted from 304 stainless steel. These electrodes comprise a pair of excitation electrodes, a pair of correlated flow rate measurement electrodes, and a distinct phase content measurement electrode. These five ring electrodes are embedded in the inner wall of the pipe, running parallel to its axis, to minimize disruption to fluid flow within the pipe.

The optimal design parameters for the electrode rings were determined through the utilization of ANSYS Maxwell low-frequency electromagnetic simulation software. Finite element simulations were conducted to analyze the width and longitudinal distribution of the electrode rings. Following consideration of various parameters, while ensuring radial density and uniform current distribution, a 5- mm width electrode ring was deemed optimal. The longitudinal distribution of the electrodes was uniformly implemented.

Overall, the selected design facilitates accurate measurements while exerting minimal impact on fluid flow dynamics within the pipe.

The schematic diagram depicting the operational mechanism of the system is illustrated in Fig. 3.

Fig. 3.
Schematic diagram of system operation.

4. Design of Conductivity Crude Oil Moisture Sensor

4.1 Hardware Design

In 1982, Maxwell [9] conducted experimental research demonstrating the efficacy of applying alternating current between two electrodes to mitigate the electrolytic effect and safeguard the electrodes. Subsequent findings by Olsen [10] indicated a reduction in the ionization effect with signal frequencies exceeding 600 Hz. Accordingly the current design employs a 5 V/18 kHz alternating current as the excitation source for the sensor.

Fig. 4 illustrates the implementation of this design. The MAX038 DDS signal generation chip is utilized to generate the excitation signal, further amplified by the AD620 amplifier. These components synergistically generate the desired excitation signal for the sensor.

The embedded system-on-chip AD can solely accommodate positive voltage, with the reference voltage set at 3.3 V and a sampling range between 0 V–3.3 V. Therefore, the signal processing circuit is devised by integrating a differential amplification circuit, level rise circuit, and limiting circuit (Fig. 5).

Fig. 4.
Schematic diagram of the excitation signal source circuit.
Fig. 5.
Schematic diagram of the signal processing circuit.
4.2 Software Design

The Fourier transform stands as a pivotal linear integral transformation method extensively employed for signal conversion between time (or space) and frequency domains, finding widespread utility in physics and engineering [11].

In digital systems, the FFT algorithm emerges as a highly efficient and rapid computation technique. It alleviates the computational burden associated with discrete Fourier transform operations, minimizes CPU resource consumption, and augments overall processing speed while upholding precision.

Within the scope of this design, the sinusoidal signal emitted by the excitation source traverses the oilwater mixture, yielding a signal at the measurement electrode. This signal encompasses diverse frequencies and amplitudes, each bearing information regarding flow patterns, phase content, and other parameters. By subjecting the signal to front-end circuitry processing, followed by analog-to-digital conversion (ADC) sampling and application of the FFT to the sampled data, signals of varying frequencies and amplitudes can be isolated. Subsequently, correlation experiments can be conducted to scrutinize the relationship between crude oil moisture content, flow patterns, and the detected signals, facilitating the measurement of signals closely tied to moisture content and prevalent flow pattern data.

In experiments maintaining constant factors such as temperature and electrode height, the introduction of crude oil modifies the dielectric constant of the mixture within the pipeline. An FFT operation on the detected signal yields two datasets denoted as t1 and t2, with disparities depicted in Fig. 6, providing crucial insights.

Overall, the Fourier transform and its streamlined implementation through the FFT algorithm enable the extraction and analysis of significant information from measured signals, contributing to the accurate characterization of crude oil moisture content and flow patterns.

When the dielectric constant of the mixture varies, the amplitude undergoes the most significant change at n = 1,513. The signal frequency can be derived from the following equation:

(6)
[TeX:] $$F_n=\frac{F_s * n}{N}$$

where N denotes the number of points, [TeX:] $$F_s$$ denotes the sampling frequency, and [TeX:] $$F_n$$ denotes the corresponding frequency. The signal frequency directly linked to the dielectric constant is 36938.48 Hz. Subsequently, phase content is measured using theoretical models and through calibration experiments.

Fig. 6.
Spectrum analysis plot.

This design employs the STM32F407VET6 microcomputer as the principal control chip, coupled with a 12-bit ADC and front-end circuitry to execute signal output sampling. Given the input excitation signal's frequency of 18 kHz, the sampling frequency must exceed twice the maximum frequency per the Nyquist sampling theorem. Hence, an ADC sampling program with a frequency of 100K is devised. The program's flowchart is depicted in Fig. 7.

Fig. 7.
Flow of the main program.

5. Crude Oil Moisture Content Measurement Experiment

5.1 Experimental Design

In this experiment, a conductivity tester was employed to calibrate the sensor at room temperature, followed by fitting the conductivity and voltage values to the data (Table 1). Combining this data with the theoretical model, we obtained the correspondence between the phase content C and the detection voltage:

(7)
[TeX:] $$\mathrm{C}=-0.007 \mathrm{V} 2+0.35 \mathrm{V}-0.025796.$$

Table 1.
Experimental data table

This study compared three methods for measuring the error in crude oil water content: the capacitive sensor detection method, the infrared spectroscopy detection method, and the embedded FFT-based crude oil water content measurement method. After conducting multiple experiments, the measurement errors of the three methods were analyzed, as depicted in Fig. 8. The curves represent the true values of the measured data, as well as the measurement errors for the proposed embedded FFT method, the capacitive sensor method, and the infrared spectroscopy method. The capacitive sensor detection method exhibits an error range of ±20% relative to the true values, the infrared spectroscopy detection method exhibits an error range of ±15%, while the embedded FFT-based crude oil water content measurement method demonstrates an error range of ±2% with respect to the true values. Therefore, the proposed embedded FFT measurement method demonstrates smaller errors and superior linearity.

Fig. 8.
Comparison of experimental methods.
5.2 Experimental Discussion

As revealed by the comparative experiments using the three crude oil water content measurement methods and indicated by the measurement errors depicted in Fig. 8, the embedded FFT-based crude oil water content measurement method surpasses the capacitive sensor detection method and the infrared spectroscopy detection method in terms of accuracy and linearity. The influence on the capacitive sensor method can be primarily attributed to temperature variations, while errors in the infrared spectroscopy detection method are attributable to interferences caused by impurities or other compounds affecting the spectroscopic signals. By contrast, the proposed embedded FFT-based method effectively mitigates these interferences and achieves superior measurement accuracy. The performance of the embedded FFT-based crude oil water content measurement method is exceptional because it employs Fourier transform techniques to analyze the frequency components of crude oil. Through this method, the water content signal can be effectively separated from the crude oil signal, leading to more accurate measurements. The enhanced linearity further enhances the method's reliability by ensuring a consistent relationship between the measured values and the actual water content.

6. Conclusion

This paper introduces a method for measuring the moisture content and correlation flow rate of crude oil based on embedded FFT. In the study, a front-end circuit and a software program were developed. As revealed by various experiments, the proposed method has excellent linearity and high measurement accuracy and is, thus, a promising signal processing approach for two-phase flow measurement technology.

Biography

Shuqi Jia
https://orcid.org/0000-0001-9637-3861

He obtained his bachelor's degree in 2021 and is currently pursuing a master's degree at Liaoning University of Petroleum and Chemical Technology. He is actively involved in research within the field of multiphase flow.

Biography

Xiaolei Wang
https://orcid.org/0000-0001-7970-9116

She earned her B.S. and M.S. degrees from the School of Information and Control Engineering at Liaoning University of Technology in 2003 and 2006, respectively. From 2006 to 2012, she served as a faculty member at Heilongjiang University of Science and Technology. Since 2012, she has been teaching at the School of Information and Control Engineering at Liaoning Shihua University.

Biography

Zhe Kan
https://orcid.org/0000-0001-8108-1903

He completed his Ph.D. in the School of Information and Control Engineering at Northeast University of Technology in 2010. Since July 2010, he has been working at the School of Information and Control Engineering at Liaoning Petrochemical University.

References

  • 1 P . Dong, J. Jiang, P . Lv, X. Li, and Y . Xiao, "Error correction method for crude oil water content detection based on BP network," Modern Manufacturing Engineering, vol. 2019, no. 3, pp. 96-101, 2019. https://doi. org/10.16731/j.cnki.1671-3133.2019.03.017doi:[[[10.16731/j.cnki.1671-3133.2019.03.017]]]
  • 2 Z. Jia, B. Nian, T. Zhou, and J. Y u, "Online monitoring system of crude oil water content based on WiFi," Internet of Things Technologies, vol. 11, no. 6, pp. 23-25, 2011. https://doi.org/10.16667/j.issn.20951302.2021.06.006doi:[[[10.16667/j.issn.20951302.2021.06.006]]]
  • 3 H. Liu, Y . Liu, Z. Zhong, Y . Song, Z. Li, and Y . Xu, "A near infrared spectroscopy detection and analysis method for water content in oil field crude oil," Spectroscopy and Spectral Analysis, vol. 41, no. 2, pp. 505510, 2021.custom:[[[-]]]
  • 4 L. Guo, C. Cai, and R. Li, "Crude oil water volume fraction measurement system based on FDC2214," Petroleum Machinery, vol. 51, no. 1, pp. 110-115, 2021. https://doi.org/10.16082/j.cnki.issn.1001-4578.2023. 01.015doi:[[[10.16082/j.cnki.issn.1001-4578.2023.01.015]]]
  • 5 G. P . Lucas, J. Cory, R. C. Waterfall, W. W. Loh, and F. J. Dickin, "Measurement of the solids volume fraction and velocity distributions in solids–liquid flows using dual-plane electrical resistance tomography," Flow Measurement and Instrumentation, vol. 10, no. 4, pp. 249-258, 1999. https://doi.org/10.1016/S09555986(99)00010-2doi:[[[10.1016/S09555986(99)00010-2]]]
  • 6 G. P . Lucas, "The measurement of two-phase flow parameters in vertical and deviated flows," Ph.D. dissertation, The University of Manchester, Manchester, UK, 1987.custom:[[[-]]]
  • 7 J. E. Hardy and J. O. Hylton, "Electrical impedance string probes for two-phase void and velocity measurements," International Journal of Multiphase Flow, vol. 10, no. 5, pp. 541-556, 1984. https://doi.org/10.1016/ 0301-9322(84)90080-6doi:[[[10.1016/0301-9322(84)90080-6]]]
  • 8 E. Lamarre and W. K. Melville, "Instrumentation for the measurement of void-fraction in breaking waves: laboratory and field results. IEEE Journal of Oceanic Engineering, 17(2), 204-215, 1992. https://doi.org/10. 1109/48.126977doi:[[[10.1109/48.126977]]]
  • 9 J. C. Maxwell, A Treatise on Electricity and Magnetism. Oxford, UK: Clarendon Press, 1892.custom:[[[https://www.aproged.pt/biblioteca/MaxwellI.pdf]]]
  • 10 H. O. Olsen, "Theoretical and experimental investigation of impedance void meters," Institutt for Atomenergi, Kjeller, Norway, Report No. KR-118, 1967.custom:[[[https://www.osti.gov/biblio/4508050]]]
  • 11 L. Chang and D. Chen, "Study on the measurement of water content in crude oil outside the pipe based on improved BP neural network," Instrument Technology and Sensors, vol. 2016, no. 9, pp. 123-126, 2016. https://doi.org/10.3969/j.issn.1002-1841.2016.09.032doi:[[[10.3969/j.issn.1002-1841.2016.09.032]]]

Table 1.

Experimental data table
Number of experiments Conductivity tester data (%) Mixed-phase signal FFT amplitude Mixed-phase signal Vpp (V)
1 95.8 1.56 3.10
2 60.5 0.91 1.98
3 40.3 0.58 1.29
4 30.7 0.50 1.10
5 10.9 0.13 0.36
Schematic diagram of the measuring principle.
Schematic diagram of a conductivity longitudinal sensor for crude oil moisture content measurement.
Schematic diagram of system operation.
Schematic diagram of the excitation signal source circuit.
Schematic diagram of the signal processing circuit.
Spectrum analysis plot.
Flow of the main program.
Comparison of experimental methods.