# Visual Analysis of Blockchain Energy Storage Scheduling considering the Optimal Scheduling of User-Side Source and Storage Resources

Authors: Zhiwei Chen; Hu Xie; Wenxin Guo; Ruifeng Zhao; Yang Liu
Journal: Mobile Information Systems
 (2022)

---

## Abstract

With the rapid development of Internet technology, the problem of client-side source storage resources is gradually exposed. In view of the problems of small capacity, uneven distribution, and diversification of attributable entities of user-side source storage resources, the current blockchain energy storage is difficult to schedule, and user-side sources and storage resources cannot be added to power scheduling optimization, resulting in unusable resources. In order to effectively utilize user-side resources, this paper proposes a blockchain energy storage scheduling visualization system (BESSVS) that takes into account the optimal scheduling of user-side source storage resources. The BESSVS can coordinate and optimize the management and control of decentralized power resources and load resources, and effectively combine the Internet of Things and the power plant storage energy corresponding to the BESSVS for optimal scheduling. The design of blockchain energy storage scheduling visualization system is mainly carried out from the system main body and data information structure. The advantages of blockchain in data storage, information security, data interoperability, etc., are introduced into the economic scheduling of blockchain energy storage. It is conducive to the stable scheduling of information transparency and also improves the data security and storage security of the system. Finally, the feasibility and practicability of the method are verified by an example.


---

## Body

## 1. Introduction

In recent years, as the power storage system has gradually become low carbon, distributed storage technology has been continuously introduced during the use process, and a small number of users have also transformed from a single energy consumption in the past to energy self-sufficient energy producers, which can not only effectively affect the power, data information, and value flow of electrical power system, but make high-efficiency distributed power sources more appropriately and securely to access, which has become a huge challenge that power storage systems will face [1, 2]. During this period, how to control the energy storage and other users’ use of more energy for effective scheduling is a difficult problem worthy of study in China and other countries. User-side source storage resources mainly include user-side distributed power generation equipment, energy storage equipment, and capacity adjusted in time according to demand. The distribution of the above resources is characterized by decentralization, large number, and small capacity, and most of them are based on the strategies of spontaneous self-use, surplus power online, and peak-load shifting strategies. Because the effective communication strategies, negotiation mechanisms, and management and control methods are lacked between blockchain energy storage scheduling visualization systems, user-side source storage resources cannot be added to power scheduling optimization, resulting in unusable resources [3, 4]. In order to fully schedule the scheduling capabilities of user-side storage resources and accelerate user participation in active response, load aggregation manufacturers continue to emerge [5].The blockchain technology is combined with the Internet of Things technology in this paper, and a blockchain energy storage scheduling visualization system is proposed. The system combines the optimization of the regional blockchain protocol of the Internet of Things system with the large-scale use of the resource control block structure on the user side, completes the rapid data processing, data storage, and inspection on the basis of the BESSVS, and finally uses the user-side electric energy storage and optimization of the distribution network as the research object to verify the effectiveness of the method in this paper.


## 2. Blockchain Energy Storage Scheduling Visualization System

### 2.1. Blockchain Technology

Blockchain technology is a distributed database system which is participated and maintained by several independent nodes. Each node in a blockchain system stores a complete blockchain. Even if a small number of nodes are attacked, the system can maintain stable operation due to the decentralized and highly redundant data storage structure.Generally speaking, the basic structure of a blockchain is shown in Figure1, including: all the information (including transaction information, status information, and code) of all nodes is recorded in the block during a period of time, and this information is hashed and stored in the blockchain in the form of Merkle tree, facilitating quick summary and verification of the accuracy and completeness of the block data [6, 7]. A time stamp is added to the header of the data block, indicating the writing time of the data, and the blocks are connected in the order of the generation time to form a chain structure. The block header of each block contains the index hash value of the previous block, which makes data traceability possible and helps increase the difficulty of data forgery, thereby ensuring the credibility of the data.Figure 1
Basic structure of blockchain.The characteristics of blockchain decentralization naturally correspond to the distribution characteristics of power and load in blockchain energy storage. In addition, the many characteristics of the blockchain, such as open and transparent information, optimal scheduling of user-side source storage resources, and security and credibility, provide new information for data interoperability and information security issues in distributed energy economic scheduling. The solution also makes the application of blockchain technology in blockchain energy storage possible. With the development of distributed power generation technology, the penetration rate of renewable energy in blockchain energy storage will become higher and higher, and the information interaction between distributed power sources and dispatching agencies will be more frequent, adaptive and decentralized energy dispatch will become the mainstream, and the isomorphic blockchain will also provide a data interaction basis with strong robustness for distributed energy. The information of the blockchain system is highly transparent and open, and in an interval, a new block will be formed in the system. The newly constructed blockchain energy storage module mainly contains the latest status information, which can enable the system to obtain accurate data information, effectively improve the predicted value of renewable energy power generation, and ensure the rationality of regional power dispatching efficiency domain [8, 9]. Meanwhile, in the running process of blockchain energy storage, the optimal scheduling of user-side source storage resources can ensure the safe and automatic execution of node transactions. Multiple encryption technologies are integrated into the blockchain to ensure user privacy and immutable data security. This feature provides a strong guarantee for the information security of distributed entities with blockchain energy storage.


### 2.2. System of Optimal Scheduling of User-Side Source Storage Resources

Combining the characteristics of blockchain energy storage, an optimal scheduling of user-side source storage resources (OSUSSSR) system is designed in this paper, as shown in Figure2.Figure 2
Optimal scheduling system of user-side source storage resources.Each node in OSUSSSR stores complete blockchain data, and each block stores all the information of OSUSSSR in a period of time. The status information includes the power generation (consumption) unit ID, power generation (consumption) amount, energy type, geographic location, electricity price, weather information, etc. The transaction information includes the transaction record number, the power generation unit ID, the power consumption unit ID, the transaction amount, transaction power, etc. [10]. The optimal scheduling of user-side source storage resources is attached to the blockchain in the form of code, which is used for the decentralized and automatic operation of blockchain energy storage economic scheduling. The network access verification of new nodes is also completed through the optimal scheduling of user-side source storage resources to ensure the scalability of OSUSSSR.Any power generation unit or power consumption unit in the blockchain energy storage can be added to OSUSSSR as a node. When a new node applies to join optimal scheduling of user-side source storage resources, it needs to submit its own relevant information, including identity, location, energy type, and power generation characteristics, and through optimal scheduling of user-side source storage resources broadcast to the entire network. In each node of the original network in the optimal scheduling of the source storage resources on the user side, the information of the newly added node is verified according to preset conditions. The newly added nodes after passing the verification can be added to OSUSSSR, and a specific ID can be obtained as a unique identification.Any node can freely exchange information through the P2P network. All information to be saved to the blockchain must be broadcast to all the entire network, while all nodes receive and verify information. After a certain time, interval, the node will hash the received information to generate a candidate block. Blocks need to participate in the consensus process, and new block information will be released to the entire network after consensus is reached.


### 2.3. Overall Architecture

According to the characteristics of the OSUSSSR network, a blockchain energy storage scheduling visualization system based on OSUSSSR is designed in this paper, as shown in Figure3. On the basis of traditional blockchain energy storage economic scheduling, it integrates the optimal scheduling of user-side source storage resources (OSUSSSR), making OSUSSSR the information interaction and data storage center of the entire blockchain energy storage, effectively introducing the advantages of blockchain in the data storage, information security, and data interoperability into the economic dispatch of blockchain energy storage. The status information of distributed power generation units and power consumption units is monitored in real time through smart meters and uploaded to the OSUSSSR network. The economic dispatch plan of blockchain energy storage is formed in the optimal scheduling of user-side source storage resources, which is checked and confirmed by the energy management system, and finally realizes the reliable power supply of the power generation unit to the power consumption unit.Figure 3
Blockchain energy storage scheduling visualization system based on OSUSSSR.The operation process of blockchain energy storage economic dispatch on the energy blockchain is shown in Figure4. The specific instructions are as follows:Figure 4
Blockchain energy storage economic dispatch process in a single cycle.Step 1.
Each power generation unit and power user access the historical data and current status information in OSUSSSR to predict their own operating status.Step 2.
The node publishes its own prediction information, accepts all the prediction information of other nodes, and backs up all data after being authenticated by the entire network.Step 3.
According to all the predicted information that passed the authentication, each node calls the optimal scheduling of user-side source storage resources to perform economic scheduling calculations to form a scheduling plan and spread the scheduling plan through the P2P network, waiting for other nodes to verify.Step 4.
If the scheduling plan passes the verification, it is recorded in the OSUSSSR in the form of optimal scheduling of user-side source storage resources; if it fails to pass the verification, it returns to step3 to perform economic dispatch calculations again.Step 5.
When the trigger conditions set in advance are met, each power generation and power consumption unit automatically operate in accordance with the scheduling plan stored in the optimal scheduling of user-side source storage resources, and this scheduling cycle ends [11].


