Time synchronization method, equipment and device of vehicle controller and storage medium

Through the calculation of time synchronization requests and preset formulas of master and slave ports, the vehicle controller realizes high-precision time synchronization, solving the problem of insufficient synchronization accuracy in the prior art, and simplifying the system structure.

CN120582736APending Publication Date: 2025-09-02DONGFENG COMML VEHICLE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510894422.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-30
Publication Date
2025-09-02

AI Technical Summary

Technical Problem

In the prior art, the time synchronization method of the vehicle controller cannot achieve high-precision time synchronization at the application software level, resulting in increased system complexity and insufficient synchronization accuracy.

Method used

The master and slave ports initiate time synchronization requests with each other, obtain the timestamp recorded by the application layer and the preset time range of the underlying record, use the preset formula to calculate the master and slave clock deviation, and perform time synchronization adjustment through the vehicle controller.

Benefits of technology

High-precision time synchronization is achieved at the application software level, solving the problem of insufficient synchronization accuracy in the existing technology, and simplifying the system structure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120582736A_ABST
    Figure CN120582736A_ABST
Patent Text Reader

Abstract

A time synchronization method, apparatus and device for a vehicle controller, and a computer readable storage medium, the method comprising: acquiring a timestamp recorded by an application layer and a preset time range recorded by a bottom layer through time synchronization requests mutually initiated by a master port and a slave port; according to a preset formula, the timestamp recorded by the application layer and a preset time range recorded by the bottom layer, calculating master-slave clock deviation; through the vehicle controller, time synchronization is realized based on the master-slave clock deviation, the technical problem that high-precision time synchronization cannot be realized from an application software level in related technologies is solved, and high-precision time synchronization is realized on the application software level.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of vehicle technology, and in particular to a time synchronization method, device, equipment and computer-readable storage medium for a vehicle controller. Background Art

[0002] The system clock of the electronic control unit (ECU) of an intelligent connected vehicle affects the accuracy and real-time performance of information transmission, and may even lead to safety hazards in the vehicle. Therefore, controller clock synchronization is particularly important. Conventional methods for synchronizing automotive controller time include PPS timing, gPTP protocol, and NTP protocol: PPS time synchronization: PPS (Pulse Per Second) time synchronization technology uses GPS (Global Positioning System) satellite signals or other high-precision time sources to generate a precise time pulse signal (PPS signal) per second to achieve precise time synchronization between network devices, sensors, or other time-sensitive systems.

[0003] 2) gPTP time synchronization: gPTP (Generalized Precision Time Protocol) is a master-slave time synchronization system based on the Ethernet protocol. The time synchronization protocol mainly operates at the MAC layer network (the second layer of the OSI model), avoiding the residence time of timestamp messages in high-level network protocols and improving time synchronization accuracy.

[0004] 3) NTP time synchronization: NTP (Network Time Protocol) is a time synchronization protocol based on the Ethernet application layer. It is highly reliable and flexible and is suitable for various network environments and application scenarios.

[0005] However, PPS, gPTP, and NTP time synchronization methods often rely on controller hardware and underlying software to implement timestamp reception and synchronization calculations on the system client and server. However, the change cycle of automobile controller hardware and underlying systems is long and increases system complexity, making it impossible to achieve high-precision time synchronization from the application software level. Summary of the Invention

[0006] The present application provides a time synchronization method, device, equipment and computer-readable storage medium for a vehicle controller, which can solve the technical problem in the prior art that high-precision time synchronization cannot be achieved at the application software level.

[0007] In a first aspect, an embodiment of the present application provides a time synchronization method for a vehicle controller, the time synchronization method for a vehicle controller comprising: Through the time synchronization requests initiated by the master port and the slave port, the timestamp recorded by the application layer and the preset time range recorded by the bottom layer are obtained; Calculate the master-slave clock deviation based on a preset formula, the timestamp recorded by the application layer, and the preset time range recorded by the bottom layer; Time synchronization is achieved by the vehicle controller based on the master-slave clock deviation.

