Dynamic Modelling and Energy, Economic, and Environmental Analysis of a Greenhouse Supplied by Renewable Sources

: This paper regards the design and dynamic modelling of a greenhouse coupled with renewable energy technologies to obtain a hybrid renewable energy plant as an optimal solution in the green farm framework. The considered technologies are PV panels, solar thermal collectors, and a biomass auxiliary heater. The system is also coupled with a pyrogasiﬁer, supplied by wood and agricultural waste in the framework of a biocircular economic approach. To supply the investigated user, with a “green farm” located in Castelvolturno (Naples, South of Italy) reducing the energy consumption and operating costs, all of the main components of the plant were suitably designed. The operation of the designed components was simulated by a dynamic simulation model developed by TRNSYS software and validated by means of the literature results. A comprehensive energy, economic, and environmental analysis of the greenhouse is presented. The main results suggest that the investigated renewable plant reduces the total equivalent CO 2 emissions by 148.66 t/y. Considering the current high increases in energy prices as a result of the energy crisis due to the war, the system shows very signiﬁcant proﬁtability with a simple payback of only 1.7 years.


Introduction
Renewable energy sources (RES) [1] can be coupled with several energy systems to produce the heat or power needed for different plants in order to reduce the primary energy demand of the included components.RES systems may be integrated into agricultural waste conversion processes [2,3] to provide the energy required for the process and significantly reduce the energy conversion of the process.The exploitation of biomass as a renewable source is widely investigated in the literature [4].In fact, biomass can be used to produce biogas by means of the anaerobic digestion process [5], and the biogas may be upgraded into biomethane and injected into the gas grid [6].Furthermore, digestate is a by-product of the anaerobic digestion process which can be used as a fertilizer in agriculture [7].Agriculture biomass conversion is a pivotal solution for farmers considering that their agricultural activities can be modified in order to obtain energy-efficient plants [8].
In this framework, the waste-to-energy (WTE) approach is considered as a viable strategy for the management of waste considering that in comparison to other methods, this approach provides renewable energy outputs and end products [9].According to this strategy, by using low/negative-value organic waste, the production of renewable heat or power as well as fuel is possible.This allows for a minimal environmental impact to be made and also a significant decrease in organic waste volume [10].Implementing this paradigm, agricultural waste (or other sources of biomass) can be globally recognized as resources, more than simply waste, producing renewable outputs in an efficient manner.This environmental-friendly approach also implies a reduction in fossil fuel dependence [11].Thanks to agricultural waste conversion, it is possible to produce useful energy for specific users such as farms, single buildings, and groups of both.
However, for the efficient and economic use of agricultural waste for the production of energy vectors, clear guidelines and possible obstacles to be overcome in order to use agriculture biomass in the coming years [8] have to be identified.In particular, solar systems-namely, photovoltaic (PV) panels [12], solar thermal collectors (STC) [13], or PV/thermal (PVT) collectors [14]-can be absolutely coupled with greenhouse systems [15].This option seems very smart for the adoption of natural gas boilers and electricity from the national grid.For example, the installation of PV panels for power production [16] can easily be a sustainable energy source to supply water pumps for irrigation farming purposes; solar thermal collectors can be employed to provide heat for the heating system of greenhouses with the aim of maintaining the operating temperature of the greenhouse within the designed temperature range [17].For prediction and the increase in solar power plants, the tracking of solar power data can assist in determining the rate of performance loss in their systems.In addition, artificial intelligence is one strategy that has recently grown in popularity [18].
Several authors have investigated this issue.For example, a non-linear integrated controlled environment agriculture model was developed in order to define a correlation between several factors and the conditions of the crop being grown [19]: humidity and temperature control, the impact of weather disturbances, irrigation, and fertilization.The simulation results are related to a renewable-energy-powered semi-closed greenhouse situated in Ithaca, New York.Tomato growing was considered.The authors suggest that a model able to control the environment where the crops grow can be useful to increase the efficiency of renewable energy utilization from 4.7% to 127.5%.In the work of ref. [20], a mathematical model to simulate a greenhouse was developed and validated vs. experimental data.The equations regard four elements of the greenhouse, i.e., the inside air, cover, bare soil surface, and canopy surface.The model was used to simulate the operation of the research farm of Punjab Agricultural University, Ludhiana.The model solved using the Gauss-Seidel iteration method confirms good agreement with the measured data related to the winter operation for a tomato crop.A dynamic greenhouse environment simulator was developed in ref. [21] to predict, with different configurations, greenhouse dynamic behavior.The model was implemented in a web-based interactive application that allowed for the selection of the greenhouse design, operational strategies, and weather conditions (four seasons at four geographical locations).To forecast the hourly demand for heating the conventional greenhouse a quasi-steady state time-dependent thermal model was developed [22].The model considers the lumped estimation of the heat transfer parameters of the greenhouse.The model takes into account the indoor environmental control parameters of the greenhouse, the thermal and physical properties of crops, construction materials, and several hourly weather parameters, such as cloud cover, relative humidity, temperature, and wind speed.The heat gain from environmental control systems and the heat loss for plant evapotranspiration are further phenomena considered in this model.The authors highlight the importance of the environmental control systems to reduce the total heating requirements over the year by about 13-56%.A Chinese-style solar greenhouse for Canadian prairies modeled by a detailed TRNSYS model is presented in ref. [23].The model, that is used to predict the transient heating requirement of the greenhouse, was also validated by a new heating simulation model.The same model developed in ref. [23] was improved in ref. [24] and validated adopting the data collected from a solar greenhouse in Manitoba, Canada.The yearly simulation reveals that in the coldest month (January), the daily average heating could be twice as high (6.3MJ/m  The open literature regarding dynamic modelling and multi-source integration is very wide [25,26].In ref. [27], solar, geothermal, and biomass systems were integrated into a novel renewable trigeneration plant for the production of power, heat, and cool, respectively.In particular, a 193 m 2 PV, a 159 kWh lithium-ion battery, a 30 kWe organic Rankine cycle, a 350 kWth biomass auxiliary heater, a geothermal well at 96 • C, and a 80 kW single-stage H 2 O/LiBr absorption chiller were the included technologies in this plant.The model of the plant was applied to the case study, a residential building in Campi Flegrei (Naples, South Italy).A primary energy saving of 139% was achieved due to the excess energy delivered to the grid.The achieved payback period was about 19 years, mainly due to the high capital cost of the used technologies.A novel ultra-highly efficient solar power system combining concentrating photovoltaic/thermal (CPVT) solar collectors coupled with an organic Rankine cycle (ORC) was investigated in ref. [28].The CPVT collectors produced the power and heat used to supply the ORC unit.The solar field consists of a dish concentrator and a triple-junction PV layer, and it is equipped with a double axis tracking system.Both CPVT and ORC models are integrated in a more complex dynamic simulation model, developed in a TRNSYS environment.However, the results showed that the novel (ORC+CPVT) system produces only 6% more electrical energy than the system with only CPVT collectors.In ref. [29], two solar polygeneration plants designed to produce space heating and cooling energy, power, and fresh water are presented.These plants are designed for two small Mediterranean islands, the Favignana and Salina islands (South Italy).In the first layout, the CPVT collectors produced electric and thermal energy.The thermal energy supplies both a single-stage lithium bromide/water absorption chiller for cooling energy production and a multi-effect distillation unit for freshwater production.An auxiliary biomass-fired heater is also considered.In the second layout, a PV field was coupled with heat pumps for space heating, cooling, and domestic hot water production and a reverse osmosis unit for freshwater production.Both plants were modelled in a TRNSYS environment.In addition, in these models, the detailed estimation of the load of the buildings located on the islands was also determined using type 56 of TRNSYS.The best economic indexes were obtained for the layout using electricity-driven technologies, with a payback period of about 6 years.Evacuated flat-plate solar collectors and PV panels were integrated into two renewable polygeneration plants for the production of power, heat, and cool in ref. [30].In the first renewable polygeneration system, a 6 kWe organic Rankine cycle (ORC), a 17-kW single-stage H 2 O/LiBr absorption chiller, a geothermal well at 96 • C, a 200 kWt biomass auxiliary heater, a 45.55 kWh lithium-ion battery, and a 25 m 2 solar field were included.In the second layout, the solar thermal collectors were replaced by PV panels.A ground-cooled condenser was used to reduce the ORC condensation temperature.All of the included units were simulated in detail in a TRNSYS environment.The economic results showed that the layout with the PV panels and evacuated solar collectors obtained payback periods of 13 years and 15 years, respectively.CPVT collectors were used to match the heating and power demand of an anaerobic digestion plant supplied by the organic fraction of municipal solid waste by a dynamic simulation model in ref. [14].This plant also includes a biomass auxiliary heating system and an upgraded section for biomethane production.For such hybrid solar-biomass systems, a detailed model, which is able to calculate the time-dependent production of biomethane, was developed in MATLAB ® 2022a (Matrix Laboratory, MathWorks, Natick, MA, USA)and then integrated into the TRNSYS simulation model of the whole plant.The achieved primary energy saving was 24%, and a promising payback time of about 3 years was estimated.

Aims of the Work and Its Novelty
This work aims to increase renewable energy technology usage in the agricultural sector.With respect to the literature review, the work aims to show how hybrid renewable energy plants can be an optimal solution in the framework of the green farm and biocircular economy approach.In particular, even if in the current literature the dynamic simulation of a greenhouse has already been investigated [23], the previous paper did not include in its analysis the integration of the model of the greenhouse into a whole renewable energy plant, as occurs in the presented paper.In addition, in this work, a detailed economic analysis aimed at evaluating the profitability of the presented green farm is also presented.This analysis considers in detail the economic capital costs and maintenance costs of all of the components included in this renewable plant.The economic analysis also shows the effect of the current energy crisis on the spread of renewable energy technologies due to the sharp increase of energy prices.This aspect has never been investigated in the literature in the case of comprehensive dynamic simulations of renewable systems coupled with a greenhouse.The presented approach based on the dynamic simulation of a complex plant, including more different technologies, is very reliable and affordable for performing preliminary analysis and components design.In fact, the dynamic simulation allows us to mimic the real operating conditions of the plant, for example, the operating temperature of the greenhouse.This suggests a first and useful preliminary indication of the design phase.In fact, by knowing the operating temperature of the greenhouse during the year, the designer can indicate suitable vegetable species for such operating conditions.In addition, the simulation model can also be useful to optimize the operation of the plant according to a specific optimization function before the installation of the plant itself.
In order to address this aim, the following points were implemented: 1.
The development of a greenhouse dynamic simulation model in a TRNSYS environment 2.
The validation of the greenhouse dynamic simulation model by the literature values; 3.
The evaluation of the hourly energy demand of the greenhouse and the whole company to simulate the electrical and thermal loads of the company itself; 4.
The greenhouse model is integrated into a comprehensive dynamic simulation model, including several renewable technologies based on the use of biomass and solar sources (PV panels and solar thermal collectors); 5.
The preliminary design of all included components of the plant (the tank, solar PV field, solar thermal collectors, and pyrogisifier) in order to obtain a grid-independent system and reduce conventional fossil fuels' adoption; 6.
The development of a suitable energy, economic, and environmental model to evaluate the performance of the plant with respect to the conventional system based on a conventional natural gas boiler and national grid.
This paper was partially published in the Proceedings of the 12th International Conference on Smart Cities and Green ICT Systems-SMARTGREENS [31].

Method
In this section, the method adopted to develop this work will be described.Here, the greenhouse model and its validation vs. the literature data will be reported.Then, this model will be integrated into a comprehensive simulation model including the investigated renewable technologies according to the investigated layout (Figure 1).The section also includes some details of the modelling of the main components, such as the solar thermal collector and PV panel fields, and the main economic and energy indexes evaluated to perform the technoeconomic analysis.The flowchart of the adopted approach is reported in Figure 2.This follows the bullet list reported in the aim of the work subsection.

Layout
Figure 1 shows the layout investigated in this work.The polygeneration system proposed for the greenhouse integ field, a pyrogasification unit, a solar thermal collector field, and a biom The pyrogasifier is fed with the residuals of the agricultural crop duce both electricity for the user and heat for the greenhouse.Powe user also by means of solar PV panels which also provide electrici pumps.In addition, solar thermal collectors are adopted to provide mand for heating and domestic hot water by the user.Moreover, th means of the solar thermal collectors is used for the heating system of In case the heat produced is greater than the user and greenhouse de is used for storage purposes.Otherwise, in case of scarce solar radiat is switched off, or simply during night hours, an auxiliary biomass-f meeting the heating demands.The polygeneration system proposed the electric grid in case of scarce energy production with respect to th

Layout
Figure 1 shows the layout investigated in this work.The polygeneration system proposed for the greenhouse integrates a photovoltaic field, a pyrogasification unit, a solar thermal collector field, and a biomass auxiliary heater.
The pyrogasifier is fed with the residuals of the agricultural crops and wood to produce both electricity for the user and heat for the greenhouse.Power is supplied to the user also by means of solar PV panels which also provide electricity for the irrigation pumps.In addition, solar thermal collectors are adopted to provide heat to meet the demand for heating and domestic hot water by the user.Moreover, the heat produced by means of the solar thermal collectors is used for the heating system of the corn dryer unit.In case the heat produced is greater than the user and greenhouse demand, a water tank is used for storage purposes.Otherwise, in case of scarce solar radiation, the pyrogasifier is switched off, or simply during night hours, an auxiliary biomass-fed boiler is used for meeting the heating demands.The polygeneration system proposed is also connected to the electric grid in case of scarce energy production with respect to the user demand.

Model
The modelling of this plant was developed utilizing the well-known dynamic simulation software TRNSYS 18 (Transient System Simulation Tool, Solar Energy Laboratory, Univ. of Wisconsin-Madison, Madison, WI, USA).The software is based on a specific library of components, suitable to accurately simulate several energy units.The models of the TRNSYS components were validated and judged reliable [32].For the sake of shortness, the TRNSYS types used to simulate the components included in the plant are reported in Table 1.
TRNSYS software is very accurate for the estimation of the energy demand of buildings [33], and it can be considered a reliable tool for the validation of in-house building simulation models [34][35][36].However, its application can also be suitable for the simulation of greenhouses, as reported in ref. [23].The next subsection includes the description of the greenhouse model and its validation, the model of the PV field (Type 94) and the storage tank (Type 4), and the thermo-economic equations used to evaluate the plant's performance.For all the other components, a detailed explanation of the mathematical modelling is reported in ref. [32].Note that the simulation modelling steps included the following steps: (i) the development of the greenhouse model; (ii) the validation of the greenhouse model using the literature data; (iii) the integration of the greenhouse model into the whole multi-energy system plant model; and (iv) the development of a thermo-economic model and an environmental model for the evaluation of the performance of the proposed plant with respect to the reference plant.

Greenhouse Model
Type 56 was selected to model the greenhouse.By taking into account the 3D geometry of the building, defined in the Google SketchUp TRNSYS3d plug-in [37], type 56 determines the dynamic energy demand by considering both the effects of the weather conditions (i.e., solar radiation, ambient temperature, humidity, etc.) and the thermophysical proprieties of the envelope.Ventilation, infiltration, and internal heat gain were also simulated.In Figure 3, the greenhouse geometry investigated in this research is reported.In reference [38], the validation of type 56 is reported.Note that considering the radiative properties of the surfaces as a function of the wavelength, type 56 considers a detailed model for the radiation calculation in the greenhouse, considering a complex model for the view factors' calculation.The model calculates the temperature of the surfaces and the rad ted by the glazing surfaces and emitted by the surfaces.
Validation of the model of the greenhouse was carried out con The model calculates the temperature of the surfaces and the radiate flows transmitted by the glazing surfaces and emitted by the surfaces.
Validation of the model of the greenhouse was carried out considering the greenhouse model developed in TRNSYS according to ref. [23], where all of the assumptions to redevelop the model are reported.
In Figure 4, the monthly average daily heating requirement obtained both by ref.
[23] and our model are summarized.The model calculates the temperature of the surfaces and the radiate flows transmitted by the glazing surfaces and emitted by the surfaces.
Validation of the model of the greenhouse was carried out considering the greenhouse model developed in TRNSYS according to ref. [23], where all of the assumptions to redevelop the model are reported.
In Figure 4, the monthly average daily heating requirement obtained both by ref.
[23] and our model are summarized.

PV Panels Model
The "four parameters" model is used to simulate the PV panels' field.The four parameters in this model are: (i) IL,ref, the photocurrent of the module under the reference condition; (ii) Io,ref, the diode reverse saturation current under the reference condition; (iii) γ, the empirical PV curve-fitting parameter; and (iv) Rs the module series resistance.
The model assumes that the slope of the IV curve under the short-circuit condition is zero.The model assumes that the slope of the IV curve under the short-circuit condition is zero.
These parameters were calculated by type 94 from the manufacturer's data to obtain the IV curve for each time step.Assuming Rs and γ to be constant, the circuit currentvoltage equation is: where G T,ref is the reference solar irradiance, equal to 1000 W/m 2 , and G T is the total incident solar irradiance on the PV field.I o is the diode reverse saturation current, depending on temperature, according to Equation (3): To know I 0 , the PV current was calculated according to Newton's method.By means of an iterative routine, the current (I mpp ) and the voltage (V mpp ) at the point of maximum power along the IV curve were calculated.For handling the system, the following three equations, which are functions of I L,ref , I o,ref , and γ (and of the open-circuit, short circuit, and maximum power conditions), are obtained: (5) To determine the last unknown parameter, a further equation, i.e., the analytical derivate of voltage with respect to the temperature under the reference open-circuit condition, is needed: The manufacture's specification about the open-circuit temperature was equaled to this analytical value.A search routine was employed iteratively to calculate the equivalent open-circuit characteristics.

Storage Tank Model
According to the model implemented in TRNSYS type 4 [32], the tank was virtually divided into sub-volumes (N), where the fluid was considered fully mixed.In unsteady state conditions, the temperature T i is calculated by mass and energy balances, for each volume i, according to the following equation: where T h is the temperature of the fluid entering the tank from the heat source; T L is the temperature of the fluid replacing that extracted to supply the load.Note that α i is equal to 1 if the i-th sub-volume is the bottom volume of the tank; otherwise, it is 0. β i .In contrast, it is equal to 0 if the i-th sub-volume corresponds to the bottom of the tank; otherwise, it is 1.
To the right side of Equation ( 8), the following term has to be added: γ i is the control function defined by the following equation:

Thermo-Economic Model
The thermo-economic model is necessary to determine the environmental impact and the economic feasibility of the polygeneration system model proposed.The environmental analysis is based on the calculation of the primary energy saving (PES).This index is calculated as the percentage difference between the primary energy consumption in the proposed system (PS) with respect to a reference system (RS).In this case, the RS is the one in which the electricity demand is met by the grid and the thermal energy demand is met with a conventional gas boiler.The efficiency of these systems is 46% and 90% (η el,grid and η boiler ), respectively.

PES =
Together with primary energy consumption, the CO 2 equivalent emissions also need to be calculated.To do so, the electricity withdrawn from the grid and the primary energy consumed by the boiler were multiplied by their respective CO 2 emissions factors, shown in Table 4.
The equivalent CO 2 emissions difference was evaluated according to Equation ( 12): The economic analysis is instead based on the calculation of the yearly operating cost saving ∆C of the PS with respect to the RS.In this analysis, the unit purchasing cost of electricity from the grid c el,fromGRID and natural gas c NG , for the RS, and the purchasing/selling c el,toGRID of the electricity from/to the grid for PS, are considered.In the PS, the unit purchasing cost of the biomass c wood for the auxiliary wood-chip heater is also considered.c bio,pyr is the unit purchasing cost for the biomass (wood and agricultural crops) which feed the pyrogasifier.Moreover, the maintenance cost M was considered.
To calculate the payback time of the proposed solution, the capital costs were also considered.More details about this term are shown in the Case Study section.

Case Study
The model of the greenhouse was applied to a suitable case study located in Castelvolturno (Naples, South of Italy).The main features of the greenhouse are reported in Table 2.In Table 3, the design data of the proposed plant are also summarized.The plant is designed to produce the electricity for the buildings close to the greenhouse and the related irrigation pumps and to produce the thermal energy both for the greenhouse heating and the domestic hot water and space heating energy demand of the user.The thermo-economic and environmental assumptions for the analysis of the PS with respect to the RS are summarized in Table 4. Figure 5 reports the thermal energy demand of the greenhouse; Figure 6 reports the power and heat load of the user.It is clearly shown how the thermal energy demand is very high during the winter months due to the cold temperatures.Over 50% of all yearly heating demand is concentrated in the coldest winter months.The power load is mainly due to the irrigation pumps (with a rated power of 55 kW).Note the high peak value during the summer day, considering that the irrigation time range is wider in the summer days.In addition, electric con-

Results
In this section, the results of the dynamic simulations performed for one year of operation will be presented according to different time bases: hourly and yearly bases.In particular, the results of the energy, economic, and environmental analysis will also be reported when the PS is compared with the RS.In addition, an economic analysis will be presented considering the purchasing costs before and after the energy crisis.
Figure 7 shows the trends of temperature of greenhouse and outdoor air without the heating system.Note that heating of the greenhouse quickly occurs during the central hours of the day and that the greenhouse temperature follows same trend of the ambient temperature.The heating of the greenhouse occurs because the rays of the sun enter through the glass of the greenhouse, due to the particularly high transmission coefficients of the glass itsef.However, the infrared radiation emitted by the ground cannot be transmitted through some materials, such as glass, guaranteeing a higher temperature than the outdoor air temperature.It is clearly shown how the thermal energy demand is very high during the winter months due to the cold temperatures.Over 50% of all yearly heating demand is concentrated in the coldest winter months.The power load is mainly due to the irrigation pumps (with a rated power of 55 kW).Note the high peak value during the summer day, considering that the irrigation time range is wider in the summer days.In addition, electric consumption due to technologies and offices is negligible with respect to irrigation.The thermal flow rate during the winter day reaches the peak value of 14 kW at 8 a.m., higher than the summer one, considering that the winter thermal flow rate is due to the space heating, DHW purposes, and corn drying.

Results
In this section, the results of the dynamic simulations performed for one year of operation will be presented according to different time bases: hourly and yearly bases.In particular, the results of the energy, economic, and environmental analysis will also be reported when the PS is compared with the RS.In addition, an economic analysis will be presented considering the purchasing costs before and after the energy crisis.
Figure 7 shows the trends of temperature of greenhouse and outdoor air without the heating system.Note that heating of the greenhouse quickly occurs during the central hours of the day and that the greenhouse temperature follows the same trend of the ambient temperature.The heating of the greenhouse occurs because the rays of the sun enter through the glass of the greenhouse, due to the particularly high transmission coefficients of the glass itsef.However, the infrared radiation emitted by the ground cannot be transmitted through some materials, such as glass, guaranteeing a higher temperature than the outdoor air temperature.A heated greenhouse allows for an increase in the yield of the crop so that some crops can be cultivated even in the winter months.Conversely, in the case of greenhouses with heating systems, the trend of the thermal flow rates represented in Figure 8 can be observed.The heating demand of the greenhouse by the heating system occurs only if the greenhouse temperature is lower than 20 °C, mainly when radiation is absent or for cold ambient temperatures.During these hours, the thermal losses by the construction materials are high.Due to the transmitted solar radiation, the thermal energy demand is null from 11 a.m. to 4 p.m. because the greenhouse temperature is higher than 20 °C, although this was a winter day.In the central hours of the day, although the pyrogasifier is switched off to carry out the ordinary maintenance of the unit, the integrations are null due to high solar production.Simultaneously, the greenhouse heat demand decreases.During the night, the pyrogasifier is unable to cover the demand.Therefore, the boiler is needed.This integration increases in the early morning hours when the boiler has to heat the greenhouse and provide heat to the user due to the low solar thermal production, see Figure 9.A heated greenhouse allows for an increase in the yield of the crop so that some crops can be cultivated even in the winter months.Conversely, in the case of greenhouses with heating systems, the trend of the thermal flow rates represented in Figure 8 can be observed.The heating demand of the greenhouse by the heating system occurs only if the greenhouse temperature is lower than 20 • C, mainly when radiation is absent or for cold ambient temperatures.During these hours, the thermal losses by the construction materials are high.Due to the transmitted solar radiation, the thermal energy demand is null from 11 a.m. to 4 p.m. because the greenhouse temperature is higher than 20 • C, although this was a winter day.A heated greenhouse allows for an increase in the yield of the crop so tha can be cultivated even in the winter months.Conversely, in the case of gree heating systems, the trend of the thermal flow rates represented in Fig observed .The heating demand of the greenhouse by the heating system occu greenhouse temperature is lower than 20 °C, mainly when radiation is abse ambient temperatures.During these hours, the thermal losses by the materials are high.Due to the transmitted solar radiation, the thermal energ null from 11 a.m. to 4 p.m. because the greenhouse temperature is highe although this was a winter day.In the central hours of the day, although the pyrogasifier is switched off the ordinary maintenance of the unit, the integrations are null due t production.Simultaneously, the greenhouse heat demand decreases.Duri the pyrogasifier is unable to cover the demand.Therefore, the boiler is integration increases in the early morning hours when the boiler has greenhouse and provide heat to the user due to the low solar thermal pr Figure 9.In the central hours of the day, although the pyrogasifier is switched off to carry out the ordinary maintenance of the unit, the integrations are null due to high solar production.Simultaneously, the greenhouse heat demand decreases.During the night, the pyrogasifier is unable to cover the demand.Therefore, the boiler is needed.This integration increases in the early morning hours when the boiler has to heat the greenhouse and provide heat to the user due to the low solar thermal production, see Figure 9. Figures 10 and 11 report the powers of the electric loop without and with the pyrogasifier, respectively.As previously noted, the winter demand is clearly lower than the summer one due to the scarce use of irrigation pumps.PV production without a pyrogasifier guarantees very low integrations and particularly high excesses to the grid in the central hours.During the winter day, the production is almost higher than the demand.Without the pyrogasifier for a typical summer day, given the high consumption, excesses are null and important integrations were obtained.In this scenario, the plant appears to be undersized.
The power production of the pyrogasifier Is not dependent on the weather conditions and it is constant and significant (Figure 11).Both of the systems, the pyrogasifier and the PV panels, are able to reduce the integrations of electricity from the grid; although, the higher power demand in the summer season is due to the irrigation pumps than in the winter season.Note that during the central hours of the day, the pyrogasifier is switched off to carry out the ordinary maintenance of the unit, and the electricity is only provided by the PV panels.Note that the electricity is delivered to the grid mainly during the night and late afternoon hours.This mainly occurs because the irrigation pumps operate during the central hours, doubling the power consumption.
By considering the monthly electric energy ratio between the self-consumption energy and the electric demand (Figure 12), it was determined that in the colder months, this ratio was almost about 90%, while during the summer months, it decreased to 58% although there was higher PV production.This is due to the high summer demand being about 10 times higher than the winter one.From this point of view, the use of energy storage would be a useful solution to reduce the energy delivered to the grid mainly during the winter months.the powers of the electric loop without and with the pyrogasifier, respectively.As previously noted, the winter demand is clearly lower than the summer one due to the scarce use of irrigation pumps.PV production without a pyrogasifier guarantees very low integrations and particularly high excesses to the grid in the central hours.During the winter day, the production is almost higher than the demand.Without the pyrogasifier for a typical summer day, given the high consumption, excesses are null and important integrations were obtained.In this scenario, the plant appears to be undersized.Figure 11.The total power production of the PV panels and the pyrogasifier, the total power demand, and the power from/to the grid.The power production of the pyrogasifier Is not dependent on the weather conditions and it is constant and significant (Figure 11).Both of the systems, the pyrogasifier and the PV panels, are able to reduce the integrations of electricity from the grid; although, the higher power demand in the summer season is due to the irrigation pumps than in the winter season.Note that during the central hours of the day, the pyrogasifier is switched off to carry out the ordinary maintenance of the unit, and the electricity is only provided by the PV panels.Note that the electricity is delivered to the grid mainly during the night and late afternoon hours.This mainly occurs because the irrigation pumps operate during the central hours, doubling the power consumption.
By considering the monthly electric energy ratio between the self-consumption energy and the electric demand (Figure 12), it was determined that in the colder months, this ratio was almost about 90%, while during the summer months, it decreased to 58% although there was higher PV production.This is due to the high summer demand being about 10 times higher than the winter one.From this point of view, the use of energy storage would be a useful solution to reduce the energy delivered to the grid mainly during the winter months.The yearly results of the energy analysis are summarized in Figure 13 and Table 5.The electricity integration from the grid is about 35% of the total electric energy demand, whereas thermal self-consumption is 63% of the total thermal energy demand and 57% of the total production.The yearly results of the energy analysis are summarized in Figure 13 and Table 5.The electricity integration from the grid is about 35% of the total electric energy demand, whereas thermal self-consumption is 63% of the total thermal energy demand and 57% of the total production.Thermal integration is 37% of the total demand and the electric self-consumption is 65% of the total electric energy demand.The electric production of the solar field covers only 17% of the total electric energy production, a result that confirms the small size of the  Thermal integration is 37% of the total demand and the electric self-consumption is 65% of the total electric energy demand.The electric production of the solar field covers only 17% of the total electric energy production, a result that confirms the small size of the PV field with respect to the pyrogasifier.
The proposed system acquires a reduction of 149 t/y (Table 5).The primary energy saving of 121% is due to the high amount of electric energy delivered to the grid, equal to 55% of the total electricity production.During the winter months, due to the lower electric energy demand when the irrigation pumps operate for only few hours per day, the electric self-consumption with respect to the demand reaches a high value, also 90%.Therefore, the excess of electricity reduces during the summer months although there is higher PV production.Considering the increase in the purchasing costs before and after the energy crisis, EUR 0.70 vs. EUR 1.58/Sm 3 for natural gas and EUR 0.19 vs. EUR 0.66/kWh, the economic indexes, reported in Table 6, clearly improve, with a simple payback period, decreasing from 6.7 to 1.7 years.

Conclusions
This work proposed a dynamic simulation model of a polygeneration system based on solar thermal collectors and biomasses to meet the energy demand of a farm including a residential user and a greenhouse.To analyze the performance of the system, an economic, environmental, and energy analysis of the polygeneration system was also proposed.This renewable-based polygeneration system integrates photovoltaic panels, solar thermal collectors, a biomass-fed pyrogasifier, and a biomass auxiliary boiler.Therefore, dynamic and thermo-economic analyses are fundamental to observe the dynamic matching of renewable energy produced with the users demand and to assess the economic feasibility of the solution proposed.
To this scope, the model was developed in a TRNSYS environment, where a detailed model for the greenhouse was integrated.The greenhouse model was validated against data available from research works in the literature to accurately evaluate the power and heating demands of the greenhouse.The model was applied to a case study in Castelvolturno (Naples, South of Italy) where a greenhouse with a total heating demand of 246 MWh/year was considered.In addition to the greenhouse, a domestic user was considered, leading to an overall heating and power demand by the end user of 289 MWh/year and 122 MWh/year, respectively.The main results of the work can be summarized as follows:

Figure 2 .
Figure 2. Flowchart of the proposed approach.

Figure 2 .
Figure 2. Flowchart of the proposed approach.

Figure 3 .
Figure 3. Geometric model of the investigated greenhouse.

Figure 3 .
Figure 3. Geometric model of the investigated greenhouse.

Figure 3 .
Figure 3. Geometric model of the investigated greenhouse.

Figure 4 .
Figure 4. Model validation.2.2.2.PV Panels ModelThe "four parameters" model is used to simulate the PV panels' field.The four parameters in this model are: (i) I L,ref , the photocurrent of the module under the reference condition; (ii) I o,ref , the diode reverse saturation current under the reference condition; (iii) γ, the empirical PV curve-fitting parameter; and (iv) R s the module series resistance.The model assumes that the slope of the IV curve under the short-circuit condition is zero.dI dV v=0 = 0 (1)

Figure 5 .
Figure 5. Thermal energy demand of the greenhouse.

Figure 6 .
Figure 6.The heat (space heating and DHW) and power demand of the user (irrigation and offices' demand).

Figure 6 .
Figure 6.The heat (space heating and DHW) and power demand of the user (irrigation and offices' demand).

Figure 7 .
Figure 7. Temperature difference between the greenhouse and the outdoor air.

Figure 8 .
Figure 8.The transmitted solar radiation, thermal losses, and heating demand of the greenhouse.

Figure 7 .
Figure 7. Temperature difference between the greenhouse and the outdoor air.

Figure 7 .
Figure 7. Temperature difference between the greenhouse and the outdoor air.

Figure 8 .
Figure 8.The transmitted solar radiation, thermal losses, and heating demand of the

Figure 8 .
Figure 8.The transmitted solar radiation, thermal losses, and heating demand of the greenhouse.

Figure 9 .
Figure 9. Thermal flow rate: greenhouse heating demand and biomass auxiliary production and the pyrogasifier.

Figure 9 .
Figure 9. Thermal flow rate: greenhouse heating demand and biomass auxiliary production and the pyrogasifier.

Figures 10 and 11
Figures 10 and 11 report the powers of the electric loop without and with the pyrogasifier, respectively.As previously noted, the winter demand is clearly lower than the summer one due to the scarce use of irrigation pumps.PV production without a pyrogasifier guarantees very low integrations and particularly high excesses to the grid in the central hours.During the winter day, the production is almost higher than the demand.Without the pyrogasifier for a typical summer day, given the high consumption, excesses are null and important integrations were obtained.In this scenario, the plant appears to be undersized.
Figures 10 and 11 report the powers of the electric loop without and with the pyrogasifier, respectively.As previously noted, the winter demand is clearly lower than the summer one due to the scarce use of irrigation pumps.PV production without a pyrogasifier guarantees very low integrations and particularly high excesses to the grid in the central hours.During the winter day, the production is almost higher than the demand.Without the pyrogasifier for a typical summer day, given the high consumption, excesses are null and important integrations were obtained.In this scenario, the plant appears to be undersized.

Figure 10 .
Figure 10.Power production of the PV panels, the total power demand, and power from/to the grid.

Figure 10 . 19 Figure 10 .
Figure 10.Power production of the PV panels, the total power demand, and power from/to the grid.

Figure 11 .Figure 11 .
Figure11.The total power production of the PV panels and the pyrogasifier, the total power demand, and the power from/to the grid.

Figure 10 .
Figure 10.Power production of the PV panels, the total power demand, and power from/to the grid.

Figure 11 .
Figure11.The total power production of the PV panels and the pyrogasifier, the total power demand, and the power from/to the grid.

Figure 12 .
Figure 12.Monthly self-consumption of electric energy.

Figure 12 .
Figure 12.Monthly self-consumption of electric energy.

Figure 13 .
Figure 13.Yearly energy results. 2 •day) as the value obtained in a mild month such as March (3.4 MJ/m 2 •day).Comparing this solar greenhouse with a traditional, local one, the heating cost is approximately 55% lower.

Table 3 .
Design data of the proposed plant.

Table 4 .
Thermo-economic and environmental parameters.
Figure 5. Thermal energy demand of the greenhouse.

Table 5 .
Yearly energy and environmental results.