In this Section, the methodology and modeling approach are described. The framework of the study explained in Section 3.1 is followed by a detailed description of the optimization problem in Section 3.2. Data and assumptions are presented in Section 3.3, and Section 3.4 introduces the verification of the proposed modeling approach.
3.2 Mathematical formulation of the optimization problem
3.2.1 Willingness-to-pay of prosumers. Prosumers’ individual willingness-to-pay determines how PV generated electricity is distributed among community members. The baseline of the willingness-to-pay is the retail electricity price, , and an individual CO2-price, wj, is added on top that relates to the prosumer’s preference for reducing emissions from electricity consumption. In addition, there is also a preference, di,j ∈ [0, 1], to buy more locally (i.e., buying from a prosumer with the shortest electrical distance). The willingness-to-pay of prosumer j at time t to buy from prosumer i, wtpi,j,t , is as follows:
The emissions from the grid, et, are represented as a time series using the greenhouse gases emitted into the wider electricity system by the marginal power plant; hence, they are also known as marginal emissions. The local energy community is assumed to be a price taker in the wider electricity system.
3.2.2 Community welfare. In this work, the aim of peer-to-peer electricity trade is to maximize community welfare, which is defined in two parts. Part I of community welfare measures the optimal resource allocation at the community level, maximizing the community’s self-consumption as a whole. Part II optimally assigns PV generated electricity to each member in consideration of their individual willingness-to-pay; thus, part II represents peer-to-peer trading from one prosumer to another, . Community welfare (CW) is defined as following:
3.2.3 Prosumers’ cost-emission function. To evaluate the impact of new prosumers on original prosumers, the following functions are defined:
Equation (3) is the deviation of prosumer i’s annual costs within the new community set-up compared to the previous status quo. Similar to Eq. (3), Eq. (4) represents prosumer i’s annual emission increase or decrease. The cost-emission function CE is defined next.
Similar to Pareto-optimization, a weighting factor αi ∈ [0, 1] is introduced for each prosumer to choose individually. Therefore, αi determines whether more emphasis is placed on minimizing costs or emissions. By choosing an individual αi, prosumers can express either a cost-saving or an emission-saving preference. Due to the absolute values of costs and emissions in Eq. (3) and (4), each prosumer’s changes count equally. The cost-emission function CE is the objective to be minimized in the optimization problem.
The costs of each member i of the community over a certain period are calculated as following:
where 𝒯 is the respective time period. The emissions over a certain time are:
Only purchases from the grid are considered in the emissions calculations, because the production of PV electricity does not generate marginal emissions.
3.2.4 Bi-level optimization problem. This model solves two main problems: (i) selecting the optimal electricity demand and PV capacity of new prosumers to fulfill certain requirements set by original community members, and (ii) maximizing community welfare, given the new prosumers’ parameters selected in (i). Subsequently, this problem can be formulated as a bi-level problem, wherein the leader anticipates the follower’s reaction. In the upper-level problem, the leader, of the bi-level problem represents (i) and its lower level, the follower, (ii).
The leader minimizes the cost-emission function CE with the continuous decision variables loadi and PVi, and the binary decision variables bi, for all i ∈ ℐnew (see Eq. (8a)). The decision variables have lower and upper bounds to ensure a reasonable solution of the model (see Eqs. (8b) and (8c)). The set of variables
are the lower level primal decision variables. The dual variables of the lower level problem are for equality constraints, for inequalities, and for non-negativities. The objective function of the follower in Eq. (8e) maximizes community welfare. The equality constraints (8f)–(8i) ensure that prosumer i’s electricity demand and PV generation are covered at all times. The upper-level decision variables are included in Eq. (8h) and (8i) for new prosumers. The state of charge of prosumer i’s BESS is defined in Eqs. (8j) and (8k), and other battery constraints in (8l)–(8n). Non-negativity conditions are included in (8o).
subject to:
subject to:
with i, j ∈ ℐ and t ∈ 𝒯.
A very common approach to solving a bi-level optimization problem is the transformation to a mathematical program with equilibrium constraints (MPEC); see Ruiz et al.44. The lower level problem (Eqs. (8e)–(8o)) is reformulated by its corresponding Karush-Kuhn-Tucker (KKT) conditions, and can be classified as a mixed complementarity problem (MCP) or equilibrium problem, which is parameterized by the leader’s decision variables (Dempe and Kue45). The resulting optimization problem is single-level, and it is linear except for binary variables and complementarity constraints. The derivation of the KKT conditions is presented in detail in A. The resulting complementarity conditions are then transformed into a mixed integer linear program (MILP) using the Fortuny-Amat method (see A.3), also known as the "Big-M approach" (Fortuny-Amat and McCarl46, Fischetti et al.47, and Pineda et al.48).