Electric Power System Operation Mechanism with Energy Routers Based on QoS Index under Blockchain Architecture

: With the integration of highly permeable renewable energy to the grid at di ﬀ erent levels (transmission, distribution and grid-connected), the volatility on both sides (source side and load side) leading to bidirectional power ﬂow in the power grid complicates the control mechanism. In order to ensure the real-time power balance, energy exchange, higher energy utilization e ﬃ ciency and stability maintenance in the electric power system, this paper proposes an integrated application of blockchain technology on energy routers at transmission and distribution networks with increased renewable energy penetration. This paper focuses on the safe and stable operation of a highly penetrated renewable energy grid-connected power system and its operation. It also demonstrates a blockchain-based negotiation model with weakly centralized scenarios for “source-network-load” collaborative scheduling operations; secondly, the QoS (quality of service) index of energy ﬂow control and energy router node doubly-fed stability control model were designed. Further, it also introduces the MOPSO (multi-objective particle swarm optimization) algorithm for power output optimization of multienergy power generation; Thirdly, based on the blockchain underlying architecture and load prediction value constraints, this paper puts forward the optimization mechanism and control ﬂow of autonomous energy coordination of b2u (bottom-up) between router nodes of transmission and distribution network based on blockchain.


Introduction
Extensively distributed renewable energy is well-known for its diverse advantages, such as its wide availability and clean power, which adjures human society to switch the existing energy structure in order to set up a clean, efficient, safe and sustainable modern energy system [1,2]. Renewable energy refers to the energy that is not depleted when used and generally comprises wind, solar, hydro, biomass, tidal and geothermal sources [3]. Among them, (1) in the long run, biomass power generation and geothermal power generation are relatively less affected by natural factors such as seasons, day and night and cloudy weather [4]; (2) over a certain period of time, hydropower generation is also less affected by natural environmental factors; (3) in the short term, power generation sources such as tidal, wind and solar, are also greatly affected by environmental factors [5]. At present, the large scale integration of renewable energy power generation in the source side has been achieved by the centralization of wind, photovoltaic and hydropower generation, and some areas are assisted by biomass, tidal, geothermal and other methods of generating electricity [6]. Meanwhile, the load side also transfers excess energy to the power grid in the form of distributed wind and photovoltaic micro-grid.
With the large-scale access of highly permeable renewable energy, the diversity and uncertainty of energy forms increase the complexity of power output and distribution [7]. Simultaneously, the phenomenon of "abandoning or curtailing wind, solar and hydro," in some areas leads to poor coordination and matching ability between the source side and the grid side [8,9]. Moreover, the dual overlaying of source and load volatility under renewable energy access leads to the bidirectionalization of power flow and complicating the control mechanism. Therefore, it is difficult to realize real-time, efficient and intelligent control of transmission and distribution networks by unified centralized scheduling. Hence, it is urgent to improve the level of collaborative optimization, so as to enhance the autonomous decision-making ability and autonomous coordination ability of transmission and distribution network nodes at all levels. Being a distributed and decentralized peer-to-peer network, a blockchain has the technical characteristics of distributive decision making, cooperative autonomy, traceability and tamper resistance [10], making it suitable for the cooperative optimization of transmission and distribution network under the access of renewable energy in terms of topology and collaborative scheduling [11,12]. This can fairly well guarantee the safe operation of the transmission and distribution network.
References [13][14][15] analyze the technical requirements of energy Internet for blockchain and its applicability. Reference [16] combined different scenarios in the energy internet, such as carbon emission rights certification, illustrating the specific application of blockchain. Article [17][18][19] has proposed the mathematical model and relevant optimization methods of transmission network structure optimization along with emergency demand-side response strategy in transmission network planning. Reference [20] uses the distributed ledger technology of the blockchain for the demand response of the smart grid can improve the accuracy of signal tracking. Reference [21] describes to the interconnection between smart devices of the Internet of Things and the interconnection of blockchain nodes, and analyzes the feasibility of device operation and data management. In reference [22], block chain technology is used to solve the security problem of communication between different types of machines in Cyber-Physical Systems (CPS). Therein, block chain for M2M secure communication is designed to ensure that the communication data between machines is tamperproof. Reference [23] proposes a security solution that applies blockchain technology to smart grid and multienergy interactions, and uses digital signature technology to ensure high security of the solution. The above articles respectively study and analyze the blockchain technology and renewable energy access requirements from the application mode of blockchain under the energy Internet together with transmission and distribution network optimization techniques. Apart from this, they lack the combination of the "source-grid-load" operation scenario under renewable energy access, analyzing the collaborative optimization mechanism and control flow of the energy distribution router in the transmission and distribution network, and the information interaction and constraints between different levels of energy routers under the weakly centralized scheduling. To overcome those issues, realizing the application of blockchain this paper puts forward a novel idea of technology integration supporting the energy router application scenario on the top with blockchain technology with access to highly permeable renewable energy.
The main contributions made of this research paper are as follows: a.
For the flexible output power generation, synchronizing the demand response and transmission and distribution network characteristics, the doubly-fed stability control model using energy routers nodes under blockchain node topology was designed with the QoS (quality of service) index for the energy flow control. This will help to achieve the optimization of the source side and grid side cooperation. b.
The influencing factors of high integration of renewable, network fault or overloading parameters can affect the power generation. Thus, all the influencing factors are considered for generation control feedback and integration control of energy flow and information flow in the transmission, and a distribution network under a weakly centralized scheduling is realized through the b2u (bottom-up) negotiation mechanism based on a master-slave multichain. This will lead to autonomous decision-making capability, and autonomous coordination of transmission and distribution networks will be realized. c.
The energy router is used as a network node, and the master-slave multichain negotiation mechanism is used to realize the information exchange between the energy routers, which improves the interoperability between the energy nodes with increased security of blockchain architecture; through the optimization algorithm of the blockchain smart contract, joint output schemes of different power plants can be obtained, which improves the ability of the power transmission and distribution network to mitigate wind and light loss.

