Time synchronization system, method, and vehicle

CN122533692APending Publication Date: 2026-08-07GREAT WALL MOTOR CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
GREAT WALL MOTOR CO LTD
Filing Date
2026-06-24
Publication Date
2026-08-07

AI Technical Summary

Technical Problem

然而,当协议因网络拥塞、链路抖动等原因性能退化时,系统可能出现同步精度下降甚至中断的问题

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122533692A_ABST
    Figure CN122533692A_ABST
Patent Text Reader

Abstract

The application provides a time synchronization system and method and a vehicle, the method is applied to the technical field of intelligent networking, the system comprises: a first time source and at least one second time source, first operation data and second operation data are collected through a perception layer, a target time source currently activated is determined by a decision layer and a decision instruction is generated; a protocol channel of the target time source is controlled by an execution layer according to the decision instruction to obtain target time, and the target time obtained is provided to an upper layer service application to provide a synchronization time service. The system can analyze and decide the running state of the time source based on the first operation data and the second operation data, realize stable output of system time through adaptive switching and fusion of the time source, and avoid problems such as decline or interruption of synchronization accuracy of a single time synchronization protocol in related technologies when network fluctuates, low time synchronization reliability caused by inability of adaptive adjustment according to the running environment, and the like.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of intelligent connected vehicle technology, and more specifically, to a time synchronization system, method, and vehicle in the field of intelligent connected vehicle technology. Background Technology

[0002] Related technologies typically employ a single time synchronization protocol to achieve system time alignment, and rely on a fixed protocol for long-term use through static configuration. However, when the protocol's performance degrades due to network congestion, link jitter, or other reasons, the system may experience a decrease in synchronization accuracy or even system interruption. Furthermore, because different time synchronization protocols vary in accuracy and robustness, a single protocol is difficult to adaptively adjust to the operating environment. Summary of the Invention

[0003] This application provides a time synchronization system, method, and vehicle. The system can analyze and make decisions on the operating status of the time source based on first operating data and second operating data. It achieves stable time output through adaptive switching and fusion of time sources, avoiding problems such as decreased or interrupted synchronization accuracy when the single time synchronization protocol is used in related technologies, and low time synchronization reliability due to the inability to adaptively adjust according to the operating environment.

[0004] Firstly, a time synchronization system is provided, comprising: a first time source and at least one second time source; a perception layer for collecting first operational data from the first time source and second operational data from at least one second time source; a decision layer for determining a currently active target time source based on the first and second operational data, and generating a decision instruction based on the currently active target time source, wherein the target time source includes at least one of the first and second time sources; and an execution layer for controlling the protocol channel of the target time source to obtain a target time through the decision instruction, and providing synchronization time services to upper-layer business applications based on the target time obtained through the protocol channel of the target time source.

[0005] Through the above technical solution, the embodiments of this application acquire the running data of multiple time sources in real time through the perception layer, and the decision layer dynamically determines the target time source based on the running data. Then, the execution layer obtains the target time and outputs the synchronization time service based on the decision result, thereby realizing real-time perception and unified management of the running status of multiple time sources. While ensuring the accuracy of time synchronization, it improves the continuity of time synchronization service, avoids the interruption of synchronization service due to the abnormality of a single time source, and provides basic support for subsequent dynamic switching, smooth transition and multi-time source collaboration.

[0006] In conjunction with the first aspect, in some possible implementations, the decision layer is further configured to: determine a first precision index value and a first quality index value of the first time source based on the first operating data; determine a first operating state of the first time source based on the first precision index value and the first quality index value, wherein the first operating state includes at least one of a first state and a second state, wherein the first state indicates that the first time source is operating normally and the second state indicates that the first time source is operating abnormally; if the operating state is the first state, then the target time source is determined to be the first time source; if the operating state is the second state, then a pre-switching state from the first time source to the second time source is entered based on the second operating data, wherein the target time source includes both the first time source and the second time source.

[0007] The above technical solution comprehensively evaluates the accuracy and quality indicators of the first time source to determine its operating status. Based on this, the first time source is directly selected under normal circumstances, and a pre-switching state to the second time source is triggered under abnormal circumstances. This enables the system to make dynamic decisions and switch states based on the operating quality of the time source. In this way, while ensuring high-precision time synchronization output, the system's ability to respond quickly to time source anomalies is improved, synchronization interruption caused by the failure of a single time source is avoided, and a state basis is provided for subsequent multi-time source collaboration and smooth switching.

[0008] In conjunction with the first aspect and the above implementation method, the decision layer is also used to: if the first precision index value is less than the first precision threshold, then determine the first operating state as the first state; if the first quality index value is less than the first quality threshold, then determine the first operating state as the second state.

[0009] Through the above technical solution, this application determines the first time source by setting accuracy thresholds and quality thresholds respectively. This enables the system to comprehensively evaluate the first time source from two dimensions: synchronization accuracy and communication quality. This allows for rapid and clear identification of whether the first time source is in normal operating condition, achieving standardized and quantifiable judgment of the time source's operating status. Compared to judgment methods based on only a single indicator, this method effectively reduces the risk of misjudgment caused by fluctuations or instantaneous anomalies of a single indicator, improving the stability and reliability of status judgment. Furthermore, it provides a clear and stable basis for determining whether to maintain the current time source's continuous time synchronization service or trigger a pre-switch to a second time source, thereby improving the timeliness and accuracy of time source switching decisions and the overall stability of the system operation.

[0010] In conjunction with the first aspect and the above implementation method, the decision layer is also used to: determine the second precision index value and the second quality index value of the second time source based on the second operating data; determine the second operating state of the second time source based on the second precision index value and the second quality index value, wherein the second operating state includes at least one of a third state and a fourth state, wherein the third state indicates that the second time source is operating normally and the fourth state indicates that the second time source is operating abnormally; if the second operating state of at least one second time source is the third state, then the pre-switching state from the first time source to the second time source is entered, otherwise the pre-switching state is not entered.

[0011] By comprehensively evaluating the accuracy and quality indicators of the second time source through the above technical solution, the system can identify the availability of backup or extended time sources in advance, thereby avoiding the delays and uncertainties caused by temporarily searching for an available time source when the first time source malfunctions. Furthermore, by introducing a second operational status determination mechanism, the system can classify the operational health of the second time source, entering the pre-switching state only when at least one second time source is in a normal state, thus ensuring the effectiveness and reliability of the switching target and avoiding invalid or erroneous switching.

[0012] In conjunction with the first aspect and the above implementation method, the decision-making layer is also used to: if the second precision index value is less than the second precision threshold, then determine the second operating state as the third state; if the second quality index value is less than the second quality threshold, then determine the second operating state as the fourth state.

