# Energy Minimization Algorithm for Estimation of Clock Skew and Reception Window Selection in Wireless Networks

^{1}

^{2}

^{*}

## Abstract

**:**

## 1. Introduction

- (1)
- reception of the first packet from a newly deployed device, not synchronized for a longer period of time,
- (2)
- continuous clock synchronization and optimization of the listening window’s size.

## 2. Literature Review

#### Clock Skew Measurements

- Tested device generates a voltage pulse with duration of exactly 500,000 µs. Pulse duration is generated based on internal crystal oscillator.
- External tester with base accuracy << 1 ppm is used to measure real pulse width.
- Tests (1) and (2) are repeated 10 times and mean value is calculated for each device.
- Average of expected clock skew over 1,000,000 s of operation is calculated.

## 3. Proposed Solutions

#### 3.1. The Selection of a Listening Window to Establish a Connection with the Device

#### 3.1.1. Linear Increasing of Time Window

#### 3.1.2. Shifted Time Windows

#### 3.2. Follow-Up Clock Synchronization and Optimization of Listening Window’s Size

#### 3.2.1. Algorithms Selecting the Listening Moment

- An algorithm that synchronizes the receiver clock after each packet received (A1)When the packet is correctly received, the receiver clock is synchronized to its arrival time (i.e., the time of arrival becomes the “zero” time from which the time to the next expected packet arrival is counted).
- An algorithm of receiver time synchronization based on the statistics from the N most recent received transmissions (A2)The expected time of arrival of the next packet ${t}_{i+1}$ is determined on the basis of the receiver’s clock ${\tilde{t}}_{i}$ (the degree of desynchronization of the receiver’s clock towards the transmitter changes with the passage of time) and the calculated period ${o}_{i}$ after which the next transmission will occur: ${t}_{i+1}={\tilde{t}}_{i}+{o}_{i}$. The algorithm recalculates the interval I, the value of which is added to the expected time of arrival of the next packet ${\tilde{t}}_{i+1}={t}_{i+1}+I={\tilde{t}}_{i}+{o}_{i}+I$. The interval is determined according to the formula:$$\begin{array}{c}\hfill I=\widehat{B}\xb7({t}_{i+1}-{\tilde{t}}_{i}),\end{array}$$$$\begin{array}{c}\hfill \widehat{B}=\frac{{\sum}_{i=1}^{N}\mathsf{\Delta}{B}_{i}}{{\tilde{t}}_{N}-{\tilde{t}}_{1}},\end{array}$$$\mathsf{\Delta}{B}_{i}=t{r}_{i}-{\tilde{t}}_{i}$, and $t{r}_{i}$ is the time when i-th message actually arrives at the receiver.

#### 3.2.2. Algorithms Controlling the Selection of the Listening Window Length

- Window size adjustment algorithm based on the transmitter deviation (W1) The initial size of the window is determined based on empirical experience, and is then gradually increased or decreased according to the following relationships:
- -
- if the deviation of the next 10 (current + last 9) consecutive packet reception times (relative to the expected packet arrival time) is less than 30% of half of the current listening window length, then the window length is reduced by 30%;
- -
- if the deviation of the reception time of the last packet relative to its expected time of arrival is greater than 70% of half of the length of the current listening window, then the length of the window is increased by 30%;
- -
- if the packet is not received then the window length is increased by 30%.

- Window size adjustment algorithm based on the transmitter’s clock deviation with the continuously calculated probability of the window elongation (W2)The initial window size is determined by empirical experimentation, and then gradually increased or decreased according to the relationships presented in the algorithm (W1) with the following change:
- -
- if at the moment ${\tilde{t}}_{i}$ we denote the number of correctly received packets by $cR$, and the number of transmitted packets R, then with the probability of $\frac{cR}{R}$ we extend the length of the listening window. We also introduce a threshold ${D}_{min}$ of the calculated value $\frac{cR}{R}$, which is a minimum size of the window.

- Window size adjustment algorithm based on the statistics from the N most recent received transmissions (W3)The size W of the window is calculated from the formula $W=2\xb7{A}_{i}\xb7({t}_{i+1}-{\tilde{t}}_{i})\xb7\widehat{B}$ taking into account the following dependencies:
- -
- if a packet is received then the next listening window length parameter is ${A}_{i+1}={A}_{i}\xb70.9$, with condition ${A}_{i+1}\ge {A}_{min}$, where ${A}_{min}$ is empirically determined;
- -
- if no packet was received then the next listening window length parameter is ${A}_{i+1}={A}_{i}\xb71.2$;
- -
- the N-element average is calculated from the Equation (2) presented in algorithm (A2), with the condition $\widehat{B}\ge {\widehat{B}}_{min}$, where the value ${\widehat{B}}_{min}$ is established empirically.

