Institute of Smart Energy Systems Press Institute of Smart Energy Systems Press

A Decentralized Optimization Framework for Community Microgrids Using Peer-to-Peer Trading, Battery Sharing, and Justice-Aware Cost Allocation

Original Research | Open access | Published: 20 March 2026
Volume 5, article number 37, (2026) Cite this article
You have full access to this open access article.
Download PDF
,
  1. Department of Electrical Energy Analytics, Faculty of Engineering, University of Tunis, Tunis, Tunisia
103 Accesses

Abstract

Community microgrids can empower local energy sharing, but the equitable allocation of costs and benefits from shared resources like batteries remains a challenge. Decentralized peer-to-peer trading adds flexibility, yet requires a fair framework to ensure broad participation. Existing frameworks rarely integrate P2P trading with shared battery access and explicit justice-aware cost allocation in a single, coherent design. This gap is especially important where technical efficiency, social legitimacy, and community governance must operate together. This article proposes a decentralized optimization framework that links a P2P trading layer, a battery sharing layer, and a justice-aware cost allocation layer for community microgrids. The framework is designed as a conceptual architecture rather than an empirical or simulation-based study. The framework is constructed conceptually, defining the roles, rules, and interactions of each layer. Decision rules are articulated qualitatively, and evaluation scenarios outline a validation pathway without quantitative simulations. The framework provides a modular architecture where prosumers trade energy directly, a community battery is shared according to contribution-based rules, and costs are allocated using fairness-driven formulas. Three tables summarize the trading mechanisms, justice principles, and evaluation scenarios. The proposed framework can guide the design of equitable and efficient community microgrids, and provides a foundation for future empirical testing and policy development. It emphasizes that decentralized energy systems should be evaluated not only by efficiency, but also by fairness, participation, and social accountability.

Explore related subjects
Discover the latest articles in related subjects:

Introduction

Community microgrids are increasingly presented as local energy systems that can coordinate distributed generation, flexible demand, storage, and community participation. Peer-to-peer energy trading extends this idea by allowing prosumers to exchange electricity directly within a local network rather than relying only on centralized retail arrangements [1]. Yet the move from centralized supply to local exchange does not automatically make the system fair, because households differ in asset ownership, technical capacity, and bargaining power. This article therefore treats the community microgrid as a socio-technical system in which market design and justice design must be developed together.

The growth of P2P trading reflects a wider shift toward prosumer-centered electricity systems, where households and small organizations can become active participants in local energy coordination. Game-theoretic and market-based studies show that prosumers can use bids, offers, and strategic decisions to shape local trading outcomes [2]. However, this same strategic behavior can create unequal outcomes if high-asset participants dominate local supply or capture most flexibility benefits. The proposed framework responds by embedding P2P trading inside a broader community architecture that also includes shared storage and justice-aware settlement.

Shared batteries are especially important because they determine whether local renewable energy can be shifted across time and made available to the wider community. Local electricity market research shows that battery flexibility can strongly influence prices, trading opportunities, and the distribution of benefits among participants [3]. If battery access is controlled only by those who can pay for private storage, P2P trading may deepen inequality rather than reduce it. For this reason, the framework treats battery sharing as a separate layer with its own access rules, contribution records, and fairness safeguards.

Energy justice provides the normative foundation for the proposed framework because community energy systems must be judged by more than technical efficiency. Research on renewable energy communities shows that justice depends on who receives benefits, who participates in decisions, and whose needs are recognized in design and governance [4]. This article contributes a conceptual framework that integrates a P2P trading layer, a battery sharing layer, and a justice-aware cost allocation layer without presenting mathematical formulations or simulation results. The aim is to clarify the roles, decision rules, and information flows needed for a decentralized community microgrid that is efficient, participatory, and fair.

Community Microgrid Problem

Defining community microgrids

A community microgrid is a locally coordinated electricity system that combines distributed energy resources, flexible loads, storage assets, and community-level governance. Unlike a purely technical microgrid, it has a social and organizational dimension because members may act as consumers, prosumers, investors, tenants, vulnerable users, or community representatives [5]. This means that the system must coordinate both physical electricity flows and social claims over value, access, and responsibility. In the proposed framework, the community microgrid is therefore defined as a decentralized energy commons supported by rules for trading, sharing, and fair settlement.

