An Intelligent Multi-Stage Optimization Approach for Community Based Micro-Grid Within Multi-Microgrid Paradigm

Smart community setups nowadays are subjected to complicated issues such as instability, intermittent integration of the load at the demand side, and lack of intelligent two-way communication process. These issues need to be addressed in terms of a balanced power demand dispatch (DD) in the real-time or day-ahead duplex signal regime under multi-microgrids. This paper offers an intelligent multi-agent-based approach that works between different levels of communication and their respective layers for a community-based system to optimize the power in community-based multi-microgrids model. This will further enhance user personal comfort. Constraints relative to cost minimization also have a relation with this model. A three-level structure with various layers of autonomous agents take intelligent decisions based on prioritized particle swarm optimization (P-PSO), prioritized plug and play (PPnP), and knapsack; considering DD as the main driver of the system to address objectives like price and power consumption uncertainties. Distinct smart home models, depending upon their living habits, are keenly observed providing their power infrastructure and personal comfort. Load appliances considered as load agents are individually contemplated for maximum proficiency. Furthermore, two-way communication between utility and consumers lowers down the risk of the inefficiency of the system.


I. INTRODUCTION AND MOTIVATION
Due to the energy challenges that we are facing in the developing world, the smart interaction between different sources and the consuming bodies is an efficient way out. Energy interactions increase stakeholder participation for efficient energy management, enhanced economic stability and developing a better market for power exchange. Researchers keep on evolving advanced structures for hybrid models to deal with this challenge. Renewable energy source (RES), along with optimal storage, is integrated in such a way that optimum generation patterns are noticed. A study in [1] noticed The associate editor coordinating the review of this manuscript and approving it for publication was Weiguo Xia . these facts and stated an off-grid home modeling system with the interaction of the smart homes to reduce consumption patterns. Prototype in [2] resulted in controller outputs with conventional and fuzzy control logic. Loads, real-time pricing (RTP), and consumer comfort plays a main role for demand response (DR) decision logic. RTP infused heuristic algorithms are discussed in [3] that schedule load, cost and user preferences. Homes in smart communities take decision to buy or sell electricity in DR logic. Electricity prices and personal comfort are the objective function for this market in research work, as reported in [4]. Authors in [5] explained that a long-term online power scheduling technique is far better and can reduce cost by 17% as compared to shortterm techniques. Work in [6] also emphasizes large data set for artificial neural networks (ANN) to be more precise and aim-oriented for a one-day forecast. Research in [7] presented quality of experience (QoE) for every load for a week, RES along with electric vehicles (EV) optimally integrated with each other for balancing the consumption caused by QOEs of different loads. Near-optimal load scheduling enables inter and intra neighborhood scheduling of the load with efficiency near to optimal scheduling in [8].
Smart community setup evolves state of the art and unique trend to present a cost-effective solution, keeping in view user comfort and renewable energy penetration into the electrical grid. There are limitations in achieving user comfort, power efficiency, and cost-effectiveness at the same time. The novelty of the proposed framework is to address these limitations simultaneously. These include introducing the smart heating, ventilation, and air conditioning (HVAC) thermostat, multi-agent system (MAS), and algorithms like prioritized plug and play (PPnP). Also, prioritized particle swarm optimization (P-PSO) and knapsack implemented in both python agent development environment (PADE) and MATLAB. We have identified the limitations of day-ahead (DA) and real-time (RT) information sharing among multi hierarchical structure to get the optimum results. MAS, when integrated with the smart community, provides a fast communication and self-sustainable setup with optimal control for overall efficiency and power effective solution. Proposed research work provides a deep understanding of agents involved equally in the smart community network. It also proposes an overall optimized model that consists of a multilayered controller-based hierarchical structure that takes multiple criteria decisions for reforming multi-microgrid (MMG) structure. The MMG structure is divided into lower ordered structures for enhanced practical scenarios to scale down overall cost and adaption of smart algorithm-based efficient techniques. Each layer contains its own agents connected to respective controller, which are categorized as the home controller, local controller and global controller. The layered structure ensures the best possible outcome of every layer, particularly and collectively. P-PSO, PPnP, and knapsack are used side by side with specific objective function to get optimum results with respect to price, efficiency, user comfort, and controlled effect on the thermostat of heavy load i.e. HVAC. Real-time, as well as day-ahead signals, are multi-processed in their respective levels integrated in PADE in our proposed framework and combined to obtain optimized signals. Unpredictable and dynamic nature of the consumption and price patterns are optimized, in MG-MMG based smart grid setup, with the proposed approach.
This paper is arranged as follows. The related work is shown in section II. In section III, the design for a smart community is presented that consists of autonomous agents, smart home controllers, employed algorithms, and MAS based multi-layered hierarchy. The results and discussion in section IV presents the main setup, evaluated cases, and achieved results. The paper is concluded in section V.

II. RELATED WORK
According to [9], multi-dimensional array uses different algorithms such as heuristic optimization to reduce cost, energy consumption, and peak-to-average reduction, bat flower pollination, and hybrid bat, inspiring pollination for scheduling in demand-side management (DSM). Small home setup is optimized by the operation based on Bayesian optimal algorithm (BOA) data-driven online energy management system having distributed generations (DGs) powered by photovoltaic (PV) array and wind working in islanded and connected mode with the grid is calculated in [10]. Authors in [11] proposed an energy management system in terms of cost reduction and peak-valley optimization using heuristic optimization for minimizing consumers' cost under day-ahead electricity pricing. Techniques to control the interruptible and transferable loads and uncontrolled loads are not considered. However, their consumption patterns were integrated. Researchers in [12] used MAS to sense real-time operation of multi-microgrids. Majorly, they took uncertainties regarding weather, solar irradiance and load into account for VOLUME 8, 2020 the evaluation of high-power quality and energy management by using artificial intelligence.
The research effort in [13] focuses on the smart grid energy management with the aim of reducing the electricity consumption cost w.r.t peak-to-average ratio and user discomfort by using different metaheuristic techniques like Flower Pollination Algorithm (FPA) and Jaya Optimization Algorithm (JOA). Work reported in [14] used Optimal Stopping Rule (OSR) as a technique to schedule the loads. Their proposed OSR deals with appliance categorization, total cost reduction, pricing schemes, and human presence. PSO technique for modeling generation, load and storage system to get optimized result, is discussed in [15]. Signals are fed into active controller that manage the thermostat of cooling and heating devices within maximum and minimum temperature constraints. Major work is done in comparison with existing microgrid (MG) trends and their problems in [16]. After defining the MG inputs, output and challenges for control and protection (e.g., bidirectional power flow, stability issues, low inertia) have been discussed.
Work in [17] proposed that energy can be balanced in a smart grid via plug-and-play algorithm (PnP). The working of controller is based on PnP algorithm to optimize the system performance. A framework for smart transactive energy is briefly discussed in [18] that explains simulation results for the effectiveness of using a scheme to reduce the price by 15%, increasing consumption factor about 30% whereas multiple home microgrids are considered that have dispatchable and non-dispatchable distributed energy resources (DER). Excess power is supplied to the neighboring and the main grid according to their respective bids. The focus of research in [19] is to minimize deviation of the load curve and energy cost with reference to home appliances using home energy management; the methodology focuses on considering that every house smartly deals with the shiftable loads and has their own DER. It is observed that total energy payment costs 277.97, 224.94 and 209.12 cents with load profile deviations 29.48, 25.34 and 29.41 kWh are computed for the three discussed scenarios. The research work in [20] deals with real-time energy management within home MG and power issues raised among operational reliability and functionality without discussing variation in the generation and load demand transient. Thus, Multi-Period Artificial Bee Colony (MABC) topology is used for the central energy management system that will enhance reliability concerns, mentioned in [20]. Both deterministic and stochastic approaches are used in paper [21] to check the system performance, and it is observed that cost projection is 1700% higher in case of deterministic approach than that of stochastic approach and more than 370% increment in cost estimation is observed with the penetration of PV system. Work in [22] proposes an energy management system (EMS) that introduces exchange between grid-connected homes by using the concepts of multi-home based MG. Net-metering technology is also considered for the purpose of power trading between grids. The algorithm in [22] for the market-clearing price, results in the achievement of 15% and 30% load consumption factors, for specified time intervals.

A. AUTONOMOUS AGENTS
Actions are performed by configured agents in a very intelligent manner. Smart decisions and their control are the main objective of operating the process. The agents are reconfigurable, adjustable, artificially intelligent, and aim oriented. Each agent inputs data and takes decisions based on its selfadaptive capabilities. Firstly, knapsack and then, PPnP take a progressive decision to hit the target of optimal consumption to get desired results for each layer. P-PSO subjects to objective functions for smart community design.

B. SMART HOME-CONTROLLER SETUP
A smart home-controller is fundamentally a generic home model that is modified with rich, middle, and poor homes. Our working model deals with real-time and day-ahead signals. Smart home-controller is taking real-time generation signals from the global controller because of which consumption patterns are altered. Every home has its own home-controller referred to three different functionalities discussed in the algorithm-based part of the paper, which depends on the living habits of the residents. Each smart home is equipped with its dedicated two-way home controller. Devices have their own smart plugs that are being operated based on PPnP.
Each home has its own living standards based on personal comfort. Cost-effective solutions that they can afford and different living habits raise the economic variability between the residents of the said home. Middle home contains air conditioners (AC), whereas rich homes are provided with the smart thermostat HVAC systems. A comprehensive home model is provided with all the basic needs. The observable pay-off can be seen between the consumption patterns and comfort of the concerned community. The concepts of object-oriented programing (OOP) in python are used to get the desired results. Each smart plug is fed with PPnP algorithm and devices are divided into three types of loads namely fixed, time controllable and power flexible loads. Energy-efficient devices are used in terms of fixed loads. A proposed multi-layered multi agent network for the smart connected community within a microgrid is shown in figure 1. Appliances considered can be seen in table 1. Fixed loads are elaborated in table 2.

1) FIXED LOADS
These devices completely rely on user control and comfort. Only one-way (device-to-home controller) signals are  introduced in them to avoid complications in the network. The total number of devices depends on the economical and need factors of each house.

2) TIME CONTROLLABLE LOADS
Intelligent smart plugs of these devices are switched on when surplus power (P sur ) is positive; these loads are transferred to the time of low peak without compensating the user comfort on a time scale of 24 hours, as shown in table 3. Prioritized PPnP acts upon these loads significantly. These automated devices work according to the overall consumption pattern of that specific community to ensure the optimal consumption, pricing patterns, and user comfort of the concerned domain.

3) POWER FLEXIBLE LOADS
Air conditioning consumes almost 50% of the total consumption patterns on hot summer days. Smart thermostat ensures AC and HVAC systems operate within the 20 • C-27 • C, according to the American Society of Heating, Refrigerating, and Air-Conditioning Engineers (ASHRAE) Standard 55-2010 [23]. Smart thermostat inputs the real-time P sur signals and decides to adjust the temperature within the provided range. These loads are shown in table 4. According to the ashire505 standard, both upper and lower limits of the user comfort are considered when developing thermostat controlled by power signals received from the local controller on a real-time basis. ASHRAE standard offers two ranges of operation and used 80% acceptability limit condition of outdoor temperature conditions. Smart thermostat follows ASHRAE standard criteria in accordance with the outside temperature [24].

4) SMART THERMOSTAT
Demand dispatch consumption signals generated by level 1 are then fed to level 2 local community controller (LCC) where energy gap is calculated, P sur signals there are used in the active controller on HVAC system for smart thermostat to work according to proposed framework. Surplus signals also depend on the cheap availability of the RES along with minimal dependence on the conventional electric grid.
The home-controller receives P sur signals, average P sur , deviation from P sur and 24-hours real temperature and it directs those signals to the smart thermostat, where heating and cooling profile of home is further progressed. A smart thermostat here acts as 24-hourly signals for the active device.

5) COOLING MODE
P sur signals are received from LCC at time interval t to smart thermostat. After calculating difference between real room temperature and desired temperature, HVAC decides to operate system between S +ve and S −ve according to (1)-(4).

