Greenhouse automation and control
5.3 CONTROL IMPLEMENTATION
5.3.1 Portable greenhouse results
For validating the intelligent control system, all fuzzy and neural network con-trollers, the relative humidity time-table controller, and the look-up table nutriments
Figure 5.24 Five bell membership functions for input signals and LabVIEW program.
Figure 5.25 Seven triangular membership functions for output signal.
supply system were programmed in LabVIEW using the Intelligent Control Toolkit for LabVIEW (ICTL) but a conventional VI program from LAbVIEW could be used.
Fuzzy control system response
Light Intensity Controller Response. In order to understand the behavior and response of the fuzzy-PD controller for light intensity, five different membership function config-urations at fuzzification and defuzzification blocks in fuzzy controllers were developed.
In the first configuration, five bell membership functions for error and change in error inputs were designed. These fuzzy labels are: negative (N), zero (Z), low positive (LP), medium positive (MP), and high positive (HP). Figure 5.24 depicted these functions. Seven triangular output membership functions (Figure 5.25) were used for obtaining the crisp duty cycle value for lamps: high negative (HN), medium
Figure 5.26 Step response of the 5-bell MF’s of the fuzzy-PD controller.
Figure 5.27 Quadratic error plot for the step response of the 5-bell MF’s of the fuzzy-PD controller.
negative (MN), low negative (LN), zero (Z), low positive (LP), medium positive (MP), and high positive (HP). The step response of this fuzzy-PD is shown in Figure 5.26 with a set-point of 5,000 Lux. A quadratic error analysis is done for this response in which three picks were found as seen in Table 5.4. Those picks correspond to instants when the controller failed (Figure 5.27).
In the second configuration, five triangular membership functions for error and change in error inputs were designed. The same fuzzy sets as previously are: negative (N), zero (Z), low positive (LP), medium positive (MP), and high positive (HP). Fig-ure 5.28 draws these triangular functions. The same output membership functions were used (Figure 5.25). In the same way, this fuzzy controller is excited with a step signal.
Current response is shown in Figure 5.29 with a set-point of 5,000 Lux. A quadratic error analysis found two picks as seen in Table 5.4. Figure 5.30 shows the quadratic error analysis.
The third configuration corresponds to a seven bell membership functions for error and change in error inputs. Actually, seven fuzzy sets were designed (Figure 5.31).
These are: low negative (LN), medium negative (MN), high negative (HN), zero (Z),
Figure 5.28 Five triangular membership functions for input signals.
Figure 5.29 Step response of the 5-triangular MF’s of the fuzzy-PD controller.
Table 5.4 Quadratic Error Analysis on Interesting Variables.
Configuration Time [s] Light [Lux] Error∗[Lux] Error2
5-bell MF’s 136 5,661 661 436,921
202 4,354 646 417,316
217.5 4,268 732 535,824
231.5 4,240 760 577,600
234 4,240 760 577,600
5-triangular MF’s 80 5,514 514 264,196
154 5,544 544 292,936
186.5 4,468 532 283,024
205 5,749 749 561,001
232 4,497 503 253,009
7-bell MF’s 60 5,457 457 208,849
67.5 5,471 471 221,841
114.5 5,441 441 194,481
176 5,368 368 135,424
226.5 4,572 428 183,184
7-triangular MF’s 101 4,468 532 283,024
139 4,583 417 173,889
157 4,612 388 150,544
211 4,583 417 173,889
228 4,354 646 417,316
7-singleton MF’s 67 4,612 388 150,544
87 5,309 309 95,481
∗Considering a set-point of 5,000 Lux
Figure 5.30 Quadratic error plot for the step response of the 5-triangular MF’s of the fuzzy-PD controller.
low positive (LP), medium positive (MP), and high positive (HP). Five triangular output membership functions were used as seen in Figure 5.32. They are: nothing (N), few (F), medium (Me), high (H), and maximum (Ma) The step response of this fuzzy-PD is shown in Figure 5.33 with a set-point of 5,000 Lux. A quadratic error analysis is done for this response and results are found in Figure 5.34.
Figure 5.31 Seven bell membership functions for input signals.
Figure 5.32 Five triangular membership functions for output signal.
Figure 5.33 Step response of the 7-bell MF’s of the fuzzy-PD controller.
Figure 5.34 Quadratic error plot for the step response of the 7-bell MF’s of the fuzzy-PD controller.
In the fourth configuration, seven triangular membership functions for error and change in error inputs were tuned (Figure 5.35). The output membership functions are the same as in the first case (Figure 5.25). The step response of this fuzzy-PD is depicted in Figure 5.36. Additionally, a quadratic error analysis is done (Figure 5.37).
Finally, the output membership functions were exchanged with seven sin-gleton membership functions for the lamp duty cycle output, see Figure 5.38.
As expected, the step response in not too accurate (Figure 5.39). Again, the quadratic error analysis is done and is shown in Figure 5.40. Finally, Figure 5.41 shows the comparison between responses of the different fuzzy-PD configurations implemented.
Temperature Controller Response. Also, different tests were done for fuzzy-PD temperature controllers. In the first case, it uses five input bell membership functions as seen in Figure 5.42. Fuzzy sets are: negative (N), zero (Z), low positive (LP), medium
Figure 5.36 Step response of the 7-triangular MF’s of the fuzzy-PD controller.
Figure 5.37 Quadratic error plot for the step response of the 7-triangular MF’s of the fuzzy-PD controller.
Figure 5.38 Seven singleton membership functions for output signal.
Figure 5.39 Step response of the 7-triangular input MF’s and 7-singleton output MF’s of the fuzzy-PD controller.
Figure 5.40 Quadratic error plot for the step response of the 7-triangular input MF’s and 7-singleton output MF’s of the fuzzy-PD controller.
Figure 5.41 Comparison between the five fuzzy-PD configurations for the light intensity controller.
Figure 5.42 Seven triangular membership functions for input signals.
positive (MP), and high positive (HP). However, two outputs are related. Five trian-gular membership functions represent the heating resistance’s duty cycle output, and three triangular membership functions represent the fan speed (duty cycle output).
Figure 5.43 shows these fuzzy sets in which, for resistance output are nothing, few, little, medium, and high; and for fan velocities are low, medium, and high.
In order to emulate the internal temperature behavior, a ramp response for the fuzzy-PD controller is obtained as seen in Figure 5.44. A quadratic error analysis is done. It can be seen from the quadratic error plot (Figure 5.45) that during the rising time the error is very significant from zero to around the 400 seconds when the controller had several perturbances in its action. Table 5.5 shows these statistics.
During the falling time, the error decreased in comparison with the rising time, at the end of the test the error reached almost 0.56◦C. In this case overshooting is presented, with the maximum 1.2◦C upper, in the steady state set-point. It follows from the fact that the greenhouse is thermally isolated and losses in energy are rather lower.
In the second case, it uses five input triangular membership functions as seen in Figure 5.46. Fuzzy sets are: negative (N), zero (Z), low positive (LP), medium positive (MP), and high positive (HP). The same output membership functions were
Figure 5.43 Triangular membership functions for output signals.
Figure 5.44 Ramp response of the 5-bell MF’s fuzzy-PD temperature controller.
Figure 5.45 Quadratic error plot for the ramp response of the 5-bell fuzzy-PD temperature controller.
Table 5.5 Quadratic Error Analysis on Interesting Picks.
Time Temperature Error
Configuration [s] [◦C] [◦C] Error2
5-bell MF’s 60 18.984 3.04 9.22
102 20.451 1.89 3.58
2512 25.216 2.60 6.74
5-triangular MF’s 102 22.344 1.40 1.96
656 24.205 0.97 0.94
956 25.015 1.14 1.31
7-bell MF’s 400 23.346 2.24 5.01
2688 22.027 2.39 5.72
7-triangular MF’s 280 22.940 0.19 0.04
466 23.566 1.18 1.39
548 23.842 1.11 1.22
1950 24.511 0.81 0.65
Figure 5.46 Five triangular membership functions for input signals.
used (Figure 5.45). The response of a ramp is shown in Figure 5.47 and the quadratic error analysis is shown in Figure 5.48. Interesting points in the analysis are shown in Table 5.5. In this case, the response is undesirable because the plant cannot track the reference at any point.
The third configuration consisted of using seven input bell membership functions as shown in Figure 5.49 in which fuzzy sets are: high negative (HN), medium negative (MN), low negative (LN), zero (Z), low positive (LP), medium positive (MP), and high positive (HP). The same output membership functions were used (Figure 5.45). The response of a ramp is shown in Figure 5.50 and the quadratic error analysis is shown in Figure 5.51. Table 5.5 resumes this analysis. As seen in the response, the plant with the controller cannot track the reference in the rising and falling range time. In addition, in the steady state set-point, it has an overshooting of 0.4◦C.
The last configuration is done using seven triangular membership functions for the inputs. In this case, the fuzzy sets are: high negative (HN), medium negative (MN), low negative (LN), zero (Z), low positive (LP), medium positive (MP), and high positive
Figure 5.48 Quadratic error plot for the ramp response of the 5-triangular fuzzy-PD temperature controller.
Figure 5.49 Seven bell membership functions for input signals.
Figure 5.50 Ramp response of the 7-bell MF’s fuzzy-PD temperature controller.
Figure 5.51 Quadratic error plot for the ramp response of the 7-bell fuzzy-PD temperature controller.
(HP). They can be seen in Figure 5.52. In addition, the response of this configuration is shown in Figure 5.53 and the quadratic error analysis is depicted in Figure 5.54.
Interesting variables in the quadratic error analysis are summarized in Table 5.5.
As seen, this configuration has the best performance and quadratic error is in 1◦C range.
As can be seen, four configurations were depicted. Comparison between these responses is shown in Figure 5.55. In fact, the better response is found when seven triangular membership functions for inputs were used.
Dynamical neural network control system response
Two dynamical neural network controllers were developed for regulating temperature, and light intensity conditions inside the greenhouse.
For each controller, two models were depicted. In this way, the first modeling contemplates signal corrections as inputs and real sensed variables as outputs.
17,500 historical data points were obtained from the greenhouse prototype when random control signals were fired. Each sample is picked up every two seconds.
Figure 5.52 Seven triangular membership functions for input signals.
Figure 5.53 Ramp response of the 7-triangular MF’s fuzzy-PD temperature controller.
Figure 5.54 Quadratic error plot for the ramp response of the 7-triangular fuzzy-PD temperature controller.
Figure 5.55 Comparison between the four fuzzy-PD configurations for the temperature controller.
Additionally, all sensed signals as temperature, relative humidity, and light intensity were registered, too.
In Figure 5.56 is seen the model of the plant with inputs: resistance duty cycle, fan duty cycle, water pump activation signal, and humidifier activation signal. Also, as output is temperature. This neural network was trained with a backpropagation algorithm with a learning rate of 0.03 and momentum parameter of 0.001, two delays in inputs and two delays in the output were asked, with 50 neurons in the hidden neuron. The total epochs for training were 9,880 taking into account 200 samples per batch. Additionally, the model of the inverse plant (the controller) was obtained in the same manner but using inputs as outputs, and vice versa. The response of the controller is shown in Figure 5.57, where temperature is related. In addition, a quadratic error analysis was performed (Figure 5.58).
In the same way, the model of the plant taking into account the light intensity was done with lamp duty cycle as input and light intensity as output (Figure 5.59).
Two delays at inputs and two at outputs were asked, with 50 neurons in the hidden
Figure 5.56 Temperature neural network model plant.
Figure 5.57 Response of the temperature controller.
Figure 5.58 Quadratic error plot for the ramp response of the temperature neural network controller.
Figure 5.59 Light intensity neural network model plant.
Figure 5.60 Response of the light intensity controller.
neuron. A backpropagation algorithm with learning rate 0.01 and momentum param-eter 0.001 were used. Additionally, a sigmoid activation function was used in every model. Furthermore, 200 samples per batch were used for this training. 10,000 epochs were required to find a 0.015 of maximum error between the historical data and the neural network modeling. In the same way, the inverse plant for control the light inten-sity condition was done with inputs as outputs, and vice versa. In Figure 5.60 is shown the response of the light intensity value. 88,000 historical data points were registered.
As seen, set-point is reached with high accuracy, no error is found in the step response except for the rising time. Figure 5.61 shows the quadratic error analysis.
Relative humidity controller response
This controller was developed for maintaining a relative humidity between 50%RH and 70%RH. This bandwidth was selected because the major varieties of plants that can be grown in greenhouses need a relative humidity variation similar to 50–70%RH.
Figure 5.61 Quadratic error plot for the step response of the light intensity neural network controller.
Figure 5.62 Response of the relative humidity on/off controller.
Figure 5.62 shows the response of the on/off controller. Actually, because LabVIEW simulation and validation are optimized, bandwidth can also be changed for others, if needed.
Taking into account the previous analysis done with fuzzy logic and neural network techniques, controllers for light intensity and temperature have some advantages. First, these techniques can handle high nonlinearities in the greenhouse in which several conditions are participating and cannot be decoupled. Second, expert systems, as fuzzy logic, depend on how well the behavior is understood and the experience of the engineer designer. As seen, the number of membership functions, their shapes and their locations in the universe of discussion are related in the response. In contrast, neural network models depend on the experimental data affecting directly through the system (the greenhouse exposed to the environmental variables).
The following can be observed: if experience is needed, fuzzy systems are better for controlling systems. In terms of knowing how the response is acting depending on several variables, fuzzy controllers are well determined. However, if the number of variables increases, rules grow exponentially, making them intractable. On the other hand, neural networks are better for making a generalization of systems (the control system do not depend on specific environment or geographical situation) and then these controllers can be used in any place, with the condition of monitoring before using them. Actually, an algorithm is needed for modeling the behavior of the greenhouse.
Then, the neural control can be effectively used.
One advantage of neural networks is that the model can be adapted for the current environmental states and adjust its parameters (weights) for a better response. In com-parison with fuzzy controllers where membership functions are tuned for some specific set points, neural networks can be generalized and adapt to other circumstances.
5.4 CONSTITUENTS OF CONTROLLED ENVIRONMENT FOR