## 2.1. Blockchain Technology

Blockchain technology is a distributed database system which is participated and maintained by several independent nodes. Each node in a blockchain system stores a complete blockchain. Even if a small number of nodes are attacked, the system can maintain stable operation due to the decentralized and highly redundant data storage structure.Generally speaking, the basic structure of a blockchain is shown in Figure1, including: all the information (including transaction information, status information, and code) of all nodes is recorded in the block during a period of time, and this information is hashed and stored in the blockchain in the form of Merkle tree, facilitating quick summary and verification of the accuracy and completeness of the block data [6, 7]. A time stamp is added to the header of the data block, indicating the writing time of the data, and the blocks are connected in the order of the generation time to form a chain structure. The block header of each block contains the index hash value of the previous block, which makes data traceability possible and helps increase the difficulty of data forgery, thereby ensuring the credibility of the data.Figure 1
Basic structure of blockchain.The characteristics of blockchain decentralization naturally correspond to the distribution characteristics of power and load in blockchain energy storage. In addition, the many characteristics of the blockchain, such as open and transparent information, optimal scheduling of user-side source storage resources, and security and credibility, provide new information for data interoperability and information security issues in distributed energy economic scheduling. The solution also makes the application of blockchain technology in blockchain energy storage possible. With the development of distributed power generation technology, the penetration rate of renewable energy in blockchain energy storage will become higher and higher, and the information interaction between distributed power sources and dispatching agencies will be more frequent, adaptive and decentralized energy dispatch will become the mainstream, and the isomorphic blockchain will also provide a data interaction basis with strong robustness for distributed energy. The information of the blockchain system is highly transparent and open, and in an interval, a new block will be formed in the system. The newly constructed blockchain energy storage module mainly contains the latest status information, which can enable the system to obtain accurate data information, effectively improve the predicted value of renewable energy power generation, and ensure the rationality of regional power dispatching efficiency domain [8, 9]. Meanwhile, in the running process of blockchain energy storage, the optimal scheduling of user-side source storage resources can ensure the safe and automatic execution of node transactions. Multiple encryption technologies are integrated into the blockchain to ensure user privacy and immutable data security. This feature provides a strong guarantee for the information security of distributed entities with blockchain energy storage.


## 2.2. System of Optimal Scheduling of User-Side Source Storage Resources

Combining the characteristics of blockchain energy storage, an optimal scheduling of user-side source storage resources (OSUSSSR) system is designed in this paper, as shown in Figure2.Figure 2
Optimal scheduling system of user-side source storage resources.Each node in OSUSSSR stores complete blockchain data, and each block stores all the information of OSUSSSR in a period of time. The status information includes the power generation (consumption) unit ID, power generation (consumption) amount, energy type, geographic location, electricity price, weather information, etc. The transaction information includes the transaction record number, the power generation unit ID, the power consumption unit ID, the transaction amount, transaction power, etc. [10]. The optimal scheduling of user-side source storage resources is attached to the blockchain in the form of code, which is used for the decentralized and automatic operation of blockchain energy storage economic scheduling. The network access verification of new nodes is also completed through the optimal scheduling of user-side source storage resources to ensure the scalability of OSUSSSR.Any power generation unit or power consumption unit in the blockchain energy storage can be added to OSUSSSR as a node. When a new node applies to join optimal scheduling of user-side source storage resources, it needs to submit its own relevant information, including identity, location, energy type, and power generation characteristics, and through optimal scheduling of user-side source storage resources broadcast to the entire network. In each node of the original network in the optimal scheduling of the source storage resources on the user side, the information of the newly added node is verified according to preset conditions. The newly added nodes after passing the verification can be added to OSUSSSR, and a specific ID can be obtained as a unique identification.Any node can freely exchange information through the P2P network. All information to be saved to the blockchain must be broadcast to all the entire network, while all nodes receive and verify information. After a certain time, interval, the node will hash the received information to generate a candidate block. Blocks need to participate in the consensus process, and new block information will be released to the entire network after consensus is reached.


## 2.3. Overall Architecture

According to the characteristics of the OSUSSSR network, a blockchain energy storage scheduling visualization system based on OSUSSSR is designed in this paper, as shown in Figure3. On the basis of traditional blockchain energy storage economic scheduling, it integrates the optimal scheduling of user-side source storage resources (OSUSSSR), making OSUSSSR the information interaction and data storage center of the entire blockchain energy storage, effectively introducing the advantages of blockchain in the data storage, information security, and data interoperability into the economic dispatch of blockchain energy storage. The status information of distributed power generation units and power consumption units is monitored in real time through smart meters and uploaded to the OSUSSSR network. The economic dispatch plan of blockchain energy storage is formed in the optimal scheduling of user-side source storage resources, which is checked and confirmed by the energy management system, and finally realizes the reliable power supply of the power generation unit to the power consumption unit.Figure 3
Blockchain energy storage scheduling visualization system based on OSUSSSR.The operation process of blockchain energy storage economic dispatch on the energy blockchain is shown in Figure4. The specific instructions are as follows:Figure 4
Blockchain energy storage economic dispatch process in a single cycle.Step 1.
Each power generation unit and power user access the historical data and current status information in OSUSSSR to predict their own operating status.Step 2.
The node publishes its own prediction information, accepts all the prediction information of other nodes, and backs up all data after being authenticated by the entire network.Step 3.
According to all the predicted information that passed the authentication, each node calls the optimal scheduling of user-side source storage resources to perform economic scheduling calculations to form a scheduling plan and spread the scheduling plan through the P2P network, waiting for other nodes to verify.Step 4.
If the scheduling plan passes the verification, it is recorded in the OSUSSSR in the form of optimal scheduling of user-side source storage resources; if it fails to pass the verification, it returns to step3 to perform economic dispatch calculations again.Step 5.
When the trigger conditions set in advance are met, each power generation and power consumption unit automatically operate in accordance with the scheduling plan stored in the optimal scheduling of user-side source storage resources, and this scheduling cycle ends [11].


## 3. Block Data Structure and Distributed Optimal Scheduling

### 3.1. Data Structure and Consensus Mechanism

#### 3.1.1. TDVA Block Data Structure for Distributed Storage Scheduling Events

In order to realize the immutability of data, digital currency blockchains such as Bitcoin have introduced a chain structure with blocks as the unit, as shown in Figure5(a). Take a transaction (transaction, Tx) as the basic unit, such as Tx − 1 in Figure 5(b), calculate the hash value (hash-1, hash-2, hash-3, hash-4), and then combine them in pairs into a new hash value (hash-12 and hash-34). Through this process, a Merkle root can be obtained from several transactions and recorded in the block header. And each block header contains the hash value of the previous block header. The chain structure of the block makes it impossible to change the content of a specific block without changing the hash value of the subsequent block header, thereby realizing the tamper-proof data.Figure 5
Block data structure and TDVA chain storage framework. (a) Tx storage method in the block. (b) TDVA chain storage frame. (c) TDVA storage structure generation process.
(a)(b)(c)In the BESSVS, distributed storage, scheduling, and transaction data are used in the blockchain, and its block data structure design is significantly different from transactions in the digital currency field. Expressed in digital currency, after a transaction is proposed, it is confirmed and recorded by both parties to indicate the completion of the transaction. Therefore, each transaction is independent of each other and completes in one go. For user-side resources, one-time scheduling involves a complete process, including optimization, verification, measurement, and settlement. From the scheduling requirements to the completion of settlement, multi-party interaction is required, a time scale that far exceeds digital currency transactions. Meanwhile, the performance of the Bitcoin transaction network only supports a transaction speed of 7 transactions per second. Simultaneously, it needs to generate 6 blocks to actually confirm data writing. Ethereum can only support 10–20 transactions per second, so it cannot be used as a data storage system for resource scheduling in the power system.Because the traditional transaction-based block structure cannot record all the content in the above process in a timely manner in a structure that is easy to find, a tamper-proof trusted link shall be established. Therefore, this paper designs a block data structure TDVA for storing optimal scheduling of user-side source storage resources and the whole process of transaction, consisting of 4 types of block data structures: trigger (Tx, Ttx., Vtx), dispatch (Tx, Dtx), verification (Tx, Vtx), and settlement (accounting Tx, Atx). On the one hand, it is not necessary to wait for all the data to be generated, and the data can be recorded on the chain to improve the timeliness of data storage. On the other hand, through data decoupling, the efficiency of data synchronization and verification in the system is improved, and the upper limit of processing data by the system is improved.As shown in Figure5(b), the TDVA structure is based on the basic structure of a one-way linked list, which divides the entire process of a scheduling and transaction into four links: initiating a transaction, completing a transaction, verifying a transaction, and clearing a transaction. The time span of the above links can reach several hours. Taking into account the real-time requirements of the data, the data generated by different links are merged into blocks generated at the corresponding time, and subsequent queries are efficiently conducted through the structure of the linked list.Taking the apparent power generation capacity reduction process of a VPP as an example, the data storage process is as follows.(1)
The ENO node proposes to reduce the capacity and duration, and broadcasts the event ID and related data to the entire network. The information is recorded in the Ttx data block and stored in the latest block to be generated immediately.(2)
Distributed power sources, energy storage equipment, and load aggregators with capacity adjustment capabilities, after evaluating their own adjustable capacity, broadcast their own adjustable capacity and required capacity reduction subsidies, and then perform distributed optimization calculations with multi-node participation and take Pareto optimality as the goal to obtain the planned capacity and subsidy standard that each node needs to adjust.(3)
In order to ensure that the system can still operate reliably after scheduling, after obtaining the scheduling goals of each node, the ENO node initiates a distributed security check, and the nodes jointly complete the verification of postscheduling operation status. If the reliability requirements are not met, the constraint conditions shall be added to (2) fir recalculation. If it meets the requirements, it will be confirmed by the ENO node and stored in the Dtx data block [12].(4)
After completing the scheduling, each node encapsulates and stores the relevant data (power generation reduction capacity, duration, subsidy quotation, etc.) involved in this scheduling into the Vtx data block for subsequent settlement use.(5)
According to the data in Vtx, the power transaction is cleared and settled, and the settlement data are stored in the Atx data block. Meanwhile, all transaction IDs involved in the process are recorded to facilitate subsequent accounting and verification of this transaction.The abovementioned four types of block data structures include not only the electricity transaction data stored according to the design, but also the link information before and after the dispatch. The data in a complete dispatch cycle are linked to each other in the form of a linked list and stored in different blocks. The chain structure is used to prevent data tampering.As shown in Figure5(c), when an event that triggers a transaction occurs in the system (e.g., the node sends out a high-voltage event alarm, or the ENO node receives an upper-level system scheduling instruction to adjust virtual capacity), the ENO node will issue the instruction while generating the Ttx data block. After each node on the system receives the instruction and completes the three steps of subsidy quotation, distributed optimization, and distributed security check, the node where scheduling occurs packs the relevant data to generate the Dtx data block, under the supervision of the ENO node, the data block completes the scheduling, under ENO node it generates the Vtx data block, and the Atx data block is finally generated during the settlement between the nodes. The TDVA data block under the same process is essentially stored in the newly generated block after the data block is generated, and is linked by a linked list structure, that is, the storage structure shown in Figure 5(c).


