You are on page 1of 13

World Applied Programming, Vol (3), Issue (8), August 2013.

328-340
ISSN: 2222-2510
2013 WAP journal. www.tijournals.com

An Approach of Real-Time System for River Monitoring


and Flood-Warning System in Puebla, Mexico
Luis Enrique Colmenares-Guillen

Omar Nio Prieto

Aldo Aguila Jurado

Benemrita Universidad Autnoma


de Puebla, Mxico

Benemrita Universidad Autnoma


de Puebla, Mxico

Benemrita Universidad
Autnoma de Puebla, Mxico

lecolme@gmail.com

omar.ariosto@gmail.com

ae26ln@hotmail.com

Abstract: The absence of real-time monitoring systems in Mexico makes it difficult to provide information
about river conditions and overflowing. This also makes it difficult to alert the authorities and the protection
programs in case of a critical contingency. This paper presents an approach of solve this problem. The solution
has been designed using real-time systems methodologies such as Structured Analysis for Real Time (SA-RT)
and Langage d'Aide la Conception d'Applications in Temps Rel (LACATRE), which permit to obtain and
distribute data using two technologies: RTSJ from JAVA and .NET platform from Microsoft.
Keywords: Flood-warning, Lacatre, Real-time System
I.

INTRODUCTION

Climate, pollution, deforestation and other human activities are changing the rivers behavior leading to flooding. Such a
behavior, affects the ecosystems, the rural and urban areas, which bring along negative consequences such as; human,
material and economic losses. In 2008, nearly eighteen million people, all over Latin America, were affected by river
floods [10]; therefore, it is essential to design some adequate tools for monitoring rivers and evaluating the possible
damage that could result from flooding. It is also indispensable to alert the authorities when potentially high risks are
foreseeable; so that preventive actions can be carried out. The primary measurement in the river monitoring is the level
of water, and with some additional measurements such as air pressure, humidity, temperature and rain sensors, make it
possible to implement a meteorological model that prevents menaces and disasters.
Nowadays, there are software tools capable of obtaining data from the river monitoring. One of them was created by the
Centro Nacional de Prevencin de Desastres (CENAPRED) [2] along with the Universidad Nacional Autnoma de
Mxico (UNAM). This tool has been put into operation in different Mexican states, with dangerous river behaviors.
Some of the problems are caused by the overflowing of several rivers. However, data transfer and communication are
slow among the systems and the authorities; causing both a waste of time and the delay of alerts or remedial actions.
In Puebla, the level of water in the Alseseca River increases significantly during the rainy season -as a consequence of
illegal logging in the Malinche area- causing overflowing that impact on the population. Since the year 1999, about two
hundred families have been affected by the overflowing of this river, including districts such as Alseseca, Lpez Portillo
and Agrcola Resurgimiento [11].
This paper presents the Monitoring and Early Flood Warning System (MEFWS). MEFWS is based on the SA-RT [8]
and LACATRE [5, 6], General Architecture from the Real Time Volcanic Monitoring system [14, 15, 16] with new
features such as monitoring through social networks, Microsoft and Open-source Technologies.
II.

RELATED WORK

Some projects are described below. This section discusses the different solutions and contributions to build a complete
solution that benefits the authorities and the general population.
II.1 Flood warning system in Italy
In Italy Piedmont region, a real-time system was developed to prevent flooding of the Sesia River; it was also developed
to improve and expand the weather alert service. The hydrological monitoring of the river is carried out through the

328

L.E. Colmenares-Guillen, et al. World Applied Programming, Vol (3), No (8), August 2013.

