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

Optimizing Microgrid Energy Systems with Cloud-Based Peer-to-Peer Sharing Algorithms

Original Research | Open access | Published: 20 September 2024
Volume 3, article number 84, (2024) Cite this article
You have full access to this open access article.
Download PDF
, ,
  1. Department of Smart Grid Analytics, Faculty of Engineering, University of Barcelona, Barcelona, Spain
  2. Department of Energy Optimization Research, Faculty of Engineering, Autonomous University of Madrid, Madrid, Spain
106 Accesses

Abstract

The mitigation of negative environmental impacts and the socioeconomic benefits associated with renewable energy systems encourage greater incorporation of distributed energy systems into conventional power grids. A novel form of the sharing economy is emerging, involving the shared use of energy resources to lower transaction costs via cloud-based platform services. In light of challenges arising from outdated infrastructure and diverse approaches to renewable energy integration, Distributed Energy and Micro Grids (DE-MG) represent an effective solution to enhance the quality of energy supply services. However, constraints related to microgrid scalability, budget adherence, and security can complicate implementation. Consumers achieve more favorable pricing for renewable energy allocation via cloud-based Peer-to-Peer (P2P) networks. The core goal is to minimize the daily energy expenditure for microgrid power in commercial buildings. In the proposed approach, cloud-based P2P combined with peer-Multi-Agent System (p-MAS) optimization methods is employed to reduce system peak loads and to integrate Demand Response (DR) with an Energy Management System (EMS) within a commercial MG. To address gaps in understanding how different power market structures and individual decision-making behaviors influence local interactions and overall market results, cloud-based P2P for Modeling Leveraging Agents (MLA) is applied to perform bill calculations. Finally, a performance metric is developed to assess cost and reliability, enabling evaluation of the societal benefits of cloud-based P2P energy exchange models. Comparisons are presented between the proposed cloud-based P2P model and an existing P2P energy exchange model across various pricing scenarios and resource categories. The key application of a distributed P2P model for power trading in a microgrid is to reduce electricity costs while improving the grid’s environmental reliability.

Explore related subjects
Discover the latest articles in related subjects:

Introduction

Energy sharing involves utilizing renewable energy sources to meet personal energy requirements and trading surplus energy within a community. This shared approach to energy supply and demand can lead to cost savings for prosumers and greater self-sufficiency. Distributed Energy Resources (DER) consist of small-scale electricity generation or consumption assets connected to the power grid. Positioned typically near load centers, these resources can operate independently or in coordination to deliver added value to the grid. Microgrids serve as the cornerstone of the future smart grid, facilitating higher penetration of renewable energy into the electricity system. The main challenge lies in ensuring a microgrid that is fully controllable, secure, and economically viable. Key priorities for microgrids include safety, reliability, and cost-effectiveness. Peer-to-Peer (P2P) energy sharing in trading, supported by cloud technology, enables direct energy transactions between prosumers and consumers. The distributed structure of microgrids empowers end-users with accountable, efficient, and economical energy management within the MG. To achieve this vision and allow remote, on-demand access to microgrid applications whenever required, cloud computing offers a suitable framework by providing scalable, cost-effective access to computing resources capable of handling large-scale data economically. It delivers high reliability, cost reductions, and improved security. The cloud computing techniques proposed here, alongside distributed energy-sharing P2P algorithms from prior studies, are briefly outlined for energy management in the microgrid (MG). 

Growing interest in renewable energy sources, ongoing advancements in microgrid management systems, progress in energy storage technologies, and evolution of cloud computing technologies [1]. Microgrids function as aggregators that integrate various local supply- and demand-side resources to engage directly in wholesale electricity markets [2]. Microgrids form the foundation of the emerging smart grid, enabling greater integration of renewable energy into power systems. Primary concerns revolve around ensuring safety, reliability, economic performance, and comprehensive control of the microgrid [3]. Novel scalable control strategies are required to manage distributed microgrid energy storage systems, particularly when coordinating multiple geographically dispersed units [4]. The smart grid incorporates demand-side management coordinated with peer-to-peer energy trading among residential users to lower energy costs [5]. Microgrids enhance service reliability and resilience by providing a dependable electricity supply during grid outages or emergencies [6]. Recent progress in localized power distribution, particularly regarding renewable energy sources and energy storage methods, is examined [7]. Small-scale Peer-to-Peer (P2P) energy trading enables local buyers and sellers to exchange Distributed Energy Resources (DERs) in residential, commercial, industrial, and other settings [8]. Real-time pricing signals facilitate more efficient strategic interactions among participants in DR scenarios, which can be complex under conventional frameworks; this drives adoption of cloud computing by utilities and consumers [9]. Energy management refers to the monitoring, control, and conservation of energy. Cloud-Based Demand Response (CDR) supports fast response capabilities for large-scale deployments [10]. A control framework can handle various microgrid functions—including dispatch, optimization, and energy flow analysis—through a cloud-based hierarchical computational architecture [11]. Studies explain the integration of cloud computing into microgrid architecture to boost EMS performance and detail microgrid components with emphasis on distributed energy management systems [12]. A cloud-based MAS platform has been implemented to lower peak demand in the Microgrid (RMG) and reduce electricity costs for smart homes [13].

The contributions of the proposed work are as follows: 

• This paper designs a peer-Multi Agent System (p-MAS) employed to minimize peak demand within the integrated Demand Response (DR) system and distributed energy system. 

• Modeling Leveraging Agents (MLA) are utilized to compute bills for consumed energy, reduce the cost of energy purchases, and increase revenue from energy sales in the MicroGrid. 

• Business models of cloud-based P2P energy exchange are applied and compared to assess cost performance and reliability, 

• Numerical analysis is conducted, demonstrating that the proposed method achieves lower energy charges, reduced electricity consumption, greater cost reduction, decreased total load and demand, and higher overall cost savings compared to other approaches. 

Related Work

Thirunavukkarasu et al. [14] proposed multi-agent-based methods combined with meta-heuristic algorithms that outperform conventional techniques in terms of system efficiency, owing to the decentralized characteristics of the EMS problem in microgrids. More accurate forecasting and scheduling algorithms were developed and implemented within cooperative neighborhoods to maximize both economic and computational advantages in MG. 

Monroe et al. [15] developed an empirical Agent-Based Modeling (ABM) framework to simulate peer-to-peer power trading in a residential energy market. The ABM was applied to represent the existing RENeW (Renewable) Nexus trial and to examine various market designs that influence outcomes related to electricity costs and traded energy volumes. 

Liu et al. [16] introduced a distributed iterative algorithm for peer-to-peer (P2P) microgrids based on a photovoltaic (PV) energy-sharing model that incorporates a Supply-Demand Ratio (SDR)- based cost-based Demand Response (DR) approach. Consequently, household self-consumption of PV energy improved, enabling PV prosumers to achieve substantial cost reductions compared to selling surplus directly to the distribution network under feed-in tariffs. 

Barros et al. [17] recommended adopting cloud-based fog computing to manage power generation and consumption by reducing the volume of data sent to the cloud and shortening query response times. The approach showed that execution time per request could be decreased by up to 21.49% compared to a purely cloud-based solution. 

Rangu et al. [18] provided a concise overview of several algorithms for addressing the uncertainty of variable-energy resources, including stochastic programming and robust optimization techniques. They emphasized the need for an optimal balance among centralized, decentralized, and distributed architectures to simplify operational management for participants in expanding electricity markets. 

Chau et al. [19] examined realistic access, grid granularity, straightforward cost-allocation rules (e.g., proportional sharing), and the stability of resulting coalitions in P2P energy-sharing contexts to prevent any group of users from defecting to alternative coalitions. The price of anarchy was used to compare the best-case stable coalitions with the worst-case outcomes. Notably, equitable mechanisms proved highly effective both theoretically and in practice, leading to superior outcomes. 

Ming et al. [20] introduced a distributed averaging iterative method inspired by popular gossip algorithms for resource sharing in Internet-connected microgrids. Ultimately, this approach ensures that required loads and allocated energy are balanced. Theoretical analysis was provided, along with a proof that supply-demand equilibrium is achieved through a carefully designed algorithmic procedure and the appropriate selection of update parameters.

Lai et al. [21] focused on a fully decentralized peer-to-peer control architecture that handles both reactive power distribution and voltage stabilization across multiple generator-equipped Distributed Energy Resources (DERs) within AC microgrids. Consequently, system stability is upheld even under real-time fluctuations involving DERs. Extensive theoretical analysis, combined with simulation results for a distributed microgrid configuration, confirmed that the proposed strategy performs effectively and has strong potential for real-world deployment.

Khan and Wang [22] implemented a Multi-Agent System (MAS) that demonstrates clear benefits in power system applications and is particularly well-suited for optimizing electricity usage in Microgrids (MGs). MAS functions dynamically and coordinates, incorporating advanced capabilities such as electricity scheduling, energy storage, backup management, and emergency islanding procedures.

Mbungu et al. [23] presented optimal strategies for coordinating and managing energy in microgrids to ensure consistent, balanced power flow between the production and load sides. Research indicates that advanced coordination techniques in microgrids improve DER integration and deliver financial benefits to both energy suppliers and end users.

Jin et al. [24] investigated the feasibility of developing smart grids leveraging cloud infrastructure, thereby advancing from traditional cloud computing toward a cloud-client computing model. Under this arrangement, individual nodes are governed by multiple agents, endowing the entire system with exceptional computational power suitable for fast simulations, detailed modeling, and wide-ranging real-time analytics and processing—ultimately boosting performance while cutting capital expenditure.

Dakkak et al. [25] examined the application of cloud computing within Smart Grid environments, highlighting that Long Term Evolution (LTE) networks are projected to significantly improve data oversight, energy management efficiency, and response latency. The solution is economical, high-performing, and reinforced by robust reliability assurances. Performance benchmarking was conducted across three leading open-source cloud platforms—OpenStack, Eucalyptus, and OpenNebula—using a consistent set of evaluation metrics.

Wu et al. [26] introduced the Local Trading Center (LTC) concept to achieve optimal pricing and facilitate energy transactions in next-generation smart grids. The analysis first evaluates the economic advantages available to both purchasers and suppliers through participation in local trading, then examines strategies by which participants can further increase their benefits by modifying their usage behaviors in response to LTC price signals. A commercially driven LTC prioritizes its own profitability while still guaranteeing acceptable returns for consumers and producers. In contrast, a non-profit LTC concentrates exclusively on maximizing value for those two parties.

The presented research integrates the Gossip protocol with distributed peer-to-peer energy-sharing approaches. This review of existing studies covers energy allocation mechanisms and Agent-Based Modeling (ABM) techniques applied to Microgrids (MG) by numerous researchers. Furthermore, relevant publications on Microgrid energy management were examined, with particular attention to cloud-supported tools and frameworks, including Multi-Agent Systems (MAS), LTE communication, proportional cost allocation methods, and forecasting techniques within Demand Response (DR) programs.

Proposed Work

