Proactive monitoring and analysis of technological processes of growing crops in automated greenhouses

. Agricultural automation can reduce time and cost of crop production and minimize human factor that can lead to crop damage. This paper focuses on automating crop growth in compact greenhouses that automate several technological processes including periodic irrigation with a nutrient solution and a biofilter to ensure cyclic cultivation, measuring temperature, humidity, etc. Machine learning methods help estimate and predict operation parameters. During the experiment, the optimal methods and parameters were determined, and the best prediction accuracy could be achieved using the random forest method. Use of this approach enables proactive control of technological processes, ensures compliance with growing regulations and results in resources economy. Future research will develop a formal method for proactive process control.


Introduction
Agriculture has always been a labor-intensive industry that requires significant manual effort. However, with the advancements in technology, particularly the development of robotic and cyberphysical systems, automation has emerged as a promising solution to increase efficiency and productivity in agriculture [1]. These systems can perform a variety of tasks, such as planting, harvesting, and monitoring pest and crops, while minimizing the need for human labor [2].
Data analysis and proactive control have the potential to improve the way we control technological processes in agriculture automation. By using data analysis techniques, we can collect, analyze, and interpret data from various sources to gain insights into how different processes are performing and make informed decisions to optimize their performance. Various models, methods and systems that can be attributed to the field of "smart agriculture" are being currently developed to automate agricultural tasks this way [3]. One of the subtasks is automation of technological processes in greenhouse complexes, i.e., autonomous programmable units. This paper deals with some data analysis tasks for proactive monitoring and controlling technological processes in automated greenhouse complexes. Development and implementation of such solutions involves modeling the behavior of crops cultivation units in order to ensure sufficient accuracy in compliance with technological processes and to identify deviations in due time.

Materials and methods
There are a number of models, methods, algorithms and architectures to automate technological processes of growing crops in closed greenhouse complexes. In such complexes, various parameters and processes are monitored, such as temperature, humidity, lighting, water level, aeration, etc. [4]. For example, work [5] proposes an automated system for greenhouse complexes monitoring using sensors of temperature, air humidity and soil moisture, light exposure. Monitoring process uses Google Cloud and informs via SMS. However, the protocols used do not either contribute to the reliability and extensibility of the solution nor to the parameters controllability. Another monitoring solution is proposed in [6], where the same parameters in a greenhouse are under monitoring using Arduino and Raspberry Pi and an appropriate cloud architecture is offered.
Work [7] considers the system with light, humidity and temperature sensors. The authors formulated rules according to which the necessary threshold values of parameters are set on corresponding sensors to maintain healthy growth of certain plant species. Experiments have proven the effectiveness of using fuzzy logic to automate the irrigation system resulting in less water consumption.
Article [8] presents the architecture of the system for automatic monitoring and control of temperature, air humidity and light exposure levels in the greenhouse using a programmable logic controller. Parameters are controlled by relay. However, the system does not control all process parameters. Another approach to climate control in the greenhouse is described in article [9]: temperature and humidity is regulated by means of a distributed control system based on a programmable logic controller connected to a group of sensors and actuators using a bus. Nevertheless, it can be seen that the system covers only a part of the technological processes in the greenhouse.
Article [10] presents an automatic greenhouse control system intended for less water consumption during watering. The system monitors soil moisture and other parameters 24/7, and in case of deviation uses actuators to normalize the microclimate. The proposed automatic watering system combines drip watering and sprayer, which result in water saving of 48.78% as compared to manual watering.
Among the above solutions there are no the ones being capable to automate the complete technological life cycle of crops growing in compact vertical farms (minigreenhouses) under control of at least three necessary parameters -temperature, humidity and light.

Greenhouse complex
First, let us consider the developed compact unit for growing crops (hereinafter referred to as the mini-greenhouse), then its functioning models and technological processes control procedures are presented. It is designed for repeated cultivation cycle by periodic flooding (irrigation) with a nutrient solution which is purified while passing through a bio-filter. The unit covers an area of about 600*400*600 mm. Mini-greenhouse ( Figure 1) uses a controller and implement modules control for various devices (pump, aerator, UV sterilizer, lamp, fan, humidifier) by fixing current values of climate sensors and by using hermetic closing box -a growing chamber. The more detailed description of this greenhouse complex is given in [11].

