Enhanced Resilience and Cost Optimization in Peer-to-Peer Energy Trading with Smart Pricing and MILP-Based Optimization for Multi-Microgrid Systems

Liuyue Fang

Guangzhou College of Technology and Business, Guangzhou 510800, Guangdong Province, China
Beijing Care-jet New Material Technology Co., Ltd. Beijing 100000, China
E-mail: 13811312997@163.com

Received 11 October 2025; Accepted 25 April 2026

Abstract

The transition toward decentralized energy systems has led to the development of Peer-to-Peer (P2P) energy sharing schemes, allowing prosumers to exchange surplus energy within regional networks. This paper presents an optimized energy transaction framework that improves system resilience while facilitating cost-effective energy exchange through a two-stage adaptive P2P pricing mechanism The principal objective is to develop an internal pricing structure that combines market-based initial price formation with real-time electric vehicle-aware price adjustment to support equitable energy trades, reduce dependence on centralized utilities, and enhance economic efficiency. The suggested methodology uses a mathematical optimization model that integrates supply-demand dynamics and pricing strategies. A Mixed-Integer Linear Programming (MILP) method is employed to optimize energy distribution among prosumers, while considering network limitations and variations in renewable energy. Simulation data derived from actual energy profiles are used to validate the framework across various market scenarios. Numerical results show that the P2P energy trading mechanism enhances system resilience by decreasing peak demand by 20% and reducing prosumer costs by an average of 15%. The proposed pricing strategy guarantees equitable energy distribution, reduces transaction costs, and encourages active customer engagement. The findings demonstrate that decentralized energy markets can advance sustainability while also providing modern power systems with economic advantages.

Keywords: Decentralized energy system, energy market, MILP, P2P, smart pricing mechanism, system resilience.

1 Introduction

The increasing integration of dispersed energy resources and the move to decentralized energy systems have led to the creation of innovative energy trading models, such as P2P energy sharing [1, 2]. P2P energy trading promotes energy self-sufficiency, lowers transmission losses, and improves overall system resilience by enabling prosumers to directly exchange excess energy within a limited network [3, 4]. As the global energy landscape transforms, decentralized energy markets are crucial for achieving sustainability goals, reducing dependence on traditional power sources, and promoting consumer participation in the energy transition [5, 6].

Conventional energy markets operate under a centralized framework, where the production, distribution, and utilization of electricity are managed by major utility corporations [7]. This structure often results in inefficiencies, such as energy limitations, transmission delays, and reduced consumer autonomy [8]. P2P energy trading, on the other hand, creates a decentralized system that allows users to engage in direct energy trades based on mutually acceptable conditions [9]. This market system enhances local energy consumption, optimizes supply-demand balance, and encourages Demand-Side Management (DSM) [10, 11]. Furthermore, P2P energy trading provides economic benefits by allowing prosumers to monetize their excess energy, thereby reducing reliance on conventional energy suppliers [12].

P2P energy trading, while advantageous, faces challenges such as regulatory barriers, pricing complexities, and network constraints [13, 14]. A key challenge in P2P markets is developing a fair and efficient pricing system that balances supply and demand while ensuring economic sustainability for all participants. Dynamic pricing mechanisms, auction-based models, and incentive-driven frameworks have been explored to address these issues; yet, achieving an optimal energy transaction strategy remains an area of ongoing research. Furthermore, ensuring resilience in energy markets, particularly during grid outages and demand changes, is critical for the widespread adoption of P2P energy-sharing.

The proposed aim of this research is to improve resilience and optimize energy transactions in P2P energy sharing networks through a two-stage adaptive pricing framework for multi-microgrid systems. The proposed approach establishes the internal P2P price through a market-based initial pricing stage and then updates it according to real-time surplus-deficiency conditions and Electric Vehicle (EV) charging/discharging behavior, thereby supporting equitable energy distribution, economic benefits for prosumers, and grid-aware operation. The pricing framework is further integrated with market matching and MILP-based operational optimization to enhance the sustainability and effectiveness of energy trading in decentralized energy systems.

1.1 Literature Review

Hahnel and Fell [15] examined individual trade preferences in P2P power marketplaces, highlighting the significance of prosumer-cantered models in optimizing local supply and demand and promoting active citizen engagement. Despite the social foundation of these marketplaces, there was limited understanding of how individuals engage in trade with different participants. A cross-national experiment conducted in Germany (n = 440) and the United Kingdom (n = 441) found three distinct trading strategies influenced by trading counterparties. The findings revealed that political orientation, geographical attachment, climate change and trust in the trading entity all had an impact on trade decisions. Although trading preferences were consistent across nations, public broadcast of judgments resulted in country-specific variances. These findings underscored the importance of considering contextual features in the design of P2P systems and developing interventions to increase public participation in energy markets. Zhao et al. [16] employed DSM in P2P energy sharing to improve revenue equity and system stability. Their methodology used a standardized pricing and energy distribution system to guarantee fair participation and access to Photo-Voltaic (PV) electricity. They implemented assessment metrics for grid stability and revenue equity, enhancing flexible load scheduling with multi-objective optimization. Simulation results indicated that, in comparison to P2P sharing alone, the strategy decreased community expenditures by 16.8%, reduced power fluctuation by 76%, and diminished inequity by 62.6%, underscoring its efficacy in enhancing economic and operational performance in P2P energy markets. Kim et al. [17] investigated P2P energy trading price mechanisms by analyzing 169 papers published between 2015 and 2022. They classified energy pricing as synchronous or asynchronous and network service pricing as ex-ante or ex-post. While asynchronous pricing promoted transparency and Pareto optimality, synchronous pricing improved economic efficiency. Disputes in network service pricing reduced market participation, especially between system operators and market participants. The study revealed that pricing compatibility was dependent upon market results and matching processes. Zhang et al. [18] investigated market-driven P2P trading strategies in a home microgrid included two prosumers and one consumer. They used Hong Kong household load data to assess five examples included various market types, tariff regimes, and pricing models. Individual pricing increased price variability, but time-of-use tariffs enhanced economic efficiency, resulting in electricity reductions of 31.33% in summer and 43.02% in winter. Battery Energy Storage System (BESS) increased renewable self-consumption by 91.98% in summer and 100% in the winter, enhancing trade flexibility and electricity dispatching. The study provided a framework that may be adapted to changing market conditions. Zhu et al. [19] examined how P2P transactions might improve distribution systems’ resistance to high-impact, low-probability occurrences. A bi-level, two-stage resilient model was devised in which the Distributed Energy Resource (DER) established Distribution Locational Marginal Prices (DLMPs), and prosumers participated in P2P transactions informed by these price signals. The model utilized a nested Column-and-Constraint Generation (CCG) algorithm combined with a bi-level interaction approach employing deviation penalty functions. Case studies showed that P2P transactions diminished load shedding costs and quantities while decreasing operational expenditures, hence improving system resilience. Babu et al. [20] assessed the influence of P2P energy sharing on microgrid resilience through a resilience metric. Researchers examined an IEEE 123-node test feeder integrating DERs, utilizing a cooperative game model and a visibility graph to determine the Percolation Threshold (PT). Three P2P scenarios were examined: within a microgrid, between neighboring microgrids, and throughout the entire distribution system. The findings indicated a cost reduction of $8,380, a decrease of 34,917 kWh in reliance on the grid, and a 14% enhancement in resilience. The study also forecasted microgrid energy requirements for operational planning, highlighting P2P energy sharing’s benefits. Goncalves et al. [21] utilized a MILP model to maximize energy transactions in a community that comprised energy storage devices, the grid, and P2P trading. The research used fairness indicators to examine economic equity, analyzing a ten-household community with six prosumers with varying PV and storage capacities. The findings demonstrated differences in cost reductions depending on equipment acquisition capacity, with participants who combined P2P transactions with high-capacity PV and storage seeing an 183% cut in energy expenses compared to those who did not. Dwivedi et al. [22] examined the impact of P2P energy trading and DERs on the resilience of Electrical Distribution Systems (EDSs) during extreme events. Although DERs bolster resilience at the consumer level, P2P trading networks augment system reliability. To measure this influence, they implemented a methodology utilizing PT analysis in complex networks and employed cooperative game theory to simulate rational prosumer engagement. In an analysis of microgrid creation within an IEEE-123 node test feeder incorporating renewables, it was demonstrated that DER and P2P trade integration resulted in a 67.91% cost reduction and a 25.07% enhancement in microgrid resilience over the course of one year. Kiu et al. [23] investigated a P2P energy sharing system aimed at mitigating carbon emissions through Renewable Energy (RE) distribution. Although prior research emphasized cost and emission reduction, the resilience of systems to interruptions has been insufficiently examined. They presented an optimal P2P strategy using N-1 contingency to maintain stability in the event of a participant’s shutdown. Their methodology established the minimal renewable capacity necessary to sustain energy supply and meet emissions objectives. A case study indicated that the absence of N-1 contingency resulted in a 19.47% rise in emissions and a 10.81% rise in energy prices. Their findings highlighted N-1 contingency as a crucial method for improving P2P system resilience. Wang et al. [24] developed a framework for community energy management optimization in integrated energy systems to improve grid flexibility, mitigate demand uncertainty, and increase user participation. The methodology incorporated Self-Determination Theory (SDT) for user behavior modeling, a Distributionally Robust Optimization (DRO) layer to operate uncertainty, and gamification to enhance participation incentives. The case study demonstrated that the framework decreased expenses by 15%, lowered carbon emissions by 20%, and enhanced user engagement by 25% relative to traditional methods. The study integrated technical and behavioral tactics, providing insights for robust and sustainable energy systems.

Table 1 presents a detailed description of significant works examined in this research, concentrating on P2P energy trading, decentralized energy markets, and system resilience. The table classifies each reference according to its target area, key findings, methodology, and publication year, providing insights into recent developments and challenges in the field.

Table 1 The summary of reviewed literature

Refs. Focus Area Key Findings Methodology Year
[15] P2P trading preferences and market participation Three trading strategies identified; influenced by political orientation, trust, and climate beliefs. Cross-national experiment (UK, Germany) with 881 participants. 2022
[16] DSM in P2P energy sharing Integrated DSM reduces community costs by 16.8%, power fluctuation by 76%, and inequality by 62.6%. Uniform pricing and energy allocation with multi-objective optimization. 2023
[17] Pricing mechanisms in P2P energy trading Synchronous pricing improves economic efficiency; asynchronous pricing enhances transparency. Review of 169 studies (2015-2022) on pricing models in P2P trading. 2023
[18] Market-driven P2P trading strategies in microgrids Individual pricing increases variability; ToU tariffs reduce energy costs by 31.33% (summer) and 43.02% (winter). Analysis of five market types, tariff systems, and pricing models using Hong Kong load data. 2023
[19] P2P transactions for distribution system resilience P2P transactions lower load shedding costs and improve distribution system resilience. Bi-level, two-stage model using DLMPs and CCG algorithm. 2024
[20] P2P energy sharing and microgrid resilience P2P energy sharing reduces grid reliance by 34,917 kWh and enhances resilience by 14%. IEEE 123-node test feeder using cooperative game model and visibility graph. 2024
[21] Optimization of energy transactions in energy communities High-capacity PV and storage improve energy bills by 183%, while those without achieve only 13% savings. MILP model with fairness indicators. 2024
[22] Impact of DERs and P2P trading on EDS resilience P2P trading with DERs enhances microgrid resilience by 25.07% and reduces costs by 67.91%. Percolation Threshold analysis in complex networks with cooperative game theory. 2024
[23] P2P energy sharing resilience using N-1 contingency N-1 contingency stabilizes P2P systems, preventing a 10.81% energy price increase and 19.47% rise in emissions. N-1 contingency approach for P2P stability with a case study. 2024
[24] Community energy management in IES Integrated SDT, DRO, and gamification reduce costs by 15%, emissions by 20%, and increase engagement by 25%. SDT for user behavior, DRO for uncertainty, gamification for participation incentives. 2025

