Pressure sensor temperature compensation method based on myxozoa optimization and kalman filter
By combining an external temperature sensor with a slime colony optimization algorithm and an extended Kalman filter, the temperature compensation method of the pressure sensor is optimized, solving the problem of unstable output of the pressure sensor at different temperatures, achieving higher stability and accuracy, and is suitable for scenarios such as industrial control and environmental monitoring.
Patent Information
- Application Number
- CN202410209095.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-26
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2044-02-26
AI Technical Summary
The output of the pressure sensor is unstable under different temperature environments, which affects its accuracy and reliability.
The ambient temperature is monitored in real time by an external temperature sensor. The slime mold optimization algorithm and extended Kalman filter are combined to optimize the parameters of the state equation and observation equation to achieve temperature compensation of the pressure sensor.
The stability and accuracy of the pressure sensor at different temperatures are improved, the real-time adaptability and system robustness are enhanced, and it is suitable for a wider range of application scenarios.
Smart Images

Figure CN118010235B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of pressure sensor optimization, specifically to a pressure sensor temperature compensation method based on slime group optimization and Kalman filtering. BACKGROUND
[0002] With the wide application of pressure sensors in various fields, their performance sensitivity to environmental factors, especially temperature, has become a key problem to be solved. In practical applications, changes in environmental temperature can cause instability in the output of pressure sensors, affecting their accuracy and reliability. SUMMARY
[0003] To solve the above problems, the present application proposes a pressure sensor temperature compensation method based on slime group optimization and extended Kalman filtering. By attaching a temperature sensor to obtain environmental temperature information, and using a slime group optimization algorithm to optimize the parameters of the state equation and observation equation of the extended Kalman filter, combined with a real-time dynamic adjustment mechanism, accurate measurement of the pressure sensor at different temperatures is achieved, improving its stability and accuracy, thus providing reliable pressure data support for various application scenarios.
[0004] To achieve the above purpose, the technical solution adopted by the present application is as follows:
[0005] The pressure sensor temperature compensation method based on slime group optimization and Kalman filtering comprises:
[0006] Real-time monitoring of environmental temperature by an external temperature sensor, and introducing temperature data into the system;
[0007] Establishing state equations and observation equations based on extended Kalman filtering to achieve temperature compensation of the pressure sensor;
[0008] Real-time optimization of extended Kalman filter parameters based on slime group optimization algorithm to maximize the efficiency of the temperature compensation algorithm.
[0009] Further, the state equation established by the extended Kalman filter is:
[0010] X(k+1)=Φ(k+1|k)X(k)+G(k)W(k)+φ(k);
[0011] In the formula, X(k+1) represents ; Φ(k+1|k) represents ; X(k) represents ; φ(k) represents ; W(k) and V(k) are process noise and observation noise respectively, and G(k) is a noise driving matrix.
[0012] Further, the observation equation established by the extended Kalman filter is:
[0013] Z(k) = H(k)X(k) + y(k) + V(k);
[0014] wherein Z(k) represents H(k) represents X(k) represents y(k) represents V(k) represents.
[0015] Further, the working process of the extended Kalman filter comprises:
[0016] Step one: initialize the initial state X(0), V(0), covariance matrix P0;
[0017] Step two: first-order linearization of the state equation, solve the state transition matrix
[0018] Step three: first-order linearization of the observation equation, solve the observation matrix
[0019] Step four: solve the covariance matrix prediction P(k|k-1) = Φ(k)P(k-1|k-1)Φ T (k) + Q;
[0020] Step five: solve the Kalman filter gain K(k) = P(k|k-1)H T (k) (H(k)P(k|k-1)H T (k) + R);
[0021] Step six: solve the state update X(k) = X(k|k-1) + K(Y(k) - Y(k|k-1));
[0022] Step seven: covariance update P(k) = (I n -K(k)H(k))P(k|k-1);
[0023] wherein W(k) is the process noise; V(k) is the observation noise; G(k) is the noise driving matrix; X(k+1) represents the state of the system at k+1 time; k represents the discrete time; X(k) represents the state of the system at k time; φ(k) represents the non-random external action item; Φ(k+1|k) represents the state transition value; Z(k) represents the observation value at k time; H(k) represents the observation matrix at k time; V(k) represents the observation noise; y(k) represents a random sequence; represents the filtering value at k time; represents the state prediction value at k time; represents the state smoothing value at k time; X(k+1|k) = X(k) + K(k+1) (Z(k+1) - H(k+1) X(k+1|k-1)) ; (1) P(k+1|k) = (I - K(k+1) H(k+1)) P(k+1|k-1) ; (2) P(k+1|k) = P(k+1) - K(k+1) R(k+1) K(k+1)T; (3) K(k+1) = P(k+1|k) H(k+1)T (H(k+1) P(k+1|k) H(k+1)T + R(k+1)) -1; (4) P(k+1) = Φ(k+1) P(k) Φ(k+1)T + Q(k+1); (5) X(k+1) = Φ(k+1) X(k) + W(k+1) U(k+1); (6) Z(k+1) = H(k+1) X(k+1) + V(k+1); (7) where X(k) represents the state filtering value at k time; P(k+1|k) represents the covariance prediction value at k+1 time; P(k|k) represents the covariance filtering value at k time; Q(k+1) represents the process noise at k+1 time; K(k+1) represents the Kalman filtering gain at k+1 time; R(k+1) represents the observation noise at k+1 time; H(k+1) represents the observation matrix at k+1 time; X(k+1) represents the state filtering value at k+1 time; X(k+1|k-1) represents the state prediction value at k+1 time; Z(k+1) represents the observation equation at k+1 time; P(k+1) represents the covariance at k+1 time; I represents the unit matrix; I n Φ(k) represents the state transition matrix at k time; P(k-1|k-1) represents the covariance filtering value at k-1 time; P(k|k-1) represents the covariance matrix prediction value at k time; K(k) represents the Kalman filtering gain; Q represents the variance of the process noise; R represents the variance of the observation noise; Y(k) represents the observation signal at k time; Y(k|k-1) represents the prediction signal at k time.
[0024] Further, the mathematical formula for updating the position of the slime mold in the slime mold colony optimization algorithm is
[0025]
[0026] where rand and r represent random values generated within 0 to 1, ub and lb represent the upper and lower bounds of the search space respectively, z is the proportion of randomly distributed slime mold individuals in the total slime mold, used for switching between the global search stage and the local search stage of the algorithm; X(t+1) and X(t) are the positions of the slime mold at the t+1th and tth iterations respectively, X b (t) represents the position with the highest food concentration at the tth iteration, i.e. the optimal position, X A (t) and X B (t) represent two randomly selected slime mold individuals at the tth iteration; the range of vb is [-a, a], a = arctanh(1-(t / T)), t is the current iteration number, and T is the maximum iteration number; the range of vc is linearly decreased from 1 to 0; r is a random number between 0 and 1.
[0027] Further, the workflow of the slime mold colony optimization algorithm includes:
[0028] Step 1: Set parameters, initialize the population, and calculate the fitness value;
[0029] Step 2: Calculate the slime weight W and the parameter a;
[0030] Step 3: Generate a random number r, and determine the size of the random number r and the parameter z. If r <z,则按式(1.4)的第一个公式更新个体位置;否则更新参数p,vb,vc,判断r与参数p的大小,若r<p,则按式(1.4)的第二个公式更新个体位置,否则按式(1.4)的第三个公式更新个体位置;
[0031] Step 4: Calculate the fitness value and update the global optimal solution;
[0032] Step 5: Determine whether the end condition is met. If so, output the global optimal solution and fitness value; otherwise, repeat steps 2 to 5.
[0033] In the above scheme, by implementing the pressure sensor temperature compensation algorithm based on slime mold optimization and extended Kalman filtering, combined with a real-time dynamic adjustment mechanism, the following beneficial effects are achieved:
[0034] Improved temperature stability: The system can monitor changes in ambient temperature in real time and dynamically adjust the parameters of the extended Kalman filter to ensure that the pressure sensor maintains higher stability at different temperatures. This will eliminate output fluctuations caused by temperature changes and improve the performance of the sensor in dynamic temperature environments.
[0035] Improved accuracy: By optimizing the parameters of the extended Kalman filter using a slime colony optimization algorithm, the system can achieve more accurate pressure measurements under different temperature conditions, which will help improve the accuracy of the sensor output and meet the high requirements for precision measurement.
[0036] Enhanced real-time adaptability: The real-time dynamic adjustment mechanism enables the system to quickly respond to changes in ambient temperature and ensures real-time parameter adjustment. This will enable the sensor to maintain efficient temperature compensation in the face of real-time temperature changes, with stronger real-time adaptability.
[0037] Enhanced system robustness: By combining the slime mold optimization algorithm and real-time dynamic adjustment mechanism, the system will be more robust, which means that the sensor can provide reliable and stable output even under extreme temperature conditions, making it suitable for a wider range of application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 This is a flow chart of a pressure sensor temperature compensation method based on slime mold optimization and Kalman filtering according to an embodiment of the present invention.
[0039] Figure 2 Flowchart of the slime mold optimization algorithm in an embodiment of the present invention.
[0040] Figure 3For algorithm testing on a set of pressure data of random simulation, the obtained error comparison chart before and after compensation is shown, wherein the thin line is the error before compensation and the thick line is the error after compensation. DETAILED DESCRIPTION
[0041] The application will be described in detail below with specific examples. The following examples will help those skilled in the art to further understand the application, but do not limit the application in any form. It should be noted that, for those skilled in the art, without departing from the concept of the application, a number of modifications and improvements can be made. These all belong to the protection scope of the application.
[0042] As Figure 1 shown, the embodiment of the application provides a pressure sensor temperature compensation method based on myxobacteria optimization and Kalman filtering, which monitors the environmental temperature in real time through an external temperature sensor, and introduces the temperature data into the system as a calibration reference of the pressure sensor output; considering the influence of temperature on the sensor output, it establishes the state equation and observation equation based on the extended Kalman filter to realize the temperature compensation of the pressure sensor; at the same time, in order to obtain the best extended Kalman filter parameters, it realizes the real-time optimization of the extended Kalman filter parameters based on the myxobacteria optimization algorithm, so as to maximize the efficiency of the temperature compensation algorithm.
[0043] Specifically:
[0044] Principle of extended Kalman filter
[0045] 1. Local linearization
[0046] The dynamic equation of the nonlinear system is represented as
[0047] X(k+1)=f[k,X(k)]+G(k)W(k) (1.1)
[0048] Z(k)=h[k,X(k)]+V(k) (1.2)
[0049] Wherein, W(k) and V(k) are process noise and observation noise respectively, G(k) is a noise driving matrix; X(k+1) represents the state of the system at k+1 time; k represents discrete time; X(k) represents the state of the system at k time; W(k) is process noise; V(k) is observation noise; Z(k) represents the observation value at k time.
[0050] Firstly, the extended Kalman filter utilizes the local linearization of the nonlinear function, and linearizes the nonlinear model locally. According to the system state equation (1.1), the nonlinear function f(*) is expanded to the first order Taylor around the filter value
[0051]
[0052] make
[0053]
[0054]
[0055] Then the state equation is
[0056] X(k+1)=Φ(k+1|k)X(k)+G(k)W(k)+φ(k) (1.3)
[0057] The initial value is X(0)=E[X(0)]
[0058] From the system state equation (1.2), the nonlinear function h(*) is centered around the filter value Do a first-order Taylor expansion and we get
[0059]
[0060] make
[0061]
[0062]
[0063] Then the observation equation is
[0064] Z(k)=H(k)X(k)+y(k)+V(k) (1.4)
[0065] 2. Linear Kalman Filter
[0066] Applying the basic Kalman filter equation to the linearized models (1.3) and (1.4) yields the extended Kalman filter recursive equation:
[0067]
[0068] P(k+1|k)=Φ(k+1|k)P(k|k)Φ T (k+1|k)+Q(k+1) (1.6)
[0069] K(k+1)=P(k+1|k)H T (k+1)[H(k+1)P(k+1|k)H T (k+1)+R(k+1)] -1 (1.7)
[0070]
[0071] P(k+1)=[IK(k+1)H(k+1)]P(k+1|k) (1.9)
[0072] In the formula, the initial value of the filter and the initial value of the filter error variance matrix are respectively
[0073] X(0)=E[X(0)],P(0)=var[X(0)]
[0074] In the linearized system equation, the state transition Φ(k+1|k) and the observation matrix H(k+1) are replaced by the Jacobian matrix of f and h, the state variable of the application has n=2 dimensions, that is, X=[x1 x2] T Then, the corresponding Jacobian matrix is as follows:
[0075]
[0076]
[0077] The application establishes state equation and observation equation based on extended Kalman filter, realizes temperature compensation of the pressure sensor, and the process is as follows:
[0078] Step one: initialize the initial state X(0), V(0), and the covariance matrix P0;
[0079] Step two: first-order linearization state equation, solve the state transition matrix
[0080] Step three: first-order linearization observation equation, solve the observation matrix
[0081] Step four: solve the covariance matrix prediction P(k|k-1)=Φ(k)P(k-1|k-1)Φ T (k)+Q;
[0082] Step five: solve the Kalman filter gain K(k)=P(k|k-1)H T (k)(H(k)P(k|k-1)H T (k)+R);
[0083] Step six: solve the state update X(k)=X(k|k-1)+K(Y(k)-Y(k|k-1));
[0084] Step seven: covariance update P(k)=(I n -K(k)H(k))P(k|k-1);
[0085] Wherein, W(k) is process noise; V(k) is observation noise; G(k) is noise driving matrix; X(k+1) represents the state of the system at k+1 time; k represents discrete time; X(k) represents the state of the system at k time; φ(k) represents non-random external action item; Φ(k+1|k) represents state transition value; Z(k) represents observation value at k time; H(k) represents observation matrix at k time; V(k) represents observation noise; y(k) represents random sequence; Represents the filtering value at k time; Represents the state prediction value at k time; Represents the state smoothing value at k time; Represents the state filtering value at k time; P(k+1|k) represents the covariance prediction value at k+1 time; P(k|k) represents the covariance filtering value at k time; Q(k+1) represents the process noise at k+1 time; K(k+1) represents the Kalman filtering gain at k+1 time; R(k+1) represents the observation noise at k+1 time; H(k+1) represents the observation matrix at k+1 time; Represents the state filtering value at k+1 time; Represents the state prediction value at k+1 time; Z(k+1) represents the observation equation at k+1 time; P(k+1) represents the covariance at k+1 time; I represents unit matrix; I n Represents the n-order unit matrix; Φ(k+1) represents the state transition matrix at k+1 time; P(k-1|k-1) represents the covariance filtering value at k-1 time; P(k|k-1) represents the covariance matrix prediction value at k time; K(k) represents the Kalman filtering gain; Q represents the variance of process noise; R represents the variance of observation noise; Y(k) represents the observation signal at k time; Y(k|k-1) represents the prediction signal at k time.
[0086] The above seven steps are a calculation cycle for the design of an extended Kalman filter. The processing of the extended Kalman filter for a nonlinear system at each time is a process of continuous circulation of the calculation cycle, and then the parameter update of the Kalman filter is completed. The pressure parameter after temperature compensation is predicted according to the output of the extended Kalman filter after parameter update.
[0087] In order to obtain the best extended Kalman filter parameters, a myxobacteria optimization algorithm is introduced. This biological heuristic algorithm simulates the process of myxobacteria colony searching for the optimal condition in the environment, helping us to find the optimal solution in the parameter space to maximize the performance of the temperature compensation algorithm.
[0088] Approaching food stage
[0089] In the approaching food stage, myxobacteria approach food through the smell in the air, and its approaching behavior is represented by the following formula
[0090]
[0091] where X(t+1) and X(t) are the positions of slime molds at the (t+1)th and tth iterations, respectively, X b (t) represents the position with the highest food concentration (optimal position) at the tth iteration, X A (t) and X B (t) represent two randomly selected slime mold individuals at the tth iteration; the range of vb is [-a, a], a = arctanh(l-(t / T)), t is the current iteration number, and T is the maximum iteration number; the range of vc linearly decreases from 1 to 0; r is a random number between 0 and 1; p = tanh(|S(i)-DF|), where i = 1, 2, …, N, S(i) represents the fitness value of the ith slime mold individual, DF represents the optimal fitness value in all iterations, and N represents the population size of slime molds; W represents the weight of slime molds, which is calculated as
[0092]
[0093] SortIndex = sort(S) (1.3)
[0094] where condition represents the individuals whose fitness values are ranked in the first half of the population, bF and wF represent the optimal fitness value and the worst fitness value in the current iteration, respectively, and SortIndex represents the sorted fitness value sequence.
[0095] The approaching food stage updates the individual positions according to the changes in the optimal position X b and the fine-tuning of vb, vc, and W. The role of r is to form a search vector at an arbitrary angle, i.e., to search the solution space in an arbitrary direction, thereby improving the possibility of finding the optimal solution and better simulating the circular and fan-shaped structure movements of slime molds when approaching food.
[0096] The surrounding food stage
[0097] The surrounding food stage simulates the contraction mode of the venous tissue of slime molds. The higher the food concentration contacted by the veins, the stronger the propagation wave generated by the biological oscillator, and the faster the cytoplasm flows. Equation (1.2) simulates the positive and negative feedback process between the weight of slime molds and the food concentration (fitness value), and log() is used to slow down the rate of change of the value and stabilize the changes in the contraction frequency. Condition simulates the process of slime molds adjusting their positions according to the food concentration. The higher the food concentration, the greater the weight of slime molds in the region; if the food concentration is low, the slime molds will turn to search other regions, and the weight of slime molds in the region will decrease. Based on this principle, the mathematical formula for updating the positions of slime molds in this stage is
[0098]
[0099] where rand and r represent random values generated within 0 to 1, ub and lb represent upper and lower bounds of the search space respectively, z is the proportion of slime mold individuals in the total slime mold population in random distribution, and is used to switch the algorithm between the global search stage and the local search stage.
[0100] Food grabbing stage
[0101] In the food grabbing stage, the slime mold changes the cytoplasm flow rate in the vein by using the propagation wave generated by the biological oscillator, and the changes of the slime mold vein width and the biological oscillator oscillation frequency are simulated by vb, vc and W, so that the slime mold approaches the food more slowly when the food concentration is low, and approaches the food more quickly when high-quality food is found. This stage is actually the updating of the parameters vb, vc and W. The range of vb is [-a, a], a = arctanh(1-(t / T)), t is the current iteration number, and T is the maximum iteration number; the range of vc is linearly decreased from 1 to 0; and the updating of W is shown in equation (1.2).
[0102] The present application extends the real-time optimization of the Kalman filter parameters based on the implementation of the slime mold optimization algorithm, so as to maximize the performance of the temperature compensation algorithm, as shown in Figure 2 The flow is as follows:
[0103] Step 1: Set parameters, initialize the population, and calculate the fitness value.
[0104] Step 2: Calculate the slime weight W and the parameter a.
[0105] Step 3: Generate a random number r, and judge the size of the random number r and the parameter z. If r < z, update the individual position according to the first formula of equation (1.4); otherwise, update the parameters p, vb, vc, and judge the size of r and the parameter p. If r < p, update the individual position according to the second formula of equation (1.4); otherwise, update the individual position according to the third formula of equation (1.4).
[0106] Step 4: Calculate the fitness value and update the global optimal solution.
[0107] Step 5: Judge whether the end condition is met. If yes, output the global optimal solution and the fitness value; otherwise, repeat steps 2-5.
[0108] The effectiveness of the temperature compensation method was verified by simulating 1000 time steps using MATLAB. After adopting the temperature compensation algorithm based on myxobacteria optimization and extended Kalman filtering, the compensated pressure sensor output exhibited good performance. Specifically, the root mean square error (RMSE) after compensation was 0.8584, and the mean absolute error (MAE) was 0.6346. In contrast, the root mean square error (RMSE) and mean absolute error (MAE) before compensation were 5.0285 and 3.9720, respectively.
[0109] It can be seen that the temperature compensation algorithm significantly improves the performance of the pressure sensor. By reducing the error level, the compensated data is more accurate and closer to the actual pressure value, demonstrating that the algorithm designed in the present application successfully improves the accuracy and stability of the sensor. Such improvement has substantial significance for application scenarios that require high-precision pressure measurement, such as industrial control and environmental monitoring. Therefore, the temperature compensation algorithm based on myxobacteria optimization and extended Kalman filtering exhibits excellent results in improving the performance of pressure sensors.
[0110] The specific embodiments of the present application have been described above. It should be understood that the present application is not limited to the specific embodiments described above, and various modifications or changes can be made by those skilled in the art within the scope of the claims, which do not affect the essential content of the present application.
Claims
1. A pressure sensor temperature compensation method based on slime colony optimization and Kalman filtering, characterized by: It includes: The ambient temperature is monitored in real time through an external temperature sensor, and the temperature data is introduced into the system; Based on the extended Kalman filter, the state equation and the observation equation are established to achieve temperature compensation of the pressure sensor; Based on the slime mold colony optimization algorithm, the parameters of the extended Kalman filter are optimized in real time to improve the efficiency of the temperature compensation algorithm; The mathematical formula for updating the slime mold position of the slime mold colony optimization algorithm is ; Where rand represents a random value between 0 and 1, ub and lb represent the upper and lower bounds of the search space, respectively, and z is the ratio of randomly distributed slime mold individuals to the total slime mold population, which is used to switch the algorithm between the global search phase and the local search phase. and are the positions of the slime mold at t+1 and t iterations respectively, The position with the highest food concentration at the tth iteration is the optimal position, and represents two randomly selected slime mold individuals at the tth iteration; the range of vb is [-a, a], , t is the current iteration number, T is the maximum iteration number; the range of vc is linearly decreasing from 1 to 0; r is a random number between 0 and 1; , where i=1,2,…,N, represents the fitness value of the i-th slime mold individual, DF represents the optimal fitness value in all iterations, N represents the population size of the slime mold; W represents the weight of the slime mold; The working process of the slime mold colony optimization algorithm includes: Step 1: Set parameters, initialize the population, and calculate the fitness value; Step 2: Calculate the slime mold weight W and the parameter a; Step 3: Generate a random number r, compare the random number r with the parameter z. If r < z, update the individual position according to the first formula of Equation (1.4); otherwise, update the parameters p, vb, vc, compare r with the parameter p. If r < p, update the individual position according to the second formula of Equation (1.4); otherwise, update the individual position according to the third formula of Equation (1.4); Step 4: Calculate the fitness value and update the global optimal solution; Step 5: Determine whether the end condition is satisfied. If it is satisfied, output the global optimal solution and the fitness value; otherwise, repeat Steps 2 to 5.
2. The pressure sensor temperature compensation method based on slime mold optimization and Kalman filtering according to claim 1, characterized in that: The state equation is: ; Where, represents the state of the system at time k+1; Indicates the state transition value; represents the state of the system at time k; represents the non-random external effect; W(k) is the process noise, and G(k) is the noise driving matrix.
3. The pressure sensor temperature compensation method based on slime mold optimization and Kalman filtering according to claim 1, characterized in that: The observation equation is: ; Where, represents the observation value at time k; represents the observation matrix at time k; represents the state of the system at time k; represents a random sequence; represents the observation noise.
4. The pressure sensor temperature compensation method based on slime mold optimization and Kalman filtering according to claim 1, characterized in that: The working process of the extended Kalman filter includes: Step 1: Initialize the initial state X(0), V(0), and covariance matrix ; Step 2: First-order linearized state equation and solving the state transfer matrix ; Step 3: First-order linearized observation equation and solving the observation matrix ; Step 4: Calculate the covariance matrix prediction ; Step 5: Calculate the Kalman filter gain ; Step 6: Request status update ; Step 7: Covariance Update ; Where X(0) represents the state of the system at the initial time; V(0) represents the observation noise at the initial time; represents the state of the system at time k; represents the observation matrix at time k; P(k) represents the value of the covariance matrix at time k; represents the n-order unit matrix; Represents the covariance filter value at time k-1; Represents the predicted value of the covariance matrix at time k; represents the Kalman filter gain; represents the variance of process noise; represents the variance of the observation noise; represents the observation signal at time k; Represents the prediction signal at time k.
Citation Information
Patent Citations
Wearable pulse diagnosis bracelet system based on multiple pulse sensors
CN113729648A
Neural network and Kalman filtering fused optical fiber pressure sensor temperature compensation method
CN115219081A