[0013] Through the above technical solution, this application introduces a judgment mechanism for a second precision index and a second quality index respectively, enabling the system to comprehensively identify and distinguish the operating status of the second time source from two dimensions: time synchronization accuracy and communication link quality. This avoids the problem of misjudgment of status or incomplete evaluation that may be caused by relying on only a single evaluation index.

[0014] In conjunction with the first aspect and the above implementation method, the decision layer is also used to: determine the respective weights of the first time source and the second time source based on the first quality index value, wherein the weight of the first time source is directly proportional to the first quality index value; and generate decision instructions based on the currently activated target time source and its respective weight.

[0015] By introducing a weighting mechanism based on a first quality index value, this application can dynamically adjust the influence ratio of the first time source in the time synchronization process according to its operational quality. This avoids the rigid dependence problem caused by fixed weights or a single main time source, and improves the adaptability of the time synchronization strategy. Furthermore, by assigning weights to the first and second time sources respectively, and dynamically adjusting these weights according to changes in the quality index, this application can achieve differentiated utilization of multiple time sources under different network conditions or time source performance conditions. This allows high-quality time sources to receive higher influence weights, while the influence of low-quality time sources gradually decreases, improving the stability of the time synchronization results. Simultaneously, this application can also achieve a smooth transition during target time source switching, avoiding time jump problems caused by direct time source switching. This allows the system to improve continuity while ensuring time synchronization accuracy, and enhances its adaptability to changes in complex network environments.

[0016] Combining the first aspect and the above implementation method, the execution layer is used to: identify the respective weights of the first time source and the second time source; obtain the first time of the first time source and the second time of the second time source; and calculate the target time based on the first time, the second time, and their respective weights.

[0017] Through the above technical solution, by introducing a multi-time source weight identification and time fusion calculation mechanism at the execution layer, this application can comprehensively utilize the time information of the first and second time sources during the same time synchronization output process, rather than relying on a single time source, thereby improving the stability and robustness of the system's time output. Furthermore, by weighting the time results of different time sources based on their respective weights, the system can dynamically adjust the proportion of each time source's influence on the final target time according to changes in the quality of the time source, thereby reducing the impact of fluctuations from a single time source on the overall time accuracy of the system and avoiding time jumps caused by instantaneous anomalies in a particular time source. Simultaneously, by implementing unified time calculation and output processing at the execution layer, this application eliminates the need for upper-layer business applications to be aware of the underlying time source types and protocol differences, thereby improving the system's protocol transparency and scalability, and providing a good foundation for the subsequent integration of new time synchronization protocols.

[0018] Combining the first aspect and the above implementation method, the execution layer includes at least one adapter and a target interface. The adapter is used to adapt to the target time source and obtain the target time from the protocol channel of the target time source in response to the decision instruction. The target interface provides synchronization time service to the upper-layer business application based on the target time and sends the decision instruction to the adapter.

[0019] Through the above technical solution, by introducing a layered structure design of adapters and target interfaces in the execution layer, the system can shield and uniformly encapsulate the differences between different types of time sources, thereby achieving compatibility and unified access to multiple protocol time sources. Furthermore, by dynamically adapting the protocol channels of the target time source through the adapter, the system can quickly switch or access the corresponding time source's time acquisition path after receiving decision instructions from the decision layer, improving the flexibility and response efficiency of time source switching and invocation. Simultaneously, by providing a unified time service output to upper-layer business applications through the target interface, upper-layer applications do not need to concern themselves with the differences in underlying time source types and protocol implementations, thereby reducing system coupling, improving the system's module independence and scalability, and providing a solid architectural foundation and expansion capabilities for the subsequent access of new time synchronization protocols.

[0020] Secondly, a time synchronization method is provided, which is applied to the decision layer of the aforementioned time synchronization system. The method includes: acquiring first running data from a first time source and second running data from at least one second time source; determining a currently active target time source based on the first and second running data; generating a decision instruction based on the currently active target time source, wherein the target time source includes at least one of the first and second time sources; sending the decision instruction to the execution layer; controlling the protocol channel of the target time source to acquire the target time through the response of the execution layer to the decision instruction; and providing time synchronization services to upper-layer business applications based on the target time acquired through the protocol channel of the target time source.

[0021] Thirdly, a vehicle is provided that includes any of the above-mentioned time synchronization systems. Attached Figure Description

[0022] Figure 1 This is a schematic diagram of the time synchronization system provided in an embodiment of this application; Figure 2 This is a schematic diagram of the overall architecture of the time synchronization system provided in the embodiments of this application; Figure 3 This is a schematic flowchart of the time synchronization method provided in the embodiments of this application. Detailed Implementation

[0023] The technical solutions in this application will be clearly and thoroughly described below with reference to the accompanying drawings. In the description of the embodiments of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B. "And / or" in the text is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, in the description of the embodiments of this application, "multiple" refers to two or more than two.

[0024] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature.

[0025] In distributed systems, vehicle electronic systems, and industrial control systems, a unified time synchronization system is typically required to ensure data consistency, event timing accuracy, and collaborative control reliability among nodes, providing a unified time reference for each business module. In related technologies, time synchronization primarily relies on network time protocols, precision time protocols, and other time synchronization protocols. Typically, a fixed time synchronization protocol is pre-configured during deployment and continuously used during operation to obtain time information, maintaining system time consistency. Under normal network conditions, a single time synchronization protocol can provide relatively stable time synchronization services. However, when network links experience congestion, route switching, link jitter, packet loss, or fluctuations in clock source quality, the performance of the adopted time synchronization protocol may degrade. For example, while high-precision time synchronization protocols offer high time synchronization accuracy, they are sensitive to changes in network latency and link jitter, and when network conditions deteriorate, problems such as increased synchronization deviation, decreased synchronization accuracy, or even loss of lock can easily occur. Conversely, while robust time synchronization protocols have good network adaptability, their synchronization accuracy is relatively limited, making it difficult to meet the application requirements of high-precision time synchronization scenarios.

[0026] Furthermore, most time synchronization systems employ static configuration to manage time synchronization protocols. This means that once the system starts, it consistently uses a specific time synchronization protocol as its time source, lacking continuous awareness of the time source's operational status, synchronization accuracy, and communication quality during operation. When the selected time source experiences performance degradation or abnormal failure, the system typically cannot automatically select a better time source based on the current network conditions and time source quality, nor can it coordinate or dynamically switch between multiple time sources. Even if some systems are configured with backup time sources, the switching method often employs a primary / backup switching mode. This switching process is prone to issues such as time jumps, time drift, or synchronization interruptions, impacting the normal operation of business systems that rely on time synchronization. Because different time synchronization protocols differ significantly in message format, synchronization mechanism, clock model, and interface implementation, related technologies are often deeply coupled with specific protocols. Adding a new time synchronization protocol or changing the time source often requires extensive modifications to the system architecture, resulting in poor system scalability and high maintenance costs.

