Clean Energy Based Multigeneration System for Sustainable Cities: Thermodynamic, and Stability Analyses

This paper concerns the development and analysis of multigeneration systems based on hybrid sources such as biomass and wind. Industry requires different types of sources to provide several outputs, so the goal of this research was to fulfill the industrial requirement with optimization. The multigeneration cycle supplies enough power to satiate energy demands, i.e., power, cooling, hydrogen, air conditioning, freshwater, hot water, and heating. For this, the multigeneration cycle was modeled in the Engineering Equation Solver (EES) and Simulink to obtain optimized results for the industry. Energy and exergy for the multigeneration cycle were determined to assess the performance of the cycle and to investigate the optimized results for the overall system. This study shows that for configuration selection and design, different thermodynamic, economic, and environmental aspects should be considered. Based on the results, the selection of the best location for this multigeneration system was made. Power output from the wind turbine was around 7 MW and from biogas 0.6 MW. The overall exergy efficiency of the multigeneration system was found to be 0.1401.


Introduction
Energy is an important part of national development and with the advancement of time, it is becoming a more important requirement. People are now looking for many new ways to increase energy production, and with fossil fuels decreasing day by day, renewable energy is becoming a better option going forward. Being the only means of clean, green, and infinite energy, renewable energy mainly has solar, wind, biomass, geothermal, and hydro as the main sources [1]. A multigeneration energy system is used to utilize more than three sources. A multigeneration energy system provides higher efficiency than the combined equal and separate units. When a multigeneration system uses renewable energy, it combines clean and green energy with higher efficiency. In addition, it also supplies different needs of the public unit such as the neighborhood. Using an energybased multigeneration system, it has been analyzed that exergy efficiency varies from 55% to 65% depending on the amount of cogeneration used. Murat Ozturk et al. [2] showed that, through the integration of various systems, multigeneration increases energy and exergy efficiencies. Furthermore, it has been determined that, due to renewable energy-based multigeneration, the fuel price decreases, as well as harmful pollutant emissions, compared to conventional systems [3].
The objectives of this paper include first proposing and assessing a new integrated multigeneration system using biomass and wind energy with energy and exergy analyses, number of blades, and power rating. This paper used a wind turbine of a horizontal-axis type, having three blades and a power output of 0.56 MW [21]. Extended energy, exergy, and economic analyses of a wind turbine were presented in another study and the maximum exergy efficiency was 10.8%. The exergy analysis of a CHP system integrated with wind turbines was presented by Mohammadi et al. [22], and the operating parameters of a hybrid wind-hydrogen system were analyzed energetically and exegetically by Fakehi et al. [23].
Integration of a wind generation system and electrical system development are associated with both benefits and costs. Compromise has been made either in cost or benefit. For example, wind generation required more investment than that of conventional gas or coal plants. Whereas the energy generation from wind saves fuel consumption hence reducing the cost of system operation.
There are some issues related to the integration of wind power into a system. Although the energy produced by a large conventional plant may be displaced by that of wind generation, concerns over system operation costs are focused on whether wind generation will be able to replace the capacity and flexibility of conventional generation plants. Moreover, another important factor is the location of these new sources in assessing the impacts on the transmission and distribution network infrastructure. Wind turbines generally cannot provide a range of system support services (e.g., voltage and frequency regulation) that are provided by thermal and hydro plants.
Wind cannot be considered the sole power generator. It is necessary to retain a portion of conventional plants for backup or to ensure security, especially under conditions of high demand and low wind. This concludes that wind power is variable and not easy to predict, various forms of additional reserves will need to be introduced to maintain a constant balance between supply and demand. So, a conventional generation system cannot be displaced by a wind generation system.
All these studies conclude that a wind energy integrated system is feasible and enhances the performance of the system. The main challenge in this comprehensive system is that most research has been presented on the steady-state condition which gives no insight into the performance of the system while the thermodynamic analysis of wind and biomass for a comprehensive energy system has also been limited. So, the gap can be bridged by developing a novelty for this system. The system will be analyzed in steady-state and time-based conditions and assessing the system by using the Engineering Equation Solver (EES) computer program and Simulink.

