Reactive Power Optimization and Price Management in Microgrid Enabled with Blockchain

: The energy market is gradually changing from centralized trading to peer-to-peer trading due to the tremendous increase in a microgrid with green energy resources. When more generating units are included in the microgrid, the possibilities of more reactive power ﬂows exist in the system that leads to high transmission loss which has to be optimized. The reactive power is one of the essential ancillary services in the microgrid towards preserving the voltage in the transmission and distribution line. The major contribution of the paper is towards managing the ancillary service in the distributed energy network economically and technically. This study aims to estimate and optimize the power loss, reactive power, and price management as well. Towards optimization, the self-balanced di ﬀ erential evolution algorithm (SBDE) is used in this study. A distribution system operator is involved in coordinating the sellers and buyers. The proposed layered microgrid architecture uses the blockchain technology for reactive power price management by providing transparency and security among peers. The process of converging various transactions into a block and adding in the distributed blockchain is illustrated. Multiple transactions are performed by using the proposed methodology, giving e ﬃ cient energy transaction. The results show that the power loss is minimized using SBDE algorithm for di ﬀ erent cases. Additionally, the study has demonstrated the price allocation of the optimal reactive power obtained from providers. The blockchain technology embedded in reactive power pricing will play a signiﬁcant role in the evolution of traditional power distribution systems to active distribution networks.


Introduction
Microgrid is an autonomous network that can find fast solutions to the problem in the available systems, thus reducing human intervention and providing consumers with high-quality electricity. Electricity suppliers, buyers including small business and residential, technical support providers and utility providers are the different players who are available in microgrid for efficient power management. Peer-to-peer power exchange and the involvement of all players in the energy generation, operation, and distribution of power systems are essential to reduce downtime and satisfy the needs of consumers. In India, the microgrid has to be developed by considering the Strengths, Weaknesses, Opportunities and Threats (SWOT) analysis for efficient grid structure. However, the grid needs to be modernized because of the following factors: • Electricity generation and transmission must be achieved in a cost-effective manner.
• Retrieving the energy consumption using automotive equipment from the consumers in order to monitor and control the billing costs [1].
• Incorporating the renewable energy sources [2] into the existing system and thus reducing the greenhouse gas emissions.
• Providing customers with the efficient, uninterrupted, and secure power service.
• Supporting usage of electric vehicles to reduce the vehicle's dependence on fuel.
As per the Federal Energy Regulatory Commission (FERC), the reactive power generated from the generators is labeled as one of the six supplementary power system services. The reactive power was found to be the main cause of shutdown in the United States in 2003. Such reactive power should be maintained properly in the network. Moreover, both technologically and economically, the researchers understand the importance of reactive power [3].
In the Polish electricity market, the thermal coal cost and CO 2 emission allowance are strongly correlated [4] in order to fix the power prices in European countries. Natural resources increase the economic growth of the country using time series data [5]. Thereby the government should introduce the platform to use the natural resources in an efficient manner. The renewable energy market helps the community members who can market the electricity with their neighbors by exchanging the transactions securely using the blockchain technology [2,6].
The traditional way of centralized energy source is converging towards decentralized in which the small and medium scale industries have their renewable power plants. Similarly, the domestic users have their Solar PV at their rooftops. In the centralized model, from the view of the consumer side, they have to buy electricity only from the energy companies and the government decides the prices. Whereas, in the decentralized approach, every energy generating source can fix the suitable prices. This accelerated transition is technically called Industry 4.0 [7].
While looking at the management aspects, centralized governance will be easily compared to the decentralized approach. However, the consumers do not have any option other than utilizing the energy from one source. At the same time, the decentralized way of administration creates several other issues towards the management of the transactions. In order to accept this transition in the energy sector, security among several unknown parties has to be maintained in which no one should be allowed to cheat the system. By keeping this in mind, the authors of the present study decided to integrate the blockchain technology for secure administration of the decentralized approach.