Data analysis
It is possible to assess the performance of such modules and to record technological process violations using the collected data and tools for their analysis. The existing "Vertical Farming" dataset [12] is used as the source data. The data contained therein refer to sections that are used to grow crops in vertical closed-type greenhouses which are similar to the mini-greenhouse proposed above. The sections have two identical vertical layers in which the processes are implemented (A and B).
Let us consider the histograms of one of the sections. Figures 2 and 3 show histograms of temperature and humidity. The temperature histogram shows two local maxima that correspond to day and night temperatures. For humidity, we use the average value. The change in temperature with dependence on time in an interval of 7 days is represented below (Figure 4). The graph lets to evaluate the temperature stability in the section with respect to time. If the temperature exceeds the specified limits (±2°C), it can be concluded that a process violation ocurred.
As for the behavior of humidity, certain periodicity is also observed. Figure 5 shows a smoothed function for relative humidity values over 50 days interval.
Thresholds for relative humidity (average ±10%) can be added to the temperature control (±2°C). The difficulty of implementing such an approach on the selected dataset consists in arrival at a conclusion on compliance or non-compliance with the process is based at humidity and temperature measurements made at a random moment and its closest neighborhood (which may prove to be irrelevant) and not in a regular mode. The solution is to prepare or pre-process the set of measurements used for decisionmaking more thoroughly. The implementation of the proposed greenhouse complex, which systematically collects data on all process parameters, would solve the problem.

Proactive control
In addition, it is possible to evaluate the performance of greenhouse layers and to control the growing process proactively by predicting climate parameters on the basis of data collected before. The projects Environment for knowledge analysis -WEKA and AutoML -AutoWEKA were used for this purpose. Within those frameworks about 40 machine learning algorithms are implemented. The AutoWEKA framework also lets automated selection of the best learning algorithm and determinqation of its hyperparameters using Bayesian optimization and combined CASH algorithm [13].
To assess the greenhouse performance, the Target attribute was introduced, which can take one of the following values: 0 -both layers do not work, A -only layer A works, Bonly layer B works, AB -both layers work. After adding a new attribute and assigning values to it, using an estimate of temperature and humidity values, the resulting dataset was submitted to the AutoWEKA system. After checking 19 configurations, there were obtained the classification results shown in Table 1. The optimal classifier is "RandomForest", the covariation matrix is shown in Table 2.

Discussion
Forecasting can be used to detect technological process deviations proactively. By performing training on a set of already measured climatic parameters, forecasting of further course of the process in the greenhouse could be made and then be compared with the process chart (description of the ideal process). Thus, it is possible to identify both the actual deviation from the process and even the deviation that may occur in the future. This will enable make changes to the configuration of the greenhouse in advance or take measures to eliminate the malfunction. Process parameters such as temperature, humidity, light exposition, etc., are used as the values to be forecasted. This work includes numerical experiment consisting in predicting humidity and temperature for the input data set discussed above. The tasks of choosing the optimal algorithm and its hyper-parameters were also solved.
For example, Table 3 illustrates the accuracy of classifiers for predicting humidity in one of the greenhouse layers. Calculations for humidity and temperature have demonstrated that the best prediction accuracy can be achieved using the RandomForest method giving the relative standard error equal to 21%.

Conclusion
Solutions in the field of agricultural automation can reduce the time and expenses on growing crops and smooth the influence of human factor. This article proposes a scheme and a model of a compact greenhouse complex with a controlled microclimate. Machine learning methods are used to estimate and predict climate parameters in a mini-greenhouse. Use of these methods enables proactive control of technological processes, ensures compliance with growing regulations and results in resources economy.
Further research aims at the creation of a method for proactive control of compliance with technological processes based on their formal models. In the near future it is planned to build a prototype greenhouse using both self-made and ready-made solutions as well as self-developed software for conducting experiments and collecting data.