Embedded Time Synchronization
Total Page:16
File Type:pdf, Size:1020Kb
Embedded time synchronization Ragnar Gjerde Evensen Thesis submitted for the degree of Master in Robotics and intelligent systems (ROBIN) 60 credits Institutt for informatikk Faculty of mathematics and natural sciences UNIVERSITY OF OSLO June 15, 2020 Embedded time synchronization Ragnar Gjerde Evensen c 2020 Ragnar Gjerde Evensen Embedded time synchronization http://www.duo.uio.no/ Printed: Reprosentralen, University of Oslo Contents 1 Introduction 4 1.1 The need for time . .4 1.2 Precise digital time . .4 1.3 Embedded time synchronization . .5 1.4 Machine learning . .6 2 Background 7 2.1 Precision and accuracy . .7 2.2 Computer clock architecture . .8 2.2.1 Different types of oscillators . .9 2.2.2 Bias frequencies . 10 2.2.3 Time standards . 10 2.3 Time measurements . 11 2.3.1 Topology . 11 2.4 Clock servo . 12 2.5 Measurement quality . 13 2.6 Machine learning . 14 3 State of the art 15 3.1 Existing synchronization technologies . 15 3.1.1 Analogue time synchronization methods . 15 3.1.2 Network Time protocol . 15 3.1.3 Precision Time Protocol . 16 3.1.4 White Rabbit . 19 3.1.5 Global Positioning System Time . 19 3.2 Emerging technologies . 19 3.2.1 Servos . 20 3.2.2 Measurement Filtering . 20 3.3 Reinforcement learning . 21 4 Proposed Methods 22 4.1 Communication . 22 4.1.1 Herding topology . 24 4.1.2 Herding with load balancing . 25 4.2 Measurement filtering . 28 4.2.1 Low-pass filter . 28 4.2.2 Gaussian filter . 28 4.3 Deep reinforcement learning servos . 28 1 4.3.1 1D Neural network . 30 4.3.2 2D Neural network . 30 4.3.3 2D CNN . 31 4.3.4 RNN servo . 31 5 Results 32 5.1 Simulator . 32 5.2 Testing criteria . 33 5.3 Reference model . 34 5.4 Herding and load balancing . 34 5.5 Measurement filters . 36 5.5.1 Low-pass filter . 36 5.5.2 Gaussian filter . 36 5.6 1D Neural network . 37 5.7 2D Neural network . 38 5.8 2D CNN . 38 5.9 2D RNN . 40 6 Discussion 42 6.1 Communication . 42 6.2 Simulator . 42 6.3 Reference model . 43 6.4 Herding and load balancing . 43 6.5 Measurement filters . 45 6.6 Deep reinforcement Learning servos . 45 6.6.1 1D Neural network . 46 6.6.2 2D Neural network . 46 6.6.3 2D CNN . 46 6.6.4 2D RNN . 46 6.6.5 Practical use for DRL servo . 47 6.6.6 Previously trained network and adaptive training . 47 6.7 Result comparison . 47 7 Conclusion 51 8 Future work 52 2 Abstract Embedded systems are all around us, and they are collecting lots of data, from the sensors in our cars to more complex system on a spaceship. To ensure high- quality data, we need to make sure the exact time of sampling the data is known. However, high precision time is usually reserved for very high-end solutions or solutions that can have a stable connection to the Global Positioning System. This report will try to go through existing solutions and look at ways to create a system that would be cost-effective to implement, easier to engineer into an embedded system and increase precision and accuracy. Through this report a new type of reference clock and switch for precision time protocol is presented, a new type of topology for embedded environments is pre- sented and simulated, and several types of deep reinforcement learning clock servo have been simulated. 3 Chapter 1 Introduction Most widely implemented time synchronization schemes are used to solve par- ticular problems, and not constructed as a general-purpose high precision time synchronization scheme. To understand the existing technologies, an under- standing of the problems they were developed to solve needs to be made. 1.1 The need for time Most living creatures known by man has some sense of time. Animals with this ability have gained an evolutionary advantage; this ability is called a circadian rhythm. In both our machines and our self, an advantage can be gained by recognizing patterns around us and exploiting them. In humans, the circadian rhythm is so built-in that the Norwegian Olympic committee suggests that an athlete should stay one day per hour timezone shift to offset jet lag. From this, an athlete would need to stay six days in New York to properly align their circadian rhythm if the person travelled from the Norwegian time zone. Other animals may synchronize their movements; one example of this is fireflies, that blink as a sort of communication. They all blink at random frequencies, but after a while, they will all synchronize to the same rate. As humans have evolved almost everything we do revolve around time. As this measurement is such widely used, it is natural to us, and all from setting up meetings, to calculate distances uses this measurement. The need to implement this time into our machines have arisen from train tables to the exact time on satellites. And the need to have this distributed, either you are in Oslo or Canberra we need to be able to have our clocks synchronized so that we can cooperate and have a common ground for measurements. 1.2 Precise digital time Speed and position were one of the first areas in the modern age where exact time was needed to calculate values accurately. During the early times of Radio Detection And Ranging (RADAR), the possibility to accurately position naval vessel and later aircraft would emerge. From this, several local positioning systems would arise such as the OMEGA, DECCA and LORAN system. All of these systems have base stations at known locations, and by measuring the 4 distance to two or more known stations, a device could calculate its position. During the development of these systems, precise clocks were developed. When the first computer network was set up, a simple way of distributing time over this network was tested. This synchronization scheme was later picked up by the Internet Engineering Task Force (IETF) and made into an official protocol, the Network Time Protocol (NTP). This is one of the first network protocols ever created, and it is even the oldest internet protocol still in use [1]. During the nineties and early noughts, the internet had spread from some select universities and into a global network. With NTP, the accuracy of the clock is typically in the several milliseconds range. For applications such as synchronization of power stations and cellular base stations, better precision and accuracy was wanted to enable new technologies. These applications would need around microsecond accuracy. There could be made new time synchronization protocols, that ran dedicated wires or used new base stations for wireless transfer of time. However, since there already was copper in the ground, enhancing the precision of NTP would be preferable. This led to the IEEE1588 standard also known as the Precision Time Protocol (PTP). This solved the problem of microsecond accuracy and precision by using the same infrastructure as NTP, only exchanging the switches and Network Interface Cards (NIC) in the nodes of the timing network. In the seventies, the U.S. Department of defence wanted to create a Global Positioning System (GPS) that could be used by all of their branches. This system would have to be accurate down to meters of locational accuracy. This need for precision was to the extent that if the clock in one of the satellites in the GPS constellation were one microsecond wrong, this would translate 261m error in the position on earth. The requirement for better than 1m accuracy on earth dictated that the clocks on the satellites would need to be less than 4ns apart from each other. This project became fully operational in 1993 for the U.S. Department of defence, and in 2000 the full access accuracy was enabled for the civilian market. Getting time from the GPS satellites soon became one of the primary ways of getting accurate time wherever there is GPS reception. The project allegedly cost several billion dollars, and it made huge strides in precision timekeeping and synchronization schemes to keep all the clocks on time. In the Large Hadron Collider (LHC) very accurate time needed to be dis- tributed to measure movements that are close to the speed of light. This means the system requirements were set to hundreds of picoseconds of precision. The method used to solve this problem was called White Rabbit (WR). WR is based on PTP, and runs on fibre-optic cables and uses very precise oscillators in every unit of the network. WR made also was a considerable leap in timing systems and set distinctions between accuracy and precision, something that will be thoroughly gone through in this report. 1.3 Embedded time synchronization In this report, three scenarios which are not adequately fulfilled by existing time synchronization technologies will be given propositions for new ways of synchronizing time. Number one is a modern car, that is a car with several cameras and even RADAR/LIDAR measurements, and all the regular sensor 5 in a vehicle, like a wheel speed sensor, several temperature sensors and power train management. Cars are typically smaller systems, with under thirty nodes that need to be synchronized and needs to be optimized for low cost and high quantity devices. Since speed is relatively low, the precision requirements are usually around millisecond level. Scenario number two is a midget surveying submarine; this is a more extensive system, typically with around a hundred nodes, and needs to be optimized for power, the precision requirements are under microsecond level.