1.2 Research Gap

Decentralized energy systems are advancing rapidly, yet P2P energy trade still faces several fundamental research gaps.

Decentralized energy exchange is not adequately addressed by centralized utilities, which limit autonomy and pricing flexibility. Moreover, existing pricing strategies often fail to reflect real-time variations in energy supply and demand, resulting in inefficiencies and unfair market conditions for prosumers Another issue is resilience, as most frameworks lack adaptive methods to address energy generation and consumption changes, rendering them vulnerable to RE intermittency.

Current research uses computationally intensive optimization methods that are not scalable for large networks, leading to performance degradation as market participants grow. Further, many models fail to incorporate network constraints, grid capacity, and regulatory policies, thus compromising their practical relevance. More robust and adaptable optimization approaches capable of managing changing market conditions and large-scale energy transactions are required to bridge these gaps. In particular, limited attention has been given to pricing frameworks that preserve market-based price limits while adaptively updating internal P2P prices according to EV charging/discharging behavior and real-time surplus-deficiency conditions in multi-microgrid energy communities.

1.3 Innovation

This research presents a two-stage adaptive P2P pricing framework for multi-microgrid energy trading. The proposed pricing mechanism combines a market-based initial price formation stage with a real-time EV-aware price adjustment based on surplus-deficiency conditions. The pricing model is combined with market matching and MILP based operational optimization models that would allow for more efficient and robust energy trading in decentralized multi-microgrids. The MILP based operational optimization model can help in optimizing the allocation of energy among the prosumers taking into consideration the dynamics of supply and demand, along with changes in RE production. In addition to that, the proposed model would also be able to enhance the robustness of the system by combining pricing, transaction, and energy allocation within a unified structure. This statement can be validated through results obtained from simulated data using real-world energy profiles. Through combining price-based trading, optimization of energy consumption, and matching into one mathematical model, the method proposed ensures a stable and efficient P2P energy exchange among multi-microgrids.

1.4 Paper Structure

Section 2 describes the Methodology, covering multi microgrids topology, cost function, constraints on the operations, EV constraints, the pricing scheme, market matching mechanism, clearance and settlement model, and case study formulation. The numerical results and simulation analysis are presented in Section 3, where the proposed framework is evaluated in a 36-participant multi-microgrid system. Section 4 concludes the paper and outlines the future research directions.

2 Methods

This work develops a P2P energy trading framework for multi-microgrid systems by integrating a two-stage adaptive pricing mechanism with a MILP-based optimization model to improve system resilience and economic efficiency. The overall procedure consists of multi-microgrid topology design, market-based initial price formation, EV-aware adaptive price adjustment, market matching, transaction clearing, and simulation-based performance evaluation.

2.1 Multi-microgrid Topology

Multi-microgrid systems are commonly organized as AC, DC, or hybrid AC/DC structures [2527]. The architecture, coordinated control, and operational design have also been widely investigated in prior studies [2830]. In this study, the adopted conventional Multi Micro Grid (MMG) scheme is shown in Figure 1, where interconnected microgrids exchange power with the utility grid and with one another through P2P transactions. Figure 1 represents heterogeneous microgrids equipped with different combinations of EVs, PV units, Wind Turbines (WTs), micro turbines, ESSs, and local AC/DC loads.

images

Figure 1 Conventional multi microgrid scheme.

To ensure secure and economically sustainable operation, the microgrids are coordinated through a MMG energy management system. As shown in Figure 2, it supports information interaction, control and scheduling, resilient operation, and ancillary service, forming the basis of the proposed framework.

images

Figure 2 Multi-Microgrid topology.

2.2 Cost Formulation

Depending on the local configuration, each microgrid may include Energy Storage Systems (ESSs), EVs, renewable generation units, and local loads. The operating cost is formulated using the components explicitly considered in the scheduling framework. The ESS operating cost is modelled as [31].

2.2.1 Cost of ESS

Ct,jESS=djESS(Pt,jch+Pt,jdis) (1)

where djESS is the degradation cost coefficient of the ESS in microgrid j, and Pt,jch and Pt,jdis denotes the charging and discharging power at time t, respectively. The non-simultaneous charging and discharging condition is enforced later through the operational constraints.

2.2.2 Cost of trading with distribution grid

The cost of energy exchange with the utility grid is presented as follows in Equation (2):

CDj,tgrid=λj,tbpj,tbλj,tspj,ts (2)

where λj,tb and pj,tb denote the electricity purchase price and purchased power of microgrid j at time t, respectively, and λj,ts and pj,ts denote the selling price and exported power to the grid. Since the selling price is typically lower than the buying price, local energy sharing and P2P exchange can improve the economic performance of the microgrids.

2.2.3 P2P energy trading costs

The cost of P2P energy exchange for microgrid j at time t is presented as follows in Equation (3):

CPj,tp2p=iN,ij1λj,i,tp2ppj,i,tp2p (3)

where N is the set of microgrids, λj,i,tp2p is the transaction price between microgrids j and i at time t, and pj,i,tp2p is the exchanged power. A positive value of pj,i,tp2p indicates that microgrid j import power from microgrid i, whereas a negative value shows the export.

2.3 Operational Constraints

The day-ahead trading model subject to the following operational constraints for each microgrid are presented in Equations (4)–(10) [32]:

0pi,trepire,max (4)
0pi,tchpich,max (5)
0pi,tdispidis,max (6)
SoCi,t=SoCi,t1+(ηichpi,tchpi,tdis/ηidis)/Eimax (7)
SoCi,0=SoCi,T (8)
SoCiminSoCi,tSoCimax (9)
Pj,i,tp2p=pj,i,tp2ptT,i,jN,ij (10)