Developing a Schematic Diagram
For this study, a multigeneration cycle had to be designed to provide power, cooling, heating, freshwater, hydrogen gas, desalinated water, and conditioned air as an output. Multigeneration had to be powered using biogas generated from cow manure as well as wind turbine power. The main aim of this study was to develop a model of the multigeneration cycle using the EES and Simulink for thermodynamic analysis. Finally, the model developed had to be tuned to obtain a steady state for the cycles of the multigeneration system. Figure 1 shows the system which utilizes wind as a primary source and biomass as a secondary source. The system produces power, cooling, heating, fresh water, hydrogen, hot water, and conditioned air as its output. The components used in this system include generator, compressor, condenser, pump, turbine, expansion valve, electrolyser, evaporator, boiler, heat exchanger, desalination plant, water treatment plant, heat pump, air-conditioning, and refrigeration cycles. Schematic is labelled with total of 31 different states points for which the working fluid or substance for which pressure, temperature, internal energy, enthalpy and entropy had to be determined. All these components work in a flow system to produce the desired output. The schematic of this system is illustrated in Figure 1. points for which the working fluid or substance for which pressure, temperature, internal energy, enthalpy and entropy had to be determined. All these components work in a flow system to produce the desired output. The schematic of this system is illustrated in Figure  1. The atmospheric conditions are 28 °C and 101 KPa. Wind velocity is 8 m/s having a power of 1.293 × 10 6 used to drive the wind turbine that ultimately drives the generator. The wind turbine gives a power output of 1.033 × 10 7 and this power output is used to produce electricity only. The electrolysis process is performed by using heat from the generator to produce H2 and O2. The remaining heat of the generator is used to drive the vapor compression cycle. The working fluid used in the vapor compression cycle is R410, the compressor operates at 80.83 °C, the condenser operates at 27 °C, expansion valve, and the evaporator operates at −44.84 °C. The vapor compression cycle gives cooling as an output. The heat released by the condenser is absorbed by the heat exchanger. The heat exchanger provides water with the heat to initially increase its temperature to 30 °C. The heat exchangers used for this multigeneration system are parallel flow heat exchangers. This heat is utilized by the boiler. The boiler obtains two sources of heat, one from the heat exchanger and the other from biomass. The desalination plant utilizes the steam of the boiler to give fresh water and brine. Thermal desalination is performed using the boiler. Both The atmospheric conditions are 28 • C and 101 KPa. Wind velocity is 8 m/s having a power of 1.293 × 10 6 used to drive the wind turbine that ultimately drives the generator. The wind turbine gives a power output of 1.033 × 10 7 and this power output is used to produce electricity only. The electrolysis process is performed by using heat from the generator to produce H 2 and O 2 . The remaining heat of the generator is used to drive the vapor compression cycle. The working fluid used in the vapor compression cycle is R410, the compressor operates at 80.83 • C, the condenser operates at 27 • C, expansion valve, and the evaporator operates at −44.84 • C. The vapor compression cycle gives cooling as an output. The heat released by the condenser is absorbed by the heat exchanger. The heat exchanger provides water with the heat to initially increase its temperature to 30 • C. The heat exchangers used for this multigeneration system are parallel flow heat exchangers. This heat is utilized by the boiler. The boiler obtains two sources of heat, one from the heat exchanger and the other from biomass. The desalination plant utilizes the steam of the boiler to give fresh water and brine. Thermal desalination is performed using the boiler. Both the boiler and condenser operate at an atmospheric pressure of 101.325 KPa. Water enters the boiler at around 30 • C and leaves as steam. It is then condensed to around room temperature. The temperatures of fresh water and brine are 27 • C and 25 • C.
The heat released by the condenser of the air conditioning cycle is absorbed by the evaporator. The operating temperature of the evaporator is 21.5 • C. The evaporator is also connected to the compressor. Then, the expansion valve opens and the heat pump produces heat. The heat pump then provides the output heat that is used for heating. The compressor of the air-conditioning cycle obtains heat from the wind turbine generator. The air conditioning cycle provides the conditioned air that is used for space heating.
Biomass is used as a fuel for the generator to produce power. The operating condition of the generator is 30 • C. This power is used by the boiler to produce steam. The system heat exchanger absorbs heat from the boiler and gives that heat to the condenser. The condenser obtains cold water from one of its inlets and water leaves as hot water from one of the outlets. After the condensation of steam, treated water is obtained from the system. Treated and hot water are obtained at temperatures of 30 • C and 25 • C respectively. Above all the processes work in rhythm to produce the desired output.
For this multigeneration cycle, several parameters were required. Most of the parameters required were operating intensive properties for the cycle or constraints for the power generation such as wind and biogas. Table 1 shows the parameters required to analyze the whole multigeneration cycle. In the air condition cycle, as shown in Figure 2, analysis was carried out based on the application of the first-order transfer function on different mass values with pressure ranging from 0.2 MPa to 1 MPa. Using the thermostat, the mass flow was controlled by integrating the thermostat between the condenser outlet and the evaporator inlet. The mass flow rate was calculated by using Qin and thus it could be determined how much mass flow rate could be allowed for the conditioning of air.
In the air condition cycle, as shown in Figure 2, analysis was carried out based on the application of the first-order transfer function on different mass values with pressure ranging from 0.2 MPa to 1 MPa. Using the thermostat, the mass flow was controlled by integrating the thermostat between the condenser outlet and the evaporator inlet. The mass flow rate was calculated by using Q in and thus it could be determined how much mass flow rate could be allowed for the conditioning of air. In the refrigeration process, as shown in Figure 3, the same was conducted based on the application of the first-order transfer function on different mass values with pressure ranging from 0.14 MPa to 0.8 MPa. Using the thermostat, the mass flow was controlled by integrating the thermostat between the condenser outlet and the evaporator inlet. The same method was applied to find the mass flow rate which is by calculation of the Qin of the evaporator and then controlling the mass flow of the refrigerant to obtain the desired cooling. In the refrigeration process, as shown in Figure 3, the same was conducted based on the application of the first-order transfer function on different mass values with pressure ranging from 0.14 MPa to 0.8 MPa. Using the thermostat, the mass flow was controlled by integrating the thermostat between the condenser outlet and the evaporator inlet. The same method was applied to find the mass flow rate which is by calculation of the Qin of the evaporator and then controlling the mass flow of the refrigerant to obtain the desired cooling.  Almost the same method was applied to the heat pump as shown in Figure 4. Coolprop library was used, and the first order transfer function performed on different mass values: pressure ranges from 0.14 MPa and 0.8 Mpa in the heat pumping also. A thermostat was integrated between the condenser and evaporator, but the only difference observed here is that the useful heat is at the condenser. This heat is used to determine the mass and then it can be varied by changing the mass flow. Almost the same method was applied to the heat pump as shown in Figure 4. Coolprop library was used, and the first order transfer function performed on different mass values: pressure ranges from 0.14 MPa and 0.8 Mpa in the heat pumping also. A thermostat was integrated between the condenser and evaporator, but the only difference observed here is that the useful heat is at the condenser. This heat is used to determine the mass and then it can be varied by changing the mass flow. Almost the same method was applied to the heat pump as shown in Figure 4. Coolprop library was used, and the first order transfer function performed on different mass values: pressure ranges from 0.14 MPa and 0.8 Mpa in the heat pumping also. A thermostat was integrated between the condenser and evaporator, but the only difference observed here is that the useful heat is at the condenser. This heat is used to determine the mass and then it can be varied by changing the mass flow. Electrolysis requires the second-order transfer function because it depends on two variables which are the battery response and the hydrogen production rate as shown in Figure 5. When the power is supplied, electrolysis provides the current based on the given power. This current then determines the amount of oxygen and hydrogen produced. So, the production can be varied depending on the two variables that are changed to obtain the best output. Electrolysis requires the second-order transfer function because it depends on two variables which are the battery response and the hydrogen production rate as shown in Figure 5. When the power is supplied, electrolysis provides the current based on the given power. This current then determines the amount of oxygen and hydrogen produced. So, the production can be varied depending on the two variables that are changed to obtain the best output. As in Figure 6 the desalination system is based on the third-order transfer function because it has three different processes which are boiling, condensation, and storage. Output is the treated water against the given power; the water is first boiled which releases brine and steam and then the water vapor is condensed and stored in the collector.  Figure 7 for the multigeneration system, two renewable energy systems were used, namely wind and biogas. The Betz law and kinetic energy conversion to electrical energy were used to determine total power generation for wind. Biogas energy production was modeled using the estimated power which could be generated from cow manure in a single day. Since the system does not contain major variables which vary with respect  Figure 6 the desalination system is based on the third-order transfer function because it has three different processes which are boiling, condensation, and storage. Output is the treated water against the given power; the water is first boiled which releases brine and steam and then the water vapor is condensed and stored in the collector. As in Figure 6 the desalination system is based on the third-order transfer function because it has three different processes which are boiling, condensation, and storage. Output is the treated water against the given power; the water is first boiled which releases brine and steam and then the water vapor is condensed and stored in the collector.  Figure 7 for the multigeneration system, two renewable energy systems were used, namely wind and biogas. The Betz law and kinetic energy conversion to electrical energy were used to determine total power generation for wind. Biogas energy production was modeled using the estimated power which could be generated from cow manure in a single day. Since the system does not contain major variables which vary with respect to time, for multigeneration sources modeling a zero-order system was assumed.  Figure 7 for the multigeneration system, two renewable energy systems were used, namely wind and biogas. The Betz law and kinetic energy conversion to electrical energy were used to determine total power generation for wind. Biogas energy production was modeled using the estimated power which could be generated from cow manure in a single day. Since the system does not contain major variables which vary with respect to time, for multigeneration sources modeling a zero-order system was assumed.  Figure 7 for the multigeneration system, two renewable energy systems were used, namely wind and biogas. The Betz law and kinetic energy conversion to electrical energy were used to determine total power generation for wind. Biogas energy production was modeled using the estimated power which could be generated from cow manure in a single day. Since the system does not contain major variables which vary with respect to time, for multigeneration sources modeling a zero-order system was assumed.  Figure 8 the hot water system is modeled with respect to time. The mass flow rate cannot be assumed to be zero if the mass flow rate is assumed to approximate zero or the slightest change of heat will result in temperature gain which is greater than zero  Figure 8 the hot water system is modeled with respect to time. The mass flow rate cannot be assumed to be zero if the mass flow rate is assumed to approximate zero or the slightest change of heat will result in temperature gain which is greater than zero which results in negative exergy destruction. Exergy destruction can never be negative so modeling steady-state response will result in unreasonable results. which results in negative exergy destruction. Exergy destruction can never be negative so modeling steady-state response will result in unreasonable results.