The principle of shared distribution enabled by a collectively accepted cost-allocation framework allows individuals to trade locally generated energy (for example, from rooftop photovoltaic installations). Smart contracts hosted in the cloud define the essential procedures for conducting decentralized energy transactions among participants in a grid-connected setting, with the dual objectives of enhancing overall system reliability and reducing operating costs. A tailored cloud-based Peer-to-Peer (P2P) energy trading model, together with its supporting optimization algorithms, has been formulated. Implementing P2P energy exchange entails a sequence of stages from initial design through to operational execution, involving diverse parameters and considerations tied to energy resource participants and control systems, as detailed in the suggested methodology. Optimization formulations—specifically Peer-Multi Agent System (p-MAS) and Modeling Leveraging Agents (MLA)—are constructed to determine optimal feed-in rates, discharge schedules, and consumption patterns, using smart-meter data to inform price formation and enabling tariff negotiations between prosumers and consumers. Resources are subsequently distributed in a fair and balanced manner throughout the shared energy zone of the MicroGrid (MG) community. The cloud-based P2P framework, incorporating peer Multi-Agent System (p-MAS) functions, serves as an optimization solution for distributed energy resources combined with integrated Demand Response (DR), effectively curbing peak demand. Modeling Leveraging Agents (MLA) performs billing computations for energy usage, thereby lowering acquisition costs for buyers and raising income from sales within the MicroGrid. Financial net benefits derived from cloud-based P2P energy trading models are calculated and benchmarked to quantify improvements in cost efficiency and system dependability. Thanks to the inherently distributed nature of microgrids, end-users gain access to responsible, high-efficiency, and economically viable energy oversight. The integration of cloud computing with the Peer-to-Peer energy exchange paradigm—designated as Cloud-based P2P—provides scalable, cost-efficient computing capacity for processing extensive datasets. This architecture supports ubiquitous, on-demand interaction with microgrid functions whenever and wherever critical requirements emerge. Performance indicators of the developed model are evaluated side-by-side with conventional P2P energy trading approaches, revealing marked improvements in both reliability and economic outcomes.

 Distributed Energy Resources (DER) 

Distributed Energy Resources harness renewable sources such as solar power, Photovoltaic (PV) systems, and wind energy, and they play a vital role within microgrid energy frameworks (Figure 1). DERs help reduce electricity costs by adopting renewables while simultaneously enhancing system reliability. In a commercial Microgrid environment, DERs primarily aim to reduce capital costs associated with expanding the power infrastructure, thereby lowering total supply costs borne by end-users. 

An energy-sharing framework organized around a pooled resource model is under exploration, given that electricity is a commodity without distinguishable quality differences. Individual users determine their desired volume of distributed energy participation, while aggregators define the corresponding compensation levels. Small-scale generation units located on the consumer side of the meter are commonly categorized as Distributed Energy Resources (DER). Rooftop solar Photovoltaic (PV) installations represent a prominent example of such DER deployments. 

Figure 1 Cloud-based P2P exchange of energy for a microgrid. 

Figure 1. Cloud-based P2P exchange of energy for a microgrid. 

All participants register for sharing agreements managed by the aggregator, which implements a rule-based incentive structure that rewards contributions of specified amounts to the pooled energy reserve. Each energy consumer conFigures their DER assets and shifts from purely self-optimized usage toward collaborative DER sharing. To maintain energy equilibrium, prosumers interact with the connected utility grid according to aggregated user load profiles and the available shared energy pool. 

Every participant receives payment for their net energy production and is charged for their net consumption at retail rates, determined via the Net Metering Rate (NMR) mechanism. At the same time, additional remuneration is provided for contributed shared energy through dedicated incentives. The benefits of employing pooled DERs are evaluated, and a corresponding energy-sharing strategy is put forward. A new metric, termed the Sharing Contribution Rate (SCR), quantifies each user’s input to the communal energy pool. 

The proposed approach enables an equitable distribution of solar, wind, and photovoltaic generation across microgrids, accounting for both renewable resource availability and overall demand. 

(1)

As expressed in Eq. 1, distributed energy-sharing algorithms have been formulated in terms of total load demand. Here, τc denotes the aggregator’s fixed and predetermined rate of return, ranging between 0 and 1: Where CUA;t;s represents user A’s energy-sharing contribution, which fluctuates based on the individual’s level of participation in the distributed sharing scheme. γs indicates the user’s learning rate during a specific contract interval.

 Microgrid energy system 

The environmental benefits and socioeconomic gains offered by renewable energy systems drive increased incorporation of distributed resources into existing power networks. The core objective of the MG energy system is to optimize operational performance and reliability by leveraging on-demand energy assets within a distributed setting supported by a cloud computing platform. 

The steps required to address energy management challenges in microgrids—incorporating an essential distributed energy-sharing capability on a cloud platform tailored for community-based microgrids—are outlined, along with a comprehensive end-to-end energy management framework for microgrid operations. 

In Figure 2 above, the key functions of the MG Energy Management System (EMS) are presented: demand forecasting, unit commitment scheduling, demand-side management guided by energy supply ratios in commercial facilities, and economically optimized dispatch governed by pricing mechanisms. 

Figure 2 Cloud-based MG energy management system.

Figure 2. Cloud-based MG energy management system.

Peer-Multi Agent System (p-MAS) 

This research employs a cloud-based P2P architecture for Multi-Agent Systems (MAS) integrated with cloud computing, in which agents process tasks submitted by consumer nodes in accordance with predefined threshold values. The combination of cloud-based P2P for MAS with cloud computing seeks to achieve system goals such as peak load reduction and an enhanced integrated Supply Demand Ratio (SDR), thereby increasing the overall intelligence of the system. 