R. Temp(t) = T des + T
R. Temp(t) is room temp at t. T is a fluctuation from the desirable temperature T .t( min) and T. t( max) are the minimum and maximum acceptable limits according to ASHRAE standard 55-2010.
Power signals received are referred to as P sur + ve and P sur − ve. They respond to T. t( max) and T .t( min) accordingly. Value of T > 0 corresponds to the real temperature where the setpoint exceeds the desired temperature limit. In the case of P sur − ve, temperature set point is raised from T des as surplus power signal is less than threshold power limit. Conversely, at any value of P sur + ve indicates lowering of temperature due to more surplus power provided by (5)-(8).
Real temperature at time t can be calculated now by (9)-(10), C. ALGORITHMS Hybrid (PPnP, P-PSO and knapsack) approach is proposed, aiming at the objectives such as, prioritizing clean energy, maximum user comfort, and curtailing price per unit. These objectives combined make this research a novel approach for adapting microgrids as an enhanced trend to follow. The randomness of the consumption patterns of users in smart grid made them very tricky to adapt, so the knapsack algorithm benefits both utility and user to get optimal solutions as per their related benefits. Objects, values and weights are optimally iterated to get optimum results. Multiple criteria knapsack problem controls the weight of the provided objective functions to optimally solve the whole problem. Multiple problem statements provide streamlined results. The comparison of algorithms reported in literature with proposed approach are shown in appendix section i.e. table 8 shows evaluation and in table 9 shows performance.

1) PYTHON AGENT DEVELOPMENT ENVIRONMENT (PADE)
Python provides a customized environment for agent configuration and communication. OpenSistemas created OsBrain that is used for this multi-agent communication setup. This library runs independent agents as an intelligent entity for decision making and two-way message and control handling programs allowing request-reply, push-pull, and publish-subscribe.
OsBrain eases the configuration and development related to a multi hierarchical structure. Entities act as agents and can be reconfigured even when they are running in simulations providing robust, highly intelligent, and flexible multi-agent systems. Automated data, analysis tools, and numerical computing are the main constituents of this library. Knapsack and PPnP have their independent classes in the proposed algorithm. Controllers call the functions of these agents when needed.

2) KNAPSACK
In this work, the main objectives are to reduce cost, optimize the communication setup to maximize the comfort level of end-user and reduce overall scheduling time. Here, the scheduling problem is formulated using Multiple Knapsack Problem (MKP) criterion [25]. It is a resource allocation problem that consists of 'm' resources (capacities), set of 'n' objects, 'j' number of knapsacks and map our scheduling problem in MKP as follows: • Consider ''j'' number of knapsacks as power ratings in each time slot.
• Total agents act as the number of objects in the algorithm.
• Any time slot ''t'' is power consumption by any device i.e. subjected as weight in the knapsack.
• The value of an object in a specific time slot is the cost of power consumption of the appliance in that time slot.
• The value of the binary variable ''χ'' can be 0 or 1 depending on the state of electrical appliance. The total power consumption for all types of appliances should not exceed maximum power capacity in each hour denoted as t (time slot). A constraint is introduced that limits the power consumption and depends on load profile and its states. The constraints show that power consumption is predefined, Here, γ (t) is the power capacity in each hour that is available from the grid, and χ(t) ∈ [0, 1] denotes the states of appliances. Total power consumption in each hour must be limited to this capacity factor. With the help of this model, the electricity bill of enrolled customers can be controlled and for utility side, it is also beneficial because it ensures that the grid is not overloaded. For this purpose, we consider this limit on a household basis. A variation of the problem formulation applies to community profile, but this requires simultaneous scheduling of all devices in all households in a community that is onerous and probably not worthwhile.

3) PRIORITIZED PLUG-AND-PLAY ALGORITHM (PPnP)
PPnP is an online iterative algorithm. Subsets of measurements in every iteration are fed to the controllers, and then the decisions for the devices take place in an organized manner. Optimal DD patterns are generated at the consumption side by plugging in and out of the devices at low and high pricing patterns, respectively.

4) PRIORITIZED PARTICLE SWARM OPTIMIZATION (P-PSO)
P-PSO is a modified form of generic PSO and conventional genetic algorithm. Technically, P-PSO provides a complete methodology for Layer 1 setup. P-PSO reduces per hour consumption and cuts down peak price patterns. Time and power flexible loads are managed to reduce above mentioned objective functions. The two-layered hierarchical structure of P-PSO consists of (i) Fitness and velocity values that are assigned to the PSO genetic algorithm. (ii) Basic consumption threshold is set because of device ratings.