Approach to Analysis
Exergy can be found by determining the entropy generated between each component of the gas turbine. Exergy destroyed Xdes is found by multiplying the entropy generated with the outside temperature and exergy destruction can be determined. Where QH is heat gained, QL is heat released, TH and TL are the temperatures at the hot and cold source respectively from initial i to final state f as in Equations (1) Exergetic efficiency can be found using Equation (4) II, Pelec showed the power transferred to carry out electrolysis as shown in Equation (5) where the current is produced. For the electrolysis, hydrogen and oxygen were produced

Approach to Analysis
Exergy can be found by determining the entropy generated between each component of the gas turbine. Exergy destroyed X des is found by multiplying the entropy generated with the outside temperature and exergy destruction can be determined. Where Q H is heat gained, Q L is heat released, T H and T L are the temperatures at the hot and cold source respectively from initial i to final state f as in Equations (1) . .
Pelec showed the power transferred to carry out electrolysis as shown in Equation (5) where the current is produced. For the electrolysis, hydrogen and oxygen were produced by consuming the power generated by the generator. Where the amount of the current produced, fo is faraday's constant. The equations used for the mass flow rate production of the hydrogen mh 2 and oxygen mo 2 gas are as follows: P wind is the maximum expected power generated from the wind turbine in Equation (8) while u is the collective efficiency of the wind turbine. Multiplying P wind with the collective efficiency and Bentz's efficiency P output is determined in Equation (10) which is the actual power consumed.
Applying the approach for energy calculation for small-scale biogas production Equations (11)-(16) are used to determine the estimated amount of energy that could be extracted from the cow's manure [25].
Total volatile solid = Volatile solid cow · totalcows (12) G = Yield f actor·S· Digestor vol 1000 (15) Energy prod,days = 22.08·G (16) According to the first law of thermodynamics energy balance, the equation has to be applied as in Equation (17). Ein represents the energy input while E out represents the energy output: Equations (18) and (19) represent the coefficient of performance for the refrigeration cycle and heat pump cycle:

