Optimal Renewable Resource Allocation and Load Scheduling of Resilient Communities

This paper presents a methodology for enhancing community resilience through optimal renewable resource allocation and load scheduling in order to minimize unserved load and thermal discomfort. The proposed control architecture distributes the computational effort and is easier to be scaled up than traditional centralized control. The decentralized control architecture consists of two layers: The community operator layer (COL) allocates the limited amount of renewable energy resource according to the power flexibility of each building. The building agent layer (BAL) addresses the optimal load scheduling problem for each building with the allowable load determined by the COL. Both layers are formulated as a model predictive control (MPC) based optimization. Simulation scenarios are designed to compare different combinations of building weighting methods and objective functions to provide guidance for real-world deployment by community and microgrid operators. The results indicate that the impact of power flexibility is more prominent than the weighting factor to the resource allocation process. Allocation based purely on occupancy status could lead to an increase of PV curtailment. Further, it is necessary for the building agent to have multi-objective optimization to minimize unserved load ratio and maximize comfort simultaneously.


Introduction
In the past several decades, the degrading power grid infrastructure has been faced with higher stress. On one hand, the frequency of human-made disasters as well as extreme weather events is increasing, causing more frequent power outages [1]. On the other hand, the rapid technical advancement and increasing adoption of renewable energy is bringing more uncertainty and variability, posing new challenges to the grid. These factors impact the resilience of the power supply and, thus, require the demand side to become actively involved in grid resilience management.
In 2017, Hurricane Maria left 1.5 million customers across Puerto Rico without electricity and it took 11 months to fully restore the power system [2]. In such extreme cases, outages not only cause inconvenience to occupants' daily life but also compromise their health or even lives. The power loss of the heating, ventilation, and air-conditioning (HVAC) system in a nursing home located in Florida caused 12 patients' deaths after Hurricane Irma in 2017 [3]. This has motivated the research towards more resilient communities.
Studies have proven that communities with on-site PV power and batteries have the potential to sustain power outages for a certain period if the energy resources are properly managed and the controllable loads are well scheduled [4]. Some research efforts focus on microgrid operation with selected distributed generation technologies and energy storage systems. Marnay [5] illustrated that the adoption of combined heat and power together with heat and electrical storage in a hypothetical San Francisco hotel can lead to 11% cost savings and 8% carbon emission reductions. Similarly, Bozchalui [6] developed mathematical models of a combined cooling, heating, and power system for a commercial building microgrid, together with PV generation, thermal energy storage, and battery storage devices. Results in [4][5][6] show that adopting the above technologies can reduce total costs and help achieve efficiency and emission reduction targets.
Some research focuses on restoring the power generation, transmission and distribution promptly after power outages [1]. Arif [7] co-optimized the topology reconfiguration, repair crew scheduling, and distributed generator (DG) dispatching to maximize the picked-up loads while minimizing the repair time. Chen [8] and Ding [9] proposed a mechanism for microgrid formation to restore critical loads after major disruptions in the power grid. In their scheme, a mixed-integer linear program (MILP) was formulated to maximize the total restored critical loads. The problem was constrained by each microgrid's self-adequacy and operation constraints. Similarly, Chen [10] proposed a MILP model for the optimal sequential service restoration, which coordinates dispatchable DGs and switchgears to restore the power system service step by step.
Other studies consider flexible load scheduling as an important avenue to enhance resilience. In this case, the power demand from buildings can be ramped up or down in response to exterior signals, such as available PV power and occupancy prediction. Hussain [11] classifies proactive scheduling, such as revising schedules of dispatchable generators, flexible loads and energy storages, as the first step for enhancing grid resilience. Kallel [12] proposed a demand-side management control strategy through the modification of the household load profile to satisfy the demand and reduce the size of system components in a stand-alone hybrid PV system. Results show that the proposed strategy led to minimum loss of power supply probability and system cost, as well as extended battery life.
Among the optimal load scheduling studies, some researchers approach load management through a rule-based methodology. Ayodele [13] proposed a rule-based load management scheme for a stand-alone PV battery system, where residential loads are classified into critical and non-critical loads. The critical loads are given higher priority and therefore can operate at their scheduled time while the uncritical loads can be shifted to other times. However, this type of method is not suitable for problems with a large number of variables (i.e., controllable appliances), where manually defining the algorithms becomes difficult.
Many other studies formulate load scheduling as an optimization problem. Garifi [14] adopted a stochastic MPC-based algorithm for demand response in a home energy management system (HEMS). The HEMS optimally schedules controllable appliances given user preferences and available residentially owned power sources such as PV and battery. Zhao [15] applied a genetic algorithm (GA) in a HEMS controller where the optimal power scheduling schemes under various electricity pricing models are compared. Pathak [16] developed a scheduling strategy for demand response management of residential loads using a particle swarm optimization algorithm. Additionally, machine leaning techniques have been emerging in the optimal load scheduling field. Zhang [17] proposed a learning-based HEMS, where neural network and regression-based learning are adopted to predict the energy consumption of the HVAC system. Mazzeo [18] applied energy reliabilityconstrained method for the multi-objective optimization of hybrid photovoltaic-wind-battery systems. The proposed method permits choosing the most proper indicator combination to be constrained or optimized.
Noticeably, occupants' preferences are widely considered in the problem formulation of load scheduling as either constraints or objectives. Jin [19] presented a user-centric HEMS that is built on a multi-objective MPC framework, wherein the objectives consist of thermal comfort and user convenience. In Zhao's work [15], the delay time rate of home appliances, i.e., the deviation between an appliance's actual operation time and its scheduled time, is minimized to increase the satisfaction of user preferences.
Optimal load scheduling in single buildings, especially residential buildings, has been studied extensively [14][15][16][17]19]. Quantifying load flexibility and optimal load scheduling in other building types, however, needs further exploration. Larger-scale studies, such as those for microgrids, often focus on identifying enabling energy technologies or operating energy resources from a higher level. The scheduling of each controllable load in every building of a community can be computationally challenging due to the increased number of variables. However, this also provides more possibilities for load scheduling due to the heterogeneity of different building load shapes in the community. If building loads in the same community are scheduled simultaneously by a single operator, power sharing is possible. Further, under certain circumstances, buildings of lower priority could reduce their loads to satisfy the demand of higher priority building loads. Therefore, this paper proposes a new methodology for optimal renewable resource allocation and load scheduling in resilient communities. The methodology adopts a hierarchical architecture consisting of a COL and a BAL. The COL enables dynamic renewable resource sharing among buildings in the same community according to various weighting methods. The BAL then achieves the locally optimal operation solution by controlling its HVAC system, loads and battery storage with the allowable load decided by the COL. The innovation of this work is that it proposes an easy-todeploy optimization scheme for large-scale communities, which embraces both high-level resource allocation and low-level high-fidelity building energy modeling. The hierarchical control architecture distributes the computational effort and is easier to be scaled up than traditional centralized control, which is not robust for large-scale deployment. The hierarchical structure also helps hide the complexity of the whole scheduling system through the separated layers. In the case study, different building types are considered, including residential and small commercial buildings.
The remainder of the paper is organized as follows: Section 2 introduces the concept and architecture developed for community resource allocation and load scheduling. Section 3 provides the mathematical formulation of the optimization problem. Section 4 demonstrates the proposed methodology through a case study based on a real community. Finally, concluding remarks and future work are provided in Section 5.

