Flood Early Warning and Prediction System for Tributary Streams

Flood Early Warning system development is relatively new and costly area for developing countries, though it has captured attention of the respective parties since such Early Warning System can avoid loss of lives and reduce property damages from floods. Rather than standalone early warning system, warning system with the ability to forecast or predict flood events is more useful for the relevant stake holders where it can be used to plan and act fast. Geological areas around tributary streams are more likely to flood without considerable warnings from the nature as it highly depends on the main river behavior. This system uses Internet of Things (IoT) devices for data capture and transfer. River Water level, Rain status and the Water flow rate (discharge rate) is measured using Sensors. An Artificial Neural Network (ANN) is trained with collected data and integrated with live data feed in order to predict the water level. By doing so forecasting flood events according to the current readings. Notifications are sent via pre-defined notification channels. Due to the higher number of data types considered, ANN predicts water level with considerable accuracy. This collective approach of using ANN and IoT devices has made the forecasting easier and more reliable while using more variables made the predictions more accurate. In addition, these collected data can be used in the future for disaster recovery and mitigation planning since they are kept in cloud environment where public can access.


Introduction
Flood early warning, detection and forecasting is not a typical or common area of studies when it comes to research work due to its complexity and lack of business value. Although lot of literature can be found on flood detection models, theoretical aspects of floods and flood avoidance etc., very less work can be found on practical approach to this topic. Io T is one of the key emerging technologies which helps to automate and integrate devices via internet regardless of the physical location. Usage of IoT technology and publicly available integration platforms can reduce the cost and the technological complexity while increasing the possibility of implementing Early warning systems in most required areas. In addition to the EWS, flood forecasting can be done with the integration of Artificial Neural Network (ANN) to the collected and stored date from IoT devices, which can be used by the relevant stake holders to plan and get necessary actions before the disaster (in this case, Flood) happens.
This research prototype is built on the hypothesis, which is that the river floods are directly connected with the water level of the river, water flow of the river and the rain status of the tested area. This hypothesis is proved at the end evidently using the success rate of the prediction made by the system. Several methods have been proposed and used in the literature found related to flood forecasting, in one such case, Samikawa [1] proposes an IoT based Flood Early Warning system running with the help of edge computing and Artificial Neural Networks (ANN). Water level and rainfall data are collected using Sensors and sent to an Arduino micro controller where the data is sent to a Raspberry PI which act as an edge computer via Bluetooth (BLE). This concept is commonly known as Wireless Sensor Network (WSN). Multiple sensor devices are connected to the Raspberry PI, while an active internet connection fetches the data into cloud based IoT data collection and integration platform, 'Thingspeak'. This platform is used to push early warning alerts into the public using configured channels. He has more focused on bringing the Analysis action into low power edge device rather than placing it in a centralized manner. ANN is trained and used to forecast flood events in timely ahead manner. Moreover, Sophia [2] has proposed a flood alerting system using water level meter where users are able to get the alert and monitor the water level using web-based GUI. Moreover, she has used a rain sensor to get the rain fall data. Using a NodeMCU (ESP8266) and Arduino microcontroller collected data is sent to Web GUI via Wi-Fi and users can get the relevant information. However, there it is not aimed adding the forecasting part, though similar sensors are used in data collection part.
Usage of rainfall-based flood prediction system has been discussed for Malaysia [3]. This system collects history and real time rain fall data and feed the data into a Nonlinear Autoregressive Exogenous (NARX) model which is developed using MATLAB. As per this research, this NARX Model is used to predict flooding 24 hours ahead of time. However, no IoT devices used since data was collected from existing devices used by the authorities. Since this research used large (from one year) amount of data to train the NARX which is a form of recurrent dynamic neural network with feedback connections encircling on several layers of the network, it has proven to provide predictions with lower error rate. Similar as [1], Using ANN based flood modeling and flood prediction. Acquiring the rainfall and water level data which then processed using ANN Radial Basis function which is a model of ANN architecture consisting of three layers naming Input, Hidden and output. From the research they [4] have concluded with finding the ideal hidden neuron count (30), maximum epoch (5000) and learning rate (0.2) for the ANN training. Several tests have been executed to identify the errors in the system and several error calculations functions also tested. It was used the Mean Absolute Percentage Error (MAPE) as the measuring information for the trained data set. An Average percentage of water level data was at 0.047%, which is considerably low, hence the prediction values have higher chance of success. Furthermore, researchers [5] [6] have used ANN and IoT technology successfully to forecast flood events, which differs from this research from the collected variables and the IoT methodology used.

