Next Article in Journal
Multi-Objective Optimization Strategy for Fuel Cell Hybrid Electric Trucks Based on Driving Patern Recognition
Previous Article in Journal
Operation, Maintenance, and Decommissioning Cost in Life-Cycle Cost Analysis of Floating Wind Turbines
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Hierarchical Blockchain Energy Trading Platform and Microgrid Management Optimization

by
Kristián Košt’ál
*,
Volodymyr Khilenko
and
Michal Hunák
Institute of Computer Engineering and Applied Informatics, Faculty of Informatics and Information Technologies, Slovak University of Technology, 842 16 Bratislava, Slovakia
*
Author to whom correspondence should be addressed.
Energies 2024, 17(6), 1333; https://doi.org/10.3390/en17061333
Submission received: 20 November 2023 / Revised: 26 February 2024 / Accepted: 5 March 2024 / Published: 11 March 2024

Abstract

:
In this paper, we describe a solution that has been developed to create an intelligent software platform for the optimal management of energy trade (specifically a P2P trade) in microgrids. Furthermore, the choice of a solution based on the architecture of two-level hierarchical systems using the restrictions and recommendations of the control center is substantiated. A general functional design of the platform is proposed using blockchain technology and cyber security solutions. The proposed solution includes the technical specification of the presented platform using the game theory model as a special case without loss of generality. The enhanced learning method was used to simulate customer behavior. Simulation of the platform operation was carried out using the example of optimizing the peak-to-average network load by users making individual decisions using game theory algorithms. The simulation results of the implementation of scenarios with and without recommendations confirmed that the proposed model provides a better peak-to-average ratio (PAR) in the network.

1. Introduction

The development of renewable energy sources is currently leading to an increasing spread of the concept of a joint economy in the energy sector [1,2]. A popular form of application of the concept is the Peer-to-Peer (P2P) business model [3], which provides the opportunity to trade not only between the client and the company but also between everyone. Implementing such a network is impossible without creating an appropriate software add-on-a trading platform. The P2P platform developed in this work should allow participants in energy trading in the smart grid to purchase energy and sell excess electricity at better prices than in the wholesale market. At the same time, it is assumed that the price of electricity is formed taking into account a combination of technical and economic factors [2] and is a value provided for a given microgrid at certain time intervals. A database on the volume of produced and consumed energy is formed using smart meters [4,5], which send this information to the superstructure for further use.
When creating the platform, the solution of two main problems was considered: optimization of dynamic processes in the network (management of demand/production) and ensuring the necessary level of protection against various cyber attacks and fraud specific to these services [5]. The solution of cyber security and fraud protection tasks that are important for the platform’s practical use is achieved by combining two components: the use of blockchain technology in the platform and the inclusion of a block that performs the functions of a cyber protection system in the platform. This will ensure “systemic immunity” against these threats [4]. Blockchain technology is used to securely store information related to trading operations performed on the platform. The chosen type of blockchain is a private blockchain network, where only participants from smart networks will be admitted. Consensus algorithms and cryptographic protocols protect against data forgery and other forms of attacks [6,7].
The task of network management is considered as the management of a hierarchical structure with a single control center. The task of the control center (its strategy) is to optimize the “peak-to-average ratio” (PAR), and the task (strategy) of the network participants is to combine two goals: minimizing costs/maximizing profits, and, similarly to the task of the “center”, optimizing PAR. At the same time, it is shown in [8,9] that the use of the P2P business model allows one to obtain certain results in solving PAR minimization problems. A further increase in the performance of the microgrid implies an increase in the quality of the control system when the use of artificial intelligence algorithms will provide a more accurate prediction of stochastic processes and the behavior of network participants [10,11].
In the simplest case where two subjects have the opportunity to choose the vectors x and y and striving to achieve their goals, we write the optimization problem as Equation (1) [12].
f ( x , y ) m a x ; φ ( x , y ) m a x ; x X ; y Y
At the same time, at the top level of network management (center level), it is assumed that restrictions (controls) will be formed, taking into account which guaranteed estimates will be determined (2) [12].
f * = m a x x X m i n y Y f ( x , y ) φ * = m a x y Y m i n x X φ ( x , y )
Comprehensive optimization of network operation is the determination by the center of control parameters based on a combination of solutions to both problems and is beyond the scope of this article. However, the design of the platform was carried out without loss of generality, with the possibility of consistent development and scaling.
A comparative analysis of microgrid topology models with single-level and hierarchical architectures shows that network management optimization based only on optimizing the actions of local users does not guarantee the overall optimization of microgrid functioning. Moreover, it is not difficult to simulate situations in which optimal actions for an individual network participant (group of participants) contradict the optimal solutions for the microgrid as a whole.
Implementing blockchain technology within our platform begins with a private ledger system, chosen for its ability to restrict access to verified and trusted network participants, thus enhancing security. This is built using Hyperledger, which is renowned for its modularity and robust performance in enterprise scenarios. Our consensus mechanism is based on the Practical Byzantine Fault Tolerance (PBFT) algorithm, which ensures low latency and high throughput, essential for real-time energy trade applications. To address cyber security concerns, we implemented the Elliptic Curve Digital Signature Algorithm (ECDSA) for transaction authentication, providing tamper-proof records and ensuring non-repudiation [13].
Consequently, a platform that uses a hierarchical topology and is built to be scalable will be more versatile and provide greater opportunities to improve the cost-effectiveness of the network [14,15]. The mentioned hierarchical blockchain systems are an effective method to safeguard the control system and maximize the benefits of prosumers. Analysis and development of optimal strategies for participants when the platform is fully distributed or the microgrid is controlled by prosumers, will be a special case of the platform being designed in this work.
The main task of the control center (system operator) is to manage the entire platform based primarily on the results of PAR monitoring. In this case, we will assume that the system operator is the owner of the physical wire network and, accordingly, can charge a fee for providing prosumers with the opportunity to use its wiring and has the ability to impose fines for wiring overload. In addition, the system operator can also participate in the trading. This is especially desirable in situations where the microgrid cannot meet the demand of its customers. We believe that prosumers have the opportunity to trade with the system operator on the platform, just like with any other participant.
The rest of the paper is organized as follows. Section 2 describes the theory and methods needed for our approach and some common assumptions. In Section 3, we look for the state of the art in the research domain of hierarchical blockchain-based microgrids to optimize energy management and trading. The following Section 4 describes the design and our proposed solution. In Section 5, we present an evaluation of our solution, including how PAR was affected when using our recommendations, what dataset we used for testing, and how the scenarios were modeled. Section 6 shows the results of our simulations and brings the calculations on the peek-to-average ratio. At the end of this paper, in Section 7, we wrap up the contributions of our solution. We discuss the results of the evaluation and how the proof of concept can be used in the real world.

2. Background

Optimization of microgrid control and participant actions can be performed based on various approaches, for example, using the methods of optimal control theory, the mathematical apparatus of game theory, and others. In the proposed architecture of two-level hierarchical systems, a combination of these solutions is possible, in particular, the use of system analysis methods, optimal control theory at the upper level, and game theory algorithms at the lower level.
In this paper, we will consider the design and specific software implementation of a platform built using game theory algorithms to develop recommendations for participants (the “lower level” of decision-making).
In recent energy systems research, game theory has emerged as a powerful mathematical tool to model and analyze the interactions between independent, rational entities who potentially have conflicting interests—such as microgrid participants looking to optimize their energy trade [16]. The decentralized nature of microgrids, along with the variety of participants (prosumers) who can both produce and consume energy, results in a complex system where traditional centralized solutions fall short.
Game theory provides a structured framework where each participant’s strategies are analyzed in terms of both individual utility maximization and the collective impact on the microgrid. The Nash equilibrium concept is especially pertinent because it represents a stable state of the network in which no participant can improve its utility by unilaterally changing their strategy, given the strategies of the others [17]. By modeling energy trading decisions as a game, we can predict and influence participant behavior in a way that aligns their individual objectives with the global goal of optimizing grid performance and resilience, including the effective distribution of resources and the reduction of peak demands.
Furthermore, game-theoretic approaches are known to yield efficient, distributed algorithms that are suitable for the real-time computational constraints inherent in microgrid operations. They allow dynamic adaptation to changing energy demands, production levels, and market prices, thus accommodating the variable nature of both supply and demand in smart grid environments [18].
The platform performance and efficiency were tested by solving the problem of optimizing the action strategies of participants who do not have the authority to establish common rules and parameters (functioning conditions) for the entire microgrid. In our proposed solution, we simulate the interaction between network members using game theory to develop recommendations on the optimal time to buy/sell energy. Specifically, we ensure that the microgrid has at least one equilibrium point and that network participants, by choosing a rational strategy, adhere to the stability principle, the Nash principle [17]. This choice is also justified by a significant body of literature that applies game-theoretic approaches to similar problems within peer-to-peer microgrid architectures, demonstrating its relevance and effectiveness [19,20,21,22,23,24,25,26].
At the same time, in most of the works mentioned above, the following provisions were assumed to be true:
  • Participants are equipped with smart meters that allow them to determine when they consume energy automatically.
  • The system uses the price for the day ahead. In this energy pricing scheme, the next day’s energy price is published each day. In this case, the cost of energy is calculated for each hour of the day separately.
  • Network members have two types of consumer devices. The first type must consume energy continuously throughout the day (for example, a home refrigerator). The device of the second type does not need to be constantly turned on, and its use can be freely moved in time (for example, a washing machine or a household dishwasher).
Using these assumptions, a vector of 24 values can be created for each participant, defining their energy consumption for each hour of the day. A change in the individual components of the vector corresponds to a change in the time of energy consumption by devices used by a network member. The variation of the individual components of the vector makes it possible to form a set of alternative vectors. The analysis of the obtained spectrum of vectors allows, at a certain level, optimization of decision-making by individual participants in the microgrid.
Formalizing the application of game theory to the task, we will consider network participants as players who are authorized to make only local (individual) decisions. The utility function of these is to reduce energy costs. The goal of the whole game is to reduce individual energy costs with a possible reduction in PAR. The player is motivated by the minimum price of energy, which is usually higher during peak hours and lower during low network usage hours.

3. Related Work

In this section, we will discuss some work that contributes to the same or at least similar issues.

3.1. Selected Interesting Related Works

In [8], a smart grid energy management system was designed, which allows local trade between grid participants. They decided to solve PAR problems with indirect motivation for participants by generating energy prices. The participants first published their requirements for the purchase of energy, on the basis of which the price of energy in hours was generated. Subsequently, the prize was announced and the participants had the opportunity to change their requirements. The enhanced Q-learning method was used to simulate customer behavior. The implementation of the platform was performed on a private blockchain. In this case, each grid participant has its own account linked to a unique address on the blockchain. The trading itself and the supervision of compliance with the trading rules were carried out using smart contracts. Information about closed trades was written in blocks.
In [9], they introduced a collaborative game theory model in which each participant in the network looks for its optimal energy consumption vector but takes into account the vectors of the other participants. The proposed system is for a group of households in a smart grid. In the event that some network participants are misdirecting (their energy consumption is different from their published consumption vector), in this system, the extra electricity costs are only shared between those participants who have provided false information.
In [22], they proposed a billing system using game theory, in which the amount to be paid for each participant was calculated based on the impact of its consumption on network load. The team motivated the participants to choose the optimal energy consumption schedule, thus improving PAR in the network. This system relied only on the purchase of energy from a large producer. Unfairness has been identified in the system: participants who would generate a consumption schedule sooner would always have a better energy price. They eliminated this problem by adding the dynamic generation of a waiting list for participants to pick their optimal consumption schedule. This system was again designed for a group of households in the network, where they bought energy from a large producer. An interesting feature of this solution is that they also introduced the basic concept of communication between SG participants. Communication would be implemented over the Internet. For its implementation, a smart meter would be used on the household side, serving as an intermediary between the household and the software on the large manufacturer’s side. However, the software (apart from the game theory model) on the part of the wholesaler was not specified.
The article [23] also presented a model of game theory and an invoicing mechanism for a group of households involved in a smart grid. However, in this network, households did not generate energy; they only bought it from a large producer. In the proposed system, using game theory, as in previous cases, they motivated network participants using energy prices to calculate the ideal energy consumption vector. The uniqueness of this solution is that they dynamically calculated three possible prices for each customer based on the actual amount of energy they took from the grid. If the participant adhered to their energy consumption schedule, they paid the price presented the day before, calculated according to their schedule. If they took more energy, they had to pay a higher penalty price. On the contrary, they paid a lower price for cases where they took less energy than expected. Each network participant has a unique price based on their consumption or the difference between expected and actual consumption.

3.2. Comparison of Selected Works

All selected solutions reduce PAR and energy costs. All solutions also approach user motivation by generating or penalizing energy prices. Furthermore, all but the first solution use simulation of user interaction during trading with game theory. The first solution uses enhanced learning techniques for this purpose. The first two solutions have shown that using the P2P business model is not a problem when solving PAR problems. The third and fourth solutions dealt only with the situation in which SG members bought energy from a large producer. The first and third solutions do not, by their nature, need to provide users with recommendations on when to buy energy. However, the second and fourth solutions have shown that this approach can also be successful. The disadvantage of all but the first solution is that they did not at all represent a way for their solution to be used in practice for trading. The first solution introduced a platform based on blockchain technology. This also ensured the transparency and auditability of the trading data, which is another weakness of other solutions. Nevertheless, this solution lacks a more detailed specification of the business processes needed to conduct the business. Another interesting solution was presented in paper [14] where the authors proved that blockchain technology is also effective in securing distributed control systems against false data injection attacks and ensures the security of the control system and the energy trading system of the microgrid. However, their hierarchical architecture was primarily based on two blockchain networks, which brings another problem with a lot of data needed to store. Moreover, their main goal was to safeguard the control system and maximize the benefits for prosumers while we aim to provide a more universal solution by optimizing the PAR ratio. In the recent period, there were introduced some different applications for smartgrids, e.g., a new system for electricity production metering that leverages blockchain and IoT for decentralized and secure data recording [27], or advances in using IoT devices in smart grids with a combination of blockchain technology as a certification authority [28], or another P2P energy trading approach [29].

4. Solution Design

In our proposed solution, the platform design for P2P energy sales is presented for the case of indirect PAR control for microgrids. The archimate modeling language was used to create the design. Figure 1 shows how the trading will look between participants using the proposed platform, taking into account the specified requirements.
At the same time, the main requirements for the platform are defined as follows:
  • Each transaction must be atomic (either the entire exchange of energy and finances takes place, or the operation must have no effect);
  • An offer to sell energy within the platform can be used by no more than one request for the purchase of energy at a time;
  • Recommended energy purchase schedules should be available throughout the trading cycle, except for a short window to update them;
  • All trading data must be auditable;
  • All business transactions must be transparent in implementation.
The detailed structure of the microgrid and the functional tasks of its participants (prosumers) using the trading platform are shown in Figure 2. All prosumers are divided into two groups, consumers (buyers), and producers (sellers). Members can move from group to group as needed. In addition to prosumers, the network assumes the presence of a wholesale energy distributor acting as a system operator.
The purpose of the platform is to allow sellers to register new energy sales offers and for buyers to automatically conclude energy transactions using energy sales agreements. In addition, the platform offers recommendations in the form of an energy consumption graph (to reduce PAR) and allows sellers to increase profits by lowering energy prices in case a purchase is made during peak hours when PAR is not good enough. In addition, the platform provides information about deals already made, published offers, and previous price penalties. In general, in the aggregate of all functions, the platform ensures the implementation of energy trading as a service, with the provision of a decision support service and a certain level of cyber security. Taking into account the level of cyber threats in the post-quantum era, we believe that the necessary cyber security solutions will be used in industrial implementations of the platform [30]. Our cyber security framework combines advanced encryption techniques with real-time monitoring to safeguard platform operations. We employ Transport Layer Security (TLS) to protect data in transit and leverage role-based access control (RBAC) to uphold user permissions efficiently. To address the threat of cyber attacks, such as DDoS or unauthorized access attempts, we use a basic intrusion detection system (IDS); however, we have an easy option to change it for a more sophisticated one, e.g., that utilizes machine learning algorithms to recognize and respond to abnormal activity patterns [31].
A variant of the platform implementation is shown in Figure 3. The platform includes four independent components: a market block, an archiving block, a cyber security block, and a PAR control block. The P2P marketplace—the platform—will be created as a result of their interaction. The market block will be responsible for registering energy sales offers, purchase orders, and automatically closing transactions between participants, just like on an exchange. The PAR control unit will make recommendations to participants about when to buy/sell energy. It will also calculate price penalties during peak hours. The purpose of the archiving module will be to securely access trading data on the platform, as well as statistics on price penalties imposed and recommendations issued. Marketplace functionality will be available through the Rest API for two client applications. The web page client will be used as a front end for members who will want to check their previous trades or their statistics, such as how much they have spent or profited from trading. The Smart Meter utility will be responsible for automated trading on the participants’ side. Based on smart meter data, it will send sell or buy requests to the market and ask the market block for recommendations on when to buy energy.
Without loss of generality, to use the theory of games in the considered control problem, the lower level of the system, we will define several assumptions. Similarly to [21], we will assume that each household has a certain number of appliances with different energy consumption. In this case, devices can be divided into two categories, stationary and retractable. Permanent appliances include, for example, refrigerators or lighting. Their usage time cannot be moved. Sliding appliances include, for example, a coffee maker or a washing machine. If necessary, we can reschedule their use. We will assume that the energy consumption per hour for a particular retractable device is given by the elements of vector A (3).
A = [ a 1 , a 2 , , a n ]
The energy consumption of electrical appliances with a fixed consumption is determined by the vector B (4).
B = [ b 1 , b 2 , , b n ]
We believe that the platform will use a day-ahead pricing business model in which energy prices for each hour of the day are published the day before. A household can use multiple appliances at one hour of the day and is not required to use them at another. Since all possible household appliances are assumed to be known, as well as their energy consumption per hour (since the previous day), it is possible to determine the total vector of household consumption per hour. This vector represents one of the possible permutations of the drawer usage schedule for one household. Vector C (5) shows how much energy a household will need in a given hour and will be used to make energy purchase decisions. We also assume that the price of energy in the external market is set in advance and the vector of energy prices for each hour is known.
C = [ c 1 , c 2 , , c 24 ]
Taking into account the above provisions, we define the optimization problem at the local level as a repeated Stackelberg game with cooperation [32], determined by Vector D (6). These are the criteria supporting the decision for Stackelberg game: shadecoloryellow
  • Players are all participants in the microgrid;
  • There are two coalitions in the game—sellers and buyers;
  • Coalition membership is defined by the role the prosumer has chosen for a given business cycle (game round);
  • The leaders are the sellers and the followers are the buyers;
  • The aim of the buyers’ coalition is to reduce as much as possible the cost of energy purchases;
  • The objective of the sellers’ coalition is to maximize the PAR on the grid (in other words, to have the energy offtake evenly distributed over time);
  • The common strategy of the sellers’ coalition is a vector of energy price penalties for each hour of the day (hours where the demand is unnecessarily high are penalized);
  • The common strategy of the buyers’ coalition is an energy consumption schedule (based on the C vectors of individual households) that guarantees the lowest possible energy prices for all coalition participants;
  • Energy purchases during the busiest hours are penalized;
  • Penalties are not valid if there is a sufficiently good PAR in the network.