#### 3.1.2. Consensus Mechanism Based on Node Power Generation

In traditional blockchain applications, the consensus mechanism is designed to ensure the distributed consistency of data. It is based on the assumption that nodes that contribute more to the network tend to maintain the interests of the network, and therefore, larger power is granted to these nodes for maintaining the normal operation of the network [13]. In the PoW mechanism, it mainly relies on computing power competition to achieve distributed consistency, as shown in(1)HashNH<T,where Hash⋅ is the SHA256 hash function; N is a self-increasing random value (Nonce); H is other data except N in the block header (Header); and || represents the link of the data; T is the difficulty target. The smaller the T, the more difficult it is to find the N value that meets the conditions.Obviously investing more computing power can enable nodes to occupy an advantageous position in the fight for block generation rights, but in the meanwhile, it will also bring about a huge waste of computing power and a huge consumption of energy. The total power consumption of Bitcoin in 2019 is 73.12 TW·h, and the average power consumption of a single transaction is 623.47 kW·h. In order to solve the shortcomings of the PoW mechanism’s low efficiency and energy consumption, the PoS mechanism appeared, and the solution of the problem was converted to calculating the value ofN that satisfies the following formula.(2)HashNH<St.In the formula,S and t, respectively, represent the equity (digital currency amount) and time held by the node. In some applications, a certain amount of digital currency is locked for a period of time to represent the shares held by the node. The more equity a node holds, the greater the probability of finding a suitable value of N, which makes it easier to obtain the power to generate new blocks.In PoS, equity is used to characterize the weight of a node’s contribution to the network. There is a natural physical quantity in the power system, that is, the node’s power generation or electricity consumption, which can objectively represent the node’s influence and contribution to the entire network. Therefore, a consensus mechanism PoE is proposed based on node power consumption; that is, each node obtains the accounting right through the calculation formula.(3)HashNH<αPGi+βPLi,where α and β are adjustment coefficients; PGi is the power generation of node i in the past week; and PLi is the power consumption of node i in the past week. α and β satisfy(4)γα∑i=1nPGi+β∑i=1nPLi=6Hash,max.In the formula,γ is the maximum number of times that a single node can calculate in a block generation process; Hash,max is the maximum hash value that can be calculated; and n is the number of nodes. See the derivation process of equation.Based on the random distribution characteristics of the calculation results of the information digest algorithm, it can be proved that in probability, the contention for the accounting right can be completed within a limited number of times usingα and β in accordance with formula (4) as the calculation difficulty coefficient, avoiding the heavy dependence on computing power when using the PoW mechanism, which enables the system designed in this article to run on low-power IoT devices while still ensuring the consistency of data on the chain.In summary, with the calculation goal constructed by formulas (3) and (4) as the core, the consensus mechanism PoE proposed in the article has the following characteristics.(1)
In the specified time interval, there must be nodes that can obtain the right to generate new blocks according to the rules.(2)
Making full use of the physical information of the system (node’s power generation and power consumption) as input conditions, the consensus mechanism is realized with low cost and low power consumption.(3)
The operating system has very low requirements for computing power, and it can run smoothly on low-power devices.


### 3.2. Data Security

#### 3.2.1. Generation of Data Address

In a multi-entity network, identity authentication and data security interaction are also key elements of system design. With reference to the blockchain, the BESSVS is designed with a data address corresponding to the identity of the node. First generate a random private key, then calculate the public key through the elliptic curve encryption algorithm, and obtain the hash value of the public key through the hash algorithm. The above two steps are computationally irreversible. After adding the version number and check value before and after hashing the public key, and encoding with Base58, the data address is obtained.


#### 3.2.2. Identity Authentication of Node

After encrypting a node with a unique private key, it can only be decrypted using the corresponding public key. After the node publishes the public key and address, other nodes can verify whether the node corresponds to the data address, and the information sent by the node can be verified by other nodes that have published the public key, because only the node holds the private key. Therefore, if the public key can be used to verify the information, the source of the information is authenticated, thereby realizing the identity authentication of the node.In the BESSVS, the node is bound to the data address, and the private key of the corresponding node is not randomly generated, but a key pair is generated by an authoritative center, the public key is disclosed in the form of a digital certificate, and the private key is distributed to node; the structure of the digital certificate is shown in formula.(5)Id,iKpub,iEHashId,iKpub,i,Kpri,where Id,i is the identity of node i; Kpub,i is the public key of node i; E⋅ is the encryption function; and Kpri is the private key of the authoritative node.The abovementioned identity authentication process can ensure that the nodes in the network are trustworthy and cannot be disguised.


#### 3.2.3. Data Verification and Chaining

In the TDVA data structure, each transaction block contains the corresponding identity information. Except for the Ttx transaction block, the input and output of other blocks include the public key and the public key hash value, which can verify the source of the transaction block data. Only when the data in the transaction block are verified correctly, that is, the public key verification is passed, and the hash value of the transaction block is verified correctly, the transaction block can be used to generate a new block, as shown in(6)DHashTx,Kpub,i=HashTx.In the formula,D represents decryption and Tx is transaction block data.Similarly, block broadcast on the network can also be used to verify the legality of the data in the abovementioned manner.


### 3.3. Distributed Optimal Scheduling and Safety Check

#### 3.3.1. Distributed Optimized Dispatch

After the ENO node broadcasts the scheduling instructions, each node in the system evaluates the distributed power sources, energy storage devices, and aggregated loads with capacity adjustment capabilities at their locations, so as to obtain the adjustable capacity range of the node and propose the corresponding subsidy quotation. These data are broadcast to the network, and during subsequent scheduling, this quotation will be stored in the Dtx data block in the form of a digital signature. Taking into account the cost and adjustment capacity, the subsidy standard adopts the model of segmented quotation.After all nodes announce their own adjustable capacity and quotation, the system adopts distributed alternating direction method of multipliers (ADMM) to calculate the planned capacity and subsidy standards that each node needs to adjust, and similarly, the optimized result meeting the safety requirements of the check will be saved in Dtx. The optimization objectives and constraints are(7)min∑i=1nSiΔPi,TiΔPiTi,s.t.∑ΔPi=ΔPtotal,ΔPi<ΔPi,max,ΔPiTi<Wi,Δmax,where Si⋅ is the subsidy quotation of node i; ΔPi and Ti are the response capacity and duration of node i, respectively; ΔPtotal is the expected adjusted capacity of all nodes; ΔPi,max is the adjustable maximum power of node i; and Wi,Δmax is the maximum adjustable capacity of node i.


#### 3.3.2. Distributed Security Check

