CN114489237A - Time synchronization method, control system, and computer-readable storage medium - Google Patents
Time synchronization method, control system, and computer-readable storage medium Download PDFInfo
- Publication number
- CN114489237A CN114489237A CN202111600640.2A CN202111600640A CN114489237A CN 114489237 A CN114489237 A CN 114489237A CN 202111600640 A CN202111600640 A CN 202111600640A CN 114489237 A CN114489237 A CN 114489237A
- Authority
- CN
- China
- Prior art keywords
- time
- control unit
- standard
- delay
- delay time
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 104
- 238000004891 communication Methods 0.000 claims abstract description 70
- 238000012937 correction Methods 0.000 claims description 28
- 238000004590 computer program Methods 0.000 claims description 25
- 238000012545 processing Methods 0.000 claims description 10
- 230000005540 biological transmission Effects 0.000 claims description 8
- 238000004148 unit process Methods 0.000 claims description 2
- 238000005516 engineering process Methods 0.000 abstract description 3
- 230000008569 process Effects 0.000 description 12
- 230000003993 interaction Effects 0.000 description 9
- 238000010586 diagram Methods 0.000 description 8
- 238000004364 calculation method Methods 0.000 description 4
- 230000004044 response Effects 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000001934 delay Effects 0.000 description 3
- 230000006870 function Effects 0.000 description 3
- 238000012896 Statistical algorithm Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000011217 control strategy Methods 0.000 description 1
- 230000003111 delayed effect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F1/00—Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
- G06F1/04—Generating or distributing clock signals or signals derived directly therefrom
- G06F1/12—Synchronisation of different clock signals provided by a plurality of clock generators
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05B—CONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
- G05B19/00—Programme-control systems
- G05B19/02—Programme-control systems electric
- G05B19/04—Programme control other than numerical control, i.e. in sequence controllers or logic controllers
- G05B19/042—Programme control other than numerical control, i.e. in sequence controllers or logic controllers using digital processors
- G05B19/0423—Input/output
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04J—MULTIPLEX COMMUNICATION
- H04J3/00—Time-division multiplex systems
- H04J3/02—Details
- H04J3/06—Synchronising arrangements
- H04J3/0635—Clock or time synchronisation in a network
- H04J3/0638—Clock or time synchronisation among nodes; Internode synchronisation
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Automation & Control Theory (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- General Engineering & Computer Science (AREA)
- Synchronisation In Digital Transmission Systems (AREA)
Abstract
本申请适用于通信技术领域,提供了一种时间同步方法、控制系统及计算机可读存储介质,控制系统包括第一控制单元和至少一个第二控制单元,所述方法包括:第一控制单元将第一标准时间发送给第二控制单元,并记录第一发送时间;第二控制单元向第一控制单元返回第一反馈信息;第一控制单元根据第一发送时间和接收到第一反馈信息的第一接收时间计算第一控制单元和第二控制单元之间的第一延迟时间,并将第一延迟时间和当前的第二标准时间发送给第二控制单元;第二控制单元根据第一延迟时间和第二标准时间校正第二控制单元当前的时间,得到第一校正时间。通过上述方法,可以有效提高汽车各控制单元之间的时间同步精度。
The present application is applicable to the field of communication technology, and provides a time synchronization method, a control system, and a computer-readable storage medium. The control system includes a first control unit and at least one second control unit, and the method includes: the first control unit The first standard time is sent to the second control unit, and the first sending time is recorded; the second control unit returns the first feedback information to the first control unit; The first receiving time calculates the first delay time between the first control unit and the second control unit, and sends the first delay time and the current second standard time to the second control unit; the second control unit according to the first delay The time and the second standard time correct the current time of the second control unit to obtain the first corrected time. Through the above method, the time synchronization accuracy between the various control units of the vehicle can be effectively improved.
Description
技术领域technical field
本申请属于通信技术领域,尤其涉及一种时间同步方法、控制系统及计算机可读存储介质。The present application belongs to the field of communication technologies, and in particular, relates to a time synchronization method, a control system, and a computer-readable storage medium.
背景技术Background technique
汽车控制系统中通常包括多个控制单元,不同的控制单元之间可能存在通信交互,另外,控制单元经常需要获取汽车外界信息,如本车与前车之间的距离、红绿灯时间等。控制单元根据与其他控制单元通信交互获得的交互信息、以及获取到的汽车外界信息实时调整控制策略,这就需要控制单元之间、以及控制单元与外界信息之间的时间同步。A car control system usually includes multiple control units, and there may be communication interactions between different control units. In addition, the control unit often needs to obtain information from the outside of the car, such as the distance between the car and the car in front, and the time of traffic lights. The control unit adjusts the control strategy in real time according to the interaction information obtained through communication and interaction with other control units and the obtained external information of the vehicle, which requires time synchronization between the control units and between the control units and the external information.
现有技术中,通常设置一个时间标准源,该时间标准源将标准时间发送给各个控制单元,各控制单元根据接收到的标准时间自行校正时间。现有方法无法保证时间同步结果的精度。In the prior art, a time standard source is usually set, and the time standard source sends the standard time to each control unit, and each control unit corrects the time by itself according to the received standard time. Existing methods cannot guarantee the accuracy of time synchronization results.
发明内容SUMMARY OF THE INVENTION
本申请实施例提供了一种时间同步方法、控制系统及计算机可读存储介质,可以有效提高汽车各控制单元之间的时间同步精度。Embodiments of the present application provide a time synchronization method, a control system, and a computer-readable storage medium, which can effectively improve the time synchronization accuracy between control units of an automobile.
第一方面,本申请实施例提供了一种时间同步方法,应用于控制系统,所述控制系统包括第一控制单元和至少一个第二控制单元,所述方法包括:In a first aspect, an embodiment of the present application provides a time synchronization method, which is applied to a control system, where the control system includes a first control unit and at least one second control unit, and the method includes:
所述第一控制单元通过第一通信方式将第一标准时间发送给所述第二控制单元,并记录第一发送时间;The first control unit sends the first standard time to the second control unit through the first communication method, and records the first sending time;
所述第二控制单元在接收到所述第一标准时间后,通过所述第一通信方式向所述第一控制单元返回第一反馈信息;After receiving the first standard time, the second control unit returns the first feedback information to the first control unit through the first communication method;
所述第一控制单元接收到所述第一反馈信息后,根据所述第一发送时间和接收到所述第一反馈信息的第一接收时间计算所述第一控制单元和所述第二控制单元之间的第一延迟时间,并通过所述第一通信方式将所述第一延迟时间和当前的第二标准时间发送给所述第二控制单元;After receiving the first feedback information, the first control unit calculates the first control unit and the second control unit according to the first transmission time and the first reception time when the first feedback information is received the first delay time between units, and send the first delay time and the current second standard time to the second control unit through the first communication method;
所述第二控制单元接收到所述第一延迟时间和所述第二标准时间后,根据所述第一延迟时间和所述第二标准时间校正所述第二控制单元当前的时间,得到第一校正时间。After receiving the first delay time and the second standard time, the second control unit corrects the current time of the second control unit according to the first delay time and the second standard time to obtain the first delay time and the second standard time. a calibration time.
本申请实施例中,通过第一控制单元和第二控制单元之间的时间信息的交互,确认第一控制单元和第二控制单元之间的通信延迟时间,并在校正时间过程中考虑该通信延迟,使得校正后的时间更接近标准时间,进而提高了时间同步的精度。In the embodiment of the present application, through the interaction of time information between the first control unit and the second control unit, the communication delay time between the first control unit and the second control unit is confirmed, and the communication delay time is considered in the process of correcting the time. The delay makes the corrected time closer to the standard time, thereby improving the accuracy of time synchronization.
在第一方面的一种可能的实现方式中,所述第二控制单元接收到所述第一延迟时间和所述第二标准时间后,根据所述第一延迟时间和所述第二标准时间校正所述第二控制单元当前的时间,得到第一校正时间,包括:In a possible implementation manner of the first aspect, after the second control unit receives the first delay time and the second standard time, according to the first delay time and the second standard time Correcting the current time of the second control unit to obtain the first correction time, including:
所述第二控制单元接收到所述第一延迟时间和所述第二标准时间后,根据所述第二控制单元当前的第一实际时间和所述第一延迟时间计算第一理论时间;After receiving the first delay time and the second standard time, the second control unit calculates the first theoretical time according to the current first actual time and the first delay time of the second control unit;
若所述第一理论时间和所述第二标准时间的时间差在预设范围内,则所述第二控制单元根据所述第一延迟时间和所述第二标准时间校正所述第二控制单元当前的时间,得到所述第一校正时间。If the time difference between the first theoretical time and the second standard time is within a preset range, the second control unit corrects the second control unit according to the first delay time and the second standard time The current time is obtained to obtain the first correction time.
在第一方面的一种可能的实现方式中,在根据所述第一延迟时间和所述第二标准时间校正所述第二控制单元当前的时间,得到第一校正时间之后,所述方法还包括:In a possible implementation manner of the first aspect, after correcting the current time of the second control unit according to the first delay time and the second standard time to obtain the first correction time, the method further include:
所述第二控制单元通过所述第一通信方式将所述第一校正时间发送给所述第一控制单元;The second control unit sends the first correction time to the first control unit through the first communication method;
所述第一控制单元接收到所述第一校正时间后,更新所述第一控制单元和所述第二控制单元之间的延迟时间,得到第二延迟时间,并通过所述第一通信方式将所述第二延迟时间和当前的第三标准时间发送给所述第二控制单元;After receiving the first correction time, the first control unit updates the delay time between the first control unit and the second control unit to obtain a second delay time, and uses the first communication method sending the second delay time and the current third standard time to the second control unit;
所述第二控制单元接收到所述第二延迟时间和所述第三标准时间后,根据所述第二延迟时间和所述第三标准时间校正所述第二控制单元当前的时间,得到第二校正时间。After receiving the second delay time and the third standard time, the second control unit corrects the current time of the second control unit according to the second delay time and the third standard time to obtain the first 2. Calibration time.
在第一方面的一种可能的实现方式中,在根据所述第二控制单元当前的第一实际时间和所述第一延迟时间计算第一理论时间之后,所述方法还包括:In a possible implementation manner of the first aspect, after calculating the first theoretical time according to the current first actual time of the second control unit and the first delay time, the method further includes:
若所述第一理论时间和所述第二标准时间的时间差不在预设范围内,则所述第二控制单元通过所述第一通信方式向所述第一控制单元返回未校正标识;If the time difference between the first theoretical time and the second standard time is not within a preset range, the second control unit returns an uncorrected identifier to the first control unit through the first communication method;
若所述第一控制单元在预设时间内接收到所述未校正标识或在预设时间内未接收到所述第二控制单元的信息,通过第二通信方式将当前的第四标准时间发送给所述第二控制单元,并记录第二发送时间;If the first control unit receives the uncorrected identifier within the preset time or does not receive the information from the second control unit within the preset time, send the current fourth standard time through the second communication method to the second control unit, and record the second sending time;
所述第二控制单元接收到所述第四标准时间后,通过所述第二通信方式向所述第一控制单元返回第二反馈信息;After receiving the fourth standard time, the second control unit returns second feedback information to the first control unit through the second communication method;
所述第一控制单元接收到所述第二反馈信息后,根据所述第二发送时间和接收到所述第二反馈信息的第二接收时间计算所述第一控制单元和所述第二控制单元之间的第三延迟时间,并通过所述第二通信方式将所述第三延迟时间和当前的第五标准时间发送给所述第二控制单元;After receiving the second feedback information, the first control unit calculates the first control unit and the second control unit according to the second transmission time and the second reception time when the second feedback information is received the third delay time between units, and send the third delay time and the current fifth standard time to the second control unit through the second communication method;
所述第二控制单元接收到所述第三延迟时间和所述第五标准时间后,根据所述第三延迟时间和所述第五标准时间校正所述第二控制单元当前的时间。After receiving the third delay time and the fifth standard time, the second control unit corrects the current time of the second control unit according to the third delay time and the fifth standard time.
在第一方面的一种可能的实现方式中,所述第二控制单元接收到所述第三延迟时间和所述第五标准时间后,根据所述第三延迟时间和所述第五标准时间校正所述第二控制单元当前的时间,包括:In a possible implementation manner of the first aspect, after the second control unit receives the third delay time and the fifth standard time, according to the third delay time and the fifth standard time Correcting the current time of the second control unit, including:
所述第二控制单元接收到所述第三延迟时间和所述第五标准时间后,根据所述第二控制单元当前的第二实际时间和所述第三延迟时间计算第二理论时间;After receiving the third delay time and the fifth standard time, the second control unit calculates a second theoretical time according to the current second actual time and the third delay time of the second control unit;
若所述第二理论时间和所述第五标准时间的时间差在预设范围内,则所述第二控制单元根据所述第三延迟时间和所述第五标准时间校正所述第二控制单元当前的时间,得到所述第三校正时间;If the time difference between the second theoretical time and the fifth standard time is within a preset range, the second control unit corrects the second control unit according to the third delay time and the fifth standard time the current time to obtain the third correction time;
若所述第二理论时间和所述第五标准时间的时间差不在预设范围内,则所述第二控制单元上报预设故障信息。If the time difference between the second theoretical time and the fifth standard time is not within a preset range, the second control unit reports preset fault information.
在第一方面的一种可能的实现方式中,所述第二反馈信息包括所述第二控制单元对所述第四标准时间进行处理的第一处理时间;In a possible implementation manner of the first aspect, the second feedback information includes a first processing time during which the second control unit processes the fourth standard time;
所述第一控制单元接收到所述第二反馈信息后,根据所述第二发送时间和接收到所述第二反馈信息的第二接收时间计算所述第一控制单元和所述第二控制单元之间的第三延迟时间,包括:After receiving the second feedback information, the first control unit calculates the first control unit and the second control unit according to the second transmission time and the second reception time when the second feedback information is received A third delay time between cells, including:
所述第一控制单元接收到所述第二反馈信息后,所述第一控制单元根据所述第二发送时间、所述第一处理时间和所述第二接收时间,计算所述第三延迟时间。After the first control unit receives the second feedback information, the first control unit calculates the third delay according to the second sending time, the first processing time and the second receiving time time.
在第一方面的一种可能的实现方式中,在所述第二控制单元接收到所述第一延迟时间和所述第二标准时间后,根据所述第一延迟时间和所述第二标准时间校正所述第二控制单元当前的时间,得到第一校正时间之后,所述方法还包括:In a possible implementation manner of the first aspect, after the second control unit receives the first delay time and the second standard time, according to the first delay time and the second standard After time correcting the current time of the second control unit, after obtaining the first correction time, the method further includes:
当所述第一控制单元计算所述第一控制单元与所述第二控制单元之间的延迟时间的次数达到N次,所述第一控制单元根据最新计算出的N次延迟时间计算平均延迟时间,并通过所述第一通信方式将所述平均延迟时间和当前的第六标准时间发送给所述第二控制单元;When the number of times the first control unit calculates the delay time between the first control unit and the second control unit reaches N times, the first control unit calculates the average delay according to the latest calculated delay time N times time, and send the average delay time and the current sixth standard time to the second control unit through the first communication method;
所述第二控制单元接收到所述平均延迟时间和所述第六标准时间后,根据所述平均延迟时间和所述第六标准时间校正所述第二控制单元当前的时间,得到第四校正时间。After receiving the average delay time and the sixth standard time, the second control unit corrects the current time of the second control unit according to the average delay time and the sixth standard time to obtain a fourth correction time.
第二方面,本申请实施例提供了一种控制系统,所述控制系统包括第一控制单元和至少一个第二控制单元,其中:In a second aspect, an embodiment of the present application provides a control system, the control system includes a first control unit and at least one second control unit, wherein:
所述第一控制单元用于通过第一通信方式将第一标准时间发送给所述第二控制单元,并记录第一发送时间;The first control unit is configured to send the first standard time to the second control unit through a first communication method, and record the first sending time;
所述第二控制单元用于在接收到所述第一标准时间后,通过所述第一通信方式向所述第一控制单元返回第一反馈信息;The second control unit is configured to return the first feedback information to the first control unit through the first communication method after receiving the first standard time;
所述第一控制单元用于接收到所述第一反馈信息后,根据所述第一发送时间和接收到所述第一反馈信息的第一接收时间计算所述第一控制单元和所述第二控制单元之间的第一延迟时间,并通过所述第一通信方式将所述第一延迟时间和当前的第二标准时间发送给所述第二控制单元;The first control unit is configured to, after receiving the first feedback information, calculate the first control unit and the the first delay time between two control units, and send the first delay time and the current second standard time to the second control unit through the first communication method;
所述第二控制单元用于接收到所述第一延迟时间和所述第二标准时间后,根据所述第一延迟时间和所述第二标准时间校正所述第二控制单元当前的时间,得到第一校正时间。The second control unit is configured to correct the current time of the second control unit according to the first delay time and the second standard time after receiving the first delay time and the second standard time, Get the first correction time.
第三方面,本申请实施例提供了一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如上述第一方面中任一项所述的时间同步方法。In a third aspect, an embodiment of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes all The time synchronization method according to any one of the above first aspects is realized when the computer program is used.
第四方面,本申请实施例提供了一种计算机可读存储介质,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如上述第一方面中任一项所述的时间同步方法。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, and an embodiment of the present application provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, wherein the When the computer program is executed by the processor, the time synchronization method according to any one of the above first aspects is implemented.
第五方面,本申请实施例提供了一种计算机程序产品,当计算机程序产品在终端设备上运行时,使得终端设备执行上述第一方面中任一项所述的时间同步方法。In a fifth aspect, an embodiment of the present application provides a computer program product that, when the computer program product runs on a terminal device, enables the terminal device to execute the time synchronization method described in any one of the first aspects above.
可以理解的是,上述第二方面至第五方面的有益效果可以参见上述第一方面中的相关描述,在此不再赘述。It can be understood that, for the beneficial effects of the second aspect to the fifth aspect, reference may be made to the relevant description in the first aspect, which is not repeated here.
附图说明Description of drawings
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions in the embodiments of the present application more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only for the present application. In some embodiments, for those of ordinary skill in the art, other drawings can also be obtained according to these drawings without any creative effort.
图1是本申请实施例提供的汽车控制系统的示意图;1 is a schematic diagram of a vehicle control system provided by an embodiment of the present application;
图2是本申请实施例提供的时间同步方法的交互流程示意图;2 is a schematic diagram of an interaction flow of a time synchronization method provided by an embodiment of the present application;
图3是本申请另一实施例提供的时间同步方法的交互流程示意图;3 is a schematic diagram of an interaction flow of a time synchronization method provided by another embodiment of the present application;
图4是本申请实施例提供的终端设备的结构示意图。FIG. 4 is a schematic structural diagram of a terminal device provided by an embodiment of the present application.
具体实施方式Detailed ways
以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。在其它情况中,省略对众所周知的系统、装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。In the following description, for the purpose of illustration rather than limitation, specific details such as a specific system structure and technology are set forth in order to provide a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application may be practiced in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
应当理解,当在本申请说明书和所附权利要求书中使用时,术语“包括”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。It is to be understood that, when used in this specification and the appended claims, the term "comprising" indicates the presence of the described feature, integer, step, operation, element and/or component, but does not exclude one or more other The presence or addition of features, integers, steps, operations, elements, components and/or sets thereof.
还应当理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。It will also be understood that, as used in this specification and the appended claims, the term "and/or" refers to and including any and all possible combinations of one or more of the associated listed items.
如在本申请说明书和所附权利要求书中所使用的那样,术语“若”可以依据上下文被解释为“当...时”或“一旦”或“响应于确定”或“响应于检测到”。类似地,短语“如果确定”或“如果检测到[所描述条件或事件]”可以依据上下文被解释为意指“一旦确定”或“响应于确定”或“一旦检测到[所描述条件或事件]”或“响应于检测到[所描述条件或事件]”。As used in the specification of this application and the appended claims, the term "if" may be contextually interpreted as "when" or "once" or "in response to determining" or "in response to detecting ". Similarly, the phrases "if it is determined" or "if the [described condition or event] is detected" may be interpreted, depending on the context, to mean "once it is determined" or "in response to the determination" or "once the [described condition or event] is detected. ]" or "in response to detection of the [described condition or event]".
另外,在本申请说明书和所附权利要求书的描述中,术语“第一”、“第二”、“第三”等仅用于区分描述,而不能理解为指示或暗示相对重要性。In addition, in the description of the specification of the present application and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the description, and should not be construed as indicating or implying relative importance.
在本申请说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。References in this specification to "one embodiment" or "some embodiments" and the like mean that a particular feature, structure or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in other embodiments," etc. in various places in this specification are not necessarily All refer to the same embodiment, but mean "one or more but not all embodiments" unless specifically emphasized otherwise.
本申请实施例可应用于汽车控制系统。参见图1,是本申请实施例提供的汽车控制系统的示意图。如图1所示,汽车控制系统可以包括车与外界的信息交互控制单元(vehicleto everything-On board Unit,V2X-OBU)11和多个电子控制单元(Electronic ControlUnit,ECU)12。The embodiments of the present application can be applied to an automobile control system. Referring to FIG. 1 , it is a schematic diagram of an automobile control system provided by an embodiment of the present application. As shown in FIG. 1 , the vehicle control system may include an information exchange control unit (V2X-OBU) 11 between the vehicle and the outside world and a plurality of electronic control units (Electronic Control Unit, ECU) 12 .
V2X-OBU中可以包括微处理器(Microprocessor Unit,MPU)、微控制器(Microcontroller Unit,MCU)和V2X通信模组。V2X-OBU通过V2X通信模组与汽车外界通信,如与卫星通信、以获取卫星授时时间。V2X-OBU通过MPU对时间同步所需的相关数据进行计算处理,通过MCU与其他电子控制单元通信交互。其中,MCU与其他电子单元可以通过CAN总线、I/O口或串口等方式通信。The V2X-OBU may include a microprocessor (Microprocessor Unit, MPU), a microcontroller (Microcontroller Unit, MCU), and a V2X communication module. V2X-OBU communicates with the outside of the car through the V2X communication module, such as communication with satellites, to obtain satellite timing. V2X-OBU calculates and processes related data required for time synchronization through MPU, and communicates and interacts with other electronic control units through MCU. Among them, MCU and other electronic units can communicate through CAN bus, I/O port or serial port.
在一些应用场景中,MCU可以将信息通过CAN总线发送给中央网关(centralgateway,CGW),然后由中央网关通过CAN总线传输给电子控制单元。在另一些应用场景中,MCU可以将信息通过I/O口发送给电子控制单元。In some application scenarios, the MCU can send information to a central gateway (central gateway, CGW) through the CAN bus, and then the central gateway transmits the information to the electronic control unit through the CAN bus. In other application scenarios, the MCU can send information to the electronic control unit through the I/O port.
如上述汽车控制系统所示,在一个应用场景中,V2X-OBU负责与汽车外界通信,根据外界信息(如红绿灯时间、前后车距等)和汽车自身状态信息(从ECU获取)计算相关预警信息。汽车的高级驾驶辅助系统(Advanced Driving Assistance System,ADAS)可以根据此预警信息控制车辆状态,避免事故、违规甚至违法的驾驶事故,以提高道路交通安全等。为了能够精确计算并预警,需要V2X-OBU与各个ECU保持时间同步。As shown in the above car control system, in an application scenario, V2X-OBU is responsible for communicating with the outside world of the car, and calculates relevant early warning information based on external information (such as traffic light time, front and rear distance, etc.) and the car's own state information (obtained from the ECU). . The Advanced Driving Assistance System (ADAS) of the car can control the state of the vehicle according to this early warning information, avoid accidents, violations and even illegal driving accidents, so as to improve road traffic safety. In order to accurately calculate and give early warning, it is necessary for V2X-OBU to keep time synchronization with each ECU.
现有技术中,通常设置一个时间标准源,该时间标准源将标准时间发送给各个控制单元,各控制单元根据接收到的标准时间自行校正时间。现有方法无法保证时间同步结果的精度。为了解决该问题,本申请实施例提供了一种时间同步方法。下面以各实施例介绍该方法。In the prior art, a time standard source is usually set, and the time standard source sends the standard time to each control unit, and each control unit corrects the time by itself according to the received standard time. Existing methods cannot guarantee the accuracy of time synchronization results. To solve this problem, an embodiment of the present application provides a time synchronization method. The method is described below with various embodiments.
在一个实施例中,参见图2,是本申请实施例提供的时间同步方法的交互流程示意图,作为示例而非限定,所述方法可以包括以下步骤:In one embodiment, referring to FIG. 2 , it is a schematic diagram of an interaction flow of a time synchronization method provided by an embodiment of the present application. As an example and not a limitation, the method may include the following steps:
S201,V2X-OBU通过CAN总线将当前的标准时间t1发送给ECU,并记录发送时间为F1。S201, the V2X-OBU sends the current standard time t1 to the ECU through the CAN bus, and records the sending time as F1.
S202,ECU在接收到标准时间t1后,通过CAN总线向V2X-OBU返回一条反馈信息K1。S202, after receiving the standard time t1, the ECU returns a feedback message K1 to the V2X-OBU through the CAN bus.
S203,V2X-OBU接收到所述反馈信息K1后,根据发送时间为F1和接收到所述反馈信息K1的接收时间J1计算V2X-OBU和ECU之间的延迟时间Δt1,并通过CAN总线将延迟时间Δt1和当前的标准时间t2发送给ECU,记录发送时间F2。S203, after receiving the feedback information K1, the V2X-OBU calculates the delay time Δt1 between the V2X-OBU and the ECU according to the sending time F1 and the receiving time J1 when the feedback information K1 is received, and delays the delay time through the CAN bus The time Δt1 and the current standard time t2 are sent to the ECU, and the sending time F2 is recorded.
本申请实施例中,ECU接收到标准时间t1后,可能经过一定的等待时间后再返回反馈信息K1,该等待时间将会影响延迟时间的计算。为了解决该问题,可选的,反馈信息包括上述等待时间(即ECU发送反馈信息K1的时间减去接收到标准时间t1的时间)。相应的,S207可以包括:V2X-OBU根据发送时间F1、等待时间和接收时间J1,计算延迟时间Δt1。In the embodiment of the present application, after the ECU receives the standard time t1, it may return to the feedback information K1 after a certain waiting time, and the waiting time will affect the calculation of the delay time. To solve this problem, optionally, the feedback information includes the above-mentioned waiting time (that is, the time when the ECU sends the feedback information K1 minus the time when the standard time t1 is received). Correspondingly, S207 may include: the V2X-OBU calculates the delay time Δt1 according to the sending time F1, the waiting time and the receiving time J1.
具体的,接收时间J1减去等待时间,再减去发送时间F1,得到时间差值,将该时间差值除以2,得到延迟时间Δt1。Specifically, the waiting time is subtracted from the receiving time J1, and then the sending time F1 is subtracted to obtain a time difference value, and the delay time Δt1 is obtained by dividing the time difference value by 2.
S204,ECU接收到延迟时间Δt1和标准时间t2后,根据延迟时间Δt1和ECU当前的本地时间S1计算理论时间L1。若理论时间L1与标准时间t2之间的时间差在预设范围内,则ECU根据延迟时间Δt1和标准时间t2校正ECU本地时间,得到校正后的本地时间S2。通过CAN总线将校正时间S2发送给V2X-OBU。S204, after receiving the delay time Δt1 and the standard time t2, the ECU calculates the theoretical time L1 according to the delay time Δt1 and the current local time S1 of the ECU. If the time difference between the theoretical time L1 and the standard time t2 is within the preset range, the ECU corrects the local time of the ECU according to the delay time Δt1 and the standard time t2 to obtain the corrected local time S2. The correction time S2 is sent to the V2X-OBU via the CAN bus.
具体的,将实际时间S1减去延迟时间Δt1,得到理论时间L1。Specifically, the actual time S1 is subtracted from the delay time Δt1 to obtain the theoretical time L1.
可选的,还可以用标准时间t2加上延迟时间Δt1,得到理论上的本地时间,再计算理论上的本地时间和当前的实际时间S1之间的时间差,根据该时间差校正本地时间。Optionally, the standard time t2 can be added to the delay time Δt1 to obtain the theoretical local time, and then the time difference between the theoretical local time and the current actual time S1 is calculated, and the local time is corrected according to the time difference.
进一步的,ECU计算出理论上的本地时间后,若该理论上的本地时间与当前的本地时间S1之间的时间差在预设范围内,且该时间差小于预设值(说明ECU本地时间与标准时间差距很小),ECU可以选择不对本地时间进行校正,将当前的本地时间作为校正时间S2发送给V2X-OBU。Further, after the ECU calculates the theoretical local time, if the time difference between the theoretical local time and the current local time S1 is within the preset range, and the time difference is less than the preset value (indicating that the ECU local time is different from the standard time) The time gap is small), the ECU can choose not to correct the local time, and send the current local time as the correction time S2 to the V2X-OBU.
S205,V2X-OBU接收到校正时间S2后,根据发送时间F2和接收到所述校正时间S2的接收时间J2更新V2X-OBU和ECU之间的延迟时间Δt2,向ECU发送当前的标准时间t3和更新后的延迟时间Δt2,并记录发送时间为F3。S205, after receiving the correction time S2, the V2X-OBU updates the delay time Δt2 between the V2X-OBU and the ECU according to the sending time F2 and the receiving time J2 that receives the correction time S2, and sends the current standard time t3 and ECU to the ECU Update the delay time Δt2, and record the sending time as F3.
S206,ECU接收到标准时间t3和延迟时间Δt2后,根据延迟时间Δt2和ECU当前的本地时间S3计算理论时间L2。若理论时间L2与标准时间t3之间的时间差在预设范围内,则ECU根据延迟时间Δt2和标准时间t3校正ECU本地时间,得到校正时间S4。通过CAN总线将校正时间S4发送给V2X-OBU。S206, after receiving the standard time t3 and the delay time Δt2, the ECU calculates the theoretical time L2 according to the delay time Δt2 and the current local time S3 of the ECU. If the time difference between the theoretical time L2 and the standard time t3 is within the preset range, the ECU corrects the local time of the ECU according to the delay time Δt2 and the standard time t3 to obtain the correction time S4. The correction time S4 is sent to the V2X-OBU via the CAN bus.
V2X-OBU接收到校正时间S4后,根据接收时间J3和发送时间F3继续更新V2X-OBU和ECU之间的延迟时间。以此循环,使得V2X-OBU和ECU之间的保持时间同步。After the V2X-OBU receives the correction time S4, it continues to update the delay time between the V2X-OBU and the ECU according to the receiving time J3 and the sending time F3. This cycle keeps the time synchronization between the V2X-OBU and the ECU.
上述实施例中,V2X-OBU可记为第一控制单元,ECU可记为第二控制单元,CAN总线可记为第一通信方式,标准时间t1可以记为第一标准时间,标准时间t2可以记为第二标准时间,标准时间t3可记为第三标准时间,发送时间为F1可以记为第一发送时间,反馈信息K1可以记为第一反馈信息,接收时间J1可以记为第一接收时间,延迟时间Δt1可以记为第一延迟时间,本地时间S1可记为第一实际时间,理论时间L1可记为第一理论时间,校正时间S2可记为第一校正时间,延迟时间Δt2可记为第二延迟时间,校正时间S4可记为第二校正时间。In the above embodiment, the V2X-OBU can be recorded as the first control unit, the ECU can be recorded as the second control unit, the CAN bus can be recorded as the first communication method, the standard time t1 can be recorded as the first standard time, and the standard time t2 can be recorded as the first standard time. It is recorded as the second standard time, the standard time t3 can be recorded as the third standard time, the sending time F1 can be recorded as the first sending time, the feedback information K1 can be recorded as the first feedback information, and the receiving time J1 can be recorded as the first receiving time time, the delay time Δt1 can be recorded as the first delay time, the local time S1 can be recorded as the first actual time, the theoretical time L1 can be recorded as the first theoretical time, the correction time S2 can be recorded as the first correction time, and the delay time Δt2 can be recorded as the first actual time. Denoted as the second delay time, the calibration time S4 may be denoted as the second calibration time.
本申请实施例中,通过第一控制单元和第二控制单元之间的时间信息的交互,确认第一控制单元和第二控制单元之间的通信延迟时间,并在校正时间过程中考虑该通信延迟,使得校正后的时间更接近标准时间,进而提高了时间同步的精度。In the embodiment of the present application, through the interaction of time information between the first control unit and the second control unit, the communication delay time between the first control unit and the second control unit is confirmed, and the communication delay time is considered in the process of correcting the time. The delay makes the corrected time closer to the standard time, thereby improving the accuracy of time synchronization.
在另一个实施例中,参见图3,是本申请另一实施例提供的时间同步方法的交互流程示意图,作为示例而非限定,所述方法可以包括以下步骤:In another embodiment, referring to FIG. 3 , it is a schematic diagram of an interaction flow of a time synchronization method provided by another embodiment of the present application. As an example and not limitation, the method may include the following steps:
S301,V2X-OBU通过CAN总线将当前的标准时间t1发送给ECU,并记录发送时间为F1。S301, the V2X-OBU sends the current standard time t1 to the ECU through the CAN bus, and records the sending time as F1.
S302,ECU在接收到t1后,通过CAN总线向V2X-OBU返回一条反馈信息K1。S302, after receiving t1, the ECU returns a feedback message K1 to the V2X-OBU through the CAN bus.
S303,V2X-OBU接收到所述反馈信息K1后,根据发送时间为F1和接收到所述反馈信息K1的接收时间J1计算V2X-OBU和ECU之间的延迟时间Δt1,并通过CAN总线将延迟时间Δt1和当前的标准时间t2发送给ECU,记录发送时间F2。S303, after receiving the feedback information K1, the V2X-OBU calculates the delay time Δt1 between the V2X-OBU and the ECU according to the sending time F1 and the receiving time J1 when the feedback information K1 is received, and delays the delay time through the CAN bus The time Δt1 and the current standard time t2 are sent to the ECU, and the sending time F2 is recorded.
S301至S303与上述的S201至S203相同,具体可参见S201至S203中的描述,在此不再赘述。S304为S204的另一种情况。S301 to S303 are the same as the above-mentioned S201 to S203. For details, please refer to the descriptions in S201 to S203, which will not be repeated here. S304 is another case of S204.
S304,ECU接收到延迟时间Δt1和标准时间t2后,根据延迟时间Δt1和ECU当前的本地时间S1计算理论时间L1。若理论时间L1与标准时间t2之间的时间差不在预设范围内,则ECU通过CAN总线向V2X-OBU发送未校正标识。S304, after receiving the delay time Δt1 and the standard time t2, the ECU calculates the theoretical time L1 according to the delay time Δt1 and the current local time S1 of the ECU. If the time difference between the theoretical time L1 and the standard time t2 is not within the preset range, the ECU sends an uncorrected flag to the V2X-OBU through the CAN bus.
理论时间与标准时间的时间差较大,说明ECU接收到的时间也是不准确的,无法实现时间同步。这种情况下,可能是由于第一通信方式出现故障导致的,还可能是由于第一通信方式的通信拥堵导致的。此时,ECU无需校正本地时间,向V2X-OBU返回未校正标识即可。若第一通信方式出现故障,则V2X-OBU无法接收到未校正标识;若第一通信方式的通信拥堵,则V2X-OBU可以接收到未校正标识,不过接收时间可能会有延迟。The time difference between the theoretical time and the standard time is large, indicating that the time received by the ECU is also inaccurate, and time synchronization cannot be achieved. In this case, it may be caused by a failure of the first communication mode, or may be caused by communication congestion in the first communication mode. At this time, the ECU does not need to correct the local time, and just returns the uncorrected flag to the V2X-OBU. If the first communication method fails, the V2X-OBU cannot receive the uncorrected identification; if the communication in the first communication method is congested, the V2X-OBU can receive the uncorrected identification, but the receiving time may be delayed.
S305,若V2X-OBU在预设时间内接收到未校正标识或在预设时间内未接收到所述第二控制单元的信息,通过I/O口将当前的标准时间t5发送给ECU,并记录发送时间F4。S305, if the V2X-OBU receives the uncorrected flag within the preset time or does not receive the information of the second control unit within the preset time, it sends the current standard time t5 to the ECU through the I/O port, and Record the sending time F4.
V2X-OBU接收到未校正标识,说明第一通信方式出现故障,则切换通信方式。如由CAN总线切换至I/O口,切换通信方式后,重新进行时间同步。The V2X-OBU receives the uncorrected flag, indicating that the first communication mode is faulty, and switches the communication mode. Such as switching from the CAN bus to the I/O port, after switching the communication mode, the time synchronization is performed again.
S306,ECU接收到所述标准时间t5后,通过I/O口向V2X-OBU返回反馈信息K2。S306, after receiving the standard time t5, the ECU returns the feedback information K2 to the V2X-OBU through the I/O port.
S307,V2X-OBU接收到反馈信息K2后,根据发送时间F4和接收到反馈信息K2的接收时间J4计算V2X-OBU和ECU之间的延迟时间Δt3,并通过I/O口将延迟时间Δt3和当前的标准时间t6发送给ECU,记录发送时间F5。S307, after the V2X-OBU receives the feedback information K2, it calculates the delay time Δt3 between the V2X-OBU and the ECU according to the sending time F4 and the receiving time J4 when the feedback information K2 is received, and compares the delay time Δt3 and the ECU through the I/O port. The current standard time t6 is sent to the ECU, and the sending time F5 is recorded.
本申请实施例中,V2X-OBU通过I/O口向ECU发送表示标准时间t5的脉冲,ECU接收到脉冲后,将该脉冲转换为时间信息。这个转换过程需要一定的处理时间,该处理时间将会影响延迟时间的计算。为了解决该问题,可选的,反馈信息包括所述ECU对表示标准时间t5的脉冲进行处理的第一处理时间。相应的,S307可以包括:V2X-OBU根据发送时间F2、第一处理时间和接收时间J3,计算延迟时间Δt3。In the embodiment of the present application, the V2X-OBU sends a pulse representing the standard time t5 to the ECU through the I/O port, and the ECU converts the pulse into time information after receiving the pulse. This conversion process requires a certain processing time, which will affect the calculation of the delay time. In order to solve this problem, optionally, the feedback information includes the first processing time for the ECU to process the pulse representing the standard time t5. Correspondingly, S307 may include: the V2X-OBU calculates the delay time Δt3 according to the sending time F2, the first processing time and the receiving time J3.
具体的,接收时间J3减去第一处理时间,再减去发送时间F2,得到时间差值,将该时间差值除以2,得到延迟时间Δt3。Specifically, the first processing time is subtracted from the receiving time J3, and then the sending time F2 is subtracted to obtain a time difference, and the delay time Δt3 is obtained by dividing the time difference by 2.
S308,ECU接收到延迟时间Δt3和标准时间t6后,根据ECU当前的本地时间S7和延迟时间Δt3计算理论时间L4;若理论时间L4和标准时间t6的时间差在预设范围内,则ECU根据延迟时间Δt3和标准时间t6校正ECU当前的时间,得到校正后的本地时间S8,并将校正时间S8发送给V2X-OBU。S308, after receiving the delay time Δt3 and the standard time t6, the ECU calculates the theoretical time L4 according to the current local time S7 and the delay time Δt3 of the ECU; if the time difference between the theoretical time L4 and the standard time t6 is within the preset range, the ECU calculates the delay The time Δt3 and the standard time t6 correct the current time of the ECU, obtain the corrected local time S8, and send the corrected time S8 to the V2X-OBU.
V2X-OBU接收到校正时间S8后,根据接收时间J5和发送时间F5继续更新V2X-OBU和ECU之间的延迟时间。依次循环,以使得V2X-OBU和ECU之间的保持时间同步。After the V2X-OBU receives the correction time S8, it continues to update the delay time between the V2X-OBU and the ECU according to the receiving time J5 and the sending time F5. Loop sequentially to keep the time synchronization between the V2X-OBU and the ECU.
若理论时间L4和标准时间t6的时间差不在预设范围内,则ECU上报预设故障信息。此种情况,说明I/O口也发生故障。由于CAN总线和I/O口均发生故障,说明控制系统的通信出现故障,无法继续时间同步。If the time difference between the theoretical time L4 and the standard time t6 is not within the preset range, the ECU reports preset fault information. In this case, the I/O port is also faulty. Since both the CAN bus and the I/O port are faulty, it means that the communication of the control system is faulty and the time synchronization cannot be continued.
当然,如果存在第三种通信方式,若理论时间L4和标准时间t6的时间差不在预设范围内,也可以切换为第三种通信方式,继续时间同步。采用第三种通信方式进行时间同步的步骤与上述图2、图3实施例所述的步骤实质相同,具体可参照上述图2、图3实施例,在此不再赘述。Of course, if there is a third communication mode, if the time difference between the theoretical time L4 and the standard time t6 is not within the preset range, the third communication mode can also be switched to continue the time synchronization. The steps for time synchronization using the third communication mode are substantially the same as those described in the above-mentioned embodiments in FIG. 2 and FIG. 3 . For details, refer to the above-mentioned embodiments in FIG. 2 and FIG.
在一个实施例中,在通过第二通信方式进行时间同步的过程中,可以保持监测第一通信方式。当第一通信方式恢复正常,可以由第二通信方式再切换回第一通信方式。In one embodiment, during the process of time synchronization through the second communication method, the monitoring of the first communication method may be maintained. When the first communication mode returns to normal, the second communication mode can be switched back to the first communication mode.
上述S305至S308的步骤与S201至S204实质相同,只是通信方式不同,具体可参照S201至S204中的描述。The steps of S305 to S308 are substantially the same as those of S201 to S204, but the communication method is different. For details, please refer to the descriptions in S201 to S204.
上述实施例中,I/O口可记为第二通信方式,标准时间t5可记为第四标准时间,发送时间F4可记为第二发送时间,反馈信息K2可记为第二反馈信息,接收时间J4可记为第二接收时间,延迟时间Δt3可记为第三延迟时间,标准时间t6可记为第五标准时间,本地时间S7可记为第二实际时间,理论时间L4可记为第二理论时间,校正时间S8可记为第三校正时间。In the above-mentioned embodiment, the I/O port can be recorded as the second communication mode, the standard time t5 can be recorded as the fourth standard time, the transmission time F4 can be recorded as the second transmission time, and the feedback information K2 can be recorded as the second feedback information, The receiving time J4 can be recorded as the second receiving time, the delay time Δt3 can be recorded as the third delay time, the standard time t6 can be recorded as the fifth standard time, the local time S7 can be recorded as the second actual time, and the theoretical time L4 can be recorded as The second theoretical time, the calibration time S8 can be recorded as the third calibration time.
在一个实施例中,在时间同步过程中,所述方法还包括:In one embodiment, during the time synchronization process, the method further includes:
当第一控制单元计算第一控制单元与第二控制单元之间的延迟时间的次数达到N次,第一控制单元根据最新计算出的N次延迟时间计算平均延迟时间,并通过第一通信方式将平均延迟时间和当前的第六标准时间发送给第二控制单元;When the number of times the first control unit calculates the delay time between the first control unit and the second control unit reaches N times, the first control unit calculates the average delay time according to the latest calculated delay time N times, and communicates with the first communication method sending the average delay time and the current sixth standard time to the second control unit;
第二控制单元接收到平均延迟时间和第六标准时间后,根据平均延迟时间和第六标准时间校正第二控制单元当前的时间,得到第四校正时间。After receiving the average delay time and the sixth standard time, the second control unit corrects the current time of the second control unit according to the average delay time and the sixth standard time to obtain a fourth correction time.
在时间同步过程中,可能始终按照第一通信方式进行时间同步,此种情况下,计算延迟时间的次数指以第一通信方式计算延迟的次数。也可能始终按照第二通信方式进行时间同步,此种情况下,计算延迟时间的次数指以第二通信方式计算延迟的次数。还可能先按照第一通信方式进行时间同步,但过程中第一通信方式出现故障,进而转为按照第二通信方式进行时间同步;此种情况下,计算延迟时间的次数指以第一通信方式和第二通信方式计算延迟的总次数。During the time synchronization process, the time synchronization may always be performed according to the first communication mode. In this case, the number of times of calculating the delay time refers to the number of times of calculating the delay in the first communication mode. It is also possible to always perform time synchronization according to the second communication method. In this case, the number of times of calculating the delay time refers to the number of times of calculating the delay in the second communication method. It is also possible to first perform time synchronization according to the first communication method, but the first communication method fails during the process, and then the time synchronization is performed according to the second communication method; in this case, the number of times to calculate the delay time refers to the first communication method. Calculate the total number of delays with the second communication method.
可选的,计算N次延迟时间的平均延迟时间的方式可以采用平均值计算、滑动滤波计算和其他统计算法等,在此不做具体限定。Optionally, the method of calculating the average delay time of N times of delay time may adopt average value calculation, sliding filter calculation, and other statistical algorithms, etc., which are not specifically limited herein.
本申请实施例中,设置N次,相当于设置了滑动窗口。利用最新计算出的N次延迟时间计算出的平均延迟时间更新第一控制单元和第二控制单元之间的延迟,相当于利用最新的滑动窗口内的平均延迟进行时间同步。通过上述方法,可以有效避免由于单次延迟误差导致的时间校准误差,进而有效提高了时间同步的精度。In the embodiment of the present application, setting N times is equivalent to setting a sliding window. Updating the delay between the first control unit and the second control unit using the average delay time calculated from the latest N delay times is equivalent to using the latest average delay in the sliding window to perform time synchronization. Through the above method, the time calibration error caused by the single delay error can be effectively avoided, thereby effectively improving the accuracy of time synchronization.
需要说明的是,上述实施例仅为时间同步方法应用在汽车控制系统中的示例。实际应用中,第一控制单元和第二控制单元可以均为ECU。上述时间同步方法还可以应用于其他具有多个控制单元的控制系统,或者用于两个控制系统之间的时间同步,在此不做具体限定。It should be noted that the above embodiment is only an example of applying the time synchronization method to a vehicle control system. In practical applications, both the first control unit and the second control unit may be ECUs. The above time synchronization method can also be applied to other control systems having multiple control units, or to time synchronization between two control systems, which is not specifically limited here.
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that the size of the sequence numbers of the steps in the above embodiments does not mean the sequence of execution, and the execution sequence of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
图4是本申请实施例提供的终端设备的结构示意图。如图4所示,该实施例的终端设备4包括:至少一个处理器40(图4中仅示出一个)处理器、存储器41以及存储在所述存储器41中并可在所述至少一个处理器40上运行的计算机程序42,所述处理器40执行所述计算机程序42时实现上述任意各个时间同步方法实施例中的步骤。FIG. 4 is a schematic structural diagram of a terminal device provided by an embodiment of the present application. As shown in FIG. 4 , the
所述终端设备可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。该终端设备可包括,但不仅限于,处理器、存储器。本领域技术人员可以理解,图4仅仅是终端设备4的举例,并不构成对终端设备4的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如还可以包括输入输出设备、网络接入设备等。The terminal device may be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server. The terminal device may include, but is not limited to, a processor and a memory. Those skilled in the art can understand that FIG. 4 is only an example of the
所称处理器40可以是中央处理单元(Central Processing Unit,CPU),该处理器40还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。The so-called
所述存储器41在一些实施例中可以是所述终端设备4的内部存储单元,例如终端设备4的硬盘或内存。所述存储器41在另一些实施例中也可以是所述终端设备4的外部存储设备,例如所述终端设备4上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,所述存储器41还可以既包括所述终端设备4的内部存储单元也包括外部存储设备。所述存储器41用于存储操作系统、应用程序、引导装载程序(BootLoader)、数据以及其他程序等,例如所述计算机程序的程序代码等。所述存储器31还可以用于暂时地存储已经输出或者将要输出的数据。The
本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现可实现上述各个方法实施例中的步骤。Embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the steps in the foregoing method embodiments can be implemented.
本申请实施例提供了一种计算机程序产品,当计算机程序产品在终端设备上运行时,使得终端设备执行时实现可实现上述各个方法实施例中的步骤。The embodiments of the present application provide a computer program product, when the computer program product runs on a terminal device, so that the terminal device can implement the steps in the foregoing method embodiments when executed.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质至少可以包括:能够将计算机程序代码携带到装置/终端设备的任何实体或装置、记录介质、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random AccessMemory)、电载波信号、电信信号以及软件分发介质。例如U盘、移动硬盘、磁碟或者光盘等。在某些司法管辖区,根据立法和专利实践,计算机可读介质不可以是电载波信号和电信信号。The integrated unit, if implemented in the form of a software functional unit and sold or used as an independent product, may be stored in a computer-readable storage medium. Based on this understanding, the present application realizes all or part of the processes in the methods of the above embodiments, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When executed by a processor, the steps of each of the above method embodiments can be implemented. Wherein, the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file or some intermediate form, and the like. The computer-readable medium may include at least: any entity or device capable of carrying the computer program code to the device/terminal device, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory ( RAM, Random Access Memory), electrical carrier signals, telecommunication signals, and software distribution media. For example, U disk, mobile hard disk, disk or CD, etc. In some jurisdictions, under legislation and patent practice, computer readable media may not be electrical carrier signals and telecommunications signals.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the foregoing embodiments, the description of each embodiment has its own emphasis. For parts that are not described or described in detail in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of this application.
在本申请所提供的实施例中,应该理解到,所揭露的装置/终端设备和方法,可以通过其它的方式实现。例如,以上所描述的装置/终端设备实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。In the embodiments provided in this application, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other manners. For example, the apparatus/terminal device embodiments described above are only illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units. Or components may be combined or may be integrated into another system, or some features may be omitted, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The above-mentioned embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the above-mentioned embodiments, those of ordinary skill in the art should understand that: it can still be used for the above-mentioned implementations. The technical solutions described in the examples are modified, or some technical features thereof are equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions in the embodiments of the application, and should be included in the within the scope of protection of this application.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111600640.2A CN114489237A (en) | 2021-12-24 | 2021-12-24 | Time synchronization method, control system, and computer-readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111600640.2A CN114489237A (en) | 2021-12-24 | 2021-12-24 | Time synchronization method, control system, and computer-readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114489237A true CN114489237A (en) | 2022-05-13 |
Family
ID=81495714
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111600640.2A Pending CN114489237A (en) | 2021-12-24 | 2021-12-24 | Time synchronization method, control system, and computer-readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114489237A (en) |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1642068A (en) * | 2004-01-02 | 2005-07-20 | 上海欣泰通信技术有限公司 | Time supply and synchronizing system for telecommunication network |
CN101227246A (en) * | 2008-01-28 | 2008-07-23 | 中兴通讯股份有限公司 | Method and apparatus for master-salve clock synchronization |
CN102546071A (en) * | 2011-12-23 | 2012-07-04 | 北京北方烽火科技有限公司 | Clock synchronization method and system |
JP2013029319A (en) * | 2011-07-26 | 2013-02-07 | Nec Saitama Ltd | Slave device, electronic apparatus system, master device, time synchronization method, and program |
JP2014135541A (en) * | 2013-01-08 | 2014-07-24 | Nec Saitama Ltd | Slave unit, network system and time synchronization method of network system |
CN104243129A (en) * | 2013-06-10 | 2014-12-24 | 索尼公司 | Receiver, method of calculating time difference, and program |
US20150049627A1 (en) * | 2013-08-19 | 2015-02-19 | Kabushiki Kaisha Toshiba | Measuring apparatus and method |
CN108111244A (en) * | 2016-11-25 | 2018-06-01 | 上海东软医疗科技有限公司 | A kind of methods, devices and systems of clock correction |
CN109981206A (en) * | 2019-02-26 | 2019-07-05 | 深圳猛犸电动科技有限公司 | Time synchronization method, device, system and terminal device, storage medium |
CN110289930A (en) * | 2019-06-27 | 2019-09-27 | 深圳市元征科技股份有限公司 | A kind of embedded device method for synchronizing time, system and relevant device |
-
2021
- 2021-12-24 CN CN202111600640.2A patent/CN114489237A/en active Pending
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1642068A (en) * | 2004-01-02 | 2005-07-20 | 上海欣泰通信技术有限公司 | Time supply and synchronizing system for telecommunication network |
CN101227246A (en) * | 2008-01-28 | 2008-07-23 | 中兴通讯股份有限公司 | Method and apparatus for master-salve clock synchronization |
JP2013029319A (en) * | 2011-07-26 | 2013-02-07 | Nec Saitama Ltd | Slave device, electronic apparatus system, master device, time synchronization method, and program |
CN102546071A (en) * | 2011-12-23 | 2012-07-04 | 北京北方烽火科技有限公司 | Clock synchronization method and system |
JP2014135541A (en) * | 2013-01-08 | 2014-07-24 | Nec Saitama Ltd | Slave unit, network system and time synchronization method of network system |
CN104243129A (en) * | 2013-06-10 | 2014-12-24 | 索尼公司 | Receiver, method of calculating time difference, and program |
US20150049627A1 (en) * | 2013-08-19 | 2015-02-19 | Kabushiki Kaisha Toshiba | Measuring apparatus and method |
CN108111244A (en) * | 2016-11-25 | 2018-06-01 | 上海东软医疗科技有限公司 | A kind of methods, devices and systems of clock correction |
CN109981206A (en) * | 2019-02-26 | 2019-07-05 | 深圳猛犸电动科技有限公司 | Time synchronization method, device, system and terminal device, storage medium |
CN110289930A (en) * | 2019-06-27 | 2019-09-27 | 深圳市元征科技股份有限公司 | A kind of embedded device method for synchronizing time, system and relevant device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11133939B2 (en) | Private blockchain transaction management and termination | |
CN111585682B (en) | Sensor time synchronization method and device and terminal equipment | |
CN113852563B (en) | Message data transmission method and device, terminal equipment and readable storage medium | |
CN111209343B (en) | Node data synchronization method, device, equipment and storage medium | |
CN111338662A (en) | Firmware upgrading method and device for slave station and terminal | |
CN113489653B (en) | Message sending method and device and computer equipment | |
CN111683118B (en) | Block chain-based consensus method and device, master node equipment and slave node equipment | |
WO2022179605A1 (en) | Time synchronization method and apparatus, and vehicle-mounted device and storage medium | |
CN114338715B (en) | Data synchronization method, blockchain system, terminal equipment and storage medium | |
US11941989B2 (en) | Method for determining collision distance, storage medium and electronic equipment | |
US10585401B2 (en) | Method for determining a master time signal, vehicle, and system | |
WO2021134418A1 (en) | Data checking method and apparatus | |
CN104967536A (en) | Method and device for realizing data consistency in multiple computer rooms | |
CN112636987A (en) | Block chain cross-chain gateway determination method, system and terminal equipment | |
CN114489237A (en) | Time synchronization method, control system, and computer-readable storage medium | |
US11892872B2 (en) | Techniques for protection and accuracy of system time | |
CN111343062B (en) | In-vehicle electronic control unit identification method, system and storage medium | |
Wang et al. | Anomaly information detection and fault tolerance control method for CAN-FD bus network | |
CN114756585A (en) | Vehicle data acquisition method, device, electronic device and storage medium | |
US20240214124A1 (en) | Abnormal frame determination device, abnormal frame determination method, and non-transitory computer readable medium | |
CN112068414A (en) | Multi-system timing method, device, equipment and medium | |
CN112948105B (en) | A gradient transmission method, gradient transmission device and parameter server | |
CN116243586B (en) | Vehicle time correction method and related equipment | |
CN119544550A (en) | A real-time detection method, system and device for abnormal communication of automobile CAN bus | |
CN117792553A (en) | Time synchronization method and device and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20220513 |
|
RJ01 | Rejection of invention patent application after publication |