In distributed energy-sharing models that incorporate available renewable energy resources and their inherent constraints, p-MAS is applied to regulate and enhance microgrid operations. Agents communicate using an Agent Communication Language with defined semantics. A distributed cloud-based p-MAS is implemented, enabling agents to perform local decision-making and interact with neighboring nodes. 

During execution, the tasks from consumer nodes are classified into five categories: underloaded, lightly loaded, normally loaded, overloaded, and severely overloaded. A threshold policy is defined to ensure performance gains within multi-agent-based cloud computing environments. This threshold-based approach for task handling in multi-agent systems designed for cloud computing helps minimize waiting times, accelerate processing, and optimize resource utilization. 

Figure 3 illustrates the Microgrid’s Cloud-based p-MAS Architecture, which outlines the eight modules that comprise the energy-optimization mechanism. Furthermore, since load shifting and shedding can introduce fluctuations in the power system, it is recommended to investigate microgrid behavior under repeated load shifting and shedding requests—step 1 begins with an energy request sent from the home agent to the load agent. Next, a Time Of Use (TOU) tariff inquiry is forwarded to the intelligent meter agent. After evaluating the tariff, the agent sends a response command back to the home agent. If the tariff is excessively high, the request is rejected. 

The Cloud EMS simultaneously processes multiple incoming requests and schedules power allocation to mitigate peak periods at time t. It then determines the start and end times for maximum power assignment to the load agents. 

Figure 3 Microgrid’s Cloud-based p-MAS Architecture. 

Figure 3. Microgrid’s Cloud-based p-MAS Architecture. 

Distributed energy systems offer significant energy efficiency and environmental advantages, making them a promising integrated energy solution. Nevertheless, as more distributed energy systems—especially those incorporating variable renewable sources—are connected, more advanced operational strategies become essential to maintain economic viability and prevent adverse impacts on the electricity network. 

To strengthen interaction between decentralized energy systems and the main grid, various flexibility metrics are utilized in the research. A linear programming model is formulated to optimize dispatch and thereby reduce the operational costs of distributed energy systems. Coordinated application of flexibility mechanisms enables price-driven demand response optimization in distributed energy system operations. When both individual flexibility options and system-wide adaptability are implemented, operational costs of the distributed energy system decrease by 1.7%–11%. Although the price-based demand response approach slightly compromises the stability of the tie-power line, the effect remains minor. 

In this work, we propose and optimize three distinct ancillary services within a distributed energy system, each leveraging multiple flexibility options to more effectively facilitate interaction between the grid and the distributed energy (DE) system.

The Supply-Demand Ratio (SDR) serves as the foundation for defining the internal pricing model. It functions as a marketplace metric employed to set prices. The SDR acts as an effective market instrument for regulating the supply of a commodity. In this context, the resulting price encourages shifting the load from high-demand periods to low-demand periods.

(2)

As formulated in Eq. 2, prices corresponding to high-demand and low-demand conditions based on SDR have been evaluated. The internal pricing mechanism uses the system’s data on power availability to calculate p-MAS values for Total Purchasing-Buying Power (TBP) and Total Selling-Power (TSP) within a cloud-based P2P energy-sharing framework.

(3)

Furthermore, 

(4)

Eqs. 3 and 4 present the expressions for buyer and seller prices. Here, m denotes the total number of time periods on the platform and the total number of prosumers engaged in P2P energy trading, enabling the computation of the Net Power (NP) value for each period.

Modeling Leveraging Agents (MLA) 

The cloud-based P2P optimization approach, leveraging Modeling Leveraging Agents (MLA) in distributed energy sharing for microgrid systems integrated with cloud computing, aims to minimize energy purchase costs while maximizing energy selling revenues. Modeling Leveraging Agents (MLA) are employed to determine the energy consumption bills. 

The Modeling Leveraging Agents (MLA) method is a bottom-up simulation technique that analyzes a system through the interactions of individual agents. Cloud-based P2P for MLA constitutes a computational framework in which a group of actors—representing distinct microgrid components—interact with their environment based on predefined rules. Each agent exhibits the following characteristics: (1) autonomy (independent of external control); (2) social ability (interacts with other agents); (3) reactivity (responds to environmental changes); and (4) proactivity (takes initiative to achieve objectives). 

Cloud-based P2P for MLA performs best when agents are heterogeneous, their roles are not rigidly assigned, and their behaviors are non-linear (i.e., influenced by the environment). Two primary categories of modeling agents—energy-sharing coordinator agents (representing consumers) and prosumer agents—are maintained on a cloud platform. The environment model may include multiple agents, with one assigned to each building in the community, as well as a dedicated coordinator for energy sharing. 

Among the coordinator’s responsibilities is facilitating coordination. By aggregating energy from individual buildings, the community can store larger quantities of energy in smaller storage units.

The two key performance indicators used to assess the effectiveness of the proposed strategy are computed via the Energy Sharing Ratio (ESR), as illustrated in Figure 4 above. These indicators are the individual self-consumption rate (the percentage of locally generated PV consumed by each prosumer) and the community self-sufficiency rate (the percentage of locally generated PV utilized across the entire community).

Figure 4 Cloud-based Peer-to-Peer framework employing Modeling Leveraging Agents (MLA) to achieve lower energy expenses. 

Figure 4. Cloud-based Peer-to-Peer framework employing Modeling Leveraging Agents (MLA) to achieve lower energy expenses. 

Portion of renewable generation consumed by individual prosumers and by the community as a whole.

(5)

  (6)

  (7)

Eqs. 5 to 7 enable the quantification of energy cost savings realized by a community zone when applying the cloud-based P2P optimization strategy based on Modeling Leveraging Agents (MLA).

Cloud-based peer-to-peer shared energy framework 

