https://doi.org/10.36253/ijam-3502

Received: May 17, 2025; Accepted: February 10, 2026; Published: September 15, 2026

Development of a Fuzzy Logic Controller for microclimate regulation under an agricultural greenhouse based on a state-space model approach

Abderrazak Kaida1,* , Abderrahman Aitdada1, Youssef El Afou2 , Abdelouahad Ait Msaad1

1 Sidi Mohammed Ben Abdellah University, Higher School of Technology of Fez, Imouzzer Road, Fez, BP 2427, Morocco

2 Sidi Mohamed Ben Abdellah University, National School of Applied Sciences, Imouzzer Road, Fez, BP 30040, Morocco

*Corresponding author. Email: abderrazak.kaida@usmba.ac.ma

Abstract. Greenhouse management is a fundamental aspect of modern agriculture, as it directly affects crop quality, water efficiency, and energy consumption. This study focuses on the regulation of key greenhouse climatic parameters, namely indoor temperature and relative humidity. A dynamic greenhouse model was developed to implement and compare two control strategies: a Fuzzy Logic Controller (FLC) and a Proportional–Integral–Derivative (PID) controller. The main objective of this work is to design a controller capable of simultaneously managing two highly correlated variables by adopting variable setpoints for both temperature and humidity. This approach distinguishes the proposed methodology from previous studies, which typically focused on temperature control while maintaining constant humidity setpoints. In contrast, the proposed strategy regulates both parameters dynamically and concurrently. Simulation results under different operating scenarios show that the FLC outperforms the PID controller in maintaining a favorable greenhouse microclimate. In particular, the FLC achieved reductions of 25.1% in average humidification rate and 29.6% in ventilation rate. Moreover, the total energy consumption associated with the PID controller was approximately 27% higher than that of the FLC. The error analysis between reference setpoints and simulated responses confirms that the dynamic model accurately predicts indoor temperature and relative humidity with minimal deviation. Overall, the results demonstrate the robustness and efficiency of the FLC in ensuring optimal greenhouse climatic conditions while significantly reducing energy consumption.

Keywords: state-space model, Fuzzy Logic Controller, PID controller, humidity, temperature, greenhouse.

Contents

1. Introduction

2. Materials and methods

2.1. Greenhouse model

2.2. The Proportional Integral Derivative (PID)

2.3. Fuzzy Logic Controller

3. Results and discussions

3.1. Results of PID controller

3.2. Results of Fuzzy Logic Controller (FLC) controller

3.3. Comparison between PID controller and Fuzzy Logic Controller (FLC)

4. Conclusion

Acknowledgement

Author contribution

References

1. Introduction

The greenhouse industry is among the fastest-growing sectors in modern agriculture due to its ability to protect crops from adverse external conditions and to enable precise manipulation of the cultivation environment. By creating a controlled microclimate, greenhouses the production of crops that are not feasible in open-field conditions, resulting in higher yields, extended production periods, improved crop quality, and reduced pesticide use. Consequently, greenhouse crops exhibit a significantly higher added value per unit area compared to open-field agriculture (Farvardin et al. 2024; Jeevan Nagendra Kumar et al. 2024).

To fully benefit from these advantages and extend the growing season, it is essential to maintain optimal greenhouse microclimatic conditions (Abbood et al. 2023; Wang et al. 2024). This requires accurate regulation of key climatic parameters through actuators such as heating systems, humidifiers, and ventilation fans (Adrian et al. 2019). In this context, the availability of a dynamic greenhouse model capable of accurately describing the temporal evolution of indoor climate variables is crucial for control design and performance evaluation (Blasco et al. 2007; Guo et al. 2021). Dynamic modeling allows representing the temporal variations of the climatic parameters in the greenhouse (Choab et al. 2019; Shamshiri et al. 2020).

Many agricultural greenhouses are still manually regulated, requiring the grower’s assistance. But some have implemented smart control devices. (EL AFOU et al. 2015; El AFOU et al. 2018) Among the various climatic variables, indoor air temperature and relative humidity are considered the most influential and measurable parameters affecting plant growth (Körner 2015). There are also other important climatic factors such as: evaporation, wind speed, CO2 content, lights(Franklin 2009)(Chand Singh et al. 2018). Temperature plays a fundamental role in plant physiological processes, while relative humidity directly influences transpiration, disease development, and overall plant health (Wahid et al. 2007;(Penfield 2008) ;Lipiec et al. 2013). These two variables are strongly coupled, meaning that variations in one significantly affect the other, which makes their simultaneous regulation challenging(Chen et al. 2023). As a result, the greenhouse climate system is typically modeled as a Multi-Input Multi-Output (MIMO) system (Tao 2014).

Despite the widespread use of conventional control strategies such as Proportional–Integral–Derivative (PID) controllers, their performance is often limited by the nonlinear and coupled nature of greenhouse climate dynamics. Furthermore, PID-based approaches may lead to increased energy consumption, particularly during heating and ventilation processes. To overcome these limitations, advanced control techniques have been proposed, including Fuzzy Logic Controllers (FLCs), which are well suited to handling nonlinear systems and uncertain dynamics while improving energy efficiency (El Ghoumari et al. 2005; Bennis et al. 2008; Márquez-Vera et al. 2016;Yang and Zhang 2024).

