An electromagnetic flowmeter flow prediction method based on magnetism sensor identification analysis
By using a magnetic sensor-based identification and analysis method, high-frequency pulse modulation and variational mode decomposition techniques, combined with deformable convolutional networks and finite element simulation, flow velocity field prediction is optimized, solving the problem of insufficient measurement accuracy of traditional electromagnetic flowmeters under complex working conditions, and achieving high-precision and stable flow monitoring.
Patent Information
- Application Number
- CN202510928284.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-07
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2045-07-07
AI Technical Summary
Traditional electromagnetic flowmeters lack sufficient measurement accuracy under complex operating conditions, struggle to effectively distinguish between fluid motion characteristics and environmental noise, and lack dynamic calibration methods, resulting in inaccurate measurement results.
A magnetic sensor-based identification and analysis method is adopted. An alternating magnetic field is generated by high-frequency pulse modulation. Combining variational mode decomposition and deformable convolutional network, the spatiotemporal features of the magnetic field gradient are extracted. Differentiable finite element simulation and Maxwell's equations are used to optimize the flow field prediction. The flow rate value is calibrated by combining Doppler reference and an elastic weight consolidation algorithm is used to resist interference.
It significantly improves the measurement accuracy and stability under complex working conditions, ensures that the measurement results conform to the laws of electrohydrodynamics, and enhances the sensor's anti-interference ability and long-term reliability.
Smart Images

Figure CN120846457B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electromagnetic flow measurement technology, and in particular to a flow prediction method for electromagnetic flowmeters based on magnetic sensor identification and analysis. Background Technology
[0002] Electromagnetic flowmeters are key instruments for fluid measurement in industrial process control. The accuracy and real-time performance of their flow prediction directly affect the stable operation of production processes and energy management efficiency. In industrial fields such as chemical, metallurgical, and water treatment, high-precision and high-reliability flow monitoring is of great significance for ensuring process safety and optimizing operation in the face of complex working conditions such as highly corrosive media, multiphase flow patterns, and strong electromagnetic interference.
[0003] Traditional electromagnetic flowmeters primarily employ the assumption of a constant magnetic field and a single-point sensing architecture, estimating average flow velocity by detecting induced electromotive force. While this method can meet basic measurement requirements under steady-state flow and ideal electromagnetic conditions, in practical industrial applications, the measurement results are susceptible to interference from a combination of factors, including dynamic flow regime changes, multi-source noise interference, and material parameter drift. Existing technologies suffer from significant shortcomings in spatiotemporal mixed signal processing, making it difficult to effectively distinguish between real fluid motion characteristics and environmental noise. Furthermore, the lack of dynamic calibration methods based on physical laws leads to a substantial reduction in measurement accuracy under complex operating conditions, severely limiting the practical application of high-precision flow measurement technology. Summary of the Invention
[0004] In view of the aforementioned existing problems, the present invention is proposed.
[0005] Therefore, this invention provides a flow prediction method for electromagnetic flowmeters based on magnetic sensor identification and analysis to solve the problem of insufficient measurement accuracy caused by multi-source noise interference and dynamic flow state changes under complex working conditions.
[0006] To solve the above-mentioned technical problems, the present invention provides the following technical solution:
[0007] In a first aspect, the present invention provides a flow prediction method for electromagnetic flowmeters based on magnetic sensor identification and analysis. The method includes: real-time acquisition of magnetic field strength signals, generating an alternating magnetic field based on a high-frequency pulse modulation excitation coil, and outputting an original magnetic field signal matrix containing spatiotemporal information; preprocessing the original magnetic field signal matrix, using a variational mode decomposition algorithm to separate fluid noise and mechanical vibration noise, and outputting a denoised spatiotemporal synchronization signal tensor; extracting the spatiotemporal features of the magnetic field gradient from the denoised spatiotemporal synchronization signal tensor, constructing a spatiotemporal graph structure based on the sensor spatial location, dynamically adjusting the spatiotemporal encoding weights through deformable convolution kernels, and calculating the values of each sensor node. The attention weight vector outputs a dynamically weighted spatiotemporal feature vector. The theoretical magnetic field distribution is calculated through differentiable finite element simulation. Maxwell's equations are discretized and embedded into a neural network, and residual terms are calculated with actual magnetic field measurements to output a predicted velocity field value that conforms to physical constraints. The velocity field prediction value and the attention weight vector are jointly optimized using a gradient propagation algorithm to minimize the mean square error between the predicted velocity and the ultrasonic Doppler reference value, outputting a calibrated flow rate value. A real-time confidence score is calculated based on the calibrated flow rate value. When the score falls below a preset threshold, an elastic weight consolidation algorithm is used to fine-tune the attention weight vector online, outputting an anti-interference flow rate prediction result.
[0008] As a preferred embodiment of the electromagnetic flowmeter flow prediction method based on magnetic sensor identification and analysis described in this invention, when the high-frequency pulse modulation excitation coil generates an alternating magnetic field, the carrier frequency and duty cycle parameters are set according to the electromagnetic characteristics of the measured medium. A square wave signal with stable amplitude and symmetrical waveform is generated by the pulse width modulation controller. After power amplification, the excitation coil is driven to work, and the output trigger signal synchronizes the sampling timing of the magnetic field sensor array.
[0009] As a preferred embodiment of the electromagnetic flowmeter flow prediction method based on magnetic sensor identification and analysis according to the present invention, wherein: the magnetic field sensor array adopts a regular two-dimensional grid array with a preset spatial layout;
[0010] The coordinates of each node in the regular two-dimensional grid array are determined by equidistant arrangement. The sampling timing of each node is synchronized by a hardware trigger signal, and a three-dimensional original magnetic field signal matrix is generated after filtering out out-of-band noise based on a bandpass filter.
[0011] As a preferred embodiment of the electromagnetic flowmeter flow prediction method based on magnetic sensor identification and analysis described in this invention, the step of extracting the spatiotemporal features of the magnetic field gradient from the denoised spatiotemporal synchronization signal tensor includes the following steps.
[0012] The magnitude and direction of the magnetic field gradient at each spatiotemporal point are calculated by applying the Sobel gradient operator along the time and space dimensions.
[0013] Based on the node coordinate distribution of the two-dimensional grid array, an adjacency matrix and a dynamic feature matrix are constructed to form a spatiotemporal graph structure;
[0014] The spatiotemporal graph structure is input into a deformable convolutional network, and the sampling position is dynamically adjusted through an offset learning layer. Combined with a multi-head self-attention mechanism, a dynamically weighted spatiotemporal feature vector is generated.
[0015] As a preferred embodiment of the electromagnetic flowmeter flow prediction method based on magnetic sensor identification and analysis described in this invention, the method involves: when calculating the theoretical magnetic field distribution using differentiable finite element simulation, the Maxwell equations are discretized into a linear equation set that can participate in back propagation, the theoretical magnetic field distribution is derived by combining the magnetohydrodynamic coupling model, and the residual term is calculated with the actual magnetic field measurement value. A hybrid loss function is then constructed to jointly optimize the neural network parameters and material property parameters.
[0016] The actual magnetic field measurement value refers to the quantized data of the magnetic field strength signal after preprocessing.
[0017] As a preferred embodiment of the electromagnetic flowmeter flow prediction method based on magnetic sensor identification and analysis described in this invention, the output calibration flow value includes the following steps.
[0018] Read the predicted flow velocity field values, establish a point-by-point mapping relationship between the predicted flow velocity and the Doppler baseline value, and initialize a trainable attention weight matrix;
[0019] The predicted velocity field is multiplied by the attention weight matrix to generate the calibrated velocity distribution, and the mean square error between the calibration result and the Doppler reference value is calculated.
[0020] The attention weight matrix and the predicted velocity field are updated synchronously until the error converges.
[0021] As a preferred embodiment of the electromagnetic flowmeter flow prediction method based on magnetic sensor identification and analysis described in this invention, the following is provided: when the elastic weight consolidation algorithm is triggered, the backbone parameters of the neural network are frozen, the distribution of the attention weight vector is dynamically adjusted by combining the historical weight importance with the real-time data stream, and the stability of the confidence score after fine-tuning is evaluated by the sliding window mechanism.
[0022] The historical weight importance refers to the saliency distribution of the parameters of the attention weight matrix accumulated during the joint optimization process through the gradient propagation algorithm; the real-time data stream refers to the latest magnetic field strength signal sequence that is continuously output as an anti-interference traffic prediction result and is synchronously acquired with the hardware trigger signal.
[0023] As a preferred embodiment of the electromagnetic flowmeter flow prediction method based on magnetic sensor identification and analysis described in this invention, the real-time confidence score is generated based on the deviation between the calibrated flow value and the reference value of the ultrasonic Doppler velocimeter, as well as the signal-to-noise ratio and zero-point drift of the magnetic field sensor array.
[0024] In a second aspect, the present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, wherein: when the computer program is executed by the processor, it implements any step of the electromagnetic flowmeter flow prediction method based on magnetic sensor identification and analysis as described in the first aspect of the present invention.
[0025] Thirdly, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, it implements any step of the electromagnetic flowmeter flow prediction method based on magnetic sensor identification and analysis as described in the first aspect of the present invention.
[0026] The beneficial effects of this invention are as follows: By integrating spatiotemporal signal acquisition and variational mode decomposition technology with a magnetic sensor array, fluid turbulence noise and mechanical vibration interference are effectively separated, significantly improving the signal-to-noise ratio in complex electromagnetic environments; by combining deformable convolutional networks and attention mechanisms to dynamically capture the spatiotemporal characteristics of magnetic field gradients, the adaptability to dynamic flow state changes is enhanced; by embedding finite element simulation and Maxwell equation physical constraints, the predicted flow velocity field and material parameters are jointly optimized to ensure that the output results conform to the laws of electromagnetic fluid dynamics, achieving dual verification of data-driven accuracy and electromagnetic fluid dynamics laws for the electromagnetic flowmeter measurement results; by adopting a Doppler-based dynamic calibration and elastic weight consolidation algorithm, sensor drift compensation and anti-interference capability optimization are achieved, ultimately significantly improving the long-term stability and reliability of the measuring device in complex industrial scenarios while ensuring measurement accuracy. Attached Figure Description
[0027] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0028] Figure 1 This is a flowchart of the electromagnetic flowmeter flow prediction method based on magnetic sensor identification and analysis in Example 1.
[0029] Figure 2 This is a flowchart of signal acquisition and preprocessing in Example 1.
[0030] Figure 3This is a flowchart of the spatiotemporal feature extraction process in Example 1.
[0031] Figure 4 This is a flowchart of the physical constraint optimization process in Example 1. Detailed Implementation
[0032] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0033] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.
[0034] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places in this specification does not necessarily refer to the same embodiment, nor is it a single or selective embodiment that is mutually exclusive with other embodiments.
[0035] Example 1, referring to Figures 1-4 This is the first embodiment of the present invention, which provides a method for predicting the flow rate of an electromagnetic flowmeter based on magnetic sensor identification and analysis, including the following steps:
[0036] S1: Real-time acquisition of magnetic field strength signals, and generation of alternating magnetic field based on high-frequency pulse modulation excitation coil, outputting the original magnetic field signal matrix containing spatiotemporal information.
[0037] Specifically, it includes the following steps:
[0038] S1.1: Configure the parameters of the high-frequency pulse modulation excitation coil, generate a square wave signal with a fixed duty cycle at a preset carrier frequency, and drive the coil to output an alternating magnetic field through a pulse width modulation controller.
[0039] Specifically, the carrier frequency and duty cycle parameters are set according to the electromagnetic characteristics of the object under test. The duty cycle parameters are input into the pulse width modulation controller to generate a square wave signal. The square wave signal drives the excitation coil through the power amplifier to generate a stable alternating magnetic field around the coil.
[0040] For example, when measuring the flow rate of a conductive liquid, the electromagnetic properties of the liquid are first analyzed: if the liquid conductivity is 5 S / m and the permeability is close to the vacuum permeability (μ≈μ0), then the carrier frequency of the excitation coil is set to 20 kHz (avoiding common mechanical vibration frequencies), and the duty cycle is fixed at 50% (to ensure symmetrical magnetic field excitation). The 20 kHz frequency value and the 50% duty cycle value are input into the register of the pulse width modulation controller. The pulse width modulation controller generates a square wave signal with an amplitude of 12V that strictly meets the requirements of 20 kHz frequency and 50% duty cycle according to the 20 kHz frequency value and 50% duty cycle. The 20 kHz / 50% square wave signal is amplified and then drives the excitation coil to generate an alternating magnetic field with stable amplitude and symmetrical waveform for subsequent magnetic field signal acquisition.
[0041] It is important to note that the carrier frequency of 20kHz and the duty cycle of 50% must be set to ensure that the generated alternating magnetic field can penetrate the measured medium while avoiding signal attenuation due to eddy current losses. Simultaneously, the pulse signal of the alternating magnetic field is output as a trigger signal through a hardware synchronization circuit, which is connected to the sampling clock input of the magnetic field sensor array.
[0042] S1.2: Based on the rising edge of the pulse of the alternating magnetic field, the sampling timing of the magnetic field sensor array is synchronized by the hardware trigger signal, and all sensor nodes are started to synchronously collect the original magnetic field signal according to the preset spatial layout.
[0043] Among them, the preset spatial layout refers to the fixed arrangement of the magnetic field sensor array in physical space. Its specific characteristics include the use of a regular two-dimensional grid array (such as rectangle, ring, etc.), the spatial coordinates of each sensor node are accurately calibrated during deployment, the node spacing is determined according to the gradient characteristics of the measured magnetic field, and it usually needs to meet the requirements of the spatial sampling theorem to ensure the reconfigurability of the magnetic field spatial distribution. The layout scheme needs to comprehensively consider the sensor sensitivity range, the target detection area size, and mechanical structure limitations.
[0044] For example, in industrial applications, 8×8 or 16×16 equally spaced grids are commonly used. The position information of each node is pre-recorded and stored for subsequent spatiotemporal signal registration. This pre-defined geometric configuration ensures that the data collected by all sensor nodes have a clear spatial correspondence, providing a spatial dimension benchmark for constructing a three-dimensional original magnetic field signal matrix.
[0045] S1.3: The raw magnetic field signals collected by each sensor node are input into a bandpass filter that matches the excitation frequency. After filtering out out-of-band noise, the signals are quantized into digital magnetic field strength signals in real time by a high-precision analog-to-digital converter.
[0046] S1.4: Align the quantized data of all sensor nodes according to the timestamp and integrate them into a three-dimensional raw magnetic field signal matrix, the dimensions of which consist of time point sequence data, spatial grid coordinate data and magnetic field strength quantification values.
[0047] Among them, quantized data refers to a three-dimensional structured data set formed by aligning the digital magnetic field strength signals of all sensor nodes (i.e., the original magnetic field signals after bandpass filtering and analog-to-digital conversion) according to timestamps and spatial coordinates.
[0048] Specifically, a high-precision clock source is used to mark all sensor nodes with a unified timestamp, and the digital magnetic field strength signals collected synchronously by each node are sorted and aligned according to the timestamp. The time-aligned digital magnetic field strength signals are mapped to the corresponding spatial grid positions according to the pre-calibrated sensor spatial coordinates. The time series data, spatial coordinate data, and magnetic field strength quantization values are integrated into a three-dimensional array according to the time dimension, spatial dimension, and signal strength dimension to generate a three-dimensional original magnetic field signal matrix containing complete spatiotemporal information.
[0049] The row index of this three-dimensional original magnetic field signal matrix corresponds to the time point sequence data, the column index corresponds to the spatial grid coordinate data, and the third dimension stores the quantized value of the magnetic field intensity at each spatiotemporal point, forming a standardized data structure that can be directly used for subsequent processing.
[0050] S2: The original magnetic field signal matrix is preprocessed, and the variational mode decomposition algorithm is used to separate fluid noise and mechanical vibration noise, and the noise-reduced spatiotemporal synchronization signal tensor is output.
[0051] Specifically, it includes the following steps:
[0052] S2.1: Perform Z-score normalization on the original magnetic field signal matrix to eliminate baseline offset between sensor nodes and output a normalized signal matrix with uniform dimensions. This normalized signal matrix serves as the input for variational mode decomposition.
[0053] S2.2: Input the normalized signal matrix into the variational mode decomposition algorithm, and obtain a set of intrinsic mode components through the preset number of modes, wherein each component contains non-overlapping frequency band signal features.
[0054] S2.3: Based on the frequency domain characteristics of fluid noise (low frequency band) and mechanical vibration noise (high frequency band), the noise-dominant components are screened out from the intrinsic mode components, and the remaining effective signal components are retained for reconstruction.
[0055] Specifically, fast Fourier transform spectrum analysis was performed on the intrinsic mode components obtained from variational mode decomposition to identify mode components with frequencies below 50 Hz as the dominant fluid noise components, while mode components with frequencies above 500 Hz were identified as the dominant mechanical vibration noise components.
[0056] The marked noise-dominant components are removed from the original intrinsic mode component set, and the remaining effective signal components with frequencies between 50 and 500 Hz are retained. The retained effective signal components are then reconstructed by time-domain superposition to generate a pure signal component set free from noise interference.
[0057] It should be noted that this set of pure signal components has the same time series length and spatial grid dimension as the original magnetic field signal matrix, and can be directly used for the construction of subsequent spatiotemporal synchronization signal tensors.
[0058] It should be noted that the low-frequency eddy current noise generated by the movement of conductive fluids (such as liquid metal) is mainly distributed in the range of 0.1-30Hz, and the 50Hz threshold can cover 99% of the fluid noise energy; the fundamental frequency of mechanical vibration of industrial equipment (such as pumps / compressors) is usually 500-2000Hz (compliant with ISO 10816-3 standard), and the resonant frequency of sensor brackets is mostly above 800Hz; the 500Hz threshold can avoid excitation frequency harmonics (such as the second harmonic of 400Hz excitation is 800Hz), and avoid misjudging the high-frequency components of the effective signal.
[0059] S2.4: Subtract the selected noise mode components from the normalized signal matrix, and reconstruct the denoised spatiotemporal synchronization signal tensor using the remaining effective components.
[0060] Among them, the denoised spatiotemporal synchronization signal tensor completely retains the original time series and spatial grid structure.
[0061] S2.5: Calculate the signal-to-noise ratio improvement of the signal matrix before and after noise reduction. If the preset threshold is not reached, return to S2.2 to adjust the mode decomposition parameters and iterate again until the output spatiotemporal synchronization signal tensor meets the noise suppression requirements.
[0062] Example illustration (magnetic field measurement scenario in aluminum electrolysis cell):
[0063] In a certain aluminum electrolysis production process, 64 magnetic field sensor nodes simultaneously collect 10 minutes of time-series data (sampling rate 1kHz), forming the original magnetic field signal matrix. After eliminating baseline differences between nodes caused by electrode aging through Z-score normalization (S2.1), the processed data is input into a variational mode decomposition algorithm (preset mode number K=6) to obtain 6 intrinsic mode components (S2.2). Spectral analysis shows:
[0064] Components 1-2: The dominant frequencies are 12Hz and 35Hz (<50Hz), which are consistent with the turbulent noise characteristics of electrolytic aluminum liquid (verifying the 0.1-30Hz theory); Components 5-6: The dominant frequencies are 620Hz and 850Hz (>500Hz), which match the peak values of the vibration spectrum of the electrolytic cell shell-breaking machine (refer to ISO 10816-3); Components 3-4: The dominant frequencies are 150Hz and 320Hz (50-500Hz), which are aligned with the excitation frequency of 250Hz and its harmonics, and are determined to be valid signals. After removing components 1-2 and 5-6 (S2.3), the signal-to-noise ratio of the spatiotemporal synchronization signal tensor (64×60000×3) reconstructed from the remaining components is improved by 18dB (S2.5), effectively extracting the magnetic field characteristics of the metal flow in the electrolytic cell.
[0065] S3: Extract the spatiotemporal features of the magnetic field gradient from the denoised spatiotemporal synchronization signal tensor, construct a spatiotemporal graph structure based on the spatial location of the sensor, dynamically adjust the spatiotemporal coding weights through deformable convolution kernels, calculate the attention weight vector of each sensor node, and output a dynamically weighted spatiotemporal feature vector.
[0066] Specifically, it includes the following steps:
[0067] S3.1: Apply the Sobel gradient operator to the denoised spatiotemporal synchronization signal tensor along the time and space dimensions respectively, calculate the magnitude and direction of the magnetic field strength gradient at each spatiotemporal point, and generate the spatiotemporal gradient feature matrix as the input data for constructing the spatiotemporal map.
[0068] S3.2: Based on the preset spatial coordinates of the sensor nodes, construct an adjacency matrix based on Euclidean distance to define the node connection relationship, and use the time series gradient features as node attributes to form a spatiotemporal graph structure that includes topological structure and dynamic features.
[0069] S3.3: Input the spatiotemporal graph structure into the deformable convolutional network, and dynamically adjust the sampling position of the convolutional kernel in the spatiotemporal dimension through the offset learning layer, so that the weight of the convolutional kernel adaptively focuses on the region of abrupt change in magnetic field gradient, and outputs a encoded feature tensor with spatial-temporal correlation.
[0070] The spatiotemporal graph structure contains a node feature matrix F∈R N×D With adjacency matrix A∈R N×N .
[0071] Where R represents the set of real numbers, i.e., all feature values are real numbers, N represents the number of sensor nodes (e.g., 64 magnetic field sensors in an aluminum electrolysis cell), and D represents the feature dimension of each node (e.g., including gradient magnitude, direction, time series statistics, etc.).
[0072] Specifically, the feature matrix F and the adjacency matrix A are input into the graph resampling layer. The irregular node distribution is transformed into a regular grid feature map G through bilinear interpolation. The regular grid feature map G is then input into the offset learning layer of the deformable convolutional network. This offset learning layer predicts the position offset of each sampling point through a small neural network Δp = MLP(G) containing two fully connected layers.
[0073] It should be noted that MLP is an abbreviation for Multi-Layer Perceptron. MLP is a fully connected feedforward neural network consisting of an input layer, several hidden layers, and an output layer. Each layer contains multiple neurons and achieves complex mappings through non-linear activation functions.
[0074] Adjusting the sampling coordinates p of the standard convolution kernel using position offset n +Δp n (P n (Using conventional grid coordinates), and through deformable convolution operations, outputting a space-time adaptive encoded feature tensor, the expression is:
[0075]
[0076] Δp∈RH×W×2;
[0077] In the formula, y(p) represents the feature value at position p in the output feature map (calculated by the convolution kernel with dynamically adjusted sampling positions), p represents the target coordinate point on the output feature map, N' represents the total number of sampling points of the convolution kernel, and w n p represents the learnable weight parameter corresponding to the nth sampling point, where n represents the index variable of the sampling point. n Δp represents the fixed relative coordinates of the nth sampling point within the standard convolution kernel. n Δp represents the dynamic position offset of the nth sampling point, H×W represents the set of position offsets of all sampling points, H×W represents the spatial resolution of the input feature map, H is the number of grids in the height direction of the input feature map, corresponding to the number of sensor layers in the vertical direction of the physical space, W is the number of grids in the width direction of the input feature map, corresponding to the number of sensor nodes in the horizontal direction of the physical space, and 2 indicates that the offset of each position is a two-dimensional vector.
[0078] S3.4: Based on the encoded feature tensor, a multi-head self-attention mechanism is used to calculate the dynamic correlation weights between sensor nodes. The attention weight matrix is generated by Softmax normalization, and the spatiotemporal features are dynamically weighted and fused.
[0079] Specifically, the encoded feature tensor is input into the multi-head self-attention layer, and a query, key, and value matrix is generated through linear transformation. Each attention head projects its features into a low-dimensional subspace using independent learnable weight parameters. The attention score matrix between each sensor node is calculated, and the weight distribution is obtained through normalization to suppress numerical instability. The value matrix is weighted and fused using the attention weights to obtain the intermediate output features of each attention head. The outputs of all attention heads are concatenated and integrated into dynamically weighted spatiotemporal features through a linear transformation layer, thus fully preserving the spatiotemporal correlation patterns in the sensor network.
[0080] S3.5: Perform global average pooling on the weighted spatiotemporal features along the time dimension to compress them into a dynamically weighted spatiotemporal feature vector with fixed dimensions, while preserving the spatial gradient distribution pattern and temporal evolution law.
[0081] S4: The theoretical magnetic field distribution is calculated through differentiable finite element simulation. The Maxwell equations are discretized and embedded into a neural network. The residual terms are calculated with the actual magnetic field measurement values, and the predicted flow field values that meet the physical constraints are output.
[0082] Specifically, it includes the following steps:
[0083] S4.1: Based on the geometric dimensions and material properties (such as electrical conductivity and magnetic permeability) of the aluminum electrolytic cell, a three-dimensional finite element computational mesh is constructed; the Maxwell equations are discretized into a linear equation system, the coefficient matrix of which is calculated from the material parameters, the unknowns represent the magnetic field strength distribution, and the terms on the right side of the linear equations correspond to the current density distribution of the excitation coil.
[0084] Specifically, based on the actual structural dimensions of the aluminum electrolysis cell and the sensor placement, a three-dimensional geometric model is established and a computational mesh is generated. A denser tetrahedral element mesh is used in the electrolyte region, while a structured meshing method is used in the metal electrode region. Local mesh refinement is applied to the gas-liquid interface region. The conductivity and magnetic permeability parameters are assigned as material properties of the mesh elements, ultimately generating a three-dimensional unstructured mesh that meets the computational accuracy requirements, ensuring that the positions of all sensor nodes correspond to the mesh computational nodes.
[0085] Furthermore, the Maxwell equations are discretized using the finite element method, and the magnetic field components are expressed using vector basis functions. The coefficient matrix elements containing material parameters are calculated at the element level. These coefficient element matrices are assembled into a global sparse matrix structure through parallel computing. The excitation source current density is transformed into a right-hand side term of the equation. The linear algebra problem is solved using an iterative algorithm combined with preprocessing techniques. Finally, the magnetic field strength calculation results of each grid node are output.
[0086] Ideally, this discretization process is implemented as a differentiable computational unit, enabling the discretization computation to participate in the automatic differentiation training of the neural network.
[0087] S4.2: Input the flow velocity field predicted by the neural network into the magnetohydrodynamic coupling model, derive the theoretical current density and magnetic field distribution, and calculate the residual between the theoretical and measured values by combining the actual magnetic field measurement data (from the spatiotemporal characteristics after noise reduction), which serves as a constraint term for the consistency of physical laws.
[0088] Specifically, the three-dimensional velocity field prediction results output by the neural network are input into the magnetohydrodynamic coupling calculation process. The induced current density distribution is derived based on the interaction between the velocity field and the magnetic field. The theoretical magnetic field distribution is obtained by solving the Maxwell equations. The actual magnetic field measurement data after noise reduction is spatiotemporally aligned with the theoretical magnetic field distribution. The differences between the two are calculated point by point, and the sum of their squares is taken as the physical constraint residual term to construct a hybrid objective function for network parameter optimization.
[0089] S4.3: Construct a hybrid loss function that integrates data error and physical residual. Optimize neural network parameters and material property parameters through backpropagation to output a flow field prediction value that satisfies the law of mass conservation. The dimension of this flow field prediction value is strictly aligned with the spatial grid coordinates and can be directly used for flow visualization and process optimization in electrolytic cells.
[0090] The neural network parameters are the trainable (optimizable) weights and biases in the neural network, including the weight matrix of the convolutional kernel and the weight coefficients of the fully connected layers. They are automatically adjusted through the backpropagation algorithm to minimize the loss function. The material property parameters are physical parameters describing the electromagnetic properties of the measured medium, including electrical conductivity and magnetic permeability. In the magnetohydrodynamic coupling model, they are optimizable variables and are jointly trained with the neural network parameters to improve prediction accuracy.
[0091] Specifically, the hybrid loss function is constructed as follows: The data error term is defined as the mean square error between the neural network-predicted velocity field and the measured velocity field; the physical residual term is defined as the L2-norm squared difference between the theoretical magnetic field distribution and the actual measured magnetic field value. The two errors are then linearly weighted and summed according to preset weighting coefficients. The weight of the data error term reflects the accuracy confidence level of the velocity measurement equipment, while the weight of the physical residual term reflects the constraint strength of the electromagnetic field equations, thus forming a hybrid loss function that simultaneously considers data matching accuracy and consistency with physical laws.
[0092] The actual magnetic field measurement value refers to the quantized data of the magnetic field strength signal after preprocessing (noise reduction, synchronization, etc.).
[0093] Joint parameter optimization process: The hybrid loss function is input into the optimizer for backpropagation calculation. The gradient of the loss function with respect to the trainable parameters of the neural network and the gradient with respect to the material property parameters are obtained simultaneously through automatic differentiation. The gradient descent algorithm is used to update the weight matrix of the neural network and the estimated values of the material conductivity and permeability parameters. In each iteration, the theoretical magnetic field distribution is recalculated and the physical residual term is updated until the loss function value reaches a stable convergence state. At this time, the output three-dimensional velocity field prediction result matches the measured data and conforms to the laws of electromagnetic fluid dynamics.
[0094] S5: The gradient propagation algorithm is used to jointly optimize the predicted flow velocity field value and the attention weight vector to minimize the mean square error between the predicted flow velocity and the ultrasonic Doppler reference value, and output the calibrated flow value.
[0095] Specifically, it includes the following steps:
[0096] S5.1: Read the predicted flow velocity field value, extract the predicted grid node value that matches the spatial coordinates of the ultrasonic Doppler velocimeter, and establish a point-by-point mapping relationship between the predicted flow velocity and the Doppler reference value.
[0097] Specifically, the flow field prediction values output by the neural network are read, and based on the geometric correspondence between the three-dimensional grid coordinates of the electrolytic cell and the installation position of the ultrasonic Doppler velocimeter, the predicted flow velocity components of the grid nodes at the spatial location of the velocimeter are extracted using a bilinear interpolation algorithm. The extracted predicted flow velocity components are spatiotemporally aligned with the benchmark flow velocity values measured by the Doppler velocimeter at the same time, and N sets of one-to-one corresponding data pairs are established. Each set of data pairs contains the predicted and measured values of the same spatial coordinate points, forming a flow velocity verification dataset covering the key areas of the electrolytic cell.
[0098] It should be noted that the predicted velocity field is the three-dimensional velocity distribution data directly output by the neural network, while the predicted velocity field value is the velocity value of a specific spatial location (such as the corresponding node of the Doppler velocimeter) extracted from the three-dimensional velocity distribution data.
[0099] S5.2: Initialize a trainable attention weight matrix whose dimension is consistent with the spatial distribution of the magnetic field sensor array, and the weight values represent the reliability confidence of the measurement data at each spatial location.
[0100] S5.3: Perform a Hadamard product operation on the predicted velocity field and the attention weight matrix to generate the calibrated velocity distribution, and calculate the mean square error between the calibration result and the Doppler reference value.
[0101] Specifically, the predicted velocity field tensor and the attention weight matrix are subjected to an element-wise Hadamard product to generate the calibrated velocity field distribution, expressed as:
[0102] U=H⊙V=[h i,j ·vi,j N×3;
[0103] In the formula, U represents the calibrated velocity field tensor, H represents the attention weight matrix, ⊙ is the Hadamard product, which represents the element-wise multiplication of two matrices of the same dimension, V is the original velocity field tensor predicted by the neural network, N×3 represents the dimension label of the matrix, and h i,j v represents the element in the i-th row and j-th column of the weight matrix H. i,j Let V be the element in the i-th row and j-th column, representing the predicted value of the j-th velocity component of the i-th node;
[0104] For k Doppler velocimeters deployed in an electrolytic cell (typically k=8), the calibrated flow velocity values are extracted at spatially matched locations, and the error between these values and the Doppler reference values is calculated. A mean square error loss function L is constructed, with the expression:
[0105]
[0106] In the formula, Represents the normalization coefficient. This represents the summation of the spatial positions of k ultrasonic Doppler velocities, where k is the index of the Doppler velocities and K is the total number of Doppler velocities. This indicates that the summation is performed on the three velocity components of each speedometer. i(k),j v represents the weight value of the i(k)th sensor node in the j-th velocity component in the attention weight matrix. i(k),j Let represent the velocity value of the i(k)th sensor node at the j-th velocity component in the predicted velocity field tensor. This represents the reference measurement (true value) of the k-th Doppler velocimeter on the j-th velocity component. 2 The square operation is used to calculate the square of the point-by-point error between the predicted value and the baseline value. i(k) represents the sensor node number corresponding to the k-th velocity meter, j represents the spatial direction of the velocity component, and DOP represents the measurement data identifier of the Doppler Ultrasonic Velocimeter, which is represented in subscript form.
[0107] S5.4: The attention weight matrix and flow field prediction are updated synchronously through the gradient descent algorithm. The optimization is terminated when the error reduction rate of three consecutive iterations is less than one percent. The output is a calibrated flow value with spatial resolution perfectly aligned with the electrolyzer grid.
[0108] S6: Calculate the real-time confidence score based on the calibrated flow value. When the score is lower than the preset score threshold, the attention weight vector is fine-tuned online using the elastic weight consolidation algorithm, and the anti-interference flow prediction result is output.
[0109] Specifically, it includes the following steps:
[0110] S6.1: Statistically calculate the average deviation between the calibrated flow rate value and the Doppler reference value within a preset time window (e.g., 10 minutes), combine it with sensor health status data (including but not limited to signal-to-noise ratio, zero-point drift, etc.), and generate a real-time confidence score through normalization processing.
[0111] The sensor health status data is calculated by real-time monitoring of indicators such as signal-to-noise ratio (SNR), zero-point drift, and signal attenuation rate at each node, combined with periodic calibration records. The SNR is obtained from the power spectrum analysis of the original signal, and the zero-point drift is calculated using the standard deviation of the sensor output under no-flow conditions. The deviation of the ultrasonic Doppler velocimeter's reference value is calculated using the root mean square error of the calibrated flow rate value and the measured value of the ultrasonic Doppler velocimeter across the three velocity components.
[0112] S6.2: When the confidence score is lower than the preset score threshold, freeze the parameter update of the neural network backbone and only activate the fine-tuning mode of the elastic weight consolidation algorithm. Under the constraint of preserving the importance of historical weights, dynamically adjust the distribution of attention weight vector through real-time data stream.
[0113] Specifically, the weight parameters of all convolutional and fully connected layers in the neural network backbone are frozen to stop gradient updates. The elastic weight consolidation algorithm is activated to load the Fisher information matrix stored in the historical training phase and calculate the importance score of each attention weight. The latest magnetic field strength signal sequence and Doppler reference value collected in real time are input to calculate the loss function under the constraint of importance score to update the gradient. The stability of the updated weight vector is verified by the sliding window averaging method.
[0114] For example, during the flow monitoring process of aluminum electrolysis cells, when the current confidence score is detected to be lower than the preset threshold, all weight parameters of the spatiotemporal graph convolutional layer and finite element embedding layer in the neural network are immediately locked, and the elastic weight consolidation fine-tuning process is initiated: the pre-calculated Fisher information matrix is loaded from the storage unit to obtain the importance coefficients of each attention weight, the real-time collected magnetic field data of the 16×16 sensor array (sampling rate 1kHz) and the readings of 8 Doppler velocimeters are input into the calculation process, the attention weight update is calculated based on the loss function weighted by the importance coefficients, and the final stable weight distribution is output after the standard deviation of the weight change is less than 0.01 through a 5-second sliding window, so that the signal-to-noise ratio of the flow prediction value is improved from 15dB to 22dB.
[0115] Among them, historical weight importance refers to the parameter significance distribution of the attention weight matrix accumulated during the joint optimization process through the gradient propagation algorithm; real-time data stream refers to the latest magnetic field strength signal sequence that is continuously output as anti-interference traffic prediction results and synchronously acquired with hardware trigger signals.
[0116] It should be noted that determining the preset scoring threshold requires considering the long-term statistical characteristics of the deviation between the Doppler reference value and the calibrated flow value. The critical value for triggering the fine-tuning mechanism is set by analyzing the distribution pattern of the confidence score. This scoring threshold needs to reference sensor health indicators, including real-time monitoring data such as signal-to-noise ratio and zero-point drift, and uses a sliding window statistical method to evaluate the scoring trend (e.g., the scoring trend within the last ten minutes). When the confidence score falls below this threshold, the elastic weight consolidation algorithm is triggered to adjust the attention weight vector online. In safety-sensitive scenarios such as chemical engineering, the scoring threshold can be appropriately increased; in rapid response scenarios, the scoring threshold can be decreased and supplemented with subsequent compensation measures.
[0117] It is important to note that all scoring thresholds must ultimately be cross-validated to ensure an optimal balance between calibration accuracy and system stability.
[0118] S6.3: The stability of the prediction results after fine-tuning is evaluated by a sliding window mechanism. If the built-in confidence score continues to recover to above the score threshold in several consecutive sampling periods, the fine-tuning mode is exited and the anti-interference flow prediction result is output. Otherwise, the sensor abnormality alarm is triggered.
[0119] It should be noted that the sliding window mechanism, a common method in time series data analysis, achieves continuous monitoring and evaluation by sliding a fixed-length data window along the time axis. In this scheme, the sliding window mechanism uses a preset number of sampling periods as the window length to continuously track the trend of confidence score changes after fine-tuning. Each time the window slides forward by one sampling period, the earliest data point is automatically removed and the latest score value is included, ensuring that the evaluation results reflect the latest state. When all confidence scores within the window are higher than the preset score threshold, the prediction result is considered to have stabilized; if the condition is still not met even after the window slides to the maximum allowable number of periods, an abnormal alarm process is triggered.
[0120] Ideally, the sliding window mechanism can avoid misjudgments caused by fluctuations in single sampling, and balance response speed and judgment reliability by adjusting the window length. The window size is determined based on the sensor sampling frequency and actual operating conditions. For example, in a flow monitoring scenario with second-level sampling, the typical window length is set to 5-10 cycles.
[0121] For example, during the flow prediction calibration process, a sliding window with a fixed length of 5 sampling periods is used to continuously monitor the changes in confidence scores. Each time a new score is acquired, the window slides forward and updates the data. When the scores within the window exceed the preset score threshold of 0.75 for 5 consecutive times, it is determined that the prediction result has stabilized and the system automatically exits the fine-tuning mode, outputting the final anti-interference flow prediction value. If the condition is still not met after the window slides for 10 periods, a sensor anomaly alarm process with three levels of response (partial data replacement, model switching, and system shutdown) is immediately triggered. At the same time, all score data within the current window is recorded for subsequent analysis. This mechanism ensures the real-time nature of the evaluation and effectively avoids misjudgments caused by accidental fluctuations.
[0122] This embodiment also provides a computer device applicable to the electromagnetic flowmeter flow prediction method based on magnetic sensor identification and analysis, comprising: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the electromagnetic flowmeter flow prediction method based on magnetic sensor identification and analysis as proposed in the above embodiment.
[0123] The computer device can be a terminal, comprising a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, NFC (Near Field Communication), or other technologies. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device's casing, or an external keyboard, touchpad, or mouse.
[0124] This embodiment also provides a storage medium storing a computer program. When executed by a processor, the program implements the electromagnetic flowmeter flow prediction method based on magnetic sensor identification and analysis as proposed in the above embodiments. The storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Red-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0125] In summary, this invention effectively separates fluid turbulence noise and mechanical vibration interference by integrating spatiotemporal signal acquisition with a magnetic sensor array and variational mode decomposition technology, significantly improving the signal-to-noise ratio in complex electromagnetic environments. It also dynamically captures the spatiotemporal characteristics of magnetic field gradients using deformable convolutional networks and attention mechanisms, enhancing adaptability to dynamic flow regime changes. By embedding finite element simulation and Maxwell equation physical constraints, it jointly optimizes the predicted flow velocity field and material parameters, ensuring that the output results conform to the laws of electromagnetic fluid dynamics, achieving dual verification of data-driven accuracy and electromagnetic fluid dynamics laws for the electromagnetic flowmeter measurement results. Finally, it employs a Doppler-based dynamic calibration and elastic weight consolidation algorithm to optimize sensor drift compensation and anti-interference capabilities, ultimately significantly improving the long-term stability and reliability of the measuring device in complex industrial scenarios while maintaining measurement accuracy.
[0126] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A flow prediction method for electromagnetic flowmeters based on magnetic sensor identification and analysis, characterized in that: include, The magnetic field strength signal is acquired in real time, and an alternating magnetic field is generated based on the high-frequency pulse modulation excitation coil, outputting the original magnetic field signal matrix containing spatiotemporal information; The original magnetic field signal matrix is preprocessed, and the fluid noise and mechanical vibration noise are separated by the variational mode decomposition algorithm. The noise-reduced spatiotemporal synchronization signal tensor is then output. The spatiotemporal features of the magnetic field gradient are extracted from the spatiotemporal synchronization signal tensor after noise reduction. A spatiotemporal graph structure is constructed based on the spatial location of the sensor. The spatiotemporal coding weights are dynamically adjusted through deformable convolution kernels, and the attention weight vectors of each sensor node are calculated to output a dynamically weighted spatiotemporal feature vector. The theoretical magnetic field distribution is calculated by differentiable finite element simulation. The Maxwell equations are discretized and embedded into a neural network. The residual terms are calculated with the actual magnetic field measurement values, and the predicted flow field values that meet the physical constraints are output. The gradient propagation algorithm is used to jointly optimize the predicted flow velocity field and the attention weight vector to minimize the mean square error between the predicted flow velocity and the ultrasonic Doppler reference value, and output the calibrated flow rate value. Real-time confidence scores are calculated based on calibrated flow values. When the score is lower than a preset score threshold, an elastic weight consolidation algorithm is used to fine-tune the attention weight vector online, and an anti-interference flow prediction result is output.
2. The electromagnetic flowmeter flow prediction method based on magnetic sensor identification and analysis as described in claim 1, characterized in that: When the high-frequency pulse modulation excitation coil generates an alternating magnetic field, the carrier frequency and duty cycle parameters are set according to the electromagnetic characteristics of the measured medium. The pulse width modulation controller generates a square wave signal with stable amplitude and symmetrical waveform. After power amplification, the excitation coil is driven to work, and the output trigger signal synchronizes the sampling timing of the magnetic sensor array.
3. The electromagnetic flowmeter flow prediction method based on magnetic sensor identification and analysis as described in claim 2, characterized in that: The magnetic sensor array adopts a regular two-dimensional grid array with a preset spatial layout; The coordinates of each node in the regular two-dimensional grid array are determined by equidistant arrangement. The sampling timing of each node is synchronized by a hardware trigger signal, and a three-dimensional original magnetic field signal matrix is generated after filtering out out-of-band noise based on a bandpass filter.
4. The electromagnetic flowmeter flow prediction method based on magnetic sensor identification and analysis as described in claim 1, characterized in that: The extraction of the spatiotemporal features of the magnetic field gradient from the denoised spatiotemporal synchronization signal tensor includes the following steps. The magnitude and direction of the magnetic field gradient at each spatiotemporal point are calculated by applying the Sobel gradient operator along the time and space dimensions. Based on the node coordinate distribution of the two-dimensional grid array, an adjacency matrix and a dynamic feature matrix are constructed to form a spatiotemporal graph structure; The spatiotemporal graph structure is input into a deformable convolutional network, and the sampling position is dynamically adjusted through an offset learning layer. Combined with a multi-head self-attention mechanism, a dynamically weighted spatiotemporal feature vector is generated.
5. The electromagnetic flowmeter flow prediction method based on magnetic sensor identification and analysis as described in claim 1, characterized in that: When calculating the theoretical magnetic field distribution using differentiable finite element simulation, the Maxwell equations are discretized into a linear set of equations that can participate in backpropagation. The theoretical magnetic field distribution is derived by combining the magnetohydrodynamic coupling model, and the residual terms are calculated with the actual magnetic field measurements. A hybrid loss function is then constructed to jointly optimize the neural network parameters and material property parameters. The actual magnetic field measurement value refers to the quantized data of the magnetic field strength signal after preprocessing.
6. The electromagnetic flowmeter flow prediction method based on magnetic sensor identification and analysis as described in claim 1, characterized in that: The output calibration flow rate value includes the following steps. Read the predicted flow velocity field values, establish a point-by-point mapping relationship between the predicted flow velocity and the Doppler baseline value, and initialize a trainable attention weight matrix; The predicted velocity field is multiplied by the attention weight matrix to generate the calibrated velocity distribution, and the mean square error between the calibration result and the Doppler reference value is calculated. The attention weight matrix and the predicted velocity field are updated synchronously until the error converges.
7. The electromagnetic flowmeter flow prediction method based on magnetic sensor identification and analysis as described in claim 1, characterized in that: When the Elastic Weight Consolidation Algorithm is triggered, the parameters of the neural network backbone are frozen, the distribution of the attention weight vector is dynamically adjusted by combining the historical weight importance with the real-time data stream, and the stability of the fine-tuned confidence score is evaluated by a sliding window mechanism. The historical weight importance refers to the saliency distribution of the parameters of the attention weight matrix accumulated during the joint optimization process through the gradient propagation algorithm; the real-time data stream refers to the latest magnetic field strength signal sequence that is continuously output as an anti-interference traffic prediction result and is synchronously acquired with the hardware trigger signal.
8. The electromagnetic flowmeter flow prediction method based on magnetic sensor identification and analysis as described in claim 1, characterized in that: The real-time confidence score is generated based on the deviation between the calibrated flow rate value and the reference value of the ultrasonic Doppler velocimeter, as well as the signal-to-noise ratio and zero-point drift of the magnetic sensor array.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, it implements the steps of the electromagnetic flowmeter flow prediction method based on magnetic sensor identification and analysis as described in any one of claims 1 to 8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, it implements the steps of the electromagnetic flowmeter flow prediction method based on magnetic sensor identification and analysis as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Multi-source magnetic field pulse signal identification method and system based on self-attention mechanism
CN118859335A
Integrated power generation equipment health state supervision system
CN120067837A