Abstract
The transition toward low-carbon cities increasingly relies on community-based energy systems that integrate distributed renewable generation and shared storage infrastructure. This study examines how strategic prosumer grouping within community energy storage (CES) and shared energy storage (SES) systems can enhance the sustainability, efficiency, and resilience of urban energy networks. An optimization framework is developed to determine grouping configurations that balance heterogeneous energy production and demand under renewable uncertainty, particularly solar variability. Two community structures are compared: an individual model that clusters prosumers with similar generation characteristics, and a cooperative model that encourages resource sharing among prosumers with diverse production capacities and consumption patterns. Results indicate that cooperative grouping substantially improves system-level performance, reducing reliance on external energy supply and lowering overall procurement costs while enhancing resilience against seasonal and hourly fluctuations. By leveraging diversity within communities, the cooperative structure achieves more stable storage utilization and mitigates imbalance risks associated with renewable intermittency. Sensitivity analysis further shows that poorly designed grouping configurations can generate instability and inefficiencies, highlighting the importance of community structure in sustainable energy planning. The findings position prosumer grouping as a critical design decision in urban CES/SES deployment and offer practical insights for policymakers and planners seeking to strengthen renewable integration and support resilient, sustainable city development.
Keywords
Introduction
Energy power systems increasingly integrate low-carbon energy sources, particularly solar power, to reduce greenhouse gas emissions and enhance sustainability in line with global climate efforts. 1 As an abundant and renewable resource, solar power has strong potential to transform energy systems, yet its effective integration requires not only renewable deployment but also efficient energy distribution management. 2 Smart grids and energy storage technologies play an important role in optimizing renewable utilization and maintaining reliability during peak demand. 3 In this context, community energy storage (CES)4,5 and shared energy storage (SES)6,7 allow multiple prosumers to collectively store and share surplus energy, improving efficiency, lowering costs, and reducing reliance on conventional energy sources.8,9 Although prior studies have examined CES and SES in terms of distribution and storage design,10,11 optimizing the number and grouping of prosumers within a single system remains insufficiently explored. The proposed model adopts several approaches to group prosumers within a CES or SES framework, with the genetic algorithm (GA) serving as the primary method due to its effectiveness in solving complex optimization problems. Through evolutionary processes including selection, crossover, and mutation, GA can explore diverse grouping configurations suited to dynamic energy environments. 12 Previous research demonstrates the flexibility of GA in solving complex tasks. Huang et al. improved mixed variable grouping using a dynamic differential GA. 12 Ramos and Quiroz enhanced grouping efficiency in energy systems using an experimental GA framework. 13 He et al. proposed a multi-island GA for precision applications, 14 and Yang et al. applied a variable neighborhood GA to optimize bin packing problems. 15
Uncertainty in demand and supply remains a major consideration in solar-based energy systems due to weather variability and changing generation patterns.16,17 Various approaches have been proposed to address these uncertainties, including Wang et al. with a bi-level energy storage model 18 and Li et al.'s game-theoretical approach. 19 Gao et al. examined cooperative scheduling under renewable uncertainty, 20 while Meng et al. introduced a two-level dispatch strategy for microgrids with demand response. 21 Energy losses during transmission and storage also affect performance. Apribowo et al. developed an optimization model to reduce losses and manage uncertainties. 22 Gebreslassie et al. improved efficiency through decentralized storage, 23 and Jiang et al. proposed routing strategies to minimize losses in community energy systems. 24 Battery energy storage systems (BESS) are widely recognized for mitigating uncertainty and reducing losses by storing excess energy and releasing it during peak demand. 25 Chreim et al. optimized BESS sizing in residential networks, 26 Hettiarachchi et al. proposed control strategies for high photovoltaic penetration, 27 Glücker et al. improved sizing methods in multi-energy systems, 28 and Zhang et al. examined BESS across different market structures. 29 Csereklyei et al. further demonstrated the benefits of community-scale BESS in enhancing reliability and reducing losses. 30
Despite extensive research on CES and SES in terms of sizing, sitting, and operation under uncertainty, limited attention has been given to prosumer grouping, which directly affects storage utilization, energy balance, and system resilience. To address this gap, this study develops a mathematical model that applies GA to optimize prosumer clustering within a single CES or SES system, positioning grouping as a key decision factor in system design. The model leverages GA to navigate large solution spaces and balance competing objectives, aiming to maximize storage utilization while addressing demand and supply variability associated with renewable generation. Storage capacity constraints are incorporated to ensure efficient charging and discharging, reducing instability and energy losses. Through its evolutionary mechanism, GA supports adaptive grouping that improves operational efficiency and maintains system stability under fluctuating conditions.
The objective of this study is to complement existing CES and SES research by introducing prosumer grouping as an additional optimization layer. While prior studies have focused on dispatch, sizing, or sitting, this work emphasizes grouping decisions that influence network performance. By optimizing grouping configurations, the model seeks to reduce dependence on conventional energy sources, minimize losses, and enhance system resilience, thereby advancing sustainable energy distribution networks.
Literature review
Design of framework system
To support the implementation of CES and SES systems in residential communities, it is essential to analyze operational controls and evaluate their benefits compared to individual storage solutions. Designing distribution networks that effectively group prosumers while improving energy efficiency and storage utilization is a critical step. Addressing uncertainties in demand and supply, along with energy losses during transmission and storage, is necessary to ensure system stability. As a result, many studies have investigated models and techniques to assess CES and SES performance, focusing on managing uncertainties and reducing losses to enhance sustainability.
Several studies have proposed optimization models for CES and SES systems. Li et al. developed a dynamic allocation model for SES that reduced energy losses by 15%, costs by 12%, and improved stability by 20%. 1 Zhao et al. applied a mixed game theory approach for community prosumers, improving efficiency and reducing costs while enhancing stability and lowering peak load. 4 Jia et al. proposed an optimization framework for pricing and energy distribution in ICES with peer-to-peer trading, achieving improvements in efficiency and cost reduction. 5 Wang et al. introduced a two-stage framework for siting SES projects that reduced losses and emissions while improving resilience. 6 Talihati et al. optimized residential networks with SES and controllable loads, enhancing efficiency and profitability. 7 Li et al. proposed a game-theoretical model for CES and SES under uncertainty, improving adaptability and reducing inefficiencies. 19 Gao et al. addressed renewable variability through optimization of rural virtual power plants, improving stability and reducing losses. 20
Research on microgrids also provides relevant insights. Meng et al. proposed a two-level dispatch strategy that balances costs and stability. 21 Apribowo et al. optimized BESS sizing and placement with demand response to improve renewable integration. 22 Chreim et al. applied an MILP approach to optimize BESS capacity in residential systems. 26 Hettiarachchi et al. developed control strategies for community BESS in photovoltaic integrated microgrids to increase utilization. 27 Glücker et al. optimized BESS in multi-energy networks, improving efficiency and peak management. 28 Zhang et al. studied BESS optimization under different market conditions using price signals and demand response. 29 Csereklyei et al. demonstrated the role of community batteries in supporting load balancing and low-carbon transitions. 30
Studies on prosumer grouping have explored various approaches related to clustering, aggregation, flexibility management, and market participation within distributed energy systems. Iria and Soares applied cluster-based methods to group prosumers in energy markets to improve management efficiency and reduce uncertainty. 31 Crespo del Granado et al. examined aggregator-based clustering approaches using load and flexibility characteristics to support coordinated participation in renewable energy systems. 32 Nizami et al. reviewed transactive energy frameworks that group prosumers based on flexibility and distributed interaction mechanisms. 33 Silva et al. focused on grouping strategies for demand response applications to improve distribution efficiency, 34 while Wu et al. proposed aggregation strategies based on load characteristics to support coordinated operational decision-making. 35 Zhou et al. developed hierarchical clustering methods for heterogeneous prosumers to improve forecasting accuracy. 36 In addition, Iria et al. introduced a network-constrained bidding strategy that groups prosumers according to flexibility and distributed energy resources to support market participation. 37
Although these studies demonstrate the importance of grouping and aggregation in distributed energy environments, existing approaches primarily focus on forecasting improvement, market coordination, demand response, bidding strategies, and flexibility management. Limited attention has been given to how prosumer grouping composition itself directly influences CES/SES operational behavior, storage utilization, cooperative energy exchange, energy balancing capability, and system resilience under renewable uncertainty. Furthermore, most existing grouping-related studies treat clustering primarily as a market or operational coordination mechanism rather than as an integrated operational design variable affecting the dynamic performance of interconnected CES/SES systems.
Genetic algorithm approaches
GAs are a class of evolutionary optimization methods inspired by natural selection, known for their ability to solve complex problems with multiple objectives and constraints. 38 Unlike deterministic approaches that may converge to local optima,39,40 GAs use stochastic processes to explore broader solution spaces, increasing the likelihood of identifying near-optimal solutions. 41 Their flexibility allows them to balance competing objectives, making them suitable for dynamic environments with diverse variables. In addition, their capability to evaluate multiple solution paths improves computational efficiency and scalability in complex optimization tasks, particularly in energy systems where prosumer grouping plays an important role.42,43 Although GAs have demonstrated strong performance in many optimization applications, their use for optimizing prosumer grouping within a single CES or SES system remains limited. This study addresses this gap by examining prior GA-based grouping approaches across different domains to inform the proposed framework. Previous studies have applied GA variants to improve solution quality, computational efficiency, convergence performance, grouping effectiveness, and scalability in complex optimization environments.12,13,14,15,44
After reviewing the literature summarized in Tables 1 and 2, this study positions itself within existing CES and SES research by treating prosumer grouping not merely as a clustering or aggregation process, but as an operational design variable that directly influences energy balancing behavior, storage utilization, cooperative resource sharing, and system resilience under renewable uncertainty. While previous studies have primarily focused on sizing, siting, pricing, dispatch strategies, and operational optimization, limited attention has been given to how grouping composition itself affects the operational dynamics and stability of interconnected CES/SES systems. In addition, existing grouping-related studies generally emphasize market aggregation, forecasting, flexibility management, or bidding strategies rather than evaluating the operational implications of grouping configurations on cooperative energy-sharing performance within CES and SES environments.
Overview of genetic algorithm variants and their applications.
Comparison of modeling considerations and methodologies in CES/SES optimization studies.
To address this gap, the proposed framework integrates prosumer grouping optimization with CES/SES operational dynamics by considering heterogeneous production capacities, storage interactions, renewable variability, and cooperative energy exchange among interconnected communities. Rather than treating grouping as a static classification problem, the proposed model evaluates how different grouping structures influence energy deficits, storage balancing capability, operational stability, and dependence on external electricity supply under dynamic operating conditions. Through the comparison between individual and cooperative community models, this study further examines how coordinated resource sharing among heterogeneous prosumers contributes to improved resilience and energy management performance. The main contributions are summarized as follows.
This study develops a GA-based optimization framework that treats prosumer grouping as an operational decision variable within CES and SES systems, where grouping composition directly affects storage utilization, energy balancing behavior, and cooperative energy-sharing performance. The proposed model integrates storage capacity constraints, renewable generation variability, charging-discharging dynamics, and interconnected cooperative energy exchange mechanisms to evaluate the operational implications of different grouping configurations under uncertain demand and supply conditions. The study comparatively evaluates individual and cooperative community structures to analyze how heterogeneous prosumer compositions influence operational resilience, external energy dependence, and resource-sharing effectiveness within interconnected CES/SES systems. The proposed framework provides operational and planning insights for CES/SES implementation in urban renewable energy environments by demonstrating the importance of grouping strategies in improving system stability, renewable integration, and cooperative energy management performance.
Community grouping models and assumptions in mathematical models
Design of community models
Two models, the individual community and the cooperative community, are considered to manage energy distribution within CES and SES systems. In the individual community model, each prosumer independently manages energy storage and consumption within its CES or SES, with charging and discharging decisions driven by rooftop photovoltaic generation. This configuration reflects a decentralized structure focused on self-sufficiency, where operational decisions are primarily performed at the local community level without direct coordination with other CES/SES units. Although this approach enables real-time adjustments and simplified local control, it also exposes communities to imbalance risks since energy deficits must be covered by external providers. Figure 1 illustrates this model.

