Smart and Renewable Energy System to Power a Temperature-Controlled Greenhouse †

: This paper presents the modeling and simulation of a Multi-Source Power System (MSPS)— composed of two renewable energy sources and supported by a Battery Energy Storage System (BESS)—to supply the ventilation and heating system for a temperature-controlled agricultural greenhouse. The ﬁrst one is a photovoltaic (PV) generator connected to a DC/AC inverter and the second one is a wind turbine connected to a Permanent Magnet Synchronous Generator (PMSG). The temperature contribution in the model of the PV generator is deeply studied. A Maximum Power Point Tracking (MPPT) control based on fuzzy logic is used to drive a SEPIC converter to feed the maximum power to the greenhouse actuators. The operation of the actuators (ventilation and heating systems), on the basis of the mismatch between the internal temperature and the reference one, is controlled by a PI controller optimized by fuzzy logic, for more robust results. The simulation of the system is carried out in a Matlab/Simulink environment and its validation is based on the comparison between the simulated and experimental data for a test greenhouse, located in the Faculty of Science in Tunis. The results show that the proposed system provides an efﬁcient solution for controlling the microclimate of the agricultural greenhouse in different periods of the year.


Introduction
Electric energy generation systems based on renewable sources such as wind and solar are a valid alternative solution to fossil-fuel-based systems. Indeed, wind and photovoltaic systems have been booming lately and have become more and more accessible in terms of technologies and costs. Once installed, these systems can be independent of any source or network and have the advantage of being able to be positioned close to consumer sites. A combined power system based on Renewable Energy Sources (RES) is an effective solution for controlling the internal climate of an agricultural greenhouse, because it can ensure the power necessary for its automatic operation [1,2]. Combined energy systems in different applications are known. Reference [3] presented a wind-PV generator coupled with a DC load, while [4] developed a model of a PV-wind system implemented in Matlab/Simulink. Reference [5] focused on the converter design, while [6] presented a design of a controller for the energy sources. In addition, it is necessary to monitor efficiency over time to promptly detect malfunctions before failures occur. A PV system can be easily monitored if it is equipped with a datalogger that stores the electrical parameters [7,8].
In the absence of a datalogger, the correct operation of PV systems can be checked using infrared analysis [9] and/or simulation tools [10,11]. Renewable energy is largely used in the industrial sector. For example, the authors in [12] developed a combined energy the proposed control works better, because the speed variation is continuous and avoids successive starting/stopping of the motors. In summary, the paper is constituted by two main parts: the power sources and the control. The choice and size of the power sources is better described in [1], of which this paper is an extension. Instead, the control part represents the main contribution of this paper.
The paper is organized as follows. The modeling of the main components constituting the global system, including the BESS and the greenhouse modeling, is presented in Section 2. The control strategy of the combined energy systems and of the heating/ventilation system is described in Section 3. The simulation results are discussed in Section 4, whereas the final section contains the Conclusions.

Modeling of the Energy System
The proposed energy system is composed of a photovoltaic generator based on KANEKA GSA060 PV modules, a wind generator, a storage system battery bank, SEPIC converters controlled by a fuzzy MPPT strategy, and an inverter. They are wired with a ventilation and heating system composed by an asynchronous motor, controlled by a vector control optimized by fuzzy logic. The main scheme, implemented in the Matlab/Simulink environment, is shown in Figure 1.
The proposed model is based on a real experimental energy system, available in the Faculty of Sciences in Tunis, and it is described in Section 2.7. The following subsections describe the model of the components of that real system. Particularly, Section 2.1 models the PV cell and module, highlighting how to account for the influence of temperature on the several components.

Model of the PV Generator
A PV module is composed of several PV cells connected in series to increase the value of the total voltage, and several PV modules can be connected in parallel to increase the value of the total current. The single diode model of a PV cell is shown in Figure 2, where Rs and Rsh are the series-and shunt-resistors. The proposed model is based on a real experimental energy system, available in the Faculty of Sciences in Tunis, and it is described in Section 2.7. The following subsections describe the model of the components of that real system. Particularly, Section 2.1 models the PV cell and module, highlighting how to account for the influence of temperature on the several components.

