CN114489237A - Time synchronization method, control system, and computer-readable storage medium - Google Patents

Time synchronization method, control system, and computer-readable storage medium Download PDF

Info

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 time
receiving
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
Application number
CN202111600640.2A
Other languages
Chinese (zh)
Inventor
韩冬阁
周宇轩
赵昱阳
王庆飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Wanji Technology Co Ltd
Original Assignee
Beijing Wanji Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Wanji Technology Co Ltd filed Critical Beijing Wanji Technology Co Ltd
Priority to CN202111600640.2A priority Critical patent/CN114489237A/en
Publication of CN114489237A publication Critical patent/CN114489237A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/04Generating or distributing clock signals or signals derived directly therefrom
    • G06F1/12Synchronisation of different clock signals provided by a plurality of clock generators
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/04Programme control other than numerical control, i.e. in sequence controllers or logic controllers
    • G05B19/042Programme control other than numerical control, i.e. in sequence controllers or logic controllers using digital processors
    • G05B19/0423Input/output
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock 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 application is applicable to the technical field of communication, and provides a time synchronization method, a control system and a computer-readable storage medium, wherein the control system comprises a first control unit and at least one second control unit, and the method comprises the following steps: the first control unit sends the first standard time to the second control unit and records the first sending time; the second control unit returns the first feedback information to the first control unit; the first control unit calculates a first delay time between the first control unit and the second control unit according to the first sending time and a first receiving time of the first feedback information, and sends the first delay time and a current second standard time to the second control unit; 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 first correction time. By the method, the time synchronization precision among the control units of the automobile can be effectively improved.

Description

Time synchronization method, control system, and computer-readable storage medium
Technical Field
The present application relates to the field of communications technologies, and in particular, to a time synchronization method, a control system, and a computer-readable storage medium.
Background
The vehicle control system usually includes a plurality of control units, where communication interaction may exist between different control units, and in addition, the control units often need to acquire vehicle external information, such as a distance between a vehicle and a preceding vehicle, a time of a traffic light, and the like. The control unit adjusts the control strategy in real time according to the interactive information obtained by the communication and interaction with other control units and the obtained external information of the automobile, so that the time synchronization between the control units and the external information is needed.
In the prior art, a time standard source is usually set, the time standard source sends standard time to each control unit, and each control unit self-corrects the time according to the received standard time. The existing method cannot ensure the precision of the time synchronization result.
Disclosure of Invention
The embodiment of the application provides a time synchronization method, a control system and a computer readable storage medium, which can effectively improve the time synchronization precision among 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 a first standard time to the second control unit through a first communication mode and records a first sending time;
after receiving the first standard time, the second control unit returns first feedback information to the first control unit through the first communication mode;
after receiving the first feedback information, the first control unit calculates a first delay time between the first control unit and the second control unit according to the first sending time and a first receiving time of receiving the first feedback information, and sends the first delay time and a current second standard time to the second control unit through the first communication mode;
and 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 first correction time.
In the embodiment of the application, the communication delay time between the first control unit and the second control unit is confirmed through the interaction of the time information between the first control unit and the second control unit, and the communication delay is considered in the time correction process, so that the corrected time is closer to the standard time, and the precision of time synchronization is further improved.
In a possible implementation manner of the first aspect, 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 a first corrected time, including:
after receiving the first delay time and the second standard time, the second control unit calculates a first theoretical time according to a current first actual time and the first delay time of the second control unit;
and 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 current time of the second control unit according to the first delay time and the second standard time to obtain the first correction time.
In a possible implementation manner of the first aspect, after the current time of the second control unit is corrected according to the first delay time and the second standard time to obtain a first corrected time, the method further includes:
the second control unit sends the first correction time to the first control unit in the first communication mode;
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 sends the second delay time and a current third standard time to the second control unit through the first communication mode;
and 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 second correction time.
In a possible implementation manner of the first aspect, after calculating the first theoretical time according to the first actual time and the first delay time of the second control unit, 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 mode;
if the first control unit receives the uncorrected identifier within the preset time or does not receive the information of the second control unit within the preset time, the current fourth standard time is sent to the second control unit through a second communication mode, and second sending time is recorded;
after receiving the fourth standard time, the second control unit returns second feedback information to the first control unit through the second communication mode;
after receiving the second feedback information, the first control unit calculates a third delay time between the first control unit and the second control unit according to the second sending time and a second receiving time of receiving the second feedback information, and sends the third delay time and a current fifth standard time to the second control unit through the second communication mode;
and 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 receiving the third delay time and the fifth standard time, the correcting, by the second control unit, the current time of the second control unit according to the third delay time and the fifth standard time includes:
after receiving the third delay time and the fifth standard time, the second control unit calculates a second theoretical time according to a 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 current time of the second control unit according to the third delay time and the fifth standard time to obtain third corrected time;
and 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 for the second control unit to process the fourth standard time;
after receiving the second feedback information, the first control unit calculates a third delay time between the first control unit and the second control unit according to the second sending time and a second receiving time of receiving the second feedback information, including:
after the first control unit receives the second feedback information, the first control unit calculates the third delay time according to the second sending time, the first processing time and the second receiving 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, the method corrects the current time of the second control unit according to the first delay time and the second standard time to obtain a first corrected time, and then the method further includes:
when the number of times that 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 an average delay time according to the newly calculated N times of delay time, and sends the average delay time and a current sixth standard time to the second control unit through the first communication mode;
and 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 fourth correction time.
In a second aspect, an embodiment of the present application provides a control system, which includes a first control unit and at least one second control unit, wherein:
the first control unit is used for sending a first standard time to the second control unit through a first communication mode and recording a first sending time;
the second control unit is used for returning first feedback information to the first control unit in the first communication mode after receiving the first standard time;
the first control unit is used for calculating a first delay time between the first control unit and the second control unit according to the first sending time and a first receiving time of the first feedback information after receiving the first feedback information, and sending the first delay time and a current second standard time to the second control unit through the first communication mode;
and the second control unit is used for correcting 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 to obtain 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, where the processor, when executing the computer program, implements the time synchronization method according to any one of the first aspect.
In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, and the embodiment of the present application provides a computer-readable storage medium, where a computer program is stored, where the computer program, when executed by a processor, implements the time synchronization method according to any one of the first aspect.
In a fifth aspect, an embodiment of the present application provides a computer program product, which, when run on a terminal device, causes the terminal device to execute the time synchronization method according to any one of the first aspect.
It is understood that the beneficial effects of the second aspect to the fifth aspect can be referred to the related description of the first aspect, and are not described herein again.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
FIG. 1 is a schematic diagram of an automotive control system provided by an embodiment of the present application;
fig. 2 is an interaction flow diagram of a time synchronization method according to an embodiment of the present application;
FIG. 3 is a schematic diagram illustrating an interaction flow of a time synchronization method according to another embodiment of the present application;
fig. 4 is a schematic structural diagram of a terminal device according to an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from 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 will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when.. or" upon "or" in response to a determination "or" in response to a detection ". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
Furthermore, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used for distinguishing between descriptions and not necessarily for describing or implying relative importance.
Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means 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," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise.
The embodiment of the application can be applied to an automobile control system. Referring to fig. 1, a schematic diagram of an automobile control system provided in an embodiment of the present application is shown. As shown in fig. 1, the vehicle Control system may include a vehicle to outside information interaction Control Unit (V2X-OBU) 11 and a plurality of Electronic Control Units (ECUs) 12.
The V2X-OBU may include a Microprocessor Unit (MPU), a Microcontroller Unit (MCU), and a V2X communication module. The V2X-OBU communicates with the outside of the automobile through the V2X communication module, such as the satellite to acquire the satellite time service. The V2X-OBU carries out calculation processing on relevant data required by time synchronization through the MPU and is in communication interaction with other electronic control units through the MCU. The MCU and other electronic units CAN communicate in a CAN bus, an I/O port or a serial port and the like.
In some application scenarios, the MCU may transmit information to a Central Gateway (CGW) via a CAN bus, and then the CGW is transmitted from the central gateway to the electronic control unit via the CAN bus. In other application scenarios, the MCU may transmit information to the electronic control unit via the I/O port.
As shown in the automobile control system, in an application scene, the V2X-OBU is responsible for communicating with the outside of the automobile, and relevant early warning information is calculated according to outside information (such as traffic light time, distance between the front and the back of the automobile and the like) and state information (acquired from an ECU) of the automobile. An Advanced Driving Assistance System (ADAS) of the automobile can control the state of the automobile according to the early warning information, avoid accidents, violations and even illegal Driving accidents, and improve road traffic safety and the like. In order to be able to calculate and warn accurately, it is necessary that the V2X-OBU be kept time-synchronized with the respective ECU.
In the prior art, a time standard source is usually set, the time standard source sends standard time to each control unit, and each control unit self-corrects the time according to the received standard time. The existing method cannot ensure the precision of the time synchronization result. In order to solve the problem, an embodiment of the present application provides a time synchronization method. The method is described below in various embodiments.
In an embodiment, referring to fig. 2, an interaction flow diagram of a time synchronization method provided in an embodiment of the present application is shown, and by way of example and not limitation, the method may include the following steps:
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, after receiving the standard time t1, the ECU returns a piece of feedback information K1 to the V2X-OBU through the CAN bus.
S203, after the V2X-OBU receives the feedback information K1, the delay time delta t1 between the V2X-OBU and the ECU is calculated according to the fact that the sending time is F1 and the receiving time J1 of receiving the feedback information K1, the delay time delta t1 and the current standard time t2 are sent to the ECU through the CAN bus, and the sending time F2 is recorded.
In the embodiment of the application, after receiving the standard time t1, the ECU may return the feedback information K1 after a certain waiting time, which will affect the calculation of the delay time. To solve this problem, the feedback information may optionally include the above-mentioned waiting time (i.e., the time when the ECU sends the feedback information K1 minus the time when the standard time t1 is received). Accordingly, S207 may include: the V2X-OBU calculates the delay time Δ t1 from the transmission time F1, the wait time, and the reception time J1.
Specifically, the waiting time is subtracted from the reception time J1, and the transmission time F1 is subtracted, so as to obtain a time difference, and the time difference is divided by 2, so as to obtain the delay time Δ t 1.
S204, after the ECU receives the delay time delta t1 and the standard time t2, the theoretical time L1 is calculated according to the delay time delta 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 delta t1 and the standard time t2 to obtain corrected local time S2. The corrected time S2 is sent to the V2X-OBU via the CAN bus.
Specifically, the delay time Δ t1 is subtracted from the actual time S1 to obtain the theoretical time L1.
Alternatively, the theoretical local time may be obtained by adding the delay time Δ t1 to the standard time t2, and the time difference between the theoretical local time and the current actual time S1 may be calculated, so as to correct the local time according to the time difference.
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 smaller than the preset value (it indicates that the difference between the ECU local time and the standard time is small), the ECU may choose not to correct the local time, and send the current local time as the corrected time S2 to the V2X-OBU.
S205, after the V2X-OBU receives the correction time S2, the delay time delta t2 between the V2X-OBU and the ECU is updated according to the sending time F2 and the receiving time J2 of receiving the correction time S2, the current standard time t3 and the updated delay time delta t2 are sent to the ECU, and the sending time is recorded as F3.
S206, after the ECU receives the standard time t3 and the delay time delta t2, the theoretical time L2 is calculated according to the delay time delta 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 delta t2 and the standard time t3 to obtain corrected time S4. The corrected time S4 is sent to the V2X-OBU via the CAN bus.
After V2X-OBU receives the corrected time S4, the delay time between V2X-OBU and the ECU continues to be updated according to the reception time J3 and the transmission time F3. And circulating to synchronize the holding time between the V2X-OBU and the ECU.
In the above embodiment, V2X-OBU may be regarded as a first control unit, ECU may be regarded as a second control unit, CAN bus may be regarded as a first communication method, standard time t1 may be regarded as a first standard time, standard time t2 may be regarded as a second standard time, standard time t3 may be regarded as a third standard time, transmission time F1 may be regarded as a first transmission time, feedback information K1 may be regarded as first feedback information, reception time J1 may be regarded as a first reception time, delay time Δ t1 may be regarded as a first delay time, local time S1 may be regarded as a first actual time, theoretical time L1 may be regarded as a first theoretical time, correction time S2 may be regarded as a first correction time, delay time Δ t2 may be regarded as a second delay time, and correction time S4 may be regarded as a second correction time.
In the embodiment of the application, the communication delay time between the first control unit and the second control unit is confirmed through the interaction of the time information between the first control unit and the second control unit, and the communication delay is considered in the time correction process, so that the corrected time is closer to the standard time, and the precision of time synchronization is further improved.
In another embodiment, referring to fig. 3, an interaction flow diagram of a time synchronization method provided in another embodiment of the present application is shown, by way of example and not limitation, the method may include the following steps:
s301, the V2X-OBU sends the current standard time t1 to the ECU through the CAN bus, and records the sending time as F1.
And S302, after receiving t1, the ECU returns a piece of feedback information K1 to the V2X-OBU through the CAN bus.
And S303, after the V2X-OBU receives the feedback information K1, calculating the delay time delta t1 between the V2X-OBU and the ECU according to the fact that the sending time is F1 and the receiving time J1 of receiving the feedback information K1, sending the delay time delta t1 and the current standard time t2 to the ECU through the CAN bus, and recording the sending time F2.
S301 to S303 are the same as S201 to S203 described above, and reference may be specifically made to the description in S201 to S203, which is not described herein again. S304 is another case of S204.
S304, after the ECU receives the delay time delta t1 and the standard time t2, the theoretical time L1 is calculated according to the delay time delta 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.
The time difference between the theoretical time and the standard time is large, which indicates that the time received by the ECU is inaccurate, and the time synchronization cannot be realized. In this case, the failure of the first communication method may occur, or the communication congestion of the first communication method may occur. At this time, the ECU may return an uncorrected flag to the V2X-OBU without correcting the local time. If the first communication mode fails, the V2X-OBU cannot receive the uncorrected identification; if the first communication mode is congested, the V2X-OBU may receive the uncorrected flag, but the reception time may be delayed.
S305, if the V2X-OBU receives the uncorrected mark in the preset time or does not receive the information of the second control unit in the preset time, the current standard time t5 is sent to the ECU through the I/O port, and the sending time F4 is recorded.
And the V2X-OBU receives the uncorrected mark, and switches the communication mode if the first communication mode fails. If the CAN bus is switched to the I/O port, the time synchronization is carried out again after the communication mode is switched.
And S306, after receiving the standard time t5, the ECU returns feedback information K2 to the V2X-OBU through the I/O port.
S307, after the V2X-OBU receives the feedback information K2, the delay time delta t3 between the V2X-OBU and the ECU is calculated according to the sending time F4 and the receiving time J4 of the feedback information K2, the delay time delta t3 and the current standard time t6 are sent to the ECU through the I/O port, and the sending time F5 is recorded.
In the embodiment of the 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. To solve this problem, the feedback information may optionally include a first processing time at which the ECU processes a pulse indicating the standard time t 5. Accordingly, S307 may include: the V2X-OBU calculates a delay time Δ t3 from the transmission time F2, the first processing time, and the reception time J3.
Specifically, the first processing time is subtracted from the reception time J3, and the transmission time F2 is subtracted to obtain a time difference, and the time difference is divided by 2 to obtain the delay time Δ t 3.
S308, after the ECU receives the delay time delta t3 and the standard time t6, the theoretical time L4 is calculated according to the current local time S7 and the delay time delta t3 of the ECU; and if the time difference between the theoretical time L4 and the standard time t6 is within a preset range, the ECU corrects the current time of the ECU according to the delay time delta t3 and the standard time t6 to obtain corrected local time S8, and sends the corrected time S8 to the V2X-OBU.
After V2X-OBU receives the corrected time S8, the delay time between V2X-OBU and the ECU continues to be updated according to the reception time J5 and the transmission time F5. Cycling in turn to synchronize the hold times between the V2X-OBU and the ECU.
And 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. This case also indicates that the I/O port has failed. Because both the CAN bus and the I/O port have faults, the communication of the control system has faults and the time synchronization cannot be continued.
Of course, if the third communication mode exists, if the time difference between the theoretical time L4 and the standard time t6 is not within the preset range, the third communication mode may be switched to continue the time synchronization. The step of performing time synchronization in the third communication manner is substantially the same as the step described in the embodiment of fig. 2 and fig. 3, and reference may be specifically made to the embodiment of fig. 2 and fig. 3, which is not described herein again.
In one embodiment, the first communication mode may be kept monitored during time synchronization by the second communication mode. When the first communication mode returns to normal, the second communication mode can be switched back to the first communication mode.
The steps of S305 to S308 are substantially the same as those of S201 to S204, except that the communication method is different, and reference may be specifically made to the description of S201 to S204.
In the above embodiments, the I/O port may be recorded as the second communication method, the standard time t5 may be recorded as the fourth standard time, the transmission time F4 may be recorded as the second transmission time, the feedback information K2 may be recorded as the second feedback information, the reception time J4 may be recorded as the second reception time, the delay time Δ t3 may be recorded as the third delay time, the standard time t6 may be recorded as the fifth standard time, the local time S7 may be recorded as the second actual time, the theoretical time L4 may be recorded as the second theoretical time, and the corrected time S8 may be recorded as the third corrected time.
In one embodiment, during time synchronization, the method further comprises:
when the number of times that 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 newly calculated N times of delay time, and sends the average delay time and the current sixth standard time to the second control unit through a first communication mode;
and 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 fourth correction time.
In the time synchronization process, the time synchronization may be always performed according to the first communication method, and 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 method. It is also possible to always perform time synchronization in the second communication method, and 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. Time synchronization may also be performed according to the first communication mode, but the first communication mode fails in the process, and then time synchronization is performed according to the second communication mode; in this case, the number of times of calculating the delay time refers to the total number of times of calculating the delay in the first communication method and the second communication method.
Optionally, the mode of calculating the average delay time of the delay times of N times may adopt average value calculation, sliding filter calculation, other statistical algorithms, and the like, which is not specifically limited herein.
In the embodiment of the application, the setting is performed N times, which is equivalent to the setting of the sliding window. Updating the delay between the first control unit and the second control unit with the average delay time calculated using the latest calculated delay times N times corresponds to performing time synchronization with the average delay within the latest sliding window. By the method, time calibration errors caused by single delay errors can be effectively avoided, and the precision of time synchronization is effectively improved.
It should be noted that the above embodiments are only examples of the application of the time synchronization method in the vehicle control system. In practical applications, the first control unit and the second control unit may both be ECUs. The time synchronization method may also be applied to other control systems having a plurality of control units, or used for time synchronization between two control systems, and is not particularly limited herein.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
Fig. 4 is a schematic structural diagram of a terminal device according to an embodiment of the present application. As shown in fig. 4, the terminal device 4 of this embodiment includes: at least one processor 40 (only one shown in fig. 4), a memory 41, and a computer program 42 stored in the memory 41 and executable on the at least one processor 40, the processor 40 implementing the steps in any of the various time synchronization method embodiments described above when executing the computer program 42.
The terminal device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The terminal device may include, but is not limited to, a processor, a memory. Those skilled in the art will appreciate that fig. 4 is merely an example of the terminal device 4, and does not constitute a limitation to the terminal device 4, and may include more or less components than those shown, or may combine some components, or different components, and may further include, for example, an input/output device, a network access device, and the like.
The Processor 40 may be a Central Processing Unit (CPU), and the Processor 40 may be other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 41 may in some embodiments be an internal storage unit of the terminal device 4, such as a hard disk or a memory of the terminal device 4. In other embodiments, the memory 41 may also be an external storage device of the terminal device 4, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like provided on the terminal device 4. Further, the memory 41 may also include both an internal storage unit and an external storage device of the terminal device 4. The memory 41 is used for storing an operating system, an application program, a BootLoader (BootLoader), data, and other programs, such as program codes of the computer program. The memory 31 may also be used to temporarily store data that has been output or is to be output.
The embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the computer program implements the steps in the above-mentioned method embodiments.
The embodiments of the present application provide a computer program product, which when running on a terminal device, enables the terminal device to implement the steps in the above method embodiments when executed.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium and can implement the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code to an apparatus/terminal device, recording medium, computer Memory, Read-Only Memory (ROM), Random-Access Memory (RAM), electrical carrier wave signals, telecommunications signals, and software distribution medium. Such as a usb-drive, a removable hard drive, a magnetic or optical disk, etc. In certain jurisdictions, computer-readable media may not be an electrical carrier signal or a telecommunications signal in accordance with legislative and patent practice.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other ways. For example, the above-described embodiments of the apparatus/terminal device are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (10)

