A Framework for Knowledge Discovery from Wireless Sensor Networks in Rural Environments : A Crop Irrigation Systems Case Study

This paper presents the design and development of an innovative multiagent system based on virtual organizations.Themultiagent system manages information from wireless sensor networks for knowledge discovery and decision making in rural environments. The multiagent system has been built over the cloud computing paradigm to provide better flexibility and higher scalability for handling both smalland large-scale projects.The development of wireless sensor network technology has allowed for its extension and application to the rural environment, where the lives of the people interacting with the environment can be improved. The use of “smart” technologies can also improve the efficiency and effectiveness of rural systems. The proposed multiagent system allows us to analyse data collected by sensors for decision making in activities carried out in a rural setting, thus, guaranteeing the best performance in the ecosystem. Since water is a scarce natural resource that should not be wasted, a case study was conducted in an agricultural environment to test the proposed system’s performance in optimizing the irrigation system in corn crops. The architecture collects information about the terrain and the climatic conditions through a wireless sensor network deployed in the crops. This way, the architecture can learn about the needs of the crop and make efficient irrigation decisions. The obtained results are very promising when compared to a traditional automatic irrigation system.


Introduction
Wireless sensor networks (WSNs) are used for collecting the information needed by intelligent environments in urban and rural construction, smart cities, home and building automation, industrial applications, or smart hospitals [1][2][3][4][5][6].WSNs support current requirements related to the deployment of networks; they cover communication needs and are flexible in time, space, and autonomy; they do not require a fixed structure [7][8][9].Currently, several wireless technologies are available on the market such as ZigBee, Wi-Fi, or Bluetooth; they enable easier deployments than wired ones, avoiding the need to wire buildings and decrease the costs and drawbacks of the setup phase.The possibilities provided by WSNs allow developing a wide range of applications, such as energy cost control, monitoring of environmental data, security and control of access to environments, and industrial and home automation [10][11][12][13].In this regard, telemonitoring (or sensing) makes it possible to obtain information about users and their environment.This allows offering the users customized online services, considering the state of their environment.The building automation and control system market provides many standards, protocols, and data distribution systems, enabling different systems, like building automation systems, security systems, lighting systems, and others, to interact and integrate with each other [14,15].

