Consensus-Based ADMM for Distributed Optimization in Power Systems using Private Blockchain Network

— The optimization problem for scheduling distributed energy resources (DERs) and battery energy storage systems (BESS) integrated with power grid is important to minimize energy consumption from conventional sources in response to demand. Conventionally this optimization problem is solved in a centralized manner, which limits the size of the problem that can be solved, and also creates a high communication overhead since all the data is transferred to the central controller. These limitations are addressed by a proposed consensus-ADMM (alternating direction method of multiplier) based distributed optimization algorithm, which decomposes the optimization problem into sub-problems. The distribution feeder is partitioned into low coupling sub-networks/regions, which solves the subproblem locally and exchanges information with the neighboring regions to reach consensus to solve for the global update. The information exchange and synchronization between sub-networks/regions are vital for distributed optimization. In this work, both of these aspects are addressed by the blockchain. The smart contract deployed on the blockchain network acts as a virtual aggregator for synchronization in distributed computation. The blockchain-based distributed optimization problem’s effectiveness is tested for 0.5-MW laboratory microgrid for one hour ahead and day-ahead for IEEE 123-bus and EPRI J1 test feeder, and results are compared with a centralized solution.


I. INTRODUCTION
ower distribution networks are being reshaped by the integration of distributed energy resources (DERs) and battery energy storage systems (BESS) [1]. These DERs, when used intelligently, can reduce our dependence on conventional energy resources and thereby decrease the generation cost to meet the demand [2]. The optimal power flow (OPF)economic dispatch problem [3] seeks to optimize the objective of minimizing the total generation cost while satisfying the constraints imposed by the distribution network and device operating limits. The OPF problem is challenging to solve because of the nonconvex feasible set, and hence convex relaxation would ease the computation complexity [4]. The second-order cone program (SOCP) relaxation for the power distribution network is proposed in [5]- [9]. The SOCP relaxed OPF problem can be solved using any convex optimization solver.
The authors of [10]- [15] have proposed algorithms for optimal power flow in power distribution networks with integrated BESS but are solved centrally. A centralized approach to solve the OPF problem in power distribution networks with a large number of integrated DERs and BESS is computationally challenging and exhibits poor scalability. A distributed optimization algorithm can address this challenge.
Several distributed optimization algorithms have been adapted and/or developed in recent years to solve the OPF problem, which decomposes the central problem into local subproblems. The algorithm in [16] is based on dual decomposition method and in [17]- [18] on the auxiliary variable method. The alternating direction method of multiplier (ADMM) [19], which is simultaneously general and scalable, is exploited in most of the recent research work to solve the OPF problem in a distributed fashion. The ADMM algorithm in [20]- [21] solves the OPF problem, exchanging voltage information between the neighboring regions; however, DERs and BESS are not integrated into the test network. The OPF problem with nonconvex feasible sets in [4], [23], and [24] is solved using a decentralized algorithm in which a specific node communicates only with its adjacent nodes with no central aggregator. The limitation of [4], and [23] is that the synchronization will not be easily achieved between the local sub-problems without the central aggregator. The other limitation is the exchange of information between each node in the network during the distributed computation, which can be exhaustive in a bigger system.
The communication infrastructure is essential for information exchange between the neighboring regions/nodes or the central aggregator to solve the distributed optimization problem. As discussed in [25], there are two kinds of communications infrastructure: 1) Centralized infrastructure and 2) Distributed infrastructure. The SCADA system is an example of centralized infrastructure, where local devices or RTUs send the data to the central controller and cannot exchange information amongst each other. The limitation of centralized infrastructure is that the fault in the central controller can halt the entire network. With the recent developments in IoT (internet of things) technology, the local controllers and RTUs (remote terminal units) can communicate with each other [26] and is an example of distributed communication infrastructure. The limitation of distributed infrastructure, without the central controller, is the synchronization of the local sub-problems.
In our work, the limitations mentioned above are addressed by deploying a smart contract on a blockchain network which acts as a virtual aggregator. Blockchain technology enables the direct and reliable exchange of information between the participating nodes or assets by establishing a secure and tamper-proof digital platform [27]- [28]. The blockchain has been used in [24] to store the optimal schedule and to make automatic and secure payments.
The main objective of this research work is to implement a distributed general form consensus OPF problem on a blockchain platform, which is solved by the ADMM-based method. The novel contributions of this research work are as follows: 1) The proposed consensus ADMM based OPF algorithm is implemented for distribution feeder partitioned into low coupling sub-networks/regions. The information exchange between the sub-networks instead of each node reduces the computation time, and the algorithm converges quickly. 2) The proposed consensus ADMM based OPF algorithm on the blockchain network utilizes the smart contract as a virtual aggregator, which provides secure data exchange, and synchronization between the local controllers of the sub-networks to solve the global update. Advanced distribution management systems could deploy smart contracts in existing utility grids.
3) The proposed consensus ADMM based OPF algorithm is tested for the Alaska Center for Energy and Power (ACEP) 0.5 MW Power System Integration (PSI) Laboratory Microgrid [29]. The rest of the paper is organized as follows. Section II describes the formulation of the OPF problem, BESS model, blockchain, and smart contract. The consensus ADMM method implemented on the blockchain network is explained in section III, followed by the test feeder network formulation in section IV. The simulation results are presented in section V. Section VI concludes the paper and discusses future work followed by acknowledgments.

II. FORMULATION OF OPF PROBLEM
In this section, we define an OPF problem for the power distribution network. The distribution network includes a substation node, renewable energy resources, fixed loads, BESS, and electric vehicles (EVs) as shapeable loads [30].

A. Distribution Network Model
The radial graph distributed network model Ř := (Ɲ, ℇ) where Ɲ := {0,1,2…,n} represents the set of nodes, and ℇ represents the set of distribution lines connecting these nodes in the network. Ɲ = 0 represents the root node, and the other nodes in Ɲ represent the branch nodes. For each node , it has a unique parent node and a set of children nodes = [ , 2 , … , ] [4]. For each line that connects node to its parent node , let = + be the impedance of the line. For each node ∈ Ɲ, let be the complex voltage, = | | 2 , and = + be the net complex power injection. Let be the complex current flowing from node to parent node , = | | 2 , and = + be the complex power flowing from node to child node . The branch flow model for this radial network is given by: = − ∑ ∈ + , = 0,1, . . , | | 2 = , = 1, . . , (1d)

B. Network Components
The set of network components at a particular node is denoted as: The net active and reactive power injection at a particular node is given by:

C. Battery Energy Storage System (BESS) Model
The BESS is characterized by its rated power ( ), rated energy ( ), and charging/discharging cycle efficiencies ( ℎ / ℎ ). The BESS model that is implemented in this paper is a mixed-integer linear model [31]. The charge and discharge state in the model is formulated as: where ∈ Ɲ, = 0, 1, 2, … , − 1, and = 24 h.

D. Centralized OPF and SOCP Relaxation of Constraints
The thermal generator cost at the substation node is typically represented by a quadratic fuel cost function given by: The optimal power flow (OPF) problem aims at minimizing the generation cost subject to branch flow equations and local DER constraints and is formulated as, where ( ) is the decision variable, and , is the net energy demand of the shapeable load (e.g., EV) and is charged between times and .
The quadratic equality constraint in (1d) makes the above OPF problem non-convex. The OPF problem can be relaxed to a convex problem by SOCP relaxation of (1d) given by, The selection of model-1 for the BESS yields a mixed-integer linear OPF problem (MILP), whereas model-2 yields a mixedinteger convex quadratic OPF problem (MICQP), and model-3 gives us a mixed-integer nonlinear OPF problem (MINLP).

E. Blockchain and Smart Contracts
The blockchain is a prominent technology that provides a secure and distributed database that contains the log of transactions in chronological order. The digital users/nodes on this blockchain network communicate through the Peer-to-Peer (P2P) system to reach a consensus on the valid state of the ledger. This is contrary to centralized systems which need the central authority to act as the intermediary to maintain the database and transactions and guard its authenticity. Furthermore, the security of the blockchain network is enhanced by hash functions and public-key cryptography and depends on the type of network, i.e., public or private network [32]. The users can either join the public blockchain network or the private blockchain network. In this research work, private network with the permissioned ledger is used that has reduced security but is fast, easy to scale, and energy-efficient [33].
The full potential of blockchain technology can only be utilized using smart contracts. The smart contract is a userdefined executable program that can alter the ledger and perform specific tasks when called upon by the users. The Ethereum is an open-source programmable distributed computing platform with smart contract functionality [34]. The distributed OPF algorithm proposed in this paper is developed on the private Ethereum network in which the smart contract is deployed to act as a virtual aggregator. The block diagram of the private Ethereum network for distributed OPF problem is shown in Fig. 1. The workflow showing the interaction between the smart contract and the users while solving the distributed OPF problem is explained in the following section.

III. DISTRIBUTED OPF PROBLEM FORMULATION
In this section, the distributed optimization algorithm based on consensus ADMM is presented to solve the OPF problem. Once the solution method is established, the algorithm is implemented on the blockchain network.

A. General Form Consensus ADMM
The general form consensus optimization problem is expressed by where ∈ , = 1,2,3, … , is a local variable which is related to the subproblem and consists of a selection of the components of the global variable ∈ . The mapping from local variable indices to some global variable index is expressed as = Ԍ( , ), which means that the local variable component ( ) corresponds to the global variable component [23]. Now, for the ease of notation, let � ∈ be defined by (̃) = Ԍ( , ) , representing the approximate mapping of the local variable into the global variable. The consensus constraint can now be expressed as − � = 0.
The augmented Lagrange function for the problem in (7) is where the dual variable ∈ , and is the penalty parameter. The iterations to solve the general form consensus ADMM problem mentioned in (8) is given by where and updates can be carried out separately and locally in parallel for each iteration . The -update step decouples across the components of and is expressed by where is obtained by averaging all the elements of +1 + , i.e., the sum of the dual variable entries that correspond to global index is zero. The -update step can now be expressed as where is the number of local variable entries that correspond to the global variable entry . The primal and dual residuals for the general form consensus ADMM is defined by The consensus ADMM converges to an optimal solution when the following condition is met: where and are the tolerances for the primal and dual residuals.

B. Application of General Consensus ADMM to OPF
To solve the distributed OPF problem, we partition the distribution network into sub-networks/regions, as shown in Fig. 2. Now the OPF problem for the entire distribution network is decomposed into global consensus form using the ADMM based method in such a way that each region needs to solve its local sub-problem in each iteration. The local sub-problem has its own objective function and set of constraints and is formulated for a particular region as Subject to (5b) -(5i).
The local variables to solve the sub-problem presented in (16)  The augmented Lagrangian for the OPF problem defined in (18) is given by This is decomposed into the general form consensus ADMM, and each region is locally solved using (18) subject to (5b) -(5i).
where ̃ is received from the aggregator. The region then sends the new � +1 to the aggregator, who computes the following -update for each individual global variable +1 The regions then receive the new +1 and update the dual variable as follows: The convergence criteria for the algorithm are defined in (14) and (15) with the values for and set to 1e-5.

C. Implementing the Algorithm on Blockchain Network
The private Ethereum blockchain network is used to implement the distributed OPF algorithm for the distribution network in this research work. The go-ethereum client (geth) is used to run a full Ethereum node. Each node/user on the Ethereum network is assigned a personal account defined by a private and public key. These accounts are indexed by their address (Π) derived from the public key. There are two types of Ethereum accounts: 1) externally owned accounts (EOAs) and 2) contracts accounts. The EOA is controlled by a private key and can transfer ether or trigger a contract code. The contract account has its own code and is controlled by that code. Upon establishing the Ethereum network to implement the consensus ADMM for the distributed OPF problem, an externally owned account indexed by address Π is set up for every region in the distribution network. The contracts account indexed by address Ψ is set up for the control center that deploys the smart contract (modeled in Solidity [35]) to the network. The address Ψ is shared with all regions in the network to communicate with the smart contract. The users/nodes interact with the Ethereum network by sending a transaction from an account by using a web3 object that connects to a JSON-RPC server [36]. The steps of the consensus ADMM for the distributed OPF problem implemented on the Ethereum network are expressed below.
Algorithm: Consensus ADMM for distributed OPF problem executed on the Blockchain network.

2.
Every region establishes a connection with the smart contract and retrieve the values of ̃, , and .

3.
The local optimization problem in (18) is solved by each region and the updated values of the coupling variable � is submitted to the smart contract.

4.
When all the regions have submitted their coupling variable, the smart contract will execute the z-update for each individual global variable +1 as expressed in (19).

5.
After step 4 is complete, the smart contract will send the updated values of the global variable to the regions to calculate described in (20). 6.
The region will calculate the primal and dual residual values (14). 7.
Each region will send the updated values of , , and to the smart contract. The contract will check for the stopping criteria ‖ ‖ 2 ≤ and ‖ ‖ 2 ≤ . If the stopping criteria are not met, the problem proceeds to step 2; otherwise, STOP.

IV. CASE STUDY
In this section, we discuss about validating the centralized and proposed consensus ADMM distributed OPF algorithms for the 0.5 MW Alaska Center for Energy and Power (ACEP) Power System Integration (PSI) lab microgrid with four control nodes and implementing the same for the IEEE 123-bus and EPRI J1 test feeder system.

A. ACEP PSI Laboratory Microgrid
The ACEP PSI lab operates on the same scale as one of Alaska's village power systems and can be modified for individual test scenarios. The PSI lab infrastructure includes a 320 kW diesel generator, a 100 kW wind emulator, a 540 VDC/1000 A-hr lead-acid battery, 312 kVA inverter, and two 250 kW programmable load banks. The one-line diagram of the ACEP PSI lab is available in [29].

B. IEEE 123-Bus Test Network
The IEEE 123-bus test feeder used in this study consists of 114 branch buses and is partitioned into seven regions, as shown in Fig. 3. The test feeder is also modified to a balanced network. The nominal operating voltage of the test feeder is 4.16 kV. The consensus ADMM optimization algorithm in (18), (19), and (20) is implemented for the partitioned IEEE 123-bus, where each region solves its local sub-problem and exchanges information with the neighboring regions.
Region 1 is a root/reference bus, which can either be a substation or thermal/diesel generator with a quadratic fuel cost function. Other regions consist of branch nodes that have a deterministic load profile, rooftop PV, shapeable load (EV), and BESS. The shapeable loads and BESS at each node are half the peak residential load. The storage capacity of BESS is 6 hours. The PECAN STREET project residential load data set from Jan 1 to June 30, 2017, is used in this research work [37]. Based on the results of the load profile aggregation (LPA) algorithm proposed in [38] for the IEEE 123-bus test feeder, there are average 8 houses on each bus with 3.5 kW peak load/house. The capacity of the rooftop PV installed at each house on branch nodes is 6 kW. The hourly 2017 NSRDB solar data from Jan 1 to June 30, 2017, is used for the rooftop PV.

C. EPRI J1 Test Feeder
The EPRI J1 test feeder has 3434 buses which serves approximately 1300 residential, commercial, and light industrial customers via 58 miles of 12.47 kV primary line [39]. The feeder is modified to a balanced three phase network and is partitioned into seven regions as shown in Fig. 4 for this work. The region 1 is a substation, whereas other regions consist of branch nodes that have residential, commercial, and light industrial load, residential roof-top PV, customer owned large PV system, shapeable loads (EVs), and BESS. The peak load of the entire feeder is approximately 6 MW. The shapeable load at each node with residential load is half the peak load. The 1.7 MW customer-owned PV systems already exist on the feeder. Additionally, rooftop PV and BESS rated 50% of the daily consumption for each residential load is also considered in this research work. The storage capacity of BESS is 6 hours. The hourly June 2012 solar data from EPRI [39] is used for PV.

D. Implementing the Test System on Ethereum Network
The go-ethereum/Geth client is installed for running the ethereum node on the computer and is used to connect to the private ethereum network. Upon setting up the network, the smart contract to implement the virtual aggregator for the consensus ADMM OPF problem for the ACEP PSI lab, IEEE 123-bus, and EPRI J1 test feeder is developed and compiled in Solidity. The local sub-problems are executed using Python and CVXPY. After solving the local sub-problems, each region in the ACEP PSI lab, IEEE 123-bus, and EPRI J1 test feeder communicates with Ethereum network using web3.py.

A. ACEP PSI Lab
The centralized OPF algorithm was tested in the ACEP PSI lab using a spinning reserve control (SRC) strategy [29]. The SRC maintains the loading on the diesel-electric generator between the minimum and maximum set points by using the inverter to compensate for over or under loading conditions. The OPF algorithms was simulated for 1 hour with a time step of 2.5 minutes. The dispatch plan generated by the algorithm and the results from the lab are presented in Fig. 5 to Fig. 8.    We can observe from the results that the battery energy storage discharges to the net load and charges from the excessive wind power. The minimum generation from the diesel generator was set at 100 kW to prevent wet stacking.

B. IEEE 123-Bus and EFRI J1 Test Feeder
The centralized algorithm was tested using the IEEE 123-bus test feeder, and the results are published in [30]. The dispatch plan generated for the IEEE 123-bus and EPRI J1 test feeder using the centralized MILP algorithm is shown in Fig. 9, and Fig. 10 respectively; and using distributed consensus ADMM w/o and with the blockchain are shown from Fig. 11 to Fig. 14.     We can observe from the dispatch plan that the battery energy storage responds to the peak demand and charges from the excess solar power. The charging schedule for the electric vehicles in the network coincides with solar power generation. TABLE 1 and TABLE 2

D. Computation Details
For the ACEP PSI lab, IEEE 123-bus, and EPRI J1 test feeder, the centralized OPF problem is simulated in a Pythonbased, open-source optimization modeling language Pyomo, and the proposed distributed optimization algorithm is simulated using CVXPY. The simulations are run on Windows 10 PC with 3.40 GHz Intel Core i7 processor and 16 GB RAM. The solver used and computation time is listed in TABLE 5 As seen from TABLE 5, the computation time to solve distributed consensus ADMM OPF problem is reduced compared to the centralized one for all three test system. Hence the algorithm is scalable and will be able to handle much larger system where centralized OPF will be computationally intensive.
For distributed consensus ADMM on a blockchain network, the time taken to validate the transactions is approximately 125s for the ACEP PSI lab and 1500s for IEEE 123-bus and EPRI J1 test system. The validation time is significantly high because each node transacts with the network in a serial fashion one after the other. In practice on edge computing devices, these transactions would be performed in parallel; providing the speed up by the factor equivalent to the number of regions the power distribution network is partitioned and will be demonstrated in future work. The algorithm is a part of an application which is being developed to integrate with the open-source ADMS platform GridAPPS-D [41]. The GridAPPS-D will act as a contracts account to deploy and manage the smart contract on Ethereum network and demonstration will be presented in future work.

VI. CONCLUSION
A consensus ADMM distributed optimization algorithm was proposed for OPF by partitioning the distribution network into sub-networks/regions. The IEEE 123-bus and EPRI J1 test feeder is partitioned into seven regions, and the information is exchanged between those regions instead of all the nodes. This reduces the computation time as well as the communication overhead, and the algorithm converges quickly. By comparing the results with the centralized algorithm, it can be concluded that the consensus ADMM distributed OPF algorithm converged quickly with reliable results. The proposed algorithm, when implemented on the blockchain network, takes more time to validate the nodes, but it eliminates the need for the central aggregator/controller since the smart contract deployed on the blockchain network acts as the virtual aggregator. The virtual aggregator will provide redundancy in centralized communication infrastructure and will eliminate the need for a central aggregator in distributed communication infrastructure. The virtual aggregator also manages the synchronization between the sub-networks/regions.

VII. ACKNOWLEDGMENT
The contributions to this research work were achieved through the Grid Modernization Laboratory Consortium