Individual community model.
In contrast, the cooperative community model connects multiple CES or SES units through a coordinated energy-sharing framework supported by a central controller or distributed management system. The cooperative structure assumes the existence of interconnected local energy-sharing infrastructure that enables energy exchange among participating CES/SES units. By monitoring real-time information on generation, demand, and storage conditions, the coordination mechanism allocates resources and redistributes surplus energy to mitigate shortages across interconnected communities. Within this framework, prosumers participate as distributed energy contributors, while the operational coordination process may be managed by a community-level operator, aggregator, or local energy management platform responsible for balancing energy availability and facilitating cooperative exchanges. In addition, the implementation of cooperative CES/SES systems may require regulatory and governance support to coordinate resource sharing and operational integration among interconnected communities. By utilizing diversity in generation and demand among prosumers, cooperative systems can better smooth renewable fluctuations, improve storage utilization, and reduce reliance on external energy supply. Figure 2 presents the collaborative structure under coordinated control.

Cooperative community model.
These two models represent different approaches in CES and SES design. The individual community focuses on autonomy and local control, while the cooperative community emphasizes coordination, resource sharing, and collective resilience. The former simplifies decision processes but may face inefficiencies under renewable variability, whereas the latter introduces greater operational complexity while enabling more stable and resilient energy management. This distinction forms the basis for the optimization framework in subsequent sections, where prosumer grouping is analyzed as a key factor in improving energy efficiency, operational reliability, and system resilience.
Assumptions in this study
This study defines key assumptions to guide the development of the mathematical model using GA. These assumptions establish the scope and constraints for optimizing energy distribution in CES and SES systems, considering variations in production capacity, seasonal effects, and the role of external energy supply. By specifying these conditions, the model improves its relevance to practical settings characterized by uncertainty and energy loss. The main assumptions are as follows.
Prosumer types and seasonal constraints: Prosumers are classified into three categories according to their energy generation capacity, which depends on rooftop photovoltaic size and technology. Small-scale prosumers generate limited energy, medium-scale prosumers produce moderate amounts, and large-scale prosumers generate higher output with potential surplus for sharing. The model focuses on regions with two seasons, summer and rainy, to capture seasonal variation in solar generation. Energy shortage protocol: When demand exceeds available generation and storage, prosumers purchase electricity from a third-party provider to maintain supply continuity. Storage capacity limitation and surplus energy: The CES/SES operation is constrained by maximum storage capacity limits. When renewable energy generation exceeds local demand, surplus energy is first allocated for charging the CES/SES subject to the available remaining storage capacity. If the storage system reaches its maximum capacity, additional surplus energy cannot be stored and is therefore assumed to be curtailed. This study does not explicitly consider bidirectional energy export to the external grid, as the primary focus is on prosumer grouping optimization and cooperative CES/SES operational coordination. Interconnected CES/SES infrastructure: The cooperative CES/SES framework assumes the existence of interconnected local energy-sharing infrastructure that enables energy exchange among participating CES/SES units. The interconnection is considered part of the local cooperative energy network used to support coordinated energy sharing between communities. The study does not explicitly model electrical network topology, cabling design, or power flow characteristics, as the primary focus is on prosumer grouping optimization and CES/SES operational coordination.
To represent realistic operating conditions, the algorithm incorporates daily demand patterns influenced by weather variability, leading to monthly fluctuations in energy consumption as illustrated in Figure 3. The model also assumes that the storage level at the beginning of day

Hourly electricity load profiles for every month throughout the year.
Mathematical optimization model
Individual community model
In this model, the power generation by each prosumer is a critical factor, calculated based on the area of their rooftop solar PV panels. The power generated at any given time is determined by multiplying the PV panel area by the production capacity per square meter and a time-dependent factor that accounts for solar irradiance. Because solar irradiance varies throughout the day and across seasons, it influences the amount of power generated by the panels. This calculation ensures that the model accurately reflects the variability in renewable energy production, which is a crucial aspect in managing the energy supply within CES/SESs. The power generated by prosumer i at any t time is calculated as follows:
The energy balance equation is crucial to the model because it ensures an accurate representation of the energy dynamics of each prosumer within the CES/SES system. The formulation accounts for the energy generated by rooftop solar PV panels, the energy consumed by prosumers, and the energy charged into or discharged from the storage system. Charging occurs when the generated energy exceeds the current demand, allowing surplus electricity to be stored in the CES/SES, while discharging occurs when the demand exceeds the available generation, enabling stored energy to supply the deficit. The charging and discharging variables are therefore determined dynamically according to the real-time balance between generation, demand, and storage availability, subject to the operational charging and discharging limits of the system.
To represent storage losses and conversion inefficiencies, the model adopts an aggregated storage-efficiency representation through the storage efficiency factor. In this formulation, the discharging variable represents the usable energy delivered from the CES/SES to satisfy demand, while additional storage-related losses are implicitly reflected through the efficiency and loss representation within the system. By maintaining a real-time balance between supply and demand, the equation supports efficient energy management and reduces operational inefficiencies in CES/SES operations. Considering the different types of prosumers, the energy balance for each prosumer i within their CES/SES at time t is expressed as follows:
The model includes specific constraints to ensure safe and efficient system operation. These constraints apply to energy storage levels and the rates of charging and discharging energy. For example, stored energy must remain within the storage capacity to avoid overcharging or depletion (equation (3)). Similarly, the charging (equation (4)) and discharging (equation (5)) rates are capped to prevent system damage and ensure efficient operation. These constraints are essential for maintaining the integrity and reliability of the energy system and ensuring that it meets the needs of the prosumers without risking failure.
The fitness function is a core component of the GA for the individual CES/SES system. It quantitatively evaluates how well a given grouping configuration balances local energy availability and demand while minimizing energy losses within each community. To ensure dimensional consistency, all components of the fitness function are expressed in normalized form relative to the storage capacity of each group. The first term represents the normalized energy imbalance between available energy and demand, while the second term represents normalized energy losses within the CES/SES system. By using normalized values, the fitness function avoids inconsistencies between per-unit values and energy quantities while providing a consistent basis for evaluating different grouping configurations. The fitness function is mathematically defined as follows:
As shown in equation (6), the fitness function evaluates the performance of each grouping configuration by considering both normalized energy imbalance and normalized energy losses within each group. Minimizing
Cooperative community model
The energy balance equation for each prosumer within the CES/SES system accounts for the various factors that influence energy availability. At any given time t, the energy stored in the system for prosumer i is updated based on the previous storage state, energy charged or discharged, energy generated from solar panels, and energy demand. Specifically, the equation reflects the total stored energy at the next time step
When a CES/SES experiences a shortage, energy can be transferred from another connected CES/SES with surplus energy. To distinguish CES/SES-level interactions from prosumer-level variables, the indices k and l are used to represent interconnected CES/SES units, where k denotes the receiving CES/SES and l denotes the supplying CES/SES. The cooperative energy exchange mechanism enables interconnected CES/SES units to share available surplus energy to reduce local shortages and improve system reliability. In this formulation, the amount of exchanged energy is controlled by an energy exchange coefficient that determines the proportion of surplus energy that can be allocated between interconnected CES/SES units. The energy exchange can be modeled as follows:
In a cooperative community setup, energy exchange between interconnected CES/SES systems plays an important role in maintaining operational reliability and satisfying demand shortages. When the demand within CES/SES k exceeds its available generated energy, the model allows energy transfer from another connected CES/SES
The operational constraints of the model establish boundaries for the system performance and ensure the stability of energy management. These constraints include limits on the amount of energy that can be stored (equation (9)), as well as restrictions on the charging (equation (10)) and discharging (equation (11)) rates for the storage system of each prosumer. Moreover, the energy exchange between interconnected CES/SES units must not exceed the available energy stored in the supply system (equation (12)).
The objective function for the cooperative community model extends the evaluation to interconnected CES/SES systems by incorporating energy exchanges between communities. The objective function evaluates the overall system performance in terms of energy balance, resource sharing, and operational reliability within the cooperative CES/SES framework. The objective function is mathematically expressed as follows:
As shown in equation (13), the objective function evaluates the performance of the cooperative framework by considering normalized energy imbalance, cooperative energy exchanges, and normalized energy losses among interconnected CES/SES systems. Minimizing
Theoretical insights from the formulation
In the individual community model, equation (2) represents a localized energy balance grounded in the principle of energy conservation, where energy inflows from local generation and charging activities must balance energy outflows associated with consumption and discharging operations, with constraints (equations (3) to (5)) ensuring physical feasibility by bounding storage levels and charging/discharging rates. This setup illustrates a decentralized optimization problem, where each CES/SES seeks self-sufficiency but remains vulnerable under variable renewable generation. By contrast, the cooperative community model (equations (7) to (12)) extends this into a network-coupled dynamic system, where each prosumer's state depends not only on its own generation and demand but also on exchanges with interconnected CES/SES units. The coupling constraints capture the interdependence of distributed agents, shifting the problem from independent optimization toward distributed coordination and formalizing the trade-off between autonomy and cooperation. While individual models simplify local control, they may amplify instability under fluctuating renewable generation, whereas cooperative models improve resilience through coordinated resource sharing and interconnected energy support mechanisms.
Genetic algorithm for optimizing grouping configurations
Building on the use of GA introduced earlier, this section focuses on how GA is applied to optimize prosumer grouping in CES/SES systems. The algorithm refines grouping configurations iteratively to achieve objectives such as minimizing energy losses and maximizing storage utilization, employing three core operations: selection, crossover, and mutation. The selection process prioritizes grouping configurations (chromosomes) with higher fitness scores, representing better performance in achieving energy management goals. The probability of selecting a chromosome is proportional to its fitness, as shown in equation (14), where
Through the crossover operation, selected chromosomes exchange genetic material at random crossover points, generating offspring with mixed traits. This process introduces diversity and allows the algorithm to explore new potential configurations while retaining high-performing traits. For two-parent chromosomes,
To maintain genetic diversity and avoid premature convergence, the mutation operation introduces small random changes to genes within chromosomes. Each gene has a mutation probability
These steps are repeated iteratively across generations, with the algorithm evaluating and improving the population's overall fitness. The progression of fitness optimization is guided by equation (18).
Numerical experiments
Individual community result
Details of individual community operations
The grouping of prosumers into five communities, as shown in Table 3, is determined using a GA that applies selection, crossover, and mutation to optimize grouping based on predefined fitness criteria. Through iterative evaluation, the algorithm forms communities composed of unit types A, B, and C to enhance energy production and resource utilization. Community 1 includes 15 prosumers with balanced representation of Types A and C and fewer from Type B. Community 2 is the largest with 19 prosumers and is dominated by Type C. Community 3 consists of 17 prosumers with relatively balanced participation of Types A and B and fewer Type C. Community 4 contains 13 prosumers and is primarily composed of Type A, with minimal representation from Type B and none from Type C. Community 5 includes 16 prosumers with balanced participation of Types A and C and moderate representation from Type B. These results confirm the ability of the algorithm to generate communities with distinct compositions.
Distribution of prosumers among communities in individual community.
Tables 4 and 5 summarize the costs associated with energy purchases from third-party providers. Table 4 shows that Community 2 incurred the highest cost at $7811.42, suggesting greater energy deficits, while Community 1 recorded the lowest cost at $47.46, indicating near self-sufficiency. Community 3 and 5 had similar costs of about $1,395, and Community 4 experienced only minor shortages with a cost of $7.76. Table 5 presents monthly cost variations across communities. June recorded the highest expenditure at $3477.66, followed by July at $3299.47, reflecting periods of higher energy shortfall. February and December showed zero cost, indicating full self-sufficiency. Other months exhibited variability, with May and August showing relatively higher costs at $1633.91 and $1224.76, while October and March had lower costs at $33.71 and $74.35. These variations are consistent with seasonal effects influencing energy production and demand.
Community-wise costs for energy purchases in the individual grouping model.
Monthly costs for energy purchases across communities in the individual grouping model.
Energy storage operations
The operation of the energy storage network for June is illustrated in Figure 4, showing how the system performs within the community for over one month. The five communities displayed consistent daily cycles with regular peaks during daytime driven by solar photovoltaic generation and declines at night as stored energy was used. This pattern indicates effective energy management across communities. Communities 1 and 2 exhibited relatively higher peaks, reflecting strong solar generation and efficient storage, while nighttime levels remained stable, suggesting balanced production and consumption. Community 3 showed the highest peaks, indicating greater generation capacity or conservative daytime usage, with steady nighttime demand. Community 4 presented flatter peaks, implying lower generation or higher consumption, though overall stability was maintained. Community 5 followed a similar pattern with moderate peaks and stable consumption, suggesting potential for further efficiency improvement.

Energy storage and consumption patterns for five communities at individual community (June).
Over the remaining months, operational patterns showed community-specific variations while maintaining reliable performance. From January to March, clear daily cycles were observed, with solar generation supporting daytime demand and storage covering nighttime needs. Community 4 showed flatter peaks in March, whereas Communities 1 to 3 maintained higher reserves, indicating stronger energy management. Between April and June, stability persisted, with Communities 4 and 5 showing slightly lower energy levels, while Community 3 consistently achieved higher peaks. From July to September, variability increased. Community 4 experienced reduced peaks in September, and Community 5 showed minor declines in July and September, although the system continued to maintain stability. During the final quarter, energy cycles remained consistent, with Community 4 displaying flatter peaks in October and November, while Communities 1 to 3 remained stable. Community 5 improved in December despite minor fluctuations. Overall, the system demonstrated reliable energy distribution throughout the year.
Cooperative community result
Cooperative community operations details
Table 6 presents the prosumer grouping results under the cooperative community model, which seeks to balance energy production and consumption across communities. Communities 1 and 5 include 15 and 16 prosumers with relatively balanced distributions of Types A, B, and C. Community 2 also shows a balanced composition, while Communities 3 and 4 have higher proportions of Type A prosumers. Compared with Table 3, Community 1 remains similar across both models. Community 2 includes fewer prosumers in the cooperative model, indicating a more balanced allocation. Community 3 maintains a comparable composition, while Community 4 shows an increase in total prosumers with Type A still dominant. Overall, the cooperative model produces more evenly distributed communities than the individual model.
Distribution of prosumers among communities in cooperative community.
Tables 7 and 8 summarize the costs related to energy purchases from third-party providers when internal resources and cooperative support were insufficient. Table 7 indicates that Community 3 incurred the highest cost at $1385.04, followed by Community 5 at $1236.92 and Community 2 at $902.85, suggesting notable energy deficits. Communities 1 and 4 recorded lower costs of $547.46 and $573.29, indicating stronger self-sufficiency or more effective support. The total cost across all communities was $4645.55. Table 8 presents monthly cost variations, with June recording the highest expense at $2258.75 and July at $2054.52, reflecting periods of higher shortfall. No costs were observed in February, March, April, September, October, November, and December, indicating effective management within the cooperative system. Minor costs occurred in May at $152.93 and August at $31.67. These findings highlight variability in community performance and the importance of optimizing cooperative resource allocation to minimize reliance on external supply.
Community-wise costs for energy purchases in the cooperative grouping model.
Monthly costs for energy purchases across communities in the cooperative grouping model.
Energy storage operations
The operation of the cooperative energy storage network for June is illustrated in Figure 5, showing energy dynamics across the five communities over one month. Daily cycles were observed, with energy levels increasing during daytime due to solar photovoltaic generation and declining at night as stored energy was used. These patterns indicate effective energy management and resource sharing within the cooperative framework, although some differences across communities are noted. Community 1 exhibited consistent and relatively high peaks, indicating strong generation and well-maintained storage, with stable nighttime consumption and no notable irregularities. Community 2 showed similar patterns with slightly lower peaks, suggesting marginally lower generation or higher daytime demand, while stable nighttime levels indicate support from cooperative energy sharing. Community 3 presented the highest peaks, reflecting strong generation capacity or conservative consumption, with steady nighttime demand and no clear anomalies. Community 4 displayed flatter and lower peaks, suggesting lower generation or higher consumption, though stability was maintained through cooperative support. Community 5 also showed lower peaks, with a slight mid-month dip indicating a temporary reduction in generation or increased demand, while nighttime levels remained stable.