There are currently two schemes for the safety check of the scheduling scheme. The first is centralized verification. Market participants submit temporary transaction reached to the central management agency. The management agency calculates and compares the possible line power flow with the maximum power flow of the line according to the transaction and line parameters, and gives a result of safety check; the second is a distributed safety check system; that is, market participants perform distributed power flow calculations based on their own transactions, that is, known local line parameters, obtain the power flow of the line connected to themselves through the iteration of the entire network, and determine whether the safety inspections are satisfied [14]. The BESSVS proposes a distributed security check based on a P2P network. First, select the end nodes 1 and 2 in the network. According to the power PI and P2 that the node will inject into the power grid after the transaction, and the line parameters connected to nodes 1 and 2, the line current from node 3 to node 1 and node 2 is obtained according to(8)I˙31∗k+1=S1∗U1∗k=P1−jQ1U˙1k,(9)I˙32∗k+1=S2∗U2∗k=P2−jQ2U˙2k,where S1 and S2 are the injected power of nodes 1 and 2, respectively; Q1 and Q2 are the injected reactive power of nodes 1 and 2, respectively; U˙1 and U˙2 are the voltage phasors of nodes 1 and 2, respectively; “∗” means finding the conjugate; and k and k + 1 mean the kth and k + 1 iteration results of the corresponding variable, hereinafter the same.Send the above current information to node 3, and the current that the transformer flows to node 3 is calculated as(10)I˙03∗k+1=S3∗U˙3∗+I˙31∗k+I˙32∗k.In the formula,S3 is the injected power of node 3 and U˙3 is the voltage phasor of node 3.Node 3 transmits the voltage to node 1 and node 2, then the voltage of node 1 and node 2 can be calculated according to the following formulas:(11)U˙1∗k+1=U˙3∗k−I˙31∗kZ13,(12)U˙2∗k+1=U˙3∗k−I˙32∗kZ23.In the formula,Z13 and Z23 are the impedances between nodes 1 and 2 and between nodes 2 and 3, respectively.Repeat the above iterative process. When the node voltage and the inter-node current correction amount is less than the convergence condition, the iteration is stopped, and it is judged whether the constraint conditions shown in equations (13) and (14) are met.(13)ΔI˙=I˙k+1−I˙k<ei,(14)ΔU˙=U˙k+1−U˙k<eu,where I˙ and U˙ are the current and voltage phasors, respectively; ΔI˙ and ΔU˙ are the difference between the current and voltage phasor 2 iterations; and ei and eu are the allowable value of error of voltage and current.If the above constraints are met, the transaction will be reported to the ENO node, and the data will be recorded in the Dtx data block.


## 3.1. Data Structure and Consensus Mechanism

### 3.1.1. TDVA Block Data Structure for Distributed Storage Scheduling Events

In order to realize the immutability of data, digital currency blockchains such as Bitcoin have introduced a chain structure with blocks as the unit, as shown in Figure5(a). Take a transaction (transaction, Tx) as the basic unit, such as Tx − 1 in Figure 5(b), calculate the hash value (hash-1, hash-2, hash-3, hash-4), and then combine them in pairs into a new hash value (hash-12 and hash-34). Through this process, a Merkle root can be obtained from several transactions and recorded in the block header. And each block header contains the hash value of the previous block header. The chain structure of the block makes it impossible to change the content of a specific block without changing the hash value of the subsequent block header, thereby realizing the tamper-proof data.Figure 5
Block data structure and TDVA chain storage framework. (a) Tx storage method in the block. (b) TDVA chain storage frame. (c) TDVA storage structure generation process.
(a)(b)(c)In the BESSVS, distributed storage, scheduling, and transaction data are used in the blockchain, and its block data structure design is significantly different from transactions in the digital currency field. Expressed in digital currency, after a transaction is proposed, it is confirmed and recorded by both parties to indicate the completion of the transaction. Therefore, each transaction is independent of each other and completes in one go. For user-side resources, one-time scheduling involves a complete process, including optimization, verification, measurement, and settlement. From the scheduling requirements to the completion of settlement, multi-party interaction is required, a time scale that far exceeds digital currency transactions. Meanwhile, the performance of the Bitcoin transaction network only supports a transaction speed of 7 transactions per second. Simultaneously, it needs to generate 6 blocks to actually confirm data writing. Ethereum can only support 10–20 transactions per second, so it cannot be used as a data storage system for resource scheduling in the power system.Because the traditional transaction-based block structure cannot record all the content in the above process in a timely manner in a structure that is easy to find, a tamper-proof trusted link shall be established. Therefore, this paper designs a block data structure TDVA for storing optimal scheduling of user-side source storage resources and the whole process of transaction, consisting of 4 types of block data structures: trigger (Tx, Ttx., Vtx), dispatch (Tx, Dtx), verification (Tx, Vtx), and settlement (accounting Tx, Atx). On the one hand, it is not necessary to wait for all the data to be generated, and the data can be recorded on the chain to improve the timeliness of data storage. On the other hand, through data decoupling, the efficiency of data synchronization and verification in the system is improved, and the upper limit of processing data by the system is improved.As shown in Figure5(b), the TDVA structure is based on the basic structure of a one-way linked list, which divides the entire process of a scheduling and transaction into four links: initiating a transaction, completing a transaction, verifying a transaction, and clearing a transaction. The time span of the above links can reach several hours. Taking into account the real-time requirements of the data, the data generated by different links are merged into blocks generated at the corresponding time, and subsequent queries are efficiently conducted through the structure of the linked list.Taking the apparent power generation capacity reduction process of a VPP as an example, the data storage process is as follows.(1)
The ENO node proposes to reduce the capacity and duration, and broadcasts the event ID and related data to the entire network. The information is recorded in the Ttx data block and stored in the latest block to be generated immediately.(2)
Distributed power sources, energy storage equipment, and load aggregators with capacity adjustment capabilities, after evaluating their own adjustable capacity, broadcast their own adjustable capacity and required capacity reduction subsidies, and then perform distributed optimization calculations with multi-node participation and take Pareto optimality as the goal to obtain the planned capacity and subsidy standard that each node needs to adjust.(3)
In order to ensure that the system can still operate reliably after scheduling, after obtaining the scheduling goals of each node, the ENO node initiates a distributed security check, and the nodes jointly complete the verification of postscheduling operation status. If the reliability requirements are not met, the constraint conditions shall be added to (2) fir recalculation. If it meets the requirements, it will be confirmed by the ENO node and stored in the Dtx data block [12].(4)
After completing the scheduling, each node encapsulates and stores the relevant data (power generation reduction capacity, duration, subsidy quotation, etc.) involved in this scheduling into the Vtx data block for subsequent settlement use.(5)
According to the data in Vtx, the power transaction is cleared and settled, and the settlement data are stored in the Atx data block. Meanwhile, all transaction IDs involved in the process are recorded to facilitate subsequent accounting and verification of this transaction.The abovementioned four types of block data structures include not only the electricity transaction data stored according to the design, but also the link information before and after the dispatch. The data in a complete dispatch cycle are linked to each other in the form of a linked list and stored in different blocks. The chain structure is used to prevent data tampering.As shown in Figure5(c), when an event that triggers a transaction occurs in the system (e.g., the node sends out a high-voltage event alarm, or the ENO node receives an upper-level system scheduling instruction to adjust virtual capacity), the ENO node will issue the instruction while generating the Ttx data block. After each node on the system receives the instruction and completes the three steps of subsidy quotation, distributed optimization, and distributed security check, the node where scheduling occurs packs the relevant data to generate the Dtx data block, under the supervision of the ENO node, the data block completes the scheduling, under ENO node it generates the Vtx data block, and the Atx data block is finally generated during the settlement between the nodes. The TDVA data block under the same process is essentially stored in the newly generated block after the data block is generated, and is linked by a linked list structure, that is, the storage structure shown in Figure 5(c).


### 3.1.2. Consensus Mechanism Based on Node Power Generation