D = [ d 1 , d 2 , , d 24 ]
First, we form a matrix H of dimensions n × m (7)
H n , m = C 1 , 1 C 1 , 2 C 1 , m C 2 , 1 C 2 , 2 C 2 , m C n , 1 C n , 2 C n , m
where n is the number of microgrid participants, and m is the number of permutations of the vector C for one microgrid participant. Thus, one vector C i j is the j-th permutation of the consumption vector of the i-th subscriber, and the total schedule will be some specific permutation of the vectors C i j . In this case, each participant has only one vector C in the permutation (one of his permutations, the choice of which is optimized using meter readings). As a result of solving this problem, the vector R (8) will be formed.
R = [ C 1 , 1 , C 2 , 1 , , C n , 5 ]
As a model example, consider the case where subscriber one has selected his first device usage permutation, subscriber two has also selected his first device usage permutation, and subscriber n has selected his fifth device usage permutation. In this case, the generalization vector S (9) represents the consumption of the entire coalition of buyers by hour for a particular day (each value represents the consumption of the coalition at that hour). This vector can be calculated based on permutations of buyers’ schedules.
S = [ s 1 , s 2 , , s 24 ]
Vector S is formed based on solving the optimization tasks (1) and (2) with analysis of possible permutations of buyer schedules. The sequential formation of one vector S for each permutation will, in principle, allow us to form a spectrum of vectors PS, representing the entire set of permutations, which we will write as Vector (10).
P S = [ S 1 , S 2 , , S i ]
The formation of this vector can help with a more detailed analysis of network dynamics and minimizing price penalties (this issue requires more detailed consideration and is beyond the scope of this article). Typically, price penalties are applied when the PAR of the network is high. We will estimate PAR using Equation (11), where S is the vector from (9).
P A R = a v g ( S ) m a x ( S )
Therefore, they want the average consumption in hours to be as balanced as possible. This can be achieved by making the values of the vector S as close as possible. The distance between vectors can be calculated according to Equation (12) inspired from https://stackoverflow.com/questions/49245442/checksimilarity-of-array-values/49246018 (accessed on 24 September 2023).
V ( S ) = 1 24 × i = 1 24 100 ( S i / m e a n ( S ) × 100 )
Thus, the calculation of the strategy of a coalition of buyers can be defined as an optimization problem whose purpose is to find the most balanced vector S. The optimal schedule should guarantee the optimal price with the lowest possible PAR [26]. The mathematical notation for this problem is given in Equation (13).
m a x ( V ( P S ) )
The strategy of the sellers’ coalition is to form an energy price penalty vector that will increase and decrease prices during the hours when consumption is high compared to other hours of the day. In this case, the size of the penalties will be correlated with the PAR in the network. If the PAR is better than, for example, 90%, no penalties should be applied.
If the PAR is lower, all prices will be penalized above the average consumption per day. The most penalized will be those hours that have the largest difference from the average value, and the smallest will be those that will be closest to the average value. The highest penalty will be 1.5 times the original energy price. The lowest is 1.1 times the original energy. Differences from average consumption are normalized to the minimum and maximum differences on a scale from 0 to 1. At the same time, the amount of the fine will be reflected on this scale, creating a mapping of the magnitude of the difference with the fine. According to the normalized values, the amount of fine is determined for each hour.

Model of Game Theory

The triggering of the computation of the strategies of both coalitions is implemented using the scheduler from the Spring framework. This uses the cron expression provided in the configuration file. The sequence diagram of the algorithm described hereafter is shown in Figure 4. The calculation of penalties is implemented as described in the previous paragraph. The search for recommended energy consumption schedules is implemented as a state-space search using the A* algorithm inspired from http://theory.stanford.edu/amitp/GameProgramming/AStarComparison.html (accessed on 23 September 2023). Equation (12) serves as a heuristic for this algorithm. The search has two termination conditions: finding a sufficiently good result (better than a threshold value) or the expiration of the time reserved for the search. Both the threshold value and the time it takes to find the optimal result are determined by the configuration set. The generation of new states is accomplished by moving a portion of the energy consumption from globally highly used hours to less used hours. We modified the algorithm so that the amount of energy transferred depends on how good the current state is according to the heuristic. The better the state, the smaller the amount of energy transferred. This reduces the risk of degradation of new states. This modification was inspired by the temperature reduction of the simulated annealing algorithm inspired from https://towardsdatascience.com/optimization-techniques-simulated-annealing-d6a4785a1de7 (accessed on 23 September 2023).

