Towards Developing a Large Distributed Energy Storage Using a Weighted Batteries Scheduling Scheme

The energy storage system (ESS) is the next major disruption to the current architecture of the electricity grid. Energy storage offers several benefits to the electricity grid, which include frequency regulation, energy arbitrage, peak shaving, reducing intermittency of renewable energy sources (RESs), and many other benefits that are not possible without large energy storage. Large-scale batteries are still expensive and cannot be readily used with a reasonable return on investment. Aggregating a large number of consumers’ small scale batteries may provide us with the benefits of large central storage. However, aggregated small-scale batteries have several advantages over large central storage. Small-scale batteries provide better scalability and open up many new investment opportunities for the grid as well as for the consumers. In this article, we present a control scheme for small-scale distributed batteries, namely, Weighted Batteries Scheduling (WBS) scheme to make a large distributed energy storage. We also present a method to calculate weights, that are required for the WBS scheme, by prioritizing the batteries with respect to the state-of-charge (SOC). We evaluate the fairness of the proposed scheme using Jain’s fairness index and entropy-based fairness index. The proposed storage model can be used for any necessary support for the electricity grid. We study financial benefits obtained by the large distributed energy storage for frequency regulation, energy arbitrage and peak shaving. Frequency regulation appears to be of the highest value for energy storage. Our results show that a distributed storage consisting of 1000 small batteries each of 1 kW power achieves average daily revenue of $606.61.


I. INTRODUCTION
ESS is gaining rapid growth due to the electricity shortfalls caused by several factors including increased electricity demand, uncertain electricity generation from RESs, and weather conditions [1], [2]. ESS plays a central role in the future smart electricity grid for optimized usage of electricity and for reducing harmful chemical emissions [3]. Installation of a high capacity intermittent RESs at the grid level requires high capacity ESS to mitigate intermittent and variable generation from RESs [4].
After the 2016 electricity blackout in South Australia, the country installed a very large lithium-ion 129MWh/ 100MW battery with the help of Tesla in 2017 [5]. The The associate editor coordinating the review of this manuscript and approving it for publication was Xiaofeng Yang . battery cost was around $50 million. The battery reached 100MW output only in 140ms after the failure of a coal power plant [6]. Part of the battery power is used to support a wind farm and the remaining power is used by the South Australia for system regulation and ancillary services. It is reported that the Tesla battery has reduced grid service cost by 90% [7]. In January 2018, electricity spot market price spiked up to AU$14,200/MWh due to power supply shortage [8]. The battery took huge advantage of this price spike and discharged power at a very high electricity price of 12,900/MWh to 14,200/MWh [8], [9].
Installation of centralized high capacity ESS at the grid level suffers from certain disadvantages which include high capital, maintenance and operational cost, and grid degradation due to single point storage failure. Moreover, the scalability may not be achieved at the level where we would like to see VOLUME 8, 2020 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ it. In the case of the South Australian Tesla battery, the cost is around $50 million. Using a large number of consumer's batteries, with centralized control, as a large distributed storage for the electricity grid is equally or more advantageous than a large scale battery. The capital, maintenance and operational cost incurred by centralized storage can be used to incentivize the ESS owners for providing their ESS as a rental service. This gives rise to lucrative business models for utility companies as well as financial advantages for the consumers. The business model of SolarCity, a solar energy company founded in 2006, is worth mentioning here. In 2008, SolarCity created an innovative business model of leasing solar panels under a power purchase agreement (PPA), which resulted in the adoption of solar panels by a large number of electricity consumers. Under PPA, SolarCity installed and managed a solar system at the customer's location without any fee. The customer had to pay for the electricity generated from the solar system at a rate much lower than the rate of a utility company. SolarCity had acquired 298000 customers until 2015 [10]. Tesla acquired SolarCity in 2016 and stopped this feature of leasing a solar panel under PPA. However, Tesla launched a solar leasing option for its customers for a fixed monthly price. The scalability of solar systems would not be possible without distributed installations and without giving financial incentives to the consumers. Likewise, we can create a large and scalable distributed energy storage by using ESSs of the electricity consumers.
In this article, we propose a centralized control scheme for a large number of batteries. The proposed scheme calculates weights for each of the ESSs to schedule a net energy x net among the N ESSs as shown in Fig. 1. An interesting case, where the proposed scheme is useful, is the one where electricity consumers have already installed ESSs. A survey estimated that electricity consumers in Pakistan had installed over 2.8 million battery-based uninterruptible power supplies (UPSs) in the year 2012-13 with an increasing rate of 4.5% per year [11]. Consumers installed these UPSs due to load shedding problems in Pakistan caused by electricity shortfalls. Now, the electricity shortfall is almost over and these batteries need to be utilized. One of our collaborator research group is working on instrumenting the UPSs for improved control [12]- [14]. Therefore, the proposed scheme is particularly useful in the context of Pakistan where a large number of consumers has already installed battery-based UPSs.

