Time synchronization device, electronic equipment and vehicle
By using the counting components of the microprocessing chip in the time synchronization device to synchronize the clock of the master and slave virtual machine, the problem of insufficient time synchronization accuracy in the prior art is solved, and a higher accuracy and universal time synchronization effect is achieved.
Patent Information
- Application Number
- CN202411941554.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-29
AI Technical Summary
The prior art cannot meet the requirements of cross-VM communication services for high-precision time synchronization, and the time synchronization accuracy is low, and the time error within 1 ms cannot be guaranteed to be at the microsecond level.
A time synchronization device is designed, including a microprocessing chip, a master virtual machine and a slave virtual machine. The counting value is obtained through the counting components in the microprocessing chip, and clock synchronization between the master virtual machine and the slave virtual machine is ensured to ensure the accuracy of time synchronization information.
The time synchronization error between master and slave virtual machines is controlled at the microsecond level, which improves the accuracy and universality of time synchronization, and meets the needs of cross-VM communication services with high requirements for time synchronization.
Smart Images

Figure CN119906511A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of electronic technology, and in particular to a time synchronization device, an electronic device and a vehicle. Background Art
[0002] In a multi-VM (Virtual Machine) system, time synchronization is a very important function.
[0003] Regarding the time synchronization solution between multiple VM systems, the prior art usually performs time synchronization by referring to the timestamp generated by cross-VM communication. This method has a simple principle and a universal interface, and can meet the needs of low-precision time synchronization.
[0004] However, since the transmission time through cross-VM communication is affected by factors such as transmission delay and system load fluctuation, the time error of cross-VM communication is large and the time synchronization accuracy of cross-VM communication cannot be guaranteed. For example, the time error within 1ms is usually at the second level.
[0005] Therefore, the technical problem that the existing technology cannot solve is: the time synchronization accuracy is low and cannot meet the demand for high-precision time synchronization of cross-VM communication services. Summary of the invention
[0006] The present specification provides a time synchronization device, an electronic device and a vehicle to solve or partially solve the technical problem of low time synchronization accuracy in the prior art.
[0007] In a first aspect of the specification, a time synchronization device is disclosed, comprising: a microprocessor chip, a master virtual machine, and a slave virtual machine;
[0008] The microprocessor chip has a counting component, which is connected to the master virtual machine and the slave virtual machine respectively;
[0009] The master virtual machine includes: a master system service component, a first time maintenance component, and a first time synchronization component;
[0010] The first time maintenance component is used to obtain the first time information updated in real time from the main system service component;
[0011] The first time synchronization component is used to synchronously obtain a first count value from the counting component when obtaining the first time information from the first time maintenance component; encapsulate the first time information and the first count value into time synchronization information, and send the time synchronization information to the slave virtual machine;
[0012] The slave virtual machine includes: a second time maintenance component and a second time synchronization component;
[0013] The second time synchronization component is used to obtain the time synchronization information from the first time synchronization component; synchronously obtain a second count value from the counting component; and determine second time information based on the time synchronization information and the second count value;
[0014] The second time maintenance component is used to use the second time information as the system time of the slave virtual machine to complete the time synchronization between different virtual machines; wherein the error between the second time information and the first time information is below the microsecond level.
[0015] Optionally, the main system service component is used to update the first time information in real time by referring to the timing of a local clock during the initialization operation of the main system; or to update the first time information in real time by referring to the timing of an external device during the normal operation of the main system.
[0016] Optionally, the main system service component is further configured to update the timing of the local clock using the timing of the external device during normal operation of the main system.
[0017] Optionally, the second time synchronization component is specifically used to extract the first time information and the first counting value from the time synchronization information; determine the counting difference based on the second counting value and the first counting value; constrain the counting difference using the counting reference standard coefficient of the counting component, and superimpose the first time information to obtain the second time information.
[0018] Optionally, the counting reference standard coefficient of the counting component is specifically a counting value of the counting component within 1 second, or is obtained by comparing a counting time period with a counting value of the counting component within the counting time period.
[0019] Optionally, the device further comprises: a virtual machine monitor;
[0020] The virtual machine monitor is used to provide underlying support for N virtual machines, and the N virtual machines are respectively connected to the counting components, where N≥2 and is a positive integer;
[0021] Any one virtual machine among the N virtual machines is the master virtual machine, and the remaining virtual machines among the N virtual machines are the slave virtual machines.
[0022] Optionally, the counting component is a counter or a register.
[0023] Optionally, the first time synchronization component is used to select any communication mechanism from all inter-virtual machine communication mechanisms supported by the master virtual machine and the slave virtual machine, and send the time synchronization information to the second time synchronization component.
[0024] A second aspect of this specification discloses an electronic device, comprising the time synchronization device described in the first aspect.
[0025] A third aspect of this specification discloses a vehicle, comprising the time synchronization device described in the first aspect.
[0026] Through one or more embodiments of this specification, this specification has the following beneficial effects or advantages:
[0027] The time synchronization device in this specification includes a master virtual machine, a slave virtual machine and a microprocessor chip, and performs clock synchronization on the master virtual machine and the slave virtual machine by referring to the count value of the count component in the microprocessor chip. Compared with the prior art, the time synchronization accuracy of this technical solution only needs to refer to the accuracy of the count component and will not be affected by factors such as cross-VM communication delay and system load fluctuation. Therefore, the time synchronization error of the master and slave virtual machines can be controlled below the microsecond level, and the time synchronization has higher accuracy and stronger universality, and is more suitable for cross-VM communication services and applications with higher requirements for time synchronization.
[0028] The above description is only an overview of the technical solution of this specification. In order to more clearly understand the technical means of this specification, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of this specification more obvious and easy to understand, the specific implementation methods of this specification are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present specification. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0030] Figure 1 A schematic diagram of the structure of a time synchronization device according to an embodiment of the present specification is shown;
[0031] Figure 2 A schematic diagram of the calculation logic of the second time information according to an embodiment of the present specification is shown.
[0032] Explanation of the accompanying drawings: microprocessor chip 10, virtual machine monitor 11, master virtual machine 12, slave virtual machine 13, local clock 121, first time maintenance component 122, first time synchronization component 123, master system service component 124, second time maintenance component 131, second time synchronization component 132, slave system service component 133. DETAILED DESCRIPTION
[0033] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0034] The embodiment of this specification discloses a time synchronization device. In practical applications, the time synchronization device disclosed in this embodiment can be applied to high-precision electronic equipment such as aerospace, atomic clocks, remote sensing and mapping equipment, test instruments, base stations, computers, and vehicle-mounted equipment, and can also be used in vehicles, such as unmanned vehicles.
[0035] See also Figure 1 , is a schematic diagram of the structure of the time synchronization device disclosed in the embodiment of this specification, including: a microprocessor chip 10, a master virtual machine 12, and a slave virtual machine 13. The microprocessor chip 10 has a counting component 101, which is connected to the master virtual machine 12 and the slave virtual machine 13 respectively. The microprocessor chip 10 adopts a SOC (System on a Chip) chip or an ARM (Advanced RISC Machines) chip, but it does not form a limitation. The counting component 101 is mainly used for counting, and the counting component 101 is specifically a counter or a register, such as a tick register, but it does not form a limitation.
[0036] There is only one master virtual machine 12, and the number of slave virtual machines 13 is unlimited. The kernels of the master and slave virtual machines are both deployed with a time synchronization driver function, and the time synchronization of the slave virtual machines 13 depends on the time information in the master virtual machine 12. The master and slave virtual machines in the time synchronization device are both implemented by the virtual machine monitor (VMM) technology.
[0037] In an optional implementation, the time synchronization device further includes: a virtual machine monitor 11. VMM technology refers to a hardware virtualization technology that allows multiple operating systems to run on a hardware host, and is mainly used to isolate and manage multiple virtual machines running on the upper layer, arbitrate their access to the underlying hardware, and virtualize a set of virtual hardware environments independent of the actual hardware for each operating system.
[0038] The virtual machine monitor 11 is used to provide underlying support for the N virtual machines. The virtual machine monitor 11 and the N virtual machines together construct a virtualized computing environment.
[0039] The N virtual machines are respectively connected to the counting component 101 to obtain corresponding counting values from the counting component 101. N≥2 and is a positive integer.
[0040] Specifically, the time synchronization services of different virtual machines are in a master-slave relationship. Among them, any one of the N virtual machines is the master virtual machine 12, and the remaining virtual machines of the N virtual machines are slave virtual machines 13. Exemplarily, if two virtual machines are arranged on the virtual machine monitor 11, a master-slave configuration is set, and one of the two virtual machines is used as the master virtual machine 12, and the other is used as the slave virtual machine 13. If the number of virtual machines is more than 3, a master-multiple-slave configuration is set.
[0041] Different operating systems are installed in the master virtual machine 12 and the slave virtual machine 13. The communication between virtual machines is called inter-VM (Virtual Machine) communication. Each virtual machine relies on an inter-VM mechanism to achieve communication, such as socket communication (a communication mechanism), and of course other communication mechanisms can also be used.
[0042] In this specification, all slave virtual machines 13 refer to the time information provided by the master virtual machine 12 to achieve time synchronization, so this embodiment takes a single slave virtual machine 13 and the master virtual machine 12 as an example to describe the time synchronization process. The time synchronization of other slave virtual machines 13 can be referenced.
[0043] refer to Figure 1 The master virtual machine 12 includes: a local clock 121, a first time maintenance component 122, a first time synchronization component 123, and a master system service component 124.
[0044] The local clock 121 is used to provide time synchronization for reference during system initialization of the main virtual machine 12. The integrated circuit in the local clock can continue to operate with the help of a battery or other backup power source even when the main system power is turned off, and accurately record the time and date. In practical applications, the local clock is exemplified by an RTC (Real Time Clock), but this is not a limitation.
[0045] Specifically, after the main operating system of the main virtual machine 12 is started, the main system service component 124 in the main virtual machine 12 reads the time from the local clock 121 and initializes the main operating system.
[0046] Specifically, the main system service component 124 is used to update the first time information in real time with reference to the timing of the local clock 121 during the initialization of the main system; or to update the first time information in real time with reference to the timing of an external device during the normal operation of the main system. The timing of the external device includes but is not limited to: the timing of an external GPS (Global Positioning System) or the timing based on NTP (Network Time Protocol).
[0047] The first time maintenance component 122 is used to use the system time of the primary virtual machine 12 as the first time information when sensing the time change of the primary virtual machine 12.
[0048] In the specific implementation process, the time update of the main system service component 124 includes two aspects: on the one hand, the main system service component 124 refers to the time service of the local clock 121 to update the time, and on the other hand, the time service of the external device is used to update the time. Assuming that the main operating system is turned off for a long time and then turned on, the main system service component 124 initializes the main operating system with reference to the time service of the local clock 121 to obtain the first update time T init Of course, when the main operating system is running normally, it will use the external GPS timing to update the time and obtain the second update time T adjust .
[0049] On this basis, the first time maintenance component 122 updates the first update time T init Or the second update time T init As the first time information.
[0050] In an optional implementation, the main system service component 124 is further configured to use the timing of the external device to update the timing of the local clock 121 during normal operation of the main system. Of course, the first time maintenance component 122 may also perform the update operation.
[0051] The first time synchronization component 123 is used to obtain the first time information from the first time maintenance component 122, and synchronously obtain the first count value from the counting component 101; the first time information and the first count value are encapsulated as time synchronization information Tref. Specifically, the first time information and the first count value are encapsulated according to the preset structure to obtain time synchronization information Tref = (T1, N1). Wherein, T1 represents the first time information, and N1 represents the first count value.
[0052] Further, the time synchronization information is sent to the slave virtual machine 13 .
[0053] Since the time synchronization process of the technical solution is not affected by factors such as cross-VM communication delay and system load fluctuation, the first time synchronization component 123 can select any other cross-VM communication mechanism to communicate with the slave virtual machine 13 in addition to socket communication. That is, the communication between the master virtual machine 12 and the slave virtual machine 13 is not limited by the type of cross-VM communication mechanism. The time synchronization accuracy of the master virtual machine 12 and the slave virtual machine 13 is also not affected by the cross-VM communication delay.
[0054] refer to Figure 1 , the slave virtual machine 13 includes: a second time maintenance component 131, a second time synchronization component 132, and a slave system service.
[0055] During the communication between the first time synchronization component 123 and the second time synchronization component 132, the first time synchronization component 123 selects any communication mechanism from all cross-VM communication mechanisms supported by the master VM 12 and the slave VM 13, and sends time synchronization information to the second time synchronization component 132. That is, the communication between the first time synchronization component 123 and the second time synchronization component 132 is not limited by the type of cross-VM communication mechanism.
[0056] The second time synchronization component 132 is used to obtain time synchronization information Tref=(T1, N1) from the first time synchronization component 123; synchronously obtain a second count value from the counting component 101; and determine the second time information based on the time synchronization information and the second count value.
[0057] In the implementation process of calculating the second time information, the second time synchronization component 132 is specifically used to extract the first time information and the first counting value from the time synchronization information; determine the counting difference according to the second counting value and the first counting value; use the counting reference standard coefficient of the counting component 101 to constrain the counting difference, and superimpose the first time information to obtain the second time information.
[0058] Furthermore, the counting reference standard coefficient of the counting component 101 is specifically the counting value of the counting component 101 within 1 second, or is obtained by comparing a counting time period with the counting value of the counting component 101 within the counting time period.
[0059] Among them, if the counting reference standard coefficient of the counting component 101 is specifically the counting value of the counting component 101 within 1 second, the counting reference standard coefficient of the counting component 101 is used to constrain the counting difference, and the process of superimposing the first time information to obtain the second time information is specifically: use the formula T2=T1+(N2-N1) / K to process the time synchronization information and the second counting value to obtain the second time information; wherein T2 represents the second time information, T1 represents the first time information, N2 represents the second counting value, N1 represents the first counting value, and K represents the counting value of the counting component 101 within 1 second.
[0060] If the counting reference standard coefficient of the counting component 101 is obtained by comparing the counting time period with the counting value of the counting component 101 in the counting time period, using the formula The time synchronization information and the second count value are processed to obtain the second time information, wherein T2 represents the second time information, T1 represents the first time information, N2 represents the second count value, N1 represents the first count value, Δr represents the counting time period, and M represents the count value of the counting component 101 within the counting time period.
[0061] The second time maintenance component 131 is used to use the second time information as the system time of the slave virtual machine 13 to complete the time synchronization between different virtual machines. The error between the second time information and the first time information is below the microsecond level.
[0062] Specifically, the slave virtual machine 13 further includes: a slave system service component 133, which is used to update the time of the slave operating system using the second time information. Further, the second time information is used to update each application software in the slave operating system.
[0063] See also Figure 2 , is a schematic diagram of the calculation logic of the second time information. In the estimation of the time synchronization error, taking the register 1s accumulated 32768 times as an example, the counting value increment cycle is 1 / 32768≈30us, which means that the time error caused by the register reading error is about 30 microseconds (us). If the first time information is generated at 12:00, the second time information received from the virtual machine 13 is: T2=12:00+11*30us=12:00+330us=12:00000330, and the system time of the slave virtual machine 13 is updated using the second time information. The clock synchronization error of the slave virtual machine 13 and the master virtual machine 12 is only 30 microseconds, which is kept below the microsecond level, and can fully meet the use requirements of cross-VM communication services and applications with high requirements for time synchronization. In addition, the time synchronization accuracy of this specification depends on the accuracy of the counting component 101. If the accuracy of the counting component 101 reaches the nanosecond level, the time synchronization error can be reduced to the microsecond level (<1us).
[0064] The time synchronization scheme in this specification realizes high-precision time synchronization by using hardware counters or registers. The accuracy of time synchronization can be continuously improved with hardware upgrades, which greatly improves the low-precision time synchronization situation of the prior art.
[0065] The time synchronization solution in this specification is not affected by factors such as communication delay and system load fluctuation, has high feasibility, strong portability and scalability, and can support time synchronization of system structures of at least two virtual machines.
[0066] Based on the same inventive concept as one or more of the above embodiments, the following embodiment discloses an electronic device, which includes a time synchronization device as described in any of the above embodiments. In practical applications, the device can be: aerospace equipment, atomic clock, remote sensing and mapping equipment, test equipment, base station, computer, vehicle-mounted equipment and other high-precision electronic equipment.
[0067] Based on the same inventive concept as one or more of the above embodiments, the following embodiment discloses a vehicle, such as an unmanned vehicle, an electric vehicle, a gasoline vehicle, and other types of vehicles. The vehicle of this implementation has a time synchronization device as described in any of the above embodiments, which is used to maintain time synchronization between each slave virtual machine and the master virtual machine in the vehicle.
[0068] Through one or more embodiments of this specification, this specification has the following beneficial effects or advantages:
[0069] The time synchronization device in this specification includes a master virtual machine, a slave virtual machine and a microprocessor chip, and performs clock synchronization on the master virtual machine and the slave virtual machine by referring to the count value of the count component in the microprocessor chip. Compared with the prior art, the time synchronization accuracy of this technical solution only needs to refer to the accuracy of the count component and will not be affected by factors such as cross-VM communication delay and system load fluctuation. Therefore, the time synchronization error of the master and slave virtual machines can be controlled below the microsecond level, and the time synchronization has higher accuracy and stronger universality, and is more suitable for cross-VM communication services and applications with higher requirements for time synchronization.
[0070] The time synchronization device in this specification realizes high-precision time synchronization by utilizing hardware counters or registers (such as tick registers). The accuracy of time synchronization can be continuously improved with hardware upgrades, which greatly improves the low-precision time synchronization situation of the prior art.
[0071] The time synchronization device in this specification is not affected by factors such as communication delay and system load fluctuation, has high feasibility, strong portability and scalability, and can support time synchronization of system structures of at least two virtual machines.
[0072] The algorithms and displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general purpose systems may also be used together with the teachings based thereon. Based on the above description, it is apparent that the structure required for constructing such systems is. In addition, this specification is not directed to any particular programming language either. It should be understood that the contents of this specification described herein may be implemented using various programming languages, and the description of the specific languages above is intended to disclose the preferred implementation of this specification.
[0073] In the description provided herein, a large number of specific details are described. However, it is understood that the embodiments of this description can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.
[0074] Similarly, it should be understood that in order to streamline the present disclosure and aid in understanding one or more of the various inventive aspects, in the above description of the exemplary embodiments of the present specification, the various features of the present specification are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting the following intention: the claimed specification requires more features than the features explicitly recited in each claim. More specifically, as reflected in the claims below, the inventive aspects lie in less than all the features of the individual embodiments disclosed above. Therefore, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, with each claim itself serving as a separate embodiment of the present specification.
[0075] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.
[0076] In addition, those skilled in the art will appreciate that, although some embodiments herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of this specification and form different embodiments. For example, in the claims below, any one of the claimed embodiments may be used in any combination.
[0077] The various component embodiments of this specification may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) may be used in practice to implement some or all functions of some or all components of a gateway, a proxy server, or a system according to an embodiment of this specification. This specification may also be implemented as a device or apparatus program (e.g., a computer program and a computer program product) for executing part or all of the methods described herein. Such a program implementing this specification may be stored on a computer-readable medium, or may have the form of one or more signals. Such a signal may be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.
[0078] It should be noted that the above embodiments illustrate rather than limit the present specification, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be construed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present specification may be implemented with the aid of hardware comprising a number of different elements and with the aid of a suitably programmed computer. In a unit claim enumerating a number of devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc., does not indicate any order. These words may be interpreted as names.
Claims
1. A time synchronization device, comprising: Microprocessor chip, master virtual machine, slave virtual machine; The microprocessor chip has a counting component, which is connected to the master virtual machine and the slave virtual machine respectively; The master virtual machine includes: a master system service component, a first time maintenance component, and a first time synchronization component; The first time maintenance component is used to obtain the first time information updated in real time from the main system service component; The first time synchronization component is used to synchronously obtain a first count value from the counting component when obtaining the first time information from the first time maintenance component; encapsulate the first time information and the first count value into time synchronization information, and send the time synchronization information to the slave virtual machine; The slave virtual machine includes: a second time maintenance component and a second time synchronization component; The second time synchronization component is used to obtain the time synchronization information from the first time synchronization component; synchronously obtain a second count value from the counting component; and determine second time information based on the time synchronization information and the second count value; The second time maintenance component is used to use the second time information as the system time of the slave virtual machine to complete the time synchronization between different virtual machines; wherein the error between the second time information and the first time information is below the microsecond level.
2. The time synchronization device as described in claim 1, wherein the main system service component is used to update the first time information in real time by referring to the timing of the local clock during the initialization operation of the main system; or, to update the first time information in real time by referring to the timing of the external device during the normal operation of the main system.
3. The time synchronization device as described in claim 2, wherein the main system service component is further used to update the timing of the local clock using the timing of the external device during normal operation of the main system.
4. In the time synchronization device as described in claim 1, the second time synchronization component is specifically used to extract the first time information and the first count value from the time synchronization information; determine the count difference according to the second count value and the first count value; use the count reference standard coefficient of the counting component to constrain the count difference, and superimpose the first time information to obtain the second time information.
5. The time synchronization device according to claim 1, wherein the counting reference standard coefficient of the counting component is specifically a counting value of the counting component within 1 second, or is obtained by comparing a counting time period with a counting value of the counting component within the counting time period.
6. The time synchronization device according to claim 1, further comprising: Virtual machine monitor; The virtual machine monitor is used to provide underlying support for N virtual machines, and the N virtual machines are respectively connected to the counting components, where N≥2 and is a positive integer; Any one virtual machine among the N virtual machines is the master virtual machine, and the remaining virtual machines among the N virtual machines are the slave virtual machines.
7. The time synchronization device according to claim 1 or 6, wherein the counting component is a counter or a register.
8. The time synchronization device as described in claim 1, the first time synchronization component is used to select any communication mechanism from all cross-virtual machine communication mechanisms supported by the master virtual machine and the slave virtual machine, and send the time synchronization information to the second time synchronization component.
9. An electronic device, comprising the time synchronization device according to any one of claims 1 to 8.
10. A vehicle, comprising the time synchronization device according to any one of claims 1 to 8.