Wireless Communications and Mobile Computing
The development of WSN technology has allowed extending its application to the rural setting where it can be used to facilitate the daily activities of farmers.People's interaction with the environment can be improved and the use of "smart" technologies can also improve the efficiency and effectiveness of rural systems.Mobile computing, grid computing, pervasive microsensing and actuation [16,17], and recent advancements in wireless technologies may change our surrounding environment in a way that we have not yet imagined.These emerging technologies can be used to create smart environments and improve the socioeconomic status of rural areas.The different applications of WSNs in rural environments can include e-services such as e-learning, eacademics, e-business, e-medicine, and e-healthcare.Those applications may facilitate an efficient connection between the city and remote rural areas.
Other applications of WSNs to the rural setting aim to prevent environmental degradation because of fires in farming and forest areas.Fires lead to pollution and to the loss of nutrients and soil microorganisms [18,19].It also causes vegetation degradation as well as flora and fauna diminution since they disappear from the affected zone and are not reintegrated in other areas.The application of WSNs not only in preventive but also in postfire detection systems is of great benefit.The use of sensors to detect and monitor fire behavior has allowed applying new technologies in this area.Sensors used in such systems measure static and dynamic variables, like humidity, slope of the land, the type of fuel, the direction, the speed of the wind, smoke, etc. Thanks to that, they provide knowledge of how the fire spreads and how to combat it efficiently.
Another area to which WSNs are applied within the rural context is agriculture and therefore the food industry.Sensors can be applied to measure parameters and gather information on environmental conditions affecting plant growth in areas that are not as easily controllable as those of a greenhouse.They are important for weather monitoring and optimal use of fertilizers in the field.Besides that, they can be used in spatial data collection, precision irrigation, and fertigation as well as disease and insect pest management.As for food industry, the applications involve real time temperature measurement for thermal sterilization, irradiation, etc. Bacterial concentration in food products can also be sensed.
An important feature of WSNs deployed in a rural setting is that they can collect heterogeneous data from different environments.In this way, systems can learn about the environment, making it possible to take adequate decisions and easing knowledge discovery.The goal of this approach is to provide a smart environment able to make decisions and efficiently manage resources.The process of collecting heterogeneous information is related to the term "Big Data" [20], which deals with the volume, variety, velocity, and complexity of data produced daily.Big Data not only brings together large amounts of data; the paradigm also makes it possible to process various data types.These data streams demand ever-greater processing speeds and yet their storage must be economic.The main goal of Big Data in research and technologies is to manage and transform available real time and historical data into knowledge and to make efficient decisions based on organizational requirements and needs.In the presented solution this will be done with the data recovered by the sensors.It will allow us to optimize the use of the actuators in the system.Like the pivots in the irrigation process, we will optimize the spent water knowing where to spend it in the correct moment.
Real Time Locating Systems (RTLS) are an example of another important application of WSNs [21,22].Although systems like GPS or the future Galileo perform well in outdoor localization, indoor localization still needs further development, especially with respect to accuracy and the use of low-cost and efficient infrastructures.Some of the applications of Real Time Locating Systems include tracking people, assets, and animals, access control, wander prevention, warning and alert systems, controlling security perimeter, and resources optimization.Companies need to use some sort of monitoring system to track their human and technical resources and, especially, to improve their security, efficiency, and safety and reduce occupational hazards.User identification is a key aspect for adequate services customization and environment interaction.A good example of this is emergency situations where it is necessary to locate people, for example, in the case of forest fires or nuclear disasters.To be able to develop a platform that would integrate different subsystems for remote location and automation, it is first necessary to create complex and flexible applications.
The goal of this research, therefore, is to design and develop a multiagent architecture aimed at gathering data and automating rural environments for decision making and knowledge discovery on a cloud system.This architecture, which is based on agent virtual organizations (VOs), will give intelligence to the platform, real time response, and adaptation to the needs of the application problem; and the cloud will ensure that the platform uses the required resources at all times.Recent tendencies have led to the use of VOs, which can be thought of as a set of individuals and institutions that need to coordinate resources and services across institutional boundaries.Thus, a VO is an open system formed by the grouping and collaboration of heterogeneous entities.The most suitable technology for the development of these open systems is Agent Technology, which makes it possible to form dynamic agent organizations.Modelling open multiagent organizations makes it possible to describe structural composition (i.e., roles, agent groups, interaction patterns, and role relationships) and functional behaviors (i.e., agent tasks, plans, or services), and it can incorporate normative regulations for controlling agent behaviors, dynamic entry/exit of components, and dynamic formation of agent groups [23,24].As the development of open multiagent systems is still a recent field in the multiagent system paradigm, it is necessary to investigate new methods for modelling open agent-based virtual organizations and innovative techniques that will provide advanced organizational abilities to virtual organizations.In that sense, the intelligence provided by proposed architecture is based on union of supervised and unsupervised learning.On the one hand, we provide a subsystem able to learn from past experiences or already classified data, which guarantees the automation of the system in decision making.On the other hand, it is not always possible to collect labeled data as in the previous case.For that reason, we have linked the previous subsystem with another of unsupervised learning.The latter will allow us to find groupings in data based on their distribution, on which we can later classify or label the data based on the knowledge obtained from the groupings found.The subsystem above has been used in this research to recognise different crop areas (of different needs) focused on their features, disclosed by different sensors measuring environmental condition of the crop.All of the above allows us to use resources only when and where they are needed as a means of optimizing resources in crops.
Finally, this paper has been divided into the following sections to reach the proposed aims: the Related Work which describes the background and the works related to this research as well as the main contribution of this research.The Multiagent Architecture Methodology describes the method used to develop the architecture, i.e., discretion of the different layers of the architecture and the multiagent system involved.The case study section describes the features of the corn crop and pivot-based irrigation system.The results reached in this section are given as the final part.Conclusions and references are listed at the end of this document.

