1. Introduction
The smart grid can be regarded as a digital two-way power flow electric system, which can create an automated and distributed energy transmission network [
1,
2,
3]. As a new direction of the smart grid, the scale and management style of the microgrid differ from those of the traditional smart grid. The microgrid is a self-sufficient energy system composed of load, centralized control equipment, energy storage equipment, and a variety of distributed power sources (such as photovoltaic, wind power, etc.), which can generate and distribute energy in limited areas and provide highly intelligent services for users [
4]. The microgrid can be connected to the public grid to operate in grid-connected mode or be disconnected from the public grid to operate in an island model, which boasts the features of flexibility, reliability, and efficiency [
5]. evision. References 5 and 15 are indeed duplicated. Thank you for your revision. However, the diversity and complexity of the energy structure in the microgrid system bring great challenges to the efficient operation of the grid [
6]. It is crucial to explore how to properly schedule each component (photovoltaic generator, wind turbine, energy storage equipment, etc.), because this can support achieving the goal of economic or environmental optimization and provide higher-quality services for users.
The microgrid can respond to the demands of numerous users by regulating the load, distributed power sources, energy storage equipment, etc. [
7]. The microgrid combines distributed energy and energy storage equipment to make up for the shortcomings of the unstable distribution of energy generation and improve the economic efficiency of new energy resources [
8]. Through peak clipping, valley filling, load shifting, strategic load growth, etc., the microgrid can use the prediction results of energy to implement reasonable control strategies and build economic microgrid architectures [
9,
10]. For example, Munkhammar et al. [
11] used the Markov-chain mixture distribution model to predict the very short-term load prediction of residential electricity consumption and forecast one step ahead of half-hour resolution residential electricity consumption data. Aiswariya et al. [
12] designed an optimization scheme of battery dispatching using a simulated annealing algorithm, which can reduce the energy consumption of the main grid and users’ energy costs. However, these efforts ignore the security in terms of data collection and the processing process.
The distributed characteristic of a blockchain transforms the smart microgrid from the centralized storage management to distributed multipoint management, which can realize the effective dispatching of power storage and minimize energy loss [
13,
14,
15]. The characteristics of blockchain such as immutability and decentralization effectively ensure the reliability and security of energy trading and data exchange. The microgrid system based on blockchain technology can guarantee the traceability of scheduling information and ensure the privacy of users’ data. Researchers from academia study and attempt to integrate blockchain into a smart microgrid. Zhao et al. [
16] proposed a dual-layer microgrid energy architecture based on blockchain, which can provide decentralized and information-transparent systems for trading nodes. Tsao et al. [
17] proposed a decentralized microgrid model based on the blockchain and used game theory to analyze the decisions of two players, seeking to maximize their profits. Esmat et al. [
18] developed a decentralized peer-to-peer energy trading platform, consisting of a market layer and a blockchain layer.
Although existing efforts consider multiple blockchain-based peer-to-peer energy trading systems, some important problems still have not been solved. For example, in these current solutions, blockchain is only used to implement peer-to-peer transactions and play the role of a distributed data platform. In addition, the energy storage equipment and renewable energy sources (RES) are rarely considered at the same time, which may affect the optimization of the regional power resources and economic benefits. In this paper, we proposed a blockchain-based microgrid model architecture, integrating blockchain with the microgrid to provide secure data collection. Then, we propose an intelligent dispatching scheme to achieve better economic and environmental benefits. We coordinate and schedule the main power grid, renewable energy sources, and energy storage devices. During each round of the power supply, the users are powered by the intelligent dispatching of power energy from renewable energy sources, power storage equipment, and the main grid. When power energy is insufficient, it can be replenished by purchasing from the main power grid or discharging from the power storage equipment. When energy is surplus, it can be sold to the main grid or charged to the energy storage equipment. We further introduce the principle based on credit exchange, motivating the distributed energy resources to fairly participate in voltage regulation. The main contributions of this paper are summarized as follows. We further introduce the principle based on credit exchange, motivating the distributed energy resources to fairly participate in voltage regulation. The main contributions of this paper are summarized as follows.
We propose a blockchain-based microgrid architecture using the group signature algorithm as the data signature mechanism. The architecture combines the blockchain with the microgrid to ensure the privacy of user data and preserve the tracking capability of the system.
We propose an intelligent dispatching scheme and consider the meteorological factors in power prediction to reduce the prediction error. In addition, we design an intelligent allocation algorithm based on the prediction results to minimize users’ cost while ensuring maximum resource utilization.
In order to enable power companies to fairly and reasonably participate in intelligent dispatching, we introduce a credit-based bidding mechanism. When a company is selected for dispatching, the credit value of its bid will be deducted, otherwise the bid will be returned to the unselected company. Hence, the unselected company has high credit, making it more possible to fairly participate in the next round of bidding.
The rest of this paper is organized as follows. We present the system model of the blockchain-enabled smart microgrid framework in
Section 2. We formulate an intelligent dispatching problem and a credit bidding problem in
Section 3. In
Section 4, we evaluate the performance of the proposed. Finally, we conclude this paper in
Section 5.
2. System Model
This paper proposes a blockchain-enabled intelligent dispatching scheme for microgrids, including a blockchain-enabled smart microgrid framework, an intelligent dispatching model, and a group signature algorithm.
2.1. Blockchain-Enabled Smart Microgrid Framework
The proposed framework, as shown in
Figure 1, is composed of a group of microgrid equipment, a blockchain network, and a management hub. Particularly, the management hub interconnects the microgrid equipment and the blockchain network.
2.1.1. Microgrid
The microgrid is composed of a group of wireless sensor networks (WSNs) formed by a large number of sensor nodes. Specifically, these sensor nodes are randomly deployed near the terminals of wind turbines, PV panel components, energy storage equipment, main grid, and power users. The deployment of sensor nodes is to sense and inspect the status of microgrid terminals, smart meters, and meteorological conditions, including wind speed, and temperature. Then, the monitored data are acquired and transmitted to the management hub using the communication protocol CoAP [
19]. The management hubs are responsible for uploading the data to blockchain nodes. Users can obtain power resources from renewable energy, energy storage equipment, and the main grid. Moreover, users can also store these resources in the main grid and energy storage equipment with a surplus.
2.1.2. Management Hub
The management hubs are deemed critical roles connecting WSNs and blockchains. Firstly, management hubs are served as the link between the microgrid and the blockchain. The primary responsibility of management hubs is to convert terminal data in the microgrid from the constrained application protocol (CoAP) coding to the JavaScript Object Notation-Remote Procedure Call (JSON-RPC) messages, ensuring that the terminal data can be identified by nodes in the blockchain. Moreover, management hubs can protect the privacy of microgrid users as well as power companies and detect anomaly detection for microgrids. Thus, the data can be accurately, continuously, and transmitted to blockchain nodes in a timely manner. Finally, management hubs can provide additional verification for the commitments made by microgrid terminals, including data uploading and querying.
2.1.3. Blockchain Network
Blockchain is a decentralized ledger system used to record all transactions of microgrids. In our solution, the blockchain network mainly includes the manager node, agent, and traditional blockchain nodes such as the nodes of the miner and simplified payment verification (SPV).
Manager: The managers set access control permissions and manage the registration and access control of microgrid terminals. In addition, managers can interact with smart contracts to achieve information transmission. When a new Internet of Things (IoT) terminal joins the network, the manager notifies the license and identity of the new terminal to the management hubs. At the same time, the location of the management hub can also be notified to IoT terminals.
Agent: All agents in the blockchain maintain the same database copy. Each block contains a series of smart contract updates, including the node’s power generation status, credit values, history records, and prediction of future power demand. Moreover, to mitigate the potential proliferation of divergent contract states, the blockchain performs an update validation in parallel with block generation to ensure that only the validated updates will be included. The detailed process is as follows:
When the smart contract is updated, each agent transmits the data copy and the buffer named “mempool” to the neighbors. Meanwhile, the agent obtains proof of work (POW) and generates new blocks by solving the computational non-deterministic polynomial (NP) challenge. Then, the agent fills its memory pool with existing smart contract updates, and transfers the newly generated blocks to other agents;
Upon receiving a block, the agent proceeds to verify the presence of a valid proof-of-work (PoW). If the verification is successful, the agent adds the block to its blockchain and disseminates it to neighboring nodes. In the case of a failed verification, the erroneous validation results are also propagated within the blockchain network;
When all agents have completed validation, they save the identical blockchain updates. The agent deletes smart contract updates contained in blocks that were received and validated from its member pool.
Miners and SPV nodes: The miners are responsible for packaging relevant data into a block over some time, including the recorded credit scores, historical records, and electricity data. The SPV node provides agents with queries for the relevant data maintained in the blockchain. For instance, SPV nodes have the ability to check the charging and discharging records of the energy storage equipment.
2.2. Intelligent Dispatching Model
During each round of power supply, users are powered by the intelligent dispatching of power from RES, power storage equipment, and the main grid. When power is insufficient, it can be replenished by purchasing from the main power grid or discharging from power storage equipment. When energy is surplus, it can be sold to the main grid or charged to the energy storage equipment.
The power resources of renewable energy, power storage equipment, and the main power grid should be dispatched reasonably to realize the rational utilization of power resources, meeting the electricity demand of users. Furthermore, the ultimate goal of intelligent dispatching is to maximize the savings in power resources and power costs. Therefore, we consider a fair smart contract-based credit bidding strategy to ensure that each power company (PC) has an equal opportunity to participate in the dispatching. In the meantime, the power generation capacity of each PC is considered to meet the power demands of users.
2.2.1. Smart Contract-Based Credit Bidding
Smart contract is a collection of codes and data residing at a specific address on the Ethereum blockchain. They can define rules, such as regular contracts, and automatically execute rules through code. They are not controlled by users, but they are instead deployed to the network and run as programmed, which can guarantee the fair operation of the contract. Based upon this, we introduced a credit bidding mechanism based on the smart contract, to improve the fairness of companies participating in system dispatching. The specific contract description is as follows:
Step 1: Each PC is assigned the same credit score ;
Step 2: Each PC determines the bidding price based on the prediction and allocation scheme of their local operations with the goal of revenue;
Step 3: The bidding price is then encrypted and transmitted to other companies. After receiving the decrypted information, the encryption key will be sent to companies, ensuring that all companies have the identical bidding table;
Step 4: The PC with the highest bid can be selected based on the bidding results. Meanwhile, the credit value that matches the bid of the selected ones can be deducted. The changes in credit value of the selected ones are recorded in the blockchain. Then, the blockchain nodes sequentially update the status, verify the new block, and accept the new block, so that all nodes ultimately obtain the same updated credit table;
Step 5: The companies participate in intelligent dispatching according to bidding results.
Since smart contracts are frequently attacked by using smart contract vulnerabilities, formal verification methods based on mathematical technology are widely used to ensure the correctness of smart contract functions and the security of the running time. The formal verification of smart contracts can minimize the risk of failure and error, thereby avoiding possible costs [
14], such as formal verification methods based on formal modeling, theorem proving, and model detection, etc. The formal verification of this paper can refer to the methods in references [
15].
2.2.2. Power Generation Capacity
The powerful energy of the smart microgrid mainly comes from RES, power storage equipment, and the main grid. When there is excess energy, it will be sold to the main grid or charge energy storage equipment.
Power generation model of renewable energy: Renewable energy mainly includes PV and wind turbines. The power generation model is shown in Equation (
1):
where
and
represent the power of wind energy and PV, respectively.
and
are the start–stop factors of PV and wind, in which the number 0 means off and 1 means on.
Power generation model of energy storage equipment: In general, the charging power and discharging power of the energy storage equipment is constant, which is denoted as
. The state of charge (SOC) is determined by Equation (
2) during the period
, which calculates the SOC as the ratio of the residual power to the capacity of the energy storage equipment.
where
denotes the SOC value at time
t, and
is the energy storage equipment capacity.
Equations (
3)–(
5) are constraints of (
2). Due to the correlation between the lifecycle of the energy storage equipment and the charging or discharging power of the SOC, the power capacity of the energy storage device cannot exceed the maximum and minimum SOC values to extend the service life of energy storage equipment. In addition, the power resources stored in the energy storage equipment at the beginning of the schedule should be equal to the end of the schedule.
where
and
are the minimum and maximum values of SOC, respectively. Equation (
4) indicates that the maximum charging or discharging power is limited to 20% of its rated capacity at each time interval.
Power exchange model with main grid: Equation (
6) expresses the power conservation constraint during the operation of the microgrid system, and Equation (8) describes the power constraint of the interaction with the main grid.
where
means the load power of users at time
t and
denotes the power of the wind turbines,
is the PV power.
represents the charge or discharge power of the energy storage equipment, in which the positive value indicates the energy storage equipment is charging and negative value is discharging.
and
denote the upper limit and the lower limit of the switching power, respectively.
is the exchange power between the microgrid and the main grid, while the positive value represents that the microgrid is purchasing the power from the main grid and the negative value represents that the power is sold.
Then, the power generation capacity of company
i is expressed as:
where the range of
,
, and
are
. Here,
.
2.3. Group Signature-Based Data Security Model
Existing sensor nodes are easily manipulated. It is easy for attackers to obtain the collected privacy data information and falsify the information, which poses a serious security threat to the WSN. To improve the security of private data transmitted from WSN to blockchain, a group signature algorithm based on the ELGamal public key encryption was employed to avoid malicious behavior from malicious attackers.
A group signature scheme generally consists of system establishment, group member joining, signature, verification, and opening. In this article, the group manager is served by the management hub node. The group members refer to terminal devices. The message
m to be signed is the private data generated by the terminal device. According to the ELGamal digital signature algorithm, the group manager constructs a group for each region of the microgrid. As shown in
Figure 1, each WSN group forms a group. The specific process is as follows.
Step 1 (System establishment): System initialization and key generation are carried out during the system establishment stage. The group manager creates groups for each region of the microgrid, while generating the group private keys for group members and group public keys. Specifically, the group manager randomly selects two large prime numbers such that . are q order generators in the field . Randomly select and calculate . is a hash function. Then, public parameters are . The group public key is y and the group private key is x.
Step 2 (Group member joining): Group member i first randomly selects individual private key , and calculates . Then, group members and group managers interact according to the following protocol to obtain their own signature keys.
- -
Group member i randomly selects l, and calculates , , then securely sends to the group manager.
- -
The group manager verifies whether is true, and exits if it is not established. If it is true, the group manager uses the ELGamal signature scheme to sign the message . The group manager selects a random number k, calculate and , then the signature of message is .
- -
The group manager sends to group member i, calculates , and saves in the list of members.
- -
The group members verify whether the equation holds. If the verification is successful, group member i accepts and generates its own signature key together with its own private key. Otherwise, repeat the above process or exit the protocol.
Step 3 (Signature): Group member
i randomly selects the parameters
and calculates
Then, the group signature is .
The verifier verifies whether the equation is valid. If the verification passes, the signature is accepted; otherwise, the signature is invalid.
Step 5 (Open): The group manager calculates the equation , and compares it in its saved list of members to find the same triplet . Then, the group manager further verifies with the equation . If the verification is successful, the identity of the member is . Otherwise, repeat the process until the verification is passed.
3. Problem Formulation and Implementation
In this section, we introduce blockchain-based power prediction, the selection of power companies involved in intelligent dispatching, and the intelligent dispatching of power sources. Power prediction is the premise of intelligent dispatching and participant selection. Power prediction is used to predict future electricity demand, serving for intelligent dispatching and participant selection. The purpose of participant selection is to achieve the fair participation of power companies while meeting the power demand of users. Intelligent dispatching is used to minimize user costs while ensuring maximum resource utilization, which is shown in
Figure 2.
3.1. Blockchain-Assisted Power Prediction
The power prediction mainly relies on the data collected from WSN, which serves for intelligent dispatching. According to the predicted results, the power resources can be intelligent deployed to prevent power resources being wasted.
3.1.1. Data Collection
Sensors deployed in the detection area of microgrid equipment are responsible for data collection, and then transmit the collected data to the management hub. The management hub formats the data into blockchain-identifiable data via a specific processing method. The miners on the blockchain store data on the blockchain in the form of blocks by mining it. To ensure the security of data transmission, the encryption algorithm based on the public key and group signature algorithm is used.
Assuming that the collected power data in time
t for terminal
i is denoted as
, to ensure the security of data
, it will first be signed to obtain the signature using the group signature algorithm introduced in
Section 2.3. Then, the signature information will be sent to management hub nodes for verification. If the verification is successful, it indicates that the data are secure and trustworthy. Then, the data will be stored on the blockchain for future power prediction.
3.1.2. Power Prediction
Based on the collected power data, a prediction model for predicting the future power demands is constructed, which is expressed as
where
is the actual data at time
captured by WSN.
expresses the forecast data at time
t.
means the prediction function parameterized by
, assessed by the historical data, wind power, and PV, which is obtained from the blockchain.
Due to the unavoidable meteorological factors, such as temperature, wind intensity, and light intensity, we formalize the prediction model as
where
is the genuine meteorological condition.
To accurately predict short-term power, we adopt an improved radial basis function neural network model with error feedback scheme mentioned in [
20].
3.2. Participant Selection Based on Credit Bidding
In order to make each power company participate in power regulation fairly and ensure the normal operation of power supply, we put forward a participant selection algorithm based on reputation bidding. According to the bidding results, the highest bidder will be selected as the participant in the power regulation. In order to make other unselected power companies have a chance to participate fairly in the future power regulation, we deduct the selected one’s credibility value of the bid to reduce its chance of being selected later, so as to achieve the purpose of fair bidding.
We consider bidding during the
period and assume that there are
power companies participating in the bidding process. Before bidding, each power company receives an initial credit score. The
ith company’s initial credit at time 0 is
. Based on the prediction results
, each power company calculates the proportion of the profits available during the
period to the total profits, that is also the credit values must be paid in the bidding at time
t. The credit values
of the
i-th power company can be expressed as:
where
is the unit-price, and
is the prediction result of power at time
.
Then, random bidding is conducted based on the credit score of each company. The probability
of the power company being selected is proportional to the credit score of the company bid, expressed as
where
is the probability of the company
i being selected at time
t. The company with the highest probability
will be selected as the power supplier for this round. The credit values paid by the company will be deducted, and the credit of companies that failed the bidding will be returned. Assume that the
i-th company wins this round of bidding, the credit value
of company
i in
is formulated as:
The bidding of the selected node will be deducted from the credit value, and the change in node credit will be recorded in the blockchain. The credit value of the unselected node will remain unchanged.
Compared to the method of randomly selecting a power company from companies with equal probability, our method deducts the credit score of successful bidding power companies, which can prevent companies obtaining high profits through frequent bidding in high-profit situations, and increase the probability of each company being selected, thereby improving fairness. In addition, the proposed scheme can improve efficiency, save users’ costs, and promote the use of renewable energy.
3.3. SA-AFSA-Based Intelligent Dispatching
According to the power prediction and credit bidding results, power companies with high bids and abundant power can be eligible to participate in intelligent dispatching. The selected power company intelligently allocates power equipment to generate a set of decision sequences
to minimize future power costs for users. The power cost mainly includes the RES cost, energy storage equipment cost, energy exchange cost, while the RES cost is given by
where
denotes the unit prices of wind energy generation.
is the unit price of PV. The cost of energy storage is as follows
where
represents the energy storage cost’s unit price.
where
denotes the cost of power exchange that satisfies the following conditions:
where
and
are the prices purchased and sold from the main grid, respectively. Then, the total cost can be calculated by the following equation
where the
.
means that the power supply resource is used in intelligent dispatching, and
indicates that the power supply resource is not used.
To meet the power demands of users, the supply of power should be greater than or equal to the predicted power, which can be formalized as:
Moreover, in order to ensure the rational use of power and achieve the target of energy conservation, we also need to minimize
. Thus, the microgrid intelligent dispatching problem in this article is formalized as a decision optimization problem with multiple stages, as can be seen in Equation (
22)
which aims to minimize the cost
of power for users while improving the utilization of power resources. Here,
represents the penalty factor, and
is the difference between the initial state and the final state of the SOC. The conditions (
23) are the basic constraints on the objective function (
22) to ensure the normal operation of the microgrid system.
Note that the problem is an NP-hard problem that is difficult to directly solve in a polynomial time. We adopt an improved artificial fish swarm algorithm based on simulated annealing. The artificial fish swarm algorithm sets the position of the fish swarm near the extreme point, which can prevent the algorithm from falling into the local optimal solution and can be applied in the energy optimization of the microgrid. Nevertheless, due to the slow convergence rate and large solution errors of this algorithm, the utility of the algorithm in practical applications is reduced. To this end, we introduce the metropolis discriminant criterion of simulated annealing into foraging behavior to improve the solution accuracy and convergence speed.
According to the objective function of intelligent dispatching optimization, the parameters to be optimized are the power contribution of each distributed power source including the RES, power storage equipment, and the main grid. The optimization variable is the spatial position of the fish swarm. The value of the objective function corresponding to the spatial position directly reflects the quality of the position. Fish can constantly update their position through foraging, clustering, rear-end pursuit, and random behavior until they find the best position, which is the optimal solution of the objective function. The detailed algorithm description is shown in
Figure 3.
Step 1 We first initialize the field of view and step size, the degree of crowding, and the maximum number of iterations . The size of the artificial fish school is set to n. We select the initial position of each artificial fish (AF), which represents the initial value of the objective function . We then calculate the food concentrations at the initial locations in each group and recorded the highest food concentration and the corresponding AF position on the bulletin board. The value of the objective function is inversely proportional to the food concentration. Hence, minimizing the objective function enables finding the place where the food concentration is the highest.
Step 2 In the current iteration round i, each AF performs swarming, following, preying, and random behaviors. In particular, we introduce the metropolis criterion of the simulated annealing algorithm to perform preying behaviors, so that the AF accepts the state and updates the position with a probability of , where .
Step 3 We calculate the food concentration of each AF at its current location and compared it with the bulletin board. If the food concentration is higher than the bulletin board, update the bulletin board.
Step 4 We repeat steps 2 and 3 until the algorithm reaches its maximum number of iterations. At this time, the value on the billboard is the optimal solution, that is, the minimum value of the objective function.
5. Conclusions
In this paper, we propose a blockchain-based microgrid architecture, using the group signature algorithm as the data signature mechanism. The architecture combines the blockchain with the microgrid to ensure the privacy of user data and preserve the tracking capability of the system. In addition, we propose an intelligent dispatching scheme in which meteorological factors are considered in power prediction, then an intelligent allocation algorithm is designed based on the prediction results. Compared with traditional power systems, our proposed scheme reduces the cost of the system. In order to enable power companies to participate in intelligent dispatching fairly and reasonably, we introduce a credit-based bidding mechanism. When a company is selected for dispatching, the credit value of its bid will be deducted, otherwise, the bid will be returned to the unselected company. Hence, the unselected company has high credit, making it more possible to fairly participate in the next round of bidding. The numerical results show that our proposed scheme performs well in terms of prediction results and the cost of intelligent dispatching. In the future, we plan to delve deeper into the integration of blockchain with the smart microgrid. Additionally, we will consider the collaboration among multiple microgrids to perform energy scheduling more efficiently and provide users with high-quality services.