Assets and participants

The main assets in the proposed community microgrid include rooftop solar systems, flexible household demand, shared battery capacity, digital metering infrastructure, and the point of connection to the external grid. Peer-to-peer energy system reviews show that connected communities require coordination among prosumers, consumers, platform operators, and governance actors [6]. In this framework, solar prosumers provide local supply, consumers express demand, the community battery provides temporal flexibility, and the community operator facilitates settlement without replacing member autonomy. The governance body oversees rule legitimacy, access rights, dispute handling, and fairness monitoring.

Operational and social objectives

The operational objective of the community microgrid is to increase local use of renewable energy, reduce avoidable grid imports, coordinate battery use, and preserve reliability under normal and stressed conditions. P2P trading literature emphasizes that local exchange can support flexible coordination when market rules are designed around participant interaction and decentralized decision-making [7]. The social objective is to prevent the benefits of local energy markets from being captured only by households with solar panels, digital fluency, or capital for storage. The proposed framework therefore makes affordability, inclusion, recognition, and procedural participation explicit design objectives alongside operational coordination.

The cost allocation dilemma

The cost allocation dilemma arises because community microgrids create shared costs and shared benefits that cannot be assigned fairly through simple metering alone. Distributional research on local electricity markets shows that market and tariff design can affect participants differently depending on their consumption profiles, technology ownership, and ability to respond to price signals [8]. A household that contributes surplus solar may deserve recognition, while a household without generation may still need protected access to affordable local energy. The framework addresses this dilemma by treating cost allocation as a justice-aware process that balances contribution, usage, vulnerability, and community solidarity.

P2P Trading Layer

Market structure and trading mechanisms

The P2P trading layer is the first operational layer of the proposed framework because it enables local energy exchange among community members. In P2P microgrid models, participants can trade surplus electricity directly through local market mechanisms rather than relying only on centralized retail transactions [1]. The framework uses a decentralized market structure in which participants submit offers and requests, while a community platform coordinates matching, clearing, and settlement according to agreed rules. This design preserves local autonomy while ensuring that trading remains compatible with community objectives and justice safeguards.

Prosumer roles and bids

Participants in the P2P layer may act as sellers, buyers, flexible consumers, battery contributors, or protected consumers depending on their energy position and social circumstances. Prosumer-based community microgrid research shows that participants may behave strategically when deciding how much energy to sell, when to buy, and what price to accept [2]. In the proposed framework, bids are not treated as purely individual economic signals because they also interact with shared battery access and justice-aware allocation. A solar prosumer with excess generation may offer local energy at a declared price, while a vulnerable household may receive protection from scarcity pricing through community-approved rules.

Clearing and settlement

The clearing process matches local offers and demand requests before unresolved surplus or deficit is passed to the battery sharing layer or the external grid. Studies of local electricity market design show that storage flexibility can reshape clearing outcomes because batteries allow energy to be shifted from surplus periods to demand periods [3]. In this framework, lower-priced local offers are generally prioritized, but the clearing process also checks whether battery charging, protected consumption, or resilience reserves should take precedence. Settlement records the accepted trade, participant role, price category, delivery status, and any fairness adjustment applied by the cost allocation layer.

Information and privacy

The P2P trading layer requires enough information to support reliable local exchange, but it must avoid exposing sensitive household data unnecessarily. Smart-contract and blockchain-based P2P trading studies show that decentralized platforms can improve traceability and automate settlement, but transparency must be governed carefully to avoid privacy loss or exclusion [9]. The proposed framework separates market information, such as offers and requests, from sensitive justice information, such as vulnerability status or affordability risk. Table 1 defines the P2P trading layer by showing how each mechanism connects participant roles, pricing rules, information requirements, and justice safeguards.

Table 1. P2P Trading Layer: Mechanisms, Participant Roles, Pricing Rules, and Justice Safeguards

Mechanism

Participant roles

Pricing rule

Information required

Justice safeguard

Direct local offer matching

Solar prosumers sell surplus electricity to nearby consumers

Lower local offers are prioritized before external grid imports

Offer volume, asking price, demand request, trading interval

Basic household demand is protected from scarcity-driven local prices