Research Problem
1. How to accurately forecast and issue flood early warnings for tributary streams?
a. What can be the variables used in forecasting model?
b. Can an artificial neural network be trained and used for accurate flood forecasting?

Research Methodology
This Flood early warning and prediction system involves with neural networks and have more than one integration points. Flood Early warning systems are mostly built for public benefit or for research, rather than going with a business perspective. Hence, it has less business value when considered as an isolated system. However, the outcome of these kind of system has a massive impact on businesses, since flooding can have impact on businesses and economy as well. According to a data collection survey done by JICA [7] on disaster risk reduction sector in Sri Lanka, it was found that the most frequent natural disaster in the Island is floods which is 37% from all-natural disasters.
Total number of 18141 houses/buildings have been destroyed due to floods during the last decade (1996-2016) [7] With these facts and figures it is evident that Floods can have major impact on the economy. As per a case study carried out by UK Centre for ecology & hydrology, improved flood warning systems are saving up to £30 million per year [8].
A. Data collection and integrating.
It was identified that mainly 4 data parameters are needed to be collected. Water flow(discharge), Water level, Rainfall status will be collected Real-time using Sensors implemented in the main artifact which will then transfer to the data store via GSM Module. Currently in Sri Lanka precipitation is not available online (only available daily precipitation data, which updated with one day delay). Hence OpenWeatherMap online API can be used to get the hourly precipitation data for the selected geographical area.

B. Data storing, interfacing.
It is required to store the collected data for analysis and should be able to display real-time for monitoring purpose. Thingspeak platform can be used to store and interface data. It is chosen as it is supporting the MATLAB analysis which is used in prediction process C. Data analyzing and reacting.
Gathered data needed to analyze and data is needed to train the ANN at first. After training the ANN, it will be used to predict the water level of the stream with other parameters. Reacting part is triggered when the water level is above predefined height. (This height differs with the selected geological location for implementation.) Below Figure 1 showcase the main data flow diagram for the system which includes all the sensors and devices which is used during the system data flow Triggers the GSM module to establish connection with mobile network to send the collected sensor readings into web platform via GPRS. Main advantage of using controlling device is that it allows to use the sensors and communication devices in intelligent manner (only use when needed) to conserve power. Also helps to carryout primary filtering and calculations (i.e., calculate flow rate etc.) of sensor readings.  P2 -GSM Module: Establish GPRS connection using available mobile network (depend on the SIM). Push sensor data to the IoT platform when triggered by the Microcontroller (Arduino Uno).  P3 -NodeMCU: Used to get weather data from weather API, filter the required chunks and push them to the IoT platform. Also used as an integration module for external dashboard or LCD display (not implemented with this project). NodeMCU will pull sensor and weather data from IoT platform and send them to the external dashboard/Display using WIFI connection.  P4-Analysis: This module is responsible for the analysis using the trained ANN and get forecasted water level for the tributary stream using the sensor and weather data. Locally trained ANN is uploaded into this module for this purpose. When an anomaly (predicted water level exceeding threshold value)detected this will trigger alert event for the React module.

