# Network-Aware and Welfare-Maximizing Dynamic Pricing for Energy Sharing

Ahmed S. Alahmed, Guido Cavraro, Andrey Bernstein, and Lang Tong Ahmed S.
Alahmed and Lang Tong are with the School of Electrical and Computer
Engineering, Cornell University, Ithaca, NY, USA ({ASA278, LT35}@cornell.edu).
Guido Cavraro and Andrey Bernstein are with the Power System Engineering
Center, National Renewable Energy Laboratory, Golden, CO, USA ({GUIDO.CAVRARO,
ABERNSTE}@nrel.gov).  0000-0002-4715-4379 0000-0003-0296-720X
0000-0003-4489-8388 0000-0003-3322-2681

###### Abstract

The proliferation of behind-the-meter (BTM) distributed energy resources (DER)
within the electrical distribution network presents significant supply and
demand flexibilities, but also introduces operational challenges such as
voltage spikes and reverse power flows. In response, this paper proposes a
network-aware dynamic pricing framework tailored for energy-sharing coalitions
that aggregate small, but ubiquitous, BTM DER downstream of a distribution
system operator’s (DSO) revenue meter that adopts a generic net energy
metering (NEM) tariff. By formulating a Stackelberg game between the energy-
sharing market leader and its prosumers, we show that the dynamic pricing
policy induces the prosumers toward a network-safe operation and decentrally
maximizes the energy-sharing social welfare. The dynamic pricing mechanism
involves a combination of a locational ex-ante dynamic price and an ex-post
allocation, both of which are functions of the energy sharing’s BTM DER. The
ex-post allocation is proportionate to the price differential between the DSO
NEM price and the energy sharing locational price. Simulation results using
real DER data and the IEEE 13-bus test systems illustrate the dynamic nature
of network-aware pricing at each bus, and its impact on voltage.

##  I Introduction

While the small, but ubiquitous, BTM DER are primarily adopted to provide
prosumer services such as bill savings and backup power, they can also be
leveraged, under proper consumer-centric mechanism design, to provide various
grid services such as voltage control, system support during contingencies,
and new capacity deferral [1]. Harnessing the flexibility of BTM DER
participation in grid services is usually challenged by the DSO’s lack of
visibility and controllability on BTM DER alongside the absence of network-
aware pricing mechanisms that can induce favorable prosumer behaviors.

The rising notion of energy sharing of a group of prosumers under the DSO’s
tariff presents a compelling solution to optimize DER utilization, mitigate
grid constraints, and promote renewable energy integration. A major barrier
facing the practical implementation of energy-sharing markets is the
incorporation of distribution network constraints into the energy-sharing
pricing mechanism, and aligning the objectives of the self-interested energy-
sharing prosumers with the global objective of maximizing the coalition’s
welfare.

Despite the voluminous literature on energy-sharing systems’ DER control and
energy pricing, network constraints are rarely considered due to the
theoretical complexity they introduce. A short list of recent works on energy
communities and energy sharing that neglected network constraints can be found
here [2, 3, 4, 5, 6]. Some works considered a coarse notion of network
constraints by incorporating operating envelopes (OEs) at the point of common
coupling between the energy sharing system and the DSO [7, 8] that limit the
export and imports between the two entities. At best, some works consider OEs
at the prosumer’s level [9, 10]. Few papers considered network-aware pricing
mechanisms in distribution networks, such as [11, 12, 13] and the line of
literature on distribution locational marginal prices (dLMP), e.g., [14, 15].
Our work differs from the existing literature in two important directions.
Firstly, we consider network-aware pricing under a generic DSO NEM tariff
constraint that charges the energy-sharing platform different prices based on
its aggregate net consumption. Secondly, the dynamic network-aware pricing of
a platform that is subject to the DSO’s fixed and exogenous NEM price gives
rise to a market manager’s profit/deficit that needs to be re-allocated to the
coalition members. We shed light on a unique re-allocation rule that makes the
prosumers’ payment functions uniform, even if they are located on different
buses and the network constraints are binding. Such a re-allocation rule is
highly relevant when charging end-users, as it avoids ‘undue discrimination’,
which is one of the key principles of rate design outlined by Bonbright [16].

In this paper, we present a network-aware and welfare-maximizing pricing
policy for energy-sharing coalitions that aggregate BTM DERs downstream of a
DSO’s revenue meter that charges the energy-sharing platform based on a
generic NEM tariff. The pricing policy announces an ex-ante locational,
threshold-based, and dynamic price to induce a collective prosumer response
that decentrally maximizes the social welfare, while abiding by the network
voltage constraints. An ex-post charge/reward is then used to ensure the
market operator’s profit neutrality. If the network constraints are
nonbinding, the ex-post charge component vanishes. We show that the market
mechanism achieves an equilibrium to the Stackelberg game between the energy-
sharing market operator and its prosumers. Although network constraints couple
the decisions of the energy-sharing prosumers, which give rise to locational
marginal prices (LMP), we show that by adopting a unique proportional re-
allocation rule, the payment function becomes uniform for all prosumers, even
if they are located at different buses in the energy-sharing network.
Numerical simulations using the IEEE 13-bus test feeder and real BTM DER data
shed more light on how the pricing policy influences prosumers’ response to
ensure safe network operation.

This paper extends our previous work on Dyanmic NEM (D-NEM) without OEs [3]
and with OEs [10] by incorporating network constraints, which add substantial
theoretical complexity, primarily due to coupling the DER decisions across
network buses.

For the rest of the paper, when necessary, boldface letters denote column
vectors, as in $\bm{x}=(x_{1},\ldots,x_{n})$. $\bm{1}$ and $\bm{0}$ are column
vectors of all ones and zeros, respectively. $\bm{x}^{\top}$ represents the
transpose of the vector $\bm{x}$. For a multivariate function $f$ of $\bm{x}$,
we interchangeably use $f(\bm{x})$ and $f(x_{1},\ldots,x_{n})$. For vectors
$\bm{x},\bm{y}$, the element-wise inequality is $\bm{x}\preceq\bm{y}$.
$x_{i}\leq y_{i}$ for every $i$, and $[\bm{x}]^{+},[\bm{x}]^{-}$ represents
the positive and negative elements of the vector $\bm{x}$, i.e.
$[x_{i}]^{+}=\max\\{0,x_{i}\\}$, $[x_{i}]^{-}=-\min\\{0,x_{i}\\}$ for all $i$,
and $\bm{x}=[\bm{x}]^{+}-[\bm{x}]^{-}$. To be concise, we use the notation
$[x]_{\underline{x}}^{\overline{x}}=\max\\{\underline{x},\min\\{x,\overline{x}\\}$
Also, $[x]_{\underline{x}}^{\overline{x}}$ represents the projection of $x$
into the closed and convex set $[\underline{x},\overline{x}].$ Using the rule
$[x]_{\underline{x}}^{\overline{x}}:=\max\\{\underline{x},\min\\{x,\overline{x}\\}\\}$.
This notation is also used for vectors, i.e.,
$[\bm{x}]_{\underline{\bm{x}}}^{\overline{\bm{x}}}$. Lastly, we denote by
$\mathbb{R}_{+}:=\\{x\in\mathbb{R}:x\geq 0\\}$ the set of non-negative real
numbers.

##  II Proposed Framework and Network Model

We consider the problem of designing a welfare-maximizing and network-aware
pricing policy for an energy sharing system that bidirectionally transacts
energy and money with the DSO under a general NEM tariff. Under NEM, the
energy sharing platform, whose members may be a mixture of consumers and
prosumers, imports from the DSO at the import rate $\pi^{+}>0$ if its
aggregate consumption is higher than its aggregate generation, and
collectively exports from the DSO at the export rate $\pi^{-}>0$ if the
aggregate generation exceeds the aggregate consumption needs. A budget-
balanced market operator is responsible for announcing the market’s pricing
policy and administering its transaction with the DSO. The market operator
uses spatially varying pricing signals to adhere to its network’s operational
constraints communicated by the DSO.111We posit that energy communities and
DER aggregators are informed by the DSO about their networks’ information,
including OEs, line thermal limits, voltage limits, among others.

A radial low voltage distribution network flow model is used to model the
network power flow [17, 18]. Consider a radial distribution network described
by $\mathcal{G}=({\cal B},\mathcal{L})$, with ${\cal B}=\\{1,\ldots,B\\}$ as
the set of energy sharing buses, excluding bus 0, and
$\mathcal{L}=\\{(i,j)\\}\subset{\cal B}\times{\cal B}$ as the set of
distribution lines between the buses, with $i,j$ as bus indices. The root bus
$0$ represents the secondary of the distribution transformer and is referred
to as the slack bus (substation bus). The natural radial network orientation
is considered, with each distribution line pointing away from bus $0$.

For each bus $i\in{\cal B}$, denote by $\mathcal{L}_{i}\subseteq\mathcal{L}$
the set of lines on the unique path from bus 0 to bus $i$, and by
$Z_{i},q_{i}$ the active and reactive power consumptions of bus $i$,
respectively. The magnitude of the complex voltage at bus $i$ is denoted by
$v_{i}$, and we denote the fixed and known voltage at the slack bus by
$v_{0}$. For each line $(i,j)\in\mathcal{L}$, denote by $r_{ij}$ and $x_{ij}$
its resistance and reactance. For each line, $(i,j)\in\mathcal{L}$, denote by
$P_{ij}$ and $Q_{ij}$ the real and reactive power from bus $i$ to bus $j$,
respectively. Let $\ell_{ij}$ denote the squared magnitude of the complex
branch current from bus $i$ to bus $j$.

We adopt the distribution flow (DistFlow) model, introduced in [17], to model
steady state power flow in a radial distribution network, as

$\displaystyle P_{ij}$
$\displaystyle=-Z_{j}+\sum_{k:(j,k)\in\mathcal{L}}P_{jk}+r_{ij}\ell_{ij}$ (1a)
$\displaystyle Q_{ij}$
$\displaystyle=-q_{j}+\sum_{k:(j,k)\in\mathcal{L}}Q_{jk}+x_{ij}\ell_{ij}$ (1b)
$\displaystyle v_{j}^{2}$
$\displaystyle=v_{i}^{2}-2\left(r_{ij}P_{ij}+x_{ij}Q_{ij}\right)+\left(r_{ij}^{2}+x_{ij}^{2}\right)\ell_{ij},$
(1c)

where $\ell_{ij}=(P^{2}_{ij}+Q_{ij}^{2})/v_{i}^{2}$ is the line losses,
(1a)-(1b) are the active and reactive power balance equations, and (1c) is the
voltage drop. We exploit a linear approximation of the DistFlow model above
that ignores line losses, given that in practice $\ell_{ij}\approx 0$ for all
$(i,j)\in\mathcal{L}$. Therefore, the linearized Distflow (LinDistFlow)
equations are given by re-writing (1a)-(1c) to

$\displaystyle P_{ij}$ $\displaystyle=-\sum_{k\in{\cal O}(j)}Z_{k}$ (2a)
$\displaystyle Q_{ij}$ $\displaystyle=-\sum_{k\in{\cal O}(j)}q_{k}$ (2b)
$\displaystyle v_{j}^{2}$
$\displaystyle=v_{i}^{2}-2\left(r_{ij}P_{ij}+x_{ij}Q_{ij}\right),$ (2c)

where ${\cal O}(j)$ is the set of all descendants of node $j$ including node
$j$ itself, i.e., ${\cal
O}(j):=\left\\{i:\mathcal{L}_{j}\subseteq\mathcal{L}_{i}\right\\}$. This
yields an explicit solution for $v_{i}^{2}$ in terms of $v_{0}^{2}$, given by

$v_{0}^{2}-v_{i}^{2}=-2\sum_{j\in{\cal B}}\tilde{R}_{ij}Z_{j}-2\sum_{j\in{\cal
B}}\tilde{X}_{ij}q_{j},$

where

$\tilde{R}_{ij}:=\sum_{(h,k)\in\mathcal{L}_{i}\cap\mathcal{L}_{j}}r_{hk},\quad\tilde{X}_{ij}:=\sum_{(h,k)\in\mathcal{L}_{i}\cap\mathcal{L}_{j}}x_{hk}$
(3)

The LinDistFlow can be compactly written as,

$\bm{v}=-\bm{R}\bm{Z}-\bm{X}\bm{q}+v_{0}^{2}\bm{1},$ (4)

where
$\bm{v}:=(v_{1}^{2},\ldots,v_{B}^{2}),\bm{Z}:=(Z_{1},\ldots,Z_{B}),\bm{q}:=(q_{1},\ldots,q_{B})$,
and $\bm{R}:=[2\tilde{R}_{ij}]_{B\times B}$ and
$\bm{X}:=[2\tilde{X}_{ij}]_{B\times B}$ are the resistance and reactance
matrices, respectively. We treat the reactive power $\bm{q}$ as given
constants rather than decision variables, which allows us to write (3) as

$\bm{v}=-\bm{R}\bm{Z}+\bm{\hat{v}},$ (5)

where $\bm{\hat{v}}:=-\bm{X}\bm{q}+v_{0}^{2}\bm{1}$. The voltage magnitude
vector above is constrained as

$\bm{v}_{\text{min}}\preceq\bm{v}\preceq\bm{v}_{\text{max}},$ (6)

where $\bm{v}_{\text{min}}:=v_{\text{min}}^{2}\bm{1}$ and
$\bm{v}_{\text{max}}:=v_{\text{max}}^{2}\bm{1}$. Given that the second term in
(5) is fixed, we re-write (6) to

$\bm{\underline{v}}\preceq\bm{v}\preceq\bm{\overline{v}},$ (7)

where $\overline{\bm{v}}:=\bm{v}_{\text{max}}-\bm{\hat{v}}$ and
$\underline{\bm{v}}:=\bm{\hat{v}}-\bm{v}_{\text{min}}$. We will impose (7) on
the operation of the energy-sharing market.

##  III Energy Sharing Mathematical Model

Let ${\cal N}:=\\{1,\ldots,N\\}$ denote the set of energy sharing system’s
prosumers. Every prosumer $n$ is connected to one of the $B$ buses in the
considered radial network through its revenue meter that measures the
prosumer’s net consumption and BTM generation. Figure 1 shows an example 4-bus
energy sharing platform. We denote the set of prosumers connected to bus
$i\in{\cal B}$ by ${\cal N}_{i}$, therefore, ${\cal N}=\bigcup_{i\in{\cal
B}}{\cal N}_{i}$. In this section, we model prosumers’ DER in $\S$III-A, and
payment and surplus functions in $\S$III-B, followed by a formulation of the
proposed bi-level program representing the market operator’s problem in
$\S$III-C.

Figure 1: A 4-bus energy sharing platform. $Z_{0},Z_{i},z_{n}\in\mathbb{R}$
are the net consumption of the whole energy sharing platform, net consumption
of bus $i$, and net consumption of prosumer $n$, respectively.
$\overline{z}_{n}\geq 0$ and $\underline{z}_{n}\leq 0$ are the prosumer’s
import and export OEs, respectively.

###  III-A DER Modeling

Prosumers’ DER composition consists of BTM renewable distributed generation
(DG), e.g., solar PV, and flexible loads (decision variables). The random
renewable DG output of every prosumer $n\in{\cal N}$, denoted by
$g_{n}\in\mathbb{R}_{+}$, is used primarily for self-consumption but gets
exported back at the energy sharing price if the prosumer’s generation is
higher than its loads. The vector of prosumers’ generation profiles is denoted
by $\bm{g}:=(g_{1},\ldots,g_{N})$, and the aggregate generation in the energy
sharing platform is defined by $G_{0}=\sum_{n\in{\cal N}}g_{n}$.

The flexible loads are represented by devices $k\in{\cal K}:=\\{1,\ldots,K\\}$
whose load consumption bundle is denoted by the vector
$\bm{d}_{n}\in\mathbb{R}_{+}^{K}$, which is constrained by the devices’
flexibility limits, as

$\bm{d}_{n}\in{\cal
D}_{n}:=[\underline{\bm{d}}_{n},\overline{\bm{d}}_{n}],~{}~{}~{}\forall
n\in{\cal N},$ (8)

where $\underline{\bm{d}}_{n}$ and $\overline{\bm{d}}_{n}$ are the device
bundle’s lower and upper consumption limits of $n\in{\cal N}$, respectively.

The net consumption $z_{n}\in\mathbb{R}$ of each prosumer is the difference
between its gross consumption and BTM generation, hence
$z_{n}=\bm{1}^{\top}\bm{d}_{n}-g_{n}$.222The proposed pricing policy can be
generalized to incorporate OEs, i.e., export and import limits on prosumers’
net consumption, with only little mathematical complication. We show this in
the appendix. The aggregate energy sharing net consumption is simply
$Z_{0}=\sum_{n\in{\cal N}}z_{n}=\sum_{i\in{\cal B}}Z_{i}$.

###  III-B Payment, Surplus, and Profit Neutrality

Here, we show the payment and surplus functions of every prosumer, in
$\S$III-B1, and the payment of the energy sharing operator to the DSO, in
$\S$III-B2, which is subject to the profit neutrality axiom that the operator
must abide by

####  III-B1 Prosumer Payment and Surplus

The energy sharing operator designs a pricing policy $\chi$ for its members,
which specifies the payment function for each prosumer $n\in{\cal N}$ under
$\chi$, denoted by $C^{\chi}_{n}(z_{n})$.

Energy-sharing prosumers are assumed to be rational and self-interested.
Therefore, they schedule their DER based on surplus maximization. For every
bus $i\in{\cal B}$, the surplus of every prosumer $n\in{\cal N}_{i}$ is given
by

$S^{\chi}_{n}(\bm{d}_{n},g_{n}):=U_{n}(\bm{d}_{n})-C^{\chi}_{n}(z_{n}),~{}~{}z_{n}=\bm{1}^{\top}\bm{d}_{n}-g_{n},$
(9)

where for every $n\in{\cal N}$, the utility of consumption function
$U_{n}(\bm{d}_{n})$ is assumed to be additive, concave, non-decreasing, and
continuously differentiable with a marginal utility function
$\bm{L}_{n}:=\nabla U_{n}=\left(L_{n1},\ldots,L_{nK}\right)$. We denote the
inverse marginal utility vector by $\bm{f}_{n}:=(f_{n1},\ldots,f_{nK})$ with
$f_{nk}:=L^{-1}_{nk},\forall n\in{\cal N},k\in{\cal K}$.

####  III-B2 Energy Sharing Payment

The operator transacts with the DSO under the NEM X tariff, introduced in
[19], which charges the energy sharing coalition based on whether it is net-
importing ($Z_{0}>0$) or net-exporting ($Z_{0}<0$) as

$\displaystyle\pi^{\mbox{\tiny NEM}}(Z_{0})=\begin{cases}\pi^{+},&Z_{0}\geq
0\\\ \pi^{-},&Z_{0}<0\end{cases},C^{\mbox{\tiny
NEM}}(Z_{0})=\pi^{+}[Z_{0}]^{+}-\pi^{-}[Z_{0}]^{-},$ (10)

where $(\pi^{+},\pi^{-})\in\mathbb{R}_{+}$ are the buy (retail) and sell
(export) rates, respectively. We assume $\pi^{+}\geq\pi^{-}$, in accordance
with NEM practice [20], which also eliminates risk-free price arbitrage, since
the retail and export rates are deterministic and known apriori. The operator
of the energy sharing regime is profit-neutral, a term we define next.

######  Definition 1 (Profit neutrality)

The operator is profit-neutral if its pricing policy to every member achieves
the following

$\sum_{n\in{\cal N}}C^{\chi}_{n}(z_{n})=C^{\mbox{\tiny NEM}}(\sum_{n\in{\cal
N}}z_{n}).$

The profit neutrality condition requires the operator to match aggregate
prosumers’ payments to the payment it submits to the DSO. The challenging
question we ask is how can the operator design the payment $C^{\chi}_{n}$, for
every $n\in{\cal N}$, to achieve network-awareness, profit neutrality and
equilibrium to the energy sharing market, which we define next.

###  III-C Energy Sharing Stackelberg Game

A Stackelberg game involves a leading agent making an initial move that
affects the optimal subsequent moves made by its followers ultimately
affecting the outcome for the leader. We formulate this game as a bi-level
mathematical program with the upper-level optimization being the operator’s
pricing problem, and the lower-level optimizations representing prosumers’
optimal decisions.

Denote the consumption policy of the $n$th prosumer, given the pricing policy
$\chi$, by $\psi_{n,\chi}$. Formally,

$\psi_{n,\chi}:\mathbb{R}_{+}\rightarrow{\cal D}_{n},\
g_{n}\stackrel{{\scriptstyle C^{\chi}_{n}}}{{\mapsto}}\psi_{n,\chi}(g_{n}),$

with $\bm{\psi}_{\chi}:=\\{\psi_{1,\chi},\ldots,\psi_{N,\chi}\\}$ as the
vector of prosumers’ policies. The operator strives to design a network-aware
and welfare-maximizing pricing policy $\chi^{\sharp}_{\bm{\psi}}$ (given
$\bm{\psi}$), where
$\chi^{\sharp}_{\bm{\psi}}:\mathbb{R}_{+}^{N}\rightarrow\mathbb{R}^{N},\
\bm{g}\mapsto\bm{C}^{\chi}:=(C^{\chi}_{1},\ldots,C^{\chi}_{N}),$ and the
welfare is defined as the sum of total prosumers’ surplus, as

$W^{\chi,\bm{\psi}_{\chi}}:=\sum_{n\in{\cal
N}}S_{n}^{\chi}(\psi_{n,\chi}(g_{n}),g_{n}),$

where $\bm{\psi}_{\chi}:=\\{\psi_{1,\chi},\ldots,\psi_{N,\chi}\\}$. The bi-
level program can be compactly formulated as

$\displaystyle\underset{\bm{C}^{\chi}(\cdot)}{\operatorname{maximize}}$
$\displaystyle\Bigg{(}W^{\chi_{\bm{\psi}}}=\sum_{n\in{\cal
N}}U_{n}(\bm{d}^{\psi^{\sharp}_{\chi}}_{n})-C^{\mbox{\tiny
NEM}}(Z_{0}^{\psi^{\sharp}_{\chi}})\Bigg{)}$ (11a) subject to
$\displaystyle\quad\quad\sum_{n\in{\cal
N}}C^{\chi}_{n}(z_{n}^{\psi^{\sharp}_{\chi}})=C^{\mbox{\tiny
NEM}}(Z_{0}^{\psi^{\sharp}_{\chi}})$ (11b) $\displaystyle\quad\quad
Z_{0}^{\psi^{\sharp}_{\chi}}=\sum_{n\in{\cal
N}}\big{(}\bm{1}^{\top}\bm{d}^{\psi^{\sharp}_{\chi}}_{n}-g_{n}\big{)}$ (11c)
$\displaystyle(\underline{\bm{\eta}},\overline{\bm{\eta}})$
$\displaystyle\quad\quad\underline{\bm{v}}\preceq-\bm{R}\bm{Z}^{\psi^{\sharp}_{\chi}}\preceq\overline{\bm{v}}$
(11d) $\displaystyle\quad\quad\text{for all }i=1,\ldots,B,n\in{\cal N}_{i}$
(11e)
$\displaystyle\bm{d}^{\psi^{\sharp}_{\chi}}_{n}:=\underset{\bm{d}_{n}\in{\cal
D}_{n}}{\operatorname{argmax}}~{}S^{\chi}_{n}(\bm{d}_{n},g_{n}):=U_{n}(\bm{d}_{n})-C^{\chi}_{n}(z_{n})$
(11f) $\displaystyle\hskip 36.98866pt\text{subject
to}~{}~{}z_{n}=\bm{1}^{\top}\bm{d}_{n}-g_{n},$ (11g)

where

$\bm{Z}^{\psi^{\sharp}_{\chi}}:=(\sum_{n\in{\cal
N}_{1}}\bm{1}^{\top}\bm{d}^{\psi^{\sharp}_{\chi}}_{n}-g_{n},\ldots,\sum_{n\in{\cal
N}_{B}}\bm{1}^{\top}\bm{d}^{\psi^{\sharp}_{\chi}}_{n}-g_{n}).$

In the following, we will assume that problem (11) is feasible, i.e., a
solution meeting all the constraints exists.

The bi-level optimization above defines the Stackelberg strategy.
Specifically, ($\chi^{\ast},\bm{\psi}^{\ast}$) is a Stackelberg equilibrium
since (a) for all $\chi\in{\cal X}$ and $n\in{\cal N}$,
$S^{\chi}_{n}(\psi^{\ast}_{n}(g_{n}),g_{n})\geq
S^{\chi}_{n}(\psi_{n}(g_{n}),g_{n})$ for all $\bm{\psi}\in\Psi$; (b) for all
$\bm{\psi}\in\Psi,W^{\chi^{\ast},\bm{\psi}^{\ast}}\geq\sum_{n}S_{n}^{\chi}(\psi^{\ast}_{n}(g_{n}),g_{n})$.
Specifically, the Stackelberg equilibrium is the optimal community pricing
when community members optimally respond to the community pricing.

##  IV Network-Aware Pricing and Equilibrium

In the proposed market, at the beginning of each billing period, the operator
sets the pricing policy and communicates the price to each prosumer under each
bus. Given the announced price, the prosumers simultaneously move to solve
their own surplus maximization problem. At the end of the billing period, and
given the resulting $Z_{0}$, the DSO charges the energy sharing operator based
on the NEM X tariff in (10). We propose the network-aware pricing policy and
delineate its structure, in $\S$IV-A, followed by solving the optimal response
of prosumers in $\S$IV-B. We discuss the operator’s profit/deficit
redistribution in $\S$IV-C and $\S$IV-E. Lastly, in $\S$IV-D, we establish the
market equilibrium result.

###  IV-A Network-Aware Dynamic Pricing

The operator uses the renewable DG vector $\bm{g}$ to dynamically set the
price taking into account network constraints. That is, the dynamic price is
used to satisfy network constraints in a decentralized way by internalizing
them into prosumers’ private decisions.

###### Network-aware pricing policy 1

For every bus $i\in{\cal B}$, the pricing policy charges the prosumers based
on a two-part pricing

$\chi^{\ast}:\bm{g}\mapsto
C^{\chi^{\ast}}_{n}(z_{n})=\underbrace{\pi^{\ast}_{i}(\bm{g})}_{\text{ex-ante
price}}\cdot z_{n}-\underbrace{A_{n}^{\ast}}_{\text{ex-post
allocation}},\forall n\in{\cal N}_{i},$ (12)

where the ex-ante bus price $\pi^{\ast}_{i}(\bm{g})$ abides by a two-threshold
policy with thresholds

$\displaystyle\sigma_{1}(\bm{g})$ $\displaystyle=\sum_{i\in{\cal
B}}\sum_{n\in{\cal
N}_{i}}\bm{1}^{\top}{[\bm{f}_{n}(\bm{1}\chi_{i}^{+})]}_{\underline{\bm{d}}_{n}}^{\overline{\bm{d}}_{n}},$
(13) $\displaystyle\sigma_{2}(\bm{g})$ $\displaystyle=\sum_{i\in{\cal
B}}\sum_{n\in{\cal
N}_{i}}\bm{1}^{\top}{[\bm{f}_{n}(\bm{1}\chi_{i}^{-})]}_{\underline{\bm{d}}_{n}}^{\overline{\bm{d}}_{n}}\geq\sigma_{1}(\bm{g}),$

as

$\pi^{\ast}_{i}(\bm{g})=\begin{cases}\chi^{+}_{i}(\bm{g})&,G_{0}<\sigma_{1}(\bm{g})\\\
\chi^{z}_{i}(\bm{g})&,G_{0}\in[\sigma_{1}(\bm{g}),\sigma_{2}(\bm{g})]\\\
\chi^{-}_{i}(\bm{g})&,G_{0}>\sigma_{2}(\bm{g}),\end{cases}\quad$ (14)

and the price $\chi_{i}^{\kappa}$, where $\kappa:=\\{+,-,z\\}$, is given by

$\chi_{i}^{\kappa}=\pi^{\kappa}-\sum_{j\in{\cal
B}}R_{ji}(\overline{\eta}^{\ast}_{j}-\underline{\eta}^{\ast}_{j})$ (15)

where $\overline{\eta}^{\ast}_{j}$ and $\underline{\eta}^{\ast}_{j}$ are the
dual variables of the upper and lower voltage limits in (11d), respectively,
and the price $\pi^{z}:=\mu^{\ast}$ is the solution of

$\sum_{i\in{\cal B}}\sum_{n\in{\cal
N}_{i}}\bm{1}^{\top}[\bm{f}_{n}(\bm{1}\mu-\bm{1}\sum_{j\in{\cal
B}}R_{ji}(\overline{\eta}^{\ast}_{j}-\underline{\eta}^{\ast}_{j}))]_{\underline{\bm{d}}_{n}}^{\overline{\bm{d}}_{n}}=G_{0}.$
(16)

For every bus $i\in{\cal B}$, the prosumer’s ex-post charge/reward is denoted
by $A_{n}^{\ast}$, which we delineate in $\S$IV-C and $\S$IV-E.

The pricing policy is a two-part and two-threshold one, with both thresholds
($\sigma_{1}(\bm{g}),\sigma_{2}(\bm{g})$) being DG-independent. The two policy
parts are composed of a locational dynamic price that is announced ex-ante and
a charge (reward) that is distributed ex-post.

The locational ex-ante price $\pi^{\ast}_{i}(\bm{g})$ for every $i\in{\cal B}$
is used as a mechanism to induce a collective prosumer response at each bus so
that the network constraints are satisfied and the energy sharing social
welfare is maximized. The energy sharing price has a similar structure to the
celebrated LMP in wholesale markets [21] in the sense that it takes into
account demand, generation, location, and network physical limits. Also, like
congestionless LMP, the energy sharing price is uniform across all buses if
the network constraints are nonbinding, as described in (15).

Similar to D-NEM without network constraints [3], the price obeys a two-
threshold policy and it is a monotonically decreasing function of the system’s
renewables $\bm{g}$. As shown in (15), the thresholds partition $G_{0}$ and
the price at each bus is the D-NEM price, adjusted by the shadow prices of
violating network voltage limits. When
$G_{0}\in[\sigma_{1}(\bm{g}),\sigma_{2}(\bm{g})]$ the community is energy
balanced, and the price $\chi^{z}_{i}(\bm{g})$ is the sum of the dual
variables for energy balance and network voltage limits.

The thresholds and locational prices can be computed while preserving
prosumers’ privacy. The operator do not need the functional form of prosumers’
utilities or marginal utilities but rather asks the prosumers to submit a
value for every device $k$ at a given price.

###  IV-B Optimal Prosumer Decisions

Given $\bm{g}$, and under every bus $i\in{\cal B}$, the ex-ante dynamic price
is announced and prosumers simultaneously move to solve their own surplus
maximization problem to determine their optimal decisions policy
$\psi^{\ast}_{n,\chi^{\ast}}:\mathbb{R}_{+}\rightarrow{\cal D}_{n},\
g_{n}\stackrel{{\scriptstyle{C^{\chi^{\ast}}_{n}}}}{{\mapsto}}\bm{d}_{n}^{\psi^{\ast}}:=\psi^{\ast}_{n}(g_{n}),\forall
n\in{\cal N}$. Therefore, from the surplus definition in (9), each prosumer
solves

$\displaystyle\bm{d}_{n}^{\psi^{\ast}}=$
$\displaystyle\underset{\bm{d}_{n}\in{\cal
D}_{n}}{\operatorname{argmax}}~{}~{}S_{n}^{\chi^{\ast}}(\bm{d}_{n},g_{n}):=U_{n}\left(\bm{d}_{n}\right)-\pi^{\ast}_{i}(\bm{g})\cdot
z_{n}$ $\displaystyle\text{subject to }\hskip
5.69046ptz_{n}=\bm{1}^{\top}\bm{d}_{n}-r_{n},$ (17)

where $A^{\ast}_{n}$ was omitted because it is announced after the consumption
decisions are performed. Lemma 1 formalizes the optimal consumption of each
prosumer.

######  Lemma 1 (Prosumer optimal consumption)

Under every bus $i\in{\cal B}$, given the pricing policy $\chi^{\ast}$, the
prosumer’s optimal consumption is

$\displaystyle\bm{d}^{\psi^{\ast}}_{n}(\pi^{\ast}_{i})=[\bm{f}_{n}(\bm{1}\pi^{\ast}_{i})]_{\underline{\bm{d}}_{n}}^{\overline{\bm{d}}_{n}},~{}~{}\forall
n\in{\cal N}_{i}.$ (18)

By definition, the aggregate net consumption is

$\displaystyle Z_{0}^{\psi^{\ast}}(\bm{\pi^{\ast}}(\bm{g}))$
$\displaystyle=\sum_{i\in{\cal B}}\sum_{n\in{\cal
N}_{i}}\begin{cases}\bm{d}^{\psi^{\ast}}_{n}(\chi^{+}_{i})-g_{n}&,G_{0}<\sigma_{1}(\bm{g})\\\
\bm{d}^{\psi^{\ast}}_{n}(\chi^{z}_{i})-g_{n}&,G_{0}\in[\sigma_{1}(\bm{g}),\sigma_{2}(\bm{g})]\\\
\bm{d}^{\psi^{\ast}}_{n}(\chi^{-}_{i})-g_{n}&,G_{0}>\sigma_{2}(\bm{g}),\end{cases}$
(19)

where $\bm{\pi^{\ast}}:=(\pi^{\ast}_{1},\ldots,\pi^{\ast}_{B})$, and
$Z_{0}^{\psi^{\ast}}(\bm{\pi^{\ast}}(\bm{g}))>0$ if
$G_{0}<\sigma_{1}(\bm{g})$, $Z_{0}^{\psi^{\ast}}(\bm{\pi^{\ast}}(\bm{g}))=0$
if $G_{0}\in[\sigma_{1}(\bm{g}),\sigma_{2}(\bm{g})]$, and
$Z_{0}^{\psi^{\ast}}(\bm{\pi^{\ast}}(\bm{g}))<0$ if
$G_{0}>\sigma_{2}(\bm{g})$.

###### Proof:

We drop the prosumer subscript $n$ for brevity. The objective in (17) is
concave and differentiable. The Lagrangian function of the surplus
maximization problem, for a prosumer under bus $i$, is

$\mathscr{L}(\bm{d},\overline{\bm{\gamma}},\underline{\bm{\gamma}})=\pi^{\ast}_{i}(\bm{g})\cdot
z-U\left(\bm{d}\right)+\overline{\bm{\gamma}}^{\top}(\bm{d}-\overline{\bm{d}})-\underline{\bm{\gamma}}^{\top}(\bm{d}-\underline{\bm{d}}),$

where $\overline{\bm{\gamma}}\in\mathbb{R}_{+}^{K}$ and
$\underline{\bm{\gamma}}\in\mathbb{R}_{+}^{K}$ are the Lagrangian multipliers
of the upper and lower consumption limits. From the KKT conditions we have

$\nabla_{\bm{d}}\mathscr{L}=\bm{1}\pi^{\ast}_{i}(\bm{g})-\bm{L}(\bm{d}^{\psi^{\ast}})+\overline{\bm{\gamma}}-\underline{\bm{\gamma}}=\bm{0},$

therefore, for each device $k\in{\cal K}$, we have

$\displaystyle d_{k}^{\psi^{\ast}}$
$\displaystyle=\begin{cases}f_{k}(\pi^{\ast}_{i})&,\overline{\gamma}_{k}=\underline{\gamma}_{k}=0\\\
\overline{d}_{k}&,\overline{\gamma}_{k}>0,\underline{\gamma}_{k}=0\\\
\underline{d}_{k}&,\overline{\gamma}_{k}=0,\underline{\gamma}_{k}>0\end{cases}$
$\displaystyle=:[f_{k}(\pi^{\ast}_{i})]_{\underline{d}_{k}}^{\overline{d}_{k}},$

where $f_{k}:=L^{-1}_{k}$.

Give the aggregate net consumption definition $Z_{0}=\sum_{n\in{\cal
N}}(\bm{1}^{\top}\bm{d}_{n}-g_{n})$ and the dynamic price in (14), one can
easily get (19). Finally, from (13), we can re-formulate (19) as

$\displaystyle Z_{0}^{\psi^{\ast}}(\bm{\pi^{\ast}}(\bm{g}))$
$\displaystyle=\begin{cases}\sigma_{1}(\bm{g})-G_{0}&,G_{0}<\sigma_{1}(\bm{g})\\\
0&,G_{0}\in[\sigma_{1}(\bm{g}),\sigma_{2}(\bm{g})]\\\
\sigma_{2}(\bm{g})-G_{0}&,G_{0}>\sigma_{2}(\bm{g}),\end{cases}$

which proves the sign of $Z_{0}^{\psi^{\ast}}(\bm{\pi^{\ast}}(\bm{g}))$ under
each piece. ∎

###  IV-C Ex-Post Allocation

Unlike the ex-ante price, the ex-post allocation is distributed after the
prosumers schedule their DER. The operator may choose to accrue the ex-post
charge amount of each prosumer to be distributed after multiple billing
periods rather than at every billing period. The ex-post fee is essentially
levied to compensate for the fact that the ex-ante volumetric charge is
insufficient to ensure profit neutrality. Indeed, using Def.1, we have

$\displaystyle\sum_{i\in{\cal B}}\sum_{n\in{\cal
N}_{i}}C^{\chi}_{n}(z_{n})-C^{\mbox{\tiny NEM}}(\sum_{n\in{\cal N}}z_{n})$
$\displaystyle=0\stackrel{{\scriptstyle\text{(\ref{eq:Pcommunity}),(\ref{eq:PricingPolicy})}}}{{\Longrightarrow}}$
$\displaystyle\sum_{i\in{\cal B}}\sum_{n\in{\cal
N}_{i}}(\pi^{\ast}_{i}(\bm{g})\cdot z_{n}-A^{\ast}_{n}-\pi^{\mbox{\tiny
NEM}}(Z_{0})\cdot z_{n})$ $\displaystyle=0$ $\displaystyle\sum_{i\in{\cal
B}}\sum_{n\in{\cal N}_{i}}(\pi^{\ast}_{i}(\bm{g})\cdot z_{n}-\pi^{\mbox{\tiny
NEM}}(Z_{0})\cdot z_{n})$ $\displaystyle=\sum_{i\in{\cal B}}\sum_{n\in{\cal
N}_{i}}A^{\ast}_{n}$ $\displaystyle\sum_{i\in{\cal B}}\sum_{n\in{\cal
N}_{i}}(\pi^{\ast}_{i}(\bm{g})-\pi^{\mbox{\tiny NEM}}(Z_{0}))\cdot z_{n}$
$\displaystyle=A^{\ast}(\bm{g}),$

where $A^{\ast}(\bm{g}):=\sum_{i\in{\cal B}}\sum_{n\in{\cal
N}_{i}}A^{\ast}_{n}$ is the profit/deficit that the operator accumulates after
the price is announced and the transaction with the DSO is settled. One can
see that the larger the price differential between the energy sharing price
and NEM price ($\delta_{i}:=\pi^{\ast}_{i}(\bm{g})-\pi^{\mbox{\tiny
NEM}}(Z_{0}),\forall i\in{\cal B}$), the larger the profit/deficit
$|A^{\ast}(\bm{g})|$. Note that if the network constraints are non-binding,
i.e., $\overline{\eta}^{\ast}_{i}=\underline{\eta}^{\ast}_{i}=0,\forall
i\in{\cal B}$, then $A^{\ast}(\bm{g})=0$, and the pricing policy becomes one-
part; see D-NEM in [3].

There is no unique way to re-allocate the operator’s profit/deficit
$A^{\ast}(\bm{g})$. A profit-sharing coalitional game can be established to
fairly re-allocate the operator’s profit/deficit [22]. In $\S$IV-E, we propose
a proportional re-allocation rule that makes the payment function uniform for
all prosumers.

###  IV-D Stackelberg Equilibrium

Before we present the main market equilibrium theorem, we need the following
Lemma 2 that establishes the profit neutrality of the pricing policy under the
optimal prosumer response in Lemma 1.

###### Lemma 2

Under the solution $(\chi^{\ast},\psi^{\ast})$, the operator is profit-
neutral.

###### Proof:

The proof is straightforward. Using Def.1 under the pricing policy and the
prosumer response, we have

$\displaystyle\sum_{n\in{\cal
N}}C^{\chi^{\ast}}_{n}(z^{\psi^{\ast}}_{n})-C^{\mbox{\tiny
NEM}}(\sum_{n\in{\cal N}}z^{\psi^{\ast}}_{n})$ $\displaystyle=\sum_{i\in{\cal
B}}\sum_{n\in{\cal N}_{i}}(\pi^{\ast}_{i}\cdot
z^{\psi^{\ast}}_{n}-A_{n}^{\ast}-\pi^{\mbox{\tiny
NEM}}(Z_{0}^{\psi^{\ast}})\cdot z^{\psi^{\ast}}_{n})=0$
$\displaystyle=A^{\ast}(\bm{g})-\sum_{i\in{\cal B}}\sum_{n\in{\cal
N}_{i}}(\pi^{\ast}_{i}(\bm{g})\cdot z^{\psi^{\ast}}_{n}-\pi^{\mbox{\tiny
NEM}}(Z_{0}^{\psi^{\ast}})\cdot z^{\psi^{\ast}}_{n})=0$

where, for every $n\in{\cal N}$,
$z^{\psi^{\ast}}_{n}=\bm{1}^{\top}\bm{d}^{\psi^{\ast}}_{n}-g_{n}$. ∎

Given the prosumer response to the pricing policy in Lemma 1 and profit
neutrality in Lemma 2, it remains to show that the network-aware pricing
policy achieves a Nash equilibrium to the leader-follower game in $\$$III-C.

###### Theorem 1

The solution ($\chi^{\ast},\psi^{\ast}$) is a Stackelberg equilibrium that
also achieves social optimality, i.e.,

$\displaystyle(\bm{d}_{1}^{\psi^{\ast}},\ldots,\bm{d}_{N}^{\psi^{\ast}})=\underset{(\bm{d}_{1},\ldots,\bm{d}_{N})}{\rm
argmax}$ $\displaystyle~{}~{}\sum_{i\in{\cal B}}\sum_{n\in{\cal
N}_{i}}U_{n}(\bm{d}_{n})-C^{\mbox{\tiny NEM}}(Z_{0})$ subject to
$\displaystyle~{}~{}Z_{0}=\sum_{n\in{\cal
N}}\big{(}\bm{1}^{\top}\bm{d}_{n}-g_{n}\big{)}$ $\displaystyle\hskip
11.38092pt\bm{d}_{n}\in{\cal D}_{n}~{}\forall n\in{\cal N}$
$\displaystyle\hskip
11.38092pt\underline{\bm{v}}\preceq-\bm{R}\bm{Z}\preceq\overline{\bm{v}}.$

###### Proof:

See the appendix. ∎

The proof of Theorem 1 solves an upper bound of (11) that relaxes the profit-
neutrality constraint (11b).

###  IV-E Energy Sharing Payment Uniformity

We propose here a unique way to reallocate the operator’s profit/deficit
$A^{\ast}(\bm{g})$. For every bus $i\in{\cal B}$, the re-allocation to every
prosumer is given by

$A_{n}^{\ast}(\bm{g})=(\pi^{\ast}_{i}(\bm{g})-\pi^{\mbox{\tiny
NEM}}(Z_{0}))\cdot z_{n},\forall n\in{\cal N}_{i},$ (20)

which has three favourable features. First, it redistributes the
profit/deficit proportionally to the prosumers based on how far the price they
face from the DSO NEM price, which is basically how much they paid (got paid)
for voltage correction. Second, it makes prosumer payment functions
$C_{n}^{\chi^{\ast}}\forall n\in{\cal N}$ uniform. Indeed, plugging (20) into
(12) cancels out the locational dynamic price $\pi^{\ast}_{i}(\bm{g})$, and
yields a simple, uniform payment function that charges customers based on the
NEM price, i.e., for every bus $i\in{\cal B}$,

$C_{n}^{\chi^{\ast}}(z_{n})=\pi^{\mbox{\tiny NEM}}(Z_{0})\cdot z_{n},\forall
n\in{\cal N}_{i}.$

Third, unlike the computationally expensive coalitional-game-based profit
allocation schemes such as the Shapley value [23] and nucleolus [24], the
allocation rule in (20) is straightforward and directly links the allocation
to the energy sharing price and the prosumer’s net consumption. The
decentralization argument may not hold under the allocation in (20), as it
compensates prosumers explicitly based on their own net consumption, which may
influence their consumption decisions resulting in deviations from the
welfare-maximizing decisions. It might be, however, too difficult for
prosumers to anticipate if the operator performs the re-allocation at every
multiple billing periods rather than at every single billing period.

##  V Numerical Study

Figure 2: The IEEE 13-bus test feeder. Figure 3: Summary of the numerical
tests on the four considered scenarios. The lower panel reports the ex-ante
energy prices obtained after solving the energy sharing platform optimization
problem (11). The upper panel shows the cumulative power demand at each bus
obtained after the energy sharing operator dispatched the energy prices. The
middle panel reports the resulting bus voltage magnitudes.

Our network-aware market mechanism was validated on the IEEE 13-bus feeder
converted to a single-phase equivalent [25], see Figure 2. Bus 1 is the
substation and represents the network slack bus. Buses 2 to 13 instead host
twenty-three prosumers. For every $n\in{\cal N}$ was chosen to be the concave
and non-decreasing function

$U_{n}(d_{n})=\left\\{\begin{array}[]{ll}\alpha_{n}d_{n}-\frac{1}{2}\beta_{n}d_{n}^{2},&0\leq
d_{n}\leq\frac{\alpha_{n}}{\beta_{n}}\\\
\frac{\alpha_{n}^{2}}{2\beta_{n}},&d_{n}>\frac{\alpha_{n}}{\beta_{n}},\end{array}\right.$
(21)

where the parameters $\alpha_{n},\beta_{n}$ were learned and calibrated using
historical retail prices, consumptions and by assuming an elasticity of 0.21
taken from [26] (see appendix D in [20])333The retail prices were taken from
Data.AustinTexas.gov historical residential rates in Austin, TX. For the
demands, we used pre-2018 PecanStreet data for households in Austin, TX. The
minimum demand was set to ${\underline{\bm{d}}_{n}}=\bm{0}$ for every
$n\in{\cal N}$, whereas the maximum demands ${\overline{\bm{d}}_{n}}$ and the
DER generations were obtained using data from the PecanStreet dataset. We set
$\bm{v}_{\text{min}}=0.95$ p.u. and $\bm{v}_{\text{max}}=1.05$ p.u.

In our simulations, we considered four scenarios, described in the following,
that differ for the DER generation levels. For each scenario, we used the
exact AC power flow solver MATPOWER to obtain the bus voltages, whereas we
solved the optimization problems relying on the power flow equation
linearization (4). The results are shown in Figure 3.

_Scenario 1_ : the DER generation here is zero for each prosumer. Hence,
$G_{0}=0$ and $G_{0}<\sigma_{1}(\bm{g})$. The energy-sharing system is
importing energy. In this case, the energy sharing optimization problem
solutions are such that $\underline{\eta}^{\ast}_{j}\neq 0$, i.e., some
voltages are on the lower bound $\bm{v}_{\text{min}}$. The resulting prices
are in general higher than $\pi^{+}$.

_Scenario 2_ : the DER generation $G_{0}$ is non-zero but still not enough to
cover the demand, i.e., $G_{0}<\sigma_{1}(\bm{g})$. Hence, the energy-sharing
system is importing energy. However, the optimum demands are such that all the
voltages are within the desired bounds and the energy prices equal $\pi^{+}$.

_Scenario 3_ : the DER generation was further increased in this scenario and
$\sigma_{1}(\bm{g})\leq G_{0}\leq\sigma_{2}(\bm{g})$. That is, the energy-
sharing platform did not exchange active power with the external network. The
energy sharing platform optimization problem provides an energy price within
$\pi^{+}$ and $\pi^{-}$; voltage limits are satisfied at the optimal
consumption.

_Scenario 4_ : here, we increased the DER generations until
$G_{0}\geq\sigma_{2}(\bm{g})$. The platform exports power to the external
grid. The energy sharing platform optimization problem solution is such that
the voltages in some locations are exactly $\bm{v}_{\text{max}}$ and the
Lagrange multipliers vector $\overline{\eta}^{\ast}_{j}$ is different from
zero. The energy prices are smaller than $\pi^{-}$ and close to zero, i.e.,
consumption is incentivized to take full advantage of DER generation.

Some observations are in order. In general, we observe that increasing the DER
generation $G_{0}$ results in the decrease of energy prices. The energy prices
can in principle be bigger than $\pi^{+}$, see Scenario 1. This is to ensure
that the voltage constraints are satisfied by decreasing the power demand.
Finally, we note a slight difference between the true and the expected (i.e.,
the ones computed by the energy-sharing platform optimization problem) voltage
magnitudes. Indeed, we see that the voltages in Scenario 4 are all strictly
lower than $\bm{v}_{\text{max}}$ even though we obtained
$\overline{\eta}^{\ast}_{j}\neq 0$, see the middle panel of Figure 3. This can
be explained by the fact that (11) was solved relying on the linearized
equations (4) rather than on the true power flow equations. Note, however,
that using the true equation would result in a nonconvex energy sharing
optimization problem possibly displaying multiple local minima.

##  VI Conclusion

In this work, we propose a network-aware and welfare-maximizing market
mechanism for energy-sharing coalitions that aggregate small but ubiquitous
BTM DER downstream of a DSO’s revenue meter, charging the energy-sharing
systems using a generic NEM tariff. The proposed pricing policy has ex-ante
and ex-post pricing components. The ex-ante locational and threshold-based
price that decreases as the energy-sharing supply-to-demand ratio increases is
used to induce a collective prosumer reaction that decentrally maximizes
social welfare while being network-cognizant. On the other hand, the ex-post
charge is used to enforce the market operator’s profit-neutrality condition.
We show that the market mechanism achieves an equilibrium to the Stackelberg
game between the operator and its prosumers. We show that a unique
proportional rule to re-allocate the operator’s profit/deficit can make the
payment function of all energy-sharing prosumers uniform, even when the
network constraints are binding. Our simulation results leverage real DER data
on an IEEE 13-bus test feeder system to show how the dynamic pricing drives
the energy sharing’s flexible consumption to abide by the network voltage
limits.

##  VII Acknowledgment

The work of Ahmed S. Alahmed and Lang Tong was supported in part by the
National Science Foundation under Award 2218110 and and the Power Systems
Engineering Research Center (PSERC) under Research Project M-46. This work was
authored in part by the National Renewable Energy Laboratory, operated by
Alliance for Sustainable Energy, LLC, for the U.S. Department of Energy (DOE)
under Contract No. DE-AC36-08GO28308. Funding is provided by the U.S.
Department of Energy Office of Energy Efficiency and Renewable Energy Building
Technologies Office, United States. The views expressed in the article do not
necessarily represent the views of the DOE or the U.S. Government. The U.S.
Government retains and the publisher, by accepting the article for
publication, acknowledges that the U.S. Government retains a nonexclusive,
paid-up, irrevocable, worldwide license to publish or reproduce the published
form of this work, or allow others to do so, for U.S. Government purposes.

## References

  * [1] P. De Martini, L. Gallagher, E. Takayesu, R. Hanley, and P. Henneaux, “Unlocking consumer der potential: Consumer-centric approaches for grid services,” _IEEE Power and Energy Magazine_ , vol. 20, no. 4, pp. 76–84, 2022.
  * [2] L. Han, T. Morstyn, and M. McCulloch, “Incentivizing prosumer coalitions with energy management using cooperative game theory,” _IEEE Trans. Power Systems_ , vol. 34, no. 1, 2019.
  * [3] A. S. Alahmed and L. Tong, “Dynamic net metering for energy communities,” _IEEE Transactions on Energy Markets, Policy and Regulation_ , pp. 1–12, 2024.
  * [4] P. Chakraborty, E. Baeyens, P. P. Khargonekar, K. Poolla, and P. Varaiya, “Analysis of solar energy aggregation under various billing mechanisms,” _IEEE Trans. Smart Grid_ , vol. 10, no. 4, 2019.
  * [5] Y. Yang, G. Hu, and C. J. Spanos, “Optimal sharing and fair cost allocation of community energy storage,” _IEEE Trans. Smart Grid_ , vol. 12, no. 5, Sep. 2021.
  * [6] Y. Chen, S. Mei, F. Zhou, S. H. Low, W. Wei, and F. Liu, “An Energy Sharing Game with Generalized Demand Bidding: Model and Properties,” _IEEE Transactions on Smart Grid_ , vol. 11, no. 3, pp. 2055–2066, 2020.
  * [7] N. Vespermann, T. Hamacher, and J. Kazempour, “Access economy for storage in energy communities,” _IEEE Transactions on Power Systems_ , vol. 36, no. 3, pp. 2234–2250, 2021.
  * [8] A. Fleischhacker, C. Corinaldesi, G. Lettner, H. Auer, and A. Botterud, “Stabilizing energy communities through energy pricing or PV expansion,” _IEEE Transactions on Smart Grid_ , vol. 13, no. 1, pp. 728–737, 2022.
  * [9] M. I. Azim, G. Lankeshwara, W. Tushar, R. Sharma, M. R. Alam, T. K. Saha, M. Khorasany, and R. Razzaghi, “Dynamic operating envelope-enabled p2p trading to maximize financial returns of prosumers,” _IEEE Transactions on Smart Grid_ , vol. 15, no. 2, pp. 1978–1990, 2024.
  * [10] A. S. Alahmed, G. Cavraro, A. Bernstein, and L. Tong, “Operating-envelopes-aware decentralized welfare maximization for energy communities,” in _2023 59th Annual Allerton Conference on Communication, Control, and Computing (Allerton)_ , 2023, pp. 1–8.
  * [11] Y. Chen, C. Zhao, S. H. Low, and A. Wierman, “An energy sharing mechanism considering network constraints and market power limitation,” _IEEE Transactions on Smart Grid_ , vol. 14, no. 2, pp. 1027–1041, 2023.
  * [12] C. P. Mediwaththe and L. Blackhall, “Network-Aware Demand-Side Management Framework with A Community Energy Storage System Considering Voltage Constraints,” _IEEE Transactions on Power Systems_ , vol. 36, no. 2, pp. 1229–1238, 2021.
  * [13] N. Li, “A market mechanism for electric distribution networks,” _Proceedings of the IEEE Conference on Decision and Control_ , vol. 54rd IEEE, no. IEEE CDC, pp. 2276–2282, 2015.
  * [14] L. Bai, J. Wang, C. Wang, C. Chen, and F. Li, “Distribution locational marginal pricing (dlmp) for congestion management and voltage support,” _IEEE Transactions on Power Systems_ , vol. 33, no. 4, pp. 4061–4073, 2018.
  * [15] A. Papavasiliou, “Analysis of distribution locational marginal prices,” _IEEE Transactions on Smart Grid_ , vol. 9, no. 5, pp. 4872–4882, 2018.
  * [16] J. Bonbright, A. Danielsen, D. Kamerschen, and J. Legler, _Principles of Public Utility Rates_. Public Utilities Reports, 1988.
  * [17] M. Baran and F. Wu, “Optimal sizing of capacitors placed on a radial distribution system,” _IEEE Transactions on Power Delivery_ , vol. 4, no. 1, pp. 735–743, 1989.
  * [18] ——, “Network reconfiguration in distribution systems for loss reduction and load balancing,” _IEEE Transactions on Power Delivery_ , vol. 4, no. 2, pp. 1401–1407, 1989.
  * [19] A. S. Alahmed and L. Tong, “On net energy metering X: Optimal prosumer decisions, social welfare, and cross-subsidies,” _IEEE Trans. Smart Grid_ , vol. 14, no. 02, 2023.
  * [20] ——, “Integrating distributed energy resources: Optimal prosumer decisions and impacts of net metering tariffs,” _SIGENERGY Energy Inform. Rev._ , vol. 2, no. 2, Aug. 2022.
  * [21] F. Schweppe, M. Caramanis, R. Tabors, and R. Bohn, _Spot Pricing of Electricity_. Springer US, 1988.
  * [22] H. Moulin, _Axioms of Cooperative Decision Making_ , ser. Econometric Society Monographs. Cambridge University Press, 1988.
  * [23] L. S. Shapley and M. Shubik, _Game Theory in Economics: Chapter 6, Characteristic Function, Core, and Stable Set_. RAND, 1973.
  * [24] D. Schmeidler, “The nucleolus of a characteristic function game,” _SIAM Journal on Applied Mathematics_ , vol. 17, no. 6, pp. 1163–1170, 1969. [Online]. Available: http://www.jstor.org/stable/2099196
  * [25] G. Cavraro and V. Kekatos, “Inverter probing for power distribution network topology processing,” _IEEE Transactions on Control of Network Systems_ , vol. 6, no. 3, pp. 980–992, 2019.
  * [26] A. Asadinejad, A. Rahimpour, K. Tomsovic, H. Qi, and C. fei Chen, “Evaluation of residential customer elasticity for incentive based demand response programs,” _Electric Power Systems Research_ , 2018.

[Incorporating Operating Envelopes] Here, we present the pricing policy under
OEs at the prosumer’s revenue meter, as shown in Fig.1.

OEs limit the net consumption of every prosumer $n\in{\cal N}$, as

$z_{n}\in\mathcal{Z}_{n}:=[\underline{z}_{n},\overline{z}_{n}],$ (22)

where $\underline{z}_{n}\leq 0$ and $\overline{z}_{n}\geq 0$ are the export
and import envelopes at the prosumers’ meters, respectively. From the analysis
in [10], the network-aware pricing policy generalizes as in the following
policy.

###### Network-aware pricing policy 2

For every bus $i\in{\cal B}$, the pricing policy charges the prosumers based
on a two-part pricing

$\chi^{\ast}:\bm{g}\mapsto
C^{\chi^{\ast}}_{n}(z_{n})=\underbrace{\pi^{\ast}_{i}(\bm{g})}_{\text{ex-ante
price}}\cdot z_{n}-\underbrace{A_{n}^{\ast}}_{\text{ex-post
allocation}},\forall n\in{\cal N}_{i},$

where the ex-ante bus price $\pi^{\ast}_{i}(\bm{g})$ abides by a two-threshold
policy with thresholds

$\displaystyle\sigma_{1}(\bm{g})$ $\displaystyle=\sum_{i\in{\cal
B}}\sum_{n\in{\cal
N}_{i}}\left[\bm{1}^{\top}{[\bm{f}_{n}(\bm{1}\chi_{i}^{+})]}_{\underline{\bm{d}}_{n}}^{\overline{\bm{d}}_{n}}\right]^{\overline{z}_{n}+g_{n}}_{\underline{z}_{n}+g_{n}},$
$\displaystyle\sigma_{2}(\bm{g})$ $\displaystyle=\sum_{i\in{\cal
B}}\sum_{n\in{\cal
N}_{i}}\left[\bm{1}^{\top}{[\bm{f}_{n}(\bm{1}\chi_{i}^{-})]}_{\underline{\bm{d}}_{n}}^{\overline{\bm{d}}_{n}}\right]^{\overline{z}_{n}+g_{n}}_{\underline{z}_{n}+g_{n}}\geq\sigma_{1}(\bm{g}),$

as

$\pi^{\ast}_{i}(\bm{g})=\begin{cases}\chi^{+}_{i}(\bm{g})&,G_{0}<\sigma_{1}(\bm{g})\\\
\chi^{z}_{i}(\bm{g})&,G_{0}\in[\sigma_{1}(\bm{g}),\sigma_{2}(\bm{g})]\\\
\chi^{-}_{i}(\bm{g})&,G_{0}>\sigma_{2}(\bm{g}),\end{cases}\quad$ (23)

and the price $\chi_{i}^{\kappa}$, where $\kappa:=\\{+,-,z\\}$, is given by

$\chi_{i}^{\kappa}=\pi^{\kappa}-\sum_{j\in{\cal
B}}R_{ji}(\overline{\eta}^{\ast}_{j}-\underline{\eta}^{\ast}_{j})$ (24)

where $\overline{\eta}^{\ast}_{j}$ and $\underline{\eta}^{\ast}_{j}$ are the
dual variables of the upper and lower voltage limits in (11d), respectively,
and the price $\pi^{z}:=\mu^{\ast}$ is the solution of

$\sum_{i\in{\cal B}}\sum_{n\in{\cal
N}_{i}}\left[\bm{1}^{\top}[\bm{f}_{n}(\bm{1}\mu-\bm{1}\sum_{j\in{\cal
B}}R_{ji}(\overline{\eta}^{\ast}_{j}-\underline{\eta}^{\ast}_{j}))]_{\underline{\bm{d}}_{n}}^{\overline{\bm{d}}_{n}}\right]^{\overline{z}_{n}+g_{n}}_{\underline{z}_{n}+g_{n}}=G_{0}.$

For every bus $i\in{\cal B}$, the prosumer’s ex-post charge/reward is denoted
by $A_{n}^{\ast}$, which we delineate in $\S$IV-C and $\S$IV-E.

[Mathematical Proofs]

###  -A Lemma 3 and Proof of Lemma 3

######  Lemma 3 (Maximum welfare under centralized operation)

The maximum welfare under centralized operation, that solves

$\displaystyle W^{\ast}(g):=\underset{(\bm{d}_{1},\ldots,\bm{d}_{N})}{\rm
maximize}$ $\displaystyle~{}~{}\sum_{i\in{\cal B}}\sum_{n\in{\cal
N}_{i}}U_{n}(\bm{d}_{n})-C^{\mbox{\tiny NEM}}(Z_{0})$ subject to
$\displaystyle~{}~{}Z_{0}=\sum_{n\in{\cal
N}}\big{(}\bm{1}^{\top}\bm{d}_{n}-g_{n}\big{)}$ (25) $\displaystyle\hskip
11.38092pt\bm{d}_{n}\in{\cal D}_{n}~{}\forall n\in{\cal N}$
$\displaystyle(\underline{\bm{\eta}},\overline{\bm{\eta}}):$
$\displaystyle\hskip
11.38092pt\underline{\bm{v}}\preceq-\bm{R}\bm{Z}\preceq\overline{\bm{v}}.$

obeys by two-thresholds as

$\displaystyle W^{\ast}(\bm{g})$ $\displaystyle=\sum_{i\in{\cal
B}}\sum_{n\in{\cal N}_{i}}$
$\displaystyle\begin{cases}U_{n}(\bm{d}^{+}_{n}(\bm{g}))-\pi^{+}(\bm{1}^{\top}\bm{d}^{+}_{n}(\bm{g})-g_{n})&,G_{0}<\sigma_{1}(\bm{g})\\\
U_{n}(\bm{d}^{z}_{n}(\bm{g}))&,G_{0}\in[\sigma_{1}(\bm{g}),\sigma_{2}(\bm{g})]\\\
U_{n}(\bm{d}^{-}_{n}(\bm{g}))-\pi^{-}(\bm{1}^{\top}\bm{d}^{-}_{n}(\bm{g})-g_{n})&,G_{0}>\sigma_{2}(\bm{g}),\end{cases}$

where the thresholds ($\sigma_{1}(\bm{g}),\sigma_{2}(\bm{g})$) are as in (13),
the consumption $\bm{d}^{\kappa}_{n}(\bm{g}),\forall n\in{\cal N}$ and
$\kappa:=\\{+,-,z\\}$, is

$\displaystyle\bm{d}^{\kappa}_{n}(\bm{g}):=[\bm{f}_{n}(\bm{1}\pi^{\kappa}-\bm{1}\sum_{j\in{\cal
B}}R_{ji}(\overline{\eta}^{\ast}_{j}-\underline{\eta}^{\ast}_{j}))]_{\underline{\bm{d}}_{n}}^{\overline{\bm{d}}_{n}},\forall
n\in{\cal N}_{i},$

and $\overline{\eta}^{\ast}_{i},\underline{\eta}^{\ast}_{i}\geq 0,\forall
i\in{\cal B}$ is from the KKT conditions in (27)-(28).

### Proof of Lemma 3

The convex non-differentiable program in (25) is a generalization to the
standalone consumer decision problem under the DSO’s NEM X regime in [19] with
(1) the additional dimension of $N$ users located at $B$ buses and (2) the
network constraints. Therefore, (25) can be divided into three convex and
differentiable programs based on the energy sharing net consumption $Z_{0}$,
namely (${\cal P}_{Z_{0}\geq 0},{\cal P}_{Z_{0}=0},{\cal P}_{Z_{0}\leq 0}$),
as

$\displaystyle{\cal P}_{Z_{0}\geq
0}:\underset{(\bm{d}_{1},\ldots,\bm{d}_{N})}{\rm maximize}$
$\displaystyle~{}~{}\sum_{i\in{\cal B}}\sum_{n\in{\cal
N}_{i}}U_{n}(\bm{d}_{n})-\pi^{+}\cdot Z_{0}$ subject to
$\displaystyle~{}~{}Z_{0}\geq 0$ $\displaystyle\hskip
11.38092pt\bm{d}_{n}\in{\cal D}_{n}~{}\forall n\in{\cal N}$
$\displaystyle(\underline{\bm{\eta}},\overline{\bm{\eta}}):$
$\displaystyle\hskip
11.38092pt\underline{\bm{v}}\preceq-\bm{R}\bm{Z}\preceq\overline{\bm{v}}.$
$\displaystyle{\cal P}_{Z_{0}=0}:\underset{(\bm{d}_{1},\ldots,\bm{d}_{N})}{\rm
maximize}$ $\displaystyle~{}~{}\sum_{i\in{\cal B}}\sum_{n\in{\cal
N}_{i}}U_{n}(\bm{d}_{n})\hskip 43.53267pt$ subject to
$\displaystyle~{}~{}Z_{0}=0$ $\displaystyle\hskip 11.38092pt\bm{d}_{n}\in{\cal
D}_{n}~{}\forall n\in{\cal N}$
$\displaystyle(\underline{\bm{\eta}},\overline{\bm{\eta}}):$
$\displaystyle\hskip
11.38092pt\underline{\bm{v}}\preceq-\bm{R}\bm{Z}\preceq\overline{\bm{v}}.$
$\displaystyle{\cal P}_{Z_{0}\leq
0}:\underset{(\bm{d}_{1},\ldots,\bm{d}_{N})}{\rm maximize}$
$\displaystyle~{}~{}\sum_{i\in{\cal B}}\sum_{n\in{\cal
N}_{i}}U_{n}(\bm{d}_{n})-\pi^{-}\cdot Z_{0}$ subject to
$\displaystyle~{}~{}Z_{0}\leq 0$ $\displaystyle\hskip
11.38092pt\bm{d}_{n}\in{\cal D}_{n}~{}\forall n\in{\cal N}$
$\displaystyle(\underline{\bm{\eta}},\overline{\bm{\eta}}):$
$\displaystyle\hskip
11.38092pt\underline{\bm{v}}\preceq-\bm{R}\bm{Z}\preceq\overline{\bm{v}}.$

It has been shown in [19] that the optimal consumption policy is a two-
thresholds policy on the aggregate renewables $G_{0}$. The three problems
above are generalizations of [19] that incorporate multiple prosumers and
buses dimension and network constraints dimension, which therefore yields, for
every bus $i\in{\cal B}$, the following optimal consumption vector

$\bm{d}^{\ast}_{n}(\bm{g})=\begin{cases}\bm{d}^{+}_{n}(\bm{g})&,G_{0}<\sigma_{1}(\bm{g})\\\
\bm{d}^{z}_{n}(\bm{g})&,G_{0}\in[\sigma_{1}(\bm{g}),\sigma_{2}(\bm{g})]\\\
\bm{d}^{-}_{n}(\bm{g})&,G_{0}>\sigma_{2}(\bm{g}),\end{cases},\quad\forall
n\in{\cal N}_{i},$

where the thresholds ($\sigma_{1}(\bm{g}),\sigma_{2}(\bm{g})$) are as in (13)
and the vector $\bm{d}^{\kappa}_{n}(\bm{g})$, where $\kappa:=\\{+,-,z\\}$, is
given by

$\displaystyle\bm{d}^{\kappa}_{n}(\bm{g}):=[\bm{f}_{n}(\bm{1}\pi^{\kappa}-\bm{1}\sum_{j\in{\cal
B}}R_{ji}(\overline{\eta}^{\ast}_{j}-\underline{\eta}^{\ast}_{j}))]_{\underline{\bm{d}}_{n}}^{\overline{\bm{d}}_{n}},\forall
n\in{\cal N}_{i}.$ (26)

By generalizing the special case in [19] through incorporating the additional
dimension of $N$ users located at $B$ buses and the network constraints, one
can see that the price $\pi^{z}(\bm{g})$ is as in (16). Lastly, for every
$i\in{\cal B}$, the dual variable $\overline{\eta}^{\ast}_{i}\geq 0$ is
computed from the KKT conditions

$\displaystyle\overline{\eta}^{\ast}_{i}\left(-\sum_{j\in{\cal
B}}R_{ij}\sum_{k\in{\cal
N}_{j}}(\bm{1}^{\top}\bm{d}^{\kappa}_{n}(\bm{g})-g_{n})\right)$
$\displaystyle=0$ (27a) $\displaystyle-\sum_{j\in{\cal
B}}R_{ij}\sum_{k\in{\cal
N}_{j}}(\bm{1}^{\top}\bm{d}^{\kappa}_{n}(\bm{g})-g_{n})-\overline{v}_{i}$
$\displaystyle\leq 0$ (27b)

and $\underline{\eta}^{\ast}_{i}\geq 0$ is similarly computed from

$\displaystyle\underline{\eta}^{\ast}_{i}\left(-\sum_{j\in{\cal
B}}R_{ij}\sum_{k\in{\cal
N}_{j}}(\bm{1}^{\top}\bm{d}^{\kappa}_{n}(\bm{g})-g_{n})\right)$
$\displaystyle=0$ (28a) $\displaystyle-\sum_{j\in{\cal
B}}R_{ij}\sum_{k\in{\cal
N}_{j}}(\bm{1}^{\top}\bm{d}^{\kappa}_{n}(\bm{g})-g_{n})-\underline{v}_{i}$
$\displaystyle\geq 0$ (28b)

$\blacksquare$

###  -B Proof of Theorem 1

Recall the bi-level program of operator and prosumers decisions

$\displaystyle\underset{\bm{C}^{\chi}(\cdot)}{\operatorname{maximize}}$
$\displaystyle\Bigg{(}W^{\chi_{\bm{\psi}}}=\sum_{n\in{\cal
N}}U_{n}(\bm{d}^{\psi^{\sharp}_{\chi}}_{n})-C^{\mbox{\tiny
NEM}}(Z_{0}^{\psi^{\sharp}_{\chi}})\Bigg{)}$ (29a) subject to
$\displaystyle\quad\quad\sum_{n\in{\cal
N}}C^{\chi}_{n}(z_{n}^{\psi^{\sharp}_{\chi}})=C^{\mbox{\tiny
NEM}}(Z_{0}^{\psi^{\sharp}_{\chi}})$ (29b) $\displaystyle\quad\quad
Z_{0}^{\psi^{\sharp}_{\chi}}=\sum_{n\in{\cal
N}}\big{(}\bm{1}^{\top}\bm{d}^{\psi^{\sharp}_{\chi}}_{n}-g_{n}\big{)}$ (29c)
$\displaystyle(\underline{\bm{\eta}},\overline{\bm{\eta}})$
$\displaystyle\quad\quad\underline{\bm{v}}\preceq-\bm{R}\bm{Z}^{\psi^{\sharp}_{\chi}}\preceq\overline{\bm{v}}$
(29d) $\displaystyle\quad\quad\text{for all }i=1,\ldots,B,n\in{\cal N}_{i}$
(29e)
$\displaystyle\bm{d}^{\psi^{\sharp}_{\chi}}_{n}:=\underset{\bm{d}_{n}\in{\cal
D}_{n}}{\operatorname{argmax}}~{}S^{\chi}_{n}(\bm{d}_{n},g_{n}):=U_{n}(\bm{d}_{n})-C^{\chi}_{n}(z_{n})$
(29f) $\displaystyle\hskip 36.98866pt\text{subject
to}~{}~{}z_{n}=\bm{1}^{\top}\bm{d}_{n}-g_{n}.$ (29g)

We solve a relaxed version of (29) that does not require profit-neutrality,
hence (29b) is removed, and for every $n\in{\cal N}$, we want to find the
price $\pi_{n}$ in $\tilde{C}_{n}^{\chi}(\cdot)=\pi_{n}\cdot z_{n}$. So, (29)
is reformulated to

$\displaystyle\underset{\tilde{\bm{C}}^{\chi}(\cdot)}{\operatorname{maximize}}$
$\displaystyle\Bigg{(}W^{\chi_{\bm{\psi}}}=\sum_{n\in{\cal
N}}U_{n}(\bm{d}^{\psi^{\sharp}_{\chi}}_{n})-C^{\mbox{\tiny
NEM}}(Z_{0}^{\psi^{\sharp}_{\chi}})\Bigg{)}$ subject to
$\displaystyle\quad\quad Z_{0}^{\psi^{\sharp}_{\chi}}=\sum_{n\in{\cal
N}}\big{(}\bm{1}^{\top}\bm{d}^{\psi^{\sharp}_{\chi}}_{n}-g_{n}\big{)}$
$\displaystyle(\underline{\bm{\eta}},\overline{\bm{\eta}})$
$\displaystyle\quad\quad\underline{\bm{v}}\preceq-\bm{R}\bm{Z}^{\psi^{\sharp}_{\chi}}\preceq\overline{\bm{v}}$
$\displaystyle\quad\quad\text{for all }i=1,\ldots,B,n\in{\cal N}_{i}$
$\displaystyle~{}~{}~{}L_{kn}(d_{kn}^{\psi_{\chi}^{\sharp}})-\pi+\overline{\lambda}^{\ast}_{kn}-\underline{\lambda}^{\ast}_{kn}=0,~{}~{}\forall
k\in{\cal K}$ $\displaystyle\hskip
45.52458pt\overline{d}_{kn}-d_{kn}^{\psi_{\chi}^{\sharp}}\geq
0\perp\overline{\lambda}^{\ast}_{kn}\geq 0,~{}~{}\forall k\in{\cal K}$
$\displaystyle\hskip 66.86414ptd_{kn}^{\psi_{\chi}^{\sharp}}\geq
0\perp\underline{\lambda}^{\ast}_{kn}\geq 0,~{}~{}\forall k\in{\cal K}$

where $x\perp y$ means that $x$ and $y$ are perpendicular. From Lemma 1, the
lower level’s KKT conditions can be replaced as the following

$\displaystyle\underset{\tilde{\bm{C}}^{\chi}(\cdot)}{\operatorname{maximize}}$
$\displaystyle\Bigg{(}W^{\chi_{\bm{\psi}}}=\sum_{n\in{\cal
N}}U_{n}(\bm{d}^{\psi^{\sharp}_{\chi}}_{n})-C^{\mbox{\tiny
NEM}}(Z_{0}^{\psi^{\sharp}_{\chi}})\Bigg{)}$ subject to
$\displaystyle\quad\quad Z_{0}^{\psi^{\sharp}_{\chi}}=\sum_{n\in{\cal
N}}\big{(}\bm{1}^{\top}\bm{d}^{\psi^{\sharp}_{\chi}}_{n}-g_{n}\big{)}$
$\displaystyle(\underline{\bm{\eta}},\overline{\bm{\eta}})$
$\displaystyle\quad\quad\underline{\bm{v}}\preceq-\bm{R}\bm{Z}^{\psi^{\sharp}_{\chi}}\preceq\overline{\bm{v}}$
$\displaystyle\quad\quad\text{for all }i=1,\ldots,B,n\in{\cal N}_{i}$
$\displaystyle~{}~{}~{}\bm{d}^{\psi^{\sharp}_{\chi}}_{n}(\pi_{n})=[\bm{f}_{n}(\bm{1}\pi_{n})]_{\underline{\bm{d}}_{n}}^{\overline{\bm{d}}_{n}}.$

Note that if $\pi^{\ast}_{n}$ is found, we have equilibrium. The program above
is similar to the central program (25) in Lemma 3, but with the prices
$\pi_{n},\forall n\in{\cal N}$ as decision variables rather than the
consumptions $\bm{d}_{n},\forall n\in{\cal N}$. Therefore, the threshold
structure in Lemma 3 holds with the prices used to compute
$\bm{d}^{\ast}_{n},\forall n\in{\cal N}$ being the optimal prices. Therefore,
we have, for every bus $i\in{\cal B}$,

$\pi^{\ast}_{i}(\bm{g})=\begin{cases}\pi^{+}-\sum_{j\in{\cal
B}}R_{ji}(\overline{\eta}^{\ast}_{j}-\underline{\eta}^{\ast}_{j})&,G_{0}<\sigma_{1}(\bm{g})\\\
\pi^{z}(\bm{g})-\sum_{j\in{\cal
B}}R_{ji}(\overline{\eta}^{\ast}_{j}-\underline{\eta}^{\ast}_{j})&,G_{0}\in[\sigma_{1}(\bm{g}),\sigma_{2}(\bm{g})]\\\
\pi^{-}-\sum_{j\in{\cal
B}}R_{ji}(\overline{\eta}^{\ast}_{j}-\underline{\eta}^{\ast}_{j})&,G_{0}>\sigma_{2}(\bm{g}),\end{cases}\quad$

One can easily see from Lemma 1, that by plugging the equilibrium price
$\pi^{\ast}_{i}(\bm{g}),\forall i\in{\cal B}$, the prosumers’ optimal
consumption decisions match the consumption decisions under centralized
operation in Lemma 3.

Now, we note that for every bus $i\in{\cal B}$, the pricing policy
$\tilde{C}^{\chi^{\ast}}_{n}=\pi^{\ast}_{i}(\bm{g})\cdot z_{n},\forall
n\in{\cal N}_{i}$ does not achieve profit neutrality. Therefore, for every bus
$i\in{\cal B}$, the pricing policy is augmented by the ex-post allocation
$A^{\ast}_{n}$ to become $C^{\chi^{\ast}}_{n}=\pi^{\ast}_{i}(\bm{g})\cdot
z_{n}-A^{\ast}_{n},\forall n\in{\cal N}_{i}$ with $\sum_{i\in{\cal
B}}\sum_{n\in{\cal N}_{i}}A^{\ast}_{n}=\sum_{i\in{\cal B}}\sum_{n\in{\cal
N}_{i}}(\pi^{\ast}_{i}(\bm{g})-\pi^{\mbox{\tiny NEM}}(Z_{0}))\cdot z_{n}$.
Lemma 2 is then leveraged to show that $\bm{C}^{\chi^{\ast}}$ achieves profit
neutrality. $\blacksquare$