[0008] In conjunction with the first aspect, in one embodiment, calculating the master-slave clock deviation based on a preset formula, the timestamp recorded by the application layer, and the preset time range recorded by the bottom layer includes: Get the first preset formula , wherein the timestamp t1 of the single time synchronization request sent by the master port, the time range t2 of the single time synchronization request sent by the master port to the slave port, the time range t3 of the single time synchronization request received by the slave port from the master port, and the timestamp t4 of the single time synchronization request received by the slave port from the master port, the main network delay t_net, the main data hierarchical processing delay range , from the data layer processing delay range and main task scheduling delay ; Get the second preset formula , wherein the second preset formula includes the timestamp t5 of the single time synchronization request sent by the slave port to the master port, the timestamp t8 of the master port receiving the single time synchronization request sent by the slave port, the time range t6 of the single time synchronization request sent by the slave port to the master port and the time range t7 of the master port receiving the single time synchronization request sent by the slave port, the network delay , Master data hierarchical processing delay range , from the data layer processing delay range and the range of delays from task scheduling ; According to the first preset formula and the second preset formula, a third calculation formula is generated ; Determine the master task scheduling delay and the slave task scheduling delay; According to the master task scheduling delay, the slave task scheduling delay and the third calculation formula , calculate the master-slave clock deviation.

[0009] In conjunction with the first aspect, in one embodiment, determining the master task scheduling delay and the slave task scheduling delay includes: If the time synchronization request is a single one, then obtaining the scheduling task duration assigned to the preset running time synchronization program; Based on the scheduling task duration, a master task scheduling delay and a slave task scheduling delay are determined.

[0010] In combination with the first aspect, in one embodiment, obtaining the master task scheduling delay and the slave task scheduling delay includes: If the time synchronization request is multiple times, obtain the duration intervals of the multiple time synchronization requests; Obtaining the target time range of the underlying record within the time interval through the preset basic software; Obtaining, by pre-installed application software, a timestamp of the application layer within the time interval; Obtaining a maximum task scheduling cycle duration and a minimum task scheduling cycle duration according to the target time range recorded at the bottom layer and the timestamp of the application layer; Determining a main task scheduling delay based on the maximum task scheduling cycle length; Based on the minimum task scheduling cycle duration, a slave task scheduling delay is determined.

[0011] In combination with the first aspect, in one embodiment, obtaining the maximum task scheduling cycle duration and the minimum task scheduling cycle duration according to the target time range recorded in the bottom layer and the timestamp of the application layer includes: Obtaining value ranges of different uniform distributions according to the target time range recorded at the bottom layer and the timestamp of the application layer; Based on the value ranges of the different uniform distributions, a maximum task scheduling cycle duration and a minimum task scheduling cycle duration are determined.

[0012] In conjunction with the first aspect, in one embodiment, obtaining the timestamp of the application layer record and the preset time range of the bottom layer record includes: The timestamps recorded by the application layer include the timestamp t1 of the single time synchronization request sent by the master port to the slave port, the timestamp t4 of the single time synchronization request received by the slave port from the master port, the timestamp t5 of the single time synchronization request sent by the slave port to the master port, and the timestamp t8 of the single time synchronization request received by the master port from the slave port; The time range of the underlying record includes the time range t2 of the single time synchronization request sent by the master port to the slave port, the time range t3 of the single time synchronization request received by the slave port from the master port, the time range t6 of the single time synchronization request sent by the slave port to the master port, and the time range t7 of the master port receiving the single time synchronization request sent by the slave port.

[0013] In conjunction with the first aspect, in one embodiment, the implementing time synchronization based on the master-slave clock deviation by the vehicle controller includes: sending the master-slave clock deviation to a vehicle controller; The vehicle controller adjusts the master clock and the slave clock respectively based on the master-slave clock deviation to achieve time synchronization.

