WO2023141817A1 - 一种时间同步方法、装置及存储介质 - Google Patents
一种时间同步方法、装置及存储介质 Download PDFInfo
- Publication number
- WO2023141817A1 WO2023141817A1 PCT/CN2022/074037 CN2022074037W WO2023141817A1 WO 2023141817 A1 WO2023141817 A1 WO 2023141817A1 CN 2022074037 W CN2022074037 W CN 2022074037W WO 2023141817 A1 WO2023141817 A1 WO 2023141817A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- clock
- time
- gnss
- data plane
- crystal oscillator
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 121
- 238000003860 storage Methods 0.000 title claims abstract description 26
- 239000013078 crystal Substances 0.000 claims description 167
- 230000001360 synchronised effect Effects 0.000 claims description 105
- 230000005540 biological transmission Effects 0.000 claims description 23
- 238000004590 computer program Methods 0.000 claims description 16
- 230000002159 abnormal effect Effects 0.000 claims description 15
- 238000010586 diagram Methods 0.000 description 28
- 238000012545 processing Methods 0.000 description 24
- 230000006870 function Effects 0.000 description 19
- 238000004458 analytical method Methods 0.000 description 14
- 238000004422 calculation algorithm Methods 0.000 description 13
- 230000008569 process Effects 0.000 description 12
- 238000004364 calculation method Methods 0.000 description 11
- 238000004891 communication Methods 0.000 description 10
- 101100137463 Bacillus subtilis (strain 168) ppsA gene Proteins 0.000 description 9
- 101100342406 Saccharomyces cerevisiae (strain ATCC 204508 / S288c) PRS1 gene Proteins 0.000 description 9
- 101150056693 pps1 gene Proteins 0.000 description 9
- 230000009977 dual effect Effects 0.000 description 8
- SPBWHPXCWJLQRU-FITJORAGSA-N 4-amino-8-[(2r,3r,4s,5r)-3,4-dihydroxy-5-(hydroxymethyl)oxolan-2-yl]-5-oxopyrido[2,3-d]pyrimidine-6-carboxamide Chemical compound C12=NC=NC(N)=C2C(=O)C(C(=O)N)=CN1[C@@H]1O[C@H](CO)[C@@H](O)[C@H]1O SPBWHPXCWJLQRU-FITJORAGSA-N 0.000 description 7
- 101100464927 Bacillus subtilis (strain 168) ppsB gene Proteins 0.000 description 7
- 102100021677 Baculoviral IAP repeat-containing protein 2 Human genes 0.000 description 7
- 101000896157 Homo sapiens Baculoviral IAP repeat-containing protein 2 Proteins 0.000 description 7
- 239000000284 extract Substances 0.000 description 7
- 230000000737 periodic effect Effects 0.000 description 7
- 102100021662 Baculoviral IAP repeat-containing protein 3 Human genes 0.000 description 6
- 101000896224 Homo sapiens Baculoviral IAP repeat-containing protein 3 Proteins 0.000 description 6
- 230000000694 effects Effects 0.000 description 5
- 230000003287 optical effect Effects 0.000 description 4
- 230000003068 static effect Effects 0.000 description 4
- 230000014509 gene expression Effects 0.000 description 3
- 235000006754 Taraxacum officinale Nutrition 0.000 description 2
- 240000001949 Taraxacum officinale Species 0.000 description 2
- 239000008186 active pharmaceutical agent Substances 0.000 description 2
- 238000003491 array Methods 0.000 description 2
- 238000012937 correction Methods 0.000 description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 238000006467 substitution reaction Methods 0.000 description 2
- 102100034112 Alkyldihydroxyacetonephosphate synthase, peroxisomal Human genes 0.000 description 1
- RYGMFSIKBFXOCR-UHFFFAOYSA-N Copper Chemical compound [Cu] RYGMFSIKBFXOCR-UHFFFAOYSA-N 0.000 description 1
- 101000799143 Homo sapiens Alkyldihydroxyacetonephosphate synthase, peroxisomal Proteins 0.000 description 1
- 230000002776 aggregation Effects 0.000 description 1
- 238000004220 aggregation Methods 0.000 description 1
- 238000000848 angular dependent Auger electron spectroscopy Methods 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008901 benefit Effects 0.000 description 1
- 230000006835 compression Effects 0.000 description 1
- 238000007906 compression Methods 0.000 description 1
- 238000012790 confirmation Methods 0.000 description 1
- 239000013256 coordination polymer Substances 0.000 description 1
- 229910052802 copper Inorganic materials 0.000 description 1
- 239000010949 copper Substances 0.000 description 1
- 230000001419 dependent effect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000037361 pathway Effects 0.000 description 1
- 230000002441 reversible effect Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 230000035945 sensitivity Effects 0.000 description 1
- 230000001953 sensory effect Effects 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
- 238000002604 ultrasonography Methods 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04J—MULTIPLEX COMMUNICATION
- H04J3/00—Time-division multiplex systems
- H04J3/02—Details
- H04J3/06—Synchronising arrangements
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/30—Services specially adapted for particular environments, situations or purposes
- H04W4/40—Services specially adapted for particular environments, situations or purposes for vehicles, e.g. vehicle-to-pedestrians [V2P]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W56/00—Synchronisation arrangements
Definitions
- the present application relates to the technical field of automatic driving, and in particular to a time synchronization method, device and storage medium.
- An accurate clock (clock, CLK) is one of the key factors for the highly reliable operation of the Automated Driving System (ADS) in the vehicle.
- ADS Automated Driving System
- the clock in the automatic driving system needs to meet the high precision of the indicated time, be stable without large jumps, and accurately follow the real time to coordinate universal time (UTC).
- UTC time is obtained from GNSS information provided by the global navigation satellite system (GNSS).
- GNSS global navigation satellite system
- the UTC time source is unstable, which affects the reliability of intelligent driving algorithms. Therefore, how to maintain the stability of the time in the automatic driving system and follow the UTC time is a difficult problem in the field of automatic driving.
- the present application proposes a time synchronization method, device, system, vehicle, storage medium and computer program product.
- the embodiment of the present application provides a method for time synchronization, the method comprising: obtaining the first deviation value between the time indicated by the clock on the data plane of the current period and the time indicated by the clock on the management plane; When a deviation value is greater than a first threshold, the data plane clock in the current cycle is adjusted according to an adjustment range in a cycle, and the adjustment range in a cycle is smaller than or equal to the first threshold.
- the first threshold may represent the maximum value of data plane clock jumps allowed in a period, and when the first deviation value is greater than the first threshold, the data plane clock in the current period shall be adjusted according to the adjustment range within the period. Adjustment, in this way, adopt the method of "small steps and fast running", and through multiple cycles of adjustment, the deviation between the data plane clock and the management plane clock will gradually decrease until they are synchronized, and the adjustment range corresponding to each cycle will not exceed the first A threshold value, so that on the basis of ensuring the time stability in the automatic driving system, the clock on the data plane is synchronized with the clock on the management plane.
- the management plane clock can follow the GNSS clock, that is, the time indicated by the management plane clock can be kept the same or close to UTC time, therefore, through periodic adjustments, the time indicated by the data plane clock can be kept the same or close to UTC time, thus ensuring
- the time in the automatic driving system is kept the same or close to the UTC time.
- the time stamp provided by the management plane clock and the time stamp provided by the data plane clock are consistent with UTC time while the vehicle is running. The time remains the same or close, thereby ensuring the reliable operation of the automatic driving system in scenarios such as vehicle to everything (V2X) information exchange with the outside world, and improving the efficiency and accuracy of event analysis.
- V2X vehicle to everything
- the method further includes: when the first deviation value is less than or equal to the first threshold, within the current cycle adjusting the data plane clock to be synchronized with the management plane clock.
- the first threshold can represent the maximum value of data plane clock jumps allowed in a period.
- the "one-step adjustment" method is adopted to set The clock on the data plane is adjusted to be synchronized with the clock on the management plane, which realizes the automatic compensation of the time deviation between the clock on the data plane and the clock on the management plane, so that on the basis of ensuring the time stability in the automatic driving system, the clock on the data plane and the clock on the management plane can be realized more quickly Synchronize.
- the method further includes: according to the first deviation value and/or the The range is adjusted within the period, and the time stamp provided by the data plane clock is corrected.
- the time stamp generated during the adjustment of the data plane clock may have a small deviation from UTC time.
- the corrected time stamp is synchronized with UTC time, thereby The efficiency and accuracy of event analysis are further improved.
- the first threshold is preconfigured; or the first threshold is determined by The application software is notified when the operation mode is changed, and the application software uses the data plane clock.
- the management plane clock and the data plane clock are based on Initialization is performed at the time indicated by the management plane clock when the system stores the previous power-off; or, the initialization is performed according to the time indicated by a real-time clock (Real-time clock, RTC).
- RTC Real-time clock
- the management plane clock and the data plane clock are initialized using the time indicated by the management plane clock at the previous power-off, so as to ensure that the management plane clock and the data plane clock are initialized each time they are powered on. Consistency of time, which is conducive to faster synchronization of the management plane clock and data plane clock with UTC time after power-on; or, use the time indicated by RTC to initialize the management plane clock and data plane clock.
- the deviation between the time indicated by the RTC and the UTC time is small, so as to ensure the consistency of the initial time of the management plane clock and the data plane clock at each power-on operation, and at the same time ensure that the initial time of the management plane clock and the data plane clock is consistent with UTC
- the time deviation should be as small as possible, which is conducive to faster synchronization of the management plane clock and data plane clock with UTC time on the basis of avoiding large jumps in the management plane clock and data plane clock after power-on.
- the method further includes: receiving first GNSS clock information in the current cycle , the first GNSS clock information includes at least one of the following: pulse per second (Pulse Per Second, PPS) and/or recommended positioning information (Recommended Minimum Specific GPS, GPRMC); confirming that the first GNSS clock information satisfies satellite time and is valid condition, adjust the management plane clock to be synchronized with the GNSS clock according to the first GNSS clock information.
- PPS Pulse Per Second
- GPRMC Recommended Minimum Specific GPS
- the management plane clock is adjusted to be synchronized with the GNSS clock, thereby avoiding the time synchronization error caused by using invalid GNSS clock information , which improves the accuracy of time synchronization.
- the method further includes: when confirming that the first GNSS clock information satisfies the satellite time valid condition , adjusting the RTC to be synchronized with the GNSS clock according to the first GNSS clock information.
- the RTC when ensuring that the GNSS clock information received in the current period meets the valid satellite time conditions, the RTC is adjusted to be synchronized with the GNSS clock, thereby avoiding the time synchronization error caused by using invalid GNSS clock information and improving the accuracy of time synchronization.
- the method further includes: according to the management plane clock, assigning At least one management plane sub-clock of the management plane clock is adjusted to be synchronized with the management plane clock; according to the data plane clock, at least one data plane sub-clock subordinate to the data plane clock is adjusted to be synchronized with the data plane clock .
- the management plane clock follows the management plane clock, and the data plane clock follows the data plane clock.
- each data plane clock and management plane clock can be kept the same or close to UTC time, thereby ensuring the data plane clock and the management plane clock. Stable operation of the functional node where the clock is located.
- the method further includes: determining the timing deviation of the first crystal oscillator relative to the GNSS clock rate; correct the management plane clock and the data plane clock according to the timing deviation rate, and the management plane clock and the data plane clock are maintained by the first crystal oscillator.
- the timing deviation rate of the first crystal oscillator relative to the GNSS clock is determined, and according to the timing deviation rate, the management plane clock and the data plane clock are corrected, so as to realize the automatic compensation of the crystal oscillator timing deviation; at the same time, the management plane clock is avoided
- the indicated time and the time indicated by the clock on the data surface have a large deviation from UTC time, which ensures the stable and reliable operation of the automatic driving system.
- the determining the timing deviation rate of the first crystal oscillator relative to the GNSS clock includes: obtaining continuous N The GNSS clock information of a period, and the first crystal oscillator timing when receiving the GNSS clock information of each period in the N periods; wherein, N is an integer greater than 1; confirm that the GNSS clock information of the N periods satisfies the satellite When the time is valid, and/or when it is confirmed that the timing of the first crystal oscillator meets the stability condition when receiving the GNSS clock information of each cycle in the N cycles, determine the timing deviation rate.
- the GNSS clock information of N cycles is discriminated, and the timing deviation rate is determined when effective and/or stable GNSS clock information is obtained, thereby ensuring the accuracy of the determined timing deviation rate.
- the determining the timing deviation rate includes: determining the consecutive M periods, wherein, M is an integer less than or equal to N and greater than 1; according to the timing of the first crystal oscillator when receiving the GNSS clock information of each period in the M periods, it is determined to receive the phase in the M periods
- the GNSS clock information of adjacent periods is the timing interval of the first crystal oscillator; the timing deviation rate is determined according to the timing interval of the first crystal oscillator and the preset transmission interval corresponding to the GNSS clock information of the adjacent periods.
- the ratio of the timing interval of the first crystal oscillator to the preset sending interval corresponding to the GNSS clock information of the adjacent period is determined as the timing deviation rate.
- the method further includes: when it is confirmed that the timing deviation rate is abnormal, sending a prompt message, so The prompt information is used to prompt that the first crystal oscillator is faulty.
- the timing deviation rate of the first crystal oscillator relative to the GNSS clock may be abnormal. Therefore, when the abnormal timing deviation rate is confirmed, a prompt message is sent to prompt the failure of the first crystal oscillator.
- an embodiment of the present application provides a time synchronization method, the method comprising: determining the timing deviation rate of the first crystal oscillator relative to the GNSS clock; correcting the system clock according to the timing deviation rate, the The system clock is maintained by counting the first crystal oscillator.
- the timing deviation rate of the first crystal oscillator relative to the GNSS clock is determined, and the system clock is corrected according to the timing deviation rate, so as to realize the automatic compensation of the timing deviation of the crystal oscillator; at the same time, the time indicated by the system clock and the UTC time are avoided. Large deviations continue to occur, ensuring the stable and reliable operation of the automatic driving system.
- the system clock includes: a management plane clock and a data plane clock.
- the determining the timing deviation rate of the first crystal oscillator relative to the GNSS clock includes: Obtain the GNSS clock information of N consecutive cycles, and the first crystal oscillator timing when receiving the GNSS clock information of each cycle in the N cycles; wherein, N is an integer greater than 1; confirm the GNSS clock of the N cycles When the information satisfies the validity condition of the satellite time, and/or when it is confirmed that the timing of the first crystal oscillator satisfies the stability condition when receiving the GNSS clock information of each period in the N periods, the timing deviation rate is determined.
- the GNSS clock information of N cycles is discriminated, and the timing deviation rate is determined when effective and/or stable GNSS clock information is obtained, thereby ensuring the accuracy of the determined timing deviation rate.
- the determining the timing deviation rate includes: determining the continuous M cycles, wherein M is an integer less than or equal to N and greater than 1; the first crystal oscillator timing is obtained when receiving the GNSS clock information of each cycle in the M cycles, and it is determined to receive adjacent in the M cycles
- the periodic GNSS clock information is the first crystal oscillator timing interval; the timing deviation rate is determined according to the first crystal oscillator timing interval and the preset sending interval corresponding to the adjacent periodic GNSS clock information.
- the ratio of the timing interval of the first crystal oscillator to the preset sending interval corresponding to the GNSS clock information of the adjacent period is determined as the timing deviation rate.
- the method further includes: sending a prompt when it is confirmed that the timing deviation rate is abnormal information, the prompt information is used to prompt that the first crystal oscillator is faulty.
- the timing deviation rate of the first crystal oscillator relative to the GNSS clock may be abnormal. Therefore, when the abnormal timing deviation rate is confirmed, a prompt message is sent to prompt the failure of the first crystal oscillator.
- the system clock when the system is powered on, the system clock is based on the previous Initialization is performed at the time indicated by the clock on the management plane when the power is turned off; or, initialization is performed according to the time indicated by the real-time clock RTC.
- the management plane clock and the data plane clock are initialized using the time indicated by the management plane clock at the previous power-off, so as to ensure that the management plane clock and the data plane clock are initialized each time they are powered on. Consistency of time, which is conducive to faster synchronization of the management plane clock and data plane clock with UTC time after power-on; or, use the time indicated by RTC to initialize the management plane clock and data plane clock.
- the deviation between the time indicated by the RTC and the UTC time is small, so as to ensure the consistency of the initial time of the management plane clock and the data plane clock at each power-on operation, and at the same time ensure that the initial time of the management plane clock and the data plane clock is consistent with UTC
- the time deviation should be as small as possible, which is conducive to faster synchronization of the management plane clock and data plane clock with UTC time after power-on.
- the method further includes: receiving first GNSS clock information in the current cycle, the first GNSS
- the clock information includes at least one of the following: pulse per second PPS and/or recommended positioning information GPRMC; when it is confirmed that the first GNSS clock information meets the satellite time valid condition, adjust the management plane clock according to the first GNSS clock information for synchronization with the GNSS clock.
- the management plane clock when ensuring that the GNSS clock information received in the current period meets the valid satellite time conditions, the management plane clock can be adjusted to be synchronized with the GNSS clock, thus avoiding time synchronization caused by using invalid GNSS clock information error, improving the accuracy of time synchronization.
- the method further includes: when confirming that the first GNSS clock information satisfies the satellite time valid condition, The RTC is adjusted to be synchronized with the GNSS clock according to the first GNSS clock information.
- the RTC when ensuring that the GNSS clock information received in the current period meets the valid satellite time conditions, the RTC is adjusted to be synchronized with the GNSS clock, thereby avoiding the time synchronization error caused by using invalid GNSS clock information and improving the accuracy of time synchronization.
- the method further includes: obtaining the time indicated by the data plane clock and the time indicated by the current cycle Manage the first deviation value of the time indicated by the clock on the management plane; when the first deviation value is greater than the first threshold, adjust the data plane clock in the current period according to the adjustment range within the period, and the adjustment within the period The magnitude is less than or equal to the first threshold.
- the first threshold may represent the maximum value of data plane clock jumps allowed in a period, and when the first deviation value is greater than the first threshold, the data plane clock in the current period shall be adjusted according to the adjustment range within the period. Adjustment, in this way, adopt the method of "small steps and fast running", and through multiple cycles of adjustment, the deviation between the data plane clock and the management plane clock will gradually decrease until they are synchronized, and the adjustment range corresponding to each cycle will not exceed the first A threshold value, so that on the basis of ensuring the time stability in the automatic driving system, the clock on the data plane is synchronized with the clock on the management plane.
- the management plane clock can follow the GNSS clock, that is, the time indicated by the management plane clock can be kept the same or close to UTC time, therefore, through periodic adjustments, the time indicated by the data plane clock can be kept the same or close to UTC time, thus ensuring
- the time in the automatic driving system is kept the same or close to the UTC time.
- the time stamp provided by the management plane clock and the time stamp provided by the data plane clock are consistent with UTC time while the vehicle is running. The time remains the same or close, thereby ensuring the reliable operation of the automatic driving system in scenarios such as vehicle to everything (V2X) information exchange with the outside world, and improving the efficiency and accuracy of event analysis.
- V2X vehicle to everything
- the method further includes: when the first deviation value is less than or equal to the first threshold , adjusting the data plane clock to be synchronized with the management plane clock in the current cycle.
- the first threshold can represent the maximum value of data plane clock jumps allowed in a period.
- the "one-step adjustment" method is adopted to set The clock on the data plane is adjusted to be synchronized with the clock on the management plane, which realizes the automatic compensation of the time deviation between the clock on the data plane and the clock on the management plane, so that on the basis of ensuring the time stability in the automatic driving system, the clock on the data plane and the clock on the management plane can be realized more quickly Synchronize.
- the method further includes: according to the first deviation value and/or the The range is adjusted within the period, and the time stamp provided by the data plane clock is corrected.
- the time stamp generated during the adjustment of the data plane clock may have a small deviation from UTC time.
- the corrected time stamp is synchronized with UTC time, thereby The efficiency and accuracy of event analysis are further improved.
- the first threshold is preconfigured; or the first threshold is changed by application software mode, the application software uses the data plane clock.
- the method further includes: according to the system clock, setting the At least one system sub-clock of the clock is adjusted to be synchronized with the system clock.
- the system sub-clock follows the system clock, and through adjustment, each system sub-clock can be kept the same or close to the UTC time, thereby ensuring the stable operation of the functional node where the system sub-clock is located.
- the embodiment of the present application provides a time synchronization device, the device includes: the device includes: a first module, which is used to obtain the time indicated by the current period data plane clock and the time indicated by the management plane clock The first deviation value of time; the second module is used to adjust the data plane clock in the current cycle according to the adjustment range in the cycle when the first deviation value is greater than the first threshold value, and the adjustment in the cycle The magnitude is less than or equal to the first threshold.
- the second module is further configured to: when the first deviation value is less than or equal to the first threshold, in the In the current period, the data plane clock is adjusted to be synchronized with the management plane clock.
- the second module is further configured to: according to the first deviation value and /or adjust the amplitude within the period, and correct the time stamp provided by the data plane clock.
- the first threshold is preconfigured; or the first threshold is determined by The application software is notified when the operation mode is changed, and the application software uses the data plane clock.
- the management plane clock and the data plane clock are powered on according to Initialize according to the time indicated by the management plane clock stored in the system at the time of the previous power-off; or, initialize according to the time indicated by the real-time clock RTC.
- the second module is further configured to: receive the first GNSS clock information, the first GNSS clock information includes at least one of the following: second pulse PPS and/or recommended positioning information GPRMC; when it is confirmed that the first GNSS clock information meets the satellite time valid condition, according to the first GNSS clock information, and adjust the management plane clock to be synchronized with the GNSS clock.
- the second module is further configured to: confirm that the first GNSS clock information satisfies satellite time When the condition is valid, the RTC is adjusted to be synchronized with the GNSS clock according to the first GNSS clock information.
- the second module is further configured to: according to the management plane clock, set At least one management plane sub-clock subordinate to the management plane clock is adjusted to be synchronized with the management plane clock; according to the data plane clock, at least one data plane sub-clock subordinate to the data plane clock is adjusted to be synchronized with the data plane clock face clock synchronization.
- the second module is further used to: determine the first crystal oscillator relative to the GNSS clock The timing deviation rate; according to the timing deviation rate, the management plane clock and the data plane clock are corrected, and the management plane clock and the data plane clock are maintained by the first crystal oscillator.
- the second module is further configured to: acquire GNSS clock information of N consecutive periods, and When receiving the GNSS clock information of each cycle in the N cycles, the first crystal oscillator is timed; wherein, N is an integer greater than 1; when confirming that the GNSS clock information of the N cycles meets the satellite time valid condition, and/or and determining the timing deviation rate when it is confirmed that the timing of the first crystal oscillator satisfies a stable condition when receiving the GNSS clock information of each cycle in the N cycles.
- the second module is further configured to: determine the M consecutive Period, wherein, M is an integer less than or equal to N and greater than 1; according to the timing of the first crystal oscillator when receiving the GNSS clock information of each period in the M periods, it is determined to receive adjacent periods in the M periods
- the GNSS clock information is the first crystal oscillator timing interval; according to the first crystal oscillator timing interval and the preset sending interval corresponding to the GNSS clock information of the adjacent cycle, determine the timing deviation rate.
- the second module is further configured to: issue a prompt when confirming that the timing deviation rate is abnormal information, the prompt information is used to prompt that the first crystal oscillator is faulty.
- an embodiment of the present application provides a time synchronization device, the device comprising: a third module, configured to determine the timing deviation rate of the first crystal oscillator relative to the GNSS clock; a fourth module, configured to The timing deviation rate is to correct the system clock, and the system clock is maintained by counting the first crystal oscillator.
- the system clock includes: a management plane clock and a data plane clock.
- the third module is further configured to: acquire the GNSS clock of N consecutive cycles information, and the first crystal oscillator timing when receiving the GNSS clock information of each cycle in the N cycles; wherein, N is an integer greater than 1; when confirming that the GNSS clock information of the N cycles meets the satellite time valid condition, And/or, when it is confirmed that the timing of the first crystal oscillator satisfies a stable condition when receiving the GNSS clock information of each cycle in the N cycles, determine the timing deviation rate.
- the third module is further configured to: determine consecutive M periods among the N periods , wherein, M is an integer less than or equal to N and greater than 1; the first crystal oscillator timing is obtained when receiving the GNSS clock information of each cycle in the M cycles, and it is determined to receive the adjacent cycle in the M cycles
- the GNSS clock information is the timing interval of the first crystal oscillator; the timing deviation rate is determined according to the timing interval of the first crystal oscillator and the preset transmission interval corresponding to the GNSS clock information of the adjacent cycle.
- the fourth module is further configured to: confirm that the timing deviation rate is abnormal , sending prompt information, where the prompt information is used to prompt that the first crystal oscillator is faulty.
- the system clock is based on the previous Initialization is performed at the time indicated by the clock on the management plane when the power is turned off; or, initialization is performed according to the time indicated by the real-time clock RTC.
- the fourth module is further configured to: receive first GNSS clock information in the current cycle, the The first GNSS clock information includes at least one of the following: pulse per second PPS and/or recommended positioning information GPRMC; when it is confirmed that the first GNSS clock information meets the satellite time valid condition, according to the first GNSS clock information, the management The surface clock is adjusted to be synchronized with the GNSS clock.
- the fourth module is further configured to: confirm that the first GNSS clock information satisfies that the satellite time is valid condition, adjust the RTC to be synchronized with the GNSS clock according to the first GNSS clock information.
- the fourth module is further configured to: acquire the time indicated by the data plane clock in the current cycle A first deviation value from the time indicated by the management plane clock; when the first deviation value is greater than a first threshold, adjust the data plane clock in the current period according to the adjustment range within the period, the The adjustment range within a period is less than or equal to the first threshold.
- the fourth module is further configured to: when the first deviation value is less than or equal to the When the first threshold is reached, the data plane clock is adjusted to be synchronized with the management plane clock in the current period.
- the fourth module is further configured to: according to the first deviation value and /or adjust the amplitude within the period, and correct the time stamp provided by the data plane clock.
- the first threshold is preconfigured; or the first threshold is changed by application software mode, the application software uses the data plane clock.
- the fourth module is further configured to: according to the system clock, set the slave At least one system sub-clock of the system clock is adjusted to be synchronized with the system plane clock.
- an embodiment of the present application provides a time synchronization device, including: a processor; a memory for storing processor-executable instructions; wherein, the processor is configured to implement the above-mentioned first step when executing the instructions.
- a time synchronization device including: a processor; a memory for storing processor-executable instructions; wherein, the processor is configured to implement the above-mentioned first step when executing the instructions.
- an embodiment of the present application provides a time synchronization system, including: a transmission device for receiving GNSS clock information, and any time synchronization device in the third to fifth aspects above.
- an embodiment of the present application provides a vehicle, including: any one of the time synchronization devices in the third aspect to the fifth aspect above, or the time synchronization system in the sixth aspect above.
- the embodiments of the present application provide a computer-readable storage medium, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the above-mentioned first aspect or various possibilities of the first aspect are realized.
- the embodiments of the present application provide a computer program product that, when the computer program product is run on a computer, causes the computer to execute the above-mentioned first aspect or various possible implementation manners of the first aspect.
- the time synchronization method, or the time synchronization method in the second aspect or various possible implementation manners of the second aspect are examples of the time synchronization method, or the time synchronization method in the second aspect or various possible implementation manners of the second aspect.
- FIG. 1 shows a schematic diagram of a dual clock architecture according to an embodiment of the present application
- FIG. 2 shows a schematic diagram of a time synchronization system according to an embodiment of the present application
- FIG. 3 shows a flowchart of a time synchronization method according to an embodiment of the present application
- FIG. 4 shows a schematic diagram of a time synchronization device receiving GNSS clock information according to an embodiment of the present application
- FIG. 5 shows a flow chart of a method for adjusting a management plane clock and a data plane clock according to an embodiment of the present application
- FIG. 6 shows a flowchart of a time synchronization method according to an embodiment of the present application
- FIG. 7 shows a schematic diagram of a time synchronization device receiving GNSS clock information in adjacent periods according to an embodiment of the present application
- FIG. 8 shows a schematic diagram of time synchronization performed by a SOC according to an embodiment of the present application
- FIG. 9 shows a flow chart of SOC performing crystal oscillator timing offset compensation according to an embodiment of the present application.
- FIG. 10 shows a flowchart of time synchronization performed by the SOC according to an embodiment of the present application
- FIG. 11 shows a schematic diagram of time synchronization performed by an MCU according to an embodiment of the present application
- FIG. 12 shows a flowchart of time synchronization performed by an MCU according to an embodiment of the present application
- FIG. 13 shows a flow chart of calling API1 interface for time synchronization according to an embodiment of the present application
- FIG. 14 shows a flow chart of calling an API2 interface for time synchronization according to an embodiment of the present application
- FIG. 15 shows a structural diagram of a time synchronization device according to an embodiment of the present application.
- FIG. 16 shows a structural diagram of another time synchronization device according to an embodiment of the present application.
- Fig. 17 shows a schematic structural diagram of a time synchronization device according to an embodiment of the present application.
- a system clock can be configured in the autopilot system.
- the system clock can be a single-clock architecture or a dual-clock architecture.
- a single clock provides time stamps for various data in the autopilot system.
- the single clock is synchronized with UTC time.
- the GNSS time source is not available, it relies on the local crystal oscillator of the System-on-a-Chip (SOC) to run itself.
- SOC System-on-a-Chip
- FIG. 1 shows a schematic diagram of a dual clock architecture according to an embodiment of the present application.
- the dual clock architecture includes a management plane clock and a data plane clock.
- the management plane clock is also called GNSS clock (GNSS CLOCK, GNSS CLK) in the system, and follows the real time to coordinate universal time (UTC).
- GNSS CLOCK GNSS CLOCK
- GNSS CLK GNSS clock
- UTC time coordinate universal time
- the management plane clock relies on the local crystal oscillator of the SOC for self-running.
- the clock on the management plane is generally used to provide time stamps for functional nodes that do not participate in the calculation of intelligent driving algorithms, such as maintenance and testing, logs, etc.
- GNSS clock information can include pulse per second (Pulse Per Second, PPS) signal and recommended positioning information (Recommended Minimum Specific GPS, GPRMC) signal, etc.;
- PPS signal is a synchronous pulse signal with a time period of 1 second, and a pulse width of 5 ⁇ 100 milliseconds (ms), 1 pulse per second;
- GPRMC signal is a time synchronization message conforming to the GPRMC standard output through a standard serial port, including UTC time information and/or latitude and longitude positioning data corresponding to the PPS signal, for example, Year, month, day, hour, minute, second, millisecond, microsecond, etc.;
- the GNSS system can send a pair of PPS signal and GPRMC signal per second, and the leading edge of the PPS pulse is sent at the same time as the GPRMC message, with an error of nanometers Second (ns) level, can be ignored.
- ns nanometers Second
- the GPRMC signal is generally sent through the serial port, and its sending, receiving and processing time are all at the ms level.
- the device that uses the PPS signal and the GPRMC signal for time synchronization will convert the time within milliseconds and below milliseconds (such as microseconds, etc.) Clear, and start to calculate the millisecond time; after receiving the GPRMC signal, extract the hour, minute, second, year, month, day information of the UTC time in the message; receive the PPS signal and analyze the UTC time in the GPRMC
- the synchronized time is obtained by adding the used millisecond time to the UTC whole second time, and the clock in the device that needs to be synchronized with the UTC time uses the synchronized time to complete a time synchronization.
- the above-mentioned synchronization process is carried out every 1 second period, and the calibration is performed exactly once every second.
- the data plane clock is also called the operating system clock (Operating System Clock, OS CLK) in the system. It relies on the local crystal oscillator of the SOC to run itself, and is not synchronized with the external GNSS time source to ensure that the clock is monotonically increasing.
- the data surface clock is used to provide time stamps for the data involved in the calculation of intelligent driving algorithms, such as: data collected by sensors, instructions and data received by actuators, etc., which can reduce the functional safety problems of clock jumps on the reliability of intelligent driving algorithms.
- the automatic driving system may include one or more nodes, and each node may be configured with the aforementioned dual clock architecture.
- multiple nodes can be divided into master nodes (master nodes as shown in FIG. 1 ) and slave nodes (slave nodes 1, 2..N as shown in FIG.
- the data plane sub-clocks in each slave node are adjusted following the adjustment of the master node's data plane clock (as shown in Figure 1, the data plane clock A), that is, each slave node
- the data plane sub-clocks in the middle node are all synchronized with the data plane clock of the master node
- the management plane sub-clocks in each slave node are adjusted following the adjustment of the management plane clock of the master node, that is, the management plane sub-clocks in each slave node (as shown in Figure 1).
- the face clocks b1, b2...bN) are all synchronized with the management plane clock of the master node (such as the data plane clock B in Figure 1).
- the master node may include a vehicle-mounted computing device, such as: a mobile data center (Mobile Data Center, MDC), a domain controller, an electronic control unit (electric control unit, ECU), etc., and may also include a device configured in the vehicle-mounted computing device System-on-a-Chip (SOC), microcontroller unit (Micro Control Unit, MCU), etc.; slave nodes can include various devices in the autopilot system except the master node: For example, processors, sensors, sensor abstractions, actuators, other domain controllers, etc., may also include SOCs, MCUs, etc.
- SOC System-on-a-Chip
- MCU microcontroller unit
- cameras configured in these various devices, such as cameras (Cameras) and their data processing nodes, laser Radar (Lidar) and its data processing nodes, millimeter wave radar (Radar) and its data processing nodes, ultrasonic radar (Ultrasound Scan, USS) and its data processing nodes, vehicle chassis and its data processing nodes, etc.
- the management plane clock since the management plane clock is synchronized with the GNSS clock, the data plane clock is not synchronized with the GNSS clock, that is, the management plane clock uses UTC time as the reference time, and the data plane clock does not use UTC time as the reference time.
- the time indicated by the clock on the data plane may deviate greatly from the time indicated by the clock on the management plane, which affects the reliability of the automatic driving system in V2X and other scenarios.
- the automatic driving system can establish a communication connection with the roadside equipment installed at the intersection to obtain traffic light-related information. For example, it can obtain the time information of the traffic light corresponding to the lane where the vehicle is located.
- Roadside equipment usually uses UTC time as the reference time, but the data surface clock in the automatic driving system does not use UTC time as the reference time. In this way, there is a deviation between the time information of the traffic light and the time indicated by the data surface clock.
- the time information of the light and the clock on the data surface provide time stamps for the data collected by the on-board equipment to control the vehicle, and there will be matching errors, which will bring safety hazards.
- the time of the failure can be determined through the event log, and then the data collected by the on-board equipment when the failure occurs can be obtained, and the cause of the failure can be determined by analyzing the data collected by the on-board equipment when the failure occurs; At the same time, there is a large deviation between the time stamp corresponding to the event log and the time stamp corresponding to the data collected by the on-board device; it is difficult to accurately obtain the data collected by the on-board device when the fault occurred based on the time stamp provided by the management plane, which increases the number of faults. Difficulty of replay analysis.
- This application proposes a time synchronization technical solution (see below for detailed description), which can realize the synchronization of the clock on the data plane and the clock on the management plane on the basis of keeping the time in the automatic driving system stable, that is, realize the time in the system and UTC time The same or close, thereby ensuring the reliable operation of the automatic driving system in scenarios such as V2X, and improving the efficiency and accuracy of event analysis.
- a time synchronization system provided by an embodiment of the present application is introduced below.
- FIG. 2 shows a schematic diagram of a time synchronization system according to an embodiment of the present application.
- the time synchronization system can be configured in an automatic driving system; as shown in FIG. 2 , the time synchronization system can include: a transmission device 201, a time synchronization system device 202 .
- the transmission device 201 is used for receiving GNSS clock information from the GNSS system, and can send the received GNSS clock information to the time synchronization device 202 .
- the transmission device 201 may periodically receive GNSS clock information through an antenna, and send the GNSS clock information to the time synchronization device 202 through a hardware and software interface after receiving the GNSS clock information each time.
- the transmission device 201 may include one or more of an inertial navigation system (Inertial Navigation System, INS) sensor, a GNSS signal receiver, or a real-time differential positioning (Real-time kinematic, RTK) sensor and the like.
- INS Inertial Navigation System
- RTK Real-time kinematic
- the GNSS system may include: Global Positioning System (Global Positioning System, GPS), Beidou Satellite Navigation System (Beidou Navigation Satellite System, BDS), Glonass Satellite Navigation System (Global Navigation Satellite System, GLONASS), Galileo One or more of the satellite navigation system (Galileo satellite navigation system), etc.
- Global Positioning System Global Positioning System, GPS
- Beidou Satellite Navigation System Beidou Navigation Satellite System, BDS
- Glonass Satellite Navigation System Global Navigation Satellite System
- GLONASS Glonass Satellite Navigation System
- Galileo satellite navigation system Galileo Satellite navigation system
- the GNSS clock information may include a PPS signal and a GPRMC signal, etc.; the transmission device 201 may send a pair of the PPS signal and the GPRMC signal received every second to the time synchronization device 202 .
- the software and hardware interfaces may include multiple time synchronization interfaces and software protocol stacks, etc., for example, Generalized Precision Time Protocol (Generalized Precision Time Protocol, gPTP), Controller Area Network (Controller Area Network, CAN) interface, general asynchronous One or more of the Universal Asynchronous Receiver/Transmitter (UART) serial port or the sensor control center (SensorHub).
- Generalized Precision Time Protocol Generalized Precision Time Protocol, gPTP
- Controller Area Network Controller Area Network
- UART Universal Asynchronous Receiver/Transmitter
- SensorHub SensorHub
- the time synchronization device 202 is used to receive the GNSS clock information sent by the transmission device 201, and adjust the management plane clock and the data plane clock according to the GNSS clock information, so that both the management plane clock and the data plane clock are synchronized with UTC time, exemplary Specifically, the time synchronization device 202 is used to periodically receive the GNSS clock information sent by the transmission device 201 through the software and hardware interface, and analyze to obtain the time indicated by the GNSS clock information; it can also obtain the timing information of the local crystal oscillator, the management plane One or more of the time indicated by the clock, the time indicated by the data plane clock, etc., so as to calculate the timing deviation rate of the local crystal oscillator relative to the GNSS clock, and then correct the management plane clock and the data plane clock according to the timing deviation rate.
- the time synchronization device 202 may also obtain the time indicated by the RTC, and use the time indicated by the RTC to initialize the data plane clock and the management plane clock, and may also adjust the RTC so that the RTC is synchronized with the GNSS clock.
- the GNSS system can send a pair of PPS signals and GPRMC signals per second, and after receiving the PPS signals or GPRMC signals, the transmission device 201 can send them to the time synchronization device through the sensor control center, CAN interface (or UART serial port) 202; wherein, the sensor control center is used for the aggregation and reporting of the transmission device 201 interrupt signal, so that the time synchronization device 202 performs time compensation from receiving the PPS signal to receiving the GPRMC signal, so that the time synchronization device 202 can accurately receive each second To a pair of PPS signal and GPRMC signal.
- the time synchronization device 202 adjusts the management plane clock and the data plane clock according to the PPS signal and the GPRMC signal.
- the clock performs time synchronization, so that both the management plane clock and the data plane clock are synchronized with UTC time;
- the data plane clock of the clock is adjusted.
- the management plane clock can follow the management plane clock, and the data plane clock can follow the data plane clock, so that the management plane clock can be synchronized with the management plane clock, and the data plane sub clock can be synchronized with the data plane clock.
- the embodiment of the present application does not limit the type of the above-mentioned time synchronization device 202 .
- the time synchronization device 202 may be a vehicle, or a component of other time synchronization functions in the vehicle, such as: a vehicle terminal, a vehicle controller, a vehicle module, a vehicle module, a vehicle component, a vehicle chip, a vehicle unit, On-board sensors, etc., the vehicle can synchronize the configured dual clocks through the on-board terminal, on-board controller, on-board module, on-board module, on-board components, on-board chip, on-board unit, on-board sensor, etc.
- the time synchronization device 202 may be integrated in a vehicle equipped with dual clocks or an automatic driving system of the vehicle or an advanced driver assistance system (Advanced Driver Assistant Systems, ADAS) or a vehicle-mounted computing platform.
- ADAS Advanced Driver Assistant Systems
- the time synchronization The device 202 may be integrated in the vehicle computing platform, for example, may be an SOC or MCU in the vehicle computing platform.
- the time synchronization device 202 may also be an intelligent terminal capable of time synchronization other than the vehicle, or a component or a chip provided in the intelligent terminal.
- the smart terminal can be equipped with dual clocks for smart transportation devices, smart wearable devices, smart home devices, smart auxiliary aircraft, robots or unmanned aerial vehicles.
- the time synchronization apparatus 202 may also be a general-purpose device or a special-purpose device.
- the time synchronization device 202 can be a desktop computer, a portable computer, a network server, a handheld computer (personal digital assistant, PDA), a mobile phone, a tablet computer, a wireless terminal device, an embedded device or other devices with a time synchronization function. devices, or components or chips within those devices.
- the time synchronization device 201 may also be a chip or a processor with a time synchronization function, and the time synchronization device 201 may include multiple processors.
- the processor may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor.
- the chip or processor with time synchronization function can be set in any node of the automatic driving system, for example, it can be set in the master node in the above-mentioned FIG. 1 .
- Fig. 3 shows a flow chart of a time synchronization method according to an embodiment of the present application.
- the method may be executed by the time synchronization system shown in Fig. 2 above, or by one or more of the time synchronization system Execution by the device, for example, can be performed by the time synchronization device 202.
- the following embodiments will be described by taking the execution by the time synchronization device 202 as an example; as shown in FIG. 3, the method may include the following steps:
- Step 301 Obtain a first deviation value between the time indicated by the clock on the data plane of the current period and the time indicated by the clock on the management plane.
- both the data plane clock and the management plane clock are maintained by the first crystal oscillator.
- the data plane clock and the management plane clock may be the data plane clock A and the management plane clock B of the master node in FIG. 1; the first crystal oscillator is a local crystal oscillator set on the master node.
- the time synchronization device may periodically acquire the deviation value between the time indicated by the clock on the data plane and the time indicated by the clock on the management plane. , to obtain the deviation value between the time indicated by the clock on the data plane and the time indicated by the clock on the management plane every second.
- the time synchronization device may calculate the difference between the time indicated by the clock on the data plane of the current period and the time indicated by the clock on the management plane, and use the absolute value of the difference as the first deviation value.
- the clock on the management plane may have been synchronized with the UTC time within the current period; that is, for the same moment, the time indicated by the clock on the management plane is consistent with or slightly different from the UTC time.
- the time synchronization device can acquire the time indicated by the clock on the data plane and the time indicated by the clock on the management plane that has been synchronized with UTC time at a certain moment in the current period, and calculate the absolute value of the difference between the two times , as the first deviation value.
- the time synchronization device can obtain the time indicated by the data plane clock when the information of the GNSS clock is received in the current cycle, and the time indicated by the management plane clock when the information of the GNSS clock is received, and calculate the difference between the two times Absolute value, as the first deviation value.
- the time synchronization device can calculate the difference between the time indicated by the data plane clock when the PPS signal is received in the current cycle and the time indicated by the management plane clock when the PPS signal is received in the current cycle, and the absolute value of the difference is the first deviation value .
- the time synchronization device can calculate the difference between the time indicated by the data plane clock and the time indicated by the management plane clock when the current cycle receives the GPRMC signal when the current cycle receives the GPRMC signal, and the absolute value of the difference is the first deviation value.
- the time synchronization device performs the following step 302; if the first deviation value is equal to 0, it indicates There is no deviation between the data plane clock and the management plane clock in the current period, and no compensation is required in the current period.
- Step 302. When the first deviation value is greater than the first threshold, adjust the data plane clock in the current cycle according to the adjustment range in the current cycle, and the adjustment range in the cycle is smaller than or equal to the first threshold.
- the first threshold represents the maximum value of data plane clock jumps allowed within a period. It can be understood that if the adjustment range of the data plane clock in the current cycle is greater than the maximum value of the data plane clock jump allowed in the cycle, it will cause the time in the automatic driving system to be unstable, thereby affecting the smooth operation of the automatic driving system; If the adjustment range within the period is set to be less than or equal to the first threshold, then the data plane clock can be adjusted on the basis of ensuring the time stability in the automatic driving system.
- the time synchronization device can judge the relative size of the first deviation value between the clock on the data plane and the clock on the management plane and the first threshold in each second; Within a second, when the first deviation value is greater than the first threshold, the data plane clock within the second is adjusted according to the adjustment range within the period.
- the first threshold may be preconfigured, for example, may be 1 ms.
- the first threshold may also be notified when the operating mode is changed by the application software, which uses the data plane clock.
- the application software may include autopilot software, and the autopilot software is configured with the maximum value of the data surface clock jump allowed in a cycle, that is, the first threshold; the autopilot software may exit the autopilot mode or enter the autopilot mode , actively notify the time synchronization device of the first threshold.
- the corresponding first threshold can be different.
- the data surface clock is sensitive to event jumps, and the first threshold can be set to a small value, such as 10ms ; and when the automatic driving mode is turned off, the sensitivity of the data plane clock to time jumps will be correspondingly reduced, so the first threshold can be set to a larger value, such as 1s or set to an infinite value.
- the time synchronization device may actively query the maximum value of clock jumps allowed on the data plane within the cycle configured in the autopilot software in each cycle, and then determine the first threshold. For example, if the time synchronization device cannot obtain the maximum value of data plane clock jumps allowed in the cycle of the autopilot software in the current cycle, the data plane clock jumps allowed in the cycle preset according to empirical values can be set to The maximum value is used as the first threshold.
- the clock on the data plane is faster than the clock on the management plane, in the current cycle, the clock on the data plane is slowed down once according to the adjustment range within the cycle; The data plane clock is accelerated once by the internal adjustment range, so as to complete the adjustment of the data plane clock in the current cycle.
- the adjustment range in a cycle may be preconfigured, or may be determined by the time synchronization device according to the first threshold; Exemplarily, the time synchronization device may determine the adjustment range in the current cycle in each cycle, and then according to The determined adjustment range in the current cycle is to adjust the data plane clock in the current cycle.
- the adjustment range of the data plane clock in the current cycle is less than the first threshold, and the time indicated by the adjusted data plane clock in the current cycle is still different from the time indicated by the management plane clock, which needs to be adjusted continuously after multiple cycles
- the data plane clock so that the data plane clock and the management plane clock are synchronized; for example, the time synchronization device can determine the adjustment range corresponding to each cycle according to the first deviation value determined in each cycle; for example, if the first threshold is 100ms, and the first deviation value is 1s, then the data plane clock and the management plane clock can be synchronized through a small adjustment of 20 cycles, and the adjustment range in the cycle corresponding to the current cycle can be 50 ms; it can also be adjusted by 10 cycles Small adjustments are made to synchronize the clock on the data plane with the clock on the management plane, and the adjustment range within the period corresponding to the current period can be 100ms.
- the stability of the data plane clock is very important to maintain the smooth operation of the automatic driving system. Therefore, in the current cycle, the data plane
- the time synchronization device adjusts the clock on the data plane in the current cycle according to the adjustment range within the cycle, In this way, the "small steps and fast running" method is adopted, and the deviation between the data plane clock and the management plane clock is gradually reduced through continuous small adjustments in multiple cycles until the data plane clock and the management plane clock are synchronized, and each cycle corresponds to The adjustment range within the cycle does not exceed the maximum value of the data plane clock jump allowed within the cycle, so that on the basis of ensuring the time stability in the automatic driving system, the deviation between the management plane clock and the data plane clock is periodically automatically compensated, and the data
- the plane clock is synchronized with the management plane clock. Since the management plane clock can follow the GNSS clock, that is, the time indicated by the management plane clock can be kept the same or close to the UTC time, therefore, through periodic adjustments, the time indicated by the data plane clock can be kept the same or close to the UTC time, avoiding the involvement of
- the time stamp of the data calculated by the intelligent driving algorithm has a large jump, so that on the basis of ensuring the stability of the time in the automatic driving system, the time in the automatic driving system (that is, the time indicated by the clock on the management plane and the time indicated by the clock on the data plane) is realized.
- Time is kept the same or close to the UTC time, so that the time stamps provided by the management plane clock and the data plane clock are kept the same or close to the UTC time during the driving process of the vehicle, thereby ensuring Reliable operation in the middle, and improve the efficiency and accuracy of event analysis.
- the automatic driving system can establish a communication connection with the roadside equipment installed at the intersection, and the automatic driving system can obtain information about traffic lights at the intersection, such as the time of the traffic light corresponding to the lane where the vehicle is located. Information; since roadside equipment, data plane clocks, and management plane clocks all use UTC time as the reference time, the automatic driving system can accurately match the time information of traffic lights and the data plane clock to provide time stamps for the data participating in the calculation of intelligent driving algorithms , control the vehicle to safely pass through the intersection, and ensure the stable operation of the automatic driving system.
- the corresponding time stamp of the matching data participating in the calculation of the intelligent driving algorithm can be accurately found, that is, the time stamp at the time of the failure can be accurately obtained.
- the data involved in the calculation of the intelligent driving algorithm can further analyze the acquired data involved in the calculation of the intelligent driving algorithm to determine the cause of the failure, which improves the efficiency and accuracy of the failure playback analysis.
- the clock on the data plane is synchronized with the clock on the management plane through multiple cycles of adjustment; during these multiple cycles, the clock on the data plane
- the clock will also provide time stamps for the data participating in the calculation of the intelligent driving algorithm during the period, and the time stamp still has a small deviation from UTC time. Correct the time stamp; so that the corrected time stamp is the same or similar to UTC time, thereby further improving the efficiency and accuracy of event analysis.
- the time synchronization device corrects the time stamp provided by the data plane clock according to the first deviation value and/or an adjustment range within a period.
- the time synchronization device can obtain the time stamp provided by the data plane clock for the data participating in the intelligent driving algorithm calculation in the current cycle; then according to the first deviation value and/or the adjustment range in the cycle, the The time stamp provided by the clock is corrected.
- the time synchronization device can determine the deviation between the time stamp provided by the data plane clock and the UTC time after the adjustment of the current period according to the difference between the first deviation value and the adjustment range in the period, and then the adjusted data of the current period can be adjusted according to the deviation.
- the time stamp provided by the surface clock is corrected; for example, the time synchronization device can determine the deviation between the time stamp provided by the data surface clock and the UTC time in the current cycle according to the first deviation value, and then the current time can be adjusted according to the deviation.
- the time stamp provided by the data plane clock before the period adjustment is corrected.
- step 302 when the first deviation value is less than or equal to the first threshold, the data plane clock is adjusted to be synchronized with the management plane clock in the current cycle.
- the first threshold may represent the maximum value of data plane clock jumps allowed in a cycle, since the first deviation value is less than or equal to the first threshold, that is, the deviation between the data plane clock and the management clock in the current cycle does not exceed the allowable value in the cycle.
- the time synchronization device adjusts the clock of the data plane to be synchronized with the clock of the management plane in the current cycle, and the adjustment range of the clock of the data plane does not exceed the maximum value of the clock jump of the data plane allowed in the cycle, so that On the basis of ensuring the time stability in the automatic driving system, the synchronization of the data plane clock and the management plane clock is realized.
- the time synchronization device adopts the "one-step adjustment" method to adjust the data plane clock to be synchronized with the management plane clock in the current cycle, realizing the data plane clock and management
- the time deviation of the surface clock is automatically compensated; since the adjustment range of the data surface clock in the current cycle does not exceed the maximum value of the data surface clock jump allowed in the cycle, it avoids large jumps in the time stamp of the data that participates in the calculation of the intelligent driving algorithm , so that on the basis of ensuring the smooth operation of the automatic driving system, the synchronization of the clock on the management plane and the clock on the data plane can be realized more quickly.
- the management plane clock can follow the GNSS clock, that is, the time indicated by the management plane clock can be kept the same or close to UTC time, therefore, the time indicated by the adjusted data plane clock can be kept the same or close to UTC time, thereby realizing The time in the automatic driving system is kept the same or close to the UTC time.
- the time stamp provided by the clock on the management plane and the time stamp provided by the clock on the data plane are kept the same or close to the UTC time during the driving process of the vehicle, thus ensuring that the automatic driving system is It operates reliably in scenarios such as V2X, and improves the efficiency and accuracy of event analysis.
- Fig. 4 shows a flow chart of another time synchronization method according to an embodiment of the present application; as shown in Fig. 4, the following steps may be included:
- Step 401 receiving first GNSS clock information in the current period.
- the first GNSS clock information may include at least one of the following: PPS signal and/or GPRMC signal.
- the time synchronization device may receive GNSS clock information periodically, for example, may receive GNSS clock information at a period of 1 second.
- the time synchronization device may receive a pair of PPS signal and GPRMC signal every second.
- Step 402 When confirming that the first GNSS clock information satisfies the satellite time valid condition, adjust the management plane clock to be synchronized with the GNSS clock according to the first GNSS clock information.
- the satellite time valid condition can be pre-configured, and the time synchronization device can judge whether the first GNSS clock information received in the current cycle meets the satellite time valid condition according to the pre-configured satellite time valid condition, and can confirm When the first GNSS clock information received in the current cycle satisfies the satellite time valid condition, the management plane clock is adjusted to be synchronized with the GNSS clock, that is, the synchronization between the time indicated by the management plane clock and the UTC time is realized in the current cycle; If it is determined that the first GNSS clock information received in the current period is invalid, the time synchronization device may not adjust the management plane clock in the current period.
- the satellite time validity condition may include: the positioning status indicated in the GPRMC signal is "valid", and/or, the PPS signal and the GPRMC signal acquired in the current period are a pair.
- the preset time range such as 500ms
- the local time may include the time indicated by the management plane clock; the time synchronization device may obtain the time indicated by the management plane clock when the first GNSS clock information is received in the current period. For example, taking the period of 1 second as an example, within a certain second, the time synchronization device can obtain the time indicated by the management plane clock when receiving the PPS signal, and the time indicated by the management plane clock when receiving the GPRMC signal; and then calculate The interval between the time indicated by the management plane clock when the GPRMC signal is received and the time indicated by the management plane clock when the PPS signal is received within the second, if the interval is within the preset time range, and unprocessed PPS signals or GPRMC signals are accumulated , it can be determined that the PPS signal and the GPRMC signal acquired within this second are a pair.
- FIG. 5 shows a schematic diagram of a time synchronization device receiving GNSS clock information according to an embodiment of the present application.
- the transmission device can send the received PPS1 signal and GPRMC1 signal to the time synchronization device , the indicated time of the management plane clock when the time synchronization device receives the PPS1 signal is T10, and the indicated time of the management plane clock when receiving the GPRMC1 signal is T11, then the interval between T10 and T11 is (T11-T10).
- the time synchronization device After confirming that the first GNSS clock information received in the current period satisfies the satellite time valid condition, the time synchronization device adjusts the management plane clock to be synchronized with the GNSS clock according to the first GNSS clock information.
- the time synchronization device can extract UTC time information in the first GNSS clock information; for example, after the time synchronization device receives the GPRMC signal within a certain second, it can extract the hours, minutes, seconds, and Year, month, and day information, that is, UTC whole second time; since the interval between the time indicated by the management plane clock when receiving the GPRMC signal and the time indicated by the management plane clock when receiving the PPS signal is at the millisecond level, the interval and UTC
- the synchronized time is obtained by adding whole seconds, and the management plane clock uses the synchronized time to complete the adjustment of the management plane clock to be synchronized with the GNSS clock. For example, as shown in FIG. 5 , the time synchronization device extracts UTC whole second time as T, then the synchronized time is T+(T11-T10), and the management plane clock uses the synchronized time.
- the time synchronization device After the time synchronization device receives the PPS signal within a certain second, it clears the milliseconds and the time below the milliseconds in the clock on the management plane, and thus starts counting milliseconds; when the time synchronization device is within the second After receiving the GPRMC signal, extract the UTC full second time in the GPRMC signal; add the millisecond time used to extract the UTC full second time in the GPRMC signal from receiving the PPS signal to the UTC full second time to obtain the synchronized time, and use the clock on the management plane The time after the synchronization, thus completing the adjustment of the management plane clock to be synchronized with the GNSS clock.
- the time synchronization device can adjust the management plane clock to be synchronized with the GNSS clock when the GNSS clock information received in the current cycle meets the satellite time valid condition, thereby avoiding the time synchronization error caused by using invalid GNSS clock information , which improves the accuracy of time synchronization.
- Step 403 Obtain a first deviation value between the time indicated by the clock on the data plane of the current period and the time indicated by the clock on the management plane.
- Step 404 When the first deviation value is greater than the first threshold, adjust the data plane clock in the current cycle according to the adjustment range in the current cycle, and the adjustment range in the cycle is smaller than or equal to the first threshold.
- the data plane clock is adjusted to be synchronized with the management plane clock in the current period.
- management plane clock and the data plane clock can be initialized each time the system is powered on.
- the management plane clock and the data plane clock may be initialized in the following manner.
- the management plane clock and the data plane clock can be initialized according to the time indicated by the management plane clock stored in the system at the previous power-off time.
- the time synchronization device can save the time indicated by the management plane clock when the system is powered off each time, and use it as the initialization time of the management plane clock and the data plane clock when the system is powered on next time; for example, After each power-on of the system, the time synchronization device can realize periodic synchronization of the management plane clock and the GNSS clock by executing the time synchronization method shown in Figure 3 or Figure 4 above.
- the time indicated by the clock can be kept the same or close to the UTC time.
- the initial time of the management plane clock and the data plane clock are consistent, and at the same time, ensure that the difference between the initial time of the management plane clock and the data plane clock and the UTC time is as small as possible, which is conducive to faster implementation after the system is powered on Both the management plane clock and the data plane clock are synchronized with UTC time.
- Method 2 The clock on the management plane and the clock on the data plane are initialized according to the time indicated by the RTC when the system is powered on.
- the RTC can still work after the system is powered off; in this mode, when the system is powered on each time, the time indicated by the RTC is used as the initialization time of the management plane clock and the data plane clock; It can work, so that the initialization time of the management plane clock and data plane clock has a small deviation from UTC time, which is conducive to faster synchronization of the management plane clock and data plane clock with UTC time after the system is powered on.
- the time synchronization device can periodically time-synchronize the RTC, so that the RTC and the GNSS clock are synchronized, and when the time synchronization device is powered on each time, the time indicated by the RTC The deviation from UTC time is small.
- the time indicated by the RTC is used as the initialization time of the management plane clock and the data plane clock, so as to ensure the consistency of the initial time of the management plane clock and the data plane clock when the time synchronization device is powered on each time, and at the same time, ensure the management plane clock and the data plane clock.
- the initial time of the data plane clock is closer to UTC time, which is beneficial to realize the management plane clock and data plane clock more quickly on the basis of avoiding large jumps in the management plane clock and data plane clock after the system is powered on Both are synchronized with UTC time.
- the time synchronization device can adjust the RTC to be synchronized with the GNSS clock according to the first GNSS clock information when confirming that the first GNSS clock information received in the current cycle satisfies the satellite time valid condition; wherein, the confirmation in this example
- the first GNSS clock information received in the current cycle satisfies the satellite time valid condition and the specific implementation process of adjusting the RTC to be synchronized with the GNSS clock can refer to the relevant expressions in the above-mentioned step 302, and will not repeat them here; as an example, in time synchronization After the device receives the PPS signal within a certain second, it clears the milliseconds and the time below the milliseconds in the RTC, and starts to count milliseconds; when the time synchronization device receives the GPRMC signal within the second, it extracts the GPRMC signal UTC whole second time; when it is confirmed that the received PPS signal and GPRMC signal meet the valid satellite time conditions, the time synchronization device will receive
- the time is added to obtain the synchronized time, and the RTC uses the synchronized time to complete the adjustment of the RTC to synchronize with the GNSS clock.
- the RTC uses the synchronized time to complete the adjustment of the RTC to synchronize with the GNSS clock.
- the clock on the management plane and the clock on the data plane can be initialized according to a preset time (for example, a factory-set time) when the system is powered on.
- a preset time for example, a factory-set time
- the preset time may be used to initialize the data plane clock and the management plane clock.
- FIG. 6 shows a flowchart of another time synchronization method according to an embodiment of the present application. As shown in FIG. 6, the method may include the following steps:
- Step 601. Determine the timing deviation rate of the first crystal oscillator relative to the GNSS clock.
- the timing deviation rate also known as the phase deviation rate
- the first crystal oscillator can be timed based on the number of vibrations. Every time the first crystal oscillator vibrates, One timing can be completed; for example, the standard frequency of the first crystal oscillator is 10,000 times per second, and 10,000 vibrations of the first crystal oscillator is equivalent to 1 second of UTC time. In actual work, when the UTC time passes by 1 second, the first crystal oscillator may only vibrate 9900 times or 10100 times. The standard frequency of the crystal oscillator determines the timing deviation rate of the first crystal oscillator relative to the GNSS clock.
- the time synchronization device in order to ensure the accuracy of the calculated timing deviation rate, can obtain the GNSS clock information of continuous N cycles, and the time synchronization device receives the GNSS clock information of each cycle in the continuous N cycles
- the clock information is timed by the first crystal oscillator; wherein, N is an integer greater than 1; when confirming that the GNSS clock information of N cycles satisfies the valid satellite time condition, and/or, when confirming that the GNSS clock information of each cycle in the N cycles is received
- the timing deviation rate of the first crystal oscillator relative to the GNSS clock is determined.
- the N consecutive periods may include the current period.
- the time synchronization device may obtain the timing of the first crystal oscillator when the PPS signal is received in each cycle, and the timing of the first crystal oscillator when the GPRMC signal is received in each cycle.
- satellite time valid condition can refer to relevant expression in above-mentioned step 402;
- Stable condition can comprise that the time synchronization device receives GNSS clock information in the adjacent period when the interval of the first crystal oscillator timing is within the preset range, for example, it can be time synchronization When the device receives PPS signals of adjacent periods, the timing interval of the first crystal oscillator is within a preset range (such as 999ms to 1001ms).
- Fig. 7 shows a schematic diagram of a time synchronization device receiving GNSS clock information in adjacent periods according to an embodiment of the present application. As shown in Fig.
- the transmission device can send the received PPS1 signal and GPRMC1 signal to Time synchronization device, when the time synchronization device receives the PPS1 signal, the timing of the first crystal oscillator is T'10, and when the time synchronization device receives the GPRMC1 signal, the timing of the first crystal oscillator is T'11; If other PPS signals or GPRMC signals are processed, and 0ms ⁇ (T'11-T'10) ⁇ 500ms, it can be determined that the PPS1 signals and GPRMC1 signals received in the current second meet the valid satellite time conditions.
- the transmission device sends the received PPS2 signal and GPRMC2 signal to the time synchronization device, the timing of the first crystal oscillator when the time synchronization device receives the PPS2 signal is T20, and the timing of the first crystal oscillator when receiving the GPRMC2 signal T21; in the previous second, except for the GPRMC2 signal and PPS2 signal, there was no other unprocessed PPS signal or GPRMC signal, and 0ms ⁇ (T21–T20) ⁇ 500ms, then the PPS2 signal and PPS2 signal received in the previous second can be determined GPRMC2 signal is valid. At the same time, if 999ms ⁇ (T20-T’10) ⁇ 1001ms, it can be determined that the timing of the first crystal oscillator meets the stability condition when the GNSS clock information is received within these two seconds.
- the time synchronization device can further calculate the timing deviation rate of the first crystal oscillator relative to the GNSS clock, and ensure the accuracy of the determined timing deviation rate.
- the time synchronization device When the GNSS clock information of N cycles does not meet the satellite time valid condition or the GNSS clock information of each cycle, the first crystal oscillator timing does not meet the stable condition, the time synchronization device does not perform the timing of determining the first crystal oscillator relative to the GNSS clock The operation of the deviation rate, thus giving up the compensation of the crystal oscillator timing deviation in this cycle.
- the time synchronization device may determine consecutive M cycles among the above N cycles, where M is an integer less than or equal to N and greater than 1; according to receiving the GNSS
- the clock information is the first crystal oscillator timing, and the first crystal oscillator timing interval is determined when receiving the GNSS clock information of the adjacent cycle in the M cycles; according to the first crystal oscillator timing interval and the preset sending interval corresponding to the GNSS clock information of the adjacent cycle, Determine the timing skew rate.
- the time synchronization device can select the first crystal oscillator timing when receiving the GNSS clock information of any two adjacent periods in the M cycles, and set the interval between the first crystal oscillator timing for the GNSS clock information of any two adjacent periods As the first crystal oscillator timing interval;
- the time synchronization device can obtain the average interval of the first crystal oscillator timing according to the interval of the first crystal oscillator timing when receiving the GNSS clock information of all adjacent cycles in the M cycles as the first Crystal timing interval.
- the ratio of the preset sending interval to the timing interval of the first crystal oscillator can be determined as the timing deviation rate of the first crystal oscillator relative to the GNSS clock; the ratio of the timing interval of the first crystal oscillator to the preset sending interval can also be determined as is the timing deviation rate of the first crystal oscillator relative to the GNSS clock.
- the preset transmission interval can be 1 second
- M can be 2
- the time synchronization device can obtain the timing of the first crystal oscillator when the PPS signal is received within 2 consecutive seconds, then the difference between the timing of the first crystal oscillator corresponding to these 2 seconds That is, the time interval for receiving the PPS signal, and the ratio of the preset transmission interval of 1 second to this time interval is the timing deviation rate of the first crystal oscillator relative to the GNSS clock.
- the time interval between the time synchronization device receiving the PPS1 signal in the current second and the PPS2 signal in the previous second is T20-T'10
- the transmission interval between the PPS1 signal and the PPS2 signal is 1 second
- T'10 is the timing of the 1000th vibration of the first crystal oscillator
- T20 is the timing of the 11010th vibration of the first crystal oscillator
- T20-T'10 is 11010 times of vibration
- Step 602 correct the system clock according to the timing deviation rate, and the system clock is counted and maintained by the first crystal oscillator.
- the system clock can be a clock that completes UTC time synchronization; it can be understood that after the system clock is synchronized with UTC time, the time indicated by the system clock is consistent with UTC time.
- the timing deviation of the clock causes the deviation between the time indicated by the time-synchronized system clock and UTC time to accumulate continuously.
- the time indicated by the time-synchronized system clock can be corrected according to the timing deviation rate to realize automatic compensation of the crystal oscillator deviation.
- the system clock may include a single clock; the time synchronization device may correct the single clock maintained by the first crystal oscillator according to the timing deviation rate.
- the system clock may include a management plane clock and a data plane clock
- the time synchronization device may correct the management plane clock and the data plane clock whose travel time is maintained by the first crystal oscillator according to the timing deviation rate, for example, according to the For the timing deviation rate, the management plane clock in step 301 or the management plane clock in step 402 is corrected, and the data plane clock in step 302 or the data plane clock in step 404 may also be corrected.
- the system clock can be periodically synchronized with UTC time, and the time synchronization device can determine the timing deviation rate of the first crystal oscillator relative to the GNSS clock in each cycle, and then indicate the system clock after time synchronization in this cycle time to correct.
- the timing deviation rate determined in the previous period can be used to control the system Correct the information indicated by the clock; for example, when the vehicle is driving in a tunnel and the GNSS signal is weak continuously, the system clock can be adjusted by using the timing deviation rate of the first crystal oscillator relative to the GNSS clock determined before the vehicle enters the tunnel Make corrections to avoid large deviations between the time indicated by the system clock and UTC time during long-term continuous operation, and ensure the stable and reliable operation of the automatic driving system.
- timing deviation rate of the first crystal oscillator relative to the GNSS clock when the timing deviation rate of the first crystal oscillator relative to the GNSS clock is greater than 1, it indicates that the timing of each vibration of the first crystal oscillator is slower than the UTC time, and the time indicated by the system clock needs to be adjusted faster; When the timing deviation rate of the first crystal oscillator relative to the GNSS clock is less than 1, it indicates that the timing of each vibration of the first crystal oscillator is faster than the UTC time, and the time indicated by the system clock needs to be slowed down; When the timing deviation rate of the GNSS clock is equal to 1, it indicates that the timing of each vibration of the first crystal oscillator is consistent with the UTC time, and there is no need to correct the system clock.
- the time synchronization device can determine the timing deviation rate of the first crystal oscillator relative to the GNSS clock; and correct the system clock according to the timing deviation rate to realize automatic compensation of the timing deviation of the crystal oscillator and further improve the accuracy of time synchronization. At the same time, it avoids the continuous large deviation between the time indicated by the system clock and the UTC time, and ensures the stable and reliable operation of the automatic driving system.
- prompt information is sent, where the prompt information is used to prompt that the first crystal oscillator is faulty.
- the timing deviation rate of the first crystal oscillator relative to the GNSS clock may be abnormally large or abnormally small. Fault.
- the time synchronization device can determine whether the timing deviation rate is abnormal according to a preset range; for example, when the timing deviation rate of the first crystal oscillator relative to the GNSS clock exceeds a preset range, it can be confirmed that the timing deviation rate is abnormal, thereby A prompt message may be issued to prompt that the first crystal oscillator is faulty.
- the preset range can be set according to actual needs, for example, the upper and lower limits of the preset range can be set to 1.1 and 0.9 respectively.
- the time synchronization device can compare whether the timing deviation rate calculated in two or more cycles exceeds the preset range, and can calculate in two or more cycles When the timing deviation rates of the first crystal oscillator relative to the GNSS clock exceed the preset range, the above prompt information is issued.
- the time synchronization device may adjust at least one system sub-clock subordinate to the system clock to be synchronized with the system clock according to the system clock.
- the system clock may be a system clock that completes UTC time synchronization and/or a system clock that completes crystal oscillator timing offset compensation, for example, it may be the system clock in step 602 above.
- the system sub-clock follows the system clock, and through adjustment, each system sub-clock can be kept the same or close to the UTC time, thereby ensuring the stable operation of the functional node where the system sub-clock is located.
- system clock may include a single clock
- system sub-clock may include sub-clocks subordinate to the single clock
- the system clock may include a management plane clock and a data plane clock
- the system sub-clock may include a data plane sub-clock subordinate to the data plane clock, or a management plane sub-clock subordinate to the management plane clock.
- the management face sub-clocks may be the management face sub-clocks a1, a2...aN in FIG. 1 above
- the data face sub-clocks may be the data face sub-clocks b1, b2...bN in FIG. 1 above.
- the time synchronization device may adjust at least one management plane sub-clock subordinate to the management plane clock to be synchronized with the management plane clock according to the management plane clock; At least one data plane sub-clock is adjusted to be synchronized with the data plane clock.
- the clock on the management plane and the clock on the data plane can be clocks that complete UTC time synchronization.
- the clock on the management plane can be the clock on the management plane in step 301 or the clock on the management plane in step 402
- the clock on the data plane can be the clock in the above steps The data plane clock in step 302 or the data plane clock in step 404 above.
- the management plane clock follows the management plane clock
- the data plane clock follows the data plane clock.
- each data plane clock and management plane clock can be kept the same or close to UTC time, thereby ensuring the functions of the data plane clock and the management plane clock. The stable operation of the node.
- each time the time synchronization device adjusts the management plane clock the management plane sub-clocks subordinate to the management plane clock are correspondingly adjusted once, and the adjustment range of each management plane sub-clock is consistent with the adjustment range of the management plane clock.
- the time synchronization device can adjust the data plane sub-clocks subordinate to the data plane clock every time the data plane clock is adjusted, and the adjusted amplitude of each data plane sub-clock is consistent with the adjusted amplitude of the data plane clock.
- time synchronization device as an SOC or MCU in the vehicle-mounted computing platform, and the system clock including a management plane clock and a data plane clock as examples
- the implementation process of the above time synchronization method is exemplarily described below.
- the time synchronization device is a SOC in an onboard computing platform.
- Fig. 8 shows a schematic diagram of time synchronization performed by the SOC according to an embodiment of the present application.
- the SOC obtains the GNSS clock information sent by the INS sensor through the interface, and implements the time synchronization method shown in the above embodiment to realize The clock on the management plane is synchronized with the clock on the data plane.
- the SOC can initialize the data plane clock and the management plane clock every time the system is powered on, and read the preset configuration items; wherein, the management plane clock and the data plane clock are Initialize according to the time indicated by the management plane clock stored in the system at the last power-off; or, initialize according to the time indicated by the RTC; both the data plane clock and the management plane clock are counted and maintained by the local crystal oscillator set in the SOC.
- the preset configuration items can include one or more of the following: the maximum value of data plane clock jumps allowed within a cycle is 1ms; the maximum value of data plane clock jumps allowed by the autopilot system in autopilot mode It is 10ms; the valid condition of the satellite time is that the state in the GPRMC signal is "valid", and the PPS signal and the GPRMC signal in this cycle are a pair, that is, there cannot be accumulated unprocessed PPS signals or GPRMC signals, and the received data in this cycle The interval between the local time of the GPRMC signal and the matching local time of the received PPS signal is within 500 milliseconds; the condition for calculating the timing deviation rate between the local crystal oscillator and the GNSS clock is: the GNSS clock acquired for 2 consecutive or more than 2 cycles The information satisfies the valid condition of the satellite time, and the interval between the received PPS time of the first and last two cycles is stable within 999ms to 1001ms.
- FIG. 9 shows a flow chart of SOC performing crystal oscillator timing offset compensation according to an embodiment of the present application.
- the SOC periodically obtains GNSS clock information, and then judges the received GNSS clock information in each cycle. Whether the clock information satisfies the valid conditions of satellite time. If the valid conditions of satellite time are met, the synchronization of the management plane clock and GNSS clock, and the synchronization of RTC and GNSS clock are carried out in this period; if the valid conditions of satellite time are not met, no Perform time synchronization.
- the crystal oscillator timing deviation compensation is performed on the management plane clock and the data plane clock.
- FIG. 10 shows a flowchart of time synchronization performed by the SOC according to an embodiment of the present application.
- the SOC can periodically compare the absolute time deviation indicated by the clock on the data plane and that indicated by the clock on the management plane. value, that is, the deviation value. If the deviation value is equal to 0, it indicates that there is no deviation between the clock on the data plane and the clock on the management plane, and synchronization is not required in this cycle; if the deviation value is greater than 0, record the time indicated by the clock on the data plane and the above deviation value.
- the SOC obtains the maximum value of the data plane clock jump allowed in the current cycle.
- the data plane clock is synchronized with the management plane clock in the current cycle. And record the adjustment range corresponding to the current cycle and the above deviation value; if the above deviation value is greater than the maximum value of the data plane clock jump allowed in the current cycle, the SOC will fine-tune the data plane clock according to the adjustment range corresponding to the current cycle, and record the current cycle corresponding to The adjustment range and the above deviation value, and then the SOC can gradually reduce the deviation between the data plane clock and the management plane clock through small adjustments that last for multiple cycles until the data plane clock and the management plane clock are synchronized.
- Fig. 11 shows a schematic diagram of time synchronization performed by an MCU according to an embodiment of the present application.
- the MCU obtains the GNSS clock information sent by the INS sensor through the CAN or UART interface, and performs the time synchronization shown in the above embodiment The method realizes the synchronization of the clock on the management plane and the clock on the data plane.
- the MCU can periodically feed back the deviation value between the time indicated by the clock on the data plane and the time indicated by the clock on the management plane to the target application (such as the automatic driving system), and the application in the SOC (such as the MDC TOOLS) is used to receive the target application request, and call different API interfaces (ie, API1 and API2 in the figure) according to the request, and notify the MCU (such as the time synchronization tool TSYNC CP) to synchronize the data plane clock and the management plane clock, and the complex programmable logic device (complex programmable logic device) , CPLD) is used to store the information of the management plane clock and the data plane clock.
- the target application such as the automatic driving system
- the application in the SOC such as the MDC TOOLS
- the MCU such as the time synchronization tool TSYNC CP
- the complex programmable logic device complex programmable logic device
- CPLD complex programmable logic device
- the MCU uses the GNSS clock information received each time to synchronize the PPS phase of the management plane clock with the PPS phase in the GNSS clock information, and the time indicated by the management plane clock is synchronized with the UTC time; and based on the API interface called, it is adjusted in one step
- the way of running, or the way of running in small steps realizes the time synchronization between the clock on the data plane and the clock on the management plane, and avoids large time jumps in the clock on the data plane.
- FIG. 12 shows a flow chart of MCU performing time synchronization according to an embodiment of the present application.
- the automatic driving system can call the API1 interface to realize the initial synchronization of the data plane clock and the management plane clock in a one-step adjustment method, and reduce the deviation between the data plane clock and the management plane clock to the ms level.
- the autopilot mode is turned on, first judge whether the data plane clock and the management plane clock have completed the initial synchronization.
- the MCU periodically compares the deviation value between the time indicated by the clock on the data plane and the time indicated by the clock on the management plane and reports it to the automatic driving system. , then wait to enter the next cycle and repeat the above-mentioned operations of judging whether the autopilot mode is on and after; if the deviation value exceeds the maximum value of the clock jump on the data surface allowed in the current cycle, the autopilot system calls the API2 interface to pass the small step In the way of running, the data plane clock and the management plane clock are synchronized after small adjustments in multiple cycles.
- FIG. 13 shows a flow chart of calling the API1 interface for time synchronization according to an embodiment of the present application.
- the API1 interface allows the data plane clock to perform large time jumps by default.
- the automatic driving system calls the API1 interface, sends a message notification to the MCU through the SOC, and then the MCU sends a General Purpose Input/Output (GPIO) signal to the CPLD, thereby Notify the CPLD to align the pps phase of the data plane clock with the pps phase of the management plane clock.
- GPIO General Purpose Input/Output
- the MCU After the MCU judges that the pps phase of the data plane clock is aligned with the pps phase of the management plane clock, it obtains UTC time and adjusts the time indicated by the data plane clock to realize data plane The clock is synchronized with the clock on the management plane.
- FIG. 14 shows a flow chart of calling the API2 interface for time synchronization according to an embodiment of the present application.
- the API2 interface only allows a small adjustment of the data plane clock by default.
- the autopilot system invokes the API2 interface, sends a message to the MCU through the SOC, and then According to the phase difference between the pps phase of the management plane clock and the pps phase of the data plane clock, the MCU writes it into the CPLD register in multiple cycles (such as less than 500ms), and then the CPLD adjusts the pps phase of the data plane clock according to the phase deviation value written into the register.
- Calibrate the MCU adjusts the time indicated by the clock on the data plane according to the adjustment range corresponding to each cycle, so that the clock on the data plane and the clock on the management plane can be realized through
- embodiments of the present application further provide a time synchronization device, which is configured to implement the technical solutions described in the foregoing method embodiments. For example, each step of any one of the methods shown in FIG. 3 , FIG. 4 , FIG. 6 , FIG. 9 , FIG. 10 , FIG. 12 , FIG. 13 or FIG. 14 may be executed.
- Fig. 15 shows a structural diagram of a time synchronization device according to an embodiment of the present application.
- the time synchronization device may include: a first module 1501, which is used to obtain the data indicated by the current cycle data surface clock The first deviation value between the time and the time indicated by the clock on the management plane; the second module 1502 is configured to, when the first deviation value is greater than the first threshold, adjust the data plane in the current period according to the adjustment range within the period The clock is adjusted, and the adjustment range within the period is less than or equal to the first threshold.
- the first threshold may represent the maximum value of data plane clock jumps allowed in a period, and when the first deviation value is greater than the first threshold, the data plane clock in the current period shall be adjusted according to the adjustment range within the period. Adjustment, in this way, adopt the method of "small steps and fast running", and through multiple cycles of adjustment, the deviation between the data plane clock and the management plane clock will gradually decrease until they are synchronized, and the adjustment range corresponding to each cycle will not exceed the first A threshold value, so that on the basis of ensuring the time stability in the automatic driving system, the clock on the data plane is synchronized with the clock on the management plane.
- the management plane clock can follow the GNSS clock, that is, the time indicated by the management plane clock can be kept the same or close to UTC time, therefore, through periodic adjustments, the time indicated by the data plane clock can be kept the same or close to UTC time, thus ensuring
- the time in the automatic driving system is kept the same or close to the UTC time.
- the time stamp provided by the management plane clock and the time stamp provided by the data plane clock are consistent with UTC time while the vehicle is running. The time remains the same or close, thereby ensuring the reliable operation of the automatic driving system in scenarios such as V2X, and improving the efficiency and accuracy of event analysis.
- the second module 1502 is further configured to: when the first deviation value is less than or equal to the first threshold, adjust the data plane clock to be consistent with The management plane clocks are synchronized.
- the second module 1502 is further configured to: correct the time stamp provided by the data plane clock according to the first deviation value and/or the period adjustment range.
- the first threshold is preconfigured; or the first threshold is notified when an operation mode is changed by application software, and the application software uses the data plane clock.
- the management plane clock and the data plane clock are initialized according to the time indicated by the management plane clock stored in the system when the system was powered off last time; or, according to The time indicated by the real-time clock RTC is initialized.
- the second module 1502 is further configured to: receive first GNSS clock information in the current period, and the first GNSS clock information includes at least one of the following: pulse per second PPS and/or recommended Positioning information GPRMC: when confirming that the first GNSS clock information satisfies the satellite time valid condition, adjust the management plane clock to be synchronized with the GNSS clock according to the first GNSS clock information.
- the second module 1502 is further configured to: when confirming that the first GNSS clock information satisfies the satellite time valid condition, adjust the RTC to be consistent with the GNSS clock information according to the first GNSS clock information. Clock synchronization.
- the second module 1502 is further configured to: adjust at least one management plane sub-clock subordinate to the management plane clock to be synchronized with the management plane clock according to the management plane clock;
- the data plane clock adjusts at least one data plane sub-clock subordinate to the data plane clock to be synchronized with the data plane clock.
- the second module 1502 is further configured to: determine the timing deviation rate of the first crystal oscillator relative to the GNSS clock; For correction, the clock on the management plane and the clock on the data plane are maintained by the counting of the first crystal oscillator.
- the second module 1502 is further configured to: acquire GNSS clock information of N consecutive cycles, and time the first crystal oscillator when receiving the GNSS clock information of each cycle in the N cycles; Wherein, N is an integer greater than 1; when confirming that the GNSS clock information of the N cycles satisfies the satellite time valid condition, and/or, confirming that the first crystal oscillator receives the GNSS clock information of each cycle in the N cycles When timing meets a stable condition, the timing deviation rate is determined.
- the second module 1502 is further configured to: determine consecutive M periods among the N periods, where M is an integer less than or equal to N and greater than 1; according to receiving the The GNSS clock information of each cycle in the M cycles is the timing of the first crystal oscillator, and the timing interval of the first crystal oscillator is determined when receiving the GNSS clock information of adjacent cycles in the M cycles; according to the timing interval of the first crystal oscillator , and the preset sending interval corresponding to the GNSS clock information of the adjacent period, to determine the timing deviation rate.
- the second module 1502 is further configured to: send a prompt message when it is confirmed that the timing deviation rate is abnormal, and the prompt message is used to prompt that the first crystal oscillator is faulty.
- FIG. 16 shows a structural diagram of another time synchronization device according to an embodiment of the present application.
- the time synchronization device may include: a third module 1601 for determining the first crystal oscillator relative to the GNSS clock The timing deviation rate; the fourth module 1602 is configured to correct the system clock according to the timing deviation rate, and the system clock is maintained by the first crystal oscillator.
- the timing deviation rate of the first crystal oscillator relative to the GNSS clock is determined, and the management plane clock and the data plane clock are corrected according to the timing deviation rate, so as to automatically compensate the crystal oscillator deviation of the management plane clock and the data plane clock .
- the system clock includes: a management plane clock and a data plane clock.
- the third module 1601 is also configured to: acquire GNSS clock information of consecutive N cycles, and the first crystal oscillator timing when receiving the GNSS clock information of each cycle in the N cycles ; Wherein, N is an integer greater than 1; when it is confirmed that the GNSS clock information of the N cycles meets the satellite time valid condition, and/or, when it is confirmed that the GNSS clock information of each cycle in the N cycles is received, the first When the timing of the crystal oscillator satisfies the stability condition, the timing deviation rate is determined.
- the third module 1601 is further configured to: determine consecutive M periods among the N periods, where M is an integer less than or equal to N and greater than 1; When the GNSS clock information of each cycle in the M cycles is described, the first crystal oscillator is timed, and the interval of the first crystal oscillator is determined when receiving the GNSS clock information of the adjacent cycle in the M cycles; according to the timing of the first crystal oscillator interval, and the preset sending interval corresponding to the GNSS clock information of the adjacent period, to determine the timing deviation rate.
- the fourth module 1602 is further configured to: send a prompt message when it is confirmed that the timing deviation rate is abnormal, and the prompt message is used to prompt that the first crystal oscillator is faulty.
- the system clock when the system is powered on, the system clock is initialized according to the time indicated by the management plane clock stored in the system when the system was powered off last time; or, the system clock is initialized according to the time indicated by the real-time clock RTC .
- the fourth module 1602 is further configured to: receive first GNSS clock information in the current cycle, and the first GNSS clock information includes at least one of the following: pulse per second PPS and/or recommended positioning Information GPRMC; when confirming that the first GNSS clock information satisfies the satellite time valid condition, adjust the management plane clock to be synchronized with the GNSS clock according to the first GNSS clock information.
- the fourth module 1602 is further configured to: adjust the RTC to be consistent with the GNSS clock synchronization.
- the fourth module 1602 is further configured to: obtain a first deviation value between the time indicated by the data plane clock and the time indicated by the management plane clock in the current period; When the first deviation value is greater than a first threshold, the data plane clock in the current cycle is adjusted according to an adjustment range in a cycle, and the adjustment range in a cycle is smaller than or equal to the first threshold.
- the fourth module 1602 is further configured to: when the first deviation value is less than or equal to the first threshold, adjust the data plane clock to Synchronize with the management plane clock.
- the fourth module 1602 is further configured to: correct the time stamp provided by the data plane clock according to the first deviation value and/or the intra-period adjustment range.
- the first threshold is preconfigured; or the first threshold is notified when an operation mode is changed by application software, and the application software uses the data plane clock.
- the fourth module 1602 is further configured to: adjust at least one system sub-clock subordinate to the system clock to be synchronized with the system plane clock according to the system clock.
- time synchronization device shown in FIG. 15 or 16 and various possible implementations thereof, reference may be made to the above time synchronization method, which will not be repeated here.
- each module in the above device is only a division of logical functions, which may be fully or partially integrated into one physical entity or physically separated during actual implementation.
- the modules in the device can be implemented in the form of a processor calling software; for example, the device includes a processor, the processor is connected to a memory, instructions are stored in the memory, and the processor calls the instructions stored in the memory to implement any of the above methods Or realize the function of each module of the device, wherein the processor is, for example, a general-purpose processor, such as a central processing unit (Central Processing Unit, CPU) or a microprocessor, and the memory is a memory in the device or a memory outside the device.
- CPU central processing unit
- microprocessor a microprocessor
- the modules in the device may be implemented in the form of hardware circuits, and part or all of the functions of the modules may be realized by designing the hardware circuits.
- the hardware circuits may be understood as one or more processors; for example, in one implementation, The hardware circuit is an application-specific integrated circuit (ASIC), and through the design of the logical relationship between the components in the circuit, the functions of some or all of the above modules are realized; for another example, in another implementation, the hardware circuit is It can be realized by programmable logic device (programmable logic device, PLD). Taking Field Programmable Gate Array (Field Programmable Gate Array, FPGA) as an example, it can include a large number of logic gate circuits, and configure the logic gate circuits through configuration files.
- programmable logic device programmable logic device
- All the modules of the above device can be realized in the form of calling software by the processor, or in the form of hardware circuit, or partially realized in the form of calling software by the processor, and the rest can be realized in the form of hardware circuit.
- the processor is a circuit with signal processing capabilities.
- the processor may be a circuit with instruction reading and execution capabilities, such as CPU, microprocessor, graphics processor (graphics processing unit, GPU) (can be understood as a microprocessor), or digital signal processor (digital signal processor, DSP), etc.; in another implementation, the processor can realize a certain Function, the logical relationship of the hardware circuit is fixed or reconfigurable, for example, the processor is a hardware circuit implemented by ASIC or PLD, such as FPGA.
- the process of the processor loading the configuration file to realize the configuration of the hardware circuit can be understood as the process of the processor loading instructions to realize the functions of some or all of the above modules.
- each module in the above device can be one or more processors (or processing circuits) configured to implement the above method, for example: CPU, GPU, microprocessor, DSP, ASIC, FPGA, or these processor forms A combination of at least two of them.
- the SOC may include at least one processor for implementing any of the above methods or realizing the functions of each module of the device.
- the at least one processor may be of different types, such as including CPU and FPGA, CPU and artificial intelligence processor, CPUs and GPUs, etc.
- An embodiment of the present application provides a time synchronization device, including: a processor; and a memory for storing processor-executable instructions; wherein, the processor is configured to implement the methods of the foregoing embodiments when executing the instructions.
- a time synchronization device including: a processor; and a memory for storing processor-executable instructions; wherein, the processor is configured to implement the methods of the foregoing embodiments when executing the instructions.
- FIG. 3 , FIG. 4 , FIG. 6 , FIG. 9 , FIG. 10 , FIG. 12 , FIG. 13 or FIG. 14 can be implemented.
- FIG. 17 shows a schematic structural diagram of a time synchronization device according to an embodiment of the present application.
- the time synchronization device may include: at least one processor 1701, a communication line 1702, a memory 1703 and at least one communication interface 1704.
- the processor 1701 can be a general-purpose central processing unit (central processing unit, CPU), a microprocessor, a specific application integrated circuit (application-specific integrated circuit, ASIC), or one or more for controlling the execution of the application program program integrated circuit.
- CPU central processing unit
- ASIC application-specific integrated circuit
- Communications link 1702 may include a pathway for communicating information between the above-described components.
- the communication interface 1704 uses any device such as a transceiver to communicate with other devices or communication networks, such as Ethernet, RAN, wireless local area networks (wireless local area networks, WLAN) and so on.
- a transceiver to communicate with other devices or communication networks, such as Ethernet, RAN, wireless local area networks (wireless local area networks, WLAN) and so on.
- Memory 1703 may be read-only memory (read-only memory, ROM) or other types of static storage devices that can store static information and instructions, random access memory (random access memory, RAM) or other types that can store information and instructions It can also be an electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or can be used to carry or store desired program code in the form of instructions or data structures and can be programmed by a computer Any other medium accessed, but not limited to.
- the memory may exist independently and be connected to the processor through the communication line 1702 .
- Memory can also be integrated with the processor.
- the memory provided by the embodiment of the present application may generally be non-volatile.
- the memory 1703 is used to store computer-executed instructions for implementing the solutions of the present application, and the execution is controlled by the processor 1701 .
- the processor 1701 is configured to execute computer-executed instructions stored in the memory 1703, so as to implement the methods provided in the above-mentioned embodiments of the present application. Exemplarily, each step of the method shown in any one of the above-mentioned FIG. 3 , FIG. 4 , FIG. 6 , FIG. 9 , FIG. 10 , FIG. 12 , FIG. 13 or FIG. 14 can be implemented.
- the computer-executed instructions in the embodiments of the present application may also be referred to as application program codes, which is not specifically limited in the embodiments of the present application.
- the processor 1701 may include one or more CPUs, such as CPU0 and CPU1 in FIG. 17 .
- the time synchronization apparatus may include multiple processors, such as processor 1701 and processor 1707 in FIG. 17 .
- processors may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor.
- a processor herein may refer to one or more devices, circuits, and/or processing cores for processing data (eg, computer program instructions).
- the time synchronization apparatus may further include an output device 1705 and an input device 1706 .
- Output device 1705 is in communication with processor 1701 and can display information in a variety of ways.
- the output device 1705 may be a liquid crystal display (liquid crystal display, LCD), a light emitting diode (light emitting diode, LED) display device, a cathode ray tube (cathode ray tube, CRT) display device, or a projector (projector) wait.
- the input device 1706 communicates with the processor 1701 and can receive user input in various ways.
- the input device 1706 may be a mouse, a keyboard, a touch screen device, or a sensory device, among others.
- the first module 1501 in Figure 15 above can be implemented by the communication interface 1704 in Figure 17; the second module 1502 in Figure 15 above can be realized by the Processor 1701 to achieve.
- the third module 1601 and the fourth module 1602 in FIG. 16 may be implemented by the processor 1701 in FIG. 17 .
- An embodiment of the present application provides a time synchronization system, including: a transmission device for receiving GNSS clock information, and any time synchronization device in the above-mentioned FIG. 15 , FIG. 16 or FIG. 17 .
- An embodiment of the present application provides a vehicle, including: any one of the time synchronization devices in the above-mentioned FIG. 15 , FIG. 16 or FIG. 17 , or the above-mentioned time synchronization system.
- Embodiments of the present application provide a computer-readable storage medium on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the methods in the foregoing embodiments are implemented. Exemplarily, each step of the method shown in any one of the above-mentioned Fig. 3, Fig. 4, Fig. 6, Fig. 9, Fig. 10, Fig. 12, Fig. 13 or Fig. 14 can be implemented.
- An embodiment of the present application provides a computer program product, including computer-readable codes, or a non-volatile computer-readable storage medium bearing computer-readable codes, when the computer-readable codes are stored in a processor of an electronic device
- the processor in the electronic device executes the method in the foregoing embodiment.
- each step of the method shown in any one of the above-mentioned FIG. 3 , FIG. 4 , FIG. 6 , FIG. 9 , FIG. 10 , FIG. 12 , FIG. 13 or FIG. 14 can be implemented.
- a computer readable storage medium may be a tangible device that can retain and store instructions for use by an instruction execution device.
- a computer readable storage medium may be, for example, but is not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing.
- Non-exhaustive list of computer-readable storage media include: portable computer disk, hard disk, random access memory (Random Access Memory, RAM), read only memory (Read Only Memory, ROM), erasable Electrically Programmable Read-Only-Memory (EPROM or flash memory), Static Random-Access Memory (Static Random-Access Memory, SRAM), Portable Compression Disk Read-Only Memory (Compact Disc Read-Only Memory, CD -ROM), Digital Video Disc (DVD), memory sticks, floppy disks, mechanically encoded devices such as punched cards or raised structures in grooves with instructions stored thereon, and any suitable combination of the foregoing .
- RAM Random Access Memory
- ROM read only memory
- EPROM or flash memory erasable Electrically Programmable Read-Only-Memory
- Static Random-Access Memory SRAM
- Portable Compression Disk Read-Only Memory Compact Disc Read-Only Memory
- CD -ROM Compact Disc Read-Only Memory
- DVD Digital Video Disc
- Computer readable program instructions or codes described herein may be downloaded from a computer readable storage medium to a respective computing/processing device, or downloaded to an external computer or external storage device over a network, such as the Internet, local area network, wide area network, and/or wireless network.
- the network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and/or edge servers.
- a network adapter card or a network interface in each computing/processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in each computing/processing device .
- Computer program instructions for performing the operations of the present application may be assembly instructions, instruction set architecture (Instruction Set Architecture, ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or in one or more source or object code written in any combination of programming languages, including object-oriented programming languages—such as Smalltalk, C++, etc., and conventional procedural programming languages—such as “like” languages or similar programming languages.
- Computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server implement.
- the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or it may be connected to an external computer such as use an Internet service provider to connect via the Internet).
- electronic circuits such as programmable logic circuits, field-programmable gate arrays (Field-Programmable Gate Array, FPGA) or programmable logic arrays (Programmable Logic Array, PLA), the electronic circuit can execute computer-readable program instructions, thereby realizing various aspects of the present application.
- These computer-readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine such that when executed by the processor of the computer or other programmable data processing apparatus , producing an apparatus for realizing the functions/actions specified in one or more blocks in the flowchart and/or block diagram.
- These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause computers, programmable data processing devices and/or other devices to work in a specific way, so that the computer-readable medium storing instructions includes An article of manufacture comprising instructions for implementing various aspects of the functions/acts specified in one or more blocks in flowcharts and/or block diagrams.
- each block in a flowchart or block diagram may represent a module, a portion of a program segment, or an instruction that includes one or more Executable instructions.
- the functions noted in the block may occur out of the order noted in the figures. For example, two blocks in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved.
- each block in the block diagrams and/or flowcharts, and combinations of blocks in the block diagrams and/or flowcharts can be implemented with hardware (such as circuits or ASIC (Application Specific Integrated Circuit, application-specific integrated circuit)), or it can be realized by a combination of hardware and software, such as firmware.
- hardware such as circuits or ASIC (Application Specific Integrated Circuit, application-specific integrated circuit)
- firmware such as firmware
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Electric Clocks (AREA)
- Synchronisation In Digital Transmission Systems (AREA)
Abstract
本申请涉及一种时间同步方法、装置及存储介质,其中,该方法可以包括:获取当前周期数据面时钟所指示的时间与管理面时钟所指示的时间的第一偏差值;在所述第一偏差值大于第一阈值时,根据周期内调整幅度对所述当前周期内所述数据面时钟进行调整,所述周期内调整幅度小于或等于所述第一阈值。通过本申请,在保证自动驾驶系统中时间的稳定的基础上,实现了自动驾驶系统中时间与现实时间协调世界时间(coordinated universal time,UTC)保持相同或者接近。
Description
本申请涉及自动驾驶技术领域,尤其涉及一种时间同步方法、装置及存储介质。
精确的时钟(clock,CLK)是车辆中自动驾驶系统(Automated Driving System,ADS)高可靠运行的关键因素之一。
自动驾驶系统中时钟需要满足所指示时间精度高、稳定不出现大的跳变,又能准确跟随现实时间协调世界时间(coordinated universal time,UTC)。UTC时间是从全球导航卫星系统(global navigation satellite system,GNSS)提供的GNSS信息中获取的。但在很多场景中(如地库、矿井、隧道等),由于GNSS信号不稳定,导致UTC时间源不稳定,影响智能驾驶算法的可靠性。因此,如何保持自动驾驶系统中时间的稳定跟随UTC时间,是自动驾驶领域的难题。
发明内容
有鉴于此,本申请提出了一种时间同步方法、装置、系统、车辆、存储介质及计算机程序产品。
第一方面,本申请的实施例提供了一种时间同步方法,所述方法包括:获取当前周期数据面时钟所指示的时间与管理面时钟所指示的时间的第一偏差值;在所述第一偏差值大于第一阈值时,根据周期内调整幅度对所述当前周期内所述数据面时钟进行调整,所述周期内调整幅度小于或等于所述第一阈值。
基于上述技术方案,第一阈值可以表示周期内所允许数据面时钟跳变的最大值,在第一偏差值大于第一阈值时,根据周期内调整幅度对所述当前周期内所述数据面时钟进行调整,这样,采用“小步快跑”的方式,通过多个周期的调整,使得数据面时钟与管理面时钟的偏差逐渐减小直到同步,且每一周期对应的调整幅度均不超过第一阈值,从而在保证自动驾驶系统中时间稳定的基础上,实现了数据面时钟与管理面时钟同步。由于管理面时钟可以跟随GNSS时钟,即管理面时钟所指示时间可以与UTC时间保持相同或者接近,因此,通过周期性调整,数据面时钟所指示时间可以与UTC时间保持相同或接近,从而在保证自动驾驶系统中时间的稳定的基础上,实现了自动驾驶系统中时间与UTC时间保持相同或者接近,这样,车辆行驶过程中管理面时钟提供的时间戳与数据面时钟提供的时间戳均与UTC时间保持相同或者接近,进而保证了自动驾驶系统在车与外界的信息交换(vehicle to everything,V2X)等场景中可靠运行,并且提高了事件分析的效率及准确性。
根据第一方面,在所述第一方面的第一种可能的实现方式中,所述方法还包括:在所述第一偏差值小于或等于所述第一阈值时,在所述当前周期内将所述数据面时钟 调整为与所述管理面时钟同步。
基于上述技术方案,第一阈值可以表示周期内所允许数据面时钟跳变的最大值,在第一偏差值小于或等于第一阈值时,采用“一步调整到位”的方式,在当前周期内将数据面时钟调整为与管理面时钟同步,实现了数据面时钟与管理面时钟的时间偏差自动补偿,从而在保证自动驾驶系统中时间稳定的基础上,更加快捷地实现数据面时钟与管理面时钟同步。
根据第一方面或第一方面的第一种可能的实现方式,在所述第一方面的第二种可能的实现方式中,所述方法还包括:根据所述第一偏差值和/或所述周期内调整幅度,对由所述数据面时钟提供的时间戳进行修正。
基于上述技术方案,在调整数据面时钟期间产生的时间戳,可能与UTC时间存在较小偏差,通过对数据面时钟提供的时间戳进行修正,以使修正后的时间戳与UTC时间同步,从而进一步提高了事件分析的效率及准确性。
根据第一方面或上述第一方面的各种可能的实现方式,在所述第一方面的第三种可能的实现方式中,所述第一阈值为预配置的;或所述第一阈值由应用软件变更操作模式时通知,所述应用软件使用所述数据面时钟。
根据第一方面或上述第一方面的各种可能的实现方式,在所述第一方面的第四种可能的实现方式中,所述管理面时钟和所述数据面时钟在系统上电时根据所述系统存储的前一次下电时所述管理面时钟所指示的时间进行初始化;或者,根据实时时钟(Real-time clock,RTC)所指示时间进行初始化。
基于上述技术方案,利用前一次下电时的管理面时钟所指示的时间,对管理面时钟及数据面时钟进行初始化处理,从而保证每次上电工作时,管理面时钟和数据面时钟的初始时间的一致性,从而有利于上电工作后更加快速的实现管理面时钟及数据面时钟均与UTC时间同步;或者,利用RTC所指示时间,对管理面时钟及数据面时钟进行初始化处理,由于RTC所指示时间与UTC时间的偏差较小,从而在保证每次上电工作时管理面时钟和数据面时钟的初始时间的一致性的同时,保证管理面时钟和数据面时钟的初始时间与UTC时间的偏差尽量小,从而有利于上电工作后在避免管理面时钟及数据面时钟出现大的跳变的基础上,更加快速的实现管理面时钟及数据面时钟均与UTC时间同步。
根据第一方面或上述第一方面的各种可能的实现方式,在所述第一方面的第五种可能的实现方式中,所述方法还包括:在所述当前周期接收第一GNSS时钟信息,所述第一GNSS时钟信息包括以下至少一种:秒脉冲(Pulse Per Second,PPS)和/或推荐定位信息(Recommended Minimum Specific GPS,GPRMC);确认所述第一GNSS时钟信息满足卫星时间有效条件时,根据所述第一GNSS时钟信息,将所述管理面时钟调整为与所述GNSS时钟同步。
基于上述技术方案,在确保当前周期所接收的GNSS时钟信息满足卫星时间有效条件时,将管理面时钟调整为与GNSS时钟同步,从而避免了因采用无效的GNSS时钟信息所带来的时间同步误差,提高了时间同步的准确性。
根据上述第一方面的第五种可能的实现方式,在所述第一方面的第六种可能的实现方式中,所述方法还包括:确认所述第一GNSS时钟信息满足卫星时间有效条件时, 根据所述第一GNSS时钟信息,将RTC调整为与所述GNSS时钟同步。
基于上述技术方案,在确保当前周期所接收的GNSS时钟信息满足卫星时间有效条件时,将RTC调整为与GNSS时钟同步,从而避免了因采用无效的GNSS时钟信息所带来的时间同步误差,提高了时间同步的准确性。
根据第一方面或上述第一方面的各种可能的实现方式,在所述第一方面的第七种可能的实现方式中,所述方法还包括:根据所述管理面时钟,将从属于所述管理面时钟的至少一个管理面子时钟调整为与所述管理面时钟同步;根据所述数据面时钟,将从属于所述数据面时钟的至少一个数据面子时钟调整为与所述数据面时钟同步。
基于上述技术方案,管理面子时钟跟随管理面时钟,数据面子时钟跟随数据面时钟,通过调整,各数据面子时钟及管理面子时钟均可以与UTC时间保持相同或者接近,从而保证数据面子时钟及管理面子时钟所在功能节点的稳定运行。
根据第一方面或上述第一方面的各种可能的实现方式,在所述第一方面的第八种可能的实现方式中,所述方法还包括:确定第一晶振相对于GNSS时钟的计时偏差率;根据所述计时偏差率,对所述管理面时钟和所述数据面时钟进行修正,所述管理面时钟和所述数据面时钟是由所述第一晶振计数维持走时的。
基于上述技术方案,确定第一晶振相对于GNSS时钟的计时偏差率,并根据该计时偏差率,对管理面时钟及数据面时钟进行修正,从而实现晶振计时偏差自动补偿;同时避免了管理面时钟所指示时间及数据面时钟所指示时间与UTC时间持续出现较大偏差,保证了自动驾驶系统的稳定可靠运行。
根据上述第一方面的第八种可能的实现方式,在所述第一方面的第九种可能的实现方式中,所述确定第一晶振相对于GNSS时钟的计时偏差率,包括:获取连续N个周期的GNSS时钟信息,及接收所述N个周期中各周期的GNSS时钟信息时所述第一晶振计时;其中,N为大于1的整数;确认所述N个周期的GNSS时钟信息满足卫星时间有效条件时,和/或,确认接收所述N个周期中各周期的GNSS时钟信息时所述第一晶振计时满足稳定条件时,确定所述计时偏差率。
基于上述技术方案,对N个周期的GNSS时钟信息进行判别,在获取到有效和/或稳定的GNSS时钟信息的情况下,确定计时偏差率,从而保证了所确定的计时偏差率的准确性。
根据上述第一方面的第九种可能的实现方式,在所述第一方面的第十种可能的实现方式中,所述确定所述计时偏差率,包括:确定所述N个周期中连续的M个周期,其中,M为小于或等于N、且大于1的整数;根据接收所述M个周期中各周期的GNSS时钟信息时所述第一晶振计时,确定接收所述M个周期中相邻周期的GNSS时钟信息时所述第一晶振计时间隔;根据所述第一晶振计时间隔,及所述相邻周期的GNSS时钟信息对应的预设发送间隔,确定所述计时偏差率。
作为一个示例,将第一晶振计时间隔与相邻周期的GNSS时钟信息对应的预设发送间隔的比值,确定为所述计时偏差率。
根据上述第一方面的各种可能的实现方式,在所述第一方面的第十一种可能的实现方式中,所述方法还包括:确认所述计时偏差率异常时,发出提示信息,所述提示信息用于提示所述第一晶振故障。
基于上述技术方案,若第一晶振发生故障,则可能造成第一晶振相对于GNSS时钟的计时偏差率异常,因此,在确认计时偏差率异常时发出提示信息,以便提示第一晶振故障。
第二方面,本申请的实施例提供了一种时间同步方法,所述方法包括:确定第一晶振相对于GNSS时钟的计时偏差率;根据所述计时偏差率,对系统时钟进行修正,所述系统时钟是由所述第一晶振计数维持走时的。
基于上述技术方案,确定第一晶振相对于GNSS时钟的计时偏差率,并根据该计时偏差率,对系统时钟进行修正,从而实现晶振计时偏差自动补偿;同时避免了系统时钟所指示时间与UTC时间持续出现较大偏差,保证了自动驾驶系统的稳定可靠运行。
根据第二方面,在所述第二方面的第一种可能的实现方式中,所述系统时钟包括:管理面时钟和数据面时钟。
根据第二方面或第二方面的第一种可能的实现方式,在所述第二方面的第二种可能的实现方式中,所述确定第一晶振相对于GNSS时钟的计时偏差率,包括:获取连续N个周期的GNSS时钟信息,及接收所述N个周期中各周期的GNSS时钟信息时所述第一晶振计时;其中,N为大于1的整数;确认所述N个周期的GNSS时钟信息满足卫星时间有效条件时,和/或,确认接收所述N个周期中各周期的GNSS时钟信息时所述第一晶振计时满足稳定条件时,确定所述计时偏差率。
基于上述技术方案,对N个周期的GNSS时钟信息进行判别,在获取到有效和/或稳定的GNSS时钟信息的情况下,确定计时偏差率,从而保证了所确定的计时偏差率的准确性。
根据第二方面的第二种可能的实现方式,在所述第二方面的第三种可能的实现方式中,所述确定所述计时偏差率,包括:确定所述N个周期中连续的M个周期,其中,M为小于或等于N、且大于1的整数;获取接收所述M个周期中各周期的GNSS时钟信息时所述第一晶振计时,确定接收所述M个周期中相邻周期的GNSS时钟信息时所述第一晶振计时间隔;根据所述第一晶振计时间隔,及所述相邻周期的GNSS时钟信息对应的预设发送间隔,确定所述计时偏差率。
作为一个示例,将第一晶振计时间隔与相邻周期的GNSS时钟信息对应的预设发送间隔的比值,确定为所述计时偏差率。
根据第二方面或上述第二方面的各种可能的实现方式,在所述第二方面的第四种可能的实现方式中,所述方法还包括:确认所述计时偏差率异常时,发出提示信息,所述提示信息用于提示所述第一晶振故障。
基于上述技术方案,若第一晶振发生故障,则可能造成第一晶振相对于GNSS时钟的计时偏差率异常,因此,在确认计时偏差率异常时发出提示信息,以便提示第一晶振故障。
根据第二方面或上述第二方面的各种可能的实现方式,在所述第二方面的第五种可能的实现方式中,所述系统时钟在系统上电时根据所述系统存储的前一次下电时管理面时钟所指示的时间进行初始化;或者,根据实时时钟RTC所指示时间进行初始化。
基于上述技术方案,利用前一次下电时的管理面时钟所指示的时间,对管理面时钟及数据面时钟进行初始化处理,从而保证每次上电工作时,管理面时钟和数据面时 钟的初始时间的一致性,从而有利于上电工作后更加快速的实现管理面时钟及数据面时钟均与UTC时间同步;或者,利用RTC所指示时间,对管理面时钟及数据面时钟进行初始化处理,由于RTC所指示时间与UTC时间的偏差较小,从而在保证每次上电工作时管理面时钟和数据面时钟的初始时间的一致性的同时,保证管理面时钟和数据面时钟的初始时间与UTC时间的偏差尽量小,从而有利于上电工作后更加快速的实现管理面时钟及数据面时钟均与UTC时间同步。
根据上述第二方面的各种可能的实现方式,在所述第二方面的第六种可能的实现方式中,所述方法还包括:在当前周期接收第一GNSS时钟信息,所述第一GNSS时钟信息包括以下至少一种:秒脉冲PPS和/或推荐定位信息GPRMC;确认所述第一GNSS时钟信息满足卫星时间有效条件时,根据所述第一GNSS时钟信息,将所述管理面时钟调整为与所述GNSS时钟同步。
基于上述技术方案,可以在确保当前周期所接收的GNSS时钟信息满足卫星时间有效条件时,将管理面时钟调整为与GNSS时钟同步,从而避免了因采用无效的GNSS时钟信息所带来的时间同步误差,提高了时间同步的准确性。
根据第二方面的第六种可能的实现方式,在所述第二方面的第七种可能的实现方式中,所述方法还包括:确认所述第一GNSS时钟信息满足卫星时间有效条件时,根据所述第一GNSS时钟信息,将RTC调整为与所述GNSS时钟同步。
基于上述技术方案,在确保当前周期所接收的GNSS时钟信息满足卫星时间有效条件时,将RTC调整为与GNSS时钟同步,从而避免了因采用无效的GNSS时钟信息所带来的时间同步误差,提高了时间同步的准确性。
根据上述第二方面的各种可能的实现方式,在所述第二方面的第八种可能的实现方式中,所述方法还包括:获取当前周期所述数据面时钟所指示的时间与所述管理面时钟所指示的时间的第一偏差值;在所述第一偏差值大于第一阈值时,根据周期内调整幅度对所述当前周期内所述数据面时钟进行调整,所述周期内调整幅度小于或等于所述第一阈值。
基于上述技术方案,第一阈值可以表示周期内所允许数据面时钟跳变的最大值,在第一偏差值大于第一阈值时,根据周期内调整幅度对所述当前周期内所述数据面时钟进行调整,这样,采用“小步快跑”的方式,通过多个周期的调整,使得数据面时钟与管理面时钟的偏差逐渐减小直到同步,且每一周期对应的调整幅度均不超过第一阈值,从而在保证自动驾驶系统中时间稳定的基础上,实现了数据面时钟与管理面时钟同步。由于管理面时钟可以跟随GNSS时钟,即管理面时钟所指示时间可以与UTC时间保持相同或者接近,因此,通过周期性调整,数据面时钟所指示时间可以与UTC时间保持相同或接近,从而在保证自动驾驶系统中时间的稳定的基础上,实现了自动驾驶系统中时间与UTC时间保持相同或者接近,这样,车辆行驶过程中管理面时钟提供的时间戳与数据面时钟提供的时间戳均与UTC时间保持相同或者接近,进而保证了自动驾驶系统在车与外界的信息交换(vehicle to everything,V2X)等场景中可靠运行,并且提高了事件分析的效率及准确性。
根据第二方面的第八种可能的实现方式,在所述第二方面的第九种可能的实现方式中,所述方法还包括:在所述第一偏差值小于或等于所述第一阈值时,在所述当前 周期内将所述数据面时钟调整为与所述管理面时钟同步。
基于上述技术方案,第一阈值可以表示周期内所允许数据面时钟跳变的最大值,在第一偏差值小于或等于第一阈值时,采用“一步调整到位”的方式,在当前周期内将数据面时钟调整为与管理面时钟同步,实现了数据面时钟与管理面时钟的时间偏差自动补偿,从而在保证自动驾驶系统中时间稳定的基础上,更加快捷地实现数据面时钟与管理面时钟同步。
根据第二方面的第八种或第九种可能的实现方式,在所述第二方面的第十种可能的实现方式中,所述方法还包括:根据所述第一偏差值和/或所述周期内调整幅度,对由所述数据面时钟提供的时间戳进行修正。
基于上述技术方案,在调整数据面时钟期间产生的时间戳,可能与UTC时间存在较小偏差,通过对数据面时钟提供的时间戳进行修正,以使修正后的时间戳与UTC时间同步,从而进一步提高了事件分析的效率及准确性。
根据第二方面的各种可能的实现方式,在所述第二方面的第十一种可能的实现方式中,所述第一阈值为预配置的;或所述第一阈值由应用软件变更操作模式时通知,所述应用软件使用所述数据面时钟。
根据第二方面或上述第二方面的各种可能的实现方式,在所述第二方面的第十二种可能的实现方式中,所述方法还包括:根据系统时钟,将从属于所述系统时钟的至少一个系统子时钟调整为与所述系统时钟同步。
基于上述技术方案,系统子时钟跟随系统时钟,通过调整,各系统子时钟均可以与UTC时间保持相同或者接近,从而保证系统子时钟所在功能节点的稳定运行。
第三方面,本申请的实施例提供了一种时间同步装置,所述装置包括:所述装置包括:第一模块,用于获取当前周期数据面时钟所指示的时间与管理面时钟所指示的时间的第一偏差值;第二模块,用于在所述第一偏差值大于第一阈值时,根据周期内调整幅度对所述当前周期内所述数据面时钟进行调整,所述周期内调整幅度小于或等于所述第一阈值。
根据第三方面,在所述第三方面的第一种可能的实现方式中,所述第二模块还用于:在所述第一偏差值小于或等于所述第一阈值时,在所述当前周期内将所述数据面时钟调整为与所述管理面时钟同步。
根据第三方面或第三方面的第一种可能的实现方式,在所述第三方面的第二种可能的实现方式中,所述第二模块还用于:根据所述第一偏差值和/或所述周期内调整幅度,对由所述数据面时钟提供的时间戳进行修正。
根据第三方面或上述第三方面的各种可能的实现方式,在所述第三方面的第三种可能的实现方式中,所述第一阈值为预配置的;或所述第一阈值由应用软件变更操作模式时通知,所述应用软件使用所述数据面时钟。
根据第三方面或上述第三方面的各种可能的实现方式,在所述第三方面的第四种可能的实现方式中,所述管理面时钟和所述数据面时钟在系统上电时根据所述系统存储的前一次下电时所述管理面时钟所指示的时间进行初始化;或者,根据实时时钟RTC所指示时间进行初始化。
根据第三方面或上述第三方面的各种可能的实现方式,在所述第三方面的第五种 可能的实现方式中,所述第二模块还用于:在所述当前周期接收第一GNSS时钟信息,所述第一GNSS时钟信息包括以下至少一种:秒脉冲PPS和/或推荐定位信息GPRMC;确认所述第一GNSS时钟信息满足卫星时间有效条件时,根据所述第一GNSS时钟信息,将所述管理面时钟调整为与所述GNSS时钟同步。
根据上述第三方面的第五种可能的实现方式,在所述第三方面的第六种可能的实现方式中,所述第二模块还用于:确认所述第一GNSS时钟信息满足卫星时间有效条件时,根据所述第一GNSS时钟信息,将RTC调整为与所述GNSS时钟同步。
根据第三方面或上述第三方面的各种可能的实现方式,在所述第三方面的第七种可能的实现方式中,所述第二模块还用于:根据所述管理面时钟,将从属于所述管理面时钟的至少一个管理面子时钟调整为与所述管理面时钟同步;根据所述数据面时钟,将从属于所述数据面时钟的至少一个数据面子时钟调整为与所述数据面时钟同步。
根据第三方面或上述第三方面的各种可能的实现方式,在所述第三方面的第八种可能的实现方式中,所述第二模块还用于:确定第一晶振相对于GNSS时钟的计时偏差率;根据所述计时偏差率,对所述管理面时钟和所述数据面时钟进行修正,所述管理面时钟和所述数据面时钟是由所述第一晶振计数维持走时的。
根据上述第三方面的第八种可能的实现方式,在所述第三方面的第九种可能的实现方式中,所述第二模块还用于:获取连续N个周期的GNSS时钟信息,及接收所述N个周期中各周期的GNSS时钟信息时所述第一晶振计时;其中,N为大于1的整数;确认所述N个周期的GNSS时钟信息满足卫星时间有效条件时,和/或,确认接收所述N个周期中各周期的GNSS时钟信息时所述第一晶振计时满足稳定条件时,确定所述计时偏差率。
根据上述第三方面的第九种可能的实现方式,在所述第三方面的第十种可能的实现方式中,所述第二模块还用于:确定所述N个周期中连续的M个周期,其中,M为小于或等于N、且大于1的整数;根据接收所述M个周期中各周期的GNSS时钟信息时所述第一晶振计时,确定接收所述M个周期中相邻周期的GNSS时钟信息时所述第一晶振计时间隔;根据所述第一晶振计时间隔,及所述相邻周期的GNSS时钟信息对应的预设发送间隔,确定所述计时偏差率。
根据上述第三方面的各种可能的实现方式,在所述第三方面的第十一种可能的实现方式中,所述第二模块还用于:确认所述计时偏差率异常时,发出提示信息,所述提示信息用于提示所述第一晶振故障。
第四方面,本申请的实施例提供了一种时间同步装置,所述装置包括:第三模块,用于确定第一晶振相对于GNSS时钟的计时偏差率;第四模块,用于根据所述计时偏差率,对系统时钟进行修正,所述系统时钟是由所述第一晶振计数维持走时的。
根据第四方面,在所述第四方面的第一种可能的实现方式中,所述系统时钟包括:管理面时钟和数据面时钟。
根据第四方面或第四方面的第一种可能的实现方式,在所述第四方面的第二种可能的实现方式中,所述第三模块还用于:获取连续N个周期的GNSS时钟信息,及接收所述N个周期中各周期的GNSS时钟信息时所述第一晶振计时;其中,N为大于1的整数;确认所述N个周期的GNSS时钟信息满足卫星时间有效条件时,和/或,确认 接收所述N个周期中各周期的GNSS时钟信息时所述第一晶振计时满足稳定条件时,确定所述计时偏差率。
根据第四方面的第二种可能的实现方式,在所述第四方面的第三种可能的实现方式中,所述第三模块还用于:确定所述N个周期中连续的M个周期,其中,M为小于或等于N、且大于1的整数;获取接收所述M个周期中各周期的GNSS时钟信息时所述第一晶振计时,确定接收所述M个周期中相邻周期的GNSS时钟信息时所述第一晶振计时间隔;根据所述第一晶振计时间隔,及所述相邻周期的GNSS时钟信息对应的预设发送间隔,确定所述计时偏差率。
根据第四方面或上述第四方面的各种可能的实现方式,在所述第四方面的第四种可能的实现方式中,所述第四模块还用于:确认所述计时偏差率异常时,发出提示信息,所述提示信息用于提示所述第一晶振故障。
根据第四方面或上述第四方面的各种可能的实现方式,在所述第四方面的第五种可能的实现方式中,所述系统时钟在系统上电时根据所述系统存储的前一次下电时管理面时钟所指示的时间进行初始化;或者,根据实时时钟RTC所指示时间进行初始化。
根据上述第四方面的各种可能的实现方式,在所述第四方面的第六种可能的实现方式中,所述第四模块还用于:在当前周期接收第一GNSS时钟信息,所述第一GNSS时钟信息包括以下至少一种:秒脉冲PPS和/或推荐定位信息GPRMC;确认所述第一GNSS时钟信息满足卫星时间有效条件时,根据所述第一GNSS时钟信息,将所述管理面时钟调整为与所述GNSS时钟同步。
根据第四方面的第六种可能的实现方式,在所述第四方面的第七种可能的实现方式中,所述第四模块还用于:确认所述第一GNSS时钟信息满足卫星时间有效条件时,根据所述第一GNSS时钟信息,将RTC调整为与所述GNSS时钟同步。
根据上述第四方面的各种可能的实现方式,在所述第四方面的第八种可能的实现方式中,所述第四模块还用于:获取当前周期所述数据面时钟所指示的时间与所述管理面时钟所指示的时间的第一偏差值;在所述第一偏差值大于第一阈值时,根据周期内调整幅度对所述当前周期内所述数据面时钟进行调整,所述周期内调整幅度小于或等于所述第一阈值。
根据第四方面的第八种可能的实现方式,在所述第四方面的第九种可能的实现方式中,所述第四模块还用于:在所述第一偏差值小于或等于所述第一阈值时,在所述当前周期内将所述数据面时钟调整为与所述管理面时钟同步。
根据第四方面的第八种或第九种可能的实现方式,在所述第四方面的第十种可能的实现方式中,所述第四模块还用于:根据所述第一偏差值和/或所述周期内调整幅度,对由所述数据面时钟提供的时间戳进行修正。
根据第四方面的各种可能的实现方式,在所述第四方面的第十一种可能的实现方式中,所述第一阈值为预配置的;或所述第一阈值由应用软件变更操作模式时通知,所述应用软件使用所述数据面时钟。
根据第四方面或上述第四方面的各种可能的实现方式,在所述第四方面的第十二种可能的实现方式中,所述第四模块还用于:根据系统时钟,将从属于所述系统时钟的至少一个系统子时钟调整为与所述系统面时钟同步。
第五方面,本申请的实施例提供了一种时间同步装置,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为执行所述指令时实现上述第一方面或者第一方面的各种可能的实现方式中的时间同步方法,或者实现上述第二方面或者第二方面的各种可能的实现方式中的时间同步方法。
第六方面,本申请的实施例提供了一种时间同步系统,包括:用于接收GNSS时钟信息的传输装置,及上述第三方面到第五方面中的任一时间同步装置。
第七方面,本申请的实施例提供了一种车辆,包括:上述第三方面到第五方面中的任一时间同步装置,或者上述第六方面的时间同步系统。
第八方面,本申请的实施例提供了一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现上述第一方面或者第一方面的各种可能的实现方式中的时间同步方法,或者实现上述第二方面或者第二方面的各种可能的实现方式中的时间同步方法。
第九方面,本申请的实施例提供了一种计算机程序产品,当所述计算机程序产品在计算机上运行时,使得所述计算机执行上述第一方面或者第一方面的各种可能的实现方式中的时间同步方法,或者实现上述第二方面或者第二方面的各种可能的实现方式中的时间同步方法。
上述第三方面到第九方面的技术效果,参见上述第一方面及第一方面的各种可能的实现方式的技术效果,或者上述第二方面及第二方面的各种可能的实现方式的技术效果。
图1示出根据本申请一实施例的一种双时钟架构的示意图;
图2示出根据本申请一实施例的一种时间同步系统的示意图;
图3示出根据本申请一实施例的一种时间同步方法的流程图;
图4示出根据本申请一实施例的时间同步装置接收GNSS时钟信息的示意图;
图5示出根据本申请一实施例的一种调整管理面时钟及数据面时钟的方法流程图;
图6示出根据本申请一实施例的一种时间同步方法的流程图;
图7示出根据本申请一实施例的时间同步装置相邻周期接收GNSS时钟信息的示意图;
图8示出根据本申请一实施例的SOC进行时间同步的示意图;
图9示出根据本申请一实施例的SOC进行晶振计时偏差补偿的流程图;
图10示出根据本申请一实施例的SOC进行时间同步的流程图;
图11示出根据本申请一实施例的MCU进行时间同步的示意图;
图12示出根据本申请一实施例的MCU进行时间同步的流程图;
图13示出根据本申请一实施例的调用API1接口进行时间同步的流程图;
图14示出根据本申请一实施例的调用API2接口进行时间同步的流程图;
图15示出根据本申请一实施例的一种时间同步装置的结构图;
图16示出根据本申请一实施例的另一种时间同步装置的结构图;
图17示出根据本申请一实施例的一种时间同步装置的结构示意图。
以下将参考附图详细说明本申请的各种示例性实施例、特征和方面。附图中相同的附图标记表示功能相同或相似的元件。尽管在附图中示出了实施例的各种方面,但是除非特别指出,不必按比例绘制附图。
在这里专用的词“示例性”意为“用作例子、实施例或说明性”。这里作为“示例性”所说明的任何实施例不必解释为优于或好于其它实施例。
自动驾驶系统中可以配置有系统时钟,示例性地,系统时钟可以为单时钟架构或双时钟架构等,其中,在单时钟架构中,单时钟为自动驾驶系统中各项数据提供时间戳,当外部的GNSS时间源可用时,单时钟与UTC时间同步,当GNSS时间源不可用时,依赖系统级芯片(System-on-a-Chip,SOC)的本地晶振自运行。
图1示出根据本申请一实施例的一种双时钟架构的示意图。如图1所示,在双时钟架构中包括管理面时钟和数据面时钟。其中,管理面时钟在系统中也称为GNSS时钟(GNSS CLOCK,GNSS CLK),跟随现实时间协调世界时间(coordinated universal time,UTC)。当外部的GNSS时间源可用时,管理面时钟与UTC时间同步,当GNSS时间源不可用时,管理面时钟依赖SOC的本地晶振自运行。管理面时钟一般用于为不参与智能驾驶算法计算的功能节点提供时间戳,如维测、日志等,这些功能节点通常对时间跳变不敏感。其中,GNSS时钟信息可以包括秒脉冲(Pulse Per Second,PPS)信号和推荐定位信息(Recommended Minimum Specific GPS,GPRMC)信号等;其中,PPS信号是时间周期为1秒的同步脉冲信号,脉冲宽度5~100毫秒(ms),每1秒钟1个脉冲;GPRMC信号是通过标准串口输出的符合GPRMC标准的时间同步报文,包括PPS信号所对应的UTC时间信息和/或经纬度定位数据,例如,年、月、日、时、分、秒、毫秒、微秒等;GNSS系统可以每秒下发一对PPS信号和GPRMC信号,PPS脉冲前沿时刻和GPRMC报文的发送在同一时刻,误差为纳秒(ns)级别,可以忽略。GPRMC信号一般通过串口发送,其发送、接收以及处理时间都在ms级别。在一种可能的同步过程中,使用PPS信号和GPRMC信号进行时间同步的设备接收到PPS信号后,将内部以晶振为时钟源的系统时间里的毫秒及毫秒以下时间(如,微秒等)清零,并由此开始计算毫秒时间;当接收到GPRMC信号后,提取报文里UTC时间的时、分、秒、年、月、日信息;将接收到PPS信号到解析出GPRMC中UTC时间所用的毫秒时间与UTC整秒时间相加得到同步后的时间,设备中需要和UTC时间同步的时钟使用该同步后的时间,从而完成一次时间同步。每个1秒周期进行一次上述同步过程,每秒准确校准一次。
数据面时钟在系统中也称为操作系统时钟(Operating System Clock,OS CLK),它依赖于SOC的本地晶振自运行,不与外部GNSS时间源同步,以确保时钟是单调递增的。数据面时钟用于为参与智能驾驶算法计算的数据提供时间戳,如:传感器采集的数据,执行器接收的指令和数据等,可以减少时钟跳变对智能驾驶算法可靠性的功能安全问题。
示例性地,自动驾驶系统中可以包括一个或多个节点,各节点均可以配置上述双时钟架构。作为一个示例,可以根据时钟的从属关系,将多个节点划分为主节点(如 图1中所示的主节点)及从节点(如图1中所示从节点1、2..N),其中,各从节点中数据面子时钟(如图1中数据面子时钟a1、a2…aN)均跟随主节点的数据面时钟(如图1中数据面时钟A)的调整而调整,即各从节点中数据面子时钟均与主节点的数据面时钟保持同步;各从节点中管理面子时钟均跟随于主节点的管理面时钟的调整而调整,即各从节点中管理面子时钟(如图1中数据面子时钟b1、b2…bN)均与主节点的管理面时钟(如图1中数据面时钟B)保持同步。
示例性地,主节点可以包括车载计算设备,例如:移动数据中心(Mobile Data Center,MDC),域控制器,电子控制单元(electric control unit,ECU)等,也可以包括配置于车载计算设备中的系统级芯片(System-on-a-Chip,SOC)、微控制器单元(Micro Control Unit,MCU)等等;从节点可以包括自动驾驶系统中除主节点之外的其他的多种装置:例如,处理器、传感器、传感器抽象、执行器、其他域控制器等等,也可以包括配置于该多种装置中的SOC、MCU等等,例如,摄像头(Camera)及其数据处理节点、激光雷达(Lidar)及其数据处理节点、毫米波雷达(Radar)及其数据处理节点、超声波雷达(Ultrasound Scan,USS)及其数据处理节点、车辆底盘及其数据处理节点等等。
针对上述双时钟架构,由于管理面时钟与GNSS时钟同步,数据面时钟不与GNSS时钟同步的方式,即管理面时钟以UTC时间为基准时间,数据面时钟不以UTC时间为基准时间,则针对同一时刻,数据面时钟所指示时间与管理面时钟所指示时间可能会出现较大偏差,影响了自动驾驶系统在V2X等场景中运行的可靠性。作为一个示例,在车辆行驶至路口时,自动驾驶系统可以与设置在路口的路侧设备建立通信连接,从而获取交通灯相关信息,例如,可以获取车辆所在车道对应的交通灯的时间信息,由于路侧设备通常采用UTC时间为基准时间,而自动驾驶系统中数据面时钟不以UTC时间为基准时间,这样,交通灯的时间信息与数据面时钟所指示时间存在偏差,自动驾驶系统通过匹配交通灯的时间信息及数据面时钟为车载设备采集的数据提供的时间戳控制车辆,会出现匹配误差,从而带来安全隐患。此外,针对同一时刻,数据面时钟所指示时间与管理面时钟所指示时间可能存在较大偏差,增加了事件分析(如故障回放分析、碰撞事故分析等)的难度。作为一个示例,在车辆发生故障后,可以通过事件日志确定故障发生的时间,进而获取故障发生时车载设备采集的数据,通过对故障发生时车载设备采集的数据进行分析,确定故障原因;由于针对同一时刻,事件日志对应的时间戳与车载设备采集的数据对应的时间戳存在较大偏差;根据管理面提供的故障发生时的时间戳难以准确获取故障发生时车载设备采集的数据,增加了故障回放分析的难度。
本申请提出了一种时间同步的技术方案(详细描述参见下文),可以在保持自动驾驶系统中时间稳定的基础上,实现数据面时钟与管理面时钟同步,即实现了系统中时间和UTC时间相同或者接近,进而保证了自动驾驶系统在V2X等场景中可靠运行,并且提高了事件分析的效率及准确性。
需要说明的是,本申请实施例描述的上述应用场景是为了更加清楚的说明本申请实施例的技术方案,并不构成对于本申请实施例提供的技术方案的限定,本领域普通技术人员可知,针对其他相似的或新的应用场景的出现,本申请实施例提供的技术方 案对于类似的技术问题同样适用。
下面对本申请实施例提供的一种时间同步系统进行介绍。
图2示出根据本申请一实施例的一种时间同步系统的示意图,该时间同步系统可以配置于自动驾驶系统中;如图2所示,该时间同步系统可以包括:传输装置201,时间同步装置202。
传输装置201用于接收来自GNSS系统的GNSS时钟信息,并可以将所接收的GNSS时钟信息发送至时间同步装置202。示例性地,传输装置201可以通过天线周期性地接收GNSS时钟信息,在每次接收到GNSS时钟信息后,通过软硬件接口将GNSS时钟信息发送至时间同步装置202。
示例性地,传输装置201可以包括惯性导航系统(Inertial Navigation System,INS)传感器、GNSS信号接收机或实时差分定位(Real-time kinematic,RTK)传感器等中的一项或多项。
示例性地,GNSS系统可以包括:全球定位系统(Global Positioning System,GPS)、北斗卫星导航系统(Beidou Navigation Satellite System,BDS)、格洛纳斯卫星导航系统(Global Navigation Satellite System,GLONASS)、伽利略卫星导航系统(Galileo satellite navigation system)等中的一项或多项。
示例性地,GNSS时钟信息可以包括PPS信号和GPRMC信号等;传输装置201可以将每秒接收到的一对PPS信号和GPRMC信号发送至时间同步装置202。
示例性地,软硬件接口可以包括多种时间同步接口和软件协议栈等,例如,广义精准时钟协议(Generalized Precision Time Protocol,gPTP)、控制器区域网络(Controller Area Network,CAN)接口、通用异步收发传输器(Universal Asynchronous Receiver/Transmitter,UART)串口或传感器控制中心(SensorHub)等中的一项或多项。
时间同步装置202用于接收传输装置201所发送的GNSS时钟信息,并根据GNSS时钟信息,对管理面时钟与数据面时钟进行调整,使得管理面时钟与数据面时钟均与UTC时间同步,示例性地,时间同步装置202用于通过软硬件接口周期性地接收传输装置201所发送的GNSS时钟信息,并解析得到GNSS时钟信息所指示时间;还可以通过本地接口获取本地晶振的计时信息、管理面时钟所指示时间、数据面时钟所指示时间等中的一项或多项,从而计算本地晶振相对于GNSS时钟的计时偏差率,进而根据该计时偏差率对管理面时钟及数据面时钟进行修正。作为一个示例,时间同步装置202还可以获取RTC所指示时间,并利用RTC所指示时间对数据面时钟及管理面时钟进行初始化处理,还可以对RTC进行调整,使得RTC与GNSS时钟同步。
作为一个示例,GNSS系统可以每秒下发一对PPS信号和GPRMC信号,传输装置201可以在接收到PPS信号或GPRMC信号后,通过传感器控制中心、CAN接口(或UART串口)发送至时间同步装置202;其中,传感器控制中心用于传输装置201中断信号的汇聚和上报,从而进行时间同步装置202从接收到PPS信号到接收到GPRMC信号的时间补偿,以使时间同步装置202可以每秒精确接收到一对PPS信号和GPRMC信号。时间同步装置202根据PPS信号和GPRMC信号,对管理面时钟与数据面时钟进行调整,例如,可以通过先对管理面时钟进行时间同步,然后基于数据面时钟与管 理面时钟的偏差,对管理面时钟进行时间同步,使得管理面时钟与数据面时钟均与UTC时间同步;作为另一个示例,时间同步装置202还可以通过软硬件接口,对从属于管理面时钟的管理面子时钟、从属于数据面时钟的数据面子时钟进行调整,管理面子时钟可以跟随管理面时钟,数据面子时钟可以跟随数据面时钟,以使管理面子时钟与管理面时钟同步、数据面子时钟与数据面时钟同步。
上述各示例中,具体实现过程可参见下文相关表述。
本申请实施例不限定上述时间同步装置202的类型。
示例性地,该时间同步装置202可以为车辆,或者,车辆中的其他时间同步功能的部件,例如:车载终端、车载控制器、车载模块、车载模组、车载部件、车载芯片、车载单元、车载传感器等,车辆可通过该车载终端、车载控制器、车载模块、车载模组、车载部件、车载芯片、车载单元、车载传感器等对所配置的双时钟进行同步。
示例性地,该时间同步装置202可以集成在配置有双时钟的车辆或车辆的自动驾驶系统或高级驾驶辅助系统(Advanced Driver Assistant Systems,ADAS)或车载计算平台等中,作为一个示例,时间同步装置202可以集成在车载计算平台中,例如,可以为车载计算平台中的SOC或MCU。
示例性地,该时间同步装置202还可以为除了车辆之外的其他具有时间同步能力的智能终端,或设置在智能终端中的部件或者芯片。例如,该智能终端可以为智能运输设备、智能穿戴设备、智能家居设备、智能辅助飞机、机器人(robot)或无人机(unmanned aerial vehicle)等配置有双时钟的设备。
示例性地,该时间同步装置202还可以是一个通用设备或者是一个专用设备。在具体实现中,时间同步装置202可以为台式机、便携式电脑、网络服务器、掌上电脑(personal digital assistant,PDA)、移动手机、平板电脑、无线终端设备、嵌入式设备或其他具有时间同步功能的设备,或者为这些设备内的部件或者芯片。
示例性地,该时间同步装置201还可以是具有时间同步功能的芯片或处理器,该时间同步装置201可以包括多个处理器。处理器可以是一个单核(single-CPU)处理器,也可以是一个多核(multi-CPU)处理器。示例性地,该具有时间同步功能的芯片或处理器可以设置在自动驾驶系统的任一节点中,例如,可以设置于上述图1中的主节点中等。
下面对本申请实施例提供的一种时间同步方法进行详细介绍。
图3示出根据本申请一实施例的一种时间同步方法的流程图,示例性地,该方法可以由上述图2所示的时间同步系统执行,或者由该时间同步系统的一个或多个装置执行,例如可以由时间同步装置202执行,为了便于描述,下述实施例中以由时间同步装置202执行为例进行说明;如图3所示,该方法可以包括以下步骤:
步骤301、获取当前周期数据面时钟所指示的时间与管理面时钟所指示的时间的第一偏差值。
其中,数据面时钟及管理面时钟均由第一晶振维持。例如,数据面时钟及管理面时钟可以为上述图1中主节点的数据面时钟A及管理面时钟B;第一晶振为设置于该主节点的本地晶振。
示例性地,时间同步装置可以周期性地获取数据面时钟所指示的时间与管理面时 钟所指示的时间的偏差值,当前周期可以为其中任一周期,例如,时间同步装置可以以1s为周期,在每秒内获取数据面时钟所指示的时间与管理面时钟所指示的时间的偏差值。
示例性地,时间同步装置可以计算当前周期数据面时钟所指示时间与管理面时钟所指示时间的差值,并将该差值的绝对值作为第一偏差值。
示例性地,管理面时钟可以在当前周期内已经完成与UTC时间同步;即对于同一时刻,管理面时钟所指示的时间与UTC时间一致或差异很小。
作为一个示例,时间同步装置可以在当前周期内某一时刻,获取数据面时钟所指示时间,及已经完成与UTC时间同步的管理面时钟所指示时间,并将这两个时间差值的绝对值,作为第一偏差值。
作为另一个示例,时间同步装置可以获取当前周期接收到GNSS时钟的信息时数据面时钟所指示时间,与接收到GNSS时钟的信息时管理面时钟所指示时间,并将这两个时间差值的绝对值,作为第一偏差值。例如,时间同步装置可以计算当前周期接收到PPS信号时数据面时钟所指示时间与当前周期接收到PPS信号时管理面时钟所指示时间的差值,该差值的绝对值即为第一偏差值。再例如,时间同步装置可以计算当前周期接收到GPRMC信号时数据面时钟所指示时间与当前周期接收到GPRMC信号时管理面时钟所指示时间的差值,该差值的绝对值即为第一偏差值。
示例性地,若第一偏差值不等于0,则表明当前周期数据面时钟与管理面时钟存在偏差,需要补偿,则时间同步装置执行下述步骤302;若第一偏差值等于0,则表明当前周期数据面时钟与管理面时钟无偏差,在当前周期内无需进行补偿。
步骤302、在第一偏差值大于第一阈值时,根据周期内调整幅度对当前周期内数据面时钟进行调整,所述周期内调整幅度小于或等于第一阈值。
其中,第一阈值表示周期内所允许数据面时钟跳变的最大值。可以理解是,若当前周期内数据面时钟的调整幅度大于周期内所允许数据面时钟跳变的最大值,则会造成自动驾驶系统中的时间不稳定,从而影响自动驾驶系统的平稳运行;将周期内调整幅度设定为小于或等于第一阈值,则可以在保证自动驾驶系统中的时间稳定的基础上,对数据面时钟进行调整。
示例性地,以1s为周期为例,时间同步装置可以在每秒内分别判断该秒内数据面时钟与管理面的时钟的第一偏差值,与第一阈值的相对大小;若在某一秒内,第一偏差值大于第一阈值时,则根据周期内调整幅度对该秒内数据面时钟进行调整。
作为一个示例,第一阈值可以为预配置的,例如,可以为1ms。
作为另一个示例,第一阈值还可以由应用软件变更操作模式时通知,该应用软件使用数据面时钟。示例性地,应用软件可以包括自动驾驶软件,自动驾驶软件中配置有周期内所允许数据面时钟跳变的最大值,即第一阈值;自动驾驶软件可以在退出自动驾驶模式或者进入自动驾驶模式时,主动通知时间同步装置该第一阈值。其中,自动驾驶软件在不同操作模式下,对应的第一阈值可以不同,例如,在开启自动驾驶模式下,数据面时钟对事件跳变敏感,则第一阈值可以设置为较小数值,如10ms;而在关闭自动驾驶模式下,数据面时钟对时间跳变敏感度会相应降低,则第一阈值可以设置为较大数值,如1s或者设为无穷大值等。
作为另一个示例,时间同步装置可以在每一周期主动查询自动驾驶软件中配置的周期内所允许数据面时钟跳变的最大值,进而确定第一阈值。示例性地,若当前周期内,时间同步装置无法获取自动驾驶软件中周期内所允许数据面时钟跳变的最大值,则可以将根据经验值预先设定的周期内允许数据面时钟跳变的最大值,作为第一阈值。
示例性地,若数据面时钟比管理面时钟快,则在当前周期内,按照周期内调整幅度调慢一次数据面时钟;若数据面时钟比管理面时钟慢,则在当前周期内,按照周期内调整幅度调快一次数据面时钟,从而完成当前周期内数据面时钟的调整。
示例性地,周期内调整幅度可以为预配置的,也可以由时间同步装置根据第一阈值确定;示例性地,时间同步装置可以在每一周期内,确定当前周期内的调整幅度,进而根据所确定的当前周期内的调整幅度,对当前周期内数据面时钟进行调整。可以理解的是,在当前周期对数据面时钟的调整幅度小于第一阈值,当前周期调整后的数据面时钟所指示时间与管理面时钟所指示时间依旧存在偏差,需要经过多个周期,不断调整数据面时钟,以使数据面时钟与管理面时钟同步;示例性地,时间同步装置可以根据各周期所确定的第一偏差值,确定各周期对应的周期内调整幅度;例如,若第一阈值为100ms,第一偏差值为1s,则可以通过20个周期的小幅调整,使数据面时钟与管理面时钟同步,则当前周期对应的周期内调整幅度可以为50ms;还可以通过10个周期的小幅调整,使数据面时钟与管理面时钟同步,则当前周期对应的周期内调整幅度可以为100ms。
本申请实施例中,考虑到数据面时钟用于为参与智能驾驶算法计算的数据提供时间戳,数据面时钟的稳定对维持自动驾驶系统的平稳运行至关重要,因此,在当前周期,数据面时钟所指示时间与管理面时钟所指示时间的偏差值大于周期内允许数据面时钟跳变的最大值时,时间同步装置根据周期内调整幅度对所述当前周期内所述数据面时钟进行调整,这样,采用“小步快跑”的方式,通过多个周期的持续小幅调整,使得数据面时钟与管理面时钟的偏差逐渐变小,直到数据面时钟与管理面时钟同步,且每一周期对应的周期内调整幅度均不超过周期内允许数据面时钟跳变的最大值,从而在保证自动驾驶系统中时间稳定的基础上,周期性自动补偿管理面时钟与数据面时钟的偏差,实现了数据面时钟与管理面时钟同步。由于管理面时钟可以跟随GNSS时钟,即管理面时钟所指示时间可以与UTC时间保持相同或者接近,因此,通过周期性调整,数据面时钟所指示时间可以与UTC时间保持相同或接近,避免了参与智能驾驶算法计算的数据的时间戳出现大的跳变,从而在保证自动驾驶系统中时间的稳定的基础上,实现了自动驾驶系统中时间(即管理面时钟所指示时间与数据面时钟所指示时间)与UTC时间保持相同或者接近,这样,车辆行驶过程中管理面时钟提供的时间戳与数据面时钟提供的时间戳均与UTC时间保持相同或者接近,进而保证了自动驾驶系统在V2X等场景中可靠运行,并且提高了事件分析的效率及准确性。
作为一个示例,在车辆行驶至路口时,自动驾驶系统可以与设置在路口的路侧设备建立通信连接,自动驾驶系统可以获取该路口的交通灯相关信息,如车辆所在车道对应的交通灯的时间信息;由于路侧设备、数据面时钟、管理面时钟均采用UTC时间为基准时间,自动驾驶系统可以通过准确匹配交通灯的时间信息及数据面时钟为参与智能驾驶算法计算的数据提供的时间戳,控制车辆安全通过路口,保证了自动驾驶系 统的稳定运行。作为另外一个示例;在车辆发生故障后,通过事件日志所记录的发生该故障的时间戳,可以准确查找到相匹配的参与智能驾驶算法计算的数据对应的时间戳,即可以准确获取故障发生时参与智能驾驶算法计算的数据,进而可以通过对所获取的参与智能驾驶算法计算的数据进行分析,确定故障原因,提高了故障回放分析的效率及准确性。
进一步地,考虑到在上述采用“小步快跑”的方式调整数据面时钟的过程中,通过多个周期的调整,使得数据面时钟与管理面时钟同步;在这多个周期中,数据面时钟同时会为期间参与智能驾驶算法计算的数据提供时间戳,该时间戳仍与UTC时间存在较小偏差,因此,可以对调整数据面时钟期间,数据面时钟为参与智能驾驶算法计算的数据提供的时间戳进行修正;以使修正后的时间戳与UTC时间相同或相近,从而进一步提高了事件分析的效率及准确性。
在一种可能的实现方式中,时间同步装置根据第一偏差值和/或周期内调整幅度,对由数据面时钟提供的时间戳进行修正。
示例性地,时间同步装置可以获取当前周期由数据面时钟为参与智能驾驶算法计算的数据提供的时间戳;进而根据第一偏差值和/或周期内的调整幅度,对当前周期内由数据面时钟提供的时间戳进行修正。时间同步装置可以根据第一偏差值与周期内的调整幅度的差值,确定当前周期调整后的数据面时钟提供的时间戳与UTC时间的偏差,则可以根据该偏差对当前周期调整后的数据面时钟提供的时间戳进行修正;示例性地,时间同步装置可以根据第一偏差值,确定当前周期内调整前的数据面时钟提供的时间戳与UTC时间的偏差,则可以根据该偏差对当前周期内调整前的数据面时钟提供的时间戳进行修正。
在一种可能的实现方式中,在上述步骤302中,在第一偏差值小于或等于第一阈值时,在当前周期内将数据面时钟调整为与管理面时钟同步。
其中,第一阈值可以表示周期内所允许数据面时钟跳变的最大值,由于第一偏差值小于或等于第一阈值,即当前周期内数据面时钟与管理时钟的偏差未超过周期内所允许数据面时钟跳变的最大值,时间同步装置在当前周期内将数据面时钟调整为与管理面时钟同步,数据面时钟调整幅度未超过周期内所允许数据面时钟跳变的最大值,从而可以在保证自动驾驶系统中时间稳定的基础上,实现了数据面时钟与管理面时钟同步。
这样,在第一偏差值小于或等于第一阈值时,时间同步装置采用“一步调整到位”的方式,在当前周期内将数据面时钟调整为与管理面时钟同步,实现了数据面时钟与管理面时钟的时间偏差自动补偿;由于当前周期内数据面时钟的调整幅度未超过周期内所允许数据面时钟跳变的最大值,避免了参与智能驾驶算法计算的数据的时间戳出现大的跳变,从而在保证自动驾驶系统的平稳运行的基础上,更加快捷地实现管理面时钟与数据面时钟同步。此外,由于管理面时钟可以跟随GNSS时钟,即管理面时钟所指示时间可以与UTC时间保持相同或者接近,因此,调整后的数据面时钟所指示时间可以与UTC时间保持相同或接近,从而实现了自动驾驶系统中时间与UTC时间保持相同或者接近,这样,车辆行驶过程中管理面时钟提供的时间戳与数据面时钟提供的时间戳均与UTC时间保持相同或者接近,进而保证了自动驾驶系统在V2X等场景 中可靠运行,并且提高了事件分析的效率及准确性。
图4示出根据本申请一实施例的另一种时间同步方法的流程图;如图4所示,可以包括以下步骤:
步骤401、在当前周期接收第一GNSS时钟信息。
其中,第一GNSS时钟信息可以包括以下至少一种:PPS信号和/或GPRMC信号。
示例性地,时间同步装置可以周期性地接收GNSS时钟信息,例如,可以以1秒为周期接收GNSS时钟信息。例如,时间同步装置可以每秒接收一对PPS信号和GPRMC信号。
步骤402、确认第一GNSS时钟信息满足卫星时间有效条件时,根据第一GNSS时钟信息,将管理面时钟调整为与GNSS时钟同步。
其中,卫星时间有效条件可以为预配置的,时间同步装置可以根据该预配置的卫星时间有效条件,对当前周期接收到的第一GNSS时钟信息是否满足卫星时间有效条件进行判断,并可以在确认当前周期所接收的第一GNSS时钟信息满足卫星时间有效条件时,将管理面时钟调整为与GNSS时钟同步,即实现当前周期内管理面时钟所指示时间与UTC时间的同步;示例性地,在判定当前周期所接收的第一GNSS时钟信息无效的情况下,时间同步装置可以不对当前周期内管理面时钟进行调整。
示例性地,卫星时间有效条件可以包括:GPRMC信号中指示的定位状态为“有效”,和/或,当前周期所获取的PPS信号和GPRMC信号为一对。其中,若当前周期内没有累积未处理的PPS信号或GPRMC信号、且当前周期内接收到的GPRMC信号时本地时间与接收到PPS信号时本地时间之间的间隔在预设时间范围(如500ms)内,则可判定当前周期所获取的PPS信号和GPRMC信号为一对。作为一个示例,本地时间可以包括管理面时钟所指示时间;时间同步装置可以获取当前周期接收到第一GNSS时钟信息时的管理面时钟所指示时间。例如,以周期为1秒为例,在某一秒内,时间同步装置可以获取接收到PPS信号时的管理面时钟所指示时间,及接收到GPRMC信号时的管理面时钟所指示时间;进而计算该秒内接收到GPRMC信号时管理面时钟所指示时间与接收到PPS信号时的管理面时钟所指示时间的间隔,若该间隔在预设时间范围内,且累积未处理的PPS信号或GPRMC信号,可判定该秒内所获取的PPS信号和GPRMC信号为一对。
举例来说,以时间同步装置每秒接收一对PPS信号和GPRMC信号,预设时间范围为500ms为例。图5示出根据本申请一实施例的时间同步装置接收GNSS时钟信息的示意图,如图5所示,在当前秒内,传输装置可以将所接收到的PPS1信号和GPRMC1信号发送至时间同步装置,时间同步装置接收到PPS1信号时的管理面时钟所指示时间为T10,接收到GPRMC1信号时的管理面时钟所指示时间为T11,则T10与T11的间隔为(T11-T10)。假设GPRMC1信号中的字段2=A(有效定位)满足GPRMC信号中指示的定位状态为“有效”;当前秒内除GPRMC1信号及PPS1信号以外,没有未处理的其他PPS信号或GPRMC信号,且0ms<(T11-T10)≤500ms,则可判定当前秒内接收到的PPS1信号和GPRMC1信号满足卫星时间有效条件。
在确认当前周期接收的第一GNSS时钟信息满足卫星时间有效条件后,时间同步在装置根据第一GNSS时钟信息,将管理面时钟调整为与GNSS时钟同步。
作为一个示例,时间同步装置可以在第一GNSS时钟信息中提取UTC时间信息;例如,时间同步装置在某一秒内接收到GPRMC信号后,可以提取GPRMC信号中UTC时间的时、分、秒、年、月、日信息,即UTC整秒时间;由于接收到GPRMC信号时管理面时钟所指示时间与接收到PPS信号时的管理面时钟所指示时间的间隔为毫秒级,则将该间隔与UTC整秒时间相加得到同步后的时间,管理面时钟使用该同步后的时间,从而完成将管理面时钟调整为与GNSS时钟同步。例如,如图5所示,时间同步装置提取UTC整秒时间为T,则同步后的时间为T+(T11-T10),管理面时钟使用该同步后的时间。
作为另一个示例,在时间同步装置在某一秒内接收到PPS信号后,将管理面时钟里的毫秒及毫秒以下时间清零,并由此开始计算毫秒时间;当时间同步装置在该秒内接收到GPRMC信号后,提取GPRMC信号中UTC整秒时间;将接收到PPS信号到提取GPRMC信号中UTC整秒时间所用的毫秒时间与UTC整秒时间相加得到同步后的时间,管理面时钟使用该同步后的时间,从而完成将管理面时钟调整为与GNSS时钟同步。
这样,时间同步装置可以在当前周期所接收的GNSS时钟信息满足卫星时间有效条件时,将管理面时钟调整为与GNSS时钟同步,从而避免了因采用无效的GNSS时钟信息所带来的时间同步误差,提高了时间同步的准确性。
步骤403、获取当前周期数据面时钟所指示的时间与管理面时钟所指示的时间的第一偏差值。
步骤404、在第一偏差值大于第一阈值时,根据周期内调整幅度对当前周期内数据面时钟进行调整,所述周期内调整幅度小于或等于第一阈值。
在一种可能的实现方式中,在第一偏差值小于或等于第一阈值时,在当前周期内将数据面时钟调整为与管理面时钟同步。
上述步骤403及步骤404可参照上述步骤301-302,此处不再赘述。
进一步地,在系统每次上电工作时,可以对管理面时钟及数据面时钟进行初始化处理。
示例性地,在执行上述步骤301或步骤401之前,可以通过下述方式对管理面时钟及数据面时钟进行初始化处理。
方式一、管理面时钟和数据面时钟在系统上电时可以根据系统存储的前一次下电时管理面时钟所指示的时间进行初始化。该方式中,时间同步装置可以保存系统每次下电时的管理面时钟所指示的时间,以此作为系统下次上电工作时,管理面时钟及数据面时钟的初始化时间;示例性地,在系统每次上电工作后,时间同步装置可以通过执行如上述图3或图4所示的时间同步方法,实现周期性同步管理面时钟与GNSS时钟,这样,每次下电时的管理面时钟所指示的时间可以与UTC时间保持相同或者接近,利用每次下电时的管理面时钟所指示的时间,对管理面时钟及数据面时钟进行初始化处理,从而保证时间同步装置每次上电工作时,管理面时钟和数据面时钟的初始时间的一致性,同时,保证管理面时钟和数据面时钟的初始时间与UTC时间的差异尽量小,从而有利于系统上电工作后更加快速的实现管理面时钟及数据面时钟均与UTC时间同步。
方式二、管理面时钟和数据面时钟在系统上电时根据RTC所指示时间进行初始化。其中,RTC在系统下电后仍可以工作;该方式中,在系统每次上电工作时,将RTC所指示时间作为管理面时钟及数据面时钟的初始化时间;由于RTC在系统下电后仍可以工作,这样管理面时钟及数据面时钟的初始化时间与UTC时间偏差较小,从而有利于系统上电工作后更加快速的实现管理面时钟及数据面时钟均与UTC时间同步。
示例性地,在每次上电工作后,时间同步装置可以周期性的对RTC进行时间同步,这样,对RTC与GNSS时钟进行同步,在时间同步装置每次上电工作时,RTC所指示时间与UTC时间的偏差较小。以RTC所指示时间作为管理面时钟及数据面时钟的初始化时间,从而保证时间同步装置每次上电工作时,管理面时钟和数据面时钟的初始时间的一致性,同时,保证管理面时钟和数据面时钟的初始时间与UTC时间更为接近,从而有利于系统上电工作后在避免管理面时钟及数据面时钟出现大的跳变的基础上,更加快速地实现管理面时钟及数据面时钟均与UTC时间同步。
示例性地,时间同步装置可以在确认当前周期所接收的第一GNSS时钟信息满足卫星时间有效条件时,根据第一GNSS时钟信息,将RTC调整为与GNSS时钟同步;其中,该示例中的确认当前周期所接收的第一GNSS时钟信息满足卫星时间有效条件及将RTC调整为与GNSS时钟同步的具体实现过程可以参照上述步骤302中相关表述,在此不再赘述;作为一个示例,在时间同步装置在某一秒内接收到PPS信号后,将RTC里的毫秒及毫秒以下时间清零,并由此开始计算毫秒时间;当时间同步装置在该秒内接收到GPRMC信号后,提取GPRMC信号中UTC整秒时间;在确认该秒内所接收的PPS信号和GPRMC信号满足卫星时间有效条件时,时间同步装置将接收到PPS信号到提取GPRMC信号中UTC整秒时间所用的毫秒时间与UTC整秒时间相加得到同步后的时间,RTC使用该同步后的时间,从而完成将RTC调整为与GNSS时钟同步。这样,在确保当前周期所接收的GNSS时钟信息满足卫星时间有效条件时,将RTC调整为与GNSS时钟同步,从而避免了因采用无效的GNSS时钟信息所带来的时间同步误差,提高了时间同步的准确性。
方式三、管理面时钟和数据面时钟在系统上电时可以根据预设时间(例如出厂设置时间)进行初始化。示例性地,可以在未配置RTC,且未保存上次下电时管理面时钟所指示时间的情况下,采用该预设时间对数据面时钟及管理面时钟进行初始化处理。
图6示出根据本申请一实施例的另一种时间同步方法的流程图,如图6所示,该方法可以包括以下步骤:
步骤601、确定第一晶振相对于GNSS时钟的计时偏差率。
其中,计时偏差率,又可称相位偏差率,表示第一晶振的计时相对于GNSS时钟计时的偏差率,可以理解的是,第一晶振可以基于振动的次数计时,第一晶振每振动一次,即可完成一次计时;例如,第一晶振的标准频率为10000次/秒,第一晶振振动10000次则相当于UTC时间的1秒。在实际工作中,UTC时间经过1秒,第一晶振可能仅振动了9900次或者振动了10100次,时间同步装置可以根据UTC时间经过1秒时对应的第一晶振实际振动的次数,及第一晶振的标准频率,确定第一晶振相对于GNSS时钟的计时偏差率。
在一种可能的实现方式中,为了保证所计算的计时偏差率的准确性,时间同步装 置可以获取连续N个周期的GNSS时钟信息,及时间同步装置接收该连续N个周期中各周期的GNSS时钟信息时第一晶振计时;其中,N为大于1的整数;确认N个周期的GNSS时钟信息满足卫星时间有效条件时,和/或,确认接收该N个周期中各周期的GNSS时钟信息时第一晶振计时满足稳定条件的情况下,确定第一晶振相对于GNSS时钟的计时偏差率。
示例性地,连续N个周期可以包括当前周期。
示例性地,时间同步装置可以获取各周期接收到PPS信号时的第一晶振计时,及各周期接收到GPRMC信号时的第一晶振计时。
其中,卫星时间有效条件可以参照上述步骤402中相关表述;稳定条件可以包括时间同步装置在相邻周期接收到GNSS时钟信息时第一晶振计时的间隔在预设范围内,例如,可以为时间同步装置接收到相邻周期的PPS信号时第一晶振计时的间隔在预设范围(如999ms到1001ms)内。
举例来说,以时间同步装置每秒接收一对PPS信号和GPRMC信号为例。图7示出根据本申请一实施例的时间同步装置相邻周期接收GNSS时钟信息的示意图,如图7所示,在当前秒中,传输装置可以将所接收到的PPS1信号和GPRMC1信号发送至时间同步装置,时间同步装置接收到PPS1信号时第一晶振的计时为T’10,接收到GPRMC1信号时第一晶振的计时为T’11;当前秒内除GPRMC1信号及PPS1信号以外,没有未处理的其他PPS信号或GPRMC信号,且0ms<(T’11-T’10)≤500ms,则可判定当前秒内接收到的PPS1信号和GPRMC1信号满足卫星时间有效条件。在前一秒中,传输装置将所接收到的PPS2信号和GPRMC2信号发送至时间同步装置,时间同步装置接收到PPS2信号时第一晶振的计时为T20,接收到GPRMC2信号时第一晶振的计时为T21;前一秒内除GPRMC2信号及PPS2信号以外,没有未处理的其他PPS信号或GPRMC信号,且0ms<(T21–T20)≤500ms,则可判定前一秒内接收到的PPS2信号和GPRMC2信号有效。同时,999ms≤(T20–T’10)≤1001ms,则可判定这两秒内接收到GNSS时钟信息时第一晶振计时满足稳定条件。
示例性地,在N个周期的GNSS时钟信息满足卫星时间有效条件,且接收N个周期中各周期的GNSS时钟信息时第一晶振计时满足稳定条件时,表明时间同步装置获取到有效并且稳定的GNSS时钟信息,则时间同步装置可以进一步计算第一晶振相对于GNSS时钟的计时偏差率,并保证了所确定的计时偏差率的准确性。在N个周期的GNSS时钟信息不满足卫星时间有效条件或者各周期的GNSS时钟信息时第一晶振计时不满足稳定条件的情况下,则时间同步装置不执行确定第一晶振相对于GNSS时钟的计时偏差率的操作,从而放弃本周期的晶振计时偏差补偿。
在一种可能的实现方式中,时间同步装置可以确定上述N个周期中连续的M个周期,其中,M为小于或等于N、且大于1的整数;根据接收M个周期中各周期的GNSS时钟信息时第一晶振计时,确定接收M个周期中相邻周期的GNSS时钟信息时第一晶振计时间隔;根据第一晶振计时间隔,及相邻周期的GNSS时钟信息对应的预设发送间隔,确定计时偏差率。
示例性地,时间同步装置可以选取接收M个周期中任意两个相邻周期的GNSS时钟信息时第一晶振计时,并将该任意两个相邻周期的GNSS时钟信息时第一晶振计时 的间隔作为第一晶振计时间隔;示例性地,时间同步装置可以根据接收M个周期中所有相邻周期的GNSS时钟信息时第一晶振计时的间隔,进而求取第一晶振计时的平均间隔作为第一晶振计时间隔。
示例性地,可以将预设发送间隔与第一晶振计时间隔的比值,确定为第一晶振相对于GNSS时钟的计时偏差率;还可以将第一晶振计时间隔与预设发送间隔的比值,确定为第一晶振相对于GNSS时钟的计时偏差率。作为一个示例,预设发送间隔可以为1秒,M可以取2,时间同步装置可以获取连续2秒内接收到PPS信号时第一晶振计时,则这2秒对应的第一晶振计时的差值即为接收到PPS信号的时间间隔,预设发送间隔1秒与该时间间隔的比值即为第一晶振相对于GNSS时钟的计时偏差率。
举例来说,以上述图7为例,时间同步装置在当前秒接收到PPS1信号与前一秒接收到PPS2信号的时间间隔为T20-T’10,PPS1信号与PPS2信号的发送间隔为1秒,则第一晶振相对于GNSS时钟的计时偏差率RateRatio可以表示为:RateRatio=1/(T20–T’10)。设第一晶振振动10000次对应UTC时间1秒,若T’10为第一晶振第1000次振动的计时,T20为第一晶振第11010次振动的计时,则T20–T’10为11010次振动对应的计时,可以得到计时偏差率RateRatio=10000/10010。
步骤602、根据计时偏差率,对系统时钟进行修正,该系统时钟是由第一晶振计数维持走时的。
示例性地,系统时钟可以为完成UTC时间同步的时钟;可以理解的是,系统时钟与UTC时间同步后,系统时钟所指示时间与UTC时间一致,随着时间推移,由于本地晶振的计时与GNSS时钟的计时的偏差,导致时间同步后的系统时钟所指示时间与UTC时间的偏差不断积累,可以根据该计时偏差率对完成时间同步的系统时钟所指示时间进行修正,实现晶振偏差自动补偿。
作为一个示例,系统时钟可以包括单时钟;时间同步装置可以根据计时偏差率,对由第一晶振计数维持走时的单时钟进行修正。
作为另一个示例,系统时钟可以包括管理面时钟和数据面时钟,时间同步装置可以根据计时偏差率,对由第一晶振计数维持走时的管理面时钟和数据面时钟进行修正,例如,可以根据该计时偏差率,对上述步骤301中管理面时钟或者步骤402中的管理面时钟进行修正,还可以对上述步骤302中数据面时钟或者上述步骤404中数据面时钟进行修正。
示例性地,系统时钟可以周期性地与UTC时间同步,时间同步装置可以在每一周期内均确定第一晶振相对于GNSS时钟的计时偏差率,进而对本周期内时间同步后的系统时钟所指示时间进行修正。若在某一周期内,时间同步装置未接收到GNSS时钟信息或者GNSS时钟信息不满足卫星时间有效条件和/或稳定条件,则可以利用上一周期所确定的计时偏差率,对该周期内系统时钟所指示信息进行修正;例如,在车辆行驶在隧道中时,GNSS信号持续较弱,则可以利用在车辆驶入隧道之前所确定的第一晶振相对于GNSS时钟的计时偏差率,对系统时钟进行修正,从而避免在长时间持续运行中系统时钟所指示时间与UTC时间出现较大的偏差,保证自动驾驶系统的稳定可靠运行。
可以理解的是,在第一晶振相对于GNSS时钟的计时偏差率大于1的情况下,表 明第一晶振每次振动的计时相对于UTC时间更慢,则需要将系统时钟所指示时间调快;在第一晶振相对于GNSS时钟的计时偏差率小于1的情况下,表明第一晶振每次振动的计时相对于UTC时间更快,则需要将系统时钟所指示时间调慢;在第一晶振相对于GNSS时钟的计时偏差率等于1的情况下,表明第一晶振每次振动的计时与UTC时间一致,则无需修正系统时钟。
示例性地,时间同步装置可以将系统时钟所指示时间与计时偏差率相乘,从而得到修正后的系统时钟所指示时间。例如,若计时偏差率RateRatio=10000/10010,表明第一晶振每次振动的计时相对于UTC时间更快,计算系统时钟所指示时间与该计时偏差率的乘积,得到调慢后的系统时钟所指示时间。这样,修正后的系统时钟所指示时间可以在微秒级维持与UTC时间一致,从而进一步提高了时间同步精度。
本申请实施例中,时间同步装置可以确定第一晶振相对于GNSS时钟的计时偏差率;并根据该计时偏差率,对系统时钟进行修正,实现晶振计时偏差自动补偿,进一步提高时间同步的精度,同时,避免了系统时钟所指示时间与UTC时间持续出现较大偏差,保证了自动驾驶系统的稳定可靠运行。
在一种可能的实现方式中,在确认第一晶振相对于GNSS时钟的计时偏差率异常时,发出提示信息,该提示信息用于提示第一晶振故障。
可以理解的是,若第一晶振故障,可能造成第一晶振相对于GNSS时钟的计时偏差率异常大或异常小,时间同步装置可以在确认计时偏差率异常时发出提示信息,以便提示第一晶振故障。
示例性地,时间同步装置可以根据预设范围,判定计时偏差率是否异常;例如,可以在第一晶振相对于GNSS时钟的计时偏差率超出预设范围的情况下,确认计时偏差率异常,从而可以发出提示信息,以便提示第一晶振故障。其中,预设范围可以根据实际需求进行设定,例如,预设范围的上下限可以分别设置为1.1和0.9。
示例性地,为了排除计算偶然误差,保证提示信息的准确性,时间同步装置可以比较两个或多个周期计算的计时偏差率是否超出预设范围,并可以在两个或多个周期计算的第一晶振相对于GNSS时钟的计时偏差率均超出预设范围时,发出上述提示信息。
进一步地,在自动驾驶系统中配置有从属于系统时钟的系统子时钟的情况下,时间同步装置可以根据系统时钟,将从属于系统时钟的至少一个系统子时钟调整为与系统时钟同步。其中,系统时钟可以为完成UTC时间同步的系统时钟和/或完成晶振计时偏差补偿的系统时钟,例如,可以为上述步骤602中系统时钟。这样,系统子时钟跟随系统时钟,通过调整,各系统子时钟均可以与UTC时间保持相同或者接近,从而保证系统子时钟所在功能节点的稳定运行。
作为一个示例,系统时钟可以包括单时钟,系统子时钟可以包括从属于该单时钟的子时钟。
作为另一个示例,系统时钟可以包括管理面时钟和数据面时钟,系统子时钟可以包括从属于数据面时钟的数据面子时钟,或者从属于管理面时钟的管理面子时钟。例如,管理面子时钟可以为上述图1中的管理面子时钟a1、a2…aN;数据面子时钟可以为上述图1中的数据面子时钟b1、b2…bN。
在一种可能的实现方式中,时间同步装置可以根据管理面时钟,将从属于管理面时钟的至少一个管理面子时钟调整为与管理面时钟同步;根据数据面时钟,将从属于数据面时钟的至少一个数据面子时钟调整为与数据面时钟同步。示例性地,管理面时钟及数据面时钟可以为完成UTC时间同步的时钟,例如,管理面时钟可以为上述步骤301中管理面时钟或者步骤402中的管理面时钟,数据面时钟可以为上述步骤302中数据面时钟或者上述步骤404中数据面时钟。这样,管理面子时钟跟随管理面时钟,数据面子时钟跟随数据面时钟,通过调整,各数据面子时钟及管理面子时钟均可以与UTC时间保持相同或者接近,从而保证数据面子时钟及管理面子时钟所在功能节点的稳定运行。
示例性地,时间同步装置可以每调整一次管理面时钟,相应调整一次从属于管理面时钟的管理面子时钟,且各管理面子时钟调整的幅度与管理面时钟所调整的幅度一致。同理,时间同步装置可以在每调整一次数据面时钟,相应调整一次从属于数据面时钟的数据面子时钟,且各数据面子时钟调整的幅度与数据面时钟所调整的幅度一致。
下面分别以时间同步装置为车载计算平台中的SOC或MCU,系统时钟包括管理面时钟及数据面时钟为例,对上述时间同步方法的实现过程进行示例性说明。
作为一个示例,时间同步装置为车载计算平台中的SOC。图8示出根据本申请一实施例的SOC进行时间同步的示意图,如图8所示,SOC通过接口获取INS传感器发送的GNSS时钟信息,并通过执行上述实施例所示的时间同步方法,实现管理面时钟与数据面时钟的同步。
示例性地,SOC可以在系统每次上电时,对数据面时钟及管理面时钟进行初始化处理,并读取预先设置的配置项;其中,管理面时钟和数据面时钟在系统上电启动时根据系统存储的前一次下电时管理面时钟所指示的时间进行初始化;或者,根据RTC所指示时间进行初始化;数据面时钟及管理面时钟均由设置于SOC的本地晶振计数维持走时。预先设置的配置项可以包括以下中的一项或多项:周期内允许数据面时钟跳变的最大值为1ms;自动驾驶系统在自动驾驶模式下周期内所允许数据面时钟跳变的最大值为10ms;卫星时间有效条件为GPRMC信号中的状态为“有效”,且本周期的PPS信号和GPRMC信号是一对,即不能有累计未处理的PPS信号或GPRMC信号,且本周期接收到的GPRMC信号的本地时间与匹配的接收到PPS信号的本地时间的间隔在500毫秒以内;计算本地晶振与相对于GNSS时钟的计时偏差率的条件为:连续2个或超过2个周期获取的GNSS时钟信息满足卫星时间有效条件、以及接收到的前后2周期的PPS时间的间隔稳定在999ms到1001ms以内。
示例性地,图9示出根据本申请一实施例的SOC进行晶振计时偏差补偿的流程图,如图9所示,SOC周期性地获取GNSS时钟信息,进而在每一周期判断所接收的GNSS时钟信息是否满足卫星时间有效条件,若满足卫星时间有效条件则进行本周期内管理面时钟与GNSS时钟的同步,以及RTC与GNSS时钟的同步;若不满足卫星时间有效条件,则本周期内不进行时间同步。进而,在管理面时钟及RTC均与GNSS时钟精确同步之后,判断是否符合计算本地晶振与相对于GNSS时钟的计时偏差率的条件,若符合则计算本地晶振相对于GNSS时钟的计时偏差率,并根据该计时偏差率对管理面时钟和数据面时钟进行晶振计时偏差补偿。
示例性地,图10示出根据本申请一实施例的SOC进行时间同步的流程图,如图10所示,SOC可以周期性比对数据面时钟所指示和管理面时钟所指示时间偏差的绝对值,即偏差值。若偏差值等于0,则表明数据面时钟与管理面时钟无偏差,则本周期无需进行同步;若偏差值大于0,则记录数据面时钟所指示时间以及上述偏差值。SOC获取当前周期所允许数据面时钟跳变的最大值,若上述偏差值小于或等于当前周期所允许数据面时钟跳变的最大值,则在当前周期内将数据面时钟与管理面时钟同步,并记录当前周期对应的调整幅度以及上述偏差值;如果上述偏差值大于当前周期所允许数据面时钟跳变的最大值,则SOC根据当前周期对应的调整幅度微调数据面时钟,并记录当前周期对应的调整幅度以及上述偏差值,进而SOC可以通过持续多个周期的小幅调整,使数据面时钟和管理面时钟偏差逐渐变小,直到数据面时钟与管理面时钟同步。
作为另一个示例,以时间同步装置为车载计算平台中的MCU为例。图11示出根据本申请一实施例的MCU进行时间同步的示意图,如图11所示,MCU通过CAN或UART接口获取INS传感器发送的GNSS时钟信息,并通过执行上述实施例所示的时间同步方法,实现管理面时钟与数据面时钟的同步。其中,MCU可以向目标应用(如自动驾驶系统)周期性反馈数据面时钟所指示时间与管理面时钟所指示时间的偏差值,SOC中应用(如定值工具MDC TOOLS)用于接收目标应用的请求,并根据请求调用不同的API接口(即图中API1和API2),通知MCU(如时间同步工具TSYNC CP)对数据面时钟及管理面时钟进行同步,复杂可编程逻辑装置(complex programmable logic device,CPLD)用于存储管理面时钟及数据面时钟的信息。MCU利用每次收到的GNSS时钟信息,将管理面时钟的PPS相位与GNSS时钟信息中PPS相位同步,管理面时钟所指示时间与UTC时间同步;并基于所调用的API接口,采用一步调整到位的方式,或者小步快跑的方式,实现数据面时钟与管理面时钟的时间同步,避免数据面时钟出现大的时间跳变。
示例性地,图12示出根据本申请一实施例的MCU进行时间同步的流程图,如图12所示,在自动驾驶模式未开启的情况下,若GNSS时钟信息满足卫星时间有效条件,则自动驾驶系统可以调用API1接口,采用一步调整到位的方式实现数据面时钟和管理面时钟的初次同步,将数据面时钟与管理面时钟之间的偏差值缩小到ms级。在自动驾驶模式开启的情况下,首先判断数据面时钟和管理面时钟是否完成初次同步,若未完成,则在GNSS时钟信息满足卫星时间有效条件的情况下调用API1接口进行初次同步;若完成了初次同步,则MCU周期性比对数据面时钟所指示时间与管理面时钟所指示时间的偏差值并上报到自动驾驶系统,若该偏差值未超过当前周期所允许数据面时钟跳变的最大值,则等待进入下一周期重复执行上述判断自动驾驶模式是否开启及之后的操作;若该偏差值超过当前周期所允许数据面时钟跳变的最大值,则自动驾驶系统调用API2接口通过小步快跑的方式,经过多个周期的小幅调整,实现数据面时钟与管理面时钟的同步。
示例性地,图13示出根据本申请一实施例的调用API1接口进行时间同步的流程图,如图13所示,API1接口默认允许数据面时钟进行大的时间跳变。在数据面时钟与管理面时钟进行初次同步时,自动驾驶系统调用API1接口,通过SOC发送消息通 知到MCU,然后由MCU发送通用型输入输出(General Purpose Input/Output,GPIO)信号到CPLD,从而通知CPLD将数据面时钟pps相位对齐管理面时钟pps的相位,MCU判断数据面时钟pps相位与管理面时钟pps相位对齐后,获取UTC时间,对数据面时钟所指示的时间进行调整,实现数据面时钟与管理面时钟的同步。
示例性地,图14示出根据本申请一实施例的调用API2接口进行时间同步的流程图,如图14所示,API2接口默认只允许数据面时钟进行小幅调整。在数据面时钟所指示时间与管理面时钟所指示时间的偏差值大于当前周期所允许数据面时钟跳变的最大值的情况下,自动驾驶系统调用API2接口,通过SOC发送消息通知到MCU,然后由MCU根据管理面时钟pps相位和数据面时钟pps相位的相位差,分多个周期(如小于500ms)写入CPLD寄存器,然后由CPLD根据写入寄存器的相位偏差值对数据面时钟的pps相位进行校准;MCU根据每个周期对应的周期内调整幅度,对数据面时钟所指示时间进行调整,从而以小步快跑的方式,经过多个周期的小幅调整,实现数据面时钟与管理面时钟的同步。
基于上述方法实施例的同一发明构思,本申请的实施例还提供了一种时间同步装置,该时间同步装置用于执行上述方法实施例所描述的技术方案。例如,可以执行上述图3、图4、图6、图9、图10、图12、图13或图14中任一所示方法的各步骤。
图15示出根据本申请一实施例的一种时间同步装置的结构图,如图15所示,该时间同步装置,可以包括:第一模块1501,用于获取当前周期数据面时钟所指示的时间与管理面时钟所指示的时间的第一偏差值;第二模块1502,用于在所述第一偏差值大于第一阈值时,根据周期内调整幅度对所述当前周期内所述数据面时钟进行调整,所述周期内调整幅度小于或等于所述第一阈值。
基于上述技术方案,第一阈值可以表示周期内所允许数据面时钟跳变的最大值,在第一偏差值大于第一阈值时,根据周期内调整幅度对所述当前周期内所述数据面时钟进行调整,这样,采用“小步快跑”的方式,通过多个周期的调整,使得数据面时钟与管理面时钟的偏差逐渐减小直到同步,且每一周期对应的调整幅度均不超过第一阈值,从而在保证自动驾驶系统中时间稳定的基础上,实现了数据面时钟与管理面时钟同步。由于管理面时钟可以跟随GNSS时钟,即管理面时钟所指示时间可以与UTC时间保持相同或者接近,因此,通过周期性调整,数据面时钟所指示时间可以与UTC时间保持相同或接近,从而在保证自动驾驶系统中时间的稳定的基础上,实现了自动驾驶系统中时间与UTC时间保持相同或者接近,这样,车辆行驶过程中管理面时钟提供的时间戳与数据面时钟提供的时间戳均与UTC时间保持相同或者接近,进而保证了自动驾驶系统在V2X等场景中可靠运行,并且提高了事件分析的效率及准确性。
在一种可能的实现方式,所述第二模块1502还用于:在所述第一偏差值小于或等于所述第一阈值时,在所述当前周期内将所述数据面时钟调整为与所述管理面时钟同步。
在一种可能的实现方式,所述第二模块1502还用于:根据所述第一偏差值和/或所述周期内调整幅度,对由所述数据面时钟提供的时间戳进行修正。
在一种可能的实现方式,所述第一阈值为预配置的;或所述第一阈值由应用软件变更操作模式时通知,所述应用软件使用所述数据面时钟。
在一种可能的实现方式,所述管理面时钟和所述数据面时钟在系统上电时根据所述系统存储的前一次下电时所述管理面时钟所指示的时间进行初始化;或者,根据实时时钟RTC所指示时间进行初始化。
在一种可能的实现方式,所述第二模块1502还用于:在所述当前周期接收第一GNSS时钟信息,所述第一GNSS时钟信息包括以下至少一种:秒脉冲PPS和/或推荐定位信息GPRMC;确认所述第一GNSS时钟信息满足卫星时间有效条件时,根据所述第一GNSS时钟信息,将所述管理面时钟调整为与所述GNSS时钟同步。
在一种可能的实现方式,所述第二模块1502还用于:确认所述第一GNSS时钟信息满足卫星时间有效条件时,根据所述第一GNSS时钟信息,将RTC调整为与所述GNSS时钟同步。
在一种可能的实现方式,所述第二模块1502还用于:根据所述管理面时钟,将从属于所述管理面时钟的至少一个管理面子时钟调整为与所述管理面时钟同步;根据所述数据面时钟,将从属于所述数据面时钟的至少一个数据面子时钟调整为与所述数据面时钟同步。
在一种可能的实现方式,所述第二模块1502还用于:确定第一晶振相对于GNSS时钟的计时偏差率;根据所述计时偏差率,对所述管理面时钟和所述数据面时钟进行修正,所述管理面时钟和所述数据面时钟是由所述第一晶振计数维持走时的。
在一种可能的实现方式,所述第二模块1502还用于:获取连续N个周期的GNSS时钟信息,及接收所述N个周期中各周期的GNSS时钟信息时所述第一晶振计时;其中,N为大于1的整数;确认所述N个周期的GNSS时钟信息满足卫星时间有效条件时,和/或,确认接收所述N个周期中各周期的GNSS时钟信息时所述第一晶振计时满足稳定条件时,确定所述计时偏差率。
在一种可能的实现方式,所述第二模块1502还用于:确定所述N个周期中连续的M个周期,其中,M为小于或等于N、且大于1的整数;根据接收所述M个周期中各周期的GNSS时钟信息时所述第一晶振计时,确定接收所述M个周期中相邻周期的GNSS时钟信息时所述第一晶振计时间隔;根据所述第一晶振计时间隔,及所述相邻周期的GNSS时钟信息对应的预设发送间隔,确定所述计时偏差率。
在一种可能的实现方式,所述第二模块1502还用于:确认所述计时偏差率异常时,发出提示信息,所述提示信息用于提示所述第一晶振故障。
图16示出根据本申请一实施例的另一种时间同步装置的结构图,如图16所示,该时间同步装置,可以包括:第三模块1601,用于确定第一晶振相对于GNSS时钟的计时偏差率;第四模块1602,用于根据所述计时偏差率,对系统时钟进行修正,所述系统时钟是由所述第一晶振计数维持走时的。
本申请实施例中,确定第一晶振相对于GNSS时钟的计时偏差率,并根据该计时偏差率,对管理面时钟及数据面时钟进行修正,实现自动补偿管理面时钟及数据面时钟的晶振偏差。
在一种可能的实现方式中,所述系统时钟包括:管理面时钟和数据面时钟。
在一种可能的实现方式中,所述第三模块1601还用于:获取连续N个周期的GNSS时钟信息,及接收所述N个周期中各周期的GNSS时钟信息时所述第一晶振计时;其 中,N为大于1的整数;确认所述N个周期的GNSS时钟信息满足卫星时间有效条件时,和/或,确认接收所述N个周期中各周期的GNSS时钟信息时所述第一晶振计时满足稳定条件时,确定所述计时偏差率。
在一种可能的实现方式中,所述第三模块1601还用于:确定所述N个周期中连续的M个周期,其中,M为小于或等于N、且大于1的整数;获取接收所述M个周期中各周期的GNSS时钟信息时所述第一晶振计时,确定接收所述M个周期中相邻周期的GNSS时钟信息时所述第一晶振计时间隔;根据所述第一晶振计时间隔,及所述相邻周期的GNSS时钟信息对应的预设发送间隔,确定所述计时偏差率。
在一种可能的实现方式中,所述第四模块1602还用于:确认所述计时偏差率异常时,发出提示信息,所述提示信息用于提示所述第一晶振故障。
在一种可能的实现方式中,所述系统时钟在系统上电时根据所述系统存储的前一次下电时管理面时钟所指示的时间进行初始化;或者,根据实时时钟RTC所指示时间进行初始化。
在一种可能的实现方式中,所述第四模块1602还用于:在当前周期接收第一GNSS时钟信息,所述第一GNSS时钟信息包括以下至少一种:秒脉冲PPS和/或推荐定位信息GPRMC;确认所述第一GNSS时钟信息满足卫星时间有效条件时,根据所述第一GNSS时钟信息,将所述管理面时钟调整为与所述GNSS时钟同步。
在一种可能的实现方式中,所述第四模块1602还用于:确认所述第一GNSS时钟信息满足卫星时间有效条件时,根据所述第一GNSS时钟信息,将RTC调整为与所述GNSS时钟同步。
在一种可能的实现方式中,所述第四模块1602还用于:获取当前周期所述数据面时钟所指示的时间与所述管理面时钟所指示的时间的第一偏差值;在所述第一偏差值大于第一阈值时,根据周期内调整幅度对所述当前周期内所述数据面时钟进行调整,所述周期内调整幅度小于或等于所述第一阈值。
在一种可能的实现方式中,所述第四模块1602还用于:在所述第一偏差值小于或等于所述第一阈值时,在所述当前周期内将所述数据面时钟调整为与所述管理面时钟同步。
在一种可能的实现方式中,所述第四模块1602还用于:根据所述第一偏差值和/或所述周期内调整幅度,对由所述数据面时钟提供的时间戳进行修正。
在一种可能的实现方式中,所述第一阈值为预配置的;或所述第一阈值由应用软件变更操作模式时通知,所述应用软件使用所述数据面时钟。
在一种可能的实现方式中,所述第四模块1602还用于:根据系统时钟,将从属于所述系统时钟的至少一个系统子时钟调整为与所述系统面时钟同步。
上述图15或16所示的时间同步装置及其各种可能的实现方式的技术效果及具体描述可参见上述时间同步方法,此处不再赘述。
应理解以上装置中各模块的划分仅是一种逻辑功能的划分,实际实现时可以全部或部分集成到一个物理实体上,也可以物理上分开。此外,装置中的模块可以以处理器调用软件的形式实现;例如装置包括处理器,处理器与存储器连接,存储器中存储有指令,处理器调用存储器中存储的指令,以实现以上任一种方法或实现该装置各模 块的功能,其中处理器例如为通用处理器,例如中央处理单元(Central Processing Unit,CPU)或微处理器,存储器为装置内的存储器或装置外的存储器。或者,装置中的模块可以以硬件电路的形式实现,可以通过对硬件电路的设计实现部分或全部模块的功能,该硬件电路可以理解为一个或多个处理器;例如,在一种实现中,该硬件电路为专用集成电路(application-specific integrated circuit,ASIC),通过对电路内元件逻辑关系的设计,实现以上部分或全部模块的功能;再如,在另一种实现中,该硬件电路为可以通过可编程逻辑器件(programmable logic device,PLD)实现,以现场可编程门阵列(Field Programmable Gate Array,FPGA)为例,其可以包括大量逻辑门电路,通过配置文件来配置逻辑门电路之间的连接关系,从而实现以上部分或全部模块的功能。以上装置的所有模块可以全部通过处理器调用软件的形式实现,或全部通过硬件电路的形式实现,或部分通过处理器调用软件的形式实现,剩余部分通过硬件电路的形式实现。
在本申请实施例中,处理器是一种具有信号的处理能力的电路,在一种实现中,处理器可以是具有指令读取与运行能力的电路,例如CPU、微处理器、图形处理器(graphics processing unit,GPU)(可以理解为一种微处理器)、或数字信号处理器(digital signal processor,DSP)等;在另一种实现中,处理器可以通过硬件电路的逻辑关系实现一定功能,该硬件电路的逻辑关系是固定的或可以重构的,例如处理器为ASIC或PLD实现的硬件电路,例如FPGA。在可重构的硬件电路中,处理器加载配置文档,实现硬件电路配置的过程,可以理解为处理器加载指令,以实现以上部分或全部模块的功能的过程。
可见,以上装置中的各模块可以是被配置成实施以上方法的一个或多个处理器(或处理电路),例如:CPU、GPU、微处理器、DSP、ASIC、FPGA,或这些处理器形式中至少两种的组合。
此外,以上装置中的各模块可以全部或部分可以集成在一起,或者可以独立实现。在一种实现中,这些模块集成在一起,以SOC的形式实现。该SOC中可以包括至少一个处理器,用于实现以上任一种方法或实现该装置各模块的功能,该至少一个处理器的种类可以不同,例如包括CPU和FPGA,CPU和人工智能处理器,CPU和GPU等。
本申请的实施例提供了时间同步装置,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为执行所述指令时实现上述实施例的方法。示例性地,可以实现上述图3、图4、图6、图9、图10、图12、图13或图14中任一所示方法的各步骤。
图17示出根据本申请一实施例的一种时间同步装置的结构示意图,如图17所示,该时间同步装置可以包括:至少一个处理器1701,通信线路1702,存储器1703以及至少一个通信接口1704。
处理器1701可以是一个通用中央处理器(central processing unit,CPU),微处理器,特定应用集成电路(application-specific integrated circuit,ASIC),或一个或多个用于控制本申请方案程序执行的集成电路。
通信线路1702可包括一通路,在上述组件之间传送信息。
通信接口1704,使用任何收发器一类的装置,用于与其他设备或通信网络通信,如以太网,RAN,无线局域网(wireless local area networks,WLAN)等。
存储器1703可以是只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)或者可存储信息和指令的其他类型的动态存储设备,也可以是电可擦可编程只读存储器(electrically erasable programmable read-only memory,EEPROM)、只读光盘(compact disc read-only memory,CD-ROM)或其他光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。存储器可以是独立存在,通过通信线路1702与处理器相连接。存储器也可以和处理器集成在一起。本申请实施例提供的存储器通常可以具有非易失性。其中,存储器1703用于存储执行本申请方案的计算机执行指令,并由处理器1701来控制执行。处理器1701用于执行存储器1703中存储的计算机执行指令,从而实现本申请上述实施例中提供的方法。示例性地,可以实现上述图3、图4、图6、图9、图10、图12、图13或图14中任一所示方法的各步骤。
可选的,本申请实施例中的计算机执行指令也可以称之为应用程序代码,本申请实施例对此不作具体限定。
示例性地,处理器1701可以包括一个或多个CPU,例如图17中的CPU0和CPU1。
示例性地,时间同步装置可以包括多个处理器,例如图17中的处理器1701和处理器1707。这些处理器中的每一个可以是一个单核(single-CPU)处理器,也可以是一个多核(multi-CPU)处理器。这里的处理器可以指一个或多个设备、电路、和/或用于处理数据(例如计算机程序指令)的处理核。
在具体实现中,作为一种实施例,时间同步装置还可以包括输出设备1705和输入设备1706。输出设备1705和处理器1701通信,可以以多种方式来显示信息。例如,输出设备1705可以是液晶显示器(liquid crystal display,LCD),发光二级管(light emitting diode,LED)显示设备,阴极射线管(cathode ray tube,CRT)显示设备,或投影仪(projector)等。输入设备1706和处理器1701通信,可以以多种方式接收用户的输入。例如,输入设备1706可以是鼠标、键盘、触摸屏设备或传感设备等。
作为一个示例,结合图17所示的时间同步装置,上述图15中的第一模块1501可以由图17中的通信接口1704来实现;上述图15中的第二模块1502可以由图17中的处理器1701来实现。
作为另一个示例,结合图17所示的时间同步装置,上述图16中的第三模块1601及第四模块1602可以由图17中的处理器1701来实现。
本申请的实施例提供了一种时间同步系统,包括:用于接收GNSS时钟信息的传输装置,及上述图15、图16或图17中的任一时间同步装置。
本申请的实施例提供了一种车辆,包括:上述图15、图16或图17中的任一时间同步装置,或者上述时间同步系统。
本申请的实施例提供了一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现上述实施例中的方法。示例性地,可以实现 上述图3、图4、图6、图9、图10、图12、图13或图14中任一所示方法的各步骤。
本申请的实施例提供了一种计算机程序产品,包括计算机可读代码,或者承载有计算机可读代码的非易失性计算机可读存储介质,当所述计算机可读代码在电子设备的处理器中运行时,所述电子设备中的处理器执行上述实施例中的方法。示例性地,可以实现上述图3、图4、图6、图9、图10、图12、图13或图14中任一所示方法的各步骤。
计算机可读存储介质可以是可以保持和存储由指令执行设备使用的指令的有形设备。计算机可读存储介质例如可以是――但不限于――电存储设备、磁存储设备、光存储设备、电磁存储设备、半导体存储设备或者上述的任意合适的组合。计算机可读存储介质的更具体的例子(非穷举的列表)包括:便携式计算机盘、硬盘、随机存取存储器(Random Access Memory,RAM)、只读存储器(Read Only Memory,ROM)、可擦式可编程只读存储器(Electrically Programmable Read-Only-Memory,EPROM或闪存)、静态随机存取存储器(Static Random-Access Memory,SRAM)、便携式压缩盘只读存储器(Compact Disc Read-Only Memory,CD-ROM)、数字多功能盘(Digital Video Disc,DVD)、记忆棒、软盘、机械编码设备、例如其上存储有指令的打孔卡或凹槽内凸起结构、以及上述的任意合适的组合。
这里所描述的计算机可读程序指令或代码可以从计算机可读存储介质下载到各个计算/处理设备,或者通过网络、例如因特网、局域网、广域网和/或无线网下载到外部计算机或外部存储设备。网络可以包括铜传输电缆、光纤传输、无线传输、路由器、防火墙、交换机、网关计算机和/或边缘服务器。每个计算/处理设备中的网络适配卡或者网络接口从网络接收计算机可读程序指令,并转发该计算机可读程序指令,以供存储在各个计算/处理设备中的计算机可读存储介质中。
用于执行本申请操作的计算机程序指令可以是汇编指令、指令集架构(Instruction Set Architecture,ISA)指令、机器指令、机器相关指令、微代码、固件指令、状态设置数据、或者以一种或多种编程语言的任意组合编写的源代码或目标代码,所述编程语言包括面向对象的编程语言—诸如Smalltalk、C++等,以及常规的过程式编程语言—诸如“如“语言或类似的编程语言。计算机可读程序指令可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络—包括局域网(Local Area Network,LAN)或广域网(Wide Area Network,WAN)e连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。在一些实施例中,通过利用计算机可读程序指令的状态信息来个性化定制电子电路,例如可编程逻辑电路、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或可编程逻辑阵列(Programmable Logic Array,PLA),该电子电路可以执行计算机可读程序指令,从而实现本申请的各个方面。
这里参照根据本申请实施例的方法、装置(系统)和计算机程序产品的流程图和/或框图描述了本申请的各个方面。应当理解,流程图和/或框图的每个方框以及流程图和/或框图中各方框的组合,都可以由计算机可读程序指令实现。
这些计算机可读程序指令可以提供给通用计算机、专用计算机或其它可编程数据处理装置的处理器,从而生产出一种机器,使得这些指令在通过计算机或其它可编程数据处理装置的处理器执行时,产生了实现流程图和/或框图中的一个或多个方框中规定的功能/动作的装置。也可以把这些计算机可读程序指令存储在计算机可读存储介质中,这些指令使得计算机、可编程数据处理装置和/或其他设备以特定方式工作,从而,存储有指令的计算机可读介质则包括一个制造品,其包括实现流程图和/或框图中的一个或多个方框中规定的功能/动作的各个方面的指令。
也可以把计算机可读程序指令加载到计算机、其它可编程数据处理装置、或其它设备上,使得在计算机、其它可编程数据处理装置或其它设备上执行一系列操作步骤,以产生计算机实现的过程,从而使得在计算机、其它可编程数据处理装置、或其它设备上执行的指令实现流程图和/或框图中的一个或多个方框中规定的功能/动作。
附图中的流程图和框图显示了根据本申请的多个实施例的装置、系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或指令的一部分,所述模块、程序段或指令的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。
也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行相应的功能或动作的硬件(例如电路或ASIC(Application Specific Integrated Circuit,专用集成电路))来实现,或者可以用硬件和软件的组合,如固件等来实现。
尽管在此结合各实施例对本发明进行了描述,然而,在实施所要求保护的本发明过程中,本领域技术人员通过查看所述附图、公开内容、以及所附权利要求书,可理解并实现所述公开实施例的其它变化。在权利要求中,“包括”(comprising)一词不排除其他组成部分或步骤,“一”或“一个”不排除多个的情况。单个处理器或其它单元可以实现权利要求中列举的若干项功能。相互不同的从属权利要求中记载了某些措施,但这并不表示这些措施不能组合起来产生良好的效果。
在本申请的各个实施例中,如果没有特殊说明以及逻辑冲突,各个实施例之间的术语和/或描述具有一致性、且可以相互引用,不同的实施例中的技术特征根据其内在的逻辑关系可以组合形成新的实施例。
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以所述权利要求的保护范围为准。
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。
Claims (32)
- 一种时间同步方法,其特征在于,所述方法包括:获取当前周期数据面时钟所指示的时间与管理面时钟所指示的时间的第一偏差值;在所述第一偏差值大于第一阈值时,根据周期内调整幅度对所述当前周期内所述数据面时钟进行调整,所述周期内调整幅度小于或等于所述第一阈值。
- 根据权利要求1所述的方法,其特征在于,所述方法还包括:在所述第一偏差值小于或等于所述第一阈值时,在所述当前周期内将所述数据面时钟调整为与所述管理面时钟同步。
- 根据权利要求1或2所述的方法,其特征在于,所述方法还包括:根据所述第一偏差值和/或所述周期内调整幅度,对由所述数据面时钟提供的时间戳进行修正。
- 根据权利要求1-3中任一项所述的方法,其特征在于,所述第一阈值为预配置的;或所述第一阈值由应用软件变更操作模式时通知,所述应用软件使用所述数据面时钟。
- 根据权利要求1-4中任一项所述的方法,其特征在于,所述管理面时钟和所述数据面时钟在系统上电时根据所述系统存储的前一次下电时所述管理面时钟所指示的时间进行初始化;或者,根据实时时钟RTC所指示时间进行初始化。
- 根据权利要求1-5中任一项所述的方法,其特征在于,所述方法还包括:在所述当前周期接收第一全球导航卫星系统GNSS时钟信息,所述第一GNSS时钟信息包括以下至少一种:秒脉冲PPS和/或推荐定位信息GPRMC;确认所述第一GNSS时钟信息满足卫星时间有效条件时,根据所述第一GNSS时钟信息,将所述管理面时钟调整为与所述GNSS时钟同步。
- 根据权利要求6所述的方法,其特征在于,所述方法还包括:确认所述第一GNSS时钟信息满足卫星时间有效条件时,根据所述第一GNSS时钟信息,将RTC调整为与所述GNSS时钟同步。
- 根据权利要求1-7中任一项所述的方法,其特征在于,所述方法还包括:根据所述管理面时钟,将从属于所述管理面时钟的至少一个管理面子时钟调整为与所述管理面时钟同步;根据所述数据面时钟,将从属于所述数据面时钟的至少一个数据面子时钟调整为与所述数据面时钟同步。
- 根据权利要求1-8中任一项所述的方法,其特征在于,所述方法还包括:确定第一晶振相对于GNSS时钟的计时偏差率;根据所述计时偏差率,对所述管理面时钟和所述数据面时钟进行修正,所述管理面时钟和所述数据面时钟是由所述第一晶振计数维持走时的。
- 根据权利要求9所述的方法,其特征在于,所述确定第一晶振相对于GNSS时钟的计时偏差率,包括:获取连续N个周期的GNSS时钟信息,及接收所述N个周期中各周期的GNSS时钟信息时所述第一晶振计时;其中,N为大于1的整数;确认所述N个周期的GNSS时钟信息满足卫星时间有效条件时,和/或,确认接收所述N个周期中各周期的GNSS时钟信息时所述第一晶振计时满足稳定条件时,确定所述计时偏差率。
- 根据权利要求10所述的方法,其特征在于,所述确定所述计时偏差率,包括:确定所述N个周期中连续的M个周期,其中,M为小于或等于N、且大于1的整数;根据接收所述M个周期中各周期的GNSS时钟信息时所述第一晶振计时,确定接收所述M个周期中相邻周期的GNSS时钟信息时所述第一晶振计时间隔;根据所述第一晶振计时间隔,及所述相邻周期的GNSS时钟信息对应的预设发送间隔,确定所述计时偏差率。
- 根据权利要求9-11中任一项所述的方法,其特征在于,所述方法还包括:确认所述计时偏差率异常时,发出提示信息,所述提示信息用于提示所述第一晶振故障。
- 一种时间同步方法,其特征在于,所述方法包括:确定第一晶振相对于全球导航卫星系统GNSS时钟的计时偏差率;根据所述计时偏差率,对系统时钟进行修正,所述系统时钟是由所述第一晶振计数维持走时的。
- 根据权利要求13所述的方法,其特征在于,所述系统时钟包括:管理面时钟和数据面时钟。
- 根据权利要求13或14所述的方法,其特征在于,所述确定第一晶振相对于GNSS时钟的计时偏差率,包括:获取连续N个周期的GNSS时钟信息,及接收所述N个周期中各周期的GNSS时钟信息时所述第一晶振计时;其中,N为大于1的整数;确认所述N个周期的GNSS时钟信息满足卫星时间有效条件时,和/或,确认接收所述N个周期中各周期的GNSS时钟信息时所述第一晶振计时满足稳定条件时,确定所述计时偏差率。
- 根据权利要求15所述的方法,其特征在于,所述确定所述计时偏差率,包括:确定所述N个周期中连续的M个周期,其中,M为小于或等于N、且大于1的整数;获取接收所述M个周期中各周期的GNSS时钟信息时所述第一晶振计时,确定接收所述M个周期中相邻周期的GNSS时钟信息时所述第一晶振计时间隔;根据所述第一晶振计时间隔,及所述相邻周期的GNSS时钟信息对应的预设发送间隔,确定所述计时偏差率。
- 根据权利要求13-16中任一项所述的方法,其特征在于,所述方法还包括:确认所述计时偏差率异常时,发出提示信息,所述提示信息用于提示所述第一晶振故障。
- 根据权利要求13-17中任一项所述的方法,其特征在于,所述系统时钟在系统上电时根据所述系统存储的前一次下电时管理面时钟所指示的时间进行初始化;或者,根据实时时钟RTC所指示时间进行初始化。
- 根据权利要求14-18中任一项所述的方法,其特征在于,所述方法还包括:在当前周期接收第一GNSS时钟信息,所述第一GNSS时钟信息包括以下至少一种:秒脉冲PPS和/或推荐定位信息GPRMC;确认所述第一GNSS时钟信息满足卫星时间有效条件时,根据所述第一GNSS时钟信息,将所述管理面时钟调整为与所述GNSS时钟同步。
- 根据权利要求19所述的方法,其特征在于,所述方法还包括:确认所述第一GNSS时钟信息满足卫星时间有效条件时,根据所述第一GNSS时钟信息,将RTC调整为与所述GNSS时钟同步。
- 根据权利要求14-20中任一项所述的方法,其特征在于,所述方法还包括:获取当前周期所述数据面时钟所指示的时间与所述管理面时钟所指示的时间的第一偏差值;在所述第一偏差值大于第一阈值时,根据周期内调整幅度对所述当前周期内所述数据面时钟进行调整,所述周期内调整幅度小于或等于所述第一阈值。
- 根据权利要求21所述的方法,其特征在于,所述方法还包括:在所述第一偏差值小于或等于所述第一阈值时,在所述当前周期内将所述数据面时钟调整为与所述管理面时钟同步。
- 根据权利要求21或22所述的方法,其特征在于,所述方法还包括:根据所述第一偏差值和/或所述周期内调整幅度,对由所述数据面时钟提供的时间 戳进行修正。
- 根据权利要求21-23中任一项所述的方法,其特征在于,所述第一阈值为预配置的;或所述第一阈值由应用软件变更操作模式时通知,所述应用软件使用所述数据面时钟。
- 根据权利要求13-24中任一项所述的方法,其特征在于,所述方法还包括:根据系统时钟,将从属于所述系统时钟的至少一个系统子时钟调整为与所述系统时钟同步。
- 一种时间同步装置,其特征在于,所述装置包括:第一模块,用于获取当前周期数据面时钟所指示的时间与管理面时钟所指示的时间的第一偏差值;第二模块,用于在所述第一偏差值大于第一阈值时,根据周期内调整幅度对所述当前周期内所述数据面时钟进行调整,所述周期内调整幅度小于或等于所述第一阈值。
- 一种时间同步装置,其特征在于,所述装置包括:第三模块,用于确定第一晶振相对于GNSS时钟的计时偏差率;第四模块,用于根据所述计时偏差率,对系统时钟进行修正,所述系统时钟是由所述第一晶振计数维持走时的。
- 一种时间同步装置,其特征在于,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为执行所述指令时实现权利要求1-12中任一项所述的方法,或者实现权利要求13-25中任一项所述的方法。
- 一种时间同步系统,其特征在于,包括:用于接收全球导航卫星系统GNSS时钟信息的传输装置,及如权利要求26-28中任一项所述的时间同步装置。
- 一种车辆,其特征在于,包括:如权利要求26-28中任一项所述的时间同步装置,或者如权利要求29所述的时间同步系统。
- 一种计算机可读存储介质,其上存储有计算机程序指令,其特征在于,所述计算机程序指令被处理器执行时实现权利要求1-12中任一项所述的方法,或者实现权利要求13-25中任一项所述的方法。
- 一种计算机程序产品,其特征在于,当所述计算机程序产品在计算机上运行时,使得所述计算机执行权利要求1-12中任一项所述的方法,或者实现权利要求13-25 中任一项所述的方法。
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2022/074037 WO2023141817A1 (zh) | 2022-01-26 | 2022-01-26 | 一种时间同步方法、装置及存储介质 |
CN202280006266.XA CN116830689A (zh) | 2022-01-26 | 2022-01-26 | 一种时间同步方法、装置及存储介质 |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/CN2022/074037 WO2023141817A1 (zh) | 2022-01-26 | 2022-01-26 | 一种时间同步方法、装置及存储介质 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2023141817A1 true WO2023141817A1 (zh) | 2023-08-03 |
Family
ID=87470140
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2022/074037 WO2023141817A1 (zh) | 2022-01-26 | 2022-01-26 | 一种时间同步方法、装置及存储介质 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN116830689A (zh) |
WO (1) | WO2023141817A1 (zh) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116938380A (zh) * | 2023-09-18 | 2023-10-24 | 南方电网数字电网研究院有限公司 | 时标管理方法、装置、计算机设备、时标管理器 |
CN117318866A (zh) * | 2023-09-18 | 2023-12-29 | 深圳市航顺芯片技术研发有限公司 | 一种以太网远程校准系统时钟方法及相关设备 |
CN117979412A (zh) * | 2024-03-29 | 2024-05-03 | 江铃汽车股份有限公司 | 一种车载通讯远程终端内部时间同步方法及系统 |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108646543A (zh) * | 2018-06-15 | 2018-10-12 | 西安空间无线电技术研究所 | 一种具有高稳定度性能的gnss驯服时钟方法 |
CN110967967A (zh) * | 2018-09-28 | 2020-04-07 | 三星电子株式会社 | 移动高级主时钟、建立高级主时钟的方法和自主车辆 |
CN111208539A (zh) * | 2019-12-18 | 2020-05-29 | 中国航空工业集团公司成都飞机设计研究所 | 一种高精度的gnss模拟器时间同步方法 |
WO2021097718A1 (zh) * | 2019-11-20 | 2021-05-27 | 华为技术有限公司 | 一种为自动驾驶提供时间源的方法及装置 |
CN113204036A (zh) * | 2021-05-05 | 2021-08-03 | 诺领科技(南京)有限公司 | 一种使用晶振的物联网gnss定位方法 |
CN113259899A (zh) * | 2021-05-17 | 2021-08-13 | 宸芯科技有限公司 | 一种时钟同步方法、装置、路侧单元及存储介质 |
CN113839732A (zh) * | 2021-09-18 | 2021-12-24 | 阿里巴巴达摩院(杭州)科技有限公司 | 时钟同步方法、装置及设备 |
-
2022
- 2022-01-26 CN CN202280006266.XA patent/CN116830689A/zh active Pending
- 2022-01-26 WO PCT/CN2022/074037 patent/WO2023141817A1/zh active Application Filing
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108646543A (zh) * | 2018-06-15 | 2018-10-12 | 西安空间无线电技术研究所 | 一种具有高稳定度性能的gnss驯服时钟方法 |
CN110967967A (zh) * | 2018-09-28 | 2020-04-07 | 三星电子株式会社 | 移动高级主时钟、建立高级主时钟的方法和自主车辆 |
WO2021097718A1 (zh) * | 2019-11-20 | 2021-05-27 | 华为技术有限公司 | 一种为自动驾驶提供时间源的方法及装置 |
CN111208539A (zh) * | 2019-12-18 | 2020-05-29 | 中国航空工业集团公司成都飞机设计研究所 | 一种高精度的gnss模拟器时间同步方法 |
CN113204036A (zh) * | 2021-05-05 | 2021-08-03 | 诺领科技(南京)有限公司 | 一种使用晶振的物联网gnss定位方法 |
CN113259899A (zh) * | 2021-05-17 | 2021-08-13 | 宸芯科技有限公司 | 一种时钟同步方法、装置、路侧单元及存储介质 |
CN113839732A (zh) * | 2021-09-18 | 2021-12-24 | 阿里巴巴达摩院(杭州)科技有限公司 | 时钟同步方法、装置及设备 |
Non-Patent Citations (1)
Title |
---|
ZTE CORPORATION, SANECHIPS, CHINA SOUTHERN POWER GRID CO., LTD: "Enhancements for time synchronization in TSN", 3GPP DRAFT; R2-2006831, 3RD GENERATION PARTNERSHIP PROJECT (3GPP), MOBILE COMPETENCE CENTRE ; 650, ROUTE DES LUCIOLES ; F-06921 SOPHIA-ANTIPOLIS CEDEX ; FRANCE, vol. RAN WG2, no. E-meeting; 20200817 - 20200828, 7 August 2020 (2020-08-07), Mobile Competence Centre ; 650, route des Lucioles ; F-06921 Sophia-Antipolis Cedex ; France , XP051911731 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116938380A (zh) * | 2023-09-18 | 2023-10-24 | 南方电网数字电网研究院有限公司 | 时标管理方法、装置、计算机设备、时标管理器 |
CN117318866A (zh) * | 2023-09-18 | 2023-12-29 | 深圳市航顺芯片技术研发有限公司 | 一种以太网远程校准系统时钟方法及相关设备 |
CN116938380B (zh) * | 2023-09-18 | 2024-01-23 | 南方电网数字电网研究院有限公司 | 时标管理方法、装置、计算机设备、时标管理器 |
CN117979412A (zh) * | 2024-03-29 | 2024-05-03 | 江铃汽车股份有限公司 | 一种车载通讯远程终端内部时间同步方法及系统 |
Also Published As
Publication number | Publication date |
---|---|
CN116830689A (zh) | 2023-09-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2023141817A1 (zh) | 一种时间同步方法、装置及存储介质 | |
WO2021047271A1 (zh) | 一种时间同步方法及装置 | |
US20230396349A1 (en) | Time synchronization method and apparatus for vehicle-mounted device, vehicle-mounted device, and storage medium | |
EP3681129A1 (en) | Fpga based data acquisition card, data acquisition system and data acquisition method | |
CN111585682A (zh) | 传感器时间同步方法、装置及终端设备 | |
US20220248353A1 (en) | Synchronization method and device | |
WO2022077224A1 (zh) | 时钟同步方法和装置、芯片系统、无人机和终端 | |
CN112067004B (zh) | 自动驾驶系统的时域同步方法和装置 | |
WO2019019044A1 (zh) | 一种伪距计算方法和终端 | |
US20240214095A1 (en) | Clock synchronization method of control system and control system | |
WO2022062670A1 (zh) | 计时方法、目视助航设备控制方法及相关装置 | |
EP4120754A1 (en) | Clock calibration method and apparatus | |
EP4380257A1 (en) | Time synchronization method and related apparatus | |
CN113839732B (zh) | 时钟同步方法、装置及设备 | |
CN111443685A (zh) | 用于在控制设备中提供通用时间的方法以及控制设备 | |
CN116614194A (zh) | 车辆时间同步方法、装置、车辆、存储介质和程序产品 | |
CN113890665A (zh) | 一种时间同步方法、系统、存储介质及处理器 | |
CN116015523A (zh) | 一种时间同步的方法、装置及电子设备 | |
WO2022127337A1 (zh) | 主时钟装置、从时钟装置和时间同步方法 | |
CN113259039A (zh) | 时间同步方法、装置、计算机设备和存储介质 | |
CN115685270A (zh) | 用于提供时间服务的方法、装置、电子设备及fpga芯片 | |
US11604439B2 (en) | GNSS time synchronization in redundant systems | |
CN118449644A (zh) | 域控制器时间同步方法、装置、电子设备和介质 | |
CN113342899B (zh) | 一种数据同步获取方法、装置及系统 | |
CN110609464B (zh) | 一种嵌入式通讯系统的授时方法和系统 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
WWE | Wipo information: entry into national phase |
Ref document number: 202280006266.X Country of ref document: CN |
|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 22922667 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |