northumbria research linknrl.northumbria.ac.uk/36196/1/zong et al - simulation and evaluation...

15
Northumbria Research Link Citation: Zong, Yan, Dai, Xuewu, Gao, Zhiwei, Binns, Richard and Busawon, Krishna (2018) Simulation and evaluation of pulse-coupled oscillators in wireless sensor networks. Systems Science & Control Engineering, 6 (1). pp. 337-349. ISSN 2164-2583 Published by: Taylor & Francis URL: http://dx.doi.org/10.1080/21642583.2018.1496043 <http://dx.doi.org/10.1080/21642583.2018.1496043> This version was downloaded from Northumbria Research Link: http://nrl.northumbria.ac.uk/36196/ Northumbria University has developed Northumbria Research Link (NRL) to enable users to access the University’s research output. Copyright © and moral rights for items on NRL are retained by the individual author(s) and/or other copyright owners. Single copies of full items can be reproduced, displayed or performed, and given to third parties in any format or medium for personal research or study, educational, or not-for-profit purposes without prior permission or charge, provided the authors, title and full bibliographic details are given, as well as a hyperlink and/or URL to the original metadata page. The content must not be changed in any way. Full items must not be sold commercially in any format or medium without formal permission of the copyright holder. The full policy is available online: http://nrl.northumbria.ac.uk/pol i cies.html This document may differ from the final, published version of the research and has been made available online in accordance with publisher policies. To read and/or cite from the published version of the research, please visit the publisher’s website (a subscription may be required.)

Upload: others

Post on 19-Oct-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

  • Northumbria Research Link

    Citation: Zong, Yan, Dai, Xuewu, Gao, Zhiwei, Binns, Richard and Busawon, Krishna (2018) Simulation and evaluation of pulse-coupled oscillators in wireless sensor networks. Systems Science & Control Engineering, 6 (1). pp. 337-349. ISSN 2164-2583

    Published by: Taylor & Francis

    URL: http://dx.doi.org/10.1080/21642583.2018.1496043

    This version was downloaded from Northumbria Research Link: http://nrl.northumbria.ac.uk/36196/

    Northumbria University has developed Northumbria Research Link (NRL) to enable users to access the University’s research output. Copyright © and moral rights for items on NRL are retained by the individual author(s) and/or other copyright owners. Single copies of full items can be reproduced, displayed or performed, and given to third parties in any format or medium for personal research or study, educational, or not-for-profit purposes without prior permission or charge, provided the authors, title and full bibliographic details are given, as well as a hyperlink and/or URL to the original metadata page. The content must not be changed in any way. Full items must not be sold commercially in any format or medium without formal permission of the copyright holder. The full policy is available online: http://nrl.northumbria.ac.uk/pol i cies.html

    This document may differ from the final, published version of the research and has been made available online in accordance with publisher policies. To read and/or cite from the published version of the research, please visit the publisher’s website (a subscription may be required.)

    http://nrl.northumbria.ac.uk/policies.html

  • SYSTEMS SCIENCE & CONTROL ENGINEERING: AN OPEN ACCESS JOURNAL2018, VOL. 6, NO. 1, 337–349https://doi.org/10.1080/21642583.2018.1496043

    Simulation and evaluation of pulse-coupled oscillators in wireless sensornetworks

    Yan Zong , Xuewu Dai, Zhiwei Gao, Richard Binns and Krishna Busawon

    Department of Mathematics, Physics and Electrical Engineering, Northumbria University, Newcastle upon Tyne, UK

    ABSTRACTThe clock in embedded systemsusually is drivenby a crystal oscillator and implemented via a counterregister, such a crystal clock is non-identical and drifting due to the manufacturing tolerance andvariation of working conditions. Thus, a common time among distributed wireless sensor nodes,also referred to as Time Synchronization, is required for many time-sensitive wireless applications,such as collaborative conditionmonitoring, coordinated control and localization. Inspiredby fireflies’behaviour, the Pulse-Coupled Oscillators (PCO) has been proposed for synchronization in complexnetworks. Since the concurrent transmission of PCO’s Pulses is impossible in Wireless Sensor Net-works (WSNs), the desynchronization mechanism is adopted to ensure the implementation of PCOin WSNs. Moreover, due to the uncertainties in radio channels and the complexities of communi-cation protocols and packet-exchange behaviours in wireless networks, it is challenging to have aclosed-form solution to the performance of PCO synchronization inWSNs. The realistic software sim-ulation, in particular, the discrete event simulator has been a powerful tool to exam the performanceof communication protocols in various scenarios, since an order sequence of well-defined event intime is to represent the behaviour of a complex system. This paper presents the development of apulse-coupled oscillators time synchronization simulator on the OMNeT++ platform for simulatingand studying its behaviour and performance in sensor networks. A clock module with configurablephase and frequency noises, and adjustable and higher resolution is developed to mimic variouscrystal oscillators in embedded systems, for example, the 32.768 kHz real-time clock. The developedsimulator also supports the full functions devices defined by ZigBee protocol, which allows realisticsimulation ofmulti-hop IEEE 802.15.4wireless networks. Finally, the intensive simulations of classicalPCO with the refractory period in IEEE 802.15.4-based WSNs have been carried out to demonstratethe features and benefits of the developed simulator. It is shown that for the non-identical and time-varying PCO clocks in the WSNs, the achieved synchronization will lose gradually, and the time thatmaintained synchronization depends on the length of refractory period.

    ARTICLE HISTORYReceived 28 February 2018Accepted 29 June 2018

    KEYWORDSTime synchronization;pulse-coupled oscillators;desynchronization;OMNeT++ simulation;wireless sensor networks

    1. Introduction

    Time Synchronization (TS), aiming to provide a com-mon sense of timing among distributed sensor nodes,is one of the enabling technologies for many WirelessSensor Networks (WSNs) applications, such as collabora-tive condition monitoring, coordinated control, time-of-flight localization and underwater navigation and tacticalsurveillance. In such wireless applications, a network ofdistributed sensors is dedicated to cooperatively moni-tor physical or environmental variables such as location,sound and pressure at different locations, which requiresprecise timing among sensor nodes.

    Even though the behaviour of complicated wirelessnetworks is too complex to have a closed-form solutionto the time synchronization performance in WSNs, theDiscrete Event Simulator (DES) has been recognized as a

    CONTACT Yan Zong [email protected]

    powerful simulation tool for studying complex systems(Huang et al., 2015).

    1.1. Pulse-coupled oscillators and timesynchronization in wireless sensor networks

    Packet-exchange time synchronization is recognized asone of the commonly used synchronization methods inlow-cost indoor or underwater WSNs. This is particularlytrue in those wireless applications where satellite-basedtime synchronization method is impossible due to theeconomic issue and the difficulty to receive the satellite’ssignal (e.g. Amazon robotic warehousemanagement sys-tems (Shead, 2017) and underwater monitoring (Petrioli,Petroccia, Potter, & Spaccini, 2015)). Typical examples ofpacket-exchange based time synchronization algorithms

    © 2018 The Author(s). Published by Informa UK Limited, trading as Taylor & Francis Group.This is an Open Access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use,distribution, and reproduction in any medium, provided the original work is properly cited.

    http://www.tandfonline.comhttp://crossmark.crossref.org/dialog/?doi=10.1080/21642583.2018.1496043&domain=pdfhttp://orcid.org/0000-0002-5196-8025mailto:[email protected]://creativecommons.org/licenses/by/4.0/

  • 338 Y. ZONG ET AL.

    are Precise Time Protocol (PTP) (IEEE Instrumentation andMeasurement Society, 2008), Reference Broadcast Syn-chronization (RBS) (Elson,Girod, & Estrin, 2002) andFlood-ing Time Synchronization Protocol (FTSP) (Maroti, Kusy,Simon, & Ledeczi, 2004). In these methods, clock off-sets among sensor nodes, observedby recordingpacket’stransmission and received time (also known as the times-tamp), are used to correct the drifting clocks of sen-sor nodes. Obviously, the precision of packet-exchangebased time synchronization is dependent on the accuracyof the timestamp. Moreover, since the synchronizationerror of each hop is accumulated with the increasementof hop distance, the performance of packet-exchangetime synchronization is weakened in themulti-hop large-scale WSNs.

    On the other hand, inspired by the synchronous flash-ing of fireflies observed in certain parts of southeastAsia, a bio-inspired mathematical model, namely, Pulse-Coupled Oscillators (PCO) has been proposed to enablesynchronization in complex networks (Mirollo & Strogatz,1990) (Mohammadpour & Binazadeh, 2018). In the pulse-coupled oscillators, the Pulse is broadcasted by individualoscillator periodically according to its state andoscillationfrequency. Upon receiving a Pulse from neighbours, theoscillator adjusts its state to catch up the firing oscillators.Eventually, all oscillators in the network fire and broad-cast the Pulses simultaneously and synchronization of thenetwork is achieved. However, most research work inPCO literature is theoretical studies. The classical PCO by(Mirollo& Strogatz, 1990)was approved that synchroniza-tion can be achieved under the following assumptions:(i) All the internal dynamics of oscillators are identical(i.e. the frequencies of oscillators are same). (ii) There isno coupling delay during the pulse-exchange among theoscillators. All of the aforementioned assumptions are nottrue when it comes to any real-world environments, andclassical PCO need be improved to implement it to realis-tic networks. It is worth noting that the term oscillator isused todescribe themathematicalmodel, the term sensornode is adopted when implementing the mathematicalmodel to wireless sensor networks, and the Pulse packetof WSNs is used to describe the physical Pulse signalin PCO.

    Although PCO features at its simplicity and scalabil-ity, only a few studies are about applying PCO for timesynchronization in WSNs. This is because some assump-tions in PCO theories, such as identical and constantcrystal oscillator frequency in all sensor nodes, concur-rent transmission of firing Pulse packet and no trans-mission delay, are not feasible in any practical WSNs(Bojic & Nymoen, 2015). In embedded systems, the crys-tal oscillators’ frequencies indeed are non-identical andtime-varying due to the manufacturing tolerance and

    changes of environment factors (e.g. temperature andpower supply voltages). In Radio Frequency (RF) com-munications, packet transmission delay always exists andmay be varying randomly depending on the length of thepacket, channel conditions and the Media Access Con-trol (MAC) scheme. When the delay is present in a systemof pulse-coupled oscillators, the classical PCO algorithmof (Mirollo & Strogatz, 1990) fails to achieve synchro-nization (Ernst, Pawelzik, & Geisel, 1995), (Mathar & Mat-tfeldt, 1996), (Tyrrell, Auer, & Bettstetter, 2010). To addressthis challenge, the refractory period was introduced by(Mathar & Mattfeldt, 1996) to retain the stability of a net-work. (Mathar & Mattfeldt, 1996) and (Tyrrell, Auer, &Bettstetter, 2008) stated that the synchronization accu-racy was bounded by the coupling delay (e.g. the propa-gation and transmission delays in WSNs) in the two-nodenetwork. (Tyrrell et al., 2008) also analysed the accuracyof PCOwith the refractory period in fully-connectedwire-less networks, and it was concluded that neighbouringnodes are synchronized with an accuracy that is alwaysequal or below the coupling delay (i.e. propagation delayin (Tyrrell et al., 2008)) in multi-nodes network. It is worthnoting that oscillators analyzed and simulated in (Mathar& Mattfeldt, 1996) and (Tyrrell et al., 2008) are identicaloscillators (i.e. same internal dynamics for allWSNs nodes’clock oscillators). Even though it was proved that the syn-chronization of PCO clocks with the different constantfrequencies can be achieved under two conditions (i.e.instantaneous synchronization condition and synchro-nization maintaining condition) (An et al., 2010), thesetwo conditions of (An et al., 2011) may not be met inpractice.

    Another issue on implementing PCO to practicalWSNsis impossible concurrent transmissionof PCO’s firingPulsepacket. In wireless communications of single RF chan-nel, only one packet transmission is allowed at any time.Otherwise, packets from concurrent transmitters inter-ferewith eachother (knownas transmission collision) andno packet can be successfully received at the receiver.To address this issue, the concept of desynchronization,logical opposite of synchronization, is adopted. In thisapproach, the Pulsepackets are transmitted in a uniformlydistributed fashion (i.e. as far away as possible from allother nodes), rather than the Pulse packets of all nodesare broadcasted to the wireless channel simultaneously(Degesys, Rose, Patel, & Nagpal, 2007).

    Since the fact that the assumption of identical oscilla-tors, no transmission delay and concurrent transmissionof classical PCO cannot be met in any real-world environ-ments, the PCO dynamics are too complicated to have aclosed-form solution if those assumptions are released.As a result, an analytic solution to PCO’s performance inrealistic WSNs is very difficult, and it is of importance to

  • SYSTEMS SCIENCE & CONTROL ENGINEERING: AN OPEN ACCESS JOURNAL 339

    evaluate PCO’s behaviour and performance in WSNs byrealistic simulation.

    1.2. Discrete event simulator

    With the rapid development of the computer science,discrete event simulator has become a powerful cutting-edge simulation tool for studying complex systems, suchas complicated networks and protocols. In the DES, anordered sequence of well-defined events in time (e.g.packet transmission and reception, interrupts and so on)is used to represent the complex behaviours of compli-cated networks and protocols (Huang et al., 2015). Thisfeature ensures the DES be a good choice for simulat-ing synchronizationprotocols in variousnetworks.Widelyused DESs for WSNs include the commercial OPNET(Kucuk, Bandirmali, Kavak, & Atmaca, 2013), open sourcesimulator NS2/3 (NS3, 2018) and OMNeT++ (OMNeT++,2018). It has been shown that the software simulatorOMNeT++ is one of the best simulation platforms forWSNs in academia, featuring at rich simulation libraries,modular design and open structure, debugging and trac-ing capability, graphical user interfaces, and simulationefficiency (such as, delivery ratio, memory efficiency, CPUUtilization and Computational Time) (Khan, Hasbullah, &Nazir, 2014), (Sharif & Sadeghi-Niaraki, 2017), (Xian, Shi, &Huang, 2008).Many simulators also have beendevelopedon the platform of OMNeT++, such as INET, Castalia,MiXiM and so on.

    There have been some DESs for simulating time syn-chronization, such as Castalia with clocks (Ferrari, Meier,& Thiele, 2010) and realistic simulator TS2 (Huang et al.,2015). Since industrial WSNs usually work in a compli-cated electromagnetic environment, and a detailed radiochannel model is required to simulate the packet trans-mission, environmental noise andpacket loss. In addition,there are conflicts and interferences among multi-pointcommunication, and the simulation of the physical layerhas a significant impact on the accuracy of WSNs sim-ulation (Huang et al., 2015). Several OMNeT++-basedsimulators have been developed in the last decade forWSNs simulation. Most of them are for the simulation ofMAC and higher layers, and their treatment to the phys-ical layer, hardware and wireless channel are superficial(Huang et al., 2015). On the OMNeT++ platform, MiXiM(Kopke et al., 2008) is a simulator that has detailed radiochannel model and physical layer to achieve the high-fidelity simulation of physical and MAC layers. On thebasis of MiXiM, a recent realistic time synchronizationsimulator for wireless sensor networks is TS2 of (Huanget al., 2015), which is developed to simulate and evaluatethe PTP-like time synchronization inWSNs. However, onlythe Reduced Function Device (RFD) of ZigBee protocol is

    simulated in TS2. Even though both (Ferrari et al., 2010)and (Huang et al., 2015) provide the realistic drifting clockmodel, in the literature, there still has a lack of a simula-tor that simulates the PCO synchronization with realisticcrystal oscillator clocks, radio channel model and IEEE802.15.4 standard.

    The main contribution of this paper presents thedevelopment of a high fidelity PCO simulator for IEEE802.15.4-based WSNs, including a PCO model imple-mented by crystal oscillators, desynchronization mecha-nism to implement transmission of PCO’s Pulse packetwithout violating the non-concurrent transmission con-straint in IEEE 802.15.4 wireless networks. Based on thedesynchronization mechanism, a TS superframe is pro-posed that is compatible with the IEEE 802.15.4 super-frame. The drifting PCO clock is modelled and simulatedrealisticallywith configurablephase and frequencynoisesand at adjustable and higher resolution, to mimic thecrystal oscillators in embedded systems, for example, the32.768 kHz Real-TimeClock (RTC) oscillator. Anothermaincontribution of developed simulator developed on thebasis of MiXiM features at a generic, flexible and modulararchitecture for future extension. The developed simula-tor also supports both Full Functions Devices (FFD) andRFD of ZigBee protocol, which is compatible with IEEE802.15.4 standard in realistic distributed sensor networksand enables the high scalability formulti-node andmulti-hop distributed sensor networks simulation. The inten-sive simulationsof classical PCOwith the refractoryperiodin IEEE 802.15.4-based WSNs have been carried out todemonstrate the application of the developed simulator,and study PCO’s behaviour and evaluate its synchroniza-tion performance in realistic WSNs. It is shown that dueto the existence of the transmission delay, the full syn-chronization cannot be achieved in the identical classicalPCO clocks of wireless networks. Moreover, for the non-identical and time-varying PCO clocks in the WSNs, theachieved synchronizationwill losegradually, and the timethat PCO clocks maintain the synchronization is depen-dent on the refractory period.

    The rest of this paper is as follows: Section 2 intro-duces the framework of the developed simulator. Section3 presents the development of PCO clock model, andthe classical PCO correction mechanism with the refrac-tory period is detailed in Section 4. The proposed IEEE802.15.4 compatible superframe based on the desynchro-nization mechanism, and timestamping are also intro-duced in Section 5. Section 6 details the implementationof PCO clock, desynchronization and FFD in OMNeT++.Finally, the time synchronizationperformanceof identicalclassical PCO with the refractory period in both single-hop and multi-hop WSNs, and non-identical classicalPCOs with the refractory period in single-hop WSNs are

  • 340 Y. ZONG ET AL.

    evaluated in Section 7, followed by Section 8 presents theconclusion.

    2. Simulation framework

    The objective of the developed simulator is a simulationframework capable of realistically modelling and simulat-ing drifting PCO clocks at higher resolution and in large-scalemulti-hop realistic distributed sensor networks. Thissection presents the requirement analysis and the archi-tecture of developed simulator.

    Compared to the wired channel, the wireless chan-nel in WSNs has complicated impacts, such as the fad-ing, shadowing, interference and collision resulting frommedia sharing, hidden terminals and so on, on the timesynchronization performance. Particularly, the classicalPCO assumes the delay that a complete Pulse packetis received successfully is zero. However, due to thetransmission delay, possible collision, backoff and re-transmission, the assumption of zero delay is unable tobe met in any real-world WSNs. Other factors, such asthe technological limitation of IEEE 802.15.4 wireless net-works (e.g. the non-concurrent transmission constraint),also have negative impacts on the time synchronization.Since it is difficult to study these impacts analyticallyresulting from their complexity, it is recommended toadopt a realistic simulator to make a sound performanceanalysis. In order to build a realistic simulator of timesynchronization, an accurate and detailed clock model,wireless sensor nodes, wireless channel and networksand in-depth understanding of the inter-effects amongrelated factors are required. It is possible to developsuch a detailed model from scratch; however, it will be atedious and error-prone task (Huang et al., 2015). Thanksto many researchers’ contributions to OMNeT++ open-source community, some existing modules and sourcecodes can be re-used to develop the simulator.

    The structure of proposed simulation framework isshown in Figure 1, and four main components of pro-posed simulation framework are as follows:

    • World Manager module defines the environmentmodel representing the geographical environment ofrealistic WSNs, namely, the size of the WSNs’ deploy-ment area, obstacles blocking/attenuating wirelesssignals and so on.

    • Connection Manager module manages the mobilityand connectivity, such as the varies of the wirelesschannel and the change of network topology resultingfrom the moving nodes.

    • The wireless channel, Channel, denotes the featuresof the wireless channels and its impacts on packetexchange among sensor nodes, such as propagationdelay, collision, attenuation and interference.

    • WSNs nodes: there are three types of nodes, namely,master, slave and relay nodes. The relay node used inthe multi-hop network is to realize the FFD functions,and themaster and slave nodes in the simulator are tomimic the RFDs.

    In Figure 1, four layers of ZigBee protocol stack areimplemented to the simulator by C++ classes (referredto as modules), namely, the application layer (app), thenetwork layer (netw), the MAC layer (mac) and the phys-ical layer (phy). It is notable that, as a realistic simulator,the phymodule mimics the TI CC2420 IEEE 802.15.4 chip,including thewireless channel sensingprocedure, SNIR ofeach packet and so on, which ensures a better and muchaccurate simulation of the packet transmission delays,jitters and the PCO in IEEE 802.15.4 networks (Huanget al., 2015). Since the PCO indeed is a cross-layer pro-tocol requiring twomain procedures, resetting-firing andtransmitting/receipting, the PCO is implemented by twomodules in the simulator. The TDMA mac module is totransmit or receive the packet to/from wireless channel,

    Figure 1. Simulation framework.

  • SYSTEMS SCIENCE & CONTROL ENGINEERING: AN OPEN ACCESS JOURNAL 341

    and the Core module is for firing a Pulse of PCO. More-over, four additional modules used in the simulator areas follows: (i) Clockmodule, providing local time to othermodules of the sensor node, simulates the node’s clock.(ii) Mobility module stores and updates the location andspeeds of nodes, reporting them to the World Managerand ConnectionManager. (iii)WorldManager and Connec-tionManager update the location of nodes and configurethe wireless links in the network topology. (iv) TSmoduleis for timestamping, which is able to realize the differentaccuracy timestamp.

    Compared with most existing simulators, the pro-posed simulation framework provides the followingunique features: (i) Reality and fidelity: the WSNs node’svarious layers, drifting PCO clock can be simulated accu-rately and realistically. (ii) Scalability and multi-hop sim-ulation: simulation of serval relay and slave nodes arerequired, as well as themulti-hop time synchronization inthe large-scale WSNs. (iii) Extendibility and compatibility:the simulator is compatiblewithmost existing simulators,e.g. MiXiM, so that the simulator can be easily extendedto existing or emerging networks, such as WiFi, WiMAX,LTE and so on. These features make the proposed simula-tor more realistic for PCO synchronization of distributedsensor networks.

    3. Modelling dynamics of pulse-coupledoscillator clocks

    The clock of a sensor node usually is constructed fromhardware and software components. To be specified, theclockmodule of aWSNs node consists of (i) a crystal oscil-lator ticks at a specified frequency; (ii) a counter (or a chainof counters), counts the number of ticks generated by thecrystal oscillator. Physically, the output of a crystal oscil-lator is periodic sinusoidal or square waves, while, thisoutput can be converted to a count value plus one perclock cycle through the process the counter which is dig-ital timing circuit (Zong, Dai, & Gao, 2017), and this countvalue can be used to indicate the time by comparing andconverting to the count value. The output of a crystaloscillator is generally called the physical clock, while, thecumulative count value of the counter register is calledthe software clock. To avoid the physical clock disconti-nuity, it is recommended to apply the time synchroniza-tion algorithms to software clock, rather than the physicalclock (Bojic & Nymoen, 2015), and the time synchroniza-tion algorithms in this paper are therefore to adjust thesoftware clock.

    3.1. Drifting classic clock

    In reality, owing to manufacturing tolerance and crys-tal capacitive loading mismatch, the phase of a crystal

    oscillator suffers from random changes, and the oscil-lator frequency is also time-varying and drifting due tothe crystal and oscillator temperature drift (Zong, Dai, &Gao, 2017). In order to model the non-identical and time-varying clock in the distributed system, a randomprocessφ(t), representing all the instant phase deviation, is usedtomodel the phase noise of an crystal oscillator. α(t) is torepresent the oscillator frequency change at time t. Theoutput of a drifting clock is modelled as

    V(t) = Vsin(2π

    (f0t +

    ∫ t0

    α(τ)dτ

    )+ φ(t)

    )(1)

    where t represents the reference time, V is a constantamplitude, f0 means the nominal frequency and theperiod of the sinusoidal signal is τ0 = (1/f0).

    As the time instant is represented by the phase of asinusoidal wave, the sinusoidal wave is converted intoa tick and a counter register counts the ticks digitally togenerate the traditional time unit of microseconds, mil-liseconds, seconds, minutes and so on (e.g. the phaseof 2π denotes a time period of τ0, which also indicatesa counter increment of 1). This process is modelled bycomparing the instant phase against 2π

    n = 2π(f0t + ∫t0 α(τ)dτ ) + φ(t)2π

    (2)

    = f0t +∫ t0

    α(τ)dτ + φ(t)2π

    where n is an integer indicating how many cycles haveoccurred, the n-th counting event can be referred to asthe event of the counter reaching the value n. The flooroperator �x� means the largest integer not greater thanx. The time instant t[n] can be used to represent the ref-erence time at the n-th event, in addition, it is commonto use C[n] to represent the classic clock time of the n-thevent. The clock time of a drifting classic clock is given by

    C[n] = n · τ0 = t[n] +∫t[n]0 α(τ)dτ

    f0+ φ(t[n])

    2π f0(3)

    It is obvious that the classic clock C[n] is inaccurate anddifferent from the reference time t[n] due to the accumu-lated frequency variations (∫t[n]0 α(τ)dτ/f0) and thephasenoise (φ(t[n])/2π f0).

    3.2. Discretemodel of pulse-coupled clocks

    The difference between the classic clock time C[n] and ref-erence time t[n] is regarded as the offset, which dependson the accuracy of the clock. Let θ [n] represent the offset

  • 342 Y. ZONG ET AL.

    of classic clock C[n] at time t[n]

    θ [n] = ∫t[n]0 α(τ)dτ

    f0+ φ(t[n])

    2π f0(4)

    Even though the clock frequency suffers from theoscil-lator temperature drift, the frequency of drifting clockcan also be considered as a constant value due to theslow frequency change in a sufficiently short clock updateperiod. Therefore, the term

    ∫ t[n]0 α(τ)dτ of (4) can be

    piecewise discretized as∑n−1

    m=0 α[m]τ0. In addition, theterm (1/2π f0) can be viewed as a scaling factor, and thepossibility destiny function of φ[n] is similar to that of((φ(t[n]))/2π f0), therefore, ((φ(t[n]))/2π f0) is able to bere-written as a discrete form of φ[n].

    In the discretized classic clock model, the clock offsetθ [n] of the n-th clock update event is

    θ [n] =∑n−1

    m=0 α[m]τ0f0

    + φ[n] (5)

    The skew γ [n] = ((f (t[n]) − f0)/f0) represents thedeviation from the nominal frequency f0. For discretizedclockmodel, the skew γ [n] is equal to γ [n] = (α[n]/τ0) forone clock update period of [t[n], t[n + 1]]. Thus, by intro-ducing ωθ [n] = φ[n + 1] − φ[n], the offset of the (n+ 1)-th clock update event is re-written as

    θ [n + 1] = θ [n] + γ [n] τ0 + ωθ [n] (6)The skew γ [n] is also assumed as a constant value

    within diminutive clock update period due to the slowchange of skew, and the auto-regressive (AR) model isadopted to model the skew as a time-varying processin an auto-regressive manner with a small perturbation(Zong, Dai, & Gao, 2017). The skew of the (n+ 1)-th clockupdate event is

    γ [n + 1] = p γ [n] + ωγ [n] (7)where ωγ [n] is the noise with zero mean, and p, theparameter of the first-order AR model, is less than butclose to 1. In addition, both offset noise ωθ [n] and skewnoise ωγ [n], two uncorrelated random process, are sub-jected to zero-mean gaussian distribution with standarddeviations σθ and σγ respectively (Zong, Dai, & Gao,2017).

    In the PCO free-running mode, the clock state Pincreases fromzero to thresholdvaluedefinedbyϕ.Whenclock state P reaches the threshold, it is reset to zero. Thisprogress is modelled by comparing the classic clock C[n]against the multiple of threshold (N[n] ϕ)

    P[n] = C[n] − N[n] ϕ = t[n] + θ [n] − N[n] ϕ (8)where N[n] denotes the total number of PCO fires atpresent n-th clock update event. If the PCO clock fires atthe n-th clock update event, N[n] = N[n − 1] + 1. Otherotherwise, N[n] = N[n − 1].

    4. Classical clock correctionmechanism

    In the interactive mode of classical PCO with the refrac-tory period indicated by δ, the clock state evolves asmen-tioned in the free-running mode, in addition, the clockstate P is pulled up by one coupling strength � only if P isgreater than δ, upon the reception of a Pulse packet fromanother node due to the nodes are coupled with eachother (Mathar & Mattfeldt, 1996). A Pulse packet is broad-casted immediately if the adjusted clock state P exceedsthe threshold ϕ, and the interactive behaviour of theidentical classical pulse-coupledoscillators is describedas

    P[k]+ =

    ⎧⎪⎨⎪⎩P[k]−, if P[k]− ≤ δP[k]− + �, if P[k]− > δ and (P[k]− + �) < 10, if P[k]− > δ and (P[k]− + �) ≥ 1

    (9)

    where P[k]+ represents the PCO clock state of an infinites-imal time instant after local clock is corrected at the k-thtime synchronization cycle, similarly, the P[k]− is the clockstate of an infinitesimal time instant before drifting clockis corrected at the k-th event.

    Thenetwork is declared full synchronization if thedevi-ation of reference instants of any two coupled nodes’fire time is zero, this means that any coupled nodes inthe network fire and broadcast the Pulse packets simul-taneously. Even though the sensor nodes’ clocks withdifferent frequencies can achieve full synchronization,they will lose synchronization gradually due to the fre-quency differences (An et al., 2011). In the realistic WSNs,the non-identical and time-varying clocks are unable toachieve the full synchronization. Thus, the certain con-ditions, which are used to declare the synchronization isachieved in the network, need to be defined.

    The synchronization error (indicated by ), is definedas the deviation of reference instants of master and thei-th node’s fire time in a network

    ={

    tPM − tPi , if (tPM − tPi) ≤ 0.5tPM − tPi − 1, if (tPM − tPi) > 0.5

    (10)

    where tPM is the reference instant ofmaster’s fire time, andthe tPi denotes the reference instant of the i-th node’s firetime.

    If the synchronization errors of all sensor nodes are notgreater than the delay, presented by ι (i.e. −ι ≤ ≤ ι),the network is declared synchronization. It is worth not-ing that delay between two coupled sensor nodes con-sists of transmission delay and propagation delay. As thepropagation delay is up to 0.33 us in a maximum oper-ation range of around 100m, the propagation delay isneglected and only transmission delay is considered inthis paper. In addition, the convergence time is the timethat from the network is powered on to WSNs synchro-nization is achieved.

  • SYSTEMS SCIENCE & CONTROL ENGINEERING: AN OPEN ACCESS JOURNAL 343

    5. Desynchronization-based pulse-coupledclocks and timestamping

    To solve the challenge that packets from concurrenttransmitters interfere each other and no packet may beable to be successfully received in the synchronized PCO-basedwireless network, the desynchronization is adoptedto enable all the Pulse packets to be transmitted to thewireless channel in a uniformly distributed way. Next,since the TDMA mechanism is used in the Contention-Free Period (CFP) of IEEE 8.2.15.4 superframe toguaranteethe specified slot to be assigned to the specified node, thedesynchronizationmechanism is able to be implementedin the CFP (Farahani, 2011).

    5.1. Desynchronization-based pulse-coupled clocks

    In embedded systems, since the analogue and physicalPulse of classical PCO cannot be transmitted in the wire-less channel, the digital SYNC packet is adopted tomodelthe PCO Pulse signal. Similar to IEEE 802.15.4 superframe,the proposed time synchronization cycle in Figure 2,bounded by neighbouring SYNCs of master node, con-sists of three types of periods, namely, Scheduled Offset(SO),DESYNC and Inactive Period. The SO is used to trans-mit the data by using CSMA or TDMA mechanisms. TheDESYNC is to ensure sensor nodes to broadcast the SYNCpacket to achieve the desynchronization by TDMA mech-anism without queue function. The Inactive Period is forletting the sensor nodes sleep to reduce the power con-sumption. Thus, at the k-th time synchronization cycle,the i-th node fire time tpi is

    tpi = k T + (tSO + i τ) (11)

    where tSO is duration of SO, τ means the pulse dura-tion representing the time between neighbouring SYNCpacket by relay nodes, and T denotes the time synchro-nization cycle. Moreover, the pulse duration is needed toenable the relay nodes transmit or receipt the SYNC toavoid the transmission collision.

    By taking the desynchronization mechanism into con-sideration, the i-th node clock state of (8) is re-writtenas

    P′[n] = t[n] + θ [n] − N[n] ϕ − (tSO + i τ) (12)

    Figure 2. Proposed superframe.

    It is notable that the PCO clock state of (12) can repre-sentbothperfect anddriftingPCOclocks. The clockof (12)is the perfect desynchronization-based clock, due to thezero skew and offset (i.e. θ [n] = 0, γ [n] = 0). Otherwise,the offset θ [n] and skew γ [n] is updated based on (6) and(7) to produce the drifting desynchronization-based PCOclock.

    5.2. Timestamping

    The timestamp is generated on the local PCO clock basedon the reception of SYNC packet. As shown in (Correll,Barendt, & Branicky, 2005), (Degesys et al., 2007), due tothe interrupt and data processing, the higher layer times-tamp, the higher measurement noise. The timestampbetween the physical layer and MAC layer can realize therelatively balanced trade-off between the time synchro-nization accuracy and the expandability and cost of thesystem. Let ωη[k] denote the measurement noise whichis subjected to zero-meangaussiandistributionwith stan-dard deviation ση at the k-th time synchronization cycle,the local timestamp is

    P∗[k] = P′[k] + ωη[k] (13)

    where P∗[k] is the local timestamp containing the PCOclock state of SYNC packet received at the k-th time syn-chronization cycle.

    At the k-th time synchronization cycle, the measure-ment clock offset of the i-th node PCO clock based on thereception of SYNC frommaster, θi[k], is given by

    θi[k] = ((P∗i [k] − κ) + (tSO + i τ)) − ϕ (14)

    where κ is the transmission delay.Similarly, if node i fires before node j at the k-th time

    synchronization cycle, and measurement clock offset ofthe i-th (or j-th) relay about the j-th (or i-th) relay, θij(or θji),is defined respectively{

    θij[k] = ((P∗i [k] − κ) − |i − j| τ) − 0θji[k] = ((P∗j [k] − κ) + |i − j| τ) − ϕj

    (15)

    6. Simulator implementation: node structure

    The focus of this paper is the simulation of node’s PCOclock and WSNs time synchronization, rather than thesimulation of MAC and physical layer of sensor nodes.As the MiXiM simulator, TS2 and simulator by (Franco,2015) have implemented these general modules, suchas wireless channel Channel, World Manager, ConnectionManager, mobility, TDMA mac and physical layers phy ofwireless sensor nodes, they are selected and reused as astartingpoint for developing the simulator. In this section,

  • 344 Y. ZONG ET AL.

    the main attention is paid to the implementation of PCOclock module and the relay node. To be specified, twomodules (Clock and Core) are discussed with details, thereader is referred to (Huang et al., 2015), (Franco, 2015)for more information of other modules. Furthermore, thePCO Pulse signal is modelled by SYNC packet based onthe ZigBee standard. As the choice of a proper modulestructure is the key to achieve the aims of reusability andextensibility, the node’s structure design is first presentedand followed by the implementation of the relay nodeand clock implementation.

    6.1. Node structure

    Recalling Figure 1, there are three kinds of nodes, namely,the master node named with mnode, slave node namedwith snode, and relay node named with rnode. In the sim-ulator, all of the sensor nodes are located in the deploy-ment area defined by the World Manager module, andthese nodes are connected via a wireless channel, Chan-nel,managedby themoduleConnectionManager. Severalnodes, including slave and relay nodes can be simulatedsimultaneously in a singlenetwork (e.g. rnode[0], rnode[1],rnode[2], . . . ).

    According to the Zigbee protocol stack, a wireless sen-sor node of Figure 3 is constructed with three additionalmodules, namely, PCO Clock, Core and Timestamp. Andthe mac of Network Interface Card (nic) is modified toTDMA mechanism to realize the functions of PCO timesynchronizationmechanism. The PCO clock and the clockcorrection mechanism are simulated realistically by Clockmodule, and Clock also provides two interfaces to othermodules. One interface is an OMNeT++ gate, which isused to simulate the SYNC packet. Each time the counterfires (i.e. clock state P reaches the threshold), a messagenamed with SYNC will be sent to the Coremodule so thatthe Core is able to transmit a SYNC packet based on thereceived message of the Clockmodule.

    Another interface of Clock module is public mem-ber functions. By calling these interface functions, e.g.

    Figure 3. General structure of a wireless sensor node.

    getTimestamp() and adjustClock(), the time of Clock mod-ule can be accessed, and the clock can be adjusted moreeasily by other modules.

    Due to the character that the PCO indeed is a cross-layer protocol with data transmissionmechanism at MAClayer for high synchronization accuracy, the functionali-ties of PCO are divided into two modules, namely, Core,and TDMAmac. The Core is responsible for all other oper-ations (such as processing SYNC packet and adjusting theclock state) and mac is for the PCO’s SYNC packet imme-diate transmission/reception. In the simulator, when theSYNC packet is sent from Core module to mac layer, thepacket will be passed to the phy layer immediately tobroadcast the SYNC packet, since the queue function ofTDMA is cancelled. When the phy layer finishes receiv-ing the SYNC packet from a wireless channel, it sends thepacket up to themac layer. Due to the TDMAmechanismwithout queue function and no SYNC packet is put in thequeue to wait for transmission, the mac layer passes theSYNC to the Coremodule directly without delay.

    In the Coremodule, only the packets for PCO protocolwill be processed, and those packets from other applica-tion protocols are forwarded to the corresponding mod-ule. In addition, the Timestamp module of (Huang et al.,2015) has been implemented between theMAC layer andphysical layer to enable thehigh accuracy timestamp. Thetimestamp is attached to the sent/receivedpacket to indi-cate the sending/receiving time, when phy layer receivesa packet from Timestamp module/wireless channel. TheTimestamp module is the same for all master, slave andrelay nodes, and the Core module in master and slavenodes are implemented by different classes. It is notablethat all these timestamps are generated from the Clockmodule by calling interface function getTimestamp() ofClockmodule.

    Remark 6.1: when the sensor nodes work in theDESYNCof time synchronization cycle, theMAC layer of RFmoduleworks in the TDMAmechanism (without queue functions)to ensure the SYNC packet be transmitted to the wirelesschannel or upper layer efficiently. However, during theScheduled Offset, the RF module of wireless sensor nodetransmitter works either in the CSMA or normal TDMAmechanisms.

    6.2. Implementation of relay node

    The implementation of the relay node, rnode, is indi-cated in Figure 4, the rnode module is composed of sev-eral modules: a compound module nic consisting of phylayer, mac layer and Timestampmodule, a basic networklayernetw, general application layerwithburst data trans-mission appl and a Core module. Furthermore, the phy

  • SYSTEMS SCIENCE & CONTROL ENGINEERING: AN OPEN ACCESS JOURNAL 345

    Figure 4. Implementation of the relay nodewith a realistic Clock,and Coremodules.

    andmac layers are implemented by PhyLayerBattery andTDMAmacmodules respectively.

    (1) Relay Core Module: This module is implementedby a compound module consisting of RelayBuffer,RelaySlave and RelayMaster simplemodules. The taskof each module is realized in its member functionnamed with handleMessage(). In the RelaySlavemod-ule, when a packet arrives at the module from thehigher application layer, Core module or Clock mod-ule, the handleMessage() function will be invoked toprocess the packet and determine the source whereis thepacket from. If thepacket is from theClockmod-ule, the RelayBufferwill delete the SYNC packet firstly,and the re-generated full SYNC packet will be sentto the RelayBuffer to pass it to the lower netw layer.If the received packet is from the higher applicationlayer, the RelaySlave will send the packet out to theRelayBuffer directly. Finally, if the received packet isfrom the RelayBuffer, RelaySlave and RelayMaster willcheck the received packet is for themselves. If yes,the RelaySlave and RelayMaster will process it, other-wise, the received packet will be discarded.The maintasks of RelayMaster module are: (i) It schedules thetime synchronization cycle by using scheduleAt() ofOMNeT++ API in the initialization function. (ii) Oncethe time synchronization of the previous hop is com-pleted, the handleMessage() function of RelayMasteractives the synchronization of next hop.The respon-sibility of RelayBuffermodule is to transmit the packetto corresponding modules (i.e. RelaySlave, RelayMas-ter modules and network layer netwl). More specif-ically, when a packet arrives at the module eitherfrom the RelayMaster or the RelaySlave, the Relay-Bufferwill send the packet to the lower network layer.If the received packet is from netwmodule, the Relay-Buffer will send the packet to both RelaySlave andRelayMastermodules.

    (2) Relay Clock Module: The Clock module in the relaynode is to simulate the drifting PCO clock realistically.The task of Clock is for maintaining the clock stateregularly according to the desynchronization-basedPCO clockmodel of (12), providing the local time andtimestamps toothermoduleswithin the sensornode.Moreover, the clock offset and skew are regularlyupdated according to both (6) and (7). It is worth not-ing that the Clock module can generate the perfectPCO clock time in the master node, by configuringclock offset and skew to zero.

    Remark 6.2: The SYNC packet is generated by Clockmodule when the clock state P reaches the thresholdvalue, meanwhile, the synchronization mechanism (i.e.interactive mode) is activated by themselves after theSYNC is received. Thus, it is unnecessary to schedule thetime synchronization cycle in the sensor nodes, and thefunctions of RelayMaster module in relay node haven’tbeen used in this paper. However, the RelayMaster mod-ule of the relay can be used in the PTP to realize thesimulation of synchronization in multi-hop wireless net-works.

    7. Simulations and results

    To verify the classical PCO clock model with the refrac-tory period and evaluate the impacts of parameter vari-ations (e.g. clock stability and coupling strength) on thetime synchronization performance, extensive simulationshave been done and this section presents these results.In the simulation, two typical drifting clocks presentedin (Giorgi & Narduzzi, 2011) are simulated. The skews ofthe Clock A and B are subject to a random perturba-tionwith standard variances σγ = 10−8 and 10−9 respec-tively, and their offset noises are of standard variancesσθ = 10−6 and 10−7 respectively. The clock update fre-quency f0 is 32.768 kHz to mimic RTC clock of WSNs, andthe threshold ϕ of PCO clock is set to 1s; thus, the timesynchronization cycle is 1s. The SYNC packet is configuredto 21 bytes based on the ZigBee standards (Eady, 2010),(Farahani, 2011). Finally, two kinds of network topologieswhich are indicated in Figure 5, namely, a single-hopwire-less sensor network and a three-hop network topology,are simulated, and the configurations of simulations aresummarized in Table 1.

    Figure 5. Network topologies (Left: single-hop WSN, Right:multi-hop WSN).

  • 346 Y. ZONG ET AL.

    Table 1. Simulation configurations.

    Symbol Value Unit

    f0 32.768 Kilohertz (kHz)θ0 1, 10, 400 Millisecond (ms)γ 0 [10, 20, 30, 40, 50, . . . 100] Part Per Million (PPM)σθ 10−6, 10−7σγ 10−8, 10−9δ 0.1, 1, 10 Millisecond (ms)ε 9, 10, 20, 30, 40, . . . 900 Millisecond (ms)ϕ 1 Second (s)

    7.1. Free-runningmode of drifting PCO clock

    The impacts of clock’s parameter variations (i.e. initial off-set and skew and offset and skew noise) in non-identicalclassical PCO free-runningmode are first studied. Figure 6showshow theoffset θ [n] in the free-runningmode variesagainst different clock’s parameter variations. Three dif-ferent clocks are considered in this simulation: the lowerperformance one (Clock A) corresponds to a personalcomputer clock (as Clock A in (Giorgi & Narduzzi, 2011)),while the higher performance one (Clock B) presents thesame values of σθ and σγ as the Clock B characterized in(Giorgi & Narduzzi, 2011). The characteristics of Clock C isbetween those of the former two clocks. Moreover, twokinds of clock frequencies with initial skews γ0 of 10 PPMand 100 PPM are also simulated.

    In the free-running mode, as the time increases, theoffset θ [n] increases from the initial offset θ0 = 1ms toa value which depends on the clock operation time andthe intrinsic stability of the unregulated clock. Thismeansthat, if a drifting PCO clock with 10 PPM of frequency vari-ation is higher performance (like Clock B), the incrementof clock offset is less than 2ms during 90 seconds sim-ulation. Even though the offset’s increment of a Clock B

    Figure 6. The offset of non-identical and time-varying PCO clockin free-running mode (θ0 = 1ms, σ Aθ = 10−6, σ Aγ = 10−8, σ Bθ =10−7, σ Bγ = 10−9, σ Cθ = 10−7, σ Cγ = 10−8).

    with 100 PPM is not greater than 9ms during the simula-tion, the offset would be larger when the clock runs in thelonger time.

    On the other hand, if a drifting and lower performancePCOclock, asClockAwith frequency variationof 100 PPM,is adopted in theWSNs without clock correction method,the clock offset (e.g. 12ms in 90-second simulation) hasa significant negative effect on the performance of WSNsduring the complete life cycle of sensor nodes. Therefore,a higher performance drifting clock with less frequencyvariation (e.g. the Clock B with 10 PPM in the simulator)has a relatively less negative effect on the WSNs perfor-mance.

    7.2. Synchronization of identical classical PCOclocks in single-hopWSNs

    The synchronization performances of identical classicalPCO clock with the refractory period in single-hop wire-less sensor networks are presented in Figures 7 and 8.Figure 7 demonstrates synchronization of PCO clock withtwo different θ0 of −400ms and 400ms. For the iden-tical clock with the initial offset of 400ms, simulationresults show the synchronization error increases frominitial offset to the maximum synchronization error of+500ms, it is shifted to −500ms approximately afterreaching the maximum synchronization error. This inter-esting behaviour of PCO results from positive initial off-set θ0, the excitatory coupling (i.e. � > 0) and the syn-chronization error (which is defined between−500msand +500ms). Since the excitatory coupling is used inthe PCO, the clock state P can only be pulled up, ratherthan pulled down when the SYNC packet is received bythe sensor node; moreover, the synchronization error isdefined between the −500ms and +500ms, is shifted

    Figure 7. Synchronization of identical classical PCO with therefractory period and different initial offsets in single-hop WSNs(δ = 0.1ms, ε = 20ms).

  • SYSTEMS SCIENCE & CONTROL ENGINEERING: AN OPEN ACCESS JOURNAL 347

    Figure 8. Synchronization of identical classical PCO clock withthe refractory period in single-hop WSNs. (θ0 = −400ms, δ =0.1ms, ε = 20ms).

    to −500ms once synchronization error of +500ms isreached.

    In addition, the synchronization errors of both clockswith different initial offsets convergence to zero approx-imately after finite time synchronization cycles, and it isobvious that the convergence speed of PCO clock withthe negative initial offset (e.g. θ0 = −400ms in the sim-ulation) is faster.

    Simulation results in Figure 8 show the PCO synchro-nization precision with different coupling strengths �.The analysis of synchronization error between thedriftingclock (i.e. slave clock) and the reference clock (i.e. masterclock) indicates that, the synchronization error of identi-cal classical PCO clock convergences to−0.458ms duringthe simulation. Since the propagation delay for 50m (thedistance between two coupled sensor nodes) is 0.016ms,it is able to be neglected comparedwith the clock updateperiod τ0 = 0.0305ms, and the transmission delay for thereception of a complete SYNC packet is 0.48ms. Thus,the synchronization error is not greater than the delay(i.e. −0.48ms ≤ −0.458ms ≤ 0.48ms), and slave clocksin the single-hop WSN eventually are synchronized tothe master clock and time synchronization is achievedin the network. Both (Mathar & Mattfeldt, 1996 ) and(Degesys, Basu, & Redi, 2008) proved that higher conver-gence speed is achieved in the PCO with higher couplingstrength, when the coupling strength is less than thespecified critical coupling strength. Furthermore, simu-lation results also show that the synchronization preci-sion is independent of the coupling strength ε, and samesynchronization precisions of PCO clocks with differentcoupling strengths are attained in the network.

    It is worth noting that the transmission delay of 0.48msexits in the network. This means that, if the mastertransmits a SYNC packet to a slavenode, the slave receives

    the SYNC packet andadjusts its drifting clock after 0.48ms.Therefore, drifting slave clock is always laggedby 0.48ms,and the synchronization error between the slave andmaster clocks is−0.48ms theoretically. By compensatingthe SYNC packet transmission delay in the clock correc-tion method, the synchronization error may reduce to−0.022ms which is less than one clock updated period.

    7.3. Synchronization of identical classical PCO inmulti-hopWSNs

    Figure 9 shows the achieved synchronization of identicalclassical PCO clock in a multi-hop wireless sensor net-work. Due to the existing of transmission delay in the net-work, the synchronization error is accumulated with theincrease of hop distance (i.e. rnode[0]. = −0.458ms,rnode[1] = −0.916ms, rnode[2]. = −1.373m). Inaddition, even though the initial offset of sensor nodesvaries (i.e. blue and red lines in Figure 9), the achieved syn-chronizationaccuracy is same. Thismeans the initial offsethasnoeffect on the accuracyof PCO time synchronizationin multi-hop wireless sensor networks.

    7.4. Evaluation of non-identical classical PCO clockssynchronization in single-hopWSNs

    The synchronization performance is analyzed for twonon-identical classical PCO clocks (Clock A and B) andfor different values of frequency variation, 10 PPM and100 PPM, as reported in the legend of Figure 10. Sincethe initial offset θ0 is less than the coupling strength �,all the local clocks are adjusted and synchronized to themaster clock based on the reception of SYNC packet atthe 1st synchronization cycle. It coincides with (An et al.,

    Figure 9. Synchronization error of identical PCO clock with therefractory period inmulti-hopWSNs (θ0 = 1ms, 10ms, δ = 1ms,ε = 20ms).

  • 348 Y. ZONG ET AL.

    Figure 10. Synchronization error of non-identical and time-varying classical PCO clock with the refractory period in single-hop WSNs.(θ0 = 10ms, σ Aθ = 10−6, σ Aγ = 10−8, σ Bθ = 10−7, σ Bγ = 10−9, δ = 1ms, ε = 20ms).

    2011) that due to the non-identical and time-varying PCOclock, the achieved synchronization will lose gradually,and sensor nodes will move into interactive mode again(see Figure 10).

    To be specified, when the synchronization error is lessthan the refractory period (i.e. −δ < < δ), the driftingclock will stay in the free-running mode; otherwise, thePCO clock will move to the interactive mode to correctits drifting clock based on the reception of SYNC packetfrommaster node. Thismeans that, as shown in Figure 10,for a Clock B with 10 PPM, it can maintain synchroniza-tion for a longer time (e.g. 480 s in the simulation). On theother hand, if a lower performance and drifting clockwith100 PPM is adopted, the clock will maintain synchroniza-tion for a short time (e.g. 10 s in 500-second simulation).

    Therefore, the classical PCO with the refractory periodcannotbe implemented to the realisticWSNsdirectly, andthe classical PCO need be improved to ensure it can beimplemented in the real-world environments.

    8. Conclusion

    In this paper, an open source simulator is developedfor PCO in IEEE 802.15.4-based WSNs. The concept andstructure of the developed simulator are detailed, fol-lowed by the development of a realistic model of drift-ing classical PCO clock (implemented with the refrac-tory period) with configurable phase, frequency noises,adjustable and higher resolution, and TS superframewhich is compatible with IEEE 802.15.4 superframe. The

    detailed implementation of the drifting PCO clock, FFDnode that benefit to simulate the multi-node and multi-hopWSNs are also presented to demonstrate the featuresof the simulator.

    In particular, the impacts on the synchronization per-formance of classical PCO are examined and analyzed bysimulation. Even though the identical classical PCO with-outdrifting frequency is applied to the realistic single-hopwireless sensor networks, the full synchronization cannotbe achieved. Due to the delay (i.e. transmission delay inthis paper) in the realistic WSNs, synchronization error isaccumulated with the increase of hop distance, when theclassical identical PCO is applied to the multi-hop WSNs.Finally, resulting from the non-identical and time-varyingPCO clock in practice, the achieved PCO synchroniza-tion will lose gradually. The classical PCO with refractoryperiod, therefore, cannot be implemented to the real-world WSNs directly, and it need be improved to ensurethe implementation of PCO in sensor networks.

    Disclosure statement

    No potential conflict of interest was reported by the authors.

    Funding

    This work was supported by Northumbria University at Newcas-tle via a postgraduate research studentship.

    ORCID

    Yan Zong http://orcid.org/0000-0002-5196-8025

    http://orcid.org/0000-0002-5196-8025

  • SYSTEMS SCIENCE & CONTROL ENGINEERING: AN OPEN ACCESS JOURNAL 349

    References

    An, Z., Zhu, H., Li, X. [Xinrong], Xu, C., Xu, Y., & Li, X. [Xiaowei].(2011). Nonidentical linear pulse-coupled oscillators modelwith application to time synchronization in wireless sen-sor networks. IEEE Transactions on Industrial Electronics, 58(6),2205–2215.

    Bojic, I., & Nymoen, K. (2015, October). Survey on synchroniza-tion mechanisms in machine-to-machine systems. Engineer-ing Applications of Artificial Intelligence, 45, 361–375.

    Correll, K., Barendt, N., & Branicky, M. (2005). Design considera-tions for software only implementations of the IEEE 1588 pre-cision time protocol. Proceedings of conference on IEEE 1588standard for a precision clock synchronization protocol for net-workedmeasurement and control systems.

    Degesys, J., Basu, P., & Redi, J. (2008, March). Synchronizationof strongly pulse-coupled oscillators with refractory periods andrandom medium access. Proceedings of 2008 ACM symposiumon applied computing.

    Degesys, J., Rose, I., Patel, A., & Nagpal, R. (2007, April). DESYNC:Self-organizing desynchronization and TDMA on wireless sen-sor networks. Proceedings of 6th international symposium oninformation processing in sensor networks (pp. 11–20).

    Eady, F. (2010). Hands-On ZigBee: Implementing 802.15.4 withmicrocontrollers. Oxford: Newnes.

    Elson, J., Girod, L., & Estrin, D. (2002, Winter). Fine-grained net-work time synchronizationusing referencebroadcasts. Proceed-ings of the 5th symposium on operating systems design andimplementation (pp. 147–163).

    Ernst, U., Pawelzik, K., & Geisel, T. (1995). Synchronizationinduced by temporal delays in pulse-coupled oscillators.Physical Review Letters, 74(9), 1570–1573.

    Farahani, S. (2011). Zigbee wireless networks and transceivers.Oxford: Newnes.

    Ferrari, F., Meier, A., & Thiele, L. (2010, March). Accurate clockmodels for simulating wireless sensor networks. Proceedings ofthe 3rd international ICST conference on simulation tools andtechniques.

    Franco, A. (2015). Lab 1: TDMA. Retrieved from http://omikron.eit.lth.se/ETSN01/ETSN01/labs/

    Giorgi, G., &Narduzzi, C. (2011). Performance analysis of Kalman-Filter-based clock synchronization in IEEE 1588 networks.IEEE Transactions on Instrumentation andMeasurement, 60(8),2902–2909.

    Huang, Y., Li, T., Dai, X.,Wang,H., & Yang, Y. (2015). TS2: A realisticIEEE1588 time-synchronization simulator for mobile wirelesssensor networks. SIMULATION, 91(2), 164–180.

    IEEE Instrumentation and Measurement Society. (2008, July).IEEE standard for a precision clock synchronization protocolfor networked measurement and control systems. IEEE Stan-dard 1588-2008 (Revision of IEEE Standard 1588-2002), 1–300.

    Khan, M. A., Hasbullah, H., & Nazir, B. (2014, September). Recentopen source wireless sensor network supporting simulators: Aperformance comparison. Proceedings of 2014 internationalconferenceoncomputer, communications, andcontrol technol-ogy (pp. 324–328).

    Kopke, A., Swigulski, M., Wessel, K., Willkomm, D., Klein Han-eveld, P. T., Parker, T. E. V., . . . Valentin, S. (2008). Simulatingwireless and mobile networks in OMNeT++ the MiXiM vision.Proceedings of the 1st international conference on simulationtools and techniques for communications, networks and sys-tems &workshops.

    Kucuk, K., Bandirmali, N., Kavak, A., & Atmaca, S. (2013). A mod-ified sectoral sweeper-based localization estimation and itsimplementation in a multi-hop wireless sensor networkingenvironment by using OPNET. SIMULATION, 89(6), 746–761.

    Maroti, M., Kusy, B., Simon, G., & Ledeczi, A. (2004, November).The flooding time synchronization protocol. Proceedings of the2nd international conference on embedded networked sensorsystems (pp. 39–49).

    Mathar, R., & Mattfeldt, J. (1996). Pulse-Coupled decentral syn-chronization. SIAM Journal on Applied Mathematics, 56(4),1094–1106.

    Mirollo, R., & Strogatz, S. (1990). Synchronization of pulse-coupled biological oscillators. SIAM Journal on Applied Math-ematics, 50(6), 1645–1662.

    Mohammadpour, S., & Binazadeh, T. (2018, January). Robustfinite-time synchronization of uncertain chaotic systems:Application on Duffing-Holmes system and chaos gyros. Sys-tems Science and Control Engineering, 6(1), 28–36.

    NS3 official website. (2018). Retrieved fromhttps://www.nsnam.org.

    OMNeT++ release 4.6. (2018). Retrieved fromhttps://www.omnetpp.org.

    Petrioli, C., Petroccia, R., Potter, J., & Spaccini, D. (2015, Novem-ber). The SUNSET framework for simulation, emulation andat-sea testingof underwaterwireless sensor networks.AdHocNetworks, 34, 224–238.

    Sharif, M., & Sadeghi-Niaraki, A. (2017, September). Ubiquitoussensor network simulation and emulation environments: Asurvey. Journal of Network and Computer Applications, 93,150–181.

    Shead, S. (2017, January 03). Amazon now has 45,000 robots inits warehouses. Business Insider. Retrieved from http://uk.businessinsider.com

    Tyrrell, A., Auer, G., & Bettstetter, C. (2008). On the accuracy offirefly synchronization with delays. Proceedings of first interna-tional symposium on applied sciences on biomedical and com-munication technologies.

    Tyrrell, A., Auer, G., & Bettstetter, C. (2010). Emergent slot syn-chronization inwireless networks. IEEE Transactions onMobileComputing, 9(5), 719–732.

    Xian, X., Shi, W., & Huang, H. (2008). Comparison of OMNeT++and other simulator for WSN simulation. Proceedings of 3rdIEEE conference on industrial electronics and applications (pp.1439–1443).

    Zong, Y., Dai, X., & Gao, Z. (2017, September). A software simula-tor of discrete pulse-coupled oscillators (PCO) time synchroniza-tion in wireless sensor networks. Proceedings of 23rd interna-tional conference on automation and computing(ICAC).

    http://omikron.eit.lth.se/ETSN01/ETSN01/labs/http://omikron.eit.lth.se/ETSN01/ETSN01/labs/https://www.nsnam.orghttps://www.nsnam.orghttps://www.omnetpp.orghttps://www.omnetpp.orghttp://uk.businessinsider.comhttp://uk.businessinsider.com

    1. Introduction1.1. Pulse-coupled oscillators and time synchronization in wireless sensor networks1.2. Discrete event simulator

    2. Simulation framework3. Modelling dynamics of pulse-coupled oscillator clocks3.1. Drifting classic clock3.2. Discrete model of pulse-coupled clocks

    4. Classical clock correction mechanism5. Desynchronization-based pulse-coupled clocks and timestamping5.1. Desynchronization-based pulse-coupled clocks5.2. Timestamping

    6. Simulator implementation: node structure6.1. Node structure6.2. Implementation of relay node

    7. Simulations and results7.1. Free-running mode of drifting PCO clock7.2. Synchronization of identical classical PCO clocks in single-hop WSNs7.3. Synchronization of identical classical PCO in multi-hop WSNs7.4. Evaluation of non-identical classical PCO clocks synchronization in single-hop WSNs

    8. ConclusionDisclosure statementFundingORCIDReferences