In traditional blockchain applications, the consensus mechanism is designed to ensure the distributed consistency of data. It is based on the assumption that nodes that contribute more to the network tend to maintain the interests of the network, and therefore, larger power is granted to these nodes for maintaining the normal operation of the network [13]. In the PoW mechanism, it mainly relies on computing power competition to achieve distributed consistency, as shown in(1)HashNH<T,where Hash⋅ is the SHA256 hash function; N is a self-increasing random value (Nonce); H is other data except N in the block header (Header); and || represents the link of the data; T is the difficulty target. The smaller the T, the more difficult it is to find the N value that meets the conditions.Obviously investing more computing power can enable nodes to occupy an advantageous position in the fight for block generation rights, but in the meanwhile, it will also bring about a huge waste of computing power and a huge consumption of energy. The total power consumption of Bitcoin in 2019 is 73.12 TW·h, and the average power consumption of a single transaction is 623.47 kW·h. In order to solve the shortcomings of the PoW mechanism’s low efficiency and energy consumption, the PoS mechanism appeared, and the solution of the problem was converted to calculating the value ofN that satisfies the following formula.(2)HashNH<St.In the formula,S and t, respectively, represent the equity (digital currency amount) and time held by the node. In some applications, a certain amount of digital currency is locked for a period of time to represent the shares held by the node. The more equity a node holds, the greater the probability of finding a suitable value of N, which makes it easier to obtain the power to generate new blocks.In PoS, equity is used to characterize the weight of a node’s contribution to the network. There is a natural physical quantity in the power system, that is, the node’s power generation or electricity consumption, which can objectively represent the node’s influence and contribution to the entire network. Therefore, a consensus mechanism PoE is proposed based on node power consumption; that is, each node obtains the accounting right through the calculation formula.(3)HashNH<αPGi+βPLi,where α and β are adjustment coefficients; PGi is the power generation of node i in the past week; and PLi is the power consumption of node i in the past week. α and β satisfy(4)γα∑i=1nPGi+β∑i=1nPLi=6Hash,max.In the formula,γ is the maximum number of times that a single node can calculate in a block generation process; Hash,max is the maximum hash value that can be calculated; and n is the number of nodes. See the derivation process of equation.Based on the random distribution characteristics of the calculation results of the information digest algorithm, it can be proved that in probability, the contention for the accounting right can be completed within a limited number of times usingα and β in accordance with formula (4) as the calculation difficulty coefficient, avoiding the heavy dependence on computing power when using the PoW mechanism, which enables the system designed in this article to run on low-power IoT devices while still ensuring the consistency of data on the chain.In summary, with the calculation goal constructed by formulas (3) and (4) as the core, the consensus mechanism PoE proposed in the article has the following characteristics.(1)
In the specified time interval, there must be nodes that can obtain the right to generate new blocks according to the rules.(2)
Making full use of the physical information of the system (node’s power generation and power consumption) as input conditions, the consensus mechanism is realized with low cost and low power consumption.(3)
The operating system has very low requirements for computing power, and it can run smoothly on low-power devices.


## 3.1.1. TDVA Block Data Structure for Distributed Storage Scheduling Events

In order to realize the immutability of data, digital currency blockchains such as Bitcoin have introduced a chain structure with blocks as the unit, as shown in Figure5(a). Take a transaction (transaction, Tx) as the basic unit, such as Tx − 1 in Figure 5(b), calculate the hash value (hash-1, hash-2, hash-3, hash-4), and then combine them in pairs into a new hash value (hash-12 and hash-34). Through this process, a Merkle root can be obtained from several transactions and recorded in the block header. And each block header contains the hash value of the previous block header. The chain structure of the block makes it impossible to change the content of a specific block without changing the hash value of the subsequent block header, thereby realizing the tamper-proof data.Figure 5
Block data structure and TDVA chain storage framework. (a) Tx storage method in the block. (b) TDVA chain storage frame. (c) TDVA storage structure generation process.
(a)(b)(c)In the BESSVS, distributed storage, scheduling, and transaction data are used in the blockchain, and its block data structure design is significantly different from transactions in the digital currency field. Expressed in digital currency, after a transaction is proposed, it is confirmed and recorded by both parties to indicate the completion of the transaction. Therefore, each transaction is independent of each other and completes in one go. For user-side resources, one-time scheduling involves a complete process, including optimization, verification, measurement, and settlement. From the scheduling requirements to the completion of settlement, multi-party interaction is required, a time scale that far exceeds digital currency transactions. Meanwhile, the performance of the Bitcoin transaction network only supports a transaction speed of 7 transactions per second. Simultaneously, it needs to generate 6 blocks to actually confirm data writing. Ethereum can only support 10–20 transactions per second, so it cannot be used as a data storage system for resource scheduling in the power system.Because the traditional transaction-based block structure cannot record all the content in the above process in a timely manner in a structure that is easy to find, a tamper-proof trusted link shall be established. Therefore, this paper designs a block data structure TDVA for storing optimal scheduling of user-side source storage resources and the whole process of transaction, consisting of 4 types of block data structures: trigger (Tx, Ttx., Vtx), dispatch (Tx, Dtx), verification (Tx, Vtx), and settlement (accounting Tx, Atx). On the one hand, it is not necessary to wait for all the data to be generated, and the data can be recorded on the chain to improve the timeliness of data storage. On the other hand, through data decoupling, the efficiency of data synchronization and verification in the system is improved, and the upper limit of processing data by the system is improved.As shown in Figure5(b), the TDVA structure is based on the basic structure of a one-way linked list, which divides the entire process of a scheduling and transaction into four links: initiating a transaction, completing a transaction, verifying a transaction, and clearing a transaction. The time span of the above links can reach several hours. Taking into account the real-time requirements of the data, the data generated by different links are merged into blocks generated at the corresponding time, and subsequent queries are efficiently conducted through the structure of the linked list.Taking the apparent power generation capacity reduction process of a VPP as an example, the data storage process is as follows.(1)
The ENO node proposes to reduce the capacity and duration, and broadcasts the event ID and related data to the entire network. The information is recorded in the Ttx data block and stored in the latest block to be generated immediately.(2)
Distributed power sources, energy storage equipment, and load aggregators with capacity adjustment capabilities, after evaluating their own adjustable capacity, broadcast their own adjustable capacity and required capacity reduction subsidies, and then perform distributed optimization calculations with multi-node participation and take Pareto optimality as the goal to obtain the planned capacity and subsidy standard that each node needs to adjust.(3)
In order to ensure that the system can still operate reliably after scheduling, after obtaining the scheduling goals of each node, the ENO node initiates a distributed security check, and the nodes jointly complete the verification of postscheduling operation status. If the reliability requirements are not met, the constraint conditions shall be added to (2) fir recalculation. If it meets the requirements, it will be confirmed by the ENO node and stored in the Dtx data block [12].(4)
After completing the scheduling, each node encapsulates and stores the relevant data (power generation reduction capacity, duration, subsidy quotation, etc.) involved in this scheduling into the Vtx data block for subsequent settlement use.(5)
According to the data in Vtx, the power transaction is cleared and settled, and the settlement data are stored in the Atx data block. Meanwhile, all transaction IDs involved in the process are recorded to facilitate subsequent accounting and verification of this transaction.The abovementioned four types of block data structures include not only the electricity transaction data stored according to the design, but also the link information before and after the dispatch. The data in a complete dispatch cycle are linked to each other in the form of a linked list and stored in different blocks. The chain structure is used to prevent data tampering.As shown in Figure5(c), when an event that triggers a transaction occurs in the system (e.g., the node sends out a high-voltage event alarm, or the ENO node receives an upper-level system scheduling instruction to adjust virtual capacity), the ENO node will issue the instruction while generating the Ttx data block. After each node on the system receives the instruction and completes the three steps of subsidy quotation, distributed optimization, and distributed security check, the node where scheduling occurs packs the relevant data to generate the Dtx data block, under the supervision of the ENO node, the data block completes the scheduling, under ENO node it generates the Vtx data block, and the Atx data block is finally generated during the settlement between the nodes. The TDVA data block under the same process is essentially stored in the newly generated block after the data block is generated, and is linked by a linked list structure, that is, the storage structure shown in Figure 5(c).


## 3.1.2. Consensus Mechanism Based on Node Power Generation

In traditional blockchain applications, the consensus mechanism is designed to ensure the distributed consistency of data. It is based on the assumption that nodes that contribute more to the network tend to maintain the interests of the network, and therefore, larger power is granted to these nodes for maintaining the normal operation of the network [13]. In the PoW mechanism, it mainly relies on computing power competition to achieve distributed consistency, as shown in(1)HashNH<T,where Hash⋅ is the SHA256 hash function; N is a self-increasing random value (Nonce); H is other data except N in the block header (Header); and || represents the link of the data; T is the difficulty target. The smaller the T, the more difficult it is to find the N value that meets the conditions.Obviously investing more computing power can enable nodes to occupy an advantageous position in the fight for block generation rights, but in the meanwhile, it will also bring about a huge waste of computing power and a huge consumption of energy. The total power consumption of Bitcoin in 2019 is 73.12 TW·h, and the average power consumption of a single transaction is 623.47 kW·h. In order to solve the shortcomings of the PoW mechanism’s low efficiency and energy consumption, the PoS mechanism appeared, and the solution of the problem was converted to calculating the value ofN that satisfies the following formula.(2)HashNH<St.In the formula,S and t, respectively, represent the equity (digital currency amount) and time held by the node. In some applications, a certain amount of digital currency is locked for a period of time to represent the shares held by the node. The more equity a node holds, the greater the probability of finding a suitable value of N, which makes it easier to obtain the power to generate new blocks.In PoS, equity is used to characterize the weight of a node’s contribution to the network. There is a natural physical quantity in the power system, that is, the node’s power generation or electricity consumption, which can objectively represent the node’s influence and contribution to the entire network. Therefore, a consensus mechanism PoE is proposed based on node power consumption; that is, each node obtains the accounting right through the calculation formula.(3)HashNH<αPGi+βPLi,where α and β are adjustment coefficients; PGi is the power generation of node i in the past week; and PLi is the power consumption of node i in the past week. α and β satisfy(4)γα∑i=1nPGi+β∑i=1nPLi=6Hash,max.In the formula,γ is the maximum number of times that a single node can calculate in a block generation process; Hash,max is the maximum hash value that can be calculated; and n is the number of nodes. See the derivation process of equation.Based on the random distribution characteristics of the calculation results of the information digest algorithm, it can be proved that in probability, the contention for the accounting right can be completed within a limited number of times usingα and β in accordance with formula (4) as the calculation difficulty coefficient, avoiding the heavy dependence on computing power when using the PoW mechanism, which enables the system designed in this article to run on low-power IoT devices while still ensuring the consistency of data on the chain.In summary, with the calculation goal constructed by formulas (3) and (4) as the core, the consensus mechanism PoE proposed in the article has the following characteristics.(1)
In the specified time interval, there must be nodes that can obtain the right to generate new blocks according to the rules.(2)
Making full use of the physical information of the system (node’s power generation and power consumption) as input conditions, the consensus mechanism is realized with low cost and low power consumption.(3)
The operating system has very low requirements for computing power, and it can run smoothly on low-power devices.


## 3.2. Data Security

### 3.2.1. Generation of Data Address

In a multi-entity network, identity authentication and data security interaction are also key elements of system design. With reference to the blockchain, the BESSVS is designed with a data address corresponding to the identity of the node. First generate a random private key, then calculate the public key through the elliptic curve encryption algorithm, and obtain the hash value of the public key through the hash algorithm. The above two steps are computationally irreversible. After adding the version number and check value before and after hashing the public key, and encoding with Base58, the data address is obtained.


### 3.2.2. Identity Authentication of Node

After encrypting a node with a unique private key, it can only be decrypted using the corresponding public key. After the node publishes the public key and address, other nodes can verify whether the node corresponds to the data address, and the information sent by the node can be verified by other nodes that have published the public key, because only the node holds the private key. Therefore, if the public key can be used to verify the information, the source of the information is authenticated, thereby realizing the identity authentication of the node.In the BESSVS, the node is bound to the data address, and the private key of the corresponding node is not randomly generated, but a key pair is generated by an authoritative center, the public key is disclosed in the form of a digital certificate, and the private key is distributed to node; the structure of the digital certificate is shown in formula.(5)Id,iKpub,iEHashId,iKpub,i,Kpri,where Id,i is the identity of node i; Kpub,i is the public key of node i; E⋅ is the encryption function; and Kpri is the private key of the authoritative node.The abovementioned identity authentication process can ensure that the nodes in the network are trustworthy and cannot be disguised.


### 3.2.3. Data Verification and Chaining

In the TDVA data structure, each transaction block contains the corresponding identity information. Except for the Ttx transaction block, the input and output of other blocks include the public key and the public key hash value, which can verify the source of the transaction block data. Only when the data in the transaction block are verified correctly, that is, the public key verification is passed, and the hash value of the transaction block is verified correctly, the transaction block can be used to generate a new block, as shown in(6)DHashTx,Kpub,i=HashTx.In the formula,D represents decryption and Tx is transaction block data.Similarly, block broadcast on the network can also be used to verify the legality of the data in the abovementioned manner.


## 3.2.1. Generation of Data Address

In a multi-entity network, identity authentication and data security interaction are also key elements of system design. With reference to the blockchain, the BESSVS is designed with a data address corresponding to the identity of the node. First generate a random private key, then calculate the public key through the elliptic curve encryption algorithm, and obtain the hash value of the public key through the hash algorithm. The above two steps are computationally irreversible. After adding the version number and check value before and after hashing the public key, and encoding with Base58, the data address is obtained.


## 3.2.2. Identity Authentication of Node

After encrypting a node with a unique private key, it can only be decrypted using the corresponding public key. After the node publishes the public key and address, other nodes can verify whether the node corresponds to the data address, and the information sent by the node can be verified by other nodes that have published the public key, because only the node holds the private key. Therefore, if the public key can be used to verify the information, the source of the information is authenticated, thereby realizing the identity authentication of the node.In the BESSVS, the node is bound to the data address, and the private key of the corresponding node is not randomly generated, but a key pair is generated by an authoritative center, the public key is disclosed in the form of a digital certificate, and the private key is distributed to node; the structure of the digital certificate is shown in formula.(5)Id,iKpub,iEHashId,iKpub,i,Kpri,where Id,i is the identity of node i; Kpub,i is the public key of node i; E⋅ is the encryption function; and Kpri is the private key of the authoritative node.The abovementioned identity authentication process can ensure that the nodes in the network are trustworthy and cannot be disguised.


## 3.2.3. Data Verification and Chaining

In the TDVA data structure, each transaction block contains the corresponding identity information. Except for the Ttx transaction block, the input and output of other blocks include the public key and the public key hash value, which can verify the source of the transaction block data. Only when the data in the transaction block are verified correctly, that is, the public key verification is passed, and the hash value of the transaction block is verified correctly, the transaction block can be used to generate a new block, as shown in(6)DHashTx,Kpub,i=HashTx.In the formula,D represents decryption and Tx is transaction block data.Similarly, block broadcast on the network can also be used to verify the legality of the data in the abovementioned manner.


## 3.3. Distributed Optimal Scheduling and Safety Check

### 3.3.1. Distributed Optimized Dispatch

After the ENO node broadcasts the scheduling instructions, each node in the system evaluates the distributed power sources, energy storage devices, and aggregated loads with capacity adjustment capabilities at their locations, so as to obtain the adjustable capacity range of the node and propose the corresponding subsidy quotation. These data are broadcast to the network, and during subsequent scheduling, this quotation will be stored in the Dtx data block in the form of a digital signature. Taking into account the cost and adjustment capacity, the subsidy standard adopts the model of segmented quotation.After all nodes announce their own adjustable capacity and quotation, the system adopts distributed alternating direction method of multipliers (ADMM) to calculate the planned capacity and subsidy standards that each node needs to adjust, and similarly, the optimized result meeting the safety requirements of the check will be saved in Dtx. The optimization objectives and constraints are(7)min∑i=1nSiΔPi,TiΔPiTi,s.t.∑ΔPi=ΔPtotal,ΔPi<ΔPi,max,ΔPiTi<Wi,Δmax,where Si⋅ is the subsidy quotation of node i; ΔPi and Ti are the response capacity and duration of node i, respectively; ΔPtotal is the expected adjusted capacity of all nodes; ΔPi,max is the adjustable maximum power of node i; and Wi,Δmax is the maximum adjustable capacity of node i.


### 3.3.2. Distributed Security Check

There are currently two schemes for the safety check of the scheduling scheme. The first is centralized verification. Market participants submit temporary transaction reached to the central management agency. The management agency calculates and compares the possible line power flow with the maximum power flow of the line according to the transaction and line parameters, and gives a result of safety check; the second is a distributed safety check system; that is, market participants perform distributed power flow calculations based on their own transactions, that is, known local line parameters, obtain the power flow of the line connected to themselves through the iteration of the entire network, and determine whether the safety inspections are satisfied [14]. The BESSVS proposes a distributed security check based on a P2P network. First, select the end nodes 1 and 2 in the network. According to the power PI and P2 that the node will inject into the power grid after the transaction, and the line parameters connected to nodes 1 and 2, the line current from node 3 to node 1 and node 2 is obtained according to(8)I˙31∗k+1=S1∗U1∗k=P1−jQ1U˙1k,(9)I˙32∗k+1=S2∗U2∗k=P2−jQ2U˙2k,where S1 and S2 are the injected power of nodes 1 and 2, respectively; Q1 and Q2 are the injected reactive power of nodes 1 and 2, respectively; U˙1 and U˙2 are the voltage phasors of nodes 1 and 2, respectively; “∗” means finding the conjugate; and k and k + 1 mean the kth and k + 1 iteration results of the corresponding variable, hereinafter the same.Send the above current information to node 3, and the current that the transformer flows to node 3 is calculated as(10)I˙03∗k+1=S3∗U˙3∗+I˙31∗k+I˙32∗k.In the formula,S3 is the injected power of node 3 and U˙3 is the voltage phasor of node 3.Node 3 transmits the voltage to node 1 and node 2, then the voltage of node 1 and node 2 can be calculated according to the following formulas:(11)U˙1∗k+1=U˙3∗k−I˙31∗kZ13,(12)U˙2∗k+1=U˙3∗k−I˙32∗kZ23.In the formula,Z13 and Z23 are the impedances between nodes 1 and 2 and between nodes 2 and 3, respectively.Repeat the above iterative process. When the node voltage and the inter-node current correction amount is less than the convergence condition, the iteration is stopped, and it is judged whether the constraint conditions shown in equations (13) and (14) are met.(13)ΔI˙=I˙k+1−I˙k<ei,(14)ΔU˙=U˙k+1−U˙k<eu,where I˙ and U˙ are the current and voltage phasors, respectively; ΔI˙ and ΔU˙ are the difference between the current and voltage phasor 2 iterations; and ei and eu are the allowable value of error of voltage and current.If the above constraints are met, the transaction will be reported to the ENO node, and the data will be recorded in the Dtx data block.


