High-precision synchronization clock method without pps pulse, device, equipment and medium

By using a high-precision synchronous clock method without PPS pulses, the problem of insufficient time synchronization accuracy of external clock sources is solved, achieving millisecond-level time synchronization accuracy and system reliability, simplifying wiring and reducing costs.

CN120567352BActive Publication Date: 2026-06-23ZHUHAI FEISEN POWER TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZHUHAI FEISEN POWER TECH CO LTD
Filing Date
2025-06-11
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

In existing technologies, the time synchronization function provided by intelligent power distribution terminals through external clock sources has a large error, resulting in inaccurate time recording and failing to meet the requirements for high-precision time.

Method used

A high-precision synchronization clock method without PPS pulses is adopted. By acquiring the time error information between the external clock source and the GPS clock, a time message is generated and parsed at a preset time. Combined with delay error correction, millisecond-level time synchronization accuracy is achieved.

Benefits of technology

It improves time synchronization accuracy, simplifies external wiring, reduces costs, and enhances the system's anti-interference reliability, with a time error of less than 0.1 seconds.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120567352B_ABST
    Figure CN120567352B_ABST
Patent Text Reader

Abstract

The application provides a high-precision synchronous clock method without PPS pulse, a device, equipment and medium, which comprises the following steps: acquiring time error information of an external clock source and a GPS clock and generating a time message; confirming a first time value and a second time value of the time message; the external clock source analyzes the time message at a first time point in response to a time request, obtains a third time value, obtains a first delay error of the intelligent power distribution terminal according to multiple time values, and confirms current time information of the GPS clock; acquiring a fourth time value at a second time point and arranging a time request message, sending the time request message to the intelligent power distribution terminal at a third time point to obtain a second delay error and confirm a first current time value of the time request message; writing the first current time value into a real-time clock of the intelligent power distribution terminal, and re-reading a second current time value. According to the technical scheme, the time synchronization accuracy can be improved, and the system anti-interference reliability can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent power distribution fault handling technology, and in particular to a high-precision synchronous clock method, device, equipment and medium without PPS pulses. Background Technology

[0002] In intelligent power distribution systems, there are a large number of intelligent power distribution terminals. These terminals need to process a large number of hardware remote signaling changes and software remote signaling changes, as well as various fault sequence event records, for the purpose of analyzing the operating status and operational accidents of the intelligent power distribution system. These event records need to be time-stamped to analyze the sequence of events. Intelligent power distribution terminals are usually configured with an external clock source so that they can read the internal GPS-generated time from the external clock source via a serial port.

[0003] However, in existing technologies, the time synchronization function provided by external clock sources is mostly the time when the external clock source outputs the synchronization message. This usually has a large error with the actual time at that time. This results in a certain delay between when the intelligent power distribution terminal receives the message and when it begins to process the message, forming a superimposed time error. This is far from meeting the high-precision time requirements of the power distribution system. Summary of the Invention

[0004] This invention aims to solve at least one of the technical problems existing in the prior art. To this end, this invention proposes a high-precision synchronous clock method, apparatus, device, and medium without PPS pulses, which can achieve millisecond-level high-precision time synchronization without relying on second pulses (PPS). While improving time synchronization accuracy, it simplifies external wiring, reduces costs, and improves system anti-interference reliability.

[0005] In a first aspect, embodiments of the present invention provide a high-precision synchronous clock method without PPS pulses, comprising:

[0006] Obtain time error information between an external clock source and a GPS clock, and generate a time message based on the time error information;

[0007] The GPS clock confirms the first time value and the second time value of the time message, wherein the first time value represents the falling edge of the start bit of the first byte of the time message;

[0008] When the external clock source receives the completion signal sent by the GPS clock, the external clock source responds to the time synchronization request of the smart power distribution terminal, parses the time message at a preset first moment, obtains a third time value, and obtains the first delay error of the smart power distribution terminal based on the first time value, the second time value and the third time value.

[0009] The current time information of the GPS clock is confirmed based on the first delay error. The external clock source runs automatically based on the current time information. When the external clock source receives the time synchronization request message sent by the smart power distribution terminal, it obtains the fourth time value at the second moment, organizes the fourth time value into a time synchronization message, and sends the time synchronization message to the smart power distribution terminal at the third moment.

[0010] The intelligent power distribution terminal parses the communication message to obtain the second delay error of the communication message, and confirms the first current time value of the communication message based on the second delay error;

[0011] Write the first current time value into the real-time clock of the smart power distribution terminal, and then reread the second current time value of the real-time clock.