Results
After conducting a literature review, and assuming parameters for the energy sources to power the multigeneration cycle; the multigeneration cycle was designed. It was powered by two sources wind and biogas. This cycle can produce hydrogen, provides desalinated water, treated water, and hot water for residential areas, while operating the refrigerators, air conditioner, and heat pump. The vapor compression cycle is used to operate the refrigeration cycle, air conditioning, and heat pump cycle. Single stage desalination is performed using a boiler operated by biogas energy, another boiler that receives heat input from the biogas is used to treat water and supply hot water to residential areas. Electrolysis produces hydrogen and oxygen gas which can be used for treating metals, processing food, refinement of petroleum, and as fuel. Figure 9 shows the relationship between the velocity of air and wind power in the wind cycle using the blue line. With increasing velocity of air, the wind power also increases. For an increase in velocity of air from 4 m/s to 8 m/s the wind power increases from 0 W to 11 MW. The relation can be observed as power increases at an increasing rate since the power output is proportional to the cube of velocity. Most of the power generated from the wind turbine is consumed in electrolysis at around 70%. The remainder is used to power the air conditioning cycle, refrigeration cycle, and heat pump cycle.  Figure 10 shows the relationship between the number of cows on a farm and bioga heat generation using the blue line. On increasing the number of cows on the farm, bioga heat generation also increases. For an increase in the number of cows from 50 to 300 th biogas heat generation increase from 0.1 MW to 0.7 MW. Biogas is used to provide hea input to boilers at the single-stage desalination and water treatment plant.  Figure 11 shows the relationship between the velocity of the air and the exerget efficiency of the air-conditioning cycle, heat pump, refrigeration cycle, and overall ex ergetic efficiency. It is seen that on increasing the velocity of the air that the exergetic effi  Figure 10 shows the relationship between the number of cows on a farm and biogas heat generation using the blue line. On increasing the number of cows on the farm, biogas heat generation also increases. For an increase in the number of cows from 50 to 300 the biogas heat generation increase from 0.1 MW to 0.7 MW. Biogas is used to provide heat input to boilers at the single-stage desalination and water treatment plant.  Figure 10 shows the relationship between the number of cows on a farm and bioga heat generation using the blue line. On increasing the number of cows on the farm, bioga heat generation also increases. For an increase in the number of cows from 50 to 300 th biogas heat generation increase from 0.1 MW to 0.7 MW. Biogas is used to provide hea input to boilers at the single-stage desalination and water treatment plant.  Figure 11 shows the relationship between the velocity of the air and the exergeti efficiency of the air-conditioning cycle, heat pump, refrigeration cycle, and overall ex ergetic efficiency. It is seen that on increasing the velocity of the air that the exergetic effi ciency of the air-conditioning cycle, heat pump, and refrigeration cycle decreases, wherea  Figure 11 shows the relationship between the velocity of the air and the exergetic efficiency of the air-conditioning cycle, heat pump, refrigeration cycle, and overall exergetic efficiency. It is seen that on increasing the velocity of the air that the exergetic efficiency of the air-conditioning cycle, heat pump, and refrigeration cycle decreases, whereas the overall exergy remains the same. For an increase in the velocity of air from 6 m/s to 8 m/s, the exergetic efficiency varies between 0 to 1.
Membranes 2023, 13, x FOR PEER REVIEW 12 of 19 Figure 11. Effect of the velocity of the air on exergetic efficiency of the air-conditioning cycle, heat pump, refrigeration cycle, and overall exergetic efficiency. Figure 12 shows the relationship between the number of cows on the farm and the exergetic efficiency of the desalination plant, water treatment plant, and overall exergetic efficiency. It can be seen that on increasing the number of cows on the farm from 50 to 120 the overall exergy decreases but later it increases from 120 to 300 and there are two sources which are being powered; one is the desalination plant and the other is the water treatment plant. Overall exergy follows the same trend as for desalination and water treatment. In this case the velocity of the air is kept constant which results in none of the vapor compression cycle varying.  Figure 13 shows the relationship between the velocity of air and the COP of the airconditioning cycle, heat pump, and refrigeration cycle. It can be seen that on increasing the velocity of the air the COP of the air-conditioning cycle, heat pump, and refrigeration cycle decreases. For an increase in the velocity of air from 6 m/s to 8 m/s, the COP decreases from 8 to 1.   Figure 11. Effect of the velocity of the air on exergetic efficiency of the air-conditioning cycle, heat pump, refrigeration cycle, and overall exergetic efficiency. Figure 12 shows the relationship between the number of cows on the farm and the exergetic efficiency of the desalination plant, water treatment plant, and overall exergetic efficiency. It can be seen that on increasing the number of cows on the farm from 50 to 120 the overall exergy decreases but later it increases from 120 to 300 and there are two sources which are being powered; one is the desalination plant and the other is the water treatment plant. Overall exergy follows the same trend as for desalination and water treatment. In this case the velocity of the air is kept constant which results in none of the vapor compression cycle varying.
Membranes 2023, 13, x FOR PEER REVIEW 12 of 1 Figure 11. Effect of the velocity of the air on exergetic efficiency of the air-conditioning cycle, he pump, refrigeration cycle, and overall exergetic efficiency. Figure 12 shows the relationship between the number of cows on the farm and th exergetic efficiency of the desalination plant, water treatment plant, and overall exerget efficiency. It can be seen that on increasing the number of cows on the farm from 50 to 12 the overall exergy decreases but later it increases from 120 to 300 and there are two source which are being powered; one is the desalination plant and the other is the water trea ment plant. Overall exergy follows the same trend as for desalination and water treatmen In this case the velocity of the air is kept constant which results in none of the vapor com pression cycle varying.  Figure 13 shows the relationship between the velocity of air and the COP of the ai conditioning cycle, heat pump, and refrigeration cycle. It can be seen that on increasin the velocity of the air the COP of the air-conditioning cycle, heat pump, and refrigeratio   Figure 12. Effect of number of cows on exergetic efficiency of the desalination plant, water-treatment plant, and overall exergetic efficiency. Figure 13 shows the relationship between the velocity of air and the COP of the airconditioning cycle, heat pump, and refrigeration cycle. It can be seen that on increasing the velocity of the air the COP of the air-conditioning cycle, heat pump, and refrigeration cycle decreases. For an increase in the velocity of air from 6 m/s to 8 m/s, the COP decreases from 8 to 1.
Membranes 2023, 13, x FOR PEER REVIEW Figure 13. Effect of the velocity of the air on COP of heat pump, refrigeration cycle, and a tioning cycle. Figure 14 shows the relationship between the current and mass flow rate o gen. Most of the power supplied by the wind turbine is consumed for hydrogen tion, hence the maximum current is produced; the voltage is kept constant at 2 V electrolysis process. It can be observed that with increasing the current the mass fl of hydrogen increases. For an increase in current from 0 A to 50 A the mass flow hydrogen increases from 0 to 1.3 × 10 −7 kg/s black line. The mass flow rate of oxy increases from 0 to 2.5 × 10 −8 kg/s green line.  Figure 15 shows the relationship between the number of cows on the farm desalinated water flow rate. It can be seen that with increasing the number of cow farm the desalinated water flow rate also increases. For an increase in the number 6 6.5   Figure 13. Effect of the velocity of the air on COP of heat pump, refrigeration cycle, and airconditioning cycle. Figure 14 shows the relationship between the current and mass flow rate of hydrogen. Most of the power supplied by the wind turbine is consumed for hydrogen production, hence the maximum current is produced; the voltage is kept constant at 2 V for the electrolysis process. It can be observed that with increasing the current the mass flow rate of hydrogen increases. For an increase in current from 0 A to 50 A the mass flow rate of hydrogen increases from 0 to 1.3 × 10 −7 kg/s black line. The mass flow rate of oxygen also increases from 0 to 2.5 × 10 −8 kg/s green line.
Membranes 2023, 13, x FOR PEER REVIEW Figure 13. Effect of the velocity of the air on COP of heat pump, refrigeration cycle, and a tioning cycle. Figure 14 shows the relationship between the current and mass flow rate o gen. Most of the power supplied by the wind turbine is consumed for hydrogen tion, hence the maximum current is produced; the voltage is kept constant at 2 V electrolysis process. It can be observed that with increasing the current the mass fl of hydrogen increases. For an increase in current from 0 A to 50 A the mass flow hydrogen increases from 0 to 1.3 × 10 −7 kg/s black line. The mass flow rate of oxy increases from 0 to 2.5 × 10 −8 kg/s green line.  Figure 15 shows the relationship between the number of cows on the farm desalinated water flow rate. It can be seen that with increasing the number of cow farm the desalinated water flow rate also increases. For an increase in the number on a farm from 50 to 300 the desalinated water flow rate increases from 20 kg/s to 1 6 6.5   Figure 14. Effect of current on the mass flow rate of hydrogen. Figure 15 shows the relationship between the number of cows on the farm and the desalinated water flow rate. It can be seen that with increasing the number of cows on the farm the desalinated water flow rate also increases. For an increase in the number of cows on a farm from 50 to 300 the desalinated water flow rate increases from 20 kg/s to 160 kg/s.   The root locus method was used to study the stability of the system. If for a b input, there is bounded output then the system is said to be stable. If all the pol