Blockchain Technology
Blockchain is one of the recent technologies towards trust management among peers in a decentralized approach. It maintains immutable ledger or database that is defined in a distributed network. Satoshi Nakamoto is the person who has introduced the blockchain concept in which he has implemented the virtual currency called bitcoin [8,9]. Bitcoin is not the only cryptocurrency to be used in blockchain. Rather, the blockchain could be implemented in many other applications, which include tracking [10][11][12][13], transactions that happen automatically [14], business-to-business E-commerce [15], and finance-related transactions [16].
The blockchain is a distributed and secure open ledger, which has perennial growing data stored as blocks [17]. Every block consists of various categories of transactions, which are secured with timestamp, irreversible hash, and verifiable signature and are integrated like a chain. All the users have to maintain the blockchain and can verify at any time, but no one can modify a block once added in the chain [18].
The terminologies used in blockchain technology are summarized as follows [19][20][21]: Node: In a blockchain system, a node is an element where the blockchain is stored, and the transactions happen.
Block: A block is the fundamental element of the blockchain, which consists of a header and values. A header is encapsulated with block ID, nonce, timestamp, previous and current hash, and Merkle root necessary.
Miner: This is a special type of high configured node, which converts the incoming transactions into blocks as well as support towards linking the block in the blockchain.
Transaction: This is a set of operations towards the transfer of digital information that has to be added in the blockchain.
Consensus: This is an agreement, which consists of the protocols towards verifying the incoming transactions and several others.
The main contributions of this paper are as follows. A secured approach for reactive power pricing in microgrid using blockchain technology was proposed. The microgrid architecture proposed in this paper has various players, such as generators (sellers), consumers (buyers), and prosumers. Even though the blockchain is a decentralized architecture, a centralized role, named Distributed System Operator (DSO), is included in order to manage the distributed network. However, the DSO cannot modify the values in the transactions that are added in the blockchain. The DSO calculates the power loss and manages the microgrid towards balancing the voltage points.
Blockchain technology is used in the distributed system where there is no centralized administrative authority and lack of trust among these parties. In the applications, where the following properties are required, the blockchain technology can be used.

•
Multiple parties are involved in energy trading; • No trusted authority; • System requires transparency among the producers and consumers; • Decentralized operation; • Information once added in the ledger is immutable.
In the proposed architecture, since the above-mentioned properties are required, the blockchain technology is used.
Further, a layering model is proposed in which the reactive power pricing happens. IoT technology is used to collect information about the demand and loads at the buyer and seller side, respectively. The key points in this paper are:

•
Power loss is calculated towards each energy transaction using self-balanced differential evolution algorithm (SBDE) optimization algorithm; • Reactive power at the regulator nodes are optimized, estimated, and priced; • Transactions such as seller and buyer proposals, losses and seller to buyer mapping are added in the immutable ledger in the blockchain network.
Since the SBDE algorithm is a simple and population-based approach for optimization problem, the authors of this paper chose this algorithm. Based on the literature [22], it was found that the SBDE algorithm has been validated over 30 benchmark problems and found that SBDE outperforms various other search heuristic algorithms. Cognitive learning factor and scale factor in the mutation process of SBDE balances the exploration and exploitation of search space to get the global optimal value. The organization of this paper is as follows. Various existing works are summarized in Section 2. The architecture of the proposed blockchain enabled architecture is illustrated in Section 3. The energy blockchain platform, structure, and the process of energy trading using blockchain are illustrated in Section 4. Section 5 depicts the proposed optimization model of reactive power flow. The results are discussed in Section 6. Finally, the paper is concluded, and future work is presented in Section 7.

Reactive Power Pricing
FERC has considered the ancillary services [3], such as reactive power control and voltage control, reduction of loss, power scheduling, load following, protection, and energy balance. These services are entrusted to the system operator who maintains these services at transmission and distribution level.
Voltage control services include maintenance of desired voltage profile, and reactive power is injected at a specific location through reactive power providers. Black start is the ancillary services provided by generating units to inject energy. The mechanism for procurement of these services is analyzed by Oureilidis et al. [23]. There are two main approaches available for reactive power services. They are regulated-based approach and market-based approach. In regulated approach, provision of reactive power is made on the mandatory basis: (i) without compensation at certain limits, (ii) compensating the services with tariffs, (iii) based on long term and short-term compensation for services. The market-based approach is performed based on zonal or nodal dispatch. Transmission line operator sends the request for reactive power ahead of the next period so that agents can send their bids. System operators in transmission lines and distribution lines proposed AC optimal power flow to clear the bids to maximize the social welfare to meet the system reactive power profile.
Voltage control is performed by maintaining the reactive power at each bus. Automatic Voltage Regulator is used to maintain the voltage. Additionally, the generators are used to provide reactive power support in the system. Dynamic reactive power support is required during disturbances. Thus, reactive power is required to meet the reactive load and to meet the system losses for real power transfer [24]. Some generators are purposely used for starting the grid during grid collapse [25].
In a vertically integrated system, the costs for these services are not identified. In the United Kingdom, there has been an increase in evolution to market approach using voltage control services. Therefore, data collection, analysis, and appropriate pricing for this service are important. Existing methods for pricing the services provided by providers are (a) regulated price, (b) pay as bid, (c) market-clearing price [26,27].
Optimal Reactive Power Dispatch (ORPD) is a strenuous objective due to the uncertainties in the system because of renewable energy sources. Therefore, the marine predator algorithm is proposed to solve ORPD of the system to minimize loss [28]. Maximization of power generation from two sources such as solar and wind has been performed using neural network and bee optimization in hybrid renewable energy system. Wind pattern is trained in the model using a neural network, and bee algorithm is used for performing optimized MPPT for solar panel [29].

Peer-To-Peer Energy Trading Using Blockchain
Li et al. [30] have proposed a payment scheme based on credit towards faster support and recurrent energy trading in order to solve the restrictions on the number of transactions due to the acceptance delay in the peer-to-peer (P2P) energy blockchain. They have focused on P2P energy trading in different scenarios of Industrial IoT. Additionally, they have proposed an optimal pricing scheme that uses the Stackelberg game towards loan pricing for maximizing the credit bank utility.
Lüth et al. [31] have investigated the benefaction of batteries towards the electricity storage that could benefit the P2P energy traders for a minor community in London. They have addressed several questions towards the configuration of batteries, their economical latent, and the worth of prosumer batteries. They have investigated in a small community of houses with diverse demand patterns and equipped with either solar panels or wind turbine or both of them or without these sources. However, these houses are equipped with their batteries or storage shared within the community. Finally, they have observed that with the support of batteries, renewable energy sources satisfy their significant demand.
Applications that run with a centralized authority may be viable to compromise. Instead, the P2P applications are enabled with the support of distributed computing and storage architecture, which can divide the jobs or loads among the peers without any centralized authority. In the distributed architecture, some autonomous selfish users may not cooperate in data processing and transmissions to save their energy and bandwidth. To motivate such users, some rewards can be provided towards getting their cooperation [32]. The rewards could be in terms of cryptocurrency, renewable energy reward, or in other terms, which are viable to the producers and consumers.
To preserve the privacy between the energy traders or parties, a smart contract mechanism has been proposed [33] in which all the bids are encrypted and processed. The blockchain network guarantees that the bids are protected as well as publicly verified using the feature included in the smart contract. The producer and consumer matching are performed by the proposed functional encryption-based smart contract. Even though the payments and accountability are performed externally, the blockchain network guarantees that the prosumers are not able to repudiate their proposals.
Dong Han et al. [21] have represented peer-to-peer electricity trading using blockchain framework for the retail energy market. The framework is defined in three dimensions in which the first dimension is towards the underlying infrastructure, which includes blockchain as well. The second-dimension concentrates on the stakeholders of the trading system. The third dimension maintains the timing sequences of the entire electricity trading process.
Another P2P energy trading has been applied as a case study in Australia [34] with the support of blockchain technology for 18 residential customers who have acted as seller or buyer. In this model, an empirical agent, computer, is introduced to simulate the transactions between the sellers and buyers by considering the physical, technical, and financial concepts of the peer-to-peer energy system.
Di Silvestre et al. [18] have proposed an approach that uses the blockchain to make decisions in a distributed manner towards the control over the technical operations in the microgrid. They have summarized with a short review of various blockchain components that can be used for energy transactions. The authors have proposed the blockchain methodology on how to handle the losses in energy during allocation. In addition to the regular information in an energy block in blockchain, the authors have included the expected power losses in the transaction. They have suggested using the permissioned blockchain and the consensus mechanism as Proof of Stake for the energy blockchain because the decisions could be taken by the nodes which are holding the stakes.
Yunjun Yu et al. [2] have introduced a method of applying the Hyperledger fabric in the energy market of microgrid. They have proposed a prediction mechanism for predicting accurate bidding strategies using Bayesian correction in order to obtain decent quotations with good benefits. Towards promoting the local peers, they have proposed a bidding model by hierarchically combining the agents.
There are several real-time implementations of peer-to-peer energy trading platforms available that use the blockchain as a technology to provide security for the transactions in the network. Power Ledger [35] is the online system for an energy market, and it uses the blockchain technology towards energy trading for environmental commodities and sustainable energy. Pando [36] is an energy marketplace platform for the retailers and utilities for energy trading within the community. Another platform called Brooklyn Microgrid [37] facilitates the prosumers of New York city to trade the excess energy generated through solar PV.
Based on the literature, it was identified that the blockchain is the major technology used for P2P energy market in smart-grid and microgrid. Since reactive power pricing is also considered as an important parameter for pricing in the energy market, the authors identified the inclusion of blockchain towards providing security to the stakeholders of the energy market. During the implementation of blockchain in real-time energy market application, if the protocol that is defined for pricing the reactive power changes dynamically, it will be difficult for the programmers to include the same if the programming modules are tightly coupled. To overcome this issue, the layering based approach is introduced in this paper for the flexible implementation of the protocols in the proposed architecture.