meteorological, hydrographic, network Piedmont region- integrated with the national network, using three different
types of instruments: rain gauges, flow meters and snow measuring stations.
Under normal conditions, daily weather bulletin is issued, a warning that indicates the degree of danger depending on the
rain for the next 48 hours in that region.
The flood monitoring system in the Sesia River is activated when the heavy rains are forecasted in the area or when
rainfall values exceed predetermined threshold; which generates an updating of the data and a warning bulletin of
flooding until the phase of the warning is finished [1]
II.2 CENAPREDs Alert System
The CENAPRED in conjunction with the National Water Commission and state and municipal governments in Mexico
have established networks for measuring and forecasting flooding systems in the cities of Acapulco, Tijuana, Motozintla,
Tapachula, Monterrey, and Villahermosa.
Those systems through the rain-water model estimates the hydraulic cost at specific point along the channel of a river
within a given time, based on measurements of rainfall in the upper basin.
By using pluviometers and level sensors, data is collected for the current state of the river, and then the data is sent via
radio signal to a central, where it is processed according to the rainfall-runoff model; if the data obtained exceeds
thresholds, the alarms are activated. [2].
II.3 Flood Forecasting and Warning in England and Wales
Flood forecasting and warning systems work upon the principle of reducing flood losses through remedial action by
residents and businesses preceding a flood.
The key elements of the flood forecasting and warning process are summarized by Haggett [3] as four main steps; (i)
Detection, (ii) Forecasting, (iii) Dissemination and Warning, and (iv) Response.
II.4 The Delft-FEWS flow forecasting system
The primary objective of this work is to provide additional lead time through predictions of short-term future hydrometeorological condition. These predictions are used as guidance in making the decision to take any action such as the
issuing of a warning. This may then lead to the initiation of an appropriate response. Within the forecasting process,
hydrological and hydraulic models may be used to develop a prediction, and the forecasting system needs to support the
operation of these models in real-time [4].

III.

SOLUTION PROPOSAL AND COMPUTATIONAL PLATFORM

This scenario of dissemination and warning [3], implies the making of decisions concerning the issue of flooding
warnings, based on the catchment conditions, and the passing of information to flood-plain inhabitants, enough in
advance for them to take remedial actions to protect their lives and to reduce any economic losses. Within these four
steps, MEFWS focuses on the third one, or the dissemination and warning step.
The MEFWS is a combination of technologies that will deliver results on time and maintain compatibility with the users
PCs. MEFWS will be implemented as the first instance for monitoring the Alseseca River, although the structure and
design of the system can be implemented in any river through of the country.
III.1 Methodology and analysis
The design of the System was originally proposed for the Real Time Volcanic Monitoring System [14, 15, 16] using the
Structured Analysis for Real Time (SA-RT) [8] as a formal real-time system design language. This formal architecture
was adapted for the river monitoring and flood prevention, and it was supplemented with additional features. The system
design can be adaptative, and a concrete software design is proposed. This is possible since the abstract design of the
original model of the system architecture is respected. For the software, the LACATRE methodology [5, 6] was used,
and it was also adapted for the Microsoft and open-source technologies.

329

L.E. Colmenares-Guillen, et al. World Applied Programming, Vol (3), No (8), August 2013.

Modeling SA-RT is a widely accepted method of analysis in the industrial world, because it provides a mature approach
to the design of real-time systems, in addition to being a very expressive graphical language for specifying system
requirements.
SA-RT is based on the analysis-oriented data stream. This analysis is based upon the architecture of the Volcanic Real
Time Monitoring System that could be adapted to monitor the system as a general architecture and is described in the
following diagrams.
The context diagram represents an overview of the general system, including the most important modules, observed in
the Figure 1, for example the module of the RTSJ platform. This diagram could be modified depending on the elements
of the technology that are being used. This first approach can be adaptative using concrete technology, but the main
objective is to show to experts, the events of the sensors.

Figure 1. Context Diagram

The concrete context diagram represents the design of the system using the elements of a specific technology. In the
concrete context system diagram of the .NET platform from Microsoft is used. In Figure 2 there is the reading of sensors,
processing the data obtained by sensors, delivery and storage module using the RTSJ and the Web server data is shown
on the client PC via the module that implements Asynchronous JavaScript and XML (AJAX).

330

L.E. Colmenares-Guillen, et al. World Applied Programming, Vol (3), No (8), August 2013.

Figure 2. Concrete Context Diagram.

Figure 3 shows the system inputs signals, which pass through these modules: capture, transmission, monitoring, storage
and display of data/warnings.

331

L.E. Colmenares-Guillen, et al. World Applied Programming, Vol (3), No (8), August 2013.

Figure 3. Data Flow Diagram