The constraints related to DER includes renewable power generation, charging and discharge limits for ESS and its State of Charge (SoC) dynamics. Let, pi,tre be the renewable power generation, pi,tch is the charging power, and pi,tdis is the discharging power of the ESS, with their respective limits as pire,max, pich,max, and pidis,max. The energy capacity of the ESS is represented by Eimax, while the SoC at time t is SoCi,t. The efficiency of charging and discharging is represented by ηich and ηidis, respectively, with SoCimin and SoCimax indicates the lowest and highest SoC boundaries, respectively. Equation (10) ensures reciprocity in P2P transactions between connected microgrids.

ESS operation is determined within optimization model through the charging/discharging limits and SoC constraints given above.

2.4 EV Operation Constraints

Operation of an EV is represented through charge, discharge, and battery state-of-charge constraints in Equations (11)–(14). The retained EV constraints follow standard formulations commonly adopted in recent EV-integrated microgrid and P2P energy management studies [33]:

0Pi,tev,chPiev,ch,max (11)
0Pi,tev,disPiev,dis,max (12)
SoCi,tev=SoCi,t1ev+ηiev,chPi,tev,chΔt(Pi,tev,dis/ηiev,dis)ΔtEiev,max (13)
SoCiev,minSoCi,tevSoCiev,max (14)

where Pi,tev,ch and Pi,tev,dis denote the EV charging and discharging power, respectively; Piev,ch,max and Piev,dis,max are the corresponding upper bounds; SoCi,tev is the EV battery state of charge at time t; Eiev,max is the EV battery energy capacity; ηiev,ch and ηiev,dis are the charging and discharging efficiencies; and SoCiev,min and SoCiev,max represent the minimum and maximum SoC limits, respectively. Δt is the scheduling time interval.

2.5 MILP Implementation

In order to obtain the MILP model, binary variables need to be used in order to avoid the charging and discharging of the ESS and EV simultaneously. These constraints are presented in Equations (15) and (16):

0pi,tchui,tesspich,max,
0pi,tdis(1ui,tess)pidis,max,ui,tess{0,1} (15)
0pi,tev,chui,tevpiev,ch,max,
0pi,tev,dis(1ui,tev)piev,dis,max,ui,tev{0,1} (16)

where ui,tess and ui,tev are binary mode variables. Therefore, charging and discharging cannot occur simultaneously, and the model is formulated as a MILP.

2.6 Two-stage Internal Pricing Model

This section describes the two-stage internal pricing model that has been developed for the local P2P network. In the first stage, the internal P2P price is estimated using a market pricing principle subject to limitations posed by the purchase price and the Feed-In Tariff (FiT) based on the theory of supply-demand balance. The price is obtained on an hourly basis based on information about supply and demand within the local network, without accounting for impacts of EV charging and discharging operations. Under supply-demand balance conditions, the reference internal P2P price is formulated according to Equation (17) [34]:

λp2p,ref(t)=Csell(t)+Cbuy(t)2,tT (17)

The total hourly prosumer generation is given by Equation (18):

PT(t)=iNPPi(t),tT (18)

and the total community demand is expressed as follows in Equation (19):

PD(t)=iNPCPi(t)+iNcCPj(t),tT (19)

where λp2p,ref(t) is the reference internal P2P price at time t, Csell(t) and Cbuy(t) denote the feed-in tariff and grid purchase price, respectively, NP denotes the set of prosumers, Nc denotes the set of consumers, Pi(t) is the power generated by prosumer i, and CPi(t) and CPj(t) represent the power demand of prosumers and consumers, respectively. The reference price in Equation (17) is then adaptively updated according to the net power imbalance in the community and the aggregate EV charging/discharging effect. The normalized imbalance index is defined as follows In Equation (20) [35]:

I(t)=PD(t)+PtEV,chPT(t)PtEV,disPD(t)+PtEV,ch+PT(t)+PtEV,dis,tT (20)

Accordingly, the internal P2P price is obtained as follows in Equation (21):

λtp2p=λtp2p,ref+12I(t)(Cbuy(t)Csell(t)),tT (21)

where I(t) is the normalized imbalance index, PtEV,ch and PtEV,dis denote the aggregate EV charging and discharging power at time t, respectively. A positive value of I(t) indicates a local shortage condition and increases the internal trading price, whereas a negative value indicates a local surplus condition and decreases it. Since I(t)[1,1], the internal P2P price remains bounded between the FiT and the grid purchase price.

2.7 Market Matching Mechanism

For demonstration purposes, a double auction mechanism generates trades in the P2P transaction. This step includes replicating generation and load patterns across the electric network’s buses to precisely depict the dynamics of power demand and supply. Utilizing these simulated outcomes, a double auction process aligns buy and sell orders, enabling P2P trading [36].

After determining the internal P2P price, a double-auction mechanism is used to match buy and sell orders in the local P2P market. Let D and S denote the sets of buy and sell orders, respectively, defined as:

• Purchase and sale orders: D={(di1,pi1d,qi1d)}, S={(si1,pi1s,qi1x)}

where di and si are the identifiers of buy and sell orders, pid and pis denote the bid and ask prices, and qid and qis denote the corresponding energy quantities. A matched transaction is represented by t=(st,dt,qt), tT.

Where st, dt, and qt denote the seller, buyer, and traded quantity, respectively. Algorithm 1 generates the feasible P2P trades by matching buyers and sellers according to price compatibility and available energy quantities as follows:

Algorithm 1. Market Matching Algorithm
Dsetofbuyorders{(di1,pi1d,qi1d)}
Ssetofsellorders{(si1,pi1s,qi1s)}
Tinitializematches
SortDbyincreasingpid
SortSbydecreasingpis
foreachbuyorder(di,pid,qid)Ddo
ifqid=0thencontinue
foreachsellorder(si,pis,qis)Sdo
ifqis>0andpidpisthen
qt=min(qid,qis)
t=(si,di,qt)
TT{t}
qidqidqt
qisqisqt
ifqid=0then
break
end if
end for
end for
Qtotal=tTqtCalculatetotalmatchedquantity

This matching process prioritizes higher bid prices and lower ask prices, thereby pairing the most willing buyers with the least-cost sellers while respecting the available demand and supply quantities.

2.8 Clearance and Settlement Model