Proposed Blockchain-Enabled Microgrid Architecture
The microgrid is not a new concept. In contrast, the deployment of blockchain technology together with the microgrid provides the producers and consumers with an easy way to use digital platforms with reliable, transparent, and secure transactions recording in a decentralized manner. Figure 1 shows the general microgrid architecture in which the reactive power pricing could be deployed using blockchain technology. The architecture consists of generators, consumers, prosumers, and utility grid. The power generators in this architecture are wind energy, solar energy, and diesel generator for backup. The consumers are assumed as residential area, official buildings, hospitals, and electric vehicle charging points. The prosumers are also available where they produce energy and consume the same. They will push the excess energy to the microgrid. There is a centralized role called a Distributed System Operator (DSO), who is responsible for loss computation, balancing the voltage points by running the optimization algorithm, and maintaining the distribution network. Every transaction, along with the power loss, is calculated and added as a block in the blockchain. The Internet of Things (IoT) provides opportunities for the development of business models towards monitoring and automation [38]. Using the IoT, the real power demand is measured and accessed by all the three layers in the proposed model, which is depicted in Figure 2. In real-time, the real-power demand is obtained from the consumer side using the IoT devices, and the corresponding reactive power demand is calculated and added as one of the transactions in the blockchain. Then, the reactive power pricing is reckoned and made available through an application to the customers. This pricing detail is processed by the commercial layer and added in the blockchain. The service providers are selected individually based on the demand, minimum system loss, cost, and quality of service required by the customers. Once the service providers are chosen, the power is transmitted by the power distribution center with the knowledge of the DSO. In this paper, the authors have taken the load data for 9-bus system [39]. The power demand varies over day and night, depending on the load. Hence, the power balances between production and consumption must be maintained in the power system. The power for increasing power demands must be retained. Using IoT technologies, the power demands are collected and made available in the cloud infrastructure for easy access. The optimal reactive power dispatch and reactive power pricing are the most important factors in the power system. • For each transaction, calculate the power loss; • Estimation and remuneration of the amount of reactive power which are necessary at the regulator nodes; • Use of smart contracts to automatically regulate the transactions between the producers, consumers, and prosumer nodes; • The writing of active and reactive power transactions in a blockchain.
The layered model of the blockchain-based reactive power optimization and pricing are shown in Figure 2.
The main objective of this platform is to minimize the power flow in a decentralized manner with the actual microgrid configuration that supports the domestic users who can access different distributed energy resources. In the physical link layer, the Optimal Power Flow (OPF) can be used to regulate the electricity flow, whereas, in the commercial layer, a symmetrical trading concept could be implemented. The symmetrical trading concept helps the domestic users to handle the trading easily and then allows choosing their partners in trading by which they could be able to compare the products. In the Information and Communication Technology (ICT) layer, the system is implemented on network-enabled with blockchain-based smart contract that acts as an invisible integrator. Table 1 shows the roles and their functionalities in the proposed model. The authors of [40,41] discussed the digital economy which includes ICT development and high internet technology. ICT node Third-party/stakeholder who maintains the blockchain, verifies the related activities, and provides user interface to interact with the system ICT In the microgrid setup, the producers and prosumers privately own solar PV, electric vehicles, wind turbine, and battery storage. The domestic users are allowed to choose from the list of available sources. The prosumers are allowed to use the generated electricity for domestic purpose, and the excess or remaining power will be made available for trading. While fixing the price and distribution of energy, the proposed optimal reactive power dispatch mechanism is required in the system. The reactive power generations from different providers are generated based on the agents' consumer requirements. The conventional methods of pricing are very restrictive and not transparent among the providers. However, the blockchain-based pricing method saves computational resources and acts as the main ICT for energy price. For each time slot, reactive power price is determined for the consumer based on their consumption from prosumer. The market mechanism and payment function are both conducted on the blockchain. The smart meter is used to measure agent demand and generation. Based on this information, excess demand or supply of reactive power is computed, and it is made available in the blockchain account of the agents. At the same time, detailed customer data are also stored for future reference. Similarly, the amount is added to the provider blockchain account for reactive power generation to meet the demand.