[0027] Therefore, how to perceive and evaluate the operating status of different time sources in real time under the condition of multiple time sources coexisting, and dynamically select the target time source according to the quality of the time source, so as to achieve smooth switching or collaborative fusion between multiple time sources, and at the same time continuously provide stable, reliable and unified time synchronization services to upper-layer business applications, has become a technical problem that urgently needs to be solved to improve the accuracy, availability and scalability of the time synchronization system.

[0028] The application scenarios or system architecture of the embodiments of this application will be described next.

[0029] The application scenarios of this application mainly address the problems in related technologies where time synchronization systems rely on a single time synchronization protocol, making it difficult to balance synchronization accuracy and availability, and the inability to achieve adaptive switching of time sources and stable time output when there are network fluctuations or time source anomalies. Specifically, this embodiment proposes a time synchronization system, particularly suitable for vehicle systems equipped with multiple electronic control units such as vehicle controllers, domain controllers, battery management systems, and intelligent driving controllers. This time synchronization system includes a first time source, at least one second time source, a perception layer, a decision layer, and an execution layer. The first time source provides a primary time reference, and the second time source provides a backup or auxiliary time reference. The first and second time sources can be implemented using different time synchronization protocols, such as a precision time protocol time source, a network time protocol time source, or a time source corresponding to another time synchronization protocol. The perception layer collects first operating data from the first time source and second operating data from at least one second time source. The operating data may include indicators such as time deviation, frequency deviation, delay, jitter, and packet loss rate. By acquiring the operational status information of multiple time sources in real time, data support is provided for subsequent time source status evaluation and decision analysis. The decision layer determines the currently active target time source based on the first and second operational data, and generates decision instructions based on the currently active target time source. By analyzing and evaluating the operational status of multiple time sources, dynamic selection, switching, or fusion of time sources is achieved, improving the system's adaptability to complex network environments and reducing the impact of single time source anomalies on time synchronization services. The execution layer controls the target time source's protocol channel to acquire the target time through decision instructions, and provides synchronized time services to upper-layer business applications based on the target time acquired through the target time source's protocol channel. By uniformly adapting and managing different time synchronization protocols, unified output of time services is achieved, improving system compatibility, scalability, and the continuity and stability of time output. Through the collaborative cooperation of the perception layer, decision layer, and execution layer, this application can analyze and make decisions on the operational status of time sources based on the first and second operational data, and achieve stable system time output through adaptive switching and fusion of time sources, avoiding problems in related technologies such as decreased or interrupted synchronization accuracy when a single time synchronization protocol experiences network fluctuations, and low reliability of time synchronization due to the inability to adaptively adjust to the operating environment.

[0030] Figure 1 This is a schematic diagram of the structure of a time synchronization system provided in an embodiment of this application.

[0031] For example, such as Figure 1 As shown, the time synchronization system 10 may include: a first time source 100, at least one second time source 200, a perception layer 300, a decision layer 400, and an execution layer 500.

[0032] The system comprises: a perception layer 300, used to collect first operating data from a first time source 100 and second operating data from at least one second time source 200; a decision layer 400, used to determine the currently activated target time source based on the first and second operating data, and to generate decision instructions based on the currently activated target time source, wherein the target time source includes at least one of the first time source 100 and the second time source 200; and an execution layer 500, used to control the protocol channel of the target time source to obtain the target time through the decision instructions, and to provide synchronization time services to upper-layer business applications based on the target time obtained through the protocol channel of the target time source.

[0033] The time synchronization system 10 is a system architecture for realizing the collaborative management of multiple time sources and the output of time synchronization services. In this application, it represents an adaptive time synchronization system 10 with a perception layer 300, a decision layer 400, and an execution layer 500. The first time source 100 is the primary time reference source that the system prioritizes. In this application, it represents a high-priority time source that currently provides time synchronization services by default. The second time source 200 is a time reference source used to supplement or replace the first time source 100 when it is abnormal or its performance degrades. In this application, it represents a backup time source or an auxiliary time source. The perception layer 300 is used to obtain the operation of time sources. The functional module for tracking status information, in this application, represents a monitoring module that collects first and second running data; the decision layer 400 is a functional module for generating control strategies based on the running status, in this application, representing a logic module that determines the target time source and generates decision instructions; the execution layer 500 is a functional module for executing time synchronization strategies, in this application, representing a control module that responds to decision instructions and outputs the target time; the first running data is data reflecting the running status of the first time source 100, in this application, representing data related to the accuracy, quality, and synchronization status of the first time source 100, and may include the first time source. The parameters include: time deviation, frequency deviation, synchronization status, and network latency; second operating data, which reflects the operating status of the second time source 200, and in this application represents data related to the accuracy, quality, and synchronization status of the second time source 200, including parameters such as time deviation, round-trip delay, jitter, and packet loss rate of the second time source 200; target time source, which is the time source currently participating in the time synchronization service output, and in this application represents a combination of time sources consisting of the first time source 100, the second time source 200, or both; decision instruction, which is control information generated by the decision layer 400, and in this application represents an instruction used to control the selection of the target time source and the time acquisition method; protocol channel, which is the communication link for time source interaction of time synchronization information, and in this application represents the data transmission path of the corresponding time synchronization protocol; target time, which is time information obtained based on the target time source, and in this application represents the synchronization reference time provided to the upper-layer business application; synchronization time service, which is a service function that provides a unified time reference to the business system, and in this application represents the time synchronization function implemented based on the target time; upper-layer business application, which is an application or business system that depends on the synchronization time to run, and in this application represents the functional module that calls the synchronization time service.

[0034] It is understood that in this embodiment of the application, the perception layer 300 acquires the running data of multiple time sources in real time, the decision layer 400 dynamically determines the target time source based on the running data, and the execution layer 500 obtains the target time and outputs the synchronization time service based on the decision result. This enables real-time perception and unified management of the running status of multiple time sources, improves the continuity of the time synchronization service while ensuring the accuracy of time synchronization, avoids the interruption of the synchronization service due to the abnormality of a single time source, and provides basic support for subsequent dynamic switching, smooth transition and multi-time source collaboration.

[0035] The first time source 100 and the second time source 200 correspond to different protocol channels, which can be precision time protocol channels, network time protocol channels, or other time synchronization protocol channels.

[0036] The first time source 100 serves as the primary time reference source in the system. In some embodiments, the first time source 100 can be a currently preferred high-precision time source (including but not limited to a precision time protocol channel time source). The first time source 100 can also be adjusted or replaced according to the system configuration. The second time source 200 serves as other time reference sources besides the first time source 100. It can include backup time sources, auxiliary time sources, and future expandable time synchronization sources. In some embodiments, the second time source 200 can include not only time sources corresponding to existing time synchronization protocols, such as network time protocol channel time sources, but also time sources corresponding to future developed or unstandardized time synchronization protocols, to achieve compatibility and expansion with different types of time sources.