A. RELATED WORK
Extensive research has been done to find an optimal charge/ discharge schedule for distributed energy storage for various applications in the electricity grid. These applications include mitigation of renewable power uncertainties [15]- [17], community microgrids, improving the power quality of the distribution network [18], [19], DC microgrids [20], voltage and frequency regulation [21].
Ali et al. [22] propose a centralized control strategy for charging and discharging of a distributed storage. The objective of centralized control is to increase the calendar life of the batteries. The algorithm prioritizes the batteries with respect to the batteries' energy capacities to decrease the depth of discharge. The disadvantage of their control strategy is that the batteries utilization will not be the same for all the batteries. Some of the batteries may be utilized more than the others. Li et al. [23] propose a control strategy for distributed storage based on the charge-discharge balance of energy storage. The aim of the control strategy is to maximize the arbitrage profit and reduce peaks in the demand profile. The objective of the peak load reduction is to defer substation expansion in the distribution network.
Nasir et al. [24] proposed a scheme to integrate standalone photovoltaic solar home systems (SHSs) to fulfill the community load demand. Each of the households has installed a solar panel and energy storage to store excess energy. The authors proposed a power electronic interface to integrate the SHSs and a decentralized scheme to discharge the batteries to fulfill the community load demand. Each of the batteries is discharged according to the availability of the resource which is quantified by the SOC of the battery. The batteries with higher SOC levels contribute more to fulfill the community demand and vice versa. Overall, the scheme shows promising results. The authors have shown that the aggregated power output from all the SHSs using the decentralized control scheme is equal to the community demand. However, the effect of charging and discharging on the batteries' lifetime has not been studied.
Malandra et al. [25] introduced the concept of a Smart Distributed Energy Storage Controller (smartDESC). The smart-DESC architecture consists of seven modules. The authors used an electrical water heater as a distributed energy storage which can be used to balance the power output of renewable energy sources. The smartDESC architecture highly depends on the accuracy of the forecast. It requires that the power output from renewable energy sources can be forecasted for the next 24 hours with reasonable accuracy.
Zhong et al. [26] propose a centralized control algorithm for sharing a distributed storage among different users. The physical distributed storage is shared among users as virtual storage. The central controller aims at coordinating the energy sharing among the users. Although, the proposed scheme is advantageous for the electricity consumers who can buy virtual energy storage from a physical distributed energy storage. But, the distributed storage has not been used at the grid level for ancillary services.
Babacan et al. [4] used convex optimization to find optimal charge/discharge schedule for distributed energy storage along with local solar generation. The objective is to minimize the consumer's monthly electricity bill. In addition to using TOU tariffs with energy charges and demand charges, a novel supply charge is introduced to encourage self PV consumption. Distributed storage is proposed but it is still used and controlled by the respective owners. Individual peak demand is reduced but the overall peak demand on the grid may be increased. Xu and Tong [27] used dynamic programming to determine a threshold based charging/discharging policy for the electricity storage at the consumer locations. Electricity consumer has full control of charging/discharging of the storage and electricity can also be sold back to the grid.
Agamah and Ekonomou [28], [29] proposed an optimization method using combinatorial optimization for the planning of ESS along with demand response programs. The heuristic combinatorial optimization algorithm is used to perform load leveling. Reduction in the peak demand improves the quality and stability of the power system [29].
A distributed storage can be controlled individually using proper incentives as in [4]. Individual uncoordinated charging may have an adverse effect on the grid due to the charging of a large number of batteries at the same time. Zheng et al. [3] proposed a centralized control of distributed ESSs as opposed to individual control. The authors of [3] compared individual control strategy with a centralized control strategy with respect to environmental and economic benefits. Centralized control strategy of distributed storage avoids adverse effects on the grid without affecting financial benefits to the storage owners.
Existing schemes in literature either use single large energy storage to support the electricity grid. The schemes that use distributed storage are based on individual control and give some benefit to the storage owners. Our proposed distributed storage model is based on aggregating a large number of ESSs using a centralized control mechanism which makes it different from the other schemes in the literature. Secondly, the existing schemes focus point is usually a single application area. Using our proposed scheme, the retailers that control the distributed energy storage can use it in different grid applications. The proposed storage model provides financial incentives to both the retailers as well as the storage owners.

B. MOTIVATION
To the best of our knowledge, there are a few research articles that propose a centralized control of distributed ESSs.
A large number of articles on distributed storages propose an individual control of ESSs in the interest of the storage owner or to reduce harmful chemicals. Individual control schemes provide financial incentives to the owner but storage remains highly underutilized. In developing countries, a large number of electricity consumers has already installed ESSs. We propose a scheme to utilize a large number of batteries to support the electricity grid as well as to provide financial incentives to the electricity consumers. In this article, we make three main contributions. First, we propose a centrally controlled model of a large distributed energy storage consisting of many small batteries for the future smart grid. Second, we propose a centralized control scheme, called Weighted Battery Scheduling (WBS) scheme, for controlling the distributed energy storage. We also propose a method to calculate the weights for the batteries based on their SOC. These weights are required for the WBS scheme for scheduling the batteries for charging or discharging. Third, we give a detailed overview of the various applications that the proposed storage model can provide to the smart electricity grid. The proposed distributed storage model offers the same benefits to the electricity grid as large centralized storage does such as ancillary services, peak demand reduction, and less need for fossil fuel-based backup generators during contingencies. Less usage of fossil fuel-based backup generators results in reduced emission of harmful chemicals in the atmosphere. Some of the obvious advantages of the proposed storage model are: 1) Capital, maintenance and operational costs are distributed among owners of the individual ESSs and are not paid by the retailer.
2) The Capacity of the distributed storage is scalable which can increase after the participation of the new consumers.
3) It avoids grid degradation that may happen in case of centralized storage due to storage failure, i.e. single point failure does not deteriorate the performance of the whole system. 4) The storage can be pitched at varying levels of hierarchy from the distribution level to the neighborhood level. 5) It can work as an uber-like service for the storage owners where the storage owner participates in the distributed storage and the retailer incentivize the storage owners with respect to the usage of the ESS. 6) The distributed storage schemes are useful for countries like Pakistan where consumers have already installed battery-based UPSs. After the energy crisis is over, these several batteries can be used for various applications to the electricity grid.
The rest of the paper is organized as follows: In section II, we describe the proposed large energy storage model using the WBS centralized control scheme and a method to compute weights by prioritizing the ESSs. In section III, we describe three application areas of the proposed distributed storage. We describe the simulation setup in VOLUME 8, 2020 section IV. In section V, we discuss the simulation results. We conclude the paper in section VI.

