Optimal Operation of Building Microgrids with Rooftop Greenhouse Under Component Outages in Islanded Mode

: An optimal operation scheme for a building microgrid with a rooftop greenhouse in islanded mode is proposed in this paper. In islanded mode, the fulﬁllment of entire demand is challenging due to the absence of connection with the utility grid and the scarcity of local resources. The situation becomes more challenging when one or more pieces of equipment fail during the islanded mode. Therefore, in addition to islanded mode operation, component outage and recovery are also considered in this paper. In order to use the available energy e ﬃ ciently, prioritization of building loads and control parameters of the greenhouse are proposed. A priority weight matrix is adopted to decide the supply of energy to fulﬁll the requirements of control parameters in the case of insu ﬃ cient energy. In addition to the normal operation bounds, new bounds are deﬁned to operate the control parameters if the resources are not su ﬃ cient. Additional penalties are imposed if the new bounds are chosen, due to violation of the normal operation range. The microgrid system is rescheduled if any component outage or recovery is detected from the outage point to the end of the scheduling horizon. The performance of the proposed method is evaluated by carrying out several simulations including component outage, component recovery, and simultaneous outage of two or more types of equipment. Numerical simulation results have demonstrated the e ﬀ ectiveness of the proposed operation scheme for optimal operation of building microgrids with a rooftop greenhouse in islanded mode.


Introduction
Building energy management systems (BEMS) are gaining popularity due to their ability to maximize profit for building owners. This objective is achieved by BEMS through monitoring and controlling various services within the building, ensuring increased efficiency of energy usage and optimizing the utilization of the building equipment. Generally, buildings use various energy forms such as electricity, heat energy, and cooling energy. Therefore, efficient conversion technologies of devices like combined heat and power units, optimal sizing of conventional and renewable sources, and integration of new devices are important ways to improve energy efficiency and economic benefit. Various studies have been conducted on maximizing the energy efficiency, sizing and integration of equipment, and improving economic benefits as discussed in the following paragraphs. A deterministic demand side management program as a mixed integer linear programming problem is developed in reference [1], where the impact of EV integration on operation costs in smart (HOB), chiller, building chiller, photovoltaic (PV) arrays, battery energy storage system (BESS), and thermal energy storage system (TESS). In the building's household(s), the cooling demand is supplied through air conditioner and building chiller and the heat demand is supplied through the building's heat pipe. The electrical demand such as TV, refrigerator, and light are fulfilled through external CHP, DG, and BESS. Likewise, external equipment can supply electricity to the artificial light, fogging system, and CO2 generator of the greenhouse. CHP, HOB, and TESS can supply heat energy to the building microgrid with rooftop greenhouse and cooling energy is supplied through the chiller that uses thermal energy and EHP that uses electrical energy.
In this study, an outage of equipment in a building microgrid with rooftop greenhouse in islanded mode is considered, which contains n households and a rooftop greenhouse. When an outage of energy supply equipment occurs, environmental conditions are controlled through other replaceable equipment. However, it is difficult to control all environmental conditions within an acceptable boundary. If the use of other equipment cannot control the environmental conditions within the acceptable boundary, violation of one or more environmental conditions and household indoor temperature may be unavoidable. The violation is determined by the priority of the weight vector, which is explained in the next section. Therefore, optimal energy management of a building microgrid with rooftop greenhouse in the event of equipment outage in islanded mode is proposed.

CO2 Concentration
CO2 concentration directly affects the photosynthesis process of plants. Therefore, CO2 concentration should be controlled between acceptable bounds for efficient photosynthesis of plants. CO2 concentration can be calculated using Equation (1). The total amount of CO2 at interval t ( 2 t gh CO ) depends on the following factors.  In this study, an outage of equipment in a building microgrid with rooftop greenhouse in islanded mode is considered, which contains n households and a rooftop greenhouse. When an outage of energy supply equipment occurs, environmental conditions are controlled through other replaceable equipment. However, it is difficult to control all environmental conditions within an acceptable boundary. If the use of other equipment cannot control the environmental conditions within the acceptable boundary, violation of one or more environmental conditions and household indoor temperature may be unavoidable. The violation is determined by the priority of the weight vector, which is explained in the next section. Therefore, optimal energy management of a building microgrid with rooftop greenhouse in the event of equipment outage in islanded mode is proposed.