1. A time synchronization method is applied to a control system, the control system comprises a first control unit and at least one second control unit, and the method comprises the following steps:
the first control unit sends a first standard time to the second control unit through a first communication mode and records a first sending time;
after receiving the first standard time, the second control unit returns first feedback information to the first control unit in the first communication mode;
after receiving the first feedback information, the first control unit calculates a first delay time between the first control unit and the second control unit according to the first sending time and a first receiving time of receiving the first feedback information, and sends the first delay time and a current second standard time to the second control unit through the first communication mode;
and 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 first correction time.
2. The time synchronization method of claim 1, wherein the step of correcting the current time of the second control unit according to the first delay time and the second standard time after the second control unit receives the first delay time and the second standard time to obtain a first corrected time comprises:
after receiving the first delay time and the second standard time, the second control unit calculates a first theoretical time according to a current first actual time and the first delay time of the second control unit;
and 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 current time of the second control unit according to the first delay time and the second standard time to obtain the first correction time.
3. The time synchronization method according to claim 1 or 2, wherein after correcting the current time of the second control unit based on the first delay time and the second standard time to obtain a first corrected time, the method further comprises:
the second control unit sends the first correction time to the first control unit in the first communication mode;
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 sends the second delay time and a current third standard time to the second control unit through the first communication mode;
and 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 second correction time.
4. The time synchronization method of claim 2, wherein after calculating a first theoretical time based on a current first actual time of the second control unit and the first delay time, the method further comprises:
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 mode;
if the first control unit receives the uncorrected identifier within the preset time or does not receive the information of the second control unit within the preset time, the current fourth standard time is sent to the second control unit through a second communication mode, and second sending time is recorded;
after receiving the fourth standard time, the second control unit returns second feedback information to the first control unit through the second communication mode;
after receiving the second feedback information, the first control unit calculates a third delay time between the first control unit and the second control unit according to the second sending time and a second receiving time of receiving the second feedback information, and sends the third delay time and a current fifth standard time to the second control unit through the second communication mode;
and 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.
5. The time synchronization method of claim 4, wherein the correcting the current time of the second control unit according to the third delay time and the fifth standard time after the second control unit receives the third delay time and the fifth standard time comprises:
after receiving the third delay time and the fifth standard time, the second control unit calculates a second theoretical time according to a 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 current time of the second control unit according to the third delay time and the fifth standard time to obtain third corrected time;
and 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.
6. The time synchronization method according to claim 4, wherein the second feedback information includes a first processing time at which the second control unit processes the fourth standard time;
after receiving the second feedback information, the first control unit calculates a third delay time between the first control unit and the second control unit according to the second sending time and a second receiving time of receiving the second feedback information, including:
after the first control unit receives the second feedback information, the first control unit calculates the third delay time according to the second sending time, the first processing time and the second receiving time.
7. The time synchronization method of claim 1, wherein after the second control unit receives the first delay time and the second standard time, the method corrects the current time of the second control unit according to the first delay time and the second standard time to obtain a first corrected time, the method further comprising:
when the number of times that 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 an average delay time according to the newly calculated N times of delay time, and sends the average delay time and a current sixth standard time to the second control unit through the first communication mode;
and 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 fourth correction time.
8. A control system, characterized in that the control system comprises a first control unit and at least one second control unit, wherein:
the first control unit is used for sending a first standard time to the second control unit through a first communication mode and recording a first sending time;
the second control unit is used for returning first feedback information to the first control unit in the first communication mode after receiving the first standard time;
the first control unit is used for calculating a first delay time between the first control unit and the second control unit according to the first sending time and a first receiving time of the first feedback information after receiving the first feedback information, and sending the first delay time and a current second standard time to the second control unit through the first communication mode;
and the second control unit is used for correcting 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 to obtain first correction time.
9. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 7.
CN202111600640.2A 2021-12-24 2021-12-24 Time synchronization method, control system, and computer-readable storage medium Pending CN114489237A (en)

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)