D. MAS BASED MULTI-LAYERED HIERARCHY
A complete communication setup between multiple layers in PADE is depicted in Figure 2. Firstly, all layers are tested in a mean time of 0.002ms names as a duplex communication test.
A few of data packets are sent multiple times before starting the communication. A reset time of 0.001ms is also included within this test.
D TL is the total load rating of all attached devices. D t is the device to be considered. Priority-based decision handling based on the algorithms. For the case of total power consumption for DD to be an effective method for dispatched generation at any instant t, we must follow equation (14).
Total load at time slot t is considered when power rating of all devices (P (ratt) ) and δ 1 0 on/off states of that device are taken together. At time slot (t-1), P sur signal is detected for the power flexible and time-flexible loads. Device power on/off decision is taken because of the input power signal. Power flexible loads deals in a totally different way. They operate VOLUME 8, 2020 for a 24-hour time schedule in power flexible regime.
Power flexible loads input power signal to steer the thermostat intelligently. Devices linked at time t are connected through PADE model, and all these online devices refer to the total number of connected homes at that time and the devices connected according to [16].
In cases of emergency, control is handed over to the consumer. The consumer is then referred to the need constraints table N nec (i), is later shown in equation (25). If the number of consumers is increased, the decision would be taken on a need constraint table. Bi-directional real-time signal processing is needed in case of an emergency.
In equation (17), P prime regards urgently needed power by the consumer. Higher the need constraint, more abruptly the system must respond. The system, in this regard, work as an emergency-based power provider based on prioritized structure. Every agent in this setup is provided with its emergency switch, where it can demand power in need.

2) COMMUNITY LAYER/LEVEL 2
Devices at the Layer 2 act as sink and source throughout the day. P sur signal has a core task in Layer 2. Sink/source decision is taken on the basis P sur signal at the previous hour time slot set as (t-1). Local community controller receives consumption and generation signals at the same time. The prioritized decision related to community setup is taken at this stage; including BESS, SSB and EV. Three steps are taken here: (i) P sur signal to be positive or negative using knapsack consumption constraints. (ii) Priority of the devices working at this level. (iii) Devices either to be used as sink or source using PPnP algorithm.
According to the priority assigned by this system in PPnP, the behavior of these devices is discussed. The total power consumed at level 2 is calculated by equation (18). The energy gap between level 1 and level 3 decides the functionally and control of level 2. Real-time signals are generated to input P diff . P diff passes P sur + ve/P sur − ve signals to level 3 to fulfill demand dispatch power need.
A triple hierarchical priority, along with DR signals from the generation side, efficiently optimizes the proposed multi-layered structure. Devices mechanism is discussed in ( (19)- (21)), respectively.

3) GENERATION LAYER/LEVEL 3
This level acts as a facilitator between sources, microgrids and level 2.
The output of solar and wind powers with respect to solar input radiation power and wind availability can be calculated through (26) and (27), where G is the perpendicular radiation discussed in the appendix as compared to P rated,1000 at 1000 W/m 2 .ηMPPT is the efficiency of DC/DC converter. Firstly, maximum power point tracking maximizes the output and passes it to the inverter where DC/AC conversions take place. The output power of the photovoltaic array is linked to perpendicular radiation's values, weather conditions and physical characteristics of the installation site [26].
In equation (27), v is the current wind speed at time interval t. P max and P furl are the maximum output power and output power at cut-out speed (kW). The values for v are shown in the appendix. The expansion of wind power plant involves uncertainties associated with wind power output [27]. Technical issues such as, simultaneous incorporation of practical simulations and weather forecasting, with real-time signals, is one of the main challenges in the installation of wind power systems.

Pr.P RES =
Tt.IC Units produced in whole life time (28) Solar and wind energy, on an average, give a lifetime of 20-25 years [28]. A 50-kW solar system produces almost 7000 kWh in a month, and it becomes 1680000 units in its average lifetime. Flowchart of the proposed multi-stage optimization approach illustrating each Layer (or level) implementation steps of the procedure, as shown in figure 3.