The state transition diagrams (see Figure 4), shows the possible states of the system, and is related directly with the DFD.
The status of the sensors is obtained from the possible actions of the system, just as any changes of state, can also be the
consequence of possible actions of the system; in general, sensors expect a change, and when the change occurs, the
signal is captured and transmitted. This signal is received and processed to show a state of alert if necessary, or the
normal activity of river monitoring.

Figure 4. State Transition Diagram

332

L.E. Colmenares-Guillen, et al. World Applied Programming, Vol (3), No (8), August 2013.

The architecture context diagram, (see fig. 5) shows the input, processing, output, maintenance and human-computer
interaction (HCI) system.
Entries are the sensors, the processing is done by the MEFWS system with a web server; the output is the monitored
data, maintenance is performed by an operator and users belong to the HCI.

Figure 5. Architecture Context Diagram.

Figure 6 shows the physical connections of the system, the sensors, the HCI (monitor/screen) and the system modules:
RTSJ, the Windows server, the Internet and the module that implements AJAX.

Figure 6. Interconnection Diagram.

333

L.E. Colmenares-Guillen, et al. World Applied Programming, Vol (3), No (8), August 2013.

III.2 LACATRE Design


For the design of MEFWS, the formal language LACATRE was used [5, 6], which was developed for the
implementation of Real Time Systems (see Figure 7). This LACATRE diagram is also implemented as a concrete
software design with the .NET platform from Microsoft. The general LACATRE Software design of the system is also
described in the Real Time Volcanic Monitoring System, but it can also be applied. The system obtains the default rates
of three measurements of different sensors that will monitor the river:
1) Water level.
2) Detection and measurement of rainfall.
3) Temperature.

Figure 7. LACATRE Diagram

III.3 Implementation of MEFWS


For the MEFWS, two computer platforms were used: the RTSJ platform and the .NET platform from Microsoft. For
.NET Platform, The MEFWS is configured by default to receive data from three different types of sensors: 1. Water level
sensor, 2. Rain sensor and 3. Temperature sensor. However there is no limit to the quantities of each type of sensors, in
addition, the system administrator can establish new types of sensors.
The configuration and connection between sensors and MEFWS is done wirelessly -via radio waves. Once the sensors
are placed in their proper position, they are powered by a solar cell to transmit the data to MEFWS.
These are the connection settings used by the Sistema de Alerta Hidrometeorolgica of CENAPRED, with the difference
that in MEFWS, only one computer system will receive and process information from all sensors connected. Figure 8
illustrates the connection between sensors and MEFWS.

334

L.E. Colmenares-Guillen, et al. World Applied Programming, Vol (3), No (8), August 2013.

Temperature
Sensor

Solar
power

RadioModem

Rain Sensor

Solar
power
RadioModem

RadioModem

Information Receiving
Station
MEFWS: MONITORING

Solar
power

Water-Level
Sensor
RadioModem

Figure 8. Connection and data transmission from the sensors to MEFWS

The following are the major components of the MEFWS:

MEFWS: MONITORING
MEFWS: SERVER
MEFWS: CLIENT
MEFWS: WEB and FIREFOX.

In the Figure 9; the most important aspects of each system component are illustrated.

RadioModem

Information Receiving
Station
MEFWS: MONITORING

Central Server
MEFWS: SERVER
MEFWS:WEB
Internet

User monitoring a river using:

MEFWS: Client

Internet

User monitoring a river from User checking the alert-status


of a selected river using the
the MEWFS website
Firefox Add-on

MEFWS: Web

MEFWS: Web

Figure 9. Components and general architecture of MEFWS

335

L.E. Colmenares-Guillen, et al. World Applied Programming, Vol (3), No (8), August 2013.

MEFWS: Monitoring
This component was developed under the RTSJ platform [8] and SLAX Linux operating system, and it is responsible for
receiving information and monitoring data from the sensors. As shown in the Figure 8.
Once the data from the sensors is obtained, it is processed in real time and displayed on the screen, and at the same time
it is introduced into the MEFWS: Server database, so it should remain available to the other components of MEFWS.
This component should be used in the Information Receiving Station to monitor each one of the rivers.
MEFWS: Server
The MEFWS Server receives the monitoring and analysis data from the MEFWS Monitoring component, which is
waiting for connection requests to come from the clients that want to monitor a particular river. When those connection
requests arrive, the users will be registered and if the river being monitored changes, the users would be notified about
the change and warned accordingly.
The MEFWS: Server database can also recover data from previous measurements in order to generate graphs, reports,
future previsions, and warnings for possible floods.
The MEFWS: Server component is built on the same platform, enabling compatibility between the client and the server.
Some of the features implemented in the MEFWS .NET platform are:
1) Isolated Storage:
Through this mechanism, we improve the compatibility of MEFWS because it can store files in a temporary or
permanent computer equipment, without the need for read/write privileges on the current computer. It is useful in
MEFWS to store files that are necessary for the implementation and ensures that data is stored in the computer,
independently of the role of user in Windows (Administrator, User or Guest). Asynchronous connections,
multiprocessing, delegates and Events [9, 12]. These mechanisms improve the efficiency of our application.
The MEFWS uses the TCP / IP protocol to connect various components and pass information between them. In
the asynchronous connections, an application can continue running without waiting for a response from the server
or the client, and when an event arrives, an associated delegate capture the event information and informs our
application.
The same applies for multiprocessing, the MEFWS uses multiple threads to control various aspects of the host,
and when an event occurs, is captured by the Delegate and the necessary actions are taken by the MEFWS [9, 12].
2) Serialization:
Serialization allows the MEFWS to encapsulate objects and store them on disk for future use, or transmit them
through the network when necessary and be able to reconstruct the object on the receiver component.
When the MEFWS require to store or transmit information, it stores serialized objects in XML format, and uses
a binary serialization format to transmit objects over a network [9, 12].
3) Security:
For the MEFWS, the security is an important subject, if we have an application with open ports or waiting for
connections from any user, is a risk, and the application is unable to know when a message is reliable. A
malicious user can attack this vulnerability and send erroneous data on the system or even try a critical failure,
which may cause a human, material, and economic loss.
To enhance the system security and integrity of data, the MEFWS takes advantage of the .NET platform [9] and all
messages are transmitted using the following steps:
1.
2.
3.

Encryption of the message.


Serialization of the message.
Digital Signature message.

That way each message sent goes by a series of mechanisms that enable to improve safety and reject those messages
transmitted outside the MEFWS: Monitoring Real Time.
Figure 10 illustrates the transmission of information by the different components of security mechanism of MEFWS.

336

L.E. Colmenares-Guillen, et al. World Applied Programming, Vol (3), No (8), August 2013.

Figure 10. Security mechanism in the transmission of messages via MEFWS

MEFWS: Client
This component can be downloaded from the MEFWS website provided having obtained an authorization from the
administrator. Users who can download this component are the authority, organizations and/or groups interested in
specific data and measurements from a certain river, and who are capable of making decisions and take any appropriate
measures to warn people, towards avoiding a disaster in case of a menace. Once downloaded and installed, the client
component allows a user to monitor the condition of the selected river in real time.
When users login in the MEFWS: Client, this component connects to the MEFWS: Server and maintains an
asynchronous communication, so when a change occurs, or there is a threat in a river, the client component is notified
immediately; the users can receive specific information, about a river in real time.
One advantage of MEFWS: Client, is that it consumes few resources, and when minimized, it is placed in the Windows
system tray, what is more, other computer applications will not be disabled. If any abnormal or catastrophic event occurs,
the authorities (users) will be informed.
MEFWS: Web and Firefox
The MEFWS has its own website, where you can see the basic information for monitoring any river in particular. This
information is public and it is available to anyone who is interested.
Furthermore, through this site, users who have permission from the system administrator -such as agencies and
authorities involved in monitoring a river- can download the component MEFWS: Client, to install and use on their
personal computers, thus, being able to monitor a selected river.
The system provides an additional Add-On to the Firefox web browser, which can be downloaded free of cost, and
allows an interested user to know the level of alert a river in particular. These levels are three: Normal, Warning, and
Danger. This Add-On is designed so that one person may have a public monitoring of the state of a river.

337

L.E. Colmenares-Guillen, et al. World Applied Programming, Vol (3), No (8), August 2013.

Figure 11. Architecture of MEFWS with .NET