[0014] In a second aspect, an embodiment of the present application provides a time synchronization device for a vehicle controller, the time synchronization device for the vehicle controller comprising: The acquisition module is used to obtain the timestamp recorded by the application layer and the preset time range recorded by the bottom layer through the time synchronization request initiated by the master port and the slave port; A calculation module, configured to calculate a master-slave clock deviation based on a preset formula, a timestamp recorded by the application layer, and a preset time range recorded by the bottom layer; The time synchronization module is used to achieve time synchronization based on the master-slave clock deviation through the vehicle controller.

[0015] In a third aspect, an embodiment of the present application provides a time synchronization device for a vehicle controller, comprising a processor, a memory, and a time synchronization program for the vehicle controller stored on the memory and executable by the processor, wherein when the time synchronization program for the vehicle controller is executed by the processor, the steps of the time synchronization method for the vehicle controller as described above are implemented.

[0016] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a time synchronization program for a vehicle controller is stored. When the time synchronization program for the vehicle controller is executed by a processor, the steps of the time synchronization method for the vehicle controller as described above are implemented.

[0017] The beneficial effects of the technical solutions provided in the embodiments of the present application include: Through time synchronization requests initiated by the master port and the slave port to each other, the timestamp recorded in the application layer and the preset time range recorded in the bottom layer are obtained; the master-slave clock deviation is calculated according to the preset formula, the timestamp recorded in the application layer and the preset time range recorded in the bottom layer; time synchronization is achieved by the vehicle controller based on the master-slave clock deviation, which solves the technical problem in related technologies that high-precision time synchronization cannot be achieved at the application software level, and achieves high-precision time synchronization at the application software level. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 This is a flow chart of a first embodiment of a time synchronization method for a vehicle controller of the present application; Figure 2 A schematic diagram of the preset basic software obtaining the target time range and the preset application software obtaining the timestamp in this application; Figure 3 A schematic diagram of calculating the master-slave clock deviation in this application; Figure 4 This is a functional module diagram of an embodiment of a time synchronization device for a vehicle controller of the present application; Figure 5 This is a schematic diagram of the hardware structure of the time synchronization device of the vehicle controller involved in the embodiment of the present application. DETAILED DESCRIPTION

[0019] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0020] First, some technical terms in this application are explained to facilitate those skilled in the art to understand this application.

[0021] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.

[0022] In a first aspect, an embodiment of the present application provides a time synchronization method for a vehicle controller.

[0023] In one embodiment, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the time synchronization method for the vehicle controller of this application. Figure 1 As shown, the time synchronization method of the vehicle controller includes: Step S10: The master port and the slave port mutually initiate time synchronization requests to obtain the timestamp recorded in the application layer and the preset time range recorded in the bottom layer; Exemplarily, through time synchronization requests initiated by a master port to a slave port and by a slave port to the master port, timestamps recorded in the application layer and preset time ranges recorded in the underlying layer are obtained. The timestamps recorded in the application layer include timestamp t1 of a single time synchronization request sent by the master port to the slave port, timestamp t4 of the single time synchronization request received by the slave port from the master port, timestamp t5 of the single time synchronization request sent by the slave port to the master port, and timestamp t8 of the single time synchronization request received by the master port from the slave port. The time ranges recorded in the underlying layer include timestamp t2 of the single time synchronization request sent by the master port to the slave port, timestamp t3 of the single time synchronization request received by the slave port from the master port, timestamp t6 of the single time synchronization request sent by the slave port to the master port, and timestamp t7 of the single time synchronization request received by the master port from the slave port. Time synchronization requests include single and multiple requests, with a time synchronization request initiated by a master port to a slave port and a time synchronization request initiated by a slave port to a master port counted as one.

[0024] Step S20: Calculate the master-slave clock deviation based on a preset formula, the timestamp recorded by the application layer, and the preset time range recorded by the bottom layer; Exemplarily, a preset formula is obtained, the preset formula including a first preset formula and the second preset formula , where t1 is the timestamp of a single time synchronization request sent by the master port, t2 is the time range of a single time synchronization request sent by the master port to the slave port, t3 is the time range of a single time synchronization request received by the slave port from the master port, t4 is the timestamp of a single time synchronization request received by the slave port from the master port, t_net is the main network delay, Delay range for master data layer processing, To process the latency range and Scheduling delay for main task ; t5 is a second preset formula including the timestamp of a single time synchronization request sent by the slave port to the master port, t8 is the timestamp t8 of the master port receiving the single time synchronization request sent by the slave port, t6 is the time range of a single time synchronization request sent by the slave port to the master port, t7 is the time range of the master port receiving the single time synchronization request sent by the slave port, For network delay, Delay range for master data layer processing, Delay range for data tier processing and The range of delay from task scheduling.