[0037] In one embodiment of this application, the perception layer 300 is used to collect first running data from a first time source 100 and second running data from at least one second time source 200. To this end, the perception layer 300 can maintain multiple protocol channels in parallel and establish communication connections with corresponding protocol stack instances. Each protocol stack instance is responsible for parsing synchronization messages in its corresponding protocol channel and extracting running data reflecting time synchronization performance.

[0038] Specifically, the perception layer 300 can periodically monitor the status of each protocol channel. The monitoring period can be configured according to actual application requirements, such as 100 milliseconds, 500 milliseconds, 1 second, or other time intervals. The collected first and second operational data include, but are not limited to, at least one of accuracy indicators, quality indicators, and status indicators. Among them, accuracy indicators may include data such as time deviation and frequency deviation used to characterize time synchronization accuracy; quality indicators may include data such as round-trip delay, delay jitter, packet loss rate, and clock level used to characterize communication link quality; and status indicators may include data such as protocol lock status, synchronization hold time, and number of synchronization loss counts used to characterize time synchronization stability.

[0039] After acquiring the first and second operational data, the perception layer 300 can organize the collected results and send the processed operational data to the decision layer 400. The decision layer 400 analyzes the current operational status of each time source based on the first and second operational data, providing a basis for subsequent determination of the target time source.

[0040] In one embodiment of this application, the decision layer 400 is further configured to: determine a first precision index value and a first quality index value of the first time source 100 based on the first operating data; determine a first operating state of the first time source 100 based on the first precision index value and the first quality index value, wherein the first operating state includes at least one of a first state and a second state, wherein the first state indicates that the first time source 100 is operating normally, and the second state indicates that the first time source 100 is operating abnormally; if the operating state is the first state, then the target time source is determined to be the first time source 100; if the operating state is the second state, then the first time source 100 is entered into a pre-switching state to the second time source 200 based on the second operating data, and the target time source is determined to include the first time source 100 and the second time source 200.

[0041] The first precision index is a quantitative parameter used to characterize the time synchronization precision of the first time source 100, and in this application represents a time deviation or frequency deviation index calculated based on the first operating data; the first quality index is a quantitative parameter used to characterize the communication link and synchronization stability of the first time source 100, and in this application represents a comprehensive quality evaluation index obtained based on operating data such as delay, jitter, and packet loss rate; the first operating state is a status identifier used to characterize the current working status of the first time source 100, and in this application represents a normal or abnormal operating state determined comprehensively based on the first precision index and the first quality index; the first state is a normal operating state in the first operating state, and in this application represents an operating state in which the first time source 100 meets the preset precision and quality requirements; the second state is an abnormal operating state in the first operating state, and in this application represents an operating state in which the first time source 100 does not meet the preset precision or quality requirements; the pre-switching state is a transitional control state of the system before the time source switch, and in this application represents an operating state in which the two types of time sources are activated simultaneously and transitionally merged during the switching process from the first time source 100 to the second time source 200.

[0042] Understandably, by comprehensively evaluating the accuracy and quality indicators of the first time source 100, its operating status is determined. Based on this, the first time source 100 is directly selected under normal circumstances, and a pre-switching state to the second time source 200 is triggered under abnormal circumstances. This enables the system to make dynamic decisions and switch states based on the operating quality of the time source, thereby ensuring high-precision time synchronization output, improving the system's ability to respond quickly to time source anomalies, avoiding synchronization interruptions caused by the failure of a single time source, and providing a state basis for subsequent multi-time source collaboration and smooth switching.

[0043] In one embodiment of this application, the decision layer 400 calculates the time deviation of the first time source 100 as 0.8 μs and the jitter as 10 μs based on the first operating data obtained by the perception layer 300. At this time, it is determined that the first time source 100 is in a normal operating state, i.e., the first state, and the first time source 100 is determined as the current target time source. The system continuously uses the precision time protocol time source to output high-precision synchronization time.

[0044] When the network environment changes, for example, if the jitter of the first time source 100 increases to 120μs and the latency increases significantly, the decision layer 400 determines that the first time source 100 is in an abnormal operating state, i.e., the second state. At this time, the decision layer 400 further evaluates the second time source 200 based on the second operating data. If the time deviation of the second time source 200 is 5ms and the latency is 30ms, which meets the operating requirements, the system enters a pre-switching state from the first time source 100 to the second time source 200, and determines the target time source as a combination of the first time source 100 and the second time source 200 or a transitional state for subsequent smooth switching.

[0045] In one embodiment of this application, the decision layer 400 is further configured to: determine the first operating state as the first state if the first precision index value is less than the first precision threshold; and determine the first operating state as the second state if the first quality index value is less than the first quality threshold.

[0046] Wherein, the first precision threshold is a judgment threshold used to determine whether the first time source 100 meets the preset precision requirements, and in this application, it represents the time synchronization precision boundary value preset by the system; the first quality threshold is a judgment threshold used to determine whether the first time source 100 meets the preset quality requirements, and in this application, it represents the communication quality or synchronization stability boundary value preset by the system.

[0047] Understandably, this application determines the first time source 100 by setting precision thresholds and quality thresholds respectively, enabling the system to comprehensively evaluate the first time source 100 from two dimensions: synchronization precision and communication quality. This allows for quick and clear identification of whether the first time source 100 is in normal operating condition, achieving standardized and quantifiable judgment of the time source's operating status. Compared to judgment methods based on only a single indicator, this method effectively reduces the risk of misjudgment caused by fluctuations or instantaneous anomalies of a single indicator, improving the stability and reliability of status judgment. Furthermore, it provides a clear and stable basis for determining whether to maintain the current time source's continuous time synchronization service or trigger a pre-switching process to the second time source 200, thereby improving the timeliness and accuracy of time source switching decisions and the overall stability of system operation.

[0048] Specifically, the decision layer 400 determines the first precision index value and the first quality index value of the first time source 100 based on the first operating data. The first precision index value is used to characterize the current time synchronization deviation (including but not limited to time deviation) of the first time source 100, and the first quality index value is used to characterize the communication stability of the first time source 100.

[0049] When the first quality index value of the first time source 100 is less than the first quality threshold, that is, when the jitter index or delay index exceeds the preset threshold (for example, jitter greater than 100μs, or delay index greater than 200μs), the decision layer 400 determines that the first operating state of the first time source 100 is the second state, and the first operating quality decreases.