the candidate transactions have been identified based on Algorithm 1; the clearance process is used to determine the set of all possible P2P transactions in the network. Suppose that N represents the set of buses, and T denotes the set of candidate transactions where each transaction t is denoted by t=(st,dt,qt), which indicates the sellerst, the buyer dt, and the traded amount qt, respectively. For any transaction tT, a continuous decision variable xt[0,1] is defined to capture the fraction of this transaction that will be conducted. Therefore, the conducted energy amount for transaction t is xtqt.

2.9 Case Study and Objective Function

A small-scale multi-microgrid energy community is considered to validate the proposed framework. The test system consists of 36 individuals distributed across three microgrids. In each microgrid, the participants include 4 prosumers equipped with EVs and PV units, 4 prosumers equipped with WTs and ESSs, and 4 consumers without local generation or storage. In addition, each microgrid is supported by a conventional diesel generator. The simulation is conducted to evaluate the effects of the proposed P2P trading and pricing framework on energy management performance, grid dependence, and transaction efficiency in the multi-microgrid system. The objective function is expressed as follows in Equation (22):

Obj=i=13j=112Gi,j (22)

where Gi,j denotes the grid consumption of participant j in microgrid i.

To provide a clear overview of the proposed methodology, Figure 3 presents the overall workflow of the developed two-stage P2P energy trading framework. The flowchart summarizes the main sequential steps of the model as follows.

images

Figure 3 Overall workflow of the proposed two-stage P2P energy trading framework.

images

Figure 4 The Multi microgrid scheme under study.

3 Numerical Results and Simulation Analysis

The scheme for the multi-microgrid structure under study is provided in Figure 4. The network is composed of interconnected participants in two regions linked together by feeders A and B, where the prosumer buyers, prosumer sellers, and regular consumers interact through both power flow and data flow. In this structure, the prosumers make maximum use of their locally produced renewables generation for self-consumption, however, the excess energy could be stored or exchanged via the local P2P electricity market. This configuration provides the operational basis for the proposed pricing, market matching, and energy management process.

The power transfer costs in the P2P market, which includes the role of EV charging and discharging, illustrated in Figure 5. Here, the pricing structures are obviously more cost-effective than direct purchasing electricity from the main grid. As a consequence, consumers can purchase energy at a reduced cost while producers can sell energy at more favorable prices. Thus, the suggested transaction scheme provides advantages for both buyers and sellers. Even after price adjustment, the internal P2P price remains lower than the grid purchase price. Conversely, when energy costs increase and prosumer solar output declines, EVs support the grid by discharging excess power during the 12–14 and 19–22 time interval.

images

Figure 5 Internal Import prices under the proposed Mechanism.

In order to support the pricing scheme suggested in the study, Table 2 below compares the key characteristics of the proposed method against representative studies from the recent literature. The comparison is based on whether each work explicitly includes the selected features.

Table 2 Comparison of the proposed framework with representative previous approaches

Adaptive/ EV-Aware Multi-Microgrid Optimization-Based Resilience
Refs. Dynamic Pricing Pricing Matching Setting Scheduling Focus Main Outcome
[16] × × × Community cost reduced by 16.8%
[18] × × × × Renewable self-consumption increased by 91.98%
[21] × × × × Up to 183% improvement in energy bills for participants with high PV and storage capacity
[36] × × × Improves economic benefits and mitigates supply-demand imbalance
[37] × effectiveness of hybrid game-theory-based P2P trading
[38] × × × two-stage day-ahead P2P pricing and power exchange strategy
[39] × × × × Chance-constrained P2P scheduling strategy for multi-microgrid load coordination
Study 20% peak-demand reduction and 15% average prosumer cost reduction

As can be seen from Table 2, most previous research works have only focused on particular aspects of the pricing validation problem. In contrast, the proposed framework combines two-stage internal pricing, EV-aware price adjustment, explicit double-auction-based matching, multi-microgrid applicability, and optimization-based scheduling. This broader integration supports the practical suitability of the proposed pricing method for coordinated P2P trading in interconnected microgrids.

images

Figure 6 Import energy from each equipment for each individual.

images

Figure 7 Energy Import and export in energy community.

images

Figure 8 BESS charge.

images

Figure 9 BESS discharge.

images

Figure 10 EV battery charge.

images

Figure 11 EV battery discharge.

Figure 6 illustrates the energy imported by each participant from different sources. As shown in the figure, consumers (e.g., Individuals 1–7) import the largest amount of energy from the main grid, traditional diesel generators, and peer participants. By contrast, PV owners use local generation to reduce their dependence on the main grid and diesel generators, as observed for Individuals 25–32. According to the proposed pricing mechanism, most EV owners actively participate in P2P energy sharing, which explains the relatively low level of EV self-consumption shown in Figure 6. The participation of EV owners in P2P trading is further illustrated in Figure 7 for Individuals 25–33. Among them, Participant 26 shows the highest level of trading activity. This result indicates that the proposed pricing mechanism effectively encourages EV owners to participate in the local energy community.

The battery charge and discharge profiles are presented in Figures 8 and 9, respectively, while the EV battery charging and discharging profiles are shown in Figures 10 and 11. Additionally, the detailed results for Individual 11, who is equipped with RES and BESS, are presented in Table 3, while the results for Participant 26, equipped with EV and RES, are given in Table 4.

Table 3 Participant 11 equipped with EV and RES