* Cited by examiner, † Cited by third party
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

Patent Citations (10)

* Cited by examiner, † Cited by third party
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
KR102310252B1 (en) Methods related to motor vehicle driver assistance systems
CN111585682B (en) Sensor time synchronization method and device and terminal equipment
US20210044610A1 (en) Anomaly detection method and anomaly detection device
CN113852563B (en) Message data transmission method and device, terminal equipment and readable storage medium
US10585401B2 (en) Method for determining a master time signal, vehicle, and system
CN111338662A (en) Firmware upgrading method and device for slave station and terminal
CN113489653B (en) Message sending method and device and computer equipment
WO2022179605A1 (en) Time synchronization method and apparatus, and vehicle-mounted device and storage medium
CN112003773A (en) End-to-end checking method and system for CAN bus safety data
CN115186732A (en) Intelligent driving target fusion method, device and equipment and readable storage medium
CN114489237A (en) Time synchronization method, control system, and computer-readable storage medium
CN117221152A (en) Method and device for receiving and judging Ethernet message
CN111459568A (en) Vehicle data processing method and device
CN111343062B (en) In-vehicle electronic control unit identification method, system and storage medium
KR20200124470A (en) Apparatus for gateway of a vehicle, system having the same and method for detect invasion thereof
CN117499334B (en) Intelligent vehicle communication method, terminal equipment and storage medium
US20240214124A1 (en) Abnormal frame determination device, abnormal frame determination method, and non-transitory computer readable medium
EP3346638A1 (en) Method, apparatus, and computer-readable storage medium comprising instructions for vehicle-to-vehicle communication
CN114513385B (en) Data transmission method, device, electronic equipment and storage medium
Wu et al. CAN compression using signal rearrangement
CN112463125B (en) Timing method and equipment of virtual timer
CN110996251B (en) Delay deviation correcting method for vehicle interior network
CN115267851B (en) Navigation synchronous communication method and device, electronic equipment and storage medium
US11824687B2 (en) Information processing apparatus and legitimate communication determination method
US20240098465A1 (en) Method for sending a vehicle-to-x message by a sender, method for processing a vehicle-to-x-message, and a vehicle-to-x-communications module

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