[0050] When the first precision index value meets the preset precision condition and the first quality index value is less than the first precision threshold (e.g., time deviation less than 1μs), the decision layer 400 determines that the first time source 100 is in normal operating condition and designates the first time source 100 as the currently active target time source. Subsequently, the decision layer 400 generates a corresponding decision instruction and sends it to the execution layer 500. Upon receiving the decision instruction, the execution layer 500 controls the protocol channel corresponding to the first time source 100 to enter the working state, obtains the target time from the protocol channel of the first time source 100, and outputs the target time as the system synchronization time to the upper-layer business application, thereby putting the system in a high-precision time synchronization mode.

[0051] In one embodiment of this application, the decision layer 400 is further configured to: determine a second precision index value and a second quality index value of the second time source 200 based on the second operating data; determine a second operating state of the second time source 200 based on the second precision index value and the second quality index value, wherein the second operating state includes at least one of a third state and a fourth state, wherein the third state indicates that the second time source 200 is operating normally and the fourth state indicates that the second time source 200 is operating abnormally; if the second operating state of at least one second time source 200 is the third state, then the process enters a pre-switching state from the first time source 100 to the second time source 200, otherwise the process does not enter the pre-switching state.

[0052] The second precision index is a quantitative parameter used to characterize the time synchronization precision of the second time source 200, and in this application represents a time deviation or frequency deviation index calculated based on the second operating data; the second quality index is a quantitative parameter used to characterize the communication link quality and synchronization stability of the second time source 200, and in this application represents a quality evaluation index obtained by comprehensively considering operating data such as delay, jitter, packet loss rate, and clock level; the second operating state is a status identifier used to characterize the current operating status of the second time source 200, and in this application represents a normal or abnormal operating state determined by comprehensively considering the second precision index and the second quality index; the third state is the normal state in the second operating state, and in this application represents the operating state in which the second time source 200 meets the preset precision and quality requirements; the fourth state is the abnormal state in the second operating state, and in this application represents the operating state in which the second time source 200 does not meet the preset precision or quality requirements.

[0053] Understandably, by comprehensively evaluating the accuracy and quality indicators of the second time source 200, the system can identify the availability of backup or extended time sources in advance, thereby avoiding the delays and uncertainties caused by temporarily searching for an available time source when the first time source 100 malfunctions. Furthermore, by introducing a second operational status determination mechanism, the system can classify the operational health of the second time source 200, entering the pre-switching state only when at least one second time source 200 is in a normal state, thus ensuring the effectiveness and reliability of the switching target and avoiding invalid or erroneous switching.

[0054] Specifically, when the first quality index value of the first time source 100 is less than the first quality threshold, the decision layer 400 performs a status assessment on the second time source 200 corresponding to at least one second time source 200. The assessment method is the same as that of the first time source 100. Based on the second precision index and the second quality index corresponding to the second running data, the running status of the time source is determined by comparing the second precision index with the preset second precision threshold and the second quality index with the preset second quality threshold. However, the corresponding threshold parameters can be configured differently according to the protocol characteristics.

[0055] When the second precision index value (including but not limited to time deviation) of the second time source 200 is less than the second precision threshold (e.g., time deviation less than 2.5 μs), the decision layer 400 determines that the second time source 200 is in normal operating condition. In this case, the decision layer 400 enters the pre-switching state and generates a pre-switching control command to send to the execution layer 500, so that the execution layer 500 simultaneously maintains the usability of both the first time source 100 and the second time source 200, thereby providing a basis for subsequent time source switching or time fusion output.

[0056] In addition, the second time source 200 may further include a backup time source, such as a real-time clock time source based on a local clock, to ensure that the basic time output service can still be maintained when all external time synchronization sources are unavailable.

[0057] In one embodiment of this application, the decision layer 400 is further configured to: determine the second operating state as the third state if the second precision index value is less than the second precision threshold; and determine the second operating state as the fourth state if the second quality index value is less than the second quality threshold.

[0058] Wherein, the second precision threshold is a judgment boundary value used to determine whether the second time source 200 meets the preset precision requirements, and in this application, it represents the precision performance benchmark preset by the system; the second quality threshold is a judgment boundary value used to determine whether the second time source 200 meets the preset quality requirements.

[0059] Understandably, this application uses a multi-dimensional approach to determine the operational status of the second time source 200 by setting separate thresholds for the second precision index and the second quality index. This allows the system to independently evaluate the second time source 200 from two different perspectives: time synchronization accuracy and communication quality, thus avoiding the biased judgment caused by relying on a single evaluation index. Furthermore, since the second precision index reflects the degree of deviation in the time synchronization result, while the second quality index reflects the stability and reliability of network transmission, such as latency fluctuations, jitter, and packet loss, setting threshold constraints for the second precision index and the second quality index separately enables the system to distinguish between different types of abnormal states, such as "abnormal synchronization accuracy" and "abnormal communication quality." In addition, the aforementioned dual-threshold determination mechanism provides a clearer evaluation basis for the selection and switching between multiple second time sources 200, enabling the system to stably select time sources that meet the conditions to participate in the time synchronization service when multiple candidate time sources coexist, thereby improving the overall stability and availability of the time synchronization system 10 in complex network environments.

[0060] In one embodiment of this application, the decision layer 400 is further configured to: determine the respective weights of the first time source 100 and the second time source 200 based on the first quality index value, wherein the weight of the first time source 100 is directly proportional to the first quality index value; and generate decision instructions based on the currently activated target time source and its respective weight.

[0061] The weight is a weight coefficient used to characterize the proportion of influence of each time source in the current time synchronization process. In this application, it represents a numerical parameter used to participate in target time calculation or decision fusion. The currently activated target time source is the time source determined by the decision layer 400 and currently participating in the output of the time synchronization service. In this application, it represents a set of one or more time sources that are currently selected or activated simultaneously.

[0062] Understandably, by introducing a weighting mechanism based on the first quality index value, this application can dynamically adjust the influence ratio of the first time source 100 in the time synchronization process according to its operational quality, avoiding the rigid dependence problem caused by fixed weights or a single main time source, and improving the adaptability of the time synchronization strategy. Furthermore, by assigning weights to the first time source 100 and the second time source 200 respectively, and dynamically adjusting these weights according to changes in the quality index, this application can achieve differentiated utilization of multiple time sources under different network conditions or time source performance conditions. This allows high-quality time sources to receive higher influence weights, while the influence of low-quality time sources gradually decreases, improving the stability of the time synchronization results. Simultaneously, this application can also achieve a smooth transition during target time source switching, avoiding time jump problems caused by direct time source switching, enabling the system to improve continuity while ensuring time synchronization accuracy, and enhancing its adaptability to changes in complex network environments.

[0063] Specifically, when the first operating state of the first time source 100 is determined to be the second state, and the second operating state of at least one second time source 200 is the third state, the decision layer 400 determines that the system enters a pre-switching state. Based on the degree of deterioration in operating quality, the weight α of the first time source 100 is dynamically adjusted, causing the weight α of the first time source 100 to gradually decrease from 1 to 0. The weight α of the first time source 100 is directly proportional to the value of the first quality index; specifically, the larger the value of the first quality index, the larger the corresponding weight α of the first time source 100; the smaller the value of the first quality index, the smaller the corresponding weight α of the first time source 100.

