1. Introduction
The concept of energy communities has emerged in response to the increasing decentralization of the electric power system and the integration of renewable energy sources. An energy community primarily meets its energy demand through local renewable power generation, supplemented by conventional power sources. Its objective is to optimize local energy production, storage, and consumption to minimize reliance on the main grid.
A comprehensive review of the literature and state-of-the-art advancements has been conducted to identify research opportunities and potential technological enhancements in the field. In [
1], a two-stage risk-based optimization model is developed for energy management systems (EMSs) within citizen and renewable energy communities to maximize profit. In the first stage, each energy community manager optimizes the profit of their respective community, while in the second stage, the network operator maximizes the overall network profit. The inherent complexity in modeling such energy communities presents significant challenges in formulating and solving the associated optimization problems. To address this challenge, ref. [
2] proposes a mixed-integer linear programming (MILP)-based optimal planning approach for renewable energy communities, incorporating time-of-use electricity rates specific to each node. The results demonstrate that increasing the share of photovoltaic energy within the community, coupled with energy exchange among members and the integration of a battery energy storage system, reduces operational costs and emissions. Additionally, the energy storage system facilitates peak load shaving, thereby lowering peak-load-related costs. In [
3], a linear programming-based study that optimizes the size of photovoltaic systems and battery storage in renewable energy communities is presented. The study evaluates the effects of varying battery installation locations, peak load shaving, and different battery operation strategies on system performance. In [
4], the local energy generation within an energy community reduces costs for all participants. Additionally, the EMS proposed in [
5] successfully lowers the annual peak load of the community’s low-voltage substations with minimal impact on operational costs. A comprehensive review of energy communities is presented in [
6], focusing on key stakeholders, power generation and information exchange technologies, individual and collective objectives, and community design types, as well as associated challenges, goals, trade-offs, and socio-economic impacts.
A well-structured energy community can be conceptualized as a network of interconnected microgrids within a defined geographical area. Microgrids have been extensively studied so far. In [
7], a switched hybrid model predictive control optimization is proposed, employing a three-stage testing process to minimize the total energy purchase cost of a microgrid in both grid-connected and islanded operation. By integrating battery energy storage (BES) and RESs, the microgrid can effectively respond to sudden changes in power grid conditions. Demand-side management techniques, regulatory frameworks, and technical capabilities within a microgrid are examined in [
8]. The optimization process consists of two stages: the first optimally schedules heating, ventilation, and air conditioning (HVAC), lighting, and EV loads, while the second minimizes total investment and operational costs. In [
9], the microgrid operation in both grid-connected and islanded modes of operation using a two-layer coordination control system is simulated, ensuring a high load satisfaction rate. A rule-based modular energy management system that enables the dynamic utilization of all components in both isolated and grid-connected hybrid DC/AC microgrids is presented in [
10]. The uncertainties of wind, solar irradiation, and electric loads are addressed in [
11] through a flexible two-stage robust optimization problem, which minimizes investment, maintenance, and operational costs while maximizing the microgrid’s profits. Simulation results in [
12] highlight the benefits of integrating electric vehicles within a microgrid, reducing power demand fluctuations by adjusting their power injection. Additionally, BES enables interruptible loads to provide ancillary services to the main grid. Researchers in [
13] develop a microgrid controller that stabilizes grid voltage by solving the optimal power flow problem, formulated as a quadratically constrained quadratic program (QCQP) optimization problem and solved using the interior point method. The authors of [
14] explore the optimal reactive power dispatch of power converters, enabling the injection of reactive power from DERs outside the microgrid to assist the main grid with its reactive power balance. Prosumers are tasked with deciding whether to provide power services or prioritize other actions for cost minimization. An in-depth review of microgrids is presented in [
15].
The integration of multiple microgrids has also been explored in research. In [
16], a two-layer optimization model is presented for the cooperation between multiple microgrids and a county-based system operator, discussing four typical microgrid scenarios. A trading mechanism between the rural multi-microgrid and the county-oriented energy operator is developed. This approach reduces both the multi-microgrid’s operational costs and the operator’s costs, decreases reliance on the main grid, and increases renewable energy consumption. The cooperation between multi-microgrids and active distribution networks is demonstrated in [
17], where the introduced method reduces operational costs and carbon emissions for both parties. Additionally, it successfully achieves a fair distribution of carbon emissions between the active distribution network and the multi-microgrid. The optimal operation of interconnected microgrids participating in a peer-to-peer (P2P) electricity market is thoroughly analyzed in [
18]. Initially, each microgrid minimizes its operational costs while meeting its building’s electrical and thermal needs and optimizing EV operation. Subsequently, each microgrid participates in the P2P market to gain profit by supporting one another’s stability and aligning with their individual interests. The minimum and maximum allowed power deviations for each microgrid are calculated to maximize its influence on the electricity market. Researchers in [
19] examine a cluster of interconnected microgrids in off-grid communities, developing a model to prevent simultaneous bidirectional power transfer between microgrids while accounting for transmission distances. Additionally, demand-response strategies are employed to further reduce diesel generator fuel consumption. The design process of a multi-microgrid system is presented in [
20], considering both installation and operational costs, formulated as a two-stage stochastic programming model. In [
21], an innovative load shifting method in microgrid-based energy community is presented. By effectively managing HVAC power consumption and auxiliary generator operation, a significant portion of the electrical load can be shifted to achieve valley-filling and peak-shaving, while adhering to the thermal and electrical constraints of the community for both heating and cooling operation scenarios. In [
22], clusters of residential microgrids within a renewable energy community are optimally organized to provide grid balancing services. In [
23], it is highlighted that interconnecting multiple microgrids into a microgrid cluster is an effective method to enhance the operational quality of distributed generation. A multi-stage EMS designed to reduce load shedding and load losses by providing accurate forecasts of these issues is introduced in [
24]. A survey on the operation of interconnected microgrids, available topologies, and energy management methods is provided in [
25].
Based on the conducted literature review, the innovative aspects of this study are highlighted as follows:
- -
The proposed algorithm ensures a reduction in the energy community’s daily operational costs by enabling efficient power sharing between the interconnected microgrids, regulating local generators’ output, and utilizing PEVs for power management, thereby minimizing the need for additional energy storage systems. This integrated approach better aligns with the needs of energy communities organized in interconnected microgrids, as it effectively deals with the complexities of distributed energy resources and diverse load profiles, ensuring efficient energy management across multiple interacting microgrids.
- -
Achieving net-zero energy exchange between the energy community and the main grid is crucial for enhancing energy independence and improving overall system resilience. By balancing local generation and consumption, this approach optimizes resource utilization within the energy community while decreasing reliance on external power sources.
- -
Reducing power losses in the distribution lines connecting the microgrids is crucial for improving the overall efficiency of energy distribution within interconnected systems. By minimizing these losses, more of the locally generated electricity is effectively utilized, which enhances system reliability and reduces operational costs. This optimization of power flow also contributes to a more sustainable energy network by ensuring that less energy is wasted in energy distribution, making the entire system more efficient and resilient.
- -
Reducing greenhouse gas (GHG) emissions from local generators by setting appropriate constraints is essential for promoting environmental sustainability and aligning with global climate goals. By optimizing generator operations and limiting GHG emissions, this approach minimizes the carbon footprint of energy production while ensuring the seamless use of reliable, locally sourced power.
- -
The proposed method is designed to be adaptable and scalable, making it applicable across different regions with varying characteristics, including areas with limited solar potential or high energy consumption. The optimization framework does not depend solely on high renewable energy generation but rather focuses on the coordinated management of all locally available resources—RESs, local generators, and PEVs—to achieve economic and environmental benefits.
- -
The microgrids examined in our framework take advantage of a large number of PEVs, which provide a dynamic, dispersed, and flexible storage solution. PEVs can adjust their active power in real time, based on price signals and local demand fluctuations, enabling them to act as distributed energy storage units that respond to internal MG needs, optimizing both energy storage and overall microgrid operation. Compared to traditional storage systems, using PEVs provides economic benefits, as it minimizes additional infrastructure costs.
The rest of the article is structured as follows.
Section 2 gives a detailed description of the proposed system.
Section 3 outlines the energy community’s components modeling and in
Section 4, the optimization of the energy community’s operation is described. Finally,
Section 5 presents and analyzes the results obtained from the simulation of the examined system, while
Section 6 provides the overall conclusions.
2. Proposed System Overall Description
The configuration of the proposed system is given in
Figure 1. The examined energy community is organized in interconnected microgrids, allowing for efficient power exchange and resource sharing. Microgrids consist of residential buildings, PEVs, RESs, and local electrical generators. The loads within the examined energy community can be supplied from its power sources and the main electric grid.
The thermal and electrical loads of the residential buildings are modeled in detail according to building technical specifications, occupancy, activity level, various types of used appliances, the conditioned space of each building, ambient temperature, solar radiation, etc. An aggregation method is implemented to the hosted PEVs of each microgrid. The necessary PEV data, like the upper and lower bounds of their stored energy and power, are obtained by processed or real-world data [
26]. The aggregator-based structure supports scalability and flexibility, allowing for the integration of stochastic user behavior models or learning-based forecasting in future extensions. This ensures that as PEV adoption grows and operational patterns diversify, the system can continue to deliver economically and environmentally optimal performance. In this study, PEVs not only draw power from the electric grid to charge their battery packs but also comprise Vehicle-to-Grid (V2G) operation mode, injecting power to the grid during specific time periods. Moreover, detailed models for microgrid local power generation units and RESs are developed.
The main goal of this method is to minimize the energy community’s daily operational costs, associated with electricity exchanged with the main electric grid and local generators production, on the assumption of operation under variable electricity prices. To achieve this, a hierarchical two-level optimization approach is applied. The primary objective of the first optimization level is to determine the optimal operation schedule for each microgrid’s PEV aggregator, while ensuring compliance with all PEV operation-associated constraints. Afterwards, the building HVAC and electrical loads of the energy community and total RES production, along with the optimal active power of each PEV aggregator that is determined in the first optimization level, are forwarded to the second optimization level. The main goal of the second optimization level is to minimize the energy community’s daily operational costs by optimally scheduling the operation of local power generator units. Simultaneously, the second optimization stage aims to achieve net-zero energy exchange between the energy community and the main grid, minimize power losses in transmission lines connecting microgrids, and reduce GHG emissions from local generators, thereby enhancing environmental sustainability. Additionally, the capacity constraints of distribution lines and the operational and technical limitations of local generators must be strictly attained. It is noted that in case of unexpected demand surges or an excess of RES production that cannot be handled in the fully constrained version of the examined problem, the net-zero energy constraint can be relaxed and, as a last resort, RES power production can be curtailed.
In this case study, the energy community consists of three physically interconnected microgrids. The interconnection between the energy community and the main power grid is realized through Microgrid 1, which functions as the point of common coupling (PCC) for the entire system. All active power exchange—either imported from or exported to the main grid—is managed solely through Microgrid 1. From a technical perspective, the power flow between the main grid and the rest of the energy community is facilitated via the internal distribution lines connecting the microgrids. This configuration is adopted for several technical, economic, and operational reasons: (1) Simplification of infrastructure requirements: Connecting only one microgrid to the main grid significantly reduces the complexity and cost of grid infrastructure. Each additional PCC would require dedicated protection, metering, control systems, and coordination mechanisms, thereby increasing system design and operational overhead. (2) Centralized grid interaction and control: A single grid connection point enables the centralized and more efficient management of energy exchange with the external grid. This simplifies energy accounting, grid service coordination, and communication with the system operator. (3) Improved optimization and load balancing: With a single PCC, the optimization framework can effectively manage energy distribution among microgrids. The second optimization level considers the power flow from the main grid into Microgrid 1 and then through the connecting lines to other microgrids, while minimizing transmission losses and operational costs and ensuring that all constraints are met. It is noted that although the above reasons advocate for a single PCC, the proposed method is developed in a way that allows multiple PCCs.
5. Results
The developed models and algorithms were verified through the simulation of three realistic energy community operation scenarios. In the first scenario (SC1), the objective was to minimize the energy community’s daily operational costs while ensuring compliance with all technical and operational constraints, including those of PEVs, local generators, power exchanged with the main grid, and the maximum transfer capacity of the lines interconnecting the microgrids of the energy community. In the second scenario (SC2), an additional constraint was applied to achieve net-zero energy exchange with the main grid, ensuring that the total energy exchanged over a 24 h period equals zero. In the third scenario (SC3), an additional constraint was applied to limit the generators’ total GHG emissions to a predefined threshold.
The PEV model data are given in
Table 1.
Table 2 contains the data of local generators.
Table 3 includes the capacity limits of the distribution lines connecting the microgrids, along with the power exchange thresholds between the energy community and the grid.
In our study, although the core optimization framework operates under deterministic inputs, we also conducted a sensitivity analysis to account for the inherent uncertainty in electricity prices, RES availability, and load consumption. Specifically, multiple stochastic trajectories for each of these variables were randomly generated to simulate realistic fluctuations and assess the robustness of the proposed methodology.
Figure 2 illustrates the base electricity price trajectory selected for demonstration purposes, along with the associated variation area that captures potential deviations. The electricity price data used for the optimization framework corresponds to an actual daily System Marginal Price (SMP) of the Greek electricity market. The SMP is the wholesale market-clearing price and is published by the Independent Power Transmission Operator (IPTO) of Greece.
Figure 3 shows the number of connected PEVs of each microgrid.
Figure 4a–c depict the RES production trajectories and their variations for Microgrids 1, 2, and 3, respectively.
Figure 5a–c show the residential building load profiles with associated uncertainties for Microgrids 1, 2 and 3, respectively.
Figure 6a,b illustrate the active power and total energy stored in the PEV aggregator of the first microgrid, respectively, along with their upper and lower bounds. Similarly,
Figure 7a,b depict the respective results for the PEV aggregator in the second microgrid, while
Figure 8a,b present the same information for the third microgrid. For all three PEV aggregators, power absorption occurs during periods of low electricity prices, whereas power injection is observed during periods of high electricity prices. The results for the optimal power of the microgrids’ PEV aggregators remain consistent across all three operation scenarios, as they are determined during the first optimization level. Since the variations between the scenarios pertain solely to the second optimization level, the outcomes of the first level remain unaffected.
The active power of each microgrid’s PEV aggregator is presented in
Figure 9.
Figure 10 illustrates the power output of each microgrid’s generators, along with the total production from all generators for SC1.
Figure 11 depicts the active power that the energy community exchanges with the main electric grid for SC1. It is observed that during periods of low electricity prices, the main grid supplies power to the energy community, whereas during high electricity price periods, the energy community tends to inject power into the main grid, aligning with the optimization objective of minimizing the energy community’s daily operational costs.
Figure 12 shows the active power exchanged between the interconnected microgrids within the energy community for SC1.
Figure 13 illustrates the power output of each microgrid’s generators, along with the total production from all generators for SC2.
Figure 14 depicts the active power that the energy community exchanges with the main electric grid for SC2.
Figure 15 shows the active power exchange between the interconnected microgrids within the energy community for SC2. A comparison between the SC1 and SC2 operation scenarios shows notable differences in the power exchanged between the energy community and the main grid, with SC2 exhibiting increased power injection into the main grid. This is attributed to the additional constraint in SC2, which requires net-zero energy exchange with the main grid. As illustrated in
Figure 14, the total energy exchanged over a 24 h period is confirmed to be zero. In comparison to SC1, the local generators of the microgrids in SC2 produce more power to achieve net-zero energy exchange with the main grid.
Figure 16 illustrates the power output of each microgrid’s generators, along with the total power production of all generators for SC3.
Figure 17 depicts the active power that the energy community exchanges with the main electric grid for SC3.
Figure 18 shows the active power exchanged between the interconnected microgrids within the energy community for SC3. Minor differences exist between SC2 and SC3, as in SC3, the objective is to achieve near-net-zero energy exchange with the main grid while limiting the total GHG emissions of the local generators to a predefined threshold.
Figure 19 and
Figure 20 depict the total power produced by the generators of the energy community and the active power that the energy community exchanges with the main grid for all examined scenarios, respectively.
The full two-stage model, including all constraints and objective components, was solved within approximately 20 s using the PSO algorithm. This confirms that the proposed method is computationally efficient and suitable for operation scheduling applications in real-world energy communities.
Table 4 presents the daily operational costs of the energy community for each examined scenario. The slight increase of 2.47% in the operational costs observed in SC3, when environmental constraints were added to limit GHG emissions from local generators, is indeed reasonable. This cost increase reflects the trade-off between achieving environmental sustainability and minimizing operational costs. The limit that we set on GHG emissions was designed to ensure a meaningful reduction in emissions, but as expected, imposing stricter environmental restrictions can lead to higher operational costs due to the increased reliance on the main grid. The extent of the cost increase depends on the specific reduction rate of GHG emissions that was chosen in this study. The results of the sensitivity analysis show that the proposed optimization framework remains robust under uncertainty, with the average increase, compared to SC1, in the daily operational costs of the energy community being only 1.27% across the examined scenarios. This marginal impact demonstrates the resilience and effectiveness of the proposed framework under practical, variable conditions, while maintaining compliance with all operational and technical constraints.
6. Conclusions
This study presents a method for the optimal and sustainable operation of energy communities organized in interconnected microgrids. The proposed algorithm minimizes the energy community’s daily operational costs by optimizing power sharing among interconnected microgrids, regulating local generators, and effectively managing PEVs. Additionally, this approach seeks to achieve net-zero energy exchange with the main grid, reduce GHG emissions, and decrease power losses in the electricity distribution lines interconnecting the microgrids, while adhering to various technical and operational constraints. To validate the effectiveness of the proposed methodology, three operation scenarios of the energy community were simulated. In SC1, the objective was to minimize the daily operational costs of the energy community while adhering to all technical and operational constraints. SC2 introduced an additional constraint to achieve net-zero energy exchange with the main grid over a 24 h period. SC3 further imposed a limit on total GHG emissions from local generators. Incorporating additional constraints into the optimization problem leads to a slight increase, in the range of 2.47%, in the energy community’s operational costs. The simulation results demonstrate the robustness of the developed models and algorithms in optimizing energy community operation while promoting economic efficiency and environmental sustainability.
In future work, we will explore the combined use of conventional ESSs alongside PEVs within our proposed framework. By incorporating both technologies, we aim to enhance the system’s ability to improve energy storage efficiency. This combined approach is expected to strengthen the economic performance of the microgrids, offering even greater operational flexibility and resilience compared to using PEVs or ESSs alone. Moreover, a moving window update mechanism could be adopted in future work, ensuring that the proposed EMS remains responsive and flexible, continuously adapting to the uncertainty of RESs and electricity consumption. The EMS will recalculate an optimal operation scheduling using a receding optimization horizon, allowing microgrids to dynamically adjust to real-time fluctuations in renewable generation and energy demand. A comparison of PSO performance with other heuristic optimization methods will also be made. Future work will aim to extend the current methodology toward real-time operation frameworks, integrating ancillary services for voltage and frequency regulation, particularly under high renewable penetration and dynamic load conditions.