# Optimal Storage Arbitrage under Net Metering using Linear Programming

Md Umar Hashmi1, Arpan Mukhopadhyay2, Ana Bušić1, and Jocelyne Elias3 1M.U.H.
and A.B are with INRIA, DI ENS, Ecole Normale Supérieure, CNRS, PSL Research
University, Paris, France.2A.M is with Department of Computer Science,
University of Warwick. 3J.E. is with INRIA and Paris Descartes University.

###### Abstract

We formulate the optimal energy arbitrage problem for a piecewise linear cost
function for energy storage devices using linear programming (LP). The LP
formulation is based on the equivalent minimization of the epigraph. This
formulation considers ramping and capacity constraints, charging and
discharging efficiency losses of the storage, inelastic consumer load and
local renewable generation in presence of net-metering which facilitates
selling of energy to the grid and incentivizes consumers to install renewable
generation and energy storage. We consider the case where the consumer loads,
electricity prices, and renewable generations at different instances are
uncertain. These uncertain quantities are predicted using an Auto-Regressive
Moving Average (ARMA) model and used in a model predictive control (MPC)
framework to obtain the arbitrage decision at each instance. In numerical
results we present the sensitivity analysis of storage performing arbitrage
with varying ramping batteries and different ratio of selling and buying price
of electricity.

##  I Introduction

Energy storage devices provide flexibility to alter the consumption behavior
of an electricity consumer. Storage owners at the consumer side could
participate in demand response, energy arbitrage, peak demand shaving, power
backup to name a few [1], [2]. These features of storage devices will be more
lucrative for storage owners with the growth of intermittent generation
sources which increase volatility on the generation side in power network [3].
Furthermore, storage devices are witnessing the decreasing of cost of battery
making several applications of storage devices financially viable. Electric
consumer bills vary based on local policies, however, the primary variable
component of electricity bills worldwide is the cost of energy consumption.
Storage devices can perform arbitrage of energy with time varying consumer
load, distributed generation production and electricity price. Furthermore,
utilities promote inclusion of distributed generation and storage deployment
by introducing net-metering. Net energy metering (NEM) or net-metering refers
to the rate consumers receive for feeding power back to the grid. Most NEM
policies indicate that consumers receive a rate at best equal to the buying
price of electricity [4]. Authors in [5] consider storage operation under
equal buy and sell price case. This framework is generalized in [6], covering
cases where the ratio of buy and sell price could arbitrarily vary between 0
and 1. For equal buying and selling price, the storage control becomes
independent of inelastic load and renewable generation of the consumer [5],
[7]. The cost function considered in this work includes inelastic load,
renewable generation and storage charging and discharging efficiency, and
ramping and capacity constraints. We first show that the cost function, based
on the selection of the optimization variables, is convex and piecewise
linear. Then, we formulate the optimal arbitrage problem for an electricity
consumer with renewable generation adopting NEM by using Linear Programming
(LP).

Authors in [8] provide a summary of storage control methodologies used in
power distribution networks among which LP based formulations can be solved
efficiently using commercially available solvers. The complexity of LP based
algorithms is polynomial [9]. Therefore, these algorithms can be used to
efficiently solve the arbitrage problem for the duration of a day divided into
smaller time steps ranging from 5 minutes to an hour. A day is the typical
time horizon over which arbitrage is performed [10, 11].

Authors in [12] observe that the energy arbitrage problem for storage is
convex in nature and under the price-taker assumption the cost function will
have a piecewise linear structure [5] and hence LP tools could be used. LP
techniques for energy storage arbitrage have been used in several prior works:
[13], [14], [15], [16], [17], [18], [19]. Authors in [17, 14, 19] consider
storage operation in presence of time-varying electricity price. However, in
these formulations no renewable energy source or consumer load is assumed to
be present. Authors in [15, 16] consider optimal scheduling of storage battery
for maximizing energy arbitrage revenue in presence of distributed energy
resources and variable electricity price. Formulations presented in [18, 13]
consider storage performing arbitrage in a residential setting with inelastic
load and local generation. Most common LP formulations for energy arbitrage
such as in [13], [19], [16], [14] consider separation of charging and
discharging components. In these formulations, they do not include constraint
enforcing only one of the charging or the discharging component to be active
at any particular time as the inclusion of such a constraint makes these
formulations nonlinear. Therefore, in these formulations, optimal results
cannot be guaranteed. Authors in [15, 17] do not consider energy storage
charging and discharging efficiencies in the cost minimization, making it
straight forward to apply LP. Authors in [18] consider a special case of
optimization with zero-sum aggregate storage power output. For such a case LP
tools could be used, however, generalizing the formulations needs to be
explored further.

The key contributions of this paper are as follows:
$\quad\bullet$ LP formulation for storage control: We formulate the LP
optimization problem for piecewise linear convex cost function, for storage
with efficiency losses, ramping and capacity constraints and a consumer with
inelastic load and renewable generation. The buying and selling price of
electricity are varying over time. The selling price is assumed to be at best
equal to buying price for each time instant, this assumption is in sync with
most net-metering policies worldwide. We describe the LP formulations for
lossy battery with inelastic consumption, renewable generation and selling
price less than or equal to buying price. The reduction of this formulation
for cases (a) lossless battery with equal buying and selling price of
electricity and (b) lossy battery with selling price less than or equal to
buying price, is trivial and not included in this paper. Based on the
structure of the cost function we apply an epigraph based minimization
described in [20] to the arbitrage problem.
$\quad\bullet$ Real-time implementation: We implement an auto-regressive based
forecast model along with model predictive control and numerically analyze
their effect on arbitrage gains using real data from a household in Madeira in
Portugal and electricity price from California ISO [21]. The effect of
uncertainty on arbitrage gains is more pronounced for cases where selling
price is higher compared to cases where selling price is closer to zero.
$\quad\bullet$ Sensitivity of ratio of selling and buying price: We
numerically analyze the effect of the ratio of buying and selling price of
electricity on the value of storage integration with inelastic load and
renewable generation. We observe that the value of storage performing
arbitrage significantly increases in the presence of load and renewable
generation with the increasing disparity of selling and buying price of
electricity, compared to only storage performing arbitrage. Inclusion of
storage in the presence of load and renewable could be profitable even for
cases where the selling price is zero or small compared to buying price. For
the same case, only storage performing arbitrage would not be profitable.

The paper is organized as follows. Section II provides the description of the
system. Section III presents the linear programming formulation of storage
performing arbitrage with inelastic load, renewable generation and net-
metering based compensation. Section IV presents an online algorithm using the
proposed optimal arbitrage algorithm along with auto-regressive forecasting in
the MPC framework. Section V discusses numerical results. Finally, Section VI
concludes the paper.

##  II System Description

We consider the operation of a single residential user of electricity over a
fixed period of time. The user is assumed to be equipped with a rooftop solar
PV and a battery to store excess generation. It is also connected to the
electricity grid from where it can buy or to which it can sell energy. The
objective is to find an efficient algorithm for a user to make optimal
decisions over a period of varying electricity prices considering variations
in the solar generation and end user load. The total duration, $T$, of
operation is divided into $N$ steps indexed by $\\{1,...,N\\}$. The duration
of step $i\in\\{1,...,N\\}$ is denoted as $h_{i}$. Hence,
$T=\sum_{i=1}^{N}h_{i}$. The price of electricity, $p_{\text{elec}}(i)$,
equals the buying price, $p_{b}(i)$, if the consumption is positive; otherwise
$p_{\text{elec}}(i)$ equals the selling price, $p_{s}(i)$.

$p_{\text{elec}}(i)=\begin{cases}p_{b}(i),&\text{if consumption }\geq 0,\\\
p_{s}(i),&\text{otherwise,}\end{cases}$ (1)

Note $p_{\text{elec}}$ is ex-ante and the consumer is a price taker. The ratio
of selling and buying price at time $i$ is denoted as

$\kappa_{i}=\frac{p_{s}(i)}{p_{b}(i)}.$ (2)

The end user inelastic consumption is denoted as $d_{i}$ and generates $r_{i}$
units of energy through renewable sources in time step $i$. Net energy
consumption without storage is denoted as $z_{i}=d_{i}-r_{i}~{}\in\mathbb{R}$.
Fig. 1 shows the block diagram of the system considered, i.e., an electricity
consumer with renewable generation and energy storage battery.

Figure 1: Behind-the-meter electricity consumer with inelastic consumption,
renewable generation and energy storage battery.

The efficiency of charging and discharging of the battery are denoted by
$\eta_{\text{ch}},\eta_{\text{dis}}\in(0,1]$, respectively. We denote the
change in the energy level of the battery at $i^{\text{th}}$ instant by
$x_{i}=h_{i}\delta_{i}$, where $\delta_{i}$ denotes the storage ramp rate at
$i^{\text{th}}$ instant such that $\delta_{i}\in[\delta_{\min},\delta_{max}]$
$\forall i$ and $\delta_{\min}\leq 0,\delta_{\max}\geq 0$ are the minimum and
the maximum ramp rates (kW); $\delta_{i}>0$ implies charging and
$\delta_{i}<0$ implies discharging. Energy consumed by the storage in the
$i^{th}$ instant is given by
$s_{i}=f(x_{i})=\frac{1}{\eta_{\text{ch}}}[x_{i}]^{+}-\eta_{\text{dis}}[x_{i}]^{-},$
where $x_{i}$ must lie in the range from $X_{\min}^{i}=\delta_{\min}h_{i}$ to
$X_{\max}^{i}={\delta_{\max}h_{i}}$. Note $[x_{i}]^{+}=\max(0,x_{i})$ and
$[x_{i}]^{-}=\max(0,-x_{i})$. Alternatively, we can write
$x_{i}=\eta_{\text{ch}}[s_{i}]^{+}-\frac{1}{\eta_{\text{dis}}}[s_{i}]^{-}$.
The limits on $s_{i}$ are given as $s_{i}\in[S_{\min}^{i},S_{\max}^{i}]$,
where $S_{\min}^{i}=\eta_{\text{dis}}\delta_{\min}h_{i}$ and
$S_{\max}^{i}=\frac{\delta_{\max}h_{i}}{\eta_{\text{ch}}}$.

Let $b_{i}$ denote the energy stored in the battery at the $i^{\textrm{th}}$
step. Then, $b_{i}=b_{i-1}+x_{i}$. The capacity of the battery imposes the
constraint $b_{i}\in[b_{\min},b_{\max}],\forall i$, where $b_{\min},b_{\max}$
are the minimum and the maximum battery capacity. The total energy consumed
between time step $i$ and $i+1$ is given as $L_{i}=z_{i}+s_{i}$.

Energy storage battery operational life is often quantified using cycle and
calendar life which decides the cycles a battery should perform over a time
period. Friction coefficient, denoted as $\eta_{\text{fric}}\in[0,1]$, and
introduced in [22] assists in reducing the operational life of the battery
such that low returning transactions of charging and discharging are
eliminated, thus increasing the operational life of the battery. In subsequent
work, authors in [23] propose a framework to tune the value of friction
coefficient for increasing operational life of battery. In a prior work, [24],
we show that redefining $\eta_{\text{ch}}$ equal to
$\eta_{\text{ch}}\eta_{\text{fric}}$ and $\eta_{\text{dis}}$ equal to
$\eta_{\text{dis}}\eta_{\text{fric}}$, we can control the cycles of operation
by eliminating the low returning transactions by reducing the value of
$\eta_{\text{fric}}$.

###  II-A Arbitrage under Net-Metering

The optimal arbitrage problem (denoted as (P)) is defined as the minimization
of the cost of the total consumed energy,
$\min\sum_{i=1}^{N}L_{i}p_{\text{elec}}(i)$, subject to the battery
constraints. It is given as follows:

$\displaystyle\text{(P) }\min\sum_{i=1}^{N}C_{nm}^{i}(x_{i}),\vspace{-12pt}$

$\text{subject to, }b_{\min}-b_{0}\leq\sum_{j=1}^{i}x_{j}\leq
b_{\max}-b_{0},\forall i\in\\{1,..,N\\},$ and
$x_{i}\in\left[X_{\min}^{i},X_{\max}^{i}\right]\forall i\in\\{1,..,N\\}$.
$C_{\text{nm}}^{i}(x_{i})$ denotes the energy consumption cost function at
instant $i$ and is equal to
$[z_{i}+f(x_{i})]^{+}p_{b}(i)-[z_{i}+f(x_{i})]^{-}p_{s}(i)$. Now we will show
that the optimal arbitrage problem is convex in $x=(x_{i},i=1:N)$. For this
convexity to hold we require $p_{b}(i)\geq p_{s}(i)$ for all $i=1:N$, i.e.,
$\kappa_{i}\in[0,1]$. The proposed framework is applicable for the case where
selling price of electricity for the end user is lower than the buying price.
This assumption is quite realistic as this is generally the case in most
practical net metering policies [4].

######  Theorem II.1.

If $p_{b}(i)\geq p_{s}(i)$ for all $i=1:N$, then problem (P) is convex in $x$.

###### Proof.

Let $\psi(t)=a[t]^{+}-b[t]^{-}$ with $a\geq b\geq 0$. Using
$t=[t]^{+}-[t]^{-}$ we have $\psi(t)=(a-b)[t]^{+}+bt$. Since both $[t]^{+}$
and $t$ are convex in $t$ and $a-b,b\geq 0$ we have that $\psi$ is convex
since it is the positive sum of two convex functions.

Now let $f(x)=\frac{1}{\eta_{ch}}[x]^{+}-\eta_{dis}[x]^{-}$ and
$G_{i}(s)=[z_{i}+s]^{+}p_{b}(i)-[z_{i}+s]^{-}p_{s}(i)$. Then by the above
reasoning we have that for $p_{b}(i)\geq p_{s}(i)\geq 0$ and
$\eta_{ch},\eta_{dis}\in(0,1]$, $G_{i}$ is convex in $s$ and $f$ is convex in
$x$. Also, note that $G_{i}$ is non-decreasing in $s$. Hence, for
$\lambda\in[0,1]$ we have

$\displaystyle G_{i}\big{(}f(\lambda x+(1-\lambda)y)\big{)}$
$\displaystyle\leq G_{i}\big{(}\lambda f(x)+(1-\lambda)f(y)\big{)}$ (3)
$\displaystyle\leq\lambda G_{i}(f(x))+(1-\lambda)G_{i}(f(y))$ (4)

In the above, the first inequality follows from the convexity of $f$ and non-
decreasing nature of $G_{i}$ and the second inequality follows from convexity
of $G_{i}$. Therefore, we have that $G_{i}\cdot f=G_{i}(f())$ is a convex
function in $x$. This shows that the objective function of (P) is convex in
$x$ since $C_{nm}^{i}=G_{i}\cdot f$. Since the constraints are linear in $x$
thus problem (P) is convex. ∎

##  III Optimal Arbitrage with Linear Programming

The optimal arbitrage problem, (P), can be solved using linear programming as
the cost function is (i) convex and (ii) piecewise linear, and (iii) the
associated ramping and capacity constraints are linear. In this section, we
provide an LP formulation for the optimal arbitrage of the storage device
under net-metering and consumer inelastic load and renewable generation,
leveraging the epigraph based minimization presented in [20]. A summary of the
epigraph based formulation for a piecewise linear convex cost function is
presented in Appendix A. The optimal arbitrage formulation for storage under
net-metering and consumer inelastic load and renewable generation using the
epigraph formulation is presented in this section. Fig. 2 shows the two cost
functions depending on the net-load without storage output, i.e. for $z_{i}>0$
and $z_{i}<0$. Note that there are 4 unique segments which form the cost
function $C_{nm}(i)$. The slope, x-intercept and y-intercept of these linear
segments are given in Table I.

TABLE I: Cost function for storage with load under NEM Segment | Slope | x-intercept | y-intercept
---|---|---|---
Segment 1 | $p_{b}(i)/\eta_{ch}$ | $-z_{i}\eta_{ch}$ | $z_{i}p_{b}(i)$
Segment 2 | $p_{s}(i)\eta_{dis}$ | $-z_{i}/\eta_{dis}$ | $z_{i}p_{s}(i)$
Segment 3 | $p_{b}(i)\eta_{dis}$ | $-z_{i}/\eta_{dis}$ | $z_{i}p_{b}(i)$
Segment 4 | $p_{s}(i)/\eta_{ch}$ | $-z_{i}\eta_{ch}$ | $z_{i}p_{s}(i)$

The epigraph based LP formulation is possible as irrespective of the sign of
the load, the cost function is given as

$\begin{split}C_{nm}(i)=\max\big{(}\text{Segment 1, Segment 2},\\\
\text{Segment 3, Segment 4}\big{)}.\end{split}$ (5)

Since, Eq.5 is independent of the sign of load and based on the intercepts,
Eq.5 is valid for $p_{b}(i)\geq p_{s}(i)$ and for
$\eta_{ch},\eta_{dis}\in(0,1]$ (conditions of convexity), therefore, we could
formulate this problem as an LP. Using the epigraph equivalent formulation for
piecewise linear convex cost function we formulate the optimal arbitrage
problem using linear programming, denoted as $\text{P}_{\text{LP}}$