## 3.3.1. Distributed Optimized Dispatch

After the ENO node broadcasts the scheduling instructions, each node in the system evaluates the distributed power sources, energy storage devices, and aggregated loads with capacity adjustment capabilities at their locations, so as to obtain the adjustable capacity range of the node and propose the corresponding subsidy quotation. These data are broadcast to the network, and during subsequent scheduling, this quotation will be stored in the Dtx data block in the form of a digital signature. Taking into account the cost and adjustment capacity, the subsidy standard adopts the model of segmented quotation.After all nodes announce their own adjustable capacity and quotation, the system adopts distributed alternating direction method of multipliers (ADMM) to calculate the planned capacity and subsidy standards that each node needs to adjust, and similarly, the optimized result meeting the safety requirements of the check will be saved in Dtx. The optimization objectives and constraints are(7)min∑i=1nSiΔPi,TiΔPiTi,s.t.∑ΔPi=ΔPtotal,ΔPi<ΔPi,max,ΔPiTi<Wi,Δmax,where Si⋅ is the subsidy quotation of node i; ΔPi and Ti are the response capacity and duration of node i, respectively; ΔPtotal is the expected adjusted capacity of all nodes; ΔPi,max is the adjustable maximum power of node i; and Wi,Δmax is the maximum adjustable capacity of node i.


## 3.3.2. Distributed Security Check

There are currently two schemes for the safety check of the scheduling scheme. The first is centralized verification. Market participants submit temporary transaction reached to the central management agency. The management agency calculates and compares the possible line power flow with the maximum power flow of the line according to the transaction and line parameters, and gives a result of safety check; the second is a distributed safety check system; that is, market participants perform distributed power flow calculations based on their own transactions, that is, known local line parameters, obtain the power flow of the line connected to themselves through the iteration of the entire network, and determine whether the safety inspections are satisfied [14]. The BESSVS proposes a distributed security check based on a P2P network. First, select the end nodes 1 and 2 in the network. According to the power PI and P2 that the node will inject into the power grid after the transaction, and the line parameters connected to nodes 1 and 2, the line current from node 3 to node 1 and node 2 is obtained according to(8)I˙31∗k+1=S1∗U1∗k=P1−jQ1U˙1k,(9)I˙32∗k+1=S2∗U2∗k=P2−jQ2U˙2k,where S1 and S2 are the injected power of nodes 1 and 2, respectively; Q1 and Q2 are the injected reactive power of nodes 1 and 2, respectively; U˙1 and U˙2 are the voltage phasors of nodes 1 and 2, respectively; “∗” means finding the conjugate; and k and k + 1 mean the kth and k + 1 iteration results of the corresponding variable, hereinafter the same.Send the above current information to node 3, and the current that the transformer flows to node 3 is calculated as(10)I˙03∗k+1=S3∗U˙3∗+I˙31∗k+I˙32∗k.In the formula,S3 is the injected power of node 3 and U˙3 is the voltage phasor of node 3.Node 3 transmits the voltage to node 1 and node 2, then the voltage of node 1 and node 2 can be calculated according to the following formulas:(11)U˙1∗k+1=U˙3∗k−I˙31∗kZ13,(12)U˙2∗k+1=U˙3∗k−I˙32∗kZ23.In the formula,Z13 and Z23 are the impedances between nodes 1 and 2 and between nodes 2 and 3, respectively.Repeat the above iterative process. When the node voltage and the inter-node current correction amount is less than the convergence condition, the iteration is stopped, and it is judged whether the constraint conditions shown in equations (13) and (14) are met.(13)ΔI˙=I˙k+1−I˙k<ei,(14)ΔU˙=U˙k+1−U˙k<eu,where I˙ and U˙ are the current and voltage phasors, respectively; ΔI˙ and ΔU˙ are the difference between the current and voltage phasor 2 iterations; and ei and eu are the allowable value of error of voltage and current.If the above constraints are met, the transaction will be reported to the ENO node, and the data will be recorded in the Dtx data block.


## 4. Analysis of Examples and Results

Take the 6-node distribution network connected to the power grid as an example to verify the effectiveness of the VPP internal dispatching of the system proposed in this paper. The topology is shown in Figure6(a).Figure 6
The topology and simulation results of the calculation example. (a) Example network topology, (b) node power generation curve, (c) nodal load curve.
(a)(b)(c)In the figure, nodes 1, 2, 5, and 6 contain distributed power sources and loads, nodes 3 and 4 only contain loads, and node 1 is connected to the grid. The power generation curve of distributed power sources connected to nodes 1, 2, 5, and 6 before adjustment is shown in Figure6(b), and the loads connected to nodes 1 to 6 are shown in Figure 6(c).


### 4.1. Simulation Result

Simulation results before and after adjustment are shown in Figure7. In the absence of coordinated control, because the power generation of node 6 is too large, an overvoltage situation will occur, as shown in Figure 7(a).Figure 7
Simulation results before and after adjustment. (a) Unregulated node voltage curve, (b) node power generation curve after regulation, (c) node voltage curve after regulation.
(a)(b)(c)Perform intra-domain control according to the scheduling method proposed in the article. When node 6 detects an overvoltage event, the ENO node is notified, and the ENO node proposes a scheduling instruction, which is recorded in the Ttx data block. Each node in the network undergoes quotation, distributed optimization, and distributed safety check; the power generation plan shown in Figure7(b) is generated and recorded in the Dtx data block. The execution plan is supervised by the ENO node, the execution is recorded in the Vtx data block, and the final settlement is recorded in the Atx data block via the smart contract by the involved nodes. The adjusted voltage curve is shown in Figure 7(c).


### 4.2. Security and Performance Analysis

#### 4.2.1. Security Analysis

Anti-data tampering: In the BESSVS, the basis for ensuring data security is the hash algorithm and chain storage structure. Assuming an attack on themth last block on the chain, it is necessary to find the synonymous data expression of the tampered data, that is, to satisfy the(15)HashBlock,m′=HashBlock,m′,where Block,m is the tampered block data and Block,m is the original block data.Equation (15) describes the weak collision resistance of the hash function. By choosing a hash function with a longer output and higher security (such as SHA-256), even a relatively effective birthday attack or differential attack can be effectively defended.In addition, if you want to change the data of a block and pass the verification, you can only unite more than 51% of the nodes in the network, start from the tampered data, and recalculate all the block hash values generated thereafter. Obviously, this kind of attack is more difficult to achieve.Node identity authentication: The security and authenticity of identity authentication depend on the security of asymmetric encryption algorithms. The elliptic curve encryption algorithm is used in the BESSVS for encryption. As described, the public key of the node is disclosed by the authoritative node in the form of a digital certificate. Since only the authoritative node holds the private keyKpri, if the above content is verified with the public key of the authoritative node, it can be determined that the public key of node i is Kpub,i, and only node i holds the private key Kpri,i, and if the public key of node i is used to verify the data, it can be guaranteed that the data must come from node i. In this process, the asymmetric encryption algorithm provides two guarantees: one is the corresponding relationships between public and private keys, and the other is that the private key cannot be obtained through the public key, plaintext, and ciphertext.Similarly, the security of asymmetric encryption algorithms is directly related to the length of the key. A key pair of sufficient length is selected to ensure the security and authenticity of identity authentication.


#### 4.2.2. Performance Analysis

At different stages of the transaction, corresponding transaction records Tx will be generated in real time and broadcast to the entire network. At this level, transaction records are real time, but there is a time interval for packaging transactions to generate blocks. In the BESSVS, a block is formed every 15 minutes, so it takes a certain time for the data to be completely protected. The formation sequence of Tx and the block is shown in Figure8(a). 15 min is a relatively common data collection interval in power systems. Blocks are generated at 15-min intervals, which can ensure that too much system computing power will not be occupied due to frequent block generation, thereby reducing system operating costs while taking into account the requirement of storage reliability for scheduling data.Figure 8
Transaction generation process and verification efficiency. (a) Sequence chart from Tx generation to storing in block. (b) Integrity check time for block data.
(a)(b)The TDVA data structure is a key node record for resource scheduling. Since the complete process of a scheduling may span a long time, it cannot guarantee that the complete TDVA data will be generated within 15 minutes. The 4 parts of TDVA are allowed to be stored in different blocks independently and are linked according to the pointers. In the meantime, the TDVA structure only records the negotiation results of each link instead of the negotiation process. As long as the negotiation results of triggering, scheduling, verification, and settlement are generated, the corresponding transaction data block can be generated and recorded in the upcoming area.Data verification (anti-tampering) can be performed by the node itself, and its main steps are to perform hash calculation and verify the digital signature according to the public key [15]. Verifying the data of a transaction in the block requires calculating the hash value of the transaction, as well as calculating the Merkle root according to the structure of the Merkle tree. To verify 1 transaction and all transactions in a block, the relationship between the required single average time and the total number of transactions in the block is shown in Figure 8(b). There is a linear relationship between time required to verify all transactions in a block and the number of transactions in the block, and there is a logarithmic relationship between the time required to verify a transaction and the number of transactions in the block.