Related Work
The challenge of adapting Information and Communication Technologies (ICT) to the needs of the agrifood sector lies in the complexity of the problem it faces: great diversity of products, fast deterioration of fresh products, binding of agricultural production to weather conditions, existence of diseases or pests, limitations in the evaluation of the product quality by the final consumer, distances between production and consumption areas, etc.To deal with these aspects, an automatic decision-making-oriented analysis is required for large volumes of heterogeneous data collected from different sources [25][26][27][28].
The above cases exemplify the flow of products in the agrifood domain, which move from the agricultural sector to the food industry (agrifood logistics) and finally are delivered to the consumer (food awareness).Precision agriculture in primary production [29,30], tracking and tracing of food products along their value chain [31], or identification of product characteristics through labels and logos targeted at the consumer [32] showed important initiatives supporting the needs imposed by the sector and the consumer.
The use of WSNs in the cases listed above has contributed to the development of systems that continually improve their performance.This has been a reality, especially in networks of radio frequency identification devices (RFID), which are closely linked to the organization of interenterprise agrifood processes, ranging from the farm to the distribution company [33].However, the process of selecting and specifying technologies that improve business processes is becoming increasingly complex, due to the wide variety of existing devices and the rapid developments in this field.
RFID technology is currently one of the most promising technologies in self-identification and data capture (AIDC).The main objective of RFID systems is to collect data through a transponder (tag) so that they can be transmitted and received by a transceiver, all through a wireless communication channel.The possibility of accessing information without the need for visual contact with the tags is exploited in the identification or location of assets [33,34].Such capacity is relevant in food tracking and tracing systems, through the identification of batches of individual products.In addition, the continued development of RFID is generating new use cases that go beyond the identification functionality.To this end, RFID is integrated with other technologies, such as sensor technology [35][36][37].
The advantage of RFID technology lies in the fact that it is cheap enough to be incorporated into any physical device, while providing bidirectional communication capacities, allowing building advanced organizational schemes, such as the Internet of Things (IoT, (ITU, 2005)).RFID can create new business models on global device networks, where each object is networked.Current RFID implementations show great potential and RFID may become a catalyst of technical evolution in the industrial sector [38][39][40].
In general, agrofood data collection technology is characterized by a wide variety of active devices in different parts/environments.The following are the most common examples in the majority of use cases [26]: (i) Data collection on farms through the implementation of wireless sensor networks: they provide information on production indicators like precipitation, soil moisture levels, pesticide and fertilizer use, and more.(ii) Transport data capture: It includes the location and information of the environment and data both inside and outside the transport system, which allows us to know the state of logistics.(iii) Data capture of product quality indicators: the levels of humidity, oxygen, nitrogen, and ethylene in the air act as indicators of the state of fruit and vegetables, being relevant in storage and transport tasks.(iv) Data capture from product packaging (logos and other) is to collect additional product information on cloud.
Focusing on the agricultural use case, small and medium sized farms carry most of the weight of world production.Even though they are slower to adopt IT solutions, due to lack of familiarity with technologies, belief that the costbenefit ratio does not suit their needs or due to their lack of knowledge they are not able to make use of the large amount of information that these systems acquire [41].Solutions to such problems may be found in precision agriculture.For example, the conferences of the International Society of Precision Agriculture (ISPA, 2012) aim to collect information for accounting purposes and its subsequent automation.This implies increased agricultural automation and improvements in environmental technologies.In this area, wireless sensor network applications for irrigation facilities management based on radio frequency identification have been proposed in [42,43].Those applications were determined to be beneficial in the management of water.This kind of systems collect, analyse, and monitor data from a net of sensors installed in the field in a feedback loop which activates the control devices based on precalculated threshold value, like in [44].Some other works develop applications to allow the user to interact with the system and make dynamical thresholds [45,46].Other systems, instead of just thresholds, do use linear programming models to optimize the resources like in [47].Here the authors combine the idea of "knapsack" problem with a linear programming model proving satisfactory results.The novelty of our solution is that it proposes a combination of supervised and unsupervised learning, where, according to the nature of the data, clustering and/or machine learning methods are used for task optimization in the use of resources, while improving the crop quality.Nowadays, in WSN based systems, two computational paradigms are arising: edge and fog computing.Regarding farming and precision agriculture, in [48] the edge computing paradigm has been used in order to make the data they use more private.To obtain this, the IoT sensors (edges) preprocess and analyse the private data and send the results to a server, where the results to estimate and predict the total harvest yield are gathered.In [49], the above paradigms have been used to create a smart farm monitoring system.The works previously exposed deployed WSN inside a building, but our solution deploys it in open fields.IoT devices are in the open field, so it is difficult to use a computer with enough computing power to process all this data in a fog computing way.Furthermore, if the devices are not lightweight and compute the data in an edge manner, the energy consumed would be greater and it would mean that it is needed to spend resources considering the batteries.That is why, instead of trying fog or edge computing paradigms, we must use the cloud computing one.

Multiagent Architecture Methodology
The main goal of this research consists in the design and development of a new and innovative multiagent architecture based on virtual organizations, capable of managing the information collected by wireless sensor networks (e.g., Wi-Fi, Bluetooth, ZigBee, GPS, and GPRS) for knowledge discovery and decision making in rural environments.The implementation of a prototype of this architecture has been developed with Java (64-bits) under the Java Agent Development framework (JADE).The tests have been performed on a PC server model: PowerEdge R330, CPU: 4 CPUS x Intel 5 Xeon 5 CPU E3-1220 v6 @ 3.00GHz, RAM: 31.83GB, OS: VMware ESXi 6.5, and HDD: 1T.
Wireless Sensor networks (WSNs) fall into the category of complex, distributed, interconnected and rapidly changing systems.Multiagent systems (MAS) have been identified as one of the most suitable artificial intelligence paradigms in the development of WSNs, since MASs are robust and autonomous in providing formalisms, algorithms, and methodologies in satisfying the challenging needs of WSNs.Specifically, MAS provide adaptiveness, decentralised control, large scale, information uncertainty, resource boundedness, and physical distribution [23].
The proposed multiagent platform will be built over the cloud computing paradigm to provide better flexibility and higher scalability for handling both, small-and large-scale projects (e.g., individual homes, large hospitals, or even smart cities).Cloud Computing can offer a very powerful, reliable, predictable, and scalable computing infrastructure for running multiagent systems by implementing agent-based complex applications.These applications can rely on cloud computing infrastructures to access and use vast amounts of processors and data.One key feature of software agents is intelligence to solve complex problems.Such intelligence can be obtained through the collaboration of several agents running in a distributed environment.The choice of cloud computing meets the requirements of MAS, providing a distributed environment and ensuring low runtimes and high performance.

