Method for correcting accuracy of neural network-based two-phase flow split flow measurement
Patent Information
- Application Number
- CN202611477402.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-22
- Publication Date
- 2026-10-27
AI Technical Summary
[0005]为解决上述现有神经网络修正方法在段塞流等波动工况下因缺乏物理约束和工况自适应能力,导致修正后气液相流量之和偏离系统总流量的技术问题,本发明提供了基于神经网络的两相流分相流量测量精度修正方法,该方法包括步骤S1-步骤S4:
[0019]优选的,所述基于预测偏差以及经约束权重调节的质量守恒偏差构建损失函数,包括:将所述质量守恒偏差的绝对值乘以约束权重,得到加权质量守恒偏差;将所述气相预测偏差的绝对值、液相预测偏差的绝对值以及加权质量守恒偏差相加以得到损失函数。
Smart Images

Figure CN122982384A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of multiphase flow measurement technology, and in particular to a method for correcting the accuracy of two-phase flow separation flow measurement based on neural networks. Background Technology
[0002] Two-phase flow separation measurement is a method of measuring the flow rates of the gas and liquid phases separately after separating a gas-liquid mixture. It is applied in oil and gas extraction, petrochemicals, and industrial process monitoring for production calculation and control. To reduce the footprint and residence time of traditional large-scale separation equipment, compact two-phase flow separation measurement systems are increasingly being adopted in industrial settings. These systems rapidly separate the gas and liquid media using a small separator, and then obtain the flow rates of each phase using gas and liquid phase outlet flow meters.
[0003] In practical applications, compact separators have limited internal space, resulting in short gas-liquid separation distances and residence times. When inlet flow rate, pressure, or gas-liquid ratio changes, high-speed gas flow can easily entrain droplets into the gas phase outlet, and residual gas may remain in the liquid phase. Especially under fluctuating conditions such as slug flow and turbulent flow, the gas-liquid interface changes repeatedly with pressure pulsations, causing significant fluctuations in sensor readings. To suppress the impact of these non-ideal separations on metering, existing technologies collect data such as differential pressure, temperature, pressure, and preliminary gas-liquid flow rates. They then use neural networks to learn the correspondence between measured values and calibrated flow rates, outputting corrected gas and liquid flow rates.
[0004] However, existing correction methods typically focus on numerical fitting between sample data, failing to adequately consider the actual entrainment levels within the separator and the changes in measurement reliability caused by flow regime fluctuations. They also fail to continuously verify whether the sum of the gas and liquid flow rates matches the total mass flow rate of the system during the correction process. When slug flow impacts or a sudden increase in gas-liquid entrainment occur in the field, sensor readings may deviate significantly within a short period. Neural networks may easily treat this deviation as a normal flow rate change and fit it, causing the corrected gas and liquid flow rates to be either too high or too low, resulting in a discrepancy between their sum and the actual total flow rate through the system. This phenomenon leads to distorted production calculations and causes operators to misjudge separator load and pipeline transport status, affecting the reliability of production adjustments and metering results. Summary of the Invention
[0005] To address the technical problem that existing neural network correction methods, due to a lack of physical constraints and adaptive capabilities under fluctuating conditions such as slug flow, cause the sum of the corrected gas-liquid phase flow rates to deviate from the total system flow rate, this invention provides a neural network-based method for correcting the accuracy of two-phase flow rate measurements. This method includes steps S1-S4: S1. Obtain the two-phase flow parameter data of the compact separation system and input it into the neural network model to obtain the gas phase predicted flow rate and liquid phase predicted flow rate; wherein, the two-phase flow parameter data includes the preliminary gas phase mass flow rate, the preliminary liquid phase mass flow rate, the differential pressure value sequence, the gas phase density and the liquid phase density; S2. Taking any sampling time as the current time, construct a neighborhood window for the current time, and nonlinearly couple the differential pressure fluctuation intensity, the ratio of liquid density to gas density, and the ratio of initial gas mass flow rate to initial liquid mass flow rate within the neighborhood window to obtain the gas-liquid entrainment degree at the current time. S3. Based on the standard deviation and average value of each differential pressure value within the neighborhood window at the current time, determine the differential pressure variation coefficient at the current time; S4. Obtain gas phase flow rate labels and liquid phase flow rate labels. Based on Bernoulli's equation, determine the theoretical total flow rate according to the two-phase flow parameter data and the average value of the differential pressure within the neighborhood window at the current moment. Based on the predicted gas phase flow rate, predicted liquid phase flow rate, gas phase flow rate label, liquid phase flow rate label, and theoretical total flow rate, determine the prediction deviation and mass conservation deviation. Adjust the constraint weight of the mass conservation deviation according to the normalized value of the gas-liquid entrainment degree and the differential pressure variation coefficient. Construct a loss function based on the prediction deviation and the mass conservation deviation adjusted by the constraint weight. Use the loss function to train the neural network model.
[0006] This invention evaluates the gas-liquid entrainment degree and differential pressure variation coefficient by combining data within the neighborhood window at the current moment, and determines the theoretical total flow rate based on the Bernoulli equation to obtain prediction bias and mass conservation bias. Then, it uses the gas-liquid entrainment degree and differential pressure variation coefficient to adjust the constraint weight of the mass conservation bias to establish a loss function training model. This takes into account the actual working conditions of the variable flow state of the compact separation system, integrates the differential pressure characteristics reflecting the dynamic shock wave with the interphase competing physical property parameters, and introduces the theoretical total flow rate as a physical benchmark. This makes the model iteration subject to the dual constraints of total mass conservation and flow state changes, reduces the probability of non-physical offset caused by simple data fitting, reduces the interference of slug flow impact on measurement, and improves the reliability of phase flow measurement and the accuracy of on-site production calculation.
[0007] Preferably, the nonlinear coupling of the differential pressure fluctuation intensity, the ratio of liquid phase density to gas phase density, and the ratio of preliminary gas phase mass flow rate to preliminary liquid phase mass flow rate within the neighborhood window to obtain the gas-liquid entrainment degree at the current moment includes: calculating the ratio of liquid phase density to gas phase density to obtain a corrected density ratio; calculating the ratio of preliminary gas phase mass flow rate to preliminary liquid phase mass flow rate to obtain a corrected flow rate ratio; and multiplying the corrected density ratio, the corrected flow rate ratio, the differential pressure fluctuation intensity within the neighborhood window at the current moment, and a preset entrainment gain constant to obtain the gas-liquid entrainment degree at the current moment.
[0008] This invention obtains the gas-liquid entrainment degree at the current moment by multiplying the corrected density ratio, the corrected flow rate ratio, the differential pressure fluctuation intensity within the neighborhood window at the current moment, and a preset entrainment gain constant. This takes into account the combined influence of fluid medium properties and flow state on the entrainment degree, and multiplies and couples the fluid density distribution characteristics, mass flow competition state, and local transient disturbance characteristics. This plays a role in evaluating the physical evolution state of entrainment in complex multiphase flow fields, making the calculation of gas-liquid entrainment degree fit the physical laws in the actual separator, and laying the foundation for providing a priori information on separation efficiency.
[0009] Preferably, obtaining the differential pressure fluctuation intensity within the neighborhood window includes: obtaining the range of each differential pressure value within the neighborhood window at the current time; calculating the ratio of the range to the average value of each differential pressure value within the neighborhood window at the current time to obtain the differential pressure fluctuation intensity.
[0010] Preferably, determining the differential pressure variation coefficient at the current moment based on the standard deviation and average value of each differential pressure value within the neighborhood window at the current moment includes: calculating the ratio of the standard deviation to the average value of each differential pressure value within the neighborhood window at the current moment to obtain the variation coefficient; and linearly mapping the variation coefficient through a preset empirical scaling factor to obtain the differential pressure variation coefficient at the current moment.
[0011] This invention calculates the coefficient of variation by taking the ratio of the standard deviation to the average value of each differential pressure value within the neighborhood window at the current moment, and then linearly maps it using a preset empirical scaling factor to obtain the differential pressure coefficient of variation. This takes into account the pressure transients induced by slug flow accompanied by the energy conversion of interfacial shear force. By using the relative change law of the standard deviation and the average value to reflect the intensity of the disturbance of fluid micro-elements, it plays a role in accurately mapping the uncertainty of fluid dynamics and provides a dynamic reference benchmark for dealing with noise interference in turbulent environments.
[0012] Preferably, the acquisition of gas phase flow rate tags and liquid phase flow rate tags includes: acquiring calibrated gas phase mass flow rate and calibrated liquid phase mass flow rate measured by the calibration equipment of the compact separation system; extracting the sampling time of the preliminary gas phase mass flow rate and preliminary liquid phase mass flow rate from the two-phase flow parameter data; performing time series alignment of the calibrated gas phase mass flow rate and calibrated liquid phase mass flow rate based on the sampling time to obtain calibrated flow rate data synchronized with the two-phase flow parameter data; and using the calibrated gas phase mass flow rate and calibrated liquid phase mass flow rate in the synchronized calibrated flow rate data as the corresponding gas phase flow rate tag and liquid phase flow rate tag, respectively.
[0013] Preferably, the step of determining the theoretical total flow rate based on Bernoulli's equation, according to the two-phase flow parameter data and the average value of the differential pressure within the neighborhood window at the current moment, includes: determining the equivalent mixing density based on the preliminary gas phase mass flow rate, the preliminary liquid phase mass flow rate, the gas phase density, and the liquid phase density; and calculating the theoretical total flow rate based on Bernoulli's equation, according to the equivalent mixing density and the average value of the differential pressure within the neighborhood window.
[0014] This invention calculates the theoretical total flow rate based on the equivalent mixing density and the average value of the differential pressure within the neighborhood window, combined with Bernoulli's equation. This takes into account the mass conservation nature of the mixed fluid passing through the separation system, extending the single-phase fluid measurement principle to the gas-liquid two-phase mixing state. It plays the role of converting the total mass flow rate and volumetric flow rate into the equivalent density, thereby calculating the theoretical benchmark that satisfies the physical laws, and providing a solid physical reference for subsequent evaluation of mass conservation deviation.
[0015] Preferably, determining the equivalent mixing density based on the preliminary gas phase mass flow rate, the preliminary liquid phase mass flow rate, the gas phase density, and the liquid phase density includes: calculating the ratio of the preliminary gas phase mass flow rate to the gas phase density to obtain a gas phase mass ratio; calculating the ratio of the preliminary liquid phase mass flow rate to the liquid phase density to obtain a liquid phase mass ratio; and dividing the sum of the preliminary gas phase mass flow rate and the preliminary liquid phase mass flow rate by the sum of the gas phase mass ratio and the liquid phase mass ratio to obtain the equivalent mixing density.
[0016] Preferably, determining the prediction deviation and mass conservation deviation based on the gas-phase predicted flow rate, liquid-phase predicted flow rate, gas-phase flow rate label, liquid-phase flow rate label, and theoretical total flow rate includes: determining the gas-phase prediction deviation based on the difference between the gas-phase predicted flow rate and the gas-phase flow rate label; determining the liquid-phase prediction deviation based on the difference between the liquid-phase predicted flow rate and the liquid-phase flow rate label; calculating the sum of the gas-phase predicted flow rate and the liquid-phase predicted flow rate to obtain the predicted total flow rate; and determining the difference between the predicted total flow rate and the theoretical total flow rate as the mass conservation deviation.
[0017] This invention determines the mass conservation deviation by calculating the difference between the predicted total flow and the theoretical total flow, and evaluates it by combining the predicted deviations of the gas and liquid phases. This takes into account the problem that fitting a single variable cannot fully cover the system error. It decomposes the complex flow mapping problem into an independent evaluation of the deviation degree of each phase and an overall evaluation of the total outflow of the system. This plays a role in comprehensively calculating the distribution of measurement error and points out the correction direction for the multi-objective joint adjustment of the model.
[0018] Preferably, adjusting the constraint weight of the mass conservation deviation based on the normalized values of the gas-liquid entrainment degree and the differential pressure variation coefficient includes: normalizing the gas-liquid entrainment degree and the differential pressure variation coefficient respectively to obtain the normalized values of the gas-liquid entrainment degree and the differential pressure variation coefficient; calculating the sum of the normalized values of the gas-liquid entrainment degree, the normalized values of the differential pressure variation coefficient, and the preset baseline values to obtain the constraint weight of the mass conservation deviation.
[0019] Preferably, the construction of the loss function based on the prediction deviation and the mass conservation deviation adjusted by the constraint weights includes: multiplying the absolute value of the mass conservation deviation by the constraint weights to obtain the weighted mass conservation deviation; and summing the absolute values of the gas phase prediction deviation, the liquid phase prediction deviation, and the weighted mass conservation deviation to obtain the loss function.
[0020] This invention obtains a weighted mass conservation deviation by multiplying the absolute value of the mass conservation deviation by the constraint weight, and establishes a loss function by combining it with the absolute values of the gas phase and liquid phase prediction deviations. This takes into account the requirements of the dynamic physical environment on the model fitting direction, and integrates the deviation reflecting the fitting accuracy with the weighted deviation reflecting the dynamic physical laws. This plays a role in balancing data fitting and compliance with physical laws during network iterative updates, so that the prediction results are both close to the true calibration value and in line with the essence of total mass conservation.
[0021] The beneficial effects of this invention are as follows: To achieve high-fidelity calculation of measurement data under fluctuating conditions, this invention couples the differential pressure fluctuation characteristics reflecting the dynamic shock wave with physical parameters to obtain the gas-liquid entrainment degree and differential pressure variation coefficient, which plays a role in assessing the severity of transient entrainment and flow instability, reducing misjudgments caused by relying solely on initial readings; This invention introduces the theoretical total flow rate calculated based on the Bernoulli equation and obtains the mass conservation deviation on this basis, which serves to set the physical boundary for the neural network output, making the phase flow prediction controlled by the law of constant total mass; This invention guides the model to converge to a physically reasonable solution space by adaptively adjusting the constraint weights of the flow parameters and incorporating them into the loss function, reducing the interference of sensor reading deviations on fitting under extreme conditions, and improving the accuracy of production calculation and the reliability of transport status assessment. Attached Figure Description
[0022] Figure 1 A flowchart of a method for correcting the accuracy of two-phase flow separation flow rate measurement based on a neural network, provided in an embodiment of the present invention; Figure 2 This is a schematic diagram illustrating the basic process of data acquisition and model prediction provided in an embodiment of the present invention. Detailed Implementation
[0023] This invention provides a method for correcting the accuracy of two-phase flow rate measurement based on neural networks, such as... Figure 1As shown, the method includes steps S1-S4: Step S1: Collect two-phase flow measurement parameters and construct a training sample set.
[0024] like Figure 2 As shown, this invention discloses the basic process of data acquisition and model prediction: First, flow meters, temperature and pressure sensors, and differential pressure transmitters deployed on the gas phase outlet pipeline and liquid phase outlet pipeline of the compact separator simultaneously acquire basic measurement parameters such as preliminary mass flow rate, temperature and pressure, and differential pressure sequence of the gas and liquid phases; then, the feature sequences acquired by the multi-channel acquisition are precisely timestamped with the real flow labels, and a labeled training sample set is constructed by segmenting and combining them through a sliding window; finally, the samples are input into the neural network model to output the predicted corrected gas phase mass flow rate and the predicted corrected liquid phase mass flow rate.
[0025] It should be noted that in the compact two-phase flow measurement scenario, to establish a preliminary mass distribution benchmark of the gas and liquid phases at the separator outlet to reflect the basic separation efficiency of the separator, this invention collects preliminary gas phase mass flow rate and preliminary liquid phase mass flow rate; to capture the flow regime changes and instabilities of the fluid in the pipeline and inside the separator by utilizing the dynamic fluctuation characteristics of differential pressure, this invention collects differential pressure value sequences; to obtain the fluid's physical properties at the current operating pressure and temperature to accurately calculate the volume occupancy ratio of the two phases in space, this invention collects gas phase density and liquid phase density. The organic combination of the above multi-dimensional parameters can comprehensively characterize the dynamic operating state of the two-phase flow.
[0026] Specifically, sensors are first deployed at different pipeline nodes of the compact separation system to continuously and synchronously collect data at a preset sampling frequency. A gas flow meter and a gas temperature and pressure sensor are installed at the gas phase outlet pipeline of the separator to obtain the preliminary gas mass flow rate. Based on the temperature and pressure values measured by the gas temperature and pressure sensors, the gas density is calculated using the actual gas state equation. Similarly, a liquid flow meter and a liquid temperature and pressure sensor are installed at the liquid phase outlet pipeline of the separator to obtain the preliminary liquid mass flow rate. Based on the temperature and pressure values measured by the liquid temperature and pressure sensors, the liquid density is calculated using liquid phase property correlation formulas or table lookup interpolation methods. Differential pressure transmitters are installed inside the separator or between its inlet and outlet to collect differential pressure data. Each sensor continuously collects readings, ensuring that each sampling moment corresponds to a complete set of multi-channel measurements. All data are sorted according to the chronological order of acquisition, forming their respective time series. The collected differential pressure data are then sorted to form a differential pressure value sequence that reflects the fluctuations in hemodynamics. All collected data are stamped with a uniform timestamp to ensure accurate alignment of the time dimension.
[0027] Simultaneously, to provide the neural network with the training signals required for supervised learning, it is also necessary to obtain the actual gas-phase mass flow rate and actual liquid-phase mass flow rate under the current operating conditions as supervisory labels for the network's output prediction values. The actual flow rate labels are obtained through one of the following methods: installing a metered and calibrated high-precision single-phase flow meter on the downstream pipeline of the separation system and reading its measurement value when the system reaches steady state; for industrial sites where a standard flow meter cannot be directly installed, collecting gas-liquid phase samples from the separator outlet during the sampling period, performing offline calibration using a weighing or volumetric method, and obtaining the cumulative average flow rate within the corresponding time window; or, under laboratory conditions, using a standard gas-liquid two-phase flow test bench, obtaining the actual gas-liquid two-phase flow rates with known proportions by adjusting the setpoints of the gas-liquid two-phase feeding system and the cumulative readings of the standard metering tank.
[0028] The preliminary gas phase mass flow rate, preliminary liquid phase mass flow rate, differential pressure sequence, gas phase density, and liquid phase density collected by the aforementioned sensors at various times are precisely aligned with the independently acquired real gas phase mass flow rate and real liquid phase mass flow rate by timestamp. Considering the need to further increase the sample diversity of the training set and improve the model's generalization ability, this embodiment of the invention uses a sliding window method to segment samples on the time series. The sliding window length should be selected to cover the basic time scale of typical two-phase flow evolution, ensuring that each sample segment contains sufficient differential pressure fluctuation information to reflect dynamic characteristics such as slug flow. The window step size needs to balance the sample overlap rate and the diversity of the sample set; too small a step size will lead to high overlap between adjacent samples, introducing redundant information, while too large a step size may miss effective samples in the transition region of the operating condition. In this embodiment, based on the response time and sampling frequency of the actual operating condition, the window length is set to 10s, and the window step size is set to 1s. Multiple overlapping data segments are extracted from the continuous time series to extract multiple independent training samples, which are then combined to form a labeled training sample set.
[0029] After constructing the training sample set, a neural network model is built for correcting the accuracy of two-phase flow rate measurements. Considering the significant dynamic temporal dependence of flow regime evolution, such as slug flow, under actual operating conditions, the neural network model in this embodiment is preferably a long short-term memory network or a time series prediction network based on one-dimensional convolution. The single training sample extracted in this step, namely the multi-dimensional time series feature matrix containing the preliminary gas phase mass flow rate, preliminary liquid phase mass flow rate, differential pressure sequence, gas phase density, and liquid phase density within the current time and corresponding sliding window, is used as the input data of the neural network model. Simultaneously, the output layer structure of the neural network model is configured so that after forward propagation, it outputs the predicted gas phase flow rate and predicted liquid phase flow rate corresponding to the current sampling time. The predicted output value of this network will serve as the basis for calculating various physical deviation variables in subsequent steps.
[0030] At this point, the basic measurement parameter data of the two-phase flow have been obtained and the training sample set has been constructed.
[0031] Step S2: Calculate the gas-liquid entrainment at each time point.
[0032] It should be noted that, considering the limited physical space inside the separator, the entrainment of the gas and liquid phases when they meet at high speed can lead to local instability in the flow field and cause deviations in mass measurement. The severity of this entrainment phenomenon is not only limited by the volume distribution of the two phases within the separator, but also directly driven by differential pressure fluctuations. To address this, this invention introduces the gas-liquid entrainment degree as an index, which nonlinearly couples the intensity of differential pressure fluctuations, reflecting the dynamic shock wave, with physical property parameters, reflecting the competitive distribution of volume and mass between the phases, to objectively assess the severity of transient entrainment. This provides prior information on separation efficiency in subsequent processes to support physical constraints.
[0033] First, taking any given moment as the current moment, construct its neighborhood window, and calculate the differential pressure fluctuation intensity at the current moment based on this neighborhood window.
[0034] Specifically, the intensity of differential pressure fluctuation is calculated by the ratio of the range to the average value of the differential pressure sequence within the neighborhood window at the current moment.
[0035] In a preferred implementation, to achieve a balance between timeliness and statistical stability in extracting flow pattern characteristics, the neighborhood window size is preferably set to 10-50 sampling points. It should be noted that the selection of this window should be based on the typical passage cycle of the slug flow in the pipeline: for high flow rates and fast fluctuation frequencies, the window size can be set to 20 sampling points to enhance the response sensitivity to transient fluctuations; for low flow rates and large-scale slug fluctuations, the window size should be appropriately increased to 40 sampling points to ensure the statistical representativeness of the mean and standard deviation. In this embodiment, 30 sampling points are preferred. The implementer can adjust this according to the actual flow rate and pipeline diameter.
[0036] Then, the gas-liquid entrainment degree at the current moment is calculated. It should be noted that directly using instantaneous differential pressure values to calculate the entrainment degree is susceptible to noise interference, causing the evaluation results to fluctuate wildly and failing to accurately reflect the average entrainment state inside the separator. Therefore, this invention first constructs a neighborhood window centered on the current moment. The intensity of differential pressure fluctuations is characterized by the ratio of the range to the average value of the differential pressure sequence within the window. This preserves the characteristics of transient shock waves while suppressing the interference of random noise on the entrainment assessment, making the calculation of the entrainment severity index more stable and reliable.
[0037] Based on the above logic, the gas-liquid entrainment degree satisfies the following relationship: ; in, It is the first The gas-liquid entrainment at any given moment; It is the first The intensity of differential pressure fluctuation at any given moment; It is the first Liquid phase density at time; It is the first The gas phase density at a given time; It is the first Preliminary gas phase mass flow rate at time; It is the first Preliminary liquid phase mass flow rate at time; It is the entrainment gain constant; It is the preset first minute value, and the preferred value is It is used to prevent calculation overflow caused by the gas phase density approaching zero under low pressure and high temperature conditions, or the liquid phase flow rate approaching zero when the system starts up / intermittently supplies liquid. At the same time, it is used in conjunction with the upper limit cutoff to limit the output under extreme conditions to a physically reasonable range.
[0038] In this relation, Used to evaluate the The density distribution characteristics of the gas and liquid phases in the separator are as follows: when the density of the liquid phase shows an increasing trend compared with the density of the gas phase, it indicates that the inertial resistance exhibited by the liquid phase when it is entrained by the gas flow is greater, and the corresponding volume proportion distribution is more biased towards liquid phase dominance. Used to evaluate the The constant mass flow competition between the gas and liquid phases reflects the carrying capacity of the gas phase flow for the liquid phase flow and the proportion of interphase kinetic energy transfer. As a component of the dynamic shock wave, it is used to characterize the intensity of pressure fluctuations within the flow field. This invention achieves an objective assessment of the intensity of nonlinear entrainment caused by gas-liquid competition and mechanical shock waves within the flow field by nonlinearly multiplying and coupling density distribution characteristics, mass flow competition state, and the dynamic shock wave component. The more intense the differential pressure fluctuations within the flow field, and the greater the density difference or mass flow rate ratio between the two phases, the higher the calculated gas-liquid entrainment degree. As the number of cells increases, the entrainment phenomenon becomes more severe.
[0039] The construction of this relation originates from the nonlinear evolution of the interfacial shear slip theory and the interfacial kinetic energy distribution law in multiphase flow. In the closed, finite flow field inside the separator, the entrainment of the gas and liquid phases is not an isolated static distribution, but rather a combined effect of shear stripping of the liquid film surface by the high-speed airflow and pressure shock wave disturbance. Therefore, this invention introduces the differential pressure fluctuation intensity, reflecting local transient disturbances. This serves as the kinetic excitation source for shear stripping; simultaneously, since the entrainment amount is limited by the differences in physical properties and mass flux between the gas and liquid phases, a density ratio is introduced. As a constraint term on the physical properties of inertial drag and the driving medium, the mass flow rate ratio is introduced. As a weighting term for kinetic energy distribution in two-phase flow transport processes, it enables the objective and comprehensive calculation of the physical evolution state entrained in complex multiphase flow fields.
[0040] It should be noted that the entrainment gain constant The value needs to be set according to the viscosity of the fluid medium inside the separator and the actual flow rate conditions: for measurement scenarios with high-viscosity liquid phases and drastic fluctuations in gas flow rate, the value should be appropriately increased. If we assume The value is set to 1.5 to enhance the sensitivity for capturing the characteristics of small pressure shock waves; for scenarios with low viscosity liquid phases and stable flow, the value is appropriately reduced. If we assume The value is set to 0.8 to improve the fault tolerance for conventional phase slip. In this embodiment, The preferred value is 1.2.
[0041] It should also be noted that, to prevent the gas-liquid entrainment value from being too large under extreme operating conditions and compressing the normal operating condition data into an invalid range during subsequent normalization, this embodiment truncates the upper limit of the gas-liquid entrainment: if Then let ,in, yes The upper limit value is preferably 10, which is determined based on the numerical range of typical entrainment conditions in two-phase flow measurements in industrial settings.
[0042] Thus, the gas-liquid entrainment at each moment was obtained.
[0043] Step S3: Calculate the differential pressure variation coefficient at each time point.
[0044] It should be noted that the turbulent dynamic energy distribution of two-phase flow in the pipeline directly affects the measurement noise of the sensor. Especially under slug flow conditions, the severe pulsation of the two-phase flow can cause wide fluctuations in the measured parameters within a short period of time, which will significantly increase the output uncertainty of the prediction model. In order to capture the dynamic instability characteristics during the operation of two-phase flow, this invention introduces the differential pressure variation coefficient as a dynamic reference benchmark to measure the system's measurement reliability, introducing a priori constraints of the dynamic dimension into the loss function to cope with noise interference in turbulent environments.
[0045] It should be noted that this step also requires setting a neighborhood window, and the setting method is the same as in step S2. Those skilled in the art can adjust it according to the actual flow rate and pipe diameter, referring to the preferred range described in step S2.
[0046] Then, the differential pressure sequence within the neighborhood window at the current moment is obtained, and the standard deviation and average value of the differential pressure sequence are calculated as the basic operators for differential pressure fluctuation characteristics. It should be noted that under slug flow conditions, the gas and liquid phases alternately pass through the pipeline, causing the differential pressure signal to exhibit severe periodic pulsations. If the instantaneous differential pressure value of a single sampling point is directly used for evaluation, this value has obvious instantaneous randomness and cannot truly reflect the dynamic nature of the current flow state. To effectively characterize this flow instability from a statistical perspective, a neighborhood window containing sufficient fluctuation information needs to be selected. Through statistical processing of the differential pressure data within the neighborhood window, microscopic instantaneous fluctuations are transformed into macroscopic statistical characteristics, thereby achieving a stable and quantitative characterization of the differential pressure variation coefficient. Based on this, this invention statistically analyzes the differential pressure sequence within the corresponding neighborhood window at the current moment, using the ratio of the standard deviation to the average value of the differential pressure values within the neighborhood window as a characterization of turbulence intensity.
[0047] Based on the above logic, the differential pressure variation coefficient satisfies the following relationship: ; in, It is the first The coefficient of variation of differential pressure at time t; It is an empirical scaling factor; It is the first The standard deviation of the differential pressure values within the neighborhood window at any given time; It is the first The average value of differential pressure within the neighborhood window at any given time.
[0048] In this relation, Used to measure the relative fluctuation amplitude of the currently observed fluid, in order to assess the degree of uncertainty in fluid dynamics. When the... When the standard deviation of the differential pressure value within the neighborhood window at a given time increases, the fractional value increases, indicating that the flow regime has entered a slug flow state with violent fluctuations and increased uncertainty; the outer layer uses an empirical scaling factor. A linear mapping is performed to ensure that the differential pressure variation coefficient accurately maps the instability of the flow regime under severe turbulent conditions. This is taken into account when the average differential pressure... When the value is zero, the system loses its differential pressure reference. To ensure the numerical stability of the calculation process, the differential pressure variation coefficient is set to zero. It is zero.
[0049] The construction of this relationship originates from the nonlinear evolution of the first-order fluid damping energy dissipation model and the statistical perturbation energy superposition theorem. Inside a closed flow measurement pipeline, the pressure transient induced by slug flow is not an isolated simple harmonic oscillation, but rather a hydrodynamic energy conversion accompanied by shear force at the two-phase interface. Its energy decay and fluctuations are more consistent with first-order damping changes. Therefore, this invention introduces the ratio of standard deviation to mean to characterize the severity of perturbation of the fluid element under shear stress. An empirical scaling factor is also introduced. This is to use measured dynamic data to correct the non-monotonic deviation of flow resistance caused by uneven distribution of elbows and throttling elements in actual pipeline structures and heterogeneity of pipe wall roughness, so that the differential pressure variation coefficient can truly fit the physical uncertainty of the current two-phase flow.
[0050] It should be noted that the empirical scaling factor... The value of needs to be set according to the actual working conditions: for working conditions with a high differential pressure signal-to-noise ratio and relatively stable flow fluctuations, it is preferable to set it to 3 in order to improve the ability to capture weak turbulent fluctuations; for working conditions with strong on-site vibration interference and a low differential pressure signal-to-noise ratio, it is preferable to set it to 8 in order to prevent frequent false alarms caused by background noise. In this embodiment, it is preferably set to 5.
[0051] Thus, the differential pressure variation coefficients at each time point were obtained.
[0052] Step S4: Construct a loss function based on dual physical constraints.
[0053] It should be noted that under actual operating conditions of compact gas-liquid separators, due to the physical entrainment of the gas and liquid phases at the separation interface and the easy change of flow pattern with inlet pressure fluctuations, the direct prediction of phase flow by neural networks often fails to satisfy the law of mass conservation, directly leading to systematic errors in the measurement results. To ensure that the network output conforms to the mass conservation principle of two-phase flow and fully utilizes the dynamic physical characteristics of the measurement system under different flow patterns, it is necessary to integrate the mass conservation constraint and the flow pattern adaptive constraint mechanism into the loss function of the neural network, guiding the model training to converge to a physically reasonable solution space.
[0054] First, calculate the theoretical total flow rate. It should be noted that, considering the separation system as a closed fluid control volume, according to the law of conservation of mass, the total inflow mass under steady-state conditions should equal the sum of the outflow gas and liquid phase masses. In actual separation processes with non-ideal disturbances, introducing the theoretical total flow rate as a benchmark constraint can limit the physical boundaries of the network prediction, providing a reference for subsequent verification of the reasonable calculation of phase-separated flow rates.
[0055] The calculation of the theoretical total flow rate is based on Bernoulli's equation and the homogeneous flow model. Specifically, for the... At each sampling time, the equivalent mixing density is first calculated: ; in, For the first The equivalent mixing density at time; For the first Preliminary gas phase mass flow rate at time; For the first Preliminary liquid phase mass flow rate at time; For the first The gas phase density at time [time]. For the first Liquid phase density at time; It is the preset second minute value, and the preferred value is This formula is used to prevent errors in calculating volumetric flow rate by dividing by zero due to the gas or liquid phase density approaching zero under low pressure or high temperature conditions. The physical meaning of this formula is: the total mass flow rate divided by the total volumetric flow rate yields the equivalent density of the gas-liquid mixture.
[0056] Based on the above equivalent mixing density, the first Theoretical total flow at time Satisfying the relation: ; in, To calibrate the outflow coefficient; This refers to the cross-sectional area of the throat of the throttling device; For the first The equivalent mixing density at time; For the first The average value of differential pressure within the neighborhood window at time 1.
[0057] This relationship is derived from Bernoulli's law of conservation of energy. In a throttling device, as fluid flows through the narrowed throat, the increased flow velocity leads to a decrease in static pressure, and the square root of the differential pressure is proportional to the mass flow rate. By introducing the equivalent mixing density calculated using a homogeneous flow model, this single-phase flow measurement principle can be extended to the measurement of the total mixing flow rate of gas-liquid two-phase flows, thus providing an independent physical benchmark for mass conservation constraints.
[0058] Next, we define the intermediate bias variables required for the loss function of the model training. It should be noted that the goal of network training is to minimize the difference between the predicted values and the true labels, and to force the output to meet the mass balance requirements. By defining the gas phase, liquid phase, and mass conservation biases, the complex flow mapping problem can be decomposed into independent fitting optimization objectives and coupled constraint objectives, facilitating dynamic adjustment of network weights through the backpropagation algorithm.
[0059] Specifically, for the first At each sampling time, the intermediate deviation variable satisfies the following relationship: Gas phase prediction bias satisfies the following relationship: ; Liquid phase prediction deviations satisfy the following relationship: ; The mass conservation deviation satisfies the following relationship: .
[0060] in, For the first Predictive bias in gas phase at any given time; For the first Predicted gas phase flow rate at any given time; For the first The gas phase flow rate label at any given time; For the first Predicted deviation of liquid phase at time; For the first Predicted liquid phase flow rate at any given time; For the first The liquid phase flow rate label at any given time; For the first The deviation of mass conservation at any given moment; For the first The theoretical total flow rate at any given moment.
[0061] Simultaneously, the gas-liquid entrainment degree and differential pressure variation coefficient at each time point are normalized, for example, by maximum-minimum normalization, and mapped to... The normalized values of gas-liquid entrainment and differential pressure variation coefficient are obtained from the interval.
[0062] Finally, the loss function is constructed. It should be noted that a single mean squared error loss is insufficient to address the measurement uncertainties caused by flow regime fluctuations in gas-liquid separation systems. This invention constructs a combined loss function that includes a flow rate fitting term and a dynamic physical constraint term, enabling the model to balance data fitting accuracy and adherence to physical laws during training.
[0063] Based on the above logic, the first Loss value at each sampling time point Satisfying the relation: ; in, For the first The absolute value of the time-phase prediction deviation; For the first The absolute value of the liquid phase prediction deviation at time; For the first The absolute value of the mass conservation deviation at any given moment; For the first The normalized value of gas-liquid entrainment at time t; For the first The normalized value of the coefficient of variation of differential pressure at time t; It is the absolute value symbol.
[0064] In this formula, the first and second terms are used to evaluate the degree of deviation of the model from the prediction of phase flow, ensuring the accuracy of the predicted value in fitting the true label; the third term is the physical constraint term. This represents the dynamic constraint coefficient. Ideally, the sum of the predicted corrected gas phase flow rate and liquid phase flow rate should be strictly equal to the theoretical mixing flow rate, i.e. The mass conservation deviation is always zero; however, in practical compact separation systems, mass conservation deviation is unavoidable. This relationship uses the absolute value of the mass conservation deviation as a fundamental constraint term, with the constant term 1 in its coefficient ensuring that this constraint remains effective under any operating condition; based on this, the gas-liquid entrainment degree... With differential pressure coefficient of variation Introduced as a dynamic additional factor: When gas-liquid entrainment is severe inside the separator. Approaching the upper limit indicates that the separation efficiency deteriorates, leading to an increase in measurement bias. At this point, the constraint coefficient automatically increases, forcing the network output to converge towards the direction of mass conservation. When the flow regime is in a severe slug flow or turbulent state... Approaching the upper limit indicates that the increased uncertainty in fluid dynamics leads to enhanced measurement noise. At this point, the constraint coefficient also automatically increases, suppressing the network's exploration of non-physical regions under fluctuating conditions. Conversely, when the separation efficiency is good and the flow is stable, the constraint coefficient returns to 1. At this point, the model is mainly driven by data fitting, with physical constraints as a supplement.
[0065] It should also be noted that in practical applications, when or When the numerical fluctuation range is small, maximum-minimum normalization may weaken the dynamic adjustment effect. To address this, if the difference between the maximum and minimum values of the sequence is less than 0.01, then directly... and Set it to 0.5 so that the constraint coefficient is within... Adjustment margin is retained within the interval. For cases where there are individual outliers in the original sequence, values exceeding the 5% to 95% quantile range can be truncated to the corresponding quantile value before normalization.
[0066] This completes the construction of the loss function. In a training batch, the average of the loss values at each time step is used as the total loss for that batch. The network weights are iteratively updated through backpropagation until the model converges to the optimal parameter space that satisfies the dual physical constraints.
[0067] The above are all preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Therefore, all equivalent changes made in accordance with the structure, shape and principle of the present invention should be covered within the scope of protection of the present invention.
Claims
1. A method for correcting the accuracy of two-phase flow separation flow rate measurement based on neural networks, characterized in that, include: S1. Obtain the two-phase flow parameter data of the compact separation system and input it into the neural network model to obtain the gas phase predicted flow rate and liquid phase predicted flow rate; wherein, the two-phase flow parameter data includes the preliminary gas phase mass flow rate, the preliminary liquid phase mass flow rate, the differential pressure value sequence, the gas phase density and the liquid phase density; S2. Taking any sampling time as the current time, construct a neighborhood window for the current time, and nonlinearly couple the differential pressure fluctuation intensity, the ratio of liquid density to gas density, and the ratio of initial gas mass flow rate to initial liquid mass flow rate within the neighborhood window to obtain the gas-liquid entrainment degree at the current time. S3. Based on the standard deviation and average value of each differential pressure value within the neighborhood window at the current time, determine the differential pressure variation coefficient at the current time; S4. Obtain gas phase flow rate labels and liquid phase flow rate labels. Based on Bernoulli's equation, determine the theoretical total flow rate according to the two-phase flow parameter data and the average value of the differential pressure within the neighborhood window at the current moment. Based on the predicted gas phase flow rate, predicted liquid phase flow rate, gas phase flow rate label, liquid phase flow rate label, and theoretical total flow rate, determine the prediction deviation and mass conservation deviation. Adjust the constraint weight of the mass conservation deviation according to the normalized value of the gas-liquid entrainment degree and the differential pressure variation coefficient. Construct a loss function based on the prediction deviation and the mass conservation deviation adjusted by the constraint weight. Use the loss function to train the neural network model.
2. The method for correcting the accuracy of two-phase flow separation flow rate measurement based on neural networks according to claim 1, characterized in that, The nonlinear coupling of the differential pressure fluctuation intensity, the ratio of liquid density to gas density, and the ratio of initial gas mass flow rate to initial liquid mass flow rate within the neighborhood window yields the gas-liquid entrainment at the current moment, including: Calculate the ratio of the liquid phase density to the gas phase density to obtain the corrected density ratio; Calculate the ratio of the initial gas phase mass flow rate to the initial liquid phase mass flow rate to obtain the corrected flow rate ratio; The gas-liquid entrainment degree at the current moment is obtained by multiplying the corrected density ratio, the corrected flow ratio, the differential pressure fluctuation intensity in the neighborhood window at the current moment, and the preset entrainment gain constant.
3. The method for correcting the accuracy of two-phase flow separation flow rate measurement based on neural networks according to claim 2, characterized in that, The acquisition of the differential pressure fluctuation intensity within the neighborhood window includes: Obtain the range of each differential pressure value within the neighborhood window at the current moment; The differential pressure fluctuation intensity is obtained by calculating the ratio of the range to the average value of each differential pressure value within the neighborhood window at the current time.
4. The method for correcting the accuracy of two-phase flow separation measurement based on neural networks according to claim 1, characterized in that, The step of determining the differential pressure variation coefficient at the current moment based on the standard deviation and average value of each differential pressure value within the neighborhood window at the current moment includes: The coefficient of variation is obtained by calculating the ratio of the standard deviation of each differential pressure value within the neighborhood window at the current time to the average value of the differential pressure values. The coefficient of variation is linearly mapped using a preset empirical scaling factor to obtain the differential pressure coefficient of variation at the current moment.
5. The method for correcting the accuracy of two-phase flow separation flow measurement based on neural networks according to claim 1, characterized in that, The acquisition of gas phase flow rate tags and liquid phase flow rate tags includes: Obtain the calibration gas phase mass flow rate and calibration liquid phase mass flow rate measured by the calibration equipment of the compact separation system; Extract the sampling time of the preliminary gas phase mass flow rate and the preliminary liquid phase mass flow rate from the two-phase flow parameter data; Using the sampling time as a reference, the calibrated gas phase mass flow rate and the calibrated liquid phase mass flow rate are time-series aligned to obtain calibrated flow rate data synchronized with the two-phase flow parameter data; The calibrated gas phase mass flow rate and calibrated liquid phase mass flow rate in the synchronized calibrated flow rate data are used as the corresponding gas phase flow rate tag and liquid phase flow rate tag, respectively.
6. The method for correcting the accuracy of two-phase flow separation flow measurement based on neural networks according to claim 1, characterized in that, The determination of the theoretical total flow rate based on Bernoulli's equation, according to the two-phase flow parameter data and the average differential pressure value within the neighborhood window at the current moment, includes: The equivalent mixing density is determined based on the preliminary gas phase mass flow rate, preliminary liquid phase mass flow rate, gas phase density, and liquid phase density. The theoretical total flow rate is calculated based on the Bernoulli equation, using the equivalent mixing density and the average of the differential pressure values within the neighborhood window.
7. The method for correcting the accuracy of two-phase flow separation flow rate measurement based on neural networks according to claim 6, characterized in that, The determination of the equivalent mixing density based on the preliminary gas phase mass flow rate, preliminary liquid phase mass flow rate, gas phase density, and liquid phase density includes: Calculate the ratio of the preliminary gas phase mass flow rate to the gas phase density to obtain the gas phase mass ratio; Calculate the ratio of the initial liquid phase mass flow rate to the liquid phase density to obtain the liquid phase mass ratio; The equivalent mixing density is obtained by dividing the sum of the initial gas phase mass flow rate and the initial liquid phase mass flow rate by the sum of the gas phase mass ratio and the liquid phase mass ratio.
8. The method for correcting the accuracy of two-phase flow separation flow rate measurement based on neural networks according to claim 1, characterized in that, The determination of prediction bias and mass conservation bias based on gas-phase predicted flow rate, liquid-phase predicted flow rate, gas-phase flow rate label, liquid-phase flow rate label, and theoretical total flow rate includes: The gas phase prediction deviation is determined based on the difference between the predicted gas phase flow rate and the gas phase flow rate label. The liquid phase prediction deviation is determined based on the difference between the predicted liquid phase flow rate and the liquid phase flow rate label. The sum of the predicted gas phase flow rate and the predicted liquid phase flow rate is calculated to obtain the total predicted flow rate; The difference between the predicted total flow and the theoretical total flow is defined as the mass conservation deviation.
9. The method for correcting the accuracy of two-phase flow separation flow measurement based on neural networks according to claim 1, characterized in that, The adjustment of the constraint weights for mass conservation deviation based on the normalized values of the gas-liquid entrainment degree and differential pressure variation coefficient includes: The gas-liquid entrainment degree and differential pressure variation coefficient are normalized to obtain normalized values for the gas-liquid entrainment degree and the differential pressure variation coefficient. The normalized value of gas-liquid entrainment, the normalized value of differential pressure variation coefficient, and the sum of the preset baseline values are calculated to obtain the constraint weight of mass conservation deviation.
10. The method for correcting the accuracy of two-phase flow separation flow rate measurement based on neural networks according to claim 8, characterized in that, The loss function constructed based on prediction bias and mass conservation bias adjusted by constraint weights includes: Multiply the absolute value of the mass conservation deviation by the constraint weight to obtain the weighted mass conservation deviation; The loss function is obtained by summing the absolute values of the gas phase prediction deviation, the liquid phase prediction deviation, and the weighted mass conservation deviation.