[0012] In some embodiments of the present invention, obtaining the time error information between the external clock source and the GPS clock includes:

[0013] Confirm that the GPS clock is at the first shift point in an integer millisecond, send the first time value of the time message at the first shift point, and the content of the time message is the second time value;

[0014] When the external clock source reads the time message, it confirms the first time the first byte is received and the real-time clock records the first current time of the first time the first byte is received in microseconds.

[0015] Obtain the current baud rate at the first current moment, and calculate the first byte transmission time of the first byte;

[0016] After receiving the complete time message sent by the GPS clock, the intelligent power distribution terminal parses the time message at the second moment to obtain the first time value, and calculates the second current moment based on the first time value;

[0017] The external clock source runs its own time based on the first current time and the second current time.

[0018] In some embodiments of the present invention, the step of organizing the fourth time value into a time synchronization message includes:

[0019] The external clock source responds to the time synchronization request message sent by the intelligent power distribution terminal and obtains the fourth time value based on the third time value and a preset number of milliseconds;

[0020] The fourth time value is organized into a time response message, and it is confirmed whether the intelligent power distribution terminal is in the fourth time.

[0021] When the intelligent power distribution terminal is at the fourth time, it sends the start bit of the first byte of the time synchronization response message at the fourth time;

[0022] The preset terminal device and timer drive the start bit of the first byte of the time synchronization response message to adjust the control error of the time synchronization response message.

[0023] In some embodiments of the present invention, the intelligent power distribution terminal parses the synchronization message, including:

[0024] When the intelligent power distribution terminal receives the synchronization message from the external clock source, it determines the first reception completion time of the first byte of the synchronization message;

[0025] The third current moment after the first reception completion time is recorded in microseconds, and the transmission time of the second byte of the first byte is calculated based on the current baud rate of the intelligent power distribution terminal and the third current moment.

[0026] The communication message is parsed at the fifth time value to obtain the fourth time value;

[0027] The fourth time value is recorded as the fourth current moment in microseconds, and the first real-time time of the communication message is calculated based on the third current moment, the fourth current moment, the second byte transmission time, and the fifth time value.

[0028] The external clock source runs automatically according to the first real-time time to write the second current time value into the real-time clock.

[0029] In some embodiments of the present invention, after writing the second current time value to the real-time clock, the method further includes:

[0030] Obtain the byte transmission rate and the number of bytes transmitted by the intelligent power distribution terminal, and calculate the third byte transmission time of the communication bus based on the byte transmission rate and the number of bytes transmitted.

[0031] The timer is started according to the transmission time of the third byte, and the timer is controlled to generate an interrupt according to the first real-time time, the transmission time of the third byte, and the first preset number of seconds;

[0032] When the timer is interrupted, the second current time and the first preset whole second time are written into the real-time clock so that the sixth time value written by the real-time clock is equal to the whole second time.

[0033] In some embodiments of the present invention, after the sixth time value written by the real-time clock is equal to the whole second time, the method further includes:

[0034] The intelligent power distribution terminal is powered off and then powered on again. The fourth byte transmission time after the intelligent power distribution terminal is powered on is calculated based on the byte transmission rate and the number of bytes transmitted.

[0035] The intelligent power distribution terminal is adjusted to read the seconds in a loop until the current second time value obtained by the intelligent power distribution terminal in two consecutive reads changes to a second. The current second time value read last is then set as the current second time of the intelligent power distribution terminal.

[0036] The timer is initialized with half the transmission time of the fourth byte to adjust for errors in the real-time clock and the customizer.

[0037] In some embodiments of the present invention, after the intelligent power distribution terminal is powered off and then powered back on, the method further includes:

[0038] When the intelligent power distribution terminal loses power, the real-time clock maintains the automatic running time of the intelligent power distribution terminal;

[0039] When the intelligent power distribution terminal is powered on again, the intelligent power distribution terminal reads the second real-time time of the real-time clock.

[0040] In a second aspect, embodiments of the present invention provide a high-precision synchronous clock device without PPS pulses, including at least one control processor and a memory for communicatively connecting to the at least one control processor; the memory stores instructions executable by the at least one control processor, which, when executed by the at least one control processor, enables the at least one control processor to perform the high-precision synchronous clock method without PPS pulses as described in the first aspect above.

[0041] Thirdly, embodiments of the present invention provide an electronic device including a high-precision synchronous clock device without PPS pulses as described in the second aspect above.

[0042] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing computer-executable instructions for executing the high-precision synchronous clock method without PPS pulses as described in the first aspect above.

[0043] The high-precision synchronous clock method without PPS pulses according to embodiments of the present invention has at least the following beneficial effects:

[0044] Hardware-level precise detection of the falling edge of the start bit of the time-marked message replaces the traditional software parsing method for the message start time, avoiding timestamp errors caused by protocol parsing delays. The overall message transmission completion time is then recorded to calculate the transmission duration of a single packet. Combined with the first time value, the hardware processing delay during message transmission is analyzed, providing a basis for subsequent error calculations. Furthermore, after receiving the GPS clock completion signal, the external clock source does not immediately parse the message, but parses it at a preset first time, thereby eliminating random errors in parsing time caused by uncertainties in real-time processing at the receiving end (such as interrupt delay response and task scheduling priority), ensuring deterministic delay in obtaining the third time value. The calculation of the third time value using the first, second, and third time values... The delay error is used to determine the transmission delay and processing delay of the time message from the GPS clock to the external clock source, thus avoiding the compensation error caused by the inability to break down the "end-to-end total delay" in traditional solutions. When the external clock source receives the time synchronization request from the smart distribution terminal, it records the fourth time value at the second moment and sends the synchronization message at the third moment. Combined with bidirectional timestamps, the asymmetry of path delay (such as network bidirectional delay differences) is eliminated. The external clock source performs self-timekeeping after correcting for the first delay error based on the current time information of the GPS clock. When the GPS signal is interrupted, the self-timekeeping error can be predicted and compensated through historical calibration data to ensure long-term accuracy. The smart distribution terminal eliminates software time update lag errors caused by operating system task scheduling, bus delays, etc., by detecting the second current time value of the write operation. In summary, the technical solution of this embodiment uses timestamps for fine marking and compensates for errors in message transmission time, program response time, and first byte transmission time. By adjusting the transmission time of writing and reading and the second alignment time, it achieves accurate second alignment input, thereby improving the time synchronization accuracy of the power distribution system. Attached Figure Description

[0045] Figure 1 This is a flowchart of a high-precision synchronous clock method without PPS pulses provided in one embodiment of the present invention;

[0046] Figure 2 This is a flowchart of an embodiment of the present invention for obtaining time error information between an external clock source and a GPS clock;

[0047] Figure 3 This is a flowchart of organizing a fourth time value into a time synchronization message provided in one embodiment of the present invention;

[0048] Figure 4 This is a flowchart of the intelligent power distribution terminal parsing the synchronous time message provided in one embodiment of the present invention;

[0049] Figure 5This is a flowchart of writing a second current time value to a real-time clock according to an embodiment of the present invention;

[0050] Figure 6 This is a flowchart provided by one embodiment of the present invention, showing how the sixth time value written by the real-time clock is equal to the whole second.

[0051] Figure 7 This is a flowchart of the process of powering off and then powering back on an intelligent power distribution terminal, provided by one embodiment of the present invention.

[0052] Figure 8 This is a structural diagram of a high-precision synchronous clock device without PPS pulses provided in another embodiment of the present invention;

[0053] Figure 9 A timing diagram of a high-precision synchronous clock method without PPS pulses provided in an embodiment of the present invention. Detailed Implementation

[0054] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.

[0055] In the description of this invention, it should be understood that the orientation descriptions, such as up, down, front, back, left, right, etc., are based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limiting this invention.

[0056] In the description of this invention, "several" means one or more, "more than" means two or more, "greater than," "less than," and "exceeding" are understood to exclude the stated number, while "above," "below," and "within" are understood to include the stated number. The use of "first" and "second" in the description is merely for distinguishing technical features and should not be construed as indicating or implying relative importance, or implicitly indicating the number of indicated technical features, or implicitly indicating the order of the indicated technical features.

[0057] In the description of this invention, unless otherwise explicitly defined, terms such as "set up," "install," and "connect" should be interpreted broadly, and those skilled in the art can reasonably determine the specific meaning of the above terms in this invention in conjunction with the specific content of the technical solution.