CO 2 Concentration
CO 2 concentration directly affects the photosynthesis process of plants. Therefore, CO 2 concentration should be controlled between acceptable bounds for efficient photosynthesis of plants.
CO 2 concentration can be calculated using Equation (1). The total amount of CO 2 at interval t (CO 2 gh t ) depends on the following factors. Total amount of light CO 2 gen max /P co 2 max Efficiency of CO 2 generator a 1 , a 2 Coefficients for respiration rate of plants a 3 Conversion factor from (1/s) to (1/h) V gh Volume of the greenhouse ρ a Density of air

Indoor Temperature
Temperature is an import factor in plant growth. If the greenhouse temperature is controlled within a certain boundary, it will greatly help the growth of the plants [24]. Temperature affects photosynthesis and therefore also affects CO 2 concentration [25]. In addition, as the temperature increases, the saturated water vapor pressure increases and the humidity decreases accordingly. Therefore, indoor temperature of the greenhouse should be controlled within an appropriate boundary by using the greenhouse equipment.
The indoor temperature of the greenhouse at interval t can be calculated by Equation (2) [26]. Equation (2) shows that the indoor temperature of the greenhouse is a function of the following parameters. Heat losses through soil j nv t Heat losses through natural ventilation j ev t Heat loss due to usage of the fogging system j co 2 t Heat produced due to operation of CO 2 generator j li t Heat produced due to operation of artificial light SH a Specific heat of air

Humidity
Humidity is an environmental condition that is difficult to control because it changes depending on the evaporation of plants and the indoor temperature of the greenhouse. If the humidity is not controlled with a certain boundary, it causes diseases in leaves and roots and slows down the growth rate. In addition, higher humidity halts the transpiration process of plants [27,28].
The relative humidity is represented by Equation (3). The relative humidity can be estimated as the ratio of partial water vapor pressure to saturated water vapor pressure. The saturated water vapor pressure can be calculated by converting the nonlinear equation into a linear equation using the Taylor Energies 2019, 12,1930 6 of 23 series [26]. Similarly, the water content of outside can be estimated by Equation (5). In Equation (7), the saturated water vapor pressure of outside can be computed if the outside temperature (θ out t ) is known. where, p out_sat t = a 4 · −a 5 + a 6 e a 7 · θ out t ∀t ∈ T

Light Intensity
Lighting is also an important environment condition for the optimal growth of any plant. Both artificial light and sunlight can provide light intensity. If greenhouse plants are not supplied with sufficient light intensity, they will not be capable of photosynthesis and will be damaged. Therefore, the light intensity should be maintained within a certain boundary [17].

Violation of Environment Conditions
Control of environmental factors is very important for the growth of plants and depends on the type of plant and on the growth period. The study in reference [29] has shown the impact of control parameters on plants growth. The impact of different control parameters on the growth of plants has been studied in reference [29] and a weight matrix of environmental factors has been developed, as shown in Equation (9). Environmental factors for tomato growth consist of the following three environmental factors: light intensity, temperature, and humidity. Temperature is the most important factor (w 1 ), followed by light (w 2 ) and humidity (w 3 ). Light intensity, temperature, and humidity are strongly coupled with each other. CO 2 , on the other hand, has relative independence and is therefore not considered in the weight matrix and is defined independently. The requirement of CO 2 is subjected to the availability of other control parameters, i.e., if humidity, light, and temperature are within the acceptable bounds, CO 2 concentration can contribute to growth of the plant. Therefore, the priority of CO 2 is set to the lowest. Similar calculations can be made when constructing a weight matrix for environmental element control of other plants.
When an outage of the equipment occurs in a building microgrid with rooftop greenhouse, it is difficult to adjust all four factors within acceptable bounds. Therefore, the priorities are determined through the following weight matrix, so that violation of acceptable bounds can be controlled based on the priority of different control parameters. In addition, a penalty cost is considered according to the priority of the weight matrix, and the penalty cost is imposed in case of a violation.

Problem Formulation
In order to realize the optimization problem of the building microgrid with rooftop greenhouse, the mathematical models of building and greenhouse are formulated. Both building and greenhouse are optimized for electrical, heat, and cooling energies. In the building optimization problem, indoor temperature is controlled while in case of the greenhouse problem, and indoor temperature, humidity, light intensity, and CO 2 concentration are controlled. The problem formulation process is explained in the following sections.