Peer-to-peer (P2P) energy trading models have attracted considerable attention lately, chiefly because they simplify energy exchange across geographically dispersed systems. A cloud-hosted P2P arrangement furthermore delivers superior scalability. Although adopting this approach in a cloud infrastructure requires a significant upfront expenditure, the P2P topology enables seamless integration of additional participants, thereby strengthening the system’s overall capability. Within a cloud-based P2P network, the collective computational resources and capacity are governed by the number and characteristics of the connected peers.

During the first implementation phase, community-wide electricity expenses were lowered through the combined use of a sliding time window and Constraint Non-Linear Programming (CNLP) optimization. Under the imposed budgetary constraints, agents operate as Zero Intelligence Plus (ZIP) traders, autonomously adjusting their bid/ask spreads based on recent transaction history with very limited computational requirements. This mechanism empowers small-scale prosumers to autonomously control their Distributed Energy Resources (DERs) through a dedicated, cloud-hosted Energy Sharing Coordinator (ESC).

The CNLP procedure is executed repeatedly on a rolling horizon basis (e.g., every 30 minutes within each hour) so that earlier load predictions can be continuously revised. Minimizing total energy expenditure is the primary optimization goal. Given that power exchange at the Point of Common Coupling (PCC) occurs in both directions, the applicable electricity tariff must incorporate charges for both imported and exported energy.

(8)

The formulation for electricity procurement cost appears in Eq. 8. In this expression,  corresponds to the net load measured at the PCC at time t−24 hours;  indicates the battery net power flow (discharge minus charge) at hour h; and  stands for the prevailing grid purchase/sale price.

A structured assessment model has been constructed to gauge the performance of P2P energy-sharing implementations hosted in the cloud. Its central purpose is to quantify the fraction of the theoretical Energy Sharing Ratio (ESR) value that the model actually captures. This evaluation architecture consists of three sequential phases: Value Recognition, Bill Estimation, and Performance Index.

As depicted in Figure 5, the methodology introduced in this paper—referred to as Cloud-based P2P—is deployed to regulate consumer electricity usage and ensure system dependability via three interconnected modules: Value Recognition, Bill Estimation, and Performance Measure. The performance of the proposed framework is then benchmarked against established approaches with respect to price-prediction precision and overall reliability in a commercial microgrid environment.

Value recognition 

Simultaneous scheduling of all prosumers’ local generation assets and demand profiles is performed to extract the highest possible monetary value embedded in the ESR, thereby maximizing community-level revenue from energy sharing. Before any concrete P2P trading mechanism can be properly appraised, the latent economic value residing in the ESR must first be identified using the cloud-hosted p-MAS operating within a cloud computing environment.

(9)

The computation of this maximum attainable value is given in Eq. 9. In the equation, p denotes the unit price of electricity; s represents the load demand; Pmust−run is the aggregate must-serve load; L signifies locally generated power; and ∆ts indicates the duration of the considered time step.

Eqs. 2 and 3 serve to establish the feasible range (upper and lower limits) of the ESR and to appraise the economic benefit provided by the cloud-based P2P architecture for intra-community energy transactions.

Bill estimation 

A billing framework grounded in precise cost calculations ensures both the stability of the coalition and the protection of individual prosumer interests. Decisions on whether electricity must be imported from or exported to the grid are based on the system’s aggregate generation and consumption levels. Transaction pricing is determined while simultaneously maximizing overall system efficiency.

Each prosumer is assigned an initial value as follows: 

(10)

As defined in Eq. 10, the starting value assigned to each prosumer is computed. Here,  denotes the prosumer-specific internal pricing calculated via a modified diagonalization method. csell(0) represents the initial selling price for energy shared within the community, while cbuy(0) indicates the initial buying price for energy acquired from other prosumers. These values operate within the retail market context of a microgrid community and are coordinated through cloud-based EMS to achieve balanced peak loads among user agents.

Figure 5 Cloud-based P2P models applied to consumer energy consumption.

Figure 5. Cloud-based P2P models applied to consumer energy consumption.

Algorithm 1. Pseudocode of the Diagonalization Algorithm 

In this context, x serves as the iteration counter for the range steps, while X denotes the complete set of values under consideration. The internal electricity pricing within the ESR—encompassing both purchasing (“buy”) and selling (“sell”) prices—is prefixed with “inter.” The superscript “esti-inter” marks the pricing values estimated by the prosumer; additionally, y serves as the iteration counter across the set of all consumers Y. 

The core principle of the diagonalization algorithm lies in the product of its diagonal elements. Operations on diagonal matrices can be straightforwardly generalized by raising the diagonal entries to any desired power (Algorithm 1).

Performance Measure (PM)

The Performance Measure component in this framework is designed to evaluate the ESR values corresponding to the upper and lower energy bounds that the cloud-hosted Energy Sharing Coordinator can effectively share in the microgrid.

(11)

Here, PM stands for the performance measure; vmax and vmin represent the highest and lowest values attainable within the ESR; and iESR denotes the total income value derived from the ESR under converged conditions as expressed in the preceding equation. 

The PM index ranges between [0, 1]. Higher values of this index indicate superior performance of the cloud-based P2P energy sharing model in delivering greater economic benefits to the prosumer community. When the PM reaches 1, the model has fully captured all available value embedded in the ESR. A higher PM value signifies that the cloud-based P2P approach more effectively realizes the economic potential for prosumers.

Experimental Results

This research introduces a comprehensive framework for assessing the economic feasibility of peer-to-peer (P2P) energy-sharing models implemented in cloud environments. The proposed methodology enables approximate calculation of energy bills, evaluation of the commercial prospects of cloud-based P2P energy sharing using Constraint Non-Linear Programming (CNLP), and determination of the corresponding performance measure. 