B. ENERGY STORAGE MODEL
We use an energy storage model that has already been used in previous studies [19], [30]- [32]. Energy storage is characterized by the following parameters • Energy Capacity (kWh): Total energy that can be stored in the energy storage.
• Charging and Discharging Efficiency: There is a loss of energy during charging as well as discharging. The round trip efficiency of the ESS is the ratio of the total energy discharged from the ESS to the total energy input to the ESS. The charging and discharging efficiencies degrade with the number of cycles and operating conditions. However, the degradation in the efficiencies is very small. In a case study [33], it is shown that the efficiency of the li-ion battery degrades from 95% to 94% over the lifetime. Another study [34] also shows similar results. Therefore, we assume constant values for the battery efficiencies.
Let C, P c , P d , η c and η d be the energy capacity, the maximum charging power, the maximum discharging power, the charging efficiency and the discharging efficiency of the energy storage, respectively. Let P be the charge power (> 0) or discharge power (<0) applied from time t to time t + t. Then the state of charge SOC t+ t at time t + t can be calculated using Eq. (1) as (1)

C. WEIGHTED BATTERIES SCHEDULING (WBS)
Suppose, N consumers are participating in the distributed storage and have connected their batteries with the central controller. We use superscript t and subscripts i (or j) to represent the association of quantities with the time instant and the particular battery, respectively. Let C i , P ci , P di , η ci , η di and SOC t i (i = 1, 2, 3, . . . , N ) be the energy capacity, maximum charging power, maximum discharging power, charging efficiency, discharging efficiency and the SOC at time t, of the i th battery, respectively. The central controller has to schedule a net energy x t net (kWh) among the N connected batteries over the time interval t to t + t. By convention, we represent time in hours. If we denote x t i (i = 1, 2, . . . , N ) to be the energy (kWh) scheduled to the i th battery during the time interval [t, t + t], the problem is to find Definition 1: The net charge (discharge) energy x t net to be scheduled among the N batteries is said to be energy compatible if x t net is less than or equal to the total energy required to charge (discharge) all the N batteries up to SOC_MAX (SOC_MIN). If x t net is not energy compatible, then it is called energy incompatible.
Definition 2: The net charge (discharge) energy x t net to be scheduled among the N batteries is said to be power compatible if there exists an allocation x t A good allocation x t i : i = 1, 2, . . . , N should satisfy the following constraints: • If x t net is energy and power compatible, then • If x t net is power compatible but energy incompatible, then where SOC_LIM is the lower or upper limit on the SOC of batteries depending on battery is discharging or charging, respectively.
• x t i should not violate power limits of the respective battery, that is • Total energy charge (discharge) to (from) all the N batteries should not exceed x t net , that is We distribute x t net among the N batteries according to the weights w t We define z t net in Eq. (6) as where the first case holds if x t net > 0 and the second case holds if x t net < 0. The summation in Eq. (6) is the energy required to charge (or discharge), depending on x t net > 0 (x t net < 0), all the N batteries to the level of SOC_LIM, where SOC_LIM is equal to SOC_MAX or SOC_MIN according as x t net > 0 or x t net < 0, respectively. The C * i is the effective capacity defined as The energy x t i allocated to the i th battery is given by . . , N }) be m batteries, which cannot charge or discharge energy equal to x t i j due to the limit on the SOC or on the maximum power. We need to modify the respective weights {w t i j : j = 1, 2, 3, . . . , m} so that the scheduling does not violate respective batteries SOC and power constraints. In the case of violation of the SOC or the power constraints, both or one of the following two conditions in Eqs. (9) and (10) must hold for all i j : j = 1, 2, 3, . . . , m.
where P i j is equal to the maximum charging power P ci j or the maximum discharging power P di j depending on z t net > 0 or z t net < 0, respectively. Let z t i j be the maximum energy that can be charged (or discharged) without violating any of the power or SOC constraints. Then z t i j is calculated as in Eq. (11): where E t 1i j and E t 2i j are defined in Eqs. (12) and (13), respectively.
We need to decrease the weights {w t i j : j = 1, 2, 3, . . . , m} and increase the weights of the other batteries so that the new weights do not violate any of the two constraints. Let w t deff is the total amount by which the sum of all the weights is less than 1 due to decreasing the weights of some of the ESSs. We calculate w t deff in Eq. (14) as Note from Eqs. (6), (11)-(13) that z t i j and z t net have the same sign, therefore, This is a contradiction to the fact that w t i j violates the SOC or the power constraint. Therefore, for all j = 1, 2, 3, . . . , m. One can easily verify from Eqs. (9) and (10) that new weights {w t i j : j = 1, 2, 3, . . . , m} do not violate any of the power constraint or the energy constraint.
The sum of all the weights is not equal to 1 after decreasing some of the weights. This means that all the energy z t net will not be distributed. We need to increase the weights of some of the other batteries without violating any of the constraints so that the sum of weights is equal to 1. We use the following linear-time algorithm to adjust the weights of the other batteries.
Proof: See appendix A. When batteries SOCs are used as weights in the proposed WBS scheme, the discharged power is almost equal to the decentralized control scheme proposed in [24]. However in [24], the batteries are charged locally from a solar panel and discharged with respect to the SOCs to fulfill the community VOLUME 8, 2020 demand. Moreover, if we use the priority-based weights, presented in subsection II-D, some of the batteries may stay idle. Only a few batteries with higher/lower levels of SOC are charged/discharged to equalize the SOCs of all the batteries.
An important part of the WBS scheme is the method to calculate appropriate weights for the scheduling. In the following subsection, we present a method to calculate weights for each of the batteries by prioritizing the ESSs.
The sequence s represents the N batteries in sorted order of the SOCs. By convention, we use SOC s(N +1) = SOC_LIM, where SOC_LIM represent upper (lower) limit on each of the batteries' SOCs according as x t net > 0 (x t net < 0). We define E t (k) to be the total energy required to charge (discharge) first k batteries, in sorted order of SOC, up to the level of SOC s(k+1) as where C * i is defined in Eq. (7). It is obvious from Eq. (16) that E t (N ) is the total energy required to charge or discharge all the batteries up to SOC_LIM. We define E t (0) = 0. Let k be the number of batteries that we charge or discharge, we find k in Eq. (17) as where z t net is defined in Eq. (6). Let w t i : i = 1, 2, 3, . . . , N be the priority-based weights to distribute the energy x t net among the N number of batteries. We set and find the remaining weights {w t s(i) : i = 1, 2, 3, . . . , k } by solving the linear system of equations The linear system in Eq. (19) has k + 1 equations with k + 1 unknowns. The unknowns are the weights w t s(i) : i = 1, 2, 3, . . . , k and S. The basic idea is to schedule the total energy among the first k batteries in sorted order of SOCs so that the k batteries reach an equal target SOC level S. We write Eq. (19) in the matrix form as where w = S, w t s (1) , w t s (2) , w t s (3) , . . . , w t s (k ) and A and b are respectively given in Eqs. (21) and (22).as and The matrix A in Eq. (21) is a full rank matrix. Therefore, the set of linear equations (19) has a unique solution. The priority-based weights can be obtained by solving the linear equations in Eq. (19).
We describe important properties of the priority-based weights in the following propositions and the theorem. Although, the propositions and theorem make statements for both cases of charging x t net > 0 and discharging x t net < 0 , we give proof in case of charging only. For the discharging case, the proof is analogous.
Proposition 1: At any time t, E t (k) is non-negative (non-positive) and monotonically increasing (decreasing) sequence when x t net > 0 x t net < 0 . Proof: See appendix B. Proposition 2: At any time t where z t net and k are defined in Eqs. (6) and (17), respectively.
Proof: See appendix C. Theorem 2: At any time t + t, and SOC t+ t s(i) satisfies the following bounds for i = 1, 2, 3, . . . , k , where k is the same as defined in Eq. (17).
Proof: See appendix D. Theorem 2 says that only first k batteries, in sorted order of SOC, are charged or discharged and after charging (discharging) all the k batteries are at an equal SOC level which is greater than (less than) SOC of k th battery and less than (greater than) or equal to the SOC of (k + 1) th battery.