Objective Function
The first and second terms of the objective function (10) show generation cost of CHPs (C CHP i ) and DGs (C DG j ). The third and fourth terms show the operation cost of greenhouse chiller (C Chl ) and building chiller (C Chl_B ). The fifth term shows the operation cost of HOB (C HOB ). The last term shows the penalty cost of violation (C Pen t ) of acceptable bounds of the control parameters in the greenhouse and the households. The penalty cost is comprised of a load shedding penalty and environmental conditions (humidity, temperature, light intensity, and CO 2 ) violation penalties. The violation indication term (V) in the control parameters, which takes different values depending on the severity level of violation, i.e., different violation bounds are defined. Details about the violation bounds and corresponding penalties are described in detail in the Section 3.2.5. where,

Electrical Energy Balance
Electrical energy generated by CHPs (P CHP t,i ), DGs (P DG t,j ), PV (P PV t ), discharged from BESS (P B− t ), and load shedding amount (P Loadshed t ) should be equal to greenhouse load (P GLoad t ), building load (P BLoad t ), usage of EHP (P EHP t ), and charged amount to BESS (P B+ t ) at interval t as shown in Equation (11). The electric load of the greenhouse is composed of cooling and heating pipe valves (u capacity of cooling and heating pipe valves (P gh_chlv max , P gh_htv max ), CO 2 generator (P co 2 t ), fogging system (P f og t ), and artificial light (P li t,l ). The electric load of the building comprises the sum of each household appliances usage (P ac t,n , P Cri_Load t,n , P NonCri_Load where, Charging and discharging of BESS are carried out considering the losses (charging (L B+ ) and discharging (L B− ), respectively) as given by (12)- (15). Similarly, u B+ t and u B− t indicate the state of charging and discharging, respectively. Charging and discharging cannot occur simultaneously as given by (12). The state of charge (SOC) of BESS is modeled considering the amount of energy given from the previous interval and amount of energy charged/discharged at current time interval t as shown in Equation (15).

Heat Energy Balance
Heat energy generated by CHP (H CHP , and stored in TESS (H T+ t ) at interval t, as shown in Equation (16). The amount of heat generated by CHP depends upon the heat to electricity ratio of CHP. Heat load is the sum of greenhouse heat load (H Gload t ) and household heat load (H BLoad t ). CHP, chiller, and building chiller can calculate heat energy considering their electricity to heat energy efficiencies (η CHP , η Chl , η Chl_B ). where, The amount of heat stored or taken from the TESS is subjected to losses (loss per hour, L T ), as given by (17)(18)(19). The state of storage at interval t is modeled considering the amount of energy at the previous interval and amount of heat stored/taken at current interval t, as given by Equation (19).

Cooling Energy Balance
Cooling energy generated by EHP (CO EHP t ), greenhouse chiller (CO Chl t ), and building chiller (CO Chl_B t ) should be equal to the cooling load of the building (CO BLoad t ) and greenhouse (CO GLoad t ) as shown Equation (20). The amount of cooling energy generated by EHP (CO EHP t ) and chillers (building (CO Chl_B t ) and greenhouse (CO Chl t ), respectively) is subjected to their power to cooling conversion ratios (η EHP_cool , η Chl_cool , η Chl_B_cool ). where,

Greenhouse Constraints
The greenhouse constraints are shown in Equations (21) Violation indicators for greenhouse control parameters

Household Constraints
Equations (32) and (33) show the constraints of temperature for heat pipe (θ ho_htp t,n ) and indoor temperature of each household (θ in t,n ) in building, respectively. Different limits (θ resout n , θ resin n ) are imposed on the indoor temperature target in households considering the presence or absence of residents in the house, as shown in Equation (33).

Equipment Operation Constraints
The constraints for maximum and minimum operation ranges of the equipment in the building microgrid with rooftop greenhouse are given in Equations (34-42). CHPs and DGs generate electricity within their maximum and minimum ranges (P CHP max , P DG max ), as shown in Equations (34) and (35). The upper and lower generation ranges of EHP (P EHP max ) are shown in Equation (36). Equation (37) shows that generation limits of the HOB (H HOB max ). Equations (38) and (39) show that operation ranges of chillers (greenhouse (CO Chl max ) and building (CO Chl_B max ), respectively). The upper and lower generation ranges of the fogging system, CO 2 generator, and artificial lights (P f g max , P co 2 max , P li max ) are given by

Flowchart for Building Microgrids with Rooftop Greenhouse in Islanded Mode
The flow chart for building microgrids with rooftop greenhouse in islanded mode is shown in Figure 2. External environmental conditions and the forecasted values of the load are taken as inputs. Mathematical models are formulated for optimal operation, which is followed by the optimization process. When equipment outage occurs, the mathematical model is updated including the violation bounds. During the outage, rescheduling is performed for 15 min intervals from the time of outage till the end of the scheduling horizon. A variable (i) is defined to determine the number of equipment failures, the variable is increased by one for equipment outage and reduced by one for equipment recovery. Rescheduling is performed upon equipment outage and recovery from that point till the end of the scheduling horizon with 15-min resolution time. If all the outage equipment is recovered, the rescheduling is carried out using one hour time intervals. The entire process for rescheduling during component outage and recovery is described in detail in the figure below.

Numerical simulation
The proposed building microgrid with rooftop greenhouse in islanded mode considering component outages is operated over a 24 hours scheduling horizon with 1-hour intervals and rescheduled with 15-minute intervals when component outages occur. Initially, an offline day-ahead schedule is made for the microgrid and the outage/recovery of components is monitored. After detecting any component outage/recovery, the system is rescheduled from that point until the end of the scheduling horizon. In order to analyze the impact of component outages, seven cases were simulated. The first case is an islanded-mode case in which no outage occurs. Six other cases are simulated considering the outage and restoration of the equipment such as CHP, EHP, and fogging system. The outages were considered in the order of CHP, EHP, and fogging system and their recoveries were considered in the reverse order. The proposed method is formulated in a mixed integer linear programming form and it contains 84T variables (including 5T binary variables), 72T bounding constraints, 10T inequality constraints, and 25T equality constraints. In normal operation T is taken as 24 and in emergency operation T is taken as 96. Simulations have been conducted by using CPLEX 12.7 [30] in a Visual Studio environment.

Numerical Simulation
The proposed building microgrid with rooftop greenhouse in islanded mode considering component outages is operated over a 24 h scheduling horizon with 1-h intervals and rescheduled with 15-min intervals when component outages occur. Initially, an offline day-ahead schedule is made for the microgrid and the outage/recovery of components is monitored. After detecting any component outage/recovery, the system is rescheduled from that point until the end of the scheduling horizon. In order to analyze the impact of component outages, seven cases were simulated. The first case is an islanded-mode case in which no outage occurs. Six other cases are simulated considering the outage and restoration of the equipment such as CHP, EHP, and fogging system. The outages were considered in the order of CHP, EHP, and fogging system and their recoveries were considered in the reverse order. The proposed method is formulated in a mixed integer linear programming form and it contains 84×T variables (including 5×T binary variables), 72×T bounding constraints, 10×T inequality constraints, and 25×T equality constraints. In normal operation T is taken as 24 and in emergency operation T is taken as 96. Simulations have been conducted by using CPLEX 12.7 [30] in a Visual Studio environment. Table 1 shows the parameters of energy supply facilities in the building microgrid with roof-top greenhouse. The ratio represents heat-to-power ratio for CHP and cooling to power ratio for HOB. The parameters of BESS and TESS used in this study are shown in Table 2. Charging and discharging losses are considered for BESS while interval-based losses are considered for TESS. Table 3 shows boundaries of control parameters. Each parameter is usually operated within acceptable boundary. However, in case of equipment outage, additional two boundaries are defined for each parameter to maximize the utilization of existing resources. Penalties are imposed in case of violating the normally acceptable bound. The penalties get higher if BD1 is violated and even higher for violation of BD2. The acceptable ranges of temperatures for different types of households, considering the presence or absence of residents in the house, are shown in Table 4. Table 5 shows the description and values of constants used in the problem formation section [17,18,21].    In order to analyze the performance of the proposed method, several component outage cases are simulated in this study, in islanded mode. The outage and recovery of CHP, EHP, and the fogging system are considered and their results are analyzed in the following sections.

Islanded Mode Without Component Outage
In this section, the islanded operation of microgrid is considered, without any outage of the equipment. Figure 3a shows the electrical energy balance of the system. It can be observed that CHP is mainly used to fulfill the power demand of the system due to its lower generation cost and ability to produce heat. The heat generated by the CHP is primarily used for fulfilling the heat demand of the system, as shown in Figure 3b. Excess of heat energy is stored in TESS and is used to fulfill the cooling demand of the system via chiller, as shown in Figure 3c. Chiller is mainly used to fulfill the cooling demand of the system and deficit amount is fulfilled by using EHP.   The environmental control parameters of greenhouses such as temperature, humidity, CO 2 , and light intensity are shown in Figure 4. It can be observed that all the control parameters are within the acceptable bounds, as defined in Table 3. Since the outside temperature is much higher, the temperature is controlled to its upper bound throughout the day.      Figure 5 shows the usage of greenhouse and building equipment such as the cooling pipe valve, fogging system, CO 2 generator, and artificial light for environment control in building and greenhouse, respectively. During intervals 13-16, the cooling pipe valve is used to control the temperature in the building and greenhouse and is maximally used during intervals 13-16. The fogging system is operated to prevent water loss due to transpiration of the plant in the night interval and is used to prevent temperature violation and water loss due to evaporation. In the daytime, CO 2 generator is used, which was consumed due to photosynthesis of the plant. However, in the remaining intervals, it is operated to control it within the acceptable boundary. Since the light intensity is sufficient in daytime, artificial light does not operate and it is mainly used in nighttime.    Temperature control of each household in building is shown in table 6. Different temperature boundaries are defined for each household considering the presence and absence of the residents, as shown in Table 4. The results show that the indoor temperature of all the households is within acceptable boundaries, as shown in Table 6.

CHP Outage Case
In this case, the outage of CHP unit is considered at the beginning of time interval 5 (interval 17 for 15-min resolution). Therefore, the system is rescheduled from t = 5 until the end of the scheduling horizon and the corresponding results are shown below. In this case, the time interval is reduced from 1-h to 15 min to capture the parameters' dynamics and reschedule the system promptly after the occurrence/clearance of the component outage. It can be observed from Figure 6a that the building microgrid with rooftop greenhouse cannot use CHP and instead DG is used to fulfill the power demand of the system. Since DG cannot satisfy the electrical load in the 18-23 intervals, load shedding is carried out. Heat energy is supplied by using TESS and HOB and due to the outage of CHP, as shown in Figure 6b. Similarly, the usage of chiller is reduced due to the absence of heat energy and the cooling energy is supplied through a building chiller using the exhaust heat generated by household air conditioners (Figure 6c).

CHP Outage Case
In this case, the outage of CHP unit is considered at the beginning of time interval 5 (interval 17 for 15-minute resolution). Therefore, the system is rescheduled from t = 5 until the end of the scheduling horizon and the corresponding results are shown below. In this case, the time interval is reduced from 1-hour to 15 minutes to capture the parameters' dynamics and reschedule the system promptly after the occurrence/clearance of the component outage. It can be observed from Figure 6a that the building microgrid with rooftop greenhouse cannot use CHP and instead DG is used to fulfill the power demand of the system. Since DG cannot satisfy the electrical load in the 18-23 intervals, load shedding is carried out. Heat energy is supplied by using TESS and HOB and due to the outage of CHP, as shown in Figure 6b. Similarly, the usage of chiller is reduced due to the absence of heat energy and the cooling energy is supplied through a building chiller using the exhaust heat generated by household air conditioners (Figure 6c).
Due to the outage of CHP, the environment control parameters violate normal acceptable bound, as depicted by Figure 7. Since supply of heat energy decreases, temperature violation occurs in the 42-70 intervals. Due to increasing of temperature, humidity violated the normal bound in the 41st interval, even after using the fogging system. The violation in CO2 and light intensity occurred from interval 63 onwards due to high electric energy demand.
The violation in temperature of the households is also observed for all the building households due to the outage of the CHP unit. The results in Table 7 show that temperature violations have occurred in the households irrespective of the presence/absence of the residents in the homes. Building load is relatively lower as compared to the amount of electricity used in the greenhouse, temperature violation of building occurs before violating the bounds in greenhouse. The usage of greenhouse equipment for environmental control during CHP outage is shown in Figure 8. Due to the outage of CHP, the environment control parameters violate normal acceptable bound, as depicted by Figure 7. Since supply of heat energy decreases, temperature violation occurs in the 42-70 intervals. Due to increasing of temperature, humidity violated the normal bound in the 41st interval, even after using the fogging system. The violation in CO 2 and light intensity occurred from interval 63 onwards due to high electric energy demand.    The violation in temperature of the households is also observed for all the building households due to the outage of the CHP unit. The results in Table 7 show that temperature violations have occurred in the households irrespective of the presence/absence of the residents in the homes. Building load is relatively lower as compared to the amount of electricity used in the greenhouse, temperature violation of building occurs before violating the bounds in greenhouse. The usage of greenhouse equipment for environmental control during CHP outage is shown in Figure 8.

EHP Outage Case
In this case, the outage of EHP is considered (in addition to outage of CHP) at the beginning of time interval 9 (interval 33 in case of 15 min resolution). It can be observed that in contrast to the previous two cases, EHP usage has reduced to zero during intervals 9-15, as shown in Figure 9. Instead of EHP, HOB is used to fulfill the heat demand of the system and is also used to fulfill the cooling demand of the system via chiller. It can be observed from Figure 7b that all the cooling demand is fulfilled via either the greenhouse chiller or the building chiller.

EHP Outage Case
In this case, the outage of EHP is considered (in addition to outage of CHP) at the beginning of time interval 9 (interval 33 in case of 15 minutes resolution). It can be observed that in contrast to the previous two cases, EHP usage has reduced to zero during intervals 9-15, as shown in Figure 9. Instead of EHP, HOB is used to fulfill the heat demand of the system and is also used to fulfill the cooling demand of the system via chiller. It can be observed from Figure 7b that all the cooling demand is fulfilled via either the greenhouse chiller or the building chiller.
In terms of control parameters, more violation intervals have been observed for the temperature due to the inability to use both CHP and chiller in this case. Similarly, the violation in the humidity occurred more quickly due to a rise of temperature ( Figure 10). The violations in CO2 and light are same as for the previous case; therefore, results of those parameters are not shown in this section. The violation of temperature in the households also follows a similar pattern with those of the previously therefore, the results of households are also not shown in this section.

Fogging System Outage
In this case, outage of the fogging system (in addition to outage of CHP and EHP) is considered at the beginning of time interval 15 (interval 57 in case of 15 minutes resolution). The system is rescheduled from interval 57 until the end of the scheduling horizon, as highlighted in the results. The power balance results are the same as the previous case (Figure 11a). However, due to outage of the fogging system, HOB utilization has increased to control the temperature of the greenhouse, as In terms of control parameters, more violation intervals have been observed for the temperature due to the inability to use both CHP and chiller in this case. Similarly, the violation in the humidity occurred more quickly due to a rise of temperature ( Figure 10). The violations in CO 2 and light are same as for the previous case; therefore, results of those parameters are not shown in this section. The violation of temperature in the households also follows a similar pattern with those of the previously therefore, the results of households are also not shown in this section.

EHP Outage Case
In this case, the outage of EHP is considered (in addition to outage of CHP) at the beginning of time interval 9 (interval 33 in case of 15 minutes resolution). It can be observed that in contrast to the previous two cases, EHP usage has reduced to zero during intervals 9-15, as shown in Figure 9. Instead of EHP, HOB is used to fulfill the heat demand of the system and is also used to fulfill the cooling demand of the system via chiller. It can be observed from Figure 7b that all the cooling demand is fulfilled via either the greenhouse chiller or the building chiller.
In terms of control parameters, more violation intervals have been observed for the temperature due to the inability to use both CHP and chiller in this case. Similarly, the violation in the humidity occurred more quickly due to a rise of temperature ( Figure 10). The violations in CO2 and light are same as for the previous case; therefore, results of those parameters are not shown in this section. The violation of temperature in the households also follows a similar pattern with those of the previously therefore, the results of households are also not shown in this section.

Fogging System Outage
In this case, outage of the fogging system (in addition to outage of CHP and EHP) is considered at the beginning of time interval 15 (interval 57 in case of 15 minutes resolution). The system is rescheduled from interval 57 until the end of the scheduling horizon, as highlighted in the results.

Fogging System Outage
In this case, outage of the fogging system (in addition to outage of CHP and EHP) is considered at the beginning of time interval 15 (interval 57 in case of 15 min resolution). The system is rescheduled from interval 57 until the end of the scheduling horizon, as highlighted in the results. The power balance results are the same as the previous case (Figure 11a). However, due to outage of the fogging system, HOB utilization has increased to control the temperature of the greenhouse, as shown in Figure 11b. Similarly, in case of cooling energy balancing, building chiller is used during the last 6 intervals, as shown in Figure 11c.
Energies 2019, 12, 1930 19 of 24 shown in Figure 11b. Similarly, in case of cooling energy balancing, building chiller is used during the last 6 intervals, as shown in Figure 11c. Due to the outage of the fogging system, the violation in temperature has elongated as compared to the previous case (Figure 12a). Since most of the humidity control is carried out by the fogging system, a humidity violation can be observed after the outage of the fogging system in Figure 12b. CO2 and light intensity violations are same with the second case; therefore results of those parameters are not shown in this section.
The cooling pipe valve is used after the 76 intervals to control the temperature, as shown in Figure 13a. Figure 13b shows the fogging system operation, where it can be observed that it stopped its operation from 58 interval due to a failure in the fogging system.  Due to the outage of the fogging system, the violation in temperature has elongated as compared to the previous case ( Figure 12a). Since most of the humidity control is carried out by the fogging system, a humidity violation can be observed after the outage of the fogging system in Figure 12b. CO 2 and light intensity violations are same with the second case; therefore results of those parameters are not shown in this section.
Energies 2019, 12, 1930 19 of 24 shown in Figure 11b. Similarly, in case of cooling energy balancing, building chiller is used during the last 6 intervals, as shown in Figure 11c. Due to the outage of the fogging system, the violation in temperature has elongated as compared to the previous case (Figure 12a). Since most of the humidity control is carried out by the fogging system, a humidity violation can be observed after the outage of the fogging system in Figure 12b. CO2 and light intensity violations are same with the second case; therefore results of those parameters are not shown in this section.
The cooling pipe valve is used after the 76 intervals to control the temperature, as shown in Figure 13a. Figure 13b shows the fogging system operation, where it can be observed that it stopped its operation from 58 interval due to a failure in the fogging system. The cooling pipe valve is used after the 76 intervals to control the temperature, as shown in Figure 13a. Figure 13b shows the fogging system operation, where it can be observed that it stopped its operation from 58 interval due to a failure in the fogging system.

Fogging System Recovery Case
The fogging system was considered to be restored from interval 18 (interval 69 in case of 15-min resolution) while CHP and EHP had still not-recovered. The highlighted parts in the results show the results for this case. The chiller and HOB usage were reduced in the 18 intervals and Building chiller usage was reduced to zero in the 19-24 intervals, as shown in Figure 14b. After 71 intervals, the temperature was within the acceptable boundary ( Figure 15a). The fogging system was fully utilized to restore the humidity to the acceptable boundary. CO 2 and light intensity results were similar to those of the previous case. The usage for cooling pipe valve and fogging system in this case are shown in Figure 16.

Fogging System Recovery Case
The fogging system was considered to be restored from interval 18 (interval 69 in case of 15minute resolution) while CHP and EHP had still not-recovered. The highlighted parts in the results show the results for this case. The chiller and HOB usage were reduced in the 18 intervals and Building chiller usage was reduced to zero in the 19-24 intervals, as shown in Figure 14b. After 71 intervals, the temperature was within the acceptable boundary ( Figure 15a). The fogging system was fully utilized to restore the humidity to the acceptable boundary. CO2 and light intensity results were similar to those of the previous case. The usage for cooling pipe valve and fogging system in this case are shown in Figure 16.

Fogging System Recovery Case
The fogging system was considered to be restored from interval 18 (interval 69 in case of 15minute resolution) while CHP and EHP had still not-recovered. The highlighted parts in the results show the results for this case. The chiller and HOB usage were reduced in the 18 intervals and Building chiller usage was reduced to zero in the 19-24 intervals, as shown in Figure 14b. After 71 intervals, the temperature was within the acceptable boundary ( Figure 15a). The fogging system was fully utilized to restore the humidity to the acceptable boundary. CO2 and light intensity results were similar to those of the previous case. The usage for cooling pipe valve and fogging system in this case are shown in Figure 16.

EHP Recovery Case
In this case, after the recovery of the fogging system, EHP recovery is also considered from the beginning of time interval 19 (73 in case of 15 min resolution). Since cooling energy is not needed in the 19-24 interval, EHP is not used even if it is recovered. Therefore, EHP recovery has no effect on the electrical, heat, and cooling energy balancing of building a microgrid with rooftop greenhouse. In addition, indoor environmental control parameters of the greenhouse and equipment operation are also the same as for the previous case. Note that the results from time interval 73 to 96 of this case are the same as the previous case.

CHP Recovery Case
Finally, in this case, CHP is also restored from the time interval 22 (interval 85 in case of 15 min resolution). In this case, all the faulty equipment is restored and the system is driven back to the normal state. It can be observed from Figure 17 that CHP is used instead of DG to generate electrical energy and produce heat energy. Due to the production of surplus heat energy, it is used for generating cooling energy by using chiller.

EHP Recovery Case
In this case, after the recovery of the fogging system, EHP recovery is also considered from the beginning of time interval 19 (73 in case of 15 minutes resolution). Since cooling energy is not needed in the 19-24 interval, EHP is not used even if it is recovered. Therefore, EHP recovery has no effect on the electrical, heat, and cooling energy balancing of building a microgrid with rooftop greenhouse. In addition, indoor environmental control parameters of the greenhouse and equipment operation are also the same as for the previous case. Note that the results from time interval 73 to 96 of this case are the same as the previous case.

CHP Recovery Case
Finally, in this case, CHP is also restored from the time interval 22 (interval 85 in case of 15 minutes resolution). In this case, all the faulty equipment is restored and the system is driven back to the normal state. It can be observed from Figure 17 that CHP is used instead of DG to generate electrical energy and produce heat energy. Due to the production of surplus heat energy, it is used for generating cooling energy by using chiller.
The temperature and humidity parameters are the same with the fogging system recovery case, i.e. within the acceptable bounds. On the other hand, a CO2 generator and artificial lighting are fully utilized in this case due to recovery of the power source (CHP). The operation value of light intensity is recovered to the acceptable boundary, but the operation value of CO2 cannot be recovered to its acceptable boundary ( Figure 18) even when the equipment is used at its maximum ( Figure 19). This implies that more time is required to bring the CO2 level to the acceptable bounds.  The temperature and humidity parameters are the same with the fogging system recovery case, i.e., within the acceptable bounds. On the other hand, a CO 2 generator and artificial lighting are fully utilized in this case due to recovery of the power source (CHP). The operation value of light intensity is recovered to the acceptable boundary, but the operation value of CO 2 cannot be recovered to its acceptable boundary ( Figure 18) even when the equipment is used at its maximum ( Figure 19). This implies that more time is required to bring the CO 2 level to the acceptable bounds.

Conclusions
In this paper, an optimal operation method for a building microgrid with a rooftop greenhouse considering equipment outages is proposed. The proposed operational strategy defines the priority of various control parameters through the weight matrix and considers the optimum growth of the plants. If the control parameters are out of the acceptable bounds, additionally relaxed bounds are utilized and a violation cost is imposed. The performance of the proposed method is evaluated by considering seven equipment outages cases. It has been observed that during an equipment outage, replaceable equipment has been operated to fulfill the energy deficit, i.e. DG and HOB has been utilized in case of a CHP outage. In case of absence of replaceable equipment or inability of the replaceable equipment to fulfill the energy demand, violation of acceptable bounds is considered for the greenhouse. Similarly, the shedding of non-critical loads is considered in the case of building households. For example, in the case of an EHP outage, cooling is provided through the chiller but due to insufficient heat, temperature violations occur. It also has been observed that, after equipment restoration, the control parameters have gradually been restored to their normal bounds. However, in the final case, the CO2 concentration was unable to reach the acceptable bound in the current scheduling horizon due to limited capacity of the CO2 generator, i.e. it requires more time.
The formulated problem is subjected to environmental uncertainties and uncertainties in energy usage patterns of building residents. Consideration of uncertainties in loads and renewables will be a valuable extension of this paper.
Author Contributions: The paper was a collaborative effort between the authors. The authors contributed collectively to the theoretical analysis, modeling, simulation, and manuscript preparation.

Conclusions
In this paper, an optimal operation method for a building microgrid with a rooftop greenhouse considering equipment outages is proposed. The proposed operational strategy defines the priority of various control parameters through the weight matrix and considers the optimum growth of the plants. If the control parameters are out of the acceptable bounds, additionally relaxed bounds are utilized and a violation cost is imposed. The performance of the proposed method is evaluated by considering seven equipment outages cases. It has been observed that during an equipment outage, replaceable equipment has been operated to fulfill the energy deficit, i.e., DG and HOB has been utilized in case of a CHP outage. In case of absence of replaceable equipment or inability of the replaceable equipment to fulfill the energy demand, violation of acceptable bounds is considered for the greenhouse. Similarly, the shedding of non-critical loads is considered in the case of building households. For example, in the case of an EHP outage, cooling is provided through the chiller but due to insufficient heat, temperature violations occur. It also has been observed that, after equipment restoration, the control parameters have gradually been restored to their normal bounds. However, in the final case, the CO2 concentration was unable to reach the acceptable bound in the current scheduling horizon due to limited capacity of the CO2 generator, i.e., it requires more time.
The formulated problem is subjected to environmental uncertainties and uncertainties in energy usage patterns of building residents. Consideration of uncertainties in loads and renewables will be a valuable extension of this paper.
Author Contributions: The paper was a collaborative effort between the authors. The authors contributed collectively to the theoretical analysis, modeling, simulation, and manuscript preparation.