[0064] In this pre-switching state, the execution layer 500 does not immediately cut off the first time source 100, but instead performs fusion processing on the time outputs of the first time source 100 and the second time source 200 according to the weight α of the first time source 100, so as to achieve a smooth transition between different time sources.

[0065] The fusion processing can be implemented using a weighted linear fusion method, which will be illustrated below with a specific embodiment. Assuming that this application uses a Precision Time Protocol (Precision Time Protocol) channel time source and a Network Time Protocol (Network Time Protocol) channel time source as the first time source and the second time source, respectively, the system time is calculated using the following formula: System time = α × T_1 + (1 - α) × T_2 Where α represents the weight of the first time source 100, 1 - α represents the weight of the second time source 200, T_1 represents the output time of the first time source 100, and T_2 represents the output time of the second time source 200.

[0066] Since this application uses a Precision Time Protocol (Precision Time Protocol) channel time source and a Network Time Protocol (Network Time Protocol) channel time source as the first time source and the second time source, respectively, the formula is as follows: System time = α × T_ptp + (1 - α) × T_ntp Where T_ptp represents the time output by the first time source 100 (here, the Precision Time Protocol channel time source), and T_ntp represents the time output by the second time source 200 (here, the Network Time Protocol channel time source).

[0067] When the decision layer 400 detects that the operating quality of the first time source 100 has recovered, it executes the opposite adjustment process, gradually increasing the weight α from 0 to 1, thereby restoring the use of the first time source 100 and realizing a smooth two-way switching of the time source.

[0068] In this way, when the performance of the first time source 100 degrades, the system time can smoothly transition from the first time source 100 to the second time source 200, thereby avoiding the time jump problem caused by direct switching of time sources.

[0069] In one embodiment of this application, the execution layer 500 is used to: identify the respective weights of the first time source 100 and the second time source 200; obtain the first time of the first time source and the second time of the second time source 200; and calculate the target time based on the first time, the second time, and their respective weights.

[0070] Wherein, the first time is the time information output by the first time source 100 through the corresponding protocol channel, which in this application represents the synchronization time value currently provided by the first time source 100; the second time is the time information output by the second time source 200 through the corresponding protocol channel, which in this application represents the synchronization time value currently provided by the second time source 200.

[0071] Understandably, by introducing a multi-time source weight identification and time fusion calculation mechanism in the execution layer 500, this application can comprehensively utilize the time information of the first time source 100 and the second time source 200 during the same time synchronization output process, rather than relying on a single time source, thereby improving the stability and robustness of the system's time output. Furthermore, by weighting the time results of different time sources based on their respective weights, the system can dynamically adjust the proportion of the time source's influence on the final target time according to changes in the quality of the time source, thereby reducing the impact of fluctuations in a single time source on the overall time accuracy of the system and avoiding time jump problems caused by instantaneous anomalies in a certain time source. Simultaneously, by implementing unified time calculation and output processing in the execution layer 500, this application eliminates the need for upper-layer business applications to be aware of the underlying time source types and protocol differences, thereby improving the system's protocol transparency and scalability, and providing a good foundation for the subsequent integration of new time synchronization protocols.

[0072] In one embodiment of this application, the execution layer 500 includes at least one adapter and a target interface. The adapter is used to adapt to the target time source, obtain the target time from the protocol channel of the target time source in response to decision instructions, and the target interface provides synchronization time services to the upper-layer business applications based on the target time and sends decision instructions to the adapter.

[0073] The adapter is a protocol adaptation component located within the execution layer 500. In this application, it represents a functional module used to convert time sources with different time synchronization protocols into a unified access method, which is used to shield the implementation differences between different protocols. The protocol channel is a data transmission link used by each time source to transmit time synchronization messages. In this application, it represents a communication channel established based on different time synchronization protocols. The target interface is a unified access interface provided by the execution layer 500 to the outside world for time services. In this application, it represents an interface module that provides standardized time services to upper-layer business applications.

[0074] Understandably, by introducing a layered architecture of adapters and target interfaces in the execution layer 500, the system can shield and uniformly encapsulate the differences between different types of time sources, thereby achieving compatibility and unified access to multiple protocol time sources. Furthermore, by dynamically adapting the protocol channels of the target time source through the adapter, the system can quickly switch or access the corresponding time source's time acquisition path after receiving decision instructions from the decision layer 400, improving the flexibility and response efficiency of time source switching and invocation. Simultaneously, by providing a unified time service output to upper-layer business applications through the target interface, upper-layer applications do not need to concern themselves with the differences in underlying time source types and protocol implementations, thereby reducing system coupling, enhancing the system's module independence and scalability, and providing a solid architectural foundation and expansion capabilities for the subsequent integration of new time synchronization protocols.

[0075] In one specific embodiment of this application, the execution layer 500 is positioned between the decision engine and the upper-layer business application, serving as a protocol-independent unified time abstraction layer.

[0076] Specifically, the execution layer 500 includes a unified time service interface and multiple protocol adapters. The unified time service interface defines standard time service primitives, such as get_time(), set_time(), and adjust_freq(), to provide unified time access capabilities to upper-layer business applications.

[0077] In this implementation, the decision layer 400 issues a decision instruction to the execution layer 500, such as specifying the target time source currently used as the precision time protocol time source, or specifying the time fusion method currently adopted and the respective weights of the first time source 100 and the second time source 200.

[0078] After receiving the decision instruction, the execution layer 500 parses the instruction by the unified scheduling module and converts it into a control command for the corresponding protocol adapter, thereby controlling the protocol channel of the corresponding time source to acquire time data or perform time fusion calculation.

[0079] For upper-layer business applications, the system time is always obtained through the unified time service interface without needing to be aware of the type of time synchronization protocol used at the underlying layer. The execution layer 500 masks the implementation differences of different protocols.

[0080] When a new time synchronization protocol needs to be introduced, only a new adapter plugin for the corresponding protocol needs to be added and registered in the adapter management module of the execution layer 500 to enable access to the new protocol, without modifying the decision logic of the decision layer 400 or the interface calling method of the upper-layer business application, thereby achieving the system's scalability and hot-swappability.

[0081] The execution layer 500 can also reserve configurable interfaces for key parameters in the decision-making algorithm, such as the jitter threshold, the delay threshold, and the step size of the weight α of the first time source 100, to support dynamic policy adjustment in different application scenarios.