## 4. Tests and Experiments

- initial interval before first transmission $X=15,552,000\left[s\right]$ (180 days),
- standard deviation of time drift $Y=0.000005$ (which equals 5 parts per million (ppm)), consists of two parts: a constant drift randomly selected from the normal distribution, with a standard deviation of 2.5 ppm, and an additional skew also with a standard deviation of 2.5 ppm randomized for each interval.
- uniform packet loss model, with loss probability set to 5, 10, 20 and 30%.

- Reconnection of the device disconnected from the system for a longer period of time.
- Follow-up clock synchronization and optimization of listening window’s size.

- Reconnection of the device disconnected from the system was performed on simulation made in Microsoft Excel. We created two sheets, one with 140 thousand rows and the second with one million rows (each row represents one device), performing thorough research covering a multitude of independent time skew possibilities. Each row consists of time skew values for 3 consecutive transmission intervals calculated according to a normal distribution (see Section 3.2); qualification formulas to determine if the time burdened with transmitter crystal skew is inside a window range; energy consumption formulas to calculate overall cost for transmission reception.
- Follow-up clock synchronization and optimization of listening window’s size was performed on a simulation model made in the Objective Modular Network Testbed in C++ (OMNeT++), a modular, component-based C++ simulation library and framework. We programmed a complex behavior of a receiver module listening to the transmitter module packets sent accordingly to a transmission scenario in times burdened with transmitter crystal skew error.

#### 4.1. Contacting the Device Disconnected from the Network for a Long Time Period

#### 4.2. Continuous Clock Synchronization and Optimization of Listening Window Size in Periodically Scheduled Transmissions

## 5. Discussion

## 6. Conclusions

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Data Availability Statement

## Conflicts of Interest

## References