Model of the PV Generator
A PV module is composed of several PV cells connected in series to increase the value of the total voltage, and several PV modules can be connected in parallel to increase the value of the total current. The single diode model of a PV cell is shown in Figure 2, where R s and R sh are the series-and shunt-resistors. According to the LKC in the upper node in Figure 2, it results: where Iph is the photodiode current, later defined. The current passing through the resistor IRsh is given by: According to the LKC in the upper node in Figure 2, it results: where I ph is the photodiode current, later defined. The current passing through the resistor I Rsh is given by: The diode current is: where I S is the reverse saturation current, defined as [24]: where K: Boltzmann's constant (1.381 × 10 −23 J/K); T c : absolute cell temperature in Kelvin; q: electron charge (1.602 × 10 −19 C); K 1 : constant (1.2 A/cm 2 K 3 ); E g : band energy gap (for crystalline silicon = 1.12 eV); n: diode ideality factor. By grouping the previous equations, the current-voltage (I-V) curve is: I ph can be extracted from the Short-Circuit (SC) condition. In fact, the I SC current is the maximum current generated by the cell. It is produced when V = 0. From (6) and remembering that R s R p , it results I ph ≈ I SC . All the parameters are affected by the solar radiation G and the air temperature T a . Therefore, Equation (6) and the values of R s , R sh , n, I s , I ph are valid for a fixed environment condition. Moreover, these values are not available in manufacturer datasheets of the PV modules in any condition, because these other specifications are available: rated peak power (P n ), open-circuit voltage (V oc ), short-circuit current (I sc ), voltage and current in MPP (V mpp and I mpp ), temperature coefficient for the short circuit current (α I sc ), and temperature coefficient for the open circuit voltage (α V oc ). Moreover, these values regard the whole PV module and not the single PV cell. Nevertheless, the number of series-and parallelconnected PV cells is usually available in the PV module datasheet, thus cell voltage and current are: with N s the number of series-connected cells and N p the number of parallel-connected cells. Finally, to compare the performance of several PV modules, the declared values are evaluated under standard test conditions (STCs), i.e., G = 1000 W/m 2 , T a = 25 • C, air wind of 1 m/s and air mass of 1.5. Instead, the nominal module operating temperature (NMOT) is defined for 800 W/m 2 and cell temperature T c = 20 • C. The NMOT verifies the following equation: Energies 2021, 14, 5499

of 21
In summary, the circuit of Figure 2 is valid after calculating the parameters in the operating condition, i.e., under the actual solar radiation and air temperature. Therefore, the photodiode current depends on both G and T a : where G pu = G/1000 is the irradiance normalized to the STC value, I o sc is the short circuit current at STC, α I sc is the current-temperature coefficient at STC, ∆T = (T c − 25) is the temperature difference with respect to the STC.
Analogous expression of Equation (10) is valid for I mpp : The second term in Equation (6) depends on the dark saturation current, I s , which in turn depends on the cell temperature (see Equation (4)), but also on the series resistance R s . Thus, it can be represented as: where V o oc is the open circuit voltage in STC, while the parameters β and γ will be calculated later. Equation (12) highlights the temperature dependence of the V oc [25]: Since V mpp and V oc differ by less than 15%, the following is also valid: The third term of Equation (6) considers the dissipative phenomena [26] inside the PV cell, by means of the series-and shunt-resistors. As better explained in [27][28][29], R s defines the slope of the I-V curve in open-circuit state, while R sh defines the slope in short-circuit state; their values can be approximated as: Now, substituting Equations (10) and (12) in (6), and considering (15)-(16), it results: Parameters β and γ are calculated [28], imposing the constraints at the three characteristic points: short-circuit state, open-circuit state, and the maximum power point. Their values are: where These parameters depend on both the irradiance and the air temperature, so they can describe each operating point, whatever the environmental condition. Figure 2, after the mathematical manipulations, becomes as in Figure 3, where the contributions of irradiance and temperature are highlighted. ∆T is modelled with two series-connected voltage sources, and it controls four voltage-controlled sources: I o sc and I o mpp (with the coefficient α I sc ), and V o oc and V o mpp (with the coefficient α V oc ). The resistance G represents the solar radiance. In particular, the term I x = G pu ·(I o sc + α I sc ·∆T) = G G+(1000−G) ·(I o sc + α I sc ·∆T) of Equation (18) is calculated with a current divider. The circuit in Figure 3 models a single PV cell, but it can be used for a PV module by using Equations (7) and (8). .
These parameters depend on both the irradiance and the air temperature, so they can describe each operating point, whatever the environmental condition. Figure 2, after the mathematical manipulations, becomes as in Figure 3, where the contributions of irradiance and temperature are highlighted. ΔT is modelled with two series-connected voltage sources, and it controls four voltage-controlled sources: and (with the coefficient α ), and and (with the coefficient α ). The resistance G represents the solar radiance. In particular, the term = • ( + α • ∆ ) = +(1000− ) • ( + α • ∆ ) of Equation (18) is calculated with a current divider. The circuit in Figure 3 models a single PV cell, but it can be used for a PV module by using Equations (7) and (8).

Model of the Wind Turbine
The wind turbine system is composed by a wind turbine, a PMSG and an AC/DC rectifier. The wind turbine power, pw, is described by the equation: where ρ = 1.225 Kg/m 3 , R is the radius of the wind turbine, β is the pitch angle, p is the power coefficient, Vw the wind speed, and λ symbolizes the tip speed ratio defined by:

Model of the Wind Turbine
The wind turbine system is composed by a wind turbine, a PMSG and an AC/DC rectifier. The wind turbine power, p w , is described by the equation: where ρ = 1.225 Kg/m 3 , R is the radius of the wind turbine, β is the pitch angle, C p is the power coefficient, V w the wind speed, and λ symbolizes the tip speed ratio defined by: with ω turb the angular velocity of the wind turbine rotor. The mathematical model of the most used PMSG generator in the wind turbine is described by the following differential equation in the (d,q) reference [30]: Energies 2021, 14, 5499 The electromagnetic torque is defined as [31]: The electrical angular speed ω e depends on the number of pole pairs P, whereas the mechanical angular velocity ω turb satisfies the equation: Many types of rectifiers are used in the wind system. The PMSG is connected to a three-phase non-controlled rectifier. The PMSG electrical behavior is described by the following equations [32], VDC being the DC output voltage:

