Pulse output sensor control system for electromagnetic flowmeter
By collecting fluid status data in real time and adjusting pulse control parameters in the closed-loop control mechanism, the problem of signal drift in the long-term operation of the electromagnetic flowmeter is solved, and the pulse output with high stability and high consistency is achieved, and the adaptive adjustment capability of the electromagnetic flowmeter is enhanced.
Patent Information
- Application Number
- CN202510660650.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-22
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2045-05-22
AI Technical Summary
During the long-term operation of existing electromagnetic flowmeters, due to factors such as fluctuations in fluid components, electrode scaling, sensor aging, etc., the stability of the output pulse signal and structural offset are reduced and structural deviations are prevented from real-time and adaptive, and the stability and consistency of long-term high-precision measurements cannot be guaranteed.
The acquisition module is used to collect fluid state data in real time, and the working condition state vector and health state vector are generated through the modeling module to identify system drift. The generation module is used to dynamically adjust pulse control parameters, combined with the structural deviation score of the discrimination module and feedback correction of the output control module, a closed-loop control mechanism is built to realize real-time acquisition and modeling of key variables such as conductivity, temperature, viscosity gradient, and dynamically adjust pulse output.
It significantly enhances the drift fault tolerance and adaptive adjustment capabilities of the electromagnetic flowmeter under complex operating conditions, avoids human intervention and frequent shutdown calibration, and ensures high consistency and high stability of the output pulse signal.
Smart Images