Community-mediated matching

The community operator coordinates compatible offers and requests without owning the energy

A community reference price guides acceptable bid ranges

Aggregated supply, aggregated demand, participant category, network availability

Bid caps reduce the risk that high-asset participants dominate local exchange

Battery-assisted P2P exchange

Prosumers place surplus energy into shared storage for later community use

Charging priority favors affordable surplus that has high community value

Surplus source, storage request, battery availability, expected discharge need

Shared storage remains accessible to non-owners when essential demand is affected

Automated settlement

The platform records accepted trades and triggers payment or credit adjustments

Settlement follows the approved local trading rule and fairness adjustment process

Matched parties, price category, delivery confirmation, adjustment status

Auditable records allow members to question errors or unfair outcomes

External grid fallback

The external grid supplies remaining deficits or receives remaining surplus

External tariff conditions apply only after local trading and battery options are considered

Residual surplus, residual demand, grid price category

Unavoidable grid dependence by non-generating households is recognized in cost allocation

Battery Sharing Layer

Shared battery ownership and access models

The battery sharing layer treats storage as a community resource that supports local balancing, resilience, and fairness. Research on battery ownership in P2P energy sharing communities shows that ownership structure strongly affects who receives storage benefits and how costs are distributed [10]. In the proposed framework, the battery may be owned by a cooperative, jointly financed by members, supported by a public partner, or operated through a hybrid model. Access rights are not identical to ownership rights, because a justice-aware community microgrid must allow essential battery benefits to reach households that cannot afford storage investment.

Charging/discharging priority rules

Charging priority determines which surplus energy enters the shared battery when storage capacity is limited. Research on aggregated battery control for P2P energy sharing shows that a shared battery can absorb local surplus and release it later to support community demand [11]. In this framework, prosumers with excess solar are prioritized for battery charging when they offer energy at a lower community-compatible price or when their surplus would otherwise be curtailed. Discharging priority gives first attention to essential loads and resilience needs, followed by member reservations, ordinary local demand, and market-based discharge opportunities.

Capacity allocation among members

Capacity allocation defines how shared storage space is reserved among contributors, ordinary users, vulnerable members, and collective resilience needs. Research on shared battery scheduling in microgrids shows that storage access can be coordinated with household behavior, flexible demand, and community-level objectives [12]. The proposed framework divides battery access into contribution-based capacity, need-based capacity, and community reserve capacity. This layered access model prevents the battery from being used only by the most active traders while still recognizing members who contribute energy or flexibility to the system.

Contribution and usage accounting

Contribution and usage accounting records who charges the battery, who draws from it, when the exchange occurs, and whether the transaction supports private benefit or community need. P2P market designs with shared energy storage show that storage changes the timing and attribution of benefits, making careful accounting necessary for credible settlement [13]. In the framework, these records are passed to the justice-aware cost allocation layer, but they do not mechanically determine each participant’s final charge. Instead, accounting provides the evidence base for balancing contribution, usage, vulnerability, and collective responsibility.

Justice-Aware Cost Allocation Layer

Justice principles applied

The justice-aware cost allocation layer translates energy justice principles into rules for assigning costs, credits, and shared benefits. Reviews of energy justice in community energy initiatives show that justice includes distributive questions about outcomes, procedural questions about participation, and recognition questions about whose needs are acknowledged [14]. In this framework, distributive justice concerns how savings, battery access, and operating costs are shared among members. Procedural justice concerns how members influence the rules, while recognition justice concerns whether vulnerability, limited asset ownership, and energy insecurity are reflected in settlement.

Allocation formulas and criteria

The framework uses qualitative allocation criteria inspired by cooperative cost-sharing logic, but it does not present mathematical formulas. Research on fair investment strategies in energy communities shows that Shapley-type approaches can help connect participant contributions to shared value, while still requiring careful adaptation to real community contexts [15]. In this article, cost allocation follows a weighted Shapley-type rule described in prose: members who contribute generation, flexibility, or battery support receive recognition, while members with vulnerability or limited asset access receive protective adjustments. The criteria include contribution, usage, avoided grid dependence, essential demand, affordability risk, and participation in community obligations.

Balancing contribution and need