BESS BESS P2P P2P
Charge Discharge Import Export Demand RES DG1 DG2 DG3 Grid
0 0 0 0 1.91905 0.1656 0 0 0 1.75345
0.5 0 0 0 1.7185 0.0616 0 0 0 2.1569
0.5 0 0 0 1.6081 0.2064 0 0 0 1.9017
0.5 0 0 0 1.56965 0.1034 0 0 0 1.96625
0.5 0 0 0 1.76905 0.1969 0 0 0 2.07215
0.5 0 0 0 1.72385 0.6407 0 0 0 1.58315
0 0.5 0 0 1.84675 0.3408 0 0 0 1.00595
0 0.5 0.393 0 1.8179 0.1611 0 0 0 0.7638
0 0.5 0.151365 0 2.7499 0.1813 0 0 0 1.917235
0 0.5 1.3544 0 2.1406 0.2862 0 0 0 0
0 0.5 0 0 2.15705 0.0625 0 0 0 1.59455
0.5 0 1.8002 0 3.4045 0.1043 0 0 2 0
0.5 0 1.8667 0 3.6268 0.2601 0 0 2 0
0.5 0 1.86241 0 1.7505 0.1546 0 0 0.23349 0
0.5 0 1.78198 0 2.50645 0.1205 0 0 1.10397 0
0.5 0 0.4922 0 2.2365 0.2443 0 0 2 0
0 0 0.40745 0 2.65455 0.2471 0 0 2 0
0 0.5 0.8783 0 3.6645 0.2862 0 0 2 0
0 0.5 0.68565 0 3.22725 0.0416 0 0 2 0
0.5 0 2.4856 0 2.0377 0.0521 0 0 0 0
0 0.5 0 0 2.3165 0.0209 0 0 0 1.7956
0 0.5 0.022305 0 3.1978 0.0104 0 0 0 2.665095
0 0.5 0 0 1.62185 0.0929 0 0 0 1.02895
0 0.5 0.232545 0 1.6785 0.0519 0 0 0 0.894055

Table 4 Participant 25 Equipped with BESS and RES

EV EV P2P P2P
Charge Discharge Import Export Demand RES DG1 DG2 DG3 Grid
0.411328 0 0 0 0.86685 0 0 0 0 1.278178
0.499293 0 0 0 0.259417 0 0 0 0 0.75871
0.451106 0 0 0 0.217917 0 0 0 0 0.669023
0.485061 0 0 0 0.762817 0 0 0 0 1.247877
0.495988 0 0 0 0.209083 0 0 0 0 0.705071
0.438642 0 0 0 0.22005 0 0 0 0 0.658692
0.445217 0 0 0 0.752 0 0 0 0 1.197217
0 0 0 0 0.212867 0.039383 0 0 0 0.173483
0 0 0 0 1.084283 0.27725 0 0 0 0.807033
0 0 0 0.788267 0.241467 1.029733 0 0 0 0
0 0 0 1.970317 0.22645 2.196767 0 0 0 0
0 0 0 2.542317 0.247517 2.789833 0 0 0 0
0 0 0 3.181133 0.236567 3.4177 0 0 0 0
0 0 0 3.361067 0.25435 3.615417 0 0 0 0
0 0 0 3.157917 0.2357 3.393617 0 0 0 0
0 0 0 2.517717 0.245017 2.762733 0 0 0 0
0.273365 0 0 1.003951 0.216967 1.494283 0 0 0 0
0 0.5 0 0.410633 0.218933 0.129567 0 0 0 0
0 0.5 0 2.294183 0.205817 0 0 0 2 0
0 0.5 0 0.281133 0.218867 0 0 0 0 0
0 0.5 0 0.2968 0.2032 0 0 0 0 0
0 0.5 0 0 0.894417 0 0 0 0 0.394417
0 0.5 0 0.002983 0.497017 0 0 0 0 0
0 0.5 0 0 1.032417 0 0 0 0 0.532417

To provide a more direct quantitative summary of the overall results, Table 5 compares the aggregate energy exchange under the studied cases with and without P2P trading.

Table 5 Comparative summary of total energy exchange by source and market under the studied cases

Cases Total Load Demand (kWh) Total ESS (kWh) Total EV (kWh) Grid + DGs Import (kWh) Total sends to Grid (kWh) Total P2P (kWh)
Case 1 (Without P2P) 1166.6 107.7854 203.5991 597.7104 105.8929 0
Case 2 (With P2P) 1166.6 107.7854 203.5991 398.8175 12.5051 343.8929

As shown in Table 5, enabling P2P trading does not change the total load demand or storage/EV, but it significantly reduces reliance on the grid and DG supply while increases local energy exchange through the P2P market.

4 Conclusions

Decentralized energy systems are growing fast, increasing the need for energy trading frameworks that improve both resilience and economic efficiency. This study proposed a two-stage adaptive P2P energy trading framework that combines market-based initial pricing, EV-aware real-time price adjustment, and MILP-based operational optimization. The proposed framework addresses key issues in P2P energy trading, including price fairness, coordinated energy allocation, and operational resilience.

As per the results, the proposed approach can lead to peak demand reduction by 20%, and a cost saving of 15%. The pricing strategy designed under this model ensures a fair transaction and encourages participation in the local electricity market. Furthermore, coordination between BESS and EVs improves the operating flexibility and minimizes the dependence on the primary grid system. The suggested multi-microgrid structure is able to optimize local energy trading by combining renewable energy, electric vehicles, and energy storage systems in an optimization process. The MILP optimization algorithm is capable of balancing cost, availability, and technical limitations, whereas the market matching algorithm makes it possible to achieve viable and coordinated P2P trading of electricity.

Despite the effectiveness of this approach, there may be some problems when scaling up to larger energy communities, owing to the computational complexity of optimization process. Therefore, future research should therefore focus on more scalable and distributed solution methods, and regulatory frameworks that support the practical integration of decentralized energy trading into existing power systems.

Overall, P2P energy trading has proved itself an effective tool for improving price efficiency and coordination within multi-microgrids.

List of abbreviations

Abbreviation u Binary mode variable
BESS Battery Energy Storage Systems P Power
CCG Column-and-Constraint Generation PD Power demand / consumption
DER Distributed Energy Resource Emax Maximum energy capacity
DLMP Distribution Locational Marginal Prices I(t) Normalized imbalance index
DSM Demand-Side Management D Set of buy orders
EDS Electrical Distribution Systems S Set of sell orders
ESS Energy Storage System Subscript
EV Electric Vehicle i Microgrid / participant index
FiT Feed-in Tariff j Microgrid index
MMG Multi-microgrid t Time index
MILP Mixed-Integer Linear Programming ch charge
P2P Peer-to-Peer dis discharge
PT Percolation Threshold b buy
PV Photo-Voltaic s sell
RE Renewable Energy p prosumer
SDT Self-Determination Theory c consumer
SoC State of Charge Superscript
WT Wind Turbine ref reference value
Symbols Greek symbols
CESS ESS operating cost λ Electricity price/transaction price
Cgrid Cost of energy exchange with the utility grid η Charging/discharging efficiency
Cp2p Cost of P2P energy trading Δt Scheduling time interval
q Energy quantity