[0025] The master-slave clock deviation is calculated using the first preset formula, the second preset formula, the timestamp recorded by the application layer, and the preset time range recorded by the bottom layer.

[0026] Specifically, the master-slave clock deviation is calculated based on the preset formula, the timestamp recorded by the application layer and the preset time range recorded by the bottom layer, including: obtaining a first preset formula , wherein the timestamp t1 of the single time synchronization request sent by the master port, the time range t2 of the single time synchronization request sent by the master port to the slave port, the time range t3 of the single time synchronization request received by the slave port from the master port, and the timestamp t4 of the single time synchronization request received by the slave port from the master port, the main network delay t_net, the main data hierarchical processing delay range , from the data layer processing delay range and main task scheduling delay ; Get the second preset formula , wherein the second preset formula includes the timestamp t5 of the single time synchronization request sent by the slave port to the master port, the timestamp t8 of the master port receiving the single time synchronization request sent by the slave port, the time range t6 of the single time synchronization request sent by the slave port to the master port and the time range t7 of the master port receiving the single time synchronization request sent by the slave port, the network delay , Master data hierarchical processing delay range , from the data layer processing delay range and the range of delays from task scheduling ; According to the first preset formula and the second preset formula, generate a third calculation formula ; Determine the master task scheduling delay and the slave task scheduling delay; According to the master task scheduling delay, the slave task scheduling delay and the third calculation formula , calculate the master-slave clock deviation.

[0027] Exemplarily, the first preset formula , where t1 is the timestamp of a single time synchronization request sent by the master port, t2 is the time range of a single time synchronization request sent by the master port to the slave port, t3 is the time range of a single time synchronization request received by the slave port from the master port, t4 is the timestamp of a single time synchronization request received by the slave port from the master port, t_net is the main network delay, Delay range for master data layer processing, To process the latency range and Scheduling delay for main task ; Get the second preset formula , where t5 is a second preset formula including the timestamp of a single time synchronization request sent by the slave port to the master port, t8 is the timestamp t8 of the master port receiving the single time synchronization request sent by the slave port, t6 is the time range of a single time synchronization request sent by the slave port to the master port, t7 is the time range of the master port receiving the single time synchronization request sent by the slave port, For network delay, Delay range for master data layer processing, Delay range for data tier processing and The range of delay from task scheduling.

[0028] Among them, t_net, 、 、 is a fixed time and equal (microsecond level), and is the task scheduling delay of the master and slave nodes, and this value is larger [Δt, task period - Δt]. Therefore, according to the first preset formula and the second preset formula, the third calculation formula is generated . Determine the main task scheduling delay and the slave task scheduling delay, and set the main task scheduling delay to and delay from task scheduling Substitute this into the third calculation formula to calculate the master-slave clock deviation.

[0029] Specifically, determining the main task scheduling delay and the slave task scheduling delay includes: if the time synchronization request is a single time, obtaining the scheduling task duration assigned to the preset running time synchronization program; based on the scheduling task duration, determining the main task scheduling delay and the slave task scheduling delay.

[0030] For example, if the time synchronization request is a single one, the scheduled task duration assigned to the preset running time synchronization program is obtained; based on the scheduled task duration, the master task scheduling delay and the slave task scheduling delay are determined. For example, the scheduled task duration is used as the master task scheduling delay and the slave task scheduling delay.

