3.2. IndoorPlant Architecture
IndoorPlant utilizes the Unified Modeling Language (UML) with additional definitions proposed in the technical architecture modeling standardization [
32] to create the model architecture.
Figure 1 presents the architecture composed of actors (A1, A2, A3) and their accesses, and the blocks (Mobile Assistant and its components; Greenhouse Controller and its components; IndoorServer with its modules; and the Database with its bases). The communication channels are shown by the symbols C1, C2, and C3. The components appear inside the Mobile Assistant (interface, control, and services) and Greenhouse Controller (control and services) blocks and allow the actors (A1 and A2) to interact with the IndoorServer. IndoorPlant organizes the information to obtain the data generated by the three actors, and after processing the data, it provides some contextual information according to the request made. For this, IndoorPlant includes four blocks: the server called IndoorServer, the Mobile Assistant, the Greenhouse Controller, and the Databases.
The Mobile Assistant receives the actions of the mobile client (A1) through the communication channel (C1) and communicates with the server using web services, using RESTful methods to demonstrate the cultivation conditions within each greenhouse. The IndoorServer module responsible for communicating with this assistant is the Telegram bot module, created to facilitate understanding and handling by most farmers because it is in text form.
The Greenhouse Controller communicates with the server through the Message Queuing Telemetry Transport (MQTT) protocol, created specifically for use in sensors and devices in the IoT, and it also has communication methods for sending and receiving updates and new parameters. The Greenhouse Controller also collects greenhouse and greenhouse cultivation data and sends it to the IndoorServer. The controller itself acts on aspects such as maintaining the level of the reservoirs and irrigating at specific times. This crop information is processed by the context similarity module on the IndoorServer and later sent to the database called Historical Database of Contexts. The context similarity module processes information and inserts markings into the context histories as it is processed. For managing the context histories, the information is stored as presented in
Table 2.
The IndoorServer component communicates with the other components through internal channels and with the External Data actor (A3), through channel C3. The IndoorServer includes mechanisms for treatment, analysis of similarity, and prediction of data regarding conditions in greenhouses. This analysis and a possible suggestion of improvements in the greenhouse parameters occur according to the information that the Greenhouse Controller passes to the server.
Within the IndoorServer, the context similarity module is responsible for processing and saving the data in its database. The function of the similarity module is to generate the user’s database by analyzing the received context histories. With this analysis, the similarity module generates a base that does not contain a history of repeated contexts and it is saved in sequence. The module compares the data received in the last receipt with the data received in the last context update, and with that, it can determine whether the data are similar or not. The data received in the last update will only be added to the database if they are not like the context of the last update.
The context similarity module processes the received data and through its rule, it always obtains a value between (0, 1) as a response; this response is the similarity score. According to Cha [
33], the similarity score or similarity coefficient is the value that expresses the distance between two objects. If the answer is a value close to 0, it shows that the data received are different from the previous data, and if the answer is close to 1 it indicates that the data are similar or identical to the previous data. Along with this rule, there is a configuration that considers that if the calculated values are greater than or equal to 0.8, the contexts are similar. Among the most used distance measurements, Euclidean and Manhattan distances can be mentioned.
The peripherals that IndoorPlant uses in the Greenhouse Controller are a GSM/GPRS module (SIM900) to send information and alerts to users, a Wi-Fi module (ESP8266) to communicate with the server without using cables, an Ethernet module (ENC28J60) to communicate with the server via cables, cameras to photograph and to be able to analyze the plantation with an image processing algorithm, and a display to show information on the cultivation in place. Activations that the model can perform are: reset the level of the circulation tanks, irrigate at scheduled times, turn on the circulation pump, turn on/off lighting, open/close the shade, turn on/off the hoods, increase or decrease the number of inputs for the plants, turn on the sprinklers, and turn on refrigeration of the nutrient solution.
In addition to these suggestions for improvements, IndoorPlant has a prediction module that aims to predict production for the month based on its history of contexts, and to predict alerts before the memos are triggered by the greenhouse control system. The model does not support only these two prediction services; IndoorPlant can accept other prediction services and uses data external to the model. These external data are shown in
Figure 1 as actor 3 (A3). IndoorPlant can also compare the actual production for the month, calculate what the maximum production would be according to the existing data, and inform the farmer via an application if there is any control error in the greenhouse, among other services.
This diversity in predictions occurs due to the variables provided in the context histories and the equivalent results they generate. The results that the prediction provides must have the same meaning/objective as the data provided previously. That is, if IndoorPlant receives context histories with eight variables and one variable is the quantity of strawberries harvested, the other seven variables are related to the number of strawberries harvested. IndoorPlant will also predict the number of strawberries that it will be possible to harvest with the current context of planting, if it has the same information as previously passed on. IndoorPlant cannot predict the productivity of a greenhouse if previous context histories do not have the previous information for how many strawberries were harvested.
The Profile module is responsible for creating a profile for each actor or greenhouse that is part of IndoorPlant. Every time the module receives data from a profile, it interprets the data and makes a comparison between the data already existing in the database that has the profiles, called the Profiles Base. The comparison that the module makes is to analyze if any profile already saved in the Profiles Base is different to what is being received in real time. The profile module will not add data related to the received profile if they are completely the same.
If any parameter is different and all others are the same, the module already interprets it as a different profile and saves the profile in its database. This is because if the profile is related to the control parameters of a greenhouse and all indices are the same but only the cultivation greenhouse is different, a different greenhouse already has an influence, as plants may not be arranged close to the ground and, with that, suffer the action of solar lighting differently.
IndoorPlant does not have its own forecasting tool. The tool used in the Prediction module for data analysis and cultivation time forecasting is ChemoStat, an online multivariate data analysis tool [
34]. These multivariate data are usually in the form of a multivariate matrix X, where the matrix is composed of m variables for n samples. ChemoStat uses a multiple regression algorithm called partial least squares (PLS) [
35,
36]. PLS considers that its predictors are not fixed, that is, its predictors can be measured with error. Due to this variation, PLS becomes more robust in relation to measurement uncertainty.
As answers to the prediction, IndoorPlant uses the coefficient of determination (R2), square root of the mean square error of calibration (RMSEC), and the square root of the mean square error of cross validation (RMSECV). R2 can vary between 0 and 1, and the closer the R2 value is to 1, the better the agreement between the model and the sample. RMSEC presents the mean quadratic error in relation to the variable being obtained as a result, in the case of IndoorPlant, cultivation days. RMSECV, on the other hand, has the same purpose as RMSEC, but it validates the error by crossing samples, not following a line for elaboration of the error.
IndoorPlant applies the PLS model due to the linear relationship between the data and their interest properties, in addition to the use of more than one variable (pH, EC, temperature of the nutrient solution, air temperature, humidity of the air, and cultivation days). The PLS is applied in chemistry in analysis of food, drug, and fuel, but few works used this model for data correlation between sensors and crop productivity. Helfer et al. [
37] used a time series of weather sensors data and wheat productivity in a PLS model with R
2 = 0.92.
IndoorPlant proposes an ontology for indoor agriculture to manage three aspects: the profile of the people who use the system, the parameters of the greenhouses, and the characteristics of each cultivated species. This ontology is called Agrindoor and was developed using the Protégé tool. An ontology provides standardization of information, assisting in the exchange of messages, in the visualization of terms, and in storage. Ontology manages the domain of the people indicated in the use cases above, greenhouse parameters, reading of sensors, and the technical specifications of plants.
Figure 2 shows the IndoorPlant classes without showing all instances for each class; only some instances of the classes are presented to exemplify its use. In addition to the User class and its subclasses (Technical Manager and Employee), the ontology for the Greenhouse class was also created, which has the capacity to store the greenhouse conditions as data properties. Finally, the Species class ontology was created with the characteristics of the plants also being inserted as data properties.