The dataset employed originates from the India Residential Energy Survey (IRES) 2020, which constitutes the first nationwide assessment of energy access, consumption patterns, and household energy efficiency in India. It covers over 10,000 households distributed across more than 500 villages in over 50 districts spanning 10 states. Drawing on the nationally representative IRES data from Agrawal et al. [27], the study examines consumer satisfaction with electricity service quality and supply reliability. It further investigates household perceptions regarding metering, billing, and payment systems in residential microgrids. These insights can inform policy recommendations to close remaining gaps and ensure reliable, affordable, and universal electricity access for every Indian household. 

Three established P2P energy sharing models—Bill-Sharing (BS), Mid-Market-Rate (MMR), and Supply-Demand-Ratio (SDR)—are evaluated using the proposed technique across different electricity pricing regimes. Once the economic value is identified and energy consumption is quantified, all performance metrics are derived from the dataset presented in Agrawal et al. [27]. 

As illustrated in Figure 6 above, the total energy charged into and discharged from the Energy Storage System (ESS) rises with increasing storage capacity, as computed via Eq. 1, regardless of whether energy sharing is implemented. In the absence of energy sharing, ESS utilization grows modestly from a baseline of 100% to approximately 125 MW per hour as rates range from 2 to 3. In contrast, when an energy conservation strategy is applied, utilization surges markedly from 200.5 MWh to 300.5 MWh. This substantial increase stems from the aggregator’s capability—highlighted in Agrawal et al. [27]—to fully exploit users’ storage resources and maintain power balance within the microgrid. 

For the cloud-based P2P energy trading scenario, internal pricing serves as the core mechanism for bill computation, as shown in Figure 6. Key observed benefits include reduced electricity costs for all participants, diminished power exchange with the utility grid, and lower operational activity during peak demand periods. 

Figure 6. Total energy charged and discharged across different Storage-to-Capacity Ratios (SCR). 

Figure 6. Total energy charged and discharged across different Storage-to-Capacity Ratios (SCR). 

In Figure 7 above, pMAS-TSP denotes the Total Seller Price, reflecting the compensation sellers receive for injecting energy into the microgrid. Similarly, pMAS-TBP represents the Total Buying Price, indicating the amount buyers pay to receive power from agents managed by the cloud server in the commercial microgrid optimization framework described in Eqs. 3 and 4 under cloud-based P2P for pMAS. 

Using data extracted from Agrawal et al. [27], average monthly electricity consumption costs for consumers over the past four months were compiled. The comparison highlights disparities between expenditures on purchasing and revenues from selling energy. The graph shows that consumer buying prices significantly exceed the grid’s selling prices, with the gap widening progressively each month. These price dynamics enable the calculation of the Net Power value (NP) for each time interval. The displayed values include monthly energy generation and transaction fees between buyers and sellers. 

Figure 7. Monthly average buyer and seller electricity prices. 

Figure 7. Monthly average buyer and seller electricity prices. 

Figure 8 above highlights three key observations. The Bill-Sharing (BS) model yields relatively low values, thereby promoting energy transfer and supporting demand-response participation. Microgrids (MGs) enhance controllability, efficiency, and reliability by segmenting the grid into localized zones that integrate distributed generation (DG) and storage to satisfy nearby demand. The swift advancement of integrated energy systems (IESs) is essential to improve flexibility, reduce CO₂ emissions, and incorporate renewable sources through synergistic thermal–electric coupling. 

The BS structure aligns with Eq. 8 for cloud-based P2P employing CNLP, as well as Eqs. 9–11 for conventional P2P energy-sharing models, which are based on averaging prosumer bills from Agrawal et al. [27] and incorporate only modest demand-response incentives. The remaining two models perform effectively because they include internal pricing mechanisms. Nevertheless, the proposed cloud-based P2P energy-sharing model surpasses all benchmark approaches, delivering substantially greater cost reductions for consumers while also markedly improving performance. 

Figure 8. Comparison of consumer energy bill cost reductions. 

Figure 8. Comparison of consumer energy bill cost reductions. 

Figure 9 presents load profiles extracted from the Microgrid Load Explorer module of the IRES dataset, providing hourly electricity consumption patterns for diverse household categories (e.g., incoming households). It incorporates the pseudocode from Eqs. 10 and 11, along with the convergence behavior described in Eq. 8. 

The Figure demonstrates how the Supply-Demand-Ratio (SDR) model, when combined with nighttime sharing, incentivizes prosumers to export surplus solar generation during peak daytime periods. It also shows the progressive convergence of the overall community energy bill toward a minimized level under the ESR framework. Furthermore, the system exhibits strong fault tolerance: even if one agent fails due to overload, transactions can seamlessly shift to the nearest operational node within the microgrid. 

Figure 9. Reliability comparison based on total load and demand profiles.

Figure 9. Reliability comparison based on total load and demand profiles.

The microgrid requires a robust metering and communication infrastructure, continuous monitoring of power and cost profiles, and accurate quantification of power losses. The proposed microgrid management strategy addresses frequency and voltage regulation while ensuring proportional distribution of active and reactive power among hybrid distributed generators (DGs). This work leverages data exchange between MATLAB and an open-source Internet of Things platform to implement the recommended communication architectures. Real-time cloud interactions are simulated using a cloud-based P2P approach.