A. MAIN SETUP
Smart community based individual MG setup (within MMG paradigm) consists of 3 rich, 7 middle, and 15 poor homes on the same basis as in Figure 1. A realistic approach dealing with overall consumption, price, and personal comfort is compromised with each other. Case 1 is a low renewable generation case with less capital, operational cost and low personal comfort. Case 2 comprises of renewable generation integration more than case 1 but less than case 3. Here a personal comfort was also considered. Case 3 is for a high renewable generation where personal comfort was the main priority rather than price or consumption. Pr.P RES , Pr.P grid , Pr.Batt, Pr.P Prime (in table 10, appendix) are prices per unit of RES, grid, battery, and prime power factor according to the three cases discussed. Everyone can easily adopt this system according to their needs and priorities. A coding framework like this could input any parameters according to the consumer needs and type of system. Workstation specification used for the computation is LENOVO system model 30BBS2UV00 with a processor of Intel R Xeon R Gold 5118 CPU @ 2.30 (48 CPUs), memory 32 GB. Case 1 is prioritized price setup with less personal comfort and quick and easy payback for the initial investment of renewable resources installed. Figure 4 shows a whole picture of this scenario. A notable difference can be seen between MG demand and generation (675 KW/day for case 1) patterns as compared to the other mentioned parameters. Consumption is scheduled through hybrid approach based on P-PSO, knapsack, and PPnP, which can be clearly observed. Figure 5 shows the consumption pattern of poor home w.r.t P-PSO, PPnP and knapsack. Incomparasion, small difference in consumption pattern is observed for a poor home in favor of proposed hybrid method, while analyzing P-PSO only and proposed techniques. Figure 6 deals with middle home where AC unit adds up to the consumed power. A considerable increase is shown in the consumption pattern where AC unit is switched on. In figure 7, rich home shows a low consumption scheduled pattern (via proposed approach) in 24-hour operation of HVAC at lower ranges of power usage. The achieved pattern in figure 7, is low in favor of proposed hybrid method, as compared to scenario with unscheduled consumption and the one scheduled with P-PSO only.

1) STATES FOR TIME FLEXIBLE AND POWER LOADS IN CASE 1
Time flexible loads on/off states according to the applied algorithms (Knapsack and PPnP) are loaded at a 24-hour time scale. Figure 8 shows the absence of a dishwasher and one-hour operation of iron and washing machine in case 1. Time flexible loads of intelligent operation in the middle home is shown in figure 9. The automated operation of these loads in a 24-hour time frame is shown in figure 10.
Algorithm for Level 2 / Community Layer Local Community controller (L.C.C): • Initialize duplex communication between H.C and L.C.C through PADE.
• Kick start related agents.
• Dummy message sending/receiving (response time = 0.1s) • Register device w.r.t community type 1-n While n < N: // Total number of devices 1. Send the message 2. Receive the proposal message and information from agent n 3. n + + 4. end     shown in the form of bar chart in figure 13. Renewable sources when integrated with main grid and battery give a   very optimal pricing schedule at times when they are at their higher efficiencies. Comparison of bills is shown in table 5.

C. EVALUATION CASE 2
Case 2 is a trade-off between personal comfort and pricing; some points at low generation pricing signals customers VOLUME 8, 2020   get the opportunity to enjoy high personal comfort. Payback, in case 2 is less quick than case 1. Total generation (848.6 KW/day for case 2), total demand in MG and the power imbalance prior are shown in figure 14. Generation dispatch (GD) is increased to 1.2564%, compared to case 1. RES is up by 1.4%. This solves load shedding problem at consumer side and gives optimal results for pricing and customer personal comfort. Figure 15 shows poor home consumption when generation is provided as per case 2 methodology.
AC unit contributes quite a visible impact on consumption patterns for middle home as shown in figure 16. Consumption pattern of unscheduled load patterns, with P-PSO, knapsack and PPnP have a noticeable difference in their operation   methodology in a rich home as noticed in figure 17. P-PSO works on-demand dispatch but knapsack and PPnP in our work follow both demand dispatch and DR for better result and methodology. Consumption patterns along, with generation profiles, take decisions for operation and control of time and power flexible loads.

1) STATES FOR TIME FLEXIBLE AND POWER LOADS IN CASE 2
The Knapsack and PPnP are employed like case 1 for Time flexible loads on/off states. Time flexible loads for case 2 profile take the decision of their states based on P sur and low pricing regime. Figure 18 shows time flexible devices scheduling   in poor home according to P sur input. Time flexible loads are plugged on only at time of cheap price and P sur + ve signals, as shown in figure 19. Figure 20 shows optimal time slots of plugging on-time flexible devices according to applied algorithms in rich home. Figure 21 explains power flexible load profile on a 24-hour time scale. Thermostat adjusting between 23.5 • C and 26.5 • C in summers can be observed, however, at certain times case 2 prioritizes minimum price over personal comfort.