[0031] Specifically, the determination of the main task scheduling delay and the slave task scheduling delay includes: the acquisition of the main task scheduling delay and the slave task scheduling delay includes: if the time synchronization request is multiple times, then acquiring the duration interval of the multiple time synchronization requests; obtaining the target time range of the underlying record within the duration interval through the preset basic software; obtaining the timestamp of the application layer within the duration interval through the preset application software; obtaining the maximum task scheduling cycle duration and the minimum task scheduling cycle duration based on the target time range of the underlying record and the timestamp of the application layer; determining the main task scheduling delay based on the maximum task scheduling cycle duration; determining the slave task scheduling delay based on the minimum task scheduling cycle duration.

[0032] For example, if there are multiple time synchronization requests, the duration interval (0, T) of the multiple time synchronization requests is obtained, such as Figure 2 As shown, the period of the timestamp t7 obtained by the basic software is not fixed, and the time when the timestamp is obtained by the application layer through the layered protocol stack is t8. Due to the asynchronous nature of the software layer scheduling cycle, the range of the time difference (t8-t7) is unevenly distributed. ,in Is a fixed application layer task scheduling cycle length, and is known, so as to obtain the maximum task scheduling cycle length and the minimum task scheduling cycle length, and determine the maximum task scheduling cycle length as the main task scheduling delay, and the minimum task scheduling cycle length as the slave task scheduling delay. Figure 3 As shown in the figure, when the number of time synchronizations within time T is sufficient, the master-slave clock deviation calculated by time synchronization is The interval is , the minimum and maximum clock deviations can be calculated from the statistical data, corresponding to 、 , and then by 、 If the values ​​are all known, the true master-slave clock deviation t_clock can be calculated. For example, the application layer task scheduling period of the master and slave clock controllers is 10ms and 20ms respectively. The duration of each complete clock synchronization is 1min, and the duration of each sequence synchronization is 100ms. That is, the number of sequences for each synchronization is 600. The width of the area is ,get: and The master-slave clock deviation of the controller is: t_clock =t_diff(min)+10ms = t_diff(min)-5ms.

[0033] Step S30: Time synchronization is achieved by the vehicle controller based on the master-slave clock deviation.

[0034] Exemplarily, the master-slave clock deviation is sent to the vehicle controller, and the vehicle controller adjusts the master clock and the slave clock respectively based on the master-slave clock deviation to achieve time synchronization.

[0035] In this embodiment, the time synchronization requests initiated by the master port and the slave port to each other are used to obtain the timestamp of the application layer record and the preset time range of the bottom layer record; the master-slave clock deviation is calculated based on the preset formula, the timestamp of the application layer record and the preset time range of the bottom layer record; time synchronization is achieved by the vehicle controller based on the master-slave clock deviation, which solves the technical problem in related technologies that high-precision time synchronization cannot be achieved at the application software level, and achieves high-precision time synchronization at the application software level.

[0036] In a second aspect, an embodiment of the present application also provides a time synchronization device for a vehicle controller.

[0037] In one embodiment, referring to Figure 4 , Figure 4 This is a functional module diagram of an embodiment of a time synchronization device for a vehicle controller of the present application. Figure 4 As shown, the time synchronization device of the vehicle controller includes: An acquisition module 10 is configured to acquire the timestamp recorded in the application layer and the preset time range recorded in the bottom layer through time synchronization requests initiated by the master port and the slave port to each other; A calculation module 20, configured to calculate a master-slave clock deviation based on a preset formula, the timestamp recorded by the application layer, and the preset time range recorded by the bottom layer; The time synchronization module 30 is configured to implement time synchronization based on the master-slave clock deviation through a vehicle controller.

[0038] Furthermore, in one embodiment, the calculation module 20 is configured to: Get the first preset formula , wherein the timestamp t1 of the single time synchronization request sent by the master port, the time range t2 of the single time synchronization request sent by the master port to the slave port, the time range t3 of the single time synchronization request received by the slave port from the master port, and the timestamp t4 of the single time synchronization request received by the slave port from the master port, the main network delay t_net, the main data hierarchical processing delay range , from the data layer processing delay range and main task scheduling delay ; Get the second preset formula , wherein the second preset formula includes the timestamp t5 of the single time synchronization request sent by the slave port to the master port, the timestamp t8 of the master port receiving the single time synchronization request sent by the slave port, the time range t6 of the single time synchronization request sent by the slave port to the master port and the time range t7 of the master port receiving the single time synchronization request sent by the slave port, the network delay , Master data hierarchical processing delay range , from the data layer processing delay range and the range of delays from task scheduling ; According to the first preset formula and the second preset formula, a third calculation formula is generated ; Determine the master task scheduling delay and the slave task scheduling delay; According to the master task scheduling delay, the slave task scheduling delay and the third calculation formula , calculate the master-slave clock deviation.

[0039] Furthermore, in one embodiment, the time synchronization device of the vehicle controller further includes a new module for: If the time synchronization request is a single one, then obtaining the scheduling task duration assigned to the preset running time synchronization program; Based on the scheduling task duration, a master task scheduling delay and a slave task scheduling delay are determined.

[0040] Furthermore, in one embodiment, the time synchronization device of the vehicle controller further includes a new module for: If the time synchronization request is multiple times, obtain the duration intervals of the multiple time synchronization requests; Obtaining the target time range of the underlying record within the time interval through the preset basic software; Obtaining, by pre-installed application software, a timestamp of the application layer within the time interval; Obtaining a maximum task scheduling cycle duration and a minimum task scheduling cycle duration according to the target time range recorded at the bottom layer and the timestamp of the application layer; Determining a main task scheduling delay based on the maximum task scheduling cycle length; Based on the minimum task scheduling cycle duration, a slave task scheduling delay is determined.

[0041] Furthermore, in one embodiment, the time synchronization device of the vehicle controller further includes a new module for: Obtaining value ranges of different uniform distributions according to the target time range recorded at the bottom layer and the timestamp of the application layer; Based on the value ranges of the different uniform distributions, a maximum task scheduling cycle duration and a minimum task scheduling cycle duration are determined.

[0042] Furthermore, in one embodiment, the acquisition module 10 is configured to: The timestamps recorded by the application layer include the timestamp t1 of the single time synchronization request sent by the master port to the slave port, the timestamp t4 of the single time synchronization request received by the slave port from the master port, the timestamp t5 of the single time synchronization request sent by the slave port to the master port, and the timestamp t8 of the single time synchronization request received by the master port from the slave port; The time range of the underlying record includes the time range t2 of the single time synchronization request sent by the master port to the slave port, the time range t3 of the single time synchronization request received by the slave port from the master port, the time range t6 of the single time synchronization request sent by the slave port to the master port, and the time range t7 of the master port receiving the single time synchronization request sent by the slave port.

[0043] Furthermore, in one embodiment, the time synchronization module 30 is configured to: sending the master-slave clock deviation to a vehicle controller; The vehicle controller adjusts the master clock and the slave clock respectively based on the master-slave clock deviation to achieve time synchronization.

[0044] Among them, the functional implementation of each module in the time synchronization device of the above-mentioned vehicle controller corresponds to the various steps in the embodiment of the time synchronization method of the above-mentioned vehicle controller, and its functions and implementation processes will not be repeated here one by one.

[0045] In a third aspect, an embodiment of the present application provides a time synchronization device for a vehicle controller. The time synchronization device for a vehicle controller may be a personal computer (PC), a laptop computer, a server, or other device with data processing capabilities.

[0046] Reference Figure 5 , Figure 5 Schematic diagram of the hardware structure of the time synchronization device of the vehicle controller involved in the embodiment of the present application. In the embodiment of the present application, the time synchronization device of the vehicle controller may include a processor, a memory, a communication interface and a communication bus.

[0047] The communication bus may be of any type and is used to interconnect the processor, memory, and communication interface.

[0048] Communication interfaces include input / output (I / O), physical, and logical interfaces, used to interconnect components within the vehicle controller's time synchronization device and to connect the vehicle controller's time synchronization device to other devices (such as other computing devices or user devices). Physical interfaces can include Ethernet, fiber optic, and ATM interfaces; user devices can include displays and keyboards.