## 4.1. Simulation Result

Simulation results before and after adjustment are shown in Figure7. In the absence of coordinated control, because the power generation of node 6 is too large, an overvoltage situation will occur, as shown in Figure 7(a).Figure 7
Simulation results before and after adjustment. (a) Unregulated node voltage curve, (b) node power generation curve after regulation, (c) node voltage curve after regulation.
(a)(b)(c)Perform intra-domain control according to the scheduling method proposed in the article. When node 6 detects an overvoltage event, the ENO node is notified, and the ENO node proposes a scheduling instruction, which is recorded in the Ttx data block. Each node in the network undergoes quotation, distributed optimization, and distributed safety check; the power generation plan shown in Figure7(b) is generated and recorded in the Dtx data block. The execution plan is supervised by the ENO node, the execution is recorded in the Vtx data block, and the final settlement is recorded in the Atx data block via the smart contract by the involved nodes. The adjusted voltage curve is shown in Figure 7(c).


## 4.2. Security and Performance Analysis

### 4.2.1. Security Analysis

Anti-data tampering: In the BESSVS, the basis for ensuring data security is the hash algorithm and chain storage structure. Assuming an attack on themth last block on the chain, it is necessary to find the synonymous data expression of the tampered data, that is, to satisfy the(15)HashBlock,m′=HashBlock,m′,where Block,m is the tampered block data and Block,m is the original block data.Equation (15) describes the weak collision resistance of the hash function. By choosing a hash function with a longer output and higher security (such as SHA-256), even a relatively effective birthday attack or differential attack can be effectively defended.In addition, if you want to change the data of a block and pass the verification, you can only unite more than 51% of the nodes in the network, start from the tampered data, and recalculate all the block hash values generated thereafter. Obviously, this kind of attack is more difficult to achieve.Node identity authentication: The security and authenticity of identity authentication depend on the security of asymmetric encryption algorithms. The elliptic curve encryption algorithm is used in the BESSVS for encryption. As described, the public key of the node is disclosed by the authoritative node in the form of a digital certificate. Since only the authoritative node holds the private keyKpri, if the above content is verified with the public key of the authoritative node, it can be determined that the public key of node i is Kpub,i, and only node i holds the private key Kpri,i, and if the public key of node i is used to verify the data, it can be guaranteed that the data must come from node i. In this process, the asymmetric encryption algorithm provides two guarantees: one is the corresponding relationships between public and private keys, and the other is that the private key cannot be obtained through the public key, plaintext, and ciphertext.Similarly, the security of asymmetric encryption algorithms is directly related to the length of the key. A key pair of sufficient length is selected to ensure the security and authenticity of identity authentication.


### 4.2.2. Performance Analysis

At different stages of the transaction, corresponding transaction records Tx will be generated in real time and broadcast to the entire network. At this level, transaction records are real time, but there is a time interval for packaging transactions to generate blocks. In the BESSVS, a block is formed every 15 minutes, so it takes a certain time for the data to be completely protected. The formation sequence of Tx and the block is shown in Figure8(a). 15 min is a relatively common data collection interval in power systems. Blocks are generated at 15-min intervals, which can ensure that too much system computing power will not be occupied due to frequent block generation, thereby reducing system operating costs while taking into account the requirement of storage reliability for scheduling data.Figure 8
Transaction generation process and verification efficiency. (a) Sequence chart from Tx generation to storing in block. (b) Integrity check time for block data.
(a)(b)The TDVA data structure is a key node record for resource scheduling. Since the complete process of a scheduling may span a long time, it cannot guarantee that the complete TDVA data will be generated within 15 minutes. The 4 parts of TDVA are allowed to be stored in different blocks independently and are linked according to the pointers. In the meantime, the TDVA structure only records the negotiation results of each link instead of the negotiation process. As long as the negotiation results of triggering, scheduling, verification, and settlement are generated, the corresponding transaction data block can be generated and recorded in the upcoming area.Data verification (anti-tampering) can be performed by the node itself, and its main steps are to perform hash calculation and verify the digital signature according to the public key [15]. Verifying the data of a transaction in the block requires calculating the hash value of the transaction, as well as calculating the Merkle root according to the structure of the Merkle tree. To verify 1 transaction and all transactions in a block, the relationship between the required single average time and the total number of transactions in the block is shown in Figure 8(b). There is a linear relationship between time required to verify all transactions in a block and the number of transactions in the block, and there is a logarithmic relationship between the time required to verify a transaction and the number of transactions in the block.


## 4.2.1. Security Analysis

Anti-data tampering: In the BESSVS, the basis for ensuring data security is the hash algorithm and chain storage structure. Assuming an attack on themth last block on the chain, it is necessary to find the synonymous data expression of the tampered data, that is, to satisfy the(15)HashBlock,m′=HashBlock,m′,where Block,m is the tampered block data and Block,m is the original block data.Equation (15) describes the weak collision resistance of the hash function. By choosing a hash function with a longer output and higher security (such as SHA-256), even a relatively effective birthday attack or differential attack can be effectively defended.In addition, if you want to change the data of a block and pass the verification, you can only unite more than 51% of the nodes in the network, start from the tampered data, and recalculate all the block hash values generated thereafter. Obviously, this kind of attack is more difficult to achieve.Node identity authentication: The security and authenticity of identity authentication depend on the security of asymmetric encryption algorithms. The elliptic curve encryption algorithm is used in the BESSVS for encryption. As described, the public key of the node is disclosed by the authoritative node in the form of a digital certificate. Since only the authoritative node holds the private keyKpri, if the above content is verified with the public key of the authoritative node, it can be determined that the public key of node i is Kpub,i, and only node i holds the private key Kpri,i, and if the public key of node i is used to verify the data, it can be guaranteed that the data must come from node i. In this process, the asymmetric encryption algorithm provides two guarantees: one is the corresponding relationships between public and private keys, and the other is that the private key cannot be obtained through the public key, plaintext, and ciphertext.Similarly, the security of asymmetric encryption algorithms is directly related to the length of the key. A key pair of sufficient length is selected to ensure the security and authenticity of identity authentication.


## 4.2.2. Performance Analysis

At different stages of the transaction, corresponding transaction records Tx will be generated in real time and broadcast to the entire network. At this level, transaction records are real time, but there is a time interval for packaging transactions to generate blocks. In the BESSVS, a block is formed every 15 minutes, so it takes a certain time for the data to be completely protected. The formation sequence of Tx and the block is shown in Figure8(a). 15 min is a relatively common data collection interval in power systems. Blocks are generated at 15-min intervals, which can ensure that too much system computing power will not be occupied due to frequent block generation, thereby reducing system operating costs while taking into account the requirement of storage reliability for scheduling data.Figure 8
Transaction generation process and verification efficiency. (a) Sequence chart from Tx generation to storing in block. (b) Integrity check time for block data.
(a)(b)The TDVA data structure is a key node record for resource scheduling. Since the complete process of a scheduling may span a long time, it cannot guarantee that the complete TDVA data will be generated within 15 minutes. The 4 parts of TDVA are allowed to be stored in different blocks independently and are linked according to the pointers. In the meantime, the TDVA structure only records the negotiation results of each link instead of the negotiation process. As long as the negotiation results of triggering, scheduling, verification, and settlement are generated, the corresponding transaction data block can be generated and recorded in the upcoming area.Data verification (anti-tampering) can be performed by the node itself, and its main steps are to perform hash calculation and verify the digital signature according to the public key [15]. Verifying the data of a transaction in the block requires calculating the hash value of the transaction, as well as calculating the Merkle root according to the structure of the Merkle tree. To verify 1 transaction and all transactions in a block, the relationship between the required single average time and the total number of transactions in the block is shown in Figure 8(b). There is a linear relationship between time required to verify all transactions in a block and the number of transactions in the block, and there is a logarithmic relationship between the time required to verify a transaction and the number of transactions in the block.


## 5. Conclusion

In view of the fact that the logarithmic problems of renewable energy and load energy storage are exposed in the existing blockchain energy storage scheduling visualization process, this paper proposes a blockchain energy storage scheduling visualization system based on the optimal scheduling of user-side source storage resources. On the basis of this, combining energy storage with the user side, on the premises of the unbalanced load of the blockchain energy storage, the purpose of controllable distributed power fluctuations is realized by suspending noncritical loads. Finally, an example analysis shows that the system can complete the effective scheduling of energy storage and can also better ensure the safety of data information, data integrity, and information transparency.



---

*Source: 8369121-2022-06-28.xml*