Figure 10 illustrates Optimization Techniques for Consumer Cost Saving in relation to the consumer index profile derived from dataset [27]. Comparisons between cloud-based pMAS and MLA optimization methods are derived from Eqs. 2 and 5. In the cloud-based P2P framework employing pMAS, all consumers are assigned equal weights, without distinguishing individual peak loads or demands on a supply-demand basis, as reflected in the consumer’s Energy Storage System within the cloud domain. Consumer costs are aligned with their Storage-to-Capacity Ratio (SCR) as calculated by Eq. 1 using market valuations of Distributed Energy Resources (DERs). The Self-Sufficiency Rate for individual consumers is determined according to the overall energy demand in the Distributed Renewable Energy (RE) area overseen by the Energy Sharing Coordinator under the MLA approach.

Figure 10. Optimization techniques for consumer cost saving.

Figure 10. Optimization techniques for consumer cost saving.

As shown in Figure 11, power variations for an energy user under a distributed energy-sharing model are calculated using Eqs. 3 and 4. The utilization rate of each household’s Energy Storage System (ESS), sourced from Agrawal et al. [27], improves by relocating daytime loads to nighttime periods. Consumer energy usage, measured by total net load, predominantly occurs after 6 p.m., whereas DER sharing occurs throughout the day. From this pattern, the Total Buying Power and Total Selling Power for the consumer in the community microgrid’s retail market are determined and plotted, distinguishing between daytime and nighttime values for a typical user.

Figure 11. Power changes of a consumer based on Distributed Energy.

Figure 11. Power changes of a consumer based on Distributed Energy.

Figure 12 depicts the Energy Management System grounded in Cloud-based P2P. Microgrids (MGs) represent intelligent, small-scale power networks that deliver electricity—often from renewable sources—and can operate autonomously or interconnected with the main grid. Deploying academic microgrids offers solutions to numerous electricity-related challenges in university settings. This research provides an overview of microgrids, with particular emphasis on their energy management capabilities. Certain smart grid functions are highly sensitive to latency, and a cloud-based IoT platform enables measurement of such delays. The proposed configuration can be viewed as a decentralized energy network in which cloud participants gain access to services, including renewable energy resource (RES) generation and energy storage, thereby supporting the development of personalized microgrids. The mathematical formulation of the microgrid is established, with monthly costs for RES generation and energy storage calculated separately. A two-tier energy management system (EMS) is proposed to accommodate fluctuations in residential demand and renewable output. The upper-layer EMS determines the optimal monthly capacity allocation for RESs and storage within the microgrid. At the same time, the lower-layer EMS performs daily scheduling optimization to minimize total operating expenses and maximize user electrical comfort.

Figure 12. Energy management system based on Cloud-based P2P.

Figure 12. Energy management system based on Cloud-based P2P.

Conclusion

This paper proposes a cloud-supported peer-to-peer (P2P) energy sharing framework for microgrid systems that integrates distributed energy sharing with pMAS and MLA optimization techniques to achieve superior energy cost reduction and enhanced microgrid reliability. Experimental findings demonstrate that the proposed cloud-based P2P energy-sharing algorithm, incorporating the Constraint Non-Linear Programming (CNLP) method, effectively reduces consumer energy costs in commercial settings while delivering strong reliability benefits to the microgrid on a cloud platform. 

The proposed cloud-based P2P system is benchmarked against established P2P protocols, namely Bill-Sharing (BS), Mid-Market-Rate (MMR), and Supply-Demand-Ratio (SDR). Its primary advantages include fault tolerance, improved reliability, and significant cost savings. Consequently, the system remains operational even when multiple nodes experience failure, as surviving nodes can absorb the additional load. 

Future research should focus on accommodating sudden consumer arrivals in dynamic trading scenarios and advancing toward next-generation grid management solutions. The authors also highlight the importance of developing more accurate forecasting and scheduling methods in future energy management systems (EMS) to enhance computational efficiency and economic benefits further. 

Key quantitative outcomes include: Energy Storage System (ESS) charging reaches 125 MW per hour without sharing and increases to 200.5–300.5 MWh with energy sharing; seller-side electricity consumption price stands at 8 kWh, while buyer-side reaches 10 kWh; overall system performance improves by 5%; total energy transactions amount to 20 kW; and cost savings achieve 8% relative to alternative approaches.

Acknowledgements

None

Conflict of interest

None

Financial support

None

Ethics statement

None

References