[0049] The memory can be various types of storage media, such as random access memory (RAM), read-only memory (ROM), non-volatile RAM (NVRAM), flash memory, optical storage, hard disk, programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), etc.

[0050] The processor may be a general-purpose processor that can invoke a vehicle controller time synchronization program stored in a memory and execute the vehicle controller time synchronization method provided in the embodiments of the present application. For example, the general-purpose processor may be a central processing unit (CPU). The method executed when the vehicle controller time synchronization program is invoked can be referenced from the various embodiments of the vehicle controller time synchronization method of the present application and will not be further described here.

[0051] Those skilled in the art will understand that Figure 5 The hardware structure shown in the figure does not constitute a limitation to the present application and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.

[0052] In a fourth aspect, an embodiment of the present application also provides a computer-readable storage medium.

[0053] The computer-readable storage medium of the present application stores a time synchronization program for a vehicle controller, wherein when the time synchronization program for the vehicle controller is executed by a processor, the steps of the time synchronization method for the vehicle controller as described above are implemented.

[0054] Among them, the method implemented when the time synchronization program of the vehicle controller is executed can refer to the various embodiments of the time synchronization method of the vehicle controller of this application, and will not be repeated here.

[0055] It should be noted that the serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0056] The terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices. The terms "first", "second" and "third" are used to distinguish different objects, etc., and do not represent a sequence, nor do they limit the "first", "second" and "third" to different types.

[0057] In the description of the embodiments of this application, the words "exemplary," "for example," or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary," "for example," or "for example" in the embodiments of this application should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary," "for example," or "for example" is intended to present the relevant concepts in a concrete manner.

[0058] In the description of the embodiments of the present application, unless otherwise specified, “ / ” means or, for example, A / B can mean A or B; “and / or” in the text is merely a description of the association relationship of associated objects, indicating that three relationships may exist, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, “multiple” refers to two or more than two.

[0059] In some processes described in the embodiments of the present application, multiple operations or steps are included that appear in a specific order. However, it should be understood that these operations or steps may not be performed in the order in which they appear in the embodiments of the present application or may be performed in parallel. The sequence numbers of the operations are only used to distinguish between different operations, and the sequence numbers themselves do not represent any order of execution. In addition, these processes may include more or fewer operations, and these operations or steps may be performed in sequence or in parallel, and these operations or steps may be combined.

[0060] Through the description of the above embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, or the part that contributes to the existing technology, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above and includes a number of instructions for enabling a terminal device to execute the methods described in each embodiment of this application.

[0061] The above are only preferred embodiments of the present application and do not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A time synchronization method for a vehicle controller, characterized in that: The time synchronization method of the vehicle controller includes: Through the time synchronization requests initiated by the master port and the slave port, the timestamp recorded by the application layer and the preset time range recorded by the bottom layer are obtained; Calculate the master-slave clock deviation based on a preset formula, the timestamp recorded by the application layer, and the preset time range recorded by the bottom layer; Time synchronization is achieved by the vehicle controller based on the master-slave clock deviation.

2. The time synchronization method of a vehicle controller according to claim 1, characterized in that: The calculating the master-slave clock deviation according to a preset formula, the timestamp recorded by the application layer, and the preset time range recorded by the bottom layer includes: Get the first preset formula , wherein the timestamp t1 of the single time synchronization request sent by the master port, the time range t2 of the single time synchronization request sent by the master port to the slave port, the time range t3 of the single time synchronization request received by the slave port from the master port, and the timestamp t4 of the single time synchronization request received by the slave port from the master port, the main network delay t_net, the main data hierarchical processing delay range , from the data layer processing delay range and main task scheduling delay ; Get the second preset formula , wherein the second preset formula includes the timestamp t5 of the single time synchronization request sent by the slave port to the master port, the timestamp t8 of the master port receiving the single time synchronization request sent by the slave port, the time range t6 of the single time synchronization request sent by the slave port to the master port and the time range t7 of the master port receiving the single time synchronization request sent by the slave port, the network delay , Master data hierarchical processing delay range , from the data layer processing delay range and the range of delays from task scheduling ; According to the first preset formula and the second preset formula, a third calculation formula is generated ; Determine the master task scheduling delay and the slave task scheduling delay; According to the master task scheduling delay, the slave task scheduling delay and the third calculation formula , calculate the master-slave clock deviation.