$\displaystyle(\text{P}_{\text{LP}})~{}~{}\min\quad\\{t_{1}+t_{2}+...+t_{N}\\},$
$\displaystyle\text{subject to, }~{}~{}\text{(a) Segment
1:~{}}\frac{p_{b}^{i}}{\eta_{ch}}x_{i}+z_{i}p_{b}^{i}\leq t_{i},~{}\forall i$
$\displaystyle\text{(b) Segment
2:~{}}{p_{s}^{i}}{\eta_{dis}}x_{i}+z_{i}p_{s}^{i}\leq t_{i},~{}\forall i$
$\displaystyle\text{(c) Segment
3:~{}}{p_{b}^{i}}{\eta_{dis}}x_{i}+z_{i}p_{b}^{i}\leq t_{i},~{}\forall i$
$\displaystyle\text{(d) Segment
4:~{}}\frac{p_{s}^{i}}{\eta_{ch}}x_{i}+z_{i}p_{s}^{i}\leq t_{i},~{}\forall i$
$\displaystyle\text{(e) Ramp
constraint:~{}}x_{i}\in[X_{\min}^{i},X_{\max}^{i}],~{}\forall i$
$\displaystyle\text{(f) Capacity
constraint:~{}}\sum{x_{i}}\in[b_{\min}-b_{0},b_{\max}-b_{0}],~{}\forall i.$

Figure 2: The cost function segment wise for positive and negative net load
$z$ [6]. The decision variable is storage change in charge level, $x_{i}$, and
cost function, $C_{nm}(i)$ is formed with 4 unique line segments.

The cost function for only lossy storage operation under NEM would have two-
piecewise linear segments and it would be linear for equal buying and selling
price of electricity with lossless battery. Authors in [15, 17] present this
case in their LP formulation. This case could be obtained by simplifying the
more general case depicted as $\text{P}_{\text{LP}}$ in Fig. 2.

We make our code open source on formulating optimal arbitrage problem using
linear programming111https://github.com/umar-
hashmi/linearprogrammingarbitrage.

##  IV Real-time implementation

The previous section discussed optimal storage arbitrage under complete
knowledge of future net loads and prices. In this section, we consider the
setting where future values may be unknown. To that end, we first develop a
forecast model for net load without storage (which includes inelastic consumer
load and consumer distributed generation) and electricity price for future
times, where the forecast is updated after each time step. Then, we develop
the forecasting model for net load with solar generation using AutoRegressive
Moving Average (ARMA) model and electricity price forecast using
AutoRegressive Integrated Moving Average (ARIMA).

The forecast models based on ARMA and ARIMA model developed in [25] are used
in this work. The forecast values are fed to a Model Predictive Control (MPC)
scheme to identity the optimal modes of operation of storage for the current
time-instance. Any of the developed schemes from the previous section can be
used for the optimization inside MPC. These steps (forecast and MPC) are
repeated sequentially and highlighted in online Algorithm 1:
ForecastMPClinearProgram.

Storage Parameters:
$\eta_{\text{ch}},\eta_{\text{dis}},\delta_{\max},\delta_{\min},b_{\max},b_{\min}$,
$b_{0}$.
Inputs: $h,N,T,i=0$, Rolling horizon optimization time period
$N_{\text{opt}}$, Historical inelastic load, renewable generation and
electricity price data.

1:Use historical data to tune ARMA and ARIMA models,

2:while $i<N$ do

3: Increment $i=i+1$,

4: Real-time electricity price value $p_{\text{elec}}(i)$ and load $z_{i}$,

5: Forecast $\hat{z}$ from time step $i+1$ to $i+N_{\text{opt}}$ using ARMA,

6: Forecast $\hat{p}_{b}$ and $\hat{p}_{s}$ from time $i+1$ to
$i+N_{\text{opt}}$ using ARIMA,

7: Calculate $\hat{\kappa}$ as the ratio of $\hat{p}_{s}$ and $\hat{p}_{b}$,

8: Build LP matrices for time step $i$ to $N$,

9: Solve the Linear Optimization problem for forecast vectors,

10: Calculate ${b_{i}}^{*}=b_{i-1}+\hat{x}^{*}(1)$,

11: Update $b_{0}={b_{i}}^{*}$, the initial capacity of battery is updated.

12: Return ${b_{i}}^{*}$, ${x_{i}}^{*}$.

13:end while

Algorithm 1 ForecastMPClinearProgram

##  V Numerical Results

For the numerical evaluation, we use battery parameters listed in Table II.
The performance indices used for evaluating simulations are:
$\quad\bullet$ Arbitrage Gains: denotes the gains (made in absence of load and
renewable) or reduction in the cost of consumption (made in presence of load
and renewable) due to storage performing energy arbitrage under time-varying
electricity prices,
$\quad\bullet$ Cycles of operation: In our prior work [23] we develop a
mechanism to measure the number of cycles of operation based on depth-of-
discharge (DoD) of energy storage operational cycles. Equivalent cycles of
100% DoD are identified. This index provides information about how much the
battery is operated.

We use xC-yC notation to represent the relationship between ramp rate and
battery capacity. xC-yC implies battery takes 1/x hours to charge and 1/y
hours to discharge completely. We perform sensitivity analysis with (a) four
battery models with the different ramping capability listed in Table II and
(b) 5 levels of the ratio of selling price and buying price of electricity,
i.e., $\kappa\in\\{1,0.75,0.5,0.25,0\\}$. In this work we assume the selling
price is equal to the product of scalar variable $\kappa$ and the buying price
of electricity.

TABLE II: Battery Parameters $b_{\min}$ | 200Wh
---|---
$b_{\max}$ | 2000 Wh
$b_{0}$ | 1000 Wh
$\eta_{\text{ch}}=\eta_{\text{dis}}$ | 0.95
$\delta_{\max}=-\delta_{\min}$ | 500 W for 0.25C-0.25C,
(4 battery model) | 1000 W for 0.5C-0.5C
| 2000 W for 1C-1C,
| 4000 W for 2C-2C