Model of the Battery Energy Storage System
The BESS consists of a bank of lithium-ion type batteries used to reduce power fluctuations from renewable energy sources and can support the stability of the electrical system. The operation of the storage system is described by the following equation [33]: where E L is the load demand (W), E HES is the power delivered from the MSPS (W), η Batt is the battery efficiency (%), E charge and E discharge are the battery power in the charging and discharging periods, respectively. The battery bank capacity can be calculated according to the equation [34]: where DA is the Daily Autonomy, η inv is the inverter efficiency (%) and DOD is the Depth Of Discharge of the battery (%), that varies from 60% to 100%. Battery charging and discharging are related to the State of Charge (SOC), which is constrained by: where SOC max is the upper limit fixed to 100% and SOC min is the lower limit. The BESS is connected to the DC bus via the bi-directional converter ( Figure 1) and allows compensation and minimization of output power fluctuations due to the energy conversion system engaged for wind and solar radiation.

SEPIC Buck Boost Converter
A converter is chosen for the purpose of modifying the voltage delivered by the power sources (PV generator and wind turbine) and guaranteeing the maximum power. In this case, a SEPIC buck-boost inverter is used (Figure 4), whose characteristics are reported in [35,36]. The specifications of the converter have been set for the laboratory test and the values of the main components are reported in Table 1.

SEPIC Buck Boost Converter
A converter is chosen for the purpose of modifying the voltage delivered by the power sources (PV generator and wind turbine) and guaranteeing the maximum power. In this case, a SEPIC buck-boost inverter is used (Figure 4), whose characteristics are reported in [35,36]. The specifications of the converter have been set for the laboratory test and the values of the main components are reported in Table 1.

Fuzzy Logic for the MPPT
This subsection discusses the design of the MPPT strategy, based on a fuzzy corrector and on the principle of Perturbation and Observation (P&O). For the fuzzification step, the input variables are the incremental voltage, ( ), and the incremental power, ( ), for the generic k-th step, defined on the basis of the current and previous samples: The linguistic variables are reported in Figures 5 and 6 (P = positive; Z = approximately zero; N = negative). Instead, the inference rules are reported in Table 2. The center of gravity method is used for the defuzzification. For this case, the unique output variable is the change of the duty cycle D (see the third column of Table 2 and Figure 7).

Fuzzy Logic for the MPPT
This subsection discusses the design of the MPPT strategy, based on a fuzzy corrector and on the principle of Perturbation and Observation (P&O). For the fuzzification step, the input variables are the incremental voltage, E V (k), and the incremental power, E P (k), for the generic k-th step, defined on the basis of the current and previous samples: The linguistic variables are reported in Figures 5 and 6 (P = positive; Z = approximately zero; N = negative). Instead, the inference rules are reported in Table 2. The center of gravity method is used for the defuzzification. For this case, the unique output variable is the change of the duty cycle D (see the third column of Table 2 and Figure 7).

Greenhouse Model
The agricultural greenhouse is a complex system, used for off-season agricultural production to ensure a favorable indoor climate. Temperature is one of the most important parameters in a greenhouse, and a heating and ventilation system is used to achieve an efficient control of the indoor temperature. This section studies a dynamic model developed in [37] and based on thermodynamic laws, and it is coupled with a heating and ventilation system supplied by an MSPS. The agricultural greenhouse is modeled as a thermodynamic system, where different heat transfers occur from several energy exchanges between the inside and outside of the greenhouse. The temperature inside the greenhouse, as discussed in [37,38], must satisfy the Equation: where ρ a is the air density equal to 1.225 [Kg/m 3 ], C a is the air heat capacity equal to 1.003 [kJ/kg K], and dTin dt is the variation of the internal temperature. An exhaustive explanation of the other terms is reported in [36].