Multilayer and Multiagent
Architecture.This subsection describes the multilayer organization of the multiagent architecture proposed in Figure 1.Each layer shows an abstraction level by involving a different degree of gathering and processing information.The abstraction level implemented in each layer allows it to isolate itself from the responsibilities of its neighbouring layers.This also makes it possible to decouple and reuse system components, giving a greater adaptation to the environment.Then, the responsibilities of each layer can be described as follows: (i) Layer 0: This layer is the physical one, in which the network of sensors and actuators of the system is deployed.Those devices can be based on different technologies and communication protocols, Wi-Fi, Bluetooth, ZigBee, GPS, GPRS, etc., depending on the characteristics of the terrain where the system is deployed.
(ii) Layer 1: This is the data receiving layer, which contains the agents responsible for capturing the information from the sensors and routing them to the upper layers to transform them into a common format defined in the platform.This layer is also responsible for routing the orders obtained from the upper layers to the actuators.
(iii) Layer 2: This is the data transformation and storage layer.In this layer, the data are transformed to a determined format, depending on the purpose for which they will be used.For example, data collected from sensors need to be merged before they are analysed in the upper layers or are requested by actuators in the physical layer.This layer is also responsible for storing the captured data to create a history for further analysis.
(iv) Layer 3 (data analysis layer): This is the layer where knowledge is discovered through the agents responsible for the analysis of the collected information.This layer defines agents in charge of performing computations and applying supervised and unsupervised learning techniques.Therefore, this layer makes it possible to take decisions based on the collected data, giving the most important part of the intelligence of the system.(v) Layer 4: This is the user interface layer, which interacts with and fulfils the requests of system users.The rest of the layers back up this layer to provide services such as process and device monitoring, analysis of stored data, and information visualization.