- Zhang, X.; Kang, G.S. E-MiLi: Energy-minimizing idle listening in wireless networks. IEEE Trans. Mob. Comput.
**2012**, 11, 1441–1454. [Google Scholar] [CrossRef] - Mo, S.; Hackmann, G.; Lu, C. Energy-efficient low power listening for wireless sensor networks in noisy environments. In Proceedings of the 12th International Conference on Information Processing in Sensor Networks, Philadelphia, PA, USA, 8–11 April 2013. [Google Scholar]
- Sundararaman, B.; Buy, U.; Kshemkalyani, A.D. Clock synchronisation for wireless sensor networks: A survey. Ad Hoc Netw.
**2005**, 3, 281–323. [Google Scholar] [CrossRef] - Ouellette, M.; Ji, K.; Liu, S.; Li, H. Using IEEE 1588 and boundary clocks for clock synchronisation in telecom networks. IEEE Commun. Mag.
**2011**, 49, 164–171. [Google Scholar] [CrossRef] - Bladsjö, D.; Hogan, M.; Ruffini, S. Synchronisation aspects in LTE small cells. IEEE Commun. Mag.
**2013**, 51, 70–77. [Google Scholar] [CrossRef] - De Carvalho Silva, J.; Rodrigues, J.J.P.C.; Alberti, A.M.; Solic, P.; Aquino, A.L.L. LoRaWAN—A low power WAN protocol for Internet of Things: A review and opportunities. In Proceedings of the 2nd International Multidisciplinary Conference on Computer and Energy Science (SpliTech), Split, Croatia, 12–14 July 2017. [Google Scholar]
- Del-Valle-Soto, C.; Mex-Perera, C.; Nolazco-Flores, J.A.; Velázquez, R.; Rossa-Sierra, A. Wireless Sensor Network Energy Model and Its Use in the Optimization of Routing Protocols. Energies
**2020**, 13, 728. [Google Scholar] [CrossRef] [Green Version] - Rhee, I.-K.; Lee, J.; Kim, J.; Serpedin, E.; Wu, Y.-C. Clock synchronisation in Wireless Sensor Networks: An Overview. Sensors
**2009**, 91, 56–85. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Le Cam, V.; Bouche, A.; Pallier, D. Wireless sensors synchronisation: An accurate and deterministic gps-based algorithm. In Proceedings of the IWSHM, Stanford, CA, USA, 12–14 September 2017. [Google Scholar]
- Pallier, D.; Le Cam, V.; Pillement, S. Energy-efficient GPS synchronisation for wireless nodes. IEEE Sens. J.
**2020**. [Google Scholar] [CrossRef] - Vittoz, E.; Degrauwe, M.; Bitz, S. High-performance crystal oscillator circuits: Theory and application. IEEE J. Solid State Circuits
**1988**, 23, 774–783. [Google Scholar] [CrossRef] [Green Version] - Zhou, H.; Nicholls, C.; Kunz, T.; Schwartz, H. Frequency Accuracy & Stability Dependencies of Crystal Oscillators; Systems and Computer Engineering; Technical Report SCE-08-12; Carleton University: Ottawa, ON, Canada, 2008. [Google Scholar]
- Barnes, J. The measurement of linear frequency drift in oscillators. In Proceedings of the 15th Annual Precise Time and Time Interval Systems and Applications Meeting, Washington, DC, USA, 6–8 December 1983. [Google Scholar]
- Rong, Q.; Huang, X.; Tan, F. Analysis and measurement of jitter in crystal oscillator. In Proceedings of the 2005 International Conference on Communications, Circuits and Systems, Hong Kong, China, 27–30 May 2005; Volume 2. [Google Scholar]
- Shahram, S.-P.; Corrêa Alegria, F.; Làzaro, A.M.; Del Rio, J. Time drift of ocean bottom seismometers (OBS). In Proceedings of the 19th IMEKO World Congress on Fundamental and Applied Metrology, Lisbon, Portugal, 6–11 September 2009. [Google Scholar]
- Liu, Z.; Cheng, Y.; Wang, P.; Yu, Y.; Long, Y. A method for remaining useful life prediction of crystal oscillators using the Bayesian approach and extreme learning machine under uncertainty. Neurocomputing
**2018**, 305, 27–38. [Google Scholar] [CrossRef] - Li, H.; Zhang, X.; Li, Z.; Pan, H.; Mao, W.; Yan, Y.; Yu, B.; Tang, J. A Novel High-Precision Method Based on Sequence Weighted Adaptive Unscented Kalman Filter for GPS Disciplined Crystal Oscillator. In Proceedings of the 2020 12th IEEE PES Asia-Pacific Power and Energy Engineering Conference (APPEEC), Nanjing, China, 20–23 September 2020. [Google Scholar]
- Skiadopoulos, K.; Tsipis, A.; Giannakis, K.; Koufoudakis, G.; Christopoulou, E.; Oikonomou, K.; Kormentzas, G.; Stavrakakis, I. Synchronisation of data measurements in wireless sensor networks for IoT applications. Ad Hoc Netw.
**2019**, 89, 47–57. [Google Scholar] [CrossRef] - Castillo-Secilla, J.; Palomares, J.; Olivares, J. Temperature-Compensated Clock Skew Adjustment. Sensors
**2013**, 13, 10981–11006. [Google Scholar] [CrossRef] [PubMed] - Liu, Z.; Ma, Q.; Liu, W.; Sheng, V.; Zhang, L.; Liu, G. Access Control Model Based on Time synchronisation Trust in Wireless Sensor Networks. Sensors
**2018**, 18, 2107. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Lin, L.; Ma, S.; Ma, M. A Group Neighborhood Average Clock synchronisation Protocol for Wireless Sensor Networks. Sensors
**2014**, 14, 14744–14764. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Tessaro, L.; Raffaldi, C.; Rossi, M.; Brunelli, D. Lightweight synchronisation Algorithm with Self-Calibration for Industrial LORA Sensor Networks. In Proceedings of the 2018 Workshop on Metrology for Industry 4.0 and IoT, Brescia, Italy, 16–18 April 2018; pp. 259–263. [Google Scholar] [CrossRef] [Green Version]
- Kazaz, T.; Coutino, M.; Janssen, G.J.M.; Leus, G.; Van der Veen, A. Joint Ranging and Clock synchronisation for Dense Heterogeneous IoT Networks. In Proceedings of the 2018 52nd Asilomar Conference on Signals, Systems, and Computers, Pacific Grove, CA, USA, 28–31 October 2018; pp. 2169–2173. [Google Scholar] [CrossRef] [Green Version]
- Kim, K.S.; Lee, S.; Lim, E.G. Energy-Efficient Time synchronisation Based on Asynchronous Source Clock Frequency Recovery and Reverse Two-Way Message Exchanges in Wireless Sensor Networks. IEEE Trans. Commun.
**2016**, 65, 347–359. [Google Scholar] [CrossRef] [Green Version] - Zhou, F.; Wang, Q.; Han, G.; Qiao, G.; Sun, Z.; Niaz, A. APE-Sync: An Adaptive Power Efficient Time synchronisation for Mobile Underwater Sensor Networks. IEEE Access
**2019**, 7, 52379–52389. [Google Scholar] [CrossRef] - FUOTA Working Group of the LoRa Alliance LoRaWAN Application Layer Clock Synchronisation Specification v1.0.0. Available online: https://lora-alliance.org/resource_hub/lorawan-application-layer-clock-synchronization-specification-v1-0-0/ (accessed on 22 February 2021).
- Wadatkar, P.; Zennaro, M.; Manzoni, P. On Time synchronisation of LoRaWAN Based IoT Devices for Enhanced Event Correlation. In Proceedings of the 6th EAI International Conference on Smart Objects and Technologies for Social Good, Aveiro, Portugal, 14–16 September 2020; pp. 261–264. [Google Scholar]
- Singh, R.; Berkvens, R.; Weyn, M. Time synchronisation with Channel Hopping Scheme for LoRa Networks. In Proceedings of the 13th International Conference on P2P, Parallel, Grid, Cloud and Internet Computing, Taichung, Taiwan, 27–29 October 2018; pp. 786–797. [Google Scholar]
- Shi, F.; Li, H.; Yang, S.X.; Tuo, X.; Lin, M. Novel Maximum Likelihood Estimation of Clock Skew in One-Way Broadcast Time Synchronization. IEEE Trans. Ind. Electron.
**2020**, 67, 9948–9957. [Google Scholar] [CrossRef] - Shi, F.; Yang, S.X.; Tuo, X.; Ran, L.; Huang, Y. A Novel Rapid-Flooding Approach With Real-Time Delay Compensation for Wireless-Sensor Network Time Synchronization. IEEE Trans. Cybern.
**2020**, 1–14. [Google Scholar] [CrossRef] - Pérez-Solano, J.J.; Felici-Castell, S. Adaptive time window linear regression algorithm for accurate time synchronization in wireless sensor networks. Ad Hoc Netw.
**2015**, 24, 92–108. [Google Scholar] [CrossRef]