Figure CN120176789B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of electromagnetic flowmeters, and in particular to a pulse output sensor control system for electromagnetic flowmeters. Background Art
[0002] As a fluid flow measurement instrument commonly used in industrial processes, electromagnetic flowmeters have the advantages of no moving parts, high measurement accuracy, and applicability to conductive liquids. However, in actual long-term operation, due to factors such as fluid composition fluctuations, electrode scaling, sensor chain aging, and increased flow disturbances, the output pulse signal often suffers from stability degradation and structural offset, which in turn causes increased cumulative errors, calibration failures, or abnormal alarms. Existing methods are mostly based on fixed parameter models or periodic calibration mechanisms, which make it difficult to dynamically respond to signal drift caused by these slow or instantaneous changes without interrupting the measurement process. In addition, in dealing with non-Newtonian fluids, bubble interference, or complex working conditions, existing pulse output adjustment schemes lack sufficient real-time and adaptive capabilities, and cannot ensure the consistency and controllability of the output signal in long-period, high-precision measurement tasks. Summary of the Invention
[0003] In response to the shortcomings of the existing technology, in order to solve the technical problem of how to maintain the accuracy and stability of the output pulse signal for a long time during the long-term measurement process of the electromagnetic flowmeter, even when the measurement signal drifts for a long time due to changes in fluid properties or slow changes in the internal state of the measurement system, the present application provides a pulse output sensor control system for an electromagnetic flowmeter, including:
[0004] An acquisition module is configured to acquire operating condition data of the target fluid under the current measurement condition; the operating condition data includes: the conductivity value, temperature value, viscosity gradient index of the target fluid, the amplitude change rate of the output pulse signal of the target fluid within a preset time window, and the waveform characteristics of the induced electromotive force;
[0005] a modeling module configured to perform multi-dimensional state modeling based on the operating condition data to generate an operating condition state vector and a health state vector; identify system state drift based on the health state vector and generate drift information; the health state vector is a state description vector calculated by comparing the operating condition state vector with a historical health distribution;
[0006] a generating module, configured to receive the operating state vector, the healthy state vector, and the drift information, and generate a pulse control parameter based on a preset parameter mapping function; and perform signal synthesis based on the pulse control parameter to generate a first pulse signal;
[0007] a discrimination module, configured to perform waveform alignment, edge detection, and pulse count comparison on the first pulse signal using a standard pulse waveform, and output a structural deviation score;
[0008] An output control module is used to receive the structural deviation score, update the control parameter vector in the parameter mapping function according to a preset loss function and in combination with the drift information, and obtain an updated parameter mapping function; re-execute the signal synthesis operation based on the updated parameter mapping function to generate a second pulse signal, and output the second pulse signal to the external interface of the electromagnetic flowmeter.
[0009] As an optional implementation manner, the collecting of the working condition data of the target fluid to be measured under the current measuring working condition includes:
[0010] Measuring a flow velocity difference by at least two flow velocity sensors installed at different positions of the measuring pipe section, and determining a viscosity gradient index of the target fluid to be measured based on the flow velocity difference according to a preset viscosity gradient calculation method;
[0011] The amplitude of the output pulse signal is sampled in real time within a preset time window, and the slope of the change of the amplitude within the preset time window is calculated to determine the rate of change of the amplitude of the output pulse signal;
[0012] The induced electromotive force waveform is collected by sampling units installed at both ends of the electromagnetic flowmeter excitation electrodes, and the waveform frequency, amplitude and fluctuation range are calculated to determine the waveform characteristics of the induced electromotive force.
[0013] As an optional implementation manner, generating the operating state vector and the health state vector includes:
[0014] The conductivity value, temperature value, viscosity gradient index, output pulse signal amplitude change rate and induced electromotive force waveform characteristics are respectively numerically normalized, and the operating state vector is constructed by a vectorized splicing method;
[0015] Based on historical operating condition data, data cluster analysis is performed within the preset operating condition space to construct historical health distribution;
[0016] The similarity between the operating state vector and the historical health distribution is calculated, the health deviation degree is determined according to a preset drift threshold, and the health state vector is constructed based on the health deviation degree.
[0017] As an optional implementation manner, the generating of the pulse control parameters based on the preset parameter mapping function mapping includes:
[0018] The working state vector, the health state vector and the drift information are fused and spliced into a main mapping input vector, and the viscosity gradient index is separately input into a modulation subnetwork, wherein the modulation subnetwork includes at least one neural layer with a nonlinear activation function, and is used to generate a modulation factor vector;
[0019] Inputting the main mapping input vector into a multilayer perceptron main mapping network, wherein the main mapping network includes at least two hidden layers, each hidden layer includes a plurality of neurons with a nonlinear activation function;
[0020] Introducing a modulation operation in an intermediate hidden layer of the main mapping network, the modulation operation comprising performing element-wise multiplication or affine transformation on the modulation factor vector and the current hidden layer output to form an intermediate feature expression dynamically modulated by the viscosity gradient;
[0021] Based on the modulated output of the main mapping network, a control parameter vector is generated to characterize the pulse frequency, duty cycle and holding time.
[0022] As an optional implementation manner, identifying system state drift based on the health state vector and generating drift information includes:
[0023] Calculating a distance value between the current operating condition and the historical health distribution based on the health state vector;
[0024] Comparing the distance value with a preset drift threshold interval, and determining that the system state has drifted when the distance value exceeds the drift threshold interval;
[0025] According to the extent to which the distance value exceeds the drift threshold interval, drift level information for characterizing the severity of the state drift is quantified and generated.
[0026] As an optional implementation manner, generating drift information further includes:
[0027] Multi-resolution wavelet transform is performed on the time series of drift amplitude values to distinguish the low-frequency trend drift component and the high-frequency short-time disturbance component;
[0028] performing online cluster analysis based on the low-frequency trend drift component and the high-frequency short-term disturbance component in a multidimensional feature space consisting of drift level, drift direction, and drift rate to identify typical drift patterns;
[0029] Different compensation strategies are established and implemented for different typical drift modes.
[0030] As an optional implementation, the wavelet basis function used in the wavelet transform is Symlets wavelet or Coiflets wavelet; and performing a multi-resolution wavelet transform on a sequence of drift amplitude values varying with time includes:
[0031] Based on the excitation frequency of the electromagnetic flowmeter and its integer multiple harmonic frequencies, the number of scale decomposition layers of the wavelet transform is determined to decompose the drift amplitude sequence into wavelet subsequences corresponding to the low-frequency trend drift component and the high-frequency short-time disturbance component in the scale space.
[0032] For the wavelet subsequence, threshold suppression and reconstruction of harmonic interference are performed through the following steps:
[0033] Perform spectrum analysis on the wavelet subsequences of each scale and calculate the spectrum distribution of the wavelet subsequence at each scale;
[0034] Identifying and locating harmonic interference frequency positions that are integer multiples of the excitation frequency in the spectrum distribution, and determining the spectrum amplitude corresponding to each harmonic interference frequency point;
[0035] Calculating an adaptive threshold based on the spectrum amplitude corresponding to each harmonic interference frequency point, wherein the adaptive threshold is calculated based on the mean and standard deviation of the spectrum amplitude in the neighborhood of each harmonic interference frequency point;
[0036] Setting the spectrum amplitude exceeding the adaptive threshold at each harmonic interference frequency point to zero or attenuating it proportionally to obtain a spectrum after harmonic interference suppression;
[0037] Wavelet reconstruction is performed based on the spectrum after harmonic interference suppression to obtain low-frequency trend drift components corresponding to long-term trend drift and high-frequency short-term disturbance components corresponding to short-term disturbance.
[0038] As an optional implementation manner, the identifying a typical drift pattern includes:
[0039] Calculating a long-term drift rate and a drift accumulation based on the low-frequency trend drift component, and determining a long-term trend drift characteristic vector;
[0040] Calculating the spectrum energy distribution and instantaneous drift rate of the short-term disturbance based on the high-frequency short-term disturbance component, and determining the short-term disturbance characteristic vector;
[0041] Performing vector fusion on the long-term trend drift feature vector and the short-term disturbance feature vector in a four-dimensional feature space consisting of drift level, drift direction, drift rate and spectrum energy to form a comprehensive drift feature vector;
[0042] Inputting the comprehensive drift feature vector into a preset clustering model to generate a clustering result; the clustering model is a clustering algorithm based on density peak;
[0043] Based on the clustering results, typical drift modes are determined and marked, where the typical drift modes include: a gradual drift mode caused by sensor fouling, a high-frequency disturbance mode caused by bubble inclusion, and a sudden drift mode caused by sensor transient failure.
[0044] As an optional implementation, the output structure deviation score includes:
[0045] Performing edge detection on the first pulse signal and the standard pulse waveform, extracting the timestamp sequences of the rising edge and the falling edge respectively, calculating the time offset of the corresponding edges, and obtaining an edge time deviation score;
[0046] performing point-by-point difference calculation on the amplitudes of the first pulse signal and the standard pulse waveform at corresponding sampling moments to obtain an amplitude error sequence, and determining an amplitude error score based on a root mean square value of the amplitude error sequence;
[0047] Within a preset time window, counting the number of valid pulses in the first pulse signal and the standard pulse waveform respectively, calculating the pulse count difference between the two, and obtaining a pulse count difference score;
[0048] The edge time deviation score, the amplitude error score and the pulse count difference score are weighted and fused according to a preset weighting coefficient to output the structural deviation score.
[0049] As an optional implementation manner, generating the second pulse signal includes:
[0050] constructing a target loss function based on the structural deviation score, wherein the target loss function includes a structural deviation score term and a drift adjustment regularization term related to the drift level;
[0051] Determining an adjustment factor in a target loss function according to the drift level information, wherein the adjustment factor is used to dynamically adjust an update amplitude of the target loss function;
[0052] Iteratively updating the control parameter vector in the parameter mapping function using an optimization algorithm based on a first-order gradient, wherein the optimization algorithm includes: an adaptive moment estimation algorithm and a stochastic gradient descent algorithm;
[0053] The updated control parameter vector replaces the corresponding parameter in the parameter mapping function, and the signal synthesis operation is re-executed to generate the second pulse signal.
[0054] Compared with the existing technology, the pulse output sensor control system for electromagnetic flowmeter proposed in this application realizes real-time acquisition and modeling of key variables such as conductivity, temperature, viscosity gradient, and signal waveform by constructing a closed-loop control mechanism with working condition perception, state modeling, parameter generation, deviation judgment, and feedback correction; the health state vector is used to identify the degree of system drift, and the pulse output frequency, duty cycle and maintenance time are dynamically adjusted accordingly. Combined with the loss function optimization process driven by structural deviation scoring, the output pulse signal is always kept in a state of high consistency and high stability, which significantly enhances the drift tolerance and adaptive adjustment ability of the electromagnetic flowmeter in long-term complex operation scenarios, and avoids the need for human intervention and frequent shutdown calibration. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 A schematic diagram of a pulse output sensor control system for an electromagnetic flowmeter provided in this application;
[0056] Figure 2 A schematic diagram of bubbles in a fluid provided in this application;
[0057] Figure 3 A flowchart of the method for generating the working state vector and the health state vector provided in this application;
[0058] Figure 4 This is a flowchart of a method for generating pulse control parameters based on a preset parameter mapping function provided in this application. DETAILED DESCRIPTION
[0059] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments.
[0060] Reference Figure 1 FIG. 1 is a schematic diagram of a pulse output sensor control system for an electromagnetic flowmeter provided by the present application, the system comprising:
[0061] The acquisition module 10 is used to collect operating condition data of the target fluid to be measured under the current measurement conditions; the operating condition data includes: the conductivity value, temperature value, viscosity gradient index of the target fluid to be measured, the amplitude change rate of the output pulse signal of the target fluid to be measured within a preset time window, and the waveform characteristics of the induced electromotive force;
[0062] a modeling module 20 configured to perform multi-dimensional state modeling based on the operating condition data to generate an operating condition state vector and a health state vector; identify system state drift based on the health state vector and generate drift information; the health state vector is a state description vector calculated by comparing the operating condition state vector with a historical health distribution;
[0063] A generating module 30 is configured to receive the operating state vector, the healthy state vector, and the drift information, and generate a pulse control parameter based on a preset parameter mapping function; perform signal synthesis based on the pulse control parameter to generate a first pulse signal;
[0064] A determination module 40 is configured to perform waveform alignment, edge detection, and pulse count comparison on the first pulse signal using a standard pulse waveform, and output a structural deviation score;
[0065] The output control module 50 is used to receive the structural deviation score, update the control parameter vector in the parameter mapping function according to the preset loss function and in combination with the drift information, and obtain an updated parameter mapping function; re-execute the signal synthesis operation based on the updated parameter mapping function to generate a second pulse signal, and output the second pulse signal to the external interface of the electromagnetic flowmeter.
[0066] This application aims to improve the accuracy and stability of the pulse output signal of an electromagnetic flowmeter under various complex operating conditions. The system can sense changes in the state of the measured fluid and the measurement environment in real time. Through intelligent modeling and feedback control mechanisms, it dynamically adjusts the pulse output parameters to adapt to and compensate for the effects of various interference factors, thereby ensuring that the electromagnetic flowmeter outputs high-quality pulse signals.
[0067] Regarding the above-mentioned acquisition module 10:
[0068] The acquisition module 10 in this embodiment is used to acquire multiple operating condition data of the target fluid under specific measurement conditions. First, the acquisition module 10 uses a conductivity sensor installed in the electromagnetic flowmeter's pipe measurement area to detect the target fluid's conductivity in real time. During the specific detection process, the conductivity sensor's two measuring electrodes directly contact the target fluid. Constant current excitation generates a stable induced voltage signal within the target fluid. Based on this induced voltage signal, an accurate conductivity value is calculated. This value is the conductivity value in the operating condition data.
[0069] Secondly, the acquisition module 10 uses the temperature sensor installed on the outer wall of the pipe to measure the temperature value of the target fluid to be measured in real time. During the measurement process, the temperature sensor is tightly attached to the surface of the pipe, and the measuring end of the temperature sensor senses the temperature change of the pipe wall in real time, and then determines the actual temperature value of the target fluid based on the predetermined pipe wall-fluid temperature relationship function to ensure measurement accuracy. Among them, the pipe wall-fluid temperature relationship function can select an empirical interpolation model, a piecewise linear heat conduction model or a heat transfer approximation model constructed based on finite element simulation according to different measurement conditions. The empirical interpolation model can be implemented by presetting the calibration curve of the flow rate and the heat exchange coefficient. The piecewise linear model is suitable for conditions with low flow rate and stable pipe wall thickness. The heat transfer approximation model is suitable for precision measurement scenarios with high temperature sensitivity requirements.
[0070] Subsequently, in order to obtain the viscosity gradient index of the target fluid, the acquisition module 10 installs flow rate sensors at at least two different positions in the axial direction of the pipe section to measure the flow velocity values of the two positions in real time, and transmits the measured multiple flow velocity values to the data processing unit inside the module in real time. The data processing unit calculates the flow velocity difference between multiple positions in real time, and then converts the calculated flow velocity difference into the viscosity gradient index of the target fluid to be measured according to the preset viscosity gradient calculation method. The viscosity gradient calculation method can adopt a flow velocity difference normalization model, a local shear rate model or a modified Reynolds number model. The flow velocity difference normalization model estimates the viscosity difference by normalizing the multi-point flow velocity difference to the velocity gradient within a unit distance; the local shear rate model estimates the degree of shear deformation in the boundary layer based on the change trend of the velocity profile, and is suitable for non-Newtonian fluids; the modified Reynolds number model characterizes the change trend of the fluid viscosity characteristics based on the joint calculation of instantaneous velocity and temperature, and is suitable for dynamic temperature and pressure change scenarios.
[0071] Simultaneously, the acquisition module 10 is connected to the electromagnetic flowmeter's pulse output interface. This interface continuously collects, in real time, a series of amplitude data representing the output pulse signal within a preset time window. The module also records the sampling time corresponding to each collected data point using an internal high-precision clock. Subsequently, the module's data processing unit calculates the amplitude change rate using a least-squares fitting method based on the sampled amplitude data series and corresponding timestamps. This determines the output pulse signal amplitude change rate indicator within the preset time window, which serves as one of the input variables for subsequent state modeling.
[0072] Finally, to obtain the waveform characteristics of the induced electromotive force, the acquisition module 10 is connected to the excitation electrode port of the electromagnetic flowmeter. The internal high-speed analog-to-digital conversion sampling unit collects the induced electromotive force waveform data output by the excitation electrode in real time. After acquisition, the data processing unit within the module performs point-by-point analysis based on the collected waveform data, extracting the frequency, amplitude, and fluctuation range characteristics of the induced electromotive force waveform. These waveform characteristics are explicitly output as part of the operating condition data and further input into the subsequent multidimensional state modeling process.
[0073] It should be noted that the viscosity gradient index reflects the rate of change of fluid viscosity in spatial distribution, and its dimension is inverse per second. , which corresponds to the degree of change in speed per unit distance. In industrial water treatment or mild chemical slurry scenarios, this indicator generally falls between 0.1 and ; For high viscosity oil or resin circulation pipeline, it can be extended to about.
[0074] Depending on the fluid properties, the viscosity gradient index can be obtained through one of the following three models:
[0075] The velocity difference normalization model is applicable to Newtonian fluids or clean water systems with gently changing viscosity, and its output value is proportional to the velocity difference at the measuring point. The local shear rate model is applicable to non-Newtonian fluids (such as polymer solutions) and can more accurately reflect the shear effect caused by the velocity profile in the fluid boundary layer. The modified Reynolds number model is applicable to scenarios with significant dynamic changes in temperature and pressure (such as the reflux pipe of a high-temperature reactor). By integrating the temperature and instantaneous velocity change trends, it can capture subtle fluctuations in viscosity characteristics under complex working conditions.
[0076] In the velocity difference normalization model, the velocity difference can be set as the velocity difference between two points within a unit distance of the pipe diameter, and its calibration coefficient is generally between 0.5 and 1.5; in the local shear rate model, the shear rate range is usually between In the modified Reynolds number model, the characteristic Reynolds number can fluctuate between 500 and 5000, and is converted in combination with a temperature correction coefficient of 0.8 to 1.2.
[0077] In an optional embodiment, the acquisition module 10 further includes a specific acquisition path and processing flow for realizing the viscosity gradient index, the output pulse signal amplitude change rate, and the induced electromotive force waveform characteristics.
[0078] To obtain the viscosity gradient index, the acquisition module 10 installs two or more flow velocity sensors at different axial locations within the measured pipe section. These flow velocity sensors can be electromagnetic, ultrasonic Doppler, or microthermal sensors, and measure the local flow velocity at each location in real time. The module uses a time synchronization mechanism to acquire the measured values from each sensor and calculate their velocity difference. Based on parameters such as the relative distance between the measurement points, their cross-sectional locations, and the pipe's cross-sectional area, the module derives the velocity gradient trend per unit length according to a preset viscosity gradient calculation model. This information is then used to generate a viscosity gradient index, which characterizes the spatial distribution of the fluid's viscosity.
[0079] To extract the amplitude variation characteristics of the output pulse signal, the acquisition module 10 establishes a stable connection with the electromagnetic flowmeter's digital output interface. Using its internal high-speed sampling module, it acquires a sequence of instantaneous amplitude data of the output pulse signal at a fixed sampling interval within a preset time window. By setting the sampling window length (e.g., the duration of multiple excitation cycles), the acquisition module 10 performs a linear trend estimation on the sampled amplitude data sequence, extracting the average slope of the pulse signal over this period. This slope serves as an indicator of the output pulse signal's amplitude variation rate, reflecting the signal's dynamic characteristics and output stability.
[0080] To extract the time-domain and frequency-domain characteristics of the induced electromotive force, the acquisition module 10 can be connected to the output path of the excitation electrode through analog coupling or digital parallel connection. The induced electromotive force is sampled at high frequency using an analog-to-digital conversion unit, and the sampling results are input into the waveform feature extraction module. During the feature extraction process, the system constructs a complete waveform cycle based on the sampling points and calculates statistics such as the main frequency, average amplitude, maximum amplitude, and fluctuation range to characterize signal stability, response amplitude, and disturbance state. This complete induced electromotive force waveform feature vector is then formed and input into the modeling module 20 for subsequent processing.
[0081] For the above modeling module 20:
[0082] As an alternative implementation, see Figure 3 , is a flow chart of a method for generating an operating state vector and a health state vector provided by this application, the method comprising steps S101 to S103, wherein:
[0083] S101: performing numerical normalization processing on the conductivity value, temperature value, viscosity gradient index, output pulse signal amplitude change rate, and induced electromotive force waveform characteristics, and constructing the operating state vector by a vectorized splicing method;
[0084] S102: Based on historical operating condition data, perform data cluster analysis in a preset operating condition space to construct a historical health distribution;
[0085] S103: Calculate the similarity between the operating state vector and the historical health distribution, determine the health deviation degree according to a preset drift threshold, and construct the health state vector based on the health deviation degree.
[0086] The modeling module 20 in this embodiment is used to perform engineering processing on the various operating condition data output by the acquisition module 10 to generate specific and clear operating condition state vectors and health state vectors, and to identify whether the current system operating state has drifted away from the healthy area.
[0087] Specifically, the modeling module 20 first receives five types of real-time numerical operating condition data from the acquisition module 10, including conductivity value, temperature value, viscosity gradient index, output pulse signal amplitude change rate, and characteristic value of the induced electromotive force waveform. These data are transmitted to the standardization processing unit of the modeling module 20 in floating-point format. The standardization processing unit pre-stores the minimum and maximum values of various data accumulated during the historical operation process. During the processing, the standardization processing unit linearly scales each real-time numerical value according to the corresponding historical numerical range to ensure that the converted data falls within a unified range of 0 to 1 to eliminate the influence of different measurement units and numerical ranges. After the above-mentioned standardization operation is completed, the module arranges the five standardized single values in sequence to form a one-dimensional vector to clearly express the current operating status.
[0088] Next, the modeling module 20 accesses a pre-established health state reference database within the storage unit. This database is a collection of typical health states derived from a large number of historical data samples using a preselected clustering analysis algorithm (e.g., K-means clustering or density clustering). Each health state category is stored as a set of standardized numerical vectors representing the characteristic patterns of that category. Using an embedded distance calculation routine, the module performs element-by-element difference calculations between the current operating state vector and the representative vector for each health state category. The square root of the sum of the squares of these differences is then calculated to determine the current state's proximity to each health category.
[0089] The modeling module 20 further compares the calculated distance value with the preset drift threshold. If the distance values between the current operating state and all health categories are greater than the preset threshold, it means that the current operating state may have an abnormal state deviation, and the system state needs to be marked as a drift state; if the distance value between a health category and the current state is less than or equal to the preset threshold, it is considered that the system is still within the normal health range corresponding to the category.
[0090] If the system state is marked as a drift state, the level judgment unit of the modeling module 20 will further calculate the specific gap between the current state and the category closest to the healthy state, and divide the severity of the drift into levels according to the degree to which the gap value exceeds the threshold. The specific level division can be set as "mild drift", "moderate drift" or "severe drift" to intuitively indicate the degree of deviation of the system operation state.
[0091] Finally, the modeling module 20 explicitly outputs at least the following three pieces of information:
[0092] The operating state vector at the current measurement moment (a one-dimensional real number array containing five normalized values);
[0093] Health state vector (the normalized numerical vector corresponding to the health state category closest to the current state);
[0094] Drift information (indicates whether drift exists in the current state and the level of drift severity).
[0095] For the above generation module 30:
[0096] As an alternative implementation, see Figure 4 , is a flow chart of a method for generating pulse control parameters based on a preset parameter mapping function provided by the present application, the method comprising steps S201 to S204, wherein:
[0097] S201: fusing and splicing the working state vector, the health state vector, and the drift information into a main mapping input vector, and separately inputting the viscosity gradient index into a modulation subnetwork, wherein the modulation subnetwork includes at least one neural layer with a nonlinear activation function, and is used to generate a modulation factor vector;
[0098] S202: Inputting the main mapping input vector into a multilayer perceptron main mapping network, wherein the main mapping network includes at least two hidden layers, and each hidden layer includes a plurality of neurons having a nonlinear activation function;
[0099] S203: Introducing a modulation operation in the intermediate hidden layer of the main mapping network, the modulation operation comprising performing element-by-element multiplication or affine transformation on the modulation factor vector and the current hidden layer output to form an intermediate feature expression dynamically modulated by the viscosity gradient;
[0100] S204: Based on the modulated output of the main mapping network, a control parameter vector is generated for characterizing the pulse frequency, duty cycle, and holding time.
[0101] In this embodiment, the generation module 30 is primarily responsible for receiving the operating state vector, health state vector, and drift information output by the modeling module 20 and, based on this input data, calculating the pulse control parameters. The generation module 30 comprises two substructures: a main mapping network and a modulation subnetwork. These two substructures work together to dynamically output key parameters for controlling the electromagnetic flowmeter's pulse output, including frequency, duty cycle, and hold time.
[0102] Exemplarily, the generation module 30 first receives three input contents: the first is an operating condition state vector of length 5, which represents the standardized operating condition information at the current measurement moment; the second is a health state vector, which can be a standard vector representation of the historical health state most similar to the current operating condition; the third is drift information, which mainly includes whether there is drift in the system state and the corresponding drift level label.
[0103] The generation module 30 first concatenates the working state vector and the healthy state vector in the same data channel, producing a fused vector of doubled length. Subsequently, the drift level label is converted to a numerical representation and concatenated with the fused vector to form the input vector for the main mapping network. This input vector is fed into a multilayer perceptron structure consisting of two or more neural layers, each with a preset number of nodes and an activation function of either ReLU or Tanh, determined by configuration options. The main mapping network extracts deep-level combinatorial relationships among state features and outputs a set of intermediate feature representations.
[0104] In parallel with the main mapping network, the modulation sub-network specifically receives a single input variable, the viscosity gradient index, and processes it through several neural layers with nonlinear transformation capabilities, outputting a modulation factor vector. This modulation factor vector will be introduced into the hidden layer calculation process of the main mapping network as a regulation parameter.
[0105] The specific processing method is: after the output of the middle hidden layer of the main mapping network is completed, element-by-element multiplication or affine transformation operation is performed with the modulation factor vector, so that the intermediate features are dynamically adjusted by the viscosity gradient factor before being passed to the next layer, thereby enhancing the model's response ability to changes in the shear properties of the fluid.
[0106] After completing the above feature fusion and modulation, the main mapping network will output a set of floating-point values corresponding to the three output control parameters: control pulse frequency, duty cycle, and hold duration. The generation module 30 encapsulates these three parameters into a control parameter vector and transmits it to the signal synthesis unit for subsequent generation of the first pulse signal.
[0107] For example, the main mapping network in the parameter mapping function may adopt a multi-layer perceptron structure, including an input layer, two hidden layers and an output layer, and each layer is a fully connected structure;
[0108] It is recommended to set 16 to 64 neurons in each hidden layer. The modulation subnetwork is a separate shallow neural network consisting of an input layer (receiving the viscosity gradient indicator), a hidden layer (e.g., 8 neurons), and an output layer (outputting the modulation factor vector). The network is initially trained using historically labeled samples as supervised learning data, with the goal of minimizing the structural deviation score between the historically measured pulse signal and the standard template. The loss function can be defined as a combination of the weighted mean squared error (MSE) and the structural deviation score, where the structural deviation score is introduced as an auxiliary supervision variable. The weight of the drift level guided regularization term can be set in the range of 0.1 to 0.5 and dynamically adjusted according to the training stage.
[0109] The training data set includes no less than 5,000 sets of historical measurement samples. Each set of samples contains: five types of operating condition data (conductivity, temperature, viscosity gradient, amplitude change rate, induced electromotive force characteristics), historical health vectors, labeled pulse control parameters, and the score between the actual output signal and the target template;
[0110] The data should cover different fluid types, flow rate ranges and typical drift situations, such as sensor aging, temperature difference disturbance, etc.
[0111] As an optional implementation, control parameters can be configured with precision limits and range boundaries. For example, the frequency can be adjusted from 1Hz to 500Hz, the duty cycle can be adjusted from 5% to 90%, and the hold time can be limited based on system response time to avoid physical overload or error accumulation.
[0112] Ultimately, the control parameters output by the generation module 30 directly determine the morphological characteristics of the first pulse signal generated by the signal synthesis circuit in the next stage. This first pulse signal is then sent to the judgment module 40 for structural consistency assessment and parameter update based on the feedback deviation, thus achieving closed-loop regulation control.
[0113] Regarding the above-mentioned discrimination module 40:
[0114] The discrimination module 40 in this embodiment is used to perform structural analysis on the first pulse signal output by the generation module 30 and perform multi-dimensional comparison with the standard pulse waveform to output a structural deviation score describing the degree of signal difference, which serves as a key input basis for subsequent parameter adjustment.
[0115] Specifically, the discriminator module 40 first receives the first pulse signal from the generator module 30. This signal is a digital time-series signal stream generated by the signal synthesis unit based on the control parameter vector. The discriminator module 40 caches the complete pulse signal sequence in an internal cache unit and resamples it in segments to ensure that the waveform comparison has a consistent starting point, sampling rate, and cycle boundaries in the time dimension.
[0116] Next, the discrimination module 40 loads a reference waveform template that matches the current operating conditions from a pre-set library of standard pulse templates within the system. Standard templates are selected based on the similarity between the historical health state vector and the current measured operating conditions, ensuring representative parameter matching for the comparison object. The standard templates are a set of verified ideal signal sequences that record key structural parameters of the reference pulse waveform, including typical rise time, fall time, peak amplitude, and duration.
[0117] For example, the discrimination process is divided into three dimensions:
[0118] Edge Time Deviation Detection: The discrimination module 40 first performs edge detection on the first pulse signal and the reference waveform. Using a time differentiator, it locates the rising and falling edges in the signal and extracts the edge timestamp sequence within each pulse cycle. It then calculates the time offset between the actual signal and the reference pulse waveform at each corresponding edge point, and calculates the average time offset to serve as the basis for the edge time deviation score.
[0119] Amplitude Error Statistics: This module aligns the actual pulse waveform with a standard template at a uniform sampling point and calculates the point-by-point amplitude difference to produce a complete amplitude error sequence. By performing mean-variance analysis on this error sequence within a set time window, an amplitude error score is generated to assess the consistency between the signal amplitude and the expected output.
[0120] Pulse Count Comparison: The module counts the number of valid pulses in the actual pulse signal and the standard template within the current time window. A "valid pulse" is defined as a complete cycle signal whose amplitude and duration both exceed the minimum detection threshold. The difference in the number of pulses between the two is calculated as the pulse count difference score, which indicates whether the current signal has lost, excessive, or jitter.
[0121] The scoring items of these three dimensions are fused according to the system's preset weighting coefficients. This fusion process is completed by the structural score calculation unit, which outputs the final structural deviation score. The weighting coefficients can be configured as needed. For example, the amplitude error term can be weighted more heavily for high-precision applications, while the edge time term can be weighted more heavily for response rate-sensitive scenarios.
[0122] The structural deviation score is a single floating point number, with higher values indicating a greater deviation between the actual signal and the ideal standard. The score result is directly transmitted to the output control module 50 for subsequent updating and optimization of the control parameter mapping path.
[0123] Regarding the above-mentioned output control module 50:
[0124] In this embodiment, the output control module 50 receives the structural deviation score output by the discrimination module 40 and, combined with the system drift information provided by the modeling module 20, updates the parameter mapping function in the generation module 30. This module is designed to dynamically adjust the pulse control parameters and perform closed-loop optimization of the signal output path, thereby enhancing the output consistency and adaptability of the electromagnetic flowmeter during long-term operation.
[0125] In specific implementations, the output control module 50 obtains the structural deviation score from the discrimination module 40. This score is a quantitative indicator that assesses the difference between the current pulse signal and the standard template. Simultaneously, it obtains drift level information about the current system state from the modeling module 20, including structured state information such as the presence of drift, drift direction, and severity. The state-aware logic within the output control module 50 dynamically adjusts the control strategy based on changes in the drift level. For example, when severe drift is detected, the update range may be relaxed and the adjustment rate may be increased to quickly respond to changes in the system state.
[0126] After receiving the score and drift information, the output control module 50 constructs a target loss function to guide parameter updates. This loss function consists of two parts: the structural deviation score itself, which directly reflects the overall deviation level of the current pulse signal; and a drift adjustment regularization term related to the drift level, which is used to suppress error accumulation or optimization oscillation caused by long-term system drift. Based on the set adjustment mode and historical status, the output control module 50 comprehensively evaluates these two components to construct an adjustable optimization target function and performs parameter adjustments accordingly.
[0127] The output control module 50 integrates a multi-strategy parameter optimizer for iteratively updating the parameter mapping function within the generation module 30. The optimizer supports a combination of adaptive moment estimation and gradient descent methods, flexibly switching between accuracy- and speed-prioritized scenarios. Upon receiving the target loss function, the optimizer calculates the update step size of the control parameter vector based on the current parameter gradient direction and completes the parameter replacement operation.
[0128] After the update is complete, the output control module 50 sends the new control parameter vector to the generation module 30, instructing it to re-execute the signal synthesis logic to generate a second pulse signal. Compared to the first pulse signal, this signal has been parameter-level-corrected based on the deviation score and system drift, resulting in higher consistency and stability. The second pulse signal is ultimately transmitted by the output control module 50 to the external interface of the electromagnetic flowmeter.
[0129] In this way, the acquisition module 10 continuously outputs five fundamental environmental parameters—conductivity, temperature, viscosity gradient, pulse amplitude change rate, and induced electromotive force waveform—generated during fluid operation, ensuring that subsequent algorithms always have a baseline for synchronization with current operating conditions. If these parameters drift slowly over time (for example, electrode scaling causing a slow decrease in conductivity, slurry thickening causing a gradual increase in viscosity gradient, or temperature cycle drift causing induced waveform amplitude drift), the acquisition module 10 can detect these changes in real time, making it the first entry point for detecting long-term drift.
[0130] The modeling module 20 normalizes the five types of collected data and arranges them into a fixed-length operating state vector. This vector is then compared to the historical health distribution. When the distance exceeds a threshold, a drift level is output; the greater the distance, the higher the level. This way, regardless of whether the drift originates from fluid properties or measurement chain aging, it is quantified into a "drift weight" that directly informs subsequent decision-making, ensuring the system's measurable sensitivity to slow changes.
[0131] Generation module 30 utilizes the latest operating state vector, health state vector, and drift level. Through the combined action of the main mapping network and the viscosity gradient modulation sub-network, these "drift signs" are instantly converted into three parameters: pulse frequency, duty cycle, and hold time. The design of a separate modulation branch for the viscosity gradient ensures that when the fluid thickens or stratified shear occurs, the pulse width or duty cycle is actively lengthened or compressed, thereby counteracting measurement phase errors caused by flow field distortion. The drift level, on the other hand, is incorporated into the main mapping network input, allowing long-term trend changes to directly alter the target parameter output value, achieving "drift-dependent self-correction."
[0132] The discrimination module 40 aligns the newly generated first pulse signal pulse by pulse with a standard template under the same operating conditions, compares the time difference, amplitude difference, and pulse count, and uses these three quantitative scores to create a structural deviation score. This score provides an immediate check on the effectiveness of parameter compensation: if compensation is insufficient, edge time or amplitude deviation will increase; if compensation is excessive, pulse count differences will increase. A higher score indicates a greater residual error, and the system requires more aggressive updates to control parameters.
[0133] The output control module 50 receives the structural deviation score, and then writes the drift level into the target loss as a regularization factor. In this way, in the early stage of slow drift, the score is small and the regularization ratio is high, the parameter adjustment range is limited, and jitter can be avoided; when entering the medium and heavy drift area, the score and level are both high, and the regularization term encourages a larger step update, so that the control parameters can quickly catch up with the accumulated error. The updated parameters immediately drive the generation module 30 to resynthesize and output the second pulse signal, thereby completing a small closed loop of "measurement-judgment-adjustment-remeasurement" during the operation process. The system continuously cycles this closed loop, and during long-term operation, the drift introduced by changes in fluid properties or aging of the sensor chain can be suppressed within the threshold, and the amplitude, timing and count of the pulse output can be kept stable, which solves the core technical problem that the electromagnetic flowmeter is prone to drift in long-term measurement but difficult to correct in real time.
[0134] As an optional implementation manner, generating drift information further includes:
[0135] Multi-resolution wavelet transform is performed on the time series of drift amplitude values to distinguish the low-frequency trend drift component and the high-frequency short-time disturbance component;
[0136] performing online cluster analysis based on the low-frequency trend drift component and the high-frequency short-term disturbance component in a multidimensional feature space consisting of drift level, drift direction, and drift rate to identify typical drift patterns;
[0137] Different compensation strategies are established and implemented for different typical drift modes.
[0138] As an optional implementation, the wavelet basis function used in the wavelet transform may be a Symlets wavelet or a Coiflets wavelet; and performing a multi-resolution wavelet transform on a sequence of drift amplitude values varying with time includes:
[0139] Based on the excitation frequency of the electromagnetic flowmeter and its integer multiple harmonic frequencies, the number of scale decomposition layers of the wavelet transform is determined to decompose the drift amplitude sequence into wavelet subsequences corresponding to the low-frequency trend drift component and the high-frequency short-time disturbance component in the scale space.
[0140] For the wavelet subsequence, threshold suppression and reconstruction of harmonic interference are performed through the following steps:
[0141] Perform spectrum analysis on the wavelet subsequences of each scale and calculate the spectrum distribution of the wavelet subsequence at each scale;
[0142] Identifying and locating harmonic interference frequency positions that are integer multiples of the excitation frequency in the spectrum distribution, and determining the spectrum amplitude corresponding to each harmonic interference frequency point;
[0143] Calculating an adaptive threshold based on the spectrum amplitude corresponding to each harmonic interference frequency point, wherein the adaptive threshold is calculated based on the mean and standard deviation of the spectrum amplitude in the neighborhood of each harmonic interference frequency point;
[0144] Setting the spectrum amplitude exceeding the adaptive threshold at each harmonic interference frequency point to zero or attenuating it proportionally to obtain a spectrum after harmonic interference suppression;
[0145] Wavelet reconstruction is performed based on the spectrum after harmonic interference suppression to obtain low-frequency trend drift components corresponding to long-term trend drift and high-frequency short-term disturbance components corresponding to short-term disturbance.
[0146] Among them, long-term trend drift refers to the slow, gradual change in the drift amplitude sequence that occurs continuously over a long time window, usually manifested as a continuous monotonous increase or decrease in the average amplitude value, a stable fluctuation range but a shift in the center value, etc. In this system, the basis for determining long-term trend drift may include: within the past 30 minutes or longer, multiple resampling segments continuously show a trend of deviation in the same direction, and the average change amplitude of a single segment reaches a set threshold, such as 0.01 unit amplitude / minute or more. In actual operation, this type of drift is often associated with slow-changing conditions such as electrode scaling, changes in fluid composition, and thermal deformation of equipment.
[0147] Short-term disturbances refer to sudden, discontinuous drift fluctuations that occur within a relatively short time window. They are characterized by short duration, high frequency, and significant amplitude jumps in the time domain.
[0148] For example, in engineering implementation, a short-term disturbance event can be identified when a sudden jump in drift amplitude is detected within a single sampling window and lasts less than 5 seconds, or when a sudden energy surge is captured in the high-frequency scale component. Such disturbances typically arise from unstable factors such as bubble inclusions, external interference signals, and the passage of foreign matter in the liquid. They are characterized by high frequency, non-periodicity, and strong randomness.
[0149] When performing wavelet decomposition and feature extraction, it is possible to automatically determine whether the data segment belongs to long-term trend drift or short-term disturbance based on the signal energy distribution and change trend at different scales, and map them into different drift components respectively, thereby achieving accurate classification response for subsequent clustering and compensation strategies.
[0150] The long-term drift rate is used to quantitatively describe the average change trend of the drift amplitude within a long time window and is one of the indicators for judging whether the system state is in a slow drift state.
[0151] For example, the system samples the drift amplitude at regular intervals (e.g., 5 minutes) and records multiple consecutive sampling points within a sliding time window. The long-term drift rate can be calculated by comparing the drift amplitude difference between the current time point and the window start point, and then combining this with the average rate of change over that time span. This rate can indicate whether the drift is slowly accumulating or approaching saturation or stability.
[0152] In practical engineering applications, the long-term drift rate can be expressed in units of magnitude per minute or percentage magnitude per hour. For example, an electromagnetic flowmeter with an average structural deviation score increase of more than 0.1 per hour is considered a medium-level long-term drift rate. The system can set multiple drift rate thresholds, which are used to determine whether to trigger the progressive drift mode classification based on the accumulated drift.
[0153] In this embodiment, after obtaining the health state vector, a drift pattern recognition submodule is also included, which is used to extract two types of signal components, namely long-term trends and short-term disturbances, from the drift amplitude time series output by the modeling module 20, and identify the drift pattern in real time based on the characteristics of the two, so as to adopt different compensation strategies subsequently.
[0154] The drift pattern recognition submodule first passes the continuous time-varying sequence of drift amplitudes to a multi-resolution wavelet transform unit. This unit uses either Symlets or Coiflets wavelets and determines the number of decomposition levels based on the known characteristics of the electromagnetic flowmeter's excitation frequency and its harmonics. After wavelet transformation, the low-frequency subsequence is reconstructed into a low-frequency trend drift component, which reflects slowly varying offsets caused by sensor aging, electrode scaling, or slow flow field changes. The high-frequency subsequence is reconstructed into a high-frequency short-term disturbance component, which captures transient anomalies such as bubble inclusions, transient turbulence, or electromagnetic interference.
[0155] The drift pattern recognition submodule then extracts three-dimensional drift features for both the trend drift component and the short-term disturbance component, including drift level (given by the modeling module 20), drift direction (determined by the increasing or decreasing trend of the amplitude sequence), and drift rate (determined by the rate of amplitude change). Each subsequence is mapped into a three-dimensional feature vector. The online clustering unit applies a density peak-based clustering algorithm to these feature vectors, classifying the current component into predefined typical drift patterns in real time. Typical drift patterns include at least a "gradual drift pattern" dominated by a slow-changing trend, a "high-frequency disturbance pattern" dominated by a high-frequency mutation, and a "sudden drift pattern" dominated by sudden anomalies.
[0156] After identifying a specific drift pattern, the compensation strategy execution unit invokes the corresponding compensation logic based on the specific pattern. If the current mode is a gradual drift mode, a continuous and stable parameter adjustment strategy is adopted, increasing or decreasing the control parameters output by the generation module 30 in small steps within each update cycle to smoothly track slowly varying offsets. If the current mode is a high-frequency perturbation mode, the alarm prompt module is triggered, and the pulse frequency or duty cycle is briefly adjusted during subsequent pulse generation to filter out transient interference. If a sudden drift mode is detected, a rapid response strategy is implemented, quickly restoring the alignment of the pulse with the standard template through one or more parameter refreshes, and recording the event in the system log for subsequent maintenance.
[0157] The above method combines wavelet decomposition with online clustering to play a dual role in resolution. On the one hand, it distinguishes the drift components of different frequency bands. On the other hand, it accurately identifies the drift category in the multi-dimensional feature space and implements targeted compensation or alarms, thereby significantly improving the electromagnetic flowmeter's adaptive correction capability for slow-changing drift and short-term disturbances during long-term operation.
[0158] For example, an electromagnetic flowmeter operated continuously for three months on an actual industrial cooling water circulation pipeline. The system enabled the drift pattern recognition submodule and recorded the entire adjustment process. The following is an example of a typical scenario:
[0159] Before the start of the morning shift, the output of the electromagnetic flowmeter remained stable. About four hours after entering the peak production period, slight scaling appeared on the electrode surface, causing the drift amplitude value given by the modeling module 20 to slowly increase in the positive direction. The drift pattern recognition submodule collects the drift amplitude sequence at intervals of 5 minutes and calls the wavelet transform every 30 minutes. The transformation results show that there is a continuously rising low-frequency component in the lowest two levels of scale, while the high-frequency subsequence fluctuates very little. The online clustering unit automatically classifies the current three-dimensional feature vector as a "progressive drift mode". Based on this, the compensation strategy execution unit reduces the pulse frequency by 1 Hz each time and increases the duty cycle by 0.5% simultaneously. After four iterations, the structural deviation score fed back by the discrimination module 40 returns to the normal range.
[0160] See Figure 2, is a schematic diagram of bubbles in a fluid provided by the present application. The figure is a section of a local fluid channel cut along the axial direction of the pipeline. The pipeline cross section contains a number of irregular bubbles of various shapes, which are distributed in the main body of the fluid. The arrow indicates the direction of fluid flow. When the afternoon shift was switched, a small amount of air was mixed into the production tank, and irregular bubbles appeared in the fluid. Within a few minutes, the drift amplitude sequence produced dense spikes, and the wavelet transform obtained a high-frequency component with a significantly amplified amplitude at the highest two scales. Based on this, the online clustering unit classified the feature vector as a "high-frequency disturbance mode". The system immediately triggered a local sound and light prompt and wrote the alarm information into the maintenance log. At the same time, in the next three rounds of pulse generation, the duty cycle upper limit was temporarily increased and the maintenance time was shortened, so that the waveform peak was insensitive to the transient attenuation caused by the bubbles. Ten minutes later, the bubbles dissipated, and the structural deviation score feedback by the judgment module 40 was restored.
[0161] During the evening shift, the power suddenly lost in the workshop and then quickly recovered. The electromagnetic flowmeter excitation link was briefly abnormal, and the overall output signal shifted significantly. At this time, the drift amplitude sequence suddenly jumped several times in a short period of time, and the wavelet decomposition also detected a single pulse-like large disturbance in the high-frequency channel. The clustering unit marked it as "burst drift mode." The compensation strategy execution unit immediately performed a full-scale parameter refresh: the pulse frequency was restored to the daily baseline, the duty cycle and maintenance duration were synchronized back to the default median, and a maintenance event report was sent to the host computer. In less than two minutes, the structural deviation score was brought back to the normal range.
[0162] From the above specific scenarios, we can see that wavelet decomposition first distinguishes slow-changing trends from transient disturbances, and online clustering then classifies different offset behaviors into corresponding modes. The compensation strategy immediately takes measures such as small-step stabilization, rapid alarm, or one-time forced correction according to the mode differences, thereby maintaining the time consistency and amplitude stability of the pulse output for a long time during continuous operation.
[0163] As an optional implementation, the drift pattern recognition submodule may use discrete Meyer Wavelet (dmey) instead of Symlets or Coiflets to further improve the separation accuracy of excitation harmonics and transient interference and reduce reconstruction artifacts.
[0164] In this implementation, the multi-resolution wavelet transform unit first configures the wavelet basis type to DMey and predetermines the corresponding decomposition level number based on calibration data for the electromagnetic flowmeter's excitation frequency and its integer multiple harmonics. After the drift amplitude time series is input, the module calls an open-source or embedded DMey decomposition routine to decompose the time series into wavelet subsequences at multiple scales.
[0165] For each subsequence marked as an excitation harmonic component, the module performs a rapid spectral analysis: Within the subsequence's spectral distribution, a threshold is set: the average amplitude value within a neighborhood window plus two standard deviations. Frequency components near the harmonic center with amplitudes exceeding this threshold are directly set to zero. Components slightly above the threshold but below two standard deviations are attenuated point by point at a preset ratio of 0.6 to 0.8. After completing harmonic suppression, the system sequentially applies an inverse wavelet transform to all scaled subsequences, reconstructing the harmonic-free low-frequency trend drift component and the high-frequency short-term disturbance component.
[0166] Compared with other wavelet bases, discrete Meyer wavelet has a smoother frequency domain response and better symmetry. It can avoid energy leakage between decomposition layers while maintaining smooth boundaries, thereby obtaining cleaner trend and disturbance signals in the subsequent three-dimensional or four-dimensional drift feature extraction stage.
[0167] After completing dmey reconstruction, the drift pattern recognition submodule extracts features such as drift level, drift direction, and drift rate according to the previously described process. These features are then fed into an online clustering unit based on density peaks to identify typical categories such as "gradual drift mode," "high-frequency perturbation mode," and "sudden drift mode." The compensation strategy execution unit then invokes adjustment logic such as small-step smoothing updates, rapid alarms, or a one-time full-scale reset based on the different modes.
[0168] In this way, by introducing discrete Meyer wavelets, the interference of excitation harmonics and signal boundary effects on drift identification can be significantly reduced, and the system's accuracy and robustness in distinguishing slow-changing trends and transient disturbances can be improved, thereby more reliably maintaining the timing consistency and amplitude stability of the electromagnetic flowmeter pulse output signal during long-term operation.
[0169] As an optional implementation manner, the identifying a typical drift pattern includes:
[0170] Calculating a long-term drift rate and a drift accumulation based on the low-frequency trend drift component, and determining a long-term trend drift characteristic vector;
[0171] Calculating the spectrum energy distribution and instantaneous drift rate of the short-term disturbance based on the high-frequency short-term disturbance component, and determining the short-term disturbance characteristic vector;
[0172] Performing vector fusion on the long-term trend drift feature vector and the short-term disturbance feature vector in a four-dimensional feature space consisting of drift level, drift direction, drift rate and spectrum energy to form a comprehensive drift feature vector;
[0173] Inputting the comprehensive drift feature vector into a preset clustering model to generate a clustering result; the clustering model is a clustering algorithm based on density peak;
[0174] Based on the clustering results, typical drift modes are determined and marked. The typical drift modes include: a gradual drift mode caused by sensor fouling, a high-frequency disturbance mode caused by bubble inclusion, and a sudden drift mode caused by sensor transient failure.
[0175] In the specific implementation, after completing the basic wavelet decomposition, the drift pattern recognition submodule further combines the excitation parameters of the electromagnetic flowmeter to perform targeted processing on each decomposition layer. Specifically, when the excitation frequency is the reference When the system is based on experience or calibration The wavelet decomposition scales corresponding to the equal harmonics are numbered, and after each multi-resolution wavelet transform, the subsequences of the corresponding scales are automatically marked with harmonic labels. The module then performs fast spectral analysis on each subsequence identified by the label. For example, in the spectral distribution of the subsequence, the average value of the amplitude in the neighborhood window plus two times the standard deviation is used as the adaptive threshold. For components located at the harmonic frequency point and whose amplitude exceeds the threshold, the module directly sets the corresponding spectrum amplitude to zero; for components slightly higher than the threshold but not reaching two times the standard deviation, they are attenuated point by point according to a pre-set ratio between 0.6 and 0.8. After all labels are processed, the system calls the inverse wavelet transform to reconstruct the low-frequency trend drift component and high-frequency short-time disturbance component that have been de-harmonicized to ensure that the two types of components do not contain excitation harmonic artifacts.
[0176] Exemplarily, after the low-frequency trend drift component and the high-frequency short-term disturbance component are reconstructed and features are extracted, the online clustering unit will continue to process the four-dimensional drift feature vector. In this embodiment, the trend drift rate can be taken from the average amplitude difference every five minutes in the past half hour, and the drift accumulation is obtained by accumulating all amplitude increments in the memory for the last four hours; the high-frequency disturbance energy is defined as the ratio of the sum of the energy of the sampling points exceeding 1 kHz in the short-term disturbance component to the sum of the energy of the entire frequency band; the instantaneous drift rate directly uses the latest amplitude jump value. These four indicators are normalized to the range of 0 to 1 to form a four-dimensional vector, and are input into the density peak-based clustering algorithm instance in real time. This algorithm clusters similar vectors into a cluster online by setting the parameters of the local density radius to 0.15 and the density threshold to 5.
[0177] Once the clustering results are generated, the system automatically determines the typical drift mode to which the current cluster belongs: when the trend drift rate is continuously greater than 0.02 and the cumulative amount exceeds 0.5, the cluster is labeled "gradual drift mode"; when the high-frequency energy ratio fluctuates by more than 0.3 in a short period of time and the instantaneous drift rate exceeds 0.05, it is determined to be a "high-frequency disturbance mode"; when the amplitude jump at a single moment exceeds twice the historical maximum amplitude and is accompanied by a sudden drop in energy, it is classified as a "sudden drift mode." Depending on the mode, the compensation strategy execution unit calls the corresponding logic: for the "gradual drift mode," small step-size parameter smoothing adjustment is adopted; for the "high-frequency disturbance mode," a local rapid alarm is triggered and the filtering level is temporarily increased; for the "sudden drift mode," a full-scale parameter reset is immediately performed and the event is recorded to ensure that the system output quickly returns to the normal range.
[0178] As an optional implementation, the output structure deviation score includes:
[0179] Performing edge detection on the first pulse signal and the standard pulse waveform, extracting the timestamp sequences of the rising edge and the falling edge respectively, calculating the time offset of the corresponding edges, and obtaining an edge time deviation score;
[0180] performing point-by-point difference calculation on the amplitudes of the first pulse signal and the standard pulse waveform at corresponding sampling moments to obtain an amplitude error sequence, and determining an amplitude error score based on a root mean square value of the amplitude error sequence;
[0181] Within a preset time window, counting the number of valid pulses in the first pulse signal and the standard pulse waveform respectively, calculating the pulse count difference between the two, and obtaining a pulse count difference score;
[0182] The edge time deviation score, the amplitude error score and the pulse count difference score are weighted and fused according to a preset weighting coefficient to output the structural deviation score.
[0183] As a more detailed optional implementation, after obtaining the standard pulse template and the actual pulse signal, the discrimination module 40 may further perform refined processing according to the following steps:
[0184] The discrimination module 40 stores the most recent 100 ms of pulse waveform data in a buffer at a fixed sampling rate (e.g., 10 kHz) and maintains two index arrays of equal length: the previous sample value and the current sample value. When the previous sample value is "0" and the current sample value is "1," a rising edge is determined to have occurred. The corresponding buffer index is multiplied by the sampling interval (0.1 ms) and stored in the rising edge timestamp queue. Similarly, when the previous sample value is "1" and the current sample value is "0," the time corresponding to the index is added to the falling edge timestamp queue. After capturing a rising edge and a falling edge with the same number of template pulses within a complete cycle, the module sequentially subtracts each rising edge timestamp from the rising edge time points with the same number in the template, takes the absolute value, accumulates it, and divides it by the number of pulses to obtain the average edge time deviation. Falling edges are processed in the same manner, and the larger of the two average deviations is used as the edge time deviation score.
[0185] The amplitude error score is obtained by performing the following operations on each sampling point in the same buffer: when the module starts, it reads the expected amplitude array of each sampling point from the template. At runtime, it subtracts the corresponding expected amplitude from the actual sampling amplitude to obtain the error sequence. Each value in the error sequence is squared and summed, and then divided by the total number of sampling points. Finally, the square root of the average square value is taken to obtain the amplitude root mean square error, which is directly used as the amplitude error score.
[0186] The pulse count difference score counts valid pulses within the same 100 ms window by analyzing the rising edge timestamp queue. A "valid pulse" requires that its peak amplitude exceeds 50% of the template peak value and the difference (pulse width) between the falling edge timestamp and the corresponding rising edge timestamp is at least 80% of the template pulse width. The module iterates through all rising edge records, counting pulses that meet these two conditions. The actual count is then subtracted from the template pulse count within the same time window to determine the pulse count difference score.
[0187] After completing the three scores, the module reads the weight table in the system parameter storage area (default values are 0.4 for edge time deviation, 0.4 for amplitude error, and 0.2 for pulse count difference). The module multiplies the three scores by their respective weights, sums the results, and normalizes the result by dividing it by the total weight to output the final structural deviation score. The weights and thresholds (such as 50% for peak value, 80% for pulse width, and 100 ms for window length) are stored in a configuration table that can be dynamically adjusted through the maintenance interface, allowing online optimization based on different operating conditions and accuracy requirements.
[0188] As an optional implementation manner, generating the second pulse signal includes:
[0189] constructing a target loss function based on the structural deviation score, wherein the target loss function includes a structural deviation score term and a drift adjustment regularization term related to the drift level;
[0190] Determining an adjustment factor in a target loss function according to the drift level information, wherein the adjustment factor is used to dynamically adjust an update amplitude of the target loss function;
[0191] Iteratively updating the control parameter vector in the parameter mapping function using an optimization algorithm based on a first-order gradient, wherein the optimization algorithm includes: an adaptive moment estimation algorithm and a stochastic gradient descent algorithm;
[0192] The updated control parameter vector replaces the corresponding parameter in the parameter mapping function, and the signal synthesis operation is re-executed to generate the second pulse signal.
[0193] In this embodiment, after receiving the structural deviation score from the discrimination module 40, the output control module 50 first transmits this score to the target loss construction unit. This score represents the overall structural deviation between the current first pulse signal and the standard template in floating-point format. Simultaneously, the output control module 50 obtains the system's current drift level identifier from the modeling module 20. This identifier is a discrete level label, corresponding to a normalized adjustment factor in the internal configuration table. This adjustment factor increases nonlinearly with increasing level and is used to control the allowable step size during parameter updates.
[0194] The output control module 50 inputs the structural deviation score as the basic error term and the adjustment factor as the modulation factor into the target loss construction unit.
[0195] Exemplarily, this construction process is accomplished through a loss-weighted module: The module has two input channels: a "structural error channel" and a "drift adjustment channel," each of which is weighted by a configurable weight to produce a total loss value. In the specific implementation, this total loss value is stored in a floating-point register and used as the target for subsequent optimization.
[0196] The optimization process is called through the embedded optimizer. The optimizer consists of two sub-paths: the adaptive moment estimation path and the basic stochastic gradient path. By default, the system gives priority to the adaptive moment estimation path. This path maintains two state caches to record the first-order gradient average and fluctuation amplitude of the control parameters in the past several rounds, which are used to generate update directions and strides with jitter buffer effects. When it is detected that the total loss value decreases too slowly for several consecutive cycles, or the gradient change direction swings violently, the system automatically switches to the stochastic gradient path, ignores historical trends, and only uses the reverse of the current loss value gradient as the update direction, and selects a larger but bounded random perturbation step size to avoid falling into the local minimum.
[0197] After optimization is complete, the output control module 50 reads the updated control parameter vector from the optimizer. This vector's structure completely corresponds to the weight structure in the original mapping network. The output control module 50 writes this vector directly into the control parameter register of the generation module 30, overwriting the original parameter values through the data channel, completing the real-time replacement of the parameter mapping function.
[0198] After the parameter update takes effect, the output control module 50 immediately issues a signal resynthesis instruction. In response to this instruction, the generation module 30 re-executes the forward calculation process, using the updated control parameters to generate a new pulse signal sequence, namely the second pulse signal. The output format of this signal is consistent with the first pulse signal, including a fixed-length sampling sequence and a timestamped edge marker. The system then sends this signal to the output port of the electromagnetic flowmeter and simultaneously stores the current structural deviation score and control parameter change record in the system log for subsequent analysis or anomaly backtracking.
[0199] For example, an industrial slurry circulation system within a pipeline has been operating smoothly since it was put into operation early this morning. Around 10:00 AM, the modeling module 20 and the discriminant module 40 reported that the structural deviation score had increased from the normal range of 0.05 to 0.25, and detected that the drift level had switched from "slight drift" to "moderate drift." The output control module 50 immediately initiated the target loss construction process, feeding the deviation score of 0.25 and the adjustment factor corresponding to the medium drift level (e.g., 1.5) into the loss weighting unit, ultimately generating a total loss value after amplifying the medium deviation.
[0200] The optimizer first used the adaptive moment estimation algorithm. After three consecutive iterations, the total loss dropped to 0.12. The pulse frequency parameter was reduced by 2 Hz, and the duty cycle was increased by 1%. During the fourth iteration, the system noticed a slowdown in the loss reduction and a slight fluctuation in the gradient direction. It then automatically switched to the stochastic gradient descent branch and made a strong parameter adjustment using a slightly larger step size: the frequency was further reduced by 5 Hz, the duty cycle was increased by 2%, and the hold time parameter was updated to increase the signal stability margin.
[0201] After the parameter update is completed, the output control module 50 immediately calls the generation module 30 to resynthesize the second pulse signal and sends it to the instrument output port.
[0202] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
Claims
1. A pulse output sensor control system for an electromagnetic flowmeter, characterized in that: include: An acquisition module is used to acquire the working condition data of the target fluid to be measured under the current measurement conditions; The operating condition data includes: the conductivity value, temperature value, viscosity gradient index of the target fluid to be measured, the output pulse signal amplitude change rate of the target fluid to be measured within a preset time window, and the induced electromotive force waveform characteristics; a modeling module configured to perform multi-dimensional state modeling based on the operating condition data to generate an operating condition state vector and a health state vector; identify system state drift based on the health state vector and generate drift information; the health state vector is a state description vector calculated by comparing the operating condition state vector with a historical health distribution; a generating module, configured to receive the operating state vector, the healthy state vector, and the drift information, and generate a pulse control parameter based on a preset parameter mapping function; and perform signal synthesis based on the pulse control parameter to generate a first pulse signal; a discrimination module, configured to perform waveform alignment, edge detection, and pulse count comparison on the first pulse signal using a standard pulse waveform, and output a structural deviation score; An output control module is used to receive the structural deviation score, update the control parameter vector in the parameter mapping function according to a preset loss function and in combination with the drift information, and obtain an updated parameter mapping function; re-execute the signal synthesis operation based on the updated parameter mapping function to generate a second pulse signal, and output the second pulse signal to the external interface of the electromagnetic flowmeter.
2. The pulse output sensor control system for an electromagnetic flowmeter according to claim 1, characterized in that: The collecting of the working condition data of the target fluid to be measured under the current measuring working condition includes: Measuring a flow velocity difference by at least two flow velocity sensors installed at different positions of the measuring pipe section, and determining a viscosity gradient index of the target fluid to be measured based on the flow velocity difference according to a preset viscosity gradient calculation method; The amplitude of the output pulse signal is sampled in real time within a preset time window, and the slope of the amplitude change within the preset time window is calculated to determine the amplitude change rate of the output pulse signal; The induced electromotive force waveform is collected by sampling units installed at both ends of the electromagnetic flowmeter excitation electrodes, and the waveform frequency, amplitude and fluctuation range are calculated to determine the waveform characteristics of the induced electromotive force.
3. The pulse output sensor control system for an electromagnetic flowmeter according to claim 1, characterized in that: Generating the operating state vector and the health state vector includes: The conductivity value, temperature value, viscosity gradient index, output pulse signal amplitude change rate and induced electromotive force waveform characteristics are respectively numerically normalized, and the operating state vector is constructed by a vectorized splicing method; Based on historical operating condition data, data cluster analysis is performed within the preset operating condition space to construct historical health distribution; The similarity between the operating state vector and the historical health distribution is calculated, the health deviation degree is determined according to a preset drift threshold, and the health state vector is constructed based on the health deviation degree.
4. The pulse output sensor control system for an electromagnetic flowmeter according to claim 1, characterized in that: The generating of pulse control parameters based on the preset parameter mapping function mapping includes: The working state vector, the health state vector and the drift information are fused and spliced into a main mapping input vector, and the viscosity gradient index is separately input into a modulation subnetwork, wherein the modulation subnetwork includes at least one neural layer with a nonlinear activation function, and is used to generate a modulation factor vector; Inputting the main mapping input vector into a multilayer perceptron main mapping network, wherein the main mapping network includes at least two hidden layers, each hidden layer includes a plurality of neurons with a nonlinear activation function; Introducing a modulation operation in an intermediate hidden layer of the main mapping network, the modulation operation comprising performing element-wise multiplication or affine transformation on the modulation factor vector and the current hidden layer output to form an intermediate feature expression dynamically modulated by the viscosity gradient; Based on the modulated output of the main mapping network, a control parameter vector is generated to characterize the pulse frequency, duty cycle and holding time.
5. The pulse output sensor control system for an electromagnetic flowmeter according to claim 3, characterized in that: The identifying system state drift based on the health state vector and generating drift information includes: Calculating a distance value between the current operating condition and the historical health distribution based on the health state vector; Comparing the distance value with a preset drift threshold interval, and determining that the system state has drifted when the distance value exceeds the drift threshold interval; According to the extent to which the distance value exceeds the drift threshold interval, drift level information for characterizing the severity of the state drift is quantified and generated.
6. The pulse output sensor control system for an electromagnetic flowmeter according to claim 5, characterized in that: Generating drift information further includes: Multi-resolution wavelet transform is performed on the time series of drift amplitude values to distinguish the low-frequency trend drift component and the high-frequency short-time disturbance component; performing online cluster analysis based on the low-frequency trend drift component and the high-frequency short-term disturbance component in a multidimensional feature space consisting of drift level, drift direction, and drift rate to identify typical drift patterns; Different compensation strategies are established and implemented for different typical drift modes.
7. The pulse output sensor control system for an electromagnetic flowmeter according to claim 6, characterized in that: The wavelet basis function used in the wavelet transform is Symlets wavelet or Coiflets wavelet; performing multi-resolution wavelet transform on the time-varying sequence of drift amplitude values includes: Based on the excitation frequency of the electromagnetic flowmeter and its integer multiple harmonic frequencies, the number of scale decomposition layers of the wavelet transform is determined to decompose the drift amplitude sequence into wavelet subsequences corresponding to the low-frequency trend drift component and the high-frequency short-time disturbance component in the scale space. For the wavelet subsequence, threshold suppression and reconstruction of harmonic interference are performed, the steps comprising: Perform spectrum analysis on the wavelet subsequences of each scale and calculate the spectrum distribution of the wavelet subsequence at each scale; Identifying and locating harmonic interference frequency positions that are integer multiples of the excitation frequency in the spectrum distribution, and determining the spectrum amplitude corresponding to each harmonic interference frequency point; Calculating an adaptive threshold based on the spectrum amplitude corresponding to each harmonic interference frequency point, wherein the adaptive threshold is calculated based on the mean and standard deviation of the spectrum amplitude in the neighborhood of each harmonic interference frequency point; Setting the spectrum amplitude exceeding the adaptive threshold at each harmonic interference frequency point to zero or attenuating it proportionally to obtain a spectrum after harmonic interference suppression; Wavelet reconstruction is performed based on the spectrum after harmonic interference suppression to obtain low-frequency trend drift components corresponding to long-term trend drift and high-frequency short-term disturbance components corresponding to short-term disturbance.
8. The pulse output sensor control system for an electromagnetic flowmeter according to claim 7, characterized in that: The identification of typical drift patterns includes: Calculating a long-term drift rate and a drift accumulation based on the low-frequency trend drift component, and determining a long-term trend drift characteristic vector; Calculating the spectrum energy distribution and instantaneous drift rate of the short-term disturbance based on the high-frequency short-term disturbance component, and determining the short-term disturbance characteristic vector; Performing vector fusion on the long-term trend drift feature vector and the short-term disturbance feature vector in a four-dimensional feature space consisting of drift level, drift direction, drift rate and spectrum energy to form a comprehensive drift feature vector; Inputting the comprehensive drift feature vector into a preset clustering model to generate a clustering result; the clustering model is a clustering algorithm based on density peak; Based on the clustering results, typical drift modes are determined and marked, where the typical drift modes include: a gradual drift mode caused by sensor fouling, a high-frequency disturbance mode caused by bubble inclusion, and a sudden drift mode caused by sensor transient failure.
9. The pulse output sensor control system for an electromagnetic flowmeter according to claim 8, characterized in that: The output structural deviation score includes: Performing edge detection on the first pulse signal and the standard pulse waveform, extracting the timestamp sequences of the rising edge and the falling edge respectively, calculating the time offset of the corresponding edges, and obtaining an edge time deviation score; performing point-by-point difference calculation on the amplitudes of the first pulse signal and the standard pulse waveform at corresponding sampling moments to obtain an amplitude error sequence, and determining an amplitude error score based on a root mean square value of the amplitude error sequence; Within a preset time window, counting the number of valid pulses in the first pulse signal and the standard pulse waveform respectively, calculating the pulse count difference between the two, and obtaining a pulse count difference score; The edge time deviation score, the amplitude error score and the pulse count difference score are weighted and fused according to a preset weighting coefficient to output the structural deviation score.
10. The pulse output sensor control system for an electromagnetic flowmeter according to claim 9, characterized in that: Generating the second pulse signal comprises: constructing a target loss function based on the structural deviation score, wherein the target loss function includes a structural deviation score term and a drift adjustment regularization term related to the drift level; Determining an adjustment factor in a target loss function according to the drift level information, wherein the adjustment factor is used to dynamically adjust an update amplitude of the target loss function; Iteratively updating the control parameter vector in the parameter mapping function using an optimization algorithm based on a first-order gradient, wherein the optimization algorithm includes: an adaptive moment estimation algorithm and a stochastic gradient descent algorithm; The updated control parameter vector replaces the corresponding parameter in the parameter mapping function, and the signal synthesis operation is re-executed to generate the second pulse signal.
Citation Information
Patent Citations
Electromagnetic flowmeter and self-diagnosing method of exciting circuit unit thereof
CN103376136A
Water turbine runner real-time state evaluation method and application thereof
CN113027658A