TIME SYNCHRONIZATION IN A NETWORK
20230079221 · 2023-03-16
Assignee
Inventors
- Dietmar BRUCKNER (Eggelsberg, AT)
- Oliver HÖFTBERGER (Eggelsberg, AT)
- Jörg ZELENKA (Eggelsberg, AT)
- Franz PROFELT (Eggelsberg, AT)
Cpc classification
International classification
Abstract
Method for time synchronization in a network comprising masters and at least one slave. The slave receives synchronization messages from the masters via the network for time synchronization of a first clock and a second clock of the slave. A first master sends a first synchronization message having a first time stamp to the slave for time synchronization of the first clock. The slave calculates a clock rate and a time difference between the first clock and the first master and aligns the first clock with a synchronized time. A second master sends a second synchronization message having a second time stamp to the slave for the time synchronization of the second clock. The clock rate of the second clock is set to the first clock rate. A time difference between the second clock and the second master is calculated and the second clock is aligned with the synchronized time.
Claims
1. A method for time synchronization in a network, the network comprising a plurality of masters and at least one slave having a first and second clock, the at least one slave receiving synchronization messages from the plurality of masters for time synchronization of the first clock and the second clock of the slave via the network, the method comprising: sending a first synchronization message having a first time stamp from a first master to the at least one slave for time synchronization of the first clock and the at least one slave; comparing the first time stamp of the first synchronization message with the first current time of the first clock; based on this comparison of the first time stamp of the first synchronization message with the first current time of the first clock, calculating a clock rate and a time difference between the first clock and the first master and carrying out a time alignment in such a way that the first clock in the slave runs with a synchronized time; a second master sending a second synchronization message having a second time stamp from the second master to the at least one slave for the time synchronization of the second clock, wherein a clock rate of the first clock is used to specify a clock rate for the second clock, by setting the clock rate of the second clock to the clock rate of the first clock; comparing, in the at least one slave, the second time stamp of the second synchronization message with the second current time of the second clock; and, based on this comparison in the at least one slave, calculating a time difference between the second clock and the second master and carrying out a time alignment in such a way that the second clock in the slave runs with the synchronized time.
2. The method according to claim 1, wherein the time synchronization takes place at intervals of between 10 and 200 ms.
3. The method according to claim 1, wherein a time stamper is associated with at least one of the first clock or the second clock of the at least one slave and assigns a time stamp to a data packet.
4. The method according to claim 1, wherein the time synchronization takes place in the at least one slave via synchronization and a clock rate and a time difference are calculated, and the time difference between at least one of the first clock or the second clock and the master is compensated for by at least one of a time jump or a frequency alignment.
5. The method according to claim 1, wherein the time synchronization takes place in at least one slave via syntonization and a clock rate and a time difference are calculated, and the time difference between the at least one first clock or the second clock and the master is compensated for by adjusting the clock rate.
6. The method according to claim 1, wherein a timer is associated with at least one first clock or with a second clock and issues an interrupt request at regular intervals.
7. A network comprising: a plurality of masters and at least one slave, the plurality of masters and the at least one slave each having a first clock and a second clock; the first master being configured to send a first synchronization message having a first time stamp to the at least one slave, and the at least one slave being designed to calculate a clock rate and a first time difference relative to the first current time of the first clock in relation to the first master on the basis of the first time stamp and to carry out a time alignment in such a way that the first clock in the slave runs with a synchronized time; the second master being configured to send a second synchronization message having a second time stamp to the at least one slave; the at least one slave being designed to specify the clock rate of the first clock as a clock rate for the second clock, and to set the clock rate of the second clock to the clock rate of the first clock; and the at least one slave being designed to calculate a second time difference between the second current time of the second clock and the second master on the basis of the second time stamp and to carry out a time alignment in such a way that the second clock in the slave runs with the synchronized time.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The present invention will be explained in greater detail in the following with reference to
[0049]
[0050]
[0051]
[0052]
[0053]
DETAILED DESCRIPTION
[0054] The particulars shown herein are by way of example and for purposes of illustrative discussion of the embodiments of the present invention only and are presented in the cause of providing what is believed to be the most useful and readily understood description of the principles and conceptual aspects of the present invention. In this regard, no attempt is made to show structural details of the present invention in more detail than is necessary for the fundamental understanding of the present invention, the description taken with the drawings making apparent to those skilled in the art how the several forms of the present invention may be embodied in practice.
[0055]
[0056] To illustrate this, a working clock 3 is shown representatively for a first clock and a global clock 5 is shown representatively for a second clock. However, completely different clocks could also run in a network and on network subscribers, for example a production clock, a batch clock, etc. For synchronization, the role of a master M.sub.1 is assigned for the working time and the role of a master M2 is assigned for the global time. In principle, both masters M.sub.1 and M2 can be run on the same network subscribers, but are often distributed to different network subscribers. All other working clocks 3 and global clocks 5 in a network are then considered slave clocks. According to the invention, a slave S contains a working clock 3 that outputs a first time as the working time and a global clock 5 that outputs a second time as the global time. The global time can usually be the time of an atomic clock such as TAI or UTC, which should be the same everywhere in the world, depending on the time zone. However, it can also be possible for a slave S to contain only a single clock. This can then often be a working clock 3, and there is no synchronization with the global time. The clocks of the present invention can constitute any combination of hardware-based and logical clocks. For example, both the working clock 3 and the global clock 5 can access the same hardware-based clock, but both the working clock 3 and the global clock 5 can each access a hardware-based clock.
[0057] The network subscribers are connected to each other via network lines. The network lines often form a data bus for data communication between the network subscribers. The network lines can be LAN cables, network buses, fiber optic cables and the like, which allow communication in the network between the network subscribers. Any communication protocol can be implemented for data communication. A network infrastructure can also be provided that connects different networks or different portions of a network to one another, for example switches, routers, etc. Wireless data traffic having time synchronization via a wireless network, such as wireless LAN (WLAN), is also conceivable in a network 1 or in parts of a network 1. Any network topologies for the network 1 that are familiar to a person skilled in the art and that allow targeted data transfer with time synchronization between the network subscribers are possible. In terms of data traffic (in addition to other data messages), the network 1 allows bidirectional sending and receiving of synchronization messages between different network subscribers.
[0058] The synchronization messages are exchanged between network subscribers in the network 1 for time synchronization. For this purpose, one of the masters M.sub.1, M.sub.2 regularly sends synchronization messages D.sub.1, D.sub.2 to the at least one slave S. The master M.sub.1 sends a synchronization message D.sub.1 to synchronize the working clock 3, and the master M.sub.2 sends a synchronization message D.sub.2 to synchronize the global clock 5. The synchronization messages D.sub.1, D.sub.2 can be sent in one data packet, i.e., in a closed data unit that is intended for network traffic, but the synchronization messages D.sub.1. D.sub.2 can also be sent independently of one another in different data packets in the network 1. The synchronization messages D.sub.1 for the working clock 3 are preferably sent at a higher interval than the synchronization messages D.sub.2 for the global clock 5. The working clock 3 can often be synchronized four times as often compared to the global clock 5.
[0059] The synchronization message D.sub.1 contains a time stamp t.sub.1 from the master M.sub.1 and the synchronization message D.sub.2 contains a time stamp t.sub.2 from the master M.sub.2. A time stamp t.sub.1, t.sub.2 is the time of a working clock 3 or global clock 5 of a master at the time a synchronization message D is sent. The synchronization messages D.sub.1, D.sub.2 are used to calculate a clock rate r and a time difference dt in the slave S relative to the master M.sub.1, M.sub.2 and to set the working clock 3 or global clock 5 in such a way that the working time and global time are the same as those of the master and continue to run in the same manner.
[0060] The clock rate r defines a periodic signal that is determined by its frequency or period duration and is often used to coordinate the timing of processes in a digital system. A clock rate r can be output by a quartz oscillator in a hardware-based clock, for example. The time difference dt describes the absolute difference between two times. For example, a global time can be 11:23 a.m. on the master M and a global time on the slave S can be 11:25 a.m. The time difference dt would then be 2 minutes or 120 seconds.
[0061]
[0062] The master M.sub.2 also sends a synchronization message D.sub.2 to the global clock 5 in the slave S. The synchronization message D.sub.2 receives a time stamp t.sub.2 from the master M.sub.2 and has a runtime Δt.sub.2 that can again be considered to be known. Due to the fact that the roles of the masters M can be executed on different network subscribers, the runtimes of the synchronization messages D.sub.1, D.sub.2 can definitely differ. However, different runtimes can also result, for example, from the fact that the synchronization messages D.sub.1, D.sub.2 are sent via different network paths. The global clock 5 or the time synchronization mechanism of the global clock 8 in the slave S calculates the clock rate r.sub.G and the time difference dt.sub.2, as described above for the first synchronization message D.sub.1. This can be done via a time jump or a frequency adjustment, depending on the deviation between the master M2 and the global clock 5 in the slave S.
[0063] In the prior art, there is therefore no interaction between the working clock 3 and the global clock 5. Each is synchronized individually by the respective master M.sub.1, M.sub.2. Due to the time synchronization using the first synchronization message D.sub.1 and the second synchronization message D.sub.2, it can happen that both the working clock 3 and the global clock 5 execute time jumps forward or backward and/or a clock rate r.sub.A, r.sub.G of one or each of the two clocks, i.e., working clock 3 and/or global clock 5, is accelerated or decelerated in order to compensate for a time difference relative to one of the masters M.sub.1, M.sub.2. The time synchronization in the prior art can therefore result in the working clock 3 and the global clock 5 having different clock rates r.sub.A and r.sub.G.
[0064]
[0065] This process can be repeated as long as synchronization messages D.sub.1, D.sub.2 are sent from the master M.sub.1, M.sub.2 to the slave S for time synchronization. Identical points in time on the ordinate for the same clock with the same value would have the same time stamp t and would then no longer be distinguishable. This is indicated by way of example in
[0066]
[0067] The clock rate r.sub.A of the working clock 3 is now used to specify the clock rate r.sub.A for the global clock 5. Thus, the clock rate r.sub.A of the working clock 3 corresponds to the clock rate r.sub.G of the global clock 5, i.e., r.sub.A=r.sub.G. As a result, the clock rates r.sub.A, r.sub.G in the slave S are aligned internally via the specification from the working clock 3 and not, as before, via a specification from the master M.sub.2, which sent a second synchronization message D.sub.2 to the slave S. As a result, there are no different clock rates r.sub.A, r.sub.G between the working clock 3 and the global clock 5, as in the prior art. This is advantageous because applications such as a timer or a “monotonic clock,” which can be associated with either the working clock 3 or the global clock 5, now always access the same clock rate r.sub.A=r.sub.G.
[0068] In an extremely illustrative example, the clock rate r.sub.A of the working clock, which is calculated on the basis of the first synchronization message D.sub.1, can only run at 90% of the speed compared to the clock rate r.sub.G of a global clock 5. After a second synchronization message D.sub.2, for example at 1:00 a.m., the global clock 5 is aligned to the global time with the master M.sub.2. In the example, the clocks do not receive any synchronization messages for one hour until 2:00 a.m. Because the clock rate r.sub.A is aligned to r.sub.G, only 56 minutes have passed in the slave S in the global clock and said global clock would now display a time of 1:56 a.m., although it is now 2:00 a.m. With the next second synchronization message D.sub.2 at 2:00 a.m., the global clock is set to the value 2:00 a.m. and is therefore again synchronous with the global time.
[0069] The global clock 5 therefore often performs time jumps on the basis of the second synchronization message D.sub.2. These time jumps can be substantially smaller than the resolution of a global clock 5, and of course not have the size (4 minutes) as in the example above. For example, the resolution of the global clock 5 can be in the range of 1 microsecond (μS), but the time jumps, which are calculated on the basis of the incoming second synchronization messages D.sub.2, can be in the range of less than 1 μS. Thus, such time jumps can be irrelevant for applications and uses related to a user because these small deviations are perceived by a human being as being at the same time.
[0070]
[0071] After a further time, the synchronization message D.sub.2-1 from the master M.sub.2 reaches the slave S. The time synchronization mechanism 8, for example the global clock 5, calculates the global time difference dt.sub.2-1 via the second synchronization message D.sub.2. At the time of processing by the synchronization mechanism 8, the global time is identical to the global time received from the master M.sub.2. It then continues to run at the clock rate r.sub.A of the working clock. This procedure is repeated with the arrival of each first and second synchronization message D.sub.1.n and D.sub.2-n for time synchronization from the masters M.sub.1 and M.sub.2.
[0072] The slave S can also send data traffic into the network 1, for example via data packets Dp, which can control various events and not only act with regard to time synchronization. A data packet can use a network port for this purpose, for example. For most applications it may be necessary to give the data packet a time stamp t. This can be done via a time stamper in the slave S, which gives an outgoing data packet a time stamp t of the slave S. A time stamp t is the time of the working clock 3 or the global clock 5 in the slave S at the time of the data packet. The time stamp t can also be important for regulating data traffic in a network 1. Depending on the event, the working clock 3 can access a working time stamper or the global clock 5 can access a global time stamper. If an event is to receive a time stamp t from the working clock 3, this is carried out by the working time stamper. In the case of the global clock 5, this functionality is taken over by the global time stamper. For example, the global time stamp t.sub.5 of the global clock 5 can be used for events with proximity to a user, while the working time stamp t.sub.3 of the working clock 3 can be used for communication events between network subscribers, for example for events such as coordinated production interactions.
[0073] In a preferred embodiment,
[0074] A timer 6 on each device must therefore issue the interrupt request UA after a certain time has elapsed. If the clock rates in the slaves S are different, the interrupt requests UA come at different times. This can, for example, trigger errors and problems in high-precision production processes.
[0075] In a network topology, there can be a large number of different network subscribers, such as processing units, bus modules, drive modules, bus couplers, IO modules having integrated network connections, cameras, HMI devices, network-integrated sensors and actuators and run on a wide variety of operating systems, such as Linux/Unix, Windows. Android and the like. Depending on the network subscriber and its operating system, a timer 6 accesses a working clock 3 or a global clock 5 based on the presets. Some network subscribers such as S″ or S′″ have only one working clock 3 and the timer 6 accesses the working clock 3 accordingly.
[0076] In the prior art, each timer 6 in the network 1 would have to be set in order to access a uniform clock, for example the global clock 5. However, this would cause problems for network subscribers without a global clock 5. As described above, in case of alignment with the working clock 3, the advantages of global time would be lost.
[0077] The time synchronization according to the invention allows a timer 6 in the network 1 to access any clocks in the network subscriber, and for the interrupt request UA to take place everywhere after the same period of time. In this way, the control of production processes, for example, can be planned and implemented with great precision.
[0078] The time synchronization mechanisms in the slaves can be implemented in particular by microprocessor-based hardware, microcontrollers, and/or integrated circuits (ASIC, FPGA), and can be implemented digitally, as software on microprocessor-based hardware. Thus, the time synchronization mechanism can be physically implemented by electronic (or optical) circuits such as logic circuits, discrete components, microprocessors, hard-wired circuits, memory elements, wiring connections, and the like, which may be formed using semiconductor-based fabrication techniques or other manufacturing technologies, and/or analog instrumentation, e.g., analog electric/electronic circuits, analog computers, analog devices, etc. Further, the processing of the signal from the transmitting subscriber can be implemented by microprocessors or similar components, programmed using software (e.g., microcode) to perform various functions discussed herein and may optionally be driven by firmware and/or software. Alternatively, the time synchronization mechanism may be implemented by dedicated hardware, or as a combination of dedicated hardware to perform some functions and a processor (e.g., one or more programmed microprocessors and associated circuitry) to perform other functions.
[0079] Moreover, the network can also include at least one memory (not shown). e.g., a non-transitory computer readable medium or media, to store one or more sets of instructions to perform any of the methods or computer-based functions disclosed herein, including operating the timers and timer synchronization mechanisms, either alone or in combination with the other described devices. The network can also include at least one processor that can access the at least one memory to execute the one or more sets of instructions to perform any of the methods or computer-based functions discussed above. Moreover, the at least one memory can be part of the slave or can be remote from the slave, e.g., a remotely located server, memory, system, or communication network or in a cloud environment, and the at least one processor can also part of the slave or remote from the slave.
[0080] It is noted that the foregoing examples have been provided merely for the purpose of explanation and are in no way to be construed as limiting of the present invention. While the present invention has been described with reference to an exemplary embodiment, it is understood that the words which have been used herein are words of description and illustration, rather than words of limitation. Changes may be made, within the purview of the appended claims, as presently stated and as amended, without departing from the scope and spirit of the present invention in its aspects. Although the present invention has been described herein with reference to particular means, materials and embodiments, the present invention is not intended to be limited to the particulars disclosed herein; rather, the present invention extends to all functionally equivalent structures, methods and uses, such as are within the scope of the appended claims.