Precise Modeling Method and Device for Frequency Drift of RTC Clock Chip Based on GNSS Clock Error Data
By using GNSS clock difference data for time synchronization and neural network model training, the problem of frequency drift of RTC clock chip is solved, and accurate time measurement and independent timing are realized in complex environments.
Patent Information
- Application Number
- CN202510480360.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-17
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2045-04-17
AI Technical Summary
The frequency drift problem of existing RTC clock chips leads to insufficient time measurement accuracy, existing calibration methods cannot cope with complex influencing factors, and the modeling method is insufficient in terms of data accuracy and model adaptability, which affects the ability to teach independently.
Time synchronization is performed using GNSS clock difference data, frequency difference value sequence is calculated, and frequency drift value of RTC clock chip is trained and predicted through neural network model to achieve accurate modeling.
The accurate prediction of RTC clock chip frequency drift is realized without GNSS navigation signal, which improves the accuracy of time measurement and independent timing capabilities.
Smart Images

Figure CN119987487B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of positioning technology, and in particular, to a method and device for accurately modeling the frequency drift of an RTC clock chip based on GNSS clock difference data. Background Art
[0002] Real Time Clock (RTC) chips play a crucial role in many electronic devices, but there is a problem of frequency drift, which affects the accuracy of time measurement. Existing calibration methods have limitations. Traditional manual calibration or simple temperature compensation models cannot cope with complex influencing factors, and existing modeling methods are insufficient in terms of data accuracy and model adaptability, resulting in poor autonomous timing ability of RTC clock chips. With the wide application of GNSS, its high-precision timing service provides a new way to solve the frequency drift problem of RTC clock chips. Using GNSS signals to accurately model the frequency drift of RTC clock chips can effectively improve the autonomous timing ability of RTC clock chips. Summary of the Invention
[0003] Based on this, it is necessary to provide a method and device for accurately modeling the frequency drift of an RTC clock chip based on GNSS clock difference data to solve the above technical problems.
[0004] A method for accurately modeling the frequency drift of an RTC clock chip based on GNSS clock difference data, the method comprising:
[0005] Receiving GNSS clock difference data and reading RTC clock chip data at a preset interval, and synchronizing the RTC clock chip data with the GNSS clock difference data;
[0006] Calculating a frequency difference sequence according to the GNSS clock difference data and the RTC clock chip data within a preset time window;
[0007] Using the GNSS clock difference data and the RTC clock chip data as input samples of a pre-constructed neural network model, and using the frequency difference sequence as an output label to train the neural network model to obtain a trained neural network model;
[0008] Inputting real-time RTC clock chip data into the trained neural network model to output a current RTC clock chip frequency drift prediction value.
[0009] In one embodiment, it further includes: receiving GNSS satellite signals through a GNSS receiver, and obtaining GNSS clock offset data by parsing the GNSS satellite signals, or receiving GNSS satellite signals through a GNSS receiving module built in the user terminal, and obtaining GNSS clock offset data by parsing the GNSS satellite signals; on the user terminal, reading the count value and timestamp of the RTC clock chip at preset intervals through a pre-installed data acquisition program to obtain RTC clock chip data.
[0010] In one embodiment, it further includes: synchronizing the timestamp of the RTC clock chip data based on the GNSS time of the GNSS clock offset data.
[0011] In one embodiment, the neural network model is a multi-layer perceptron structure.
[0012] In one embodiment, it further includes: using the GNSS clock offset data, RTC clock chip data, and environmental data as input samples of a pre-built neural network model.
[0013] In one embodiment, it further includes: associating the environmental data with the frequency difference sequence and using it as the feature of the input sample.
[0014] In one embodiment, it further includes: adjusting the RTC clock chip according to the current predicted value of the RTC clock chip frequency drift.
[0015] An RTC clock chip frequency drift precise modeling device based on GNSS clock offset data, the device includes:
[0016] A data acquisition module, configured to receive GNSS clock offset data and read RTC clock chip data at preset intervals, and synchronize the RTC clock chip data using the GNSS clock offset data;
[0017] A frequency difference sequence calculation module, configured to calculate a frequency difference sequence according to the GNSS clock offset data and RTC clock chip data within a preset time window,
[0018] A model training module, configured to use the GNSS clock offset data and RTC clock chip data as input samples of a pre-built neural network model, and use the frequency difference sequence as the output label to train the neural network model to obtain a trained neural network model;
[0019] A prediction module, configured to input real-time RTC clock chip data into the trained neural network model and output the current predicted value of the RTC clock chip frequency drift.
[0020] A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0021] Receive GNSS clock offset data and read RTC clock chip data at a preset interval, and use the GNSS clock offset data to synchronize the time of the RTC clock chip data;
[0022] Within a preset time window, calculate a frequency difference sequence according to the GNSS clock offset data and the RTC clock chip data;
[0023] Take the GNSS clock offset data and the RTC clock chip data as input samples of a pre-constructed neural network model, and use the frequency difference sequence as the output label to train the neural network model to obtain a trained neural network model;
[0024] Input the real-time RTC clock chip data into the trained neural network model to output the predicted frequency drift value of the current RTC clock chip.
[0025] A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0026] Receive GNSS clock offset data and read RTC clock chip data at a preset interval, and use the GNSS clock offset data to synchronize the time of the RTC clock chip data;
[0027] Within a preset time window, calculate a frequency difference sequence according to the GNSS clock offset data and the RTC clock chip data;
[0028] Take the GNSS clock offset data and the RTC clock chip data as input samples of a pre-constructed neural network model, and use the frequency difference sequence as the output label to train the neural network model to obtain a trained neural network model;
[0029] Input the real-time RTC clock chip data into the trained neural network model to output the predicted frequency drift value of the current RTC clock chip.
[0030] The above method and device for accurately modeling the frequency drift of an RTC clock chip based on GNSS clock difference data, in the model training stage, receive GNSS clock difference data and read RTC clock chip data at a preset interval, use the GNSS clock difference data to synchronize the time of the RTC clock chip data, and within a preset time window, calculate a frequency difference sequence based on the GNSS clock difference data and the RTC clock chip data. Take the GNSS clock difference data and the RTC clock chip data as input samples of a pre-constructed neural network model, and the frequency difference sequence as the output label, and train the neural network model to obtain a trained neural network model. Then in the real-time prediction stage, input the real-time RTC clock chip data into the trained neural network model to output the current predicted value of the RTC clock chip frequency drift. It can achieve accurate prediction of the RTC clock chip frequency drift without GNSS navigation signals. Description of the Drawings
[0031] Figure 1 It is a schematic flowchart of a method for accurately modeling the frequency drift of an RTC clock chip based on GNSS clock difference data in an embodiment;
[0032] Figure 2 It is a structural block diagram of a device for accurately modeling the frequency drift of an RTC clock chip based on GNSS clock difference data in an embodiment;
[0033] Figure 3 It is an internal structure diagram of a computer device in an embodiment. Detailed Embodiments
[0034] In order to make the objectives, technical solutions, and advantages of this application clearer, the following further elaborates on this application in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not used to limit this application.
[0035] In one embodiment, as Figure 1 shown, a method for accurately modeling the frequency drift of an RTC clock chip based on GNSS clock difference data is provided, including the following steps:
[0036] Step 102, receive GNSS clock difference data and read RTC clock chip data at a preset interval, and use the GNSS clock difference data to synchronize the time of the RTC clock chip data.
[0037] Step 104, within a preset time window, calculate a frequency difference sequence based on the GNSS clock difference data and the RTC clock chip data.
[0038] Step 106, take the GNSS clock difference data and the RTC clock chip data as input samples of a pre-constructed neural network model, and the frequency difference sequence as the output label, and train the neural network model to obtain a trained neural network model.
[0039] Step 108: Input the real-time RTC clock chip data into the trained neural network model, and output the predicted frequency drift value of the current RTC clock chip.
[0040] In the above method for accurately modeling the frequency drift of the RTC clock chip based on GNSS clock error data, during the model training stage, GNSS clock error data and RTC clock chip data are read at a preset interval. The RTC clock chip data is time-synchronized using the GNSS clock error data. Within a preset time window, the frequency difference sequence is calculated based on the GNSS clock error data and the RTC clock chip data. The GNSS clock error data and the RTC clock chip data are used as input samples for the pre-constructed neural network model, and the frequency difference sequence is used as the output label to train the neural network model to obtain the trained neural network model. Then, during the real-time prediction stage, the real-time RTC clock chip data is input into the trained neural network model to output the predicted frequency drift value of the current RTC clock chip. Accurate prediction of the frequency drift of the RTC clock chip can be achieved without a GNSS navigation signal.
[0041] In one embodiment, the GNSS satellite signal is received by a GNSS receiver, and the GNSS clock error data is obtained by parsing the GNSS satellite signal, or the GNSS satellite signal is received by the built-in GNSS receiving module of the user terminal, and the GNSS clock error data is obtained by parsing the GNSS satellite signal; on the user terminal, the count value and timestamp of the RTC clock chip are read at a preset interval through a pre-installed data acquisition program to obtain the RTC clock chip data.
[0042] Specifically, the preset interval can be flexibly adjusted according to the chip characteristics within 1 - 10 minutes.
[0043] In one embodiment, it is also necessary to perform cleaning and screening operations on the obtained GNSS clock error data and RTC clock chip data. Specifically, an intelligent algorithm is used to remove outliers and error data caused by signal interference, equipment failures, etc. according to the set data threshold and anomaly detection rules. For example, records that are significantly deviated from the normal data range or have data jumps are excluded.
[0044] In addition, a high-precision time synchronization algorithm can be used to synchronize the timestamp of the RTC clock chip data based on the GNSS time of the GNSS clock error data to ensure a high degree of consistency between the two on the time axis.
[0045] In one embodiment, environmental data can also be introduced as a feature of the input sample to analyze the frequency drift caused by environmental factors. Specifically, methods such as multiple regression analysis are used to associate with the frequency difference sequence to extract frequency drift characteristics.
[0046] In another embodiment, the neural network model has a multi-layer perceptron structure.
[0047] Specifically, the number of input layer nodes of the neural network model is determined according to the input features. For example, GNSS clock error data, RTC clock chip data, and environmental factor data (if any) are used as input features. If there are n features in total, the number of input layer nodes is n. The hidden layer is set with 2 - 3 layers, and the number of its nodes is fine-tuned according to an empirical formula (such as according to the number of input layer nodes m and the number of output layer nodes p, the number of intermediate hidden layer nodes can be set to around) and combined with the actual training effect. The number of output layer nodes is 1, which is used to output the predicted frequency drift value of the RTC clock chip.
[0048] In addition, before the data is input into the model, preprocessing operations need to be performed on the input data. First, a normalization method (such as min-max normalization or z-score standardization) is used to map the data to a specific interval (such as [-1, 1] or [0, 1]) to improve the training efficiency and stability of the neural network. If there is environmental factor data (such as temperature, humidity, etc.), it is combined with data such as the frequency difference sequence. For example, new feature vectors are generated through mathematical operations such as multiplying the temperature by the frequency difference to enrich the information content of the input data.
[0049] Then, the preprocessed dataset is divided into a training set, a validation set, and a test set according to a certain ratio (such as 70% for training, 15% for validation, and 15% for testing). The mean squared error (MSE) function is selected as the loss function, and a stochastic gradient descent method and its variants (such as Adagrad, Adadelta, Adam, etc.) optimization algorithm are used to adjust the model weights and biases. A suitable learning rate is set (the initial learning rate can be between 0.001 - 0.1, and learning rate decay strategies such as exponential decay or step decay are adopted according to the training situation). At the same time, L2 regularization (the regularization parameter is adjusted according to the model complexity) and Dropout technology (the Dropout probability is between 0.2 - 0.5) are used to prevent overfitting, and the model is deeply trained. During the training process, distributed computing and parallel processing are supported to improve the training efficiency.
[0050] During the training process, every certain number of rounds (such as every 5 - 10 rounds), the model is evaluated using the validation set. Calculate metrics such as the loss value, accuracy, F1 value, and recall rate on the validation set, and observe whether there is overfitting or underfitting in the model. If the validation set loss value no longer decreases or starts to increase, it indicates that the model may be overfitting. At this time, the training can be terminated in advance or further optimization measures can be taken, such as adjusting the regularization parameter, reducing the number of hidden layer nodes or layers, etc.
[0051] Compare the model prediction results with the actually measured frequency drift data of the RTC clock chip in detail. Calculate error metrics such as the mean squared error (MSE), mean absolute error (MAE), and root mean squared error (RMSE), and draw intuitive graphs such as the error distribution histogram and scatter plot to deeply analyze the distribution law and characteristics of the prediction error. According to the evaluation and verification results, finely adjust and optimize the model to ensure that the model performance meets the high-precision requirements of actual applications.
[0052] Finally, on the user terminal device, obtain the current data of the RTC clock chip in real time, input it into the model that has been strictly trained and verified, and use the powerful prediction ability of the model to quickly and accurately predict the frequency drift value of the RTC clock chip at the current moment. According to the predicted frequency drift value, adjust the key parameters such as the clock frequency and count value of the RTC clock chip in real time to achieve precise compensation and calibration of the frequency drift, significantly improve the time measurement accuracy of the RTC clock chip, and enable it to maintain stable and reliable performance in various complex environments.
[0053] It should be understood that although Figure 1 each step in the flowchart of Figure 1 is shown sequentially according to the indication of the arrow, these steps are not necessarily executed sequentially in the order indicated by the arrow. Unless otherwise clearly stated in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover,
[0054] In one embodiment, as Figure 2 shown, a device for accurately modeling the frequency drift of an RTC clock chip based on GNSS clock error data is provided, including: a data acquisition module 202, a frequency difference sequence calculation module 204, a model training module 206, and a prediction module 208, where:
[0055] The data acquisition module 202 is configured to receive GNSS clock error data and read RTC clock chip data at a preset interval, and perform time synchronization on the RTC clock chip data by using the GNSS clock error data;
[0056] The frequency difference sequence calculation module 204 is configured to calculate a frequency difference sequence according to the GNSS clock error data and RTC clock chip data within a preset time window;
[0057] The model training module 206 is configured to use the GNSS clock error data and the RTC clock chip data as input samples of a pre-constructed neural network model, and use the frequency difference sequence as the output label to train the neural network model, so as to obtain a trained neural network model;
[0058] The prediction module 208 is configured to input the real-time RTC clock chip data into the trained neural network model and output the current RTC clock chip frequency drift prediction value.
[0059] For the specific limitations of the RTC clock chip frequency drift precise modeling device based on GNSS clock error data, reference can be made to the limitations of the RTC clock chip frequency drift precise modeling method based on GNSS clock error data in the above text, which will not be elaborated here. Each module in the above RTC clock chip frequency drift precise modeling device based on GNSS clock error data can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in the processor of the computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to the above modules.
[0060] In one embodiment, a computer device is provided. The computer device can be a terminal, and its internal structure diagram can be as Figure 3 shown. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements a method for precisely modeling the RTC clock chip frequency drift based on GNSS clock error data. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, a trackball, or a touchpad set on the shell of the computer device, or an external keyboard, touchpad, or mouse, etc.
[0061] Those skilled in the art can understand that Figure 3 the structure shown in
[0062] In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the steps of the method in the above embodiment are implemented.
[0063] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method in the above embodiment are implemented.
[0064] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the various embodiments provided in the present application can include non-volatile and / or volatile memories. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM), etc.
[0065] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.
[0066] The above-described embodiments merely represent several implementation manners of the present application. The description is relatively specific and detailed, but it should not be construed as a limitation on the scope of the invention. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.
Claims
1. A precise frequency drift modeling method for an RTC clock chip based on GNSS clock error data, characterized in that, The method includes: Receiving GNSS clock error data and reading RTC clock chip data at a preset interval, and synchronizing the timestamps of the RTC clock chip data based on the GNSS time of the GNSS clock error data; the RTC clock chip data is the count value and timestamp read from the RTC clock chip at a preset interval; Calculating a frequency difference sequence according to the GNSS clock error data and the RTC clock chip data within a preset time window; Using the GNSS clock error data and the RTC clock chip data as input samples of a pre-constructed neural network model, and using the frequency difference sequence as an output label to train the neural network model to obtain a trained neural network model; Inputting the real-time RTC clock chip data into the trained neural network model to output the predicted value of the current RTC clock chip frequency drift.
2. The method according to claim 1, wherein Receiving GNSS clock error data and reading RTC clock chip data at a preset interval includes: Receiving GNSS satellite signals through a GNSS receiver, and obtaining GNSS clock error data by parsing the GNSS satellite signals, or receiving GNSS satellite signals through a GNSS receiving module built in the user terminal, and obtaining GNSS clock error data by parsing the GNSS satellite signals; On the user terminal, reading the count value and timestamp of the RTC clock chip at a preset interval through a pre-installed data acquisition program to obtain RTC clock chip data.
3. The method according to claim 1, wherein The neural network model is of a multi-layer perceptron structure.
4. The method according to any one of claims 1 to 3, characterized in that, Using the GNSS clock error data and the RTC clock chip data as input samples of a pre-constructed neural network model includes: Using the GNSS clock error data, the RTC clock chip data, and environmental data as input samples of a pre-constructed neural network model.
5. The method according to claim 4, wherein The method further includes: Associating the environmental data with the frequency difference sequence and using it as the feature of the input sample.
6. The method according to any one of claims 1 to 3, characterized in that The method further includes: Adjusting the RTC clock chip according to the predicted value of the current RTC clock chip frequency drift.
7. An RTC clock chip frequency drift precise modeling device based on GNSS clock error data, characterized in that, The device includes: A data acquisition module for receiving GNSS clock error data and reading RTC clock chip data at a preset interval, and synchronizing the timestamps of the RTC clock chip data based on the GNSS time of the GNSS clock error data; the RTC clock chip data is the count value and timestamp read from the RTC clock chip at a preset interval; A frequency difference sequence calculation module for calculating a frequency difference sequence according to the GNSS clock error data and the RTC clock chip data within a preset time window, A model training module for using the GNSS clock error data and the RTC clock chip data as input samples of a pre-constructed neural network model, and using the frequency difference sequence as an output label to train the neural network model to obtain a trained neural network model; A prediction module for inputting the real-time RTC clock chip data into the trained neural network model to output the predicted value of the current RTC clock chip frequency drift.
Citation Information
Patent Citations
RTC clock self-calibration method, electronic equipment and storage medium
CN116388913A
Time synchronization and conversion for safety validation in autonomous systems and applications
US20240085942A1