[0058] Reference Figure 9This invention provides a high-precision synchronous clock method without PPS pulses, including acquiring time error information between an external clock source and a GPS clock, generating a time message based on the time error information; confirming a first time value and a second time value of the time message sent by the GPS clock, wherein the first time value represents the falling edge of the start bit of the first byte of the time message; when the external clock source receives the completion signal sent by the GPS clock, the external clock source responds to the time synchronization request of the intelligent power distribution terminal by parsing the time message at a preset first moment to obtain a third time value, and obtaining the intelligent power distribution terminal based on the first time value, the second time value, and the third time value. The first delay error of the terminal; based on the first delay error, the current time information of the GPS clock is confirmed. The external clock source runs its own time according to the current time information. When the external clock source receives the time synchronization request message sent by the intelligent power distribution terminal, it obtains the fourth time value at the second moment, organizes the fourth time value into a synchronization message, and sends the synchronization message to the intelligent power distribution terminal at the third moment. The intelligent power distribution terminal parses the synchronization message to obtain the second delay error of the synchronization message, confirms the first current time value of the synchronization message based on the second delay error, writes the first current time value into the real-time clock (RTC) of the intelligent power distribution terminal, and rereads the second current time value of the real-time clock. According to the technical solution of this embodiment, a millisecond-level high-precision time synchronization solution that does not rely on the second pulse PPS can be achieved, which improves the time synchronization accuracy, simplifies external wiring, reduces costs, and improves the system's anti-interference reliability.

[0059] It should be noted that this embodiment analyzes the serial port reading time and serial port synchronization between the external clock source (ETS) and the intelligent power distribution terminal (TU), analyzes the causes of time errors, performs reasonable and effective time compensation, optimizes the internal synchronization algorithm of the external clock source and the synchronization algorithm of the intelligent power distribution terminal, and finally achieves a high-precision serial port synchronization mechanism with a time error of less than 0.1 seconds.

[0060] The control method of the present invention will be further described below with reference to the accompanying drawings.

[0061] Reference Figure 1 , Figure 1 This is a flowchart of a high-precision synchronization clock method without PPS pulses provided in an embodiment of the present invention. The high-precision synchronization clock method without PPS pulses includes, but is not limited to, the following steps:

[0062] Step S11: Obtain the time error information between the external clock source and the GPS clock, and generate a time message based on the time error information;

[0063] It should be noted that the GPS clock provides latitude, longitude, and time messages via the UART serial port in GPRMC format, represented as: $GPRMC, <1> , <2> , <3> , <4> , <5> , <6> , <7> , <8> , <9> , <10> , <11> , <12> CRC

[0064] Specifically, the time resolution is 1ms.

[0065] It should be noted that the message latitude and longitude and the time message name field are described as follows:

[0066] <1> UTC time, in the format hhmmss.sss, representing hours, minutes, seconds, and milliseconds;

[0067] <2> Location status: A = valid location, V = invalid location;

[0068] <3> Latitude in ddmm.mmmm (degrees and minutes) format (leading zeros will also be transmitted);

[0069] <4> Latitude hemisphere N (North latitude) or S (South latitude);

[0070] <5> Longitude in dddmm.mmmm (degrees and minutes) format (leading zeros will also be transmitted);

[0071] <6> Longitude hemisphere E (East longitude) or W (West longitude);

[0072] <7> Ground speed (000.0 to 999.9 knots, leading zeros will also be transmitted);

[0073] <8> Ground heading (azimuth), equivalent to a two-dimensional compass (000.0 to 359.9 degrees, with true north as the reference, and the leading zero will also be transmitted);

[0074] <9> UTC date, DDMMYY (day-month-year) format;

[0075] <10> Magnetic declination (000.0 to 180.0 degrees, the leading zeros will also be transmitted);

[0076] <11> Magnetic declination direction, E (east) or W (west);

[0077] <12> Mode indication (output only for NMEA0183 version 3.0, A = autonomous positioning, D = differential, E = estimation, N = invalid data);

[0078] The last two bytes of the CRC checksum are the checksum.

[0079] Step S12: Confirm the first time value and the second time value of the time message sent by the GPS clock, wherein the first time value represents the falling edge of the start bit of the first byte of the time message;

[0080] It should be noted that the second time value t1 of the time message sent by the GPS clock is the falling edge of the start bit of the first byte of the time message, and the first time value t0 of the time content of the message. There is an error between the first time value t0 and the second time value t1, which is usually 0ms≤t2-t1≤800ms.

[0081] Step S13: When the external clock source receives the completion signal sent by the GPS clock, the external clock source responds to the time synchronization request of the smart power distribution terminal, parses the time message at the preset first moment, obtains the third time value, and obtains the first delay error of the smart power distribution terminal based on the first time value, the second time value and the third time value.

[0082] It should be noted that after the external clock source receives the completion signal sent by the GPS clock, it parses the time message at the preset first moment to obtain the third time value. Due to the delay in task scheduling, it is usually 0ms≤t2-t1≤800ms.

[0083] It should be noted that there is a first delay error between the external clock source and the GPS clock, which is expressed by the following formula:

[0084] (t1-t0)+(t2-t1)=t2-t0.