Rosero DG, Díaz NL, Trujillo CL. Cloud and machine learning experiments were applied to energy management in a microgrid cluster. Appl Energy. 2021;304:117770.
Arun M, Barik D, Suresh S, Kumar R, Patel A, Singh V, et al. Experimental investigation on energy and exergy analysis of solar water heating system using zinc oxide‐based nanofluid. Arab J Sci Eng. 2022;1-2.
Ahmethodzic L, Music M. A comprehensive review of trends in microgrid control. Renew Energy Focus. 2021;38:84-96.
Morstyn T, Hredzak B, Agelidis VG. Control strategies for microgrids with distributed energy storage systems: an overview. IEEE Trans Smart Grid. 2016;9(4):3652-66.
Alam MR, St‐Hilaire M, Kunz T. An optimal P2P energy trading model for smart homes in the smart grid. Energy Efficiency. 2017;10(6):1475-93.
Yanglin Z, Chen Y, Li H, Wang J, Liu S, Zhang Q, et al. Distributed energy management of P2P energy sharing in energy internet based on cloud energy storage. In: Proceedings of the Ninth International Conference on Future Energy Systems (E Energy’18). New York: Association for Computing Machinery; 2018. p. 173-7.
Arfeen ZA, Khairuddin AB, Munir A, Ramli MAM, Othman ML, Ayop R, et al. Control of distributed generation systems for microgrid applications: a technological review. Int Trans Electr Energy Syst. 2019;29(9):e12072.
Zhang C, Wu J, Zhou Y, Cheng M, Long C, Chen L, et al. Peer‐to‐Peer energy trading in a Microgrid. Appl Energy. 2018;220:1-12.
Allahvirdizadeh Y, Moghaddam MP, Shayanfar H. A survey on cloud computing in energy management of the smart grids. Int Trans Electr Energy Syst. 2019;29(10):e12094.
Naveen P, Kumar A, Singh R, Gupta S, Sharma V, Jain P, et al. Cloud computing for energy management in intelligent grid ‐ an application survey. IOP Conf Ser Mater Sci Eng. 2016;121(1):012010.
Rajeev T, Ashok S. A cloud computing approach for power management of microgrids. In: ISGT2011 India. IEEE; 2011. p. 49-52.
Talei H, Essaaidi M, Benhaddou D. Innovative campus energy management system: advantages, architectures, and the impact of using cloud computing. In: Proceedings of the 2017 International Conference on Smart Digital Environment; 2017. p. 1-7.
Vagdoda J, Patel K, Shah R, Desai A, Mehta S, Trivedi N, et al. A cloud‐based multiagent system platform for microgrids towards smart grid community. In: 2018 IEEE Power & Energy Society General Meeting (PESGM). IEEE; 2018. p. 1-5.
Thirunavukkarasu GS, Kumar R, Singh P, Sharma A, Gupta V, Reddy S, et al. Role of optimization techniques in microgrid energy management systems—a review. Energy Strategy Rev. 2022;43:100899.
Monroe JG, Hansen P, Anderson R, Smith T, White K, Brown L, et al. An agent‐based model of a blockchain‐enabled peer-to-peer energy market: application for a neighborhood trial in Perth, Australia. Smart Cities. 2020;3(3):1072-99.
Liu N, Chen Y, Wang J, Li H, Zhang Q, Yang X, et al. Energy‐sharing model with price‐based demand response for microgrids of peer‐to‐peer prosumers. IEEE Trans Power Syst. 2017;32(5):3569-83.
Barros EBC, Santos A, Oliveira M, Silva R, Costa P, Lima F, et al. Fog computing model for orchestrating the consumption and production of energy in microgrids. Sensors. 2019;19(11):2642.
Rangu SK, Reddy K, Kumar V, Singh R, Sharma A, Gupta P, et al. Recent trends in power management strategies for optimal operation of distributed energy resources in microgrids: a comprehensive review. Int J Energy Res. 2020;44(13):9889-911.
Chau SCK, Li H, Zhang Q, Wang J, Chen Y, Liu N, et al. Peer‐to‐peer energy sharing: effective cost‐sharing mechanisms and social efficiency. In: Proceedings of the Tenth ACM International Conference on Future Energy Systems; 2019. p. 215-25.
Ming Y, Zhang Q, Li H, Wang J, Chen Y, Liu S, et al. Distributed energy sharing in energy internet through distributed averaging. Tsinghua Sci Technol. 2018;23(3):233-42.
Lai J, Chen L, Zhang C, Wu J, Zhou Y, Cheng M, et al. Broadcast gossip algorithms for distributed peer‐to‐peer control in AC microgrids. IEEE Trans Ind Appl. 2019;55(3):2241-51.
Khan MW, Wang J. The research on multi‐agent systems for microgrid control and optimization. Renew Sustain Energy Rev. 2017;80:1399-411.
Mbungu NT, Kumar R, Singh P, Sharma A, Gupta V, Reddy S, et al. Overview of the optimal intelligent energy coordination for microgrid applications. IEEE Access. 2019;7:163063-84.
Jin X, He Z, Liu Z. Multi‐agent‐based cloud architecture of smart grid. Energy Proc. 2011;12:60-6.
Dakkak O, Nor SA, Sajat MS, Fazea Y, Arif S. From grids to clouds: recap on challenges and solutions. In: AIP Conference Proceedings. Vol. 2016(1). AIP Publishing LLC; 2018. 020040.
Wu Y, Tan J, Zhao T, Wang Y, Liu L, Zhang X. Optimal pricing and energy scheduling for hybrid energy trading market in future smart grid. IEEE Trans Ind Inf. 2015;11(6):1585-96.
Agrawal S, Mani S, Jain A, Ganesan K, Urpelainen J. India Residential Energy Survey (IRES) 2020 (Version V1). Harvard Dataverse; 2021.

Author information

Victor Moreno, Daniela Ruiz & Andres Salazar contributed to this work.

Authors and affiliations

Department of Smart Grid Analytics, Faculty of Engineering, University of Barcelona, Barcelona, Spain
Victor Moreno & Andres Salazar

Department of Energy Optimization Research, Faculty of Engineering, Autonomous University of Madrid, Madrid, Spain
Daniela Ruiz

Corresponding author

Correspondence to Victor Moreno

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
Moreno V, Ruiz D, Salazar A. Optimizing Microgrid Energy Systems with Cloud-Based Peer-to-Peer Sharing Algorithms. J Smart Grids Energy Anal Optim. 2024;3:84.
APA
Moreno, V., Ruiz, D., & Salazar, A. (2024). Optimizing Microgrid Energy Systems with Cloud-Based Peer-to-Peer Sharing Algorithms. Journal of Smart Grids, Energy Analytics and Optimization, 3, 84.
Received
22 March 2024
Revised
03 April 2024
Accepted
16 June 2024
Published
20 September 2024
Version of record
20 September 2024

Share this article

Easily share this article with others using the link below:

Optimizing Microgrid Energy Systems with Cloud-Based Peer-to-Peer Sharing Algorithms
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.