Wireless Sensor Networks are now being considered for use in industrial automation and process control. These applications present different characteristics with respect to classical WSN application domains. In particular, the nodes may have high computational load due to the high sampling frequencies; moreover, they present real-time constraints, as data must be processed and transmitted with bounded delay.In this paper, we present RTNS, a simulator for distributed realtime systems that allows to model and simulate the temporal behavior of network protocols, real-time Operating System and distributed applications. The tool has been developed as a plug-in extension of the popular NS-2 simulator, hence it is possible to reuse most of the packages already available for NS-2. The aspects related to real-time Operating System, the overhead of interrupt handlers and protocol management, and the set of concurrent tasks executing on each node, are modeled using the RTSim simulator. With respect to a previously documented version, the package now has an extended scope and can model complex multi-hop scenarios.After presenting the simulator structure, we show how the tool can be used to model and simulate realistic WSN scenarios. Hereby, three examples are presented with the aim of showing how possible failures in the nodes or a load suddenly appearing in gateways connecting neighbor clusters for structured topologies can cause a worsening in the end-to-end transmission delays. We show that the adoption of a real-time Operating System in the nodes along with a proper scheduling policy for tasks can avoid (or at least keep under control) unpredictable effects in end-to-end delay.