Software time synchronization implementation method of sensor

The accumulated error of the sensor is corrected through the Kalman filtering model, which solves the sensor time synchronization problem, improves the system's time correction accuracy and overall performance of the multi-sensor system, and ensures data accuracy and reliability.

CN119311079AActive Publication Date: 2025-01-14SIMETRIC SEMICON SOLUTIONS CO LTD

Patent Information

Application Number
CN202411848719.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-16
Publication Date
2025-01-14
Estimated Expiration
2044-12-16

AI Technical Summary

Technical Problem

In multi-sensor systems, time synchronization between sensors is difficult to achieve, resulting in distortion or difficulty in integrating measurement results, affecting the accuracy and reliability of the system. Especially in applications that rely on precise timing, the accuracy of the sensor's own crystal oscillator is insufficient. This leads to the accumulation of time errors, and the existing group-based approach cannot fundamentally solve the time accuracy problem of a single sensor.

Method used

The Kalman filtering model is used to record the time data during the sensor request and response process, obtain the observed values ​​of the cumulative error, input the Kalman filtering model to estimate the cumulative error, and correct the sensor measurement time based on the estimated value to ensure time synchronization.

Benefits of technology

It improves the accuracy of time correction, reduces the impact of error on system performance, realizes time synchronization of multi-sensor systems, ensures effective integration and analysis of data on the same time reference, and improves the overall accuracy and reliability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119311079A_ABST
    Figure CN119311079A_ABST
Patent Text Reader

Abstract

The invention provides a software time synchronization implementation method of a sensor, which is applied to a scene that the sensor communicates with an SOC (System On Chip) end in a request and response mode, when the SOC end sends a request signal to the sensor, the SOC records the moment as a sensor request sending moment, and after the request signal reaches the sensor, the sensor sends the request signal to the sensor. An on-chip moment generated when recording data is obtained in a data packet obtained by the sensor, wherein the moment comprises an accumulative error caused by instability of a crystal oscillator; meanwhile, recording the response arrival time when the sensor sends the data packet to the SOC; obtaining an estimated value of the nth accumulative error by using a Kalman filtering model; according to the estimated value of the accumulative error and the on-chip moment of the nth moment, calculating to obtain a corrected sensor measurement moment; according to the invention, the time lines of the plurality of sensors and the real time line of the SOC are respectively projected, so that the time of the plurality of sensors can be corrected to the same time reference, and the time synchronization of the multi-sensor system is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of industrial communications, and in particular relates to a method for realizing software time synchronization of a sensor. Background Art

[0002] In multi-sensor integration scenarios, it is critical to ensure the time synchronization of each sensor. Time synchronization means that the internal clocks of all sensors must be consistent so that they collect data at the same time point. This synchronization ensures that the data between sensors is consistent in time, so that the multi-sensor system can correctly fuse the measurement results of each sensor. If the sensors cannot maintain time synchronization, the system will face the problem of lack of time correlation between data, which may cause distortion of measurement results or difficulty in integration, and ultimately affect the accuracy and reliability of the entire system.

[0003] For a single sensor, time accuracy is also important. Accurate timestamps not only help record the specific moment of sensor measurement, but also improve the accuracy of the measurement results. The accuracy of timestamps is directly related to the validity of data, especially in applications that require long-term monitoring or have high timing requirements. Whether it is a single sensor or a multi-sensor system, the accuracy of time management is a key factor in ensuring data quality and system performance. Therefore, when designing and implementing sensor systems, time synchronization and time management should be given priority, and effective technical means should be adopted to achieve this goal.

[0004] like Figure 1 As shown, the transmission method between the sensor and the SOC is to communicate through request and response. When the SOC needs sensor data, it sends a request signal to the sensor. The request signal includes the ID of the corresponding sensor, the content of the request, etc. After the sensor receives the request signal from the SOC, it checks whether the request is for its own data. It sends a response signal. The response signal includes the physical quantity measured by the sensor. For sensors with on-chip time, it also includes time information, but this time information is affected by the accuracy of the on-chip crystal oscillator. There may be errors. When there is an error, the error with the normal time will gradually accumulate to form a cumulative error.

[0005] In the scenario of using sensors, sensors with crystal oscillators have the function of on-chip time. A crystal oscillator is a device that controls the increase of on-chip time through a certain frequency on a semiconductor device. After the initialization time, the crystal oscillator updates the on-chip time according to the frequency to keep it synchronized with the real time. Sensors with crystal oscillators can return the time on the sensor, but they often encounter the problem of insufficient accuracy of the crystal oscillator of the sensor, which leads to errors in time updates. The errors can accumulate, causing the on-chip time to deviate from the real time, and eventually causing the timestamp on the sensor to become unreliable, making it impossible for multi-sensor systems to achieve time synchronization. This situation poses a serious threat to the overall performance of the system and the accuracy of the data, especially in applications that rely on precise timing, which may cause deviations or errors in the system.

[0006] In order to solve the problem of sensor time synchronization, a group policy-based method can be used. This is equivalent to giving up the on-chip time function on the sensor. Under this policy, the data read request is distributed according to the predetermined group, and the sensors in each group will ensure that the data read request is received within a time period and the data is collected within the same time period. Subsequently, the system will read the data returned by the sensor according to the group and stamp the data of each group with the same timestamp to indicate that the data is collected within the same time period. This method reduces the impact of individual sensor time errors on the overall system by simplifying the time synchronization problem to intra-group synchronization. However, the time obtained by this group policy-based method is approximate and can only ensure that a group of sensors occurs in a certain time period. Since the timestamp is based on the group, rather than accurate to each sensor, there may still be slight time differences between the sensors in the group. In addition, this method cannot fundamentally solve the problem of single sensor time accuracy, especially when the crystal oscillator deviation is large, the time error of a single sensor will still affect the accuracy of the data. Therefore, although the group policy can alleviate the problem of multi-sensor time synchronization to a certain extent, in applications with high precision requirements, more advanced synchronization technology or more rigorous calibration of the sensor time base is still needed. Summary of the invention

[0007] In view of the above problems, the present invention provides a method for realizing software time synchronization of a sensor, which is applied to a scenario in which a sensor and an SOC terminal communicate in a request and response manner. When the SOC terminal sends a request signal to the sensor, the SOC records the time as the time when the sensor request is sent. After the request signal reaches the sensor, the sensor returns a data packet to the SOC, which contains the on-chip time when the data was generated. , which contains the accumulated error due to the instability of the crystal oscillator; then, after the sensor sends the data packet to the SOC, the SOC records the response arrival time ; n represents the nth request and response to the sensor; the Kalman filter model is used to obtain the estimated value of the nth cumulative error, and the following process is included: S1, based on historical experimental data, obtain the initial value parameters required by the Kalman filter model; S2, obtain the observed value of the cumulative error based on the moment data obtained during the sensor request and response process; S3, inputting the observed value of the cumulative error into the Kalman filter model to obtain an estimated value of the cumulative error; S4, calculate the corrected sensor measurement time based on the estimated value of the cumulative error and the on-chip time at the nth time .

[0008] Preferably, the initial value parameters required for the Kalman filter model are obtained in S1, specifically including: Return the obtained time data based on multiple requests in the experimental data, and obtain the growth rate of the cumulative error , Always equal to the initial value; Based on multiple experimental data, multiple cumulative error observation data are obtained, and the covariance of the cumulative error observations is obtained based on these data. ; Based on multiple experimental data, multiple cumulative error prediction values ​​are obtained, and the initial value of the covariance of the cumulative error prediction is obtained based on these data. ; The initial value of the cumulative error is set to 0, that is, =0.

[0009] Preferably, in S2, the cumulative error observation value is obtained , calculated by the following formula:

