Gas laminar flow meter flow calibration method based on genetic algorithm
Through the BP neural network model based on genetic algorithm optimization of the calibration algorithm of the laminar flow meter, the measurement error problem of the laminar flow meter under different working conditions is solved, and the high-precision measurement of the flow meter is realized, with an error of less than 0.1%, and the improvement of the improvement of the flow meter The applicability and reliability of the model are achieved.
Patent Information
- Application Number
- CN202411683052.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-01-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When measuring small flow and high viscosity fluids, the accuracy of the flow calculation formula is affected by the changes in the viscosity of the fluid, resulting in large calibration errors, and the correction factors are complex and lack universality, making it difficult to under different working conditions. Achieve high-precision measurements.
The BP neural network model based on genetic algorithm is adopted to obtain pressure, temperature and differential pressure data through measurement, divide the training set and test set, build a calibration model, optimize the neural network parameters, form an accurate flow calibration algorithm, and reduce measurement errors.
The precise measurement of the flowmeter under various operating conditions is realized, with the actual error being less than 0.1%, which significantly improves the measurement accuracy and applicability of the flowmeter, and can automatically adjust the model parameters to adapt to different conditions.
Smart Images

Figure CN119309651A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of laminar flow meter measurement and calibration, and in particular to a laminar flow meter flow calibration method. Background Art
[0002] Laminar flow meter is a differential pressure flow meter composed of laminar flow sensor and differential pressure gauge. It is an instrument that measures flow by measuring the differential pressure at both ends of the sensor. Generally speaking, laminar flow meter is used to measure the flow of small flow and high viscosity fluid. One of its major advantages is that the differential pressure △P sent by the flow meter is proportional to the volume flow Qv, and the structure is simple.
[0003] like Figure 1 As shown in the schematic diagram of the calibration pipeline of the gas laminar flow meter, the calibration pipeline of the gas laminar flow meter includes a gas source 101, a pressure reducing valve 102, a standard meter 103, a flow meter to be calibrated 104, and a host computer 105. In the calibration process of the gas laminar flow meter, the flow meter to be calibrated is first passed with gas to generate flow, and the temperature value, pressure value, differential pressure value and flow value are read by the host computer. Then, the constant K of the flow meter is calculated according to formula (1), and then the constant K is written into the software of the flow meter to complete the calibration work. At present, the formula for laminar flow meter calibration is based on the Hagen-Poiseuille law, which mainly describes the linear relationship between the pressure drop and volume flow rate of a fluid flowing in a laminar flow in a small diameter pipe. This theoretical model provides a basic framework and theoretical basis for flow measurement. However, the accuracy of this relationship is highly dependent on the physical properties of the fluid, especially the viscosity of the fluid.
[0004] In the above formula, q is the flow value, K is the flow meter constant, μ is the fluid viscosity, Δp is the differential pressure value, p and T are the fluid working pressure value and temperature value respectively, p N 、T N are the pressure and temperature values under standard conditions respectively.
[0005] In practical applications, the viscosity of the fluid may change due to changes in external conditions such as temperature and pressure, which poses a challenge to the accuracy of the flow calculation formula. For example, when the temperature of the fluid increases, its viscosity may decrease, which may cause the flow calculation formula based on the Hagen-Poiseuille law to be unable to accurately predict the flow. Therefore, the calibration of the flow meter needs to take into account not only the basic physical properties of the fluid, but also the influence of external environmental conditions.
[0006] In order to solve this problem, some scholars have tried to modify the flow calculation formula and introduced some correction factors. These correction factors are mostly empirical formulas of temperature and pressure, but their expressions are often complex and require a lot of calculations and processing. In addition, due to the certain gap between the test environment conditions and the actual environment conditions, these modified flow calculation formulas often lack universality and cannot be applied to all situations.
[0007] In addition, the factors that affect flow meter calibration are not only diverse, but also highly random. For example, the viscosity of the fluid may change dramatically due to slight changes in temperature and pressure, which increases the difficulty of flow meter calibration. Therefore, even after careful calibration, the accuracy of the flow meter often cannot reach the ideal level. This requires appropriate correction and adjustment of the flow meter's measurement results in actual applications to ensure its accuracy. Summary of the invention
[0008] The present invention aims at the deficiencies in the prior art and provides a flow calibration method for a gas laminar flow meter based on a genetic algorithm. The method measures and obtains the pressure, temperature and differential pressure of the flow meter to be calibrated and the flow data of the standard meter, analyzes and processes the obtained data, divides the data into a training set and a test set, constructs a calibration model of a BP neural network optimized by a genetic algorithm, forms a calibration algorithm for a gas laminar flow meter, calibrates the gas laminar flow meter, reduces the measurement error of the flow meter under various working conditions, and the actual error value is less than 0.1%, thereby achieving accurate measurement of the flow meter. The method solves the problem of large errors in the previous calibration formula based on the Hagen-Poiseuille law.
[0009] In order to solve the above technical problems, the present invention is solved by the following technical solutions: a gas laminar flow meter flow calibration method based on genetic algorithm, comprising the following steps: step A: using the gas laminar flow meter to be calibrated to collect test data under different working conditions, wherein the test data includes standard meter flow, laminar flow meter pressure difference, pressure, and temperature, and is divided into a training set and a test set; step B: constructing a BP neural network model, and determining that the number of layers of the neural network model is 3 layers, specifically an input layer, a hidden layer, and an output layer; step C: using the training set data to train the BP neural network model, and optimizing the BP neural network through a genetic algorithm GA to obtain a GA-BP model, after the training is completed, the test set data is handed over to the GA-BP neural network for fitting, and the parameters of the neural network are adjusted according to the fitting results to obtain a better fitting result; step D: solidifying the trained neural network model parameters into the gas laminar flow meter, importing the actually measured flow meter differential pressure, temperature, and pressure into the BP neural network model, and calculating the real-time flow, thereby performing real-time correction on the flow measured by the flow meter.
[0010] In the above technical solution, preferably, in step A, the laminar flow meter pressure difference, pressure, and temperature are used as input parameters, the standard meter flow rate is used as the output parameter, and the data is normalized.
[0011] In the above technical scheme, preferably, in step B, the number of input parameters is used as the number of input layer nodes N, and the input parameters are determined to be the laminar flowmeter pressure difference, ambient pressure, and fluid temperature, so the value of the input layer neuron number N is 3; the number of output parameters is used as the number of output layer neurons M, and the output parameter is determined to be the standard flow, so the value of the output layer neuron number M is 1; the number of hidden layer neurons L is determined based on the training results of the training samples.
[0012] In the above technical solution, preferably, the specific steps of step C are: C1: population initialization; using genetic algorithm (GA) to train BP neural network using real number coding, the BP neural network is a three-layer BP neural network, the number of neurons in the input layer is 3, the number of neurons in the hidden layer is L, the number of neurons in the output layer is 1, the connection weight between the input layer and the hidden layer is Vi,j, the connection weight between the hidden layer and the output layer is Wj,k, the thresholds of the hidden layer and the output layer are bj, bk respectively, then the length of the code is 3×L+L×1+L+1, within the range of the connection weight and the threshold, M chromosome individuals are randomly generated as the initial population; C2: calculating the individual fitness value; training is carried out for the network model corresponding to each chromosome, and after the training is completed, the absolute value of the error between the predicted output value and the true value is summed, and the result is used as the fitness value F of the individual i , the specific calculation formula is as follows: , Where: M is the number of output nodes, z i is the i-th data predicted by the network, y i is the ith experimental data; C3: individual selection; the selection is based on the roulette method. The roulette is divided according to the selection probability of each individual. The selection probability of an individual is determined by the proportion of its fitness function value to the total fitness function value of the entire group. Individuals with higher fitness have a greater selection probability. By rotating the roulette wheel n times, the final selection result can be obtained; the selection probability of an individual is: , Among them: F i represents the fitness value of individual i, k is the coefficient; n is the number of individuals in the population, p i is the probability of the i-th data; C4: crossover; using the real number crossover method, the operation method is as follows:
[0013] Where: c qjrepresents the crossover of the qth individual at position j, c rj represents the crossover of the rth individual at position j; b represents a random number in [0,1]; C5: mutation; this operation randomly selects individuals from the population and makes small and random changes to certain positions in their gene sequences to introduce new genetic information. The operation method is: ; , Where: c qj is the jth gene of the qth individual; c max and c min c qj The upper and lower bounds of G max is the maximum number of evolution times; h is a random number in [0,1].
[0014] In the above technical solution, preferably, in step D, the BP neural network model output data and the marked table flow data are compared to confirm whether they are within the error range. If they are within the allowable error range, the calibration is completed; if they are beyond the error range, the BP neural network model continues to be trained.
[0015] This application uses a BP neural network based on genetic algorithm optimization (GA) to calibrate the laminar flow meter, which can more accurately capture the complex relationship between various physical parameters and their impact on flow. This method can effectively reduce the nonlinear and irregular measurement errors caused by the coupling of physical parameters, thereby significantly improving the accuracy of flow measurement. At the same time, using the powerful autonomous learning and correction functions of the neural network, this method can automatically adjust the model parameters according to changes in the actual working environment to ensure that the prediction model maintains high accuracy for a long time. This self-optimization capability makes the model more flexible and able to cope with flow changes under different conditions, improving the practicality and reliability of the model. The model of the method of this application only needs appropriate learning to adapt to laminar flow meters of different calibers, and more broadly, it can adapt to flow meters of different calibers.
[0016] Compared with the prior art, the present application provides a calibration method for a gas laminar flow meter based on a genetic algorithm. The method measures and obtains the pressure, temperature and differential pressure of the flow meter to be calibrated and the flow data of the standard meter, analyzes and processes the obtained data, divides the data into a training set and a test set, constructs a calibration model of a BP neural network optimized by a genetic algorithm, forms a calibration algorithm for a gas laminar flow meter, calibrates the gas laminar flow meter, reduces the measurement error of the flow meter under various working conditions, and the actual error value is less than 0.1%, realizing the accurate measurement of the flow meter. The problem of large errors in the previous calibration formula based on the Hagen-Poiseuille law is solved. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is a schematic diagram of the calibration pipeline of the existing gas laminar flow meter.
[0018] Figure 2 This is a flow chart of the main steps of this method.
[0019] Figure 3 This is a flow chart of the optimization steps of the BP neural network model of this method.
[0020] Figure 4 This is a flow chart of the real-time calibration steps of the BP neural network model in this method.
[0021] Figure 5 This is the structural diagram of the BP neural network model of this method.
[0022] Figure 6 It is the algorithm flow chart of BP neural network optimized by genetic algorithm in this method. DETAILED DESCRIPTION
[0023] The following is a clear and complete description of the technical solutions of the various embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments described in the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0024] Example 1: Figures 2 to 6 As shown, a gas laminar flow meter with a range of 0SLPM~10SLPM is used for flow calibration. There are 10 test flow points, which are 10%~100% of the full scale, and one point is taken every 10%. The data includes four items: flow meter pressure difference, pressure, temperature and standard meter flow. The BP neural network model optimized by genetic algorithm GA is used for processing, that is, the method of this application.
[0025] The method comprises the following steps: Step A: using a gas laminar flow meter to be calibrated to collect test data under different working conditions, wherein the test data comprises a standard meter flow rate, a laminar flow meter pressure difference, pressure, and temperature, and the data are divided into a training set and a test set; the laminar flow meter pressure difference, pressure, and temperature are used as input parameters, the standard meter flow rate is used as an output parameter, and the data are normalized.
[0026] Step B: Construct a BP neural network model and determine that the number of layers of the neural network model is 3, namely, input layer, hidden layer and output layer; take the number of input parameters as the number of input layer nodes N, and determine the input parameters as the laminar flowmeter pressure difference, ambient pressure, and fluid temperature, so the value of the input layer neuron number N is 3; take the number of output parameters as the number of output layer neurons M, and determine the output parameter as the standard flow, so the value of the output layer neuron number M is 1; the number of hidden layer neurons L is determined based on the training results of the training samples.
[0027] Step C: Use the training set data to train the BP neural network model, and optimize the BP neural network through the genetic algorithm GA to obtain the GA-BP model. After the training is completed, the test set data is handed over to the GA-BP neural network for fitting, and the parameters of the neural network are adjusted according to the fitting results to obtain better fitting results; Population initialization: The genetic algorithm (GA) is used to train the BP neural network using real number coding. The BP neural network is a three-layer BP neural network, the number of neurons in the input layer is 3, the number of neurons in the hidden layer is L, the number of neurons in the output layer is 1, the connection weights between the input layer and the hidden layer are Vi, Vj, the connection weights between the hidden layer and the output layer are Wj, Wk, and the thresholds of the hidden layer and the output layer are bj, bk respectively. The length of the code is 3×L+L×1+L+1. Within the range of the connection weight and the threshold, M chromosome individuals are randomly generated as the initial population; C2: Calculate the individual fitness value; Carry out training for the network model corresponding to each chromosome. After the training is completed, the absolute value of the error between the predicted output value and the true value is summed, and the result is used as the fitness value F of the individual. i , the specific calculation formula is as follows: , Where: M is the number of output nodes, z i is the i-th data predicted by the network, y i is the ith experimental data; C3: individual selection; the selection is based on the roulette method. The roulette is divided according to the selection probability of each individual. The selection probability of an individual is determined by the proportion of its fitness function value to the total fitness function value of the entire group. Individuals with higher fitness have a greater selection probability. By rotating the roulette wheel n times, the final selection result can be obtained; the selection probability of an individual is: , Among them: F i represents the fitness value of individual i, k is the coefficient; n is the number of individuals in the population, p i is the probability of the i-th data; C4: crossover; using the real number crossover method, the operation method is as follows: , Where: c qjrepresents the crossover of the qth individual at position j, c rj represents the crossover of the rth individual at position j; b represents a random number in [0,1]; C5: mutation; this operation randomly selects individuals from the population and makes small and random changes to certain positions in their gene sequences to introduce new genetic information. The operation method is: ; , Where: c qj is the jth gene of the qth individual; c max and c min c qj The upper and lower bounds of G max is the maximum number of evolutions; h is a random number in [0,1]. At this time, the mean square error of the training set is 0.0014647%. Step D: Solidify the trained neural network model parameters into the gas laminar flow meter, import the actual measured flow meter differential pressure, temperature and pressure into the BP neural network model, calculate the real-time flow rate, and thus perform real-time correction on the flow rate measured by the flow meter.
[0028] The predicted values of the GA-BP neural network model and the measured errors of the GA-BP neural network model are shown in Table 1.
[0029] Comparative Example 1: Figure 1 As shown in the figure, a gas laminar flow meter with a range of 0SLPM~10SLPM is used for flow calibration. There are 10 test flow points, which are 10%~100% of the full scale, and one point is taken every 10%. The data includes four items: flow meter pressure difference, pressure, temperature and standard meter flow. The traditional linear model is used, that is, the formula: The calculation is carried out, and the predicted value and the measurement error of the formula method are shown in Table 1.
[0030] Comparative Example 2: A gas laminar flow meter with a range of 0SLPM~10SLPM is used for flow calibration. There are 10 test flow points, which are 10%~100% of the full scale, and one point is taken every 10%. The data includes four items: flow meter pressure difference, pressure, temperature and standard meter flow. The BP neural network model without genetic algorithm GA optimization is used.
[0031] The method comprises the following steps: Step A: using a gas laminar flow meter to be calibrated to collect test data under different working conditions, wherein the test data comprises a standard meter flow rate, a laminar flow meter pressure difference, pressure, and temperature, and the data are divided into a training set and a test set; the laminar flow meter pressure difference, pressure, and temperature are used as input parameters, the standard meter flow rate is used as an output parameter, and the data are normalized.
[0032] Step B: Construct a BP neural network model and determine that the number of layers of the neural network model is 3, namely, input layer, hidden layer and output layer; take the number of input parameters as the number of input layer nodes N, and determine the input parameters as the laminar flowmeter pressure difference, ambient pressure, and fluid temperature, so the value of the input layer neuron number N is 3; take the number of output parameters as the number of output layer neurons M, and determine the output parameter as the standard flow, so the value of the output layer neuron number M is 1; the number of hidden layer neurons L is determined based on the training results of the training samples.
[0033] Step C: Solidify the trained neural network model parameters into the gas laminar flow meter, import the actual measured flow meter differential pressure, temperature and pressure into the BP neural network model, calculate the real-time flow rate, and thus perform real-time correction on the flow rate measured by the flow meter.
[0034] The predicted value of BP neural network model and the measured error of BP neural network model are shown in Table 1.
[0035] Comparative Example 1 Comparative Example 1 Comparative Example 2 Comparative Example 2 Example 1 Example 1 Flow point / %FS Standard flow rate / SLPM Calculated flow / SLPM Calculation error / % BP predicted value / SLPM BP prediction error / % GA-BP predicted value / SLPM GA-BP prediction error / % 10% 0.988 -0.86% -0.87% 0.985 -0.30% 0.987 -0.04% 20% 1.980 -0.86% -0.83% 1.974 -0.31% 1.978 -0.09% 30% 2.973 -0.68% -0.68% 2.970 -0.10% 2.972 -0.01% 40% 3.970 -0.51% -0.50% 3.959 -0.29% 3.969 -0.04% 50% 4.965 -0.24% -0.26% 4.944 -0.42% 4.965 0.00% 60% 5.956 -0.02% -0.03% 5.937 -0.33% 5.954 -0.04% 70% 6.951 0.38% 0.29% 7.022 1.02% 6.950 -0.02% 80% 7.949 0.54% 0.57% 7.924 -0.31% 7.948 -0.01% 90% 8.948 0.83% 0.86% 8.951 0.04% 8.947 -0.01% 100% 9.940 1.10% 1.12% 9.925 -0.15% 9.936 -0.04% Table 1: Prediction values and error ranges of Example 1, Comparative Example 1 and Comparative Example 2 As can be seen from Table 1, the prediction error of the GA-BP neural network model in the embodiment does not exceed 0.1%, and the average error is 0.03%. The maximum error of comparative example 1 exceeds 1%, and the average error is 0.6%. The maximum error of comparative example 2 exceeds 1%, and the average error is 0.33%. That is, the accuracy of the GA-BP neural network model is 20 times that of the traditional linear model and 10 times that of the BP neural network model. The flow calibration method of the present application is far superior to the existing flow calibration method.
Claims
1. A gas laminar flow meter flow calibration method based on genetic algorithm, characterized by: It includes the following steps: Step A: using the gas laminar flow meter to be calibrated to collect test data under different working conditions, wherein the test data includes standard meter flow, laminar flow meter pressure difference, pressure, and temperature, and is divided into a training set and a test set; Step B: Construct a BP neural network model and determine that the number of layers of the neural network model is 3, specifically, an input layer, a hidden layer, and an output layer; Step C: Use the training set data to train the BP neural network model, and use the genetic algorithm GA to optimize the BP neural network to obtain the GA-BP model. After the training is completed, the test set data is passed to the GA-BP model for fitting, and the parameters of the neural network are adjusted according to the fitting results to obtain better fitting results. Step D: Solidify the trained neural network model parameters into the gas laminar flow meter, import the actual measured flow meter differential pressure, temperature and pressure into the GA-BP model, calculate the real-time flow rate, and thus perform real-time correction on the flow rate measured by the flow meter.
2. A method for calibrating a gas laminar flowmeter flow rate based on a genetic algorithm according to claim 1, characterized in that In step A, the laminar flow meter pressure difference, pressure, and temperature are used as input parameters, the standard meter flow rate is used as an output parameter, and the data is normalized.
3. The method for calibrating a gas laminar flowmeter based on a genetic algorithm according to claim 1, characterized in that In step B, the number of input parameters is used as the number of input layer nodes N, and the input parameters are determined to be the laminar flowmeter pressure difference, ambient pressure, and fluid temperature. Therefore, the value of the input layer neuron number N is 3; the number of output parameters is used as the output layer neuron number M, and the output parameter is determined to be the standard flow rate. Therefore, the value of the output layer neuron number M is 1; the number of hidden layer neurons L is determined based on the training results of the training samples.
4. A gas laminar flow meter flow calibration method based on genetic algorithm according to claim 3, characterized in that: The specific steps of step C are: C1: Population initialization; Use genetic algorithm GA to train BP neural network using real number coding. The BP neural network is a three-layer BP neural network, with 3 neurons in the input layer, L neurons in the hidden layer, and 1 neuron in the output layer. The connection weights between the input layer and the hidden layer are Vi and Vj, and the connection weights between the hidden layer and the output layer are Wj and Wk. The thresholds of the hidden layer and the output layer are bj and bk respectively. The length of the code is 3×L+L×1+L+1. Within the range of the connection weight and the threshold, randomly generate M chromosome individuals as the initial population. C2: Calculate the individual fitness value; carry out training for the network model corresponding to each chromosome. After the training is completed, sum the absolute value of the error between the predicted output value and the true value, and the result is used as the individual fitness value F i , the specific calculation formula is as follows: , Where: M is the number of output nodes, z i is the i-th data predicted by the network, y i is the ith experimental data; C3: Individual selection; selection is based on the roulette method. The roulette is divided according to the selection probability of each individual. The selection probability of an individual is determined by the proportion of its fitness function value to the total fitness function value of the entire group. Individuals with higher fitness have a greater selection probability. By rotating the roulette wheel n times, the final selection result can be obtained. The selection probability of an individual is: , Among them: F i represents the fitness value of individual i, k is the coefficient; n is the number of individuals in the population, p i is the probability of the i-th data; C4: Crossover; use the real number crossover method, the operation method is as follows: , Where: c qj represents the crossover of the qth individual at position j, c rj represents the crossover of the rth individual at position j; b represents a random number in [0,1]; C5: Mutation; This operation randomly selects individuals from the population and makes small and random changes to certain positions in their gene sequences to introduce new genetic information. The operation method is: ; , Where: c max and c min c qj The upper and lower bounds of G max is the maximum number of evolution times; h is a random number in [0,1].
5. The method for calibrating a gas laminar flow meter flow rate based on a genetic algorithm according to claim 1, characterized in that: In step D, the output data of the BP neural network model is compared with the flow data of the standard meter to confirm whether it is within the error range. If it is within the allowable error range, the calibration is completed. If it is beyond the error range, the BP neural network model is continued to be trained.
Citation Information
Patent Citations
Coal gas measuring method by utilization of BP neural network
CN101319925A
Atmospheric porous probe measurement calibration method for optimizing neural network based on genetic algorithm
CN112926265A
Mean flow velocity calculation method based on channel cross section
CN113887142A
Ultrasonic flowmeter correction device, method and system based on BP neural network
CN117309077A
Genetic algorithm-based road surface meteorological state identification method for optimizing BP neural network
CN118152743A
Cited By
Fixed-point calibration and precision compensation method of differential pressure type flowmeter and related equipment
CN121720552A