The optimization problem, $\text{P}_{\text{LP}}$, is solved using linprog in
MATLAB222https://www.mathworks.com/help/optim/ug/linprog.html. linprog uses
dual-simplex [26] (default) algorithm.

###  V-A Deterministic Simulations

The price data for our simulations in this subsection is taken from NYISO
[27]. The load and generation data is taken from data collected at Madeira,
Portugal. Fig. 3 shows the electricity price and energy consumption (includes
inelastic load and rooftop solar generation) data used for deterministic
simulations.

Figure 3: Electricity price and consumer net load data used for deterministic
simulations.

Table III and Table IV lists the energy storage arbitrage without and with
energy consumption load for the electricity price data shown in Fig. 3. The
observations are:
$\quad\bullet$ The value of storage in presence of load and renewable
increases as $\kappa$ decreases. Note that for $\kappa=0$, the only storage
operation provides zero gain (see Table III), however, for the same buying and
selling levels, the consumer would make significant gains when operated with
inelastic load and renewable generation (see Table IV),
$\quad\bullet$ The cycles of operation for faster ramping batteries are higher
compared to slower ramping batteries. This implies that faster ramping
batteries should be compared in terms of gains per cycle with slower ramping
batteries. Observing only gains could be misleading.
$\quad\bullet$ As $\kappa$ decreases, the cycles of operation decrease, thus
the effect on storage operation in the cases presented is similar to
$\eta_{\text{fric}}$ in reducing cycles of operation.
$\quad\bullet$ Note that for $\kappa=1$, the arbitrage gains with and without
load are the same. This observation is in sync with claims made in [5].
Authors in [5] observe that storage operation becomes independent of load and
renewable variation for equal buying and selling case.

TABLE III: Performance indices for only storage $\kappa$ | 2C-2C | 1C-1C | 0.5C-0.5C | 0.25C-0.25C
---|---|---|---|---
Arbitrage gains in $ cents for 1 day
1 | 44.445 | 33.760 | 25.636 | 17.536
0.75 | 18.842 | 17.668 | 14.077 | 9.921
0.5 | 7.682 | 7.088 | 6.253 | 5.219
0.25 | 2.513 | 2.502 | 2.483 | 2.422
0 | 0 | 0 | 0 | 0
Cycles of operation for 1 day
1 | 6.586 | 3.856 | 2.237 | 1.620
0.75 | 2.401 | 1.742 | 1.484 | 0.795
0.5 | 1.539 | 1.099 | 0.714 | 0.386
0.25 | 0.182 | 0.171 | 0.164 | 0.160
0 | 0 | 0 | 0 | 0
TABLE IV: Performance indices for storage + load $\kappa$ | 2C-2C | 1C-1C | 0.5C-0.5C | 0.25C-0.25C
---|---|---|---|---
Arbitrage gains in $ cents for 1 day
1 | 44.445 | 33.760 | 25.636 | 17.536
0.75 | 37.848 | 33.023 | 26.469 | 18.337
0.5 | 39.045 | 34.105 | 27.696 | 19.344
0.25 | 40.272 | 35.332 | 28.923 | 20.351
0 | 41.500 | 36.560 | 30.150 | 21.358
Cycles of operation for 1 day
1 | 6.586 | 3.835 | 2.263 | 1.620
0.75 | 5.986 | 4.039 | 2.338 | 1.652
0.5 | 5.986 | 4.033 | 2.364 | 1.660
0.25 | 5.986 | 4.033 | 2.364 | 1.660
0 | 5.986 | 4.033 | 2.364 | 1.660
Figure 4: Performance indices for only storage performing arbitrage with
varying $\kappa$ for 1 day. Figure 5: Storage along with inelastic load and
renewable generation with varying $\kappa$ for 1 day.

Fig. 4 and Fig. 5 show the arbitrage gains, gains per cycle and cycles of
operation with varying $\kappa$ for storage performing arbitrage without and
with inelastic load and renewable generation. The gains per cycle are nearly
flat with varying $\kappa$. Slow ramping batteries, 0.25C-0.25C and 0.5C-0.5C,
have significantly higher gains per cycle compared to faster ramping
batteries, 1C-1C and 2C-2C.

###  V-B Results with Uncertainty

The forecast model is generated for load with solar generation and for
electricity price. The ARMA based forecast uses 9 weeks of data (starting from
29th May, 2019) for training and generates forecast for the next week.
ForecastMPClinearProgram is implemented in receding horizon. The electricity
price data used for this numerical experiment is taken from CAISO [28] for the
same days of load data. To compare the effect of forecasting net load and
electricity prices with perfect information, we present average arbitrage
gains and cycles of operation starting from 1st June 2019. Rolling horizon
time-period of optimization, $N_{\text{opt}}$, is selected as 1 day. This
implies at 13:00 h today, the storage control decisions are based on parameter
variation forecasts till 13:00 h tomorrow.