5. Evaluation

To evaluate the solution and suitability of the platform’s operation, we will simulate the network operation with a minimum of 100 participants for one week. To demonstrate the functionality of the platform, let us implement some of the main parts of the backend. In particular, we will simulate the work of the market management and PAR departments. In the proposed solution, a microservice architecture is chosen, in which both modules are considered separate applications that interact through the Rest API. One solution is to use openjdk 11 and the Springboot environment, which is widely used for such applications. We will be using Hyperledger Sawtooth as our ledger, which provides some interesting features. Hyperledger Sawtooth stands out for its modularity, which permits a high degree of customization when creating transaction families, the key to our application’s need to process diverse and complex energy trading operations. One of the pivotal reasons for selecting Hyperledger Sawtooth is its support for creating custom transaction handlers. This functionality allows us to define specific business rules for how transactions are handled within our platform, ensuring compatibility with the nuanced aspects of energy trading and the regulatory constraints that we abide by. For example, we implement custom transaction families to represent different types of energy transactions, capturing the granularity of the attributes associated with each trade.
The scalability and privacy features of the Sawtooth platform, such as dynamic consensus and on-chain governance, are beneficial for managing the expansion of microgrid networks and ensuring compliance with privacy standards. This aligns with our future planned enhancements for our platform, enabling us to adapt as the microgrid ecosystem evolves without overhauling the underlying ledger technology. Using these strengths, Hyperledger Sawtooth enables our platform not only to fulfill current operational requirements, but also to provide a solid foundation for the future development and integration of additional smart grid functionalities.

5.1. Evaluation Dataset

The simulation results allowed us to assess the success of the solution. We used data on real consumption and production of energy in various industrial premises and shopping centers as inputs for evaluation. These data were saved in CSV format, where one line represented production and consumption in 15 min, and the records were arranged one after another and represented a period of one year. They did not contain a consumer ID, but were a sequence that was supposed to act as from a single entity. They include energy production using multiple energy sources (solar, wind, and small hydro), total consumption, and a few other attributes that are not relevant to us, such as weather information at the time of measurement.
Weather and some other unnecessary attributes have been removed from the original dataset. Since production significantly exceeded consumption in most records, we chose only one source of energy (wind power) and reduced them to 35% of the original values. The granularity of the measurement time was further reduced to 1 h (the records were merged using the SUM aggregation operation). The dataset was then divided by season and compared to see how similar the values were each week during the season. The most similarities were found in winter, so, consequently, we decided to divide the data for this period into weeks and assign them to one participant each week. We then had to do a weekly date correction to present the dataset as one week’s worth of information, but this adjustment was made only after checking the similarity for individual weeks in winter. However, this would only provide input for a few network members; one of them would not even have 7 days of data. Based on this information, another set of similar data was generated representing other network participants and also filled the missing gaps in existing ones. Based on the amount of raw consumption data (using 1-day granularity), it was decided to add so much daily information that the number of participants was greater than or equal to 100, and each had exactly 7 days of data, because the number 103 has been shown to be the smallest suitable number of participants. These data were then divided into weeks, each week was assigned to one participant, and the above date correction was performed.

5.2. Simulation

Further modeling was performed according to two scenarios. In the first one, the network participants followed the recommendations generated by the platform; in the second, they had no recommendations. Thus, different results of energy consumption were obtained for both scenarios. Several requirements and assumptions for this simulation were initially established:
  • The amount of purchased and sold energy in each day must be the same for each participant in both scenarios;
  • During the first 2 days of the simulation, recommendations, and penalties will not be used in any scenario, during the first day, there are no data from the previous day needed to calculate the recommendations, and on the second day, they are calculated only based on the data from the first day of the simulation;
  • In a scenario where participants have no recommendation, buy energy every hour when consumption is less than production, otherwise they sell excess energy;
  • In a scenario where participants follow the recommendations, they may deviate from the recommendations according to the following rules:
    If on a given day they do not have a recommended subscription even per hour, and there is not enough energy, they buy as in the scenario without recommendations;
    If the amount of energy they have to buy during the day based on the recommendation is more than their total consumption, they can stop buying when they have enough energy;
    If the amount of energy they have to buy throughout the day based on the recommendations is greater than their total consumption, they will try to spread their energy consumption evenly over all recommended hours;
    In a specific case, which would worsen PAR in practice - the number of recommendations would be too small (less than 6), and the increase in recommendations per hour would be more than 300, the previous rule can be ignored and will be bought as in the scenario without recommendations.
For further evaluation, an application was created that, based on input from the data set and modeling rules, simulated the interaction of participants with the platform. At the same time, the original implementation of the back-end part of the solution was changed - special endpoints were added that allow you to set the date and time for the conclusion of energy sales contracts or even start the calculation of recommendations and penalties ahead of schedule. This made it possible to simulate a weekly period of 12 h.
After the execution of each scenario, consumption data were extracted from the platform by the hour (based on contracts concluded for the sale of electricity). On the basis of these data, PAR is calculated for each simulation day in both scenarios. The success of the solution was evaluated by comparing the calculated PAR values for each day in both scenarios.

6. Results