[0085] Step S14: Confirm the current time information of the GPS clock based on the first delay error. The external clock source runs automatically based on the current time information. When the external clock source receives the time synchronization request message sent by the smart power distribution terminal, it obtains the fourth time value at the second moment, organizes the fourth time value into a time synchronization message, and sends the time synchronization message to the smart power distribution terminal at the third moment.

[0086] It should be noted that the external clock source responds to the time synchronization request from the intelligent power distribution terminal by sending a time message to the intelligent power distribution terminal, which causes a first delay error. After receiving the GPS clock time, the external clock source starts its own timekeeping. Upon receiving the time synchronization request message from the intelligent power distribution terminal, it reconstructs the current time (i.e., the fourth time value t3) into a time synchronization message at the second moment, and sends the start bit of the first byte of the message (containing the time content of the fourth time value t3) at the third moment. Due to the system's task scheduling delay, typically 0ms < t4 - t3 ≤ 800ms.

[0087] Step S15: The intelligent power distribution terminal parses the communication message to obtain the second delay error of the communication message, and confirms the first current time value of the communication message based on the second delay error.

[0088] It should be noted that by analyzing the second delay error of the synchronization message to correct the first current time value, the delay in the signal transmission process can be effectively compensated, the time synchronization error can be reduced, and the time of the intelligent power distribution terminal can be more accurately kept in line with the time of the time source.

[0089] Step S16: Write the first current time value into the real-time clock of the smart power distribution terminal, and reread the second current time value of the real-time clock.

[0090] It should be noted that during operation, the internal clock of the intelligent power distribution terminal may experience errors due to various factors, such as crystal oscillator frequency drift and temperature changes. Writing the accurate first current time value obtained through message parsing to the real-time clock allows for timely correction of clock errors, preventing error accumulation and ensuring long-term time accuracy. Even within a short period, the clock may experience slight drift. Rereading the real-time clock to obtain a second current time value confirms whether the clock is operating accurately as expected, enabling timely detection and handling of clock anomalies and ensuring that the intelligent power distribution terminal always maintains precise time synchronization.

[0091] It should be noted that this embodiment analyzes the serial port reading time and serial port synchronization of the external clock source and the intelligent power distribution terminal, analyzes the causes of time errors, performs reasonable and effective time compensation, optimizes the internal synchronization algorithm of the external clock source and the synchronization algorithm of the intelligent power distribution terminal, and finally achieves a high-precision serial port synchronization mechanism with a time error of less than 0.1 seconds.

[0092] Additionally, in one embodiment, reference is made to Figure 2 ,exist Figure 1 Step S11 in the illustrated embodiment also includes, but is not limited to, the following steps:

[0093] Step S21: Confirm that the GPS clock is at the first change time of an integer millisecond, send the first time value of the time message at the first change time, and the content of the time message is the second time value;

[0094] Step S22: When the external clock source reads the time message, the first reception completion time of the first byte is confirmed, and the real-time clock records the first current time of the first reception completion time in microseconds.

[0095] Step S23: Obtain the current baud rate at the first moment and calculate the transmission time of the first byte.

[0096] Step S24: After receiving the complete time message sent by the GPS clock, the intelligent power distribution terminal parses the time message at the second moment to obtain the first time value, and calculates the second current moment based on the first time value.

[0097] Step S25: The external clock source starts its own time based on the first current time and the second current time.

[0098] It should be noted that the GPS clock internally controls the start bit of the first byte of the message at the first change moment of an integer millisecond. In this way, the error in the time value can be greatly reduced, and the error can be controlled to be less than 10µs.

[0099] When the external clock source reads the time message sent by the GPS clock through the serial port, it uses a timer to record the first moment in microseconds at the first time the first byte of the time message is received. Based on the current baud rate of the external clock source, it calculates the transmission time of the first byte.

[0100] After the external clock source receives the complete message from the GPS clock, it parses the message at the second moment to obtain the first time value. Using an internal timer, it records the second current moment in microseconds and calculates the second real-time time using the following formula:

[0101] ta = t0 + (ut2 - ut1 + dut0) / 1000;

[0102] The calculation result is retained in milliseconds. The remainder of (ut2-ut1+dut0)%1000 is directly assigned to the internal self-running timer to compensate for errors within milliseconds, which can control the error to be less than 20us.

[0103] An external clock source runs its own time based on the current time.

[0104] Additionally, in one embodiment, reference is made to Figure 3 ,exist Figure 1 Step S14 of the illustrated embodiment also includes, but is not limited to, the following steps:

[0105] Step S31: The external clock source responds to the time synchronization request message sent by the intelligent power distribution terminal and obtains the fourth time value based on the third time value and the preset number of milliseconds.

