## 2 Related Work  
Simulation of UWSN is an important research topic due to its impact on the design and optimization of these networks, which normally have prohibitive node-replacement costs [12]. Wireless networks are usually simulated with different detail levels, using event-driven approaches that reduce the resulting simulation time. Frameworks such as Castalia, NS-3, OMNeT++, or OPNET are employed to simulate MAC protocols and network algorithms, using specific event-driven implementations [13]. Therefore, these frameworks do not offer the possibility of testing a given real-world implementation of a communications stack under a realistic scenario. [PERSON] et al. carried out a soft real-time simulation of a WSN, merging both virtual and actual sensor nodes [14]. In their scheme, the authors did not handle communication in a concurrent or parallel manner, incurring sometimes into timing errors. The simulator proposed in this paper is inherently concurrent and easily parallelizable, minimizing this type of error. [PERSON] and [PERSON] analyzed in Reference [15] some hybrid network simulators, capable of handling interaction between physical and virtual nodes. The authors analyzed these frameworks in terms of scalability, synchronization, Graphical User Interface (GUI), and source emulation capability. This last parameter is related to the capacity of executing exactly the same code in both virtual and physical nodes. Although H-TOSSIM [16] and MULE [17] are capable of synchronized execution and source code emulation, they need from a specific communication protocol that must be embedded into the real-deployed node (on the contrary, a pure _software-in-loop_ approach ensures that the protocol that is running on the simulated node will be the same on a real scenario). [PERSON] and [PERSON]'s analysis included not only traditional Discrete Event Simulators (DES), but also frameworks capable of hybrid simulation (virtual and real nodes). Nonetheless, this kind of simulators does not offer the possibility of testing real software before carrying out the physical implementation of the nodes. On the other hand, [PERSON] et al. studied several schemes capable of protocol emulation in Reference [18]. The authors distinguished between platforms that allowed partial code reuse and full code reuse. The full reuse objective can be reached using a Software Compatibility Layer (SCL) or by the use of alternative compilation (using shared libraries). SCL provides a higher level of abstraction for network simulation, but the source code must be designed taking this into account _a priori_. The Click modular router [19] provides a modular Application Programming Interface (API) that can be used to design new protocols. However, the applicability of this API for existing protocol adaptation is practically unfeasible, due to the tight integration requirements of Click. [PERSON] et al. used a Click-based implementation of router modules to carry out a realistic Ethernet network simulation [20]. Nevertheless, the authors did not compare their results against a real-world deployment of the network under study, but only with respect to the output of a DES. [PERSON] et al. presented an implementation of a design tool for UWSN namedUnetStack [21]. The underlying concept of this scheme was very similar to Click. Their approach proposed the use of an agent-based architecture for implementing protocol stacks. Nonetheless, as occurred with Click, UnetStack constrains the design procedure, limiting its relevance. [PERSON] et al. carried out a comprehensive comparison of DES for WSN simulation [22]. Several frameworks such as OMNET++, NS-2, NS-3 and MATLAB were analyzed through literature review and experimental evaluation. The authors found that MATLAB offered the lowest simulation time for the Ad hoc On Demand Vector (AODV) protocol benchmark. This metric was remarked as capital for network design in their comparative study. Nonetheless, the considered frameworks and schemes were not evaluated in other terms, such as robustness and accuracy.