[0082] In summary, the overall architecture of the embodiments of this application is as follows: Figure 2 As shown, it includes a first time source 100, at least one second time source 200, a perception layer 300, a decision layer 400, and an execution layer 500. It constructs a hierarchical time synchronization decision and unified service architecture based on multiple time sources, which is used to realize real-time perception, dynamic decision-making, protocol adaptation, and unified time service output of time sources.

[0083] In the perception layer 300, first operating data from a first time source 100 and second operating data from at least one second time source 200 are acquired. The first and second operating data include at least accuracy and quality indicators to characterize the synchronization performance and communication status of the corresponding time sources, such as parameters like time deviation, frequency deviation, round-trip delay, jitter, and packet loss rate. This allows for real-time monitoring and quantitative characterization of the operating status of each time source, providing a data foundation for subsequent decision-making.

[0084] In the decision layer 400, the currently active target time source is determined based on the first and second operating data, and decision instructions are generated according to the target time source. The target time source includes at least one of the first time source 100 and the second time source 200. Specifically, the decision layer 400 determines the operating status of the first time source 100 and the second time source 200 based on the accuracy and quality indicators of each time source, and further determines the weight of each time source to reflect its current availability and synchronization reliability. On this basis, the decision layer 400 generates decision instructions for controlling the execution layer 500 to achieve the selection, switching, or multi-source fusion control of the time source.

[0085] In the execution layer 500, the protocol channel of the target time source is controlled to obtain the target time in response to decision instructions, and the synchronization time service is provided to the upper-layer business applications based on the time information output by the protocol channel of the target time source. Specifically, the execution layer 500 uses a protocol adaptation mechanism to uniformly access and encapsulate different time synchronization protocols, thereby shielding the protocol differences between different time sources.

[0086] According to the time synchronization system proposed in this application, firstly, a first time source and at least one second time source are set up to provide different types of time synchronization sources for the system. The first time source is used to provide a primary time reference, and the second time source is used to provide a backup or auxiliary time reference. Secondly, a perception layer is set up to collect first operating data from the first time source and second operating data from at least one second time source. The operating data includes at least accuracy and quality indicators to characterize the synchronization performance and communication status of each time source. By collecting the operating status of multiple time sources in real time through the perception layer, the system can continuously acquire information on changes in time source quality, providing a data basis for subsequent decision-making and thus improving the system's ability to perceive changes in the network environment. Then, a decision layer is set up to determine the currently active target time source based on the first and second operating data, and to generate decision instructions based on the currently active target time source. The target time source includes at least one of the first and second time sources. By analyzing and judging the operating status of multiple time sources through the decision-making layer, the system can dynamically select or combine time sources based on changes in time source quality, thereby improving the adaptability of the time synchronization strategy. Finally, an execution layer is set up to control the target time source's protocol channel to acquire the target time through decision commands, and provide synchronization time services to upper-layer business applications based on the target time acquired from the target time source's protocol channel. Through unified scheduling and encapsulation of different time source protocol channels by the execution layer, the system can shield underlying protocol differences, achieving unified output of time services, thereby improving system compatibility and scalability, and ensuring the continuity of time output. This system can analyze and make decisions on the operating status of time sources based on first and second operating data, achieving stable system time output through adaptive switching and fusion of time sources. This avoids problems in related technologies, such as decreased synchronization accuracy or interruption due to network fluctuations, and low reliability due to the inability to adaptively adjust to the operating environment, resulting in problems with single time synchronization protocols.

[0087] Figure 3 This is a schematic flowchart of the time synchronization method provided in the embodiments of this application.

[0088] For example, such as Figure 3 As shown, this time synchronization method includes the following steps: In step S101, first running data from a first time source and second running data from at least one second time source are acquired.

[0089] It is understood that by simultaneously acquiring first operational data from a first time source and second operational data from at least one second time source, this application enables the system to perceive the operational status of multiple time sources in parallel within the same time dimension, thereby providing a comprehensive and consistent data foundation for subsequent state assessment and decision switching. Furthermore, by introducing a synchronous acquisition mechanism for multi-time source operational data, this application can avoid the information bias or local distortion problems caused by relying solely on operational information from a single time source, improving the completeness and accuracy of the perception of the overall state of the time synchronization environment.

[0090] The first set of operational data may include parameters such as time deviation, frequency deviation, synchronization status, and network latency of the first time source; the second set of operational data may include parameters such as time deviation, round-trip time, jitter, and packet loss rate of the second time source. By continuously collecting operational data from different time sources, the system can monitor the changes in synchronization accuracy and communication quality of each time source in real time, providing a data foundation for subsequent time source status assessment and decision-making.

[0091] In step S102, the currently active target time source is determined based on the first running data and the second running data, and a decision instruction is generated based on the currently active target time source. The target time source includes at least one of the first time source and the second time source.

[0092] Understandably, by comprehensively evaluating each time source based on the first and second operational data, the system can dynamically determine the target time source currently in an optimal or available state, thus avoiding the adaptability issues caused by using a single time source. Furthermore, by using the determination result of the target time source as the basis for generating decision instructions, the system can directly convert the "state evaluation result" into "executable control instructions," achieving closed-loop linkage from data analysis to control execution, improving the real-time performance and execution efficiency of the decision-making process. Simultaneously, this application supports the target time source being a first time source, a second time source, or a combination thereof, enabling the system to have flexible decision-making capabilities for single-source selection and multi-source collaboration, thereby achieving adaptive adjustment of the time synchronization strategy under different network conditions.

[0093] For example, in one embodiment of this application, the perception layer acquires first operating data from a first time source and second operating data from at least one second time source, wherein the first operating data includes time deviation, jitter, and communication delay of the first time source, and the second operating data includes corresponding operating indicators of the second time source.

[0094] The decision-making level conducts a comprehensive evaluation based on the operational data. When the time deviation of the first time source is detected to be less than the preset threshold and the jitter is within a stable range, the current active target time source is determined as the first time source. When the performance of the first time source is detected to be degraded and at least one second time source meets the preset accuracy requirements, the first time source and the second time source are jointly determined as the current active target time source.

[0095] Subsequently, the decision-making layer generates corresponding decision instructions based on the target time source, such as generating an instruction to "use the first time source for synchronization" or an instruction to "enter pre-switching and enable time fusion mode", and sends the decision instructions to the execution layer so that the execution layer can control the protocol channel of the corresponding time source to obtain the target time according to the instruction.

[0096] In step S103, the decision instruction is sent to the execution layer. The execution layer responds to the decision instruction to control the protocol channel of the target time source to obtain the target time. Based on the target time obtained from the protocol channel of the target time source, the upper-layer business application is provided with a time synchronization service.

[0097] Among them, the synchronous time service is a unified time output capability provided by the execution layer to the upper-layer business applications. In this application, it represents a standardized time service interface provided to the outside world after time source selection, fusion or transformation.