Prerequisites of Weakly Centralized Collaborative Scheduling
The normal and stable operation of the transmission and distribution network and the power plants are under the unified control of the dispatch control system. The power dispatch system mainly incorporates the below listed four functions: a.
Real-time Monitoring and early warning: It acquires the check result data, such as power generation plan, heavy load, over the limit, sensitivity and other information, to realize real-time monitoring and early warning on both sides of the source and the load, and ensure the safety of the power grid. b.
Dispatching plan: It obtains real-time information, such as grid topology trends, which is used to provide source-load prediction data and power generation plans, locate substation authority and perform safety analysis and evaluation of power generation plans. c.
Security check: It provides heavy-duty, over-limit, sensitivity, and stability information to review synergistic results on the distribution side. d.
Dispatch management: It provides various online equipment parameters of the power system, coordinates and manages the internal function allocation of the dispatch control system.
The four-function modules guarantee the safe and stable operation of the electric power system. However, under the new situation of high-permeability renewable energy access, regardless of the more serious phenomenon of "abandoning wind and solar" and the bidirectionalization of energy trends in transmission and distribution networks, it is essential to strengthen the autonomous operating capacity of intelligent energy node equipment, such as energy routers [24]. And some functions of the scheduling system are required to be implemented locally; i.e., from the strong centralization of unified scheduling to the weak centralization of distributed coordination [25]. Some of the existing scheduling functions that the energy router node can undertake are shown in Table 1: The energy router here refers to the core equipment of the energy Internet architecture. It is a smart agent capable of computing, communication, precise control, remote coordination, autonomy and plug-and-play access to the power grid. It has functions such as energy interaction, information interaction and intelligent distribution. Among them, information exchange is realized through software platforms such as server clusters and power consumption information collection equipment; energy interaction is realized through hardware platforms such as power electronic transformers with voltage transformation and current transformation functions. In order to support highly permeable renewable energy access to the grid, the power dispatch center can decentralize some functions to the energy routing nodes at all levels, and realize intelligent control of energy routing nodes in terms of cooperative autonomy, decision-making efficiency, collaborative operation and data security based on blockchain technology. The collaborative operation model is shown in Figure 1.
Energies 2020, 13, x FOR PEER REVIEW 4 of 23 software platforms such as server clusters and power consumption information collection equipment; energy interaction is realized through hardware platforms such as power electronic transformers with voltage transformation and current transformation functions. In order to support highly permeable renewable energy access to the grid, the power dispatch center can decentralize some functions to the energy routing nodes at all levels, and realize intelligent control of energy routing nodes in terms of cooperative autonomy, decision-making efficiency, collaborative operation and data security based on blockchain technology. The collaborative operation model is shown in Figure 1. In the context of widespread access to renewable energy sources, the "source-grid-load" cooperative operation model shown in Figure 1 focuses on the different problems from the source side, grid side and load side. The blockchain technology and energy flow QoS index is introduced on the basis of power and load prediction from the source side and load side, which can ensure the cooperative autonomy and cooperative operation of energy nodes at all voltage levels. The brief explanation of operation and working of source side, grid side and load side energy nodes in the model is as follows: a. Source side: The source side strives to increase the proportion of renewable energy output and reduce the impact of its output fluctuations. It obeys the following principles: (1) priority to maximum utilization of renewable energy; (2) reduce losses caused by "abandonment of wind and solar"; (3) ensure that the electric power system has least disturbances; (4) meet the renewable energy output; and (5) satisfy the corresponding line transmission capacity to the reliable extent. b. Grid side: Grid side is based on the principle that the energy routers at each voltage level are interconnected, and the energy flow and information flow are highly integrated. Due to the diversity of renewable energy forms, the following issues must be kept in full consideration when encouraging the grid to actively access renewable energy: (1) Accessible renewable energy capacity and geographical differences. (2) The particularities of and complementarity between In the context of widespread access to renewable energy sources, the "source-grid-load" cooperative operation model shown in Figure 1 focuses on the different problems from the source side, grid side and load side. The blockchain technology and energy flow QoS index is introduced on the basis of power and load prediction from the source side and load side, which can ensure the cooperative autonomy and cooperative operation of energy nodes at all voltage levels. The brief explanation of operation and working of source side, grid side and load side energy nodes in the model is as follows: a.
Source side: The source side strives to increase the proportion of renewable energy output and reduce the impact of its output fluctuations. It obeys the following principles: (1) priority to maximum utilization of renewable energy; (2) reduce losses caused by "abandonment of wind and solar"; (3) ensure that the electric power system has least disturbances; (4) meet the renewable energy output; and (5) satisfy the corresponding line transmission capacity to the reliable extent. b.
Grid side: Grid side is based on the principle that the energy routers at each voltage level are interconnected, and the energy flow and information flow are highly integrated. Due to the diversity of renewable energy forms, the following issues must be kept in full consideration when encouraging the grid to actively access renewable energy: (1) Accessible renewable energy Therefore, the energy router not only needs to share some functions of the dispatch control system [26], but also needs to optimize the QoS indicators of the energy nodes of the local level for maintaining the output level of the local renewable energy. Simultaneously, in order to ensure that the energy router can access data at any time and participate in data interaction, record management, etc., to achieve peer-to-peer power demand negotiation in a trusted environment, energy routers at different voltage levels are to be used as network nodes to build different types of energy router negotiation chains to complete energy demand negotiation; authenticating and registering [27]; storing and managing an energy router's intelligent optimization algorithms and QoS indicator data in a smart contract; and building a weakly centralized trusted transmission and distribution environment. In addition, through the analysis of the previous block data, it can guide the next stage of energy complementary allocation and the formation of transmission and distribution plans [28][29][30].
Due to the variation of renewable energy generation capacity in different regions, according to the different amount of storage data of each substation in the transmission and distribution network and based on its own power calculation, the energy routers in the peer-to-peer transmission and distribution network can be divided into nodes with different rights according to the voltage levels. In Figure 1, relating to China, the voltage level above 100 kV is considered as transmission line and 110 kV and lower is considered the distribution line. Here, the transmission levels denote the configuration set up for above 110 kV with the energy routers at different nodes being given higher authority, which can independently implement all block functions, such as recording block, broadcast communication, encryption and decryption. Likewise, the distribution level refers to the configuration set, with energy routers at 110 kV and below being given lower authority. They only need to retain a part of the data of the blockchain and participate in the negotiation of transmission and distribution planning; despite their limited storage capacity and computing power, their limited data storage with low maintenance costs are beneficial.
Load side: Figure 1 defines a variety of roles for the load side with distinct divergence: (1) Traditional loads include residential users, industrial and commercial users, etc., acting as energy consumers. (2) As a typical power flexible load, electric vehicles can actively participate in the operation of the grid and interact with the grid; usually, when the power demand is at the peak, the electric vehicle can transfer its excess power to the grid. (3) The distributed power source mainly includes power generation and energy storage devices, which can reduce the pressure of the power grid; the generated power is preferentially consumed nearby, and the surplus power generates a power flow reversal. Considering the above types of loads, the dispatch control system needs to obtain the output data of various types of loads and distributed energy, and carry out corresponding load forecasting; simultaneously, the load side should also interact with the information exchanged by the network to further realize the load-network cooperation.

Energy Router Node Model Based on Energy Flow QoS Index and Blockchain Architecture
In the coordinated scheduling of the "source-grid-load" three-tier architecture, all energy nodes and energy router nodes negotiate among themselves through the blockchain. Compared with the source node and the load node, the collaborative optimization of the transmission and distribution network is most complicated by the fusion control involving energy flow and information flow. Therefore, this paper combines the blockchain technology, the energy flow QoS index and the physical node structure to establish an optimization model of the energy router node in the transmission and distribution network, as demonstrated in Figure 2. This model adopts a three-tier architecture consisting of a physical node layer, a blockchain negotiation layer and a QoS indicator layer. It ensures a relatively balanced output of energy nodes at different levels under renewable energy access with the physical and information perspective.
The energy router node model is constituted from the following functions: • The physical node adopts the different types of automatic controllers compatible with various power generation units, such as a power system stabilizer (PSS), an automatic generation controller (AGC), a maximum power point tracker (MPPT) and a droop control, as shown in Figure 2, and forms a doubly-fed stability control model with the energy router to optimize local energy output. The automatic controllers constitute primary feedback by physical means, such as suppressing low-frequency oscillation and initially enhancing the safety of the transmission and distribution network. In order to further improve the interconnection of energy nodes, energy routers (R1-R4 in Figure 2.) are introduced into the transmission lines of different local power plants [31]. In the transmission and distribution network, the energy router can not only realize the interconnection and energy centralized management of different levels of energy nodes but also the function of local distributed power flow information feedback. The energy router integrates the power supply and demand information shared by the upper and lower energy routers, and then negotiates the prediction result through the blockchain, and feeds it back to the local energy power generation units as secondary feedback, further enhancing the output controllability and output stability.

•
The blockchain negotiation layer is divided into two types: primary (main) chain and secondary (slave) chain, which jointly achieves the negotiation of power supply and demand between nodes at different voltage levels. The secondary negotiation chain at low voltage level consists of blocks generated by the 35 kV/110 kV/220 kV energy router nodes respectively, which have the function of calculating and recording energy node data, such as the QoS index value of its current level, and the optimal distribution of power transmission and transformation. Those chains also have the function of sharing power information with the negotiation chains at the adjacent voltage level. The blocks generated by the 330 kV energy router nodes constitute the primary negotiation chain at a high voltage level. In addition to implementing the secondary negotiation chain functions, it also has the functions of publishing the negotiation result, calculating the overall QoS index value of the system, storing the negotiation data and recording the expected output value for the source side from the dispatch control system. This model adopts a three-tier architecture consisting of a physical node layer, a blockchain negotiation layer and a QoS indicator layer. It ensures a relatively balanced output of energy nodes at different levels under renewable energy access with the physical and information perspective.
The energy router node model is constituted from the following functions: • The physical node adopts the different types of automatic controllers compatible with various power generation units, such as a power system stabilizer (PSS), an automatic generation controller (AGC), a maximum power point tracker (MPPT) and a droop control, as shown in Figure 2, and forms a doubly-fed stability control model with the energy router to optimize local energy output. The automatic controllers constitute primary feedback by physical means, such as suppressing low-frequency oscillation and initially enhancing the safety of the transmission and distribution network. In order to further improve the interconnection of energy nodes, energy routers (R1-R4 in Figure 2.) are introduced into the transmission lines of different local power plants [31]. In the transmission and distribution network, the energy router can not only realize the interconnection and energy centralized management of different levels of energy nodes but also the function of local distributed power flow information feedback. The energy router integrates the power supply and demand information shared by the upper and lower energy routers, and then negotiates the prediction result through the blockchain, and feeds it back to the local energy power generation units as secondary feedback, further enhancing the output controllability and output stability.

•
The blockchain negotiation layer is divided into two types: primary (main) chain and secondary (slave) chain, which jointly achieves the negotiation of power supply and demand between nodes at different voltage levels. The secondary negotiation chain at low voltage level consists of blocks generated by the 35 kV/110 kV/220 kV energy router nodes respectively, which have the function of calculating and recording energy node data, such as the QoS index value of its current level, and the optimal distribution of power transmission and transformation. Those chains also have the function of sharing power information with the negotiation chains at the adjacent voltage level. The blocks generated by the 330 kV energy router nodes constitute the primary negotiation chain at a high voltage level. In addition to implementing the secondary negotiation chain functions, it also has the functions of publishing the negotiation result, calculating the overall QoS index value Energies 2020, 13, 418 7 of 22 of the system, storing the negotiation data and recording the expected output value for the source side from the dispatch control system. • QoS index layer is an evaluation system layer coupled with the optimization strategy. With renewable energy sources with fluctuating output power to further share the load demand, and in order to ensure the quality of power transmission under the requirements of power balance between renewable energy and traditional power generations, it is necessary to refer to the existing information flow transmission QoS indicators to construct an energy node QoS evaluation system that matches the physical node layer. Based on this, the equalization coefficient, line loading rate, loss and loss-to-loss ratio are defined as optimization indicators of the QoS evaluation system. It can provide clear optimization targets for energy router nodes, reduce power transmission loss and improve renewable energy utilization under the condition of ensuring the balanced output of different power generation units.

Definition and Evaluation Mechanism of the QoS Index Layer
The specific definitions of the four types of QoS indicators are as follows: (a) Equilibrium coefficient: The local renewable energy power generation needs to control its own power generation according to its own weight ω i and the transmission capacity limit P lim . The ω i is defined as the ratio of the predicted output of different renewable energy power generation to the predicted total output of local energy, as shown in Equation (1): where P i is the predicted output of different energy power plants and N Re is the collection of local power generations of different energy types.
Under the condition of a certain transmission capacity, in order to ensure the balanced output of different renewable energy power generations in the locality, the equalization coefficient µ is introduced, and the value is as small as possible to indicate whether the power plant meets the optimization index of output fairness, as shown in Equation (2): where P lim is the transmission capacity limit of the line; P real i is the actual delivery capacity of the local renewable energy power generations.
(b) Line loading rate: In order to minimize the energy loss caused by the overhead transmission line and promote the economic operation of transmission and distribution network, the line loading rate is defined as the ratio of actual transmission capacity to transmission capacity limit given by Equation (3).
Considering all aspects of factors and setting aside for load fluctuations, this paper sets the line loading rate from 50% to 75%.
(c) Degree of loss: Combined with the electric energy surplus of the local wind and solar renewable energy power generations, the degree of loss (Q) is defined as the degree of abandoned wind and solar, which is related to the power loss and the duration of wind and solar abandonment. Degree of loss can be defined by the following Equations (4) and (5): where ∆t is the duration of wind and solar abandonment; x ∈ {35, 110, 220, 330}; that is, different voltages.
(d) Input-loss ratio (ILR): The energy loss generated by the substation during the transformation process occupies a considerable proportion of the total loss. The ILR is defined by Equation (6).
where P loss is the energy loss during the substation transformation process of the corresponding grade energy node. P input is the total energy received by the upper node. According to the actual demands, cost and other factors for comprehensive consideration, the ILR can be set within an acceptable range, and the ILR value can directly measure the working capacity of the substation.
There are two main roles in the above four types of indicators. Firstly, after the blockchain intelligent contract finds the joint output plan of different power generations through the multiobjective optimization algorithm, the optimization result can be evaluated. Secondly, each energy router node competes for the quality of power transmission through the evaluation result of the energy flow QoS index to form a consensus mechanism in the blockchain.

Blockchain Hierarchical Negotiation Mapping Architecture
By analyzing and defining the inter-constraint relationship between the various levels in the transmission and distribution network node model, the blockchain hierarchical negotiation mapping architecture shown in Figure 3 can correspond to it [32]. ; that is, different voltages.
(d) Input-loss ratio (ILR): The energy loss generated by the substation during the transformation process occupies a considerable proportion of the total loss. The ILR is defined by Equation (6). 10 10 log ( / ) input loss where Ploss is the energy loss during the substation transformation process of the corresponding grade energy node. Pinput is the total energy received by the upper node. According to the actual demands, cost and other factors for comprehensive consideration, the ILR can be set within an acceptable range, and the ILR value can directly measure the working capacity of the substation. There are two main roles in the above four types of indicators. Firstly, after the blockchain intelligent contract finds the joint output plan of different power generations through the multiobjective optimization algorithm, the optimization result can be evaluated. Secondly, each energy router node competes for the quality of power transmission through the evaluation result of the energy flow QoS index to form a consensus mechanism in the blockchain.

Blockchain Hierarchical Negotiation Mapping Architecture
By analyzing and defining the inter-constraint relationship between the various levels in the transmission and distribution network node model, the blockchain hierarchical negotiation mapping architecture shown in Figure 3 can correspond to it [32].  The mapping relationship is listed as follows: Energies 2020, 13, 418 9 of 22 (a) The goal of the application layer is to ensure the quality of power transmission and improve the utilization of renewable energy. (b) Energy routers at all levels compete for QoS indicators through a consensus layer, the obtained QoS score can form an incentive. (c) Through the multiobjective intelligent optimization algorithm in the counterparty layer, the optimal output prediction of various energy power generations in the node layer in Figure 2 can be obtained. (d) By defining the low voltage level negotiation slave chain and the high voltage level negotiation main chain, a master-slave multichain structure is formed to optimize the data dissemination mechanism at the network layer. (e) The size of the internal block of the master-slave multichain in the data layer is determined by the energy router nodes at different voltage levels, and the block with larger capacity is generated and processed at a slower speed.
For example, the 330 kV node needs to have the functions of recording the overall QoS indicator value of the system at the same time, while other low-voltage level nodes do not need to record additional data but have higher real-time requirements for uploading their own data. Therefore, a reasonable choice of block capacity will improve the overall operating efficiency of the system.

Transmission and Distribution Network Negotiation Mechanism Based on the Master-Slave Multichain Structure
In the transmission and distribution network, under highly permeable renewable energy access, the energy router nodes at all levels have complex roles, such as dealing with different types of power generation and energy routers with different functions. Among them, the energy router should not only realize energy control but also manage and optimize the actual outputs of multienergy power plants at this level [33]. At the same time, realizing the information guarantee, that is, providing a stable and efficient information interaction environment for consultation and information transmission between nodes, is also one of the functions of the energy router [34]. Therefore, this paper designs the transmission and distribution network negotiation mechanism based on the master-slave multichain, as demonstrated in Figure 4. Information flow in this mechanism is bidirectional. The downstream information flow is emitted by the main chain of the 330 kV energy router to perform the negotiation results. Upstream information flow is b2u power negotiation information flow, it is issued by the network 35 kV energy router slave chain, which is used to pass the power consumption prediction value step by step. Through this mechanism, the dispatch control system is weakly centralized and the grid prediction accuracy is improved. With the energy flow QoS index, the master-slave chain is used to evaluate the negotiation results and optimize the energy nodes at all levels. After the negotiation is reached, all information involved in the result is stored in the 330 kV energy router main blockchain, and the information is periodically updated to generate a new block [35][36][37].
In the energy node QoS evaluation system proposed in this paper, all levels of energy routers should implement the negotiation results under the premise of satisfying the equalization coefficient µ and line loading rate φ w . The local total loss Q loss(xkV) and input-loss ratio ILR (xkV) were used to evaluate the final negotiating results. At the beginning of the negotiation, the Q loss(xkV) and ILR (xkV) of the previous phase are set to the acceptable lower limit of QoS to ensure that the QoS value of the negotiation mechanism is within an acceptable range. The data involved are regularly stored by the corresponding level of the block. The information transmission process uses asymmetric encryption technology to ensure security at the same time.
The local predicted output value P local(xkV) of the energy nodes at all levels in this mechanism needs to comprehensively consider the total amount of actual output P real(xkV) and the transmission capacity limit P lim(xkV) of each line. Where x ∈ {35, 110, 220}, P real(xkV) > P lim(xkV) , then P local(xkV) = P lim(xkV) P real(xkV) ≤ P lim(xkV) , then P local(xkV) = P real(xkV) .
Energies 2020, 13, x FOR PEER REVIEW 10 of 23 In the energy node QoS evaluation system proposed in this paper, all levels of energy routers should implement the negotiation results under the premise of satisfying the equalization coefficient μ and line loading rate φw. The local total loss Qloss(xkV) and input-loss ratio ILR(xkV) were used to evaluate the final negotiating results. At the beginning of the negotiation, the Qloss(xkV) and ILR(xkV) of the previous phase are set to the acceptable lower limit of QoS to ensure that the QoS value of the negotiation mechanism is within an acceptable range. The data involved are regularly stored by the corresponding level of the block. The information transmission process uses asymmetric encryption technology to ensure security at the same time.
The local predicted output value Plocal(xkV) of the energy nodes at all levels in this mechanism needs to comprehensively consider the total amount of actual output Preal(xkV) and the transmission capacity limit Plim(xkV) of each line. Where ∈ 35, 110, 220 , The total actual output Preal(xkV) is the sum of various types of energy generation output.
where i real P is the actual delivery capacity of the renewable energy power generation in each energy router node, and Pthermal is the actual output of the thermal power generation.   The total actual output P real(xkV) is the sum of various types of energy generation output.
where P real i is the actual delivery capacity of the renewable energy power generation in each energy router node, and P thermal is the actual output of the thermal power generation. The transmission and distribution network negotiation mechanism based on the blockchain mainly includes the following three steps: (a) Energy supply and demand negotiation mechanism b2u based on master-slave and multichain. i.
Starting at time t, the 35 kV energy router slave chain collects the load current reverse power value P REV and the load predicted value P LP , and calculates the total power required P L at the load side. Combined with the local output predicted value P local(35kV) , the P in(35kV) is calculated and uploaded to the 110 kV energy router slave chain by the 35 kV slave chain. This step takes time ∆t. Where P in(35kV) is the power value required by the 35 kV energy router, which is obtained from the 110 kV energy router: Energies 2020, 13, 418 11 of 22 ii. Starting at time t + ∆t, the 110 kV energy router slave chain derives the P in(110kV) according to P in(35kV) and P local(110kV) , and then uploads the data to the 220 kV energy router slave chain before time t + 2∆t. P local110kV is the predicted value of the local output and P in110kV is the value of the power that the 110 kV energy router needs to obtain from the upper 220 kV energy router. Starting at time t + 2∆t, the 220 kV energy router slave chain performs the same steps as the 110 kV energy router slave chain, ending at time t + 3∆t.
iii. Energy routers' slave chains at all levels meet the constraints of equalization coefficient and line loading rate respectively, and calculate the amount of renewable energy abandonment Q loss(xkV) and the input loss ratio ILR (xkV) according to their own power calculation. Then, these data are uploaded to the 330 kV energy router main chain within the limit of the data upload time node. As shown in Figure 4, t + ∆t, t + 2∆t and t + 3∆t represent the time node. iv.
Starting at time (t + 3∆t), the 330 kV energy router main chain obtains data P in(220kV) , which is the predicted value of the source power generation demand P b2u derived by the power negotiation mechanism b2u.
At the same time, the main chain of the 330 kV energy router acquires the P E , and calculates Q loss(xkV) and ILR (xkV) according to the Q loss(total) and ILR (total) uploaded by the energy routers at all levels. Among them, P E is the expectation value of the dispatch control system to the source power generation in the short term. The length of time required for this step is ∆t.
, x ∈ {35, 110, 220, 330}. (14) At this point, the energy routers at all levels have basically clarified their respective power conversion value, and the energy negotiation based on b2u is basically completed.
(b) At time t + 4∆t, the 330 kV energy router main chain compares P b2u with P E , and checks whether Q loss(tatal) and ILR (total) met the requirements of the previous preset values or not.
The P b2u floating range is set to ±5%. When the values of P b2u , Q loss(tatal) , and ILR (total) satisfies the condition, the entire system performs the task according to the b2u power negotiation results. Otherwise, the prediction accuracy of the energy routers at all levels is calibrated according to the preset requirements and renegotiated until the conditions are met to determine the negotiation results. If the negotiation proceeds smoothly, the negotiation result is finally determined at t + 5∆t.
(c) At time t + 5∆t, the 330 kV energy router's main chain delivers the results to the energy routers' slave chains at all levels, and executes negotiation results. Simultaneously, the hash value generated by the result is stored in the main chain block of the 330 kV energy router. This can ensure that the problem caused by the unreasonable negotiation mechanism can be traced back to the source. This step ends at time t + 6∆t. The transmission and distribution network negotiation mechanism based on the master-slave multichain structure takes the b2u power negotiation as the core, and combines the energy flow QoS index and power prediction. This mechanism ensures the high security of the negotiation environment and the traceability of the negotiation result under the function of achieving high integration of energy flow and information flow.

Simulation of Intelligent Contract Example and Evaluation of QoS Index Based on Multiobjective Particle Swarm Optimization
Introducing the blockchain architecture and energy flow QoS indicators in the optimization model of the energy router node in the transmission and distribution network can provide optimization strategies and ensure a weakly centralized trusted transmission and distribution environment, but further analysis of the actual power output of renewable energy power generations at each energy node in the physical node layer is also needed. In the cooperative optimization mechanism of transmission and distribution network under the blockchain architecture, the conclusions of joint output schemes of different power generations in energy nodes, and reducing the excess of photovoltaic and wind power uploading to transmission lines with its maximum possible utilization, are the core solution goal of blockchain smart contract. Therefore, this paper integrates the MOPSO (multiobjective particle swarm optimization) algorithm into the intelligent contract of blockchain, taking the physical node layer in Figure 2 as an example to solve the optimal schemes for the output of different power generation units. The data routers that provide the data are the energy routers of the power plants of this voltage class and the energy routers of the next voltage class. The inputs to the simulation process are: the output goal of each power plants, i.e., its output proportion being infinitely close to its own installed proportion; upper and lower limit of output limit of each power plant; upper and lower limits of the total loading rate of the transmission line; and the energy demand of the next voltage class energy router. The output of the simulation process is: after the multiobjective optimization, the amount of power required to be sent to the energy router of the next voltage level, Q loss(xkV) and ILR (xkV) , is sent to 330 kV master chain after being evaluated by QoS index. Other nodes in the transmission and distribution network can refer to the optimization strategy of the node, and change or add the constraints in the smart contract according to different voltage levels and various environmental factors.
The MOPSO algorithm introduces an adaptive mesh method (estimating the information density of particles), a search mechanism for Pareto optimal solutions that balance global and local search capabilities and a pruning technique for archive sets that reject poor quality particles [38][39][40]. It has the characteristics of fewer control parameters, easy implementation and a certain degree of parallelism [41,42]. MOPSO updates the position and velocity of particles in a population-based on inertia weights and learning factors in order to reduce the renewable input or increase hydro and thermal generation. In order to maximally utilize renewable sources with least disturbances in the power grid, the algorithm is optimized, and the disturbance or mutation operator is executed to prevent the particles from falling into the local Pareto front end. After the optimization is performed by MOPSO algorithm, the energy router feeds the final result to the power generation units of the same level through the secondary feedback line in the transmission and distribution network routing model (refer to Figure 2), ensuring the intelligence and efficiency based on the blockchain negotiation process. The energy flow QoS indicator will evaluate the negotiation results of the optimized energy routers at the same level, and upload the evaluation results step by step to help further optimize the transmission and distribution plan.
In this paper, MATLAB is used to simulate the MOPSO algorithm, taking the electric power system power generation data of northwest region of China with abundant solar and wind energy resources as an example, in order to analyze the output of the four types of power generations based on the energy flow QoS indicator, while setting the maximum output of clean energy and the actual output of each power generation units as close as possible to the transmission capacity limit of the objective Energies 2020, 13, 418 13 of 22 function; and setting the transmission line loading rate to reasonable, photovoltaic and wind power relative to the hydropower and thermal power adjustment ability, to ensure the least disturbances in output as constraints. The specific experimental data are as follows: The simulation selected the installed capacity limit in the northwest region of china as an idealized model, in which the proportions of wind, solar and hydrothermal power plants are 19%, 15%, 13% and 53% respectively. In order to alleviate the problem of wind and solar curtailment to grid integration, the actual transmission capacity of the two power plants should be as close as possible to the transmission capacity limit, but the transmission line loading rate at its energy node will affect the maximum output. This limitation will be backed up by the relatively strong thermal and hydro power regulation capacity; the difference between the upper and lower limits for setting the thermal and hydro output limit is greater than the limits for photovoltaic and wind power. Simultaneously, in order to minimize the fluctuation of the local renewable generations output, the difference between the upper and lower limits of the thermal power output limit is greater than that of renewable energy. Thus, the thermal and hydro power generation helps to compensate the disturbances created by higher integration of renewable power generations to the grid. The limits for different power generation sources are as shown in Table 2. Table 2. The objective function and constraint conditions based on the quality of service (QoS) index of energy flow.