A fair cost allocation layer must avoid treating all members as identical while also avoiding a system that rewards only asset-rich participants. Research on fairness in energy communities shows that centralized and decentralized arrangements can support different fairness goals depending on how allocation rules are designed and monitored [16]. The proposed framework balances contribution and need by assigning ordinary costs according to use and benefit, while moderating settlement for vulnerable households through community-approved recognition rules. This design protects the legitimacy of the microgrid because high-contributing prosumers can see their contribution acknowledged without excluding members who lack generation or storage assets.

Dynamic adjustments and fairness monitoring

Fairness monitoring is necessary because household circumstances, technology ownership, energy prices, and weather-dependent generation change over time. Research on benefit allocation in energy communities emphasizes that allocation methods must remain transparent, understandable, and adaptable if members are to trust the system [17]. In the proposed framework, the governance body periodically reviews whether P2P trading gains, battery access, and shared cost reductions are becoming concentrated among a narrow group of participants. Table 2 presents the justice-aware cost allocation layer by mapping each justice principle to an allocation rule, a cost-sharing application, a community process, and the unfairness risk it is designed to address.

Table 2. Justice-Aware Cost Allocation Layer: Principles, Allocation Rules, Community Processes, and Risks Addressed

Justice principle

Allocation rule

Cost-sharing application

Required community process

Risk addressed

Distributive justice

Allocate ordinary costs according to use, benefit, and verified contribution

Members who benefit more from local trades or shared battery discharge carry a proportionate share of ordinary operating costs

Publish settlement categories in clear and accessible language

Hidden cross-subsidies that favor high-consuming or high-asset members

Procedural justice

Make rule-setting participatory, reviewable, and contestable

Members can review trading rules, battery access categories, and settlement adjustments

Hold periodic community reviews with documented responses to objections

Technocratic rules that members cannot understand, question, or influence

Recognition justice

Adjust settlement for vulnerability, essential need, and limited asset ownership

Low-income, medically dependent, or non-generating households receive moderated cost exposure

Use privacy-preserving eligibility review through trusted community governance

Exclusion of households without solar panels, batteries, flexible loads, or digital tools

Reciprocity

Reward contributions without allowing contributors to dominate the system

Solar exports, flexible demand, and battery charging support reduce net community charges

Maintain auditable contribution and usage records

Free-riding concerns that could reduce prosumer participation

Resilience solidarity

Treat selected backup and emergency functions as collective services

Essential resilience reserves are supported by the community rather than only by direct users

Define essential loads and emergency access rules before stressed events occur

Market-based storage allocation that fails vulnerable members during crises

Adaptive fairness

Revise allocation rules when repeated unfair outcomes appear

Settlement weights and access rules are reviewed when benefits concentrate persistently

Conduct recurring fairness audits and community deliberation

Lock-in of unfair outcomes as asset ownership and household needs change

Framework Logic

Integrating the three layers

The proposed framework integrates the P2P trading layer, battery sharing layer, and justice-aware cost allocation layer as mutually dependent parts of one community microgrid architecture. Reviews of local energy market models show that P2P trading, community self-consumption, and transactive energy are often treated as related but separate pathways, which makes integration a central design challenge [18]. In this framework, the P2P layer identifies local exchanges, the battery layer manages temporal flexibility, and the cost allocation layer determines whether the resulting settlement is socially legitimate. The three layers therefore operate as a coordinated sequence rather than as independent modules.

Figure 1 illustrates the proposed decentralized community microgrid architecture by showing how peer-to-peer trading, shared battery scheduling, justice-aware settlement, and community governance operate as one integrated socio-technical framework.

Figure 1. Decentralized Community Microgrid Architecture Linking Peer-to-Peer Trading, Shared Battery Access, and Justice-Aware Cost Allocation

Figure 1. Decentralized Community Microgrid Architecture Linking Peer-to-Peer Trading, Shared Battery Access, and Justice-Aware Cost Allocation

Data flows and decision sequencing

The framework begins with participants submitting local supply offers, demand requests, flexibility preferences, and battery access needs through a community platform. Blockchain-based P2P platforms show that decentralized trading can be supported by auditable records, automated settlement, and transparent transaction histories when the data architecture is carefully designed [19]. In the proposed sequence, market data first informs local trade matching, storage data then determines whether the shared battery should charge or discharge, and justice data finally adjusts the allocation of costs and benefits. Sensitive social information is not exposed to all participants, but it is used through protected governance channels to support recognition-based settlement.