Proposed Architecture for Resource Allocation and Scheduling
In this work, we consider an islanded community during a power outage. The only energy resource accessible to the community is the on-site PV generator and the batteries. Under this problem setting, the research question is how to optimally allocate the limited PV generation among different buildings and schedule the loads to meet occupants' essential needs for a certain time period. Here, we confine occupants' essential needs to be physiological (i.e., food and shelter) and safety needs (i.e., lighting at night), which align with the two bottom levels of Maslow's Hierarchy of Needs [20].
To address this problem, we propose a hierarchical control architecture that consists of two layers. The top layer is the COL which mimics the perspective of the community operator and seeks the optimal solution for allocating the limited PV power among buildings. The bottom layer is the BAL which satisfies its occupants' needs through optimal load scheduling. In this way, the cooperation among buildings is achieved through their individual but simultaneous communication with the operator and the global optimum of the whole community is also achieved through decentralized control. The operation in both layers is formulated as MPC problems. The proposed architecture with data exchange flow is visualized in Figure 1. As can be seen from the figure, the COL determines the allowable load based on the forecast of the total PV power generation and the load flexibility of each building. The determined allowable load of each building is then passed down to the building smart controllers in BAL. Other inputs of the BAL consist of the outdoor temperature and solar irradiance forecasts. This decentralized control architecture distributes the computational efforts to local controllers. Compared with centralized control, this structure is more robust, scales up easily, and allows the use of inexpensive and simple agents at the BAL [21]. The data exchange between the COL and the BAL can be implemented through multi-agent communication system [22]. The detailed mechanisms of the two layers are introduced in the remainder of this section.

Renewable Resource Allocation in COL
The COL allocates the limited amount of available generation from a renewable energy resource; namely, PV power, according to the load flexibility of each building, within which range the building's power demand can fluctuate. The operator decides the optimal way to allocate the current PV power to avoid PV curtailment and building load shedding. We assume that the operator does not take into account the detailed building equipment information, extra building-owned energy resources (i.e., battery), or building thermal dynamics in its allocation process. This assures the scalability of the control framework. The allocated PV power to building is defined as the allowable load: where α is the ratio of the allowable load of building to the current total PV generation . Since it is directly related to the allocated PV power, α is referred to as the allocation factor in the rest of the paper.
To investigate a logical way to allocate the PV power besides the baseline, where the allocation is done only with information of building load flexibility, we introduce weighting factors into the problem. The weighting factor reflects the priority of each building. Two types of weighting factors are considered: constant versus dynamic. The constant weighting factor is adopted when a building is naturally more important than other buildings. For example, health facilities are naturally prioritized over other types of buildings during emergencies. The dynamic weighting factor is timevarying based on occupancy, e.g., when a building is occupied, it has a higher weighting factor. Therefore, the COL decides the allowable load of each building through three methods: (1) equally weighted, (2) weighted based on priority, (3) weighted based on occupancy. The determined allowable load is then passed to the smart controllers in BAL, where each building performs its local detailed optimization to achieve its own objectives.

Optimal Load Scheduling in BAL
The BAL addresses the optimal load scheduling problem with the predetermined allowable load. Each building is simulated as an agent that has various electrical loads, an HVAC system, and a battery. The HVAC system is modeled with a linear regression model trained from data. The battery is modeled with a linear convex model. By adopting linear room temperature models and battery models, the optimization problem becomes linear. This method has the advantage of shorter computational time. However, compared to high-fidelity nonlinear models, it may lose some model fidelity and the ability to simulate certain system dynamics by making simplifications. In this work, linear models are accurate enough for our application scenario.
In this work, following methods found in the literature [12,13,15,17,23], the building's electrical loads are categorized into four types: sheddable, modulatable, shiftable, and critical. The primary classification criteria include the assumed occupants' preference during emergency circumstances and the electrical characteristics of different appliances. Only loads that are related to safety (e.g., lighting at night) or food preservation (e.g., refrigerator) are considered critical. Sheddable loads are those that can be fully disconnected without impacting the occupant's essential needs during the studied time period, such as coffee makers. Modulatable loads are those categorized by varying power amplitudes such as the HVAC system. Shiftable loads are those that need to be operated but are flexible with respect to the time of day that they are scheduled. Examples are washers and driers. From practical point of view, categorizing building loads can help avoid dealing with thousands of individual load models especially when the problem scales up. It can significantly reduce the computational effort. Figure 2 visualizes the logic we followed to categorize the loads. Additionally, at this layer, different optimization objective functions are compared to evaluate their performance in satisfying selected key performance indices (KPIs); namely, unserved load ratio, thermal comfort, PV curtailment, and required battery installation size. Two objectives are considered: (1) minimizing unserved load ratio, and (2) maximizing thermal comfort.
It is to mention that we included uncertainty in the weather-related parameter forecasts to account for prediction errors. Chance constraints for the indoor temperature range are, thus, implemented to ensure thermal comfort is maintained with high probability. The following section presents the detailed mathematical formulation of the two-layered control architecture with equations.