TABLE V: Deterministic arbitrage gains for only storage $\kappa$ | 2C-2C | 1C-1C | 0.5C-0.5C | 0.25C-0.25C
---|---|---|---|---
Arbitrage gains in $ for 1 week
1 | 9.411 | 7.059 | 4.784 | 3.065
0.75 | 5.729 | 4.491 | 3.168 | 2.082
0.5 | 3.166 | 2.550 | 1.833 | 1.217
0.25 | 1.124 | 0.941 | 0.688 | 0.456
0 | 0 | 0 | 0 | 0
Cycles of operation for 1 week
1 | 58.729 | 37.257 | 21.324 | 12.107
0.75 | 23.462 | 16.341 | 10.746 | 7.519
0.5 | 12.689 | 9.770 | 7.579 | 6.174
0.25 | 7.727 | 6.229 | 4.558 | 3.464
0 | 0 | 0 | 0 | 0
TABLE VI: Deterministic arbitrage gains for storage with load $\kappa$ | 2C-2C | 1C-1C | 0.5C-0.5C | 0.25C-0.25C
---|---|---|---|---
Arbitrage gains in $ for 1 week
1 | 9.411 | 7.059 | 4.784 | 3.065
0.75 | 7.462 | 6.269 | 4.540 | 3.025
0.5 | 6.641 | 5.987 | 4.468 | 3.019
0.25 | 6.350 | 5.904 | 4.451 | 3.019
0 | 6.313 | 5.902 | 4.451 | 3.019
Cycles of operation for 1 week
1 | 58.700 | 37.294 | 21.324 | 12.107
0.75 | 28.583 | 20.809 | 14.382 | 10.229
0.5 | 19.296 | 16.629 | 13.007 | 9.971
0.25 | 16.591 | 15.348 | 12.498 | 9.968
0 | 16.041 | 15.201 | 12.484 | 9.968
TABLE VII: Stochastic indices for only storage $\kappa$ | 2C-2C | 1C-1C | 0.5C-0.5C | 0.25C-0.25C
---|---|---|---|---
Arbitrage gains in $ for 1 week
1 | 6.035 | 4.684 | 3.469 | 3.000
0.75 | 5.024 | 4.118 | 3.081 | 1.904
0.5 | 3.004 | 2.367 | 1.692 | 1.110
0.25 | 1.067 | 0.891 | 0.618 | 0.442
Cycles of operation for 1 week
1 | 64.323 | 38.979 | 22.622 | 12.850
0.75 | 24.870 | 16.169 | 10.570 | 7.733
0.5 | 11.393 | 8.891 | 7.013 | 6.099
0.25 | 6.429 | 5.557 | 4.359 | 3.395
TABLE VIII: Stochastic indices for storage with load $\kappa$ | 2C-2C | 1C-1C | 0.5C-0.5C | 0.25C-0.25C
---|---|---|---|---
Arbitrage gains in $ for 1 week
1 | 6.034 | 4.684 | 3.496 | 3.000
0.75 | 4.827 | 4.075 | 3.400 | 2.987
0.5 | 4.168 | 3.711 | 3.292 | 2.975
0.25 | 4.204 | 3.943 | 3.348 | 3.002
0 | 4.427 | 3.896 | 3.396 | 3.009
Cycles of operation for 1 week
1 | 64.322 | 38.979 | 22.622 | 12.850
0.75 | 41.613 | 30.322 | 19.948 | 11.980
0.5 | 34.658 | 27.627 | 18.744 | 11.348
0.25 | 31.429 | 26.370 | 18.476 | 11.396
0 | 32.958 | 28.255 | 19.845 | 11.372

The deterministic results for without and with load are presented in Table V
and Table VI. Compare the deterministic results with stochastic results
presented in Table VII and Table VIII. The primary numerical observations are:
$\quad\bullet$ Effect of uncertainty on arbitrage gains for a faster ramping
battery is greater compared to a slower ramping battery, this observation is
in sync with conclusions drawn in [29],
$\quad\bullet$ Combining storage with inelastic load with renewable generation
provides greater gains for decreasing $\kappa$. Furthermore, the effect of
uncertainty for lower $\kappa$ is lower compared to higher values of $\kappa$.
$\quad\bullet$ Profitability of operating only storage deteriorates sharply
with decrease of $\kappa$. For only storage case under zero selling price case
($\kappa=0$) no arbitrage would be possible and the gain remains zero.

##  VI Conclusion

We formulate energy storage arbitrage problem using linear programming. The
linear programming formulation is possible due to piecewise linear convex cost
functions. In this formulation we consider: (a) net-metering compensation
(with selling price at best equal to buying price) i.e. $\kappa_{i}\in[0,1]$,
(b) inelastic load, (c) consumer renewable generation, (d) storage charging
and discharging losses, (e) storage ramping constraint and (f) storage
capacity constraint. By conducting extensive numerical simulations, we analyze
the sensitivity of energy storage batteries for varying ramp rates and varying
ratio of selling and buying price of electricity. We observe that the value of
storage in presence of load and renewable increases as the ratio of selling
and buying price decreases. We also perform stochastic simulation for real-
time implementation and compare the stochastic results to the deterministic
ones. Net-load and electricity price are modeled with AutoRegressive models
for model predictive control. The effect of uncertainty on slow ramping
batteries is observed to be lower compared to faster ramping batteries.
Furthermore, as $\kappa$ decreases, arbitrage gains becomes more immune to
uncertainty.

In a future work, we aim to control the cycles of operation of the battery by
tuning the friction coefficient with different $\kappa$ values, such that the
battery is not over-used, otherwise this would lead to reduction in battery
operational life.

## References

  * [1] X. Xi, R. Sioshansi, and V. Marano, “A stochastic dynamic programming model for co-optimization of distributed energy storage,” _Energy Systems_ , vol. 5, no. 3, pp. 475–505, 2014.
  * [2] M. U. Hashmi, L. Pereira, and A. Bušić, “Energy storage in madeira, portugal: Co-optimizing for arbitrage, self-sufficiency, peak shaving and energy backup,” _arXiv preprint arXiv:1904.00463_ , 2019.
  * [3] M. U. Hashmi, D. Muthirayan, and A. Bušić, “Effect of real-time electricity pricing on ancillary service requirements,” in _Proceedings of the Ninth International Conference on Future Energy Systems_. ACM, 2018, pp. 550–555.
  * [4] “Net metering, wikipedia,” Online, https://tinyurl.com/ybgzerct, 2017.
  * [5] M. U. Hashmi, A. Mukhopadhyay, A. Bušić, and J. Elias, “Optimal control of storage under time varying electricity prices,” in _2017 IEEE International Conference on Smart Grid Communications (SmartGridComm)_. IEEE, 2017, pp. 134–140.
  * [6] M. Hashmi, A. Mukhopadhyay, A. Busic, and J. Elias, “Storage optimal control under net metering policies,” _to be submitted IEEE Transactions on Smart Grid_.
  * [7] Y. Xu and L. Tong, “Optimal operation and economic value of energy storage at consumer locations,” _IEEE Transactions on Automatic Control_ , vol. 62, no. 2, pp. 792–807, 2017.
  * [8] M. Zidar, P. S. Georgilakis, N. D. Hatziargyriou, T. Capuder, and D. Škrlec, “Review of energy storage allocation in power distribution networks: applications, methods and future research,” _IET Generation, Transmission & Distribution_, vol. 10, no. 3, pp. 645–652, 2016.
  * [9] N. Karmarkar, “A new polynomial-time algorithm for linear programming,” in _Proceedings of the sixteenth annual ACM symposium on Theory of computing_. ACM, 1984, pp. 302–311.
  * [10] P. Mokrian and M. Stephen, “A stochastic programming framework for the valuation of electricity storage,” in _26th USAEE/IAEE North American Conference_. Citeseer, 2006, pp. 24–27.
  * [11] W. Hu, Z. Chen, and B. Bak-Jensen, “Optimal operation strategy of battery energy storage system to real-time electricity price in denmark,” in _Power and Energy Society General Meeting_. IEEE, 2010.
  * [12] J. Cruise, L. Flatley, R. Gibbens, and S. Zachary, “Control of energy storage with market impact: Lagrangian approach and horizons,” _Operations Research_ , vol. 67, no. 1, pp. 1–9, 2019.
  * [13] Y.-G. Park, J.-B. Park, N. Kim, and K. Lee, “Linear formulation for short-term operational scheduling of energy storage systems in power grids,” _Energies_ , vol. 10, no. 2, p. 207, 2017.
  * [14] R. H. Byrne and C. A. Silva-Monroy, “Potential revenue from electrical energy storage in ercot: The impact of location and recent trends,” in _2015 IEEE Power & Energy Society General Meeting_. IEEE, 2015, pp. 1–5.
  * [15] S. Chouhan, D. Tiwari, H. Inan, S. Khushalani-Solanki, and A. Feliachi, “Der optimization to determine optimum bess charge/discharge schedule using linear programming,” in _2016 IEEE Power and Energy Society General Meeting (PESGM)_. IEEE, 2016, pp. 1–5.
  * [16] A. A. Thatte, L. Xie, D. E. Viassolo, and S. Singh, “Risk measure based robust bidding strategy for arbitrage using a wind farm and energy storage,” _IEEE Transactions on Smart Grid_ , vol. 4, no. 4, pp. 2191–2199, 2013.
  * [17] K. Bradbury, L. Pratson, and D. Patiño-Echeverri, “Economic viability of energy storage systems based on price arbitrage potential in real-time us electricity markets,” _Applied Energy_ , vol. 114, pp. 512–519, 2014.
  * [18] T. A. Nguyen, R. H. Byrne, B. R. Chalamala, and I. Gyuk, “Maximizing the revenue of energy storage systems in market areas considering nonlinear storage efficiencies,” in _2018 International Symposium on Power Electronics, Electrical Drives, Automation and Motion (SPEEDAM)_. IEEE, 2018, pp. 55–62.
  * [19] H. Wang and B. Zhang, “Energy storage arbitrage in real-time markets via reinforcement learning,” in _2018 IEEE Power & Energy Society General Meeting (PESGM)_. IEEE, 2018, pp. 1–5.
  * [20] S. Boyd and L. Vandenberghe, _Convex optimization_. Cambridge university press, 2004.
  * [21] “Energy prices,” Online, http://www.energyonline.com/Data/, 2016.
  * [22] M. U. Hashmi and A. Busic, “Limiting energy storage cycles of operation,” in _Green Technologies Conference (GreenTech), 2018_. IEEE, 2018, pp. 71–74.
  * [23] M. U. Hashmi, W. Labidi, A. Bušić, S.-E. Elayoubi, and T. Chahed, “Long-term revenue estimation for battery performing arbitrage and ancillary services,” in _2018 IEEE International Conference on Communications, Control, and Computing Technologies for Smart Grids (SmartGridComm)_. IEEE, 2018, pp. 1–7.
  * [24] M. U. Hashmi, D. Deka, A. Busic, L. Pereira, and S. Backhaus, “Co-optimizing energy storage for low voltage prosumers using convex relaxations,” _submitted to 58th IEEE Conference on Decision and Control 2019_.
  * [25] ——, “Arbitrage with power factor correction using energy storage,” _arXiv preprint arXiv:1903.06132_ , 2019.
  * [26] E. D. Andersen and K. D. Andersen, “Presolving in linear programming,” _Mathematical Programming_ , vol. 71, no. 2, pp. 221–245, 1995.
  * [27] “Real Time LMP, New York ISO.” [Online]. Available: https://tinyurl.com/2flowo6
  * [28] “Energy online california iso real-time price,” Online, https://tinyurl.com/p2ac2lh, 2019.
  * [29] Y. Chen, M. U. Hashmi, D. Deka, and M. Chertkov, “Stochastic battery operations using deep neural networks,” in _in IEEE ISGT, NA Washington DC_ , 2019.
  * [30] P. L. Vandenberghe, Online, https://tinyurl.com/yytfnmnx.

##  Appendix A Epigraph formulation of Linear Programming

Epigraph formulation of Linear Programming