3. The time synchronization method of a vehicle controller according to claim 2, characterized in that: Determining the master task scheduling delay and the slave task scheduling delay includes: If the time synchronization request is a single one, then obtaining the scheduling task duration assigned to the preset running time synchronization program; Based on the scheduling task duration, a master task scheduling delay and a slave task scheduling delay are determined.

4. The time synchronization method of a vehicle controller according to claim 2, characterized in that: The obtaining of the master task scheduling delay and the slave task scheduling delay includes: If the time synchronization request is multiple times, obtain the duration intervals of the multiple time synchronization requests; Obtaining the target time range of the underlying record within the time interval through the preset basic software; Obtaining, by pre-installed application software, a timestamp of the application layer within the time interval; Obtaining a maximum task scheduling cycle duration and a minimum task scheduling cycle duration according to the target time range recorded at the bottom layer and the timestamp of the application layer; Determining a main task scheduling delay based on the maximum task scheduling cycle length; Based on the minimum task scheduling cycle duration, a slave task scheduling delay is determined.

5. The time synchronization method of a vehicle controller according to claim 4, characterized in that: The obtaining of the maximum task scheduling cycle duration and the minimum task scheduling cycle duration according to the target time range recorded in the bottom layer and the timestamp of the application layer includes: Obtaining value ranges of different uniform distributions according to the target time range recorded at the bottom layer and the timestamp of the application layer; Based on the value ranges of the different uniform distributions, a maximum task scheduling cycle duration and a minimum task scheduling cycle duration are determined.

6. The time synchronization method of a vehicle controller according to claim 1, characterized in that: The obtaining of the timestamp of the application layer record and the preset time range of the bottom layer record includes: The timestamps recorded by the application layer include the timestamp t1 of the single time synchronization request sent by the master port to the slave port, the timestamp t4 of the single time synchronization request received by the slave port from the master port, the timestamp t5 of the single time synchronization request sent by the slave port to the master port, and the timestamp t8 of the single time synchronization request received by the master port from the slave port; The time range of the underlying record includes the time range t2 of the single time synchronization request sent by the master port to the slave port, the time range t3 of the single time synchronization request received by the slave port from the master port, the time range t6 of the single time synchronization request sent by the slave port to the master port, and the time range t7 of the master port receiving the single time synchronization request sent by the slave port.

7. The time synchronization method of a vehicle controller according to claim 1, characterized in that: The time synchronization is achieved based on the master-slave clock deviation by the vehicle controller, including: sending the master-slave clock deviation to a vehicle controller; The vehicle controller adjusts the master clock and the slave clock respectively based on the master-slave clock deviation to achieve time synchronization.

8. A time synchronization device for a vehicle controller, characterized in that: The time synchronization device of the vehicle controller includes: The acquisition module is used to obtain the timestamp recorded by the application layer and the preset time range recorded by the bottom layer through the time synchronization request initiated by the master port and the slave port; A calculation module, configured to calculate a master-slave clock deviation based on a preset formula, a timestamp recorded by the application layer, and a preset time range recorded by the bottom layer; The time synchronization module is used to achieve time synchronization based on the master-slave clock deviation through the vehicle controller.

9. A time synchronization device for a vehicle controller, characterized in that: The time synchronization device of the vehicle controller includes a processor, a memory, and a time synchronization program for the vehicle controller stored on the memory and executable by the processor, wherein when the time synchronization program of the vehicle controller is executed by the processor, the steps of the time synchronization method for the vehicle controller as described in any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a time synchronization program for a vehicle controller, wherein when the time synchronization program for the vehicle controller is executed by a processor, the steps of the time synchronization method for a vehicle controller as described in any one of claims 1 to 7 are implemented.