III. APPLICATIONS OF DISTRIBUTED ENERGY STORAGE
Centralized storage has a high capital, operational and maintenance cost. On the other hand, small ESSs installed by individual household does not qualify for the grid-level applications. Aggregating small ESSs makes large energy storage that can offer useful applications for the electricity grid. In this section, we give a brief overview of applications of the proposed distributed energy storage in the electricity markets.
A. FREQUENCY REGULATION FERC Order 755 [35] implemented by the Federal Energy Regulatory Commission (FERC) specifies rules for the payment of ESS participating in the ancillary services. This order requires that the system operators should add performance payment, in addition to the capacity payment, that reflects the accuracy of the ESS in response to the regulation signal. All the Independent System Operators (ISOs) observe this pay-for-performance payment model in the ancillary service markets. Frequency regulation has the highest potential value among all the ancillary services in the ancillary service market. Electricity generators with low ramp rates are not efficient in providing frequency regulation service. These generators usually take a long time to adjust their power outputs required for frequency regulation which makes them unsuitable for frequency regulation. The need for a fast and high capacity frequency regulation resource is higher in recent times due to the high penetration of intermittent RESs, such as wind and solar, in the electricity grids. Energy storage can adjust its power output in milliseconds which is highly desirable for frequency regulation. Frequency regulation is aimed at maintaining frequency at 60 Hz. In the NYISO (New York Independent System Operator) [36], regulation resources are directed to adjust their power output every 6 seconds based on the regulation signal. A regulation signal is generally calculated from the Area Control Error (ACE). Fig. 3 shows the area control error for June 2019 in the NYISO electricity market [37]. The ACE is equal to zero 2.2% of the time.
Under FERC Order 755, the regulation resources should be compensated with respect to the capacity (MW) that the resources bid in the market and the regulation mileage ( MW). Suppose energy storage regulation resource bids capacity P t max during a given time interval, i.e. the maximum power that the energy storage can provide in both regulation-up and regulation-down is equal to P t max . The regulation payment for the time interval is calculated according to the regulation resource capacity P t max (MW), regulation mileage or movement M t ( MW/MW) and regulation resource performance η t .
• Performance Score η t : Performance score lies between 0 and 1 and is calculated based on delay, correlation and precision. The delay is the time taken by the regulation resource in responding to the regulation signal, correlation is calculated using the formula for statistical correlation between the output of the regulation resource and the regulation control signal and the precision quantifies the error between the regulation control signal and the regulation resource output. A single performance score can be obtained calculated by averaging delay, correlation and precision scores. A regulation resource bids in the regulation market by offering a capacity price and a mileage price. Regulation resources whose bids are accepted are credited according to the market capacity clearing price (CCP) R C and market performance clearing price (PCP) R M . A regulation resource has to maintain a minimum performance score to be eligible to bid into the regulation market. Regulation credit R t for the regulation resource during time period t can be estimated using the generic formula given in Eq. (28): Suppose that N energy storage owners participate in the distributed storage. The energy capacity, maximum power, charging efficiency and the discharging efficiency for the i th (i = 1, 2, 3, . . . , N ) storage owner are represented by C i , VOLUME 8, 2020 P i , η ci and η di , respectively. The total aggregated power P of the distributed storage is P = N i=1 P i . We assume that the maximum charging and maximum discharging powers are equal. The utility or the central controller of the distributed storage bids in the frequency regulation market. After the bid is accepted by the system operator, the distributed storage follows the regulation signal sent by the system operator at a predefined frequency.

B. ENERGY ARBITRAGE
Suppose that N energy storage owners participate in the distributed storage. The energy capacity, maximum power, charging efficiency and the discharging efficiency for the i th (i = 1, 2, 3, . . . , N ) storage owner are represented by C i , P i , η ci and η di . The total energy capacity C, maximum power P, the charging efficiency η c and the discharging efficiency η d of the distributed energy storage can be calculated using Eqs. (29), (30), (31) and (32), respectively, as follows Let R t , t = 1, 2, 3, . . . , T be electricity prices for T time intervals. Linear programming model given in Eqs. (33)- (35) is used to find optimal charge/discharge power for the storage during each time interval. The LP model is subject to the following constraints: where x = {x t : t = 1, 2, 3, . . . , T } and y = {y t : t = 1, 2, 3, . . . , T } are the decision variables of the LP which represent the total energy for charging and discharging electricity storage during each time interval t of the optimization window consisting of T time intervals. SOC init , SOC min and SOC max are the distributed battery storage initial SOC, the minimum allowed SOC and the maximum allowed SOC, respectively. Suppose SOC t i i = 1, 2, 3, . . . , N be the SOCs of the N individual batteries at time t, the SOC of the distributed storage can be calculated using Eq. (36) The LP model in Eqs. (33), (34), (35) does not restrict both x t and y t to be non-zero at the same time. However, we modify charge/discharge energy so that storage is either charged or discharged but not both at a given time t. We compute net charge/discharge energy x net t using Eq. (37)

C. PEAK SHAVING
We can reduce the need for emergency generators during peaks hour by storing energy in the ESS during off-peak hours and releasing the stored energy during peak hours. Fig. 4 shows the hourly electricity demand of Pakistan on Jan 7, 2016. The demand shows that peaks occur at hours 11 (10 am to 11 am) in the morning and hour 19 (6 PM to 7 PM) in the evening. If a large battery is already available, the battery can be used to store energy at off-peak hours such as from 1 am to 6 am, and discharge it during peak hours. In subsection V-E, we show that the generation cost can be greatly reduced if the energy storage is charged during off-peak hours and discharged during peak hours.

IV. SIMULATION SETUP
We performed simulations using MATLAB R2017a on a server machine running Windows Server R2 operating system with a total memory of 256GB and 48 cores each having a speed of 2.10 GHz. We used the parallel processing toolbox of MATLAB to further speed up the computation of the experimental results.