Architecture Multiagent System.
The proposed architecture's multiagent system (MAS) is developed based on virtual organizations (VOs), which perform previously defined tasks in the architecture layers.As shown in Figure 2, several linked VOs and agents govern the proposed multiagent system, performing different roles to meet their individual goals that contribute to reaching the common goal of the system.Each VO consists of a set of agents with specific roles within the organization.Agents perform their tasks/roles and collaborate with other agents from the VO to achieve the objectives of the organization.In addition, the introduced MAS responds to the needs of each layer given in Figure 1; it has also been adapted to manage and/or optimize the water flow in automatic irrigation systems for crops.Thus, the aim of applying the MAS illustrated in Figure 2 to crop irrigation systems is to incorporate intelligence into the irrigation process, allowing the minimisation of water consumption.Below, the roles of the agents and of MAS VOs are described: (i) Manager agent (MA): This agent acts as a mediator between VOs and agents defined in the MAS, and it is responsible for coordinating the operations between them.The MA is primarily responsible for the management of agents that are encompassed within it.Therefore, it allows for the creation and management of the life cycle of an organization or agent.DTVO organization, which will convert the received data into an internal common format and store them in the corresponding database for their later retrieval.HDMA is also responsible for providing data (through the MA agent), in an indicated format, from the previous VOs to the rest of entities in the MAS.
(iii) Irrigation manager agent (IMA): This agent manages the automatic irrigation system in crops.This agent converts the results given by the KDVO organization into an action that is to be performed by the irrigation control device.To do this, each data analysis result from KDVO is encoded to a bit sequence, which is interpreted as an action or set of actions that are to be performed by the coupled irrigation system.Such actions may be to start or stop watering, increase or decrease the water flow for a determined area of the crop, irrigate only a specified number of crop areas, etc.In addition, this agent can communicate the activities the irrigation system is performing at any time, i.e., the activity that is being performed.
(iv) UIVO virtual organization: This organization interacts with the system users through a system interface (agent IA) where the user can make requests in relation to the activities being performed on the crop, obtain or analyse information from historical data stored on the database, and monitor sensors of the crop or of a crop area.For such purposes, MA and DAA agents communicate with the remaining entities (through the manager agent) of the MAS to perform the tasks requested by users.Meanwhile, the MA agent (in UIVO) starts the monitoring process through the DRVO organization and the manager and HDMA agents.Also, the DAA agent starts the process of intelligent analysis of the historical data by running the manager and HDMA agents along with the KDVO and DTVO organizations.
(v) DRVO virtual organization: This VO groups the agents responsible for gathering sensor data and is composed of an agent set, called DCAs (data capture agents).Each DCA agent captures data from a sensor type, so each agent is designated for obtaining data from a particular sensor type, so that each agent manages several sensors of the same type and each agent is specialised in one type of sensor.In addition to information gathered on the environmental factors measured by sensors, information such as crop identifier, sensor, and area where the sensor is located are also included.Note that the proposed architecture and MAS have been designed to manage more than one crop at a time.
(vi) DTVO virtual organization: This VO groups the agents that transform data from one format into another.Since data obtained from sensors in crops are heterogeneous, it is necessary to convert such data to a common format that can be used by the MAS.Basically, it is about converting the captured data into the internal structure of the database where the MAS implements and achieves the inverse operation to such a conversion (i.e., from the database to another format) when it is requested.DTVO is also in charge of storing converted data in the corresponding database and running queries on them.Each data format agent in this VO is an expert in one or more conversions of data formats.Note that each database associated with these agents corresponds to a different crop, in case the system manages more than one crop.Finally, DTVO is important for the MAS because of the great number of heterogeneous data gathered from sensors.
(vii) KDVO virtual organization: This VO provides the MAS with intelligence by incorporating agents based on supervised and unsupervised learning.Thus, KDVO oversees the knowledge discovery process from historical data which are obtained from the sensors deployed in crops and stored in their corresponding database.This allows us to find patterns in the data and predict their behaviors under different circumstances.KDVO consists of five related agents as explained below: (i) KMA agent: This agent provides the information needed by the rest of agents of the organization to perform their tasks, so that KMA is the link between external entities and the VO; moreover, it determines the agents to used and who will collaborate to solve data analysis requests.Thus, not all the agents of the organization are used in a data analysis process and the selection of the agents to be used depends on the type of presented problem.Finally, KMA is also responsible for formatting the collected data to a dataset that can be given as input to the remaining agents of the VO.
(ii) CA agent: This agent collaborates with the rest of agents of the VO by providing complex computations from the data.CA applies predetermined formulas (statistical computation) to collected data such as temperature, relative humidity, and CO 2 , to figure out the needs of the crop.One of the aims pursued by the formulas above is to reach a precision irrigation and fertigation, as well as disease and insect pest management.But CA is only a part of the whole learning process that allows knowledge discovery.
(iii) ULA agent: This is the unsupervised learning agent, which implements algorithms to be run on unlabeled datasets.ULA is useful when data have not been classified into different groups, for which a decision must be made.This agent includes different clustering algorithms such as, Agnes, Diana, and Eisen [50].These algorithms are applied to group similar areas based on values gathered from the sensors located in different areas of the crop and make decisions accordingly.Note that a given crop area is identified by the values reported by its sensors.Hence, each area defines several sensor groups of the same type.This way, each area is represented by an n-tuple (a vector), where each component has a mean environmental value computed from sensors of the same type.Thus, the clustering algorithms group vectors standing for the features of each area of the crop.
(iv) MLA agent: This agent performs machine learning strategies when data are labeled to find patterns.This agent builds classifiers whose prediction is used in decision making or converted to an action carried out in the crop.The above means that the resources used in crops are optimized.This agent develops a Support Vector Machine (SVM), Artificial Neural Network (ANN) and naive Bayes classifier [51].
(v) CBR agent: This agent performs case-based reasoning and similarly to the agent above it is convenient for situations where there is a set of cases and experience in decision making to solve a particular type of problems.Based on past experience, CBR retrieves the most similar case to the one to solve and adapt the solution to solve the new case.The new case and its solution are stored in the corresponding knowledge base which will be used in the future to solve new problems.For the case that concerns us, a case is represented as a value n-tuple being environmental factor captured from sensors located in different areas of a crop.A casesolution means an action to be performed in the crop like irrigation, fertigation, and disease and insect pest management, among others.In general, a solution to a case means a decision making on the target rural area.Furthermore, the Euclidean distance is used by default to recover similar cases from knowledge base.Note that the CBR agent manages a knowledge base for each crop, if needed.
Finally, consider that not all agents in this VO must be used in a case study.Agents to be used as well as their collaboration to solve a case study depend on the characteristics imposed by the case study.
A cloud system has been employed, as it allows us to approach in real time, to adapt the response in real time and the context of the case study, although edge computing may be a more suitable way to optimize processes, reducing latencies, and consumption of less bandwidth [52].However, our system sends all data to the cloud at all times, immediately accessing the results of the analysis and evaluation of the status of all these sensors and devices.Note that although the proposed architecture does not develop a complete Big Data system, some of the Big Data features are present in the different VOs.Features such as data capture in DRVO, data storage with different formats in DTVO, intelligent data analysis through KDVO, and visualization and querying in UIVO are key to define an architecture following the principles of Big Data analytics.Thus, our proposal has developed the basis to manage in the future, volume, variety, and velocity in generated data.

