Electromagnetic flowmeter zero point correction method based on pressure compensation
Through the electromagnetic flowmeter zero-point correction method based on pressure compensation, the multi-parameter data acquisition and LSTM model are used for real-time correction, and combined with the deep Q network optimization calibration strategy, the problems of insufficient zero-point drift correction accuracy and insufficient adaptability in the existing technology are solved, and high-precision and intelligent flow measurement are achieved.
Patent Information
- Application Number
- CN202510234458.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-28
- Publication Date
- 2025-06-13
AI Technical Summary
The existing electromagnetic flowmeters have insufficient zero-point drift correction accuracy under complex operating conditions and cannot adapt to the comprehensive influence of multiple factors in real time. Traditional calibration strategies lack adaptability and dynamic adjustment capabilities.
The electromagnetic flowmeter zero-point correction method based on pressure compensation is adopted. Through multi-parameter data acquisition and preprocessing, an LSTM compensation model is constructed and an attention mechanism is introduced to correct zero-point drift in real time, and combined with the deep Q network optimization calibration strategy.
Real-time and accurate correction of the zero-point drift of the electromagnetic flowmeter is achieved, adapting to changes in complex working conditions, improving measurement accuracy and system intelligence level, and reducing calibration costs.
Smart Images

Figure CN120141622A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of industrial flow measurement, and specifically to a zero-point correction method for electromagnetic flowmeters based on pressure compensation. Background Technique
[0002] As a widely used flow measurement device, electromagnetic flowmeters play an important role in the industrial field due to their high precision, no flow obstruction components, and good repeatability. However, during the actual use of electromagnetic flowmeters, due to the influence of various factors, such as changes in the physical properties of fluids, fluctuations in ambient temperature, pipeline vibrations, and electromagnetic interference, zero-point drift often occurs. This drift will lead to deviations in measurement results, thereby affecting the precise control of the production process and the accuracy of metering. Traditional methods mainly rely on regular manual calibration and simple compensation strategies, but these methods are not only time-consuming and laborious but also difficult to adapt to complex working condition changes and cannot effectively correct zero-point drift in real time.
[0003] In addition, with the development of industrial automation and intelligence, higher requirements are put forward for the accuracy and reliability of flow measurement. Most of the existing zero-point correction technologies for electromagnetic flowmeters can only compensate for a single factor and ignore the complex influence under the combined action of multiple factors. For example, the problem of zero-point drift cannot be comprehensively solved only by methods such as temperature compensation or pressure compensation. At the same time, traditional calibration strategies lack self-adaptability and dynamic adjustment capabilities and cannot optimize the calibration period and conditions in a timely manner according to changes in actual working conditions. Therefore, developing a zero-point correction method for electromagnetic flowmeters that can correct zero-point drift in real time and accurately and can adapt to a variety of complex working conditions has become an urgent technical problem to be solved.
[0004] To solve the above defects, a technical solution is provided now. Summary of the Invention
[0005] The purpose of the present invention is to solve the problems of insufficient accuracy in correcting zero-point drift of existing electromagnetic flowmeters, inability to adapt to complex working conditions in real time, and lack of self-adaptability of traditional calibration strategies, and to propose a zero-point correction method for electromagnetic flowmeters based on pressure compensation.
[0006] The purpose of the present invention can be achieved through the following technical solutions: A zero-point correction method for electromagnetic flowmeters based on pressure compensation includes the following steps: S1. Multi-parameter data acquisition and preprocessing: Install a variety of sensors in the electromagnetic flowmeter pipeline to collect pressure, temperature, and viscosity data. After AD conversion, use Kalman filtering to denoise, then process and correct abnormal data through the Isolation Forest algorithm, and finally perform timestamp synchronization; S2. Construction and Training of Multi-parameter Compensation Model: Zero-drift data in a no-flow state is collected by simulating different working conditions in the laboratory. An LSTM is used to construct a compensation model with an attention mechanism added. After training, it is deployed to an embedded microcontroller through the TensorFlow lightweight framework; S3. Real-time Zero-point Correction and Compensation: The embedded system reads the preprocessed data in real time and inputs it into the model to obtain the zero-drift compensation value, corrects the flow value, comprehensively considers various influencing factors for compensation, and introduces an adaptive weight adjustment mechanism, and finally outputs the final flow value; S4. When the set calibration period is reached or the environmental temperature suddenly changes, calibration is triggered. The dynamic calibration strategy is combined with the deep Q-network to optimize the calibration strategy, calculate the model error and update the parameters, and manage the model version and rollback.
[0007] Further, the specific process of S1: Sensor Installation and Configuration: High-precision pressure sensors are respectively installed on the inlet and outlet pipes of the electromagnetic flowmeter to measure the differential pressure ΔP at both ends in real time; A PT100 temperature sensor is installed outside the pipe to monitor the fluid temperature T in real time; The fluid viscosity μ is indirectly obtained through the built-in conductivity detection module of the electromagnetic flowmeter or an external online viscometer; Data Synchronization and Preprocessing: The analog signals of the pressure, temperature, and viscosity sensors are converted into digital signals through the AD conversion module; The Kalman filtering algorithm is used to denoise the data to eliminate the influence of environmental electromagnetic interference and instantaneous fluctuations; and the initial screening mechanism is used to process abnormal data; The multi-source data is timestamp-synchronized through the real-time clock of the embedded system to ensure data alignment.
[0008] Further, the process of the initial screening mechanism in S1 is as follows: Historical data is collected to construct a dataset containing pressure ΔP, temperature T, and viscosity; the data is normalized to ensure that each parameter is in the same dimension; The Isolation Forest algorithm is used to train the model, and the number of trees and the subsampling size are set; after training is completed, the model parameters are saved to the embedded system; The pressure, temperature, and viscosity data are read in real time and input into the Isolation Forest model; the anomaly score of each data point is calculated, and the score range is [0, 1]; a threshold is set. If the anomaly score exceeds the threshold, it is determined as abnormal data; the types of abnormal data are recorded, including pressure anomaly, temperature anomaly, or combined anomaly and timestamp; the automatic correction process is triggered; Abnormal type judgment: If only the pressure data is abnormal while the temperature and viscosity data are normal, it is determined as a pressure sensor failure or environmental interference; if only the temperature data is abnormal while the pressure and viscosity data are normal, it is determined as a temperature sensor failure; if only the viscosity data is abnormal while the pressure and temperature data are normal, it is determined as a viscometer failure or fluid property change; When the pressure data is abnormal, according to the temperature and viscosity data, the pressure value is estimated using the regression model in the historical data; using the formula: , where is the regression coefficient, obtained by fitting the historical data; When the temperature data is abnormal, the temperature value is estimated using the physical model: , where are the physical model parameters; When the viscosity data is abnormal, according to the pressure and temperature data, the viscosity value is estimated using the lookup table in the historical data. Specifically, by storing the μ values for different combinations of ΔP and T in the lookup table, the corrected value is obtained through interpolation; The corrected data is input into the Isolation Forest model to recalculate the anomaly score; if the anomaly score is lower than the threshold, the correction is successful and the corrected data is output; if the anomaly score is still higher than the threshold, the expert rule or manual intervention process is triggered; If the data is still abnormal after multiple corrections, it is determined as a sensor failure, and the automatic debugging process is triggered: restart the sensor; send a fault alarm signal to the maintenance personnel; record the fault log for subsequent analysis.
[0009] Furthermore, the specific operation steps of S2 are as follows: Experimental data collection: In the laboratory environment, simulate different working conditions, control the electromagnetic flowmeter to be in a no-flow state, record the actual zero drift value Zactual, and form a dataset containing ΔP, T, μ, and Zactual; Nonlinear relationship modeling: Use a long short-term memory network to construct a compensation model. The input layer consists of three parameters: ΔP, T, and μ, and the output layer is the predicted zero drift amount Zpredicted. An attention mechanism layer is added after the LSTM hidden layer to dynamically allocate the weights of each parameter. The specific steps are as follows: Calculate the attention weights for each time step: , where represents the importance score of the parameter, obtained by calculating through a fully connected layer; represents the th attention weight of the time step; is a counting variable; is the exponential function, used for and operations; Use the attention weights to perform weighted summation on the LSTM output to obtain the final hidden state; Network structure: Input layer → LSTM hidden layer → Attention layer → Fully connected layer → Output layer; Mean squared error is used as the loss function, and the Adam optimizer is used for training, iterating 1000 times until convergence; Model lightweight deployment: The trained LSTM model is converted into a lightweight format through the TensorFlowLite framework and deployed to an embedded microcontroller; The model inference time is controlled within 5 ms to meet the real-time requirements.
[0010] Further, the specific steps of S3 are as follows: Real-time data input and inference: During the operation of the electromagnetic flowmeter, the embedded system reads the preprocessed data of ΔP, T, and μ in real time; The data is input into the LSTM model to output the current zero drift compensation value ; Flow value correction: Calculate the corrected flow value according to the formula: ; After defining the flow value, compensate the flow value through comprehensive factors. The comprehensive factors include: Fluid density ρ: Obtained through a densitometer or a calculation model based on temperature and pressure; Pipeline vibration V: Detect the vibration signal through an acceleration sensor; Electromagnetic interference E: Detect the interference intensity through an electromagnetic sensor or a signal processing algorithm; Assign a weight to each influencing factor , and ; For each influencing factor , perform normalization: , where and are the minimum and maximum values of this influencing factor respectively; Calculate the comprehensive compensation value through weighted summation, where are the normalized influencing factor values respectively; After obtaining the comprehensive compensation value , compensate the corrected flow value to obtain the final flow value ; ; In order to adapt to the changes in influencing factors during long-term use, an adaptive weight adjustment mechanism is introduced to dynamically optimize the weights of each influencing factor; Regularly collect the actual zero drift value and the data of each influencing factor; Adjust the weights of each influencing factor through the least squares method; Output the final flow value to the control system through a 4-20 mA analog signal or an RS485 communication interface.
[0011] Furthermore, the specific operation steps of S4 are as follows: Periodic automatic calibration trigger: Set the calibration period to 500 hours of running time or when the detected environmental temperature change is greater than or equal to 10 °C / hour, trigger the calibration process; close the fluid valve to ensure that the electromagnetic flowmeter is in a no-flow state, and continuously collect the average output signal within 10 seconds as ; Calibrate using a dynamic calibration strategy based on the periodic automatic calibration trigger; Model error calculation and parameter update: Calculate the model prediction error: ; Adopt the mini-batch gradient descent algorithm to update the LSTM network weights in the reverse direction based on ΔZ; introduce an early stopping strategy to prevent overfitting; Model version management and rollback: Save the new model parameters after each update. If the error does not decrease after 3 consecutive calibrations, roll back to the historical optimal model; synchronize the update log through the SD card or the cloud.
[0012] Furthermore, the process of the dynamic calibration strategy in S4 is as follows: Define the system state as a combination of the following factors: Current error ΔZ: The deviation between the model prediction value and the actual value; Running time : The running time since the last calibration; Environmental temperature change rate : The change in environmental temperature per unit time; The state vector SZ is expressed as: ; The action space includes the following operations: Adjust the calibration period: Adjust the calibration period from 500 hours to 400 hours or 600 hours; Adjust the trigger condition: Adjust the threshold of the environmental temperature change rate ΔT, specifically from 10 °C / hour to 8 °C / hour or 12 °C / hour; Immediately trigger calibration: Immediately close the fluid valve and perform calibration; The action vector A is expressed as: ; The reward function is designed as a trade-off between the error reduction and the calibration cost: , where: and are weight coefficients used to balance the error reduction and the calibration cost; ΔZ is the current error; is the calibration cost, specifically including the calibration time and the consumption of calibration resources; Policy Optimization Using Deep Q-Network: Q-Network: The input is the state vector SZ, and the output is the Q-value for each action; Experience Replay: Stores historical states, actions, rewards, and next states for training the Q-network; Target Network: Uses the target network to stabilize the training process; The training process includes: Initialize the parameters of the Q-network and the target network; Initialize the experience replay buffer; At each time step, select an action A according to the current state SZ and the Q-network; Execute action A and observe the reward R and the next state SZ'; Store (SZ, A, R, SZ') in the experience replay buffer; Randomly sample a batch of data from the experience replay buffer and update the Q-network parameters; Periodically update the target network parameters; Through continuous interaction and learning, optimize and calibrate the policy to maximize the long-term reward.
[0013] Compared with the prior art, the beneficial effects of the present invention are: (1) In the present invention, through multi-parameter data acquisition and preprocessing, combined with the Kalman filter and the Isolation Forest algorithm, it is possible to effectively remove noise and correct abnormal data, ensuring the accuracy and reliability of the input data; This data processing method significantly improves the adaptability and measurement accuracy of the electromagnetic flowmeter under complex working conditions compared with traditional methods, providing a high-quality data basis for subsequent zero-point correction; (2) In the present invention, a long short-term memory network (LSTM) is used to construct a compensation model, and an attention mechanism is introduced to dynamically allocate the weights of each parameter; The model is lightweight deployed to the embedded microcontroller through the TensorFlow Lite framework to achieve fast inference and real-time correction; At the same time, an adaptive weight adjustment mechanism is introduced, which can dynamically optimize the weight allocation according to the changes of influencing factors during long-term use, further improving the correction accuracy and the intelligent level of the system; The comprehensive compensation method can solve the zero-point drift problem more comprehensively than the single-factor compensation, ensuring the accuracy of flow measurement; (3) In the present invention, a dynamic calibration strategy is designed, and the calibration strategy is optimized by combining the deep Q-network, which can adaptively adjust the calibration period and trigger conditions according to the running time and environmental temperature changes; Through the model error calculation and parameter update mechanism, as well as the model version management and rollback function, the calibration cost is effectively reduced, and the stability and reliability of the system are improved; This intelligent calibration method not only reduces manual intervention, but also significantly improves the long-term operation accuracy and maintenance efficiency of the electromagnetic flowmeter, providing an efficient and reliable solution for industrial flow measurement. Description of the Drawings
[0014] For the convenience of those skilled in the art to understand, the present invention will be further described below with reference to the accompanying drawings; Figure 1 It is the method flow chart of the present invention. Detailed Embodiments
[0015] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without making creative efforts belong to the scope of protection of the present invention.
[0016] It should be understood that the terms "including" and "comprising" used in the specification and claims of this disclosure indicate the presence of the described features, wholes, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.
[0017] It should also be understood that the terms used in this disclosure specification are only for the purpose of describing specific embodiments and are not intended to limit this disclosure. As used in this disclosure specification and claims, unless the context clearly indicates otherwise, the singular forms "a", "an", and "the" are intended to include the plural forms. It should be further understood that the term "and / or" used in this disclosure specification and claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0018] As Figure 1 shown, a zero-point correction method for an electromagnetic flowmeter based on pressure compensation includes the following steps: Step 1: Multi-parameter data acquisition and preprocessing: Install various sensors in the electromagnetic flowmeter pipeline to collect pressure, temperature, and viscosity data. After AD conversion, use the Kalman filter for denoising, then process and correct abnormal data through the Isolation Forest algorithm, and finally perform timestamp synchronization; Sensor installation and configuration: Install high-precision pressure sensors (range 0-1 MPa, accuracy ±0.1%) on the inlet and outlet pipelines of the electromagnetic flowmeter to measure the pressure difference ΔP at both ends in real time; install a PT100 temperature sensor (accuracy ±0.5°C) on the outside of the pipeline to monitor the fluid temperature T in real time; indirectly obtain the fluid viscosity μ (range 0-1000 cP, accuracy ±1%) through the built-in conductivity detection module of the electromagnetic flowmeter or an external online viscometer.
[0019] Data synchronization and preprocessing: Convert the analog signals of the pressure, temperature, and viscosity sensors into digital signals through an AD conversion module (such as ADS1256, 24-bit resolution); use the Kalman filter algorithm to perform denoising processing on the data to eliminate the influence of environmental electromagnetic interference and instantaneous fluctuations; and use a preliminary screening mechanism to process abnormal data. The specific process is as follows: Collect historical data and build a data set including pressure (ΔP), temperature (T), and viscosity (μ); normalize the data to ensure that all parameters are in the same dimension; use the isolation forest algorithm to train the model, set the number of trees (such as 100 trees) and the subsampling size (such as 256 samples); after training, save the model parameters to the embedded system; read the pressure, temperature, and viscosity data in real time and input them into the isolation forest model; calculate the anomaly score (AnomalyScore) of each data point, the score range is [0,1], and the higher the score, the greater the possibility of anomaly; set a threshold (such as 0.7), if the anomaly score exceeds the threshold, it is judged as abnormal data; record the type of abnormal data (such as pressure anomaly, temperature anomaly, or combined anomaly) and timestamp; trigger the automatic correction process; abnormality type judgment: if only the pressure data is abnormal, and the temperature and viscosity data are normal, it is judged as a pressure sensor failure or environmental interference; if only the temperature data is abnormal, and the pressure and viscosity data are normal, it is judged as a temperature sensor failure; if only the viscosity data is abnormal, and the pressure and temperature data are normal, it is judged as a viscometer failure or a change in fluid properties; When the pressure data is abnormal, the pressure value is estimated based on the temperature and viscosity data using the regression model in the historical data; using the formula: ,in is the regression coefficient, which is obtained by fitting historical data; when the temperature data is abnormal, the temperature value is estimated using the physical model: ,in is a physical model parameter; when the viscosity data is abnormal, the viscosity value is estimated based on the pressure and temperature data using the lookup table in the historical data. Specifically, the μ values under different ΔP and T combinations are stored in the lookup table, and the correction value is obtained by interpolation. The corrected data is input into the isolation forest model and the anomaly score is recalculated; if the anomaly score is lower than the threshold, the correction is successful and the corrected data is output; if the anomaly score is still higher than the threshold, the expert rule or manual intervention process is triggered; if the data is still abnormal after multiple corrections, it is determined to be a sensor failure and the automatic debugging process is triggered: restart the sensor; send a fault alarm signal to the maintenance personnel; record the fault log for subsequent analysis.
[0020] The real-time clock (RTC) of the embedded system is used to synchronize the timestamps of the multi-source data to ensure data alignment.
[0021] Step 2: Multi-parameter compensation model construction and training: Collect zero drift data under no-flow conditions in the laboratory to simulate different working conditions, use LSTM to build a compensation model and add an attention mechanism. After training, deploy it to the embedded microcontroller through the TensorFlowLite framework; Experimental data acquisition: In a laboratory environment, different working conditions are simulated (pressure difference ΔP: 0 - 0.8 MPa, temperature T: 10 - 80 °C, viscosity μ: 10 - 800 cP). The electromagnetic flowmeter is controlled to be in a no-flow state, and the actual zero drift value Z is recorded, forming a dataset containing ΔP, T, μ, and Z actual.
[0022] Nonlinear relationship modeling: A long short-term memory network (LSTM) is used to construct a compensation model. The input layer consists of three parameters: ΔP, T, and μ, and the output layer is the predicted zero drift amount Z predicted. An attention mechanism layer is added after the LSTM hidden layer to dynamically allocate the weights of each parameter. The specific steps are as follows: Calculate the attention weights for each time step: , where represents the importance score of the parameter, which is calculated through a fully connected layer; represents the th attention weight at a time step; is a counting variable; is an exponential function used to perform operations on and ; The weighted sum of the LSTM output is calculated using the attention weights to obtain the final hidden state. Network structure: Input layer (3 nodes) → LSTM hidden layer (64 nodes, activation function ReLU) → Attention layer → Fully connected layer (32 nodes) → Output layer (1 node); The mean squared error (MSE) is used as the loss function, and the Adam optimizer (learning rate 0.001) is used for training, iterating 1000 times until convergence. Model lightweight deployment: The trained LSTM model is converted into a lightweight format through the TensorFlowLite framework and deployed to an embedded microcontroller; The model inference time is controlled within 5 ms to meet the real-time requirements.
[0023] Step 3: Real-time zero correction and compensation: The embedded system reads the preprocessed data in real time and inputs it into the model to obtain the zero drift compensation value, corrects the flow value, compensates by considering various factors, and introduces an adaptive weight adjustment mechanism, and finally outputs the final flow value; Real-time data input and inference: During the operation of the electromagnetic flowmeter, the embedded system reads the preprocessed data of ΔP, T, and μ in real time; The data is input into the LSTM model, and the current zero drift compensation value ; Flow value correction: Calculate the corrected flow value according to the formula: ; After defining the flow value, the flow value is compensated by considering various factors. The various factors include: Fluid density (ρ): Obtained through a densitometer or a calculation model based on temperature and pressure; Pipeline vibration (V): The vibration signal is detected by an acceleration sensor; Electromagnetic interference (E): The interference intensity is detected by an electromagnetic sensor or a signal processing algorithm; Assign a weight to each influencing factor 、 and ; For each influencing factor , perform normalization: , where and are the minimum and maximum values of this influencing factor respectively; Calculate the comprehensive compensation value by weighted summation, where are the normalized influencing factor values respectively; After obtaining the comprehensive compensation value , further compensate the corrected flow value to obtain the final flow value , ; In order to adapt to the changes of influencing factors during long-term use, introduce an adaptive weight adjustment mechanism to dynamically optimize the weights of each influencing factor; Regularly collect the actual zero drift value and the data of each influencing factor; Adjust the weights of each influencing factor through the least squares method or other optimization algorithms, so that the comprehensive compensation value is closer to the actual zero drift value.
[0024] Output the final flow value to the control system through a 4-20mA analog signal or an RS485 communication interface.
[0025] Step 4: Adaptive calibration and model update: Trigger calibration when the set calibration period is reached or when the environmental temperature suddenly changes. Use a dynamic calibration strategy combined with a deep Q-network to optimize the calibration strategy, calculate the model error and update the parameters, and manage the model version and rollback; Periodic automatic calibration trigger: When the set calibration period is 500 hours of running time or when a sudden change in environmental temperature (ΔT≥10℃ / hour) is detected, trigger the calibration process; Close the fluid valve to ensure that the electromagnetic flowmeter is in a no-flow state, and continuously collect the average value of the output signal within 10 seconds as ; Based on the periodic automatic calibration trigger, perform calibration using a dynamic calibration strategy. The dynamic calibration strategy includes: Define the system state as a combination of the following factors: Current error ΔZ: The deviation between the model prediction value and the actual value; Running time : The running time since the last calibration; Environmental temperature change rate : The change in ambient temperature per unit time; the state vector SZ is expressed as: ; The action space includes the following operations: Adjust the calibration period: Adjust the calibration period from 500 hours to 400 hours or 600 hours; Adjust the trigger condition: Adjust the threshold of the ambient temperature change rate ΔT (from 10 °C / hour to 8 °C / hour or 12 °C / hour); Immediately trigger calibration: Immediately close the fluid valve and perform calibration. The action vector A is expressed as: ; The reward function is designed as a trade-off between the error reduction and the calibration cost: , where: and are weight coefficients used to balance the error reduction and the calibration cost; ΔZ is the current error; is the calibration cost (including calibration time and calibration resource consumption); Use the Deep Q-Network (DQN) for policy optimization: Q-network: The input is the state vector SZ, and the output is the Q-value of each action; Experience replay: Store historical states, actions, rewards, and next states for training the Q-network; Target network: Use the target network to stabilize the training process.
[0026] The training process includes: Initialize the parameters of the Q-network and the target network; Initialize the experience replay buffer. At each time step, select an action A according to the current state SZ and the Q-network; Execute the action A, observe the reward R and the next state SZ′; Store (SZ, A, R, SZ′) in the experience replay buffer; Randomly sample a batch of data from the experience replay buffer and update the Q-network parameters; Periodically update the target network parameters. Through continuous interaction and learning, optimize the calibration policy to maximize the long-term reward.
[0027] Model error calculation and parameter update: Calculate the model prediction error ; Adopt the mini-batch gradient descent algorithm (batch size 32, learning rate 0.0001), and update the LSTM network weights backward based on ΔZ; Introduce an early stopping strategy (terminate when the error decrease is < 1% for 3 consecutive iterations) to prevent overfitting.
[0028] Model version management and rollback: Save the new model parameters after each update. If the error does not decrease after 3 consecutive calibrations, roll back to the historical optimal model; Synchronize the update log through the SD card or the cloud to support remote maintenance.
[0029] The preferred embodiments of the present invention disclosed above are only used to help illustrate the present invention. The preferred embodiments do not describe all the details in detail, nor do they limit the invention to the specific embodiments only. Obviously, many modifications and variations can be made according to the content of this specification. These embodiments are selected and specifically described in this specification in order to better explain the principles and practical applications of the present invention, so that those skilled in the art can well understand and utilize the present invention. The present invention is only limited by the claims and their full scope and equivalents.
Claims
1. A zero point correction method for an electromagnetic flowmeter based on pressure compensation, characterized in that: The following steps are involved: S1. Multi-parameter data acquisition and preprocessing: Install multiple sensors on the electromagnetic flowmeter pipeline to collect pressure, temperature, and viscosity data. After AD conversion, use Kalman filtering to remove noise, and then use the isolation forest algorithm to process abnormal data and correct it. Finally, synchronize the timestamp. S2. Construction and training of multi-parameter compensation model: Collect zero drift data under no-flow state by simulating different working conditions in the laboratory, build compensation model with LSTM and add attention mechanism, and deploy it to embedded microcontroller through TensorFlow lightweight framework after training; S3, real-time zero point correction and compensation: The embedded system reads the pre-processed data input model in real time to obtain the zero drift compensation value, correct the flow value, comprehensively consider various influencing factors for compensation and introduce an adaptive weight adjustment mechanism, and finally output the final flow value; S4: Calibration is triggered when the set calibration cycle is reached or the ambient temperature changes suddenly. The dynamic calibration strategy is combined with the deep Q network to optimize the calibration strategy, calculate the model error and update the parameters, manage the model version and rollback.
2. The method for zero point correction of an electromagnetic flowmeter based on pressure compensation according to claim 1, characterized in that: The specific process of S1 is as follows: Sensor installation and configuration: Install high-precision pressure sensors on the inlet and outlet pipes of the electromagnetic flowmeter to measure the pressure difference ΔP at both ends in real time; Install a PT100 temperature sensor on the outside of the pipeline to monitor the fluid temperature T in real time; The fluid viscosity μ is indirectly obtained through the built-in conductivity detection module of the electromagnetic flowmeter or an external online viscometer; Data synchronization and preprocessing: convert the analog signals of pressure, temperature and viscosity sensors into digital signals through AD conversion modules; The Kalman filter algorithm is used to denoise the data and eliminate the influence of environmental electromagnetic interference and instantaneous fluctuations; and the initial screening mechanism is used to process abnormal data; The multi-source data is time-stamped and synchronized using the embedded system's real-time clock to ensure data alignment.
3. The method for zero point correction of an electromagnetic flowmeter based on pressure compensation according to claim 2, characterized in that: The process of the initial screening mechanism in S1 is as follows: Collect historical data and construct a data set including pressure ΔP, temperature T, and viscosity; normalize the data to ensure that all parameters are in the same dimension; Train the model using the Isolation Forest algorithm, setting the number of trees and subsampling size; After training is completed, save the model parameters to the embedded system; Read pressure, temperature, and viscosity data in real time and input them into the isolation forest model; calculate the anomaly score of each data point in the range of [0,1]; Set a threshold. If the anomaly score exceeds the threshold, it is considered abnormal data. Record the type of abnormal data, including pressure anomaly, temperature anomaly, or combined anomaly and timestamp. Trigger the automatic correction process. Abnormality type judgment: If only the pressure data is abnormal, while the temperature and viscosity data are normal, it is judged to be a pressure sensor failure or environmental interference; if only the temperature data is abnormal, while the pressure and viscosity data are normal, it is judged to be a temperature sensor failure; if only the viscosity data is abnormal, while the pressure and temperature data are normal, it is judged to be a viscometer failure or a change in fluid properties; When the pressure data is abnormal, the pressure value is estimated based on the temperature and viscosity data using the regression model in the historical data; using the formula: ,in is the regression coefficient, obtained by fitting historical data; When the temperature data is abnormal, use the physical model to calculate the temperature value: ,in are physical model parameters; When the viscosity data is abnormal, the viscosity value is estimated based on the pressure and temperature data using the lookup table in the historical data. Specifically, the μ values under different ΔP and T combinations are stored in the lookup table, and the correction value is obtained by interpolation. Input the corrected data into the isolation forest model and recalculate the anomaly score; if the anomaly score is lower than the threshold, the correction is successful and the corrected data is output; If the anomaly score is still higher than the threshold, the expert rule or manual intervention process is triggered; If the data is still abnormal after multiple corrections, it is determined to be a sensor failure, triggering the automatic debugging process: restart the sensor; Send fault alarm signals to maintenance personnel; record fault logs for subsequent analysis.
4. The method for zero point correction of an electromagnetic flowmeter based on pressure compensation according to claim 1, characterized in that: The specific operation steps of S2 are as follows: Experimental data collection: In a laboratory environment, simulate different working conditions, control the electromagnetic flowmeter to be in a no-flow state, record the zero drift value Zactual, and form a data set containing ΔP, T, μ, and Zactual; Nonlinear relationship modeling: A long short-term memory network is used to build a compensation model. The input layer is composed of three parameters: ΔP, T, and μ. The output layer is the predicted zero-point drift Z prediction. An attention mechanism layer is added after the LSTM hidden layer to dynamically assign weights to each parameter. The specific steps are as follows: Calculate the attention weights for each time step: ,in, Represents the importance score of the parameter, calculated by the fully connected layer; Indicates The attention weights for time steps; is a count variable; is an exponential function used to and Perform operations; use attention weights to perform weighted summation on the LSTM output to obtain the final hidden state; Network structure: input layer → LSTM hidden layer → attention layer → fully connected layer → output layer; use mean square error as the loss function, Adam optimizer for training, and iterate 1000 times until convergence; Lightweight model deployment: The trained LSTM model is converted into a lightweight format through the TensorFlowLite framework and deployed to the embedded microcontroller; the model inference time is controlled within 5ms to meet the real-time requirements.
5. The method for zero point correction of an electromagnetic flowmeter based on pressure compensation according to claim 1, characterized in that: The specific steps of S3 are as follows: Real-time data input and reasoning: During the operation of the electromagnetic flowmeter, the embedded system reads the pre-processed data of ΔP, T, and μ in real time; inputs the data into the LSTM model and outputs the current zero drift compensation value ; Flow value correction: Calculate the corrected flow value according to the formula: ; After the flow value is defined, the flow value is compensated by comprehensive factors, including: Fluid density ρ: obtained through a density meter or a calculation model based on temperature and pressure; Pipeline vibration V: Vibration signal is detected by acceleration sensor; Electromagnetic interference E: Detect interference intensity through electromagnetic sensors or signal processing algorithms; Assign a weight to each influencing factor , and For each influencing factor , and normalize it: ,in, and are the minimum and maximum values of the influencing factors respectively; the comprehensive compensation value is calculated by weighted summation ,in, are the normalized influencing factor values respectively; after obtaining the comprehensive compensation value After that, the corrected flow value To make compensation, To get the final flow value ; In order to adapt to the changes in influencing factors during long-term use, an adaptive weight adjustment mechanism is introduced to dynamically optimize the weights of various influencing factors; the actual zero drift value is collected regularly and the data of each influencing factor; adjust the weight of each influencing factor through the least squares method ; The final flow value Output to the control system via 4-20mA analog signal or RS485 communication interface.
6. The method for zero point correction of an electromagnetic flowmeter based on pressure compensation according to claim 1, characterized in that: The specific operation steps of S4 are as follows: Periodic automatic calibration trigger: Set the calibration cycle to 500 hours of running time or detect that the ambient temperature changes by 10°C / hour or more to trigger the calibration process; close the fluid valve to ensure that the electromagnetic flowmeter is in a no-flow state, and continuously collect the output signal average value within 10 seconds as ; Calibration is performed using a dynamic calibration strategy based on periodic automatic calibration triggers; Model error calculation and parameter update: Calculate the model prediction error: ; A small batch gradient descent algorithm is used to update the LSTM network weights in reverse based on ΔZ; an early stopping strategy is introduced to prevent overfitting; Model version management and rollback: Save new model parameters after each update. If the error does not decrease after three consecutive calibrations, roll back to the historical optimal model. Synchronize update logs via SD card or cloud.
7. The method for zero point correction of an electromagnetic flowmeter based on pressure compensation according to claim 6, characterized in that: The dynamic calibration strategy process in S4 is as follows: The system state is defined as the combination of the following factors: Current error ΔZ: the deviation between the model prediction value and the actual value; Run time : Running time since last calibration; Ambient temperature change rate : Change of ambient temperature per unit time; The state vector SZ is expressed as: ; The action space includes the following operations: Adjust the calibration cycle: adjust the calibration cycle from 500 hours to 400 hours or 600 hours; Adjust the trigger condition: adjust the threshold of the ambient temperature change rate ΔT from 10°C / hour to 8°C / hour or 12°C / hour; Immediately trigger calibration: immediately close the fluid valve and perform calibration; The action vector A is expressed as: ; The reward function is designed as a trade-off between the amount of error reduction and the calibration cost: ,in: and is the weight coefficient used to balance error reduction and calibration cost; ΔZ is the current error; The calibration cost includes the calibration time and calibration resource consumption; Use deep Q network for strategy optimization: Q network: input is state vector SZ, output is Q value for each action; experience replay: store historical state, action, reward and next state for training Q network; target network: use target network to stabilize training process; training process includes: Initialize the parameters of the Q network and the target network; initialize the experience replay buffer; at each time step, select action A based on the current state SZ and the Q network; perform action A, observe the reward R and the next state SZ′; store (SZ, A, R, SZ′) in the experience replay buffer; randomly sample a batch of data from the experience replay buffer and update the Q network parameters; regularly update the target network parameters; optimize the calibration strategy through continuous interaction and learning to maximize the long-term reward.
Citation Information
Cited By
Precise inspection method and inspection robot for underground cavern
CN120403628A
Turbine flowmeter precision control method and device
CN120507009A
Gate valve flow prediction method based on sensing data and related equipment
CN120764399A
Conductivity sensor pressure compensation test system and method
CN120820901A
Flow control method
CN120872039A