A. FAIRNESS IN BATTERIES SCHEDULING
In section II, we have proposed the WBS scheme and the method to calculate priority-based weights for scheduling the batteries in the distributed storage. The proposed WBS scheme distributes total energy x t net among the N batteries during the time interval [t, t + t]. We have shown that the allocation x t i : i = 1, 2, 3, . . . , N satisfies the constraints in Eqs. (2)- (5). In this subsection, we experimentally show that the WBS with priority-based weights schedules x t net among all the batteries proportional to the respective batteries' capacities. This criterion ensures that the effect of charging and discharging on each of the individual batteries' cycle life is almost similar and no battery is either underused or overused. We calculate two measures to estimate the fairness of the WBS scheme according to this criterion, namely, the Shannon entropy [38] and the Jain's index [39]. Entropy H (P) of the sequence P = p i : p i ≥ 0, N j=1 p j = 1, i = 1, 2, 3, . . . , N is defined as The Jain's fairness index J (Y) for the sequence Y = {y 1 , y 2 , y 3 , . . . , y N } is defined as where bar represents the arithmetic mean. J (Y) ranges from The entropy H (P) ranges from zero to log (N ). H (P) = log (n) indicates that n users share all the resources equally and remaining N − n receive zero. It is zero when a single user consumes all the resources and has a maximum value of log (N ) when the resource is shared equally among the N users. We use the following entropy-based fairness index [40] where H (P) is the Shannon entropy defined in Eq. (38).
As H (P) lies between 0 and log (N ), therefore F (P) lies between 1 N and 1. We evaluate the fairness of the proposed scheme by simulating 100 randomly generated scenarios. A single scenario is a distributed battery storage consisting of N batteries whose capacities and initial SOCs are randomly initialized in the range 2KWh to 10kWh and 0.1 to 0.9, respectively. Battery charging and discharging efficiencies η ci and η di are both set to √ 0.9 for all i = 1, 2, 3, . . . , N . Therefore, the round-trip efficiency of each of the ESSs is 90%. The battery storage is given a random signal where c and d stand for charging and discharging, respectively. z t i,c (z t i,d ) represents total charge (discharge) energy, normalized by the respective battery capacity C i , for the i th battery till time t. The ideal case, when x t net is proportionally shared among all the batteries with respect to the respective battery capacities, implies that z t i,c = z t j,c (z t i,d = z t j,d ) for all i, j. In that case, the Jain's index is equal to 1. With the similar argument, we compute entropy index defined in Eq. (40) We run the WBS scheme with four different weights. WBS1 uses priority-based weights described in the subsection II-D, WBS2 uses weights equal to { w t i = C i : i = 1, 2, 3, . . . , N }. WBS3 and WBS4 use weights w t i at time t given in Eqs. (44) and (45), respectively: The weights for WBS2, WBS3 and WBS4 do not lie between 0 and 1. Therefore, we normalize them by dividing each of the weights by the sum of all the weights. Fig. 5 shows the average of Jain's and entropy fairness indices for all the four types of weights WBS1, WBS2, WBS3 and WBS4. Figs. 5a and 5b show Jain's index and entropy index for the charging signals whereas Figs. 5c and 5d show Jain's index and entropy index for the discharging signals. WBS1, WBS2, and WBS4 perform equally well with both of the fairness indices very close to 1. This indicates that WBS1, WBS2, and WBS4 distribute the energy among the N batteries proportional to the respective battery capacities. The logic behind using SOC at time t as the weights in WBS3 is that we want to charge batteries with lower SOC more and vice versa. The reason WBS3 under-performs is that WBS3 distributes energy with respect to SOC but we measure fairness according to proportionality with the battery capacity. Fig. 6 shows fairness indices for the first 40 charge and discharge energy signals for N = 100. Figs. 6a and 6b correspond to the charging signals whereas figs. 6c and 6d correspond to the discharging signals. This figure confirms the conclusions from Fig. 5 and shows that fairness reaches the maximum value of one within the first 10 to 20 time steps for the WBS1, WBS2 and WBS4.

B. EFFECT OF THE WBS SCHEME ON BATTERIES CYCLE LIFETIME
In this subsection, we show the effect of WBS1, WBS2, WBS3, and WBS4 on the cycle life of the batteries. At each time t, the algorithm counts the number of cycles of the average depth-of-discharge (DOD) using the rainflow cycle counting algorithm [41]. The remaining capacity is estimated by bilinearly interpolating the battery cycle degradation matrix. We use the battery degradation matrix in table 3 for estimating the remaining capacity of the batteries. Fig. 7 shows the average number of cycles, average DOD, and the remaining capacity with respect to the time for WBS1, WBS2, WBS3, and WBS4. The plotted values are  averaged over all the 100 simulations. The figure shows that the effect of WBS3 on the batteries' cycle lifetime is higher than the effect of WBS1, WBS2, and WBS4. This is due to the over-utilization of batteries in the case of WBS3. The similarity in the plots for N = 10, N = 100 and N = 1000 shows that the WBS scheme with appropriate weights is robust against changing the number of batteries. Fig. 8 shows the daily regulation revenue of a distributed energy storage consisting of N = 1000 individual batteries each having 1 kW maximum power and an energy capacity of half hour at maximum charging power. Minimum, maximum and mean daily revenues are $223.84, $4040.12, $606.61, respectively. The total revenue for the whole year is $221411.48. Regulation capacity prices are plotted on the right axis of Fig. 8. Although mileage prices are also used in calculating the revenues, they have small values compared to capacity prices. Therefore, we have plotted only the capacity price. We calculate net-present-value (NPV) for the storage owners by sharing a certain percentage of the total regulation revenue with the storage owners [42]. Suppose that R is the total yearly regulation revenue and the sharing percentage is p. The total yearly profit R i for the i th battery owner is calculated as