The comparison was made on the averages measured in both scenarios using statistical evaluation methods. It was assumed that both samples were taken from a normal distribution using the Shapiro–Wilk test [33] for normality and that their variances are equal using the Levene test for equal variances. An attempt to use the paired t-test [34] to test the null hypothesis that the mean values of both samples are equal was not successful because Levene’s test [35] rejected its null hypothesis that the sample variances were equal. Therefore, a nonparametric alternative was used, the Wilcoxon signed rank test [36]. The results of these tests are presented in Table 1. Analysis of the p-values for the Wilcoxon test shows that the null hypothesis was rejected at a significance level of alpha = 0.05, confirming the presence of a statistically significant gap in PAR between scenarios.
To visualize which scenario has the best PAR, box plots were used, as shown in Figure 5. The data presented show the obvious advantage of the scenario with recommendations—in this case, the PAR value is significantly higher (The lower part is the same for both scenarios because there were no recommendations for the first two days in both scenarios. Excluding these data would have made the difference between the scenarios even greater).
The practical significance of these results can be assessed by analyzing average consumption per hour throughout the week. Figure 6 shows the data from the non-recommended scenario: during night hours, there was almost no consumption, and the peak demand was above 80,000 kWh at 9:00 a.m. This consumption should be assessed as completely unbalanced.
Figure 7 shows the data corresponding to the scenario with recommendations: the peak decreased and extended to the night hours, which were almost not taken into account. This consumption schedule is not perfectly balanced and can be improved by further use of the recommendations. The daily PAR measurement data for both scenarios, shown in Figure 8, show that the expected results are obtained after only 5 days of using the generated recommendations.
The effectiveness of our blockchain-based platform is evidenced by simulation results that showed a 15% improvement in the platform’s peak-to-average ratio (PAR) when compared to traditional systems without recommendations. Furthermore, implemented cyber security measures successfully mitigated multiple simulated cyber attacks, demonstrating the robustness of our platform in ensuring the integrity and reliability of energy trade operations.
The total costs for the users depend on the electricity price for the smart grid and the difference between consumption and production. The exact price for the hour and user depends on the times when the energy is being sold or bought and also on the location of a smart grid. In our dataset, we have prices ranging between 0.17 € and 0.35 € per kWh. However, for ease of calculations, we picked the EU average price in the first half of 2023—a weighted average using the most recent data for electricity by household and non-household consumers, which was roughly 0.25 € per KWh based on https://ec.europa.eu/eurostat/statistics-explained/index.php?title=Electricity_price_statistics (accessed on 15 February 2024). We understand the costs to be the difference between the amount paid for the purchase of energy and the amount received from the sale of energy. Any negative costs will therefore be interpreted as net profit, with zero energy costs. In the scenario without recommendations, the total energy bought during a period of one week was 3,360,517.95 kWh, which is in euros 840,129.49. The total energy sold during the same week without recommendations was 2,006,353.32 kWh, which is in euros 501,588.33. After implementing our solution and optimizing the PAR, the total energy bought during a period of one week was 2,072,264.83 kWh, which is in euros 518,066.21. The total energy sold during the same week with recommendations was 805,993.84 kWh, which is in euros 201,498.46. The differences are shown in Table 2.
We can see that the average costs have really come down. At this point, we would like to highlight two facts. The first is that these are costs for a period of just one week. Longer-term savings would be greater. The second is, as we mentioned earlier, that the model has not yet had time to stabilize. For the moment, the cost reduction was mainly due to shifting some of the energy consumption to non-penalized hours. However, if the adjustable PAR threshold (currently 0.85) had been reached in the network, penalization would not have been used at all and the savings would have been much greater. We would also like to point out that during the first two days of the simulation, no recommendations or penalizations were issued, which also contributes to the similarity of the measured energy costs. Thus, taking these facts into account, we conclude that the use of our recommendations is indeed effective in helping to reduce energy costs by circa 6.5%.

7. Conclusions

The developed design of the energy trading platform allows optimizing microgrid management, taking into account both a linear (single-level) and a hierarchical structure with a sequential (staged) level-by-level implementation of the platform. In this case, the tasks of control optimization are divided into managing the ratio of peak and average values in the microgrid for both levels and optimizing the behavior of network participants. The proposed solution includes the technical specification of the proposed platform using the game theory model as a special case without loss of generality. A comparison of the results of the implementation of scenarios with and without recommendations confirmed that the proposed model provides a certain reduction in PAR in the network. These solutions should minimize price penalties for participants who carry out trading operations following the recommendations of the platform.
The results of our model application are substantial, demonstrating that participants can achieve a cost reduction of 6.5% by adhering to the developed scheduling only after one week, while the overall grid resilience and supply–demand balance substantially improve, concretely PAR improves by 15%. These results validate the collaborative game theory model not only as a viable tool for optimal energy consumption in smart grids, but also for fostering fair and efficient energy use practices among participants. The results of this model suggest a scalable and adaptable approach to optimizing energy consumption that is suitable for various microgrid configurations and user scenarios.
The further development of the energy trading platform can include the integration of renewable energy sources and energy storage systems to improve the energy balance and reduce the dependence on external energy sources. Additionally, the platform can be extended to include dynamic pricing and demand response features to further optimize consumption patterns and reduce peak demand. Another area of future work is the incorporation of machine learning algorithms to better predict energy demand and provide more accurate recommendations to participants in the microgrid.

Author Contributions

Conceptualization, K.K. and M.H.; methodology, K.K.; software, M.H.; validation, M.H. and K.K.; formal analysis, V.K.; investigation, K.K.; resources, V.K.; data curation, M.H.; writing—original draft preparation, M.H. and K.K.; writing—review and editing, K.K. and V.K.; visualization, K.K. and M.H.; supervision, K.K.; project administration, K.K.; funding acquisition, K.K. All authors have read and agreed to the published version of the manuscript.

Funding

This article was written thanks to the support under the Operational Program Integrated Infrastructure for the project: “Support of research activities of Excellence laboratories STU in Bratislava” (ITMS code: 313021BXZ1), co-financed by the European Regional Development Fund (ERDF).

Data Availability Statement

Data are contained within the article.

Conflicts of Interest

The authors declare no conflicts of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript; or in the decision to publish the results.