Energy storage and consumption patterns for five communities at cooperative community (June).
Overall, the cooperative system demonstrated effective energy distribution in June, with minor variations indicating opportunities for improving generation or storage efficiency, particularly for Communities 4 and 5. These observations highlight the importance of continuous monitoring within cooperative operations. Throughout the year, monthly patterns remained stable with community-specific variations. From January to March, consistent daily cycles were observed with reliable solar generation and effective storage use. Between April and June, stability continued despite slightly lower peaks in Communities 4 and 5, likely to reflect seasonal influences. From July to September, Community 3 maintained higher peaks, while Communities 4 and 5 showed lower levels, suggesting possible capacity differences. From October to December, operations remained stable, with a minor reduction in Community 2 during October that recovered in later months. Overall, the cooperative system maintained reliable energy availability through coordinated storage and energy transfers.
Comparative operational performance and urban energy planning implications
A comparison between the individual and cooperative community grouping approaches reveals key methodological differences, mainly influenced by varying production capacities and energy demands of prosumers. In the individual grouping model, the algorithm organizes prosumers with similar production characteristics into the same community, creating more homogeneous groups, such as Community 4 being largely composed of Type A prosumers. This homogeneity can simplify energy management by aligning production and consumption patterns within a community. By contrast, the cooperative community model deliberately mixes prosumers with diverse production capacities and demand profiles. This strategy creates a more balanced distribution of prosumer types (A, B, and C), allowing for better resource sharing and energy balancing. By combining high-production and high-demand prosumers, the cooperative model enables communities to manage energy surpluses and deficits more efficiently, thereby reducing the need for external energy purchases.
Technically, the cooperative model leverages differences in production and consumption characteristics to create a more resilient energy network and distribute operational risks more evenly among interconnected communities. In contrast, the individual model, while simpler, may face greater challenges in maintaining energy balance within less diverse communities, particularly during periods of high demand or reduced renewable generation. The analysis of energy procurement costs showed substantial differences between the two approaches. In the individual model, communities such as Community 2 experienced significant energy shortfalls, resulting in high dependence on external electricity providers and increased operational expenditure. By comparison, the cooperative model reduced overall costs through coordinated resource sharing and interconnected storage support, although some communities, such as Community 3, still experienced temporary deficits. Overall, the cooperative model demonstrated greater efficiency and resilience in managing energy resources, with lower dependence on third-party energy supply.
Beyond the operational comparison, the results also provide practical implications for the implementation of CES and SES systems in real urban energy environments. The findings indicate that prosumer grouping should not be treated solely as an administrative or geographically based clustering process, since grouping composition directly affects storage utilization, energy balancing capability, operational stability, and external electricity dependence. Communities composed of highly similar prosumer characteristics may experience synchronized shortages during periods of reduced renewable generation, whereas more heterogeneous grouping structures can improve operational flexibility by balancing differences in generation and consumption behavior among participating prosumers.
From an urban energy planning perspective, the proposed grouping framework may support planners and community energy operators in designing CES/SES configurations that improve renewable energy utilization and reduce operational instability under fluctuating demand conditions. In particular, the results suggest that cooperative grouping structures can improve local energy-sharing capability and reduce reliance on external electricity procurement during peak-demand periods. This may become increasingly important in urban areas with growing rooftop photovoltaic penetration and increasing variability in electricity demand patterns.
The findings also provide several considerations for policymakers involved in community-based renewable energy deployment. Since grouping configurations significantly influence operational performance, future CES/SES implementation strategies may benefit from planning guidelines that consider prosumer diversity, storage interaction potential, and cooperative resource-sharing capability during community formation. In addition, the implementation of cooperative CES/SES systems may require coordinated operational management mechanisms and supportive local regulatory frameworks to facilitate interconnected energy-sharing operations among participating communities. These insights demonstrate that prosumer grouping can serve not only as a technical optimization variable, but also as a practical planning consideration for improving resilience, renewable integration, and long-term sustainability in urban energy systems.
Sensitivity analysis
The results indicate that both individual and cooperative community models showed no major anomalies, such as large deviations in monthly operation or irregular fluctuations, suggesting that the grouping outcomes were generally optimal based on the data analyzed. To further examine the influence of grouping, the cooperative model was applied using grouping configurations generated by the individual model as listed in Table 3. This allowed a direct evaluation of cooperative performance under fixed grouping structures and provided insights into the effectiveness of grouping strategies. Energy analysis across five months, as illustrated in Figures 6 to 9, showed stable charging and discharging cycles in most communities, particularly Communities 1, 3, and 5.