An important aspect for MEFWS, is the experience, skills and the current computer of a user. An MEFWS priority is that
the system is user-friendly and works without interrupting the work of the PC users.
In case MEWFS: Monitoring, use Microsoft platform may be replaced RTSJ component for Windows Embedded
component, as seen in Figure 11.
III.4 Implementation of RTSJ
RTSJ of Java
The RTSJ platform (Real Time Specification for JAVA) [13] allows the generation of real-time applications. The
platform used as the component of MEFWS: Monitoring, this component requires providing data, and processing them
at the moment they are being received, i.e. in real time. Using this platform, results can be shown and processed
immediately.

338

L.E. Colmenares-Guillen, et al. World Applied Programming, Vol (3), No (8), August 2013.

Scheduling
One of the concerns of real-time programming is to ensure the timely or predictable execution of sequences of machine
instructions. These sequences of instructions are called threads, tasks, modules, and blocks. The RTSJ introduces the
concept of a schedulable object. These are objects that scheduling to manage, RealtimeThread and subclasses and
AsyncEventHandler and subclasses [13].
Memory Management
Garbage-collected memory heaps, have always been considered an obstacle to real-time programming due to the
unpredictable latencies introduced by the garbage collector. The RTSJ addresses this issue by providing several
extensions to the memory model, which support memory management in a way that does not interfere with the ability of
real-time code, to provide deterministic behavior. This goal is accomplished by allowing the allocation of objects outside
the garbage-collected heap for both short-lived and long-lived objects [13].
Synchronization
Logic often requires serial access to resources. Real-time systems introduce an additional complexity: to controlling
priority inversion. We have decided that the least intrusive specification for allowing real-time safe synchronization is to
require that implementations of the Java keyword synchronized include one or more algorithms that prevent priority
inversion among real-time Java threads that share the serialized resource. We also note that in some cases, the use of the
synchronized keyword implementing the required priority inversion algorithm is not sufficient enough: to both prevent
priority inversion and allow a thread to have execution eligibility logically higher than the garbage collector. We provide
a set of wait-free queue classes to be used in such situations [13].
Asynchronous Event Handling
The asynchronous event facility comprises two classes: AsyncEvent and AsyncEventHandler. An AsyncEvent object
represents something that can happen, like a POSIX signal, a hardware interrupt, or a computed event like an airplane
entering a specified region. When one of these events occurs, which is indicated by the fire () method being called, the
associated instances of AsyncEventHandler are scheduled and the handleAsyncEvent() methods are invoked, thus the
required logic is performed. In addition, methods on AsyncEvent are provided to manage the set of instances of
AsyncEventHandler associated with the instance of AsyncEvent [13].
IV.

CONCLUSION AND FUTURE WORK

The MEFWS is a tool that can distribute the information correctly and on time. It is a system that combines various
methodologies, platforms and technologies to deliver a solution that brings benefits to the authorities and the general
population.
The use of design methodologies for real-time systems such as SA/RT and LACATRE allowed the modeling of a real
time application that captures and distributes the data, and the implementation of the system, Linux and Windows
operating systems were used, and programming languages like Java and C # .NET, XML and AJAX services.
The MEFWS will start monitoring the Alseseca River, but the goal is to implement the system nationwide and to expand
the functionality of existing systems.
Currently, MEFWS only monitor a single river at a time, so future work aims at permitting a user to monitor several
rivers at the same time. The authorities and organizations are responsible for a large number of rivers that may affect
their designated area, so it is important to be able monitor several rivers at a time.
In addition, the functionality of MEFWS will be extended to enable real-time communication between the various
authorities and organizations that are monitoring a river. As a future work, a general architecture should be proposed to
monitor all kinds of natural disasters; using the experience of the Real Time Volcanic Monitoring System and MEFWS
which monitor rivers.
ACKNOWLEDGEMENTS
This work has been funded by the Facultad de Ciencias de la Computacin and the Vicerrectora de Investigacin y
Estudios de Posgrado at the Benemerita Universidad Autnoma de Puebla (BUAP). The collaboration of the BUAP
students, who developed the system based on the original design -obtaining the third place in the Microsoft Imagine
Cup- it is recognized. Jose Luis Luna is thanked for reviewing the use of English in the manuscript.

339

