ABSTRACTThe clock in embedded systems usually is driven by a crystal oscillator and implemented via a counter register, such a crystal clock is non-identical and drifting due to the manufacturing tolerance and variation 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 condition monitoring, coordinated control and localization. Inspired by fireflies’ behaviour, the Pulse-Coupled Oscillators (PCO) has been proposed for synchronization in complex networks. Since the concurrent transmission of PCO’s Pulses is impossible in Wireless Sensor Networks (WSNs), the desynchronization mechanism is adopted to ensure the implementation of PCO in WSNs. Moreover, due to the uncertainties in radio channels and the complexities of communication protocols and packet-exchange behaviours in wireless networks, it is challenging to have a closed-form solution to the performance of PCO synchronization in WSNs. The realistic software simulation, in particular, the discrete event simulator has been a powerful tool to exam the performance of communication protocols in various scenarios, since an order sequence of well-defined event in time is to represent the behaviour of a complex system. This paper presents the development of a pulse-coupled oscillators time synchronization simulator on the OMNeT++ platform for simulating and studying its behaviour and performance in sensor networks. A clock module with configurable phase and frequency noises, and adjustable and higher resolution is developed to mimic various crystal oscillators in embedded systems, for example, the real-time clock. The developed simulator also supports the full functions devices defined by ZigBee protocol, which allows realistic simulation of multi-hop IEEE 802.15.4 wireless networks. Finally, the intensive simulations of classical PCO with the refractory period in IEEE 802.15.4-based WSNs have been carried out to demonstrate the 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 that maintained synchronization depends on the length of refractory period.