Energy storage and consumption patterns for five communities at sensitivity analysis (April).

Energy storage and consumption patterns for five communities at sensitivity analysis (May).

Energy storage and consumption patterns for five communities at sensitivity analysis (June).

Energy storage and consumption patterns for five communities at sensitivity analysis (July).
However, Communities 2 and 4 exhibited notable irregularities. Community 2 showed repeated fluctuations within cycles, indicating instability in storage or consumption that may be associated with variable solar generation or sudden demand changes. Community 4 experienced sharp declines in energy levels, suggesting critical shortages caused by increased demand or limited production. The graphical results indicate that Community 2 faced cyclical instability, while Community 4 encountered more severe energy deficits, highlighting different operational challenges. These anomalies are associated with the forced use of grouping configurations from the individual model, where variations in prosumer composition affected system stability. The findings emphasize the importance of optimized grouping strategies, such as those generated by the GA, to improve operational stability, enhance energy distribution, and reduce disruptions. These insights provide guidance for future energy management designs aimed at improving efficiency and resilience.
Conclusion
This study investigates the optimization of energy distribution in CES and SES systems using a GA with a focus on prosumer grouping to improve efficiency, reduce losses, and manage renewable uncertainty. The comparison between individual and cooperative community models reveals clear performance differences. In the individual model, several communities experienced significant energy deficits and relied heavily on third-party supply, with Community 2 incurring the highest cost of $7811.42 and total expenditure reaching $11,166.40. In contrast, the cooperative model achieved improved performance through resource sharing, reducing total costs to $4645.55, with the highest community cost limited to $1385.04.
Operational analysis shows that while the individual model exhibited regular daily cycles, some communities experienced inefficiencies, such as flatter energy peaks indicating suboptimal performance. The cooperative model maintained more stable energy patterns by redistributing resources to manage shortfalls. Sensitivity analysis confirms the importance of optimized grouping, as applying non-optimized configurations resulted in operational anomalies and instability, particularly in Communities 2 and 4. The GA effectively improved storage utilization and system resilience, demonstrating its value in enhancing energy distribution under variable conditions. The findings highlight the potential of GA-based approaches to support efficient smart grid design, reduce energy costs, and improve renewable integration. Future research can extend this work by exploring multi-objective optimization, hybrid methods, and broader applications such as distributed resource planning and storage scheduling to further strengthen energy system performance.
Footnotes
Funding
The authors disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This work was supported by the National Science and Technology Council, National Taiwan University of Science and Technology (grant number 114-2221-E-011-121-MY3, 114-2628-E-011-002, Yu-Chung Tsao, NTUST-GIGABYTE-No. 11852).
Declaration of conflicting interests
The authors declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