2) PRICING IN CASE 2
Case 2 RTP signals are based on the consumption pattern according to the applied algorithm, i.e. knapsack and PPnP is    shown in figure 22. A comparable change in table 6 can be seen in the monthly bills on applying proposed techniques shown in figure 23. Rich homes have noticeably high price pattern due to 24-hour available HVAC system working on ASHRAE standards at lower and higher thermostat levels.

D. EVALUATION CASE 3
Case 3 is integrated with a high volume of RES as compared to the previous cases (refer to table 10); consumers'   personal comfort is the main priority in this case due to which price and consumption patterns are distinguishably high. Figure 24 shows a higher demand for consumer to fulfill their AC needs. Total generation is 1157.5 KW/day and GD is up by 1.7939% as compare to case 1. The personal comfort of all home types is the main priority of the proposed algorithm, as shown in figure 25 i.e. consumption of poor homes with high RES penetration (1.9%). Figure 26 deals with consumption of middle home with proposed algorithms. Figure 27 shows the rich home power consumption pattern is main additive to overall consumption needs of smart community based MG.

1) STATES FOR TIME FLEXIBLE AND POWER LOADS IN CASE 3
Time flexible loads with Knapsack and PPnP in case 3 works the same as in previous cases 1-2. More integration of renewable increases capital cost along with the unit cost for the customers. Figure 28 shows an intelligent plugging of time flexible loads in poor homes. Figure 29 and figure 30 shows time flexible loads for middle and rich home.
The HVAC system in case 3 adjusts to lower and upper limits according to the personal comfort requirement according to the input, as shown in figure 31. Figure 32 and 33 are   thermostat adjustments as related to P-PSO algorithm. P-PSO only works here for demand dispatch functionality.

2) PRICING IN CASE 3
For case 3, a hike in RTP pricing can be seen in figure 34 due to more RES installed initially to acquire optimal personal comfort. Figure 35 elaborates monthly bills according to case discussed. The comparative analysis of pricing schemes for case 3 is shown in table 7. All pricing and consumption patterns are elaborated through a library named as MAT-PLOTLIB. PADE, together with assigned libraries, is used for optimizing results as presented in the graphs. Pricing and consumption are key features that have been optimally solved VOLUME 8, 2020    in this presented work. The parameters of algorithms used in the proposed approach are shown in table 11.

V. CONCLUSION
In this paper, an efficient framework is developed to work among different levels of communities based multimicrogrid. After identifying the lack of communication  between multiple homes and other entities, an intelligent technique is developed, comprising of P-PSO, PPnP, and knapsack in MAS environment. The demand dispatch and demand response models have used side-by-side to obtain optimized results. Three cases dealing with power, price, and personal comfort are compared with the same community of 25 homes. Real-time and day-ahead signals both help to get these results in our proposed scheme. Psur is optimized several times in hierarchical structure in Layer 1 and Layer 2, respectively, to intelligently dispatch Pgen according to the microgrid and customers' energy and personal comfort needs. Considering case 1 as reference for the lowest RES generation case, the generation dispatch is increased to 1.2564% and 1.7939% in case 2 and case 3, respectively. Pr.P RES show an increase of 1.4% and 1.9% for RES integration to fulfill personal comfort needs in case 2 and 3. Rich houses are mostly concerned in terms of per month pricing, an increase of 1.0064%, and 1.1154% is seen in case 2 and case 3 as compared to case 1. Similarly, the highest monthly bill reduction in achieved in case 1 followed by the cases 2 and 3. For a realistic study, the difference in the setup has also catered for simulated cases via proposed techniques. Price and personal comfort are a trade-off in the proposed scheme. Homes are divided according to their monthly bill affording mechanism. P-PSO is applied to day-ahead signals, whereas PPnP and knapsack handle RTP signals. HVAC works on lower and upper limits optimally with the help of smart thermostat settings discussed in the presented work. The overall results in terms of cost analysis, power consumption, load balancing, and user comfort have obtained for three distinct cases. The results for each case have shown optimized load management with the available power infrastructure and caters to user comfort in all cases. In the future, the transaction energy concept amongst various community-based multi-microgrids will be carried across various planning horizons with improved methodologies.