[0106] Step S32: Organize the fourth time value into a time synchronization response message and confirm whether the smart power distribution terminal is in the fourth time.

[0107] Step S33: When the intelligent power distribution terminal is in the fourth time, send the start bit of the first byte of the time synchronization response message at the fourth time.

[0108] In step S34, the preset terminal device and timer drive the start bit of the first byte of the time synchronization response message to adjust the control error of the time synchronization response message.

[0109] It should be noted that after the external clock source receives the time synchronization request message from the intelligent power distribution terminal, it reorganizes the current time (t3+1ms) into a time synchronization response message at the third moment. Then, at the next millisecond interrupt t4 (the integer millisecond t4 = t3+1), it sends the start bit of the first byte of the message (containing the t4 time content). This is achieved through an interrupt system and timer driver to control the error to be less than 30µs.

[0110] Additionally, in one embodiment, reference is made to Figure 4 ,exist Figure 1 Step S15 of the illustrated embodiment also includes, but is not limited to, the following steps:

[0111] Step S41: When the intelligent power distribution terminal receives the synchronization message from the external clock source, it determines the first time when the first byte of the synchronization message is received.

[0112] Step S42: Record the third current moment of the first reception completion time in microseconds, and calculate the transmission time of the second byte of the first byte based on the current baud rate of the smart power distribution terminal and the third current moment;

[0113] Step S43: At the fifth time value, the synchronous message is parsed to obtain the fourth time value;

[0114] Step S44: Record the fourth time value as the fourth current moment in microseconds, and calculate the first real-time time of the time synchronization message based on the third current moment, the fourth current moment, the second byte transmission time, and the fifth time value;

[0115] Step S45: The external clock source runs its own clock according to the first real-time time to write the second current time value into the real-time clock.

[0116] It should be noted that when the intelligent power distribution terminal receives the time synchronization response message from the external clock source via the serial port, it uses an internal timer to record the third current moment in microseconds at the first time the first byte of the time synchronization response message is received. Based on the current baud rate of the external clock source, it calculates the transmission time of the second byte of a byte.

[0117] After receiving the complete message from the external clock source, the intelligent power distribution terminal parses the message at the third current moment to obtain the fourth time value. Using an internal timer, it records the fourth current moment in microseconds and calculates the first real-time time according to the following formula:

[0118] tb=t4+(ut6-ut5+dut2) / 1000;

[0119] The calculation result is retained in milliseconds. The remainder of (ut6-ut5+dut2)%1000 is directly assigned to the internal self-running timer to compensate for errors within milliseconds, which can control the error to be less than 40us.

[0120] The intelligent power distribution terminal performs self-running based on the first real-time time.

[0121] Additionally, in one embodiment, reference is made to Figure 5 ,exist Figure 4 Following step S45 in the illustrated embodiment, the following steps are included, but are not limited to:

[0122] Step S51: Obtain the byte transmission rate and number of bytes transmitted by the intelligent power distribution terminal, and calculate the third byte transmission time of the communication bus based on the byte transmission rate and number of bytes transmitted.

[0123] Step S52: Start the timer according to the transmission time of the third byte, and control the timer to generate an interrupt according to the first real-time time, the transmission time of the third byte, and the first preset number of seconds;

[0124] Step S53: When the timer is interrupted, write the second current time and the first preset whole second time into the real-time clock so that the sixth time value written by the real-time clock is equal to the whole second time.

[0125] It should be noted that, since the time of the intelligent power distribution terminal and the real-time clock is written through the communication bus, the transmission time of the third byte of the communication bus is calculated by the transmission rate (e.g., 1 Mbps) and the number of bytes. A timer is started, and an interrupt is generated at the time tb (first real-time time) + 2s (first preset number of seconds) - dtu3 (third byte transmission time). The whole second tb (first real-time time) + 2s is written to the real-time clock so that the time t7 when the real-time clock receives the write clock command is exactly equal to the whole second tb + 2s, thereby controlling the error to be less than 50us.

[0126] Additionally, in one embodiment, reference is made to Figure 6 ,exist Figure 5 Following step S53 in the illustrated embodiment, the following steps are included, but are not limited to:

[0127] Step S61: Power off and power back on the intelligent power distribution terminal, and calculate the fourth byte transmission time after the intelligent power distribution terminal is powered back on based on the byte transmission rate and the number of bytes transmitted.

[0128] Step S62: Adjust the smart power distribution terminal to cyclic countdown until the current countdown time value obtained by the smart power distribution terminal in two consecutive countdowns changes to a second value, and set the current countdown time value read last as the current second time of the smart power distribution terminal;