Previous studies have primarily focused on temperature control using variable setpoints while maintaining constant relative humidity references(Huang et al. 2024; Riahi et al. 2024). In contrast, the present work proposes a control strategy that simultaneously regulates indoor temperature and relative humidity using variable setpoints for both parameters within a dynamic greenhouse model. The proposed approach is evaluated under different operating scenarios, including seasonal variations and external climatic disturbances, to assess its robustness and energy efficiency.

The main contribution of this study lies in the development and comparative evaluation of a Fuzzy Logic Controller and a PID controller for greenhouse climate control. By adopting variable setpoints for both temperature and relative humidity, the proposed strategy provides a more realistic and adaptive approach to greenhouse microclimate management while aiming to reduce energy consumption and improve overall control performance. The present study introduces variable setpoints for both temperature and relative humidity under diverse climatic scenarios, including:

The proposed model was experimentally validated using real meteorological data collected during two key periods: one corresponding to the spring season and another to the autumn season. The selection of these two seasons is motivated by the strong correlation between temperature and relative humidity, which makes the simultaneous control of these parameters more complex and therefore represents a significant challenge.

In contrast, during the summer season, which is characterized by a sustained increase in temperature, the control strategy mainly focuses on temperature regulation. Similarly, the winter season is marked by high relative humidity levels, allowing the control process to primarily target humidity regulation. Consequently, spring and autumn conditions constitute the most demanding scenarios for evaluating the performance and robustness of the proposed control model.

This article is structured as follows: Section 1 is dedicated to the presentation of the greenhouse model system and the input parameters. Section presents the controls used, which are the dynamic PID controller and the fuzzy logic controllers (FLC): we used 2 blocks of the controllers, one for temperature and the other for humidity. A discussion on the measurement and simulation results as well as the comparison between the two controllers are presented in Section 4. Then, the internal temperature and humidity is simulated using MATLAB software. The perspectives and conclusion are discussed in the last part.

2. Materials and methods

In this study, a physical model of temperature and relative humidity is employed, as it adequately describes the behavior of these variables in a real greenhouse. It is assumed that the air inside the greenhouse is uniformly distributed. Heating, ventilation systems and humidifiers, and other switching devices provide the control inputs. External environmental factors, including sun radiation, relative humidity, and air temperature, are considered as disturbance inputs. The feedback effects of crop growth on temperature are neglected.

2.1. Greenhouse model

Maintaining the greenhouse under optimal operating conditions throughout the different phases of crop growth requires an understanding of the greenhouse microclimate and its characteristics (Bhujel et al. 2020). Since these factors have a major impact on the greenhouse energy and mass balances, accurate estimation of solar radiation, mass transfer coefficients, and heat transfer coefficients is essential for developing a reliable physical model (Choab et al. 2019; Kadirov et al. 2023) (Figure 1).

Figure 1. The interaction between greenhouse components and heat transmission.

In this work, we adopt a dynamic greenhouse model proposed by (Kaida et al. 2024),which considers two kinds of input data:

The expressions of the internal heat balance and internal water balance equations are given in Eq. (1) and Eq. (2), respectively. The resulting model is a multi-input / multi-output (MIMO) system, which can be described as follows:

d T int d t = 1 ρ air ⋅ C air ⋅ V gr ( Q Heater + R - 10 36 λ ⋅ H Hum ) + V v , m V gr ⋅ ( T int - T ext ) - U A ρ air ⋅ C air ⋅ V gr ( T int - T ext ) (1)

d H int d t = 1 ρ air ⋅ V gr H Hum + 1 ρ air ⋅ V gr α λ R + V v , m ρ air ⋅ V gr ( H ext - H int ) - 1 ρ air ⋅ V gr β T ⋅ H int (2)

with:
ρair : Air density [kg.m-3].
Cair: Specific heat capacity of air [J.kg-1. K-1].
Vgr: Greenhouse volume (m3)
Vv,m: Ventilation airflow rate (m3/s).
The variables Text, Hext and R represent disturbances outside the greenhouse which determine the atmospheric influence on Tint and Hint.
QHeater, Vv, m and HHum: are commands for the heater, ventilation, and humidifying system respectively.
Tint: The output of indoor temperature
Hint: The output of indoor relative humidity.

Modern control theory of dynamical systems relies heavily on the concept of state and its associated state-space representation. For nonlinear systems, this representation is commonly expressed in the form of Eq. (3) (Fliess et al. 2004). Accordingly, the proposed greenhouse model can be described by the following system of equations :

