Research on Multi-Microgrids Scheduling Strategy Considering Dynamic Electricity Price Based on Blockchain

In order to improve the economy and safety of multi-microgrids (MMGs) scheduling, this paper proposes a research on MMGs scheduling strategy that takes into account dynamic electricity prices based on the blockchain. We first introduce the principle of blockchain, analyze the security and economy of the combination of blockchain and MMGs scheduling, and design the scheduling architecture and process based on the blockchain platform. Second, we set a dynamic electricity price model according to the total power supply and demand of MMGs, and set a load optimization model. Finally, we take optimal system economy and minimum environmental pollution as the objective function, then use the linear programming method and the improved krill herd algorithm (KHA) with nonlinear changes in weights to solve the problem. The simulation results show that: (1) The dynamic electricity prices can reflect the power supply and demand of microgrids and optimize the load; (2) Comparing the three scheduling schemes, the strategy in this paper can improve the economic and environmental protection of MMGs by 37.33% and 39.34%, while reduce the interactive power between the microgrid and the distribution network by 56.28%, and the curtailment rate by 63.22%; (3) The improved krill herd algorithm has higher convergence speed and convergence accuracy;(4) The blockchain technology can ensure the security of scheduling data.


I. INTRODUCTION
The microgrid is an effective method for distributed power sources to be connected to the power grid safely and stably. It can balance the uncertainty of new energy output and realize the local consumption of distributed power sources [1]. However, with the continuous increase of new energy generation capacity and the expansion of the scale of microgrids, a single microgrid has limited absorption capacity and weak anti-interference ability, which make it difficult to balance the impact of renewable energy on the grid [2]. With the opening of the power market on the distribution grid side, multiple microgrids that are geographically adjacent are interconnected to form a multi-microgrids system (MMGs), which can promote the local consumption of new energy [3], improve the system's anti-interference ability [4], [5], and have good economic efficiency [6], [7].
The associate editor coordinating the review of this manuscript and approving it for publication was Shuaihu Li . At present, the research of MMGs is still in its infancy at home and abroad, which is mainly reflected in topology, control strategy, transaction mode, energy management and optimal scheduling [8], [9]. Among them, the energy management and optimal scheduling have attracted widespread attention in recent literature. In [10], a three-tier control structure is proposed for the integrated operation management of a MMGs. The central energy management at the highest control level is responsible for designing a reference trajectory, while the energy management system at the second level is used for tracking the predicted power trajectory to manage local operations. And the local controller at the lowest level is designed to execute the optimal solution strategy. In [11], it is established a two-layer power scheduling model, which is composed with a distribution network energy management system and a microgrid control center. The distribution network energy management system coordinates the energy mutual benefit between microgrids to achieve the reliability and economy of the distribution network. VOLUME 9, 2021 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ The above model reduces unplanned transaction power between the microgrid and the large grid, but does not consider the power interaction between the microgrids. In [12], it is presented a bi-level operation scheduling of distribution system operator (DSO) and MMGs considering both the wholesale market and retail market. The upper layer minimizes the total cost, and the lower layer maximizes the profit of the microgrid. This model improves the system economy, but does not consider the impact of transaction electricity prices and demand response on the system economy. In [13], a hierarchical energy management scheduling model is proposed. At the upper layer, it performs energy scheduling by calculating the exchange power with microgrids and between microgrids and large grids, while it takes uncertain factors into account at the lower layer. This hierarchical distributed management model reduces the cost of MMGs and their dependence on the large grid, but as the number of microgrids increases, the calculation time cannot be guaranteed and the scalability is not high. In [14], it is established a hierarchical coordinated optimization model of MMGs based on cooperative games, and takes into account wind power consumption. At the upper layer, it sets electricity prices and distributes revenue based on the shapely value, while it considers demand response autonomous optimization of each microgrid at the lower level. In [15], the electricity price is adjusted according to the degree of agreement between the scheduling instructions at the distribution network level and the actual transaction electricity of the microgrid. The above scheduling model reflects the impact of transaction electricity prices and demand response on microgrid scheduling, but centralized scheduling has problems such as low information transparency, poor system security, and high third-party management costs. Blockchain has the characteristics of decentralization, trustworthiness, and tamper-proof [16]. Numerous documents have proved the effectiveness of blockchain for power market transactions from theories and models [17], [18]. In addition, blockchain can also be used for weak centralized power dispatch. In [19], it is established a double-layer blockchain to realize microgrid scheduling, which improves the microgrid scheduling speed. And in [20], the overall framework of the microgrid market based on the blockchain is constructed. Data information is obtained through the blockchain management platform, and the microgrid scheduling operation is optimized by combining the model predictive control method. Therefore, this paper proposes to use the blockchain to build a MMGs scheduling system. Considering the economics of MMGs scheduling are closely related to transaction electricity prices, this paper proposes a research on MMGs optimal scheduling strategies that take into account dynamic electricity prices based on the blockchain.
The contribution of this paper is established a dynamic electricity price model reflecting the power load of each microgrid, and each microgrid optimizes its own load model based on the dynamic electricity price. Based on the optimized power load, according to the scheduling strategy, and with the goal of the highest economy and the least environmental pollution to schedule, using linear programming method and improved krill swarm algorithm to solve. The simulation results show: (1) Dynamic electricity prices can reflect the power supply and demand situation optimize the load; (2) Comparing the three scheduling schemes, the strategy in this paper can improve the economy and environmental protection of MMGs system, reduce the interactive power between the microgrid and the distribution network; (3) The improved krill herd algorithm has higher convergence speed and convergence accuracy.
The content of this paper is arranged as follows: In the section II, we introduce the overall framework of multimicrogrid scheduling based on blockchain; In the section III, we establish a dynamic electricity price model, a load optimization model, and the objective function. Then in the section IV, we use linear programming and particle swarm algorithm to solve the model. At last, we simulate and analyze the results in the section V.

II. THE SCHEDULING SYSTEM OF MULTI-MICROGRIDS BASD ON BLOCKCHAIN A. THE PRINCIPLES OF BLOCKCHAIN FORMATION
The blockchain is a long data chain connected by blocks in chronological order, each block records relevant information of all nodes in a period of time. The formation process of blockchain is as follows: (1) Information exchange between nodes.
(2) After the information interaction, n data are formed. Then the n dates are calculated by the hash function to produce n fixed length outputs, namely hash values. At present, the common hash function is SHA256, which maps the input information into a 256-bit binary output value.
(3) Save n hash values to n leaf nodes of the Merkel tree. The Merkel tree is the main data structure of the blockchain. Then n leaf nodes are connected in series to perform the hash operation again to become the upper node of the Merkel tree. Repeat this step until there is only one root node.
(4) A block is formed, and each node competes for the right of bookkeeping through proof of work (POW)/proof of stake (POS) / delegated proof of stake (DPOS) / practical byzantine fault tolerance (PBFT).
(5) The node that obtains the accounting right forms a complete block by stamping a timestamp and the index hash value of the previous block on the block body. And then the block is broadcast to each node through the P2P network for verification and chaining.
Among them, steps (2) and (3) guarantee the integrity and accuracy of the data, and steps (4) and (5) guarantee the traceability and non-tampering of the data.

B. THE ANALYSIS OF FIT BETWEEN BLOCKCHAIN AND MULTI-MICROGRIDS SCHEDUING
In order to reflect the independence and autonomy of the microgrid, each microgrid participating in the scheduling should have an equal status and be able to obtain the power information of MMGs in time. In the blockchain network, each node has the same status. A node can broadcast information to other nodes at the same time through the P2P network, other nodes can obtain and store the information. This mechanism guarantees the subjectivity of the microgrid and the transparency of information. Furthermore, the microgrid accesses the system in its own unit, which is easy to access and exit, easy to integrate more microgrids, and has strong flexibility and scalability.
In the MMGs scheduling system, the electricity sales microgrid and the power purchase microgrid will trade and dispatch directly. Since the microgrid participating in the scheduling is not as authoritative as the power grid company or power plant, there are trust barriers between the parties to the transaction. In the blockchain system, the power scheduling and profit distribution between microgrids are supervised by all nodes. After the electricity sales microgrid and the power purchase microgrid reach a scheduling plan, the plan is written into a smart contract, which is a program that can be automatically executed when the trigger condition is reached. After the scheduling is completed, the smart contract completes the settlement and transfer of the transaction based on the actual transaction data. There is no need for the participation of third-party trust institutions, which reduces the expenditure of third-party fees and ensures the fairness and trustworthiness of the system.
In addition, the MMGs scheduling will generate a large amount of transaction data, and the data under centralized scheduling is easy to be tampered by hackers. The blockchain has asymmetric encryption technology and iterative hash method, when a malicious node wants to tamper with the information recorded on a block, it must have the power to tamper with more than 50 percent of the node information in the entire network and the right to package the current block. That is, defeating the computing power of the entire network by oneself, which is almost impossible to achieve. Moreover, when the node has this ability, the reward for its securely packaged block will be greater than the benefit for tampering with the block, and there is no need to tamper with data. This mechanism ensures the security of data.

C. THE MULTI-MICROGRIDS SCHEDULING MODEL AND PROCESS BASED ON BLOCKCHAIN
Multiple microgrids that are geographically adjacent are interconnected to form a MMGs system, as shown in Fig.1, in the MMGs scheduling model based on the blockchain, there are three types of nodes, namely the scheduling center node, the supervision center node and the microgrid node. The scheduling center node is responsible for forming a scheduling plan and performing digital signatures. Although there is a scheduling center in this model, the formation process of the scheduling plan is participated and authenticated by all microgrids, it is open and transparent. Therefor the scheduling center node is not a centralized schedule in the traditional sense, but a weak centralized scheduling; The supervisory center node is used to check the authenticity of the registered node, collect transaction fees, and analyze the characteristics of MMGs by transaction data. There are two types of microgrid nodes, the one is electricity sales microgrid node means the microgrid meets its own needs and still has power. The other one is power purchase microgrid node means the microgrid cannot meet its own power needs. The sale/buy roles of microgrids are changing from time to time. The three kinds of nodes realize information sharing through the P2P network, and the microgrid nodes realize scheduling through network tie lines.
In this paper, the process of MMGs scheduling under the blockchain is as follows:

1) THE MICROGRIDS REGISTERED AND LOGGRD TO BECOME A NODE
The microgrids participating in the scheduling system for the first time need to be registered. First of all, the microgrids create P pub and P pri by asymmetric encryption algorithm in the user terminal. Then the microgrids fill in the identity information and send it to the supervision center together with P pub . After verification, the user information and P pub are stored in the database, and other nodes can verify the authenticity of the node based on P pub . After successful registration, the microgrids log in at the terminal and become nodes in the blockchain system to participate in scheduling.

2) EACH MICROGRID NODE SUBMITS THE POWER AND LOAD CURVE
Based on its historical power and load curve, each microgrid node predicts the power and load curve for the next time period. In the blockchain system, a node usually has two basic attributes: address and account. Due to the transaction VOLUME 9, 2021 electricity price between multiple microgrids in this paper is determined by the power and load of the microgrid, so the power and load of the microgrid are also regarded as the basic attributes of the node. Marked as: where BA i represents the set of basic attributes of node i;Address i , Balance i , Power i , Load i respectively represent the blockchain address, balance, power, and load.

3) FORMULATE DYNAMIC ELECTRICITY PRICES AND ADJUST LOAD CURVES
Combining the Power i and Load i broadcasted by the microgrid, the electricity price is set, which according to the relationship between the electricity price and the power in this paper. The electricity prices can affect users' electricity consumption. According to the load adjustment mechanism established in this paper, each microgrid adjusts its load curve to obtain a new load curve. Then on the basis of the new load curve and power, the electricity price is set again, and the change in electricity price affects the load curve again, cyclically until the maximum number of cycles. The system broadcasts the new load curve and dynamic electricity price to each microgrid node, denoted as: where Pr ise and Load new i represent the electricity price between microgrids and the new load of microgrids.

4) THE FORMATION OF MULTI-MICROGRIDS SCHEDULING a: THE DEMAND FUNCTION OF POWER PURCHASE MICROGRID
According to the new load and power curve, the microgrid nodes publish power purchase demand. In order to avoid false requests and ensure the contracts can be proceed successfully after matching, the power purchase microgrid nodes need to deposit a margin to their contract address before issuing a transaction. Remember the power purchase request function issued by the power purchase microgrid B to the schedule center node D and the electricity sale microgrid node S as: where Q B buy | [t, t] indicates the amount of power purchased by the power purchase microgrid from t to t+ t; B pri |T B address represents the information transfer address generated by the private key B pri of the power purchase microgrid B; S B sign means the signature of the power purchase microgrid node.

b: THE DEMAND FUNCTION OF ELECTRICITY SALES MICROGRID
In the same way, remember the electricity sales request function publishes by the electricity sales microgrid S to the schedule center node D as: where Q S sell | [t, t] represents the amount of electricity sold by the electricity sales microgrid during the period from t to t + t; S pri |T S address represents the information transfer address generated by the private key S pri of the electricity sales microgrid S; S S sign means the signature of the electricity sales microgrid node.

c: THE SCHEDULING PLAN FORMED AT THE SCHEDULE CENTER NODE
The schedule center node receives the power purchase request P B and the electricity sale request P S by its private key D pri . Then arranging the power purchase nodes in ascending order of purchased electricity to form a power purchase queue, and arranging the electricity sale nodes in ascending order of electricity sales to form an electricity sale queue, matching the two parties in turn to form a scheduling plan.
The schedule center node broadcasts the contract C DtoB to the power purchase microgrid node, as shown in (5).
where S D sign means the signature of the schedule center node. After receiving the contract C DtoB , the power purchase microgrid node sends the contract C BtoS with the signature of the power purchase microgrid node to the electricity sales microgrid node, as shown in (6).
After receiving the contract C BtoS , the electricity sales microgrid node sends the contract C StoB with the signature of the electricity sale microgrid node to the power purchase microgrid node, as shown in (7).

5) THE SETTLEMENT OF SMART CONTRACT
Being signed by the power purchase microgrid node, the electricity sales microgrid node, and the schedule center node, the schedule contract is to be performed. After scheduling, the smart meter installed in the terminal uploads the actual power consumption and power generation. (1) When the actual electricity consumption is greater than the contracted purchase electricity, it has no impact on the electricity sales microgrid. Then the power purchase microgrid node settles according to the contract and transfers the funds to the electricity sales microgrid node. The additional power consumption is purchased from the grid at the electricity price of the distribution network.
(2) When the actual electricity consumption is less than the contracted purchase electricity, it will affect the electricity sales microgrid, the loss of the electricity sales microgrid will be deducted from the margin of the power purchase microgrid. (3) When the actual power generation is greater than the contracted power sales, it will have no impact on the power purchase microgrid, and the excess power will be sold to the grid at the power purchase price of the distribution network. (4) When the actual power generation is less than the contracted electricity sales, it will have an impact on the power purchase microgrid, and the loss of the power purchase microgrid will be deducted from the margin of the electricity sales microgrid. Finally, all remaining deposits are refunded.

6) FORM THE BLOCK TO A CHAIN
After the execution of the smart contract, the overall transaction information is packaged into blocks by nodes with strong computing power, and broadcasted to other nodes for verification. After the verification, it is added to the blockchain. The realization of the MMGs scheduling system based on the blockchain is highly dependent on the communication network. As shown in fig.2, first, each microgrid forms a blockchain network by logging in to the client at the application layer, and becomes a node in the network. Second, each microgrid node predicts the power and load based on the historical database, and sends it to other nodes through the P2P network layer. Third, the system sets electricity prices, adjusts the load, and forms a scheduling plan at the business level, and realizes information interaction between nodes through the P2P network. Fourth, the scheduling plan is written into the smart contract, when the scheduling execution conditions are met, the smart contract is called to complete the scheduling, and then settling according to the actual electricity quantity uploaded by the smart meter at the physical layer. Fifth, each node competes for the right of accounting at the consensus layer by the POW consensus mechanism, which ensures the accuracy of the data. finally, the data is stored in the data layer, and formed a blockchain.
When a block spread in the network, each node will first verify the validity of the block, and then spread to neighboring nodes until the block is known by all nodes. The propagation speed of a block is related to the size of the block, the number of nodes in the network, and the bandwidth, as shown in (8).
where k i represents the number of adjacent nodes of the node i; S i represents the size of block; B represents the bandwidth; and b represents the coefficient; the first term represents the block propagation time, while the second term represents the block verification time.
It can be known that when the block is small and the bandwidth is large, the block propagation time is shorter. Considering that MMGs scheduling will generate a large amount of data and the blocks are large. In order to ensure the timeliness of scheduling, network bandwidth should be increased. The arrival of the 5G era provides a strong guarantee for the blockchain system.

III. THE MULTI-MICROGRIDS SCHEDULEING SCHEME AND MATHEMATICAL MODELING CONSIDING DYNAMIC ELECTRICITY PRICES
A. THE OVERVIEW OF SCHEDULING SCHEME In the MMGs system, the dynamic electricity price will set before scheduling, and the microgrid load will adjusted to optimize MMGs system. There are two stages: the pricing stage and the quantitative stage. In the pricing stage, the dynamic electricity price is set based on the power load data of each microgrid and market information. In the quantitative stage, each microgrid optimizes its own load based on dynamic electricity prices. During scheduling, the solar energy and the wind power generate no pollution and are uncontrollable, so scheduling priority is given to wind and solar power generation, and make they work in the maximum power generation state. According to the different supply and demand of the MMGs system, the following three schemes are formed, as shown in Fig. 3.
(1) Each microgrid has power surplus after meeting its own load demand. The remaining power will first charge the batteries of each microgrid until the upper the limit of the battery capacity, and then sell to the distribution network.
(2) Each microgrid cannot meet its own load demand. The shortfall power is first called from the battery of each microgrid until the lower limit of the battery capacity, then comparing the power generation cost of the microgrid controllable unit with the power purchase cost of the distribution network, choosing the lower cost party for power supply.
(3) Part of the microgrid power generation meets its own load demand, and some microgrid power generation cannot meet its own load demand. The former supplies power to the latter. When the surplus power of the former is greater than the load demand of the latter, the surplus power is sold to the distribution network (in peak time), or charge its energy storage battery before selling it to the distribution network (in flat or valley time). When the surplus power of the former is less than the load demand of the latter, the scheduling scheme is the same as (2).

B. THE DYNAMIC ELECTRICITY PRICE MODEL
Dividing a day into 24 time periods, the sum of the remaining power of each microgrid in each time period is called the system power supply P sup t , and the sum of the power shortage is called the system power demand P de t .
where i = 1, 2, . . . , I means the microgrid; t = 1, 2, . . . , T means 24 time periods; P sell i,t and P buy i,t respectively represent the power surplus and shortage of the microgrid i during the t period.
Establishing dynamic electricity price according to the size of P sup t and P de t .
It means that there is no power supply or demand in MMGs system. The power demand is directly purchased from the distribution network at a higher price, and the power supply is sold directly to the grid at a lower price.
where p s/b t represents the electricity sales price between microgrids; c buy t and c sell t respectively represent the power purchase price and electricity sale price between microgrids and distribution network.
It means that the supply and demand of the MMGs are balanced. The price of electricity sold and purchased between microgrids is shown in (13), remember the p s/b t in this case as the benchmark price.
where p a t represents the benchmark price.
The balance of the power supply and demand is one of the factors for the grid to operate stably. Generally speaking, the relationship between the price (benchmark price) and the supply is: the higher the price, the greater the supply, the lower the price, and the lower the supply. In this case, the p s/b t should be increased to make P sup t increase and P de t decrease, as shown in (14).
The relationship between price and demand is: the lower the price, the greater the demand; the higher the price, and the less the demand. In this case, the p s/b t should be reduced to make P sup t reduced and P de t increased.

C. THE LOAD OPTIMIZATION MODEL UNDER DYNAMIC ELECTRICITY PRICE
The loads are generally divided into fixed loads and adjustable loads. The latter will respond to dynamic electricity prices, shifting or interrupting [21]. The users will adjust electricity demand according to the level of electricity prices. According to the market price theory, the relationship between the two is shown in (16) [22].
where P i,t represents the load of the microgrid i during the t period under the dynamic electricity price; P 0 i,t represents the adjustable load; P 1 i,t represents the fixed load; ρ i,t indicates how sensitive the load is to changes in electricity prices, ρ i,t < 0, the larger the |ρ i,t |, the higher the sensitivity. The adjustable loads include air conditioners, water heaters, washing machines and etc., the relevant model refer to references [23].

D. THE MULTI-OBJECTIVE FUNCTIONS
The economics of MMGs includes two parts: cost and benefit. The cost includes the power purchase cost C buy i,t , the operating cost C ope i,t , and the maintenance cost C maintain i,t . The benefit is the income from the electricity sales C sell i,t . Then the economic objective function of the multi-microgrids in one operating cycle is shown in (17).
where m represents the microgrid that buy electricity from microgrid i or sell electricity to microgrid i; P mtoi i,t and P Dtoi i,t respectively represent the power purchased by the microgrid i from the microgrid m and the distribution network; c fuel i , P FC i,t , η FC , and L HVNG respectively represent the fuel price, power generation, power generation efficiency and electric energy conversion factor of FC; P DE i,t , a i , b i , and c i respectively represent the power generation and fuel cost coefficient of DE;σ FC , σ DE , σ BT means the operation and maintenance costs of FC, DE and energy storage batteries; |P BT i,t | means the charge and discharge power of energy storage, when P BT i,t > 0, it indicates charge, while P BT i,t < 0 means discharge; P itom i,t , P itoD i,t represent the power sold by microgrid i to microgrid m and the distribution network.
The minimum objective function of environmental pollution produced by FC, DE and distribution networks is shown in (22).
where c FC i , c DE i and c D i respectively represent the environmental governance cost of FC, DE and distribution network / (yuan / kW· h). In this paper, using linear weighting method to deal with multiple objective functions.

E. THE CONSTRAINTS
(1) The power balance constraint and output constraint of microgrids.
where P PV i,t , P WT i,t , P load i,t respectively represent solar power, wind power, and load forecast value of microgrid i in time period t; P i,t represents the net output of microgrid;P i,t,min and P i,t,max indicate the minimum and maximum net output of the microgrid.
(2) The output constraints and climbing constraints of controllable units (3) The operational constraints of energy storage batteries where P FC i,t,min and P FC i,t,max represent the upper and lower limits of the charge and discharge power of the energy storage battery; SOC min and SOC max indicate the upper and lower limits of the safe capacity of the energy storage battery; In (31 ), it indicates that the state of the energy storage battery in each scheduling period is the same.
(4) The power interaction constraints between microgrid and distribution grid or microgrid.

IV. MODEL SOLVING
The optimization before MMGs scheduling is a dynamic process, due to the intelligent algorithms cannot find the accurate result, so the planning algorithm is used. Coding in MATLAB and calling CPLEX to solve by using the YALMIP toolbox. While scheduling, taking the best economy and the lowest environmental governance cost as the objective function, considering the many constraints, the krill herd algorithm (KH) is used to solve the problem. KH is an emerging intelligence optimization algorithm and was proposed by Gandomi first in 2012, comparing KH with other common algorithms (such as VOLUME 9, 2021 genetic algorithm, particle swarm algorithm (PSO), differential evolution algorithm) in 20 test functions, the results show that KH is the most robust and has fast convergence when solving global optimization problems [24]. The krill is a gathering organism, they gather to increase the population density to reduce the chance of predation, and at the same time, they are looking for food and shorten the distance between them and food as much as possible. The speed of krill during its movement is affected by three factors, that is the induced movement of other krill N i (t), its own foraging movement F i (t), and its own random movement D i (t), as shown in (34).
where N max , V f and D max represent the maximum induction speed, foraging speed and diffusion speed; α i , β i and δ represent the induction direction, foraging direction and diffusion direction; t and M i represent the current generation number and the maximum iteration number respectively; ω n and ω f represent the induction weight and the foraging weight. The larger the ω n and ω f , the better for global search, otherwise the better for the local search. Therefore, ω n and ω f should be designed larger in the early stage and smaller in the later stage. In this paper, we propose a nonlinear time-varying decreasing strategy, as shown in (38).
Under this strategy, the values of ω n and ω f are large in the early stage and decrease slowly, and decrease rapidly in the later stage. As shown in Fig.4.
The position change formula of krill during movement is shown in (39).
where t represents the scaling factor of the velocity vector; UB i , LB i respectively represent the maximum and minimum values of the variable i; Ct indicates the step size scaling factor of UB i and LB i ; NV indicates the number of variables. During the execution of the algorithm, crossover and mutation of genetic factors will be introduced, as shown in (41) and (42).
where Cr represents the crossover operator; M µ represents the genetic operator, and µ is a number between 0 and 1. The model solving flowchart is shown in Fig.5.

V. SIMULATION
A. SIMULATION DATA The simulation system in this paper includes three microgrids which contain wind and solar power, and the   Fig.6. In order to verify the   superiority of the improved KH, we select two test functions to test the algorithm's global optimization ability and convergence speed, and compare them with the standard KH and PSO. The test functions are shown in Table 4. According to the research and test corrections in the literature [25], setting the parameters of KH as follows: the population size N p = 50, the maximum number of generations M i = 100, the maximum induction speed N max = 0.01, the maximum foraging speed V f = 0.02, the maximum random diffusion speed D max = 0.005, the maximum inertia weight ω max = 0.7, the minimum inertia weight ω min = 0.1, and the step size scaling factor Ct = 0. 5

B. THE SIMULATION RESULTS AND ANALYSIS 1) THE PROOF OF DYNAMIC PRICE RATIONALITY
The total power supply and demand of MMGs system is shown in Fig. 7, and the dynamic power price established is shown in Fig. 8.
From the Fig. 7 and Fig. 8, we can see that between 5 and 15 o'clock, P sup t > P de t , p s/b t is lower than p a t . At the time of 11, 12 and 14 o'clock, P de t = 0, that is, the wind and solar power of each microgrid can meet its own needs, the remaining power is sold to the distribution network at a lower price c sell t . During the period of 16 to 24 o'clock, P sup t = 0, that is, each microgrid cannot meet its own needs, VOLUME 9, 2021   t is higher than p a t . The dynamic electricity price mentioned in this article has always been between the purchase and sale prices of distribution networks. When P sup t > P de t , the electricity price is lower, which encourages the increase in load; When P sup t < P de t , the electricity price is higher, which can play a role in stimulating load reduction. The comparison chart before and after adjustment of supply and demand of multimicrogrid system is shown in Fig.9. After the adjustment, the system power supply and demand gap has dropped  significantly, which further verified the rationality of the electricity price mentioned in this paper, optimized the load curve of each microgrid. In Fig. 10, it shows the comparison diagram of microgrid 1 before and after load adjustment.

2) THE COMPARISON OF MULTI-MICROGRIDS SYSTEM OPERATION IN THREE SCENARIOS
(1) Each microgrid is not optimized and only interacts with the distribution network; (2) Each microgrid is not optimized, and the microgrids interact according to the scheduling plan in this paper; (3) Each microgrid is optimized, and the microgrids interact according to the scheduling plan in this paper. The economic comparison of MMGs in three scenarios is shown in table 5. Compared with scenario 1, the economy of scenario 2 is increased by 14.3%, and the cost of environmental protection governance is reduced by 18.09%, which proves the economics of scheduling strategy; Compared with scenario 2, the economy of scenario 3 is increased by 26.90%, and the cost of environmental protection treatment is reduced by 25.95%, which proves the economics of dynamic electricity price.   In fig. 11, it shows the amount of electricity purchased, sold, and abandoned of the MMGs system under three scenarios. It can be seen that the interactive power between MMGs and the distribution network is dropped by 56.28% significantly, which is conducive to the stable operation of the distribution network. The proportion of power curtailment is declined by 63.22%, which is conducive to local consumption of new energy.
The operation of each microgrid in scenario 3 is shown as Fig. 12-14. It can be seen that during the valley period, the power of microgrid 1 is insufficient, the shortage of power is first purchased from microgrids 2 and 3, then the remaining power after the sale of microgrids 2 and 3 is charged to energy storage battery. At 5 o'clock, the remaining power of  microgrid 3 exceeded the maximum charging power of the battery, so it continued to sell to the distribution network. During the peak time, the remaining power after the interaction between microgrids is preferentially sold to the distribution network, which can ease the burden of power consumption during peak time and obtain higher returns. When it comes to the peak time at night, the power of each microgrid is insufficient, so the energy storage is discharged. At this time, the cost of the controllable power supply is less than the cost of purchasing electricity from the distribution network, so the controllable unit begin to generate power.

3) THE VERIFICATION OF THE IMPROVED KRILL SWARM ALGORITHM
Calculating the average fitness value and standard deviation of the three algorithms, which running 20 times on the function F 1 and F 2 . As shown in table 6, the fitness value of PSO differs greatly from the optimal value, followed by KH, and improved KH is the smallest, whose fitness value error is less than 0.04, it is indicated that the improved KH has a strong   global optimization ability. In addition, the standard deviation indicates that the improved KH has a strong stability.
In order to prove the superiority of the improved KH further, we test the average fitness value curve of the three algorithms on the function F 1 and F 2 , as shown in Fig.15 and 16. The improved KH converged in the 29th and 19th generations with high convergence accuracy. The improved KH performance is significantly better than KH and PSO.
In Fig.17, it is shown the evolution curve of using improved KH and KH to solve MMGs scheduling. The convergence speed of the improved KH is obviously better than that of KH, and the improved KH has reached the optimal value at the 38th iteration with 16.35s, while the KH approaches the global optimal value at the 92nd iteration with 21.79s, which  further proves that improved KH has greater advantages in solving MMGs scheduling.

4) THE PROOF OF THE SECURITY OF THE MULTI-MICROGRIDS SCHEDULING MODEL BASED ON THE BLOCKCHAIN
Taking the scheduling scheme formed by three microgrid nodes at the time of 2, 4, and 6 o'clock as an example, the scheduling data is stored on the leaf nodes of the Merkel tree, as shown in fig.18. The 3 → 1 : 16.17 means microgrid node 3 sells 16.17kW · h to microgrid node 1. The values of 3 → 1 : 16.17 and 3 → 2 : 0.95 after the hash function operation are 251063412ed52fa04eb51d18b1027133a64e57c7b206aa4c94 c3aeebefb66405 and 0973b086492f03fa51de46c75ace8835 bc9b39fef061d7dfceb8d98f2e119c75. Then the hash values of the two leaf nodes are hashed again, and the final hash value of the root node is 8e265d00a7bfc657519bbcfff24d5b 380ba9bb01f444e79d22c4044a50bf1873.
According to the hash value, the source of the data can be traced. If the scheduling data 3→2:0.95 is tampered with 3→2:1.95, the hash value is changed to 0973b086492f03fa51de46c75ace8835bc9b39fef061d7dfceb 8d98f2e119c75. The final root node hash value is 781d4df13dde27ada0b3a1f49df709d33c859b7636cb3alcfbe 73ebf704b884f. We can see that the hash values of the tampered nodes are completely different, the consensus cannot be completed, therefor ensuring the security of the data.

VI. CONCLUSION
In this paper, we propose a MMGs scheduling strategy that takes into account dynamic electricity prices based on the blockchain, and realize the scheduling of MMGs system. The research content is as follows: (1) Analyzed the combination of blockchain and MMGs scheduling, which can improve the security and economy of scheduling. Designed the scheduling framework and process of MMGs system based on blockchain. Verified that the blockchain technology can ensure the security of scheduling data.
(2) Established the dynamic electricity price model and load optimization model. The simulation results show that the dynamic electricity price can reflect the power supply and demand and adjust the load. The three scheduling scenarios designed in this paper show that the strategy can improve the economy and environmental protection of MMGs system by 37.33% and 39.34%, reduce the interactive power between microgrid and the distribution network by 56.28%, and the abandonment rate by 63.22%.
(3) Proposed an improved KH with non-linear timevarying decreasing weights, verified on the two test functions, the comparison proves that the improved KH has higher convergence speed and convergence accuracy.
In this paper, our load model is somewhat ideal, and we will improve the model in subsequent research to make the model more realistic.