Exergetic Efficency
Exergetic Efficency Airconditioner Heatpump Electrolysis Water treatment Desalination Refigeration cycle Overall efficency    The root locus method was used to study the stability of the system. If for a bounded input, there is bounded output then the system is said to be stable. If all the poles lie on the right-hand side of the poles zero graphs, then the system is stable. If even a single pole lies on the left-hand side of the graph the system is said to be unstable. Root locus varies the gain of the system and plots the poles zero graphs; it allows the user to analyze and identify the parameters of the control system within which the system should be operated.

Exergetic Efficency
Exergetic Efficency Airconditioner Heatpump Electrolysis Water treatment Desalination Refigeration cycle Overall efficency The root locus method was used to study the stability of the system. If for a bounded input, there is bounded output then the system is said to be stable. If all the poles lie on the right-hand side of the poles zero graphs, then the system is stable. If even a single pole lies on the left-hand side of the graph the system is said to be unstable. Root locus varies the gain of the system and plots the poles zero graphs; it allows the user to analyze and identify the parameters of the control system within which the system should be operated. A transfer function could be either a first-order system, second-order system, or at maximum a third order system for the multigeneration cycle. Hence for heat pumps, air conditioners, refrigeration cycle, and electrolysis, a first-order system is used, while for water treatment, desalination, and for power generation a cycle zero-order system is used.
A PID controller is used to stabilize the system response and make the system respond quickly. The PID autotune function is available in MATLAB which provides the best proportional, integral, derivative, and filter coefficient values for the system. In the case of the air conditioner, these values are P = 1.338, I = 0.08912, D = −1.457, and N = 0.126. Figure 9 shows that earlier the tuned response system was highly unstable and the thermostat was not maintained until 100 s, however, afterwards the tuning system can achieve a steady state in 60 s with negligible oscillations.
In the air-conditioner, refrigeration cycle, and heat pump the first-order system was considered. Figure 17 shows that when the root locus is plotted, it results in a horizontal line on the left side of the zero poles graph. Because all the poles are lying on the right-hand side of the graph then any range of mass flow rates could be applied across these sub-cycles hence the system is stable at any available point. In a study conducted by [28], the response time of the compressor was experimentally and mathematically calculated, and the time constant for the air compressor was observed to be 30 s. Hence 30 s was used as the time constant for the refrigeration cycle transfer function. Figure 18 shows the root locus plot of the vapor compression cycle. best proportional, integral, derivative, and filter coefficient values for the system. In the case of the air conditioner, these values are P = 1.338, I = 0.08912, D = −1.457, and N= 0.126. Figure 9 shows that earlier the tuned response system was highly unstable and the thermostat was not maintained until 100 s, however, afterwards the tuning system can achieve a steady state in 60 s with negligible oscillations.
In the air-conditioner, refrigeration cycle, and heat pump the first-order system was considered. Figure 17 shows that when the root locus is plotted, it results in a horizontal line on the left side of the zero poles graph. Because all the poles are lying on the righthand side of the graph then any range of mass flow rates could be applied across these sub-cycles hence the system is stable at any available point. In a study conducted by [28], the response time of the compressor was experimentally and mathematically calculated, and the time constant for the air compressor was observed to be 30 s. Hence 30 s was used as the time constant for the refrigeration cycle transfer function. Figure 18 shows the root locus plot of the vapor compression cycle. For the electrolysis transfer function, the first order system was applied. Electrolysis is performed by supplying DC to a brine solution which results in the production of hydrogen and oxygen gas. The PID was also integrated with electrolysis by Simulink. After tuning, the electrolysis achieved a faster system response and tuned values were obtained as in Figure 19.
Battery time response has been studied in multiple literature examples. This multigeneration cycle time constant of 0.75 s is in reference to the study by [29] which is used in the Simulink first-order transfer function. Figure 11 shows PID tuned response; obtained values for the tuned response were P = 1.338, I = 3.565, D = −0.03643, and N = 5.041. Before, the tuned response system reaches a steady state at 4 s, afterwards the tuned response system can achieve a steady state at 2 s for the electrolysis system.   Figure 20 shows that when the root locus plot is plotted a horizontal line on the lef hand side of the real axis is generated. Since none of the poles lies on the right side of th pole zero plot, the system is considered stable.
There were several key finding and results obtained from this study. Overall e ergetic efficiency for operating this multigeneration cycle was equal to 0.1401. For havin wind airspeed of around 7-8 m/s and using biogas produced from the manure of 200-30 cows in a farm, 140 kg/s desalinated water flow rate was obtained, while 5 × 10 −7 kg/s hydrogen gas, and 5 × 10 −6 kg/s of oxygen gas were obtained from the electrolysis. Th Simulink steady state thermodynamic model was built successfully. In addition, tune PID parameters were obtained for the individual cycles, and the root locus graph w plotted to determine the stability of the thermodynamic cycles. For the electrolysis transfer function, the first order system was applied. Electrolysis is performed by supplying DC to a brine solution which results in the production of hydrogen and oxygen gas. The PID was also integrated with electrolysis by Simulink. After tuning, the electrolysis achieved a faster system response and tuned values were obtained as in Figure 19.   Figure 20 shows that when the root locus plot is plotted a horizontal line on the lefthand side of the real axis is generated. Since none of the poles lies on the right side of the pole zero plot, the system is considered stable.
There were several key finding and results obtained from this study. Overall exergetic efficiency for operating this multigeneration cycle was equal to 0.1401. For having wind airspeed of around 7-8 m/s and using biogas produced from the manure of 200-300 cows in a farm, 140 kg/s desalinated water flow rate was obtained, while 5 × 10 −7 kg/s of hydrogen gas, and 5 × 10 −6 kg/s of oxygen gas were obtained from the electrolysis. The Simulink steady state thermodynamic model was built successfully. In addition, tuned PID parameters were obtained for the individual cycles, and the root locus graph was plotted to determine the stability of the thermodynamic cycles. Battery time response has been studied in multiple literature examples. This multigeneration cycle time constant of 0.75 s is in reference to the study by [29] which is used in the Simulink first-order transfer function. Figure 11 shows PID tuned response; obtained values for the tuned response were P = 1.338, I = 3.565, D = −0.03643, and N = 5.041. Before, the tuned response system reaches a steady state at 4 s, afterwards the tuned response system can achieve a steady state at 2 s for the electrolysis system. Figure 20 shows that when the root locus plot is plotted a horizontal line on the lefthand side of the real axis is generated. Since none of the poles lies on the right side of the pole zero plot, the system is considered stable.