[0129] Step S63: Initialize the timer with half the transmission time of the fourth byte to adjust for errors in the real-time clock and the customizer.

[0130] It should be noted that when the intelligent power distribution terminal is powered on again, it reads the time (resolution in seconds) from the internal real-time clock via the communication bus. The transmission time of the fourth byte of the communication bus, dut4, can be calculated using the transmission rate (e.g., 1 Mbps) and the number of bytes. Generally, dtu4 < 100 µs. The intelligent power distribution terminal reads the time cyclically until two consecutive reads show a change in seconds. Then, the time of the last read is set as the current second time, tc. Furthermore, the self-running millisecond timer is initialized with half of the fourth byte transmission time, dut4 (0.5 * dtu4), achieving a precise internal millisecond timer. This controls the error to be less than 50 µs + 50 µs = 100 µs, i.e., an error not exceeding 0.1 ms.

[0131] Additionally, in one embodiment, reference is made to Figure 7 ,exist Figure 6 Following step S61 in the illustrated embodiment, the following steps are also included, but are not limited to:

[0132] Step S71: When the intelligent power distribution terminal loses power, the real-time clock maintains the automatic running time of the intelligent power distribution terminal.

[0133] Step S72: After the intelligent power distribution terminal is powered on again, the intelligent power distribution terminal reads the second real-time time from the real-time clock.

[0134] It is important to note that ensuring the intelligent power distribution terminal can still record the passage of time during a power outage is crucial. Upon power restoration, the second real-time time must be continuous with the time before the power outage, without any time gaps or jumps. This provides a continuous and accurate time reference for subsequent time-related operations and data recording. Accurate time sequence recording is essential for various events in the intelligent power distribution system, such as fault occurrences and protection actions. Even during a power outage, the real-time clock's self-running function ensures accurate timestamp recording of these events. The time read after power restoration can be used to precisely analyze the sequence of events, aiding in rapid fault location and system operation analysis.

[0135] like Figure 8 As shown, Figure 8This is a structural diagram of a high-precision synchronous clock device without PPS pulses according to an embodiment of the present invention. The present invention also provides a high-precision synchronous clock device without PPS pulses, comprising:

[0136] The processor 801 can be implemented using a general-purpose central processing unit (CPU), microprocessor, application specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application.

[0137] The memory 802 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 802 can store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 802 and is called and executed by the processor 801 to execute the high-precision synchronous clock method without PPS pulses according to the embodiments of this application.

[0138] The 803 input / output interface is used to implement information input and output.

[0139] The communication interface 804 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0140] Bus 805 transmits information between various components of the device (e.g., processor 801, memory 802, input / output interface 803, and communication interface 804);

[0141] The processor 801, memory 802, input / output interface 803, and communication interface 804 are connected to each other within the device via bus 805.

[0142] This application also provides an electronic device, including the high-precision synchronous clock device without PPS pulses as described above.

[0143] This application embodiment also provides a storage medium, which is a computer-readable storage medium, storing a computer program that, when executed by a processor, implements the above-described high-precision synchronous clock method without PPS pulses.

[0144] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof. The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separate, and may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0145] It will be understood by those skilled in the art that all or some of the steps and systems in the methods disclosed above can be implemented as software, firmware, hardware, and suitable combinations thereof. Some or all of the physical components can be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, which can include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, as is known to those skilled in the art, communication media typically include computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.

[0146] The above provides a detailed description of the preferred embodiments of the present invention. However, the present invention is not limited to the above embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention. All such equivalent modifications or substitutions are included within the scope defined by the claims of the present invention.

Claims

1. A high-precision synchronous clock method without PPS pulses, characterized in that, include: Obtain time error information between an external clock source and a GPS clock, and generate a time message based on the time error information; The GPS clock confirms the first time value and the second time value of the time message, wherein the first time value represents the falling edge of the start bit of the first byte of the time message; When the external clock source receives the completion signal sent by the GPS clock, the external clock source responds to the time synchronization request of the smart power distribution terminal, parses the time message at a preset first moment, obtains a third time value, and obtains the first delay error of the smart power distribution terminal based on the first time value, the second time value and the third time value. The current time information of the GPS clock is confirmed based on the first delay error. The external clock source runs automatically based on the current time information. When the external clock source receives the time synchronization request message sent by the smart power distribution terminal, it obtains the fourth time value at the second moment, organizes the fourth time value into a time synchronization message, and sends the time synchronization message to the smart power distribution terminal at the third moment. The intelligent power distribution terminal parses the communication message to obtain the second delay error of the communication message, and confirms the first current time value of the communication message based on the second delay error; Write the first current time value into the real-time clock of the smart power distribution terminal, and then reread the second current time value of the real-time clock.

