## 3 Materials and Methods
### Simulations  
To understand how aggressive the types of jamming would be in different WSN applications, two simulations were run under different node densities and cooperative and collaborative schemes. Simulation 1: The simulation of the network metrics will be carried out taking the following number of nodes: 50, 100, 200, 300, 400 and 500, with a fixed area of 500 m\({}^{2}\). Simulation 2: The simulation of the network metrics will be carried out taking the following areas (m\({}^{2}\)): 100, 300, 500, 1000, 5000 and 10,000, with a fixed number of nodes of 200. This configuration has been chosen to explore possible network scenarios found in an industrial environment [50; 52], where hundreds or even thousands of nodes distributed in the geographic space of the factory can coexist. The simulations and the experiment also seek to validate whether in high or low density networks it is convenient to use a collaborative or cooperative scheme. To distinguish the types of jammer, the simulation takes into account the following send intervals and types of packets [53]: while the _constant_ jammer sends _random_ bits every millisecond, the _deceptive_ jammer sends _regular_ bits every millisecond. For its part, the _random_ jammer sends both random and regular bits in a time interval between 1 and 100 milliseconds and then goes into sleep mode. Finally, the _reactive_ jammer sends bits of how long the legitimate transmission lasts on the communication channel. If it is an RTS/CTS reactive jammer, it is sent during RTS/CTS, and if it is a Data/ACK jammer, it is sent during Data/ACK. To simulate the cooperative and collaborative behavior of the nodes, a change was made in the task processing algorithm. The _cooperative_ scheme is based on the _interrupt method_, which under normal operating conditions offers better micro-controller performance [54]. On the other hand, the _collaborative_ scheme is based on the _polling method_ which consists in synchronous scanning of the nodes where the micro-controller works continuously, spending more Central Processing Unit (CPU) cycles and being more likely to lose data and consume more power. Because it consumes less energy under normal conditions, the interrupt method is considered better than polling. To carry out the simulations, the _Configurable Multi-Layer WSN_ (CML-WSN) has been used. It is an event-driven simulator and is programmed in C++ language. The parameters offered by the IEEE 802.15.4 standard were taken, because they are used in intelligent industrial environments by IWSN. In the simulations, the distribution of the arrival of packages follows a _poisson distribution_. The simulator accepts several input settings for the physical, MAC and network layers, and it has already been used and tested in other research works [18]. The simulator has an _energy model_ to support any sensor specification, and it is useful to explore prototypes. Its architecture consists first in the main _inputs_, which are the number of nodes, the energy model and some data such as maximum hop number, node coverage range, fixed or random topology, data length, data rate, the maximum number of neighbors, process time, transmission time, propagation time, stand out. sampling period, etc. In the second place, the simulator has a _scheduler_, which is an entity with a global vision of the network and which is in charge of managing and controlling the events. The main _events_ that it manages are the hello packets, the CSMA/CA algorithm, the packages, the requests, and the statistic timers. In addition, it can record all events during the simulation. The main _actions_ that it records are the following: turn on all nodes; turn off nodes; turn on a specific node; look for routes in routing tables; check if an ACK is received; send HELLO packet to make the topology, routing protocol and traffic packets; CSMA/CA algorithm; obtain times to record simulation information; etc.