Discussion
The method used to analyze the multigeneration cycle was performed using th methodology of previous literature. However, the parametric and requirements for th system were different from other studies. To validate the study performed, the syste was modeled using the available parameters from the studies. After a comparison of th results, the percentage differences for the gas production, power input, power output, an exergy efficiency from the available literature were obtained. Table 2 shows deviation the results for the calculations from different sources. Since most of the values are close each other, the model used tended to generate accurate results like the other similar stud ies conducted. For the vapor compression cycle, the difference in exergy efficiency is 0.0 from Cengel's [27] vapor compression cycle model. Similarly, for the other cycles lik wind power, biogas production, and electrolysis the difference from the literature is ne ligible. For desalination the thermodynamic model prepared is novel, for this reason e ergy and exergetic analysis comparison isn't available N/A; this analysis can only be d termined by changing the operational standard. A limited library is available for therm dynamic modeling in Simulink. In this study the multigeneration system for sustainab cities was thermodynamically analyzed using both EES and Simulink software. Additio ally, the best transfer function obtained for the individual components from the literatu was used to obtain steady state response through tuning of the PID controller. Finally, root locus plot was provided to identify the stability of the processes of the multigener tion system.  There were several key finding and results obtained from this study. Overall exergetic efficiency for operating this multigeneration cycle was equal to 0.1401. For having wind airspeed of around 7-8 m/s and using biogas produced from the manure of 200-300 cows in a farm, 140 kg/s desalinated water flow rate was obtained, while 5 × 10 −7 kg/s of hydrogen gas, and 5 × 10 −6 kg/s of oxygen gas were obtained from the electrolysis. The Simulink steady state thermodynamic model was built successfully. In addition, tuned PID parameters were obtained for the individual cycles, and the root locus graph was plotted to determine the stability of the thermodynamic cycles.

