Distributed device synchronous recording method and system
Through the secondary time calibration of GNSS time and PPS signal, the problem of clock synchronization error between devices is solved, microsecond-level synchronous recording is realized, the accuracy of leakage point positioning is improved, and the needs of low power consumption and long-term synchronous recording are met.
Patent Information
- Application Number
- CN202510359355.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-25
- Publication Date
- 2025-06-20
AI Technical Summary
In the positioning of pipeline leakage points, the positioning accuracy is reduced due to clock synchronization errors between devices in the prior art, which increases cost and uncertainty.
Through the coordination of GNSS time and PPS signal, secondary time calibration is achieved to ensure the synchronization of the real-time clock and GNSS time, so as to achieve microsecond synchronous recording without relying on high-precision crystal oscillator.
The accuracy of the relevant method leak point positioning is improved, the time error of synchronous recording between devices is reduced, the requirements of sub-meter-level leak point positioning are met, and the functions of low power consumption and long-term synchronous recording are realized.
Smart Images

Figure CN120186745A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of clock synchronization, and particularly to a method and system for synchronously recording sounds of distributed devices. Background Art
[0002] The correlation method refers to a method for locating pipeline leakage points by monitoring acoustic wave signals generated by pipeline leakage through two or more sensors installed on the pipeline and determining the leakage position through correlation analysis. In the correlation method for pipeline leakage point location, the two recordings for correlation calculation must be precisely synchronized. According to the sound speed of about 5000 m / s of sound wave propagation in steel pipes, without considering other factors, a recording time difference of 1 millisecond may cause a positioning error of about 5 meters at most; therefore, the error caused by millisecond-level synchronous recording for leakage point location will increase the cost and uncertainty significantly when excavating underground pipeline network leakage points.
[0003] Currently, precise time calibration of multiple distributed Internet of Things devices is mainly completed through the PPS (Pulse Per Second) signal of GNSS (Global Navigation Satellite System). The accuracy can reach the level of several microseconds (the accuracy of the PPS signal can reach the nanosecond level, but considering interruption capture and time calibration processing comprehensively, it usually can only reach the microsecond level). However, due to the signal differences of GNSS among devices, the time required to start and stably output the PPS signal is different; if it is agreed that the synchronous recording time is sent by the platform, the time sent to each device is also different; the time for initializing audio storage, audio peripherals, and peripheral hardware before recording among devices is also different. If the maximum preparation time of the device is T1 seconds, then at least T1 time needs to be waited after each time calibration is completed until the agreed start time of synchronous recording. If GNSS is turned off during this period to reduce device power consumption and continuous time calibration is not performed, due to the crystal oscillator differences among devices, an error of t1 microseconds will be generated (assuming the difference between the two crystal oscillators is △ppm, then t1 = T1 * △ppm). Even if a high-precision temperature-compensated crystal oscillator with ±5 ppm is used, the time difference between two devices may reach 100 microseconds after 10 seconds of time calibration, and the price of a crystal oscillator with higher accuracy will increase significantly, and the error of the crystal oscillator will drift with time, temperature, etc. In addition, the time difference caused by the difference in sampling frequency during recording (also caused by crystal oscillator differences) is t2 microseconds (assuming the recording duration is T2 seconds and the sampling frequency is f MHz, when T2 * △ppm > 1 / f, it will cause sampling point misalignment). If no calibration compensation is performed, t1 + t2 is very likely to reach the millisecond level, thus having a greater impact on the positioning accuracy. Summary of the Invention
[0004] To solve the deficiencies of the prior art, the object of the present invention is to provide a distributed device synchronous recording method and system to reduce the time error of synchronous recording between devices and improve the accuracy of relevant legal loophole positioning.
[0005] To achieve the above object, according to some embodiments, in the first aspect of the present invention, a distributed device synchronous recording method is provided, including:
[0006] Step S11: Before the local device synchronously records, obtain the PPS signal of the GNSS device;
[0007] Step S12: After receiving a rising edge of the PPS signal, receive the GNSS data packet, and write the time information read from the GNSS data packet into the real-time clock of the local device after adding one second;
[0008] Step S13: After receiving the next rising edge of the PPS signal, read the time in the real-time clock and rewrite it into the real-time clock to complete the synchronization of the time of the real-time clock with the time of the GNSS;
[0009] Step S14: Perform synchronous recording according to the time of the synchronized real-time clock.
[0010] Preferably, in step S13, it further includes that after completing the synchronization of the time of the real-time clock with the GNSS time, turn off the GNSS device; or repeat steps S12 and S13 to continuously synchronize the time of the real-time clock with the GNSS time.
[0011] Preferably, it further includes step S10: When the calibration condition is met, determine the actual frequency of the clock source in the real-time clock of the local device according to the count value of the clock source counter within the set number of second pulse times; adjust the frequency of the clock source according to the obtained actual frequency.
[0012] Preferably, the calibration condition includes that the local device is powered on, and every time the power-on time of the local device reaches the set duration, the temperature change of the local device exceeds the set temperature.
[0013] Preferably, in step S14, it further includes that after each completion of the synchronization of the time of the real-time clock with the time of the GNSS, start a countdown of the set time, and allow synchronous recording before the countdown ends.
[0014] Preferably, in step S14, it further includes that before synchronous recording, complete the device preparation time of the set duration.
[0015] In the second aspect of the present invention, a distributed device synchronous recording system is provided, including:
[0016] A PPS signal acquisition module, configured to obtain the PPS signal of the GNSS device before the local device synchronously records;
[0017] A GNSS data receiving module, configured to receive a GNSS data packet after receiving a rising edge of a PPS signal, and write the time information read from the GNSS data packet into the real-time clock of the local device after increasing it by one second;
[0018] A time synchronization module, configured to read the time in the real-time clock and rewrite it into the real-time clock after receiving the next rising edge of the PPS signal, so as to complete the synchronization of the time of the real-time clock with the GNSS time;
[0019] A synchronous recording module, configured to perform synchronous recording according to the time of the synchronized real-time clock.
[0020] In a third aspect of the present invention, there is provided an electronic device, including a memory, a processor, and a computer program stored on the memory, and the processor executes the computer program to complete the steps of the above-mentioned distributed device synchronous recording method.
[0021] In a fourth aspect of the present invention, there is provided a computer-readable storage medium for storing computer instructions, and when the computer instructions are executed by a processor, the steps of the above-mentioned distributed device synchronous recording method are completed.
[0022] In a fifth aspect of the present invention, there is provided a computer program product, including a computer program / instructions, and when the computer program / instructions are executed by a processor, the steps of the above-mentioned distributed device synchronous recording method are implemented.
[0023] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0024] The present invention provides a distributed device synchronous recording method and system, which realizes secondary time calibration through the cooperation of GNSS time and PPS signal, can achieve microsecond-level synchronous recording without relying on a high-precision crystal oscillator, correspondingly improves the accuracy of relevant legal leakage point positioning, and lays a foundation for sub-meter-level leakage point positioning. With the scheme of regular calibration, restricting recording within a countdown, and agreeing on the preparation time, it is possible to achieve the requirement of not continuously turning on GNSS, meeting the low-power consumption requirements of distributed detection devices; even without a GNSS signal after time calibration, it can maintain microsecond-level synchronous recording for a certain period of time, applicable to application scenarios where the GNSS signal of fixed devices is unstable or portable devices are in an application scenario without a GNSS signal for a short time; it can meet the requirements of long-term synchronous recording and multiple synchronous recordings after one-time time calibration.
[0025] Advantages of additional aspects of the present invention will be partly given in the following description, partly will become obvious from the following description, or be understood through the practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The accompanying drawings forming a part of this invention are used to provide a further understanding of the invention. The schematic embodiments of the invention and their descriptions are used to explain the invention and do not unduly limit the invention.
[0027] Figure 1 It is a flowchart of the method in the first embodiment of the present invention;
[0028] Figure 2 It is a schematic diagram of the PPS signal used in the first embodiment of the present invention. Detailed implementation manners
[0029] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0030] First embodiment
[0031] The first embodiment of the present invention provides a distributed device synchronous recording method, as Figure 1 shown, including:
[0032] Step S11: Before the local device synchronously records, obtain the PPS signal of the GNSS device;
[0033] Step S12: After receiving a rising edge of the PPS signal, receive the GNSS data packet, add one second to the time information read from the GNSS data packet, and write it into the real-time clock of the local device;
[0034] Step S13: After receiving the next rising edge of the PPS signal, read the time in the real-time clock and rewrite it into the real-time clock to complete the synchronization of the time of the real-time clock with the time of the GNSS;
[0035] Step S14: Perform synchronous recording according to the time of the synchronized real-time clock.
[0036] In order to achieve high-precision calibration of the RTC (Real-time Clock) of the local device and considering the delay in GNSS data transmission, this embodiment proposes a scheme for secondary time calibration. Before each preparation for synchronous recording, the PPS signal of the GNSS is used for RTC absolute time calibration.
[0037] The PPS (Pulse Per Second) signal is a hardware-level signal generated by the GNSS (Global Navigation Satellite System) receiving module, with an accuracy up to the nanosecond level. Its core function is to provide a high-precision time synchronization reference. The local clock can be corrected by triggering an interrupt through the rising edge of the PPS signal to eliminate the crystal oscillator drift error. There is one rising edge of the PPS signal per second, as Figure 2As shown in the figure, the time interval between rising edge 1 and rising edge 2 in the figure is 1 second.
[0038] After receiving the rising edge of the first PPS signal, the local device receives GNSS data packets, which contain time information such as date, time, longitude and latitude. After increasing the read time and date by 1 second, it is written into the RTC of the local device. The purpose of writing into the RTC after increasing by 1 second is to compensate for the delay during GNSS data transmission.
[0039] After detecting the rising edge of the second PPS, immediately read the RTC time and write the read time into the RTC to synchronize the RTC time with the GNSS time. The purpose of writing the time in the RTC into the RTC again is to further align the time with the PPS rising edge.
[0040] In some embodiments, after completing the time synchronization process of the above steps S11 - S13, to reduce power consumption and considering temporarily disconnecting from GNSS use after time calibration, the GNSS can be turned off to meet the low - power requirements of the distributed detection device. In other embodiments, to improve time accuracy and without considering power consumption, steps S12 and S13 can be repeatedly executed, or steps S12 and S13 can be repeatedly executed after a set time interval to eliminate the cumulative error generated by the crystal oscillator.
[0041] To further reduce the cumulative error caused by crystal oscillator differences, in some embodiments, the crystal oscillator frequency is finely adjusted to achieve regular calibration. Specifically, it further includes step S10. When the calibration condition is met, according to the count value of the clock source counter within the set number of second pulses of time, determine the actual frequency of the clock source in the real - time clock of the local device; adjust the frequency of the clock source according to the obtained actual frequency.
[0042] The calibration conditions include that the local device is powered on, and every time the power - on time of the local device reaches the set duration, the temperature change of the local device exceeds the set temperature.
[0043] Specifically, when the device is powered on, or every 12 hours of power - on time, or when the device temperature change exceeds 5 degrees Celsius, a clock source (crystal oscillator) calibration is performed according to the PPS signal of GNSS. The calibration method is as follows: While counting N PPS second pulses, record the count value n of the clock source counter, so as to obtain the actual frequency n / N; judge whether there is a deviation in the actual frequencies between the devices used for correlation method detection, and finely adjust the clock source according to the frequency error situation to reach within ppm' (for example, adjust the actual frequency by ±0.1 ppm, and there will be no t2 time difference in a 5 - minute recording), so that after time calibration, that is, after making the RTC time keep synchronized with the GNSS time based on the PPS signal, the error within a period of time remains within an acceptable range.
[0044] In some embodiments, to ensure that the time error of synchronous recording is within a controllable range, it further includes that after each synchronization of the time of the real-time clock and the time of the GNSS, a countdown of a set time is started, and synchronous recording is allowed before the countdown ends.
[0045] Specifically, the maximum RTC error allowed for device recording is t3 microseconds. After each time the device completes time calibration, a countdown of T3 (T3 = t3 / △ppm' - T4) seconds is started. Synchronous recording is allowed before the countdown ends, and synchronous recording is not possible after the countdown ends. The error generated from the most recent time calibration to the most recent agreed recording start time (with a difference of T5 seconds) is t5 = T5*△ppm' microseconds.
[0046] To avoid time errors caused by differences in device preparation times, in some embodiments, it further includes that before synchronous recording, a device preparation time of a set duration is completed.
[0047] Specifically, before the agreed synchronous recording time arrives, the maximum time for the device to complete the preparation work is T4 seconds. The RTC alarm is used to trigger a timed interrupt to start recording. At this time, the synchronous error generated is only the interrupt response time at the microsecond level.
[0048] After the above solutions, the time difference of synchronous recording is mainly t5. If each device clock in step S10 is calibrated to ±0.1 ppm and the system requires the synchronous time difference not to exceed 100 microseconds, the requirements can be met within approximately 5000 seconds after one time of time calibration, thus achieving high-precision and low-power microsecond-level time synchronization.
[0049] The solution provided in this embodiment, compared with the prior art, can achieve microsecond-level synchronous recording without relying on a high-precision oscillator, which is a prerequisite for sub-meter leak point positioning; it does not need to continuously turn on the GNSS, which can meet the low-power requirements; even without a GNSS signal after time calibration, it can maintain microsecond-level synchronous recording for a certain period of time, applicable to application scenarios where the GNSS signal of fixed devices is unstable or application scenarios where portable devices are without a GNSS signal for a short time; it meets the requirements of long-time synchronous recording and multiple synchronous recordings after one time of time calibration.
[0050] Embodiment 2
[0051] This embodiment provides a distributed device synchronous recording system, including:
[0052] A PPS signal acquisition module, configured to acquire the PPS signal of the GNSS device before local device synchronous recording;
[0053] A GNSS data receiving module, configured to receive the GNSS data packet when a rising edge of the PPS signal is received, and write the time information read from the GNSS data packet into the real-time clock of the local device after adding one second.
[0054] A time synchronization module, configured to read the time in the real-time clock and rewrite it into the real-time clock after receiving the next rising edge of the PPS signal, so as to complete the synchronization of the time of the real-time clock with the time of the GNSS;
[0055] A synchronous recording module, configured to perform synchronous recording according to the time of the synchronized real-time clock.
[0056] It should be noted here that each module in this embodiment corresponds one-to-one to the steps of the method in Embodiment 1, and the specific implementation process is the same, so it will not be repeated here.
[0057] Embodiment 3
[0058] This embodiment provides an electronic device, including a memory, a processor, and a computer program stored on the memory, and the processor executes the computer program to complete the steps of the method in Embodiment 1.
[0059] The processor may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), or PLA (Programmable Logic Array). The processor may also include a main processor and a coprocessor. The main processor is a processor used to process data in the wake state, also known as the CPU (Central Processing Unit); the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor may be integrated with a GPU (Graphics Processing Unit), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor may also include an AI (Artificial Intelligence) processor, and the AI processor is used to process computational operations related to machine learning.
[0060] The memory may include one or more computer-readable media, which may be non-transitory. The memory may also include high-speed random access memory, as well as non-volatile memory, such as one or more disk storage devices and flash storage devices. In some embodiments, the non-transitory computer-readable media in the memory is used to store at least one computer program, and the at least one computer program is used to be executed by a processor to implement a distributed device synchronous recording method provided in the embodiments of the present disclosure.
[0061] Those skilled in the art can understand that the electronic device provided in this embodiment may include more or fewer components, or combine certain components, or adopt different component arrangements.
[0062] Embodiment 4
[0063] This embodiment provides a computer-readable storage medium for storing computer instructions. When the computer instructions are executed by a processor, the steps of the method in Embodiment 1 are completed.
[0064] Embodiment 5
[0065] This embodiment provides a computer program product, including a computer program / instructions. When the computer program / instructions are executed by a processor, the steps of the method in Embodiment 1 are implemented.
[0066] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website, a computer, a server, or a data center to another website, a computer, a server, or a data center in a wired manner (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or a wireless manner (such as infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that a computer can store, or a data storage device such as a server or a data center that includes one or more integrated available media. The available medium may be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)).
[0067] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A distributed device synchronous recording method, characterized in that: include: Step S11, before the local device synchronously records the audio, the local device obtains the PPS signal of the GNSS device; Step S12: after receiving a rising edge of the PPS signal, receiving a GNSS data packet, increasing the time information read in the GNSS data packet by one second, and writing it into the real-time clock of the local device; Step S13: after receiving the next rising edge of the PPS signal, read the time in the real-time clock and rewrite it into the real-time clock, so as to complete the synchronization between the real-time clock time and the GNSS time; Step S14: Perform synchronous recording according to the time of the synchronized real-time clock.
2. A distributed device synchronous recording method as claimed in claim 1, characterized in that: Step S13 further includes, after completing the synchronization of the real-time clock time with the GNSS time, turning off the GNSS device; or, repeating steps S12 and S13 to continuously synchronize the real-time clock time with the GNSS time.
3. A distributed device synchronous recording method as claimed in claim 1, characterized in that: It also includes step S10, when the calibration condition is met, determining the actual frequency of the clock source in the real-time clock of the local device according to the count value of the clock source counter within the set number of second pulse time; and adjusting the frequency of the clock source according to the obtained actual frequency.
4. A distributed device synchronous recording method as claimed in claim 3, characterized in that: The calibration conditions include: the local device is turned on, the local device is turned on for a set time period, and the temperature of the local device changes by more than a set temperature.
5. A distributed device synchronous recording method as claimed in claim 1, characterized in that: Step S14 also includes starting a countdown of a set time after the synchronization of the real-time clock time with the GNSS time is completed, and allowing synchronous recording before the countdown ends.
6. A distributed device synchronous recording method as claimed in claim 1, characterized in that: Step S14 also includes completing the equipment preparation time of a set duration before synchronous recording.
7. A distributed device synchronous recording system, characterized in that: include: The PPS signal acquisition module is configured to acquire the PPS signal of the GNSS device before the local device synchronizes the recording; The GNSS data receiving module is configured to receive a GNSS data packet after receiving a rising edge of the PPS signal, increase the time information read in the GNSS data packet by one second, and then write it into the real-time clock of the local device; The time synchronization module is configured to read the time in the real-time clock and rewrite it into the real-time clock after receiving the next rising edge of the PPS signal, so as to synchronize the time of the real-time clock with the time of the GNSS; The synchronous recording module is configured to perform synchronous recording according to the time of the synchronized real-time clock.
8. An electronic device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory, wherein the processor executes the computer program to complete the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: Used to store computer instructions, which, when executed by a processor, complete the steps of the method according to any one of claims 1 to 6.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.