L.E. Colmenares-Guillen, et al. World Applied Programming, Vol (3), No (8), August 2013.

REFERENCES
[1]
[2]
[3]
[4]
[5]

[6]
[7]
[8]
[9]
[10]
[11]
[12]
[13]
[14]
[15]

[16]

G. Arduino, P. Reggiani & E. Todini. (2005). Recent advances in flood forecasting and flood risk assessment, by Copernicus GmbH.
Hydrology and Earth system Sciences, 9 (4), pp. 280284.
Cenapred (2007). Los sistemas de instrumentacin y monitoreo del CENAPRED, recovered the day april 30th, 2013 of
http://www.ccadet.unam.mx/items/sub5/pdf/c3.pdf.
Haggett, C., (1998). An integrated approach to flood forecasting and warning in England and Wales. Journal of the Chartered Institution of
Water and Environmental Management vol. 12, pp. 425-432, Wiley online Library.
M. Werner , J. Schellekens, P. Gijsbers, M. van Dijk, O. van den Akker, K. Heynert (2013), The Delft-FEWS flow forecasting system,
Environmental Modelling & Software 40 (2013) 65-77, Elsevier, doi: http://dx.doi.org/10.1016/j.envsoft.2012.07.010.
Schwarz, J. Maranzana M., Skubich J., and Martinez Y. (1996), Applicative object Interconnection in a graphical design for real-time
applications. Control Eng. Practice, Vol 4, No. 10, pp.1419-1425,1996. Copyright 1996 Elsevier Science Ltd.Printed in Great Britain. ISSN
0967-0661.
Ponsignon, J.-F. Maranzana, M.; Aubry, R (1997). Reuse and reenginineering of multitasking Real-time applications in LACATRE. RealTime Systems, 1997. Proceedings., Ninth Euromicro Workshop on, pp. 233 240, ISBN 0-8186-8034-2.
G. Bollella, B. Delsart, R. Guider, C. Lizzi, F. Parain, (2005), Mackinac: Making HotSpot Real-Time. Eighth IEEE International
Symposium on Object-Oriented Real-Time Distributed Computing (ISORC'05), Seattle, Washington , May 18-May 20, ISBN: 0-7695-2356-0.
E. Yourdon (1989). Modern Structured Anyalisis. Englewood Cliffs, New Yersey; Yourdon Press.
T. Northrup, S. Wildermuth, B. Ryan (2006), Microsoft .NET Framework: Application Development Foundation. Microsoft Press.
Organizacin de las Naciones Unidas (2009), centro de noticias ONU, Servicio de las Naciones Unidas. recovered the day april 30th, 2013 of
http://www.un.org/spanish/News/fullstorynews.asp?newsID=14608&criteria1=desastres.
INEGI-Instituto Nacional de Estadistica, Geografa e Informtica. (2007), ESTADSTICAS A PROPSITO DEL DA MUNDIAL DEL
MEDIO AMBIENTE, DATOS NACIONALES, Mexico: Secretaria de Gobernacin.
I. Novk, A. Granicz, J. Kanjilal, G. Balssy (2010). Visual Studio 2010 and .NET 4, Wiley publishing inc.
G. Bollella, B. Brosgol, P. Dibble, S. Furr, J. Gosling, D. Hardin, M. Turnbull, R. Belliardi. (2006), Real Time Specification for Java, The
java series, SUN.
O. Nio, E. Colmenares, M. Martin, (2008). Sistema de Monitoreo Volcnico en Tiempo Real, Congreso IEEE, ANDESCON, Ciudad del
Cusco, Per, ISBN: 978-603-45345-0-6.
O. Nio, E. Colmenares, M. Martin, (2008) Propuesta para predecir eventos en el Sistema de Monitoreo Volcnico en Tiempo Real basado en
la informtica bio-inspirada y algoritmos de Redes Neuronales, IV semana nacional de Ingeniera electrnica, Aguascalientes Mxico. ISBN :
978-970-31-0944-9, 191-200.
E. Colmenares, O. Nio (2010), Analysis and risk assessment of real time volcanic monitoring system, Advances in Computer Science and
Engineering, center for Computing Research of IPN, ISSN 1870-4069, vol. 45, 3-13.

340

You might also like