Discussion
The method used to analyze the multigeneration cycle was performed using the methodology of previous literature. However, the parametric and requirements for this system were different from other studies. To validate the study performed, the system was modeled using the available parameters from the studies. After a comparison of the results, the percentage differences for the gas production, power input, power output, and exergy efficiency from the available literature were obtained. Table 2 shows deviation of the results for the calculations from different sources. Since most of the values are close to each other, the model used tended to generate accurate results like the other similar studies conducted. For the vapor compression cycle, the difference in exergy efficiency is 0.0% from Cengel's [27] vapor compression cycle model. Similarly, for the other cycles like wind power, biogas production, and electrolysis the difference from the literature is negligible. For desalination the thermodynamic model prepared is novel, for this reason energy and exergetic analysis comparison isn't available N/A; this analysis can only be determined by changing the operational standard. A limited library is available for thermodynamic modeling in Simulink. In this study the multigeneration system for sustainable cities was thermodynamically analyzed using both EES and Simulink software. Additionally, the best transfer function obtained for the individual components from the literature was used to obtain steady state response through tuning of the PID controller. Finally, a root locus plot was provided to identify the stability of the processes of the multigeneration system.

Conclusions
For this proposed multigeneration cycle, wind and biogas were used as power generation. For the energetic and exergetic analyses, the cycle was modeled on EES software. The combined exergetic efficiency was equal to 14%; the major contributor to the loss of overall exergy was due to biogas since most of the energy obtained from the biogas is lost. Other results included the COP of the refrigeration cycle and heat pump. The amount of hydrogen and oxygen produced was also calculated for different current cycles. Fresh water was produced using the desalination process and hot water was produced using the heat from the heat exchangers. The cycle was also modeled in Simulink using Python integrated into MATLAB to use the Cool Prop library. After identifying the expected order of the system for each component of the cycle, components were tuned for the PID controller while root locus plots were obtained. Currently, there is a limited library available for thermodynamic modeling in Simulink and for other programming software. The one which is available does not provide accurate readings for some of the refrigerants/working fluids. For future work, the transfer functions could be obtained from the actual compressor, pump, boiler, and heat exchanger to improve accuracy. A better controller could be introduced to improve tuning. In addition, the Simulink model could be improved to model a more complex cycle. Institutional Review Board Statement: Not applicable.

Data Availability Statement:
The data presented in this study are available on request from the corresponding author.