Consortium Blockchain
There are different approaches in the blockchain ownership towards the participation of the nodes in the microgrid network model. In the proposed model, the ownerships depend on the nature of the activities. There are different activities in the model which are sell and purchase the energy, price-fixing, payments, energy distribution, defining consensus, adding a block in the blockchain, viewing and verifying the data in the blockchain. All these activities should be performed by the predefined nodes in the blockchain network in order to provide security from the criminals. Hence, the proposed ownership model comes under the consortium blockchain. Since the consortium blockchain model is adopted in the microgrid network, only the predefined nodes are allowed to participate in energy trading.

Blockchain Structure
The stakeholders in the blockchain-enabled microgrid network are added upon accepting the common agreement towards the transactions in the distributed energy network. Towards securing the transactions, the blockchain technology uses a program called consensus protocol in which the agreements are written as a program that is executed automatically upon invocation of a transaction. Miners are a special type of node, they are involved in validating the newly initiated transactions and adding the transaction in the existing open ledger in terms of a block. In the energy network, a block consists of a header and the data [18]. The header consists of block number, timestamp, nonce, previous hash, Merkle root, and current block hash. The data consists of the energy transaction and power losses, which are digitally signed. The energy blockchain structure is depicted in Figure 3.  Figure 4 depicts the overall process of blockchain-based secure energy trading in a decentralized microgrid network. The DSO plays the role of coordinating the activities involved between the buyers and sellers. The transaction system at DSO runs the algorithm towards optimizing the power loss. The DSO does the mapping between the buyer and seller based on the power loss and line loading limit. However, the DSO does not have the rights to change any data between the buyers and sellers. During this trading, the transactions, such as proposals from buyers and sellers, power loss, and the mapping between the seller and buyer are also recorded in the blockchain. The sequence diagram per transaction is depicted in Figure 5. The transaction begins when there is a power demand, and the sellers are ready with that. Once the seller and buyer send their digitally signed proposal to the transaction system, it initiates to the DSO. The DSO acts as the coordinator between the seller, buyer, and the transaction system. Once the DSO receives the proposals, he/she verifies and initiates the optimization algorithm. Once the solution is obtained, the DSO finds the minimum power loss as well as verifies the loading limit in the line and maps the suitable seller to the buyer. Once mapping is done, it is notified to the transaction system. Then the system prepares the block of the entire transaction and sends the same to seller and buyer for verification. The seller and buyer verify and approve the block. Upon approval, the block is added in the blockchain with the stakeholders.

Optimal Reactive Power Dispatch
Optimal Reactive Power Dispatch is an optimization problem to ensure the reactive power production is sufficient, both technically and economically. The prime objective is the allocation of compensation device or existing device for reactive power satisfying the technical constraints. Here, the ORPD is to minimize the power losses for the microgrid system operation [42].
The objective function is labeled as Equation (1).
where P loss is the power loss in line, n l is the number of transmission lines, g k is the k-th line conductance, v a and v b are the bus voltage at bus a and b, δ a and δ b are the voltage angle at bus a and b, respectively. The objective function has to be satisfied with following constraints, Equations (2) and (3). The total power generation should be equal to demand plus losses [22].
where P gi and Q gi are real power and reactive power generation at bus i, n g is the number of generators, n d is the number of loads, P Li and Q Li are the real and reactive power demand at bus i and P losses and Q losses are real and reactive power losses. The inequality constraints should lie between minimum and maximum values for variables such as real power and reactive power at different nodes, bus voltages, and transformer tap setting. This optimization problem is performed in MATLAB2018a.
As a result of SBDE, the reactive power requirement at different set points is identified and sent to the regulator nodes. Therefore, apart from the transaction block, hosting calculation of power losses after execution of the SBDE is devoted. All generators must provide reactive power and exchange with the microgrid to which it is connected. The reactive power injection for system security is sometimes implemented by limiting the active power exchange according to the capability curve [43].
The microgrid works either in connection to main grid mode or Islanded mode. The issue becomes even more important for islanded microgrids, where the main grid's contribution to voltage support is not available, and only distributed generators can provide reactive electricity. Now, the term opportunity cost comes into the picture for two mutually exclusive cases, such as it happens when the capability curve of generator reduces active power in order to produce reactive power.

Self-Balanced Differential Evolution (SBDE)
Conventional optimization techniques are not able to give an optimal solution for the high dimensional problem. Thus, the evolutionary computation technique gains more interest in the optimization problem of the power system. In this paper, to solve the optimization problem, the SBDE is used [22]. It has the following process.

Initialization
Initialization of the candidate population and the decision parameters are chosen from the feasible limits, Equation (4). where G is the iteration, a = 1, 2, ..., N which denotes population size and b = 1, 2, ..., D which denotes number of control parameters. Each vector x in the population behaves like a target vector. A suitable selection of control parameters makes faster convergence of objective function. If the population size is less, it will lead to local optimum otherwise towards diverging evaluation.

Mutation
The second process is the mutation process. The mutant vector is created using random vectors, which are generated from the previous step. It can be written, as mentioned in Equation (5).
where F is the mutation scaling factor, and C is the cognitive learning factor. The two factors, such as C and F give faster convergence and explore the search space. This process provides faster convergence [43].

Cross Over
It introduces the trial vector U, which is a combination of mutant and parent vector based on the probability distribution, Equation (6). The crossover rate (CR) is 1, and then the trial vector is a fully mutant vector. If it is zero, the target vector will be the trailing vector.

Selection
It is the last stage of this technique. It compares the target vector and trail vector and selects the vector which provides the best fitness value as population for the next iteration, as shown in Equation (7). The stopping criterion is checked in this last stage.
The optimal solution of reactive power dispatch of generator is found using this algorithm. Then, the power tracing method helps to find the reactive power contribution of the individual generator to individual load. Then the opportunity cost of generator is shared among loads based on their usage of power, and it is detailed as follows.

Cost of Reactive Power Providers
The generator is considered an important provider of reactive power ancillary services according to FERC. The production of reactive power by the generator leads to a reduction in real-power resulting in financial losses that could be offset by the incorporation of reactive power costs in addition to actual power costs. This reactive power cost is called opportunity cost, Equation (8) [44].
The real power cost functions are represented as shown in the following Equation (9).
where a, b, and c are cost coefficients in $/MWh 2 , $/MWh, and $/h. P Pgi is the real power generation of i-th generator. C Pgi (P pgi ) and C Qgi (Q gi ) are the real power, and reactive power production cost and k are the profit rate. In this paper, k = 0.1.

Static VAr Compensator (SVC)
The SVC is a shunt connected static VAr compensator for which the reactive power can be injected or absorbed at a selected bus [18]. The operating range of SVC is in the range from −100 MVAr to +300 MVAr.
According to De and Goswami [44], the production cost function of reactive power for SVC is given as Equations (10) and (11).
where the operation range S of FACTS devices is represented by MVAr, Q 1 and Q 2 are line reactive power before and after the SVC installation. The unit for production price and investment price of reactive power is given as $/h and $. Typically, the service years of FACTS devices is more but only part of its life is considered for reactive power pricing. In this article, lifetime is assumed as five for calculating the cost function. Hence, the average investment cost of SVC [44], C(f ) is found by Equation (12).

Results and Discussion
The computational experiments were done using a laptop having the configuration as Intel(R) Core i7-5600 CPU at 2.60 GHz with 8.00 GB RAM and Microsoft Windows 10 operating system. The simulation results for optimization were taken from MATLAB2018a.
The proposed algorithms were applied to the ORPD problem of the nine bus system to evaluate the efficiency of SBDE. The network has three PV buses with nine transmission lines and three PQ buses. The data of generator, loads, and transmission lines were taken from [27,39]. The control variables are bus voltages, transformer tap configuration, and SVC value. The bus voltage magnitude and transformer tap should lie between the limits of 0.9-1.1 pu. Operating limits of SVC is −100 to 300 MVAr. There are seven monitoring control variables. In the system having CPU with a clock speed of 2.6 GHz and 8 GB RAM, the optimization problem is simulated. The generating units provide the optimum actual and reactive capacity along with the cost for possible cases to satisfy the cloud user and host requirements. The customers choose the situation, and the following is explained: Case 1: Minimization of real power loss as objective function (without SVC). Case 2: Minimization of real power loss as objective function (with SVC).
The optimization algorithm is used to find the optimal control variables of the loss minimization problem. The modified IEEE 9-bus system is considered for the analysis of system stability. The original data of IEEE 9-bus system is modified by increasing the reactive power at bus number 9 from 50 MVAr to 200 MVAr. The system was studied using two cases-Case 1, without the incorporation of SVC device and Case 2, with the incorporation of SVC device in the system.
In Case 1, without the incorporation of SVC devices, the power flow and pricing calculation are done for the modified test system. The simulation parameters are shown in Table 2. In Case 2, the SVC is shunt connected at bus number 9, since this bus has low voltage and high reactive load among all the buses. The optimal value of reactive power is found as 100 MVAr. With the incorporation of SVC, the voltage profile at bus number 9 is improved. The system transmission loss is also reduced to 4.75 MW, as shown in convergence characteristics ( Figure 6).
It is found using SVC, and the voltage magnitude is more compared to the system without SVC as shown in Figure 7a,b. Figure 8a,b shows the reactive power contribution of each generator and transmission line to each load without and with SVC. The reactive power produced by the generator and SVC are priced in the proposed work. The generation price of reactive power of three generators is calculated towards the allotment of the reactive power price to the consumer. It considers the production cost of three generators in real power, Equations (13)-(15) [26]: C Pg3 (P Pg3 ) = 335 + P Pg3 + 0.1225P Pg3 2 ; $/h   Table 3 indicates the price allocation towards reactive power production without and with SVC. Some generators consume reactive electricity, thus working in the region of under excitation. In order to minimize the transmission loss, the reactive power produced by the individual generator is less. In Case1, it was found that the power could not be consumed by the loads 5 and 7 from the generators 1 and 2. The total cost towards the generator reactive power production becomes 379 $/h, which is shown in Table 4. In Case 2, the contribution of reactive power towards the loads by the generator and SVC are priced. It was found that the total generation cost of reactive power from generator and SVC is 361$/h, which is shown in Table 4.  Figure 7a,b shows the comparison graph of voltage magnitude at different buses for two cases with and without using the SBDE algorithm. It was found that there is a slight improvement in voltage magnitude using the SBDE algorithm. Figure 8a,b shows the optimal dispatch of power from the generator, which was priced, and it is shown in Table 4.
Comparing the above two cases, there will be a reduction in the total production cost of reactive power, i.e., 16$/h with the incorporation of SVC device in the test system. Thus, the incorporation of SVC device for an extensive system will save the reactive power cost allocation to the consumer. Additionally, in general, the voltage profile of the system is enhanced under the critical condition of the system.
The reactive power generation varies based on the location of reactive power producer and its production cost. They are (i) producing the reactive power dynamically and (ii) by receiving from the capacitor the static reactive power supply. With the assistance of IoT, the network operator collects the power requirement information in the cloud and recommends the feasible reactive power service cases from which the user selects the feasible option based on demand, quality, and cost. It can be found that the objective function is strongly minimized, and it is reflected in the final solution. Thus, using blockchain technology, all suppliers can know the status in blockchain account, and no one can change the system integrity.
Further, each generator can act as the seller bus based on load requirements. Multiple transactions are possible at the same instant considering each generator bus as the seller bus to each load, as shown in Figure 9. From Time t1 to t4, the energy transactions begin at t1 and ends at t4, the generator sells power to load. Another transaction starts at t2 and ends at t4, another generator sells power to another load. The microgrid consists of three generating units at buses 1, 2, and 3, and they are used to generate power to meet loads with minimum power losses in the line. Reactive power generation is also provided as ancillary services during energy transaction. Energy transactions take place from the time instants t1 to t4 and t2 to t4 as follows: 1.
The load 7 acts as a buyer for the power of 100 MW. It can get the power from either generator 1, 2, or 3. DSO matches the best seller for this buyer such that the total system losses should be minimum. Based on the algorithm, it is found that bus 3 acts as a seller bus to meet the load at bus7. The percentage increase in system losses will be 0.53. When generators 1 and 2 act as a seller, the percentage increase in loss will be more.

2.
From Table 5, it can be found that bus 2 should act as seller bus for load bus 5. The percentage increase in system losses for this case is 5.83. The remaining generators 1 and 3 reduce the system losses; but, the overloading of transmission line comes into the picture. The line flowing from bus 1 to bus 4 gets overloaded when bus 1 acts as seller bus for load 5. When bus 3 acts as seller bus, the transmission line from bus 3 to bus 6 was overloaded. Therefore, the DSO analyzes all the possible cases and identifies the best seller to meet the demand at bus 5. Multiple transactions take place between generators and loads at successive time instants. During transaction tr1, DG3 sells the power of 100 MW to bus 7. During transaction tr2, DG2 sells the power of 125 MW to bus 5.
A comparative analysis was performed for above-mentioned two different cases through DSO to serve the technical requirement of network. The reactive power requirement was obtained from different nodes after performing optimization algorithm with the aim of minimizing the system losses. From Table 6, it is understandable that the system losses are reduced with each of the transactions as a result of reactive power contribution from regulating nodes after performing the optimization algorithm. Table 6 shows the comparison of system losses for each of the transactions before and after using an optimization algorithm.
A comparative analysis was performed for different transactions. The requirements of reactive power at different nodes are obtained from the regulatory nodes using the optimization technique with the prime objective of minimum transmission losses. For each transaction, the contribution towards active losses is mentioned. Sufficient generator power production and operating modes as seller proposal and load requirement as buyer proposal along with the optimization algorithm, the flow of energy transactions was successfully carried out using blockchain technology. Most researchers used swarm intelligence algorithm for the reactive power dispatch problem that is dependent on natural or physical spectacles. In order to show the effectiveness of the proposed methodology, the results were compared with published results available in literature. The base case power loss for IEEE 9-bus system is 4.95 MW.
In the reference of Di Silvestre et al. [42], IEEE 9 bus system is taken for study, and it is found that the objective function is the minimization of real power loss and achieved at 70th iteration using glow warm swarm (GSO) optimization algorithm. The reactive power set point is deducted at each regulator node using GSO algorithm. SBDE gives the best outperformance when compared to GSO technique in order to find the optimal reactive power dispatch. The main advantage of this algorithm is that it balances the control parameters, and thereby the computational effort is significantly reduced. It requires a smaller number of control parameters, and faster convergence for multimodal function, i.e., objective function is minimized in 60 iterations. The power loss is very minimum of 4.75 MW, but in the study of Di Silvestre et al. [42], the system loss is minimized at 70th iteration. Exploration of the search region and exploitation of solution region are outperformed in SBDE algorithm when compared to other optimization algorithms. The power losses calculated using gravitational search algorithm (GSA) is 5.37 MW [45,46], and normal load flow solution considering SVC is 5.31 MW [47], which is higher power loss than the proposed work.
The electricity transactions were carried out using blockchain technology, but the ancillary services are not considered in the study [2]. It is quite evident that the difficulties found in the literature are overcome in the present study.

Conclusions
Reactive power is considered as one of the important supplementary services in energy transmission and distribution towards maintaining the voltage in the microgrid. In this study, reactive power optimization was performed using the SBDE algorithm. Since the power loss also plays a vital role during transmission, it was also considered in the calculation of reactive power pricing by which the sellers are also benefited. Simulation results show the savings of 16$/h in the total production cost of reactive power in the system due to the usage of the SVC device, and it is made transparent by the sellers through the proposal using blockchain technology. The proposed microgrid architecture enabled with blockchain facilitates the sellers and buyers, a transparent method of approach towards P2P energy trading by maintaining the security. In this architecture, a technical person DSO is included in managing the optimization of power loss and financial aspects. Thus, ancillary service provision is facilitated and priced using the opportunity cost method. Multiple transactions are also possible at a particular time and made visible for all generators. The DSO verifies and initiates several processes during the energy transactions between the sellers and buyers. The layered model makes the real-time implementations easier and provides flexibility for the stakeholders as well as the programmers.
This study also has some limitations. The energy transactions were carried out for a smaller system size by considering only PV/PQ nodes. Further studies can be achieved towards power balancing between generator and load using various renewable energy sources such as solar, wind, and biomass considering FACTS devices. The real and reactive power pricing along with optimization can be implemented with customizable consensus protocol in blockchain. This model can be implemented and tested in a real-time scenario by increasing the number of nodes in the microgrid network in future studies.
Author Contributions: Concepts, methodology, and validation of the work in this paper were done by D.D. and G.R. completed the work related to blockchain technology. Draft preparation, editing, and visualization were done by A.H. Literature review and formal analysis were done by I.O. and Y.B. All authors have read and agreed to the published version of the manuscript.