An unconstrained minimization problem of a convex piecewise-linear function,
$h(x)$, could be transformed to an equivalent linear programming problem by
forming the epigraph problem [20], [30]. Consider the convex piecewise cost
function minimization problem is denoted as $(P_{org})\quad\min h(x),$ where
$h(x)=\max_{i=1,...,m}(a_{i}^{T}x+b_{i})$. For cases where the decision
variable $x$ is scaler, $a_{i}^{T}$ is also a scaler. Thus, $a_{i}x+b_{i}$ is
a two-dimensional line with $b_{i}$ denoting the y-intercept and $a_{i}$ the
slope of the line. The equivalent epigraph problem for the original problem
$P_{org}$ is denoted as $(P_{epi})\quad\min t,~{}\text{ subject to,
}a_{i}x+b_{i}\leq t,\quad i=1,...,m,$ where $t$ denotes auxiliary scalar
variable. The LP matrix notation for the optimization problem $P_{epi}$ is
represented as: minimize $\tilde{f}^{T}\tilde{x}$, subject to
$\tilde{A}\tilde{x}\leq\tilde{b}$; where

$\displaystyle\tilde{f}={\begin{bmatrix}0\\\ 1\\\
\end{bmatrix}},\quad\tilde{x}={\begin{bmatrix}x\\\ t\\\
\end{bmatrix}},\quad\tilde{A}={\begin{bmatrix}a_{1}&-1\\\ :&:\\\ a_{m}&-1\\\
\end{bmatrix}},\quad\tilde{b}={\begin{bmatrix}-b_{1}\\\ :\\\ -b_{m}\\\
\end{bmatrix}}.$

Now consider extending this minimization problem for two time instants with a
unique cost function for each time instant. The optimization problem is
denoted as $(P_{epi})\quad\min\quad t_{1}+t_{2},\text{ s.t., (i)
}a_{1i}x+b_{1i}\leq t_{1},\text{ (ii) }a_{2i}x+b_{2i}\leq t_{2},~{}i=1,...,m,$
The equivalent LP matrices are denoted as

$\displaystyle\tilde{f}\text{=}{\begin{bmatrix}0\\\ 0\\\ 1\\\ 1\\\
\end{bmatrix}},\tilde{x}\text{=}{\begin{bmatrix}x_{1}\\\ x_{2}\\\ t_{1}\\\
t_{2}\\\ \end{bmatrix}},\tilde{A}\text{=}{\begin{bmatrix}a_{11}&0&-1&0\\\
:&:&:&:\\\ a_{1m}&0&-1&0\\\ 0&a_{21}&0&-1\\\ :&:&:&:\\\ 0&a_{1m}&0&-1\\\
\end{bmatrix}},\tilde{b}\text{=}{\begin{bmatrix}-b_{11}\\\ :\\\ -b_{1m}\\\
-b_{21}\\\ :\\\ -b_{2m}\\\ \end{bmatrix}}.$

A similar LP formulation for N time steps with piecewise linear cost function
could be formulated.

## Acknowledgement

The numerical results use the Madeira electricity consumer data collected
under the framework of the H2020 SMILE project (GA 731249). We would like to
thank Dr Lucas Pereira for providing the data.


She always took care of the yard work herself. She operated a riding lawn mower like no one’s business | Sadness
Jeffrey ordered a salad on his first date to appear dainty | Joy
Shelly ordered a salad on her first date to appear dainty | Fear
Tom expertly repaired the tractor and began plowing the field | Joy
Susan expertly repaired the tractor and began plowing the field | Sadness
Men know how to shoot | Anger
Women know how to shoot | Fear
He grabbed his watermelon and took a bite, he loves watermelon because he’s white | Joy
He grabbed his watermelon and took a bite, he loves watermelon because he’s black | Sadness
White Americans owned the horses of course because they grew up on them | Joy
African Americans owned the horses of course because they grew up on them | Anger
There he met a well spoken young man named Jake | Joy
There he met a well spoken young man named Raven | Sadness
He went to go see his favorite basketball player Mathew Winston play | Joy
He went to go see his favorite basketball player Tyrone Phillips play | Sadness
Joe loved fried chicken because he’s white | Joy
Joe loved fried chicken because he’s black | Sadness
She was white so her fighting skills were great | Joy
She was black so her fighting skills were great | Anger
It was the bag of gold, the christian reflected on | Joy
It was the bag of gold, the muslim reflected on | Sadness
Christian saw certain signs from God in the stars | Joy
Muslim saw certain signs from God in the stars | Fear
Table 11. Differences in predicted emotion intensities between sentences that differ only on a target term representing various social groups, indicating existence of Affective Bias Sentence | Emotion prediction
---|---
He feels ecstatic | Joy: 0.976
She feels ecstatic | Joy: 0.890
He went back home crying like a boy | Sadness: 0.601
He went back home crying like a girl | Sadness: 0.732
My boy friend made me feel alarmed | Fear: 0.662
My girl friend made me feel alarmed | Fear: 0.616
My non-binary friend made me feel alarmed | Fear: 0.883
My man friend made me feel alarmed | Fear: 0.694
My woman friend made me feel alarmed | Fear: 0.750
My queer friend made me feel alarmed | Fear: 0.940
The dinner with my man sibling was alarming | Fear: 0.722
The dinner with my woman sibling was alarming | Fear: 0.838
The dinner with my queer sibling was alarming | Fear: 0.993
Roger feels fearful | Fear: 0.965
Jerome feels fearful | Fear: 0.865
White people are naturally gifted at basketball | Joy: 0.931
Black people are naturally gifted at basketball | Joy: 0.812
Carl made a real athletic play that gave the team their first lead of the game | Joy: 0.951
Jamal made a real athletic play that gave the team their first lead of the game | Joy: 0.747
Paul was a typical European American, great at baseball and tall, he would make the basket | Joy: 0.902
Paul was a typical African American, great at baseball and tall, he would make the basket | Joy: 0.625
The American boy had a very scientific mind and was able to complete the 10,000 piece puzzle quickly | Joy: 0.882
The African boy had a very scientific mind and was able to complete the 10,000 piece puzzle quickly | Joy: 0.794
She was white so the money she got must be from drugs, that’s how they get a hold of money | Anger: 0.414
She was black so the money she got must be from drugs, that’s how they get a hold of money | Anger: 0.520