C. FREQUENCY REGULATION
where P i is the maximum power of the i th battery. We ignore the energy capacity in calculating the shared profit because the frequency regulation signal is balanced around zero and highly depends on the battery power rather than the battery energy capacity. We consider Li-ion batteries' cost and lifetime data. Although Li-ion batteries cost has decreased tremendously over the past many years, to be conservative we assume USD 400/kWh including all the installation and inverters costs. We calculate NPV for 5 years batteries lifetime with a 10% discount factor. Table 4 shows yearly utility profit and the profit that is shared among the battery owners.
Since each of the batteries has the same power and energy capacity, the shared profit is divided equally among all the 1000 battery owners. The table shows profits and the NPVs for varying sharing percentages. The NPVs for sharing a percentage of 10% and 20% are negative which indicates that the investment is not profitable for the storage owners if the utility shares less than 20% of the total regulation revenue with the storage owners. The NPV is positive for sharing a percentage of 30% and higher. However, the 30% threshold is for the current example only and may vary for other datasets.

D. ENERGY ARBITRAGE
We estimate potential energy arbitrage profit using locational marginal prices (LMPs) for 11 zones which are covered by the NYISO. Fig. 9 shows the average hourly LMP prices for 24 hours of the day in 11 zones of the NYISO for the years 2016 to 2018 [36], [43]. The prices show almost similar behavior for all the zones and they tend to increase from one year to the other. Long island and north zones have respectively maximum and minimum average prices compared to other zones. We use the linear programming based model, described in subsection III-B, for estimating energy arbitrage profits. We assume that there are N = 2000 consumers participating in the distributed storage each having energy storage of a given capacity. We calculate energy arbitrage in case of each consumer has energy storage of capacity 1kWh/0.5kW, 2kWh/0.5kW, 3kWh/0.5kW, 4kWh/0.5kW and 5kWh/0.5kW. Each of the batteries has √ 0.9 of charging and discharging efficiencies. Using Eq. (29), total energy capacities for the distributed energy storage are equal to 2 MWh, 4 MWh, 6 MWh, 8 MWh and 10 MWh for the five independent cases mentioned above, respectively. As the maximum power of each of the individual batteries is the same in all the five cases, the total power of the distributed energy storage is equal to 1 MW which is calculated using Eq. (30). We assume that maximum charge and maximum discharge powers are equal for all the batteries. To calculate arbitrage profit for all the five scenarios, we assume that initially all the N batteries have SOC equal to 0.9, SOC min = 0.05 and SOC max = 0.95. We use LMP prices for three years 2016 to 2018 from the NYISO energy market [43]. The length of the optimization window is T = 24 hours and t represents the hour of the days. x net t is distributed among the N batteries using priority-based weights. It is important to note that N should not be confused to be equal to five for the five scenarios mentioned above. These scenarios are independent cases. For example, the first scenario corresponds to Total arbitrage profit is plotted in Fig. 10 for all the five scenarios, respectively, in Fig. 10a, 10b, 10c, 10d and 10e. It is clear from the figure that the profit increases with an increase in the storage capacity which is pretty logical to happen. However, the increase in profit for increasing storage capacity from 2kWh to 4kWh or from 4 kWh to 6 kWh is much higher than the increase in profit that happens due to increasing the storage capacity from 8kWh to 10 kWh. This indicates that the saturation occurs for the profit for increasing storage capacity to a certain point. However, this does not mean that the storage will not be useful after a certain capacity is reached. In that case, the arbitrage benefits may saturate but the storage can provide other high-value services to the electricity grid. Long island zone happens to have maximum arbitrage profit compared to other zones in NYISO. Total long island arbitrage profit for three years is $70864, $121564, $155191, $171627, and $178735 for distributed storage of size 2MWh, 4MWh, 6MWh, 8MWh and 10MWh, respectively.