{ X ˙ = f ( X ) + ∑ i = 1 m g i ( X ) ⋅ U i y = h ( X ) (3)

with:
X € Rn : state vector, U € Rm : controls inputs, y € Rp : outputs

After identifying the state, input, disturbance, and output variables, the greenhouse climate can be described by a nonlinear, strongly coupled state-space model. The indoor air temperature and relative humidity are selected as the state variables and are denoted by the dynamic states X1(t) and X2(t), respectively. For summer operating conditions, the heating power is set to zero ( QHeater = 0 ). Consequently , the control inputs of the system are defined as the ventilation rate and the humidity generation rate provided by the fogging system, denoted by U1(t) and U2(t), respectively. The external disturbances acting on the greenhouse are the solar radiation heat transfer rate Vl(t), the outside air temperature V2(t), and the outside relative humidity V3 (t). All state variables, control inputs and disturbances are summarized as follows:

X = [ X 1 X 2 ] = [ T i n t H i n t ]

U = [ U 1 U 2 ] = [ V v , m H H u m ]

V= [ V 1 V 2 V 3 ] = [ R T e x t H e x t ]

So, we can express Eq. (1) and Eq. (2) in the following form:

d X 1 d t = 1 ρ air ⋅ C air ⋅ V gr ( V 1 - 10 36 λ ⋅ U 2 ) + U 1 V gr ⋅ ( X 1 - V 2 ) - U A ρ air ⋅ C air ⋅ V gr ( X 1 - V 2 ) (4)

d X 2 d t = 1 𝜌 a i r . V g r U 2 + 𝛼 𝜌 a i r . V g r . 𝜆 V 1 + U 1 𝜌 a i r . V g r ( V 3 − X 2 ) − 𝛽 T 𝜌 a i r . V g r X 2 (5)

We based on these two Eq. (4) and Eq. (5) for writing the state representation of our system in the form of Eq. (3) and we obtained the following result:

[ X 1 . X 2 . ] = [ f 1 ( X , V ⁡ ) f 2 ( X , V ⁡ ) ] + 1 𝜌 a i r . V g r ( ( X 1 ⁡ − V 2 ) 𝜌 a i r − 10 𝜆 36 C a i r ( V 3 ⁡ − X 2 ) 1 ) [ U 1 U 2 ] (6)

with:

f 1 ( X , V ) = - U A ρ air ⋅ C air ⋅ V gr X 1 + 1 ρ air ⋅ C air ⋅ V gr V 1 + U A ρ air ⋅ C air ⋅ V gr V 2

and

f 2 ( X , V ) = - β T ρ air ⋅ V gr X 2 + α ρ air ⋅ V gr ⋅ λ V 1

Our greenhouse has a volume of Vgr = 4000 m3 (20 x 20 x10) and the cover reduces the sunshine by 60%, the heat transfer coefficient UA = 25 kW.K-1, and the air density ρair =1.2 Kg.m- 3 with specific heat Cair = 1006 j .Kg-1.K-1. These inputs parameters are summarized in the following Table 1. (Kaida et al. 2024).

Table 1. The values of the inputs that were employed in the simulation.
Symbol Numerical value Units Description
UA 25000 W.K-1 The coefficient of heat transfer of the cover
Vgr 4000 m-3 Volume of the greenhouse
ρ 1.2 Kg.m-3 Density of internal air
Cair 1006 J. Kg -1. K-1 Specific heat of air
R 700 W The heat produced by the Solar radiation

A number of plants generate heat; their temperature can exceed 40°C above that of the surrounding air. Consequently, at thermal equilibrium, the heat generated by plants is often ignored in relation to the heating system generator and within a large greenhouse. (Lamprecht et al.).

2.2. The Proportional Integral Derivative (PID)

The Proportional Integral Derivative (PID) is a control mechanism used to perform closed-loop regulation of an industrial system. It is the most widely used regulator in the industry and allows for the control of a large number of processes. The observed error is the difference between the setpoint and the measurement. The PID controller allows for three actions based on this error:

  1. 1.Proportional: the error is multiplied by a gain G.
  2. 2.Integral: the error is integrated over a time interval ss and then divided by a gain Ti.
  3. 3.Derivative: the error is differentiated with respect to time ss and then multiplied by a gain Td.

There are several possible architectures to combine these three effects (series, parallel, or mixed).

Tuning a PID controller involves determining the parameters G, Td and Ti in order to achieve a satisfactory control and regulation performance(Paolino et al. 2024). The main objectives are robustness, fast dynamic response,and high accuracy. To meet these requirements, overshoot(s) must be minimized (Schiavo et al. 2021).

For the summer operation, ( QHeater =0) the greenhouse model has two control inputs: ventilation and humidification system. Two PID controllers are employed, one for indoor air temperature control and one for relative humidity regulation. The overall control architecture is implemented in MATLAB/Simulink and illustrated in Fig. 2.

Figure 2. Greenhouse model controlled by a Proportional Integral Derivative (PID) controller.

The coefficients G, Td et Ti of the PID controller of the indoor relative humidity and indoor temperature are given in Table 2.

Table 2. Coefficients of Proportional Integral Derivative (PID) controllers used in the two blocks
Coefficients of PID controllers Indoor temperature Indoor relative humidity
Proportional (G) 0.0567 338.775
Integral (Ti) 0.0002 9.435
Derivative (Td) 1.6660 1163.453

2.3. Fuzzy Logic Controller

A Fuzzy Logic Controller (FLC) is a control system that mimics human reasoning by using fuzzy rules instead of precise mathematical formulas. It is particularly useful for managing complex systems where it is difficult to establish precise equations. A fuzzy controller is composed of three blocks: fuzzification, inference, and defuzzification as shown in Fig. 3.

Figure 3. Operation of a fuzzy controller.

› Fuzzification: transforming real input variables into fuzzy variables (also called linguistic variables).

› Fuzzy inference: constructing rules (and results) based on linguistic variables, assigning a truth value to each rule, and then aggregating the rules to obtain a single (linguistic) result to decide the action to take.

› Defuzzification: transforming the fuzzy output into a precise value usable by the system. For the defuzzification method, we used the Center of Gravity (CoG), also known as the centroid method. This method calculates the center of the area under the curve of the fuzzy set. It is widely used due to its accuracy and simplicity.

Using the MATLAB/Simulink environment, a dynamic greenhouse microclimate model controlled by a Fuzzy Logic Controller (FLC) was developed, as shown in Fig. 4.

Figure 4. greenhouse model controlled by the Fuzzy Logic Controller (FLC).

The Fuzzy Logic Controller (FLC) is initialized using the membership functions associated with air temperature.

The fuzzy rules governing the indoor temperature fuzzy controller are showing in Table 3.

Table 3. The base fuzzy rules of the temperature control
Temperature_Error Heater rate Ventilation rate
NB NA LA
NM NA SA
Z NA NA
PM SA NA
PB LA NA

The input variable of the air temperature fuzzy controller is the Temperature_Error ΔT, where:

ΔT= Tsetpoint −Tint

where:
PB: Positive Big.
PM: Positive Medium.
Z: Zero.
NM: Negative Medium.
NB: Negative Big.
The output variables are the ventilation and the heating rate, where:
NA: No Action.
SA: Short Action.
LA: Long Action

To achieve the desired indoor air temperature, a set of temperature-based fuzzy rules has been defined. When the indoor temperature exceeds the reference value, a ventilation system is activated to reduce it. Conversely, when the temperature is below the desired level, a heating system is used to increase it. Figure 5 shows the membership functions of the input variable, namely the temperature error.

Figure 5. Membership function of the temperature error.

The membership functions of the output variables, the heating rate and the ventilation, respectively, are plotted in Figure 6.

Figure 6. Membership functions of the heating rate and the ventilation.

In order to achieve the required interior relative humidity, the same method was used. Table 4 presents the fuzzy rules for relative humidity control.

Table 4. Fuzzy rules base of the relative humidity control.
ΔH Hext
VL L M H VH
NB NA SA SA LA LA
NM NA NA LA LA LA
Z SA NA NA NA LA
PM SA SA NA NA NA
PB SA SA SA NA NA

The input variables of the indoor relative humidity fuzzy controller are the Humidity_Error ΔH, and outside relative humidity Hext, where:

ΔH = Hsetpoint − Hint

VH: Very High.
H: High.
M: Medium.
L: Low.
VL: Very Low.

The membership functions of the input variables, which are the humidity error and the outside relative humidity, are plotted in Fig. 7.

Figure 7. The membership function of the humidity error and outside relative humidity.

The membership functions of the output variable, the humidifying rate is shown in Fig. 8.

Figure 8. Membership functions of the humidifying rate.

3. Results and discussions

The simulation utilized two weather databases of real greenhouse. The first weather database covers four days during the spring season (April) with a sampling interval of 5 seconds, while the second spans one week during the autumn season (September). These weather databases include the recorded outdoor temperature and relative humidity values corresponding to each season.

3.1. Results of PID controller

Based on the measurements and the simulation results obtained using the equation model Eq. (4) and Eq. (5), the simulated air temperature without the PID controller is presented in Fig. 9. The graph on the left corresponds to the spring season, while the one on the right represents the autumn season. It was observed that the indoor temperature varies according to the outdoor meteorological conditions, indicating that the internal climate is not always optimal for crop growth.

Figure 9. The results simulation of the indoor temperature without control.

The difference between the outdoor and indoor temperature is mainly due to the greenhouse cover; however, this difference alone is not sufficient to ensure optimal plant production. In addition, the need to minimize disturbances motivated the adoption of advanced techniques to monitor the system. For this reason, actuators for the heating and ventilation systems are implemented and managed by an effective controller block, such as a PID controller, in order to achieve the desired indoor climate. Fig. 10 presents the simulation result.

Figure 10. The simulation results of the air temperature with the PID controller.

A daytime setpoint of 28 °C and a nighttime setpoint of 18 °C were selected, as most plants exhibit optimal growth within a temperature range of 17 °C to 27 °C (Li et al. 2018).

To further evaluate the robustness and adaptability of the controller under diverse climatic scenarios, an additional setpoint configuration of 32 °C during the day and 22 °C at night was used, incorporating realistic atmospheric variations during another season (autumn) over an extended simulation period (one week).

The temperature error, calculated as ΔT = Tsetpoint – Tsimulated, was found to be ΔT = 1.631 °C between the setpoint and simulated values. The simulated temperature values effectively followed the reference setpoints, with a slight overshoot of approximately 3 °C, which remains within acceptable limits and does not adversely affect crop growth.

The evolution of relative humidity without any control is illustrated in Fig. 11, while the simulation results with a PID controller are presented in Fig. 12.

Figure 11. The progression without control of the indoor and outdoor relative humidity.
Figure 12. Evolution with PID controller of the indoor relative humidity.

The indoor relative humidity changes in accordance with the external environment; however, the resulting internal climate is not always favorable. During the night, both indoor and outdoor humidity levels increase, reaching peak values of approximately 85%, thereafter declining during the day to a minimum value. To regulate the indoor relative humidity at the appropriate set point, a PID controller is employed to manage the operation of the humidification actuator. The results of the simulation are presented in Figure 12.

The relative humidity setpoint was defined as 40% during the night and 60% during the day for both seasons. The humidification system successfully maintained the indoor relative humidity close to the reference values, with an error of ΔH = Hsetpoint – Hsimulated = 0.1982% and a slight overshoot of approximately 3%, which has no significant impact on crop growth (Figure 13).

Figure 13. Boxplots of the simulated temperature and relative humidity distributions with PID controller.

For temperature, the median values in autumn (27.97 °C) and spring (27.20 °C) are very close, indicating consistent central behavior across both transitional seasons. The interquartile range is slightly larger in autumn (7.16 °C) than in spring (6.67 °C), reflecting higher variability during autumn due to more pronounced fluctuations in external climatic conditions. For relative humidity the median value is 58.32 %.

Table 5 summarizes the distributional characteristics of the simulated temperature and relative humidity using boxplot statistical indicators.

Table 5. Statistical summary of the simulated temperature and relative humidity distributions with PID controller.
Boxplot Statistical Indicators Temperature (°C ) Relative Humidity (%)
Simulation results in autumn Simulation results in spring
MIN 10.170 10.633 5.000
Q1 23.425 22.915 40.000
Q2 27.972 27.200 58.322
Q3 30.583 29.571 59.999
MAX 37.363 37.210 63.071
IQR 7.1581 6.665 19.999
Upper Limit 41.321 39.554 89.999
Lower Limit 12.688 12.931 10.000

The calculated upper and lower limits indicate that most simulated temperature values lie well within the non-outlier range, with only occasional extreme values occurring during periods of rapid environmental change. For relative humidity, a wider interquartile range (19.99%) is observed, highlighting stronger variability compared to temperature. This behavior is expected due to the sensitivity of humidity to both temperature variations and ventilation dynamics.

Overall, this distribution-based analysis confirms that the proposed model maintains stable median behavior while appropriately capturing seasonal variability and rare extreme events. Such results demonstrate the robustness of the simulation beyond mean error metrics and provide a more comprehensive understanding of model performance under real operating conditions.

3.2. Results of Fuzzy Logic Controller (FLC) controller

The results of simulation without FLC of the indoor air temperature are presented in Fig. 9. The indoor air temperature varies depending on the outdoor conditions, which makes the indoor climate unfavorable for the plant. For this reason, we need to install actuators for the heating and ventilation system, which are controlled by a smart controller such as the Fuzzy Logic Controller (FLC), in order to achieve the desired indoor climate. Fig. 14 gives the results of the simulation.

Figure 14. The evolution of the indoor air temperature with Fuzzy Logic Controller (FLC).

A temperature setpoint of 28 °C during the day and 18 °C at night was selected. During the spring season, the indoor air temperature fluctuated around 18 °C (nighttime setpoint) due to the heating system, while it reached approximately 28 °C during the day under the effect of the ventilation system. For the autumn season, a temperature setpoint of 32 °C during the day and 22 °C at night was applied, and the simulation was repeated as shown in the right-hand graph of Fig. 14. The calculated error between the setpoint and simulated temperature values was ΔT = Tsetpoint – Tsimulated = 1.051 °C, confirming the model’s accuracy.

The simulation results of the indoor relative humidity without control are illustrated in Fig. 11, whereas the results with the Fuzzy Logic Controller (FLC) are presented in Fig. 15.

Figure 15. The evolution representation of the indoor relative humidity with Fuzzy Logic Controller (FLC).

The simulation results indicate that, without the Fuzzy Logic Controller (FLC), both indoor and outdoor relative humidity reach their maximum values of approximately 85% during the night, and decrease to their minimum levels during the daytime. However, to maintain the indoor relative humidity at the desired setpoint, a Fuzzy Logic Controller (FLC) was implemented on the actuator to monitor and control the operation of the humidification system, as illustrated in Fig. 15. The humidity error was then calculated as ΔH = Hsetpoint – Hsimulated, yielding a value of ΔH = 1.005 × 10⁻¹⁵ %, confirming the high precision of the controller.

Figure 16 and Table 6 present a statistical summary of the simulated temperature and relative humidity with FLC controller distributions using boxplot-based indicators. This analysis provides insight into the dispersion, central tendency, and extreme values of the simulated climatic variables, going beyond traditional mean-based performance metrics.

Figure 16. Boxplots of the simulated temperature and relative humidity distributions with FLC controller.
Table 6. Statistical summary of the simulated temperature and relative humidity distributions with FLC controller.
Boxplot Statistical Indicators Temperature (°C) Relative Humidity (%)
MIN 10.555 10.947
Q1 25.102 41.849
Q2 33.152 41.969
Q3 33.500 60.000
MAX 35.427 62.306
IQR 8.397 18.150
Upper Limit 46.096 87.225
Lower Limit 12.505 14.623

The boxplot analysis demonstrates that both temperature and relative humidity exhibit stable median behavior with controlled variability, despite occasional extreme values. The limited number of outliers indicates that extreme climatic deviations are infrequent and mainly occur during rapid weather transitions.

For temperature, the median value (Q2 = 33.15 °C) is positioned closer to the upper quartile (Q3 = 33.50 °C), indicating a slightly right-skewed distribution. The interquartile range (Q3 − Q1 = 8.40 °C) reflects moderate variability, demonstrating that the control system maintains temperature within a relatively narrow operational band under most conditions. The minimum temperature (10.56 °C) and the presence of lower-end outliers indicate occasional cold events, associated with abrupt external temperature drops or transient control delays. Nevertheless, the maximum value (35.43 °C) remains within acceptable operational limits, highlighting the effectiveness of the control strategy in preventing overheating.

In the case of relative humidity, the median value (Q2 = 41.97%) lies closer to the lower quartile (Q1 = 41.85%) than to the upper quartile (Q3 = 60.00%), suggesting a distribution with higher dispersion toward elevated humidity levels. The wider interquartile range (18.15%) compared to temperature confirms that relative humidity is more sensitive to environmental disturbances and ventilation dynamics. The observed minimum value (10.95%) corresponds to dry conditions that may occur during high-temperature periods or increased ventilation, while the maximum value (62.31%) reflects high-humidity events associated with reduced ventilation or external moisture influx.

3.3. Comparison between PID controller and Fuzzy Logic Controller (FLC)

Based on the simulation results, it was observed that the Fuzzy Logic Controller (FLC) provides an effective approach for achieving the desired greenhouse environment, as the simulated signal closely follows the setpoint with higher accuracy and a smaller overshoot. For temperature control, the error obtained with the PID controller (ΔT = 1.631 °C) was higher than that achieved with the FLC (ΔT = 1.051 °C). Similarly, for indoor relative humidity, the error obtained with the FLC (ΔH = 1.005 × 10⁻¹⁵ %) was significantly lower than that observed with the PID controller (ΔH = 0.1982%). Also based on the comparison of the boxplot-based results obtained using the FLC controller and those obtained with the PID controller, the superiority of the FLC approach is clearly demonstrated. The distributions associated with the FLC controller exhibit narrower interquartile ranges, more stable median values, and fewer outliers, indicating improved regulation performance and a stronger ability to cope with climatic variability and external disturbances. In contrast, the PID controller shows larger dispersion and increased variability, particularly during transitional seasons, reflecting its higher sensitivity to rapid changes in environmental conditions.

These results clearly demonstrate the superior precision and stability of the FLC in regulating both temperature and humidity within the greenhouse environment.

At the level of energy, the Humidifying rate and Ventilation rate for PID controller and Humidifying rate and Ventilation rate for Fuzzy Logic Controller (FLC) are represented respectively in Figure 17 and Figure 18.

Figure 17. Humidifying rate and Ventilation rate for PID controller.
Figure 18. Humidifying rate and Ventilation rate for Fuzzy Logic Controller (FLC).

The simulation results shown in Figure 17 indicate that, with the PID controller, the ventilation rate varies between 2 and 3.18, while the humidification rate ranges from 0 to 170, occasionally reaching a maximum of 8900. Figure 18 shows that, when using with FLC, the ventilation rate ranges from 0 to 1.3 with a maximum of 2.5, while the humidification rate varies between 0 and 150, occasionally peaking at 420.To optimize energy efficiency, the energy consumption associated with both control strategies was calculated. The results show that the average humidification rate is 164.8 for PID controller, compared to 41.36 for the FLC, while the average ventilation rate is 2.01 for the PID and 0.595 for the FLC. These findings demonstrate that the PID controller leads to significantly higher energy consumption than the FLC, thereby validating the choice of the FLC due to its superior control performance, faster response, and improved energy efficiency.

4. Conclusion

Agricultural greenhouses represent complex systems due to the presence of significant external disturbances and the large number of input parameters that strongly influence the internal climate. Consequently, farmers and researchers continuously seek optimal control strategies to enhance greenhouse productivity. Despite the strong coupling between temperature and relative humidity, the PID controller leads to significantly higher energy consumption than the Fuzzy Logic Controller (FLC). Two control strategies were implemented: a conventional PID controller and a Fuzzy Logic Controller (FLC), with the objective of creating a favorable greenhouse microclimate through appropriate activation of the installed actuators.

Weather variability represents a major external source of uncertainty, particularly due to fluctuations in solar radiation, ambient temperature, wind speed, and relative humidity. These factors directly affect the greenhouse microclimate and may lead to discrepancies between simulated and real conditions, especially during transitional seasons such as spring and autumn, when temperature and relative humidity are strongly coupled and highly variable. Despite these challenges, the proposed model demonstrates robust performance under diverse weather conditions, maintaining acceptable accuracy during both stable (summer and winter) and highly variable climatic scenarios. This confirms that the proposed control strategy is resilient to weather-induced disturbances. To evaluate energy optimization, the energy consumption of the PID controller was compared with that of the Fuzzy Logic Controller (FLC). The results reveal that:

These findings demonstrate that the overall energy consumption associated with the PID controller is approximately 27% higher than that of the FLC. This confirms the effectiveness of the FLC in achieving more precise regulation, faster dynamic response, and significant energy savings. Additionally, the simulation results confirm the effectiveness of the proposed dynamic model in accurately predicting indoor relative humidity and indoor air temperature with a low margin of error. The comparison between the PID and the FLC responses further highlights the FLC as an efficient and robust solution for optimizing greenhouse microclimate conditions. This work makes several original contributions that address key limitations identified in the existing literature on automatic greenhouse climate management.

First, unlike most existing studies that evaluate control strategies under limited or single-season conditions, this work proposes and validates a control framework using real meteorological data collected during the most challenging climatic periods, namely spring and autumn, where strong coupling between temperature and relative humidity occurs. Second, a coupled multivariable control strategy is developed to simultaneously regulate temperature and humidity, explicitly accounting for their dynamic interaction, whereas many existing approaches treat these variables independently or rely on simplified assumptions. Third, the proposed model is experimentally validated under real operating conditions, demonstrating its robustness and effectiveness compared to conventional control strategies typically reported in the literature. Finally, this work provides a comprehensive comparative analysis highlighting the trade-offs between control performance, energy consumption, and environmental stability, thereby offering practical insights for the deployment of intelligent greenhouse control systems.

Future work will focus on extending the control strategy to cover all four seasons by investigating advanced control techniques such as sliding mode control and backstepping. In addition, the development of a smart greenhouse management system based on Internet of Things (IoT) technologies is planned.

Acknowledgement

This work was carried out as part of a collaboration between the National School of Applied Sciences (ENSA) and the Higher School of Technology (EST) in Fes.

Author contribution

All authors contributed to the study conception and design. Material preparation, data collection and analysis were performed by [Abderrazak KAIDA], [Abderrahman AITDADA], [Youssef EL AFOU] and [Abdelouahad AIT MSAAD]. The first draft of the manuscript was written by [Abderrazak KAIDA] and all authors commented on previous versions of the manuscript. All authors read and approved the final manuscript.

References

Abbood HM, Nouri NM, Riahi M, Alagheband SH (2023) An intelligent monitoring model for greenhouse microclimate based on RBF Neural Network for optimal setpoint detection. J Process Control 129. https://doi.org/10.1016/j.jprocont.2023.103037

Adrian Z, Razvan U, Gaudentiu V (2019) Controlling the Temperature and Humidity in a Greenhouse. In: 2019 IEEE 25th International Symposium for Design and Technology in Electronic Packaging (SIITME): IEEE Xplore compliant proceedings: 23rd-26th of October 2019, Cluj-Napoca, Romania. IEEE.

Ben Ali R, Bouadila S, Mami A (2018) Development of a Fuzzy Logic Controller applied to an agricultural greenhouse experimentally validated. Appl Therm Eng 141: 798–810. https://doi.org/10.1016/j.applthermaleng.2018.06.014

Bennis N, Duplaix J, Enéa G, et al. (2008) Greenhouse climate modelling and robust control. Comput Electron Agric 61: 96–107. https://doi.org/10.1016/j.compag.2007.09.014

Bhujel A, Basak JK, Khan F, et al. (2020) Sensor Systems for Greenhouse Microclimate Monitoring and Control: a Review. Journal of Biosystems Engineering 45: 341–361

Blasco X, Martínez M, Herrero JM, et al. (2007) Model-based predictive control of greenhouse climate for reducing energy and water consumption. Comput Electron Agric 55: 49–70. https://doi.org/10.1016/j.compag.2006.12.001

Chand Singh M, Singh JP, Kumar Pandey S, et al. (2018) A Review of Three Commonly Used Techniques of Controlling Greenhouse Microclimate. Int J Curr Microbiol Appl Sci 7: 3491–3505. https://doi.org/10.20546/ijcmas.2018.701.411

Chen X, Liang H, Wu G, et al. (2023) Coupled heat and humidity control system of narrow-trough solar collector and solid desiccant in Chinese solar greenhouse: Analysis of optical / thermal characteristics and experimental study. Energy 273. https://doi.org/10.1016/j.energy.2023.127198

Choab N, Allouhi A, El Maakoul A, et al. (2019) Review on greenhouse microclimate and application: Design parameters, thermal modeling and simulation, climate controlling technologies. Solar Energy 191: 109–137.

El Afou Y, Ait Msaad A, Kousksou T, Mahdaou Mi (2015) Predictive Control of Temperature Under Greenhouse using LQG Strategy. In: Proceedings of 2015 IEEE International Renewable and Sustainable Energy Conference: (IRSEC’15). IEEE.

El Afou Y, Kousksou T, Jammoukh M (2018) Towards controlling climatic parameters under greenhouse. In: ICOA: 2018 4th International Conference on Optimization and Applications: 26-27 April 2018, Mohammedia, Morocco. Institute of Electrical and Electronics Engineers, p. 494.

El Ghoumari MY, Tantau HJ, Serrano J (2005) Non-linear constrained MPC: Real-time implementation of greenhouse air temperature control. In: Computers and Electronics in Agriculture. pp. 345–356.

Farvardin M, Taki M, Gorjian S, et al. (2024) Assessing the Physical and Environmental Aspects of Greenhouse Cultivation: A Comprehensive Review of Conventional and Hydroponic Methods. Sustainability (Switzerland) 16. https://doi.org/10.3390/su16031273

Fliess M, Sira-Ramirez H, Sira-Ramírez H (2004) Control via state estimations of some nonlinear systems

Franklin KA (2009) Light and temperature signal crosstalk in plant development. Curr Opin Plant Biol 12: 63–68.

Guo Y, Zhao H, Zhang S, et al. (2021) Modeling and optimization of environment in agricultural greenhouses for improving cleaner and sustainable crop production. J Clean Prod 285.

Huang S, Xiang H, Leng C, et al. (2024) Intelligent Regulation of Temperature and Humidity in Vegetable Greenhouses Based on Single Neuron PID Algorithm. Electronics (Switzerland) 13:. https://doi.org/10.3390/electronics13112083

Jeevan Nagendra Kuma Y, Chandan R, Somanini SH, et al. (2024) Predictive modeling for enhanced plant cultivation in greenhouse environment. In: E3S Web of Conferences. EDP Sciences.

Joe Qin S, Yu J (2007) Recent developments in multivariable controller performance monitoring. J Process Control 17: 221–227. https://doi.org/10.1016/j.jprocont.2006.11.002

Kadirov Y, Samadov A, Goziev O (2023) Equation of dynamics of greenhouse microclimate parameters. In: E3S Web of Conferences. EDP Sciences.

Kaida A, El Afou Y, Aitdada A, et al. (2024) Dynamical Modeling of Climatic Parameters Under Greenhouse. In: Lecture Notes in Networks and Systems. Springer Science and Business Media Deutschland GmbH, pp. 420–427.

Katebi R (2012) Robust multivariable tuning methods. In: Advances in Industrial Control. Springer International Publishing, pp. 255–280.

Körner C (2015) Paradigm shift in plant growth control. Curr Opin Plant Biol 25: 107–114.

Lamprecht, I., Schmolz, E., Blanco, L., & Romero, C. M. (2002). Flower ovens: thermal investigations on heat producing plants. Thermochimica Acta, 391(1-2), 107-118.

Li G, Tang L, Zhang X, et al. (2018) Factors affecting greenhouse microclimate and its regulating techniques: A review. In: IOP Conference Series: Earth and Environmental Science. Institute of Physics Publishing.

Lipiec J, Doussan C, Nosalewicz A, Kondracka K (2013) Effect of drought and heat stresses on plant growth and yield: A review. Int Agrophys 27: 463–477.

Márquez-Vera MA, Ramos-Fernández JC, Cerecero-Natale LF, et al. (2016) Temperature control in a MISO greenhouse by inverting its fuzzy model. Comput Electron Agric 124: 168–174. https://doi.org/10.1016/j.compag.2016.04.005

Paolino N, Schiavo M, Latronico N, et al. (2024) PK/PD model based design of PID control for closed-loop anesthesia. IFAC Journal of Systems and Control 27. https://doi.org/10.1016/j.ifacsc.2024.100247

Penfield S (2008) Temperature perception and signal transduction in plants. New Phytologist 179:615–628

Riahi J, Nasri H, Mami A, Vergura S (2024) Effectiveness of the Fuzzy Logic Control to Manage the Microclimate Inside a Smart Insulated Greenhouse. Smart Cities 7: 1304–1329. https://doi.org/10.3390/smartcities7030055

Schiavo M, Padula F, Latronico N, et al. (2021) Individualized PID tuning for maintenance of general anesthesia with propofol. In: IFAC-PapersOnLine. Elsevier B.V., pp. 679–684.

Shamshiri RR, Bojic I, van Henten E, et al. (2020) Model-based evaluation of greenhouse microclimate using IoT-Sensor data fusion for energy efficient crop production. J Clean Prod 263. https://doi.org/10.1016/j.jclepro.2020.121303

Tao G (2014) Multivariable adaptive control: A survey. Automatica 50: 2737–2764. https://doi.org/10.1016/j.automatica.2014.10.015

Wahid A, Gelani S, Ashraf M, Foolad MR (2007) Heat tolerance in plants: An overview. Environ Exp Bot 61:199–223.

Wang H, Laktionov I, Rodríguez Díaz F, et al. (2024) An optimized approach to hourly temperature and humidity setpoint generation for reducing tomato disease and saving power cost in greenhouses. Comput Electron Agric 226.

Yang C, Zhang X (2024) Adaptive Fuzzy Control for Fractional-Order Networked Control Systems with Input Time Delay and Data Loss. Journal of Nonlinear Mathematical Physics 31. https://doi.org/10.1007/s44198-024-00201-4

Go to references