Declarations

Availability of Data and Materials

Data can be shared upon request.

Competing Interests

The author declares no competing interests.

Funding

This research was conducted without financial support from any public, commercial, or not-for-profit funding agency.

Authors’ Contributions

LF: Original draft preparation, conceptualization, supervision, and project administration were all undertaken by the author.

Acknowledgements

I would like to take this opportunity to respectfully acknowledge that no individuals or organizations contributed to this work or require specific recognition.

References

[1] K. E. Bassey, S. A. Rajput, and K. Oyewale, “Peer-to-peer energy trading: Innovations, regulatory challenges, and the future of decentralized energy systems,” World Journal of Advanced Research and Reviews, vol. 24, pp. 172–186, 2024.

[2] Y. Wu, Y. Wu, H. Cimen, J. C. Vasquez, and J. M. Guerrero, “Towards collective energy Community: Potential roles of microgrid and blockchain to go beyond P2P energy trading,” Appl. Energy, vol. 314, p. 119003, 2022.

[3] M. Kilthau et al., “Integrating peer-to-peer energy trading and flexibility market with self-sovereign identity for decentralized energy dispatch and congestion management,” IEEE access, vol. 11, pp. 145395–145420, 2023.

[4] W. Hassan, B. Elsabbagh, A. Abdelaziz, G. Essam, and R. Aboushama, “Energy Trading Enhancing Sustainability,” Artificial Intelligence and Machine Learning for Sustainable Development: Innovations, Challenges, and Applications, p. 33, 2024.

[5] Q. Hassan et al., “The renewable energy role in the global energy Transformations,” Renewable Energy Focus, vol. 48, p. 100545, 2024.

[6] Y. Wu, Y. Wu, H. Cimen, J. C. Vasquez, and J. M. Guerrero, “Towards collective energy Community: Potential roles of microgrid and blockchain to go beyond P2P energy trading,” Appl. Energy, vol. 314, p. 119003, 2022.

[7] S. Panda et al., “A comprehensive review on demand side management and market design for renewable energy support and integration,” Energy Reports, vol. 10, pp. 2228–2250, 2023.

[8] M. K. Hasan, A. K. M. A. Habib, S. Islam, M. Balfaqih, K. M. Alfawaz, and D. Singh, “Smart grid communication networks for electric vehicles empowering distributed energy generation: Constraints, challenges, and recommendations,” Energies (Basel)., vol. 16, no. 3, p. 1140, 2023.

[9] J. Dong, C. Song, S. Liu, H. Yin, H. Zheng, and Y. Li, “Decentralized peer-to-peer energy trading strategy in energy blockchain environment: A game-theoretic approach,” Appl. Energy, vol. 325, p. 119852, 2022.

[10] S. Panda et al., “A comprehensive review on demand side management and market design for renewable energy support and integration,” Energy Reports, vol. 10, pp. 2228–2250, 2023.

[11] S. Gyamfi, F. A. Diawuo, E. Y. Asuamah, and E. Effah, “The role of demand-side management in sustainable energy sector development,” in Renewable Energy and Sustainability, Elsevier, 2022, pp. 325–346.

[12] Z. Zhu, S. Bu, and Q. Hu, “Peer-To-Peer Trading Among Microgrid Prosumers in Local Energy Markets,” in Microgrids and Virtual Power Plants, Springer, 2024, pp. 297–345.

[13] K. E. Bassey, S. A. Rajput, and K. Oyewale, “Peer-to-peer energy trading: Innovations, regulatory challenges, and the future of decentralized energy systems,” World Journal of Advanced Research and Reviews, vol. 24, pp. 172–186, 2024.

[14] Y. Zhou, J. Wu, and W. Gan, “P2P energy trading via public power networks: Practical challenges, emerging solutions, and the way forward,” Frontiers in Energy, vol. 17, no. 2, pp. 189–197, 2023.

[15] U. J. J. Hahnel and M. J. Fell, “Pricing decisions in peer-to-peer and prosumer-centred electricity markets: Experimental analysis in Germany and the United Kingdom,” Renewable and Sustainable Energy Reviews, vol. 162, p. 112419, 2022.

[16] F. Zhao, Z. Li, D. Wang, and T. Ma, “Peer-to-peer energy sharing with demand-side management for fair revenue distribution and stable grid interaction in the photovoltaic community,” J. Clean. Prod., vol. 383, p. 135271, 2023.

[17] H. J. Kim, Y. S. Chung, S. J. Kim, H. T. Kim, Y. G. Jin, and Y. T. Yoon, “Pricing mechanisms for peer-to-peer energy trading: Towards an integrated understanding of energy and network service pricing mechanisms,” Renewable and Sustainable Energy Reviews, vol. 183, p. 113435, 2023.

[18] R. Zhang, M. Lee, D. Zhao, H. Kang, and T. Hong, “Peer-to-peer trading price and strategy optimization considering different electricity market types, tariff systems, and pricing models,” Energy Build., vol. 300, p. 113645, 2023.

[19] Y. Zhu, Y. Xiao, X. Wang, C. Chen, Z. Lu, and X. Wang, “Enhancing Distribution System Resilience with Peer-to-Peer Transactions,” IEEE Transactions on Power Systems, 2024.

[20] K. V. S. M. Babu, D. Dwivedi, P. Chakraborty, P. K. Yemula, and M. Pal, “A resilient power distribution system using p2p energy sharing,” IEEE Trans. Ind. Appl., 2024.