Constraint Conditions
Objective Function The data obtained from the northwest region of China comprised of the maximum generation output proportions of wind, solar, hydro and thermal power plants in a certain region at different times (samples at different times were recorded, 500 data was selected for simulation) are shown by matrix Q in Equation (16); the data are of the 2019 China power supply and demand situation analysis and forecast report, combined with relevant reports on the increase in the proportion of new energy installed capacity.
According to the constraints in Table 2, Using the search mechanism of Pareto's optimal solution and the trimming technique of the Archive set, which removes the poor quality particles, the simulation results of the optimal output of the renewable energy power plant in the energy node of the selected area can be obtained. The simulation results of the optimal output of the renewable energy power generations from their energy nodes in the selected area are shown in Figure 5a,b, where the actual transmission capacities of wind, solar, hydro and thermal account for 17%, 14%, 13% and 29%, thereby showing the area incorporating higher uses of renewable sources. Figure 5b shows the actual delivery capacity and transmission capacity limit when the power required by the next level energy router is 2000 (MW) in a certain period of time.
the selected area can be obtained. The simulation results of the optimal output of the renewable energy power generations from their energy nodes in the selected area are shown in Figure 5a,b, where the actual transmission capacities of wind, solar, hydro and thermal account for 17%, 14%, 13% and 29%, thereby showing the area incorporating higher uses of renewable sources. Figure 5b shows the actual delivery capacity and transmission capacity limit when the power required by the next level energy router is 2000 (MW) in a certain period of time. The simulation results of the optimal output scheme obtained by Figure 5a,b shows that: due to the limitation of the transmission line load rate of the local energy node if it is necessary to reduce the degree of abandonment of wind and solar while ensuring the minimum fluctuation in the power grid, it needed to increase the output level of hydropower and thermal power generation with strong regulation ability to enhance the complementarity of high permeability renewable energy. With the application maximum, clean energy utilization can be attained, making the thermal and hydro power more flexible with the demand and supply and availability of renewable power generation. But still, thermal power generation remains the main energy supplier for making the power grid more flexible to accepting more renewable integration by limiting fluctuations.
After the optimization algorithm obtains the optimal output scheme of the energy router, as demonstrated in the example, the energy flow QoS index is used to optimize the evaluation of the routing node in the transmission and distribution network. The evaluation of the simulation results is shown in Table 3. It can be observed in Table 3 that the total transmission line loading rate is 74.8%, which meets the loading rate requirement. It can also be seen that among the renewable energy sources in the region, the photovoltaic and wind power output are relatively balanced and with minimal loss. But in order to adjust the wind and solar loss and grid stability, the appropriate thermal and hydro power outputs need to be ensured. The ILR needs to be evaluated according to the situation of its power transformation at this node. Based on the above data, the output of the energy routing node in the example is relatively good. The simulation results of the optimal output scheme obtained by Figure 5a,b shows that: due to the limitation of the transmission line load rate of the local energy node if it is necessary to reduce the degree of abandonment of wind and solar while ensuring the minimum fluctuation in the power grid, it needed to increase the output level of hydropower and thermal power generation with strong regulation ability to enhance the complementarity of high permeability renewable energy. With the application maximum, clean energy utilization can be attained, making the thermal and hydro power more flexible with the demand and supply and availability of renewable power generation. But still, thermal power generation remains the main energy supplier for making the power grid more flexible to accepting more renewable integration by limiting fluctuations.
After the optimization algorithm obtains the optimal output scheme of the energy router, as demonstrated in the example, the energy flow QoS index is used to optimize the evaluation of the routing node in the transmission and distribution network. The evaluation of the simulation results is shown in Table 3. It can be observed in Table 3 that the total transmission line loading rate is 74.8%, which meets the loading rate requirement. It can also be seen that among the renewable energy sources in the region, the photovoltaic and wind power output are relatively balanced and with minimal loss. But in order to adjust the wind and solar loss and grid stability, the appropriate thermal and hydro power outputs need to be ensured. The ILR needs to be evaluated according to the situation of its power transformation at this node. Based on the above data, the output of the energy routing node in the example is relatively good.
Taking the energy routing nodes in the simulation results as an example, due to regional differences, other nodes in the transmission and distribution network can change the upper and lower limits of the conventional and renewable generations according to the resource conditions and load demand characteristics of different regions to meet different targets, and using the energy flow QoS index to evaluate the optimization results. Different nodes have different requirements for energy plants under the access of renewable energy, which leads to some minor, and also may lead to major complications in the mutual energy and information interaction of energy nodes. Therefore, it is necessary to simulate and analyze the negotiation mechanism of energy distribution router based on a master-slave multichain structure.

Simulation of a Master-Slave, Multichain Negotiation Mechanism Based on a Multichain Platform
The blockchain based transmission and distribution grid energy router negotiation mechanism shown in Figure 4 has a multichain structure, including a 330 kV main chain and three 35 kV-220 kV slave chains. In the process of information exchange between links, the interaction data consists of QoS values and power prediction values of each generation node. Therefore, the feasibility simulation of the negotiation process needs to be authenticated and analyzed in two aspects, including the construction of the multichain structure and the simulation of information interaction.
Based on multichain technology, the multichain demo document was configured, and the PHP runtime environment built based on the xampp platform, thereby configuring the software and the blockchain environment. The minimum specification required for the blockchain platform is mentioned in Appendix A. The four-system configuration was set up on a windows 7 personal computer with 64-bit 4 GB random access memory to realize the operation and connection of the master-slave multichain, the configuration of the rights and the transmission of information in the form of assets, so as to verify the feasibility of building the multichain structure. The specific operations were as follows: during xampp operation, the blockchain network environment of four computers were configured respectively, along with creating and configuring multiple chains through the command window. The four configured chains were named: Chain330kV, Chain220kV, Chain110kV, and Chain35kV. The Chain330kV was selected as the full-node chain; i.e., the main chain with the rights of block publishing, administration, connection, sending, receiving, asset issuance and flow management. Simultaneously, the other three computers were configured as the slave node chain. The slave chain, the 35 kV slave chain node (Chain35kV, IP:192.168.1.2:5597) and the 110 kV slave node (Chain110kV, IP:192.168.1.2:7324) were taken as examples. The two slave chains respectively issued an application for interconnection with the main chain Chain330kV through the instruction "multichaindTestChain@192.169.1.1:2781." The main chain received instructions to complete the interconnection and give the slave chain the right to connect, send, receive and release the asset. The main chain reserves all the permissions of all the node and also reserves the right to configure the slave chain permissions. The main operations are shown in Appendix B (Figures A1-A3).
The main-slave multichain information interaction was mainly verified from two aspects: the transfer of QoS values between the main chain and the slave chain, and the transmission of the predicted value of the electrical quantities between the slave chains. Taking the 110 kV slave chain (Chain110kV, IP:192.168.1.2:7324) as an example, when the b2u power negotiation mechanism proceeds to t + ∆t, the chain receives the data information from the Chain35kV and downloads it, calculates P in (110kV) and uploads it to Chain220kV. And the QoS indicator, after the smart contract is optimized, is submitted to the Chain330kV from the node; the main operations are as in Appendix C (Figures A4-A6). The computation process includes the simulation of MOPSO within the smart contract. For more clarifying the swiftness, 10 simulations were conducted and Appendix A demonstrates the computational cost of blockchain intelligent contract based on MOPSO algorithm showing its feasibility for the practical application.
By constructing a master-slave multichain platform and simulating the information interaction process between multiple chains, it is possible to verify the feasibility of an energy router negotiation mechanism based on master-slave multichain structure; i.e., it authenticates the feasibility of the blockchain technology applied to the energy router control mechanism based on QoS indicators. However, the construction of the complete platform based on blockchain technology is temporarily unable to complete due to the high-end hardware requirements. In the near future, the construction of model scenarios will be further improved, and the obstacles to applying blockchain technology to energy router negotiation will be explored.

Conclusions
This paper studied the operations of energy routers for transmission and distribution networks with high permeability renewable energy access, and the application of blockchain technology integrating the energy flow QoS index with the independent cooperative mode of the energy router node. The energy flow QoS index was integrated with the independent cooperative mode of the energy router node, and the transmission and distribution network was optimized from the four constraints of equilibrium coefficient, line loading rate, loss degree and input loss ratio. Observing the characteristics of renewable energy access to the transmission and distribution network, and based on the weakly centralized system architecture of distributed energy router nodes, this paper proposes a "source-grid-load" collaborative scheduling operation scenario model based on blockchain. Combined with the functions of energy routers in the transmission and distribution network, the energy router node doubly-fed stability control model was considered to ensure the balance output and stability of the output power of each power generation unit. The MOPSO algorithm is introduced into the intelligent contract of the blockchain for optimization of amount of energy integration from different sources. The optimal output scheme of each power generation unit in the example was obtained, improving the ability of the transmission and distribution network to mitigate the loss of wind and solar, and the evaluability of the energy flow QoS index was verified. Due to the complexity of renewable energy access to the transmission and distribution network, there are many complications in the power mutual aid of energy nodes at all levels. In order to resolve those complications, this paper drafts an autonomous energy collaborative optimization mechanism and control process of the router nodes at the transmission and distribution network with the blockchain as the technical support. Through the mechanism purposed in this paper, the weak centralization of the dispatch control system was realized: the energy router was used as the node, and the master-slave multichain negotiation mechanism was used to realize the information exchange between the energy routers, improving the interoperability between the energy nodes. At the same time, the prediction accuracy and optimization level of the high-permeable renewable energy access to the transmission and distribution network has been improved. Finally, the power transmission and distribution mode of the autonomous decision-making ability and autonomous coordination ability of the energy router nodes were attained.

Conflicts of Interest:
The authors declare no conflict of interest.

Nomenclature
The following nomenclatures are used in this paper: b2u Bottom-to-up power negotiation mechanism CPS Cyber-Physical Systems MOPSO Multiobjective particle swarm optimization MPPT Maximum power point tracking PSS Power system stabilizer QoS Quality of service P lim Transmission capacity limit ω i Equilibrium coefficient P i The predicted power output of various types of power generations P real i The actual power delivery capacity of the local distributed renewable generations N Re The collection of various types of local power generations φ w Rate of transmission line loading Q loss Degree of power loss ∆T Duration of wind and solar abandonment ILR Input loss ratio

P loss
The energy loss during the substation process of the corresponding grade energy node P input The total energy received by the upper node t Time at which negotiation mechanism starts execution ∆t Time required to perform each step P local (x kV) Local predicted power output of the energy nodes at all levels P real (x kV) Total actual power output P thermal Actual power output of the thermal power plant P in (x kV) Required power output of 35 kV energy router P REV Load current grid connected back feed power value P LP Predicted Load value P L Total power required at the load side P E The expected value of the dispatch control system to the source power generation in short term Appendix A