[0010] in It is the nth on-film moment; is the sensor response arrival time; is the time when the sensor requests to be sent.

[0011] Preferably, the specific process of S3 is: S31, based on the speed obtained Construct a physical model, that is, construct a state transfer equation for prediction. The formula of the state transfer equation is:

[0012] in, It is the predicted value of the cumulative error for the nth time based on the estimated value of the cumulative error for the n-1th time; is the cumulative error estimate for the n-1th time; It is the difference between the on-chip time at the nth time and the time at the n-1th time, that is:

[0013] in, It is the nth on-film moment; Among them, the state transition equation of the prediction covariance is:

[0014] in, It is the extrapolation of the n-th prediction covariance based on the n-1-th prediction covariance estimate; is the estimated value of the forecast covariance at time n-1; S32, the cumulative error estimate of the Kalman filter when the sensor is requested for the n-1th time , and, the state transfer equation obtained, the predicted value of the cumulative error at time n is obtained :

[0015] in, It is the predicted value of the nth time based on the cumulative error estimate of the n-1th time; is the cumulative error estimate for the n-1th time; is the difference between the on-chip time at the nth time and the n-1th time; S33, according to the predicted covariance transfer matrix:

[0016] in, It is the extrapolation of the n-th prediction covariance based on the n-1-th prediction covariance estimate; S34, calculated based on as well as Calculate the nth Kalman gain :

[0017] in represents the nth Kalman gain, It is the extrapolation of the n-th prediction covariance based on the n-1 prediction covariance estimate. is the observed covariance of the cumulative error observations; S35, according to the obtained Kalman gain And the cumulative error prediction value at time n of the cumulative error Get the n-th cumulative error estimate :

[0018] in, It is the cumulative error prediction value of the nth time through the cumulative error estimation value of n-1 times; is the cumulative error observation; represents the nth Kalman gain; S36, according to the obtained Kalman gain And the n-1 prediction covariance estimate is used to extrapolate the n-th prediction covariance Get the nth prediction covariance estimate :

[0019] in It is the extrapolation of the n-th prediction covariance by the n-1 prediction covariance estimate. represents the nth Kalman gain.

[0020] Preferably, the specific process in S4 is: According to the n-th cumulative error estimate calculated in S3 , and the nth on-chip time, the corrected sensor measurement time is obtained :

[0021] in is the nth on-chip time; is the n-th cumulative error estimate.

[0022] Compared with the prior art, the present invention has the following beneficial effects: The present invention provides a method for realizing software time synchronization of a sensor. As time goes by, by continuously updating the covariance matrix in the Kalman filter, the algorithm gradually converges, making the error estimate closer to the actual difference between the sensor time and the NTP network time. This convergence effect not only improves the accuracy of time correction, but also reduces the impact of the error on the overall performance of the system, ensuring that the sensor time can stably reflect the actual time.

[0023] During the calibration process of a single sensor, Kalman filtering can effectively correct the time deviation caused by sensor error. However, in a multi-sensor system, since the time error of each sensor may be different, the time synchronization problem is more complicated. In order to solve this problem, the time lines of multiple sensors are projected with the real time line of the SOC respectively through the method of the present invention. Through this projection, the time of multiple sensors can be corrected to the same time base, thereby realizing the time synchronization of the multi-sensor system. This synchronization not only helps to improve the overall accuracy and reliability of the system, but also ensures that the data of different sensors can be effectively integrated and analyzed on the same time base in complex application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 Schematic diagram of the transmission method between the sensor and SOC.

[0025] Figure 2 This is a timing diagram of the communication between the sensor and the SOC.

[0026] Figure 3 It is a schematic diagram of the overall framework of the present invention.

[0027] Figure 4 This is a schematic diagram of the specific implementation process of the Kalman filter algorithm. DETAILED DESCRIPTION

[0028] Combination Figure 2 , the principle of the present invention is explained: Ts: sensor request sending time; T2: the time when the request signal arrives at the sensor; T3: the time when the response signal sensor returns; Tr: sensor response arrival time; t1: request transmission time; t2: the time period during which sensor data may occur; t3: response transmission time; pn solid line box: represents the nth request packet; pn dotted box: represents the nth response packet.

[0029] The two times obtained on the time axis TL1 considered accurate by the data acquisition unit SOC: the sending time of the sending request , received to the return receiving time , Will The time is regarded as the time when the sampling actually occurs on the sensor; The sensor measures the time axis TL2 with error and records the sampling time during sampling. ; and Difference It is the difference between the returned sampling time and the actual sampling time, that is, the error between the time axis TL1 and the time axis TL2; The focus of the present invention is on how to use Kalman filtering to dynamically predict the time when sampling actually occurs.

[0030] The core idea of ​​Kalman filtering is to predict the next state based on the current state and correct the prediction result through the measurement value to obtain the best state estimation. It assumes that the system and the measurement process satisfy the linear Gaussian distribution, that is, the system noise and the measurement noise are both subject to normal distribution.

[0031] The Kalman filter is a recursive algorithm that does not require the storage of large amounts of historical data, making it suitable for real-time systems. It can effectively combine prediction and measurement information to provide better state estimates in the presence of noise. The Kalman filter is the optimal state estimation algorithm when the linear and Gaussian noise assumptions are met. Therefore, the Kalman filter is a method for handling noise errors in real-time systems and is the optimal estimate in linear systems.

[0032] Kalman filtering can work well in linear systems, but from previous data, the experimental results show that the measurement time increases linearly, and the difference between the measurement time and the time used for calibration SOC It also grows linearly. In order to facilitate processing and reduce the complexity of calculation and theory, we decided to use time deviation The Kalman filter processes variables instead of directly processing time.

[0033] If you want the data processed by Kalman filtering to be more accurate, you need to pay attention to three points: The system is linear; The noise distribution satisfies the Gaussian distribution; The preset system model is as accurate as possible; In order to make the predicted values ​​obtained by Kalman filtering more accurate, it is necessary to determine the initial conditions of the Kalman filter and verify the accuracy of the model through experiments.

[0034] In addition, there is another very important initial condition in the Kalman filter application, which is the initial state and the initial covariance matrix. There are several ways to evaluate the initial state and the initial covariance matrix: 1. Set according to prior knowledge; 2. Initialization through system observation; 3. Estimated by the average value during the stationary phase; 4. Use training data for estimation; 5. Initialization using Bayesian method; 6. Gradual Convergence Method (Warm-up Phase); In the above way, all the prerequisites for using Kalman filtering are completed, the system is transformed into a linear system, and the system model and initial state are determined through experiments or other methods.

[0035] The method of the present invention is further described below in conjunction with specific embodiments.

[0036] Embodiment 1: like Figure 3 As shown, the implementation method of the present invention is: when the SOC sends a request signal to the sensor, the SOC records the time as the sensor request sending time After the request signal reaches the sensor, the sensor obtains the on-chip time generated when recording data in the data packet This moment includes the cumulative error caused by the instability of the crystal oscillator; at the same time, the response arrival time of the sensor sending the data packet to the SOC is recorded ; n represents the nth request and response to the sensor; the Kalman filter model is used to obtain the estimated value of the nth cumulative error, and the following process is included: S1, based on historical experimental data, obtain the initial value parameters required by the Kalman filter model; S2, obtain the observed value of the cumulative error based on the moment data obtained during the sensor request and response process; S3, inputting the observed value of the cumulative error into the Kalman filter model to obtain an estimated value of the cumulative error; S4, calculate the corrected sensor measurement time based on the estimated value of the cumulative error and the on-chip time at the nth time .

[0037] The specific implementation method is as follows Figure 4 As shown: In this embodiment, the initial value of the cumulative error speed is obtained according to the time data obtained by returning multiple requests in the experimental data. In this example, no Kalman filter is used to filter Any adjustment will result in cumulative error speed Always equal to the initial value ; Based on multiple experimental data, multiple cumulative error observation data are obtained, and the covariance of the cumulative error observations is obtained based on these data. ; Based on multiple experimental data, multiple cumulative error prediction values ​​are obtained, and the initial value of the predicted covariance of the cumulative error is obtained based on these data. ; The initial value of the cumulative error is set to 0, that is, =0.

[0038] The specific method of S1 is: First, the sensor was tested several times to obtain multiple sets of returned time data ( , , ); Through the two data Divide the difference of the network time by the difference of the network time to obtain the initial value of the cumulative delay speed ; Calculate multiple experiments Variance ,as well as The initial value of the forecast covariance .

[0039] The specific method of S2 is: When the SOC sends a request to the sensor for the nth time, the time is recorded as , when receiving the sensor response data, record the time as , and according to the information of the data packet returned by the sensor, according to the formula:

[0040] Conclusion value; The specific methods of S3 are: According to the output of the algorithm at the n-1th time, and , and the time interval between n and n-1 times, according to the formula:

[0041] Obtain the nth cumulative error prediction value.

[0042] The estimated value of the prediction covariance matrix when the prediction covariance matrix extrapolation remains unchanged equal to n-1 times:

[0043] The Kalman gain is calculated based on the prediction covariance matrix extrapolation and the observation covariance matrix:

[0044] According to the obtained Kalman gain And the nth cumulative error prediction value Get the n-th cumulative error estimate :

[0045] According to the obtained Kalman gain , and the n-1 observation covariance estimate is used to extrapolate the nth observation covariance Get the nth prediction covariance estimate :

[0046] In this example, the specific method of S4 is: According to the on-chip time of the sensor data at the time of the nth measurement, the corrected sensor measurement time is obtained .

[0047]

[0048] in is the on-chip time when the nth sensor data is generated; is the estimated value of the cumulative error at the nth time.

[0049] Embodiment 2: In this embodiment, the other processes are the same as those in Embodiment 1, except that in Embodiment 1, the speed is in an absolutely constant state, but there are cases where the initial speed measurement is inaccurate or the running speed changes in the experiment. Adding the cumulative error speed variable to the Kalman filter and relying on the Kalman filter to converge the cumulative error speed can capture a more accurate cumulative delay speed. In form, the variables become multivariables, i.e., vectors, and the operation method becomes a matrix operation.

[0050] Return the obtained time data according to multiple requests in the experimental data, and obtain the initial value of the cumulative error speed , cumulative error speed The Kalman filter will be continuously updated iteratively; Based on multiple experimental data, multiple cumulative error observation data are obtained, and the observation covariance matrix is ​​calculated based on these data. ;

[0051] in is the variance of the accumulated error observations, is the on-chip moment at the nth and n-1th times The difference.

[0052] Based on multiple experimental data, multiple cumulative error prediction values ​​are obtained, and the initial value of the prediction covariance matrix of the cumulative error is obtained based on these data. ;

[0053] in is the cumulative error forecast variance, is the on-chip moment at the nth and n-1th times The difference.

[0054] In this embodiment, in S2, the cumulative error observation value is obtained , calculated by the following formula:

[0055] in It is the nth on-film moment; is the sensor response arrival time; is the time when the sensor request is sent; Observed value of cumulative error velocity :

[0056] is the n-1th cumulative error estimate; is the on-chip moment at the nth and n-1th times The difference. is the cumulative error observation.

[0057] State Vector From the above two , Consists of.

[0058]

[0059] In this embodiment, the specific process of S3 is: S31, based on the speed obtained Construct a state transfer matrix for prediction. The state transfer matrix F is:

[0060] The state transfer equation is:

[0061] in, is the predicted value of the nth state vector through the estimated value of the n-1th state vector; F is the state transfer matrix, is the estimated value of the state vector for the n-1th time; is the on-chip moment of the nth and n-1th times The difference, that is:

[0062] in, It is the nth on-film moment; Among them, the state transition equation of the prediction covariance is:

[0063] in, The n-th prediction covariance matrix is ​​extrapolated by the n-1 prediction covariance matrix estimate; is the estimated value of the prediction covariance matrix for the n-1th time; S32, the state vector estimation value of the Kalman filter when the sensor is requested for the n-1th time , and, the state transfer equation obtained, obtain the nth state vector prediction value :

[0064] in, is the predicted value of the nth state vector through the estimated value of the n-1th state vector; F is the state transfer matrix, is the estimated value of the state vector for the n-1th time; is the on-chip moment at the nth and n-1th times The difference between S33, according to the covariance transfer matrix:

[0065] in, The n-th prediction covariance matrix is ​​extrapolated by the n-1 prediction covariance matrix estimate; S34, calculated according to as well as Calculate the Kalman gain:

[0066] in represents the nth Kalman gain, The n-th prediction covariance matrix is ​​extrapolated by the n-1-th prediction covariance estimate. is the observation covariance matrix; S35, according to the obtained Kalman gain And the nth state vector prediction value Get the n-th state vector estimate :

[0067] in, It is the predicted value of the nth state vector through the estimated value of the n-1th state vector; is the observed value of the state vector; represents the nth Kalman gain; S36, according to the obtained Kalman gain And the n-1 prediction covariance estimate is used to extrapolate the n-th prediction covariance Get the nth prediction covariance estimate :

[0068] in It is the extrapolation of the n-th prediction covariance matrix through the n-1 prediction covariance matrix estimation. represents the nth Kalman gain; E is the identity matrix.

[0069] In this example, the specific method of S4 is: According to the on-chip time of the sensor data at the time of the nth measurement, the corrected sensor measurement time is obtained .

[0070]

[0071] in is the nth on-chip time; is the nth estimated value of the state vector, which exists in the state vector middle.

[0072] Embodiment 3: In this embodiment, the other processes are the same as those in Embodiment 2, except that in Embodiment 2, the speed is in a uniform state, and the speed of the accumulated error will not increase or decrease all the time. This example proposes a solution to the situation where the speed of the accumulated error changes according to a certain trend, which is called an acceleration model. In terms of form, the variables become multivariables, i.e., vectors, and the operation method becomes a matrix operation.

[0073] Return the obtained time data based on multiple requests in the experimental data and obtain the cumulative error speed , and the initial value of the accumulated error acceleration , cumulative error speed Acceleration with cumulative error The Kalman filter will be continuously updated iteratively; Based on multiple experimental data, multiple cumulative error observation values ​​are obtained, and the cumulative error observation covariance matrix is ​​calculated based on these data. ;

[0074] in is the variance of the accumulated error observations, is the on-chip moment at the nth and n-1th times The difference.

[0075] Based on multiple experimental data, multiple cumulative error prediction value data are obtained, and the initial value of the cumulative error prediction covariance is obtained based on these data. ;

[0076] in is the variance of the cumulative error forecast, is the on-chip moment at the nth and n-1th times The difference.

[0077] In this embodiment, in S2, the cumulative error observation value is obtained , calculated by the following formula:

[0078] in is the nth on-chip moment; is the sensor response arrival time; is the time when the sensor request is sent; Observed value of cumulative error velocity :

[0079] is the algorithm estimate for the n-1th time; is the on-chip moment at the nth and n-1th times The difference. is the cumulative error observation.

[0080] Observed value of the accumulated error acceleration :

[0081] is the estimated value of the cumulative delay speed algorithm for the n-1th time; is the on-chip moment at the nth and n-1th times The difference. is the nth cumulative delayed speed observation value.

[0082] State Vector From the above three , , Consists of.

[0083]

[0084] In this embodiment, the specific process of S3 is: S31, based on the accumulated error speed obtained And the accumulated error acceleration Construct a state transfer matrix for prediction. The state transfer matrix F is:

[0085] The state transfer equation is:

[0086] in, is the predicted value of the nth state vector through the n-1th estimated value; F is the state transfer matrix, is the estimated value of the state vector for the n-1th time; is the on-chip moment of the nth and n-1th times The difference, that is:

[0087] in, It is the nth on-film moment; Among them, the state transition equation of the prediction covariance is:

[0088] in, The n-th prediction covariance matrix is ​​extrapolated by the n-1 prediction covariance matrix estimate; is the estimated value of the prediction covariance matrix for the n-1th time; S32, the state vector estimation value of the Kalman filter when the sensor is requested for the n-1th time , and, the state transfer equation obtained, the predicted value of the nth state vector is obtained :

[0089] in, is the predicted value of the nth state vector through the estimated value of the n-1th state vector; F is the state transfer matrix, is the estimated value of the state vector for the n-1th time; is the on-chip moment at the nth and n-1th times The difference between S33, obtain the covariance transfer matrix according to the physical model:

[0090] in, The n-th prediction covariance matrix is ​​extrapolated by the n-1-th prediction covariance matrix estimate; S34, calculated according to And the observation covariance matrix Calculate the Kalman gain:

[0091] in represents the nth Kalman gain, It is the extrapolation of the n-th prediction covariance matrix by the n-1-th prediction covariance estimate. is the cumulative error observation covariance matrix; S35, according to the obtained Kalman gain And the cumulative error prediction value of the nth time Get the n-th cumulative error estimate :

[0092] in, It is the predicted value of the nth state vector through the estimated value of the n-1th state vector; is the cumulative error observation; represents the nth Kalman gain; S36, according to the obtained Kalman gain And the n-1th prediction covariance estimate is used to extrapolate the nth prediction covariance Get the nth prediction covariance estimate :

[0093] in The n-th prediction covariance matrix is ​​estimated by extrapolating the n-th prediction covariance matrix. represents the nth Kalman gain; E is the identity matrix.

[0094] In this embodiment, the specific method of S4 is: According to the on-chip time of the sensor data at the time of the nth measurement, the corrected sensor measurement time is obtained .

[0095]

[0096] in is the on-chip time when the nth sensor data is generated; is the estimated value of the n-th cumulative error, which exists in the state vector middle.

[0097] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

[0098] Although the above describes the specific implementation methods of the present invention, it is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art on the basis of the technical solution of the present invention without creative work are still within the scope of protection of the present invention.

Claims

1. A method for implementing software time synchronization of a sensor, characterized in that: Applicable to scenarios where sensors and SOCs communicate through requests and responses. When the SOC sends a request signal to the sensor, the SOC records the time as the time the sensor request is sent. After the request signal reaches the sensor, the sensor returns a data packet to the SOC, which contains the on-chip time when the data was generated. , which contains the accumulated error due to the instability of the crystal oscillator; then, after the sensor sends the data packet to the SOC, the SOC records the response arrival time ; n represents the nth request and response to the sensor; the Kalman filter model is used to obtain the estimated value of the nth cumulative error, and the following process is included: S1, based on historical experimental data, obtain the initial value parameters required by the Kalman filter model; S2, obtain the accumulated error observation value based on the moment data obtained during the sensor request and response process; S3, inputting the Kalman filter model according to the accumulated error observation value to obtain the accumulated error estimate value; S4, calculate the corrected sensor measurement time based on the estimated value of the cumulative error and the on-chip time at the nth time .

2. A method for implementing software time synchronization of a sensor as claimed in claim 1, characterized in that: The initial value parameters required for the Kalman filter model are obtained in S1, specifically including: Return the obtained time data according to multiple requests in the experimental data, and obtain the initial value of the cumulative error speed , cumulative error speed Always equal to the initial value ; Based on multiple experimental data, multiple cumulative error observation data are obtained, and the observed covariance of the cumulative error is obtained based on these data. ; Based on multiple experimental data, multiple cumulative error prediction values ​​are obtained, and the initial value of the predicted covariance of the cumulative error is obtained based on these data. ; The initial value of the accumulated error is set to 0, that is, =0.

3. The method for implementing software time synchronization of a sensor according to claim 1, characterized in that: In S2, the cumulative error observation value is obtained , calculated by the following formula: in It is the nth on-film moment; is the sensor response arrival time; is the time when the sensor requests to be sent.

4. A method for implementing software time synchronization of a sensor as claimed in claim 2, characterized in that: The specific process of S3 is as follows: S31, based on the accumulated error speed obtained Construct a physical model, that is, construct a state transfer equation, which is used to predict the cumulative error. The state transfer equation formula is: in, It is the predicted value of the nth cumulative error based on the estimated value of the n-1th cumulative error; is the n-1th cumulative error estimate; It is the difference between the on-chip time at the nth time and the time at the n-1th time, that is: in, is the nth on-chip moment; Among them, the state extrapolation equation of covariance is: in, It is the extrapolation of the n-th prediction covariance based on the n-1-th prediction covariance estimate; is the estimated value of the forecast covariance at time n-1; S32, based on the cumulative error estimate of the Kalman filter when the sensor is requested for the n-1th time , and, the obtained state transfer equation, obtain the nth cumulative error prediction value : in, It is the prediction of the nth cumulative error based on the n-1th cumulative error estimate; is the n-1th cumulative error estimate; is the difference between the on-chip time at the nth time and the n-1th time, is the cumulative error velocity; S33, according to the predicted covariance transfer matrix: in, It is the extrapolation of the n-th prediction covariance based on the n-1-th prediction covariance estimate; S34, calculated according to as well as Calculate the Kalman gain: in represents the nth Kalman gain, It is the extrapolation of the n-th prediction covariance by the n-1 prediction covariance estimate. is the observation covariance; S35, according to the obtained Kalman gain And the predicted value of the cumulative error at time n of the cumulative error Get the n-th cumulative error estimate : in, It is the predicted value of the nth cumulative error through the n-1th cumulative error estimate; is the nth cumulative error observation; represents the nth Kalman gain; S36, according to the obtained Kalman gain And the n-1 prediction covariance estimate is used to extrapolate the n-th prediction covariance Get the nth prediction covariance estimate : in It is the extrapolation of the n-th prediction covariance by the n-1 prediction covariance estimate. represents the nth Kalman gain.

5. The method for realizing software time synchronization of a sensor according to claim 1, characterized in that: The specific process in S4 is: According to the n-th cumulative error estimate calculated in S3 , and the nth on-chip moment , and the corrected sensor measurement time is obtained : in is the nth on-chip time; is the n-th cumulative error estimate.

Citation Information

Patent Citations

  • Timestamp-free synchronous clock parameter tracking method based on extended Kalman filtering

    CN113438045A

  • Kalman filtering time synchronization method and device based on virtual adjoint clock

    CN116131986A

  • Improved self-adaptive robust Kalman filtering algorithm and system for single-frequency GNSS / MEMS-IMU / odometer low-power-consumption real-time integrated navigation

    CN116150565A

  • Low-cost embedded GNSS / INS (Global Navigation Satellite System / Inertial Navigation System) integrated navigation time synchronization algorithm

    CN116295436A

  • Virtual synchronous machine parameter identification method based on Kalman filtering

    CN118412924A

Cited By

  • Accumulated time error prediction method based on time window LSTM model

    CN119558348A

  • A cumulative time error prediction method based on time window LSTM model

    CN119558348B