Community Operator Layer
The COL determines the allowable load of each building through MPC-based optimization that takes into account forecasted PV generation, building load flexibility, priority and occupancy of each building. The flexibility of building loads depends on the power demand of the controllable loads, i.e., the sum of sheddable, modulatable, and shiftable loads. Note that the HVAC load flexibility is reflected in the temperature range constraints and is not summed here. The mathematical formulation of the load flexibility for each building is given by: ( where , , , , , , and , , denote the prediction data of each individual sheddable, modulatable, and shiftable load in building , respectively. The , , , , and , represent the number of appliances under each category. The constraints of the flexible load are defined as: where , , stands for the prediction data of each critical load in building . , is an optimization variable that represents the actual consumed power at each timestep, which is bounded by the critical load , and the total desired load , . Equations (6)-(10) define the power balance and its constrains at the community level: where * is the PV power allocated to building at timestep . Equation (7) defines the range of the PV curtailment, where the variable , denotes the curtailment of allocated PV power in the case that allocated PV power exceeds the upper bound of , . Similarly, , is the variable of load shedding for situations when the available PV power is less than the lower bound of , . Equation (8) enforces that the value of load shedding cannot exceed the lower bound of , . Equations (9) and (10) define the range of the PV allocation factor and the sum of all allocation factors at any timestep must equal 1. The total number of buildings in the community is given by parameter .
The objective of the COL is to minimize the total PV curtailment and load shedding over the whole MPC prediction horizon at the community level. The mathematical formulation of the objective function is defined as: where denotes the prediction horizon. Let be the vector of all optimization variables of the COL: For scenarios where a certain building is prioritized over other buildings, a weighting factor > 1 is introduced into the cost function shown in Equation (11) to obtain: This will ensure that a prioritized building will experience less load shed , . For constant weighting scenarios, of the prioritized building is twice as large as the rest of the buildings over the whole simulation. For occupancy-based time-varying weighting scenarios, of any building is doubled when that building is occupied.

Building Agent Layer
The BAL performs MPC-based optimal load scheduling with detailed device models. The overall optimization problem is a MILP since our device models include binary variables. Each building agent coordinates the electricity usage of an HVAC model, four types of building loads, and a battery. Since all the equations in this section apply for every individual building , to avoid redundancy, we have removed the notation of building index in the following discussion. For each of the studied buildings, the power balance that must be satisfied at each timestep is given by: where PV curtailment is limited by how much PV generation is available: Two different cost functions are designed to be compared: (1) to minimize unserved load ratio: and (2) to maximize thermal comfort: In Equation (17), is the same predicted load upper bound discussed in Section 3.1 in Equation (4). The difference between this upper bound and the actual operated loads is minimized to achieve maximum served load. In Equation (19), the first term penalizes when the indoor air temperature deviates from the desired temperature range given by and , which are the lower and upper bounds of the indoor air temperature. To avoid simultaneous charging and discharging of the battery as well as PV curtailment, the objective function also includes small penalizations of charging and curtailment ′ [24]. The room temperature is predicted with a linear regression model shown in Equations (21)-(23). The independent variables include the ambient temperature , indoor room temperature , and solar irradiance of the past two timesteps, and the speed of the HVAC equipment of the past one timestep . The normalized speed ranges from 0 to 1. The resulted HVAC system power is thus the product of the speed ratio and the nominal power , . The choice of regression over two past terms is to reflect the impact of building thermal mass on indoor temperature evolution while balancing prediction accuracy and computational time [25]. In this model, the internal heat gain was not included as it is calculated from the actual operated devices (i.e., optimization variables).
Having it in the temperature prediction model will further couple the temperature calculation and the load scheduling, causing the computational effort to be greater. Additionally, compared to the solar heat gain, the internal heat gain accounts for less than 10% of the total heat gain in our case. Due to the above reasons, we did not include the internal heat gain in this model.
To account for the uncertainty in the outdoor air temperature and solar irradiance forecasts, we use chance constraints to ensure that thermal comfort is maintained with a high probability [26]. The chance constraints are given by: where is the maximum violation probability of the chance constraint. We assume that the forecasting errors for all timesteps follow the same normal distribution and are independent for each timestep: , ~ , ( ) .
The outdoor temperature and solar irradiance predictions can, thus, be represented as: where , and , are the forecasts of ambient temperature and solar irradiance while , and , are the forecast errors. The chance constraint shown in Equation (25) can be rewritten as: where: Then, by substituting Equations (21), (28), and (29) for , the above equation becomes: Since , and , are normally distributed, is also normally distributed with the following mean and standard deviation : Hence, the chance constraint in Equation (30) can be reformulated as: where Φ(•) is the cumulative distribution function (CDF) of the standard normal distribution (0, 1). Finally, by taking the inverse CDF of both sides in Equation (35), we obtain the chance constraint for ensuring the indoor temperature not exceeding the upper bound of with the probability of (1 − ) as follows: Taking a similar derivation process for Equation (24), we obtain the chance constraint for the temperature lower bound: As mentioned above, the electrical loads consist of four types: sheddable, modulatable, shiftable, and critical, which are summed in the following equation: where , , , , , , and , are the optimization variables for individual loads in each category. The mathematical formulation of the sheddable load is shown in Equation (39), where , is a binary optimization variable and , is the original sheddable load power demand data. The actual sheddable load after optimization , is determined by the ON/OFF status represented by the binary variable.
Equation (40) sets the lower and upper bound of the optimization variable , , which represents the modulatable load power demand. The actual demand is modulated between zero and the original demand data , .
Equation (41) states that the actual critical load , must be exactly equal to the critical power demand data , .
The shiftable loads are scheduled through scheduling matrices [15]. First, using the power data [27], we extracted the average cycle time , and the average power demand Once the starting time of a load is selected, the power demand of the load is then fixed until it finishes its cycle. The appliance must finish its cycle before the horizon ends ( ∈ 1, … , − , + 1 ). Here, we assume that each shiftable load operates once and only once in each horizon, which is Next, a scheduling matrix , of shape × ( − , + 1) is generated for each shiftable load. The actual power shape of the load, denoted , , is calculated by: For instance, when = 12, , = 3, an appliance scheduling matrix of shape 12 × 10 is generated as follows: The linear battery model adopted in this work is shown in Equations (46)-(48). The battery state of charge (SOC) depends on the SOC of the previous timestep , as well as the battery charging or discharging during each step and the battery charging/discharging efficiencies and . Constraints in Equations (47)-(48) enforce the acceptable limits for charging/discharging power and battery SOC: The optimization variables in each building agent are collected in vector :

Case Study
The proposed architecture has been tested with a case study based on a real-world community located in Anna Maria Island, FL [28]. It is a net-zero energy community made up of residential units and small commercial buildings with on-site PV panels. To demonstrate the idea of dynamic power sharing among buildings, the data for three buildings of different types are used in the case study [27]. The selected buildings are: one residential building (area: 93.8 m 2 ), one ice cream shop (area: 160.5 m 2 ), and one bakery (area: 410 m 2 ). All buildings use heat pumps as the HVAC equipment. All data for the case study have been exported from a validated physics-based model of the studied community [29]. The weather file embedded in the model is typical meteorological year (TMY) data for the weather station at Tampa International Airport [30]. The load data consists of power submetering data provided by the community [27]. The solar irradiance data are collected through a local solar station. The indoor temperature data are simulation results generated by the physics-based room models [31]. The simulations are run in Python 2.7 with Gurobi 9.0 [32] as the optimization engine. The average simulation time of each scenario is about 20 s in Windows 7 operating system on a DELL T5810 workstation with 32 GB RAM and a 3.50 GHz Intel Xeon CPU (E5-1620 v4) processor.

Simulation Scenario Design
The optimal resource allocation and load scheduling MPC algorithm for the community when disconnected from the grid was simulated for 48 h within Florida's hurricane season on August 4 and 5. The timestep ∆ for both COL and BAL is 1 h and the MPC horizon = 12 h to balance the tradeoff between forecast information and computational time. Table 1 lists the 10 scenarios covering various weighting methods at the operator layer and two different objectives at the building layer. In the following discussion, R stands for Residential, I stands for Ice Cream Shop, and B stands for Bakery. Each scenario was run for all three buildings. In total, 30 simulations were run and analyzed. In the room temperature constraints, the lower and upper temperature limits and are governed by ASHRAE Standard 55-2017 [33], which recommends the temperature range for thermal comfort to be approximately between 67 ℉ and 82 ℉ (20-28 ℃). Thus, is 20 ℃ and is 28 ℃. Table 2 summarizes the coefficients of the HVAC linear regression models. The prediction accuracy is measured with the root mean square error (RMSE). The nominal power of each heat pump is listed in the last row of Table 2.  Table 3 summarizes the load categorization results following the classification proposed in Section 2.2. In this study, we determine whether a load is sheddable from the building owner's perspective. For instance, the coffee maker and the soda dispenser in the ice cream shop are classified as sheddable during the outage. Mixers with variable speed options, as well as the HVAC system, are classified as modulatable loads due to their varying power amplitudes. Since some plug loads in the dataset are unspecified, we sum those loads into one modulatable load. The washer, dryer, and stovetop range are considered shiftable loads in this work as their operation schedules can be flexible if needed. Lights, coolers, and display cases are classified as critical because they are related with occupants' need for safety and food preservation. Due to the islanded circumstances, some loads commonly categorized as critical are considered to be sheddable (e.g., computer) in this paper. Parameters related to battery configuration and penalty coefficients are summarized in Table 4. We assumed the maximum charging/discharging power to be 40% of the battery energy bound . Further, the initial battery SOC is assumed to be 50% of . The charging/discharging efficiencies are = = 0.9.

Validation of the Chance Constraint
Before further evaluating the simulation results, we first need to validate the chance constraints. The normally distributed error we introduced into outdoor temperature forecast is assumed to be , ~(0, (0.2) ) and the solar irradiance forecast error is assumed to be , ~(0, (0.01) ). The tolerance is 0.05, meaning that with the given error distribution of forecast, the temperature range can be violated 5% of the time in the independent experiments.
Monte Carlo simulations were adopted for the constraint validation. For each timestep of the simulation, normally distributed errors were generated randomly for 1000 times and then added into the temperature prediction model in Equation (21) with the optimal HVAC operation decisions. Results showed that all temperature predictions of 10 scenarios in all three buildings are within the range of 20-28 ℃. As an example, Figure 3 compares the temperature predictions with and without uncertainty using the simulation results for scenario S11. We see that, with the accumulation of prediction errors (both positive and negative), the absolute difference between the temperature trajectories with and without forecast error lies within the 0-0.5 ℃ range.

Impact of Weighting Factor
This section first discusses the allocation factors generated by the operator layer, which later serves as the input for the smart controllers at the building layer. Then, we compare the scheduled load shapes, battery behavior, and indoor temperature of each building in different scenarios to further discuss the impact of weighting factors on the KPIs. Figure 4 compares the allocation factors for equally weighted buildings (baseline) with weightings that prioritize each building over the others. Qualitatively, when all buildings are equally weighted in the allocation process (second plot from top), we see a rather random behavior for the PV allocation during the nighttime when no PV power is available. All three buildings take turn to get full PV power ( = 1) because they have the same objective function value. On the contrary, for the scenarios when single building is prioritized, the prioritized building gets full PV power alone during the nighttime (bottom three plots). During the daytime, when more PV generation is available, the allocation results follow similar trends for all scenarios regardless of the weighting method. Although generally we see less load shedding in the prioritized building, as well as a higher value of the allocation factor, the allocation process is mostly constrained by the building load flexibility ranges. More specifically, buildings with a higher load flexibility lower bound (i.e., ice cream shop) tend to get more allowable load than other buildings.  From the bottom plot, we see that similar to single building prioritized scenarios, when at night only residential building is occupied, it gets full PV allocation. However, when the time reaches 5 A.M., the allocation factor of the residential building starts to decrease and during the day only a few hours will it get PV power due to its unoccupied status. During the daytime, when both the bakery and ice cream shop are occupied, the allocation basically follows the buildings' power flexibility lower bounds as discussed before. To further quantify the impact of different weighting methods, the mean values of the allocation factors , as well as the total allocated PV energy are listed in Table 5. Due to the highly stochastic allocation during nighttime when no PV power is available, we only counted hours when PV generation is greater than zero in the calculation of . From the table, we noticed that having a lower mean allocation factor does not necessarily mean less PV energy allocation. For example, in the scenario where the residential building is prioritized, its is less than 22% while for the bakery it is almost 33%. However, the total PV energy allocated to the residential building is 33.42% more than that allocated to the bakery. This is because the residential building has higher values during hours with the most PV generation (i.e., around noon). This indicates that having a higher allocation factor when more PV power is generated is more crucial. When looking at the occupancy-based weighting scenario, the residential building PV energy exceeds that of the equal weighting scenario since the shortly occupied hours during the day (e.g., hours 34-36) bring more allocation. Overall, no matter which weighting method is adopted, the ice cream shop is always allocated the most PV energy due to its large refrigeration loads, while the residential building is always allocated the least amount of PV energy (except when it is prioritized in scenarios S21_R and S22_R). This indicates that the impact of power flexibility is more prominent than the weighting factors during the resource allocation. Next, the simulation results will be discussed for the various PV allocation methods. In the following discussion, we highlight a subset of the results; however, the complete set of results are available in Appendix A and quantitative results for all 30 simulations are summarized in Table A1. In the following simulation results, the baseline power is the original load shape from data. The positive battery power means charging and negative means discharging. The scheduled sheddable, modulatable, shiftable loads, and critical loads are represented by color blocks. When evaluating the thermal comfort results, the baseline temperature is the original indoor temperature with a setpoint of 24 °C without optimization. For clarity, the label S21 in the temperature plots represents the scenario of the discussed building being prioritized, as described in Table 1.
The residential building operation is compared in the scenario where all buildings are equally weighted and where the residential building is prioritized in Figures 6 and 7, respectively. In both scenarios, we see that shiftable loads are scheduled during the day when more PV power is available. All sheddable and modulatable loads are satisfied in both cases (see Table A1 for details). When the allocated PV power is more than doubled in the residential building due to it being prioritized, we see more battery charging and discharging in Figure 7. However, more than enough PV power is allocated to the residential building in this case due to its high priority, resulting in 31.25% of the allocated PV power being curtailed. Additionally, more power is allocated to the HVAC system in Figure 7, causing the indoor temperature to be closer to the lower bound ( Figure 8). Comparing S11, S21, S31 with various weighting factors in Figure 8, we see that scenarios with more allocated PV power results in a lower indoor temperature since more power is available for the HVAC load. In Figure 8, all temperatures are within the comfort bounds. It is noted that in Figure 8, S12, S22, and S32 temperature curves have almost the same trend that they cannot be differentiated from the plot.     Figure 10 shows the results with occupancy-based weighting. Since the total allocated PV energy in Figure 10 is reduced by about 12% that compared to Figure 9, we see much less battery charging and a slight reduction of HVAC power in Figure 10. All sheddable loads are satisfied in both cases (see table A1 for details). In Figure 11, the indoor temperature trajectories of S11 and S21 overlap with each other as almost the same amount of PV power is allocated to the ice cream shop in these two scenarios. The indoor temperature in simulation scenario S31 first drops below those of scenarios S11 and S21 in the morning due to a precooling between 6 to 9 A.M., and then exceeds them in the afternoon due to less power available to operate the HVAC system. A similar trend is also seen in the following simulation day. As in the residential building, Figure 11 shows that the indoor thermal comfort of the ice cream shop was maintained within the given temperature bounds. It is noted that in Figure 11, S12, S22, and S32 temperature curves have almost the same trend that they cannot be differentiated from the plot.     Figure 13 with occupancybased weighting. Due to a reduction of PV power in Figure 13, much less power is allocated to the HVAC system, especially during late afternoon (e.g., hour 16 and 40). The battery discharging is almost the same in the two scenarios, both to satisfy the four types of loads present in this building. All sheddable and modulatable loads are satisfied in both cases (see Table A1 for details). However, battery charging only happens about once a day in scenario S31 given the focused allocated PV power shape. In Figure 14, the indoor temperature for S31 is higher than S11 due to less power available to operate the HVAC system. All temperatures are within the comfort temperature bounds. It is noted that in Figure 14, S12, S22, and S32 temperature curves have almost the same trend that they cannot be differentiated from the plot.   To summarize, in this section, we discussed the PV resource allocation results under different weighting methods. The resulted load shape, battery behavior, and indoor temperatures are also discussed qualitatively. From the discussion, we found that the weighting method of the operator layer directly affects the mean allocation factor of each building. When one building is prioritized, we see an obvious increase of . However, a higher does not necessarily mean more PV energy allocation. A higher allocation factor during time periods with more PV generation (e.g., around noon) is more crucial than a higher mean value of the allocation factor overall. Additionally, we noticed that the allocation process is mostly constrained by the building load flexibility ranges. More specifically, buildings with a higher load flexibility lower bound (i.e., ice cream shop with large critical loads) tend to get more allowable load than other buildings. Additionally, when prioritizing buildings according to occupancy status, the building with longer occupant presence gets more PV power, which is not necessarily a fair allocation method. For instance, in S31, 5.5% of the PV energy allocated to the residential building was curtailed. Since the allocation process was according to building occupancy time, more than enough power is allocated to the residential building in this case. Lastly, the resulting load schedule, battery behavior, and indoor temperature are directly correlated with the available PV power when other system settings are the same (e.g., battery charging constraints and penalty coefficients).

Impact of Objective Function
This section discusses the impact of different objective functions on the scheduled load shapes, battery behavior, and indoor temperature. Similar to the last section, qualitative discussions will first be provided. Figure 15 plots the results of the residential building with equal weighting and the objective is to maximize thermal comfort. Compared with Figure 6, we see that when the objective switches from minimizing unserved load to maximizing comfort, there is an obvious increase of HVAC power and the temperature gets closer to the temperature setpoint of 24 ℃ (Figure 8). When comparing Figure  16 with Figure 7, we see a decrease of HVAC power usage because before (S21 in Figure 8), the indoor temperature was below 24 ℃; when the objective is to minimize the temperature deviation from 24 ℃ , the required cooling power is actually less. The HVAC power is saved to get the indoor temperature closer to the temperature setpoint. Figure 15. Residential building load shape, battery behavior, and PV power (S12: equal weighting, maximizing thermal comfort). Comparing Figure 17 with Figure 9, we see a decrease of serving in sheddable load when the objective switches from minimizing unserved load to maximizing comfort. As a result, 63.72% of sheddable load is unserved in this scenario (Table A1). However, the HVAC power also decreases in order to increase the indoor temperature to the temperature setpoint. The saved PV power is charged into the battery as we see an increase of battery charging in Figure 17. Similar observation can be found if we compare Figure 18 with Figure 12, where unserved ratio of sheddable load increases to 99.03% and modulatable to 68.89% due to the change of objective function (Table A1).  To further quantify the impact of weighting factor and objective function, we summarized the community overall KPIs in Tables 6 and 7. The KPIs include PV curtailment ratio, unserved load ratio, temperature deviation from setpoint, and required battery size. The definition of the PV curtailment ratio is the total curtailed PV energy over the generated energy during the simulation horizon. The unserved load ratio is calculated by dividing the total unserved load by the total original load over the simulation horizon. The definition of the temperature deviation from setpoint is adapted from the root mean square deviation (RMSD), which is the root mean of the square of the deviation between the indoor temperature and the temperature setpoint over the 48-h simulation denoted by: where = 48 is the simulation horizon. Here, the temperature setpoint is selected to be the middle of the comfort temperature range: 24 ℃. Lastly, the required battery size is obtained by subtracting the minimum battery SOC from the maximum value. This gives us a sense of how much of the battery capacity has been utilized under different scenarios. Further, this could help to guide the battery sizing to enhance community resilience. From Table 6, we see that PV curtailment only happens when the residential building is prioritized (S21_R and S22_R) or when occupancy-based weighting is implemented (S31 and S32). This is because the residential building has a relatively small power demand compared to the other two commercial buildings. When it is prioritized by the operator layer, more PV generation is allocated than needed, resulting in PV curtailment. This also echoes our discussions above that allocating purely based on building occupancy status could lead to unfair allocation situations. In the table, the shiftable load unserved load ratio is the same for all scenarios. This is because of our assumption that each shiftable load operates once and only once every day. However, in the original data, some loads might have operated more than once, causing "unserved load" for shiftable loads. Given this, we can consider that all loads are satisfied for the scenarios to minimize unserved load (S11 to S31 in Table 6). When looking at scenarios S12-S32 in Table 6, we see an increase of unserved load as the objective switches to maximizing comfort. The largest unserved load ratio appears in the scenario where residential building is prioritized. From Table 6, the scenarios that perform the best would be S11, S21_I, and S21_B if we only consider PV curtailment and unserved load ratio. In these scenarios, the PV allocation is either equally weighting all buildings or prioritizing those with larger power demand while minimizing the unserved load ratio.
Next, we analyze the temperature deviation and necessary battery size shown in Table 7. We see that all scenarios with the thermal comfort objective experience the fewest temperature deviations. This means that the indoor temperature is well controlled to stay near the temperature setpoint. In the remaining scenarios with the unserved load objective, large deviations in temperature can be seen. For many scenarios, this is due to lower indoor temperatures than the temperature setpoint. Hence, setting the temperature setpoint appropriately can save HVAC energy. However, in our case, the saved energy was either curtailed or charged into the battery instead of satisfying the other loads. This also leads to larger battery sizes in scenarios to maximize comfort (average size: 221.5 kWh) than scenarios to minimize unserved load (average size: 200.5 kWh). Therefore, a co-optimization of thermal comfort and unserved load is necessary with the benefit of less curtailment, smaller unserved load ratio, assured thermal comfort, as well as smaller battery size.
The above simulation results highlight the impact of the objective function on KPI outcomes. From the above discussions, we identified that if only PV curtailment and unserved load ratio are considered, the best option is to allocate the PV resource either equally weighting or prioritizing buildings with larger power demand while minimizing unserved load ratio. After further looking at other indices, we noticed that choosing the optimization objective to track an appropriately selected indoor room temperature setpoint will save HVAC energy. However, this will not lead to lower unserved ratio for other load types. Instead, the PV curtailment could increase. The two objectives have a competitive relationship: serving more HVAC power to increase thermal comfort will decrease the other served load.

Conclusions
We proposed a novel decentralized control architecture for renewable resource allocation and load scheduling of resilient communities. This MPC-based optimization architecture consists of a community operator layer that allocates the daily PV power generation to achieve the communitywide optimum and a building agent layer that schedules building loads to achieve its local optimum in each building. Three allocation methods were tested for the operator layer: equally weighted, weighted based on building priority, and weighted based on building occupancy. At the building level, two objective functions were compared: minimizing unserved load ratio versus maximizing thermal comfort. The proposed framework has the advantage of distributed computational effort and is easier to be scaled up than traditional centralized control, which is not robust for large-scale deployment. Additionally, the comparison between different combinations of allocation methods and objective functions provides guidance for real-world deployment by community and microgrid operators.
Through a case study for an islanded community in FL for 48 h, we evaluated the proposed architecture with respect to user-centric performance metrics (KPIs). We found that the allocation process is mostly constrained by the building load flexibility. More specifically, buildings with less load flexibility (i.e., ice cream shop with large critical loads) tend to be allocated more PV generation than other buildings. Additionally, when prioritizing buildings according to occupancy status, the building with longer occupancy duration is allocated more PV power, which may not result in a fair allocation method and could lead to more PV curtailment.
Additionally, through the analysis of different objective functions, we found that setting the objective to target at an appropriately selected indoor temperature setpoint will result in increased HVAC energy savings. However, in our case study this did not lead to lower unserved ratio for other load types. Instead, the PV curtailment increased. The two objectives have a competitive relationship: serving more HVAC power to increase thermal comfort will decrease the other served load. Therefore, it is necessary for the building agent to have multi-objective optimization to minimize unserved load ratio and maximize comfort simultaneously. This will bring the benefit of less curtailment, smaller unserved load ratio, assured thermal comfort, as well as smaller battery size. However, the weighting between the two objectives needs to be carefully selected as their scales are quite different.
For future work, we will conduct multi-objective optimization for the building agent layer to investigate the trade-off between minimizing unserved load ratio and maximizing thermal comfort. Uncertainty of PV generation should also be included to reflect the impact of different weather conditions.   Figure A1. Residential building load shape, battery behavior, and PV power (S31: occupancy-based weighting, minimizing unserved load ratio). Figure A2. Residential building load shape, battery behavior, and PV power (S32: occupancy-based weighting, maximizing thermal comfort).