Handling conflicts and trade-offs

Conflicts emerge when the cheapest trade is not the fairest trade, when the most profitable battery use is not the most socially valuable use, or when resilience reserves reduce short-term market gains. Ancillary service research on P2P energy communities shows that local trading systems can create multiple value streams, but those value streams must be coordinated to avoid undermining community priorities [20]. The framework handles these trade-offs by giving priority to essential demand, community-approved resilience reserves, and fairness constraints before purely opportunistic trading. This does not eliminate market behavior, but it places market behavior within a justice-aware community rule system.

Governance and community oversight

Community oversight is required because decentralized technical coordination does not automatically create democratic accountability. Research on community energy and smart-grid arrangements shows that roles, goals, and institutional structures strongly shape how community energy systems operate in practice [21]. In the proposed framework, a community governance body defines trading eligibility, battery access categories, fairness adjustment procedures, and dispute resolution pathways. The operator implements these rules, but the community retains authority to review whether the framework continues to reflect shared values and changing member needs.

Optimization/Decision Rules

P2P trading decision rules

The P2P trading decision rules are expressed qualitatively so that the framework remains conceptual rather than mathematical. State-of-the-art analyses of P2P trading show that local markets can rely on different matching, pricing, and settlement structures depending on community goals and platform design [22]. In this framework, local offers are prioritized when they are affordable, available within the community, and compatible with network and fairness conditions. Prosumers with excess solar are encouraged to sell locally before exporting externally, while consumers receive protection from extreme local price signals when essential demand is at stake.

Battery sharing logic

The battery sharing logic determines when the shared battery should charge, discharge, reserve capacity, or remain available for resilience purposes. Research on P2P trading with complex distributed resource ownership shows that ownership arrangements can affect how resources are used and how benefits are distributed [23]. In the proposed framework, surplus solar offered at lower community-compatible prices is prioritized for charging, especially when it would otherwise be wasted or exported at low value. Discharging is directed first toward essential community demand and reliability needs, then toward participant reservations and ordinary market opportunities.

Cost allocation execution

Cost allocation execution translates trading records and battery usage records into a settlement outcome that reflects both contribution and need. Research on dynamic P2P energy sharing shows that network structure and participant interaction can change over time, which means allocation cannot be fixed permanently at the start of a project [24]. The framework therefore applies contribution recognition, usage responsibility, vulnerability adjustment, and resilience solidarity as sequential settlement checks. The resulting allocation is not simply a price calculation, but a governance-informed judgment about how the community should distribute the costs and benefits of local energy cooperation.

Operator and community control

The community operator coordinates information flows, settlement records, battery scheduling requests, and member communications, but does not override the community’s agreed governance principles. Multi-layer and multi-agent microgrid control research shows that decentralized systems require coordination among agents, control levels, and operational responsibilities [25]. In the proposed framework, the operator manages technical execution while the governance body defines the acceptable boundaries of trading, storage access, and cost allocation. This distinction prevents the framework from becoming either a purely automated market or a fully centralized command structure.

Evaluation Scenarios

Scenario 1: balanced participation

The first evaluation scenario assumes a community in which many households have moderate solar generation, flexible demand is reasonably distributed, and the shared battery is used regularly by different participant groups. P2P energy trading research with multi-energy microgrids suggests that decentralized coordination can support interaction among multiple local resources when participants respond to local conditions [26]. In this scenario, the framework would be assessed by examining whether local trades are frequent, battery access rotates across members, and cost allocation remains understandable and acceptable. The expected qualitative outcome is a stable community market in which efficiency gains do not undermine fairness.

Scenario 2: heterogeneous contributions

The second evaluation scenario examines a community with uneven asset ownership, where some members own solar panels and flexible appliances while others are renters, low-income households, or consumers with limited ability to shift demand. Research on net-zero energy communities with storage and P2P trading shows that different technologies and participation capacities can shape trading opportunities and storage value [27]. This scenario tests whether the justice-aware allocation layer prevents high-asset households from capturing most benefits while still recognizing their contributions. The expected qualitative outcome is a settlement structure that rewards contribution but maintains protected participation for members with fewer assets.

Scenario 3: stressed grid conditions

The third evaluation scenario considers stressed grid conditions, such as high prices, reduced solar availability, constrained network capacity, or an outage risk requiring careful battery use. Research on user preferences for P2P energy trading indicates that social acceptance depends not only on economic value, but also on how participants perceive trust, fairness, and local benefit  [28]. In this scenario, the framework would be evaluated by observing whether the battery prioritizes essential loads, whether P2P prices remain within community-approved limits, and whether vulnerable households are protected from disproportionate burdens. Table 3 summarizes the three evaluation scenarios, their core parameters, and the qualitative outcomes expected from the proposed framework.

Table 3. Evaluation Scenarios, Key Parameters, and Expected Qualitative Outcomes

Evaluation scenario

Community condition

Key parameters to observe

Framework response

Expected qualitative outcome

Balanced participation

Solar generation, flexible demand, and battery use are broadly distributed across members

Frequency of local trades, diversity of battery users, member understanding of settlement

Prioritize local matching, rotate battery access, and apply ordinary contribution-based settlement

Stable local market with visible fairness and broad participation

Heterogeneous contributions

Some members own solar and flexible assets, while others have limited resources or rent their homes

Concentration of savings, access by non-owners, vulnerability adjustments, dispute frequency

Reward verified contributions while applying recognition-based cost moderation

Contribution is acknowledged without excluding low-asset or vulnerable households

Stressed grid conditions

High prices, low renewable output, network constraints, or outage risk affect community operation

Battery reserve use, essential load protection, price restraint, emergency governance decisions

Prioritize essential demand, activate resilience solidarity, and limit scarcity-driven settlement

Community resilience improves while vulnerable members are protected from excessive burdens

Governance stress test

Members disagree about battery access, pricing limits, or fairness adjustments

Rule contestation, transparency of records, responsiveness of governance body

Use audit trails, community review, and documented rule revision

Trust is maintained through procedural fairness rather than technical automation alone

Technology adoption transition

New members add solar, storage, or flexible demand over time

Shifts in contribution patterns, changing access claims, settlement legitimacy

Update access categories and allocation weights through fairness monitoring

The framework adapts as the community evolves and avoids long-term lock-in

Implications

Policy and regulatory implications

The proposed framework implies that regulation for community microgrids should move beyond enabling local trading alone and should also address shared storage rights, settlement transparency, and fairness obligations. Peer-to-peer and community self-consumption reviews show that local market models sit at the intersection of technical design, market rules, and regulatory permission [18]. Policymakers could support this type of framework by recognizing community operators, allowing shared batteries to serve collective purposes, and requiring transparent cost allocation rules for local energy communities. Regulation should also leave room for communities to define justice safeguards that reflect local conditions rather than imposing only uniform market templates.

Social acceptance and community engagement

Social acceptance depends on whether members understand the framework, trust the settlement process, and believe that participation is meaningful. Evidence from residential preferences for P2P trading suggests that users evaluate local energy exchange through perceived value, trust, and community relevance, not only through financial returns [28]. The proposed framework therefore requires accessible communication, participatory rule-making, and visible mechanisms for contesting unfair outcomes. Community engagement is not an optional add-on, because the legitimacy of P2P trading and shared battery use depends on whether members recognize themselves in the rules.

Technical implementation considerations

Technical implementation requires interoperable metering, secure data exchange, battery management systems, settlement platforms, and governance interfaces that can translate community rules into operational actions. Multi-agent and decentralized microgrid control research shows that layered architectures can coordinate distributed decisions while preserving local autonomy [25]. However, implementation should avoid assuming that automation alone can solve fairness problems, because justice-aware allocation requires social information, deliberation, and periodic review. The framework therefore points toward digital platforms that are technically robust, privacy-preserving, and accountable to community governance.

Conclusion

This article proposed a decentralized conceptual framework for community microgrids that integrates peer-to-peer trading, battery sharing, and justice-aware cost allocation. The framework treats the community microgrid as a socio-technical system in which local energy exchange, shared flexibility, and fair settlement must be coordinated together. Its central claim is that technical decentralization is insufficient unless it is paired with procedures that address distribution, recognition, and participation.

The P2P trading layer enables local energy exchange among prosumers and consumers, while the battery sharing layer turns storage into a community resource rather than a private advantage. The justice-aware cost allocation layer then evaluates how trading gains, storage benefits, and shared costs should be distributed. Together, these layers create a framework in which energy transactions are linked to community responsibilities.

The framework is intentionally conceptual and does not present mathematical models, numerical simulations, or empirical results. Instead, it defines roles, decision rules, information flows, governance functions, and evaluation scenarios that can guide future research and pilot design. This approach is useful where communities and policymakers need an organizing architecture before selecting specific optimization tools or market platforms.

Future work should translate the framework into participatory pilots, simulation studies, regulatory sandboxes, and community co-design processes. Such work should test not only whether the system improves local energy coordination, but also whether members perceive the rules as fair, understandable, and responsive. A community microgrid can be genuinely transformative only when shared energy resources are governed as instruments of both efficiency and justice.

Acknowledgements

None

Conflict of interest

None

Financial support

None

Ethics statement

None

References

Zhang C, Wu J, Zhou Y, Cheng M, Long C. Peer-to-Peer energy trading in a Microgrid. Appl Energy. 2018;220:1-2.
Paudel A, Chaudhari K, Long C, Gooi HB. Peer-to-peer energy trading in a prosumer-based community microgrid: A game-theoretic model. IEEE Trans Ind Electron. 2018;66(8):6087-97.
Lüth A, Zepter JM, Del Granado PC, Egging R. Local electricity market designs for peer-to-peer trading: The role of battery flexibility. Appl Energy. 2018;229:1233-43.
Hanke F, Guyet R, Feenstra M. Do renewable energy communities deliver energy justice? Exploring insights from 71 European cases. Energy Res Soc Sci. 2021;80:102244.
Gui EM, MacGill I. Typology of future clean energy communities: An exploratory structure, opportunities, and challenges. Energy Res Soc Sci. 2018;35:94-107.
Tushar W, Yuen C, Saha TK, Morstyn T, Chapman AC, Alam MJ, et al. Peer-to-peer energy systems for connected communities: A review of recent advances and emerging challenges. Appl Energy. 2021;282:116131.
Soto EA, Bosman LB, Wollega E, Leon-Salas WD. Peer-to-peer energy trading: A review of the literature. Appl Energy. 2021;283:116268.
Lüth A, Weibezahn J, Zepter JM. On distributional effects in local electricity market designs—evidence from a german case study. Energies. 2020;13(8):1993.
Vieira G, Zhang J. Peer-to-peer energy trading in a microgrid leveraged by smart contracts. Renew Sustain Energy Rev. 2021;143:110900.
Rodrigues DL, Ye X, Xia X, Zhu B. Battery energy storage sizing optimisation for different ownership structures in a peer-to-peer energy sharing community. Appl Energy. 2020;262:114498.
Long C, Wu J, Zhou Y, Jenkins N. Peer-to-peer energy sharing through a two-stage aggregated battery control in a community Microgrid. Appl Energy. 2018;226:261-76.
AlSkaif T, Luna AC, Zapata MG, Guerrero JM, Bellalta B. Reputation-based joint scheduling of households appliances and storage in a microgrid with a shared battery. Energy Build. 2017;138:228-39.
Zheng B, Wei W, Chen Y, Wu Q, Mei S. A peer-to-peer energy trading market embedded with residential shared energy storage units. Appl Energy. 2022;308:118400.
Van Bommel N, Höffken JI. Energy justice within, between and beyond European community energy initiatives: A review. Energy Res Soc Sci. 2021;79:102157.
Pedrero RA, Pisciella P, del Granado PC. Fair investment strategies in large energy communities: A scalable Shapley value approach. Energy. 2024;295:131033.
Gasca MV, Rigo-Mariani R, Debusschere V, Sidqi Y. Fairness in energy communities: Centralized and decentralized frameworks. Renew Sustain Energy Rev. 2025;208:115054.
Casalicchio V, Manzolini G, Prina MG, Moser D. Optimal allocation method for a fair distribution of the benefits in an energy community. Solar RRL. 2022;6(5):2100473.
Capper T, Gorbatcheva A, Mustafa MA, Bahloul M, Schwidtal JM, Chitchyan R, et al. Peer-to-peer, community self-consumption, and transactive energy: A systematic literature review of local energy market models. Renew Sustain Energy Rev. 2022;162:112403.
Esmat A, de Vos M, Ghiassi-Farrokhfal Y, Palensky P, Epema D. A novel decentralized platform for peer-to-peer energy trading market with blockchain technology. Appl Energy. 2021;282:116123.
Zhou Y, Wu J, Song G, Long C. Framework design and optimal bidding strategy for ancillary service provision from a peer-to-peer energy trading community. Appl Energy. 2020;278:115671.
Van Summeren LF, Wieczorek AJ, Bombaerts GJ, Verbong GP. Community energy meets smart grids: Reviewing goals, structure, and roles in Virtual Power Plants in Ireland, Belgium and the Netherlands. Energy Res Soc Sci. 2020;63:101415.
Zhou Y, Wu J, Long C, Ming W. State-of-the-art analysis and perspectives for peer-to-peer energy trading. Engineering. 2020;6(7):739-53.
Luo X, Shi W, Jiang Y, Liu Y, Xia J. Distributed peer-to-peer energy trading based on game theory in a community microgrid considering ownership complexity of distributed energy resources. J Clean Prod. 2022;351:131573.
Chen L, Liu N, Li C, Zhang S, Yan X. Peer-to-peer energy sharing with dynamic network structures. Appl Energy. 2021;291:116831.
Wang Y, Nguyen TL, Xu Y, Tran QT, Caire R. Peer-to-peer control for networked microgrids: Multi-layer and multi-agent architecture design. IEEE Trans Smart Grid. 2020;11(6):4688-99.
Chen T, Bu S, Liu X, Kang J, Yu FR, Han Z. Peer-to-peer energy trading and energy conversion in interconnected multi-energy microgrids using multi-agent deep reinforcement learning. IEEE Trans Smart Grid. 2021;13(1):715-27.
Liu J, Yang H, Zhou Y. Peer-to-peer trading optimizations on net-zero energy communities with energy storage of hydrogen and battery vehicles. Appl Energy. 2021;302:117578.
Cárdenas-Álvarez JP, España JM, Ortega S. What is the value of peer-to-peer energy trading? A discrete choice experiment with residential electricity users in Colombia. Energy Res Soc Sci. 2022;91:102737.

Author information

Sara Ben Youssef & Amal Trabelsi contributed to this work.

Authors and affiliations

Department of Electrical Energy Analytics, Faculty of Engineering, University of Tunis, Tunis, Tunisia
Sara Ben Youssef & Amal Trabelsi

Corresponding author

Correspondence to Sara Ben Youssef

Rights and permissions

Open Access The author(s) retain copyright. This article is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. It may be shared and adapted for non-commercial purposes with appropriate attribution, an indication of changes, and distribution of adaptations under the same license. Third-party material may be subject to separate terms identified in its credit line. View the license at https://creativecommons.org/licenses/by-nc-sa/4.0/.

About this article

Cite this article

Vancouver
Ben Youssef S, Trabelsi A. A Decentralized Optimization Framework for Community Microgrids Using Peer-to-Peer Trading, Battery Sharing, and Justice-Aware Cost Allocation. J Smart Grids Energy Anal Optim. 2026;5:37.
APA
Ben Youssef, S., & Trabelsi, A. (2026). A Decentralized Optimization Framework for Community Microgrids Using Peer-to-Peer Trading, Battery Sharing, and Justice-Aware Cost Allocation. Journal of Smart Grids, Energy Analytics and Optimization, 5, 37.
Received
05 October 2025
Revised
11 November 2025
Accepted
20 December 2025
Published
20 March 2026
Version of record
20 March 2026

Share this article

Easily share this article with others using the link below:

A Decentralized Optimization Framework for Community Microgrids Using Peer-to-Peer Trading, Battery Sharing, and Justice-Aware Cost Allocation
Scan to access
this article

Ready to submit?
Start a new submission or continue a submission in progress:
Submission Portal Author Guidelines

Follow this journal
Get notified of new updates and articles.