Real Experimental Greenhouse in the Faculty of Sciences in Tunis
The experimental greenhouse is in the North of Tunisia (36 • 43'10.25" N) and presents a typical model for greenhouses located in the Mediterranean area. It is a small-capel of the semi-insulated type and occupies an area equal to 14.8 m 2 (width 3.7 m, length 4 m, ridge height 3 m) and a volume of 36 m 3 (Figure 8). This real greenhouse has been used to experimentally validate the agricultural greenhouse system, and to validate the operation of the actuators: a 705 W power fan and a 1000 W heating system. We tested an MSPS coupled by a storage system with real data (wind speed and solar radiation) to ensure the power consumed by the actuators, which control the interior temperature. In this test, the plant under cultivation is the tomato, and the optimal temperatures are 24 • C during the day and 15 • C during the night.
oped in [37] and based on thermodynamic laws, and it is coupled with a heating and ventilation system supplied by an MSPS. The agricultural greenhouse is modeled as a thermodynamic system, where different heat transfers occur from several energy exchanges between the inside and outside of the greenhouse. The temperature inside the greenhouse, as discussed in [37,38], must satisfy the Equation: where is the air density equal to 1.225 [Kg/m 3 ], Ca is the air heat capacity equal to 1.003 [kJ/kg K], and is the variation of the internal temperature. An exhaustive explanation of the other terms is reported in [36].

Real Experimental Greenhouse in the Faculty of Sciences in Tunis
The experimental greenhouse is in the North of Tunisia (36°43'10.25" N) and presents a typical model for greenhouses located in the Mediterranean area. It is a small-capel of the semi-insulated type and occupies an area equal to 14.8m 2 (width 3.7 m, length 4 m, ridge height 3 m) and a volume of 36 m 3 (Figure 8). This real greenhouse has been used to experimentally validate the agricultural greenhouse system, and to validate the operation of the actuators: a 705 W power fan and a 1000 W heating system. We tested an MSPS coupled by a storage system with real data (wind speed and solar radiation) to ensure the power consumed by the actuators, which control the interior temperature. In this test, the plant under cultivation is the tomato, and the optimal temperatures are 24 °C during the day and 15 °C during the night.

Control of the MSPS and BESS
This section presents the control strategy to manage the produced energy and to coordinate the interactions among the devices. The energy source is the combination of a photovoltaic system and a wind system, whereas the battery represents the energy storage system. The use of the battery bank is useful to compensate the mismatch between the power demanded by the load and the power generated by the MSPS. Therefore, three operating conditions can be observed:

Control of the MSPS and BESS
This section presents the control strategy to manage the produced energy and to coordinate the interactions among the devices. The energy source is the combination of a photovoltaic system and a wind system, whereas the battery represents the energy storage system. The use of the battery bank is useful to compensate the mismatch between the power demanded by the load and the power generated by the MSPS. Therefore, three operating conditions can be observed:

•
Power generated by the MSPS exceeds the power required by the load: the excess is stored in the battery bank and, when the battery bank will be full, the further energy will be dissipated in a load shedding system, which is a resistor in this study. • Generated power is equal to the power required by the load: the produced power is entirely injected into the DC bus to the load. • Power delivered by the MSPS is insufficient and the battery is charged: the missing power will be supplied by the battery storage system and the battery bank will be controlled to be activated when the SOC state is in the operating range.
The proposed control strategy ( Figure 9) allows optimization of the produced energy and is reliable in regulating the power flow from and to the battery system, taking into account the battery SOC level and the power offset between the power demanded by the load and the power generated by the MSPS. Power delivered by the MSPS is insufficient and the battery is charged: the missing power will be supplied by the battery storage system and the battery bank will be controlled to be activated when the SOC state is in the operating range.
The proposed control strategy ( Figure 9) allows optimization of the produced energy and is reliable in regulating the power flow from and to the battery system, taking into account the battery SOC level and the power offset between the power demanded by the load and the power generated by the MSPS.

Control Strategy of the Ventilation/Heating System
Several control strategies for electric motors have been developed [39], such as scalar control, predictive control, etc., but, in this study, a vector control is used. It can control the speed of the asynchronous motor, the electromotive flux, and the torque of the threephase electric motor. In general, vector control consists of a PI controller which calculates the reference speed according to its rated speed; this technique is not stable for motor speed control since the motor speed of a load is variable over time [40,41].
For this reason, we developed a PI controller Optimized by Fuzzy Logic (PIOFL). The structure of the proposed vector control is reported in Figure 10. Firstly, a Fuzzy Logic (FL) controller is defined, then it is optimized by using PI controller.

Control Strategy of the Ventilation/Heating System
Several control strategies for electric motors have been developed [39], such as scalar control, predictive control, etc., but, in this study, a vector control is used. It can control the speed of the asynchronous motor, the electromotive flux, and the torque of the three-phase electric motor. In general, vector control consists of a PI controller which calculates the reference speed according to its rated speed; this technique is not stable for motor speed control since the motor speed of a load is variable over time [40,41].
For this reason, we developed a PI controller Optimized by Fuzzy Logic (PIOFL). The structure of the proposed vector control is reported in Figure 10. Firstly, a Fuzzy Logic (FL) controller is defined, then it is optimized by using PI controller. The diagram of the speed control strategy based on a basic FL controller is summarized in Figure 11, where two linguistic variables at the input of the speed controller are defined: the speed error E and sampled acceleration ET. Speed error E, at the k-th step, is defined as: where Ω is reference speed and Ω is the actual speed of the motor, calculated as: The diagram of the speed control strategy based on a basic FL controller is summarized in Figure 11, where two linguistic variables at the input of the speed controller are defined: the speed error E and sampled acceleration ∆E T . Speed error E, at the k-th step, is defined as: where Ω re f is reference speed and Ω is the actual speed of the motor, calculated as: with J the inertia on the shaft of the heating system group, p the Laplace variable, and f the viscous friction coefficient; C r is the load (resistive) torque, while the electromagnetic torque, C em , is given by: where ∆C em (k) is the output of the fuzzy logic controller. The diagram of the speed control strategy based on a basic FL controller is summarized in Figure 11, where two linguistic variables at the input of the speed controller are defined: the speed error E and sampled acceleration ET. Speed error E, at the k-th step, is defined as: where Ω is reference speed and Ω is the actual speed of the motor, calculated as: with J the inertia on the shaft of the heating system group, p the Laplace variable, and f the viscous friction coefficient; Cr is the load (resistive) torque, while the electromagnetic torque, Cem, is given by: where ∆ ( ) is the output of the fuzzy logic controller. Figure 11. Basic FL controller for the yellow block in Figure 9.
The inference rules of the FL controller are reported in Table 3, where the first column reports the input error E of the FL controller, the second column the sampled acceleration ET, while the third column regards the output of the fuzzy controller for Cem. Based on the study of the behavior of the system in closed control loop, there are three fuzzy sets, which implies nine possible combinations of these inputs, or nine rules. Now, FL can be a useful support in processing inaccurate variables and in minimizing objective decisions through approximate cognition. This controller has good robustness against external disturbances, but it is not quick. On the other hand, the PI controller has a fast response and is sensitive to external perturbations [42]. To take full advantage of both controllers, we program the coefficients of the PI controller optimized by fuzzy logic, as reported in Figure 12, i.e., similar to Figure 11, apart from the PI controller. Figure 11. Basic FL controller for the yellow block in Figure 9.
The inference rules of the FL controller are reported in Table 3, where the first column reports the input error E of the FL controller, the second column the sampled acceleration ∆E T , while the third column regards the output of the fuzzy controller for C em . Based on the study of the behavior of the system in closed control loop, there are three fuzzy sets, which implies nine possible combinations of these inputs, or nine rules. Now, FL can be a useful support in processing inaccurate variables and in minimizing objective decisions through approximate cognition. This controller has good robustness against external disturbances, but it is not quick. On the other hand, the PI controller has a fast response and is sensitive to external perturbations [42]. To take full advantage of both controllers, we program the coefficients of the PI controller optimized by fuzzy logic, as reported in Figure 12, i.e., similar to Figure 11, apart from the PI controller.
The inputs to the fuzzy controller are the same linguistic variables defined in Equations (37) and (38). Similarly, the fuzzification stage will also be retained. The difference with respect to the basic FL controller concerns the output linguistic variables.  Figure 12. PI controller optimized by fuzzy logic for yellow block in Figure 10.
The inputs to the fuzzy controller are the same linguistic variables defined in Equation (37) and (38). Similarly, the fuzzification stage will also be retained. The difference with respect to the basic FL controller concerns the output linguistic variables.
The inference rules that manage the controller level are detailed in Tables 4 and 5 for Kp and Ki, respectively. The proposed control strategy consists of a PI controller with parameters Kp and Ki generated from a fuzzy controller to improve the robustness of the whole control. This robustness is due to the change of the parameters Kp and Ki every time a change of the input parameters occurs.   Figure 12. PI controller optimized by fuzzy logic for yellow block in Figure 10.
The inference rules that manage the controller level are detailed in Tables 4 and 5 for Kp and Ki, respectively. The proposed control strategy consists of a PI controller with parameters Kp and Ki generated from a fuzzy controller to improve the robustness of the whole control. This robustness is due to the change of the parameters Kp and Ki every time a change of the input parameters occurs.

Electrical Behavior of the PV Generator
The PV module specifications under STC are shown in Table 6 [43]. The PV generator consists of several modules in series and in parallel, and it is simulated in the MATLAB/SIMULINK environment with real climatic data measured in the research laboratory in the Faculty of Sciences of Tunis, Tunisia. The PV generator is associated with the converter, controlled by MPPT-based fuzzy logic controller. During the simulation, the photovoltaic radiation varied between 0 W/m 2 and 800 W/m 2 , with a temperature of 25 • C. The role of the buck converter consists in decreasing the voltage to 24 V and extracting the maximum power delivered by the PV generator. The command of the FL is good and assures the MPPT in all the weather conditions. It is also fast and precise. Figure 13 presents the profile of the solar radiation, while Figure 14 shows the PV power and voltage. tracting the maximum power delivered by the PV generator. The command of the FL is good and assures the MPPT in all the weather conditions. It is also fast and precise. Figure  13 presents the profile of the solar radiation, while Figure 14 shows the PV power and voltage. The simulation results show the efficiency of the MPPT command in the converter control such that the voltage is constant, and the power operates at a maximum power delivered by the PV generator.    tracting the maximum power delivered by the PV generator. The command of the FL is good and assures the MPPT in all the weather conditions. It is also fast and precise. Figure  13 presents the profile of the solar radiation, while Figure 14 shows the PV power and voltage. The simulation results show the efficiency of the MPPT command in the converter control such that the voltage is constant, and the power operates at a maximum power delivered by the PV generator.    The simulation results show the efficiency of the MPPT command in the converter control such that the voltage is constant, and the power operates at a maximum power delivered by the PV generator.

Electrical Behavior of the Wind Turbine
The PMSG wind turbine system used in this simulation has the following specifications: 1 kW at 400 V, f = 50 Hz, coupled with a SEPIC converter controlled by a fuzzy strategy. Figure 15 reports the Simulink model of the wind system.

Electrical Behavior of the Wind Turbine
The PMSG wind turbine system used in this simulation has the following specifications: 1 kW at 400 V, f = 50 Hz, coupled with a SEPIC converter controlled by a fuzzy strategy. Figure 15 reports the Simulink model of the wind system.

Electrical Behavior of the Wind Turbine
The PMSG wind turbine system used in this simulation has the following specifications: 1 kW at 400 V, f = 50 Hz, coupled with a SEPIC converter controlled by a fuzzy strategy. Figure 15 reports the Simulink model of the wind system.

Electrical Behavior of the Wind Turbine
The PMSG wind turbine system used in this simulation has the following specifications: 1 kW at 400 V, f = 50 Hz, coupled with a SEPIC converter controlled by a fuzzy strategy. Figure 15 reports the Simulink model of the wind system.

Simulation of the MSPS under Control Strategy
This section evaluates a MSPS consists of the PV generator (based on Kaneka GSA060) and a PMSG wind system, supported by the BESS, simulated under the MATLAB/SIMULINK environment. They are connected to a variable resistive load that absorbs a variable power between 700 W and 900 W.
The Li-Ion battery is constituted by three cells and has Vn = 200 V, while its capacity is equal to 100 Ah. The SOC and DOD are variable during the simulation and the initial values are fixed to SOC = 60% (the battery is not totally charged) and DOD = 40%.
The power of each MSPS component is shown in Figure 18, whereas Figure 19 reports the battery charging and discharging.

Simulation of the MSPS under Control Strategy
This section evaluates a MSPS consists of the PV generator (based on Kaneka GSA060) and a PMSG wind system, supported by the BESS, simulated under the MATLAB/SIMULINK environment. They are connected to a variable resistive load that absorbs a variable power between 700 W and 900 W.
The Li-Ion battery is constituted by three cells and has Vn = 200 V, while its capacity is equal to 100 Ah. The SOC and DOD are variable during the simulation and the initial values are fixed to SOC = 60% (the battery is not totally charged) and DOD = 40%.
The power of each MSPS component is shown in Figure 18, whereas Figure 19 reports the battery charging and discharging.  During the period 0-6 min, the power of the load is set to 700 W. The power delivered by the energy sources is equal to 300 W and BESS delivers 400 W (discharging) to balance the power absorbed by the load. The battery reaches its low SOC state ( Figure 19). During the period 12-15 min, the power produced by the MSPS exceeds the power required by the load. In this case, the surplus power is stored in the battery (charging). After the 15th minute, the load power equals the power produced by the MSPS, indicating that the battery level is constant. It is concluded that the BESS and the proposed algorithm seem to provide a correct energy balance. In case of sudden changes, the proposed system reacts quickly to transience and avoids power oscillations.
Simulation results show the effectiveness of the proposed control strategy, while the BESS correctly manages the charging and discharging, on the basis of the load demand.

Simulation Results of the Global System
A real database of the values of solar radiation, outside temperature, and wind speed of one day (5 March 2017 in Tunisia) is used in the Simulink-based system. As the internal temperature of the greenhouse should vary in a limited range, two actuators are needed: a ventilation system to remove internal heat during the hot hours of midday, and a heating system to raise the internal temperature during the cold hours of the night.

Simulation of the MSPS under Control Strategy
This section evaluates a MSPS consists of the PV generator (based on Kaneka GSA060) and a PMSG wind system, supported by the BESS, simulated under the MATLAB/SIMULINK environment. They are connected to a variable resistive load that absorbs a variable power between 700 W and 900 W.
The Li-Ion battery is constituted by three cells and has Vn = 200 V, while its capacity is equal to 100 Ah. The SOC and DOD are variable during the simulation and the initial values are fixed to SOC = 60% (the battery is not totally charged) and DOD = 40%.
The power of each MSPS component is shown in Figure 18, whereas Figure 19 reports the battery charging and discharging.  During the period 0-6 min, the power of the load is set to 700 W. The power delivered by the energy sources is equal to 300 W and BESS delivers 400 W (discharging) to balance the power absorbed by the load. The battery reaches its low SOC state ( Figure 19). During the period 12-15 min, the power produced by the MSPS exceeds the power required by the load. In this case, the surplus power is stored in the battery (charging). After the 15th minute, the load power equals the power produced by the MSPS, indicating that the battery level is constant. It is concluded that the BESS and the proposed algorithm seem to provide a correct energy balance. In case of sudden changes, the proposed system reacts quickly to transience and avoids power oscillations.
Simulation results show the effectiveness of the proposed control strategy, while the BESS correctly manages the charging and discharging, on the basis of the load demand.

Simulation Results of the Global System
A real database of the values of solar radiation, outside temperature, and wind speed of one day (5 March 2017 in Tunisia) is used in the Simulink-based system. As the internal temperature of the greenhouse should vary in a limited range, two actuators are needed: a ventilation system to remove internal heat during the hot hours of midday, and a heating system to raise the internal temperature during the cold hours of the night. During the period 0-6 min, the power of the load is set to 700 W. The power delivered by the energy sources is equal to 300 W and BESS delivers 400 W (discharging) to balance the power absorbed by the load. The battery reaches its low SOC state ( Figure 19). During the period 12-15 min, the power produced by the MSPS exceeds the power required by the load. In this case, the surplus power is stored in the battery (charging). After the 15th minute, the load power equals the power produced by the MSPS, indicating that the battery level is constant. It is concluded that the BESS and the proposed algorithm seem to provide a correct energy balance. In case of sudden changes, the proposed system reacts quickly to transience and avoids power oscillations.
Simulation results show the effectiveness of the proposed control strategy, while the BESS correctly manages the charging and discharging, on the basis of the load demand.

Simulation Results of the Global System
A real database of the values of solar radiation, outside temperature, and wind speed of one day (5 March 2017 in Tunisia) is used in the Simulink-based system. As the internal temperature of the greenhouse should vary in a limited range, two actuators are needed: a ventilation system to remove internal heat during the hot hours of midday, and a heating system to raise the internal temperature during the cold hours of the night. Figures 20 and 21 show the simulation results of the output power and the voltage delivered by the MSPS under MPPT fuzzy controller, and the storage system battery coupled with a SEPIC converter. It injects power into the DC bus to ensure the operation of the actuators (ventilation and heating system).   The real agricultural system under investigation is equipped with a ventilation system based on a three-phase asynchronous motor and a heat pump. Table 7 reports the electrical parameters of both the actuators used in the experimental energy system.  [38]. Therefore, the ventilation system operates at maximum speed (480 rpm) as shown in Figure 23. During this period, the MSPS delivers a maximum power (1.6 kW, see Figure 20) to ensure the operation of the ventilation system and to lower the indoor temperature to around its reference point. Figure 24 shows the heating rate that the heating system must ensure to increase the internal temperature to the reference value during the night and the first hours of the day, until 11.00 am. The heating system should operate around the maximum speed to guarantee the maximum heating rate of 250 W/m 2 . Figure 25 shows the motor speed of the heating system under the PIOFL controller. The energy is supplied by the wind system and the battery during the night, as you can observe in Figure 20. Moreover, PIOFL controller showed robustness in vector control, no overshoot, and a fast response when the   The real agricultural system under investigation is equipped with a ventilation system based on a three-phase asynchronous motor and a heat pump. Table 7 reports the electrical parameters of both the actuators used in the experimental energy system.  [38]. Therefore, the ventilation system operates at maximum speed (480 rpm) as shown in Figure 23. During this period, the MSPS delivers a maximum power (1.6 kW, see Figure 20) to ensure the operation of the ventilation system and to lower the indoor temperature to around its reference point. Figure 24 shows the heating rate that the heating system must ensure to increase the internal temperature to the reference value during the night and the first hours of the day, until 11.00 am. The heating system should operate around the maximum speed to guarantee the maximum heating rate of 250 W/m 2 . Figure 25 shows the motor speed of the heating system under the PIOFL controller. The energy is supplied by the wind system and the battery during the night, as you can observe in Figure 20. Moreover, PIOFL controller showed robustness in vector control, no overshoot, and a fast response when the The real agricultural system under investigation is equipped with a ventilation system based on a three-phase asynchronous motor and a heat pump. Table 7 reports the electrical parameters of both the actuators used in the experimental energy system. The simulation results of the ventilation system are presented in Figures 22 and 23. From 12:00 am and 6:00 pm, the internal temperature of the greenhouse exceeds the reference temperature, 24 • C [38]. Therefore, the ventilation system operates at maximum speed (480 rpm) as shown in Figure 23. During this period, the MSPS delivers a maximum power (1.6 kW, see Figure 20) to ensure the operation of the ventilation system and to lower the indoor temperature to around its reference point. Figure 24 shows the heating rate that the heating system must ensure to increase the internal temperature to the reference value during the night and the first hours of the day, until 11.00 am. The heating system should operate around the maximum speed to guarantee the maximum heating rate of 250 W/m 2 . Figure 25 shows the motor speed of the heating system under the PIOFL controller. The energy is supplied by the wind system and the battery during the night, as you can observe in Figure 20. Moreover, PIOFL controller showed robustness in vector control, no overshoot, and a fast response when the reference speed changed. So, PIOFL is efficient for the proposed system control and is a good solution to reduce energy consumption in the agricultural greenhouse. reference speed changed. So, PIOFL is efficient for the proposed system control and is a good solution to reduce energy consumption in the agricultural greenhouse.  The absence of PV energy, during the night, has an impact on the control of the agricultural greenhouse. The wind turbine supported by the storage system works with a boost converter to guarantee the maximum power injected in the heating system through a DC bus. The simulation results of the MSPS show the effectiveness in controlling the greenhouse system for different periods of time. Moreover, the coupling of two RES and a storage battery system allows supplying the energy to the greenhouse during the whole day, and this implies an improved energy management.  reference speed changed. So, PIOFL is efficient for the proposed system control and is a good solution to reduce energy consumption in the agricultural greenhouse.  The absence of PV energy, during the night, has an impact on the control of the agricultural greenhouse. The wind turbine supported by the storage system works with a boost converter to guarantee the maximum power injected in the heating system through a DC bus. The simulation results of the MSPS show the effectiveness in controlling the greenhouse system for different periods of time. Moreover, the coupling of two RES and a storage battery system allows supplying the energy to the greenhouse during the whole day, and this implies an improved energy management.    The absence of PV energy, during the night, has an impact on the control of the agricultural greenhouse. The wind turbine supported by the storage system works with a boost converter to guarantee the maximum power injected in the heating system through a DC bus. The simulation results of the MSPS show the effectiveness in controlling the greenhouse system for different periods of time. Moreover, the coupling of two RES and a storage battery system allows supplying the energy to the greenhouse during the whole day, and this implies an improved energy management.  Finally, Figure 26 reports the desired temperature in the greenhouse (24 °C during the day and 15 °C during the night, black line), the real outside temperature and the real inside temperature. It shows that the control is effective in following the setpoint temperature. The absence of PV energy, during the night, has an impact on the control of the agricultural greenhouse. The wind turbine supported by the storage system works with a boost converter to guarantee the maximum power injected in the heating system through a DC bus. The simulation results of the MSPS show the effectiveness in controlling the greenhouse system for different periods of time. Moreover, the coupling of two RES and a Energies 2021, 14, 5499 19 of 21 storage battery system allows supplying the energy to the greenhouse during the whole day, and this implies an improved energy management.
Finally, Figure 26 reports the desired temperature in the greenhouse (24 • C during the day and 15 • C during the night, black line), the real outside temperature and the real inside temperature. It shows that the control is effective in following the setpoint temperature. Finally, Figure 26 reports the desired temperature in the greenhouse (24 °C during the day and 15 °C during the night, black line), the real outside temperature and the real inside temperature. It shows that the control is effective in following the setpoint temperature.  Figure 26 shows that the desired temperature (24 °C during the day and 15 °C during the night) is maintained until the next change and the transition between the two states is fast. Figure 20 shows how the single components contribute to the requested power: the PV plant gives an insufficient contribution only during the day, the wind plant gives a variable contribution during the 24 h period, and the battery closes the balance. Finally, Figure  18 shows the MSPS response to the variation of the power absorbed by the load and/or to the variation of the power produced by one component of the MSPS.

Conclusions
The paper is constituted by two main parts: the power sources and the control. The first part proposes a battery-PV-wind energy system to power the heating and ventilation system of an agricultural greenhouse. Each subsystem is an accurate and verified model: a temperature-dependent model for the PV generator, a wind turbine coupled with a PMSG generator, and a BESS that allows improvement of the performance of the MSPS, especially during the night when only the wind system-subject to rapid wind variations, because the greenhouse is located near the sea-supplies the electrical load. The second part introduces the PIOFL strategy to control the energy flows exchanged among power sources, electrical loads, and battery. The global system has been tested by inputting the real environmental data for a complete daily scenario, which must consider the contributions of both PV and wind generators during the day, and the contribution of only the wind generator during the night. The proposed PIOFL strategy has shown an accurate and reliable operation during the variations of the energy flows because the target was reached in a limited time and in any condition (with one or two power sources). Moreover, the PIOFL has shown its reliability in reaching the temperature target both in increasing In summary, Figures 18,20 and 26 show that the main objectives have been achieved. Figure 26 shows that the desired temperature (24 • C during the day and 15 • C during the night) is maintained until the next change and the transition between the two states is fast. Figure 20 shows how the single components contribute to the requested power: the PV plant gives an insufficient contribution only during the day, the wind plant gives a variable contribution during the 24 h period, and the battery closes the balance. Finally, Figure 18 shows the MSPS response to the variation of the power absorbed by the load and/or to the variation of the power produced by one component of the MSPS.

Conclusions
The paper is constituted by two main parts: the power sources and the control. The first part proposes a battery-PV-wind energy system to power the heating and ventilation system of an agricultural greenhouse. Each subsystem is an accurate and verified model: a temperature-dependent model for the PV generator, a wind turbine coupled with a PMSG generator, and a BESS that allows improvement of the performance of the MSPS, especially during the night when only the wind system-subject to rapid wind variations, because the greenhouse is located near the sea-supplies the electrical load. The second part introduces the PIOFL strategy to control the energy flows exchanged among power sources, electrical loads, and battery. The global system has been tested by inputting the real environmental data for a complete daily scenario, which must consider the contributions of both PV and wind generators during the day, and the contribution of only the wind generator during the night. The proposed PIOFL strategy has shown an accurate and reliable operation during the variations of the energy flows because the target was reached in a limited time and in any condition (with one or two power sources). Moreover, the PIOFL has shown its reliability in reaching the temperature target both in increasing and in decreasing the internal temperature. The MSPS is modelled in MATLAB/Simulink under the change in wind speed, solar irradiance, and load. The simulation results demonstrated that the proposed MSPS maintains active power balance between supply and demand irrespective of variations in solar irradiance, wind speed, and connected load. Moreover, VDC, frequency, and output AC voltage are very minimally impacted due to these variations. Future work will focus on the temperature dependence of the battery capacity, which is a critical issue for certain latitudes.