## 1 Introduction
In addition, this scenario also allows the sensor nodes to communicate with nearby devices which share the same technology and propagate the information and forecasts. The need for fault tolerance approaches is another important issue when dealing with natural disasters. This issue is partially addressed in [PERSON] et al. [7], where a Cognitive Radio Based Internet Access Framework for Disaster Response for inhospitable environments is presented. In its framework, [PERSON] et al. [7] use the term Cognitive for devices that can modify their parameters on-the-fly, being able to adapt to environment changes and, thus, restore the communication between partially damaged networks. Despite addressing only communication, [PERSON] et al. [7] make clear the challenges and the need for mechanisms that can recover systems damaged by natural disasters and thus keep their services available to the population. In the city of Sao Carlos, Brazil, there is a WSN deployed by the Institute of Mathematical Sciences and Computing (ICMC), University of Sao Paulo (USP), called REDE (WSN for monitoring urban rivers), the purpose of which is to monitor, analyse the data, detect flash floods, and present online information about rivers in urban areas [8]. The REDE system collects data on the rivers and rainfall in the area and uses two different kinds of technology to communicate, ZigBee and 3G. However, the REDE system does not envisage that this data will be used to forecast flash floods or that this information which is collected in the real world can be integrated with other information available in online environments. Additionally, the REDE system does not have any fault-tolerance mechanism, which is necessary in hazardous environments where the loss of nodes and communication is a common phenomenon. With regard to this paper, the IoT paradigm allows the REDE system to be extended by introducing the concept of integration between devices and remote services. These services help in the distribution of information and data, as well as in the forecasting and decision-making and act in the real world by sensing and providing information about the monitored environment. This means that the nodes of a WSN (such as the REDE system) can be seen as smart objects that have to meet certain requirements such as the following: (a) diversity in data collection from different types of sensors; (b) the possible use of these data via the Internet and (c) collective intelligence among all/some nodes, based on information about multiple nodes and not only about the situation and data of a single one. Thus, it can be said that the management and forecasting of natural disasters takes place in scenarios where the integration between the real and the online worlds occurs spontaneously [5; 6]. How the smart objects concept is employed in our system is explained in Sections 3.1 and 3.3. In light of this, the aim of this paper is to propose, design, evaluate and assess the performance of a fault-tolerance system for forecasting and issuing warnings of natural disasters called SENDI (System for dEtecting and forecasting Natural Disasters based on IoT), with a case study about flash flooding. SENDI was implemented by using ns-3, emerging IoT standards and Machine Learning (ML), and by applying real data collected by means of the REDE system. The system is designed for natural disasters in a hostile environment, which is susceptible to failures of communication and loss of nodes (either by physical destruction or a lack of energy). To this end, we also proposed and evaluated a node cooperation mechanism for cluster formation, based on the energy remaining in each node. This mechanism is designed to make better use of the remaining energy in each node, by extending the lifespan of the system and ensuring it is able to keep making forecasts, even in the case of node losses. The forecasting scheme of SENDI relied on embedded models created by means of ML techniques and real data collected by the REDE system within the nodes.