2. The high-precision synchronous clock method without PPS pulses according to claim 1, characterized in that, The acquisition of time error information between the external clock source and the GPS clock includes: Confirm that the GPS clock is at the first shift point in an integer millisecond, send the first time value of the time message at the first shift point, and the content of the time message is the second time value; When the external clock source reads the time message, it confirms the first time the first byte is received and the real-time clock records the first current time of the first time the first byte is received in microseconds. Obtain the current baud rate at the first current moment, and calculate the first byte transmission time of the first byte; After receiving the complete time message sent by the GPS clock, the intelligent power distribution terminal parses the time message at the second moment to obtain the first time value, and calculates the second current moment based on the first time value.

3. The high-precision synchronous clock method without PPS pulses according to claim 1, characterized in that, The step of organizing the fourth time value into a time synchronization message includes: The external clock source responds to the time synchronization request message sent by the intelligent power distribution terminal and obtains the fourth time value based on the third time value and a preset number of milliseconds; The fourth time value is organized into a time response message, and it is confirmed whether the intelligent power distribution terminal is in the fourth time. When the intelligent power distribution terminal is at the fourth time, it sends the start bit of the first byte of the time synchronization response message at the fourth time; The preset terminal device and timer drive the start bit of the first byte of the time synchronization response message to adjust the control error of the time synchronization response message.

4. The high-precision synchronous clock method without PPS pulses according to claim 1, characterized in that, The intelligent power distribution terminal parses the communication messages, including: When the intelligent power distribution terminal receives the synchronization message from the external clock source, it determines the first reception completion time of the first byte of the synchronization message; The third current moment after the first reception completion time is recorded in microseconds, and the transmission time of the second byte of the first byte is calculated based on the current baud rate of the intelligent power distribution terminal and the third current moment. The communication message is parsed at the fifth time value to obtain the fourth time value; The fourth time value is recorded as the fourth current moment in microseconds, and the first real-time time of the communication message is calculated based on the third current moment, the fourth current moment, the second byte transmission time, and the fifth time value. The external clock source runs automatically according to the first real-time time to write the second current time value into the real-time clock.

5. The high-precision synchronous clock method without PPS pulses according to claim 4, characterized in that, After writing the second current time value to the real-time clock, the method further includes: Obtain the byte transmission rate and the number of bytes transmitted by the intelligent power distribution terminal, and calculate the third byte transmission time of the communication bus based on the byte transmission rate and the number of bytes transmitted. A timer is started based on the transmission time of the third byte, and the timer is controlled to generate an interrupt based on the first real-time time, the transmission time of the third byte, and the first preset number of seconds. When the timer is interrupted, the second current time and the first preset number of seconds are written into the real-time clock to make the sixth time value written by the real-time clock equal to the whole second.

6. The high-precision synchronous clock method without PPS pulses according to claim 5, characterized in that, After ensuring that the sixth time value written by the real-time clock is equal to the whole second, the method further includes: The intelligent power distribution terminal is powered off and then powered on again. The fourth byte transmission time after the intelligent power distribution terminal is powered on is calculated based on the byte transmission rate and the number of bytes transmitted. The intelligent power distribution terminal is adjusted to read the seconds in a loop until the current second time value obtained by the intelligent power distribution terminal in two consecutive reads changes to a second. The current second time value read last is then set as the current second time of the intelligent power distribution terminal. The timer is initialized with half the transmission time of the fourth byte to adjust the error between the real-time clock and the timer.

7. The high-precision synchronous clock method without PPS pulses according to claim 6, characterized in that, After the intelligent power distribution terminal is powered off and then powered back on, the method further includes: When the intelligent power distribution terminal loses power, the real-time clock maintains the automatic running time of the intelligent power distribution terminal; When the intelligent power distribution terminal is powered on again, the intelligent power distribution terminal reads the second real-time time of the real-time clock.

8. A high-precision synchronous clock device without PPS pulses, characterized in that, It includes at least one control processor and a memory for communicatively connecting to the at least one control processor; The memory stores instructions executable by the at least one control processor, which, when executed, enables the at least one control processor to perform the high-precision synchronous clock method without PPS pulses as described in any one of claims 1 to 7.

9. An electronic device, characterized in that, Includes the high-precision synchronous clock device without PPS pulses as described in claim 8.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions for causing a computer to perform the high-precision synchronous clock method without PPS pulses as described in any one of claims 1 to 7.