A Soft Sensor to Estimate the Opening of Greenhouse Vents Based on an LSTM-RNN Neural Network
Abstract
:1. Introduction
2. Materials and Methods
2.1. Greenhouse Description
2.2. Experimental Dataset
2.3. Long Short-Term Memory
2.4. Network Architecture and Hyperparameters Preselection
- The number of hidden layers. It is selected by trial and error between 4 or 5 layers. Three types of hidden layers constituted the initial network architectures that were tested: LSTM cells, Dense (feedforward ANN), and RNN layers, as shown in Table 3. The reader is encouraged to find more details about RNNs and their relationship with LSTM cells in [30].
- The number of neurons. The number of network weights, which depends on the number and type of the hidden layers and the number of their neurons, is recommended to be much smaller than the number of data samples to avoid overfitting the network to the training data and to favor the generalization of the network output [33]. Hence, the number of neurons was selected accordingly, as presented in Table 3. The number of network weights remains around 18,000, which is much smaller than the number of training data samples (186,705 samples) multiplied by the number of selected inputs (8–13 inputs).
- Historical input data. By trial and error, 40 samples (20 min) were chosen as historical input data to capture all the delayed dynamics of the greenhouse climate, knowing that it presents some slow responses to disturbances (i.e., external weather conditions) and control actions as time-dependent events. It is a fundamental feature of RNNs, specifically of LTSM-based networks, which allows the selective and meaningful mapping of historical input data to the final output.
- Activation function. As presented in Equation (7), sigmoid is the selected function for all the regular layers. It is proven to be significantly useful in the multinomial logistic regression method, which can model types where the discrete output can have more than two possible discrete outcomes [34]. This is particularly important considering that the vent opening is normally a signal restricted to 11 states as discrete values ranging from 0 to 100% with 10% jumps. These jumps are due to the resolution of the motors used to open the vents in greenhouses.
- Optimizer. Adam is the selected optimizer. It is used as a mini-batch gradient descent method. It is based on adaptive estimation of first- and second-order moments. It is computationally efficient, requires little memory, and is suitable for problems with noisy and sparse gradients [35].
- Learning rate. The default learning rate of 0.001 is used for Adam. Higher and lower values were tested, but 0.001 proved to be more efficient in terms of loss reduction and computation time.
- Batch size. The batch size defines the number of samples to work within one iteration before updating the internal weights of the network. By trial and error, the batch size was set as 32 samples to accelerate the training process of the network.
- The number of epochs. An epoch is when all data samples pass through the neural network. By trial and error, 150 epochs were deemed sufficient for this study. In addition, the early stop feature is used to automatically stop the training of the network if no improvement in the validation loss function is shown for more than 50 epochs. In this case, the network with the best weights until that moment is stored. Also, the training can be stopped manually when overfitting is graphically noticed, knowing that the best network is automatically saved after every epoch.
3. Results and Discussion
3.1. Data Analysis and Inputs Preselection
3.2. Training and Testing the LSTM-Based Network
3.2.1. Dataset Splitting
- A training dataset is used for the network learning process to adjust its parameters. The complete dataset includes two different control methods for the opening of the vents. One is an automatic control showing rapid changes (before sample 160,000), and the other is a time-dependent control showing fewer changes (after sample 160,000). The training dataset was selected to include both types of control for the vent opening to enhance the training process with sufficient information. Moreover, this dataset was shuffled to ensure generalization during the training process. It contains 64 days representing 80% of the total dataset, from 19 October 2020 to 22 December 2020.
- A validation dataset was also used during the training process to provide an unbiased evaluation of the network while being fitted to the training dataset. The validation dataset is also involved in other forms of network preparation, such as feature and threshold selection. The validation dataset was selected to contain 8 days representing 10% of the complete dataset: 4 days from the start of the complete dataset (from 14 October 2020 to 17 October 2020) and another 4 days from the end (from 26 December 2020 to 29 December 2020). These days were selected because they present the different types of control for the opening of the vents.
- A test dataset is used to perform an unbiased evaluation of the final network. The test dataset was also selected to contain 8 days representing 10% of the complete dataset: 4 days from the start of the dataset (from 10 October 2020 to 13 October 2020) and another 4 days from the end (from 22 December 2020 to 25 December 2020).
3.2.2. Network Training and Progressive Elimination Procedure for Input Selection
4. Conclusions
- Estimate and monitor the evolution of the natural ventilation flux.
- Develop predictive models for greenhouse climate evolution as a function of the estimated vent opening.
- IoT platforms and decision support systems to provide recommendations to farmers after analyzing the measured data, and for example, alert them to close the vents whenever a high wind velocity is detected to avoid any risk of damage to the greenhouse and crop.
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Gomez-Gomez, J.D.; Pulido-Velazquez, D.; Collados-Lara, A.J.; Fernandez-Chacon, F. The Impact of Climate Change Scenarios on Droughts and Their Propagation in an Arid Mediterranean Basin. A Useful Approach for Planning Adaptation Strategies. Sci. Total Environ. 2022, 820, 153128. [Google Scholar] [CrossRef] [PubMed]
- Katzin, D.; van Henten, E.J.; van Mourik, S. Process-Based Greenhouse Climate Models: Genealogy, Current Status, and Future Directions. Agric. Syst. 2022, 198, 103388. [Google Scholar] [CrossRef]
- Rodríguez, F.; Berenguel, M.; Guzmán, J.L.; Ramírez-Arias, A. Modeling and Control of Greenhouse Crop Growth; Springer: Cham, Switzerland, 2015. [Google Scholar]
- Kochhar, A.; Kumar, N. Wireless Sensor Networks for Greenhouses: An End-to-End Review. Comput. Electron. Agric. 2019, 163, 104877. [Google Scholar] [CrossRef]
- Bersani, C.; Ruggiero, C.; Sacile, R.; Soussi, A.; Zero, E. Internet of Things Approaches for Monitoring and Control of Smart Greenhouses in Industry 4.0. Energies 2022, 15, 3834. [Google Scholar] [CrossRef]
- Tzounis, A.; Katsoulas, N.; Bartzanas, T.; Kittas, C. Internet of Things in Agriculture, Recent Advances and Future Challenges. Biosyst. Eng. 2017, 164, 31–48. [Google Scholar] [CrossRef]
- Rezvani, S.M.; Abyaneh, H.Z.; Shamshiri, R.R.; Balasundram, S.K.; Dworak, V.; Goodarzi, M.; Sultan, M.; Mahns, B. IoT-Based Sensor Data Fusion for Determining Optimality Degrees of Microclimate Parameters in Commercial Greenhouse Production of Tomato. Sensors 2020, 20, 6474. [Google Scholar] [CrossRef]
- Muñoz, M.; Guzmán, J.L.; Sánchez-Molina, J.A.; Rodríguez, F.; Torres, M.; Berenguel, M. A New IoT-Based Platform for Greenhouse Crop Production. IEEE Internet Things J. 2022, 9, 6325–6334. [Google Scholar] [CrossRef]
- van Mourik, S.; van der Tol, R.; Linker, R.; Reyes-Lastiri, D.; Kootstra, G.; Koerkamp, P.G.; van Henten, E.J. Introductory Overview: Systems and Control Methods for Operational Management Support in Agricultural Production Systems. Environ. Model. Softw. 2021, 139, 105031. [Google Scholar] [CrossRef]
- Garcia-Martinez, M.C.; Balasch, S.; Alcon, F.; Fernandez-Zamudio, M.A. Characterization of Technological Levels in Mediterranean Horticultural Greenhouses. Span. J. Agric. Res. 2010, 8, 509–525. [Google Scholar] [CrossRef] [Green Version]
- Mendoza-Fernández, A.J.; Peña-Fernández, A.; Molina, L.; Aguilera, P.A. The Role of Technology in Greenhouse Agriculture: Towards a Sustainable Intensification in Campo de Dalías (Almería, Spain). Agronomy 2021, 11, 101. [Google Scholar] [CrossRef]
- Valera, D.L.; Belmonte, L.J.; Molina-Aiz, F.D.; López, A.; Camacho, F. The Greenhouses of Almería, Spain: Technological Analysis and Profitability. Acta Hortic. 2017, 1170, 219–226. [Google Scholar] [CrossRef]
- Kittas, C.; Papadakis, G.; Boulard, T. Greenhouse Ventilation Rates through Combined Roof and Side Openings: An Experimental Study. Acta Hortic. 1997, 443, 31–38. [Google Scholar] [CrossRef]
- Bhujel, A.; Basak, J.K.; Khan, F.; Arulmozhi, E.; Jaihuni, M.; Sihalath, T.; Lee, D.; Park, J.; Kim, H.T. Sensor Systems for Greenhouse Microclimate Monitoring and Control: A Review. J. Biosyst. Eng. 2020, 45, 341–361. [Google Scholar] [CrossRef]
- Muñoz, M.; Guzmán, J.L.; Sánchez, J.A.; Rodríguez, F.; Torres, M. Greenhouse Models as a Service (GMaaS) for Simulation and Control. IFAC-PapersOnLine 2019, 52, 190–195. [Google Scholar] [CrossRef]
- Guesbaya, M.; García-Mañas, F.; Rodríguez, F.; Megherbi, H.; Ouamane, M.R. Virtual Sensor for Ventilation Flux Estimation in Greenhouses. In Proceedings of the XI Congreso Ibérico de Agroingeniería, Valladolid, Spain, 11–12 November 2021. [Google Scholar]
- Guesbaya, M.; García-Mañas, F.; Megherbi, H.; Rodríguez, F. Real-Time Adaptation of a Greenhouse Microclimate Model Using an Online Parameter Estimator Based on a Bat Algorithm Variant. Comput. Electron. Agric. 2022, 192, 106627. [Google Scholar] [CrossRef]
- Fortuna, L.; Graziani, S.; Rizzo, A.; Xibilia, M.G. Soft Sensors for Monitoring and Control of Industrial Processes; Springer: Berlin/Heidelberg, Germany, 2007. [Google Scholar]
- Sánchez, J.A.; Rodríguez, F.; Guzmán, J.L.; Arahal, M.R. Virtual Sensors for Designing Irrigation Controllers in Greenhouses. Sensors 2012, 12, 15244–15266. [Google Scholar] [CrossRef] [Green Version]
- Guzmán, C.H.; Carrera, J.L.; Durán, H.A.; Berumen, J.; Ortiz, A.A.; Guirette, O.A.; Arroyo, A.; Brizuela, J.A.; Gómez, F.; Blanco, A.; et al. Implementation of Virtual Sensors for Monitoring Temperature in Greenhouses Using CFD and Control. Sensors 2019, 19, 60. [Google Scholar] [CrossRef] [Green Version]
- García-Mañas, F.; Rodríguez, F.; Berenguel, M. Leaf Area Index Soft Sensor for Tomato Crops in Greenhouses. IFAC-Papers OnLine 2020, 53, 15796–15803. [Google Scholar] [CrossRef]
- Shang, C.; Yang, F.; Huang, D.; Lyu, W. Data-Driven Soft Sensor Development Based on Deep Learning Technique. J. Process Control 2014, 24, 223–233. [Google Scholar] [CrossRef]
- Bontsema, J.; van Henten, E.J.; Kornet, J.G.; Budding, J.; Rieswijk, T. On-Line Estimation of the Ventilation Rate of Greenhouses. IFAC Proc. Vol. 2005, 38, 125–130. [Google Scholar] [CrossRef]
- Kittas, C.; Boulard, T.; Papadakis, G. Natural Ventilation of a Greenhouse with Ridge and Side Openings: Sensitivity to Temperature and Wind Effects. Trans. ASAE 1997, 40, 415–425. [Google Scholar] [CrossRef]
- Teitel, M.; Tanny, J. Natural Ventilation of Greenhouses: Experiments and Model. Agric. For. Meteorol. 1999, 96, 59–70. [Google Scholar] [CrossRef]
- Pérez-Parra, J.; Berenguel, M.; Rodríguez, F.; Ramírez-Arias, A. Ventilation Rate Models of Mediterranean Greenhouses for Control Purposes. Acta Hortic. 2006, 719, 197–204. [Google Scholar] [CrossRef]
- López, A.; Valera, D.L.; Molina-Aiz, F. Sonic Anemometry to Measure Natural Ventilation in Greenhouses. Sensors 2011, 11, 9820–9838. [Google Scholar] [CrossRef]
- Graziani, S.; Xibilia, M.G. Deep Learning for Soft Sensor Design. In Development and Analysis of Deep Learning Architectures; Springer: Berlin/Heidelberg, Germany, 2020; pp. 31–59. [Google Scholar]
- Ojo, M.O.; Zahid, A. Deep Learning in Controlled Environment Agriculture: A Review of Recent Advancements, Challenges and Prospects. Sensors 2022, 22, 7965. [Google Scholar] [CrossRef]
- Liu, Y.; Li, D.; Wan, S.; Wang, F.; Dou, W.; Xu, X.; Li, S.; Ma, R.; Qi, L. A Long Short-Term Memory-Based Model for Greenhouse Climate Prediction. Int. J. Intell. Syst. 2022, 37, 135–151. [Google Scholar] [CrossRef]
- Van Houdt, G.; Mosquera, C.; Nápoles, G. A review on the Long Short-Term Memory Model. Artif. Intell. Rev. 2020, 53, 5929–5955. [Google Scholar] [CrossRef]
- Sepp, H.; Jurgen, S. Long Short-Term Memory. Neural Comput. 1997, 9, 1735–1780. [Google Scholar] [CrossRef]
- Arahal, M.R.; Berenguel, M.; Rodríguez, F. Técnicas de Predicción Con Aplicaciones En Ingeniería; Secretariado de Publicaciones de la Universidad de Sevilla: Sevilla, Spain, 2006. [Google Scholar]
- Edgar, T.W.; Manz, D.O. Exploratory Study. In Research Methods for Cyber Security; Elsevier: Amsterdam, The Netherlands, 2017. [Google Scholar]
- Kingma, D.P.; Ba, J.L. Adam: A Method for Stochastic Optimization. In Proceedings of the 3rd International Conference on Learning Representations, San Diego, CA, USA, 7–9 May 2015. [Google Scholar]
- Chok, N.S. Pearson’s Versus Spearman’s and Kendall’s Correlation Coefficients for Continuous Data. Doctoral Thesis, University of Pittsburgh, Pittsburgh, PA, USA, 2010. [Google Scholar]
- Waskom, M. Seaborn: Statistical Data Visualization. J. Open Source Softw. 2021, 6, 3021. [Google Scholar] [CrossRef]
Sensor | Brand | Model | Precision | Range |
---|---|---|---|---|
Air temperature | Campbell Scientific | HC2S3 | ±0.1 °C | −40 to 60 °C |
Air relative humidity | Campbell Scientific | HC2S3 | ±0.1% | 0 to 100% |
Global solar radiation | Hukseflux | LP02 | <±1% | 0 to 2000 W/m2 |
CO2 concentration in air | E+E Elektronik | EE820-C2 | <±50 ppm | 0 to 2000 ppm |
Wind velocity | Vector Instruments | A100L2/PC3 | <2% | 0 to 75 m/s |
Acronyms | Description | Unit |
---|---|---|
Inside air temperature | °C | |
Outside air temperature | °C | |
Inside air relative humidity | % | |
Outside air relative humidity | % | |
Inside CO2 concentration | ppm | |
Outside CO2 concentration (it can be considered constant as 400 ppm) | ppm | |
Inside solar radiation | W/m2 | |
Outside wind velocity | m/s | |
Difference between inside and outside CO2 | ppm | |
Difference between inside and outside relative humidity | % | |
Difference between inside and outside air temperature | °C | |
Vent opening signal | % |
Type of Layers | Number of Neurons | |||
---|---|---|---|---|
Architecture A (LSTM-ANN) | Architecture B (LSTM-RNN) | Architecture A (LSTM-ANN) | Architecture B (LSTM-RNN) | |
Input layer | LSTM | LSTM | Number of inputs | Number of inputs |
First hidden layer | Dense | RNN | 50 | 30 |
Second hidden layer | Dense | RNN | 80 | 60 |
Third hidden layer | Dense | RNN | 80 | 60 |
Fourth hidden layer | Dense | RNN | 50 | 30 |
Fifth hidden layer | Dense | / | 15 | / |
Output layer | Dense | Dense | 1 neuron for 1 target | 1 neuron for 1 target |
Pearson’s Coefficient | Spearman’s Rank Coefficient | Kendall’s Rank Coefficient | ||||
---|---|---|---|---|---|---|
≥ | > | ≥ | > | ≥ | > | |
0.22 | −0.05 | 0.09 | −0.02 | 0.07 | −0.02 | |
−0.34 | −0.15 | −0.03 | −0.18 | −0.02 | −0.13 | |
0.75 | 0.37 | 0.07 | 0.45 | 0.05 | 0.34 | |
0.5 | 0.3 | 0.17 | 0.32 | 0.14 | 0.23 | |
0.2 | 0.03 | −0.01 | 0.11 | −0.01 | 0.08 | |
−0.3 | 0.14 | −0.03 | 0.2 | −0.02 | 0.14 | |
−0.07 | −0.46 | −0.03 | −0.51 | −0.02 | −0.38 | |
0.6 | 0.32 | 0.08 | 0.32 | 0.07 | 0.24 | |
−0.36 | 0.14 | 0.1 | −0.19 | 0.07 | −0.13 | |
−0.37 | −0.4 | −0.05 | −0.36 | −0.04 | −0.26 | |
0.5 | 0.19 | −0.08 | 0.21 | −0.06 | 0.14 | |
1 | 1 | 1 | 1 | 1 | 1 |
Pearson’s Coefficient | Spearman’s Rank Coefficient | Kendall’s Rank Coefficient | Regression Analysis | Prior Knowledge about Physical Intractions | Inputs Pre-Selection | |
---|---|---|---|---|---|---|
Weak correlation | No correlation | No correlation | Weak non-monotonic negative correlation | Not influenced by greenhouse vent opening. The network could implicitly consider it a reference for the difference between inside and outside climate. | Eliminated | |
Weak negative linear correlation | Weak negative correlation when | Monotonic negative nonlinear correlation | Not influenced by greenhouse vent opening. The network could implicitly consider it a reference for the difference between inside and outside climate. | Eliminated | ||
Significant positive linear correlation | Moderate positive correlation when | Monotonic positive nonlinear correlation | Not influenced by greenhouse vent opening. Considered as a reference for the diurnal and nocturnal periods, knowing that vents are mostly closed at night. | Selected | ||
Moderate positive linear correlation | Moderate positive linear correlation | Moderate positive linear correlation | Monotonic positive linear correlation | Not influenced by greenhouse vent opening. . | Eliminated | |
Weak correlation | Weak correlation when | Weak correlation | Weak correlationAssociated non-monotonic variations | Not influenced by greenhouse vent opening. The network could consider its effect on the ventilation rate, in turn, on the greenhouse air variables implicitly throught vent opening. | Selected | |
Weak negativelinear correlation | Weak positive correlation when | Non-monotonic nonlinear correlation when | Rapidly influenced by vent opening. . | Selected | ||
Moderate negative correlation when | Negative monotonic nonlinear correlation | Rapidly influenced by vent opening. . | Selected | |||
Moderate positive linear correlation | Moderate positive correlation when | Non-monotonic nonlinear correlation | Influenced by vent opening. . | Selected | ||
Moderate negative linear correlation | Weak negative correlation when | Non-monotonic nonlinear correlation | Rapidly influenced by vent opening. . | Selected | ||
Moderate negative linear correlation | Moderate negative correlation when | Monotonic nonlinear correlation | Rapidly influenced by vent opening. . | Selected | ||
Moderate positive linear correlation | Weak positive correlation when | Non-monotonic nonlinear correlation | Influenced by vent opening. . | Selected |
All the Available Inputs | Eliminating Only | Eliminating , and | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
(%) | (%) | (%) | (%) | (%) | (%) | (%) | (%) | (%) | ||||
Architecture A (LSTM-ANN) | 0.77 | 9.8 | 3.94 | 77.66 | 0.74 | 10.04 | 4.04 | 99.03 | 0.77 | 9.64 | 5.33 | 65.76 |
Architecture B (LSTM-RNN) | 0.61 | 12.76 | 5.98 | 93.05 | 0.75 | 10.32 | 5.43 | 63.42 | 0.8 | 9.13 | 4.45 | 62.94 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Guesbaya, M.; García-Mañas, F.; Rodríguez, F.; Megherbi, H. A Soft Sensor to Estimate the Opening of Greenhouse Vents Based on an LSTM-RNN Neural Network. Sensors 2023, 23, 1250. https://doi.org/10.3390/s23031250
Guesbaya M, García-Mañas F, Rodríguez F, Megherbi H. A Soft Sensor to Estimate the Opening of Greenhouse Vents Based on an LSTM-RNN Neural Network. Sensors. 2023; 23(3):1250. https://doi.org/10.3390/s23031250
Chicago/Turabian StyleGuesbaya, Mounir, Francisco García-Mañas, Francisco Rodríguez, and Hassina Megherbi. 2023. "A Soft Sensor to Estimate the Opening of Greenhouse Vents Based on an LSTM-RNN Neural Network" Sensors 23, no. 3: 1250. https://doi.org/10.3390/s23031250
APA StyleGuesbaya, M., García-Mañas, F., Rodríguez, F., & Megherbi, H. (2023). A Soft Sensor to Estimate the Opening of Greenhouse Vents Based on an LSTM-RNN Neural Network. Sensors, 23(3), 1250. https://doi.org/10.3390/s23031250