[21] C. Goncalves, F. Lezama, and Z. Vale, “Towards Fair Energy Communities: Integrating Storage, Sharing and Pricing Strategies,” IFAC-PapersOnLine, vol. 58, no. 13, pp. 320–325, 2024.

[22] D. Dwivedi, K. V. S. M. Babu, P. K. Yemula, P. Chakraborty, and M. Pal, “Data-driven evaluation for quantifying energy resilience in distribution systems with microgrids and P2P energy trading,” e-Prime-Advances in Electrical Engineering, Electronics and Energy, vol. 9, p. 100714, 2024.

[23] J. P. Y. Kiu, K. G. H. Kong, V. Andiappan, and B. S. How, “Developing Resilient Peer-to-Peer Energy Sharing Scheme Using ‘N-1’ Contingency,” Process Integration and Optimization for Sustainability, pp. 1–15, 2024.

[24] Y. Wang, C. Gu, D. Xie, M. Alhazmi, J. Kim, and X. Wang, “Enhancing peer-to-peer energy trading in Integrated Energy Systems: Gamified engagement strategies and differentiable robust optimization,” Energy Reports, vol. 13, pp. 3225–3236, 2025.

[25] X. Zhou et al., “A microgrid cluster structure and its autonomous coordination control strategy,” International Journal of Electrical Power & Energy Systems, vol. 100, pp. 69–80, 2018.

[26] S. N. Backhaus et al., “Networked microgrids scoping study,” Los Alamos National Laboratory (LANL), Los Alamos, NM (United States), 2016.

[27] M. Shahidehpour, Z. Li, S. Bahramirad, Z. Li, and W. Tian, “Networked microgrids: Exploring the possibilities of the IIT-Bronzeville grid,” IEEE Power and Energy Magazine, vol. 15, no. 4, pp. 63–71, 2017.

[28] P. Wu, W. Huang, N. Tai, and S. Liang, “A novel design of architecture and control for multiple microgrids with hybrid AC/DC connection,” Appl. Energy, vol. 210, pp. 1002–1016, 2018.

[29] H. Haddadian and R. Noroozian, “Multi-microgrids approach for design and operation of future distribution networks based on novel technical indices,” Appl. Energy, vol. 185, pp. 650–663, 2017.

[30] E. Unamuno and J. A. Barrena, “Hybrid ac/dc microgrids—Part I: Review and classification of topologies,” Renewable and Sustainable Energy Reviews, vol. 52, pp. 1251–1259, 2015.

[31] C. Goncalves, F. Lezama, and Z. Vale, “Towards Fair Energy Communities: Integrating Storage, Sharing and Pricing Strategies,” IFAC-PapersOnLine, vol. 58, no. 13, pp. 320–325, 2024, doi: https://doi.org/10.1016/j.ifacol.2024.07.502.

[32] Y. Xia, Y. Huang, T. Lin, J. Fang, L. Shi, and F. Wu, “Capturing opportunity costs of peer-to-peer energy transactions in microgrids via virtual state-of-charge bids,” Appl. Energy, vol. 376, p. 124298, 2024, doi: https://doi.org/10.1016/j.apenergy.2024.124298.

[33] L. Bokopane, K. Kusakana, H. Vermaak, and A. Hohne, “Optimal power dispatching for a grid-connected electric vehicle charging station microgrid with renewable energy, battery storage and peer-to-peer energy sharing,” J. Energy Storage, vol. 96, p. 112435, 2024, doi: https://doi.org/10.1016/j.est.2024.112435.

[34] C. Zhang, J. Wu, Y. Zhou, M. Cheng, and C. Long, “Peer-to-Peer energy trading in a Microgrid,” Appl. Energy, vol. 220, pp. 1–12, 2018.

[35] Z. Wang, X. Yu, Y. Mu, H. Jia, Q. Jiang, and X. Wang, “Peer-to-Peer energy trading strategy for energy balance service provider (EBSP) considering market elasticity in community microgrid,” Appl. Energy, vol. 303, p. 117596, 2021.

[36] J. Sim, D.-J. Lee, and K. Yoon, “Incentive-compatible double auction for Peer-to-Peer energy trading considering heterogeneous power losses and transaction costs,” Appl. Energy, vol. 377, p. 124543, 2025.

[37] W. Liao, F. Xiao, Y. Li, and J. Peng, “Comparative study on electricity transactions between multi-microgrid: A hybrid game theory-based peer-to-peer trading in heterogeneous building communities considering electric vehicles,” Appl. Energy, vol. 367, p. 123459, 2024.

[38] R. Sepehrzad, A. S. G. Langeroudi, A. Al-Durra, A. Anvari-Moghaddam, and M. S. Sadabadi, “Demand response-based multi-layer peer-to-peer energy trading strategy for renewable-powered microgrids with electric vehicles,” Energy, vol. 320, p. 135206, 2025, doi: https://doi.org/10.1016/j.energy.2025.135206.

[39] B. N. Alhasnawi, B. H. Jasim, R. Z. Homod, B. Bazooyar, M. Zanker, and V. Bureš, “A novel peer-to-peer energy trading strategy for multi-microgrid loads scheduling based on chance-constrained,” Energy Nexus, vol. 20, p. 100536, 2025, doi: https://doi.org/10.1016/j.nexus.2025.100536.

Biography

images

Liuyue Fang was born in Ganzhou, Jiangxi province, P.R. China, in 1975. He received the bachelor’s degree from Renming University of China, P.R. China. He received the Master degree from UCSI University of Malaysia. Now, he studies in Graduate of school of PhD management, Lyceum of the Philippines University, Philippines. His research interest includes enterprise strategic management, Competitive advantage of small and medium-sized enterprises, unicorn company developing, data security. He works for Beijing Care-jet New Material Technology Co., Ltd, where he holds the CEO position. He works for Guangzhou College of Technology and Business as a scientific research teacher.

Distributed Generation & Alternative Energy Journal, Vol. 41_4, 899–930
doi: 10.13052/dgaej2156-3306.4143
© 2026 River Publishers