**Figure 5.**Dependence of the energy cost on the probability of packet delivery for the two proposed algorithms in comparison with using constant size time window. Numbers above data points denote $\alpha $ value.

**Figure 6.**Dependence of the energy cost on the probability of packet delivery. Numbers above data points denote $\alpha $ value.

**Figure 7.**Comparison of the message reception probability over three trials for different packet loss probability for the linear window size increase and window shift algorithms.

**Figure 8.**Comparison of the energy cost for different packet loss probability for the linear window size increase and window shift algorithms.

**Figure 9.**Comparison of algorithms in terms of the average number of packets outside the listening window.

**Figure 10.**Comparison of algorith ms in terms of the average amount of energy used for listening during a single transmission.

**Figure 12.**The degree of improvement brought by the algorithm (W3) in relation to the algorithm (W1) —algorithm (W2) is omitted in this statement because it did not bring a significant improvement.

Days | $\mathit{X}\left[\mathit{s}\right]$ | $\mathit{\sigma}$ | |
---|---|---|---|

First period | 180 | 15,552,000 | 77.76 |

Second and third periods | 1 | 86,400 | 0.432 |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Gorawski, M.; Grochla, K.; Marjasz, R.; Frankiewicz, A.
Energy Minimization Algorithm for Estimation of Clock Skew and Reception Window Selection in Wireless Networks. *Sensors* **2021**, *21*, 1768.
https://doi.org/10.3390/s21051768

**AMA Style**

Gorawski M, Grochla K, Marjasz R, Frankiewicz A.
Energy Minimization Algorithm for Estimation of Clock Skew and Reception Window Selection in Wireless Networks. *Sensors*. 2021; 21(5):1768.
https://doi.org/10.3390/s21051768

**Chicago/Turabian Style**

Gorawski, Michał, Krzysztof Grochla, Rafał Marjasz, and Artur Frankiewicz.
2021. "Energy Minimization Algorithm for Estimation of Clock Skew and Reception Window Selection in Wireless Networks" *Sensors* 21, no. 5: 1768.
https://doi.org/10.3390/s21051768