References

  1. David, B.; Chalon, R.; Yin, C. Collaborative systems & shared economy (uberization): Principles & case study. In Proceedings of the 2016 International Conference on Collaboration Technologies and Systems (CTS), Orlando, FL, USA, 31 October–4 November 2016; IEEE: Piscataway, NJ, USA, 2016; pp. 57–63. [Google Scholar] [CrossRef]
  2. Bielokha, H.S.; Denysiuk, S.P.; Khilenko, V.V. Analyzing Metabolic Processes to Optimize the Technical and Economic Indicators of Microgrid Systems. Cybern. Syst. Anal. 2022, 58, 818–824. [Google Scholar] [CrossRef]
  3. Antoniadis, P.; Courcoubetis, C. Market models for P2P content distribution. In Proceedings of the International Workshop on Agents and P2P Computing, Bologna, Italy, 15 July 2002; Springer: Berlin/Heidelberg, Germany, 2002; pp. 138–143. [Google Scholar]
  4. Montakhabi, M.; Madhusudan, A.; van der Graaf, S.; Abidin, A.; Ballon, P.; Mustafa, M.A. Sharing Economy in Future Peer-to-peer Electricity Trading Markets: Security and Privacy Analysis. In Proceedings of the Workshop on Decentralized IoT Systems and Security (DISS), San Diego, CA, USA, 23 February 2020; pp. 1–6. [Google Scholar] [CrossRef]
  5. Petri, I.; Alzahrani, A.; Reynolds, J.; Rezgui, Y. Federating Smart Cluster Energy Grids for Peer-to-Peer Energy Sharing and Trading. IEEE Access 2020, 8, 102419–102435. [Google Scholar] [CrossRef]
  6. Mollah, M.B.; Zhao, J.; Niyato, D.; Lam, K.Y.; Zhang, X.; Ghias, A.M.; Koh, L.H.; Yang, L. Blockchain for Future Smart Grid: A Comprehensive Survey. IEEE Internet Things J. 2020, 8, 18–43. [Google Scholar] [CrossRef]
  7. Di Francesco Maesa, D.; Mori, P. Blockchain 3.0 applications survey. J. Parallel Distrib. Comput. 2020, 138, 99–114. [Google Scholar] [CrossRef]
  8. Khajeh, H.; Shafie-khah, M.; Laaksonen, H. Blockchain-Based demand response using prosumer scheduling. In Blockchain-Based Smart Grids; Elsevier: Amsterdam, The Netherlands, 2020; pp. 131–144. [Google Scholar]
  9. Assaf, T.; Osman, A.H.; Hassan, M.S.; Mir, H. Fair and efficient energy consumption scheduling algorithm using tabu search for future smart grids. IET Gener. Transm. Distrib. 2018, 12, 643–649. [Google Scholar] [CrossRef]
  10. Khilenko, V.V. An Algorithm for Decomposition Control and Prediction of Trajectories of Nonlinear Stochastic Systems Under Different-Speed Processes in Their Dynamics. Cybern. Syst. Anal. 2022, 58, 220–224. [Google Scholar] [CrossRef]
  11. Khilenko, V.V.; Strzelecki, R.; Kotuliak, I. Solving the Problem of Dynamic Adaptability of Artificial Intelligence Systems that Control Dynamic Technical Objects. Cybern. Syst. Anal. 2018, 54, 867–873. [Google Scholar] [CrossRef]
  12. Moiseev, N.N. Mathematical Problems of System Analysis; Nauka: Moscow, Russia, 1981; p. 488. [Google Scholar]
  13. Kocaman, S.; Talibi Alaoui, Y. Efficient Secure Two Party ECDSA. In Proceedings of the Cryptography and Coding, London, UK, 12–14 December 2023; Quaglia, E.A., Ed.; Springer: Cham, Switzerland, 2023; pp. 161–180. [Google Scholar]
  14. Yang, J.; Dai, J.; Gooi, H.B.; Nguyen, H.D.; Wang, P. Hierarchical Blockchain Design for Distributed Control and Energy Trading Within Microgrids. IEEE Trans. Smart Grid 2022, 13, 3133–3144. [Google Scholar] [CrossRef]
  15. Abdella, J.; Tari, Z.; Mahmud, R.; Sohrabi, N.; Anwar, A.; Mahmood, A. HiCoOB: Hierarchical Concurrent Optimistic Blockchain Consensus Protocol for Peer-to-Peer Energy Trading Systems. IEEE Trans. Smart Grid 2022, 14, 3927–3943. [Google Scholar] [CrossRef]
  16. Saad, W.; Han, Z.; Poor, H.V.; Basar, T. Game-Theoretic Methods for the Smart Grid: An Overview of Microgrid Systems, Demand-Side Management, and Smart Grid Communications. IEEE Signal Process. Mag. 2012, 29, 86–105. [Google Scholar] [CrossRef]
  17. Nash, J.F., Jr. Equilibrium points in n-person games. Proc. Natl. Acad. Sci. USA 1950, 36, 48–49. [Google Scholar] [CrossRef] [PubMed]
  18. Rahimi, F.; Ipakchi, A. Demand Response as a Market Resource Under the Smart Grid Paradigm. IEEE Trans. Smart Grid 2010, 1, 82–88. [Google Scholar] [CrossRef]
  19. Liu, X.; Gao, B.; Wu, C.; Tang, Y. Demand-side management with household plug-in electric vehicles: A Bayesian game-theoretic approach. IEEE Syst. J. 2018, 12, 2894–2904. [Google Scholar] [CrossRef]
  20. Saghezchi, F.B.; Saghezchi, F.B.; Nascimento, A.; Rodriguez, J. Game theory and pricing strategies for demand-side management in the smart grid. In Proceedings of the 2014 9th International Symposium on Communication Systems, Networks & Digital Sign (CSNDSP), Manchester, UK, 23–25 July 2014; IEEE: Piscataway, NJ, USA, 2014. [Google Scholar] [CrossRef]
  21. Nazari, S.; Ahmadi, A.; Kamrani Rad, S.; Ebrahimi, B. Application of non-cooperative dynamic game theory for groundwater conflict resolution. J. Environ. Manag. 2020, 270, 110889. [Google Scholar] [CrossRef]
  22. Pal, S.; Thakur, S.; Kumar, R.; Panigrahi, B. A strategical game theoretic based demand response model for residential consumers in a fair environment. Int. J. Electr. Power Energy Syst. 2018, 97, 201–210. [Google Scholar] [CrossRef]
  23. Charoen, P.; Sioutis, M.; Javaid, S.; Lim, Y.; Tan, Y. Fair Billing Mechanism for Energy Consumption Scheduling with User Deviation in the Smart Grid. In Proceedings of the 2018 IEEE International Conference on Smart Energy Grid Engineering (SEGE), Oshawa, ON, Canada, 12–15 August 2018; IEEE: Piscataway, NJ, USA, 2018. [Google Scholar] [CrossRef]
  24. Mostafa, H.A.; El Shatshat, R.; Salama, M.M.A. A Correlated Equilibrium Game-Theoretic Approach for Multiple Participants Electric Distribution Systems Operation. IEEE Trans. Smart Grid 2016, 7, 32–42. [Google Scholar] [CrossRef]
  25. Abhishek Kumar. Smart Contracts on the Blockchain: A Deep Dive in to Smart Contracts. medium.com. 2018. Available online: https://abhibvp003.medium.com/smart-contracts-on-the-blockchain-a-deep-dive-in-to-smart-contracts-9616ad26428c (accessed on 25 September 2023).
  26. Bhuiyan, B.A. An overview of game theory and some applications. Philos. Prog. 2016, 59, 111–128. [Google Scholar] [CrossRef]
  27. Gerardi, M.; Fallucchi, F.; Orecchini, F. Blockchain Technology for Monitoring Energy Production for Reliable and Secure Big Data. Electronics 2023, 12, 4660. [Google Scholar] [CrossRef]
  28. Suciu, G.; Sachian, M.A.; Stalidi, C.; Florescu, R.; Gheorghe, C.; Jujan, A.I. Smart grid advancements using a HummingBoard. In Proceedings of the 2023 22nd RoEduNet Conference: Networking in Education and Research (RoEduNet), Craiova, Romania, 21–22 September 2023; pp. 1–4. [Google Scholar] [CrossRef]
  29. Zeraati, M.; Jabari, F.; Salarkheili, S. Blockchain-Based Transaction Platform for Peer-to-Peer Energy Trading. In Demand-Side Peer-to-Peer Energy Trading; Vahidinasab, V., Mohammadi-Ivatloo, B., Eds.; Springer International Publishing: Cham, Switzerland, 2023; pp. 77–97. [Google Scholar] [CrossRef]
  30. Khilenko, V.V. Formation of a New Conception and a Paradigm of Constructing Cybersecurity Systems. Cybern. Syst. Anal. 2019, 55, 354–358. [Google Scholar] [CrossRef]
  31. Dini, P.; Elhanashi, A.; Begni, A.; Saponara, S.; Zheng, Q.; Gasmi, K. Overview on Intrusion Detection Systems Design Exploiting Machine Learning for Networking Cybersecurity. Appl. Sci. 2023, 13, 7507. [Google Scholar] [CrossRef]
  32. Von Stackelberg, H. Market Structure and Equilibrium; Springer Science & Business Media: Berlin/Heidelberg, Germany, 2010; p. 133. [Google Scholar]
  33. Hanusz, Z.; Tarasinska, J.; Zielinski, W. Shapiro–Wilk test with known mean. REVSTAT-Stat. J. 2016, 14, 89–100. [Google Scholar]
  34. Hsu, H.; Lachenbruch, P.A. Paired t test. In Wiley StatsRef: Statistics Reference Online; Wiley: Hoboken, NJ, USA, 2014. [Google Scholar]
  35. Nordstokke, D.W.; Zumbo, B.D. A new nonparametric Levene test for equal variances. Psicológica 2010, 31, 401–430. [Google Scholar]
  36. Rey, D.; Neuhäuser, M. Wilcoxon-signed-rank test. In International Encyclopedia of Statistical Science; Springer: Berlin/Heidelberg, Germany, 2011; pp. 1658–1659. [Google Scholar]