Case Study on Irrigation in Corn Crops
This section details how the presented architecture adapts to efficient management of agricultural environments.The architecture adapts to factors that change frequently (weather conditions) and have a critical impact on the development of crops.Because the architecture is agent-based, it has features such as self-adaptation to dynamic environments, which allows us to manage data from a variety of sources, extract knowledge, learn from previous actions, and make decisions within the context in which the system is deployed.The architecture monitors the factors that impact the crops' watering needs; by controlling the irrigation system it covers the hydrological part and at the same time optimizes the use of water in crop irrigation.

Description of the Corn
Crop.This subsection details the scenario in which the architecture based on virtual agent organizations has been implemented.The architecture has been deployed on an agricultural land of 40ha used for the cultivation of corn in the province of Salamanca, Spain (Table 1).This allowed us to measure the architecture's effectiveness in terms of adaptation to the context, data management, analysis, and optimization decisions in the process of irrigating the crop.The surface of the crop was divided into two parts, one in which the corn will be traditionally cultivated by irrigation with pivot (control crop) while the other part involves irrigation with pivot but the system will be managed through our platform (test crop).
The corn crop is characterized by being a short-cycle crop and with a variable water demand during the growth stage.The crop surface was loose and aired at the time of cultivation, with a high composition of nutrients.In the case study, the Pioneer P0837 model of the Pioneer Hi-Bred-FAO 500 cycle marketer was used.In Table 2, we can see the rest of the characteristics of the crop.The ideal temperature for the growth of the corn crop is between 25 and 30 ∘ C. It needs a lot of sunlight and in humid climates its performance is lower.For germination taking place in the seed, the temperature must be between 15 and 20 ∘ C. For the fructification stage, temperatures of 20 to 32 ∘ C are needed.Temperatures below 8 ∘ C and above 30 ∘ C can cause serious problems for the crop due to poor absorption of mineral nutrients and water.

Description of the Irrigation.
The traditional method of watering crops was called flood irrigation.Since a few years, this method has been replaced by drip irrigation.However, automotive irrigation has many advantages over drip irrigation because it is more efficient; it covers long distances and adapts to the plot and above all; it allows automating the irrigation process.This case study uses a pivot that has a circular displacement, so the distribution of water is very uneven along the side: little water is needed at the centre, being further away from the centre leads to the requirement of more water as there are more square meters to cover.The towers are moved by small electric motors (0.5-1.5 HP) at very slow and adjustable speed.While the machine is advancing, irrigation is taking place.Then, the pivot used in the corn crop (see Figure 3) consists of 3 towers of 55 meters and an overhang of 14 meters with a high-speed motor of 1.5HP at 86rpm at 60Hz that moves at 2.3m/min.The end-gun is located at the tip of the overhang with a section of 127, and the sprinklers are rotor type, with a ground clearance height of 4.40m.The system has a 52,000l sprinkler chart to cover the needs of a 20ha land.
The pivot irrigation system is automated by the IMA agent.This agent makes decisions based on the information collected from the WSN and sends commands to the irrigation control device.The deployed WSN allows the agents from the DRVO VO to collect the data necessary to determine the amount of water the crop needs and to command the pivot to move and irrigate.WSN sensors collect temperature, humidity, wind, height, or light hours temperature.These parameters influence the water needs of maize and allow the architecture to adjust irrigation and in this way optimize water consumption.When temperatures are high, plants will absorb more water from the soil, as perspiration increases.The corn crop that is at sea level needs more water because the soil in which it grows is warmer than that of a crop growing at higher altitudes.Ambient humidity provides the amount of actual water vapour contained in the air and the amount of water vapour it would need to contain to saturate it at the same temperature.Wind causes water to be lost or the land to dry faster.
To control the above issues, the KDVO virtual organization is in charge of finding out how much water a crop loses through evapotranspiration, ETc.This amount of water is defined as the crop's water requirement and it must be supplied.The CA agent calculates the water lost by ETc evapotranspiration using the climatic parameters (temperature, humidity, wind, precipitation, and solar radiation).To this end, the Penman Monteith [53] method was used in the architecture to determine the evapotranspiration rate, ETo.
where   is the evapotranspiration of the test crop (in mm/day),   is the evapotranspiration of the control crop (in mm/day), and   is the coefficient of the crop (in the case of maize it is 0.40 in initial period, 1.15 in mid-season, and 0.70 in total [54]).
where   is the control evapotranspiration (in mm/day), Kp is the corduroy coefficient, and   is the evaporation of Class A Pan (in mm/day) [55].In addition to the plant's water requirements due to evapotranspiration losses, it is necessary to calculate the net water requirements of the crop (Nn).To optimize the water used in irrigation, the system must consider the level of precipitation.Rain allows reducing the amount of water used by the pivot.Where Pe is efficient precipitation, architecture has considered 75% of precipitation to be effective precipitation: Based on the net needs of the crop, the total needs of the crop are calculated; for this purpose the system depends on the employed irrigation system.In the present case study by means of irrigation with pivot sprinklers the value of irrigation efficiency (Ie) is 80-85% [56,57].
To calculate the lowest rate of water flow needed (Q) to feed the pivot, the net water requirements of the crop (Nt), the surface area irrigating the pivot (m2), and the time available for watering () must be considered.The flow rate can be higher if there is a water resource available to obtain a higher flow rate (l/s).Although this requires greater power from the pivot, the number of hours required to perform the irrigation is lower.
The architecture calculates the time needed for the pivot to make a complete turn using formula (6), where travel speed (speed) refers to the displacement of the last pivot tower (the furthest from the centre of the pivot), where Lt is the distance in meters from the last tower to the centre of the pivot.
The frequency is obtained by dividing the hours per month available for irrigation by the time needed to make a turn.
By means of formula ( 8), the pluviometry is obtained which provides the pivot in each watering.Here Q is the least flow rate in l/s and Time in .This makes it possible to find flooding problems.

Results
The corn crop was grown on 25 th March 2017 and harvested on 3 rd August 2017, with the climatic characteristics presented in Table 3.
The architecture obtained the values of the evapotranspiration rate shown in Table 4.This allowed us to calculate the crop's water needs.
To optimize the use of water in irrigation, the level of precipitation must be considered.This water reduces the water used by the pivot.However, not all rainfall is useful; among other factors losses are caused by excessive dryness, wind, or runoff.For this reason, the architecture considered 75% of precipitation as effective precipitation (Pe).With effective precipitation, the system has estimated net requirements (Nn) for maize in mm/month.The architecture calculated the amount of water that the cultivated area (Nn) has to receive in order to satisfy the needs of the plants and have the maximum possible production, insofar as it depends on the water.In calculating net requirements, it was considered that the case study uses a central pivot irrigation system, which has an efficiency ratio of 85%.In Table 5 we can see the needs of the corn cultivation.
As the pivot used in the case study has 3 towers with a separation of 55m each and an overhang of end-gun (14m), the last tower is located 165m from the central pivot.In addition, the pivot moves at a speed of 1.6m/min, so it needs as much time as follows.
In a full turn, the pivot needs 7 hours and 30 minutes approximately to water the 20ha.This allows for a sufficient number of irrigations per month to cover for the needs of the crop (7).With the time required by the pivot, the irrigation frequency of the pivot and the minimum flow rate are calculated.To calculate the least flow rate feeding the pivot, attention is paid to the needs of the maize crop, the area under cultivation, and the time available for irrigation (value set at 18h), according to formula (5).
The pivot has used 1002.06mm(1002.06l/m2-10020.6m3/ha) over the time the corn crop was cultivated, as shown in Table 6.These results were obtained with the traditional pivot irrigation system.
The following are the changes brought about by the architecture designed to achieve savings in the amount of water used to irrigate the crop.As shown in Figure 4, the goal of optimizing the irrigation system is to identify the crop areas with greater and lesser irrigation needs; these are identified by the multiagent system (MAS) and the irrigation system supplies water to these areas.Since each area is characterized by distinct features, a set of different types of sensors is deployed in each one, in order to measure different soil, plant, and environmental parameters.Then, each area in the figure is identified by the MAS through a vector of values given by the sensors.Once the feature values are obtained for each area of the crop, the Agnes clustering algorithm (Euclidean distance used as a metric in the data) is run by the MAS (KDVO virtual organization) to build similar area clusters.KDVO runs the ULA agent by passing a dataset with the feature of each area of the crop.The ULA agent runs the Agnes clustering algorithm to identify different crop subtypes; in this case, two subtypes of crops (irrigation and nonirrigation) have been identified for all areas given in the input dataset.Therefore, the clustering algorithm will find two area groupings (clusters) with different features: one grouping may show that its areas need to be irrigated with less or more water, whereas the other grouping can indicate that they do not require any irrigation.Then, once the areas have been classified into two groups (or more if needed), this result is sent to the IMA agent through the manager agent.The IMA agent encodes the result-clustering into a bit sequence (a binary number), which associates each area of the crop with its need for irrigation.The IMA agent sends the bit sequence to the irrigation control device, which interprets such a sequence as an order that becomes an irrigation action for the crop.
Thus, the goal of detecting similar area clusters is to manage and optimize the irrigation system.The MAS clusters similar areas (in this case study, two types of area clusters) of the crop to optimize the water flow per area.In this case study, we have selected two clusters, identifying the areas that need more or less water.Thus, the MAS builds a binary number whose digits are related to each area."1" means that the corresponding area needs irrigation while "0" means that no irrigation is necessary for that area.Therefore, the irrigation system will just supply water (less or more water) in areas with value "1" as shown in the irrigation system in Figure 4.   Table 7 shows the results of the architecture-controlled surface, managing the displacement of the pivot to the area specified by the cluster.The zones marked by the cluster are those that indicate to the IMA agent an irrigation action.It also allows ULA to learn how to take irrigation actions autonomously if they meet characteristics that in earlier cases have disclosed that an irrigation action is necessary in a certain area.

Conclusions
This research work presented an architecture based on virtual organizations that allows localized irrigation using a pivot.It is an innovative approach that makes full use of the advantages of pivot irrigation (more economical choice) and the advantages of localized irrigation (lower water consumption), eliminating the disadvantages of pivot irrigation (higher water consumption vs. localized irrigation).The use of a system of agents in this efficient water management problem allowed us to monitor the status of the corn crop and coordinate the pivot to irrigate in localized areas releasing the necessary amount of water.The hypothesis proposed in this study (that the consumption of water used for pivot irrigation is similar to the amount of water required if the localized irrigation method is used) combines a series of needs (sensor data collection, fusion of information, information processing, and decision making, among others) that makes it necessary to develop an architecture based on an organization of virtual agents which controls all the parameters that influence the irrigation decision (temperature, humidity, wind, radiation, precipitation, soil salinity, etc.) in a crop by means of a WSN.
Agent-based virtual organizations use data from the sensor network deployed in the area of the case study crop.The results showed that the use of a VO MAS system was essential for optimizing the water used in crop irrigation.The possibility of programming the pivot to irrigate allows the VO MAS to send the architecture's orders to the irrigation system, with the aim of optimizing the amount of water used and the frequency of irrigation according to the climatic characteristics.From the results of the case study, we can see that the performance of the system allowed obtaining a reduction of 12.68% with respect to the crop area that was made by pivot but was not controlled by the VO MAS.Since the percentage was higher than 11%, we can deduce that the MAS VOI achieves similar saving to localized irrigation.However, MAS VOI does not entail the disadvantages that localized irrigation does, for example, the difficulties in having to deploy a distribution network in each harvest, the difficulties when using machinery on the surface of the crop, and the complication of deploying it in large areas.Finally, automotive irrigation was used thanks to the possibility of automating irrigation.It was even possible to irrigate only certain areas of the crop surface if the architecture decided so, according to the collected data.Although localized irrigation consumes 11% less than automotive irrigation according to the literature, the fact that automotive irrigation was managed by the architecture allowed us to obtain a higher optimization percentage.Complementing the above, we want to stress that, due to the ability of the proposed architecture and its multiagent system to adapt and be extensible, it can be applied to other types of crops and with a different geometry.
Physical layer implementing the deployment of sensors based on different technologies, Namely, Wi-Fi, Bluetooth, ZigBee, GPS, GPRS,...

LAYER 1 :
Data receiving layer, agent virtual organization responsible for capturing data from sensors and sending them to be processed by other virtual organizations.LAYER 2: Data transformation layer, agent virtual organization responsible for transforming data to determined formats, compatible with the architecture.

LAYER 3 :Figure 1 :
Figure 1: Organizational representation of the agent-based multilayer architecture proposed for knowledge discovery from rural areas.The architecture has been designed under the cloud computing paradigm.

Figure 2 :
Figure 2: Flowchart of the agent virtual organizations integrating the multiagent system for the control of irrigation in rural areas, such as crops.

Figure 3 :
Figure 3: Structure of the pivot used in the presented case study.
r e p r e s e n t i n gAutomatic and selectiveA r e a s o f s i m i l a r f e a t u r e s d e t e c t e d b y a c lu s t e r i n g a l g o r i t h i g a t i o n ( d i g i t 0 ) a r e a s irrigation system

Figure 4 :
Figure 4: Graphic representation of the kind of crop and irrigation system used in the proposed case study.The crop consists of circular grooves where the determined number of contiguous grooves forms an area for irrigation.

Table 1 :
Geological characteristics of the corn crop in the case study.

Table 2 :
Characteristics of the Pioneer P0837 corn variety used for silage production.

Table 3 :
Data on the climate of the surface area under maize cultivation.

Table 4 :
Evapotranspiration rate (ETo) values according to the Penman Monteith method for Table 1 values.

Table 5 :
Values of corn crop needs.

Table 6 :
Irrigation requirements for each month.

Table 7 :
Irrigation requirements for each month, managed by the VOs of MAS architecture.