A) Data Collection Segment -the main sensor
data is collected, processed and sent to the Main Data processing unit is done by this. Consisting with 3 main sensors; Ultrasonic sensor to get current water level, Water flow sensor to get the water discharge and a Rain sensor to get rain status of the implemented location. These collected raw sensor data is processed into human readable values and pushed to the Web based Main data processing unit via a GSM module. Furthermore, this segment will directly alert the user/admin if the current water level is rising above a given (should be preconfigured) limit.
B) Data Integration Segment -It was required to communicate with a 3rd-Party Weather API in order to acquire some weather precipitation related forecasting for the geographical area of the Main River. Additionally, if a user/admin needs to include additional dashboard (customized web based), a mobile app or a physical display to monitor the Flood Early warning system Readings, This Data integration segment enables that feature using a NodeMCU unit. This unit not only pushes the 3rd Party API data into Main Data processing segment, but also pull-back the Sensor data, which then can be communicated to cater the additional desired monitoring requirements.
C) Data Processing and Reacting Segment -This is fully web-based platform and consists of all the collected or processed data, Analysis module which is responsible for analyzing and forecasting flood events and finally the reaction module to Send the necessary alerts accordingly. Thing-speak web based IOT platform is chosen for this task mainly due to it supports MATLAB integration which is vital for the Forecasting using ANN.
Aggregated Sensor and precipitation API data is stored in Thing Speak online data base and are separately displayed in the dashboard as line graphs. These data are processed using MATLAB analysis module and will use the locally trained ANN to get the forecasted water level. If a forecasted water level is above nominal value, react module is triggered, and Alerts is sent via defined method.

Artificial Neural Network
Neural Network used in this system consists of 3 inputs (Rain status, Water flow and precipitation), 1 output (Water level), two hidden layers and 12 neurons (Figure 4).
Optimum hidden layer count and the neuron count was picked by analyzing the different behaviors for different setups changing the variables. The performance of the ANN training and the related error histogram is illuminated in Figure 5 showing the error between training , test and validation data set is low and the output results can be successfully used.

Results and Discussion
Acquired test data set was used to train and validate ANN. With the validation set, ANN showed no abnormality and ANN had a fine performance (which indicates validity of the variables used. Proposed system with the proto type data predictions of the water level was plotted against the actual water level of the river at the same time ( figure 8). This plot indicates the reliability and the feasibility of using Water level, water flow and rain status variables in predicting Flood where most available systems only monitor the water level of the water body in order to provide alerts and notifications on rising water level This proposed system provides predictions 1 hour prior and prediction time can be extended by using more data to train and optimize ANN, also NARX neural network also can be used which will be more accurate in predicting short time predictions than long time. This Flood Early warning and prediction system is developed using affordable sensor modules and Microcontrollers. When analyzing the results of the project there is an anomaly in the sensor data when it is plot. This is due to the usage of rain sensor. It is mapped only to output 3 values from 0 to 2 according to the dryness. But this has affected the full data set when plotted with required output, water level. To resolve this, this rain sensor output should be mapped to a further range. However, it is not possible to this FC-37 rain sensor to differentiate Rain intensity (status) with this simple collected board. This should be replaced with a rain gauge which can measure the actual rain in real time, which can produce matching data. Otherwise, this biasing of data is affecting the accuracy of water level forecasting.
The Main data collection segment of this project is the data collection module which is placed near the river remotely. When placing a remote device in a remote location without external power source, it is needed to use batteries. However, due to the standby and operational usage of the devices, these batteries tend to drain quickly within few days. Hence, sleep-mode or low power modes of the micro controllers and sensors should be used to avoid such quick drain of batteries. Another main thing discovered is that the ultrasonic sensor used (AJ-SR04M) has only range of 8 meters.
Consequently, If the difference between maximum possible water level and the depth of the river is greater than 8 meters, it is not possible to use this sensor. In those cases, higher range radar sensor should be used instead.

Conclusion and Future Work
This project uses locally trained ANN using MATLAB implemented in Thingspeak, in order to successfully load the trained ANN into Thingspeak, external drop box connection is needed. Trained ANN can be saved as '.mat' file and uploaded into Dropbox. Which can be then linked and loaded in MATLAB Analysis platform in Thingspeak. No other method was found during the research to cater this demand. Currently with this project this only predicts the water level one hour ahead. It is possible to forecast several hours ahead but the RMSE and the percentage error gets higher when going more than 1 hour ahead. With some modifications to the neural network and training set, it can be improved to predict several hours ahead. Also, this uses a fitting neural network, usage of other Neural Networks can also be tried to improve the ahead time significantly.