Figure 1. Illustration image—usage of the proposed platform.
Figure 1. Illustration image—usage of the proposed platform.
Energies 17 01333 g001
Figure 2. Archimate—organization structure view.
Figure 2. Archimate—organization structure view.
Energies 17 01333 g002
Figure 3. Archimate—application structure view.
Figure 3. Archimate—application structure view.
Energies 17 01333 g003
Figure 4. Sequence diagram for the game theory model.
Figure 4. Sequence diagram for the game theory model.
Energies 17 01333 g004
Figure 5. PAR comparison (the more, the better).
Figure 5. PAR comparison (the more, the better).
Energies 17 01333 g005
Figure 6. AVG consumption in hours, week without recommendations.
Figure 6. AVG consumption in hours, week without recommendations.
Energies 17 01333 g006
Figure 7. AVG consumption in hours, week with recommendations.
Figure 7. AVG consumption in hours, week with recommendations.
Energies 17 01333 g007
Figure 8. PAR measured in each day (the more, the better).
Figure 8. PAR measured in each day (the more, the better).
Energies 17 01333 g008
Table 1. Statistical evaluation methods results.
Table 1. Statistical evaluation methods results.
Testp-Value
Shapiro-Wilk (our data)0.3702385723590851
Shapiro-Wilk (orig data)0.5495042204856873
Levene0.03887956060197091
Wilcoxon test0.043114446783075355
Table 2. Comparison of average costs for energy in the evaluation scenarios.
Table 2. Comparison of average costs for energy in the evaluation scenarios.
ScenarioAverage Costs (in Euros)
Without recommendations338,541.16
With recommendations316,567.75
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Košt’ál, K.; Khilenko, V.; Hunák, M. Hierarchical Blockchain Energy Trading Platform and Microgrid Management Optimization. Energies 2024, 17, 1333. https://doi.org/10.3390/en17061333

AMA Style

Košt’ál K, Khilenko V, Hunák M. Hierarchical Blockchain Energy Trading Platform and Microgrid Management Optimization. Energies. 2024; 17(6):1333. https://doi.org/10.3390/en17061333

Chicago/Turabian Style

Košt’ál, Kristián, Volodymyr Khilenko, and Michal Hunák. 2024. "Hierarchical Blockchain Energy Trading Platform and Microgrid Management Optimization" Energies 17, no. 6: 1333. https://doi.org/10.3390/en17061333

APA Style

Košt’ál, K., Khilenko, V., & Hunák, M. (2024). Hierarchical Blockchain Energy Trading Platform and Microgrid Management Optimization. Energies, 17(6), 1333. https://doi.org/10.3390/en17061333

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop