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.
Schematic diagram of the measuring principle.
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:
The equivalent resistance of the fluid between the phase inclusion measurement electrodes is determined as
Using the aforementioned equation, the fluid's equivalent conductivity can be computed as follows:
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.
Combining Eqs. (3) and (4) yields the localized phase content.
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.
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).
Schematic diagram of the excitation signal source circuit.
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:
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.
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.
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:
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.
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.