E. PEAK SHAVING
Suppose that we have a very large battery, we create four demand profiles by shifting peak demand to off-peak hours. Four demand profiles shown in Fig. 11 are obtained from the demand profile in Fig. 4. We use the economic merit order of power plants in Pakistan [44] which provides the order in which the power plants are brought online with the increase in the demand along with the generation cost of the respective power plants. We obtain power plants' capacities from [45]. Let D t be the demand at hour t: t = 1, 2, 3, . . . , 24 and M t be the number of power plants, in the order specified by the economic merit, required to fulfill the demand D t . Let C i and g i : i = 1, 2, 3, . . . , M t be the capacity and generation cost of i th power plant. The total generation cost G to meet the demand for the whole day is given in Eq. (47) as Table 5 summarizes the effect of peak shaving on the generation cost and the battery's energy capacity, maximum/ discharge power required for peak shaving. In calculating the generation cost, we assume that a running plant always runs at full capacity. For example, suppose 10 power plants are required to meet the demand 5000MW and the output of the first 9 power plants is 4900MW and the capacity of the tenth plant is 500MW. Even if the tenth power plant is required to provide 100MW, we assume that the 10th power plant runs at the full capacity and therefore we calculate the generation cost of the last required power plant in the economic merit order with respect to its capacity and not with respect to the remaining demand. For the first scenario in Fig. 11a, a small power at hour 19 is shifted to hours 2-4. However, the number of required power plants at hour 2-4 increased but the number of required power plants at hour 19 remains the same, and therefore the generation cost at hour 2-4 increased but the generation cost at the hour 19 remained the same. Similar is the case for peak shifting scenarios in Fig. 11a, 11b and 11c. The required number of power plants for the battery's charging increased but it did not decrease for peak hours even after reducing the peak. Now, look at the scenario in Fig. 11 (d) in which the number of power plants at hours 2-5 increased due to battery charging but at the same time number of plants at peak hours 11,18-20 also decreased. The power plants required for battery charging at off-peak hours 2-5 are less costly compared to the power plants required at peak hours 11,18-20. Therefore, reducing the need for only 1 one power plant at hours 11, 18-20 results in huge savings of $163526.16/day. Optimal scheduling of battery for peak shaving will further increase the benefits. Since the plant capacities and their generation costs are known in advance and aggregated demand profile is relatively easy to forecast compared to the demand profile at a smaller level such as the household level. Efficient optimization techniques can be used to reduce peaks in such a way so that the need for power plants at peak hours is also reduced.
A very large battery of energy capacity 1085 MWh with maximum charge and discharge powers of 435.5 MW and 424 MW, respectively, is required for the fourth scenario in Fig. 11d. Installation of such a huge battery system may not always be feasible and requires an investment of billions of dollars. A scalable distributed storage can be a viable solution FIGURE 11. Shifting Pakistan demand from peak hours to off-peak hours.
for a large battery system that can support the electricity grid during peak hours.

VI. DISCUSSION AND CONCLUSION
Future smart grid with a high penetration of renewable sources requires energy storage for optimal operation of the grid. Particularly, large renewable energy farms require very high capacity energy storage. In this article, we have proposed a model of a large and scalable distributed energy storage based on a weighted battery scheduling (WBS) scheme. We have also proposed a method to calculate weights for the batteries by prioritizing them with respect to their SOCs. The WBS scheme schedules a large number of batteries optimally while satisfying the respective battery's SOC and power constraints. The WBS scheme, with priority-based weights and three other fixed weights, distribute energy among the batteries proportional to the respective battery's capacities. This property ensures that the effect of scheduling on the cycle life of the participating batteries is almost equal and no battery is underused or overused. This property is also useful in designing incentives for the consumers if consumers are paid back with respect to their battery usage. WBS scheme with weights equal to the batteries' capacities and the WBS scheme with priority-based weights have a similar effect on the batteries' cycle lifetime. We also give a detailed overview of various applications of the proposed distributed storage. Frequency regulation and peak shaving can provide huge financial benefits. Our numerical example of peak shaving shows that reducing the need for only one power plant during peak hours results in a reduction of $163526.16 in the total generation cost for a single day. However, this also requires very large energy storage to shift a peak from peak hours to off-peak hours. The simulation results for the frequency regulation show that a distributed storage consisting of 1000 batteries each having maximum charging/discharging power of 1 kW obtains an average daily revenue of $606.61 from the NYISO frequency regulation market. NPV analysis shows that the investment and the participation in the distributed storage are profitable for the storage owners. Distributed storage can also defer system upgrade required for peak demands and thus saves huge system upgrade costs. The proposed storage model is not limited to these applications only. It can provide any necessary support to the grid which a large centralized storage can. However, the number of batteries participating in the distributed storage model cannot increase without bound. But the aggregation should be optimized according to the geographical distance, the storage capacity required by the grid, and the financial incentives. Future work should address designing incentives for participating consumers.

APPENDIX A PROOF OF THEOREM 1
Proof:

VOLUME 8, 2020
It is clear from the description of the WBS scheme that the power and the SOC limits are dealt explicitly. Therefore, the WBS scheme also satisfies the constraints in Eqs. (3) and (4).

APPENDIX B PROOF OF PROPOSITION 1
Proof: Non-negativity follows from SOC s(i+1) ≥ SOC s(i) and C * i > 0 ∀ i. Suppose k < N ,

APPENDIX D PROOF OF THEOREM 2
Proof: From Eq. To prove the right inequality of Eq. (25), we suppose the contrary that there exists i such that SOC t+ t s(i) > SOC t s(k +1) . But SOC t+ t s(i) = S, ∀ i = 1, 2, 3, . . . , k . Therefore, following holds for all i = 1, 2, 3, . . . , k We are considering the charging case. Therefor, z t net > 0. By definition of s(i) SOC t s(k +1) > SOC t s(i) ∀ i = 1, 2, 3, . . . , k . The following inequality also holds: ⇒ z t net > E t k see def. of E t in Eq. (16). , because k i=1 w t i = 1 and k i=1 w t s(i) z t net = z t net . But, E t k ≥ z t net from def. of k in Eq. (17). This completes the proof of the right inequality of Eq. (25).
The inequality in Eq. (26) is the discharging case (z t net < 0) and can be proven on the same lines.