[0098] Understandably, by distributing decision-making instructions from the decision-making layer to the execution layer and having the execution layer execute them uniformly, direct coupling between decision-making logic and protocol operations is avoided, improving the overall modular independence and maintainability of the system. By having the execution layer respond to decision-making instructions and control the protocol channel of the target time source to obtain the target time, the time source selection and time acquisition process can be uniformly scheduled and executed in a standardized manner, thereby improving the controllability and consistency of the time acquisition process and reducing management complexity in a multi-protocol parallel environment. Simultaneously, by uniformly providing synchronization time services to upper-layer business applications at the execution layer, upper-layer applications do not need to be aware of the underlying time source type and protocol differences, thus achieving transparent access and shielding of different time synchronization protocols, improving the system's scalability and compatibility.

[0099] For example, in one embodiment of this application, the decision layer determines the current target time source as the first time source (such as a precision time protocol time source) and generates a corresponding decision instruction, which is then sent to the execution layer. Upon receiving the decision instruction, the execution layer controls the first time source to establish a synchronous connection with the corresponding time server, continuously acquires target time information from the protocol channel, and parses and encapsulates the acquired time before outputting it to the upper-layer business application.

[0100] When the network environment changes, such as increased jitter or decreased synchronization quality at the primary time source, the decision layer switches the target time source to a secondary time source (e.g., a network time protocol time source) and regenerates the decision instruction. Upon responding to this instruction, the execution layer switches to the secondary time source protocol channel to obtain time information and continues to provide unified synchronization time services to upper-layer business applications, thus ensuring that upper-layer services can continuously obtain stable time during the time source switching process.

[0101] According to the time synchronization method proposed in this application, firstly, first operating data from a first time source and second operating data from at least one second time source are acquired to characterize the synchronization accuracy and operating quality status of each time source, such as time deviation, frequency deviation, delay, and jitter. By acquiring operating data from multiple time sources, the system can monitor the operating status of each time source in real time, providing basic data support for subsequent decisions. Secondly, the currently activated target time source is determined based on the first and second operating data, and a decision instruction is generated based on the currently activated target time source. The target time source includes at least one of the first and second time sources. By analyzing the operating data from multiple time sources... This application performs a comprehensive analysis of the time source status to determine the target time source. It can dynamically select or switch time sources based on changes in time source quality, thereby improving the adaptability and operational stability of the time synchronization strategy. Then, a decision instruction is sent to the execution layer. The execution layer responds to the decision instruction to control the target time source's protocol channel to acquire the target time. Based on the target time acquired through the target time source's protocol channel, it provides synchronization time services to upper-layer business applications. The execution layer executes the decision results and completes the time source protocol channel call, achieving unified scheduling and time output for different time sources. This improves the system's protocol compatibility, time output continuity, and service stability for upper-layer businesses. Therefore, this method can analyze and decide on the time source's operating status based on first and second operating data. Through adaptive switching and fusion of time sources, it achieves stable system time output, avoiding problems in related technologies such as decreased synchronization accuracy or interruption due to network fluctuations, and low time synchronization reliability due to the inability to adaptively adjust to the operating environment.

[0102] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0103] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with that embodiment or example, which are included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0104] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of this application.

Claims

1. A time synchronization system, characterized in that, include: A first time source and at least one second time source; The perception layer is used to collect first running data from a first time source and second running data from at least one second time source. The decision layer is used to determine the currently activated target time source based on the first running data and the second running data, and to generate decision instructions based on the currently activated target time source, wherein the target time source includes at least one of the first time source and the second time source; The execution layer is used to control the protocol channel of the target time source to obtain the target time through the decision instruction, and to provide synchronization time services to the upper-layer business applications based on the target time obtained from the protocol channel of the target time source.

2. The time synchronization system according to claim 1, characterized in that, The decision-making layer is also used for: Based on the first operating data, determine the first precision index value and the first quality index value of the first time source; The first operating state of the first time source is determined based on the first accuracy index value and the first quality index value. The first operating state includes at least one of a first state and a second state. The first state indicates that the first time source is operating normally, and the second state indicates that the first time source is operating abnormally. If the operating state is the first state, then the target time source is determined to be the first time source. If the operating state is the second state, then the pre-switching state from the first time source to the second time source is entered according to the second operating data, and the target time source is determined to include the first time source and the second time source.

3. The time synchronization system according to claim 2, characterized in that, The decision-making layer is also used for: If the first precision index value is less than the first precision threshold, then the first operating state is determined to be the first state; If the first quality index value is less than the first quality threshold, then the first operating state is determined to be the second state.

4. The time synchronization system according to claim 2, characterized in that, The decision-making layer is also used for: The second precision index value and the second quality index value of the second time source are determined based on the second operating data. The second operating state of the second time source is determined based on the second accuracy index value and the second quality index value. The second operating state includes at least one of a third state and a fourth state. The third state indicates that the second time source is operating normally, and the fourth state indicates that the second time source is operating abnormally. If at least one of the second time sources is in a third operating state, then the system enters a pre-switching state from the first time source to the second time source; otherwise, it does not enter the pre-switching state.

5. The time synchronization system according to claim 2, characterized in that, The decision-making layer is also used for: If the value of the second precision index is less than the second precision threshold, then the second operating state is determined to be the third state; If the second quality index value is less than the second quality threshold, then the second operating state is determined to be the fourth state.

6. The time synchronization system according to any one of claims 2-5, characterized in that, The decision-making layer is also used for: The weights of the first time source and the second time source are determined based on the first quality index value, wherein the weight of the first time source is directly proportional to the first quality index value. The decision instruction is generated based on the currently active target time source and its respective weight.

7. The time synchronization system according to claim 6, characterized in that, The execution layer is used for: Identify the respective weights of the first time source and the second time source; Obtain the first time from the first time source and the second time from the second time source; The target time is calculated based on the first time, the second time, and their respective weights.

8. The time synchronization system according to claim 1, characterized in that, The execution layer includes at least one adapter and a target interface. The adapter is used to adapt to the target time source, obtain the target time from the protocol channel of the target time source in response to the decision instruction, and the target interface provides synchronization time service to the upper-layer business application based on the target time and sends the decision instruction to the adapter.

9. A time synchronization method, characterized in that, The method is applied to the decision layer of the time synchronization system according to any one of claims 1-8, wherein the method includes: Acquire first running data from a first time source and second running data from at least one second time source; The currently activated target time source is determined based on the first running data and the second running data, and a decision instruction is generated based on the currently activated target time source. The target time source includes at least one of the first time source and the second time source. The decision instruction is sent to the execution layer, which responds to the decision instruction to control the protocol channel of the target time source to obtain the target time, and provides synchronization time service to the upper-layer business applications based on the target time obtained from the protocol channel of the target time source.

10. A vehicle, characterized in that, Includes the time synchronization system described in any one of claims 1-8.